2
Cassowary.net: an incremental constraint solver for .NET
3
(http://lumumba.uhasselt.be/jo/projects/cassowary.net/)
5
Copyright (C) 2005 Jo Vermeulen (jo.vermeulen@uhasselt.be)
7
This program is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public License
9
as published by the Free Software Foundation; either version 2.1
10
of the License, or (at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU Lesser General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
using System.Collections;
26
public class ClVariable : ClAbstractVariable
28
public ClVariable(string name, double value) : base(name)
31
if (_ourVarMap != null) {
32
_ourVarMap.Add(name, this);
36
public ClVariable(string name) : base(name)
39
if (_ourVarMap != null)
41
_ourVarMap.Add(name, this);
45
public ClVariable(double value)
55
public ClVariable(long number, string prefix, double value) : base(number, prefix)
60
public ClVariable(long number, string prefix) : base(number, prefix)
65
public override bool IsDummy
70
public override bool IsExternal
75
public override bool IsPivotable
80
public override bool IsRestricted
85
public override string ToString()
87
return "[" + Name + ":" + _value + "]";
91
/// Change the value held -- should *not* use this if the variable is
92
/// in a solver -- instead use AddEditVar() and SuggestValue() interface
94
public /*sealed*/ double Value
96
get { return _value; }
97
set { _value = value; }
101
/// Permit overriding in subclasses in case something needs to be
102
/// done when the value is changed by the solver
103
/// may be called when the value hasn't actually changed -- just
104
/// means the solver is setting the external variable
106
public void ChangeValue(double value)
111
public object AttachedObject
113
get { return _attachedObject; }
114
set { _attachedObject = value; }
117
public static Hashtable VarMap
119
get { return _ourVarMap; }
120
set { _ourVarMap = value; }
123
private static Hashtable _ourVarMap;
124
private double _value;
125
private object _attachedObject;