-
Notifications
You must be signed in to change notification settings - Fork 9
/
ParameterProperty.m
executable file
·62 lines (46 loc) · 1.71 KB
/
ParameterProperty.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
% Describes protocol class parameters (properties in a protocol class).
%
% ProtocolParameter objects are obtained from the parameterProperty method of a protocol.
% Copyright (c) 2012 Howard Hughes Medical Institute.
% All rights reserved.
% Use is subject to Janelia Farm Research Campus Software Copyright 1.1 license terms.
% http://license.janelia.org/license/jfrc_copyright_1_1.html
classdef ParameterProperty < handle
properties (SetAccess = private)
meta
end
properties
defaultValue
description = ''
units = ''
end
methods
function obj = ParameterProperty(metaProperty)
if ~isa(metaProperty, 'meta.property')
error('metaProperty must be of class meta.property');
end
obj = obj@handle();
obj.meta = metaProperty;
end
function set.defaultValue(obj, value)
if obj.meta.Dependent
error('Cannot define the default value of a dependent parameter');
end
obj.defaultValue = value;
end
function value = get.defaultValue(obj)
value = [];
if ~isempty(obj.defaultValue)
value = obj.defaultValue;
elseif obj.meta.HasDefault
value = obj.meta.DefaultValue;
end
end
function set.description(obj, value)
if ~ischar(value)
error('description must be of class char');
end
obj.description = value;
end
end
end