📄 jco$table.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: JCO.java
package com.sap.mw.jco;
import java.io.Serializable;
// Referenced classes of package com.sap.mw.jco:
// JCO, IMetaData, IExtendedFieldMetaData
public static class JCO$Table extends
implements Cloneable, Serializable
{
/**
* @deprecated Method copyContent is deprecated
*/
protected void copyContent( rsrc, rdest)
{
JCO$Table src = (JCO$Table)rsrc;
JCO$Table dest = (JCO$Table)rdest;
dest.row_capacity = src.row_capacity;
dest.row_capacity_increment = src.row_capacity_increment;
super.copyContent(src, dest);
}
/**
* @deprecated Method copyRaw is deprecated
*/
protected static void copyRaw(ure src, JCO$Table dest)
{
dest.copyRaw(src);
}
/**
* @deprecated Method copyRaw is deprecated
*/
protected static void copyRaw(JCO$Table src, int srcrow, JCO$Table dest, int destrow)
{
if(srcrow < 0 || srcrow > (() (src)).num_rows || destrow < 0 || destrow > (() (dest)).num_rows)
{
throw new ion(131, "JCO_ERROR_ILLEGAL_ARGUMENT", "Illegal row number in source or destination table.");
} else
{
int save_destrow = (() (dest)).row;
dest.row = destrow;
dest.copyRaw((() (src)), srcrow);
dest.row = save_destrow;
return;
}
}
/**
* @deprecated Method copyRaw is deprecated
*/
protected void copyRaw(ure src)
{
copyRaw((() (src)), 0);
}
/**
* @deprecated Method copyRaw is deprecated
*/
private void copyRaw( src, int srcrow)
{
int ioffset = super.boffset[0] + super.row * super.row_length;
int src_ioffset = ((ta) (src)).boffset[0] + srcrow * src.row_length;
System.arraycopy(src.data, src_ioffset, super.data, ioffset, super.row_length);
if(src.odata != null)
{
int src_offset = src.row * ((ta) (src)).num_odata;
for(int i = 0; i < ((ta) (src)).num_odata; i++)
{
Object o = src.odata[i + src_offset];
if(o != null)
if(o instanceof )
o = (()o).clone();
else
if(o instanceof String)
o = o;
else
if(o instanceof byte[])
o = ((byte[])o).clone();
super.odata[super.row * super.num_odata + i] = o;
}
}
setModified(super.row);
}
public void addInfo(String name, int type, int length, int offset, int decimals, String sdefault, String description,
int flags, Object tab_meta, IExtendedFieldMetaData extended)
{
if(!isEmpty())
{
throw new ion(128, "JCO_ERROR_NOT_SUPPORTED", "Changing of metadata is not allowed if the table already contains data. Please consult JCo documentation.");
} else
{
super.addInfo(name, type, length, offset, decimals, sdefault, description, flags, tab_meta, extended);
row_capacity = 0;
return;
}
}
public void ensureBufferCapacity(int required_rows)
{
if(required_rows <= row_capacity)
return;
if(row_capacity <= 0)
{
row_capacity = Math.max(required_rows + 1, 2);
} else
{
row_capacity = row_capacity_increment > 0 ? row_capacity_increment + row_capacity + 1 : (int)((double)row_capacity * 1.2D + 10D);
row_capacity = Math.max(required_rows + 1, row_capacity);
}
int saved_num_rows = super.num_rows;
super.num_rows = row_capacity;
try
{
super.ensureBufferCapacity();
for(int irow = super.num_rows; irow >= saved_num_rows; irow--)
initializeRow(irow);
}
finally
{
super.num_rows = saved_num_rows;
}
}
public void trimToRows()
{
if(super.num_rows == 0 || super.num_rows == row_capacity)
{
return;
} else
{
int capacity = (super.num_rows + 1) * super.row_length;
char old_data[] = super.data;
super.data = new char[capacity];
System.arraycopy(old_data, 0, super.data, 0, Math.min(old_data.length, super.data.length));
capacity = super.num_rows * super.num_odata;
Object old_odata[] = super.odata;
super.odata = new Object[capacity];
System.arraycopy(((Object) (old_odata)), 0, ((Object) (super.odata)), 0, Math.min(old_odata.length, super.odata.length));
byte old_opcode[] = super.opcode;
super.opcode = new byte[super.num_rows];
System.arraycopy(old_opcode, 0, super.opcode, 0, Math.min(old_opcode.length, super.opcode.length));
row_capacity = super.num_rows;
return;
}
}
protected void setModified(int row)
{
super.setModified(row);
if(super.opcode[row] == 0)
super.opcode[row] = 4;
}
protected void appendDelta(byte opcode, int opvalue)
{
super.setModified(0);
if(opcode == 1 && super.delta != null && super.delta.length > 0)
{
int old_code = super.delta[super.delta.length - 1];
byte old_opcode = (byte)((old_code & 0xe0000000) >> 29);
if(old_opcode == 1)
{
opvalue += old_code & 0x1fffffff;
super.delta[super.delta.length - 1] = opcode << 29 | opvalue & 0x1fffffff;
return;
}
}
int old_delta[] = super.delta;
super.delta = new int[(old_delta == null ? 0 : old_delta.length) + 1];
if(old_delta != null)
System.arraycopy(old_delta, 0, super.delta, 0, old_delta.length);
super.delta[super.delta.length - 1] = opcode << 29 | opvalue & 0x1fffffff;
}
public int copyFrom( source)
{
int old_num_rows = super.num_rows;
int n = super.copyFrom(source);
appendDelta((byte)1, source.num_rows);
for(int i = old_num_rows; i < super.num_rows; i++)
super.opcode[i] = 1;
return n;
}
public final boolean isEmpty()
{
return super.num_rows == 0;
}
public final boolean isFirstRow()
{
return super.num_rows > 0 && super.row == 0;
}
public final boolean isLastRow()
{
return super.num_rows > 0 && super.row == super.num_rows - 1;
}
public final int getNumRows()
{
return super.num_rows;
}
public final int getNumColumns()
{
return super.num_fields;
}
public void clear()
{
if(super.num_rows == 0)
{
return;
} else
{
super.data = new char[0];
super.odata = new Object[0];
super.opcode = new byte[0];
appendDelta((byte)5, super.num_rows);
row_capacity = 0;
super.num_rows = 0;
super.row = 0;
return;
}
}
public void deleteAllRows()
{
clear();
}
public final void firstRow()
{
super.row = 0;
}
public final void lastRow()
{
super.row = super.num_rows > 0 ? super.num_rows - 1 : 0;
}
public final boolean nextRow()
{
boolean eor = ++super.row < super.num_rows;
if(super.row >= super.num_rows)
super.row = super.num_rows - 1;
return eor;
}
public final boolean previousRow()
{
boolean bor = --super.row >= 0;
if(super.row < 0)
super.row = 0;
return bor;
}
public final int getRow()
{
return super.row;
}
public void setRow(int pos)
{
super.row = pos;
if(super.row < 0)
super.row = 0;
else
if(super.row >= super.num_rows)
super.row = super.num_rows <= 0 ? 0 : super.num_rows - 1;
}
public void appendRow()
{
insertRow(super.num_rows);
}
public void appendRows(int num_rows)
{
if(num_rows < 1)
return;
int old_num_rows = super.num_rows;
super.row = super.num_rows;
ensureBufferCapacity(super.num_rows + num_rows);
super.num_rows += num_rows;
for(int irow = super.num_rows; irow >= old_num_rows; irow--)
if(irow < super.num_rows)
super.opcode[irow] = 1;
appendDelta((byte)1, num_rows);
}
public void insertRow(int pos)
{
byte mode = ((byte)(pos < super.num_rows ? 2 : 1));
pos = Math.min(Math.max(pos, 0), super.num_rows);
ensureBufferCapacity(super.num_rows + 1);
super.row = pos;
for(int irow = super.num_rows; irow > pos; irow--)
{
System.arraycopy(super.data, (irow - 1) * super.row_length, super.data, irow * super.row_length, super.row_length);
System.arraycopy(((Object) (super.odata)), (irow - 1) * super.num_odata, ((Object) (super.odata)), irow * super.num_odata, super.num_odata);
if(irow < super.num_rows)
super.opcode[irow] = super.opcode[irow - 1];
}
super.num_rows++;
initializeRow(pos);
if(mode == 1)
{
super.opcode[pos] = 1;
appendDelta((byte)1, 1);
} else
{
super.opcode[pos] = 2;
appendDelta((byte)2, pos);
}
}
public void deleteRow()
{
deleteRow(super.row);
}
public void deleteRow(int pos)
{
if(pos < 0 && pos >= super.num_rows)
return;
for(int i = pos; i < super.num_rows; i++)
{
System.arraycopy(super.data, (i + 1) * super.row_length, super.data, i * super.row_length, super.row_length);
System.arraycopy(((Object) (super.odata)), (i + 1) * super.num_odata, ((Object) (super.odata)), i * super.num_odata, super.num_odata);
if(i < super.num_rows - 1)
super.opcode[i] = super.opcode[i + 1];
}
appendDelta((byte)3, pos);
super.num_rows--;
if(super.odata != null)
{
for(int i = (super.num_rows + 1) * super.num_odata; i < super.odata.length; i++)
super.odata[i] = null;
}
super.row = Math.min(Math.max(super.row, 0), super.num_rows - 1);
}
private static final long serialVersionUID = 0x199d2b6fe1L;
protected static final byte OP_NOOP = 0;
protected static final byte OP_APPEND = 1;
protected static final byte OP_INSERT = 2;
protected static final byte OP_DELETE = 3;
protected static final byte OP_UPDATE = 4;
protected static final byte OP_CLEAR = 5;
protected static final int OP_SHIFT = 29;
protected static final int OP_OPCODE_MASK = 0xe0000000;
protected static final int OP_VALUE_MASK = 0x1fffffff;
private int row_capacity;
private int row_capacity_increment;
public JCO$Table(String name)
{
super(4, name);
row_capacity = 0;
row_capacity_increment = 0;
}
public JCO$Table(IMetaData meta_data)
{
super(4, meta_data);
row_capacity = 0;
row_capacity_increment = 0;
}
public JCO$Table(JCO$Table value)
{
super(4, value.getMetaData());
row_capacity = 0;
row_capacity_increment = 0;
copyContent(value, this);
}
protected JCO$Table(ure value)
{
super(4, value.getMetaData());
row_capacity = 0;
row_capacity_increment = 0;
super.row_length = (() (value)).row_length;
appendRow();
System.arraycopy((() (value)).data, 0, super.data, 0, super.row_length);
for(int i = 0; i < ((ta) (value)).num_odata; i++)
{
Object o = (() (value)).odata[i];
if(o != null)
if(o instanceof )
o = (()o).clone();
else
if(o instanceof String)
o = o;
else
if(o instanceof byte[])
o = ((byte[])o).clone();
super.odata[i] = o;
}
super.modified = true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -