src/main/java/org/cyclops/integrateddynamics/core/evaluate/OperatorBuilders.java
public static OperatorBuilder.ITypeValidator createOperatorTypeValidator(final IValueType... expectedSubTypes) {
        final int subOperatorLength = expectedSubTypes.length;
        final L10NHelpers.UnlocalizedString expected = new L10NHelpers.UnlocalizedString(
                org.cyclops.integrateddynamics.core.helper.Helpers.createPatternOfLength(subOperatorLength), ValueHelpers.from(expectedSubTypes));
        return (operator, input) -> {
            if (input.length == 0 || !ValueHelpers.correspondsTo(input[0], ValueTypes.OPERATOR)) {
                String givenName = input.length == 0 ? "null" : input[0].getTranslationKey();
                return new L10NHelpers.UnlocalizedString(L10NValues.VALUETYPE_ERROR_INVALIDOPERATOROPERATOR,
                        0, givenName);
            }
            if (input.length != subOperatorLength + 1) {
                IValueType[] operatorInputs = Arrays.copyOfRange(input, 1, input.length);
                L10NHelpers.UnlocalizedString given = new L10NHelpers.UnlocalizedString(
                        org.cyclops.integrateddynamics.core.helper.Helpers.createPatternOfLength(operatorInputs.length), ValueHelpers.from(operatorInputs));
                return new L10NHelpers.UnlocalizedString(L10NValues.VALUETYPE_ERROR_INVALIDOPERATORSIGNATURE,
                        expected, given);
            }
            return null;
        };
    }
/**
     * Create a type validator for operator operator type validators.
     * @param expectedSubTypes The expected types that must be present in the operator (not including the first
     *                         operator type itself.
     * @return The type validator instance.
     */
Create a type validator for operator operator type validators.
@param expectedSubTypes The expected types that must be present in the operator (not including the first
operator type itself.
@return The type validator instance.
Create a type validator for operator operator type validators . @param expectedSubTypes The expected types that must be present in the operator ( not including the first operator type itself . @return The type validator instance .
public static OperatorBuilder.ITypeValidator createOperatorTypeValidator(final IValueType... expectedSubTypes) {
        final int subOperatorLength = expectedSubTypes.length;
        final L10NHelpers.UnlocalizedString expected = new L10NHelpers.UnlocalizedString(
                org.cyclops.integrateddynamics.core.helper.Helpers.createPatternOfLength(subOperatorLength), ValueHelpers.from(expectedSubTypes));
        return (operator, input) -> {
            if (input.length == 0 || !ValueHelpers.correspondsTo(input[0], ValueTypes.OPERATOR)) {
                String givenName = input.length == 0 ? "null" : input[0].getTranslationKey();
                return new L10NHelpers.UnlocalizedString(L10NValues.VALUETYPE_ERROR_INVALIDOPERATOROPERATOR,
                        0, givenName);
            }
            if (input.length != subOperatorLength + 1) {
                IValueType[] operatorInputs = Arrays.copyOfRange(input, 1, input.length);
                L10NHelpers.UnlocalizedString given = new L10NHelpers.UnlocalizedString(
                        org.cyclops.integrateddynamics.core.helper.Helpers.createPatternOfLength(operatorInputs.length), ValueHelpers.from(operatorInputs));
                return new L10NHelpers.UnlocalizedString(L10NValues.VALUETYPE_ERROR_INVALIDOPERATORSIGNATURE,
                        expected, given);
            }
            return null;
        };
    }
public static OperatorBuilder . ITypeValidator createOperatorTypeValidator ( final IValueType ... expectedSubTypes ) { final int subOperatorLength = expectedSubTypes . length ; final L10NHelpers . UnlocalizedString expected = new L10NHelpers . UnlocalizedString ( org . cyclops . integrateddynamics . core . helper . Helpers . createPatternOfLength ( subOperatorLength ) , ValueHelpers . from ( expectedSubTypes ) ) ; return ( operator , input ) -> { if ( input . length == 0 || ! ValueHelpers . correspondsTo ( input [ 0 ] , ValueTypes . OPERATOR ) ) { String givenName = input . length == 0 ? "null" : input [ 0 ] . getTranslationKey ( ) ; return new L10NHelpers . UnlocalizedString ( L10NValues . VALUETYPE_ERROR_INVALIDOPERATOROPERATOR , 0 , givenName ) ; } if ( input . length != subOperatorLength + 1 ) { IValueType [ ] operatorInputs = Arrays . copyOfRange ( input , 1 , input . length ) ; L10NHelpers . UnlocalizedString given = new L10NHelpers . UnlocalizedString ( org . cyclops . integrateddynamics . core . helper . Helpers . createPatternOfLength ( operatorInputs . length ) , ValueHelpers . from ( operatorInputs ) ) ; return new L10NHelpers . UnlocalizedString ( L10NValues . VALUETYPE_ERROR_INVALIDOPERATORSIGNATURE , expected , given ) ; } return null ; } ; }
Create a type validator for operator operator type validators.
Create a type validator for operator operator type validators .