Identified Device model object.
Inheritance: BuiltObject, IComparable, ICloneable
Ejemplo n.º 1
0
 public object Clone()
 {
     Device d = new Device();
     d.id = this.id;
     d.parentId = this.parentId;
     d.confidence = this.confidence;
     d.PutPropertiesMap(this.properties);
     return d;
 }
            public Device GetDevice(VocabularyHolder vocabularyHolder)
            {
                Dictionary<string, string> dic = new Dictionary<string, string>();

                if (vocabularyHolder != null)
                {
                    foreach (StringPair sp in properties)
                    {
                        try
                        {
                            //vocabularyHolder.ExistProperty(sp.key, ODDRService.ASPECT_DEVICE, ODDRVocabularyService.ODDR_LIMITED_VOCABULARY_IRI);
                            if (vocabularyHolder.ExistProperty(sp.key, ODDRService.ASPECT_DEVICE, ODDRVocabularyService.ODDR_LIMITED_VOCABULARY_IRI) != null)
                            {
                                //dic.Add(sp.key, sp.value);
                                dic[sp.key] = sp.value;
                            }
                        }
                        //catch (NameException ex)
                        //{
                        //    Console.WriteLine(ex.Message);
                        //    //property non loaded
                        //}
                        catch (ArgumentException ae)
                        {
                            //Console.WriteLine(this.GetType().FullName + " " + sp.key + " already present in device " + id);
                        }
                    }
                }
                else
                {
                    foreach (StringPair sp in properties)
                    {
                        //dic.Add(sp.key, sp.value);
                        dic[sp.key] = sp.value;
                    }
                }

                Device d = new Device();
                d.id = this.id;
                d.parentId = this.parentId;
                d.PutPropertiesMap(dic);

                return d;
            }