Java Doc for DataStoreEvaluator.java in  » J2EE » Sofia » com » salmonllc » sql » 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 » J2EE » Sofia » com.salmonllc.sql 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.salmonllc.sql.DataStoreEvaluator

DataStoreEvaluator
public class DataStoreEvaluator implements java.io.Serializable(Code)
This type is used to evaluate java-like expressions using rows in a DataBuffer. The class needs to be passed a String containing the expression that will be used. This expression will be parsed and evaluated using the evaluate row method.The rules for expressions are as follows:

Column names: Columns in the datastore can be referenced in the same way that they are referenced in the get and set methods in the datastore. Generally this is either by using tablename.columnname or a single intenral name string. Which you can use depends on how the column was added to the datastore.

Comparisons: You can use ==, >=, <=, !=, > or < comparisons in your expressions. Use these to compare the values of Strings, Dates, Numbers or Booleans. (Note: The values of each part of the comparison will be used as opposed to the default java method which will test object references).

Operators: You can use +, -, /, * and ^ (exponent) to perform operations on numeric values. The + operator may also be used to concatinate String values.
In addition the if operator can be used to return a value based on a comparison. The syntax for if is : if(comparison,truevalue,falsevalue)

Literals: String Literals are surrounded by double quotes, Date, DateTime or Time Literals are also surrounded by quotes and in JDBC date escape form YYYY-MM-DD for dates, HH:MM:SS for times and a combination of the two for DateTimes

Nulls: The constant "null" can be used to check for columns values that are filled in. The equals(==) and not equals(!=) comparisons will return valid results when used with null. Every other comparison returns false when used with a null value on either side of the expression.

Several methods are available that can be called on the various columns in the datastore. This is done by placing the method name after the column name followed by any method parameters. ex: table1.column1.substring(0,10). Methods can only be invoked on columns in the datastore, not on literals as in Java. Any method invoked on a null column will itself return null.

Examples:
 "table1.column1 == 'xxxx'"
"table1.column1.substring(2,3) + 'xxx'"
String Methods:
String substring(int start, int end): Gets a section of the String starting at start and ending at the character before end.
Integer indexOf(String subString) : Finds the first position of subString in the string or -1 if no occurance is found.
Integer lastIndexOf(String substring) : Finds the last position of subString in the string or -1 if no occurance is found.
Integer length() : Finds the length of the string in characters.
String toUpperCase(): Returns an all upper case version of the string.
String urlEncode(): Replaces ampersand, questionmarks and spaces in a String with URL Encoded Characters
String toLowerCase(): Returns an all lower case version of the string.
String trim(): Returns all leading and trailing spaces from the string.
String charAt(int position): Returns the character at position.
String startsWith(String substring): Returns true if the string starts with the specified substring.
String endsWith(String substring): Returns true if the string ends with the specified substring.
String escape(): Returns a string with quotes and spaces escaped so they work in javascript code.
String tempValue(): Returns a string with the temporary value of the column
Numeric Methods:

Double sqrt(): Returns the square root of the number.
Double round(int places): Returns the number rounded to "places" number of decimal places.
String format(String pattern): Format the value as a string using the specified pattern.

Date Methods:

Integer getMonth(): Returns the month of the given date (January = 0, Dec = 11).
Integer getDate(): Returns the day of the month of the given date.
Integer getDay(): Returns the day of the week of a given date (Sunday = 0, Saturday = 6).
Integer getYear(): Returns the year of the given date.
Integer getHours(): Returns the hours of the given time.
Integer getMinutes(): Returns the Minutes of the given time.
Integer getSeconds(): Returns the Seconds of the given time.
Date toDate(): Returns the Date portion of a DateTime.
Time toTime(): Returns the Time portion of a DateTime.
Date dateAdd(int days): Returns the specified date incremented by "days" number of days.

String format(String pattern): Format the value as a string using the specified pattern.

There are also five constants you can use
null: The value null
$DATE$:todays date as a Date value
$TIME$: todays date and time as Datetime value
$ROWNO$: the number of the row that the evaluator is evaluating
$ROWCOUNT$: the total number of the rows in the datastore
$ROWSTATUS$: the status of the row. See DatastoreBuffer.STATUS constants
$QUOT$: include a single quote in a string


Field Summary
final public static  intAGGREGATE_AVERAGE
    
final public static  intAGGREGATE_COUNT
    
final public static  intAGGREGATE_SUM
    
 int_pos
    

Constructor Summary
public  DataStoreEvaluator(DataStoreBuffer db, DataStoreExpression expression)
     This method will construct a new DataStoreEvaluator using the specified expression.
public  DataStoreEvaluator(DataStoreBuffer db, DataStoreExpression expression, String format)
     This method will construct a new DataStoreEvaluator using the specified expression.
public  DataStoreEvaluator(DataStoreBuffer db, String expression)
     This method will construct a new DataStoreEvaluator using the specified expression.
public  DataStoreEvaluator(DataStoreBuffer db, String expression, String format)
     This method will construct a new DataStoreEvaluator using the specified expression.

Method Summary
public  ObjectevaluateAggregate(int aggregateType)
     This method evaluates the expression passed in the constructor for every row in the DataStoreBuffer.
public  ObjectevaluateAggregate(int aggregateType, int startRow, int endRow)
     This method evaluates the expression passed in the constructor for every row in the DataStoreBuffer.
public  StringevaluateAggregateFormat(int aggregateType)
     This method evaluates the expression passed in the constructor for every row in the DataStoreBuffer.
public  StringevaluateAggregateFormat(int aggregateType, int startRow, int endRow)
     This method evaluates the expression passed in the constructor for every row in the DataStoreBuffer.
public  ObjectevaluateRow()
     This method evaluates the expression passed in the constructor for the current row in the DataStoreBuffer.
public  ObjectevaluateRow(int rowNo)
     This method evaluates the expression passed in the constructor for a particular row in the DataStoreBuffer.
Parameters:
  rowNo - - row The row to evaluate.
public  StringevaluateRowFormat()
     This method evaluates the expression passed in the constructor for the current row in the DataStoreBuffer.
public  StringevaluateRowFormat(int rowNo)
     This method evaluates the expression passed in the constructor for a particular row in the DataStoreBuffer.
public  DataStoreBuffergetDataStore()
    
public  DataStoreExpressiongetDataStoreExpression()
     This method gets the DataStoreExpression being used for this DataStoreEvaluator.
public  StringgetExpression()
     This method returns the original expression that will be evaluated.
public  StringgetFormat()
     This method sets the display format for the result of the expression.
public  StringgetResultBucket()
    
public static  booleanisBoolean(String token)
     This method was created in VisualAge.
public static  booleanisDate(String token)
     This method was created in VisualAge.
public static  booleanisDateTime(String token)
     This method was created in VisualAge.
public static  booleanisNumber(String token)
     This method was created in VisualAge.
public static  booleanisString(String token)
     This method was created in VisualAge.
public static  booleanisTime(String token)
     This method was created in VisualAge.
public  voidsetFormat(String format)
     This method sets the display format for the result of the expression.
public  voidsetResultBucket(String resultBucket)
    
Parameters:
  resultBucket - The resultBucket to set.

Field Detail
AGGREGATE_AVERAGE
final public static int AGGREGATE_AVERAGE(Code)



AGGREGATE_COUNT
final public static int AGGREGATE_COUNT(Code)



AGGREGATE_SUM
final public static int AGGREGATE_SUM(Code)



_pos
int _pos(Code)




Constructor Detail
DataStoreEvaluator
public DataStoreEvaluator(DataStoreBuffer db, DataStoreExpression expression) throws DataStoreException(Code)
This method will construct a new DataStoreEvaluator using the specified expression.
Parameters:
  db - The DataStoreBuffer to evaluate.
Parameters:
  expression - The expression to evaluate.



DataStoreEvaluator
public DataStoreEvaluator(DataStoreBuffer db, DataStoreExpression expression, String format) throws DataStoreException(Code)
This method will construct a new DataStoreEvaluator using the specified expression.
Parameters:
  db - The DataStoreBuffer to evaluate.
Parameters:
  expression - The expression to evaluate.
Parameters:
  format - The pattern for the output.
See Also:   DataStore.setFormat



DataStoreEvaluator
public DataStoreEvaluator(DataStoreBuffer db, String expression) throws DataStoreException(Code)
This method will construct a new DataStoreEvaluator using the specified expression.
Parameters:
  db - The DataStoreBuffer to evaluate.
Parameters:
  expression - The expression to evaluate.



DataStoreEvaluator
public DataStoreEvaluator(DataStoreBuffer db, String expression, String format) throws DataStoreException(Code)
This method will construct a new DataStoreEvaluator using the specified expression.
Parameters:
  db - The DataStoreBuffer to evaluate.
Parameters:
  expression - The expression to evaluate.
Parameters:
  format - The pattern for the output.
See Also:   DataStore.setFormat




Method Detail
evaluateAggregate
public Object evaluateAggregate(int aggregateType) throws DataStoreException(Code)
This method evaluates the expression passed in the constructor for every row in the DataStoreBuffer. A object with the result of the evaluation.
Parameters:
  aggregateType - Valid Values are:AGGREGATE_SUM, AGGREGATE_COUNT



evaluateAggregate
public Object evaluateAggregate(int aggregateType, int startRow, int endRow) throws DataStoreException(Code)
This method evaluates the expression passed in the constructor for every row in the DataStoreBuffer. A object with the result of the evaluation.
Parameters:
  aggregateType - Valid Values are:AGGREGATE_SUM, AGGREGATE_COUNT
Parameters:
  startRow - the first row to evaluate
Parameters:
  endRow - the last row to evaluate



evaluateAggregateFormat
public String evaluateAggregateFormat(int aggregateType) throws DataStoreException(Code)
This method evaluates the expression passed in the constructor for every row in the DataStoreBuffer. It will format the output according to the parrern specified and return a string version of it. A object with the result of the evaluation.
Parameters:
  aggregateType - Valid Values are:AGGREGATE_SUM, AGGREGATE_COUNT



evaluateAggregateFormat
public String evaluateAggregateFormat(int aggregateType, int startRow, int endRow) throws DataStoreException(Code)
This method evaluates the expression passed in the constructor for every row in the DataStoreBuffer. It will format the output according to the parrern specified and return a string version of it. A object with the result of the evaluation.
Parameters:
  aggregateType - Valid Values are:AGGREGATE_SUM, AGGREGATE_COUNT
Parameters:
  startRow - the first row to evaluate
Parameters:
  endRow - the last row to evaluate



evaluateRow
public Object evaluateRow() throws DataStoreException(Code)
This method evaluates the expression passed in the constructor for the current row in the DataStoreBuffer. A object with the result of the evaluation.



evaluateRow
public Object evaluateRow(int rowNo) throws DataStoreException(Code)
This method evaluates the expression passed in the constructor for a particular row in the DataStoreBuffer.
Parameters:
  rowNo - - row The row to evaluate. A object with the result of the evaluation.
throws:
  DataStoreException -



evaluateRowFormat
public String evaluateRowFormat() throws DataStoreException(Code)
This method evaluates the expression passed in the constructor for the current row in the DataStoreBuffer. It will then format the result using the format pattern and return a String version of the result; A String representation of the result of the evaluation.



evaluateRowFormat
public String evaluateRowFormat(int rowNo) throws DataStoreException(Code)
This method evaluates the expression passed in the constructor for a particular row in the DataStoreBuffer. It will then format the result using the format pattern and return a String version of the result; A String representation of the result of the evaluation.
Parameters:
  rowNo - The row to evaluate.



getDataStore
public DataStoreBuffer getDataStore()(Code)
Returns the datastore



getDataStoreExpression
public DataStoreExpression getDataStoreExpression()(Code)
This method gets the DataStoreExpression being used for this DataStoreEvaluator. DataStoreExpression



getExpression
public String getExpression()(Code)
This method returns the original expression that will be evaluated.



getFormat
public String getFormat()(Code)
This method sets the display format for the result of the expression.
See Also:    DataStore#setFormat(String,String).



getResultBucket
public String getResultBucket()(Code)
Returns the resultBucket, a column to place the value of the results of the expression.



isBoolean
public static boolean isBoolean(String token)(Code)
This method was created in VisualAge. boolean
Parameters:
  token - java.lang.String



isDate
public static boolean isDate(String token)(Code)
This method was created in VisualAge. boolean
Parameters:
  token - java.lang.String



isDateTime
public static boolean isDateTime(String token)(Code)
This method was created in VisualAge. boolean
Parameters:
  token - java.lang.String



isNumber
public static boolean isNumber(String token)(Code)
This method was created in VisualAge. boolean
Parameters:
  token - java.lang.String



isString
public static boolean isString(String token)(Code)
This method was created in VisualAge. boolean
Parameters:
  token - java.lang.String



isTime
public static boolean isTime(String token)(Code)
This method was created in VisualAge. boolean
Parameters:
  token - java.lang.String



setFormat
public void setFormat(String format)(Code)
This method sets the display format for the result of the expression.
See Also:    DataStore#setFormat(String,String).



setResultBucket
public void setResultBucket(String resultBucket)(Code)

Parameters:
  resultBucket - The resultBucket to set. A column to place the value of the results of the expression



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.