com.esri.arcgis.geodatabase
Class NetworkFieldEvaluator

java.lang.Object
  extended bycom.esri.arcgis.geodatabase.NetworkFieldEvaluator
All Implemented Interfaces:
INetworkEvaluator, INetworkEvaluator2, INetworkEvaluatorSetup, INetworkFieldEvaluator, java.io.Serializable

public class NetworkFieldEvaluator
extends java.lang.Object
implements INetworkEvaluator, INetworkEvaluator2, INetworkFieldEvaluator, INetworkEvaluatorSetup

A container for describing a network attribute evaluator whose values are derived from object field attributes.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

A NetworkFieldEvaluator is an evaluator that assigns network attribute values based on field values stored in the source feature class.

At its simplest, the NetworkFieldEvaluator  transfers the value of a specified field in the source feature to the network attribute.  An example is transferring travel_time attribute values from source features to network elements, which can then be used by the route solver.

The NetworkFieldEvaluator can also take values from two or more fields in a source and combine them in a simple mathematical expression to derive a network attribute. For example, a source feature class may have information about distance and speed of travel, but not travel time. The field expression evaluator can take the distance value, divide by travel speed, and assign the calculated travel time to a network attribute.

See Also:
Serialized Form

Constructor Summary
NetworkFieldEvaluator()
          Constructs a NetworkFieldEvaluator using ArcGIS Engine.
NetworkFieldEvaluator(java.lang.Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compare this object with another
 INetworkEvaluator getAsINetworkEvaluator()
          Deprecated. No replacement. The object reference can be directly used where the implemented interface is needed.
 INetworkEvaluator2 getAsINetworkEvaluator2()
          Deprecated. No replacement. The object reference can be directly used where the implemented interface is needed.
 INetworkEvaluatorSetup getAsINetworkEvaluatorSetup()
          Deprecated. No replacement. The object reference can be directly used where the implemented interface is needed.
 INetworkFieldEvaluator getAsINetworkFieldEvaluator()
          Deprecated. No replacement. The object reference can be directly used where the implemented interface is needed.
static java.lang.String getClsid()
           
 IUID getCLSID()
          Unique CLSID identifier for this network evaluator.
 IPropertySet getData()
          The data used by this network evaluator for custom properties.
 java.lang.String getDisplayName()
          Name displayed in the user interface for this network evaluator.
 void getExpression(java.lang.String[] expression, java.lang.String[] preLogic)
          Gets the VBScript calculator expression and pre-logic used to derive the values for this network evaluator.
 java.lang.String getName()
          Unique name of this network evaluator.
 IStringArray getRequiredFieldNames()
          Required fields of this network evaluator.
 int hashCode()
          the hashcode for this object
 void initialize(INetworkDataset networkDataset, IDENetworkDataset dataElement, INetworkSource source, IEvaluatedNetworkAttribute attribute)
          Initializes the network evaluator in preparation to evaluate the attribute value of a network element.
 boolean isCacheAttribute()
          Indicates if this evaluator's values should be computed and stored when the network is built or computed at run time and never stored.
 boolean isDataHasEdits()
          Indicates if the data for this evaluator has been edited.
 java.lang.Object queryValue(INetworkElement element, IRow row)
          Evaluates the attribute value of a network element.
 void refresh()
          .
 void setData(IPropertySet data)
          The data used by this network evaluator for custom properties.
 void setExpression(java.lang.String expression, java.lang.String preLogic)
          Sets the VBScript calculator expression and pre-logic used to derive the values for this network evaluator.
 boolean supportsDefault(int elementType, IEvaluatedNetworkAttribute attribute)
          Indicates if this network evaluator can be used as the default evaluator for the given network element type and network attribute.
 boolean supportsSource(INetworkSource source, IEvaluatedNetworkAttribute attribute)
          Indicates if this network evaluator can be used as the evaluator for the given network source and network attribute.
 boolean validateDefault(int elementType, IEvaluatedNetworkAttribute attribute, int[] errorCode, java.lang.String[] errorDescription, java.lang.String[] errorAppendInfo)
          Indicates if the network evaluator is in a valid state for use as the default evaluator for the given element type and network attribute.
 boolean validateSource(IDatasetContainer2 datasetContainer, INetworkSource networkSource, IEvaluatedNetworkAttribute attribute, int[] errorCode, java.lang.String[] errorDescription, java.lang.String[] errorAppendInfo)
          Indicates if the network evaluator is in a valid state for use as the evaluator for the given network source and network attribute.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworkFieldEvaluator

public NetworkFieldEvaluator()
                      throws java.io.IOException,
                             java.net.UnknownHostException
Constructs a NetworkFieldEvaluator using ArcGIS Engine.

Throws:
java.io.IOException - if there are interop problems
java.net.UnknownHostException - if there are interop problems

NetworkFieldEvaluator

public NetworkFieldEvaluator(java.lang.Object obj)
                      throws java.io.IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.

Construct a NetworkFieldEvaluator using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to NetworkFieldEvaluator.
NetworkFieldEvaluator theNetworkFieldEvaluator = (NetworkFieldEvaluator) obj;

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
java.io.IOException - if there are interop problems
Method Detail

getClsid

public static java.lang.String getClsid()

getAsINetworkEvaluator

public INetworkEvaluator getAsINetworkEvaluator()
Deprecated. No replacement. The object reference can be directly used where the implemented interface is needed.


getAsINetworkEvaluator2

public INetworkEvaluator2 getAsINetworkEvaluator2()
Deprecated. No replacement. The object reference can be directly used where the implemented interface is needed.


getAsINetworkFieldEvaluator

public INetworkFieldEvaluator getAsINetworkFieldEvaluator()
Deprecated. No replacement. The object reference can be directly used where the implemented interface is needed.


getAsINetworkEvaluatorSetup

public INetworkEvaluatorSetup getAsINetworkEvaluatorSetup()
Deprecated. No replacement. The object reference can be directly used where the implemented interface is needed.


equals

public boolean equals(java.lang.Object o)
Compare this object with another


hashCode

public int hashCode()
the hashcode for this object


getName

public java.lang.String getName()
                         throws java.io.IOException,
                                AutomationException
Description copied from interface: INetworkEvaluator
Unique name of this network evaluator.

Specified by:
getName in interface INetworkEvaluator
Returns:
The pName
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.

getDisplayName

public java.lang.String getDisplayName()
                                throws java.io.IOException,
                                       AutomationException
Description copied from interface: INetworkEvaluator
Name displayed in the user interface for this network evaluator.

Remarks

The DisplayName is the name for the evaluator that will be displayed in the Type column of the Evaluators dialog in ArcCatalog.

Specified by:
getDisplayName in interface INetworkEvaluator
Returns:
The pDisplayName
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.

isCacheAttribute

public boolean isCacheAttribute()
                         throws java.io.IOException,
                                AutomationException
Description copied from interface: INetworkEvaluator
Indicates if this evaluator's values should be computed and stored when the network is built or computed at run time and never stored.

Remarks

The CacheAttribute property determines whether the values computed by this evaluator are stored in the logical network of the network dataset.

If the CacheAttribute property is set to True, then the attribute values are computed by the evaluator only when the network is built.  The computed attribute values are then stored in the logical network.  When a client queries for attribute values (such as during a network analysis), the attribute values are retrieved from the logical network.

If the CacheAttribute property is set to False, then the attribute values are computed by the evaluator whenever any client asks for an attribute value (such as during a network analysis).  The computed attribute values are not stored in the logical network.  Depending on the complexity of the evaluator, this operation can be much slower than looking up values stored in the logical network.

Specified by:
isCacheAttribute in interface INetworkEvaluator
Returns:
The cache
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.

getRequiredFieldNames

public IStringArray getRequiredFieldNames()
                                   throws java.io.IOException,
                                          AutomationException
Description copied from interface: INetworkEvaluator2
Required fields of this network evaluator.

Remarks

RequiredFieldNames returns the field names that the evaluator requires in order to correctly evaluate the row.  This property is used to minimize the data that is returned by the query to the database by only returning the required fields.  Return a NULL pointer if you want it to include all the field names in the query. 

Specified by:
getRequiredFieldNames in interface INetworkEvaluator2
Returns:
A reference to a com.esri.arcgis.system.IStringArray
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.

refresh

public void refresh()
             throws java.io.IOException,
                    AutomationException
Description copied from interface: INetworkEvaluator2
.

Remarks

The Refresh method is an opportunity to update any internal state within the evaluator based on changes to parameters, dynamic data feeds, etc.  The Refresh method is called on every evaluator assigned to a network attribute when INetworkAttribute2::Refresh() is called.  For example, this is called internally during a solve operation after setting the network attribute parameters and prior to performing the actual solve.

Specified by:
refresh in interface INetworkEvaluator2
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setExpression

public void setExpression(java.lang.String expression,
                          java.lang.String preLogic)
                   throws java.io.IOException,
                          AutomationException
Description copied from interface: INetworkFieldEvaluator
Sets the VBScript calculator expression and pre-logic used to derive the values for this network evaluator.

Specified by:
setExpression in interface INetworkFieldEvaluator
Parameters:
expression - The expression (in)
preLogic - The preLogic (in)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getExpression

public void getExpression(java.lang.String[] expression,
                          java.lang.String[] preLogic)
                   throws java.io.IOException,
                          AutomationException
Description copied from interface: INetworkFieldEvaluator
Gets the VBScript calculator expression and pre-logic used to derive the values for this network evaluator.

Remarks

When examining the preLogic parameter for code with multiple lines, the CarriageReturn-LineFeed character is at the line breaks.

Specified by:
getExpression in interface INetworkFieldEvaluator
Parameters:
expression - The expression (in/out: use single element array)
preLogic - The preLogic (in/out: use single element array)
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

initialize

public void initialize(INetworkDataset networkDataset,
                       IDENetworkDataset dataElement,
                       INetworkSource source,
                       IEvaluatedNetworkAttribute attribute)
                throws java.io.IOException,
                       AutomationException
Description copied from interface: INetworkEvaluatorSetup
Initializes the network evaluator in preparation to evaluate the attribute value of a network element.

Remarks

The Initialize method does all the "heavy lifting" needed to prepare the evaluator for a call to QueryValue, a lightweight method for querying the attribute value for a network element.  Once the evaluator is initialized, the client can make multiple calls to this lightweight QueryValue for calculating the attribute values of multiple network elements.

When querying for attribute values in the network dataset ArcGIS calls the Initialize method immediately after it instantiates the evaluator.  For evaluators with CacheAttribute = True, this occurs when building the network dataset.  For evaluators with CacheAttribute = False, this occurs on the first call in the session to INetworkElement::AttributeValue or ::AttributeValueByName that requires this evaluator to determine the attribute value.

Specified by:
initialize in interface INetworkEvaluatorSetup
Parameters:
networkDataset - A reference to a com.esri.arcgis.geodatabase.INetworkDataset (in)
dataElement - A reference to a com.esri.arcgis.geodatabase.IDENetworkDataset (in)
source - A reference to a com.esri.arcgis.geodatabase.INetworkSource (in)
attribute - A reference to a com.esri.arcgis.geodatabase.IEvaluatedNetworkAttribute (in)
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.

setData

public void setData(IPropertySet data)
             throws java.io.IOException,
                    AutomationException
Description copied from interface: INetworkEvaluatorSetup
The data used by this network evaluator for custom properties.

Specified by:
setData in interface INetworkEvaluatorSetup
Parameters:
data - A reference to a com.esri.arcgis.system.IPropertySet (in)
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.

getData

public IPropertySet getData()
                     throws java.io.IOException,
                            AutomationException
Description copied from interface: INetworkEvaluatorSetup
The data used by this network evaluator for custom properties.

Remarks

The Data property stores data that is needed by the evaluator.  It is stored in a PropertySet object using key-value pairs.

Specified by:
getData in interface INetworkEvaluatorSetup
Returns:
A reference to a com.esri.arcgis.system.IPropertySet
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isDataHasEdits

public boolean isDataHasEdits()
                       throws java.io.IOException,
                              AutomationException
Description copied from interface: INetworkEvaluatorSetup
Indicates if the data for this evaluator has been edited.

Remarks

The DataHasEdits property indicates whether changes have been made to the Data PropertySet that have not yet been handled by the evaluator's internal logic.  This is useful in determining whether the evaluator needs to be re-Initialized before making additional calls to QueryValue.

This property is only used when modifying the network dataset's evaluators via objects like the EvaluatorEditor to signify the network dataset may need to be rebuilt/reinitialized.  This property is not queried prior to network analysis to determine if the evaluator needs to be re-initialized.  Thus, it is not a mechanism to trigger that the evaluators need to be re-initialized based on new data between solves.

Specified by:
isDataHasEdits in interface INetworkEvaluatorSetup
Returns:
The hasEdits
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.

getCLSID

public IUID getCLSID()
              throws java.io.IOException,
                     AutomationException
Description copied from interface: INetworkEvaluatorSetup
Unique CLSID identifier for this network evaluator.

Specified by:
getCLSID in interface INetworkEvaluatorSetup
Returns:
A reference to a com.esri.arcgis.system.IUID
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.

supportsSource

public boolean supportsSource(INetworkSource source,
                              IEvaluatedNetworkAttribute attribute)
                       throws java.io.IOException,
                              AutomationException
Description copied from interface: INetworkEvaluatorSetup
Indicates if this network evaluator can be used as the evaluator for the given network source and network attribute.

Remarks

TheSupportsSource method is used to determine if the evaluator can be used to assign attribute values for elements generated by the given source.  If SupportsSource is False, then the evaluator does not show up as a choice for the user in the Evaluators dialog in ArcCatalog.

Specified by:
supportsSource in interface INetworkEvaluatorSetup
Parameters:
source - A reference to a com.esri.arcgis.geodatabase.INetworkSource (in)
attribute - A reference to a com.esri.arcgis.geodatabase.IEvaluatedNetworkAttribute (in)
Returns:
The isSupported
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

supportsDefault

public boolean supportsDefault(int elementType,
                               IEvaluatedNetworkAttribute attribute)
                        throws java.io.IOException,
                               AutomationException
Description copied from interface: INetworkEvaluatorSetup
Indicates if this network evaluator can be used as the default evaluator for the given network element type and network attribute.

Remarks

The SupportsDefault method is used to determine if the evaluator can be used to assign default attribute values for elements of the given type.  If SupportsDefault is False, then the evaluator does not show up as a default evaluator choice for the user in the Evaluators dialog in ArcCatalog.

Specified by:
supportsDefault in interface INetworkEvaluatorSetup
Parameters:
elementType - A com.esri.arcgis.geodatabase.esriNetworkElementType constant (in)
attribute - A reference to a com.esri.arcgis.geodatabase.IEvaluatedNetworkAttribute (in)
Returns:
The isSupported
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.

validateSource

public boolean validateSource(IDatasetContainer2 datasetContainer,
                              INetworkSource networkSource,
                              IEvaluatedNetworkAttribute attribute,
                              int[] errorCode,
                              java.lang.String[] errorDescription,
                              java.lang.String[] errorAppendInfo)
                       throws java.io.IOException,
                              AutomationException
Description copied from interface: INetworkEvaluatorSetup
Indicates if the network evaluator is in a valid state for use as the evaluator for the given network source and network attribute.

Specified by:
validateSource in interface INetworkEvaluatorSetup
Parameters:
datasetContainer - A reference to a com.esri.arcgis.geodatabase.IDatasetContainer2 (in)
networkSource - A reference to a com.esri.arcgis.geodatabase.INetworkSource (in)
attribute - A reference to a com.esri.arcgis.geodatabase.IEvaluatedNetworkAttribute (in)
errorCode - The errorCode (in/out: use single element array)
errorDescription - The errorDescription (in/out: use single element array)
errorAppendInfo - The errorAppendInfo (in/out: use single element array)
Returns:
The isValid
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.

validateDefault

public boolean validateDefault(int elementType,
                               IEvaluatedNetworkAttribute attribute,
                               int[] errorCode,
                               java.lang.String[] errorDescription,
                               java.lang.String[] errorAppendInfo)
                        throws java.io.IOException,
                               AutomationException
Description copied from interface: INetworkEvaluatorSetup
Indicates if the network evaluator is in a valid state for use as the default evaluator for the given element type and network attribute.

Specified by:
validateDefault in interface INetworkEvaluatorSetup
Parameters:
elementType - A com.esri.arcgis.geodatabase.esriNetworkElementType constant (in)
attribute - A reference to a com.esri.arcgis.geodatabase.IEvaluatedNetworkAttribute (in)
errorCode - The errorCode (in/out: use single element array)
errorDescription - The errorDescription (in/out: use single element array)
errorAppendInfo - The errorAppendInfo (in/out: use single element array)
Returns:
The isValid
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.

queryValue

public java.lang.Object queryValue(INetworkElement element,
                                   IRow row)
                            throws java.io.IOException,
                                   AutomationException
Description copied from interface: INetworkEvaluatorSetup
Evaluates the attribute value of a network element.

Remarks

QueryValue computes the attribute value for the given element.  The Row parameter is provided in order to query any information from the Row (such as field values) corresponding to the given network element.

Before calling QueryValue, the evaluator must first be initialized by calling the Initialize method.  After calling Initialize, QueryValue can be called multiple times to calculate attribute values for multiple network elements.

Specified by:
queryValue in interface INetworkEvaluatorSetup
Parameters:
element - A reference to a com.esri.arcgis.geodatabase.INetworkElement (in)
row - A reference to a com.esri.arcgis.geodatabase.IRow (in)
Returns:
A Variant
Throws:
AutomationException - If the ArcObject component throws an exception.
java.io.IOException - If there are interop problems.