jInfer

cz.cuni.mff.ksi.jinfer.basicdtd.utils
Class DomainUtils

java.lang.Object
  extended by cz.cuni.mff.ksi.jinfer.basicdtd.utils.DomainUtils

public final class DomainUtils
extends Object

Utility functions for attribute domain handling. Domain is the range of values an attribute may have. In the context of this class, it is a hash map of (attribute value, number of times it was used).


Field Summary
static String ATTRIBUTE_CDATA
          DTD's way of saying the attribute contains character data.
static String ATTRIBUTE_IMPLIED
          DTD's way of saying the attribute has an implied value.
 
Method Summary
static String getAttributeType(Map<String,Integer> domain, int threshold)
          For domain D of attribute A returns its description, or the type of A.
static String getDefault(Map<String,Integer> domain, double ratio)
          Returns the default value for this domain (that is the value found with probability higher than ratio) or #IMPLIED, if there is no dominant value.
static Map<String,Integer> getDomain(Attribute attribute)
          Returns the domain of values of this attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_IMPLIED

public static final String ATTRIBUTE_IMPLIED
DTD's way of saying the attribute has an implied value.

See Also:
Constant Field Values

ATTRIBUTE_CDATA

public static final String ATTRIBUTE_CDATA
DTD's way of saying the attribute contains character data.

See Also:
Constant Field Values
Method Detail

getDomain

public static Map<String,Integer> getDomain(Attribute attribute)
Returns the domain of values of this attribute.


getDefault

public static String getDefault(Map<String,Integer> domain,
                                double ratio)
Returns the default value for this domain (that is the value found with probability higher than ratio) or #IMPLIED, if there is no dominant value.

Parameters:
ratio - Minimal ratio of a single value occurence, above which it is declared dominant and therefore default.
Returns:
Default value in double quotes or the keyword #IMPLIED.

getAttributeType

public static String getAttributeType(Map<String,Integer> domain,
                                      int threshold)
For domain D of attribute A returns its description, or the type of A. Decides whether this domain is small enough to be enumerated in the attribute definition, or whether it should be an ambiguous CDATA.

Parameters:
threshold - Domains smaller or equal to this will be returned as an enum, larger as CDATA.
Returns:
String defining (describing) this domain.

jInfer

Generated on Fri Dec 9 00:01:25 CET 2011