yangxu998 / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Filtering methods for Tables #606

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Tables don't have filtering and transforming methods (although those can be 
applied to the Table views).

Original issue reported on code.google.com by ted.zlat...@gmail.com on 15 Apr 2011 at 3:42

GoogleCodeExporter commented 9 years ago
Do you mean the Map views?

Original comment by wasserman.louis on 15 Apr 2011 at 8:52

GoogleCodeExporter commented 9 years ago
Yes, I mean the Table views which are Maps, like Table.row() :)

Original comment by ted.zlat...@gmail.com on 15 Apr 2011 at 9:08

GoogleCodeExporter commented 9 years ago
Implementation of Tables.transformCells() is up at 
http://codereview.appspot.com/4442047/.

Original comment by wasserman.louis on 15 Apr 2011 at 10:01

GoogleCodeExporter commented 9 years ago
Very cool, that takes care of transformations.  I hope filtering is as easy!

Original comment by ted.zlat...@gmail.com on 15 Apr 2011 at 10:24

GoogleCodeExporter commented 9 years ago
Well, it ain't, but here it is anyway.  http://codereview.appspot.com/4425056/

Mind, I'm not yet convinced it's widely needed enough to merit addition.  Do 
you have a particular use case in mind?

Original comment by wasserman.louis on 19 Apr 2011 at 8:01

GoogleCodeExporter commented 9 years ago
Again, very cool.

One of my use cases is to build several TableModels for JTables from a single 
underlying Table, where the final rendered and view are not aware of the 
underlying Table or the objects it holds, only what's been filtered and 
transformed.  I'm using GlazedLists to do this currently and converting back 
and forth between its lists and the Guava data models is killing me.

Another use case, which is not covered by your code, is aggregating table rows 
and columns (general reduce functionality).  For example if I have 200 users in 
my Table, it would be nice to be able to derive a Table that groups users by 
department and shows each departments as a row.  GlazedLists calls that a 
GroupingList.  But you probably will consider that outside the scope of the 
original ticket.

Original comment by ted.zlat...@gmail.com on 20 Apr 2011 at 1:31

GoogleCodeExporter commented 9 years ago

Original comment by fry@google.com on 2 May 2011 at 12:39

GoogleCodeExporter commented 9 years ago
Can this issue be reopened for the Table filtering part? My particular use case 
is finding all row/column keys that point to a particular value. I have these 
working:

   Collections2.filter(collection, equalTo(something))
   Maps.filterValues(map, equalTo(something))
   Multimaps.filterValues(multimap, equalTo(something))

But this can't be easily done for Table.

Original comment by daniel.y...@gmail.com on 4 May 2012 at 12:30

GoogleCodeExporter commented 9 years ago
Makes sense -- and we do already have an implementation available.  I suppose 
the question is whether or not we are okay with the added API weight.

Original comment by wasserman.louis on 4 May 2012 at 4:13

GoogleCodeExporter commented 9 years ago
Did I miss something? Reading comment 5 (provides a patch for filtering 
methods) and 7 (says fixed in release10), I thought the filtering methods would 
be available in Tables.filter*. They are not, AFAI can see, in v12. Has it been 
implemented then reverted (in which case, why?), or is it not yet included?

I would be most interested by filtered views, especially on rows and columns.

Original comment by olivier.cailloux on 17 May 2012 at 2:43

GoogleCodeExporter commented 9 years ago
Not sure, although filtering methods for these are *complicated.*  
Multimaps.filter was bad enough.

Original comment by wasserman.louis on 17 May 2012 at 3:13

GoogleCodeExporter commented 9 years ago
Oops, probalby we got mixed up with transformValues.  We haven't checked in an 
implementation internally.  It may happen one day.

Original comment by cpov...@google.com on 17 May 2012 at 3:15

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 17 May 2012 at 6:06

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 30 May 2012 at 7:43

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 22 Jun 2012 at 6:16

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:18

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09