/*======================================================================== Copyright (C) 2006 by Geir-Tore Lindsve, Torbjørn Meistad and Yngve Raudberget, hereby refered to as "the authors". All rights reserved Permission is hereby granted, without written agreement and without license or royalty fees, to use, reproduce, prepare derivative works, distribute, and display this software and its documentation for NONCOMMERCIAL RESEARCH AND EDUCATIONAL PURPOSES, provided that (1) the above copyright notice and the following two paragraphs appear in all copies of the source code and (2) redistributions, including without limitation binaries, reproduce these notices in the supporting documentation. IN NO EVENT SHALL THE AUTHORS, OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ========================================================================*/ using System; using System.Collections.Generic; using System.Text; namespace CLab.CSP { /// /// An abstract class used by classes representing types in the CSP part of CLab. /// The different possible "values", like strings for the enumeration type, or integers /// for the range type, are all encoded as ranges. All of the types must have an end point. /// public abstract class CSPType { private String typeName; private int end; /// /// Initializes a new instance of the class. /// /// Name of the type. /// The end value. public CSPType(String typeName, int end) { this.typeName = typeName; this.end = end; } /// /// Gets or sets the name of the type. /// /// The name of the type. public String TypeName { get { return typeName; } set { typeName = value; } } /// /// Gets or sets the end of the range. /// /// The end. public int End { get { return end; } set { end = value; } } /// /// Returns a constant from the enumeration, /// representing the current type. /// /// A constant from the enumeration. public abstract CPTypes TypeFormat(); /// /// Gets the string representation of an int within the range of a type. /// Has to be implemented by classes implmementing this abstract class. /// /// An integer representing a domain value. /// The string representation of the domain value. public abstract String GetStringRepOfDomainInt(int domainInt); /// /// Gets the int representation of the string representation of a domain value. /// Has to be implemented by classes implmementing this abstract class. /// /// The string representation of a domain value. /// The int representation of the domain value. public abstract int GetIntRepOfDomainString(String domainString); /// /// Returns a that represents the current . /// /// /// A that represents the current . /// public override string ToString() { return typeName; } } }