Created
June 1, 2014 21:27
-
-
Save Fhernd/45b9c95648490ae30ded to your computer and use it in GitHub Desktop.
Estructura que representa la entidad `Punto` del modelo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ===++=== | |
// | |
// OrtizOL | |
// | |
// ===--=== | |
/*============================================================ | |
// | |
// Clase: Punto.cs | |
// | |
// Original en: http://goo.gl/wVys4z | |
// | |
// Propósito: Representar la entidad Rojo del modelo. | |
// | |
============================================================*/ | |
using System; | |
namespace ElTriangulo.Modelo | |
{ | |
/// <summary> | |
/// Estructura de punto. | |
/// </summary> | |
public struct Punto | |
{ | |
#region Campos | |
/// <summary> | |
/// Ordenada x. | |
/// </summary> | |
private double x; | |
/// <summary> | |
/// Coordenada y. | |
/// </summary> | |
private double y; | |
#endregion | |
#region Propiedades | |
/// <summary> | |
/// Accede y recupera la ordenada X. | |
/// </summary> | |
public double X | |
{ | |
get | |
{ | |
return x; | |
} | |
set | |
{ | |
if (value >= 0) | |
{ | |
x = value; | |
} | |
else | |
{ | |
x = 0; | |
} | |
} | |
} | |
/// <summary> | |
/// Accede y recupera la coordenada Y. | |
/// </summary> | |
public double Y | |
{ | |
get | |
{ | |
return y; | |
} | |
set | |
{ | |
if (value >= 0) | |
{ | |
y = value; | |
} | |
else | |
{ | |
y = 0; | |
} | |
} | |
} | |
#endregion | |
#region Constructor | |
/// <summary> | |
/// Inicializa una instancia de la estructura punto. | |
/// </summary> | |
/// <param name="x">Ordenada X del punto.</param> | |
/// <param name="y">Coordenada Y del punto.</param> | |
public Punto(double x, double y) | |
{ | |
this.x = x; | |
this.y = y; | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment