📄 cubecursor.java
字号:
MiningVector mv = aggregStream.read();
int[] edgeKeys = new int[nEdgeAtt];
for (int j = 0; j < nEdgeAtt; j++)
edgeKeys[j] = (int) mv.getValue( edgeIndexes.IntegerAt(j) );
// Add vector to stream if new:
IntArray edgeArr = new IntArray(edgeKeys);
if ( usedKeys.get(edgeArr) == null ) {
double[] values = new double[nEdgeAtt];
for (int j = 0; j < nEdgeAtt; j++)
values[j] = edgeKeys[j];
mv = new MiningVector(values);
mv.setMetaData(edgeMetaData);
edgeTable.add(mv);
usedKeys.put(edgeArr, new Integer(0));
};
};
// Crate edge cursor and add to ordinate edges:
EdgeCursor edgeCursor = new EdgeCursor(this, false, edgeView, edgeTable);
addOrdinateEdge(edgeCursor);
System.out.println("edgeCursor:" + edgeTable);
while ( edgeCursor.next() )
System.out.println( edgeTable.read() );
}
}
catch (MiningException ex) {
throw new OLAPException( ex.toString() );
}
}
/**
* Private class to compare integer arrays of same length.
* To be used in hashtable.
*/
private class IntArray {
int[] array;
public IntArray(int[] array) {
this.array = array;
}
public boolean equals(Object obj) {
IntArray intArr2 = (IntArray) obj;
for (int i = 0; i < array.length; i++)
if (array[i] != intArr2.array[i]) return false;
return true;
}
public int hashCode() {
return array[0];
}
}
/**
* Creates page edges for measure and other page dimensions.
*
* @throws OLAPException couldn't create ordinate edge
*/
private void createPageEdge() throws OLAPException {
try {
MiningDataSpecification aggMetaData = aggregStream.getMetaData();
pageStream.setMetaData(aggMetaData);
for (int i = 0; i < cubeView.getPageEdge().size(); i++) {
EdgeView edgeView = (EdgeView) cubeView.getPageEdge().iterator().next();
// Crate edge cursor and add to page edges:
EdgeCursor edgeCursor = new EdgeCursor(this, true, edgeView, pageStream);
addPageEdge(edgeCursor);
}
}
catch (MiningException ex) {
throw new OLAPException( ex.toString() );
}
}
// -----------------------------------------------------------------------
// Selection to determine set of vectors at current cursor position
// -----------------------------------------------------------------------
/**
* Update ordinate selection vector and run selection. Result is
* contained in selectedVectors.
*
* @param mv mining vector of ordinate edge with current coordinates
* @throws OLAPException cannot update selection
*/
protected void updateSelection(MiningVector mv) throws OLAPException {
// Copy coodinates into ordinateSelect vector:
MiningDataSpecification ordMetaData = ordinateSelect.getMetaData();
int nOrdAtt = ordMetaData.getAttributesNumber();
MiningDataSpecification vecMetaData = mv.getMetaData();
int nVecAtt = vecMetaData.getAttributesNumber();
for (int i = 0; i < nVecAtt; i++) {
int ind = ordMetaData.getAttributeIndex( vecMetaData.getMiningAttribute(i) );
ordinateSelect.setValue(ind, mv.getValue(i) );
};
// Run selection:
boolean nomissing = true;
SelectAttribute[] sa = new SelectAttribute[nOrdAtt];
for (int i = 0; i < nOrdAtt; i++) {
double val = ordinateSelect.getValue(i);
if ( Category.isMissingValue(val) ) {
nomissing = false;
break;
}
CategoricalAttribute ca = (CategoricalAttribute) ordMetaData.getMiningAttribute(i);
Category cat = ca.getCategory(val);
sa[i] = new SelectAttribute( ca.getName(), cat.getDisplayValue() );
};
pageStream.clear();
if ( !nomissing )
return;
try {
aggregStream.runSelections(sa);
aggregStream.reset();
while ( aggregStream.next() )
pageStream.add( aggregStream.read() );
EdgeCursor ec = (EdgeCursor) pageEdge.get(0);
DimensionCursor dc = (DimensionCursor) ec.dimensionCursor.get(0);
int ext[] = new int[1];
ext[0] = pageStream.size();
dc.setExtents(ext);
}
catch (MiningException ex) {
throw new OLAPException( ex.toString() );
}
}
// -----------------------------------------------------------------------
// Getter and setter methods
// -----------------------------------------------------------------------
public void setOrdinateEdge(Collection input) throws OLAPException {
ordinateEdge.set(input);
}
public List getOrdinateEdge() throws OLAPException {
return ordinateEdge.get();
}
public void addOrdinateEdge(javax.olap.cursor.EdgeCursor input) throws OLAPException {
ordinateEdge.add(input);
}
public void removeOrdinateEdge(javax.olap.cursor.EdgeCursor input) throws OLAPException {
ordinateEdge.remove(input);
}
public void addOrdinateEdgeBefore(javax.olap.cursor.EdgeCursor before, javax.olap.cursor.EdgeCursor input) throws OLAPException {
ordinateEdge.addBefore(before, input);
}
public void addOrdinateEdgeAfter(javax.olap.cursor.EdgeCursor before, javax.olap.cursor.EdgeCursor input) throws OLAPException {
ordinateEdge.addAfter(before, input);
}
public void moveOrdinateEdgeBefore(javax.olap.cursor.EdgeCursor before, javax.olap.cursor.EdgeCursor input) throws OLAPException {
ordinateEdge.moveBefore(before, input);
}
public void moveOrdinateEdgeAfter(javax.olap.cursor.EdgeCursor before, javax.olap.cursor.EdgeCursor input) throws OLAPException {
ordinateEdge.moveAfter(before, input);
}
public void setPageEdge(Collection input) throws OLAPException {
pageEdge.set(input);
}
public Collection getPageEdge() throws OLAPException {
return pageEdge.get();
}
public void addPageEdge(javax.olap.cursor.EdgeCursor input) throws OLAPException {
pageEdge.add(input);
}
public void removePageEdge(javax.olap.cursor.EdgeCursor input) throws OLAPException {
pageEdge.remove(input);
}
public void synchronizePages() throws OLAPException {
throw new UnsupportedOperationException();
}
// TransactionalObject methods:
public void setActiveIn( javax.olap.query.querytransaction.QueryTransaction input) throws OLAPException {
throw new UnsupportedOperationException();
}
public javax.olap.query.querytransaction.QueryTransaction getActiveIn() throws OLAPException {
throw new UnsupportedOperationException();
}
// -----------------------------------------------------------------------
// RowDataAccessor methods
// -----------------------------------------------------------------------
public void close() throws OLAPException {
}
public InputStream getAsciiStream(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public InputStream getAsciiStream(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public BigDecimal getBigDecimal(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public BigDecimal getBigDecimal(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public InputStream getBinaryStream(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public InputStream getBinaryStream(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Blob getBlob(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Blob getBlob(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public boolean getBoolean(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public boolean getBoolean(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public byte getByte(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public byte getByte(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public byte[] getBytes(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public byte[] getBytes(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Reader getCharacterStream(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Reader getCharacterStream(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Clob getClob(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Clob getClob(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public void getDate(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public void getDate(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public void getDate(int arg0, Calendar arg1) throws OLAPException {
throw new UnsupportedOperationException();
}
public void getDate(String arg0, Calendar arg1) throws OLAPException {
throw new UnsupportedOperationException();
}
public javax.olap.cursor.RowDataMetaData getMetaData() throws OLAPException {
throw new UnsupportedOperationException();
}
public double getDouble(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public double getDouble(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public float getFloat(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public float getFloat(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public int getInt(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public int getInt(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public long getLong(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public long getLong(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Object getObject(int arg0) throws OLAPException {
return null;
}
public Object getObject(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Object getObject(int arg0, Map arg1) throws OLAPException {
throw new UnsupportedOperationException();
}
public Object getObject(String arg0, Map arg1) throws OLAPException {
throw new UnsupportedOperationException();
}
public short getShort(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public short getShort(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public String getString(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public String getString(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Time getTime(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Time getTime(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Time getTime(int arg0, Calendar arg1) throws OLAPException {
throw new UnsupportedOperationException();
}
public Time getTime(String arg0, Calendar arg1) throws OLAPException {
throw new UnsupportedOperationException();
}
public Timestamp getTimestamp(int arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Timestamp getTimestamp(String arg0) throws OLAPException {
throw new UnsupportedOperationException();
}
public Timestamp getTimestamp(int arg0, Calendar arg1) throws OLAPException {
throw new UnsupportedOperationException();
}
public Timestamp getTimestamp(String arg0, Calendar arg1) throws OLAPException {
throw new UnsupportedOperationException();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -