public void EntryOrder() { var formatter = new RecordChangeAuditFormatter("dummyEntity", "dummyUser", null); formatter.AddChangedLookup("B", null, new Resource {Name="r" } ); var field1 = new IntField().As<Field>(); field1.Name = "C"; formatter.AddChangedField(field1, 1, 2); var field2 = new IntField().As<Field>(); field2.Name = "A"; formatter.AddChangedField(field2, 1, 2); var result = formatter.ToString(); var indexA = result.IndexOf("[A]"); var indexB = result.IndexOf("[B]"); var indexC = result.IndexOf("[C]"); Assert.That(indexA, Is.LessThan(indexB)); Assert.That(indexB, Is.LessThan(indexC)); }
public static void TestIntField() { AgentData agent = new AgentData(); agent.StartNode = new NodeData(); IntField intField = new IntField(); intField.FieldName = "IntField"; intField.Value = 100; agent.StartNode.Fields.Add(intField); RepeatIntField repeatIntField = new RepeatIntField(); repeatIntField.FieldName = "RepeatIntField"; repeatIntField.Value = new List <int>(); repeatIntField.Value.Add(1); repeatIntField.Value.Add(100); repeatIntField.Value.Add(-1000000); repeatIntField.Value.Add(10000); agent.StartNode.Fields.Add(repeatIntField); byte[] bytes = Serializer.Serialize(agent); AgentData deAgentData = Serializer.DeSerialize <AgentData>(bytes); }
public void DefaultValTest() { BooleanField bf = new BooleanField(110); Assert.That(false, Is.EqualTo(bf.Obj)); Assert.That(110, Is.EqualTo(bf.Tag)); CharField cf = new CharField(300); Assert.That('\0', Is.EqualTo(cf.getValue())); Assert.That(300, Is.EqualTo(cf.Tag)); DateTimeField dtf = new DateTimeField(3); Assert.That(3, Is.EqualTo(dtf.Tag)); StringField sf = new StringField(32); Assert.That(32, Is.EqualTo(sf.Tag)); Assert.That("", Is.EqualTo(sf.Obj)); IntField ifld = new IntField(239); Assert.That(239, Is.EqualTo(ifld.Tag)); Assert.That(0, Is.EqualTo(ifld.Obj)); DecimalField df = new DecimalField(1); Assert.That(1, Is.EqualTo(df.Tag)); Assert.That(new Decimal(0.0), Is.EqualTo(df.Obj)); }
public static void TestIntField() { BehaviorTreeElement behaviorTree = new BehaviorTreeElement(); behaviorTree.StartNode = new NodeData(); IntField intField = new IntField(); intField.FieldName = "IntField"; intField.Value = 100; behaviorTree.StartNode.Fields.Add(intField); RepeatIntField repeatIntField = new RepeatIntField(); repeatIntField.FieldName = "RepeatIntField"; repeatIntField.Value = new List <int>(); repeatIntField.Value.Add(1); repeatIntField.Value.Add(100); repeatIntField.Value.Add(-1000000); repeatIntField.Value.Add(10000); behaviorTree.StartNode.Fields.Add(repeatIntField); byte[] bytes = Serializer.Serialize(behaviorTree); BehaviorTreeElement deBehaviorTreeData = Serializer.DeSerialize <BehaviorTreeElement>(bytes); }
public static IndexableField InstantiateField(string key, object value, FieldType fieldType) { IndexableField field; if (value is Number) { Number number = ( Number )value; if (value is long?) { field = new LongField(key, number.longValue(), Field.Store.YES); } else if (value is float?) { field = new FloatField(key, number.floatValue(), Field.Store.YES); } else if (value is double?) { field = new DoubleField(key, number.doubleValue(), Field.Store.YES); } else { field = new IntField(key, number.intValue(), Field.Store.YES); } } else { field = new Field(key, value.ToString(), fieldType); } return(field); }
public async Task IntFieldTest() { var theme = MatterHackers.MatterControl.AppContext.Theme; var testField = new IntField(theme); await ValidateAgainstValueMap( testField, theme, (field) => (field.Content as MHNumberEdit).ActuallNumberEdit.Text, new List <ValueMap>() { { "0.12345", "0" }, { "1.2345", "1" }, { "12.345", "12" }, { "12.7", "12" }, // Floor not round? { "+0.12345", "0" }, { "+1.2345", "1" }, { "+12.345", "12" }, { "-0.12345", "0" }, { "-1.2345", "-1" }, { "-12.345", "-12" }, { "-12.7", "-12" }, // Floor not round? { "22", "22" }, // Invalid values revert to expected { "abc", "0" }, { "+abc", "0" }, { "-abc", "0" }, }); }
public virtual void TestIntFieldCache() { Directory dir = NewDirectory(); IndexWriterConfig cfg = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())); cfg.SetMergePolicy(NewLogMergePolicy()); RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, cfg); Document doc = new Document(); IntField field = new IntField("f", 0, Field.Store.YES); doc.Add(field); int[] values = new int[TestUtil.NextInt(Random(), 1, 10)]; for (int i = 0; i < values.Length; ++i) { int v; switch (Random().Next(10)) { case 0: v = int.MinValue; break; case 1: v = 0; break; case 2: v = int.MaxValue; break; default: v = TestUtil.NextInt(Random(), -10, 10); break; } values[i] = v; if (v == 0 && Random().NextBoolean()) { // missing iw.AddDocument(new Document()); } else { field.IntValue = v; iw.AddDocument(doc); } } iw.ForceMerge(1); DirectoryReader reader = iw.Reader; Ints ints = FieldCache.DEFAULT.GetInts(GetOnlySegmentReader(reader), "f", false); for (int i = 0; i < values.Length; ++i) { Assert.AreEqual(values[i], ints.Get(i)); } reader.Dispose(); iw.Dispose(); dir.Dispose(); }
public void GetIntTest() { IntField field = new IntField(200, 101); fieldmap.SetField(field); Assert.That(fieldmap.GetInt(200), Is.EqualTo(101)); fieldmap.SetField(new StringField(202, "2222")); Assert.That(fieldmap.GetInt(202), Is.EqualTo(2222)); Assert.Throws(typeof(FieldNotFoundException), delegate { fieldmap.GetInt(99900); }); }
public void IntFieldTest() { IntField field = new IntField(Tags.AdvTransType, 500); Assert.That(field.getValue(), Is.EqualTo(500)); Assert.That(field.Tag, Is.EqualTo(5)); Assert.That(field.ToString(), Is.EqualTo("500")); Assert.That(field.Obj, Is.EqualTo(500)); Assert.That(field.Tag, Is.EqualTo(5)); field.Tag = 10; Assert.That(field.Tag, Is.EqualTo(10)); }
public override void OnAwake() { if (Node.Fields == null || Node.Fields["Frames"] == null) { return; } IntField field = Node.Fields["Frames"] as IntField; Frames = field.Value; }
public override void OnAwake() { if (Node.Fields == null || Node.Fields["Duration"] == null) { return; } IntField field = Node.Fields["Duration"] as IntField; Duration = field.Value / 1000; }
public override void OnAwake() { IntField durationField = Node.NodeData["Duration"] as IntField; if (durationField == null || durationField.Value <= 0) { Node.Status = ENodeStatus.Error; return; } Duration = durationField; }
public override void OnAwake() { IntField framesField = Node.NodeData["Frames"] as IntField; if (framesField == null) { Node.Status = NodeStatus.Error; return; } m_Frames = framesField; }
static SoilSurveyRow() { HebrewEnglishFieldsDictionary["עבודה"] = new IntField <string>("JobId"); HebrewEnglishFieldsDictionary["מדגם"] = new IntField <string>("SampleId"); HebrewEnglishFieldsDictionary["עומק מ-"] = new IntField <string>("DepthFrom"); HebrewEnglishFieldsDictionary["עומק עד"] = new IntField <string>("DepthTo"); HebrewEnglishFieldsDictionary["תאריך קבלה"] = new DateField <string>("RecievalDate"); HebrewEnglishFieldsDictionary["מגדל"] = new StringField <string>("Megadel"); HebrewEnglishFieldsDictionary["גידול"] = new StringField <string>("Gidul"); HebrewEnglishFieldsDictionary["זן"] = new StringField <string>("Variety"); HebrewEnglishFieldsDictionary["הערת מדגם"] = new StringField <string>("SampleRemark"); }
public override void OnAwake() { IntField loopTimesField = Node.NodeData["LoopTimes"] as IntField; if (loopTimesField == null) { Node.Status = ENodeStatus.Error; return; } m_LoopTimes = loopTimesField; }
public void IntFieldTest() { IntField field = new IntField(200, 101); IntField refield = new IntField(200); fieldmap.SetField(field); fieldmap.GetField(refield); Assert.That(101, Is.EqualTo(refield.Obj)); field.setValue(102); fieldmap.SetField(field); fieldmap.GetField(refield); Assert.That(102, Is.EqualTo(refield.Obj)); }
// ----------------------------------------------------------- // Hero List Fields // ----------------------------------------------------------- /// <summary> /// A field that can contain an integer from an IntField object. An IntField exists inside an IntList object. /// </summary> /// <param name="intField">The IntField object that contains the integer that appears in the field.</param> /// <param name="index">The slot assigned to the IntField in its IntList object.</param> /// <returns>The IntField assigned to the field.</returns> public static int IntListField(IntField intField, int index) { int bodyWidth = 100; int height = 20; int value = intField.value; GUIStyle bodyStyle = Fields.TextBox.StyleA; BeginHorizontal(); int result = EditorGUILayout.IntField("", value, bodyStyle, GUILayout.Width(bodyWidth), GUILayout.Height(height)); EndHorizontal(); return(result); }
public void ToAdmin(QuickFix.Message message, SessionID sessionID) { // Faz o processamento try { string msgType = message.Header.GetString(35); logger.Debug("ToAdmin: " + msgType); // Complementa a mensagem de logon com a senha if (msgType.Equals(QuickFix.FIX42.Logon.MsgType)) { Logon message2 = (Logon)message; if (ConfigurationManager.AppSettings["Passwd42"] != null) { message2.Set(new RawData(ConfigurationManager.AppSettings["Passwd42"].ToString())); message2.Set(new RawDataLength(ConfigurationManager.AppSettings["Passwd42"].ToString().Length)); } if (ConfigurationManager.AppSettings["CancelOnDisconnect"] != null && ConfigurationManager.AppSettings["CancelOnDisconnect"].ToString().ToUpper().Equals("N") && ConfigurationManager.AppSettings["CancelOnDisconnect"].ToString().ToUpper().Equals("FALSE")) { char codtype = ConfigurationManager.AppSettings["CancelOnDisconnect"].ToString()[0]; if (codtype >= '0' && codtype <= '3') { CharField field35002 = new CharField(35002, codtype); message2.SetField(field35002); } IntField field35003 = new IntField(35003, 60000); message2.SetField(field35003); } message2.Set(new HeartBtInt(30)); message2.Set(new EncryptMethod(0)); message2.Set(new ResetSeqNumFlag(ConfigurationManager.AppSettings["ResetSeqNum"].ToString().Equals("true"))); } logger.Debug("toAdmin(). Session id : " + sessionID + " Msg: " + message.GetType().ToString()); if (message.Header.GetString(35).Equals(QuickFix.FIX42.Heartbeat.MsgType) == false) { Crack(message, sessionID); } } catch (Exception ex) { logger.Error("toAdmin() Erro: " + ex.Message, ex); } }
private void DrawFields(Type type, ComponentSystemBase effectiveInstance) { foreach (var field in cachedFields) { if (field.FieldType == typeof(System.Int32)) { IntField.Draw(type, field, effectiveInstance); } else if (field.FieldType == typeof(System.Single)) { FloatField.Draw(type, field, effectiveInstance); } else if (field.FieldType == typeof(System.String)) { StringField.Draw(type, field, effectiveInstance); } else if (field.FieldType == typeof(System.Boolean)) { BoolField.Draw(type, field, effectiveInstance); } else if (field.FieldType.IsEnum) { var underlyingType = Enum.GetUnderlyingType(field.FieldType); if (underlyingType == typeof(short)) { MaskField.Draw(type, field, effectiveInstance); } else { EnumField.Draw(type, field, effectiveInstance); } } else { // monobehaviours switch (field.FieldType.ToString()) { case "UnityEngine.Mesh": MeshField.Draw(type, field, effectiveInstance); break; case "UnityEngine.Material": MaterialField.Draw(type, field, effectiveInstance); break; } } } }
void UpdateIntelligence() { IntField.GetComponent <Text> ().text = Int + ""; this.Att_MgDmg = 5 * Int; this.Att_MgDmgCrit = 2 * Int; this.Att_FireRes = 1 * Con + 1 * Int; this.Att_IceRes = 1 * Con + 1 * Int;; this.Att_LightRes = 1 * Con + 1 * Int; MgDmg.GetComponent <Text> ().text = Att_MgDmg + ""; MgDmgCrit.GetComponent <Text> ().text = Att_MgDmgCrit + ""; FireRes.GetComponent <Text> ().text = Att_FireRes + ""; IceRes.GetComponent <Text> ().text = Att_IceRes + ""; LightRes.GetComponent <Text> ().text = Att_LightRes + ""; }
private void OnValidate() { Player player = GetComponent <Player>(); if (player) { playerId = player.Id; if (player.Score) { playerScore = player.Score; } if (player.GetIsFireballActive) { isFireballActive = player.GetIsFireballActive; } } }
public Entities.Forms.IntField ToEntity(IntField field) { return(new Entities.Forms.IntField { Description = field.Description, FieldName = field.FieldName, IsRequired = field.IsRequired, DefaultValue = field.DefaultValue, Min = field.Min, Max = field.Max, FieldType = GetFieldType(field), AllowFilter = field.AllowFilter, AllowSort = field.AllowSort, DisplayName = field.DisplayName, IsUnique = field.IsUnique }); }
public override void OnAwake() { if (Node.Fields == null) { Node.Status = NodeStatus.ERROR; return; } if (Node.Fields["Millisecond"] == null) { Node.Status = NodeStatus.ERROR; return; } IntField floatField = Node.Fields["Millisecond"] as IntField; WaitTime = floatField.Value; }
public void ToAdmin(QuickFix.Message message, SessionID sessionID) { // Faz o processamento try { string msgType = message.Header.GetString(35); logger.Debug("ToAdmin: " + msgType); if (msgType.Equals(QuickFix.FIX44.Logon.MsgType)) { Logon message2 = (Logon)message; if (!string.IsNullOrEmpty(this.Password)) { message2.Set(new RawData(this.Password)); message2.Set(new RawDataLength(this.Password.Length)); } if (!string.IsNullOrEmpty(this.CancelOnDisconnect)) { char codtype = this.CancelOnDisconnect[0]; if (codtype >= '0' && codtype <= '3') { CharField field35002 = new CharField(35002, codtype); message2.SetField(field35002); } IntField field35003 = new IntField(35003, 10000); message2.SetField(field35003); } message2.Set(new HeartBtInt(30)); message2.Set(new EncryptMethod(0)); message2.Set(new ResetSeqNumFlag(true)); } logger.Debug("toAdmin(). Session id : " + sessionID + " Msg: " + message.GetType().ToString()); if (message.Header.GetString(35).Equals(QuickFix.FIX42.Heartbeat.MsgType) == false) { Crack(message, sessionID); } } catch (Exception ex) { logger.Error("toAdmin() Erro: " + ex.Message, ex); } }
/// <summary> /// 更新当前位置 /// </summary> /// <param name="centerPos"></param> public void SetCurPos(Vector3Int centerPos, int index) { /* * curPos = centerPos; * visiableZone.SetField(curPos, farSize, farSize); * nearZone.SetField(curPos, nearSize, nearSize); */ allCurPos[index] = centerPos; IntField visZone = new IntField(); visZone.SetField(centerPos, farSize, farSize); visiableZoneList[index] = visZone; IntField nearZone = new IntField(); nearZone.SetField(centerPos, nearSize, nearSize); nearZoneList[index] = nearZone; }
/// <summary> /// 从二进制流加载数据库 /// </summary> /// <param name="reader">二进制流</param> public void Load(BinaryReader reader) { name = reader.ReadString(); title = reader.ReadString(); entities = new Entity[reader.ReadInt32()]; for (int i = 0; i < entities.Length; ++i) { entities[i] = new Entity("", 0); entities[i].Load(reader); } fields = new Field[reader.ReadInt32()]; for (int i = 0; i < fields.Length; ++i) { bool isIntField = reader.ReadBoolean(); if (isIntField) { fields[i] = new IntField("", 1, new Constraint[0]); } else { fields[i] = new CharField("", 1, 1, new Constraint[0]); } fields[i].Load(reader); } foreach (var entity in entities) { foreach (var field in entity.Fields) { if (field.RefEntityName != "") { field.Constraints = new Constraint[1]; field.Constraints[0] = new ForeignConstraint(new string[1] { field.RefEntityName }); var foreignConstraint = field.Constraints[0] as ForeignConstraint; foreignConstraint.RefDataBase = this; foreignConstraint.RefEntity = entities.First(x => x.Name == field.RefEntityName); } } } }
public void SetFieldOverwriteTest() { IntField field = new IntField(21901, 1011); IntField refield = new IntField(21901); fieldmap.SetField(field, false); fieldmap.GetField(refield); Assert.That(1011, Is.EqualTo(refield.Obj)); field.setValue(1021); IntField refield2 = new IntField(21901); fieldmap.SetField(field, false); fieldmap.GetField(refield2); Assert.That(refield.Obj, Is.EqualTo(1011)); fieldmap.SetField(field, true); IntField refield3 = new IntField(21901); fieldmap.GetField(refield3); Assert.That(1021, Is.EqualTo(refield3.Obj)); }
/// <summary> /// 加载到二进制流 /// </summary> /// <param name="reader">二进制流</param> public void Load(BinaryReader reader) { name = reader.ReadString(); length = reader.ReadInt32(); var fieldsLength = reader.ReadInt32(); fields = new Field[fieldsLength]; for (int i = 0; i < fieldsLength; ++i) { bool isIntField = reader.ReadBoolean(); if (isIntField) { fields[i] = new IntField("", length, new Constraint[0]); } else { fields[i] = new CharField("", length, 1, new Constraint[0]); } fields[i].Load(reader); } }
public static void TestNode() { //创建AgentData AgentData agent = new AgentData(); //添加开始节点 agent.StartNode = new NodeData(); //开始节点字段 IntField intField = new IntField(); intField.FieldName = "IntField"; intField.Value = 100; agent.StartNode.Fields.Add(intField); //创建开始节点的第一个子节点 NodeData node1 = new NodeData(); //子节点1的枚举字段 EnumField enumField = new EnumField(); enumField.FieldName = "EnumField"; enumField.Value = 100; node1.Fields.Add(enumField); //创建开始节点的第二个子节点 NodeData node2 = new NodeData(); //子节点2的Long字段 LongField longField = new LongField(); longField.FieldName = "LongField"; longField.Value = 100; node2.Fields.Add(longField); agent.StartNode.Childs = new List <NodeData>(); agent.StartNode.Childs.Add(node1); agent.StartNode.Childs.Add(node2); byte[] bytes = Serializer.Serialize(agent); AgentData deAgentData = Serializer.DeSerialize <AgentData>(bytes); }
/// <summary> /// Add a group to message; optionally auto-increment the counter. /// When parsing from a string (e.g. Message::FromString()), we want to leave the counter alone /// so we can detect when the counterparty has set it wrong. /// </summary> /// <param name="group">group to add</param> /// <param name="autoIncCounter">if true, auto-increment the counter, else leave it as-is</param> internal void AddGroup(Group grp, bool autoIncCounter) { // copy, in case user code reuses input object Group group = grp.Clone(); if (!_groups.ContainsKey(group.Field)) { _groups.Add(group.Field, new List <Group>()); } _groups[group.Field].Add(group); if (autoIncCounter) { // increment group size int groupsize = _groups[group.Field].Count; int counttag = group.Field; IntField count = null; count = new IntField(counttag, groupsize); this.SetField(count, true); } }
protected override void ConstructFields() { SupportsNotificationBinding = false; NoBuildCrosschecks = true; FieldValidationSuspended = true; TableName = "TBL_TESTPERSON"; StoreFlag = StoreFlag.LoadAndStore; m_fldName = new StringField() { Owner = this, FieldName = "PERSON_NAME", Required = true, Size = 50 }; m_fldRating = new IntField() { Owner = this, FieldName = "RATING", MinMaxChecking = true, MinValue = 0, MaxValue = 10 }; m_fldRegistered = new BoolField() { Owner = this, FieldName = "IS_REGISTERED", Required = true }; m_fldDOB = new DateTimeField() { Owner = this, FieldName = "DOB" }; m_fldScore = new DoubleField() { Owner = this, FieldName = "SCORE" }; m_fldData1 = new StringField() { Owner = this, FieldName = "Data1" }; m_fldData2 = new StringField() { Owner = this, FieldName = "Data2" }; m_fldData3 = new StringField() { Owner = this, FieldName = "Data3" }; m_fldData4 = new IntField() { Owner = this, FieldName = "Data4" }; m_fldData5 = new IntField() { Owner = this, FieldName = "Data5" }; m_fldData6 = new IntField() { Owner = this, FieldName = "Data6" }; m_fldData7 = new BoolField() { Owner = this, FieldName = "Data7" }; m_fldData8 = new BoolField() { Owner = this, FieldName = "Data8" }; m_fldData9 = new BoolField() { Owner = this, FieldName = "Data9" }; m_fldData10 = new DoubleField() { Owner = this, FieldName = "Data10" }; }
protected override void OnInitialize() { Vector2 winSize = new Vector3( 312.0f, 265.0f ); maxSize = winSize; minSize = winSize; autoRepaintOnSceneChange = true; m_root = new Control(); m_root.SetSize( 100.0f, 100.0f, Control.MetricsUnits.Percentage, Control.MetricsUnits.Percentage ); m_root.AddDecorator( new StackContent() ); AddChild( m_root ); // Input object field m_original = new ObjectField( typeof( GameObject ), true, null, "Original" ); m_original.SetHeight( 26.0f, Control.MetricsUnits.Pixel ); m_original.SetWidth( 100.0f, Control.MetricsUnits.Percentage ); m_original.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ); m_root.AddChild( m_original ); // Rotation pivot point m_pivot = new Vector3Field( Vector3.zero, "Pivot:" ); m_pivot.SetHeight( 40.0f, Control.MetricsUnits.Pixel ); m_pivot.SetWidth( 100.0f, Control.MetricsUnits.Percentage ); m_pivot.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ); m_root.AddChild( m_pivot ); // Transform control m_transform = new TransformControl(); m_transform.SetWidth( 100.0f, Control.MetricsUnits.Percentage ); m_transform.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ); m_root.AddChild( m_transform ); // Count field m_count = new IntField( 1, "Duplicate Count:" ); m_count.SetHeight( 26.0f, Control.MetricsUnits.Pixel ); m_count.SetWidth( 100.0f, Control.MetricsUnits.Percentage ); m_count.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ); m_root.AddChild( m_count ); // Space field m_space = new EnumDropdown( Space.World, "Space:" ); m_space.SetHeight( 26.0f, Control.MetricsUnits.Pixel ); m_space.SetWidth( 100.0f, Control.MetricsUnits.Percentage ); m_space.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ); m_root.AddChild( m_space ); // Duplicate button m_duplicate = new Button( "Duplicate" ); m_duplicate.SetWidth( 100.0f, Control.MetricsUnits.Percentage ); m_duplicate.SetMargin( 5.0f, 5.0f, 5.0f, 5.0f ); m_duplicate.Enabled = false; m_root.AddChild( m_duplicate ); // Events m_original.ValueChange += m_original_ValueChange; m_count.ValueChange += m_count_ValueChange; m_duplicate.Clicked += m_duplicate_Clicked; SceneView.onSceneGUIDelegate += SceneViewGUI; }
public static void BeforeClass() { NoDocs = AtLeast(4096); Distance = (1 << 30) / NoDocs; Directory = NewDirectory(); RandomIndexWriter writer = new RandomIndexWriter(Random(), Directory, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(TestUtil.NextInt(Random(), 100, 1000)).SetMergePolicy(NewLogMergePolicy())); FieldType storedInt = new FieldType(IntField.TYPE_NOT_STORED); storedInt.Stored = true; storedInt.Freeze(); FieldType storedInt8 = new FieldType(storedInt); storedInt8.NumericPrecisionStep = 8; FieldType storedInt4 = new FieldType(storedInt); storedInt4.NumericPrecisionStep = 4; FieldType storedInt2 = new FieldType(storedInt); storedInt2.NumericPrecisionStep = 2; FieldType storedIntNone = new FieldType(storedInt); storedIntNone.NumericPrecisionStep = int.MaxValue; FieldType unstoredInt = IntField.TYPE_NOT_STORED; FieldType unstoredInt8 = new FieldType(unstoredInt); unstoredInt8.NumericPrecisionStep = 8; FieldType unstoredInt4 = new FieldType(unstoredInt); unstoredInt4.NumericPrecisionStep = 4; FieldType unstoredInt2 = new FieldType(unstoredInt); unstoredInt2.NumericPrecisionStep = 2; IntField field8 = new IntField("field8", 0, storedInt8), field4 = new IntField("field4", 0, storedInt4), field2 = new IntField("field2", 0, storedInt2), fieldNoTrie = new IntField("field" + int.MaxValue, 0, storedIntNone), ascfield8 = new IntField("ascfield8", 0, unstoredInt8), ascfield4 = new IntField("ascfield4", 0, unstoredInt4), ascfield2 = new IntField("ascfield2", 0, unstoredInt2); Document doc = new Document(); // add fields, that have a distance to test general functionality doc.Add(field8); doc.Add(field4); doc.Add(field2); doc.Add(fieldNoTrie); // add ascending fields with a distance of 1, beginning at -noDocs/2 to test the correct splitting of range and inclusive/exclusive doc.Add(ascfield8); doc.Add(ascfield4); doc.Add(ascfield2); // Add a series of noDocs docs with increasing int values for (int l = 0; l < NoDocs; l++) { int val = Distance * l + StartOffset; field8.IntValue = val; field4.IntValue = val; field2.IntValue = val; fieldNoTrie.IntValue = val; val = l - (NoDocs / 2); ascfield8.IntValue = val; ascfield4.IntValue = val; ascfield2.IntValue = val; writer.AddDocument(doc); } Reader = writer.Reader; Searcher = NewSearcher(Reader); writer.Dispose(); }
protected override void ConstructFields() { TableName = "TBL_TESTPERSON"; StoreFlag = StoreFlag.LoadAndStore; m_fldName = new StringField() { Owner = this, FieldName = "PERSON_NAME", Required = true, Size = 50 }; m_fldSex = new StringField() { Owner = this, FieldName = "SEX", Required = true, Size = 1, DataEntryType = DataEntryType.DirectEntryOrLookupWithValidation, LookupType = LookupType.Dictionary }; m_fldSex.LookupDictionary.AddRange(new string[]{"M,Male", "F,Female", "U,Unspecified"}); m_fldRating = new IntField() { Owner = this, FieldName = "RATING", MinMaxChecking = true, MinValue = 0, MaxValue = 10 }; m_fldRegistered = new BoolField() { Owner = this, FieldName = "IS_REGISTERED", Required = true }; m_fldDOB = new DateTimeField() { Owner = this, FieldName = "DOB" }; m_fldSalary = new DecimalField() { Owner = this, FieldName = "PAYROLL_VOLUME", MinMaxChecking = true, MinValue = 0M, MaxValue = Decimal.MaxValue }; //calculated field returns salary * 10 years m_fldDecadeSalary = new DecimalField() { Owner = this, FieldName = "DECADE_SALARY", StoreFlag = StoreFlag.None, DataEntryType = DataEntryType.None, Calculated = true, Formula = "850-10 +(::PAYROLL_VOLUME * 10)" }; m_fldScore = new DoubleField() { Owner = this, FieldName = "SCORE" }; m_fldMovieNames = new ListField<string>() { Owner = this, FieldName = "MOVIES", Required = true }; //ths is business logic-driven computed column for GUI m_fldBusinessCode = new StringField() { Owner = this, FieldName = "BUSINESS_CODE", StoreFlag = StoreFlag.None, DataEntryType = DataEntryType.None }; }