📄 schema.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.Olap.Metadata;
import java.util.Collection;
import java.util.Iterator;
import javax.olap.OLAPException;
/**
* Schema contains all elements comprising an OLAP model. A Schema may also
* contain any number of DeploymentGroups, representing the various physical
* deployments of the logical Schema.
*/
public class Schema extends com.prudsys.pdm.Cwm.Core.Package implements javax.olap.serversidemetadata.Schema
{
public Cube[] cube; // changed to array, M. Thess, 04.01.2004
public Dimension[] dimension; // changed to array, M. Thess, 04.01.2004
public DeploymentGroup[] deploymentGroup; // changed to array, M. Thess, 04.01.2004
public Schema()
{
}
public Collection getCube() throws OLAPException
{
return com.prudsys.pdm.Cwm.Core.CWMTools.ArrayToList(cube);
}
public void setCube(Collection cube) throws OLAPException
{
this.cube = new Cube[ cube.size() ];
Iterator it = cube.iterator();
for (int i = 0; i < cube.size(); i++)
this.cube[i] = (Cube) it.next();
}
public void addCube( javax.olap.metadata.Cube input) throws OLAPException
{
int size = (cube == null) ? 0 : cube.length;
Cube[] oldData = cube;
cube = new Cube[size+1];
if (size > 0) System.arraycopy(oldData, 0, cube, 0, size);
cube[size] = (Cube) input;
}
public void removeCube( javax.olap.metadata.Cube input) throws OLAPException
{
int size = (cube == null) ? 0 : cube.length;
if (size == 0)
return;
int ipos = -1;
for (int i = 0; i < size; i++)
if (cube[i].equals(input)) {
ipos = i;
break;
}
if (ipos == -1)
return;
Cube[] oldData = cube;
cube = new Cube[size-1];
for (int i = 0; i < ipos; i++)
cube[i] = oldData[i];
for (int i = ipos+1; i < size; i++)
cube[i-1] = oldData[i];
}
public Collection getDeploymentGroup() throws OLAPException
{
return com.prudsys.pdm.Cwm.Core.CWMTools.ArrayToList(deploymentGroup);
}
public void setDeploymentGroup(Collection deploymentGroup) throws OLAPException
{
this.deploymentGroup = new DeploymentGroup[ deploymentGroup.size() ];
Iterator it = deploymentGroup.iterator();
for (int i = 0; i < deploymentGroup.size(); i++)
this.deploymentGroup[i] = (DeploymentGroup) it.next();
}
public void addDeploymentGroup( javax.olap.serversidemetadata.DeploymentGroup input) throws OLAPException
{
int size = (deploymentGroup == null) ? 0 : deploymentGroup.length;
DeploymentGroup[] oldData = deploymentGroup;
deploymentGroup = new DeploymentGroup[size+1];
if (size > 0) System.arraycopy(oldData, 0, deploymentGroup, 0, size);
deploymentGroup[size] = (DeploymentGroup) input;
}
public void removeDeploymentGroup( javax.olap.serversidemetadata.DeploymentGroup input) throws OLAPException
{
int size = (deploymentGroup == null) ? 0 : deploymentGroup.length;
if (size == 0)
return;
int ipos = -1;
for (int i = 0; i < size; i++)
if (deploymentGroup[i].equals(input)) {
ipos = i;
break;
}
if (ipos == -1)
return;
DeploymentGroup[] oldData = deploymentGroup;
deploymentGroup = new DeploymentGroup[size-1];
for (int i = 0; i < ipos; i++)
deploymentGroup[i] = oldData[i];
for (int i = ipos+1; i < size; i++)
deploymentGroup[i-1] = oldData[i];
}
public Collection getDimension() throws OLAPException
{
return com.prudsys.pdm.Cwm.Core.CWMTools.ArrayToList(dimension);
}
public void setDimension(Collection dimension) throws OLAPException
{
this.dimension = new Dimension[ dimension.size() ];
Iterator it = dimension.iterator();
for (int i = 0; i < dimension.size(); i++)
this.dimension[i] = (Dimension) it.next();
}
public void addDimension( javax.olap.metadata.Dimension input) throws OLAPException
{
int size = (dimension == null) ? 0 : dimension.length;
Dimension[] oldData = dimension;
dimension = new Dimension[size+1];
if (size > 0) System.arraycopy(oldData, 0, dimension, 0, size);
dimension[size] = (Dimension) input;
}
public void removeDimension( javax.olap.metadata.Dimension input) throws OLAPException
{
int size = (dimension == null) ? 0 : dimension.length;
if (size == 0)
return;
int ipos = -1;
for (int i = 0; i < size; i++)
if (dimension[i].equals(input)) {
ipos = i;
break;
}
if (ipos == -1)
return;
Dimension[] oldData = dimension;
dimension = new Dimension[size-1];
for (int i = 0; i < ipos; i++)
dimension[i] = oldData[i];
for (int i = ipos+1; i < size; i++)
dimension[i-1] = oldData[i];
}
public String toString() {
String s = "Schema name = " + getName() + " \n";
if (dimension != null) {
s = s + "#dimensions = " + dimension.length + " :\n";
for (int i = 0; i < dimension.length; i++)
s = s + dimension[i].toString() + "\n";
s = s + "\n";
}
if (cube != null) {
s = s + "#cubes = " + cube.length + " :\n";
for (int i = 0; i < cube.length; i++)
s = s + cube[i].toString() + "\n";
}
return s;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -