org.knowceans.corpus.parsers.dpa
Class IptcCategories

java.lang.Object
  extended by org.knowceans.corpus.parsers.dpa.IptcCategories
All Implemented Interfaces:
java.io.Serializable, ICategories

public class IptcCategories
extends java.lang.Object
implements ICategories, java.io.Serializable

IptcCategories represents the IPTC document categorisation hierarchy.

Author:
heinrich
See Also:
Serialized Form

Field Summary
private static java.lang.Object[][] iptcCodes
           
(package private)  java.util.Vector<java.lang.Integer> iptcIndex
           
(package private)  java.util.HashMap<java.lang.Integer,java.lang.String> iptcMap
           
private static long serialVersionUID
           
 
Constructor Summary
IptcCategories()
           
 
Method Summary
 java.lang.String decode(int iptcCode)
          get description string for IPTC code
 java.lang.String decode(java.util.Vector<java.lang.Integer> a)
          return a string description of the category ids in the argument.
private  int getLevel(int iptc)
          returns the level of the IPTC code in the hierarchy, starting with 1.
private  int getLevelIptc(int iptc, int level)
          Get the IPTC code at the specified level
 int[] indexToHierarchy(int index, boolean include)
          returns the index of the argument and those indices that correspond to the superclasses in the IPTC hierarchy.
 int indexToIptc(int index)
          get the IPTC category code of the index
 int[] indexToSubindices(int index, int levels, boolean include)
          returns the indices of the direct subcategories of the index.
 int iptcCategoryCount()
           
 int iptcToIndex(int iptc)
          get the index of the IPTC category code
static void main(java.lang.String[] args)
           
 java.util.Vector<java.lang.Integer> subjects(java.lang.String sub)
          get category ids (encoding) of the descriptors in the argument (space-separated).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

iptcMap

java.util.HashMap<java.lang.Integer,java.lang.String> iptcMap

iptcIndex

java.util.Vector<java.lang.Integer> iptcIndex

iptcCodes

private static final java.lang.Object[][] iptcCodes
Constructor Detail

IptcCategories

public IptcCategories()
Method Detail

main

public static void main(java.lang.String[] args)

subjects

public java.util.Vector<java.lang.Integer> subjects(java.lang.String sub)
Description copied from interface: ICategories
get category ids (encoding) of the descriptors in the argument (space-separated).

Specified by:
subjects in interface ICategories
Returns:

decode

public java.lang.String decode(java.util.Vector<java.lang.Integer> a)
Description copied from interface: ICategories
return a string description of the category ids in the argument.

Specified by:
decode in interface ICategories
Returns:

decode

public java.lang.String decode(int iptcCode)
get description string for IPTC code

Parameters:
iptcCode -
Returns:

iptcToIndex

public int iptcToIndex(int iptc)
get the index of the IPTC category code

Parameters:
iptc - code
Returns:

iptcCategoryCount

public int iptcCategoryCount()
Returns:

indexToIptc

public int indexToIptc(int index)
get the IPTC category code of the index

Parameters:
index - code
Returns:

indexToHierarchy

public int[] indexToHierarchy(int index,
                              boolean include)
returns the index of the argument and those indices that correspond to the superclasses in the IPTC hierarchy.

Parameters:
index -
Returns:

indexToSubindices

public int[] indexToSubindices(int index,
                               int levels,
                               boolean include)
returns the indices of the direct subcategories of the index.

Parameters:
index - of category (root not yet implemented)
levels - that should be considered
include - the argument.
Returns:

getLevelIptc

private int getLevelIptc(int iptc,
                         int level)
Get the IPTC code at the specified level

Parameters:
iptc -
Returns:

getLevel

private int getLevel(int iptc)
returns the level of the IPTC code in the hierarchy, starting with 1. returns 0 for "unknown" or "ambiguous".

Parameters:
iptc -
Returns: