本文整理汇总了C#中ModelElement类的典型用法代码示例。如果您正苦于以下问题:C# ModelElement类的具体用法?C# ModelElement怎么用?C# ModelElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelElement类属于命名空间,在下文中一共展示了ModelElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDependencies
/// <summary>
/// Gets the dependencies for a specific model element.
/// </summary>
/// <param name="modelElement">Model element to get the dependencies for.</param>
/// <param name="options">Options.</param>
/// <returns>List of dependencies.</returns>
public DependenciesData GetDependencies(ModelElement modelElement, DependenciesRetrivalOptions options)
{
List<ModelElement> elements = new List<ModelElement>();
elements.Add(modelElement);
return GetDependencies(elements, options);
}
示例2: Visit
//TODO: FIXME - This method is a royal mess!
public override bool Visit(ElementWalker walker, ModelElement modelElement)
{
var result = base.Visit(walker, modelElement);
if (walker.InternalElementList.Last() == modelElement)
{
var typesNode = this.treeView.Nodes[0].Nodes[0];
typesNode.Text = "Models";
foreach (ModelElementTreeNode classNode in typesNode.Nodes)
{
var originalNodes = classNode.Nodes.OfType<RoleGroupTreeNode>().ToArray();
foreach (RoleGroupTreeNode roleGroupNode in originalNodes)
{
var toRemove = new List<ModelElementTreeNode>();
foreach (ModelElementTreeNode propNode in roleGroupNode.Nodes)
{
toRemove.Add(propNode);
}
foreach (var node in toRemove)
{
roleGroupNode.Nodes.Remove(node);
this.TreeContainer.InsertTreeNode(classNode.Nodes, node);
}
}
foreach (TreeNode node in originalNodes) classNode.Nodes.Remove(node);
}
typesNode.Expand();
}
return result;
}
示例3: AddClass
public static void AddClass(ModelElement cls, CodeTypeDeclaration declaration)
{
if (!isInitialized)
throw new ArgumentException("CodeGenerationContext must first be initialized");
if (cls == null)
throw new ArgumentNullException("No class supplied", "cls");
if (declaration == null)
throw new ArgumentNullException("No CodeTypeDeclaration supplied", "declaration");
if (cls.GetType() == typeof(ModelClass))
{
ModelClass modelClass = (ModelClass)cls;
if (!classDeclarations.ContainsKey(modelClass))
classDeclarations.Add(modelClass, declaration);
}
else if (cls.GetType() == typeof(NestedClass))
{
NestedClass nestedClass = (NestedClass)cls;
if (!nestedClassDeclarations.ContainsKey(nestedClass))
nestedClassDeclarations.Add(nestedClass, declaration);
}
else
throw new ArgumentException("Only ModelClass and NestedClass entities supported", "cls");
generatedClassNames.Add(((NamedElement)cls).Name);
}
示例4: CanAcceptSourceAndTarget
public static bool CanAcceptSourceAndTarget(ModelElement candidateSource, ModelElement candidateTarget)
{
if(candidateSource == null)
{
return false;
}
bool acceptSource = CanAcceptSource(candidateSource);
// If the source wasn't accepted then there's no point checking targets.
// If there is no target then the source controls the accept.
if(!acceptSource || candidateTarget == null)
{
return acceptSource;
}
else // Check combinations
{
if(candidateSource is DataContractBase)
{
if (candidateTarget is DataContract)
{
if(HasNullReferences((DataContractBase)candidateSource, (Contract)candidateTarget))
{
return false;
}
return true;
}
}
}
return false;
}
示例5: UnaryExpression
/// <summary>
/// Constructor
/// </summary>
/// <param name="root">The root for which this expression should be evaluated</param>
/// <param name="log"></param>
/// <param name="expression">The enclosed expression</param>
/// <param name="unaryOp">the unary operator for this unary expression</param>
/// <param name="start">The start character for this expression in the original string</param>
/// <param name="end">The end character for this expression in the original string</param>
public UnaryExpression(ModelElement root, ModelElement log, Expression expression, string unaryOp, int start,
int end)
: base(root, log, start, end)
{
Expression = SetEnclosed(expression);
UnaryOp = unaryOp;
}
示例6: ExplanationPart
/// <summary>
/// Constructor
/// </summary>
/// <param name="element">The element for which this explanation part is created</param>
/// <param name="leftPart">The left path to associate to this explanation</param>
/// <param name="rightPart">The value associate to this left part</param>
public ExplanationPart(ModelElement element, object leftPart, INamable rightPart = null)
{
Element = element;
LeftPart = leftPart;
RightPart = rightPart;
SubExplanations = new List<ExplanationPart>();
}
示例7: GetName
/// <summary>
/// Gets the element name from the property that is marked as "IsElementName".
/// </summary>
/// <param name="modelElement">Domain class to get the name for.</param>
/// <returns>Name of the domain class as string if found. Null otherwise.</returns>
public virtual string GetName(ModelElement modelElement)
{
if( modelElement is IDomainModelOwnable )
return (modelElement as IDomainModelOwnable).DomainElementName;
return null;
}
示例8: HasName
/// <summary>
/// Verifies if a given modelElement has a name property or not.
/// </summary>
/// <param name="modelElement">ModelElement to verify.</param>
/// <returns>
/// True if the given model element has a property marked with "IsElementName" set to true. False otherwise.
/// </returns>
public virtual bool HasName(ModelElement modelElement)
{
if( modelElement is IDomainModelOwnable )
return (modelElement as IDomainModelOwnable).DomainElementHasName;
return false;
}
示例9: CreateDiagramHelper
internal override EntityDesignerDiagram CreateDiagramHelper(Partition diagramPartition, ModelElement modelRoot)
{
var evm = modelRoot as EntityDesignerViewModel;
var diagram = new EntityDesignerDiagram(diagramPartition);
diagram.ModelElement = evm;
return diagram;
}
示例10: StructExpression
/// <summary>
/// Constructor
/// </summary>
/// <param name="root"></param>
/// <param name="log"></param>
/// <param name="structure"></param>
/// <param name="associations"></param>
/// <param name="parsingData">Additional information about the parsing process</param>
public StructExpression(ModelElement root, ModelElement log, Expression structure,
Dictionary<Designator, Expression> associations, ParsingData parsingData)
: base(root, log, parsingData)
{
Structure = SetEnclosed(structure);
SetAssociation(associations);
}
示例11: ExpressionBasedListExpression
/// <summary>
/// Constructor for MAP, REDUCE
/// </summary>
/// <param name="listExpression"></param>
/// <param name="condition">the condition to apply to list elements</param>
/// <param name="iteratorExpression">the expression to be evaluated on each element of the list</param>
/// <param name="iteratorVariableName"></param>
/// <param name="start">The start character for this expression in the original string</param>
/// <param name="end">The end character for this expression in the original string</param>
public ExpressionBasedListExpression(ModelElement root, ModelElement log, Expression listExpression,
string iteratorVariableName, Expression condition, Expression iteratorExpression, int start, int end)
: base(root, log, listExpression, iteratorVariableName, condition, start, end)
{
IteratorExpression = iteratorExpression;
IteratorExpression.Enclosing = this;
}
示例12: SumExpression
/// <summary>
/// Constructor
/// </summary>
/// <param name="log"></param>
/// <param name="listExpression"></param>
/// <param name="condition"></param>
/// <param name="expression"></param>
/// <param name="root">the root element for which this expression should be parsed</param>
/// <param name="iteratorVariableName"></param>
/// <param name="parsingData">Additional information about the parsing process</param>
public SumExpression(ModelElement root, ModelElement log, Expression listExpression, string iteratorVariableName,
Expression condition, Expression expression, ParsingData parsingData)
: base(root, log, listExpression, iteratorVariableName, condition, expression, parsingData)
{
AccumulatorVariable = CreateBoundVariable("RESULT", null);
ISubDeclaratorUtils.AppendNamable(this, AccumulatorVariable);
if (expression != null)
{
DefinedAccumulator = SetEnclosed(expression);
Accumulator =
SetEnclosed(new BinaryExpression(
Root,
RootLog,
DefinedAccumulator,
BinaryExpression.Operator.Add,
new UnaryExpression(
Root,
RootLog,
new Term(
Root,
RootLog,
new Designator(Root, RootLog, "RESULT", ParsingData.SyntheticElement),
ParsingData.SyntheticElement),
ParsingData.SyntheticElement),
ParsingData.SyntheticElement));
}
}
示例13: GetElementImage
/// <summary>
/// Decides what the icon of the method will be in the interface shape
/// </summary>
protected System.Drawing.Image GetElementImage(ModelElement mel)
{
var assembly = Assembly.GetExecutingAssembly();
if (_images.Count == 0)
{
_images.Add("field", new System.Drawing.Bitmap(assembly.GetManifestResourceStream(assembly.GetName().Name + ".Resources.field.png")));
_images.Add("key", new System.Drawing.Bitmap(assembly.GetManifestResourceStream(assembly.GetName().Name + ".Resources.key.png")));
}
if (mel is nHydrate.Dsl.ViewField)
{
var field = mel as nHydrate.Dsl.ViewField;
var image = field.CachedImage;
if (image == null)
{
image = _images["field"];
//Primary Key
if (field.IsPrimaryKey)
image = _images["key"];
field.CachedImage = image;
}
return image;
}
else
{
return null;
}
}
示例14: additionalChecks
/// <summary>
/// Perform additional checks based on the parameter types
/// </summary>
/// <param name="root">The element on which the errors should be reported</param>
/// <param name="context">The evaluation context</param>
/// <param name="actualParameters">The parameters applied to this function call</param>
public override void additionalChecks(ModelElement root, Interpreter.InterpretationContext context, Dictionary<string, Interpreter.Expression> actualParameters)
{
CheckFunctionalParameter(root, context, actualParameters[First.Name], 1);
CheckFunctionalParameter(root, context, actualParameters[Second.Name], 1);
Function function1 = actualParameters[First.Name].GetExpressionType() as Function;
Function function2 = actualParameters[Second.Name].GetExpressionType() as Function;
if (function1 != null && function2 != null)
{
if (function1.FormalParameters.Count == 1 && function2.FormalParameters.Count == 1)
{
Parameter p1 = (Parameter)function1.FormalParameters[0];
Parameter p2 = (Parameter)function2.FormalParameters[0];
if (p1.Type != p2.Type && p1.Type != EFSSystem.DoubleType && p2.Type != EFSSystem.DoubleType)
{
root.AddError("The formal parameters for the functions provided as parameter are not the same");
}
}
if (function1.ReturnType != function2.ReturnType && function1.ReturnType != EFSSystem.DoubleType && function2.ReturnType != EFSSystem.DoubleType)
{
root.AddError("The return values for the functions provided as parameter are not the same");
}
}
}
示例15: CreateChildShape
/// <summary>
/// Customize childshape create to set an initial location for a <see cref="BarkerEntityShape"/>
/// </summary>
protected override ShapeElement CreateChildShape(ModelElement element)
{
object barkerEntityPositionsObject;
Dictionary<Guid, PointD> barkerEntityPositions;
PointD initialLocation;
BarkerErModelContainsBinaryAssociation modelContainsAssociation;
EntityType barkerEntity;
ConceptType conceptType;
ObjectType objectType;
if (null != (barkerEntity = element as EntityType))
{
if (element.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo.TryGetValue(BarkerEntityPositionDictionaryKey, out barkerEntityPositionsObject) &&
null != (barkerEntityPositions = barkerEntityPositionsObject as Dictionary<Guid, PointD>) &&
null != (conceptType = EntityTypeIsPrimarilyForConceptType.GetConceptType(barkerEntity)) &&
null != (objectType = ConceptTypeIsForObjectType.GetObjectType(conceptType)) &&
barkerEntityPositions.TryGetValue(objectType.Id, out initialLocation))
{
return new BarkerEntityShape(
this.Partition,
new PropertyAssignment(BarkerEntityShape.AbsoluteBoundsDomainPropertyId, new RectangleD(initialLocation, new SizeD(1, 0.3))));
}
}
else if (null != (modelContainsAssociation = element as BarkerErModelContainsBinaryAssociation))
{
return new AssociationConnector(Partition);
}
return base.CreateChildShape(element);
}