本文整理汇总了C#中Generated.getStateMachine方法的典型用法代码示例。如果您正苦于以下问题:C# Generated.getStateMachine方法的具体用法?C# Generated.getStateMachine怎么用?C# Generated.getStateMachine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generated
的用法示例。
在下文中一共展示了Generated.getStateMachine方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ensureGuidProcedure
/// <summary>
/// Ensures that two Procedure have matching GUID, and recursively.
/// obj is the leader for Guid. If other doesn't match obj guid,
/// 1. other does not have a guid, in that case, other should have the same guid as obj
/// 2. other already has a guid. In that case, there is a mismatch between objects, and the process stops here
/// </summary>
/// <param name="obj"></param>
/// <param name="other"></param>
public static void ensureGuidProcedure(Generated.Procedure obj, Generated.Procedure other)
{
if ( obj == null )
{
if ( other != null )
{
// Side effect, setup a GUID if needed for the other part (other)
string guid = other.Guid;
}
return;
}
if ( other == null )
{
if ( obj != null )
{
// Side effect, setup a GUID if needed for the other part (obj)
string guid = obj.Guid;
}
return;
}
if ( obj.Guid != other.getGuid() )
{
if ( string.IsNullOrEmpty(other.getGuid()) || GuidByName && (obj.Name == other.Name) )
{
// These are matching elements, copy the guid from obj
other.setGuid ( obj.Guid );
}
else
{
// Elements do not match. Stop the recursive process
return;
}
}
ensureGuidReqRelated (obj, other);
ensureGuidStateMachine ( obj.getStateMachine(), other.getStateMachine() );
if ( obj.allRules() != null )
{
if ( other.allRules() != null )
{
foreach ( Generated.Rule subElement in obj.allRules() )
{
bool found = false;
// Try first to assign Guid to elements which do not have a guid
// This helps handling duplicated in lists
foreach ( Generated.Rule otherElement in other.allRules() )
{
if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) && otherElement.getGuid() == null )
{
ensureGuidRule ( subElement, otherElement );
found = true;
break;
}
}
if ( !found )
{
foreach ( Generated.Rule otherElement in other.allRules() )
{
if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
{
ensureGuidRule ( subElement, otherElement );
found = true;
break;
}
}
}
if ( !found )
{
ensureGuidRule ( subElement, null );
}
}
foreach ( Generated.Rule otherElement in other.allRules() )
{
bool found = false;
foreach ( Generated.Rule subElement in obj.allRules() )
{
if ( CompareUtil.canonicalStringEquality(subElement.Name, otherElement.Name) )
{
found = true;
break;
}
}
if ( !found )
{
//.........这里部分代码省略.........
示例2: compareState
/// <summary>
/// Compares two State and annotates the differences on the first one
/// </summary>
/// <param name="obj"></param>
/// <param name="other"></param>
public static void compareState(Generated.State obj, Generated.State other, VersionDiff diff)
{
if ( other == null )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) );
return;
}
compareReqRelated (obj, other, diff);
if ( obj.getStateMachine() == null )
{
if ( other.getStateMachine() != null )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "StateMachine", "" ) );
}
}
else
{
compareStateMachine ( obj.getStateMachine(), other.getStateMachine(), diff );
}
if ( obj.getWidth() != other.getWidth() )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Width", other.getWidth().ToString(), obj.getWidth().ToString()) );
}
if ( obj.getHeight() != other.getHeight() )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Height", other.getHeight().ToString(), obj.getHeight().ToString()) );
}
if ( obj.getX() != other.getX() )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "X", other.getX().ToString(), obj.getX().ToString()) );
}
if ( obj.getY() != other.getY() )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Y", other.getY().ToString(), obj.getY().ToString()) );
}
if ( obj.getPinned() != other.getPinned() )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Pinned", other.getPinned().ToString(), obj.getPinned().ToString()) );
}
if ( obj.getEnterAction() == null )
{
if ( other.getEnterAction() != null )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "EnterAction", "" ) );
}
}
else
{
compareRule ( obj.getEnterAction(), other.getEnterAction(), diff );
}
if ( obj.getLeaveAction() == null )
{
if ( other.getLeaveAction() != null )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "LeaveAction", "" ) );
}
}
else
{
compareRule ( obj.getLeaveAction(), other.getLeaveAction(), diff );
}
}
示例3: compareProcedure
/// <summary>
/// Compares two Procedure and annotates the differences on the first one
/// </summary>
/// <param name="obj"></param>
/// <param name="other"></param>
public static void compareProcedure(Generated.Procedure obj, Generated.Procedure other, VersionDiff diff)
{
if ( other == null )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) );
return;
}
compareReqRelated (obj, other, diff);
if ( obj.getStateMachine() == null )
{
if ( other.getStateMachine() != null )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "StateMachine", "" ) );
}
}
else
{
compareStateMachine ( obj.getStateMachine(), other.getStateMachine(), diff );
}
if ( obj.allRules() != null )
{
if ( other.allRules() != null )
{
foreach ( Generated.Rule subElement in obj.allRules() )
{
bool compared = false;
foreach ( Generated.Rule otherElement in other.allRules() )
{
if ( subElement.Guid == otherElement.Guid )
{
compareRule ( subElement, otherElement, diff );
compared = true;
break;
}
}
if ( !compared )
{
diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Rules", "", subElement.Name ) );
}
}
foreach ( Generated.Rule otherElement in other.allRules() )
{
bool found = false;
foreach ( Generated.Rule subElement in obj.allRules() )
{
if ( subElement.Guid == otherElement.Guid )
{
found = true;
break;
}
}
if ( !found )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Rules", otherElement.Name) );
}
}
}
else
{
foreach ( Generated.Rule subElement in obj.allRules() )
{
diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Rules", "", subElement.Name ) );
}
}
}
else
{
if ( other.allRules() != null )
{
foreach ( Generated.Rule otherElement in other.allRules() )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Rules", otherElement.Name) );
}
}
}
if ( obj.allParameters() != null )
{
if ( other.allParameters() != null )
{
foreach ( Generated.Parameter subElement in obj.allParameters() )
{
bool compared = false;
foreach ( Generated.Parameter otherElement in other.allParameters() )
{
if ( subElement.Guid == otherElement.Guid )
{
compareParameter ( subElement, otherElement, diff );
compared = true;
break;
}
//.........这里部分代码省略.........
示例4: searchState
/// <summary>
/// Searches a specific string in State and updates the list
/// of model element with all the elements in which that string is found
/// </summary>
/// <param name="obj"></param>
/// <param name="obj">The string to search for</param>
/// <param name="occurences">The list of model elements which hold the searched string</param>
public static void searchState(Generated.State obj, string searchString, List<ModelElement> occurences)
{
searchReqRelated (obj, searchString, occurences);
if ( obj.getStateMachine() != null )
{
searchStateMachine ( obj.getStateMachine(), searchString, occurences );
}
if ( obj.getEnterAction() != null )
{
searchRule ( obj.getEnterAction(), searchString, occurences );
}
if ( obj.getLeaveAction() != null )
{
searchRule ( obj.getLeaveAction(), searchString, occurences );
}
}
示例5: searchProcedure
/// <summary>
/// Searches a specific string in Procedure and updates the list
/// of model element with all the elements in which that string is found
/// </summary>
/// <param name="obj"></param>
/// <param name="obj">The string to search for</param>
/// <param name="occurences">The list of model elements which hold the searched string</param>
public static void searchProcedure(Generated.Procedure obj, string searchString, List<ModelElement> occurences)
{
searchReqRelated (obj, searchString, occurences);
if ( obj.getStateMachine() != null )
{
searchStateMachine ( obj.getStateMachine(), searchString, occurences );
}
if ( obj.allRules() != null )
{
foreach ( Generated.Rule subElement in obj.allRules() )
{
searchRule ( subElement, searchString, occurences );
}
}
if ( obj.allParameters() != null )
{
foreach ( Generated.Parameter subElement in obj.allParameters() )
{
searchParameter ( subElement, searchString, occurences );
}
}
}
示例6: ensureGuidState
/// <summary>
/// Ensures that two State have matching GUID, and recursively.
/// obj is the leader for Guid. If other doesn't match obj guid,
/// 1. other does not have a guid, in that case, other should have the same guid as obj
/// 2. other already has a guid. In that case, there is a mismatch between objects, and the process stops here
/// </summary>
/// <param name="obj"></param>
/// <param name="other"></param>
public static void ensureGuidState(Generated.State obj, Generated.State other)
{
if ( obj == null )
{
if ( other != null )
{
// Side effect, setup a GUID if needed for the other part (other)
string guid = other.Guid;
}
return;
}
if ( other == null )
{
if ( obj != null )
{
// Side effect, setup a GUID if needed for the other part (obj)
string guid = obj.Guid;
}
return;
}
if ( obj.Guid != other.getGuid() )
{
if ( string.IsNullOrEmpty(other.getGuid()) || GuidByName && (obj.Name == other.Name) )
{
// These are matching elements, copy the guid from obj
other.setGuid ( obj.Guid );
}
else
{
// Elements do not match. Stop the recursive process
return;
}
}
ensureGuidReqRelated (obj, other);
ensureGuidStateMachine ( obj.getStateMachine(), other.getStateMachine() );
ensureGuidRule ( obj.getEnterAction(), other.getEnterAction() );
ensureGuidRule ( obj.getLeaveAction(), other.getLeaveAction() );
}