%

% Copyright 2017-2018 The MathWorks, Inc.
classdef (CaseInsensitiveProperties = true) SignalBase < xls.internal.ObjBase
    properties (Dependent, SetAccess = private)
        Complex (1,1) logical;
        StartColumn (1,1) int32;
        StopColumn (1,1) int32;
        Classification (1,1) xls.internal.SignalClassifications;
        Interpolation (1,1) xls.internal.Interpolations;
        Sync (1,1) xls.internal.Synchronizations;
        AbsTol (1,1) double;
        RelTol (1,1) double;
        LeadTol (1,1) double;
        LagTol (1,1) double;
    end

    properties (Abstract, Dependent, SetAccess = private)
        Name;
        Type;
        Unit;
    end

    methods (Abstract)
        validateDimensions(obj, busField);
        validateComplexity(obj, busField);
        bool = isExplicitBus(obj);
    end

    methods
        function obj = SignalBase(id)
            obj@xls.internal.ObjBase(id);
        end

        function ret = get.Complex(obj)
            ret = xls.internal.getSignalProperty(obj.id, 'Complex');
        end

        function ret = get.StartColumn(obj)
            ret = xls.internal.getSignalProperty(obj.id, 'StartColumn') + 1; % 1-indexed
        end

        function ret = get.StopColumn(obj)
            ret = xls.internal.getSignalProperty(obj.id, 'StopColumn') + 1; % 1-indexed
        end

        function ret = get.Classification(obj)
            ret = xls.internal.getSignalProperty(obj.id, 'Classification');
            ret = xls.internal.SignalClassifications(ret);
        end

        function ret = get.Interpolation(obj)
            ret = xls.internal.getSignalProperty(obj.id, 'Interpolation');
            ret = xls.internal.Interpolations(ret);
        end

        function ret = get.Sync(obj)
            ret = xls.internal.getSignalProperty(obj.id, 'Synchronization');
            ret = xls.internal.Synchronizations(ret);
        end

        function ret = get.AbsTol(obj)
            ret = xls.internal.getSignalProperty(obj.id, 'AbsTol');
        end

        function ret = get.RelTol(obj)
            ret = xls.internal.getSignalProperty(obj.id, 'RelTol');
        end

        function ret = get.LeadTol(obj)
            ret = xls.internal.getSignalProperty(obj.id, 'LeadTol');
        end

        function ret = get.LagTol(obj)
            ret = xls.internal.getSignalProperty(obj.id, 'LagTol');
        end

        splitDims = getSplitDimensions(obj);
        dims = getDimensions(obj);
        elem = getElement(obj);
    end
end
