⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recorddef.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
字号:
/*
 *    This program 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 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program 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 this program; if not, write to the Free Software
 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/**
 * Title: XELOPES Data Mining Library
 * Description: The XELOPES library is an open platform-independent and data-source-independent library for Embedded Data Mining.
 * Copyright: Copyright (c) 2002 Prudential Systems Software GmbH
 * Company: ZSoft (www.zsoft.ru), Prudsys (www.prudsys.com)
 * @author Valentine Stepanenko (valentine.stepanenko@zsoft.ru)
 * @version 1.0
 */

package com.prudsys.pdm.Cwm.Record;

import java.util.Collection;
import java.util.Iterator;

import com.prudsys.pdm.Cwm.COBOLData.Section;

/**
 * A RecordDef is an ordered collection of Fields representing the structure of a
 * Record.
 *
 *
 *
 * Examples of RecordDefs include definitions of
 *
 *
 *
 *     language-specific data structures
 *
 *     database records
 *
 *     IMS segments
 *
 *
 *
 * The internal structure of a RecordDef instance is constructed by adding Field
 * instances as features (using the ElementOwnership association) and pointing
 * each Field instance?s inherited type reference to the Classifier instance
 * representing the Field?s data type. The referenced instance can be either a
 * primitive data type (an instance of DataType, such as "integer") or a
 * structured data type (such as a Group instance).
 *
 *
 *
 * Refer to the example for more details of the relationships between RecordDefs,
 * Fields, Records, and their values.
 */
public class RecordDef extends com.prudsys.pdm.Cwm.Core.Class implements org.omg.cwm.resource.record.RecordDef
{

   /**
    * The value of a fieldDelimiter used to separate field values in an input stream.
    */
   public com.prudsys.pdm.Cwm.Core.String fieldDelimiter = new com.prudsys.pdm.Cwm.Core.String();;

   /**
    * True if the record is fixed length. Otherwise, the record can be of variable
    * length.
    */
   public com.prudsys.pdm.Cwm.Core.Boolean isFixedWidth = new com.prudsys.pdm.Cwm.Core.Boolean();

   /**
    * The delimiter of a text string in the record, such as a quote.
    */
   public com.prudsys.pdm.Cwm.Core.String textDelimiter = new com.prudsys.pdm.Cwm.Core.String();

   public RecordFile file[];
   public Section section[];

   public RecordDef()
   {

   }

   public String getFieldDelimiter() {
     return fieldDelimiter.getString();
   }

   public void setFieldDelimiter(String fieldDelimiter) {
     com.prudsys.pdm.Cwm.Core.String s = new com.prudsys.pdm.Cwm.Core.String();
     s.setString(fieldDelimiter);
     this.fieldDelimiter = s;
   }

   public Collection getFile() {
     return com.prudsys.pdm.Cwm.Core.CWMTools.ArrayToList(file);
   }

   public void setFile(Collection file) {

     this.file = new RecordFile[ file.size() ];
     Iterator it = file.iterator();
     for (int i = 0; i < file.size(); i++)
       this.file[i] = (RecordFile) it.next();
   }

   public void addFile( org.omg.cwm.resource.record.RecordFile input) {

     int size = (file == null) ? 0 : file.length;
     RecordFile[] oldData = file;
     file = new RecordFile[size+1];
     if (size > 0) System.arraycopy(oldData, 0, file, 0, size);
     file[size] = (RecordFile) input;
   }

   public void removeFile( org.omg.cwm.resource.record.RecordFile input) {

     int size = (file == null) ? 0 : file.length;
     if (size == 0)
       return;

     int ipos = -1;
     for (int i = 0; i < size; i++)
       if (file[i].equals(input)) {
         ipos = i;
         break;
       }
     if (ipos == -1)
       return;

     RecordFile[] oldData = file;
     file = new RecordFile[size-1];
     for (int i = 0; i < ipos; i++)
       file[i] = oldData[i];
     for (int i = ipos+1; i < size; i++)
       file[i-1] = oldData[i];
   }

   public Boolean getIsFixedWidth() {
     return isFixedWidth.getBoolean();
   }

   public void setIsFixedWidth(Boolean isFixedWidth) {
     com.prudsys.pdm.Cwm.Core.Boolean b = new com.prudsys.pdm.Cwm.Core.Boolean();
     b.setBoolean(isFixedWidth);
     this.isFixedWidth = b;
   }

   public boolean isFixedWidthValue() {
     return isFixedWidth.isBooleanValue();
   }

   public void setIsFixedWidth(boolean isFixedWidth) {
     setIsFixedWidth( new Boolean(isFixedWidth) );
   }


   public String getTextDelimiter() {
     return textDelimiter.getString();
   }

   public void setTextDelimiter(String textDelimiter) {
     com.prudsys.pdm.Cwm.Core.String s = new com.prudsys.pdm.Cwm.Core.String();
     s.setString(textDelimiter);
     this.textDelimiter = s;
   }

   public String toString() {

     String s = "RecordDef: " +  getName() + "\n";
     if (feature != null)
       for (int i = 0; i < feature.length; i++)
         s = s + "field name = " + feature[i].getName() +
                 ", field type = " + ((Field)feature[i]).getType().getName() + "\n";

     return s;
   }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -