本文整理汇总了C#中Generated类的典型用法代码示例。如果您正苦于以下问题:C# Generated类的具体用法?C# Generated怎么用?C# Generated使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Generated类属于命名空间,在下文中一共展示了Generated类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
/// <summary>
/// Initializes the Historical data package
/// </summary>
/// <param name="filePath">The path to the file to load</param>
/// <param name="factory">THe factory used to create instances of the loaded file</param>
public static History Load(string filePath, Generated.Factory factory)
{
History retVal = null;
acceptor.setFactory(factory);
if (File.Exists(filePath))
{
// Do not rely on XmlBFileContext since it does not care about encoding.
// File encoding is UTF-8
XmlBStringContext ctxt;
using (StreamReader file = new StreamReader(filePath))
{
ctxt = new XmlBStringContext(file.ReadToEnd());
file.Close();
}
try
{
retVal = acceptor.accept(ctxt) as History;
}
catch (XmlBException excp)
{
Log.Error(ctxt.errorMessage());
}
}
return retVal;
}
示例2: GetRepresentations
private static RepresentationCollection<Representation> GetRepresentations(Generated.RepresentationSystem representationSystem)
{
var numericRepresentations = representationSystem.Representations.NumericRepresentation.Select(v => new NumericRepresentation(v));
var enumeratedRepresentations = representationSystem.Representations.EnumeratedRepresentation.Select(d => new EnumeratedRepresentation(d));
var allRepresentations = numericRepresentations.Union<Representation>(enumeratedRepresentations);
return new RepresentationCollection<Representation>(allRepresentations);
}
示例3: compareCase
/// <summary>
/// Compares two Case and annotates the differences on the first one
/// </summary>
/// <param name="obj"></param>
/// <param name="other"></param>
public static void compareCase(Generated.Case obj, Generated.Case other, VersionDiff diff)
{
if ( other == null )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) );
return;
}
compareNamable (obj, other, diff);
if ( obj.allPreConditions() != null )
{
if ( other.allPreConditions() != null )
{
int i = 0;
while ( i < obj.countPreConditions() && i < other.countPreConditions() )
{
Generated.PreCondition element = obj.getPreConditions( i );
Generated.PreCondition otherElement = other.getPreConditions( i );
comparePreCondition ( element, otherElement, diff );
i += 1;
}
while ( i < obj.countPreConditions() )
{
diff.appendChanges ( new Diff(obj.getPreConditions(i), HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "PreConditions", "", obj.getPreConditions( i ).Name ) );
i += 1;
}
while ( i < other.countPreConditions() )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove, "PreConditions", other.getPreConditions( i ).Name) );
i += 1;
}
}
else
{
foreach ( Generated.PreCondition subElement in obj.allPreConditions() )
{
diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "PreConditions", "", subElement.Name ) );
}
}
}
else
{
if ( other.allPreConditions() != null )
{
foreach ( Generated.PreCondition otherElement in other.allPreConditions() )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "PreConditions", otherElement.Name) );
}
}
}
if ( !CompareUtil.canonicalStringEquality(obj.getExpression(), other.getExpression()) )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Expression", other.getExpression(), obj.getExpression()) );
}
if ( !CompareUtil.canonicalStringEquality(obj.getComment(), other.getComment()) )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Comment", other.getComment(), obj.getComment()) );
}
}
示例4: visit
/// <summary>
/// Cleans all text fields in this element
/// </summary>
/// <param name="obj"></param>
/// <param name="visitSubNodes"></param>
public override void visit(Generated.Namable obj, bool visitSubNodes)
{
if ( obj.getName() != null )
{
obj.setName(obj.getName().Trim());
}
base.visit(obj, visitSubNodes);
}
示例5: visit
public override void visit(Generated.Paragraph obj, bool visitSubNodes)
{
Paragraph paragraph = (Paragraph) obj;
while (paragraph.RequirementSetReferences.Count > 0)
{
RequirementSetReference reference = (RequirementSetReference) paragraph.RequirementSetReferences[0];
reference.Delete();
}
base.visit(obj, visitSubNodes);
}
示例6: visit
public override void visit(Generated.Action obj, bool visitSubNodes)
{
Rules.Action action = (Rules.Action)obj;
if (Rebuild)
{
action.Statement = null;
}
// Side effect : compiles or recompiles the statement
DataDictionary.Interpreter.Statement.Statement statement = action.Statement;
base.visit(obj, visitSubNodes);
}
示例7: Transaction
public Transaction(KeyPair sourceAccount, long sequenceNumber, Operation[] operations, Generated.Memo memo)
{
SourceAccount = CheckNotNull(sourceAccount, "sourceAccount cannot be null");
SequenceNumber = CheckNotNull(sequenceNumber, "sequenceNumber cannot be null");
mOperations = CheckNotNull(operations, "operations cannot be null");
if (operations.Length <= 0)
{
throw new ArgumentException("At least one operation required");
}
mFee = operations.Length * BASE_FEE;
mSignatures = new List<Generated.DecoratedSignature>();
Memo = memo != null ? memo : Stellar.Memo.None();
}
示例8: compareAction
/// <summary>
/// Compares two Action and annotates the differences on the first one
/// </summary>
/// <param name="obj"></param>
/// <param name="other"></param>
public static void compareAction(Generated.Action obj, Generated.Action other, VersionDiff diff)
{
if ( other == null )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) );
return;
}
if ( !CompareUtil.canonicalStringEquality(obj.getExpression(), other.getExpression()) )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Expression", other.getExpression(), obj.getExpression()) );
}
if ( !CompareUtil.canonicalStringEquality(obj.getComment(), other.getComment()) )
{
diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Comment", other.getComment(), obj.getComment()) );
}
}
示例9: CaseTIdentifier
public override void CaseTIdentifier(Generated.node.TIdentifier node)
{
StringBuilder name = new StringBuilder("");
foreach (char c in node.Text)
{
if (c > 0xFF)
{
byte[] utf8Bytes = Encoding.UTF8.GetBytes(c.ToString());
foreach (byte b in utf8Bytes)
{
name.Append("U");
name.AppendFormat("{0:x2}", b);
}
}
else
name.Append(c);
}
node.Text = name.ToString();
}
示例10: FromXdr
public static Operation FromXdr(Generated.Operation xdr)
{
var body = xdr.Body;
Operation operation = null;
switch (body.Discriminant.InnerValue)
{
case Generated.OperationType.OperationTypeEnum.CREATE_ACCOUNT:
//operation = new CreateAccountOperation.Builder(body.CreateAccountOp).Build();
break;
case Generated.OperationType.OperationTypeEnum.PAYMENT:
operation = new PaymentOperation.Builder(body.PaymentOp).Build();
break;
case Generated.OperationType.OperationTypeEnum.PATH_PAYMENT:
//operation = new PathPaymentOperation.Builder(body.getPathPaymentOp()).build();
break;
case Generated.OperationType.OperationTypeEnum.MANAGE_OFFER:
//operation = new ManagerOfferOperation.Builder(body.getManageOfferOp()).build();
break;
case Generated.OperationType.OperationTypeEnum.CREATE_PASSIVE_OFFER:
//operation = new CreatePassiveOfferOperation.Builder(body.getCreatePassiveOfferOp()).build();
break;
case Generated.OperationType.OperationTypeEnum.SET_OPTIONS:
//operation = new SetOptionsOperation.Builder(body.getSetOptionsOp()).build();
break;
case Generated.OperationType.OperationTypeEnum.CHANGE_TRUST:
operation = new ChangeTrustOperation.Builder(body.ChangeTrustOp).Build();
break;
case Generated.OperationType.OperationTypeEnum.ALLOW_TRUST:
//operation = new AllowTrustOperation.Builder(body.getAllowTrustOp()).build();
break;
case Generated.OperationType.OperationTypeEnum.ACCOUNT_MERGE:
//operation = new AccountMergeOperation.Builder(body).build();
break;
default:
throw new Exception("Unknown operation body " + body.Discriminant.InnerValue);
}
if (xdr.SourceAccount != null)
{
operation.SourceAccount = KeyPair.FromXdrPublicKey(xdr.SourceAccount.InnerValue);
}
return operation;
}
示例11: visit
public override void visit(Generated.Frame obj, bool visitSubNodes)
{
Tests.Frame frame = (Tests.Frame)obj;
if (frame != null)
{
checkExpression(frame, frame.getCycleDuration());
Types.Type type = frame.CycleDuration.GetExpressionType();
if (type != null)
{
if (!frame.EFSSystem.DoubleType.Match(type))
{
frame.AddError("Cycle duration should be compatible with the Time type");
}
}
}
base.visit(obj, visitSubNodes);
}
示例12: GetUnitOfMeasureSystems
private UnitOfMeasureSystemCollection GetUnitOfMeasureSystems(Generated.UnitSystem unitSystem)
{
var unitOfMeasureSystems = unitSystem.UnitOfMeasureSystems.Select(u => new UnitOfMeasureSystem(u, this));
return new UnitOfMeasureSystemCollection(unitOfMeasureSystems);
}
示例13: GetUnitDimensions
private UnitCollection<UnitDimension> GetUnitDimensions(Generated.UnitSystem unitSystem)
{
var unitDimensions = unitSystem.UnitDimensions.Select(u => new UnitDimension(u));
return new UnitCollection<UnitDimension>(unitDimensions);
}