C_PRIMITIVE VisitPrimitiveConstraint(C_PRIMITIVE primitiveConstraint) { System.Diagnostics.Trace.Assert(primitiveConstraint != null, "objectConstraint must not be null"); C_PRIMITIVE result = null; C_DATE dateConstraint = primitiveConstraint as C_DATE; if (dateConstraint != null) { result = VisitPrimitiveConstraint(dateConstraint); } else { C_DATE_TIME dateTimeConstraint = primitiveConstraint as C_DATE_TIME; if (dateTimeConstraint != null) { result = VisitPrimitiveConstraint(dateTimeConstraint); } else { C_TIME timeConstraint = primitiveConstraint as C_TIME; if (timeConstraint != null) { result = VisitPrimitiveConstraint(timeConstraint); } else { C_DURATION durationConstraint = primitiveConstraint as C_DURATION; if (durationConstraint != null) { result = VisitPrimitiveConstraint(durationConstraint); } else { result = primitiveConstraint; } } } } System.Diagnostics.Debug.Assert(result != null, "objectConstraint must not be null"); return(result); }
C_PRIMITIVE_OBJECT VisitPrimitiveObjectConstraint(C_PRIMITIVE_OBJECT objectConstraint) { System.Diagnostics.Trace.Assert(objectConstraint != null, "objectConstraint must not be null"); C_PRIMITIVE result = VisitPrimitiveConstraint(objectConstraint.item); C_PRIMITIVE_OBJECT primitiveObjectConstraint = null; if (result != objectConstraint.item) { primitiveObjectConstraint = new C_PRIMITIVE_OBJECT(); CloneObjectConstraint(objectConstraint, primitiveObjectConstraint); primitiveObjectConstraint.item = result; } else { primitiveObjectConstraint = objectConstraint; } System.Diagnostics.Debug.Assert(primitiveObjectConstraint != null, "primitiveObjectConstraint must not be null"); return(primitiveObjectConstraint); }
private static CPrimitive Map(this C_PRIMITIVE model) { CPrimitive primitive; if (model is C_BOOLEAN) { primitive = ((C_BOOLEAN)model).Map(); } else if (model is C_INTEGER) { primitive = ((C_INTEGER)model).Map(); } else if (model is C_STRING) { primitive = ((C_STRING)model).Map(); } else if (model is C_DURATION) { primitive = ((C_DURATION)model).Map(); } else if (model is C_DATE) { primitive = ((C_DATE)model).Map(); } else if (model is C_DATE_TIME) { primitive = ((C_DATE_TIME)model).Map(); } else if (model is C_REAL) { primitive = ((C_REAL)model).Map(); } else { throw new ParseException(string.Format("'{0}' is not a valid primitive type.", model.GetType())); } return(primitive); }
public C_PRIMITIVE_OBJECT MakePrimitiveObject(C_ATTRIBUTE an_attribute, C_PRIMITIVE a_primative) { C_PRIMITIVE_OBJECT result = new C_PRIMITIVE_OBJECT(); if (a_primative != null) { result.item = a_primative; } //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 result.node_id = ""; result.occurrences = default_occurrences(); //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 //else // result.any_allowed = true; add_object(an_attribute, result); switch (a_primative.GetType().ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture)) { case "xmlparser.c_boolean": result.rm_type_name = "BOOLEAN"; break; case "xmlparser.c_integer": result.rm_type_name = "INTEGER"; break; case "xmlparser.c_code_phrase": result.rm_type_name = "CODE_PHRASE"; break; case "xmlparser.c_date": result.rm_type_name = "DATE"; break; case "xmlparser.c_date_time": result.rm_type_name = "DATE_TIME"; break; case "xmlparser.c_duration": result.rm_type_name = "DURATION"; break; case "xmlparser.c_ordinal": result.rm_type_name = "ORDINAL"; break; case "xmlparser.c_quantity": result.rm_type_name = "QUANTITY"; break; case "xmlparser.c_string": result.rm_type_name = "STRING"; break; case "xmlparser.c_time": result.rm_type_name = "TIME"; break; case "xmlparser.c_real": result.rm_type_name = "REAL"; break; default: System.Diagnostics.Debug.Assert(false, a_primative.GetType().ToString() + " is not handled"); break; } return result; }
public C_PRIMITIVE_OBJECT MakePrimitiveObject(C_ATTRIBUTE an_attribute, C_PRIMITIVE a_primative) { C_PRIMITIVE_OBJECT result = new C_PRIMITIVE_OBJECT(); if (a_primative != null) { result.item = a_primative; } //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 result.node_id = ""; result.occurrences = default_occurrences(); //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 //else // result.any_allowed = true; add_object(an_attribute, result); switch (a_primative.GetType().ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture)) { case "xmlparser.c_boolean": result.rm_type_name = "BOOLEAN"; break; case "xmlparser.c_integer": result.rm_type_name = "INTEGER"; break; case "xmlparser.c_code_phrase": result.rm_type_name = "CODE_PHRASE"; break; case "xmlparser.c_date": result.rm_type_name = "DATE"; break; case "xmlparser.c_date_time": result.rm_type_name = "DATE_TIME"; break; case "xmlparser.c_duration": result.rm_type_name = "DURATION"; break; case "xmlparser.c_ordinal": result.rm_type_name = "ORDINAL"; break; case "xmlparser.c_quantity": result.rm_type_name = "QUANTITY"; break; case "xmlparser.c_string": result.rm_type_name = "STRING"; break; case "xmlparser.c_time": result.rm_type_name = "TIME"; break; case "xmlparser.c_real": result.rm_type_name = "REAL"; break; default: System.Diagnostics.Debug.Assert(false, a_primative.GetType().ToString() + " is not handled"); break; } return(result); }
C_PRIMITIVE VisitPrimitiveConstraint(C_PRIMITIVE primitiveConstraint) { System.Diagnostics.Trace.Assert(primitiveConstraint != null, "objectConstraint must not be null"); C_PRIMITIVE result = null; C_DATE dateConstraint = primitiveConstraint as C_DATE; if (dateConstraint != null) result = VisitPrimitiveConstraint(dateConstraint); else { C_DATE_TIME dateTimeConstraint = primitiveConstraint as C_DATE_TIME; if (dateTimeConstraint != null) result = VisitPrimitiveConstraint(dateTimeConstraint); else { C_TIME timeConstraint = primitiveConstraint as C_TIME; if (timeConstraint != null) result = VisitPrimitiveConstraint(timeConstraint); else { C_DURATION durationConstraint = primitiveConstraint as C_DURATION; if (durationConstraint != null) result = VisitPrimitiveConstraint(durationConstraint); else result = primitiveConstraint; } } } System.Diagnostics.Debug.Assert(result != null, "objectConstraint must not be null"); return result; }