// Generated by Haxe 4.3.3
package code;

import haxe.root.*;

@SuppressWarnings(value={"rawtypes", "unchecked"})
public class PythonCode extends haxe.lang.HxObject
{
	static
	{
		//line 10 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		{
			//line 10 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			java.lang.Object __temp_odecl2 = null;
			//line 10 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			{
				//line 10 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				java.lang.Object __temp_odecl1 = new haxe.lang.DynamicObject(new java.lang.String[]{"SuppressWarnings"}, new java.lang.Object[]{new haxe.root.Array(new java.lang.Object[]{"checkstyle:CyclomaticComplexity"})}, new java.lang.String[]{}, new double[]{});
				//line 10 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				__temp_odecl2 = new haxe.lang.DynamicObject(new java.lang.String[]{"generateMethods"}, new java.lang.Object[]{__temp_odecl1}, new java.lang.String[]{}, new double[]{});
			}
			
			//line 10 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			code.PythonCode.__meta__ = new haxe.lang.DynamicObject(new java.lang.String[]{"statics"}, new java.lang.Object[]{__temp_odecl2}, new java.lang.String[]{}, new double[]{});
		}
		
	}
	
	public PythonCode(haxe.lang.EmptyObject empty)
	{
	}
	
	
	public PythonCode()
	{
		//line 10 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		code.PythonCode.__hx_ctor_code_PythonCode(this);
	}
	
	
	protected static void __hx_ctor_code_PythonCode(code.PythonCode __hx_this)
	{
	}
	
	
	public static java.lang.Object __meta__;
	
	public static haxe.ds.StringMap<java.lang.String> generate(model.Diagram diagram)
	{
		//line 12 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		haxe.ds.StringMap<java.lang.String> files = new haxe.ds.StringMap<java.lang.String>();
		//line 13 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		{
			//line 13 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			java.lang.Object set = diagram.iterator();
			//line 13 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(set, "hasNext", null)) )))
			{
				//line 13 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				model.Set set1 = ((model.Set) (haxe.lang.Runtime.callField(set, "next", null)) );
				//line 14 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				if ((  ! (haxe.root.Std.isOfType(set1, model.Association.class))  || (((model.Association) (set1) )).isClass() )) 
				{
					//line 15 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					files.set(( set1.className.toLowerCase() + ".py" ), code.PythonCode.generateClass(set1));
				}
				
			}
			
		}
		
		//line 18 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		return files;
	}
	
	
	public static java.lang.String generateClass(model.Set set)
	{
		//line 22 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		java.lang.String content = "";
		//line 23 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		content += code.PythonCode.addImports(set);
		//line 24 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		if ( ! (set.isInterface) ) 
		{
			//line 25 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			content += ( ( ( "class " + set.className ) + (( (( set.superset != null )) ? (( ( "(" + set.superset.className ) + ")" )) : ("") )) ) + ":\n" );
		}
		
		//line 27 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		content += code.PythonCode.generateFields(set);
		//line 28 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		content += code.PythonCode.generateConstructor(set);
		//line 29 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		content += code.PythonCode.generateMethods(set);
		//line 30 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		content += "\n";
		//line 31 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		return content;
	}
	
	
	public static java.lang.String addImports(model.Set set)
	{
		//line 35 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		haxe.root.Array<java.lang.String> imports = new haxe.root.Array<java.lang.String>();
		//line 36 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		imports.push("from __future__ import annotations");
		//line 37 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		{
			//line 37 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			int _g = 0;
			//line 37 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			haxe.root.Array<haxe.root.Array<model.Field>> _g1 = new haxe.root.Array<haxe.root.Array<model.Field>>(new haxe.root.Array[]{set.fields, set.navFields});
			//line 37 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			while (( _g < _g1.length ))
			{
				//line 37 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				haxe.root.Array<model.Field> fields = _g1.__get(_g);
				//line 37 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				 ++ _g;
				//line 38 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				{
					//line 38 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					int _g2 = 0;
					//line 38 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					while (( _g2 < fields.length ))
					{
						//line 38 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						model.Field field = fields.__get(_g2);
						//line 38 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						 ++ _g2;
						//line 39 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						if (haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(field.classType, 0, 5), "Array")) 
						{
							//line 40 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							if ( ! (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.root.Lambda.has(((java.lang.Object) (imports) ), haxe.lang.Runtime.toString("from typing import List"))) ))) ) 
							{
								//line 41 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								imports.push("from typing import List");
							}
							
							//line 43 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							java.lang.String classType = haxe.lang.StringExt.substring(field.classType, 6, ( field.classType.length() - 1 ));
							//line 44 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							if ( ! (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.root.Lambda.has(((java.lang.Object) (imports) ), haxe.lang.Runtime.toString(( "import " + classType.toLowerCase() )))) ))) ) 
							{
								//line 45 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								imports.push(( "import " + classType.toLowerCase() ));
							}
							
						}
						else
						{
							//line 47 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							if (( haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(field.classType, 0, 4), "Date") &&  ! (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.root.Lambda.has(((java.lang.Object) (imports) ), haxe.lang.Runtime.toString("from datetime import date"))) )))  )) 
							{
								//line 48 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								imports.push("from datetime import date");
							}
							else
							{
								//line 49 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								if (( haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(field.classType, 0, 4), "Time") &&  ! (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.root.Lambda.has(((java.lang.Object) (imports) ), haxe.lang.Runtime.toString("from datetime import time"))) )))  )) 
								{
									//line 50 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
									imports.push("from datetime import time");
								}
								else
								{
									//line 51 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
									if (( haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(field.classType, 0, 8), "DateTime") &&  ! (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.root.Lambda.has(((java.lang.Object) (imports) ), haxe.lang.Runtime.toString("from datetime import datetime"))) )))  )) 
									{
										//line 52 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
										imports.push("from datetime import datetime");
									}
									else
									{
										//line 53 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
										if (( ( (  ! (haxe.lang.Runtime.valEq(field.classType, "T"))  && ( ((int) (haxe.lang.Runtime.toInt(haxe.lang.StringExt.charCodeAt(code.PythonCode.getType(field.classType), 0))) ) <= 90 ) ) &&  ! (haxe.lang.Runtime.valEq(field.classType, set.className))  ) &&  ! (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.root.Lambda.has(((java.lang.Object) (imports) ), haxe.lang.Runtime.toString(( "import " + field.classType.toLowerCase() )))) )))  )) 
										{
											//line 55 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
											imports.push(( "import " + field.classType.toLowerCase() ));
										}
										
									}
									
								}
								
							}
							
						}
						
					}
					
				}
				
			}
			
		}
		
		//line 59 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		if (( ( set.superset != null ) &&  ! (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.root.Lambda.has(((java.lang.Object) (imports) ), haxe.lang.Runtime.toString(( ( ( "from " + set.superset.className.toLowerCase() ) + " import " ) + set.superset.className )))) )))  )) 
		{
			//line 60 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			imports.push(( ( ( "from " + set.superset.className.toLowerCase() ) + " import " ) + set.superset.className ));
		}
		
		//line 62 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		if (( haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.root.Lambda.exists(((java.lang.Object) (set.fields) ), ((haxe.lang.Function) (( (( code.PythonCode_addImports_62__Fun_0.__hx_current != null )) ? (code.PythonCode_addImports_62__Fun_0.__hx_current) : (code.PythonCode_addImports_62__Fun_0.__hx_current = ((code.PythonCode_addImports_62__Fun_0) (new code.PythonCode_addImports_62__Fun_0()) )) )) ))) )) || haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.root.Lambda.exists(((java.lang.Object) (set.methods) ), ((haxe.lang.Function) (( (( code.PythonCode_addImports_62__Fun.__hx_current != null )) ? (code.PythonCode_addImports_62__Fun.__hx_current) : (code.PythonCode_addImports_62__Fun.__hx_current = ((code.PythonCode_addImports_62__Fun) (new code.PythonCode_addImports_62__Fun()) )) )) ))) )) )) 
		{
			//line 63 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			imports.push("from typing import TypeVar");
			//line 64 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			imports.push("T = TypeVar(\"T\")");
		}
		
		//line 66 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		java.lang.String content = ( imports.join("\n") + "\n\n" );
		//line 67 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		return content;
	}
	
	
	public static java.lang.String generateFields(model.Set set)
	{
		//line 71 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		java.lang.String content = "";
		//line 72 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		{
			//line 72 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			{
				//line 72 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				haxe.root.Array<model.Field> fields = set.fields;
				//line 73 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				{
					//line 73 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					int _g = 0;
					//line 73 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					while (( _g < fields.length ))
					{
						//line 73 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						model.Field field = fields.__get(_g);
						//line 73 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						 ++ _g;
						//line 74 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						content += ( ( ( ( ( ( "\t" + (( (( ( field.visibility == model.Field.ACCESS_PRIVATE ) || ( field.visibility == model.Field.ACCESS_PROTECTED ) )) ? ("_") : ("") )) ) + field.className ) + ": " ) + code.PythonCode.getType(field.classType) ) + (( (field.isStatic) ? (" #static") : ("") )) ) + "\n" );
					}
					
				}
				
			}
			
			//line 72 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			{
				//line 72 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				haxe.root.Array<model.Field> fields1 = set.navFields;
				//line 73 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				{
					//line 73 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					int _g1 = 0;
					//line 73 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					while (( _g1 < fields1.length ))
					{
						//line 73 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						model.Field field1 = fields1.__get(_g1);
						//line 73 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						 ++ _g1;
						//line 74 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						content += ( ( ( ( ( ( "\t" + (( (( ( field1.visibility == model.Field.ACCESS_PRIVATE ) || ( field1.visibility == model.Field.ACCESS_PROTECTED ) )) ? ("_") : ("") )) ) + field1.className ) + ": " ) + code.PythonCode.getType(field1.classType) ) + (( (field1.isStatic) ? (" #static") : ("") )) ) + "\n" );
					}
					
				}
				
			}
			
		}
		
		//line 78 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		return content;
	}
	
	
	public static java.lang.String generateMethods(model.Set set)
	{
		//line 83 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		java.lang.String content = "";
		//line 84 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		{
			//line 84 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			int _g = 0;
			//line 84 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			haxe.root.Array<haxe.root.Array<model.Method>> _g1 = new haxe.root.Array<haxe.root.Array<model.Method>>(new haxe.root.Array[]{set.accessors, set.methods});
			//line 84 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			while (( _g < _g1.length ))
			{
				//line 84 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				haxe.root.Array<model.Method> methods = _g1.__get(_g);
				//line 84 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				 ++ _g;
				//line 85 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				{
					//line 85 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					int _g2 = 0;
					//line 85 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					while (( _g2 < methods.length ))
					{
						//line 85 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						model.Method method = methods.__get(_g2);
						//line 85 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						 ++ _g2;
						//line 86 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						haxe.root.Array<java.lang.String> _g3 = new haxe.root.Array<java.lang.String>(new java.lang.String[]{});
						//line 86 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						{
							//line 86 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							java.lang.Object x = ((java.lang.Object) (haxe.lang.Runtime.callField(((java.lang.Object) (method.params) ), "iterator", null)) );
							//line 86 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(x, "hasNext", null)) )))
							{
								//line 86 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								model.Field x1 = ((model.Field) (haxe.lang.Runtime.callField(x, "next", null)) );
								//line 86 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								_g3.push(( ( x1.className + ": " ) + code.PythonCode.getType(x1.classType) ));
							}
							
						}
						
						//line 86 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						haxe.root.Array<java.lang.String> params = _g3;
						//line 87 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						if ( ! (method.isStatic) ) 
						{
							//line 88 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							params.insert(0, "self");
						}
						
						//line 90 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						content += ( ( ( ( ( ( ( ( "\n\t" + (( (( ( method.visibility == model.Field.ACCESS_PRIVATE ) || ( method.visibility == model.Field.ACCESS_PROTECTED ) )) ? ("_") : ("") )) ) + "def " ) + method.className ) + "(" ) + params.join(", ") ) + ")" ) + (( (haxe.lang.Runtime.valEq(method.classType, "")) ? ("") : (( " -> " + code.PythonCode.getType(method.classType) )) )) ) + ":\n" );
						//line 92 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						if (( haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(method.className, 0, 3), "get") || haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(method.className, 0, 3), "set") )) 
						{
							//line 93 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							model.Field field = set.getFieldCode(code.Code.extractFieldName(method.className, null));
							//line 94 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							if (( field != null )) 
							{
								//line 95 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								if (haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(method.className, 0, 3), "set")) 
								{
									//line 96 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
									content += ( ( ( ( ( "\t\tself." + (( (( ( field.visibility == model.Field.ACCESS_PRIVATE ) || ( field.visibility == model.Field.ACCESS_PROTECTED ) )) ? ("_") : ("") )) ) + field.className ) + " = " ) + field.className ) + "\n" );
								}
								
								//line 99 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								content += ( ( ( ( "\t\treturn self." + (( (( ( field.visibility == model.Field.ACCESS_PRIVATE ) || ( field.visibility == model.Field.ACCESS_PROTECTED ) )) ? ("_") : ("") )) ) + field.className ) + (( (haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(field.classType, 0, 5), "Array")) ? (".copy()") : ("") )) ) + "\n" );
							}
							
						}
						else
						{
							//line 102 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							if (( ( method.params.length == 1 ) && (( haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(method.className, 0, 3), "add") || haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(method.className, 0, 6), "remove") )) )) 
							{
								//line 103 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								model.Field field1 = set.getFieldFromArrayType(method.params.__get(0).classType);
								//line 104 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								if (( field1 != null )) 
								{
									//line 105 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
									content += ( ( ( ( ( "\t\tself." + (( (( ( field1.visibility == model.Field.ACCESS_PRIVATE ) || ( field1.visibility == model.Field.ACCESS_PROTECTED ) )) ? ("_") : ("") )) ) + field1.className ) + (( (haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(method.className, 0, 3), "add")) ? (".append(") : (".remove(") )) ) + method.params.__get(0).className ) + ")\n" );
									//line 107 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
									content += "\t\treturn self;\n";
								}
								
							}
							else
							{
								//line 109 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								if ( ! (haxe.lang.Runtime.valEq(method.classType, "")) ) 
								{
									//line 110 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
									content += ( ( "\t\treturn " + code.Code.getDefaultValue(method.classType, "None", null) ) + "\n" );
								}
								else
								{
									//line 112 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
									content += "\t\tpass\n";
								}
								
							}
							
						}
						
					}
					
				}
				
			}
			
		}
		
		//line 116 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		return content;
	}
	
	
	public static java.lang.String generateConstructor(model.Set set)
	{
		//line 120 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		java.lang.String content = "";
		//line 121 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		if (( set.constructors.length != 0 )) 
		{
			//line 122 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			boolean emptyConstructor = true;
			//line 123 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			model.Method method = set.constructors.__get(0);
			//line 124 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			haxe.root.Array<java.lang.String> _g = new haxe.root.Array<java.lang.String>(new java.lang.String[]{});
			//line 124 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			{
				//line 124 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				java.lang.Object x = ((java.lang.Object) (haxe.lang.Runtime.callField(((java.lang.Object) (method.params) ), "iterator", null)) );
				//line 124 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(x, "hasNext", null)) )))
				{
					//line 124 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					model.Field x1 = ((model.Field) (haxe.lang.Runtime.callField(x, "next", null)) );
					//line 124 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					_g.push(( ( x1.className + ": " ) + code.PythonCode.getType(x1.classType) ));
				}
				
			}
			
			//line 124 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			haxe.root.Array<java.lang.String> params = _g;
			//line 125 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			params.insert(0, "self");
			//line 126 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			content += ( ( "\n\tdef __init__(" + params.join(", ") ) + "):\n" );
			//line 127 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			if (( set.superset != null )) 
			{
				//line 128 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				haxe.root.Array<model.Field> parentFields = ((haxe.root.Array<model.Field>) (((haxe.root.Array) (haxe.root.Lambda.filter(((java.lang.Object) (method.params) ), ((haxe.lang.Function) (new code.PythonCode_generateConstructor_128__Fun(set)) ))) )) );
				//line 129 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				haxe.root.Array<java.lang.String> _g1 = new haxe.root.Array<java.lang.String>(new java.lang.String[]{});
				//line 129 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				{
					//line 129 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					int _g_current = 0;
					//line 129 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					haxe.root.Array<model.Field> _g_array = parentFields;
					//line 129 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					while (( _g_current < _g_array.length ))
					{
						//line 129 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						model.Field x2 = _g_array.__get(_g_current++);
						//line 129 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						_g1.push(x2.className);
					}
					
				}
				
				//line 129 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				content += ( ( "\t\tsuper().__init__(" + _g1.join(", ") ) + ")\n" );
				//line 130 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				emptyConstructor = false;
			}
			
			//line 132 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			{
				//line 132 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				int _g2 = 0;
				//line 132 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				haxe.root.Array<model.Field> _g3 = method.params;
				//line 132 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				while (( _g2 < _g3.length ))
				{
					//line 132 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					model.Field param = _g3.__get(_g2);
					//line 132 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					 ++ _g2;
					//line 133 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					model.Field field = set.getFieldCode(param.className);
					//line 134 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					if (( field != null )) 
					{
						//line 135 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						content += ( ( ( ( ( "\t\tself." + (( (( ( field.visibility == model.Field.ACCESS_PRIVATE ) || ( field.visibility == model.Field.ACCESS_PROTECTED ) )) ? ("_") : ("") )) ) + field.className ) + " = " ) + param.className ) + "\n" );
						//line 137 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						emptyConstructor = false;
					}
					
				}
				
			}
			
			//line 140 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			{
				//line 140 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				{
					//line 140 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					haxe.root.Array<model.Field> fields = set.fields;
					//line 141 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					{
						//line 141 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						int _g4 = 0;
						//line 141 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						while (( _g4 < fields.length ))
						{
							//line 141 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							model.Field field1 = fields.__get(_g4);
							//line 141 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							 ++ _g4;
							//line 142 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							if ((  ! (field1.isStatic)  &&  ! (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.root.Lambda.exists(((java.lang.Object) (method.params) ), ((haxe.lang.Function) (new code.PythonCode_generateConstructor_142__Fun_0(field1)) ))) )))  )) 
							{
								//line 143 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								content += ( ( ( ( ( "\t\tself." + (( (( ( field1.visibility == model.Field.ACCESS_PRIVATE ) || ( field1.visibility == model.Field.ACCESS_PROTECTED ) )) ? ("_") : ("") )) ) + field1.className ) + " = " ) + code.Code.getDefaultValue(field1.classType, "[]", "None") ) + "\n" );
								//line 145 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								emptyConstructor = false;
							}
							
						}
						
					}
					
				}
				
				//line 140 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				{
					//line 140 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					haxe.root.Array<model.Field> fields1 = set.navFields;
					//line 141 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					{
						//line 141 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						int _g5 = 0;
						//line 141 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
						while (( _g5 < fields1.length ))
						{
							//line 141 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							model.Field field2 = fields1.__get(_g5);
							//line 141 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							 ++ _g5;
							//line 142 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
							if ((  ! (field2.isStatic)  &&  ! (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.root.Lambda.exists(((java.lang.Object) (method.params) ), ((haxe.lang.Function) (new code.PythonCode_generateConstructor_142__Fun(field2)) ))) )))  )) 
							{
								//line 143 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								content += ( ( ( ( ( "\t\tself." + (( (( ( field2.visibility == model.Field.ACCESS_PRIVATE ) || ( field2.visibility == model.Field.ACCESS_PROTECTED ) )) ? ("_") : ("") )) ) + field2.className ) + " = " ) + code.Code.getDefaultValue(field2.classType, "[]", "None") ) + "\n" );
								//line 145 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
								emptyConstructor = false;
							}
							
						}
						
					}
					
				}
				
			}
			
			//line 149 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			if (emptyConstructor) 
			{
				//line 149 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				content += "\t\tpass\n";
			}
			
		}
		
		//line 151 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		return content;
	}
	
	
	public static java.lang.String getType(java.lang.String classType)
	{
		//line 155 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		java.lang.String languageType = classType;
		//line 156 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		if (haxe.lang.Runtime.valEq(haxe.lang.StringExt.substr(classType, 0, 5), "Array")) 
		{
			//line 157 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			languageType = ( ( "List[" + haxe.lang.StringExt.substr(classType, 6, ( classType.length() - 7 )) ) + "]" );
		}
		else
		{
			//line 158 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
			if (haxe.lang.Runtime.valEq(classType, "String")) 
			{
				//line 159 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				languageType = "str";
			}
			else
			{
				//line 160 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
				if (( ( ( ( ( haxe.lang.Runtime.valEq(classType, "Int") || haxe.lang.Runtime.valEq(classType, "Float") ) || haxe.lang.Runtime.valEq(classType, "Double") ) || haxe.lang.Runtime.valEq(classType, "Date") ) || haxe.lang.Runtime.valEq(classType, "Time") ) || haxe.lang.Runtime.valEq(classType, "DateTime") )) 
				{
					//line 162 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
					languageType = classType.toLowerCase();
				}
				
			}
			
		}
		
		//line 164 "/home/frank/Documents/Developpements/dbconcept-0.5.1/src/code/PythonCode.hx"
		return languageType;
	}
	
	
}


