Commit 3db225be authored by Matthew Dawson's avatar Matthew Dawson
Browse files

Rename VariableTypeMarker to TypeMarker.

Similar to the VariableType to Type change, update VariableTypeMarker.
parent fcca6ee8
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ public enum BinaryOperation {
    BooleanAnd,
    BooleanOr;

    Collection<VariableTypeMarker> getInputTypeForOutput(VariableTypeMarker outputType) {
    Collection<TypeMarker> getInputTypeForOutput(TypeMarker outputType) {
        // Boolean inputs only work with a boolean input!
        if (this == BooleanAnd || this == BooleanOr || this == Implies || this == GreaterThen || this == GreaterThenEqual ||
                this == LessThen || this == LessThenEqual || this == Equals || this == NotEquals) {
@@ -50,12 +50,12 @@ public enum BinaryOperation {
            case GreaterThenEqual:
            case LessThen:
            case LessThenEqual:
                return Arrays.asList(new VariableTypeMarker[]{RealType.Type, FixedPointType.TypeMarker});
                return Arrays.asList(new TypeMarker[]{RealType.Type, FixedPointType.TypeMarker});
            case Equals:
            case NotEquals:
                return Arrays.asList(new VariableTypeMarker[]{RealType.Type, FixedPointType.TypeMarker, EnumerationType.TypeMarker});
                return Arrays.asList(new TypeMarker[]{RealType.Type, FixedPointType.TypeMarker, EnumerationType.TypeMarker});
        }
        return Arrays.asList(new VariableTypeMarker[]{outputType});
        return Arrays.asList(new TypeMarker[]{outputType});
    }

    public Type getOutputForInput(Type inputType) {
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ final public class EnumerationType extends Type {
    private final Set<String> m_values = new LinkedHashSet<String>();
    private final String m_name;

    public static class Marker implements VariableTypeMarker {
    public static class Marker implements TypeMarker {
        @Override
        public boolean isMarkerFor(Type m_type) {
            return m_type instanceof EnumerationType;
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public interface Expression {
     * @param requestedType The class of type requested.
     * @return The concrete type that will be used, or null if none can be found.
     */
    Type actualOutputTypeForRequestedOutput(VariableTypeMarker requestedType);
    Type actualOutputTypeForRequestedOutput(TypeMarker requestedType);

    /**
     * Returns a string representing this expression generated from the given generator.
+4 −4
Original line number Diff line number Diff line
@@ -26,9 +26,9 @@ public final class ExpressionBinaryOperation implements Expression, ExpressionWi
        m_rhs = expr;
    }

    private Type getInputTypeForOutput(VariableTypeMarker requestedType) {
        Collection<VariableTypeMarker> allowedInputTypes = m_op.getInputTypeForOutput(requestedType);
        for(VariableTypeMarker allowedType : allowedInputTypes) {
    private Type getInputTypeForOutput(TypeMarker requestedType) {
        Collection<TypeMarker> allowedInputTypes = m_op.getInputTypeForOutput(requestedType);
        for(TypeMarker allowedType : allowedInputTypes) {
            Type inputType = m_lhs.actualOutputTypeForRequestedOutput(allowedType);
            if(inputType != null &&
                    m_rhs.actualOutputTypeForRequestedOutput(inputType) != null) {
@@ -44,7 +44,7 @@ public final class ExpressionBinaryOperation implements Expression, ExpressionWi
    }

    @Override
    public Type actualOutputTypeForRequestedOutput(VariableTypeMarker requestedType) {
    public Type actualOutputTypeForRequestedOutput(TypeMarker requestedType) {
        Type inputType = getInputTypeForOutput(requestedType);
        if (inputType != null) {
            return m_op.getOutputForInput(inputType);
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ public final class ExpressionUnaryOperation implements Expression, ExpressionWit
    }

    @Override
    public Type actualOutputTypeForRequestedOutput(VariableTypeMarker requestedType) {
    public Type actualOutputTypeForRequestedOutput(TypeMarker requestedType) {
        return m_expr.actualOutputTypeForRequestedOutput(requestedType);
    }

Loading