Ejemplo n.º 1
0
        public static int?AddTerm(this IDivision division, IModelContext modelContext)
        {
            // TODO: Get vocabulary name from config
            var vocabularyName = "University_Structure";
            var vocabulary     = new VocabularyController().GetVocabularies().FirstOrDefault(v => v.Name == vocabularyName);

            if (vocabulary != null)
            {
                var termName = GetSafeTermName(division.ShortTitle, division.Title);
                try {
                    var term           = new Term(termName, string.Empty, vocabulary.VocabularyId);
                    var parentDivision = division.GetParentDivision(modelContext);
                    if (parentDivision != null)
                    {
                        term.ParentTermId = parentDivision.DivisionTermID;
                    }
                    return(new TermController().AddTerm(term));
                }
                catch (Exception ex) {
                    Exceptions.LogException(new Exception($"Error adding {termName} term to {vocabularyName} vocabulary.", ex));
                }
            }
            else
            {
                Exceptions.LogException(new Exception($"Could not find vocabulary with name {vocabularyName}."));
            }

            return(null);
        }
Ejemplo n.º 2
0
        public DivisionViewModel(IDivision division, ViewModelContext <DivisionSettings> context)
        {
            Division = division;
            Context  = context;

            _subDivisionViewModels = Division.SubDivisions.Select(d => new DivisionViewModel(d, Context)).ToList();
        }
Ejemplo n.º 3
0
        public static void UpdateTerm(this IDivision division, IModelContext modelContext)
        {
            var termName = GetSafeTermName(division.ShortTitle, division.Title);

            try {
                var parentDivision = division.GetParentDivision(modelContext);
                if (division.DivisionTermID != null)
                {
                    var termCtrl = new TermController();
                    var term     = termCtrl.GetTerm(division.DivisionTermID.Value);
                    if (term != null)
                    {
                        term.Name = termName;
                        if (parentDivision != null)
                        {
                            term.ParentTermId = parentDivision.DivisionTermID;
                        }
                        termCtrl.UpdateTerm(term);
                    }
                }
            }
            catch (Exception ex) {
                Exceptions.LogException(new Exception($"Error updating {termName} term.", ex));
            }
        }
Ejemplo n.º 4
0
 public override void Visit(IDivision division)
 {
     if (Process(division))
     {
         visitor.Visit(division);
     }
     base.Visit(division);
 }
Ejemplo n.º 5
0
        public Category(IDivision d, string n, string des)
        {
            this.Div         = d;
            this.Name        = n;
            this.Description = des;

            d.AddCategory(this);
        }
Ejemplo n.º 6
0
        private bool IsDivisionChampion(ITeam team)
        {
            IDivision div = GetConference(team).Divisions.Where(d => d.Teams.Contains(team)).FirstOrDefault();

            ITeam[] teams = div.Teams.ToArray();
            Array.Sort(teams, new DivisionCompare(league));
            return(teams[3] == team);
        }
Ejemplo n.º 7
0
 private static Dictionary <string, object> DivisionToAttributes(IDivision division)
 {
     return(new Dictionary <string, object>()
     {
         { "Division_ID", division.ID.ToString() },
         { "Name", division.Name },
     });
 }
Ejemplo n.º 8
0
        public static VCard GetVCard(this IDivision division)
        {
            var vcard = new VCard();

            // org. name
            if (!string.IsNullOrWhiteSpace(division.Title))
            {
                vcard.OrganizationName = division.Title;
            }

            // email
            if (!string.IsNullOrWhiteSpace(division.Email))
            {
                vcard.Emails.Add(division.Email);
            }

            // secondary email
            if (!string.IsNullOrWhiteSpace(division.SecondaryEmail))
            {
                vcard.Emails.Add(division.SecondaryEmail);
            }

            // phone
            if (!string.IsNullOrWhiteSpace(division.Phone))
            {
                vcard.Phones.Add(new VCardPhone()
                {
                    Number = division.Phone, Type = VCardPhoneType.Work
                });
            }

            // fax
            if (!string.IsNullOrWhiteSpace(division.Fax))
            {
                vcard.Phones.Add(new VCardPhone()
                {
                    Number = division.Fax, Type = VCardPhoneType.Fax
                });
            }

            // website
            if (!string.IsNullOrWhiteSpace(division.WebSite))
            {
                vcard.Url = division.WebSite;
            }

            // location
            if (!string.IsNullOrWhiteSpace(division.Location))
            {
                // TODO: Add organization address
                vcard.DeliveryAddress = division.Location;
            }

            // revision
            vcard.LastRevision = division.LastModifiedOnDate;

            return(vcard);
        }
Ejemplo n.º 9
0
        public static int?AddOrUpdateTerm(this IDivision division, IModelContext modelContext)
        {
            var vocabularyName = UniversityConfig.Instance.Vocabularies.OrgStructure;
            var vocabulary     = new VocabularyController().GetVocabularies().FirstOrDefault(v => v.Name == vocabularyName);

            if (vocabulary == null)
            {
                Exceptions.LogException(new Exception($"Could not find the {vocabularyName} vocabulary."));
                return(null);
            }

            var termName = GetSafeTermName(division.ShortTitle, division.Title);
            var termCtrl = new TermController();
            var term     = default(Term);

            if (division.DivisionTermID == null)
            {
                term = termCtrl.GetTermsByVocabulary(vocabulary.VocabularyId).FirstOrDefault(t => t.Name == termName);
                if (term != null)
                {
                    Exceptions.LogException(new Exception($"Could not create term {termName} in the {vocabularyName} vocabulary as it already exists."));
                    return(null);
                }

                term = new Term(termName, string.Empty, vocabulary.VocabularyId);
            }
            else
            {
                term      = termCtrl.GetTerm(division.DivisionTermID.Value);
                term.Name = termName;
            }

            var parentDivision = division.GetParentDivision(modelContext);

            if (parentDivision != null)
            {
                term.ParentTermId = parentDivision.DivisionTermID;
            }
            else
            {
                term.ParentTermId = null;
            }

            try {
                if (division.DivisionTermID == null)
                {
                    return(termCtrl.AddTerm(term));
                }

                termCtrl.UpdateTerm(term);
                return(term.TermId);
            }
            catch (Exception ex) {
                Exceptions.LogException(new Exception($"Error creating/updating {termName} term in the vocabulary {vocabularyName}.", ex));
            }

            return(null);
        }
Ejemplo n.º 10
0
        IDivision IDivision.Divide(IDivision divisor, out IDivision reminder)
        {
            ComplexPolynom pd = divisor as ComplexPolynom;

            ComplexPolynom[] cp = Divide(pd);
            cp[1].Reduce();
            reminder = cp[1];
            return(cp[0]);
        }
Ejemplo n.º 11
0
        public static IDivision GetParentDivision(this IDivision division, IModelContext modelContext)
        {
            if (division.ParentDivisionID != null)
            {
                return(modelContext.Get <DivisionInfo> (division.ParentDivisionID.Value));
            }

            return(null);
        }
Ejemplo n.º 12
0
        private HLLocation ProcessDivisionExpression(IDivision pExpression)
        {
            HLLocation locationLeftOperand  = ProcessExpression(pExpression.LeftOperand);
            HLLocation locationRightOperand = ProcessExpression(pExpression.RightOperand);
            HLLocation locationTemporary    = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type)));

            mCurrentBlock.EmitDivide(locationTemporary, locationLeftOperand, locationRightOperand);
            return(pExpression.ResultIsUnmodifiedLeftOperand ? locationLeftOperand : locationTemporary);
        }
Ejemplo n.º 13
0
        public static IDivision GetParentDivision(this IDivision division, IModelContext modelContext)
        {
            Contract.Ensures(Contract.Result <IDivision> () != null);
            if (division.ParentDivisionID != null)
            {
                return(modelContext.Get <DivisionInfo, int> (division.ParentDivisionID.Value));
            }

            return(null);
        }
Ejemplo n.º 14
0
        public static string GetSearchUrl(this IDivision division, ModuleInfo module, PortalSettings portalSettings)
        {
            if (!string.IsNullOrEmpty(division.HomePage))
            {
                return(Globals.NavigateURL(int.Parse(division.HomePage), false, portalSettings, "",
                                           portalSettings.PortalAlias.CultureCode));
            }

            return(Globals.NavigateURL(module.TabID, false, portalSettings, "",
                                       portalSettings.PortalAlias.CultureCode, "", "mid", module.ModuleID.ToString()));
        }
        /// <summary>
        /// Calculates greatest common divisor
        /// </summary>
        /// <param name="el1">First element</param>
        /// <param name="el2">Second element</param>
        /// <returns>The greatest common divisor</returns>
        static private IDivision greatestCommonDivisor(IDivision el1, IDivision el2)
        {
            if (el2.IsZero)
            {
                return(el1);
            }
            IDivision rem;
            IDivision el = el1.Divide(el2, out rem);

            return(greatestCommonDivisor(el2, rem));
        }
Ejemplo n.º 16
0
 public static string SearchText(this IDivision division)
 {
     return(FormatHelper.JoinNotNullOrEmpty(
                ", ",
                division.Title,
                UniversityModelHelper.HasUniqueShortTitle(division.ShortTitle, division.Title) ? division.ShortTitle : null,
                division.Phone,
                division.Fax,
                division.Email,
                division.SecondaryEmail,
                division.WebSite,
                division.Location,
                division.WorkingHours
                ));
 }
Ejemplo n.º 17
0
 public static string FormatEduProgramDivisionLink(IDivision division, string role = null, bool isPublished = true)
 {
     if (division != null)
     {
         var classAttr = isPublished ? string.Empty : " class=\"u8y-not-published-element\"";
         var roleLabel = !string.IsNullOrEmpty(role) ? role + ": " : string.Empty;
         if (!string.IsNullOrWhiteSpace(division.HomePage))
         {
             var url = Globals.NavigateURL(int.Parse(division.HomePage));
             return($"<span{classAttr}>{roleLabel}<a href=\"{url}\" target=\"_blank\">{division.Title}</a></span>");
         }
         return($"<span{classAttr}>{roleLabel}{division.Title}</span>");
     }
     return(string.Empty);
 }
        /// <summary>
        /// Calculates greatest common divisor
        /// </summary>
        /// <param name="el1">First element</param>
        /// <param name="el2">Second element</param>
        /// <returns>The greatest common divisor</returns>
        static public IDivision GreatestCommonDivisor(IDivision el1, IDivision el2)
        {
            IDivision c, d;

            if (el1.Norm > el2.Norm)
            {
                c = el1;
                d = el2;
            }
            else
            {
                c = el2;
                d = el1;
            }
            return(greatestCommonDivisor(c, d));
        }
Ejemplo n.º 19
0
      public override void Visit(IDivision division) {
        this.Visit(division.LeftOperand);
        this.Visit(division.RightOperand);
        Bpl.Expr rexp = TranslatedExpressions.Pop();
        Bpl.Expr lexp = TranslatedExpressions.Pop();

        var tok = division.Token();

        var loc = this.sink.CreateFreshLocal(division.RightOperand.Type);
        var locExpr = Bpl.Expr.Ident(loc);
        var storeLocal = Bpl.Cmd.SimpleAssign(tok, locExpr, rexp);
        this.StmtTraverser.StmtBuilder.Add(storeLocal);

        var a = new Bpl.AssertCmd(tok, Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Neq, locExpr, Bpl.Expr.Literal(0)));
        this.StmtTraverser.StmtBuilder.Add(a);

        TranslatedExpressions.Push(Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Div, lexp, locExpr));
      }
Ejemplo n.º 20
0
        public static void InsertDivision(IDivision division)
        {
            CheckWorkBook();
            var attributes = DivisionToAttributes(division);

            var id = new KeyValuePair <string, object>("Division_ID", attributes["Division_ID"]);

            if (Excel.IO.ExcelIOAPIs.IsIDOfWorksheet(FilePath, worksheets[2], id))
            {
                var idColumn = new Dictionary <string, object>()
                {
                    { id.Key, id.Value }
                };
                RowUpdate.Update(FilePath, worksheets[2], idColumn, attributes);
                return;
            }

            RowInsert.Insert(FilePath, worksheets[2], attributes);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Finds all roots of polynom
        /// </summary>
        /// <param name="accuracy">Accuracy</param>
        /// <returns>Array of roots</returns>
        public Complex[] Roots(double accuracy)
        {
            if (Deg == 1)
            {
                return(new Complex[] { (-coeff[0] / coeff[1]) });
            }
            if (Deg == 2)
            {
                return(SquareRoots);
            }
            ComplexPolynom polynom = this;
            ComplexPolynom p       = this;
            ComplexPolynom deri    = Derivation;
            IDivision      div     = this;
            ComplexPolynom comd    = StaticExtensionClassicalAlgebra.GreatestCommonDivisor(this, deri) as ComplexPolynom;

            if (comd.Deg > 0)
            {
                List <Complex> r         = new List <Complex>();
                ComplexPolynom divcomdeg = Divide(comd)[0];
                Complex[]      r1        = comd.Roots(accuracy);
                Complex[]      r2        = divcomdeg.Roots(accuracy);
                r.AddRange(r1);
                r.AddRange(r2);
                return(r.ToArray());
            }
            Complex[] roots = new Complex[p.Deg];
            for (int i = 0; i < roots.Length; i++)
            {
                if (p.Deg == 1)
                {
                    roots[i] = (-p.coeff[0]) / p.coeff[1];
                    break;
                }
                Complex x = p.Root(accuracy);
                roots[i] = x;
                ComplexPolynom pol = new ComplexPolynom(new Complex[] { -x, 1 });
                p = p.Divide(pol)[0];
            }
            return(roots);
        }
Ejemplo n.º 22
0
        public void Division_Constructor()
        {
            IDivision nfcNorth = this.NFL.GetDivision("NFC", "North");
            IDivision nfcSouth = this.NFL.GetDivision("NFC", "South");
            IDivision nfcEast  = this.NFL.GetDivision("NFC", "East");
            IDivision nfcWest  = this.NFL.GetDivision("NFC", "West");
            IDivision afcNorth = this.NFL.GetDivision("AFC", "North");
            IDivision afcSouth = this.NFL.GetDivision("AFC", "South");
            IDivision afcEast  = this.NFL.GetDivision("AFC", "East");
            IDivision afcWest  = this.NFL.GetDivision("AFC", "West");

            switch (this.LeagueDataFile.StripPath())
            {
            case "NFL_2016.xml":
            case "NFL_2017.xml":
                Assert.AreEqual("North", nfcNorth.Name);
                Assert.AreEqual("South", nfcSouth.Name);
                Assert.AreEqual("East", nfcEast.Name);
                Assert.AreEqual("West", nfcWest.Name);
                Assert.AreEqual("North", afcNorth.Name);
                Assert.AreEqual("South", afcSouth.Name);
                Assert.AreEqual("East", afcEast.Name);
                Assert.AreEqual("West", afcWest.Name);

                Assert.AreEqual(4, nfcNorth.Teams.Count());
                Assert.AreEqual(4, nfcSouth.Teams.Count());
                Assert.AreEqual(4, nfcEast.Teams.Count());
                Assert.AreEqual(4, nfcWest.Teams.Count());
                Assert.AreEqual(4, afcNorth.Teams.Count());
                Assert.AreEqual(4, afcSouth.Teams.Count());
                Assert.AreEqual(4, afcEast.Teams.Count());
                Assert.AreEqual(4, afcWest.Teams.Count());
                break;

            default:
                break;
            }
        }
Ejemplo n.º 23
0
        public void Division_WinPercentage()
        {
            IDivision nfcSouth = this.NFL.GetDivision("NFC", "South");
            ITeam     saints   = this.NFL.GetTeam("NO");

            IDivision nfcWest  = this.NFL.GetDivision("NFC", "West");
            ITeam     seahawks = this.NFL.GetTeam("SEA");

            switch (this.StatsDataFile.StripPath())
            {
            case "NFLStats_2016.xml":
                Assert.AreEqual((2.0 / 6.0), nfcSouth.WinPercentage(saints));
                Assert.AreEqual(((3.0 + (1.0 * 0.5)) / 6.0), nfcWest.WinPercentage(seahawks));
                break;

            case "NFLStats_2017.xml":
                Assert.AreEqual((4.0 / 6.0), nfcSouth.WinPercentage(saints));
                break;

            default:
                break;
            }
        }
Ejemplo n.º 24
0
    /// <summary>
    /// Returns a deep copy of the given division expression.
    /// </summary>
    /// <param name="division"></param>
    public Division Copy(IDivision division) {
      Contract.Requires(division != null);
      Contract.Ensures(Contract.Result<Division>() != null);

      var mutableCopy = this.shallowCopier.Copy(division);
      this.CopyChildren((BinaryOperation)mutableCopy);
      return mutableCopy;
    }
Ejemplo n.º 25
0
 /// <summary>
 /// Traverses the children of the division expression.
 /// </summary>
 public virtual void TraverseChildren(IDivision division)
 {
     Contract.Requires(division != null);
       this.TraverseChildren((IBinaryOperation)division);
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Performs some computation with the given division expression.
 /// </summary>
 /// <param name="division"></param>
 public virtual void Visit(IDivision division)
 {
 }
 public EmployeeListViewModel (IEnumerable<IEmployee> employees, IDivision division)
 {
     Employees = employees;
     Division = division;
 }
Ejemplo n.º 28
0
 public override void Visit(IDivision operation)
 {
     ProcessOperation(operation);
 }
Ejemplo n.º 29
0
 public virtual void onASTElement(IDivision division)
 {
 }
Ejemplo n.º 30
0
 public void Visit(IDivision division)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Performs some computation with the given division expression.
 /// </summary>
 /// <param name="division"></param>
 public virtual void Visit(IDivision division)
 {
     this.Visit((IBinaryOperation)division);
 }
 /// <summary>
 /// Rewrites the given division expression.
 /// </summary>
 /// <param name="division"></param>
 public virtual IExpression Rewrite(IDivision division)
 {
     return division;
 }
Ejemplo n.º 33
0
    /// <summary>
    /// Returns a shallow copy of the given division expression.
    /// </summary>
    /// <param name="division"></param>
    public Division Copy(IDivision division) {
      Contract.Requires(division != null);
      Contract.Ensures(Contract.Result<Division>() != null);

      return new Division(division);
    }
Ejemplo n.º 34
0
 /// <summary>
 /// Generates IL for the specified division.
 /// </summary>
 /// <param name="division">The division.</param>
 public override void TraverseChildren(IDivision division)
 {
     this.Traverse(division.LeftOperand);
       this.Traverse(division.RightOperand);
       if (division.TreatOperandsAsUnsignedIntegers)
     this.generator.Emit(OperationCode.Div_Un);
       else
     this.generator.Emit(OperationCode.Div);
       this.StackSize--;
 }
 public override void Visit(IDivision division)
 {
     if(Process(division)){visitor.Visit(division);}
     base.Visit(division);
 }
Ejemplo n.º 36
0
 public override void Visit(IDivision binary)
 {
     _formattedValue = Format(binary.LeftOperand) + " / " + Format(binary.RightOperand);
 }
Ejemplo n.º 37
0
 private HLLocation ProcessDivisionExpression(IDivision pExpression)
 {
     HLLocation locationLeftOperand = ProcessExpression(pExpression.LeftOperand);
     HLLocation locationRightOperand = ProcessExpression(pExpression.RightOperand);
     HLLocation locationTemporary = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type)));
     mCurrentBlock.EmitDivide(locationTemporary, locationLeftOperand, locationRightOperand);
     return pExpression.ResultIsUnmodifiedLeftOperand ? locationLeftOperand : locationTemporary;
 }
Ejemplo n.º 38
0
 public virtual void onASTElement(IDivision division) { }
Ejemplo n.º 39
0
 public override IExpression Rewrite(IDivision operation)
 {
     return(ReplaceOperation(operation));
 }
Ejemplo n.º 40
0
 public void Visit(IDivision division)
 {
     this.result = this.rewriter.Rewrite(division);
 }
Ejemplo n.º 41
0
        public override void TraverseChildren(IDivision division)
{ MethodEnter(division);
            base.TraverseChildren(division);
     MethodExit();   }
Ejemplo n.º 42
0
 public EmployeeListViewModel(IEnumerable <IEmployee> employees, IDivision division)
 {
     Employees = employees;
     Division  = division;
 }
Ejemplo n.º 43
0
 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Traverses the given division expression.
 /// </summary>
 /// <param name="division"></param>
 public virtual void Visit(IDivision division)
 {
     if (this.stopTraversal) return;
       //^ int oldCount = this.path.Count;
       this.path.Push(division);
       this.Visit(division.LeftOperand);
       this.Visit(division.RightOperand);
       //^ assume this.path.Count == oldCount+1; //True because all of the virtual methods of this class promise not to decrease this.path.Count.
       this.path.Pop();
 }
Ejemplo n.º 44
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="division"></param>
 public Division(IDivision division)
   : base(division) {
     this.TreatOperandsAsUnsignedIntegers = division.TreatOperandsAsUnsignedIntegers;
 }
Ejemplo n.º 45
0
 /// <summary>
 /// Traverses the division expression.
 /// </summary>
 public void Traverse(IDivision division)
 {
     Contract.Requires(division != null);
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(division);
       if (this.StopTraversal) return;
       this.TraverseChildren(division);
       if (this.StopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(division);
 }
Ejemplo n.º 46
0
 public static IEnumerable <IOccupiedPosition> GetHeadEmployeePositions(this IDivision division)
 {
     return(division.OccupiedPositions.Where(op => op.PositionID == division.HeadPositionID));
 }
Ejemplo n.º 47
0
 public void Visit(IDivision division)
 {
     this.traverser.Traverse(division);
 }
Ejemplo n.º 48
0
 public override void TraverseChildren(IDivision division) {
   base.TraverseChildren(division);
   ((Division)division).Type = this.GetBinaryNumericOperationType(division, division.TreatOperandsAsUnsignedIntegers);
 }
Ejemplo n.º 49
0
 public void Visit(IDivision division)
 {
     Contract.Requires(division != null);
       throw new NotImplementedException();
 }
Ejemplo n.º 50
0
 /// <summary>
 /// Visits the specified division.
 /// </summary>
 /// <param name="division">The division.</param>
 public override void Visit(IDivision division)
 {
     Division mutableDivision = new Division(division);
     this.resultExpression = this.myCodeCopier.DeepCopy(mutableDivision);
 }
Ejemplo n.º 51
0
 public override void Visit(IDivision division) {
   base.Visit(division);
   Bpl.Expr rexp = TranslatedExpressions.Pop();
   Bpl.Expr lexp = TranslatedExpressions.Pop();
   TranslatedExpressions.Push(Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Div, lexp, rexp));
 }
Ejemplo n.º 52
0
 /// <summary>
 /// Returns a deep copy of the given division expression.
 /// </summary>
 /// <param name="division"></param>
 public Division Copy(IDivision division)
 {
     var mutableCopy = this.shallowCopier.Copy(division);
       this.CopyChildren((BinaryOperation)mutableCopy);
       return mutableCopy;
 }
Ejemplo n.º 53
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="division"></param>
 public Division(IDivision division)
     : base(division)
 {
 }
Ejemplo n.º 54
0
 /// <summary>
 /// Returns a shallow copy of the given division expression.
 /// </summary>
 /// <param name="division"></param>
 public Division Copy(IDivision division)
 {
     return new Division(division);
 }
Ejemplo n.º 55
0
 public void Visit(IDivision division)
 {
     this.result = this.copier.Copy(division);
 }
Ejemplo n.º 56
0
 public void Factory()
 {
     collections = new RomanNumberCollection();
     division    = new Division();
 }
    public override void TraverseChildren(IDivision division) {

      var needsParen = LowerPrecedenceThanParentExpression(division);
      var savedCurrentPrecedence = this.currentPrecedence;
      this.currentPrecedence = this.Precedence(division);

      if (needsParen) this.sourceEmitterOutput.Write("(");
      this.Traverse(division.LeftOperand);
      if (division.LeftOperand is ITargetExpression)
        this.sourceEmitterOutput.Write(" /= ");
      else
        this.sourceEmitterOutput.Write(" / ");
      this.Traverse(division.RightOperand);
      if (needsParen) this.sourceEmitterOutput.Write(")");

      this.currentPrecedence = savedCurrentPrecedence;
    }
 public override void TraverseChildren(IDivision division)
 {
   var targetExpression = division.LeftOperand as ITargetExpression;
   if (targetExpression != null) { // x /= e
     bool statement = this.currentExpressionIsOpAssignStatement;
     this.currentExpressionIsOpAssignStatement = false;
     this.VisitAssignment(targetExpression, division, (IExpression e) => this.TraverseDivisionRightOperandAndDoOperation(e),
       treatAsStatement: statement, pushTargetRValue: true, resultIsInitialTargetRValue: division.ResultIsUnmodifiedLeftOperand);
   } else { // x / e
     this.Traverse(division.LeftOperand);
     this.TraverseDivisionRightOperandAndDoOperation(division);
   }
 }
Ejemplo n.º 59
0
 public override void TraverseChildren(IDivision division)
 {
     MethodEnter(division);
     base.TraverseChildren(division);
     MethodExit();
 }
Ejemplo n.º 60
0
 /// <summary>
 /// Rewrites the given division expression.
 /// </summary>
 /// <param name="division"></param>
 public virtual IExpression Rewrite(IDivision division)
 {
     var mutableDivision = division as Division;
       if (mutableDivision == null) return division;
       this.RewriteChildren(mutableDivision);
       return mutableDivision;
 }