last ...
This commit is contained in:
@@ -339,7 +339,7 @@ bool IsSame(
|
||||
}
|
||||
|
||||
//
|
||||
result = sourceBox.IsSame(destBox);
|
||||
result = sourceBox.IsSameAs(destBox);
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -894,7 +894,7 @@ bool FindBoxIndex(
|
||||
XBoxZone iBox = boxes[i];
|
||||
|
||||
//
|
||||
bool isSame = box.IsSame(iBox);
|
||||
bool isSame = box.IsSameAs(iBox);
|
||||
if (isSame)
|
||||
{
|
||||
//
|
||||
@@ -931,7 +931,7 @@ bool IsBoxBelow(
|
||||
//
|
||||
result = source.IsValid() &&
|
||||
dest.IsValid() &&
|
||||
!source.IsSame(dest);
|
||||
!source.IsSameAs(dest);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
@@ -974,7 +974,7 @@ bool IsBoxAbove(
|
||||
//
|
||||
result = source.IsValid() &&
|
||||
dest.IsValid() &&
|
||||
!source.IsSame(dest);
|
||||
!source.IsSameAs(dest);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
@@ -1019,7 +1019,7 @@ bool IsBoxInside(
|
||||
//
|
||||
result = source.IsValid() &&
|
||||
dest.IsValid() &&
|
||||
!source.IsSame(dest);
|
||||
!source.IsSameAs(dest);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
@@ -1083,7 +1083,7 @@ bool IsBoxInsideOr(
|
||||
//
|
||||
result = source.IsValid() &&
|
||||
dest.IsValid() &&
|
||||
!source.IsSame(dest);
|
||||
!source.IsSameAs(dest);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
|
||||
@@ -5317,6 +5317,7 @@ struct XBoxZone
|
||||
{
|
||||
//
|
||||
return IsValid() &&
|
||||
item.IsValid() &&
|
||||
dir == item.dir &&
|
||||
from == item.from &&
|
||||
type == item.type &&
|
||||
@@ -5326,42 +5327,42 @@ struct XBoxZone
|
||||
period == item.period;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Box is Same as another ...
|
||||
*
|
||||
* @param box: XBoxZone instance Reference ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsSame(XBoxZone &box)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
// /**
|
||||
// * Check Box is Same as another ...
|
||||
// *
|
||||
// * @param box: XBoxZone instance Reference ...
|
||||
// *
|
||||
// * @return ( bool )
|
||||
// */
|
||||
// bool IsSame(XBoxZone &box)
|
||||
// {
|
||||
// //
|
||||
// bool result = false;
|
||||
|
||||
//
|
||||
result = IsValid() &&
|
||||
box.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
// //
|
||||
// result = IsValid() &&
|
||||
// box.IsValid();
|
||||
// if (!result)
|
||||
// {
|
||||
// return result;
|
||||
// }
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
dir == box.dir &&
|
||||
from == box.from &&
|
||||
type == box.type &&
|
||||
upper == box.upper &&
|
||||
lower == box.lower &&
|
||||
symbol == box.symbol &&
|
||||
period == box.period
|
||||
//
|
||||
;
|
||||
// //
|
||||
// result =
|
||||
// //
|
||||
// dir == box.dir &&
|
||||
// from == box.from &&
|
||||
// type == box.type &&
|
||||
// upper == box.upper &&
|
||||
// lower == box.lower &&
|
||||
// symbol == box.symbol &&
|
||||
// period == box.period
|
||||
// //
|
||||
// ;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
// //
|
||||
// return result;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Retrieve Box Age ...
|
||||
|
||||
@@ -642,6 +642,54 @@ struct XOBFVG
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
struct XSignalBox
|
||||
{
|
||||
//
|
||||
XBoxZone ob;
|
||||
XBoxZone fvg;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XSignalBox()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Cleanup Model ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
ob.Clean();
|
||||
fvg.Clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Model ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsValid()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
ob.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Model State Parsing ...
|
||||
struct XPOIStateEvents
|
||||
@@ -4869,6 +4917,165 @@ int AddIfNotExists(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
/**
|
||||
* Find Index of a Signal Box on another ...
|
||||
*
|
||||
* @param index: int, index of exists ...
|
||||
* @param item: XSignal Box ...
|
||||
* @param items: XSignal Box Collection ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool FindIndex(
|
||||
int &index,
|
||||
XSignalBox &item,
|
||||
XSignalBox &items[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
index = -1;
|
||||
int count = ArraySize(items);
|
||||
|
||||
//
|
||||
result = item.IsValid() &&
|
||||
HasChild(items);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
bool isSame = item.ob
|
||||
.IsSameAs(items[i].ob);
|
||||
if (isSame)
|
||||
{
|
||||
//
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = IsValidIndex(index);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find Index of a Signal Box on another ...
|
||||
*
|
||||
* @param index: int, index of exists ...
|
||||
* @param item: XSignal Box ...
|
||||
* @param items: XSignal Box Collection ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool FindIndex(
|
||||
int &index,
|
||||
XBoxZone &item,
|
||||
XSignalBox &items[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
index = -1;
|
||||
int count = ArraySize(items);
|
||||
|
||||
//
|
||||
result = item.IsValid() &&
|
||||
HasChild(items);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
bool isSame = item.IsSameAs(items[i].ob);
|
||||
if (isSame)
|
||||
{
|
||||
//
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
isSame = item.IsSameAs(items[i].fvg);
|
||||
if (isSame)
|
||||
{
|
||||
//
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = IsValidIndex(index);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Signal Box in a Collection if not Exists ...
|
||||
*
|
||||
* @param item: XSignal Box ...
|
||||
* @param items: XSignal Box Collection ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool AddIfNotExists(
|
||||
XSignalBox &item,
|
||||
XSignalBox &items[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = item.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int idx = -1;
|
||||
result = !FindIndex(
|
||||
idx,
|
||||
item,
|
||||
items //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
AddRef(
|
||||
item,
|
||||
items //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XPOI State Event Parsers ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user