Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question on in memory find criteria

 
Reshma Das
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iam storing the data in in memory vector. whenever user reserves a seat this gets updated. any new client gets the fresh data from memory. but since criteriaFind returns DataInfo[] iam not able to do search on in memory vector becoz
if i do search from memory the code becomes too complex, extracting the data from vector placing in array. searching it . storing in new vector. then again convert it back to datainfo objects.
at client side reconvert datainfo[] back to vector.
it is too complex.
is it find to do search on file direcly?
iam using JTable9vector, vector);
thanks
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DOn't store in memory. Don't worry about making many calls to the server to do your search. It is fine, you will not get docked any points. Plus your code will be cleaner and easier to read, which will get you more points.
Just have a call to criteriaFind with the string or a HashSet, and have it create the DataInfo[] array, and then wrap it into your TableModel class you created by extending AbstractTableModel, and pass the new TableModel to the setModel() method into your JTable class , and your done. In my case it automatically refreshed the JTable.
And the code is really that small.
Mark
 
Reshma Das
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the constructor u used for ur jtable?
iam using vector,vector.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first to create I used


Here is the constructor for my Abstract Table Model called FlightTableModel.

Hope that helps
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic