Type conversion in OCL



Type conversion in OCL

From: Geoflávia Guilarducci de Alvarenga <geoflavia_at_hotmail.com>
Date: Fri, 24 Nov 2006 15:13:23 -0200
Message-ID: <BAY111-F3550969BDF7D45D49E6336B7E10@phx.gbl>
Hello members's pUML!

Is it possible to making type conversion in OCL?
For example: I need to convert String to Integer. See above:

*********************************************
Context TipoIdPesFis::validar_TipoIdPesFis (numDocIdPesFis: String) : 
Boolean
body:
     let
	D1  : Integer = numDocIdPesFis.substring(1,1),
	D2  : Integer = numDocIdPesFis.substring(2,2),
	D3  : Integer = numDocIdPesFis.substring(3,3),
	DV1 : Integer = numDocIdPesFis.substring(10,10),
	Soma : Integer = (D1*10) + (D2*9) + (D3*8,)
	Resultado : Integer = Soma - ((Soma.div(11)) * 11))
     in
	if Resultado = 1 or  Resultado = 0
		then
				if DV1 = 0
				then  	result = true
				else	result = false
				endif
		else
				if DV1 = (11 - Resultado1)
				then  	result = true
				else	result = false
				endif
		endif

*********************************************

This expression is correct, isn' t ?


Best regards,

Geoflávia Guilarducci

_________________________________________________________________
Descubra como mandar Torpedos do Messenger para o celular! 
http://mobile.msn.com/
Received on Fri 24 Nov 2006 - 17:13:58 GMT