Click here to Skip to main content
12,350,035 members (25,473 online)
Click here to Skip to main content
Articles » Languages » C# » Applications » Downloads

Tagged as

Stats

109.1K views
9.7K downloads
161 bookmarked
Posted

The beauty of fractals - A simple fractal rendering program done in C#

, 27 Jul 2009 CPOL
A fractal rendering application demonstrating many .NET programming techniques.
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
 
namespace FracMaster
{
    
    public class ParameterSet : IFractalParameters
    {

        private List<Parameter> pars = new List<Parameter>();
       
        public IEnumerator GetEnumerator()
        {
            return pars.GetEnumerator(); 
        }
        
        public object Clone()
        {
            ParameterSet p = new ParameterSet();            
            foreach(Parameter px in pars)
            {
                p.AddValue(px.Name,px.Value);
            }
            return p;            
        }

        public object Current 
        {
            get
            {
                return pars.GetEnumerator().Current;
            }
        }

        public bool MoveNext()
        {
            return pars.GetEnumerator().MoveNext();
        }

        public void Reset()
        {
             
        }

        public bool HasValue(String name)
        {
            foreach (Parameter p in pars)
            {
                if (p.Name == name)
                {                    
                    return true;
                }
            }
            return false;
        }

        public void SetValue(String name, object value)
        {
            foreach (Parameter p in pars)
            {
                if (p.Name == name)
                {
                      p.Value = value;
                      return;
                }
            }
            AddValue(name, value);            
        }

        public object GetValue(String name)
        {
            foreach (Parameter p in pars)
            {
                if (p.Name == name)
                {
                    return p.Value;
                }
            }
            throw new ApplicationException("parameter '" + name + "' not found");
        }

        public object GetValue(String name, object defaultValue)
        {
            foreach (Parameter p in pars)
            {
                if (p.Name == name)
                {
                    return p.Value;
                }
            }
            return defaultValue;
        }

        public void AddValue(String name, object value)
        {
            foreach (Parameter p in pars)
            {
                if (p.Name == name)
                {
                    throw new ArgumentException("Paramter with that name already exists");
                }
            }

            pars.Add(new Parameter(name, value));
        }

         



    }


    
}

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)

Share

About the Author

Zimmermann Stephan
Software Developer (Senior)
Austria Austria
I have started programming at the age of 13 on the commodore 64.

Ever since then I have been programming on many systems in many languages.

During the last 12 years I have been working as professional programmer in different companies and different areas.

Now I am working as freelancer programmer / consultant

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160621.1 | Last Updated 27 Jul 2009
Article Copyright 2009 by Zimmermann Stephan
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid