www.pudn.com > d4j.zip > CDT.java


// CDT: Model Conferee Description Table 
// $Id: CDT.java,v 1.3 2003/07/24 20:22:58 cgm8 Exp $ 
/*  
 * Copyright (c) 1999 Carlos G Mendioroz. 
 * 
 *  This file is part of D4J. 
 * 
 *  D4J is free software; you can redistribute it and/or 
 *  modify it under the terms of the GNU Lesser General Public 
 *  License as published by the Free Software Foundation; either 
 *  version 2 of the License, or (at your option) any later version. 
 *   
 *  D4J 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 
 *  Lesser General Public License for more details. 
 *   
 *  You should have received a copy of the GNU Lesser General Public 
 *  License along with this library; if not, write to the 
 *  Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
 *  Boston, MA  02111-1307, USA. 
 * 
 * Report problems and direct all questions to: 
 * 
 *	tron@acm.org 
 */ 
package local.dialogic; 
 
import java.util.*; 
 
 
public class CDT extends java.lang.Object 
{ 
 
// This is what we model: 
/* 
typedef struct { 
 
          int chan_num;      // SCbus time slot number  
          int chan_sel;      // meaning of time slot number  
          int chan_attr;     // attribute description  
} MS_CDT; 
#define     chan_lts                   chan_attr 
*/ 
 
    int chan_num; 
    int chan_sel; 
    int chan_attr; 
    Channel channel; 
    int chan_lts; 
 
    private static Vector cdtAtTs; 
     
    static { 
        cdtAtTs = new java.util.Vector(5,4); 
    } 
     
    public static CDT atTs(int ts) { 
        if (ts >= cdtAtTs.size()) 
            return null; 
        return (CDT)cdtAtTs.elementAt(ts); 
    } 
     
    public CDT(Channel aChannel) { 
        this(aChannel, Dialogic.MSPA_NULL); 
    } 
     
    public CDT(Channel aChannel, int attributes) { 
        channel = aChannel; 
        chan_sel = Dialogic.MSPN_TS; 
        chan_num = channel.getNetwork().getTs(); 
        chan_attr = attributes; 
        chan_lts = -1; 
        if (cdtAtTs.size() <= chan_num) { 
            cdtAtTs.setSize(chan_num + 1); 
        } 
        cdtAtTs.setElementAt(this, chan_num); 
   } 
    
    public String toString() { 
        return "CDT for " + channel + " at " + chan_lts + " (" + chan_attr + ")"; 
    } 
}