net.logAnalyzer.analysis
Class LAAnalysis

java.lang.Object
  extended bynet.logAnalyzer.analysis.LAAnalysis
Direct Known Subclasses:
MultiValuesAnalysis, SingleValueAnalysis

public abstract class LAAnalysis
extends java.lang.Object

This class defines a template to implement results of analysis.

Version:
0.1
Author:
Karim REFEYTON

Constructor Summary
protected LAAnalysis(LAAnalyzer analyzer, java.lang.String[] valuesNames)
          Construct a new analysis from the specified analyzer and values names.
 
Method Summary
 void changeKey(java.lang.Comparable oldKey, java.lang.Comparable newKey)
          Change the specified old key to the new key.
 boolean containsKey(java.lang.Comparable key)
          Returns true if the analysis contains the specified key.
 LAAnalyzer getAnalyzer()
          Returns the originator analyzer.
 java.text.SimpleDateFormat getDateFormat()
          Returns the format used for dates.
protected  java.util.Date getDateValue(java.lang.Comparable key, int index)
          Returns the value associated to the specified key.
protected  double getDoubleValue(java.lang.Comparable key, int index)
          Returns the value associated to the specified key.
 java.lang.Comparable getKey(int index)
          Returns the keys at the specified index.
 java.util.Vector getKeys()
          Returns the resulting values keys vector.
protected  long getLongValue(java.lang.Comparable key, int index)
          Returns the value associated to the specified key.
protected  java.lang.Object getObjectValue(java.lang.Comparable key, int index)
          Returns the value associated to the specified key.
 java.lang.String getStringKey(int index)
          Returns the keys at the specified index.
protected  java.lang.String getStringValue(java.lang.Comparable key, int index)
          Returns the value associated to the specified key.
protected  java.lang.String getValueName(int index)
          Returns the value name.
protected  int getValueNameIndex(java.lang.String valueName)
          Returns the index of the value name.
protected  java.lang.String[] getValuesNames()
          Returns the values names.
protected  void moveKeyAt(int index, int newIndex)
          Moves the key at the specified index to the specified new index.
protected  java.util.Date putDateValue(java.lang.Comparable key, int index, java.util.Date value)
          Set the value associated to the specified key.
protected  double putDoubleValue(java.lang.Comparable key, int index, double value)
          Set the value associated to the specified key.
protected  long putLongValue(java.lang.Comparable key, int index, long value)
          Set the value associated to the specified key.
protected  java.lang.String putStringValue(java.lang.Comparable key, int index, java.lang.String value)
          Set the value associated to the specified key.
protected  void removeKey(java.lang.Comparable key)
          Remove the specified key of the analysis.
protected  void removeKey(int keyIndex)
          Remove the key at the specified index of the analysis.
 long size()
          Returns the number of values in the analysis.
protected  void sortByValueASC(int index)
          Sort results by the specified value form lowest to greatest.
protected  void sortByValueDESC(int index)
          Sort results by the specified value form greatest to lowest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LAAnalysis

protected LAAnalysis(LAAnalyzer analyzer,
                     java.lang.String[] valuesNames)
Construct a new analysis from the specified analyzer and values names.

Parameters:
analyzer - Analyzer.
valuesNames - Names of values.
Method Detail

getAnalyzer

public final LAAnalyzer getAnalyzer()
Returns the originator analyzer.

Returns:
Analyzer.

getDateFormat

public final java.text.SimpleDateFormat getDateFormat()
Returns the format used for dates.

Returns:
Date format.

containsKey

public final boolean containsKey(java.lang.Comparable key)
Returns true if the analysis contains the specified key.

Parameters:
key - Key to check.
Returns:
true if the key exists; false otherwise.

moveKeyAt

protected final void moveKeyAt(int index,
                               int newIndex)
Moves the key at the specified index to the specified new index.

Parameters:
index - Index of the key to move.
newIndex - New index of the key.

getKey

public final java.lang.Comparable getKey(int index)
Returns the keys at the specified index.

Parameters:
index - Key index.
Returns:
Key at the specified index.

getStringKey

public final java.lang.String getStringKey(int index)
Returns the keys at the specified index. Dates are formatted with #dateFormat.

Parameters:
index - Key index.
Returns:
Key at the specified index.

getKeys

public final java.util.Vector getKeys()
Returns the resulting values keys vector.

Returns:
Values keys vector.

getDateValue

protected final java.util.Date getDateValue(java.lang.Comparable key,
                                            int index)
Returns the value associated to the specified key.

Parameters:
key - Key of the values group.
index - Index of the value.
Returns:
Value if exists; null otherwise.

getDoubleValue

protected final double getDoubleValue(java.lang.Comparable key,
                                      int index)
Returns the value associated to the specified key.

Parameters:
key - Key of the values group.
index - Index of the value.
Returns:
Value if exists; 0 otherwise.

getLongValue

protected final long getLongValue(java.lang.Comparable key,
                                  int index)
Returns the value associated to the specified key.

Parameters:
key - Key of the values group.
index - Index of the value.
Returns:
Value if exists; 0 otherwise.

getStringValue

protected final java.lang.String getStringValue(java.lang.Comparable key,
                                                int index)
Returns the value associated to the specified key. Dates are formatted with #dateFormat.

Parameters:
key - Key of the values group.
index - Index of the value.
Returns:
Value if exists; n""ull otherwise.

getObjectValue

protected final java.lang.Object getObjectValue(java.lang.Comparable key,
                                                int index)
Returns the value associated to the specified key.

Parameters:
key - Key of the values group.
index - Index of the value.
Returns:
Value if exists; null otherwise.

putDateValue

protected final java.util.Date putDateValue(java.lang.Comparable key,
                                            int index,
                                            java.util.Date value)
Set the value associated to the specified key.

Parameters:
key - Key of the values group.
index - Index of the value.
value - Value to set.
Returns:
Old value if exists; null otherwise.

putDoubleValue

protected final double putDoubleValue(java.lang.Comparable key,
                                      int index,
                                      double value)
Set the value associated to the specified key.

Parameters:
key - Key of the values group.
index - Index of the value.
value - Value to set.
Returns:
Old value if exists; null otherwise.

putLongValue

protected final long putLongValue(java.lang.Comparable key,
                                  int index,
                                  long value)
Set the value associated to the specified key.

Parameters:
key - Key of the values group.
index - Index of the value.
value - Value to set.
Returns:
Old value if exists; null otherwise.

putStringValue

protected final java.lang.String putStringValue(java.lang.Comparable key,
                                                int index,
                                                java.lang.String value)
Set the value associated to the specified key.

Parameters:
key - Key of the values group.
index - Index of the value.
value - Value to set.
Returns:
Old value if exists; null otherwise.

getValueNameIndex

protected final int getValueNameIndex(java.lang.String valueName)
Returns the index of the value name.

Parameters:
valueName - Name of value.
Returns:
Index of the value name.

getValueName

protected final java.lang.String getValueName(int index)
Returns the value name.

Parameters:
index - Index of the value.
Returns:
Value name.

getValuesNames

protected final java.lang.String[] getValuesNames()
Returns the values names.

Returns:
Values names.

changeKey

public final void changeKey(java.lang.Comparable oldKey,
                            java.lang.Comparable newKey)
Change the specified old key to the new key.

Parameters:
oldKey - Key to change.
newKey - New key.

removeKey

protected final void removeKey(java.lang.Comparable key)
Remove the specified key of the analysis.

Parameters:
key - Key to remove.

removeKey

protected final void removeKey(int keyIndex)
Remove the key at the specified index of the analysis.

Parameters:
keyIndex - Key index to remove.

size

public final long size()
Returns the number of values in the analysis.

Returns:
Number of values.

sortByValueASC

protected final void sortByValueASC(int index)
Sort results by the specified value form lowest to greatest.

Parameters:
index - Index of the value used to sort results.

sortByValueDESC

protected final void sortByValueDESC(int index)
Sort results by the specified value form greatest to lowest.

Parameters:
index - Index of the value used to sort results.


Copyright © 2006 null. All Rights Reserved.