|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectiitb.con.ds.InstanceTable
public class InstanceTable
InstanceTable holds the InstanceMetaItem as value objects. The super key is the type id and the sub key is the instance id.
Instances are managed in the concept-net as a set of three files:
ntab file - holds the information about the instance-meta information as InstanceItem
net file - holds the instances
nfsl file - free blocks list in the .net file
The instances are added/updated/removed to the action buffer list and it is committed to the respective file on calling commit() method.
InstanceMetaItem
,
Instance
Constructor Summary | |
---|---|
InstanceTable(java.lang.String dirName,
java.lang.String mode)
Constructs the InstanceTable. |
Method Summary | |
---|---|
void |
close()
Close the file associate with the table |
void |
commit()
Commits the instances to the respective file. Commit operation is performed based on the object and action state that present in the ActionBufferList. |
InstanceMetaItem |
get(java.lang.Integer instanceId)
Returns the InstanceMetaItem for the given instance id |
java.util.Map<java.lang.Integer,InstanceMetaItem> |
get(java.lang.Short typeId)
Returns the hash map with key-value pair as InstanceId , InstanceMetaItem for the given type id |
InstanceMetaItem |
get(java.lang.Short typeId,
java.lang.Integer instanceId)
Returns the InstanceMetaItem for the given type id and instance id |
java.util.List<InstanceMetaItem> |
getAllItems()
Returns all the InstanceMetaItems from the table |
java.lang.Object |
getObject(java.lang.Object o)
Returns the InstanceMetaItems for the given type id |
void |
put(InstanceMetaItem item)
Puts the InstanceMetaItem into the instance table |
void |
put(java.lang.Short typeId,
InstanceMetaItem item)
Puts the InstanceMetaItem into the instance table with key as type id |
void |
put(java.lang.Short typeId,
java.lang.Integer instanceId,
InstanceMetaItem item)
Puts the InstanceMetaItem into the instance table with keys as type id and instance id |
boolean |
remove(InstanceMetaItem item)
Removes the instance from the instance table with the given InstanceMetaItem handle |
boolean |
remove(java.lang.Integer instanceId)
Removes the instance from the instance table with instance id as key |
boolean |
remove(java.lang.Short typeId,
java.lang.Integer instanceId)
Removes the instance from the instance table with type id and instance id as keys |
void |
setItem(java.lang.Short typeId,
java.lang.Integer instanceId,
InstanceMetaItem item)
Sets the InstanceMetaItem with keys as type id and instance id |
int |
size()
Returns the size of the table i.e. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InstanceTable(java.lang.String dirName, java.lang.String mode) throws java.io.FileNotFoundException, java.io.IOException
dirName
- directory name of the concept-netmode
- opening mode (r, rw)
java.io.FileNotFoundException
- if file not found
java.io.IOException
- if file operation failsMethod Detail |
---|
public void close() throws java.io.IOException
close
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
java.io.IOException
- if file operations failpublic void commit() throws java.io.IOException
commit
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
java.io.IOException
- if file operation failspublic InstanceMetaItem get(java.lang.Integer instanceId)
get
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
instanceId
- Instance id
InstanceMetaItem
Instance
public java.util.Map<java.lang.Integer,InstanceMetaItem> get(java.lang.Short typeId)
get
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
typeId
- Type id
public InstanceMetaItem get(java.lang.Short typeId, java.lang.Integer instanceId)
get
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
typeId
- Type idinstanceId
- Instance id
InstanceMetaItem
Type
,
Instance
public java.util.List<InstanceMetaItem> getAllItems()
getAllItems
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
InstanceMetaItem
public java.lang.Object getObject(java.lang.Object o)
getObject
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
o
- Type id - Short type
public void put(InstanceMetaItem item)
put
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
item
- InstanceMetaItemInstanceMetaItem
public void put(java.lang.Short typeId, InstanceMetaItem item)
put
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
typeId
- Type iditem
- InstanceMetaItemType
,
InstanceMetaItem
public void put(java.lang.Short typeId, java.lang.Integer instanceId, InstanceMetaItem item)
put
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
typeId
- Type idinstanceId
- Instance iditem
- InstanceMetaItemType
,
Instance
,
InstanceMetaItem
public boolean remove(InstanceMetaItem item)
item
- InstanceMetaItem
InstanceMetaItem
public boolean remove(java.lang.Integer instanceId)
remove
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
instanceId
- Instance id
public boolean remove(java.lang.Short typeId, java.lang.Integer instanceId)
remove
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
typeId
- Type idinstanceId
- Instance id
public void setItem(java.lang.Short typeId, java.lang.Integer instanceId, InstanceMetaItem item)
typeId
- Type idinstanceId
- Instance iditem
- InstanceMetaItemType
,
Instance
,
InstanceMetaItem
public int size()
size
in interface ItemTable<java.lang.Short,java.lang.Integer,InstanceMetaItem>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |