Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (575)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  ReadWriteCollection for entities  (Read 4978 times)
0 Members and 1 Guest are viewing this topic.
Online matheus23

JGO Kernel


Medals: 109
Projects: 3


You think about my Avatar right now!


« Reply #30 - Posted 2013-03-07 17:38:08 »

Yeah but how do I actually do sorting with that collection? Or am I asking something plain stupid here? It doesn't look like this is possible with your code yet...
You have a
1  
private E[] items;

It's dead simple to just use
Arrays.sort(items);
, right?

Nope, because the Collection seems to save some more data, which could be invalidated:
1  
   private int iterateIndex, retainIndex, endIndex;

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline theagentd
« Reply #31 - Posted 2013-03-07 21:37:17 »

That shouldn't matter. The sort shouldn't move anything around enough to break the whole list. Besides, I never said that you should throw it directly into Arrays.sort(). I just meant that it should be extremely easy to implement it.

Myomyomyo.
Offline princec

JGO Kernel


Medals: 404
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #32 - Posted 2013-03-07 21:55:57 »

... again still missing the point of this collection, it's for where the natural ordering of the elements is the order in which they were added. If you're sorting it you're using the wrong collection in the first place.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Agro
« Reply #33 - Posted 2013-03-07 23:56:44 »

Ah, Arrays.sort helped me. Thanks

Offline ctomni231

JGO Wizard


Medals: 99
Projects: 1
Exp: 7 years


Not a glitch. Just have a lil' pixelexia...


« Reply #34 - Posted 2013-03-08 00:16:01 »

Yeah but how do I actually do sorting with that collection? Or am I asking something plain stupid here? It doesn't look like this is possible with your code yet...

I did read the replies to this question Tongue, but maybe an example will be better.

http://www.java-gaming.org/topics/ringvibe/27700/msg/248929/view.html#msg248929

In the game I made, I used an array for the rings. Each ring has a lifetime where it gets created and deleted. Riven's collection code helps with organizing this type of array. The rings don't need to be sorted... they just need to destroy and create themselves without causing an error. Creating and deleting the elements at the same time during an array is really bad news Tongue

Offline ShannonSmith
« Reply #35 - Posted 2013-03-08 03:19:43 »

I must say Riven since you started working for Cas you have been making some pretty cool stuff. This coupled with that continuations lib is giving me all sorts of ideas about simulating massive populations of all sorts of things. 
Offline princec

JGO Kernel


Medals: 404
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #36 - Posted 2013-03-08 10:27:07 »

Not for but with I should emphasise.

Cas Smiley

Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (35 views)
2014-10-17 03:59:02

Norakomi (26 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (26 views)
2014-10-15 16:18:58

TehJavaDev (50 views)
2014-10-14 00:39:48

TehJavaDev (52 views)
2014-10-14 00:35:47

TehJavaDev (40 views)
2014-10-14 00:32:37

BurntPizza (63 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (76 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!