예제 #1
0
파일: Body.cs 프로젝트: Anttifer/Jypeli
        private Body(Body copy)
        {
            Initialize();
            this.ignoresCollisionResponce = copy.ignoresCollisionResponce;
            this.shape            = copy.shape;
            this.massInfo         = copy.massInfo;
            this.coefficients     = copy.coefficients;
            this.collisionIgnorer = copy.collisionIgnorer;
            this.matrices         = copy.matrices.Duplicate();
            this.state            = copy.state.Duplicate();
            this.lifetime         = copy.lifetime.Duplicate();

            this.transformation = copy.transformation;
            this.linearDamping  = copy.linearDamping;
            this.angularDamping = copy.angularDamping;

            this.ignoresCollisionResponce = copy.ignoresCollisionResponce;
            this.ignoresGravity           = copy.ignoresGravity;
            this.ignoresPhysicsLogics     = copy.ignoresPhysicsLogics;
            this.isTransformed            = copy.isTransformed;
            this.isCollidable             = copy.isCollidable;
            this.isEventable = copy.isEventable;

            this.tag = copy.tag;
        }
예제 #2
0
        private void Delete(CollidingRulesNode crn)
        {
            var answer = MessageBox.Query("Delete Rules", "Which colliding rule do you want to delete?", "Ignore", "Update", "Both", "Cancel");

            if (answer == 0 || answer == 2)
            {
                // tell ignorer to forget about this rule
                if (Ignorer.Delete(crn.IgnoreRule))
                {
                    Remove(crn);
                }
                else
                {
                    CouldNotDeleteRule();
                }
            }

            if (answer == 1 || answer == 2)
            {
                // tell Updater to forget about this rule
                if (!Updater.Delete(crn.UpdateRule))
                {
                    CouldNotDeleteRule();
                }
                else
                //no point removing it from UI twice
                if (answer != 2)
                {
                    Remove(crn);
                }
            }
        }
예제 #3
0
        private void Next()
        {
            if (_valuePane.CurrentFailure == null)
            {
                return;
            }

            int skipped = 0;
            int updated = 0;

            try
            {
                while (CurrentReport.Next())
                {
                    var next = CurrentReport.Current;

                    //prefer rules that say we should update the database with redacted over rules that say we should ignore the problem
                    if (!Updater.OnLoad(null, next, out _))
                    {
                        updated++;
                    }
                    else if (!Ignorer.OnLoad(next, out _))
                    {
                        skipped++;
                    }
                    else
                    {
                        SetupToShow(next);

                        break;
                    }
                }
            }
            catch (Exception e)
            {
                ShowException("Error moving to next record", e);
            }

            if (CurrentReport.Exhausted)
            {
                ShowMessage("End", "End of Failures");
            }

            StringBuilder info = new StringBuilder();

            info.Append(CurrentReport.DescribeProgress());

            if (skipped > 0)
            {
                info.Append(" Skipped " + skipped);
            }
            if (updated > 0)
            {
                info.Append(" Auto Updated " + updated);
            }

            _info.Text = info.ToString();
        }
예제 #4
0
 internal void OnCollision(Body other, object customIntersectionInfo)
 {
     if (Collided != null &&
         (eventIgnorer == null ||
          Ignorer.CanCollide(eventIgnorer, other.eventIgnorer)))
     {
         Collided(this, new CollisionEventArgs(other, customIntersectionInfo));
     }
 }
예제 #5
0
 internal void OnCollision(Body other, ReadOnlyCollection <IContactInfo> contacts)
 {
     if (Collided != null &&
         (eventIgnorer == null ||
          Ignorer.CanCollide(eventIgnorer, other.eventIgnorer)))
     {
         Collided(this, new CollisionEventArgs(other, contacts));
     }
 }
예제 #6
0
 internal void OnCollision(TimeStep step, Body other, object customIntersectionInfo)
 {
     if (Collided != null &&
         other.IsEventable &&
         (eventIgnorer == null ||
          Ignorer.CanCollide(this, other, eventIgnorer, other.eventIgnorer)))
     {
         Collided(this, new CollisionEventArgs(step, other, customIntersectionInfo));
     }
 }
예제 #7
0
 internal void OnCollision(TimeStep step, Body other, IContact contact)
 {
     if (Collided != null &&
         other.IsEventable &&
         (eventIgnorer == null ||
          Ignorer.CanCollide(this, other, eventIgnorer, other.eventIgnorer)))
     {
         Collided(this, new CollisionEventArgs(step, other, contact));
     }
 }
예제 #8
0
파일: Body.cs 프로젝트: Anttifer/Jypeli
 async internal void OnColliding(TimeStep step, Body other, IContact contact)
 {
     if (Colliding != null &&
         other.IsEventable &&
         (eventIgnorer == null ||
          Ignorer.CanCollide(this, other, eventIgnorer, other.eventIgnorer)))
     {
         await using var obj = new CollisionEventArgs(step, other, contact);
         Colliding(this, obj);
     }
 }
예제 #9
0
        /**
         *
         * The FindShortest() method searches the node structure for a match,
         * skipping any characters that the Ignorer says to ignore and using the
         * Comparator to compare characters. If the word is found in the structure
         * then the final Node is returned, otherwise it returns null
         *
         * @param word
         *            word to find
         * @param pos
         *            position in word to start at
         * @param comp
         *            Comparator to use
         * @param ig
         *            Ignorer to use
         * @return Node in the Tree of last character of the matching word, or null
         *         if no match
         */
        public TreeNode findShortest(String word, int pos, Comparator comp,
                                     Ignorer ig)

        {
            TreeNode cur = null;

            if (word.Length > pos)

            {
                cur = this;
                for (int p = pos; p < word.Length; ++p)

                {
                    char c = word[p];
                    if (!ig.isIgnored(c))

                    {
                        cur = cur.hasChild(c, comp);
                        if (cur == null)

                        {
                            return(null);
                        }
                        // abort the scan if we found a node which represents the
                        // end of a
                        // word.
                        if (cur.getFlags() != null)

                        {
                            break;
                        }
                    }
                }
            }

            // Only return nodes that have a non-zero GetFlags() - this means it is
            // a
            // complete match
            if (cur != null)

            {
                if (cur.getFlags() == null)

                {
                    cur = null;
                }
            }

            return(cur);
        }
예제 #10
0
파일: Tree.cs 프로젝트: chargen/if3-csharp
        /**
         *
         * Construct a Tree object which utilizes the provided Comparator and
         * Ignorer
         *
         * @param comp
         *            Comparator to use with this Tree
         * @param ig
         *            Ignorer to use with this Tree
         */
        public Tree(Comparator comp, Ignorer ig)
        {
            log.Information(5, "Creating Tree " + this);
            comparator = comp;
            ignorer    = ig;

            // create the 128 top Node's.
            top = new TreeNode[128];

            // populate the top nodes with their default values, which match their
            // index
            // number.
            for (int i = 0; i < 128; ++i)
            {
                top[i] = new TreeNode();
                top[i].clear();
                top[i].setValue((char)i);
            }
        }
예제 #11
0
        /**
         * <summary> The Add() method adds the string to the current node, creating
         * children nodes as needed. The specified word_flags is attached to the
         * final node. Any characters that the Ignorer says are to be ignored are
         * skipped. Any comparisons are done with the Comparator. The final Node of
         * the word is returned.
         *
         * @param word
         *            Word to add
         * @param word_flags
         *            flags to associate with word
         * @param comp
         *            Comparator to use
         * @param ig
         *            Ignorer to use
         * @return Node in the Tree of last character in the word
         */
        public TreeNode add(String word, TreeFlag word_flags, Comparator comp,
                            Ignorer ig)

        {
            TreeNode cur = this;

            for (int p = 0; p < word.Length; ++p)

            {
                char c = word[p];
                if (!ig.isIgnored(c))

                {
                    cur = cur.addChild(c, comp);
                }
            }
            cur.flags = word_flags;
            return(cur);
        }
예제 #12
0
        private void Ignore()
        {
            if (_valuePane.CurrentFailure == null)
            {
                return;
            }

            try
            {
                Ignorer.Add(_valuePane.CurrentFailure);
                History.Push(new MainWindowHistory(CurrentReport.CurrentIndex, Ignorer));
            }
            catch (OperationCanceledException)
            {
                //if user cancels adding the ignore then stay on the same record
                return;
            }
            Next();
        }
예제 #13
0
파일: Body.cs 프로젝트: Anttifer/Jypeli
 public static bool CanCollide(Body body1, Body body2)
 {
     if (body1 == null)
     {
         throw new ArgumentNullException("body1");
     }
     if (body2 == null)
     {
         throw new ArgumentNullException("body2");
     }
     return
         (body1.isCollidable &&
          body2.isCollidable &&
          (body1.collisionIgnorer == null ||
           (Ignorer.CanCollide(body1, body2, body1.collisionIgnorer, body2.collisionIgnorer)))
          &&
          (body2.collisionIgnorer == null ||
           !body2.collisionIgnorer.BothNeeded ||
           (Ignorer.CanCollide(body2, body1, body2.collisionIgnorer, body1.collisionIgnorer))));
 }
예제 #14
0
        private Body(Body copy)
        {
            this.proxies = new LinkedList <BodyProxy>();
            this.ignoresCollisionResponce = copy.ignoresCollisionResponce;
            this.shape            = copy.shape;
            this.massInfo         = copy.massInfo;
            this.coefficients     = copy.coefficients;
            this.collisionIgnorer = copy.collisionIgnorer;
            this.matrices         = copy.matrices.Duplicate();
            this.state            = copy.state.Duplicate();
            this.lifetime         = copy.lifetime.Duplicate();

            this.transformation = copy.transformation;
            this.linearDamping  = copy.linearDamping;
            this.angularDamping = copy.angularDamping;

            this.ignoresCollisionResponce = copy.ignoresCollisionResponce;
            this.ignoresGravity           = copy.ignoresGravity;
            this.isCollidable             = copy.isCollidable;
            this.ignoresGravity           = copy.ignoresGravity;
            this.isTransformed            = copy.isTransformed;

            this.tag = (copy.tag is ICloneable) ? (((ICloneable)copy.tag).Clone()) : (copy.tag);
        }
예제 #15
0
 private void Ignore(OutstandingFailureNode ofn)
 {
     Ignorer.Add(ofn.Failure);
     Remove(ofn);
 }
예제 #16
0
        public override bool CanCollide(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other)
        {
            if (otherBody.IgnoresPhysicsLogics)
            // || otherBody.IsBroadPhaseOnly)
            {
                return(true);
            }

            return(thisBody.Position.Y - depthAllowed > otherBody.Position.Y);
        }
예제 #17
0
 /// <summary>
 /// Asettaa törmäyksenvälttelyryhmän.
 /// </summary>
 /// <param name="ignorer"></param>
 public void SetCollisionIgnorer(Ignorer ignorer)
 {
     this.CollisionIgnorer = ignorer;
 }
예제 #18
0
        /**
         *
         * The FindLongest() method searches the node structure for a match,
         * skipping any characters that the Ignorer says to ignore and using the
         * Comparator to compare characters. If the word is found in the structure
         * then the final Node is returned, otherwise it returns null
         *
         * @param word
         *            word to find
         * @param pos
         *            position in word to start at
         * @param comp
         *            Comparator to use
         * @param ig
         *            Ignorer to use
         * @return Node in the Tree of last character of the matching word, or null
         *         if no match
         */
        public TreeNode findLongest(String word, int pos, Comparator comp,
                                    Ignorer ig)

        {
            TreeNode cur = null;
            char     c;

            if (word.Length > pos)

            {
                cur = this;
                for (int i = pos; i < word.Length; ++i)

                {
                    c = word[i];
                    if (!ig.isIgnored(c))

                    {
                        cur = cur.hasChild(c, comp);

                        // No child matches, so we stop searching at this point
                        if (cur == null)

                        {
                            break;
                        }

                        // if the child matches we may have a match. But if there
                        // are more
                        // chars in the string,
                        // we must continue down the children to see if there is a
                        // longer
                        // match that is better.
                        // If we do find a longer match, we return that.
                        // If we do not find a longer match, we return our match.

                        if ((cur.getFlags() != null) && (i < word.Length - 1))

                        {
                            TreeNode possible_match = cur.findLongest(word, i + 1,
                                                                      comp, ig);
                            if (possible_match != null)

                            {
                                cur = possible_match;
                            }
                            // at this point, break out of our loop. cur is either
                            // the match we
                            // found or
                            // is the longer match that the last child of the short
                            // match found.
                            break;
                        }
                    }
                }
            }
            // Only return nodes that have a non-zero GetFlags() - this means it is
            // a
            // complete match
            if (cur != null)

            {
                if (cur.getFlags() == null)

                {
                    cur = null;
                }
            }
            return(cur);
        }
예제 #19
0
 public PatternExpanderUrl(PatternExpanderTarget target) : base(target)
 {
     ignorer = new IgnorerWhiteSpace();
     //common_prefix = "[,www.]";
     common_prefix = "";
 }