function U = wordfactordiscr(varargin)
% WORDFACTORDISCR Discriminant factor for words
%
% U = WORDFACTORDISCR(T,L) where T is a factor template and L is
% the number of values the variables may take on.
%
% U = WORDFACTORDISCR Creates an empty/default object
%
% U = WORDFACTORDISCR(A) where A is a wordfactordiscr object will return a
% copy of A

% Fields:
%  numLabels

    
% Jerod Weinman
% jerod@acm.org
    
% $Id: wordfactordiscr.m 1 2009-06-17 20:04:43Z weinman $
 
% Jerod Weinman
% jerod@acm.org
% Copyright 2006, 2008, 2009, 2011
 
%    This file is part of VIDI.
%
%    VIDI is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    VIDI is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with VIDI.  If not, see <http://www.gnu.org/licenses/>.

  if nargin == 0
	
	U0 = factordiscr();
	
	U.numLabels = 0;
	
	U = class(U,'wordfactordiscr',U0);
	
  elseif nargin==1 & isa(varargin{1},'wordfactordiscr')
	
	U = varargin{1};
	
  else
	
	T = varargin{1};
	L = varargin{2};
	
	if ~isa(T,'factortemplate')
	  error('T must be a factortemplate object');
	end;
	
	if ~isscalar(L) || L<0
	  error('L must be a non-negative scalar');
	end;
	
	U0 = factordiscr(T);
	
	
	U.numLabels = L;
	
	U = class(U,'wordfactordiscr',U0);
	
  end;
