Exemplo n.º 1
0
        /// <summary>
        /// adds a link to this node
        /// </summary>
        public bool AddIncomingLink(String link_type,
		                            node source,
		                            truthvalue weight)
        {
            bool success = false;
            link lnk = null;

            if (!linkTemporal.IsTemporalLinkType(link_type))
                lnk = new link(source, this, weight);
            else
                lnk = new linkTemporal(source, this, weight);

            success = lnk.SetLinkType(link_type);
            if (success)
                AddIncomingLink(lnk);
            return(success);
        }
Exemplo n.º 2
0
        /// <summary>
        /// adds a link to this node
        /// </summary>
        public bool AddOutgoingLink(String link_type,
		                            node destination,
		                            truthvalue weight)
        {
            bool success = false;
            link lnk = null;

            if (!linkTemporal.IsTemporalLinkType(link_type))
                lnk = new link(this, destination, weight);
            else
                lnk = new linkTemporal(this, destination, weight);

            success = lnk.SetLinkType(link_type);
            if (success)
                AddOutgoingLink(lnk);
            return(success);
        }
Exemplo n.º 3
0
 private void init()
 {
     SetNodeType("profession");
     Manual = new truthvalue();
     Clerical = new truthvalue();
     Leadership = new truthvalue();
     SocialStatus = new truthvalue();
     Religious = new truthvalue();
     Enforcement = new truthvalue();
     Entertainment = new truthvalue();
     Teaching = new truthvalue();
 }
Exemplo n.º 4
0
 private void initSkill()
 {
     SetNodeType("skill");
     Strength = new truthvalue();
 }
Exemplo n.º 5
0
        /// <summary>
        /// parse an xml node
        /// </summary>
        /// <param name="xnod"></param>
        /// <param name="level"></param>
        public override void LoadFromXml(XmlNode xnod, int level)
        {
            LoadNodeFromXml(xnod, level);

            if (xnod.Name == "Name")
                Name = xnod.InnerText;

            if (xnod.Name == "SocialClass")
                SocialClass = Convert.ToInt32(xnod.InnerText);

            if (xnod.Name == "Dimensions")
            {
            }

            if (xnod.Name == "Manual")
            {
                Manual = truthvalue.FromString(xnod.InnerText);
            }

            if (xnod.Name == "Clerical")
            {
                Clerical = truthvalue.FromString(xnod.InnerText);
            }

            if (xnod.Name == "Leadership")
            {
                Leadership = truthvalue.FromString(xnod.InnerText);
            }

            if (xnod.Name == "SocialStatus")
            {
                SocialStatus = truthvalue.FromString(xnod.InnerText);
            }

            if (xnod.Name == "Religious")
            {
                Religious = truthvalue.FromString(xnod.InnerText);
            }

            if (xnod.Name == "Enforcement")
            {
                Enforcement = truthvalue.FromString(xnod.InnerText);
            }

            if (xnod.Name == "Entertainment")
            {
                Entertainment = truthvalue.FromString(xnod.InnerText);
            }

            if (xnod.Name == "Teaching")
            {
                Teaching = truthvalue.FromString(xnod.InnerText);
            }

            // call recursively on all children of the current node
            if (xnod.HasChildNodes)
            {
                XmlNode xnodWorking = xnod.FirstChild;
                while (xnodWorking != null)
                {
                    LoadFromXml(xnodWorking, level + 1);
                    xnodWorking = xnodWorking.NextSibling;
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// parse an xml node
        /// </summary>
        /// <param name="xnod"></param>
        /// <param name="level"></param>
        public override void LoadFromXml(XmlNode xnod, int level)
        {
            LoadLinkFromXml(xnod, level);

            if (xnod.Name == "RelationshipType")
                SetRelationshipType(xnod.InnerText);

            if (xnod.Name == "PeopleRelationship")
            {
                for (int i = 0; i < xnod.ChildNodes.Count; i++)
                {
                    personality person = new personality();
                    person.LoadFromXml(xnod.ChildNodes[i], level);
                    if (i == 0)
                    {
                        atoms_incoming.Clear();
                        atoms_incoming.Add(person);
                    }
                    else
                    {
                        atoms_outgoing.Clear();
                        atoms_outgoing.Add(person);
                    }
                }
            }

            if (xnod.Name == "Started")
                SetStartedDate(DateTime.Parse(xnod.InnerText));

            if (xnod.Name == "Ended")
                SetEndedDate(DateTime.Parse(xnod.InnerText));

            if (xnod.Name == "Affect")
                affect = truthvalue.FromString(xnod.InnerText);

            if (xnod.Name == "Credibility")
                credibility = truthvalue.FromString(xnod.InnerText);

            if (xnod.Name == "Familiarity")
                familiarity = truthvalue.FromString(xnod.InnerText);

            if (xnod.Name == "InterpersonalProperties")
            {
                property.Clear();
                String[] props = xnod.InnerText.Split(',');
                for (int i = 0; i < props.Length; i++)
                {
                    property.Add(Convert.ToInt32(props[i]));
                }
            }

            // call recursively on all children of the current node
            if (xnod.HasChildNodes)
            {
                XmlNode xnodWorking = xnod.FirstChild;
                while (xnodWorking != null)
                {
                    LoadFromXml(xnodWorking, level + 1);
                    xnodWorking = xnodWorking.NextSibling;
                }
            }
        }
Exemplo n.º 7
0
 public belief()
 {
     SetNodeType("belief");
     Strength = new truthvalue();
 }
Exemplo n.º 8
0
 public linkTemporal(node source, node destination, truthvalue weight)
     : base(source, destination, weight)
 {
     SetFlag(atom.FLAG_TEMPORAL);
 }
Exemplo n.º 9
0
        /// <summary>
        /// parse an xml node
        /// </summary>
        /// <param name="xnod"></param>
        /// <param name="level"></param>
        public override void LoadFromXml(XmlNode xnod, int level)
        {
            LoadNodeFromXml(xnod, level);

            if (xnod.Name == "OpinionType")
                SetOpinionType(xnod.InnerText);

            if (xnod.Name == "OpinionEvent")
            {
                Event = new societyevent();
                Event.LoadFromXml(xnod, level + 1);
            }

            if (xnod.Name == "Strength")
                Strength = truthvalue.FromString(xnod.InnerText);

            if (xnod.Name == "Reason")
                Reason = xnod.InnerText;

            // call recursively on all children of the current node
            if (xnod.HasChildNodes)
            {
                XmlNode xnodWorking = xnod.FirstChild;
                while (xnodWorking != null)
                {
                    LoadFromXml(xnodWorking, level + 1);
                    xnodWorking = xnodWorking.NextSibling;
                }
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// constructor
        /// </summary>
        public link(node source, node destination, truthvalue weight,
		            String linkTypeStr)
        {
            int linkType = GetLinkTypeInt32(linkTypeStr);
            initLink(source, destination, weight, linkType);
        }
Exemplo n.º 11
0
 public ownership(node thingOwned, node personOwner)
     : base(personOwner, thingOwned, null)
 {
     SetLinkType("ownership");
     atom_value = new truthvalue();
 }
Exemplo n.º 12
0
        /// <summary>
        /// constructor
        /// </summary>
        public link(node source, node destination, truthvalue weight,
		            int linkType)
        {
            initLink(source, destination, weight, linkType);
        }
Exemplo n.º 13
0
 /// <summary>
 /// constructor
 /// </summary>
 public link(node source, node destination, truthvalue weight)
 {
     int linkType = GetLinkTypeInt32("inheritance");
     initLink(source, destination, weight, linkType);
 }
Exemplo n.º 14
0
        private void initLink(node source, 
                              node destination, 
                              truthvalue weight,
                              int linkType)
        {
            SetAtomType("link");
            SetFlag(atom.FLAG_IS_LINK);

            // set the link properties
            AddToIncomingSet(source);
            AddToOutgoingSet(destination);
            atom_value = weight;

            // update the node links
            source.AddOutgoingLink(this);
            destination.AddIncomingLink(this);

            link_type = (byte)linkType;
        }
Exemplo n.º 15
0
 private void initPersonality()
 {
     SetNodeType("personality");
     Extroversion = new truthvalue();
     Extroversion.SetValue(50);
     Agreeableness = new truthvalue();
     Agreeableness.SetValue(50);
     Conscientiousness = new truthvalue();
     Conscientiousness.SetValue(50);
     Neuroticism = new truthvalue();
     Neuroticism.SetValue(50);
     Openness = new truthvalue();
     Openness.SetValue(50);
 }
Exemplo n.º 16
0
 public opinion()
 {
     SetNodeType("opinion");
     Strength = new truthvalue();
 }
Exemplo n.º 17
0
        /// <summary>
        /// parse an xml node
        /// </summary>
        /// <param name="xnod"></param>
        /// <param name="level"></param>
        public override void LoadFromXml(XmlNode xnod, int level)
        {
            LoadNodeFromXml(xnod, level);

            if (xnod.Name == "Name")
                Name = xnod.InnerText;

            if (xnod.Name == "isMale")
                isMale = Convert.ToBoolean(xnod.InnerText);

            if (xnod.Name == "DateOfBirth")
                SetDateOfBirth(DateTime.Parse(xnod.InnerText));

            if (xnod.Name == "PhysicalAttributes")
            {
            }

            if (xnod.Name == "EyeColour")
                EyeColour = xnod.InnerText;

            if (xnod.Name == "HairColour")
                HairColour = xnod.InnerText;

            if (xnod.Name == "HairLength")
                HairLength = xnod.InnerText;

            if (xnod.Name == "FacialHair")
                FacialHair = xnod.InnerText;

            if (xnod.Name == "BodyBuild")
                BodyBuild = xnod.InnerText;

            if (xnod.Name == "Height")
                Height = xnod.InnerText;

            if (xnod.Name == "PersonalityAttributes")
            {
            }

            if (xnod.Name == "Extroversion")
                Extroversion = truthvalue.FromString(xnod.InnerText);

            if (xnod.Name == "Agreeableness")
                Agreeableness = truthvalue.FromString(xnod.InnerText);

            if (xnod.Name == "Conscientiousness")
                Conscientiousness = truthvalue.FromString(xnod.InnerText);

            if (xnod.Name == "Neuroticism")
                Neuroticism = truthvalue.FromString(xnod.InnerText);

            if (xnod.Name == "Openness")
                Openness = truthvalue.FromString(xnod.InnerText);

            if (xnod.Name == "Sexuality")
                Sexuality = xnod.InnerText;

            if (xnod.Name == "Beliefs")
            {
                beliefs.Clear();
                for (int i = 0; i < xnod.ChildNodes.Count; i++)
                {
                    belief b = new belief();
                    b.LoadFromXml((XmlNode)(xnod.ChildNodes[i]), level);
                    beliefs.Add(b);
                }
            }

            if (xnod.Name == "Roles")
            {
                roles.Clear();
                for (int i = 0; i < xnod.ChildNodes.Count; i++)
                {
                    role r = new role();
                    r.LoadFromXml((XmlNode)(xnod.ChildNodes[i]), level);
                    roles.Add(r);
                }
            }

            if (xnod.Name == "Possessions")
            {
                possessions.Clear();
                for (int i = 0; i < xnod.ChildNodes.Count; i++)
                {
                    possession p = new possession();
                    p.LoadFromXml((XmlNode)(xnod.ChildNodes[i]), level);
                    possessions.Add(p);
                }
            }

            if (xnod.Name == "Relationships")
            {
                relationships.Clear();
                for (int i = 0; i < xnod.ChildNodes.Count; i++)
                {
                    relationship r = new relationship();
                    r.LoadFromXml((XmlNode)(xnod.ChildNodes[i]), level);
                    relationships.Add(r);
                }
            }

            if (xnod.Name == "GeneralSkills")
            {
                generalskills.Clear();
                for (int i = 0; i < xnod.ChildNodes.Count; i++)
                {
                    skill s = new skill();
                    s.LoadFromXml((XmlNode)(xnod.ChildNodes[i]), level);
                    generalskills.Add(s);
                }
            }

            if (xnod.Name == "Opinions")
            {
                opinions.Clear();
                for (int i = 0; i < xnod.ChildNodes.Count; i++)
                {
                    opinion o = new opinion();
                    o.LoadFromXml((XmlNode)(xnod.ChildNodes[i]), level);
                    opinions.Add(o);
                }
            }

            // call recursively on all children of the current node
            if (xnod.HasChildNodes)
            {
                XmlNode xnodWorking = xnod.FirstChild;
                while (xnodWorking != null)
                {
                    LoadFromXml(xnodWorking, level + 1);
                    xnodWorking = xnodWorking.NextSibling;
                }
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// parse an xml node
        /// </summary>
        /// <param name="xnod"></param>
        /// <param name="level"></param>
        public override void LoadFromXml(XmlNode xnod, int level)
        {
            LoadNodeFromXml(xnod, level);

            if (xnod.Name == "SkillType")
                SetSkillType(xnod.InnerText);

            if (xnod.Name == "Description")
                SetDescription(xnod.InnerText);

            if (xnod.Name == "Strength")
                Strength = truthvalue.FromString(xnod.InnerText);

            if (xnod.Name == "AcquiredDate")
                SetAcquiredDate(DateTime.Parse(xnod.InnerText));

            // call recursively on all children of the current node
            if (xnod.HasChildNodes)
            {
                XmlNode xnodWorking = xnod.FirstChild;
                while (xnodWorking != null)
                {
                    LoadFromXml(xnodWorking, level + 1);
                    xnodWorking = xnodWorking.NextSibling;
                }
            }
        }
Exemplo n.º 19
0
 private void initRelationship()
 {
     SetLinkType("relationship");
     affect = new truthvalue();
     affect.SetValue(0.5f);
     credibility = new truthvalue();
     credibility.SetValue(0.5f);
     familiarity = new truthvalue();
     familiarity.SetValue(0.5f);
 }
Exemplo n.º 20
0
        /// <summary>
        /// parse an xml node
        /// </summary>
        /// <param name="xnod"></param>
        /// <param name="level"></param>
        public override void LoadFromXml(XmlNode xnod, int level)
        {
            LoadNodeFromXml(xnod, level);

            if (xnod.Name == "Strength")
                Strength = truthvalue.FromString(xnod.InnerText);

            if (xnod.Name == "BeliefSystem")
                BeliefSystem = xnod.InnerText;

            if (xnod.Name == "AcquiredDate")
                SetAcquiredDate(DateTime.Parse(xnod.InnerText));

            if (xnod.Name == "RelinquishedAge")
                RelinquishedAge = Convert.ToInt32(xnod.InnerText);

            // call recursively on all children of the current node
            if (xnod.HasChildNodes)
            {
                XmlNode xnodWorking = xnod.FirstChild;
                while (xnodWorking != null)
                {
                    LoadFromXml(xnodWorking, level + 1);
                    xnodWorking = xnodWorking.NextSibling;
                }
            }
        }