Re: Data Structures question
| From: | Arnaud Limbourg | Date: | Sat, 16 Nov 2002 09:31:53 +0000 |
| Subject: | Re: Data Structures question | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-10866@lists.php.net to get a copy of this message | ||
> Personally, +1 for Structure_*.
> Vote for code clarity rather than short names.
>
> > What are Perl and Java calling these?
> I don't know about Perl myself (I'm not a Perl coder, only
> C/C++/Java/PHP).
I posted a mail on the original thread but i'll say it again here :)
Why not DataStructure_* ? It's not that long and is pretty clear to me ;)
> In java
> all of the classes belong to java.util.*;
>
> The reason I asked about abstract classes and the like
> is that for maintence and design reasons, I'd like to go the fully
> engineered way for using things like Java does it looks like a bloated
> system, but in reality it is a very good example of code refactoring.
>
> The only documentation I find about abstract classes/functions in PHP
> is this posting:
> http://www.zend.com/lists/php-dev/200211/msg00300.html
>
> How does one go about putting together abstract functions from that?
> is there a AbstractFunctionException that could be thrown?
>
> This is a total overview of the Java data structure system
> For more details, have a look at:
> http://java.sun.com/j2se/1.4/docs/api/java/util/package-frame.htmlfÈg•™„
> Ñ@E>
>
> I have left out two classes from Java that I considered of minimal
> value in PHP, for various reasons (WeakHashMap, Hashtable)
>
> Interfaces:
> Collection
> List extends Collection
> Set extends Collection
> SortedSet extends Set
> Map
> SortedMap extend Map
> Iterator
>
> Implementation Helper Classes:
> AbstractCollection implements Collection - skeletal (mostly abstract)
> AbstractList implements List extends AbstractCollection - skeletal (mostly abstract)
> AbstractSequentialList implements List extends AbstractList - skeletal (mostly abstract)
> AbstractSet implements Set extends AbstractCollection - skeletal (mostly abstract)
> AbstractMap implements Map - skeletal (mostly abstract)
>
> Classes (ones that can be used):
> Vector implements List extends AbstractList - growable array of objects
> ArrayList implements List extends AbstractList - Resizable-array implementation of the List
> interface
> LinkedList implements List extends AbstractSequentialList - doubly linked list
> Stack extends Vector - standard stack
> HashSet implements Set extends AbstractSet - composition HashMap
> TreeSet implements SortedSet extends AbstractSet - composition TreeMap
> LinkedHashSet implements Set extends HashSet - better performance HashSet for some operations
> HashMap implements Map extends AbstractMap - Hash table based implementation
> LinkedHashMap extends HashMap - like LinkedHashSet, but for Maps
> IdentityHashMap implements Map - uses reference-equality instead object-equality
> TreeMap implements SortedMap extends AbstractMap - Red-Black Tree using keys
>
> Stuff not currently in Java directly, but trivial to implement using above
> classes:
> Queue - composition LinkedList
> Deque - composition LinkedList
> PriorityQueue - ?
>
> Further questions for doing Iterators. Does PHP support
> inner/anonymous classes?
> I found this old posting:
>
> http://www.phpbuilder.com/mail/php-developer-list/199909/0739.php
> How much of this has changed with ZE2 ?