Java Doc for DataUtilities.java in  » GIS » GeoTools-2.4.1 » org » geotools » data » 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 » GIS » GeoTools 2.4.1 » org.geotools.data 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.data.DataUtilities

DataUtilities
public class DataUtilities (Code)
Utility functions for use when implementing working with data classes.

TODO: Move FeatureType manipulation to feature package


author:
   Jody Garnett, Refractions Research

Inner Class :abstract static class Traversal extends DefaultFilterVisitor

Field Summary
static  FilterFactoryff
    
static  MaptypeMap
    


Method Summary
public static  String[]attributeNames(FeatureType featureType)
    
public static  String[]attributeNames(Filter filter, FeatureType featureType)
     Traverses the filter and returns any encoutered property names.
public static  String[]attributeNames(Filter filter)
     Traverses the filter and returns any encoutered property names.
public static  String[]attributeNames(Expression expression, FeatureType featureType)
     Traverses the expression and returns any encoutered property names.
public static  String[]attributeNames(Expression expression)
     Traverses the expression and returns any encoutered property names.
public static  booleanattributesEqual(Object att, Object otherAtt)
    
public static  Envelopebounds(FeatureCollection collection)
     Manually calculates the bounds of a feature collection.
public static  FeatureCollectioncollection(Feature[] features)
     Copies the provided features into a FeatureCollection.
public static  FeatureCollectioncollection(Feature feature)
     Copies the provided features into a FeatureCollection.
public static  FeatureCollectioncollection(FeatureReader reader)
     Copies the provided reader into a FeatureCollection, reader will be closed.
public static  FeatureCollectioncollection(FeatureIterator reader)
     Copies the provided reader into a FeatureCollection, reader will be closed.
public static  intcompare(FeatureType typeA, FeatureType typeB)
     Compare operation for FeatureType.

Results in:

  • 1: if typeA is a sub type/reorder/renamespace of typeB
  • 0: if typeA and typeB are the same type
  • -1: if typeA is not subtype of typeB

Comparison is based on AttributeTypes, an IOException is thrown if the AttributeTypes are not compatiable.

Namespace is not considered in this opperations.

static  AttributeTypecreateAttribute(String typeSpec)
     Returns AttributeType based on String specification (based on UML).
public static  FeatureTypecreateSubType(FeatureType featureType, String[] properties, CoordinateReferenceSystem override)
    
public static  FeatureTypecreateSubType(FeatureType featureType, String[] properties, CoordinateReferenceSystem override, String typeName, URI namespace)
    
public static  FeatureTypecreateSubType(FeatureType featureType, String[] properties)
    
public static  FeatureTypecreateType(String identification, String typeSpec)
     Utility method for FeatureType construction.
public static  ObjectdefaultValue(AttributeType attributeType)
     Provides a defautlValue for attributeType.
public static  ObjectdefaultValue(Class type)
     Returns a non-null default value for the class that is passed in.
public static  Object[]defaultValues(FeatureType featureType)
    
public static  Object[]defaultValues(FeatureType featureType, Object[] values)
    
public static  booleanisMatch(AttributeType a, AttributeType b)
    
public static  QuerymixQueries(Query firstQuery, Query secondQuery, String handle)
     Takes two Query objects and produce a new one by mixing the restrictions of both of them.

The policy to mix the queries components is the following:

  • typeName: type names MUST match (not checked if some or both queries equals to Query.ALL)
  • handle: you must provide one since no sensible choice can be done between the handles of both queries
  • maxFeatures: the lower of the two maxFeatures values will be used (most restrictive)
  • attributeNames: the attributes of both queries will be joined in a single set of attributes.
public static  Featureparse(FeatureType type, String fid, String[] text)
    
public static  FeaturereType(FeatureType featureType, Feature feature)
     Creates duplicate of feature adjusted to the provided featureType.
public static  FeatureReaderreader(Feature[] features)
     Creates a FeatureReader for testing.
public static  FeatureReaderreader(Collection collection)
    
public static  FeatureCollectionresults(Feature[] featureArray)
    
public static  FeatureCollectionresults(FeatureCollection collection)
     Returns collection if non empty.
public static  FeatureSourcesource(Feature[] featureArray)
    
public static  FeatureSourcesource(FeatureCollection collection)
    
public static  Stringspec(FeatureType featureType)
    
public static  Featuretemplate(FeatureType featureType)
     Constructs an empty feature to use as a Template for new content.
public static  Featuretemplate(FeatureType featureType, String featureID)
    
public static  Featuretemplate(FeatureType featureType, Object[] atts)
    
public static  Featuretemplate(FeatureType featureType, String featureID, Object[] atts)
    
public static  voidtraverse(Filter filter, FilterVisitor visitor)
    
public static  voidtraverse(Expression expression, FilterVisitor visitor)
    
public static  voidtraverse(Set set, FilterVisitor visitor)
     Performs a depth first traversal on Filter.
public static  SettraverseDepth(Filter filter)
     Performs a depth first traversal of Filter.
public static  SettraverseDepth(Expression expression)
     Performs a depth first traversal of Filter.
static  Classtype(String typeName)
    
static  StringtypeMap(Class type)
    
public static  FileurlToFile(URL url)
     Takes a URL and converts it to a File.

Field Detail
ff
static FilterFactory ff(Code)



typeMap
static Map typeMap(Code)





Method Detail
attributeNames
public static String[] attributeNames(FeatureType featureType)(Code)
DOCUMENT ME!
Parameters:
  featureType - DOCUMENT ME! DOCUMENT ME!



attributeNames
public static String[] attributeNames(Filter filter, FeatureType featureType)(Code)
Traverses the filter and returns any encoutered property names.

The feautre type is supplied as contexts used to lookup expressions in cases where the attributeName does not match the actual name of the type.




attributeNames
public static String[] attributeNames(Filter filter)(Code)
Traverses the filter and returns any encoutered property names. DataUtilities.attributeNames(Filter,FeatureType)



attributeNames
public static String[] attributeNames(Expression expression, FeatureType featureType)(Code)
Traverses the expression and returns any encoutered property names.

The feautre type is supplied as contexts used to lookup expressions in cases where the attributeName does not match the actual name of the type.




attributeNames
public static String[] attributeNames(Expression expression)(Code)
Traverses the expression and returns any encoutered property names. DataUtilities.attributeNames(Expression,FeatureType)



attributesEqual
public static boolean attributesEqual(Object att, Object otherAtt)(Code)
DOCUMENT ME!
Parameters:
  att - DOCUMENT ME!
Parameters:
  otherAtt - DOCUMENT ME! DOCUMENT ME!



bounds
public static Envelope bounds(FeatureCollection collection)(Code)
Manually calculates the bounds of a feature collection.
Parameters:
  collection -



collection
public static FeatureCollection collection(Feature[] features)(Code)
Copies the provided features into a FeatureCollection.

Often used when gathering features for FeatureStore:


 featureStore.addFeatures( DataUtilities.collection(array));
 

Parameters:
  features - Array of features FeatureCollection



collection
public static FeatureCollection collection(Feature feature)(Code)
Copies the provided features into a FeatureCollection.

Often used when gathering features for FeatureStore:


 featureStore.addFeatures( DataUtilities.collection(feature));
 

Parameters:
  features - Array of features FeatureCollection



collection
public static FeatureCollection collection(FeatureReader reader) throws IOException(Code)
Copies the provided reader into a FeatureCollection, reader will be closed.

Often used when gathering features for FeatureStore:


 featureStore.addFeatures( DataUtilities.collection(reader));
 

Parameters:
  features - Array of features FeatureCollection



collection
public static FeatureCollection collection(FeatureIterator reader) throws IOException(Code)
Copies the provided reader into a FeatureCollection, reader will be closed.

Often used when gathering features for FeatureStore:


 featureStore.addFeatures( DataUtilities.collection(reader));
 

Parameters:
  features - Array of features FeatureCollection



compare
public static int compare(FeatureType typeA, FeatureType typeB)(Code)
Compare operation for FeatureType.

Results in:

  • 1: if typeA is a sub type/reorder/renamespace of typeB
  • 0: if typeA and typeB are the same type
  • -1: if typeA is not subtype of typeB

Comparison is based on AttributeTypes, an IOException is thrown if the AttributeTypes are not compatiable.

Namespace is not considered in this opperations. You may still need to reType to get the correct namesapce, or reorder.


Parameters:
  typeA - FeatureType beind compared
Parameters:
  typeB - FeatureType being compared against



createAttribute
static AttributeType createAttribute(String typeSpec) throws SchemaException(Code)
Returns AttributeType based on String specification (based on UML).

Will parse a String of the form: "name:Type:hint"

Where Type is:

  • 0,Interger,int: represents Interger
  • 0.0, Double, double: represents Double
  • "",String,string: represents String
  • Geometry: represents Geometry
  • full.class.path: represents java type

Where hint is "hint1;hint2;...;hintN", in which "hintN" is one of:

  • nillable
  • srid=<#>


Parameters:
  typeSpec -
throws:
  SchemaException - If typeSpect could not be interpreted



createSubType
public static FeatureType createSubType(FeatureType featureType, String[] properties, CoordinateReferenceSystem override) throws SchemaException(Code)
Create a derived FeatureType


Parameters:
  featureType -
Parameters:
  properties - - if null, every property of the feature type in input will be used
Parameters:
  override -
throws:
  SchemaException -



createSubType
public static FeatureType createSubType(FeatureType featureType, String[] properties, CoordinateReferenceSystem override, String typeName, URI namespace) throws SchemaException(Code)



createSubType
public static FeatureType createSubType(FeatureType featureType, String[] properties) throws SchemaException(Code)
DOCUMENT ME!
Parameters:
  featureType - DOCUMENT ME!
Parameters:
  properties - DOCUMENT ME! DOCUMENT ME!
throws:
  SchemaException - DOCUMENT ME!



createType
public static FeatureType createType(String identification, String typeSpec) throws SchemaException(Code)
Utility method for FeatureType construction.

Will parse a String of the form: "name:Type,name2:Type2,..."

Where Type is defined by createAttribute.

You may indicate the default Geometry with an astrix: "*geom:Geometry".

Example:name:"",age:0,geom:Geometry,centroid:Point,url:java.io.URL"


Parameters:
  identification - identification of FeatureType:(namesapce).typeName
Parameters:
  typeSpec - Specification for FeatureType
throws:
  SchemaException -



defaultValue
public static Object defaultValue(AttributeType attributeType) throws IllegalAttributeException(Code)
Provides a defautlValue for attributeType.

Will return null if attributeType isNillable(), or attempt to use Reflection, or attributeType.parse( null )


Parameters:
  attributeType - null for nillable attributeType, attempt at reflection
throws:
  IllegalAttributeException - If value cannot be constructed forattribtueType



defaultValue
public static Object defaultValue(Class type)(Code)
Returns a non-null default value for the class that is passed in. This is a helper class an can't create a default class for any type but it does support:
  • String
  • Object - will return empty string
  • Number
  • Character
  • JTS Geometries

Parameters:
  type -



defaultValues
public static Object[] defaultValues(FeatureType featureType) throws IllegalAttributeException(Code)
DOCUMENT ME!
Parameters:
  featureType - DOCUMENT ME! DOCUMENT ME!
throws:
  IllegalAttributeException - DOCUMENT ME!



defaultValues
public static Object[] defaultValues(FeatureType featureType, Object[] values) throws IllegalAttributeException(Code)
DOCUMENT ME!
Parameters:
  featureType - DOCUMENT ME!
Parameters:
  values - DOCUMENT ME! DOCUMENT ME!
throws:
  IllegalAttributeException - DOCUMENT ME!
throws:
  ArrayIndexOutOfBoundsException - DOCUMENT ME!



isMatch
public static boolean isMatch(AttributeType a, AttributeType b)(Code)
DOCUMENT ME!
Parameters:
  a - DOCUMENT ME!
Parameters:
  b - DOCUMENT ME! DOCUMENT ME!



mixQueries
public static Query mixQueries(Query firstQuery, Query secondQuery, String handle)(Code)
Takes two Query objects and produce a new one by mixing the restrictions of both of them.

The policy to mix the queries components is the following:

  • typeName: type names MUST match (not checked if some or both queries equals to Query.ALL)
  • handle: you must provide one since no sensible choice can be done between the handles of both queries
  • maxFeatures: the lower of the two maxFeatures values will be used (most restrictive)
  • attributeNames: the attributes of both queries will be joined in a single set of attributes. IMPORTANT: only explicitly requested attributes will be joint, so, if the method retrieveAllProperties() of some of the queries returns true it does not means that all the properties will be joined. You must create the query with the names of the properties you want to load.
  • filter: the filtets of both queries are or'ed


Parameters:
  firstQuery - Query against this DataStore
Parameters:
  secondQuery - DOCUMENT ME!
Parameters:
  handle - DOCUMENT ME! Query restricted to the limits of definitionQuery
throws:
  NullPointerException - if some of the queries is null
throws:
  IllegalArgumentException - if the type names of both queries donot match



parse
public static Feature parse(FeatureType type, String fid, String[] text) throws IllegalAttributeException(Code)
DOCUMENT ME!
Parameters:
  type - DOCUMENT ME!
Parameters:
  fid - DOCUMENT ME!
Parameters:
  text - DOCUMENT ME! DOCUMENT ME!
throws:
  IllegalAttributeException - DOCUMENT ME!



reType
public static Feature reType(FeatureType featureType, Feature feature) throws IllegalAttributeException(Code)
Creates duplicate of feature adjusted to the provided featureType.
Parameters:
  featureType - FeatureType requested
Parameters:
  feature - Origional Feature from DataStore An instance of featureType based on feature
throws:
  IllegalAttributeException - If opperation could not be performed



reader
public static FeatureReader reader(Feature[] features) throws IOException(Code)
Creates a FeatureReader for testing.
Parameters:
  features - Array of features FeatureReader spaning provided feature array
throws:
  IOException - If provided features Are null or empty
throws:
  NoSuchElementException - DOCUMENT ME!



reader
public static FeatureReader reader(Collection collection) throws IOException(Code)
DOCUMENT ME!
Parameters:
  collection - DOCUMENT ME! DOCUMENT ME!
throws:
  IOException - DOCUMENT ME!



results
public static FeatureCollection results(Feature[] featureArray)(Code)



results
public static FeatureCollection results(FeatureCollection collection)(Code)
Returns collection if non empty.
Parameters:
  collection - provided collection
throws:
  IOException - Raised if collection was empty



source
public static FeatureSource source(Feature[] featureArray)(Code)
DOCUMENT ME!
Parameters:
  featureArray - DOCUMENT ME! DOCUMENT ME!
throws:
  IOException - DOCUMENT ME!
throws:
  RuntimeException - DOCUMENT ME!



source
public static FeatureSource source(FeatureCollection collection)(Code)
DOCUMENT ME!
Parameters:
  collection - DOCUMENT ME! DOCUMENT ME!
throws:
  NullPointerException - DOCUMENT ME!
throws:
  RuntimeException - DOCUMENT ME!



spec
public static String spec(FeatureType featureType)(Code)
Record typeSpec for the provided featureType
Parameters:
  featureType - DOCUMENT ME! DOCUMENT ME!



template
public static Feature template(FeatureType featureType) throws IllegalAttributeException(Code)
Constructs an empty feature to use as a Template for new content.

We may move this functionality to FeatureType.create( null )?


Parameters:
  featureType - Type of feature we wish to create A new Feature of type featureType
throws:
  IllegalAttributeException - if we could not create featureTypeinstance with acceptable default values



template
public static Feature template(FeatureType featureType, String featureID) throws IllegalAttributeException(Code)
DOCUMENT ME!
Parameters:
  featureType - DOCUMENT ME!
Parameters:
  featureID - DOCUMENT ME! DOCUMENT ME!
throws:
  IllegalAttributeException - DOCUMENT ME!



template
public static Feature template(FeatureType featureType, Object[] atts) throws IllegalAttributeException(Code)
DOCUMENT ME!
Parameters:
  featureType - DOCUMENT ME!
Parameters:
  atts - DOCUMENT ME! DOCUMENT ME!
throws:
  IllegalAttributeException - DOCUMENT ME!



template
public static Feature template(FeatureType featureType, String featureID, Object[] atts) throws IllegalAttributeException(Code)
DOCUMENT ME!
Parameters:
  featureType - DOCUMENT ME!
Parameters:
  featureID - DOCUMENT ME!
Parameters:
  atts - DOCUMENT ME! DOCUMENT ME!
throws:
  IllegalAttributeException - DOCUMENT ME!



traverse
public static void traverse(Filter filter, FilterVisitor visitor)(Code)

Parameters:
  filter - DOCUMENT ME!
Parameters:
  visitor - DOCUMENT ME!



traverse
public static void traverse(Expression expression, FilterVisitor visitor)(Code)

Parameters:
  expression - DOCUMENT ME!
Parameters:
  visitor - DOCUMENT ME!



traverse
public static void traverse(Set set, FilterVisitor visitor)(Code)
Performs a depth first traversal on Filter.

Filters can contain Expressions and other Filters, this method will call visitor.visit( Filter ) and visitor.visit( Expression )


Parameters:
  set - Set of Filter and Expression information
Parameters:
  visitor - Vistor to traverse across set



traverseDepth
public static Set traverseDepth(Filter filter)(Code)
Performs a depth first traversal of Filter.
Parameters:
  filter - Set of Filters in traversing filter



traverseDepth
public static Set traverseDepth(Expression expression)(Code)
Performs a depth first traversal of Filter.
Parameters:
  expression - Set of Filters in traversing filter



type
static Class type(String typeName) throws ClassNotFoundException(Code)



typeMap
static String typeMap(Class type)(Code)



urlToFile
public static File urlToFile(URL url)(Code)
Takes a URL and converts it to a File. The attempts to deal with Windows UNC format specific problems, specifically files located on network shares and different drives. If the URL.getAuthority() returns null or is empty, then only the url's path property is used to construct the file. Otherwise, the authority is prefixed before the path. It is assumed that url.getProtocol returns "file". Authority is the drive or network share the file is located on. Such as "C:", "E:", "\\fooServer"
Parameters:
  url - a URL object that uses protocol "file" a File that corresponds to the URL's location



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.