Class FlkRecent

java.lang.Object
  extended by FlkRecent

public class FlkRecent
extends java.lang.Object

FlkRecent contains methods to maintain the FlkRecentDB.txt database used by Flicker. These are recently accessed image files. The file is written after EACH new image is loaded.

 The file is a tab-delimited file with the following fields:
        DbMenuName, ClickableURL, ImageURL, DatabaseName, TimeStamp

 The map is used to build menus of images to load
 a map entry contains the following fields:
 1. DbMenuName: is the name of the database+menuName: e.g.,
   "SWISS-2DPROT Human Plasma"
 2. ClickableURL1: is the clickable map URL for image 1: e.g.,
   "http://www.expasy.org/cgi-bin/map3/big/PLASMA_HUMAN?"
 3. ClickableURL2: is the clickable map URL for image 2: e.g.,
   it may be null
 4. ImageURL1: is the Image URL for image 1: e.g.
   "http://www.expasy.org/ch2dgifs/PLASMA_HUMAN/PLASMA_HUMAN_id.gif"
 5. ImageURL2: is the Image URL for image 2: e.g.
   it may be null
 6. DatabaseName: is name of the database: e.g.,
   "SWISS-2DPROT Human"
 7. TimeStamp: is the time stamp when it was saved: e.g.
   "20030918-170230"

 The database file FlkRecentDB.txt contains data Fields:
        DbMenuName, ClickableURL, ImageURL, DatabaseName, TimeStamp
 E.g. of a data entry:
        SWISS-2DPROT Human Plasma
        http://www.expasy.org/cgi-bin/map3/PLASMA_HUMAN?
        http://www.expasy.org/ch2dgifs/PLASMA_HUMAN/PLASMA_HUMAN_id.gif
        SWISS-2DPROT Human
        20030918-170230

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The Flicker Mozilla and Legal files are available on http://open2dprot.sourceforge.net/Flicker

Version:
$Date$ $Revision$
Author:
P. Lemkin (LECB/NCI), G. Thornwall (SAIC), Frederick, MD
See Also:
Flicker Home

Field Summary
(package private)  java.lang.String clickableURL1
          is the clickable map URL for image 1: e.g., "http://www.expasy.org/cgi-bin/map3/big/PLASMA_HUMAN?"
(package private)  java.lang.String clickableURL2
          is the clickable map URL for image 2: e.g., "http://www.expasy.org/cgi-bin/map3/big/PLASMA_HUMAN?"
(package private)  java.lang.String databaseName
          is name of the database: e.g., "SWISS-2DPROT Human"
(package private)  java.lang.String dbMenuName
          is the name of the database+menuName: e.g., "SWISS-2DPROT Human Plasma"
private static Flicker flk
          Instance of Flicker
static boolean flkRecentChangedFlag
          flat that is set true if we edit the file (add/delete) since we loaded it from the disk.
static java.lang.String FlkRecentDBfile
          name of the database file
static FlkRecent[] flkRecents
          FlkRecent database [0:nMaps]
(package private)  java.lang.String imageURL1
          ImageURL: is the Image URL for image: e.g.
(package private)  java.lang.String imageURL2
          ImageURL: is the Image URL for image: e.g.
static int MAX_RECENTS
          Max # of recent images
static int nMaps
           
(package private)  java.lang.String timeStamp
          is the time stamp when it was saved: e.g.
private static Util util
          Util instance
 
Constructor Summary
FlkRecent(Flicker flkS)
          FlkRecent() - constructor for Class FlkRecent
FlkRecent(java.lang.String dbMenuName, java.lang.String clickableURL, java.lang.String imageURL, java.lang.String databaseName, java.lang.String timeStamp)
          FlkRecent() - constructor to add a new FlkRecent entry NOTE: to do add of an entry, use 'new FlkRecent()' method
FlkRecent(java.lang.String dbMenuName, java.lang.String clickableURL1, java.lang.String clickableURL2, java.lang.String imageURL1, java.lang.String imageURL2, java.lang.String databaseName, java.lang.String timeStamp)
          FlkRecent() - constructor to add a new FlkRecent entry pair NOTE: to do add of an entry, use 'new FlkRecent()' method
 
Method Summary
(package private) static FlkRecent addOrUpdate(java.lang.String dbMenuName, java.lang.String clickableURL, java.lang.String imageURL, java.lang.String databaseName, java.lang.String timeStamp)
          addOrUpdate() - add or Update an entry to database FlkRecents[0:nMaps-1].
(package private) static FlkRecent addOrUpdatePair(java.lang.String dbMenuName, java.lang.String clickableURL1, java.lang.String clickableURL2, java.lang.String imageURL1, java.lang.String imageURL2, java.lang.String databaseName, java.lang.String timeStamp)
          addOrUpdatePair() - add or Update an entry pair to DB FlkRecents[0:nMaps-1].
(package private) static void clear()
          clear() - clear database FlkRecents[0:nMaps-1].
(package private)  boolean delete()
          delete() - rmv entry from database FlkRecents[0:nMaps-1].
(package private) static boolean deleteOldestEntry()
          deleteOldestEntry() - delete the oldest entry
(package private) static int lookup(FlkRecent fm)
          lookup() - lookup entry to database FlkRecents[0:nMaps-1].
(package private) static FlkRecent lookupByDbMenuName(java.lang.String dbMenuName)
          lookupByDbMenuName() - lookup entry by dbMenuName in FlkRecents[0:nMaps-1].
(package private) static FlkRecent lookupByImageURL(java.lang.String imageURLname)
          lookupByImageURL() - lookup entry by dbMenuName in FlkRecents[0:nMaps-1].
(package private) static FlkRecent lookupByImageURL(java.lang.String imageURLname1, java.lang.String imageURLname2)
          lookupByImageURL() - lookup oair entry by dbMenuName in FlkRecents[0:nMaps-1].
(package private) static boolean read()
          read() - read database from FlkRecentDB.txt file to FlkRecents[0:nMaps-1].
(package private)  boolean set(java.lang.String dbMenuName, java.lang.String clickableURL, java.lang.String imageURL, java.lang.String databaseName, java.lang.String timeStamp)
          set() - set entry to database FlkRecents[0:nMaps-1].
(package private)  boolean set(java.lang.String dbMenuName, java.lang.String clickableURL1, java.lang.String clickableURL2, java.lang.String imageURL1, java.lang.String imageURL2, java.lang.String databaseName, java.lang.String timeStamp)
          set() - set entry pair to database FlkRecents[0:nMaps-1].
(package private) static boolean setByImageURL(java.lang.String dbMenuName, java.lang.String clickableURL, java.lang.String imageURL, java.lang.String databaseName, java.lang.String timeStamp)
          setByImageURL() - set entry to database FlkRecents[0:nMaps-1].
(package private) static boolean write()
          write() - write database in memory to FlkRecentDB.txt database file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flk

private static Flicker flk
Instance of Flicker


util

private static Util util
Util instance


MAX_RECENTS

public static final int MAX_RECENTS
Max # of recent images

See Also:
Constant Field Values

flkRecents

public static FlkRecent[] flkRecents
FlkRecent database [0:nMaps]


nMaps

public static int nMaps

FlkRecentDBfile

public static java.lang.String FlkRecentDBfile
name of the database file


flkRecentChangedFlag

public static boolean flkRecentChangedFlag
flat that is set true if we edit the file (add/delete) since we loaded it from the disk.


dbMenuName

java.lang.String dbMenuName
is the name of the database+menuName: e.g., "SWISS-2DPROT Human Plasma"


clickableURL1

java.lang.String clickableURL1
is the clickable map URL for image 1: e.g., "http://www.expasy.org/cgi-bin/map3/big/PLASMA_HUMAN?"


clickableURL2

java.lang.String clickableURL2
is the clickable map URL for image 2: e.g., "http://www.expasy.org/cgi-bin/map3/big/PLASMA_HUMAN?"


imageURL1

java.lang.String imageURL1
ImageURL: is the Image URL for image: e.g. "http://www.expasy.org/ch2dgifs/PLASMA_HUMAN/PLASMA_HUMAN_id.gif"


imageURL2

java.lang.String imageURL2
ImageURL: is the Image URL for image: e.g. "http://www.expasy.org/ch2dgifs/PLASMA_HUMAN/PLASMA_HUMAN_id.gif"


databaseName

java.lang.String databaseName
is name of the database: e.g., "SWISS-2DPROT Human"


timeStamp

java.lang.String timeStamp
is the time stamp when it was saved: e.g. "20030918-170230"

Constructor Detail

FlkRecent

public FlkRecent(Flicker flkS)
FlkRecent() - constructor for Class FlkRecent

Parameters:
flk - instance of Flicker

FlkRecent

public FlkRecent(java.lang.String dbMenuName,
                 java.lang.String clickableURL,
                 java.lang.String imageURL,
                 java.lang.String databaseName,
                 java.lang.String timeStamp)
FlkRecent() - constructor to add a new FlkRecent entry NOTE: to do add of an entry, use 'new FlkRecent()' method

Parameters:
dbMenuName -
clickableURL -
imageURL -
databaseName -
timeStamp -

FlkRecent

public FlkRecent(java.lang.String dbMenuName,
                 java.lang.String clickableURL1,
                 java.lang.String clickableURL2,
                 java.lang.String imageURL1,
                 java.lang.String imageURL2,
                 java.lang.String databaseName,
                 java.lang.String timeStamp)
FlkRecent() - constructor to add a new FlkRecent entry pair NOTE: to do add of an entry, use 'new FlkRecent()' method

Parameters:
dbMenuName -
clickableURL1 -
clickableURL2 -
imageURL1 -
imageURL2 -
databaseName -
timeStamp -
Method Detail

read

static boolean read()
read() - read database from FlkRecentDB.txt file to FlkRecents[0:nMaps-1].

Returns:
true if succeed

write

static boolean write()
write() - write database in memory to FlkRecentDB.txt database file.

Returns:
true if succeed

lookup

static int lookup(FlkRecent fm)
lookup() - lookup entry to database FlkRecents[0:nMaps-1].

Parameters:
fm - is the instance to lookup
Returns:
index of FlkRecents[] if succeed, else -1

lookupByDbMenuName

static FlkRecent lookupByDbMenuName(java.lang.String dbMenuName)
lookupByDbMenuName() - lookup entry by dbMenuName in FlkRecents[0:nMaps-1].

Parameters:
dbMenuName - is the menu name of the instance to lookup
Returns:
matching instance of FlkRecents[] if succeed, else null

lookupByImageURL

static FlkRecent lookupByImageURL(java.lang.String imageURLname)
lookupByImageURL() - lookup entry by dbMenuName in FlkRecents[0:nMaps-1].

Parameters:
imageURLname - is the imageURL name of the instance to lookup
Returns:
matching instance of FlkRecents[] if succeed, else null

lookupByImageURL

static FlkRecent lookupByImageURL(java.lang.String imageURLname1,
                                  java.lang.String imageURLname2)
lookupByImageURL() - lookup oair entry by dbMenuName in FlkRecents[0:nMaps-1].

Parameters:
imageURLname1 - is the imageURL1 name of the instance to lookup
imageURLname2 - is the imageURL2 name of the instance to lookup
Returns:
matching instance of FlkRecents[] if succeed, else null

addOrUpdate

static FlkRecent addOrUpdate(java.lang.String dbMenuName,
                             java.lang.String clickableURL,
                             java.lang.String imageURL,
                             java.lang.String databaseName,
                             java.lang.String timeStamp)
addOrUpdate() - add or Update an entry to database FlkRecents[0:nMaps-1]. If the imageURL is not in the recent database, then add it by doing a 'new FlkRecent()' method . If it is found, then do a set.

Parameters:
dbMenuName -
clickableURL - may be null
imageURL - URL or local file path
databaseName -
timeStamp -
Returns:
true if succeed

addOrUpdatePair

static FlkRecent addOrUpdatePair(java.lang.String dbMenuName,
                                 java.lang.String clickableURL1,
                                 java.lang.String clickableURL2,
                                 java.lang.String imageURL1,
                                 java.lang.String imageURL2,
                                 java.lang.String databaseName,
                                 java.lang.String timeStamp)
addOrUpdatePair() - add or Update an entry pair to DB FlkRecents[0:nMaps-1]. If the imageURL is not in the recent database, then add it by doing a 'new FlkRecent()' method . If it is found, then do a set.

Parameters:
dbMenuName -
clickableURL - may be null
imageURL - URL or local file path
databaseName -
timeStamp -
Returns:
true if succeed

set

boolean set(java.lang.String dbMenuName,
            java.lang.String clickableURL,
            java.lang.String imageURL,
            java.lang.String databaseName,
            java.lang.String timeStamp)
set() - set entry to database FlkRecents[0:nMaps-1]. NOTE: to do add of an entry, use 'new FlkRecent()' method

Parameters:
dbMenuName -
clickableURL -
imageURL -
databaseName -
timeStamp -
Returns:
true if succeed

set

boolean set(java.lang.String dbMenuName,
            java.lang.String clickableURL1,
            java.lang.String clickableURL2,
            java.lang.String imageURL1,
            java.lang.String imageURL2,
            java.lang.String databaseName,
            java.lang.String timeStamp)
set() - set entry pair to database FlkRecents[0:nMaps-1]. NOTE: to do add of an entry, use 'new FlkRecent()' method

Parameters:
dbMenuName -
clickableURL1 -
clickableURL2 -
imageURL1 -
imageURL2 -
databaseName -
timeStamp -
Returns:
true if succeed

setByImageURL

static boolean setByImageURL(java.lang.String dbMenuName,
                             java.lang.String clickableURL,
                             java.lang.String imageURL,
                             java.lang.String databaseName,
                             java.lang.String timeStamp)
setByImageURL() - set entry to database FlkRecents[0:nMaps-1]. NOTE: to do add of an entry, use 'new FlkRecent()' method

Parameters:
dbMenuName -
clickableURL -
imageURL -
databaseName -
timeStamp -
Returns:
true if succeed

deleteOldestEntry

static boolean deleteOldestEntry()
deleteOldestEntry() - delete the oldest entry

Returns:
true if succeed

delete

boolean delete()
delete() - rmv entry from database FlkRecents[0:nMaps-1].

Returns:
true if succeed

clear

static void clear()
clear() - clear database FlkRecents[0:nMaps-1].