Java Doc for CollectionFunctions.java in  » Development » JoSQL » org » josql » functions » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » JoSQL » org.josql.functions 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.josql.functions.AbstractFunctionHandler
      org.josql.functions.CollectionFunctions

CollectionFunctions
public class CollectionFunctions extends AbstractFunctionHandler (Code)
Defines a set of functions that operate on "collections" of objects in some way.


Field Summary
final public static  StringHANDLER_ID
     The id that can be used to get the "CollectionFunctions" handler object from the Query object.


Method Summary
public  Listcollect(List objs, Expression exp, String saveValueName)
    
public  Listcollect(Expression exp)
    
public  Listcollect(List allobjs, Expression exp)
    
public  intcount(List objs, Expression exp, Object value)
     For each of the objects in the objs List get the value from each one using the accessor and compare it to the value parameter.
public  intcount(Expression exp)
    
public  intcount(List allobjs, Expression exp)
    
public  Listfind(List objs, Expression exp)
     Find objects from the List based upon the expression passed in.
public  Listforeach(Expression exp)
    
public  Listforeach(List allobjs, Expression exp)
    
public  Listforeach(List objs, String exp)
     Given a list of objects, execute the expression against each one and return those objects that return a true value for the expression. In effect this is equivalent to executing the WHERE clause of a JoSQL statement against each object (which in fact is what happens internally).
public  Listforeach(Expression listFunction, Expression exp)
    
public  Objectget(Map m, Expression exp)
     Get a value from the specified Map.
Parameters:
  m - The map of objects.
Parameters:
  exp - The expression is evaluated (in the context of the current object) and the value returned used as the key to the Map, the value it maps to (which may be null) is returned.
public  Objectget(List l, Number n)
     Get a value from the specified List.
Parameters:
  l - The list of objects.
Parameters:
  n - The index, indices start at 0.
public  Mapgrp(List objs, Expression exp)
     Group objects from the List based upon the expression passed in.
public  Listsort(List objs)
     Sort a list according to it's "natural" ordering (see Collections.sort(List) ).
Parameters:
  objs - The list of objects to sort.
public  Listsort(Map m)
     Sort a Map by the keys in ascending order (for more optionality in the sort and ordering see: CollectionFunctions.sort(Map,String,String) ).
Parameters:
  m - The map to sort.
public  Listsort(Map m, String type)
     Sort a Map by it's keys or values in ascending order (for more optionality in the sort and ordering see: CollectionFunctions.sort(Map,String,String) ).
Parameters:
  m - The map to sort.
Parameters:
  type - Should be either: "key" or "value" to indicate which item to sort on.Use null for key.
public  Listsort(Map m, String type, String dir)
     Sort a Map by either it's key or value.
Parameters:
  m - The map to sort.
Parameters:
  type - Should be either: "key" or "value" to indicate which item to sort on.Use null for key.
Parameters:
  dir - The direction you want to sort on, either "asc" or "desc".
public  ListtoList(List allobjs, Expression exp, String saveValueName)
    
public  ListtoList(Expression exp)
    
public  ListtoList(List allobjs, Expression exp)
    
public  Listunique(List objs)
    
public  Listunique(Expression exp)
    
public  Listunique(List objs, Expression exp)
    

Field Detail
HANDLER_ID
final public static String HANDLER_ID(Code)
The id that can be used to get the "CollectionFunctions" handler object from the Query object.





Method Detail
collect
public List collect(List objs, Expression exp, String saveValueName) throws QueryExecutionException(Code)



collect
public List collect(Expression exp) throws QueryExecutionException(Code)



collect
public List collect(List allobjs, Expression exp) throws QueryExecutionException(Code)



count
public int count(List objs, Expression exp, Object value) throws QueryExecutionException(Code)
For each of the objects in the objs List get the value from each one using the accessor and compare it to the value parameter. The value param is converted to a string and then to a Boolean value using: Boolean.valueOf(String) .
Parameters:
  objs - The list of objects to iterate over.
Parameters:
  exp - The expression to use to get the value from the object in the List.
Parameters:
  value - The value to compare the result of the accessor against. If the parm is nullthen it defaults to Boolean.FALSE. A count of how many times the accessor evaluated to the same value of the value parm.
throws:
  QueryExecutionException - If the value from the accessor cannot be gained or ifthe compare cannot be performed.



count
public int count(Expression exp) throws QueryExecutionException(Code)



count
public int count(List allobjs, Expression exp) throws QueryExecutionException(Code)



find
public List find(List objs, Expression exp) throws QueryExecutionException(Code)
Find objects from the List based upon the expression passed in. If the expression evaluates to true then the object will be returned. Note: in accordance with the general operating methodology for the Query object, the ":_allobjs" special bind variable will be set to the the List passed in and the "_currobj" will be set to the relevant object in the List.
Parameters:
  objs - The List of objects to search.
Parameters:
  exp - The expression to evaulate against each object in the List. The List of matching objects, if none match then an empty list is returned.
throws:
  QueryExecutionException - If the expression cannot be evaulated against eachobject.



foreach
public List foreach(Expression exp) throws QueryExecutionException(Code)



foreach
public List foreach(List allobjs, Expression exp) throws QueryExecutionException(Code)



foreach
public List foreach(List objs, String exp) throws QueryExecutionException(Code)
Given a list of objects, execute the expression against each one and return those objects that return a true value for the expression. In effect this is equivalent to executing the WHERE clause of a JoSQL statement against each object (which in fact is what happens internally). The class for the objects if found by examining the list passed in.
Parameters:
  objs - The list of objects.
Parameters:
  exp - The expression (basically a where clause, it is ok for the expressionto start with "WHERE", case-insensitive) to execute for each of theobjects. The list of matching objects.



foreach
public List foreach(Expression listFunction, Expression exp) throws QueryExecutionException(Code)



get
public Object get(Map m, Expression exp) throws QueryExecutionException(Code)
Get a value from the specified Map.
Parameters:
  m - The map of objects.
Parameters:
  exp - The expression is evaluated (in the context of the current object) and the value returned used as the key to the Map, the value it maps to (which may be null) is returned. The value that the exp value maps to, may be null.



get
public Object get(List l, Number n)(Code)
Get a value from the specified List.
Parameters:
  l - The list of objects.
Parameters:
  n - The index, indices start at 0. The value of the ith element from the list of objects. Return nullif n is out of range.



grp
public Map grp(List objs, Expression exp) throws QueryExecutionException(Code)
Group objects from the List based upon the expression passed in. The expression is evaulated for each object, by calling: Expression.getValue(ObjectQuery) and the return value used as the key to the Map. All objects with that value are added to a List held against the key. To maintain the ordering of the keys (if desirable) a LinkedHashMap is used as the return Map. Note: in accordance with the general operating methodology for the Query object, the ":_allobjs" special bind variable will be set to the the List passed in and the "_currobj" will be set to the relevant object in the List.
Parameters:
  objs - The List of objects to search.
Parameters:
  exp - The expression to evaulate against each object in the List. The LinkedHashMap of matching objects, grouped according to the return valueof executing the expression against each object in the input List.
throws:
  QueryExecutionException - If the expression cannot be evaulated against eachobject.



sort
public List sort(List objs)(Code)
Sort a list according to it's "natural" ordering (see Collections.sort(List) ).
Parameters:
  objs - The list of objects to sort. The sorted list, according to their natural ordering.



sort
public List sort(Map m)(Code)
Sort a Map by the keys in ascending order (for more optionality in the sort and ordering see: CollectionFunctions.sort(Map,String,String) ).
Parameters:
  m - The map to sort. A List sorted according to the key in ascending order.



sort
public List sort(Map m, String type)(Code)
Sort a Map by it's keys or values in ascending order (for more optionality in the sort and ordering see: CollectionFunctions.sort(Map,String,String) ).
Parameters:
  m - The map to sort.
Parameters:
  type - Should be either: "key" or "value" to indicate which item to sort on.Use null for key. A List sorted according to the key in ascending order.



sort
public List sort(Map m, String type, String dir)(Code)
Sort a Map by either it's key or value.
Parameters:
  m - The map to sort.
Parameters:
  type - Should be either: "key" or "value" to indicate which item to sort on.Use null for key.
Parameters:
  dir - The direction you want to sort on, either "asc" or "desc". Use nullfor "asc". A List sorted according to the key or value.



toList
public List toList(List allobjs, Expression exp, String saveValueName) throws QueryExecutionException(Code)



toList
public List toList(Expression exp) throws QueryExecutionException(Code)



toList
public List toList(List allobjs, Expression exp) throws QueryExecutionException(Code)



unique
public List unique(List objs)(Code)



unique
public List unique(Expression exp) throws QueryExecutionException(Code)



unique
public List unique(List objs, Expression exp) throws QueryExecutionException(Code)



Fields inherited from org.josql.functions.AbstractFunctionHandler
protected Query q(Code)(Java Doc)

Methods inherited from org.josql.functions.AbstractFunctionHandler
public void setQuery(Query q)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.