📄 recordfile.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;
/**
* A RecordFile is the definition of a file. It may have one or more RecordDefs,
* defining the structure of the records in the file. Each of these RecordDefs
* defines a valid structure for records in the file. Subclasses of RecordFile in
* extensions to support specific languages and systems may be used to represent
* specific types of files such as COBOL CopyLib files and C-language header files.
*
*
*
* Physical deployments of a RecordFile can be found via the
* DataManagerDataPackage association in the SoftwareDeployment package .
*/
public class RecordFile extends com.prudsys.pdm.Cwm.Core.Package implements org.omg.cwm.resource.record.RecordFile
{
/**
* True if the contents of fields in the first record of the file contain field
* names applicable to subsequent records.
*/
public com.prudsys.pdm.Cwm.Core.Boolean isSelfDescribing = new com.prudsys.pdm.Cwm.Core.Boolean();
/**
* Contains the value that serves as a logical end-of-record indication in a
* stream-oriented file. A common examples include the usage of carriage-return
* characters and carriage-return/line-feed character pairs as new-line characters
* in ASCII text files.
*/
public com.prudsys.pdm.Cwm.Core.Integer recordDelimiter = new com.prudsys.pdm.Cwm.Core.Integer();
/**
* The number of records to ignore at the beginning of a file. The specific
* semantics of records that are skipped may be beyond the scope of CWM.
*/
public com.prudsys.pdm.Cwm.Core.Integer skipRecords = new com.prudsys.pdm.Cwm.Core.Integer();
public RecordDef record[];
public RecordFile()
{
}
public Boolean getIsSelfDescribing() {
return isSelfDescribing.getBoolean();
}
public void setIsSelfDescribing(Boolean isSelfDescribing) {
com.prudsys.pdm.Cwm.Core.Boolean b = new com.prudsys.pdm.Cwm.Core.Boolean();
b.setBoolean(isSelfDescribing);
this.isSelfDescribing = b;
}
public boolean isSelfDescribingValue() {
return isSelfDescribing.isBooleanValue();
}
public void setIsSelfDescribing(boolean isSelfDescribing) {
setIsSelfDescribing( new Boolean(isSelfDescribing) );
}
public Collection getRecord() {
return com.prudsys.pdm.Cwm.Core.CWMTools.ArrayToList(record);
}
public void setRecord(Collection record) {
this.record = new RecordDef[ record.size() ];
Iterator it = record.iterator();
for (int i = 0; i < record.size(); i++)
this.record[i] = (RecordDef) it.next();
}
public void addRecord( org.omg.cwm.resource.record.RecordDef input) {
int size = (record == null) ? 0 : record.length;
RecordDef[] oldData = record;
record = new RecordDef[size+1];
if (size > 0) System.arraycopy(oldData, 0, record, 0, size);
record[size] = (RecordDef) input;
}
public void removeRecord( org.omg.cwm.resource.record.RecordDef input) {
int size = (record == null) ? 0 : record.length;
if (size == 0)
return;
int ipos = -1;
for (int i = 0; i < size; i++)
if (record[i].equals(input)) {
ipos = i;
break;
}
if (ipos == -1)
return;
RecordDef[] oldData = record;
record = new RecordDef[size-1];
for (int i = 0; i < ipos; i++)
record[i] = oldData[i];
for (int i = ipos+1; i < size; i++)
record[i-1] = oldData[i];
}
public Long getRecordDelimiter() {
return recordDelimiter.getLong();
}
public void setRecordDelimiter(Long recordDelimiter) {
com.prudsys.pdm.Cwm.Core.Integer i = new com.prudsys.pdm.Cwm.Core.Integer();
i.setLong(recordDelimiter);
this.recordDelimiter = i;
}
public Long getSkipRecords() {
return skipRecords.getLong();
}
public void setSkipRecords(Long skipRecords) {
com.prudsys.pdm.Cwm.Core.Integer i = new com.prudsys.pdm.Cwm.Core.Integer();
i.setLong(skipRecords);
this.skipRecords = i;
}
public String toString() {
String s = "RecordFile name = " + getName() + " \n";
if (record != null)
for (int i = 0; i < record.length; i++)
s = s + record[i].toString() + "\n";
return s;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -