Giter Club home page Giter Club logo

as3-utilities's People

Contributors

skyboy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

as3-utilities's Issues

A few bugs in LinkedVector

Hey skyboy, huge thanks for the code, but there's definitely a few places where it's falling down.

First is the static emptyNode (line 30, line 36 and a few other places). It's a nice idea, but if you for instance, filter in one LinkedVector, then in that, map another LinkedVector, because they were both set to use the same node, it messed the whole thing up, quite a few runtime errors. I initially just got rid of the private static version of it, but then I realised if you did the same thing for a one instance of a LinkedVector, filter, then inside map it, you'd have the same problem. I got rid of any static entries of emptyNode and now with each function that used it, they create their own 'emptyNode' and all logic now works correctly.

Next is in the constructor of LinkedVector, in 2 lines (line 63 & 64), there's "if (values.length > 1) { if (values == 1)...", I've changed that first check to values.length > 0 and it now seems to work correctly, but I wanted to highlight it to you.

Last place where I'm having problems is splice.

I think rather than going through the problems, a list of where things go wrong might be more helpful to you, so here's the tests I ran,

        var lv:LinkedVector = new LinkedVector();
        for(var i:int = 19; i < 22; ++i)
            lv.push({"a": i, "b": "" + i});

// lv.splice(0, 0);
//all ok, len: 3
// lv.splice(0, 0, {"a": 99, "b": 22}, {"a": 101, "b": 102});
//all ok, len: 5
// lv.splice(0, 2);
//TypeError: Error #1009: Cannot access a property or method of a null object reference.
//at linkedlist.skyboy::LinkedVector/splice()[C:\dev\repos\git\peggleSocialService\frontend\game\src\linkedlist\skyboy\LinkedVector.as:638]
// lv.splice(0, 2, {"a": 99, "b": 22}, {"a": 101, "b": 102});
//all ok, len: 3
// lv.splice(0, 20);
//all ok, len: 0
// lv.splice(0, 20, {"a": 99, "b": 22}, {"a": 101, "b": 102});
//all ok, len: 2
// lv.splice(1, 0);
//all ok, len: 3
// lv.splice(1, 0, {"a": 99, "b": 22}, {"a": 101, "b": 102});
//all ok, len: 5
// lv.splice(1, 1);
//TypeError: Error #1009: Cannot access a property or method of a null object reference.
//at linkedlist.skyboy::LinkedVector/splice()[C:\dev\repos\git\peggleSocialService\frontend\game\src\linkedlist\skyboy\LinkedVector.as:648]
// lv.splice(1, 1, {"a": 99, "b": 22}, {"a": 101, "b": 102});
//ran, but very wrong, length: 6, but only has 1 item, the very first, {a: 19, b: 19}

As you can see, it acts quite irrationally at more than a few points. Currently we're just avoiding splice, before we try and rewrite it, but again I wanted to bring the issues to you.

Thanks, seaders.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.