internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { TimeToWaitInSeconds = new XmlFormula(xRoot, XmlConstants.TimeToWaitInSeconds); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { XMovement = new XmlFormula(xRoot, XmlConstants.XPositionChange); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { ChangeGhostEffect = new XmlFormula(xRoot, XmlConstants.ChangeGhostEffect); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { YPosition = new XmlFormula(xRoot, XmlConstants.YPosition); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { TimesToRepeat = new XmlFormula(xRoot, XmlConstants.TimesToRepeat); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { ChangeBrightness = new XmlFormula(xRoot, XmlConstants.ChangeBrightness); } }
internal override XElement CreateXml() { var xRoot = new XElement(XmlConstants.Brick); xRoot.SetAttributeValue(XmlConstants.Type, XmlConstants.XmlNoteBrickType); if((FNote == null) && (Note != null)) { //necessary as there is right now no gui support for formaulas in this brick FNote = new XmlFormula { FormulaTree = new XmlFormulaTree { VariableType = "STRING", VariableValue = Note } }; } if (Note != null) { var xElement = FNote.CreateXml(); xElement.SetAttributeValue(XmlConstants.Category, XmlConstants.Note); var xFormulalist = new XElement(XmlConstants.FormulaList); xFormulalist.Add(xElement); xRoot.Add(xFormulalist); } return xRoot; }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { VolumeXML = new XmlFormula(xRoot, XmlConstants.VolumeChange); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { Transparency = new XmlFormula(xRoot, XmlConstants.Transparency); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { Degrees = new XmlFormula(xRoot, XmlConstants.TurnRightDegrees); } }
internal override XElement CreateXml() { var xRoot = new XElement(XmlConstants.Brick); xRoot.SetAttributeValue(XmlConstants.Type, XmlConstants.XmlSpeakBrickType); if ((FText == null) && (Text != null)) { //necessary as there is right now no gui support for formaulas in this brick FText = new XmlFormula { FormulaTree = new XmlFormulaTree { VariableType = "STRING", VariableValue = Text } }; } //TODO: only for tests needed as long as upper "necessary as there is right now no gui support for formaulas in this brick" isn't fixed if ((FText != null) && (Text == null)) Text = FText.FormulaTree.VariableValue; if ((FText != null) && (Text != null)) { var xElement = FText.CreateXml(); xElement.SetAttributeValue(XmlConstants.Category, XmlConstants.Speak); var xFormulalist = new XElement(XmlConstants.FormulaList); xFormulalist.Add(xElement); xRoot.Add(xFormulalist); } return xRoot; }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { StepsXML = new XmlFormula(xRoot, XmlConstants.Steps); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { DurationInSeconds = new XmlFormula(xRoot, XmlConstants.DurationInSeconds); XDestination = new XmlFormula(xRoot, XmlConstants.XDestination); YDestination = new XmlFormula(xRoot, XmlConstants.YDestination); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { FText = new XmlFormula(xRoot, XmlConstants.Speak); Text = FText.FormulaTree.VariableValue; } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { FNote = new XmlFormula(xRoot, XmlConstants.Note); Note = FNote.FormulaTree.VariableValue; } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { VariableFormula = new XmlFormula(xRoot, XmlConstants.Variable); if (xRoot.Element(XmlConstants.UserVariable) != null) UserVariable = new XmlUserVariable(xRoot.Element(XmlConstants.UserVariable)); } }
public override bool Equals(System.Object obj) { XmlFormula f = obj as XmlFormula; if ((object)f == null) { return(false); } return(this.Equals(f)); }
public void XmlFormulaTest() { TextReader sr = new StringReader("<formula category=\"IF_CONDITION\"> <leftChild> <leftChild> <leftChild> <leftChild> <leftChild> <type>USER_VARIABLE</type> <value>x speed</value> </leftChild> <rightChild> <type>USER_VARIABLE</type> <value>x speed</value> </rightChild> <type>OPERATOR</type> <value>MULT</value> </leftChild> <rightChild> <leftChild> <type>USER_VARIABLE</type> <value>y speed</value> </leftChild> <rightChild> <type>USER_VARIABLE</type> <value>y speed</value> </rightChild> <type>OPERATOR</type> <value>MULT</value> </rightChild> <type>OPERATOR</type> <value>PLUS</value> </leftChild> <type>FUNCTION</type> <value>SQRT</value> </leftChild> <rightChild> <type>NUMBER</type> <value>2</value> </rightChild> <type>OPERATOR</type> <value>GREATER_THAN</value> </leftChild> <rightChild> <leftChild> <type>SENSOR</type> <value>OBJECT_X</value> </leftChild> <rightChild> <type>NUMBER</type> <value>55</value> </rightChild> <type>OPERATOR</type> <value>SMALLER_THAN</value> </rightChild> <type>OPERATOR</type> <value>LOGICAL_AND</value> </formula>"); var xRoot = XElement.Load(sr); TextReader refSr = new StringReader("<formula category=\"IF_CONDITION\"> <leftChild> <leftChild> <leftChild> <leftChild> <leftChild> <type>USER_VARIABLE</type> <value>x speed</value> </leftChild> <rightChild> <type>USER_VARIABLE</type> <value>x speed</value> </rightChild> <type>OPERATOR</type> <value>MULT</value> </leftChild> <rightChild> <leftChild> <type>USER_VARIABLE</type> <value>y speed</value> </leftChild> <rightChild> <type>USER_VARIABLE</type> <value>y speed</value> </rightChild> <type>OPERATOR</type> <value>MULT</value> </rightChild> <type>OPERATOR</type> <value>PLUS</value> </leftChild> <type>FUNCTION</type> <value>SQRT</value> </leftChild> <rightChild> <type>NUMBER</type> <value>2</value> </rightChild> <type>OPERATOR</type> <value>GREATER_THAN</value> </leftChild> <rightChild> <leftChild> <type>SENSOR</type> <value>OBJECT_X</value> </leftChild> <rightChild> <type>NUMBER</type> <value>55</value> </rightChild> <type>OPERATOR</type> <value>SMALLER_THAN</value> </rightChild> <type>OPERATOR</type> <value>LOGICAL_AND</value> </formula>"); var refXRoot = XElement.Load(refSr); var testObject = new XmlFormula(xRoot); var referenceObject = new XmlFormula() { FormulaTree = new XmlFormulaTree(refXRoot) }; Assert.AreEqual(referenceObject, testObject); }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { IfCondition = new XmlFormula(xRoot, XmlConstants.XmlIFCONDITION); } /*if (xRoot.Element("ifElseBrick") != null) { IfLogicElseBrickReference = new XmlIfLogicElseBrickReference(xRoot.Element("ifElseBrick")); } if (xRoot.Element("ifEndBrick") != null) { IfLogicEndBrickReference = new XmlIfLogicEndBrickReference(xRoot.Element("ifEndBrick")); }*/ }
internal override void LoadFromXml(XElement xRoot) { DurationInSeconds = new XmlFormula(xRoot.Element("durationInSeconds")); Frequency = new XmlFormula(xRoot.Element("frequency")); }
public bool Equals(XmlFormula f) { return(this.FormulaTree.Equals(f.FormulaTree)); }
public bool Equals(XmlFormula f) { return this.FormulaTree.Equals(f.FormulaTree); }
internal override void LoadFromXml(XElement xRoot) { Motor = xRoot.Element("motor").Value; Speed = new XmlFormula(xRoot.Element("speed")); }
internal override void LoadFromXml(XElement xRoot) { Degrees = new XmlFormula(xRoot.Element("degrees")); Motor = xRoot.Element("motor").Value; }