DRCL J-Sim API

drcl.data
Class Map

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.data.Map
All Implemented Interfaces:
java.lang.Cloneable, ObjectCloneable, ObjectDuplicable, java.io.Serializable
Direct Known Subclasses:
RadixMap

public class Map
extends DrclObj

A map keeps (MapKey, entry object) pairs in it. Given a MapKey, an entry/entries can be retrieved by exact match, longest match, match, or wildcard match.

See Also:
MapKey, Serialized Form

Field Summary
static java.lang.Class BEST_CLASS_FOR_LONGEST_MATCH
           
static java.lang.String MATCH_ALL
           
static java.lang.String MATCH_EXACT
           
static java.lang.String MATCH_LONGEST
           
static java.lang.String MATCH_WILDCARD
           
 
Constructor Summary
Map()
           
 
Method Summary
 void addEntry(MapKey key_, java.lang.Object entry_)
          Add the key-entry pair to the Map.
 boolean anyMatch(BitSet key_)
           
 java.lang.String binaryRepresentation()
          Prints out the content of this map and represents the keys in the binary form.
 java.lang.String binaryRepresentation(boolean skipLeadingZeros_)
          Prints out the content of this map and represents the keys in the binary form.
 java.lang.String binaryRepresentation(int length_)
          Prints out the content of this map and represents the keys in the binary form.
 java.lang.String diag()
          Printout for diagnosis.
 void duplicate(java.lang.Object source_)
          opies the content of the source_ object to this object.
 java.lang.Object get(BitSet bs_, java.lang.String matchType_)
          For "longest match" and "match all".
 java.lang.Object get(MapKey key_, java.lang.String matchType_)
          For "exact match" and "wildcard match".
 java.lang.Object[] getAllEntries()
           
 MapKey[] getAllKeys()
           
static Map getBestImplementationForLongestMatch()
           
 int getSize()
          Returns the current size (number of entries) of the map.
 java.lang.String hexRepresentation()
          Prints out the content of this map and represents the keys in the hex form.
 java.lang.String hexRepresentation(boolean skipLeadingZeros_)
          Prints out the content of this map and represents the keys in the hex form.
 java.lang.String hexRepresentation(int length_)
          Prints out the content of this map and represents the keys in the hex form.
 java.lang.String info()
          Prints out the content of this map and represents the keys by the indices of 1's.
 java.lang.String numberRepresentation()
          Prints out the content of this map and represents the keys in the form of long integers.
 java.lang.Object remove(BitSet bs_, java.lang.String matchType_)
          For "longest match" and "match all".
 java.lang.Object remove(MapKey key_, java.lang.String matchType_)
          For "exact match" and "wildcard match".
 void removeEntry(java.lang.Object entry_)
           
 void reset()
          Removes all the entries.
 
Methods inherited from class drcl.DrclObj
clone, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BEST_CLASS_FOR_LONGEST_MATCH

public static java.lang.Class BEST_CLASS_FOR_LONGEST_MATCH

MATCH_EXACT

public static final java.lang.String MATCH_EXACT
See Also:
Constant Field Values

MATCH_LONGEST

public static final java.lang.String MATCH_LONGEST
See Also:
Constant Field Values

MATCH_ALL

public static final java.lang.String MATCH_ALL
See Also:
Constant Field Values

MATCH_WILDCARD

public static final java.lang.String MATCH_WILDCARD
See Also:
Constant Field Values
Constructor Detail

Map

public Map()
Method Detail

getBestImplementationForLongestMatch

public static final Map getBestImplementationForLongestMatch()

reset

public void reset()
Removes all the entries.


duplicate

public void duplicate(java.lang.Object source_)
Description copied from class: DrclObj
opies the content of the source_ object to this object. he subclass must implement this method to realize DrclObj.clone().

Specified by:
duplicate in interface ObjectDuplicable
Overrides:
duplicate in class DrclObj

addEntry

public void addEntry(MapKey key_,
                     java.lang.Object entry_)
Add the key-entry pair to the Map. No check is done for duplicate keys.

Parameters:
key_ - the key.
entry_ - the entry.

get

public java.lang.Object get(MapKey key_,
                            java.lang.String matchType_)
For "exact match" and "wildcard match".

See Also:
for "longest match" and "match all".

get

public java.lang.Object get(BitSet bs_,
                            java.lang.String matchType_)
For "longest match" and "match all".

See Also:
for "exact match" and "wildcard match".

anyMatch

public boolean anyMatch(BitSet key_)
Parameters:
key_ - the key to match.
Returns:
true if a key that matches the argument exists.

remove

public java.lang.Object remove(MapKey key_,
                               java.lang.String matchType_)
For "exact match" and "wildcard match".

See Also:
for "longest match" and "match all".

remove

public java.lang.Object remove(BitSet bs_,
                               java.lang.String matchType_)
For "longest match" and "match all".

See Also:
for "exact match" and "wildcard match".

removeEntry

public void removeEntry(java.lang.Object entry_)

getAllEntries

public java.lang.Object[] getAllEntries()

getAllKeys

public MapKey[] getAllKeys()

getSize

public int getSize()
Returns the current size (number of entries) of the map.


info

public java.lang.String info()
Prints out the content of this map and represents the keys by the indices of 1's.


diag

public java.lang.String diag()
Printout for diagnosis.


numberRepresentation

public java.lang.String numberRepresentation()
Prints out the content of this map and represents the keys in the form of long integers.


binaryRepresentation

public java.lang.String binaryRepresentation()
Prints out the content of this map and represents the keys in the binary form.


binaryRepresentation

public java.lang.String binaryRepresentation(boolean skipLeadingZeros_)
Prints out the content of this map and represents the keys in the binary form.

See Also:
MapKey.binaryRepresentation(boolean).

binaryRepresentation

public java.lang.String binaryRepresentation(int length_)
Prints out the content of this map and represents the keys in the binary form.

See Also:
MapKey.binaryRepresentation(int).

hexRepresentation

public java.lang.String hexRepresentation()
Prints out the content of this map and represents the keys in the hex form.


hexRepresentation

public java.lang.String hexRepresentation(boolean skipLeadingZeros_)
Prints out the content of this map and represents the keys in the hex form.

See Also:
MapKey.hexRepresentation(boolean).

hexRepresentation

public java.lang.String hexRepresentation(int length_)
Prints out the content of this map and represents the keys in the hex form.

See Also:
MapKey.hexRepresentation(int).

DRCL J-Sim API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~