📄 enumeration.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.DataTypes;
import java.util.Collection;
import java.util.Iterator;
import com.prudsys.pdm.Cwm.Core.CWMTools;
import com.prudsys.pdm.Cwm.Core.DataType;
/**
* The Enumeration class is intended as a starting point from which emerated
* data types can be created. An emerated data type is a collection of
* identifiers often used as the permitted states that some other attribute or
* property of the emerated type may take.
*
*
*
* The isOrdered attribute of an Enumeration instance is used to determine if the
* ordered constraint on the EnumerationLiterals association is relevant for the
* enumeration. The particular ordering of EnumerationLiteral instances is
* obtained from the ordered constraint on the association even if the value
* attributes of the EnumerationLiteral instances contain non-null values that
* might be used to determine ordering. This is done to provide more flexible
* ordering semantics.
*
*
*
* An instance of Enumeration is also required to create a range data type. Refer
* to the EnumerationLiteral class for details.
*/
public class Enumeration extends DataType implements org.omg.cwm.foundation.datatypes.Enumeration
{
/**
* If True, the ordered constraint on the EnumerationLiterals association is
* relevant. Otherwise, the ordering of EnumerationLiteral instances is considered
* unspecified.
*/
public com.prudsys.pdm.Cwm.Core.Boolean isOrdered;
public EnumerationLiteral literal[];
public Enumeration()
{
}
public java.lang.Boolean getIsOrdered() {
return isOrdered.getBoolean();
}
public void setIsOrdered(java.lang.Boolean isOrdered) {
com.prudsys.pdm.Cwm.Core.Boolean b = new com.prudsys.pdm.Cwm.Core.Boolean();
b.setBoolean(isOrdered);
this.isOrdered = b;
}
public boolean isOrderedValue() {
return isOrdered.isBooleanValue();
}
public void setIsOrdered(boolean isOrdered) {
setIsOrdered(new java.lang.Boolean(isOrdered));
}
public Collection getLiteral() {
return CWMTools.ArrayToList(literal);
}
public void setLiteral(Collection literal) {
this.literal = new EnumerationLiteral[ literal.size() ];
Iterator it = literal.iterator();
for (int i = 0; i < literal.size(); i++)
this.literal[i] = (EnumerationLiteral) it.next();
}
public void addLiteral( org.omg.cwm.foundation.datatypes.EnumerationLiteral input) {
int size = (literal == null) ? 0 : literal.length;
EnumerationLiteral[] oldData = literal;
literal = new EnumerationLiteral[size+1];
if (size > 0) System.arraycopy(oldData, 0, literal, 0, size);
literal[size] = (EnumerationLiteral) input;
}
public void removeLiteral( org.omg.cwm.foundation.datatypes.EnumerationLiteral input) {
int size = (literal == null) ? 0 : literal.length;
if (size == 0)
return;
int ipos = -1;
for (int i = 0; i < size; i++)
if (literal[i].equals(input)) {
ipos = i;
break;
}
if (ipos == -1)
return;
EnumerationLiteral[] oldData = literal;
literal = new EnumerationLiteral[size-1];
for (int i = 0; i < ipos; i++)
literal[i] = oldData[i];
for (int i = ipos+1; i < size; i++)
literal[i-1] = oldData[i];
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -