Class LinkedDataStream<T extends java.lang.Comparable<T>>

java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.datasources.LinkedDataStream<T>
All Implemented Interfaces:
InterfaceObject, NamedObject, TreeObject, CleanableObject, IconObject

public class LinkedDataStream<T extends java.lang.Comparable<T>>
extends AbstractInterfaceObject
implements IconObject
Provides a link to a data source, using a unique field as the link field.
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Details

    • data_table

      protected java.lang.String data_table
    • data_source

      protected DataSource data_source
    • cached

      protected boolean cached
    • cache

      protected java.util.HashMap<T extends java.lang.Comparable<T>,​java.util.HashMap<java.lang.String,​java.lang.Object>> cache
    • record_set

      protected DataRecordSet record_set
    • index

      protected DataIndex<T extends java.lang.Comparable<T>> index
    • unknown_value

      protected double unknown_value
  • Constructor Details

  • Method Details

    • getInstance

      public static LinkedDataStream<?> getInstance​(DataSource data_source, java.lang.String data_table, java.lang.String link_field, boolean cached, java.lang.String name, boolean is_name_map) throws DataSourceException
      Returns an instance of LinkedDataStream of the correct generic type, based on the data type of the linked field.
      Parameters:
      data_source -
      data_table -
      link_field -
      cached -
      name -
      has_name_map -
      Returns:
      A new instance of the correct generic type
      Throws:
      DataSourceException
    • getObjectIcon

      public javax.swing.Icon getObjectIcon()
      Description copied from interface: IconObject
      Returns the Icon associated with this object.
      Specified by:
      getObjectIcon in interface IconObject
      Returns:
    • getIcon

      public static javax.swing.Icon getIcon()
    • refresh

      public void refresh() throws DataSourceException
      Throws:
      DataSourceException
    • getLinkTable

      public java.lang.String getLinkTable()
    • getLinkField

      public java.lang.String getLinkField()
    • setUnknownValue

      public void setUnknownValue​(double value)
    • getUnknownValue

      public double getUnknownValue()
      Value to use when a key is not found in the linked source
      Returns:
    • getDataSource

      public DataSource getDataSource()
    • getNumericFields

      public java.util.ArrayList<java.lang.String> getNumericFields()
      Returns all fields which are numeric.
      Returns:
    • getNumericValue

      public double getNumericValue​(T key, java.lang.String field) throws DataSourceException
      Returns the value for field at record where link field equals key.
      Parameters:
      key -
      field -
      Returns:
      Throws:
      DataSourceException - if no record exists for key
    • getValue

      public java.lang.Object getValue​(T key, java.lang.String field) throws DataSourceException
      Throws:
      DataSourceException
    • clearCache

      public void clearCache()
    • getSQLForKey

      protected java.lang.String getSQLForKey​(java.lang.String key)
    • setTreeNode

      public void setTreeNode​(InterfaceTreeNode treeNode)
      Description copied from interface: TreeObject
      Sets the children for this node's InterfaceTreeNode.
      Specified by:
      setTreeNode in interface TreeObject
      Overrides:
      setTreeNode in class AbstractInterfaceObject
    • getTreeLabel

      public java.lang.String getTreeLabel()
      Description copied from interface: TreeObject
      Returns the label text to appear in a tree node.
      Specified by:
      getTreeLabel in interface TreeObject
      Overrides:
      getTreeLabel in class AbstractInterfaceObject
      Returns: