155 lines
5.1 KiB
C#
155 lines
5.1 KiB
C#
// using System;
|
|
// using BCG.Utilities;
|
|
// using System.Collections;
|
|
|
|
// namespace BCG
|
|
// {
|
|
// internal class JoinRow : IBlueRow
|
|
// {
|
|
// private RowNode myLeftNode, myRightNode;
|
|
// protected IBlueRow myLeftRow, myRightRow;
|
|
// protected int myId;
|
|
// protected JoinTableSchema mySchema;
|
|
// private object[] myValues;
|
|
|
|
// #region Constructor(s)
|
|
|
|
// /// <summary>
|
|
// /// Constructs a row, assigning it the same ID as that of the left row.
|
|
// /// </summary>
|
|
// /// <param name="leftRow">left row of the join</param>
|
|
// /// <param name="rightRow">right row of the join</param>
|
|
// /// <param name="schema">schema of the joined row</param>
|
|
// public JoinRow (IBlueRow leftRow, IBlueRow rightRow, JoinTableSchema schema)
|
|
// : this ((int)leftRow["id"], leftRow, rightRow, schema) {}
|
|
|
|
// /// <summary>
|
|
// /// Constructs a row assigning it the ID provioded as the first argument
|
|
// /// </summary>
|
|
// /// <param name="id">id of the joined row</param>
|
|
// /// <param name="leftRow">left row of the join</param>
|
|
// /// <param name="rightRow">right row of the join</param>
|
|
// /// <param name="schema">schema of the joined row</param>
|
|
// public JoinRow (int id, IBlueRow leftRow, IBlueRow rightRow, JoinTableSchema schema)
|
|
// {
|
|
// myId = id;
|
|
// myLeftRow = leftRow;
|
|
// myRightRow = rightRow;
|
|
// mySchema = schema;
|
|
// myValues = new object [schema.columnNames.Length];
|
|
// }
|
|
|
|
// #endregion
|
|
|
|
// #region IBlueRow members
|
|
// public IBlueTableSchema schema {get{return mySchema;}}
|
|
// #endregion
|
|
|
|
// public bool isPartialJoin{get{return myRightRow == null;}}
|
|
|
|
// public RowNode leftNode
|
|
// {
|
|
// get{return myLeftNode;}
|
|
// set{myLeftNode = value;}
|
|
// }
|
|
|
|
// public RowNode rightNode
|
|
// {
|
|
// get{return myRightNode;}
|
|
// set{myRightNode = value;}
|
|
// }
|
|
|
|
// #region ICollection members
|
|
// public int Count{get{return mySchema.columnNames.Length;}}
|
|
|
|
// public bool IsSynchronized {get{return false;}}
|
|
|
|
// public object SyncRoot{get{return this;}}
|
|
|
|
// public void CopyTo (Array array, int index)
|
|
// {
|
|
// int i = 0;
|
|
// foreach (object o in this as IEnumerable)
|
|
// array.SetValue (o, i++);
|
|
// }
|
|
|
|
// #endregion
|
|
|
|
// #region IDictionary members
|
|
// public bool IsFixedSize {get{return true;}}
|
|
|
|
// public bool IsReadOnly {get{return true;}}
|
|
|
|
// /// <summary>
|
|
// /// The key can either be the string corrsponding to the column name or
|
|
// /// the order of the column
|
|
// /// </summary>
|
|
// public virtual object this [object key]
|
|
// {
|
|
// get
|
|
// {
|
|
// if (key is string)
|
|
// return this[(string)key];
|
|
// return this[(int)key];
|
|
// }
|
|
// set {throw new NotSupportedException ("The IBlueRow is read only");}
|
|
// }
|
|
|
|
// public object this [int index]
|
|
// {
|
|
// get
|
|
// {
|
|
// if (index == mySchema.columnNames.Length - 1)
|
|
// return myId;
|
|
// else if (index < myLeftRow.Count)
|
|
// {
|
|
// if (myValues[index] == null)
|
|
// myValues[index] = myLeftRow[index];
|
|
// return myValues[index];
|
|
// }
|
|
// else if (index >= myLeftRow.Count && index < mySchema.columnNames.Length - 1)
|
|
// {
|
|
// if (myValues[index] == null)
|
|
// myValues[index] = (myRightRow == null) ? DBNull.Value : myRightRow[index - myLeftRow.Count];
|
|
// return myValues[index];
|
|
// }
|
|
// BlueEventLog.logAssert (false, "Incorrect index in JoinRow");
|
|
// return null;
|
|
// }
|
|
// }
|
|
|
|
// public object this [string colName] {get{return this[mySchema[colName].colNo];}}
|
|
|
|
// public ICollection Keys{get{return mySchema.columnNames;}}
|
|
|
|
// public ICollection Values
|
|
// {
|
|
// get
|
|
// {
|
|
// object[] retVal = new object[mySchema.columnNames.Length];
|
|
// CopyTo (retVal, 0);
|
|
// return retVal;
|
|
// }
|
|
// }
|
|
|
|
// public void Add (object key, object value) {throw new NotSupportedException ("The IBlueRow is readonly");}
|
|
|
|
// public void Clear () {throw new NotSupportedException ("The IBlueRow is readonly");}
|
|
|
|
// public bool Contains (object key){return mySchema[(string)key] != null;}
|
|
|
|
// /// <summary>
|
|
// /// Note, the default enumerator is the IDictionary's enumerator, so if user needs to
|
|
// /// iterate through the values, typecast this into an IEnumerable
|
|
// /// </summary>
|
|
// /// <returns></returns>
|
|
// public IDictionaryEnumerator GetEnumerator() {return new BlueRowDictionaryEnumerator(this);}
|
|
|
|
// IEnumerator IEnumerable.GetEnumerator () {return new BlueRowEnumerator(this);}
|
|
|
|
// public void Remove (object key) {throw new NotSupportedException ("The IBlueRow is readonly");}
|
|
// #endregion
|
|
// }
|
|
|
|
// }
|