Esempio n. 1
0
        public double SumRegion(PointTO point1, PointTO point2)
        {
            ICubePersistence persistence = PersistenceFactory.GetCubePersistence();

            //Point Validations
            ValidatePoint(point1);

            //Point Validations
            ValidatePoint(point2);

            return(persistence.SumRegion(point1, point2));
        }
Esempio n. 2
0
        public int GetDimensions()
        {
            ICubePersistence persistence = PersistenceFactory.GetCubePersistence();

            //Check response en return data accordingly
            int dimensions = persistence.GetDimensions();

            if (dimensions == 0)
            {
                dimensions = -1;
            }
            return(dimensions);
        }
Esempio n. 3
0
        public bool Update(PointTO point)
        {
            ICubePersistence persistence = PersistenceFactory.GetCubePersistence();

            //Point Validations
            ValidatePoint(point);

            //Check Value
            if (point.Value < Math.Pow(10, 9) * -1 || point.Value > Math.Pow(10, 9))
            {
                throw new Exception("Value is not allowed. -10^9 <= W <= 10^9");
            }

            return(persistence.Update(point));
        }
Esempio n. 4
0
        public bool Create(int dimensions)
        {
            ICubePersistence persistence = PersistenceFactory.GetCubePersistence();

            if (dimensions <= 0)
            {
                throw new Exception("Dimensions must be greater then Zero");
            }

            if (dimensions > 100)
            {
                throw new Exception("Maximum dimensions is 100");
            }

            return(persistence.Create(dimensions));
        }
Esempio n. 5
0
        private void ValidatePoint(PointTO point)
        {
            ICubePersistence persistence = PersistenceFactory.GetCubePersistence();
            int dimensions = persistence.GetDimensions();

            //Check Boundaries
            if (point.X <= 0 || point.Y <= 0 || point.Z <= 0)
            {
                throw new Exception("Cube is index 1, lower numbers are not allowed for x, y or z");
            }

            if (point.X > dimensions || point.Y > dimensions || point.Z > dimensions)
            {
                throw new Exception("Cube limits exceeded");
            }
        }
Esempio n. 6
0
        public List <PointTO> GetValues()
        {
            ICubePersistence persistence = PersistenceFactory.GetCubePersistence();

            return(persistence.GetValues());
        }