/*
 * Copyright 2014 Josef Hardi <josef.hardi@gmail.com>
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.github.johardi.r2rmlparser.document;

import io.github.johardi.r2rmlparser.util.StringUtils;

public abstract class TermMap
{
   /**
    * A constant-valued term map
    */
   public final static int CONSTANT_VALUE = 1;

   /**
    * A column-valued term map
    */
   public final static int COLUMN_VALUE = 2;

   /**
    * A template-valued term map
    */
   public final static int TEMPLATE_VALUE = 3;

   private int mType;
   private String mTermType;

   private String mValue;
   private String mDatatype;
   private String mLanguage;

   public void setType(int type)
   {
      mType = type;
      if (mTermType == null) {
         decideDefaultTermType();
      }
   }

   protected abstract void decideDefaultTermType();

   /**
    * Returns one of the following types below. The type specifies the kind of
    * value returns by <code>getValue()</code> method.
    * <ul>
    * <li>{@link CONSTANT_VALUE} - A constant-valued term map, specified by <code>rr:constant</code> property</li>
    * <li>{@link COLUMN_VALUE} - A column-valued term map, specified by <code>rr:ccolumn</code> property</li>
    * <li>{@link TEMPLATE_VALUE} - A template-valued term map, specified by <code>rr:template</code> property</li>
    * </ul>
    */
   public int getType()
   {
      return mType;
   }

   public void setTermType(String type)
   {
      mTermType = type;
   }

   public String getTermType()
   {
      return mTermType;
   }

   public void setDatatype(String datatype)
   {
      mDatatype = datatype;
   }

   /**
    * Returns the value specified by <code>rr:datatype</code> property.
    */
   public String getDatatype()
   {
      return mDatatype;
   }

   /**
    * Returns <code>true</code> if the map has specified explicitly the data
    * type, or <code>false</code> otherwise.
    */
   public boolean hasDatatype()
   {
      return (StringUtils.isEmpty(mDatatype)) ? false : true;
   }

   public void setLanguage(String value)
   {
      mLanguage = value;
   }

   /**
    * Returns the value specified by <code>rr:language</code> property.
    */
   public String getLanguage()
   {
      return mLanguage;
   }

   /**
    * Returns <code>true</code> if the map has language tag specified, or
    * <code>false</code> otherwise.
    */
   public boolean hasLanguageTag()
   {
      return (StringUtils.isEmpty(mLanguage)) ? false : true;
   }

   public void setValue(String value)
   {
      mValue = value;
   }

   /**
    * Returns the term map value. Use <code>getType()</code> method to know the
    * kind of value returned by this method.
    */
   public String getValue()
   {
      return mValue;
   }
}

@@ -1439,70 +1439,264 @@
  the
- kind of%0A    * value returns by %3Ccode%3EgetValue()%3C/code%3E method
+%0A    * representative meaning of the value returned by %3Ccode%3EgetValue()%3C/code%3E%0A    * method. For example, if this method returns %3Ccode%3ECOLUMN_VALUE%3C/code%3E then%0A    * the string from %3Ccode%3EgetValue()%3C/code%3E indicates a column name in the%0A    * logical table
 .%0A  
@@ -1771,32 +1771,42 @@
 ap, specified by
+%0A    *    
  %3Ccode%3Err:consta
@@ -1892,32 +1892,42 @@
 ap, specified by
+%0A    *    
  %3Ccode%3Err:ccolum
@@ -2016,32 +2016,42 @@
 ap, specified by
+%0A    *    
  %3Ccode%3Err:templa
@@ -2215,32 +2215,500 @@
 e = type;%0A   %7D%0A%0A
+   /**%0A    * Returns one of the following URI string constants below.%0A    * %3Cul%3E%0A    * %3Cli%3E%3Ccode%3Ehttp://www.w3.org/ns/r2rml#IRI%3C/code%3E, which represents term%0A    *     type%3Ccode%3Err:IRI%3C/code%3E%3C/li%3E%0A    * %3Cli%3E%3Ccode%3Ehttp://www.w3.org/ns/r2rml#Literal%3C/code%3E, which represents term%0A    *     type%3Ccode%3Err:Literal%3C/code%3E%3C/li%3E%0A    * %3Cli%3E%3Ccode%3Ehttp://www.w3.org/ns/r2rml#BlankNode%3C/code%3E, which represents%0A    *     term type%3Ccode%3Err:BlankNode%3C/code%3E%3C/li%3E%0A    * %3C/ul%3E%0A    */%0A
    public String

Add javadoc.