last works on Detecting Pivots ...
- Pivots Detection works Fine; - Analyse Pivots Has some issues and i have to Fix them ...
This commit is contained in:
@@ -239,101 +239,6 @@ struct XPivot
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Structure Exists in Specified Collection or not ...
|
||||
*
|
||||
* @param items: XPivot, reference Array ...
|
||||
* @param index: int, reference to Holds Founded Index ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsExists(
|
||||
XPivot &items[],
|
||||
int &index //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Prepare ...
|
||||
index = -1;
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result =
|
||||
IsValid() &&
|
||||
HasChild(items);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(items);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
result = IsSameAs(items[i]);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
index = i;
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
result &&
|
||||
IsValidIndex(index);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Structure to Specified Collection only if not Exists ...
|
||||
*
|
||||
* @param items: XPivot, reference Array ...
|
||||
*/
|
||||
void AddIfNotExists(XPivot &items[])
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (!IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
if (!HasChild(items))
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
this,
|
||||
items //
|
||||
);
|
||||
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int index = -1;
|
||||
bool isExists = IsExists(items, index);
|
||||
if (!isExists)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
this,
|
||||
items //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate Pivot Age ...
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user