Click here to Skip to main content
15,894,343 members
Articles / Programming Languages / C# 4.0

Grandiose projects 5. Audio support

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
3 Feb 2012CPOL8 min read 23.2K   2K   8  
Audio support for grandiose projects
using System;
using System.Collections.Generic;
using System.Text;

namespace CategoryTheory
{

    /// <summary>
    /// Exception of category theory
    /// </summary>
    public class CategoryException : Exception
    {
        /// <summary>
        /// Text of illegal source exception
        /// </summary>
        static public readonly string IllegalSource = "Illegal source";

        /// <summary>
        /// Text of illegal target exception
        /// </summary>
        static public readonly string IllegalTarget = "Illegal target";
  
        /// <summary>
        /// Text of illegal target exception
        /// </summary>
        static public readonly string IllegalObject = "Illegal object";

        /// <summary>
        /// Text of target - source coincidence
        /// </summary>
        static public readonly string TargetSourceCoincidence = "Target coincides with source";

        /// <summary>
        /// Text whether endpoints of two arrows do not coincide
        /// </summary>
        static public readonly string EndpointsOfTwoArrowsError = "Endpoints of arrows do not coincide";

        /// <summary>
        /// Text of direct product does not supported
        /// </summary>
        static public readonly string DirectProductNotSupported = "Category does not support direct products";

        /// <summary>
        /// Text of direct product does not supported
        /// </summary>
        static public readonly string DirectSumNotSupported = "Category does not support direct sums";

        /// <summary>
        /// Text of equalizer does not supported
        /// </summary>
        static public readonly string EqualizerNotSupported = "Category does not support equalizers";

        /// <summary>
        /// Text of equalizer does not supported
        /// </summary>
        static public readonly string CoequalizerNotSupported = "Category does not support coequalizers";

        /// <summary>
        /// Text of unique solution
        /// </summary>
        static public readonly string UniqueSolution = "The solution is unique";

        /// <summary>
        /// Text of unique solution
        /// </summary>
        static public readonly string MultipleSolution = "The solution is multiple";

        /// <summary>
        /// Text of unique solution
        /// </summary>
        static public readonly string NoSolution = "The solution does not exist";

        /// <summary>
        /// Noncommutative path text
        /// </summary>
        static public readonly string NonCommutativePath = "Diagram has noncommutative path";

        /// <summary>
        /// The "different sources" text
        /// </summary>
        static public readonly string DifferentSources = "Different sources";

        /// <summary>
        /// The "different targets" text
        /// </summary>
        static public readonly string DifferentTargets = "Different targets";

        /// <summary>
        /// Referential integrity error
        /// </summary>
        static public readonly string ReferentialIntegrity = "Object reference not set to an instance of an object.";

        /// <summary>
        /// Source already exists error
        /// </summary>
        static public readonly string SourceAlreadyExists = "Source already exists";

        /// <summary>
        /// Target already exists error
        /// </summary>
        static public readonly string TargetAlreadyExists = "Target already exists";


        /// <summary>
        /// Associated object
        /// </summary>
        private object o;

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="message">Exception messege</param>
        public CategoryException(string message)
            : base(message)
        {
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="message">Exception message</param>
        /// <param name="o">Associated object</param>
        public CategoryException(string message, object o)
            : this(message)
        {
            this.o = o;
        }


        /// <summary>
        /// Throws message in case of illegal source
        /// </summary>
        static public void ThrowIllegalSourceException()
        {
            throw new CategoryException(IllegalSource);
        }

        /// <summary>
        /// Throws message in case of illegal target
        /// </summary>
        static public void ThrowIllegalTargetException()
        {
            throw new CategoryException(IllegalTarget);
        }
 
        /// <summary>
        /// Throws message in case of illegal object
        /// </summary>
        static public void ThrowIllegalObjectException()
        {
            throw new CategoryException(IllegalObject);
        }

        /// <summary>
        /// Throws exception if endpoints of two arrows do not coincide
        /// </summary>
        /// <param name="x">First arrow</param>
        /// <param name="y">Second arrow</param>
        static public void ThrowEndpointsException(ICategoryArrow x, ICategoryArrow y)
        {
            if ((x.Source != y.Source) | (x.Target != y.Target))
            {
                throw new CategoryException(EndpointsOfTwoArrowsError);
            }
        }


        /// <summary>
        /// Throws message in case of illegal target
        /// </summary>
        static public void ThrowSourceTargetCoincidenceException()
        {
            throw new CategoryException(TargetSourceCoincidence);
        }

        /// <summary>
        /// Throws message in case of illegal target
        /// </summary>
        static public void ThrowSourceExistsException()
        {
            throw new CategoryException(SourceAlreadyExists);
        }

        /// <summary>
        /// Throws message in case of illegal target
        /// </summary>
        static public void ThrowTargetExistsException()
        {
            throw new CategoryException(TargetAlreadyExists);
        }

        /// <summary>
        /// Associated object
        /// </summary>
        public object Object
        {
            get
            {
                return o;
            }
        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
Russian Federation Russian Federation
Ph. D. Petr Ivankov worked as scientific researcher at Russian Mission Control Centre since 1978 up to 2000. Now he is engaged by Aviation training simulators http://dinamika-avia.com/ . His additional interests are:

1) Noncommutative geometry

http://front.math.ucdavis.edu/author/P.Ivankov

2) Literary work (Russian only)

http://zhurnal.lib.ru/editors/3/3d_m/

3) Scientific articles
http://arxiv.org/find/all/1/au:+Ivankov_Petr/0/1/0/all/0/1

Comments and Discussions