/** 
 * Project    : KANT (LMT)
 * Source Name: Syntax.java
 * Copyright  : Copyright (c) LTI, Carnegie Mellon University
 * Description: Class for Syntax
 * @version     1.0 (created by jko - 10/01/01)
 **/

package lmt;

import java.sql.*;
import java.util.*;

public class Syntax {
  String concept_id;
  String abbreviation;
  String acronym;
  String complement_s;	
  String complement_x;	
  String complement_ap;	
  String active;
  SQLConnection con;
	
  /** constructor 
   **/
  Syntax(SQLConnection con, String concept_id) {
    this.con = con;
    this.concept_id = concept_id;
    concept_id = "";		
    abbreviation = "";
    acronym = "";		
    complement_s = "";
    complement_x = "";		
    complement_ap = "";
    active = "";
  }
	
  // setters and getters
  public String getConceptID() {
    return concept_id;
  }	
  public void setConceptID(String concept_id) {
    if (concept_id == null)
      concept_id = "";
    this.concept_id = concept_id;
  }		
  public String getAbbreviation() {
    return abbreviation;
  }	
  public void setAbbreviation(String abbreviation) {
    if (abbreviation == null)
      abbreviation = "";
    this.abbreviation = abbreviation;
  }	
  public String getAcronym() {
    return acronym;
  }	
  public void setAcronym(String acronym) {
    if (acronym == null)
      acronym = "";
    this.acronym = acronym;
  }	
  public String getComplementS() {
    return complement_s;
  }	
  public void setComplementS(String complement_s) {
    if (complement_s == null)
      complement_s = "";				
    this.complement_s = complement_s;
  }	
  public String getComplementX() {
    return complement_x;
  }	
  public void setComplementX(String complement_x) {
    if (complement_x == null)
      complement_x = "";		
    this.complement_x = complement_x;
  }	
  public String getComplementAP() {
    return complement_ap;
  }	
  public void setComplementAP(String complement_ap) {
    if (complement_ap == null)
      complement_ap = "";
    this.complement_ap = complement_ap;
  }		
  public void setActive (String active) {
    if (active == null)
      active = "";		
    this.active = active;
  }	
	
  /** Get all syntaxs which have the concept_id. 
   * @param pos a string representing part-of-speech
   * @param concept_id a string representing concept_id
   * @return Vector all syntax pronouns fetched from the database.
   **/	
  public static Syntax fetchSyntax(SQLConnection con, String pos, String concept_id) {
    Syntax syntax = null;
		
    Debug.debug("-- pos: " + pos);
    if ( pos == null )
      return syntax;
		
    if ( pos.equals("VERB") ) 
      syntax = SyntaxVerb.fetchSyntax(con, concept_id);
		
    else if (pos.equals("NOUN") ||
	     pos.equals("PROP") ||
	     pos.equals("UNIT") ) 
      syntax = SyntaxNoun.fetchSyntax(con, concept_id);
    else if ( pos.equals("PRON") ) 
      syntax = SyntaxPronoun.fetchSyntax(con, concept_id);
	
    else if (pos.equals("ADVERB") ) 
      syntax = SyntaxAdv.fetchSyntax(con, concept_id);
			
    else if (pos.equals("ADJ") ) 
      syntax = SyntaxAdj.fetchSyntax(con, concept_id);			
		
    else if (pos.equals("CONJ") ) 
      syntax = SyntaxConj.fetchSyntax(con, concept_id);
		
    else if (pos.equals("QUANT") ) 
      syntax = SyntaxQuant.fetchSyntax(con, concept_id);
		
    else if (pos.equals("SYM") ) 
      syntax = SyntaxSym.fetchSyntax(con, concept_id);			
	
    return syntax;
  }

  public void makeQuery(Vector queryVector, String pos) {
				
    if ( pos.equals("VERB") ) 
      ((SyntaxVerb)this).makeQuery(queryVector);	
    else if (pos.equals("NOUN") ||
	     pos.equals("PROP") ||
	     pos.equals("UNIT") ) 
      ((SyntaxNoun)this).makeQuery(queryVector);	
    else if ( pos.equals("PRON") ) 
      ((SyntaxPronoun)this).makeQuery(queryVector);	
    else if (pos.equals("ADVERB") ) 
      ((SyntaxAdv)this).makeQuery(queryVector);	
    else if (pos.equals("ADJ") ) 
      ((SyntaxAdj)this).makeQuery(queryVector);		
    else if (pos.equals("CONJ") ) 
      ((SyntaxConj)this).makeQuery(queryVector);	
    else if (pos.equals("QUANT") ) 
      ((SyntaxQuant)this).makeQuery(queryVector);	
    else if (pos.equals("SYM") ) 
      ((SyntaxSym)this).makeQuery(queryVector);	
  }		
}
