private static LTLNode TranslateLTL(ltl2ba.Node LTLHeadNode) { type_t type = new type_t(); LTLNode node = new LTLNode(type, TranslateLTL(LTLHeadNode.lft), TranslateLTL(LTLHeadNode.rgt)); return(node); }
} // End enum type_t public static string GetSQL(string strId, type_t EntityType) { string strSQL = null; strId = strId.Replace("'", "''"); //if (EntityType == type_t.NULL) if (true) { strSQL = @" SELECT path_id ,real_path_id ,name ,typ AS objtype ,parent_path_id ,(SELECT COUNT(*) FROM T_Paths AS p2 WHERE p2.parent_path_id = T_Paths.real_path_id) AS HasChildren , CASE WHEN typ = 'Folder' THEN 0 WHEN typ = 'SYML' THEN 0 WHEN typ = 'File' THEN 1 ELSE 3 END AS Sort FROM t_paths WHERE parent_path_id = @abc ORDER BY Sort, name "; return(strSQL); } return(""); } // End Function GetSQL
/** Constructor for a node containing an atomic proposition (index into APSet) */ public LTLNode(int ap) { _type = type_t.T_AP; _left = null; _right = null; _ap = ap; }
public void ProcessRequest(HttpContext context) { string strJSON = null; try { string strId = context.Request.Params["id"]; string strData = context.Request.Params["data"]; type_t EntityType = (type_t)Enum.Parse(typeof(type_t), strData, true); System.Diagnostics.Debug.WriteLine(strId); System.Diagnostics.Debug.WriteLine(strData); System.Diagnostics.Debug.WriteLine(EntityType); string strSQL = GetSQL(strId, EntityType); System.Data.DataTable dt = SQL.GetDataTable(strSQL); List <TreeItem> ls = new List <TreeItem>(); foreach (System.Data.DataRow dr in dt.Rows) { TreeItem root = new TreeItem(); root.id = System.Convert.ToString(dr["obj_uid"]); root.text = System.Convert.ToString(dr["caption"]); root.children = System.Convert.ToBoolean(dr["HasChildren"]); root.state = NodeState.closed; root.data = System.Convert.ToString(dr["objtype"]); // root.type = 123; // root.type = type_t.SO; // root.type = (type_t)Enum.Parse(typeof(type_t), System.Convert.ToString(dr["objtype"])); root.type = System.Convert.ToString(dr["objtype"]); // root.a_attr.target = "_blank"; // root.a_attr.href = "http://127.0.0.1"; ls.Add(root); } // Next dr strJSON = Tools.Serialization.JSON.Serialize(ls); // List<TreeItem > obj = Tools.Serialization.JSON.Deserialize<List<TreeItem >>(strJSON); // Console.WriteLine(obj); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); Tools.AJAX.cAjaxResult AjaxResult = new Tools.AJAX.cAjaxResult(); AjaxResult.error = new Tools.AJAX.AJAXException(ex); strJSON = Tools.Serialization.JSON.Serialize(AjaxResult); } System.Diagnostics.Debug.WriteLine(strJSON); context.Response.ContentType = "application/json"; context.Response.Write(strJSON); } // End Sub ProcessRequest
public extern static IntPtr remove_verify (hid_t id, type_t id_type);
public extern static IntPtr object_verify (hid_t id, type_t id_type);
public static extern ssize_t get_name (hid_t loc_id, type_t ref_type, IntPtr refer, [Out] byte[] name, size_t size);
public static extern herr_t create (IntPtr refer, hid_t loc_id, byte[] name, type_t ref_type, hid_t space_id);
public static extern ssize_t get_name (hid_t loc_id, type_t ref_type, IntPtr refer, [In][Out] byte[] name, size_t size);
} // End Function GetSQL public void ProcessRequest(HttpContext context) { string strJSON = null; try { string strId = context.Request.Params["id"]; string strData = context.Request.Params["data"]; string strPath = context.Request.Params["path"]; string path_id = context.Request.Params["path_id"]; type_t EntityType = (type_t)Enum.Parse(typeof(type_t), strData, true); System.Diagnostics.Debug.WriteLine(strId); System.Diagnostics.Debug.WriteLine(strData); System.Diagnostics.Debug.WriteLine(strPath); System.Diagnostics.Debug.WriteLine(path_id); System.Diagnostics.Debug.WriteLine(EntityType); string strSQL = GetSQL(strId, EntityType); long lng; long.TryParse(strId, out lng); strSQL = strSQL.Replace("@abc", lng.ToString()); System.Data.DataTable dt = SQL.GetDataTable(strSQL); List <TreeItem> ls = new List <TreeItem>(); foreach (System.Data.DataRow dr in dt.Rows) { TreeItem root = new TreeItem(); //root.id = strPath + "/" + System.Convert.ToString(dr["Path_Id"]); // Trouble - symlink unfortunately has same id // but this id is only used by jsTree anyway root.id = System.Guid.NewGuid().ToString(); root.real_id = System.Convert.ToString(dr["real_path_id"]); root.path_id = System.Convert.ToString(dr["Path_Id"]); root.text = System.Convert.ToString(dr["name"]); root.children = System.Convert.ToBoolean(dr["HasChildren"]); root.state = NodeState.closed; root.data = System.Convert.ToString(dr["objtype"]); // root.type = 123; // root.type = type_t.SO; // root.type = (type_t)Enum.Parse(typeof(type_t), System.Convert.ToString(dr["objtype"])); root.type = System.Convert.ToString(dr["objtype"]); // root.a_attr.target = "_blank"; // root.a_attr.href = "http://127.0.0.1"; ls.Add(root); } // Next dr strJSON = Tools.Serialization.JSON.Serialize(ls); // List<TreeItem > obj = Tools.Serialization.JSON.Deserialize<List<TreeItem >>(strJSON); // Console.WriteLine(obj); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); Tools.AJAX.cAjaxResult AjaxResult = new Tools.AJAX.cAjaxResult(); AjaxResult.error = new Tools.AJAX.AJAXException(ex); strJSON = Tools.Serialization.JSON.Serialize(AjaxResult); } System.Diagnostics.Debug.WriteLine(strJSON); context.Response.ContentType = "application/json"; context.Response.Write(strJSON); } // End Sub ProcessRequest
public static extern hid_t get_region (hid_t loc_id, type_t ref_type, IntPtr refer);
public static extern herr_t get_obj_type (hid_t loc_id, type_t ref_type, IntPtr refer, ref H5O.type_t obj_type);
public static extern ssize_t get_name (hid_t loc_id, type_t ref_type, IntPtr refer, StringBuilder name, size_t size);
public extern static htri_t type_exists(type_t type);
public LTLNode(type_t type, LTLNode left) : this(type, left, null) { }
public static string GetSQL(string strId, type_t EntityType) { string strSQL = null; strId = strId.Replace("'", "''"); if (EntityType == type_t.NULL) { strSQL = @" SELECT site_uid AS obj_uid ,site_no || ' ' || site_text AS caption ,EXISTS(SELECT * FROM building WHERE building_site_uid = site_uid) AS HasChildren ,'" + type_t.SO.ToString() + @"' AS objtype FROM site ORDER BY CAST(site_no as integer) "; return(strSQL); } if (EntityType == type_t.SO) { strSQL = @" SELECT building_uid AS obj_uid --,building_nr || ' - ' || building_text AS caption --,'GB' || RIGHT('00' || building_no, 2) || ' - ' || building_text AS caption -- PG 9.1+ only --,'GB' || substring('00' || building_no, 1 + char_length('00' || building_no) - 2) || ' - ' || building_text AS caption ,'GB' || LPAD(building_no::text, 2, '0') || ' - ' || building_text AS caption -- much easier ,EXISTS(SELECT * FROM floor WHERE floor_building_uid = building_uid) AS HasChildren ,'" + type_t.GB.ToString() + @"' AS objtype FROM building WHERE building_site_uid = '" + strId + @"' ORDER BY building_nr "; return(strSQL); } if (EntityType == type_t.GB) { strSQL = @" SELECT MAX(CAST(floor_uid AS varchar(36))) AS obj_uid ,floor_building_uid , CASE WHEN floortype_code = 'EG' THEN floortype_short_en --ELSE floortype_short_en || RIGHT('00' || floor_no, 2) -- PG 9.1+ only --ELSE floortype_short_en || substring('00' || floor_no, 1 + char_length('00' || floor_no) - 2) ELSE floortype_short_en || LPAD(floor_no::text, 2, '0') -- much easier END AS caption ,0 AS HasChildren ,'" + type_t.GS.ToString() + @"' AS objtype --,floor_isexterior --,floortype_sort --,floortype_multiplicatorno --,floortype_mez_sort FROM floor LEFT JOIN floortype ON floortype_uid = floor_floortype_uid WHERE floor_building_uid = '" + strId + @"' GROUP BY floor_building_uid ,floor_no ,floortype_uid ,floortype_code ,floortype_short_DE ,floortype_short_FR ,floortype_short_IT ,floortype_short_EN ,floortype_sort ,floortype_multiplicatorno ,floortype_mez_sort ORDER BY floor_building_uid --,floor_isexterior ,floortype_sort ,floortype_multiplicatorno * floor_no ,floortype_mez_sort "; return(strSQL); } // ,ROW_NUMBER() OVER(ORDER BY SO_Nr, GB_Nr, GS_IsAussengeschoss, GST_Sort, GST_GS_NrMultiplikator * GS_Nr, GST_ZG_Sort) AS RPT_GS_Sort // ,ROW_NUMBER() OVER(ORDER BY Site_No, Building_No, Floor_IsExterior, FloorType_Sort, FloorType_MultiplicatorNo * Floor_No, FloorType_Mez_Sort) AS Floor_Sort // ,ROW_NUMBER() OVER(ORDER BY Floor_Building_UID, FloorType_Sort, FloorType_MultiplicatorNo * Floor_No, FloorType_Mez_Sort) AS Floor_Sort if ("a" == "B".ToLower()) { strSQL = @" SELECT Site.Site_UID ,Site.Site_No ,Site.Site_Text ,Building.Building_UID ,Building.Building_Site_UID ,Building.Building_Nr ,Building.Building_Text ,Building.Building_No ,Floor.Floor_UID ,Floor.Floor_Building_UID ,Floor.Floor_No ,Floor.Floor_Isexterior ,FloorType.FloorType_UID ,FloorType.FloorType_Code ,FloorType.FloorType_Short_DE ,FloorType.FloorType_Short_FR ,FloorType.FloorType_Short_IT ,FloorType.FloorType_Short_EN ,FloorType.FloorType_long_DE ,FloorType.FloorType_long_FR ,FloorType.FloorType_long_IT ,FloorType.FloorType_long_EN ,FloorType.FloorType_Sort ,FloorType.FloorType_MultiplicatorNo ,FloorType.FloorType_Mez_Sort ,ROW_NUMBER() OVER(ORDER BY Site_No, Building_No, Floor_IsExterior, FloorType_Sort, FloorType_MultiplicatorNo * Floor_No, FloorType_Mez_Sort) AS Floor_Sort -- ,ROW_NUMBER() OVER(ORDER BY SO_Nr, GB_Nr, GS_IsAussengeschoss, GST_Sort, GST_GS_NrMultiplikator * GS_Nr, GST_ZG_Sort) AS RPT_GS_Sort -- ,ROW_NUMBER() OVER(ORDER BY Floor_Building_UID, FloorType_Sort, FloorType_MultiplicatorNo * Floor_No, FloorType_Mez_Sort) AS Floor_Sort FROM Site LEFT JOIN Building ON Building.Building_Site_UID = Site.Site_UID LEFT JOIN Floor ON Floor.Floor_Building_UID = Building.Building_UID LEFT JOIN FloorType ON FloorType.FloorType_UID = Floor.Floor_FloorType_UID ORDER BY -- Site_No, Building_No, Floor_No Floor_Sort "; } // http://stackoverflow.com/questions/1481476/when-to-use-on-update-cascade // http://www.postgresql.org/docs/9.1/static/functions-string.html // http://www.w3resource.com/PostgreSQL/postgresql-string-functions-part1.php // http://www.w3resource.com/PostgreSQL/postgresql-string-functions-part3.php // http://de.wikipedia.org/wiki/Normalisierung_(Datenbank) // http://en.wikipedia.org/wiki/Fourth_normal_form return(strSQL); }
/** Constructor for an operator of type */ public LTLNode(type_t type, LTLNode left, LTLNode right) { _type = type; _left = left; _right = right; }
public extern static herr_t clear_type(type_t type, hbool_t force);
public extern static herr_t destroy_type(type_t type);
public extern static herr_t unregister(type_t id);
public extern static int H5Iget_type_ref(type_t type);
public static extern ssize_t get_msg( hid_t msg_id, ref type_t msg_type, [In][Out] StringBuilder msg, size_t size);
public extern static int inc_type_ref(type_t type);
public extern static herr_t nmembers (type_t type, ref hsize_t num_members);
public extern static hid_t register(type_t type, IntPtr obj);
public extern static IntPtr search (type_t type, search_func_t func, IntPtr key);
public static extern hid_t dereference (hid_t obj_id, type_t ref_type, IntPtr refer);
public static extern hid_t create_msg (hid_t cls, type_t msg_type, [MarshalAs(UnmanagedType.LPStr)]string msg);
public static extern ssize_t get_name (hid_t loc_id, type_t ref_type, IntPtr refer, [In][Out] StringBuilder name, size_t size);
public static extern ssize_t get_msg( hid_t msg_id, ref type_t msg_type, StringBuilder msg, size_t size);
public extern static htri_t is_registered(type_t id);
public extern static herr_t create_ud (hid_t link_loc_id, string link_name, type_t link_type, IntPtr udata, size_t udata_size, hid_t lcpl_id = H5P.DEFAULT, hid_t lapl_id = H5P.DEFAULT);
public static extern hid_t create_msg (hid_t cls, type_t msg_type, [MarshalAs(UnmanagedType.LPStr)] string msg);
private static LTLNode TranslateLTL(ltl2ba.Node CurrentNode, APSet apset, APSet predefined_apset) { if (CurrentNode == null) { return(null); } type_t nodeType = type_t.T_TRUE; switch ((Operator)CurrentNode.ntyp) { case Operator.ALWAYS: nodeType = type_t.T_GLOBALLY; break; case Operator.AND: nodeType = type_t.T_AND; break; case Operator.EQUIV: nodeType = type_t.T_EQUIV; break; case Operator.EVENTUALLY: nodeType = type_t.T_FINALLY; break; case Operator.FALSE: nodeType = type_t.T_FALSE; break; case Operator.IMPLIES: nodeType = type_t.T_IMPLICATE; break; case Operator.NOT: nodeType = type_t.T_NOT; break; case Operator.OR: nodeType = type_t.T_OR; break; case Operator.TRUE: nodeType = type_t.T_TRUE; break; case Operator.U_OPER: nodeType = type_t.T_UNTIL; break; case Operator.V_OPER: nodeType = type_t.T_RELEASE; break; case Operator.NEXT: nodeType = type_t.T_NEXTSTEP; break; case Operator.PREDICATE: nodeType = type_t.T_AP; string ap = CurrentNode.sym.name; char ch = ap[0]; if (ch == '"') { // std::cerr << ap << std::endl; Debug.Assert(ap[ap.Length - 1] == '"'); // last char is " if (ap.Length <= 2) { // empty ap! throw new Exception("LTL-Parse-Error: empty quoted string"); } ap = ap.Substring(1, ap.Length - 2); // cut quotes } else if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { // nop } else { throw new Exception("LTL-Parse-Error"); } int ap_i; // the AP index if (predefined_apset != null) { if ((ap_i = predefined_apset.find(ap)) != -1) { return(new LTLNode(ap_i)); } else { // not found in predefined APSet! //std::cerr << "[" << (int)s[2] << "]" << std::endl; throw new Exception("Can't parse formula with this APSet!"); } } else { if ((ap_i = apset.find(ap)) != -1) { // AP exists already return(new LTLNode(ap_i)); } else { // create new AP ap_i = apset.addAP(ap); return(new LTLNode(ap_i)); } } break; default: break; } LTLNode newNode = new LTLNode(nodeType, TranslateLTL(CurrentNode.lft, apset, predefined_apset), TranslateLTL(CurrentNode.rgt, apset, predefined_apset)); return(newNode); }