Mostrando las entradas con la etiqueta Umbrello. Mostrar todas las entradas
Mostrando las entradas con la etiqueta Umbrello. Mostrar todas las entradas

lunes, 24 de octubre de 2011

Auto-generación de código

Para realizar la auto-generación de código de mi proyecto, hice el diagrama de clases utilizando la herramienta Umbrello.

El código auto-generado es el siguiente:

Clase Empleado
/**
* Class Empleado
*/
public class Empleado {

//
// Fields
//

private int no_empleado;
private String nom_empleado;
private int contraseña;

//
// Constructors
//
public Empleado () { };

//
// Methods
//


//
// Accessor methods
//

/**
* Set the value of no_empleado
* @param newVar the new value of no_empleado
*/
private void setNo_empleado ( int newVar ) {
no_empleado = newVar;
}

/**
* Get the value of no_empleado
* @return the value of no_empleado
*/
private int getNo_empleado ( ) {
return no_empleado;
}

/**
* Set the value of nom_empleado
* @param newVar the new value of nom_empleado
*/
private void setNom_empleado ( String newVar ) {
nom_empleado = newVar;
}

/**
* Get the value of nom_empleado
* @return the value of nom_empleado
*/
private String getNom_empleado ( ) {
return nom_empleado;
}

/**
* Set the value of contraseña
* @param newVar the new value of contraseña
*/
private void setContraseña ( int newVar ) {
contraseña = newVar;
}

/**
* Get the value of contraseña
* @return the value of contraseña
*/
private int getContraseña ( ) {
return contraseña;
}

//
// Other methods
//

/**
*/
public void entrar( )
{
}


/**
*/
public void consultar( )
{
}


}
Clase Cliente
/**
* Class Cliente
*/
public class Cliente {

//
// Fields
//

private int no_cliente;
private String nom_cliente;
private String colonia;
private String calle;
private int no_dir;
private int cp_dir;
private int tel_cliente;

//
// Constructors
//
public Cliente () { };

//
// Methods
//


//
// Accessor methods
//

/**
* Set the value of no_cliente
* @param newVar the new value of no_cliente
*/
private void setNo_cliente ( int newVar ) {
no_cliente = newVar;
}

/**
* Get the value of no_cliente
* @return the value of no_cliente
*/
private int getNo_cliente ( ) {
return no_cliente;
}

/**
* Set the value of nom_cliente
* @param newVar the new value of nom_cliente
*/
private void setNom_cliente ( String newVar ) {
nom_cliente = newVar;
}

/**
* Get the value of nom_cliente
* @return the value of nom_cliente
*/
private String getNom_cliente ( ) {
return nom_cliente;
}

/**
* Set the value of colonia
* @param newVar the new value of colonia
*/
private void setColonia ( String newVar ) {
colonia = newVar;
}

/**
* Get the value of colonia
* @return the value of colonia
*/
private String getColonia ( ) {
return colonia;
}

/**
* Set the value of calle
* @param newVar the new value of calle
*/
private void setCalle ( String newVar ) {
calle = newVar;
}

/**
* Get the value of calle
* @return the value of calle
*/
private String getCalle ( ) {
return calle;
}

/**
* Set the value of no_dir
* @param newVar the new value of no_dir
*/
private void setNo_dir ( int newVar ) {
no_dir = newVar;
}

/**
* Get the value of no_dir
* @return the value of no_dir
*/
private int getNo_dir ( ) {
return no_dir;
}

/**
* Set the value of cp_dir
* @param newVar the new value of cp_dir
*/
private void setCp_dir ( int newVar ) {
cp_dir = newVar;
}

/**
* Get the value of cp_dir
* @return the value of cp_dir
*/
private int getCp_dir ( ) {
return cp_dir;
}

/**
* Set the value of tel_cliente
* @param newVar the new value of tel_cliente
*/
private void setTel_cliente ( int newVar ) {
tel_cliente = newVar;
}

/**
* Get the value of tel_cliente
* @return the value of tel_cliente
*/
private int getTel_cliente ( ) {
return tel_cliente;
}

//
// Other methods
//

/**
*/
public void registrar( )
{
}


}
Clase Película
/**
* Class Pelicula
*/
public class Pelicula {

//
// Fields
//

private int no_pel;
private String titulo;
private String material;
private String situacion;
private String genero;
private String clasificacion;
private double costoVta;
private double costoRta;
private int cantpel_vta;
private int cantpel_rta;

//
// Constructors
//
public Pelicula () { };

//
// Methods
//


//
// Accessor methods
//

/**
* Set the value of no_pel
* @param newVar the new value of no_pel
*/
private void setNo_pel ( int newVar ) {
no_pel = newVar;
}

/**
* Get the value of no_pel
* @return the value of no_pel
*/
private int getNo_pel ( ) {
return no_pel;
}

/**
* Set the value of titulo
* @param newVar the new value of titulo
*/
private void setTitulo ( String newVar ) {
titulo = newVar;
}

/**
* Get the value of titulo
* @return the value of titulo
*/
private String getTitulo ( ) {
return titulo;
}

/**
* Set the value of material
* @param newVar the new value of material
*/
private void setMaterial ( String newVar ) {
material = newVar;
}

/**
* Get the value of material
* @return the value of material
*/
private String getMaterial ( ) {
return material;
}

/**
* Set the value of situacion
* @param newVar the new value of situacion
*/
private void setSituacion ( String newVar ) {
situacion = newVar;
}

/**
* Get the value of situacion
* @return the value of situacion
*/
private String getSituacion ( ) {
return situacion;
}

/**
* Set the value of genero
* @param newVar the new value of genero
*/
private void setGenero ( String newVar ) {
genero = newVar;
}

/**
* Get the value of genero
* @return the value of genero
*/
private String getGenero ( ) {
return genero;
}

/**
* Set the value of clasificacion
* @param newVar the new value of clasificacion
*/
private void setClasificacion ( String newVar ) {
clasificacion = newVar;
}

/**
* Get the value of clasificacion
* @return the value of clasificacion
*/
private String getClasificacion ( ) {
return clasificacion;
}

/**
* Set the value of costoVta
* @param newVar the new value of costoVta
*/
private void setCostoVta ( double newVar ) {
costoVta = newVar;
}

/**
* Get the value of costoVta
* @return the value of costoVta
*/
private double getCostoVta ( ) {
return costoVta;
}

/**
* Set the value of costoRta
* @param newVar the new value of costoRta
*/
private void setCostoRta ( double newVar ) {
costoRta = newVar;
}

/**
* Get the value of costoRta
* @return the value of costoRta
*/
private double getCostoRta ( ) {
return costoRta;
}

/**
* Set the value of cantpel_vta
* @param newVar the new value of cantpel_vta
*/
private void setCantpel_vta ( int newVar ) {
cantpel_vta = newVar;
}

/**
* Get the value of cantpel_vta
* @return the value of cantpel_vta
*/
private int getCantpel_vta ( ) {
return cantpel_vta;
}

/**
* Set the value of cantpel_rta
* @param newVar the new value of cantpel_rta
*/
private void setCantpel_rta ( int newVar ) {
cantpel_rta = newVar;
}

/**
* Get the value of cantpel_rta
* @return the value of cantpel_rta
*/
private int getCantpel_rta ( ) {
return cantpel_rta;
}

//
// Other methods
//

/**
*/
public void vender( )
{
}


/**
*/
public void rentar( )
{
}


/**
*/
public void agregar( )
{
}


/**
*/
public void eliminar( )
{
}


}
Clase Ticket
/**
* Class Ticket
*/
public class Ticket {

//
// Fields
//

protected int no_tick;
protected int cantPeliculas = 0;
protected String fecha;
protected double subtotal;
protected double total;

//
// Constructors
//
public Ticket () { };

//
// Methods
//


//
// Accessor methods
//

/**
* Set the value of no_tick
* @param newVar the new value of no_tick
*/
protected void setNo_tick ( int newVar ) {
no_tick = newVar;
}

/**
* Get the value of no_tick
* @return the value of no_tick
*/
protected int getNo_tick ( ) {
return no_tick;
}

/**
* Set the value of cantPeliculas
* @param newVar the new value of cantPeliculas
*/
protected void setCantPeliculas ( int newVar ) {
cantPeliculas = newVar;
}

/**
* Get the value of cantPeliculas
* @return the value of cantPeliculas
*/
protected int getCantPeliculas ( ) {
return cantPeliculas;
}

/**
* Set the value of fecha
* @param newVar the new value of fecha
*/
protected void setFecha ( String newVar ) {
fecha = newVar;
}

/**
* Get the value of fecha
* @return the value of fecha
*/
protected String getFecha ( ) {
return fecha;
}

/**
* Set the value of subtotal
* @param newVar the new value of subtotal
*/
protected void setSubtotal ( double newVar ) {
subtotal = newVar;
}

/**
* Get the value of subtotal
* @return the value of subtotal
*/
protected double getSubtotal ( ) {
return subtotal;
}

/**
* Set the value of total
* @param newVar the new value of total
*/
protected void setTotal ( double newVar ) {
total = newVar;
}

/**
* Get the value of total
* @return the value of total
*/
protected double getTotal ( ) {
return total;
}

//
// Other methods
//

/**
*/
protected void imprimir( )
{
}


}
Clase TicketVenta
/**
* Class TicketVenta
*/
public class TicketVenta extends Ticket {

//
// Fields
//


//
// Constructors
//
public TicketVenta () { };

//
// Methods
//


//
// Accessor methods
//

//
// Other methods
//

/**
*/
public void imprimir( )
{
}


}
Clase TicketRenta
/**
* Class TicketRenta
*/
public class TicketRenta extends Ticket {

//
// Fields
//

private String fechaLimRta;
private String fechaEntrega;
private double multa;

//
// Constructors
//
public TicketRenta () { };

//
// Methods
//


//
// Accessor methods
//

/**
* Set the value of fechaLimRta
* @param newVar the new value of fechaLimRta
*/
private void setFechaLimRta ( String newVar ) {
fechaLimRta = newVar;
}

/**
* Get the value of fechaLimRta
* @return the value of fechaLimRta
*/
private String getFechaLimRta ( ) {
return fechaLimRta;
}

/**
* Set the value of fechaEntrega
* @param newVar the new value of fechaEntrega
*/
private void setFechaEntrega ( String newVar ) {
fechaEntrega = newVar;
}

/**
* Get the value of fechaEntrega
* @return the value of fechaEntrega
*/
private String getFechaEntrega ( ) {
return fechaEntrega;
}

/**
* Set the value of multa
* @param newVar the new value of multa
*/
private void setMulta ( double newVar ) {
multa = newVar;
}

/**
* Get the value of multa
* @return the value of multa
*/
private double getMulta ( ) {
return multa;
}

//
// Other methods
//

/**
*/
public void imprimir( )
{
}


}
El código auto-generado del esqueleto del proyecto es casi el mismo que el código del esqueleto que yo realice, solamente que en el código auto-generado se utilizan los método get y set para modificar y leer los atributos de cada clase.

Referencias:

Saludos.

jueves, 18 de agosto de 2011

Instalación de herramientas

Taller de Programación Orientada a Objetos

En esta entrada explicare como instalar las herramientas que estare utilizando en Taller de Programación Orientada a Objetos para mi proyecto.

Utilizare el sistema operativo xubuntu 11.04, muy parecido a Ubuntu.


Para editar codigo utilizare el editor de textos, Emacs.

Descarga e instalación de Emacs.


Primero abrimos la terminal y escribimos emacs, y se mostrarán los paquetes que contengan el nombre "emacs". El primer paquete es el que descargaremos e instalaremos, es decir, emacs23.

Ahora para descargar e instalar ese paquete de emacs23, tecleamos en la terminal lo siguiente:

sudo apt-get install emacs23

Se mostrara algo asi en la terminal:

Después de terminada la descarga y la instalación, tecleamos emacs en la terminal y se abrirá dicho editor.

Listo, se ha instalado Emacs.

Para realizar algun programa en Emacs en cualquier lenguaje de programación, escribimos lo sguiente en la terminal:
emacs nombreprograma.extensión
Es decir, se escribe emacs, despues el nombre de nuestro programa con la extensión del lenguaje. Por ejemplo para hacer un programa en C, colocamos en la terminal lo siguiente:
emacs programa.c
Descarga e instalación de JAVA

JAVA será el lenguaje orientado a objetos que estare utilizando.

Para comenzar la descarga e instalación de JAVA, tecleamos en la terminal javac, que es el compilador de JAVA, nos aparecerán varios paquetes, pero el que descargaremos e instalaremos es openjdk-6-jdk.


Ahora para descargar e instalar el paquete openjdk-6-jdk, tecleamos en la terminal lo siguiente:
sudo apt-get install openjdk-6-jdk
Se mostrará algo asi en la terminal:


Después de terminada la descarga y la instalación, tecleamos en la terminal java y se mostrará algo asi:


Ahora tecleamos javac en la terminal, y se mostrará algo asi:


Esto quiere decir que se ha instalado correctamente el compilador de JAVA.

Para compilar algun programa hecho en JAVA se tecla lo siguiente en la terminal:
javac nombreprograma.java
Para ejecutar el programa se escribe en la terminal lo siguiente:
java nombreprograma
API de JAVA (En inglés).

Descarga e instalación de MySQL
MySQL es un gestor de base de datos y además es un software libre. Utilizaré MySQL para crear bases de datos para mi proyecto.

Para descargar e instalar MySQL debemos instalar dos paquetes.
Tecleamos en la terminal lo siguiente:
sudo apt-get install mysql-server mysql-client
Al instalarse MySQL se pedirá una contraseña del administrador root.
Al terminar la descarga y la instalación se mostrará algo asi:

Para entrar a MySQL, nos conectamos como root, tecleando lo siguiente en la terminal:
mysql -u root -p
Se pedirá la contraseña que escribimos cuando se instaló MySQL.
Después de conectarnos como root nos aparecerá lo siguiente:

Ahora ya estamos en MySQL. Para crear una base de datos tecleamos lo siguiente:
create database nombredelabasededatos;
Para salir de MySQL, tecleamos exit en la terminal.


Descarga e instalación de Umbrello

Umbrello es una herramienta que permite crear diagramas UML para ayudar en la creación de un software. Permite generar automáticamente un código a partir de la creación de un diagrama en los lenguajes: C++, JAVA, Python, IDL, Pascal/Delphi, Ada, Perl, entre otros. También crea diagrmas a parir de la importación de código de los lenguajes anteriores.
Para descargar e instalar Umbrello, tecleamos lo siguiente en la terminal:
sudo apt-get install umbrello
Después de instalado Umbrello, tecleamos en la terminal Umbrello, y se abrirá dicha herramienta.



Descarga e instalación de BOUML

Bouml es una aplicación UML que permite definir y generar código en C++, JAVA, ldl, PHP. Es una aplicación rápida que no requiere mucha memoria para manejar varios miles de clases.
Para descargar e instalar Bouml, tecleamos en la terminal lo siguiente:
sudo apt-get install bouml

Después de la instalación de bouml, tecleamos bouml en la terminal y se abrirá dicha aplicación.


Referencias:

Saludos.