<?xml version="1.0" encoding="UTF-8"?> | |
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="bug509533" nsURI="http://www.example.org/bug509533" nsPrefix="bug509533"> | |
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore"> | |
<details key="invocationDelegates" value="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"/> | |
<details key="settingDelegates" value="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"/> | |
<details key="validationDelegates" value="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"/> | |
</eAnnotations> | |
<eClassifiers xsi:type="ecore:EDataType" name="HSV" instanceClassName="java.lang.String" | |
serializable="false"/> | |
<eClassifiers xsi:type="ecore:EDataType" name="RGB" instanceClassName="java.lang.String" | |
serializable="false"/> | |
<eClassifiers xsi:type="ecore:EClass" name="Bug509533"> | |
<eOperations name="hsv2rgb" lowerBound="1" eType="#//RGB"> | |
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"> | |
<details key="body" value="let hsv : Sequence(String) = color.tokenize(',') in
	let h : Integer = hsv->at(1).toReal().round() in
	let s : Real = hsv->at(2).toReal()/100.0 in
	let v : Real = hsv->at(3).toReal()/100.0 in
	let c : Real = v * s in
	let hh1 : Real = h/120 in
	let hh2 : Real = 2 * (hh1 - hh1.floor()) in
	let x : Real = c * (1 - (hh2 - 1).abs()) in
	let m : Real = v -c in
	let t : Tuple(r:Real,g:Real,b:Real) =
	if h < 60 then Tuple{r=c,g=x,b=0.0}
	elseif h < 120 then Tuple{r=x,g=c,b=0.0}
	elseif h < 180 then Tuple{r=0.0,g=c,b=x}
	elseif h < 240 then Tuple{r=0.0,g=x,b=c}
	elseif h < 300 then Tuple{r=x,g=0.0,b=c}
	else Tuple{r=c,g=0.0,b=x} endif in
	let r = (255 * (t.r + m)).round() in
	let g = (255 * (t.g + m)).round() in
	let b = (255 * (t.b + m)).round() in
	RGB{value=r.toString() + ',' + g.toString() + ',' + b.toString()}"/> | |
</eAnnotations> | |
<eParameters name="color" eType="#//HSV"/> | |
</eOperations> | |
</eClassifiers> | |
</ecore:EPackage> |