static void Main(string[] args) { var input = Console.In; //var input = new StringReader("6\nhome office\nhome garage\nhome parents_home\noffice lab\noffice library\nlibrary main_entrance"); var count = int.Parse(input.ReadLine()); var many = Enumerable.Range(0, count) .Select(_ => input.ReadLine() .Split(' ') .ToArray()) .ToArray(); var dic = new Dictionary<string,key>(); foreach (var key in many) { dic[key[0]] = new key(key[0]); dic[key[1]] = new key(key[1]); } foreach (var key in many) { var master = dic[key[0]]; var slave = dic[key[1]]; master.Children.Add(slave); } var master2 = dic.Values.OrderByDescending(key => key.Level).First(); Console.WriteLine(master2.Level); }
public static void Register(this IDictionary<key, IList<Action<KeyArgs>>> dictionary, key key, Action<KeyArgs> action) { if (!dictionary.ContainsKey(key)) { dictionary.Add(key, new List<Action<KeyArgs>>()); } dictionary[key].Add(action); }
// Use this for initialization void Start () { gameObject.GetComponent<Renderer>().enabled = false; GetComponent<Renderer>().material.color = Color.blue; if(keyName == "MiddleC"){ currentKey = key.MiddleC; } if(keyName == "CSharp"){ currentKey = key.CSharp; } if(keyName == "D"){ currentKey = key.D; } if(keyName == "DSharp"){ currentKey = key.DSharp; } if(keyName == "E"){ currentKey = key.E; } if(keyName == "F"){ currentKey = key.F; } if (keyName == "FSharp") { currentKey = key.FSharp; } if(keyName == "G"){ currentKey = key.G; } if (keyName == "GSharp") { currentKey = key.GSharp; } if(keyName == "A"){ currentKey = key.A; } if (keyName == "ASharp") { currentKey = key.ASharp; } if(keyName == "B"){ currentKey = key.B; } if(keyName == "HighC"){ currentKey = key.HighC; } if (keyName == "HighCSharp") { currentKey = key.HighCSharp; } if(keyName == "HighD"){ currentKey = key.HighD; } if (keyName == "HighDSharp") { currentKey = key.HighDSharp; } if(keyName == "HighE"){ currentKey = key.HighE; } if(keyName == "HighF"){ currentKey = key.HighF; } }
static void AddInput(key k, string s) { switch (s) { case "menu": menu.f += k.f; break; case "term": term.f += k.f; break; case "invt": invt.f += k.f; break; case "lamp": lamp.f += k.f; break; case "fire": fire.f += k.f; break; case "jump": jump.f += k.f; break; case "duck": duck.f += k.f; break; case "dash": dash.f += k.f; break; } }
private key GenerateCollectionKey(IForeignKeyColumnInfo[] kdef) { key key; key = new key(); if (kdef.Length == 1) { key.column1 = kdef[0].ForeignKeyColumnName; } else { key.column = kdef.Select(q => new column() { name = q.ForeignKeyColumnName }).ToArray(); } return key; }
public Controls() { // why the how does it menu = new key((n)=>menu.input=n); term = new key((n)=>term.input=n); invt = new key((n)=>invt.input=n); fire = new key((n)=>fire.input=n); lamp = new key((n)=>lamp.input=n); jump = new key((n)=>jump.input=n); dash = new key((n)=>dash.input=n); duck = new key((n)=>duck.input=n); accept = new key((n)=>accept.input=n); mouseX = new axis((n)=>mouseX.input=n); mouseY = new axis((n)=>mouseY.input=n); axisX = new axis((n)=>axisX.input=n); axisY = new axis((n)=>axisY.input=n); //roll = new axis((n)=>roll.input=n); } // there is no reason for this how does it even
public Controls() { // why the how does it menu = new key((n)=>menu.input=n); term = new key((n)=>term.input=n); invt = new key((n)=>invt.input=n); fire = new key((n)=>fire.input=n); lamp = new key((n)=>lamp.input=n); jump = new key((n)=>jump.input=n); dash = new key((n)=>dash.input=n); duck = new key((n)=>duck.input=n); mouseX = new axis((n)=>mouseX.input=n); mouseY = new axis((n)=>mouseY.input=n); axisX = new axis((n)=>axisX.input=n); axisY = new axis((n)=>axisY.input=n); roll = new axis((n)=>roll.input=n); }
if (string.IsNullOrEmpty(key)) { throw new InvalidOperationException(Resources.Error_EmptyKey);
ValidateKeyValue(key, value);
set => Set(key, value);
if (!Validate(key, value)) { throw new InvalidOperationException($"Invalid value {value} for key '{key}'");
foreach (var(key, value) in other)
SetValueImpl(key, value);
set => UpdateWithNotification(key, value);
private set => this.set(key, value);
set => this.AddOrReplace(key, value);
public bool Equals(ref key k) { return period == k.period && input == k.input; }
foreach (var (key, value) in HtmlAttributes)
return this.Get(key);
SetPropertyNoCheck(key, value);
set => Put(key, value);
private void ProcessManyToOneReference( Entity entity, DirectedReference directedReference, Action <object> addItem, string cascade, string collectionCascade, string lazy, string orderByClause, bool inverse) { if (directedReference.FromEndEnabled == false) { return; } ITable referenceMappedTable = directedReference.Reference.MappedTable(); DirectedRelationship directedRelationship = null; if (referenceMappedTable == null) { directedRelationship = GetDirectedMappedRelationship(entity, directedReference.Reference); } if (directedReference.FromEndCardinality == Cardinality.One) { fetchMode fetchMode; bool insert; bool update; if (directedReference.Entity1IsFromEnd) { fetchMode = (fetchMode)Enum.Parse(typeof(fetchMode), directedReference.Reference.GetReferenceEnd1FetchMode().ToString(), true); insert = directedReference.Reference.GetReferenceEnd1Insert(); update = directedReference.Reference.GetReferenceEnd1Update(); } else { fetchMode = (fetchMode)Enum.Parse(typeof(fetchMode), directedReference.Reference.GetReferenceEnd2FetchMode().ToString(), true); insert = directedReference.Reference.GetReferenceEnd2Insert(); update = directedReference.Reference.GetReferenceEnd2Update(); } manytoone manyToOneNode; if (referenceMappedTable == null) { manyToOneNode = CreateManyToOneNode(directedReference, directedRelationship, cascade); } else { manyToOneNode = CreateManyToOneNode(directedReference, referenceMappedTable); } manyToOneNode.fetch = fetchMode; manyToOneNode.fetchSpecified = true; manyToOneNode.insert = insert; manyToOneNode.update = update; addItem(manyToOneNode); } else { key keyNode = new key(); if (referenceMappedTable == null && directedRelationship.ToKey.Columns.Count > 1) { foreach (var columnNode in GetColumnNodes(directedRelationship.ToKey.Columns)) { keyNode.AddColumn(columnNode); } } else if (referenceMappedTable != null) { ITable toPrimaryMappedTable = EntityMapper.GetPrimaryTable(directedReference.ToEntity); var toColumnsInPrimaryKey = referenceMappedTable.Relationships.First(t => t.PrimaryTable == toPrimaryMappedTable || t.ForeignTable == toPrimaryMappedTable).ForeignKey.Columns; foreach (var columnNode in GetColumnNodes(toColumnsInPrimaryKey)) { keyNode.AddColumn(columnNode); } } else { keyNode.column1 = directedRelationship.ToKey.Columns[0].Name.BackTick(); } onetomany oneToManyNode = new onetomany(); oneToManyNode.@class = directedReference.ToEntity.Name; collectionFetchMode collFetchMode; if (directedReference.Entity1IsFromEnd) { collFetchMode = (collectionFetchMode)Enum.Parse(typeof(collectionFetchMode), directedReference.Reference.GetReferenceEnd1CollectionFetchMode().ToString(), true); } else { collFetchMode = (collectionFetchMode)Enum.Parse(typeof(collectionFetchMode), directedReference.Reference.GetReferenceEnd2CollectionFetchMode().ToString(), true); } AssociationType type = NHCollections.GetAssociationType(directedReference); switch (type) { case AssociationType.None: Log.WarnFormat("No association type was set on reference {0} for the end {1}. This is usually an error.", directedReference.Reference.Name, directedReference.Entity1IsFromEnd ? "1" : "2"); return; case AssociationType.Set: var set = CreateSetNode(directedReference, keyNode, collectionCascade, collFetchMode, lazy, inverse); set.Item = oneToManyNode; if (orderByClause.Length > 0) { set.orderby = orderByClause; } addItem(set); break; case AssociationType.Map: var mapNode = CreateMapNode(directedReference, keyNode, collectionCascade, collFetchMode, lazy, inverse); mapNode.Item = new index { column1 = NHCollections.GetIndexColumnName(directedReference), type = NHCollections.GetIndexColumnTypeName(directedReference, EntityMapper.GetPrimaryTable(directedReference.ToEntity)) }; mapNode.Item1 = oneToManyNode; if (orderByClause.Length > 0) { mapNode.orderby = orderByClause; } addItem(mapNode); break; case AssociationType.Bag: var bag = CreateBagNode(directedReference, keyNode, collectionCascade, collFetchMode, lazy, inverse); bag.Item = oneToManyNode; if (orderByClause.Length > 0) { bag.orderby = orderByClause; } addItem(bag); break; case AssociationType.List: list listNode = CreateListNode(directedReference, keyNode, collectionCascade, collFetchMode, lazy, inverse); listNode.Item = new index { column1 = NHCollections.GetIndexColumnName(directedReference) }; listNode.Item1 = oneToManyNode; if (orderByClause.Length > 0) { listNode.orderby = orderByClause; } addItem(listNode); break; case AssociationType.IDBag: idbag idbagNode = CreateIdBagNode(directedReference, keyNode, collectionCascade, collFetchMode, lazy, inverse); idbagNode.collectionid = new collectionid { column1 = NHCollections.GetIndexColumnName(directedReference), generator = new generator { @class = "sequence" }, type = NHCollections.GetIndexColumnTypeName(directedReference, EntityMapper.GetPrimaryTable(directedReference.ToEntity)) }; addItem(idbagNode); break; default: throw new ArgumentOutOfRangeException("AssociationType not handled yet: " + type.ToString()); } } }
private void ProcessManyToManyReference( Entity entity, DirectedReference directedReference, Action <object> addItem, Dictionary <ITable, int> manyToManySameTableProcessingCounts, string collectionCascade, string lazy, string orderByClause, bool inverse) { if (directedReference.FromEndEnabled == false) { return; } ITable referenceMappedTable = directedReference.Reference.MappedTable(); ITable fromPrimaryMappedTable = EntityMapper.GetPrimaryTable(entity); ITable toPrimaryMappedTable = EntityMapper.GetPrimaryTable(directedReference.ToEntity); Cardinality cardinalityPrimary; Cardinality cardinalityForeign; IKey mainKey; IKey associationKey; ITable associationTable = entity.GetAssociationTable(directedReference.ToEntity, out cardinalityPrimary, out cardinalityForeign, out mainKey, out associationKey); key keyNode = new key(); List <IColumn> fromInPrimaryKey = new List <IColumn>(); List <IColumn> toInPrimaryKey = new List <IColumn>(); if (fromPrimaryMappedTable == toPrimaryMappedTable) { // This many-to-many relationship is to the same table if (manyToManySameTableProcessingCounts.ContainsKey(toPrimaryMappedTable)) { int index = manyToManySameTableProcessingCounts[toPrimaryMappedTable]; index++; fromInPrimaryKey.AddRange(referenceMappedTable.Relationships.Where(t => t.PrimaryTable == fromPrimaryMappedTable).ElementAt(index).PrimaryKey.Columns); toInPrimaryKey.AddRange(referenceMappedTable.Relationships.Where(t => t.PrimaryTable == toPrimaryMappedTable).ElementAt(index).ForeignKey.Columns); manyToManySameTableProcessingCounts[toPrimaryMappedTable] = index; } else { fromInPrimaryKey.AddRange(referenceMappedTable.Relationships.Where(t => t.PrimaryTable == fromPrimaryMappedTable).ElementAt(0).PrimaryKey.Columns); toInPrimaryKey.AddRange(referenceMappedTable.Relationships.Where(t => t.PrimaryTable == toPrimaryMappedTable).ElementAt(0).ForeignKey.Columns); manyToManySameTableProcessingCounts.Add(toPrimaryMappedTable, 0); } } else { foreach (var coll in referenceMappedTable.Relationships.Where(t => t.PrimaryTable == fromPrimaryMappedTable).Select(r => r.ForeignKey.Columns)) { foreach (var c in coll) { fromInPrimaryKey.Add(c); } } foreach (var coll in referenceMappedTable.Relationships.Where(t => t.PrimaryTable == toPrimaryMappedTable).Select(r => r.ForeignKey.Columns)) { foreach (var c in coll) { toInPrimaryKey.Add(c); } } } if (fromInPrimaryKey.Count() == 1) { keyNode.column1 = fromInPrimaryKey.First().Name.BackTick(); } else { foreach (var columnNode in GetColumnNodes(fromInPrimaryKey)) { keyNode.AddColumn(columnNode); } } manytomany manyToManyNode = new manytomany(); manyToManyNode.@class = directedReference.ToEntity.Name; if (toInPrimaryKey.Count() == 1) { manyToManyNode.column = toInPrimaryKey.First().Name.BackTick(); } else { foreach (var columnNode in GetColumnNodes(toInPrimaryKey)) { keyNode.AddColumn(columnNode); } } collectionFetchMode collFetchMode; if (directedReference.Entity1IsFromEnd) { collFetchMode = (collectionFetchMode)Enum.Parse(typeof(collectionFetchMode), directedReference.Reference.GetReferenceEnd1CollectionFetchMode().ToString(), true); } else { collFetchMode = (collectionFetchMode)Enum.Parse(typeof(collectionFetchMode), directedReference.Reference.GetReferenceEnd2CollectionFetchMode().ToString(), true); } AssociationType type = NHCollections.GetAssociationType(directedReference); switch (type) { case AssociationType.None: Log.WarnFormat("No association type was set on reference {0} for the end {1}. This is usually an error.", directedReference.Reference.Name, directedReference.Entity1IsFromEnd ? "One" : "Two"); return; case AssociationType.Set: set setNode = CreateSetNode(directedReference, keyNode, collectionCascade, collFetchMode, lazy, inverse); setNode.table = referenceMappedTable.Name.BackTick(); setNode.Item = manyToManyNode; if (orderByClause.Length > 0) { setNode.orderby = orderByClause; } addItem(setNode); break; case AssociationType.Bag: bag bagNode = CreateBagNode(directedReference, keyNode, collectionCascade, collFetchMode, lazy, inverse); bagNode.table = referenceMappedTable.Name.BackTick(); bagNode.Item = manyToManyNode; if (orderByClause.Length > 0) { bagNode.orderby = orderByClause; } addItem(bagNode); break; case AssociationType.Map: map mapNode = CreateMapNode(directedReference, keyNode, collectionCascade, collFetchMode, lazy, inverse); mapNode.table = referenceMappedTable.Name.BackTick(); mapNode.Item = new index { column1 = NHCollections.GetIndexColumnName(directedReference), type = NHCollections.GetIndexColumnTypeName(directedReference, toPrimaryMappedTable /*fromPrimaryMappedTable*/) }; mapNode.Item1 = manyToManyNode; if (orderByClause.Length > 0) { mapNode.orderby = orderByClause; } addItem(mapNode); break; case AssociationType.List: list listNode = CreateListNode(directedReference, keyNode, collectionCascade, collFetchMode, lazy, inverse); listNode.table = referenceMappedTable.Name.BackTick(); listNode.Item = new index { column1 = NHCollections.GetIndexColumnName(directedReference), }; listNode.Item1 = manyToManyNode; if (orderByClause.Length > 0) { listNode.orderby = orderByClause; } addItem(listNode); break; // case AssociationType.IDBag: // throw new NotImplementedException( // string.Format("Have not implemented {0} association type for Many To Many relationships", type)); default: throw new NotImplementedException("AssociationType not handled yet: " + type.ToString()); } }
MemSet(key, value);
set => Set(key, value, false);
set => this.Set(key, value);
set => SetValue(key, value);
set => setValue(key, value);
foreach (var(key, value) in keyValuePairs)
set => Setter(key, value);
get => Get(key, defaultValue);
set => Setter2(key, value);
set => Add(key, value);
(Key, IsDefault) = (IsNotEmptyOrWhiteSpace(key, nameof(key)), false);
FromECPrivateKey(key, algId, out ret);
key => { throw new KeyNotFoundException("Does not have html attribute '{0}'".ToFormat(key));
throw new InvalidSolutionException(key);
// Use this for initialization void Start () { //keyInZone = NoteMovement.inZone; // GameObject notes = GameObject.FindGameObjectWithTag("Note"); NoteMovement noteMovement = notes.GetComponent<NoteMovement>(); //noteScript = gameObject.GetComponent<GameObject>(); if(keyName == "MiddleC"){ currentKey = key.MiddleC; } if(keyName == "CSharp"){ currentKey = key.CSharp; } if(keyName == "D"){ currentKey = key.D; } if(keyName == "DSharp"){ currentKey = key.DSharp; } if(keyName == "E"){ currentKey = key.E; } if(keyName == "F"){ currentKey = key.F; } if (keyName == "FSharp") { currentKey = key.FSharp; } if(keyName == "G"){ currentKey = key.G; } if (keyName == "GSharp") { currentKey = key.GSharp; } if(keyName == "A"){ currentKey = key.A; } if (keyName == "ASharp") { currentKey = key.ASharp; } if(keyName == "B"){ currentKey = key.B; } if(keyName == "HighC"){ currentKey = key.HighC; } if (keyName == "HighCSharp") { currentKey = key.HighCSharp; } if(keyName == "HighD"){ currentKey = key.HighD; } if (keyName == "HighDSharp") { currentKey = key.HighDSharp; } if(keyName == "HighE"){ currentKey = key.HighE; } if(keyName == "HighF"){ currentKey = key.HighF; } }
public static SortList instance(IDataSeries input, int period) { if ( input == null ) return new SortList(input, period); lock(dict) { key k = new key(input, period); if ( dict.ContainsKey(k) ) return dict[k]; else return dict[k] = new SortList(input, period); } }
get => Indexer_Get(key); set => Indexer_Set(key, value);
set => Alloc(key, value, true);
set => Assign(key, value);
set => Insert(key, value, false);
set => this.Add(key, value);
public static void KeyPress(key key, int delay = 0) { if (key != key.Null) { KeyPressDI(Keys.GetDxKey(key), delay); //if(delay < 1) //{ // KeyDown((byte)key); // KeyUp((byte)key); //} //else //{ // KeyDown((byte)key); // System.Threading.Thread.Sleep(delay); // KeyUp((byte)key); //} } }
public static dxKey GetDxKey(key key) { switch (key) { case key.zero_numpad: return dxKey.zero_numpad; case key.one_numpad: return dxKey.one_numpad; case key.two_numpad: return dxKey.two_numpad; case key.three_numpad: return dxKey.three_numpad; case key.four_numpad: return dxKey.four_numpad; case key.five_numpad: return dxKey.five_numpad; case key.six_numpad: return dxKey.six_numpad; case key.seven_numpad: return dxKey.seven_numpad; case key.eight_numpad: return dxKey.eight_numpad; case key.nine_numpad: return dxKey.nine_numpad; case key.numlock: return dxKey.numlock; case key.forwardSlash_numpad: return dxKey.forwardSlash_numpad; case key.asterisk_numpad: return dxKey.asterisk_numpad; case key.dash_numpad: return dxKey.dash_numpad; case key.plus_numpad: return dxKey.plus_numpad; case key.period_numpad: return dxKey.period_numpad; case key.five_numlock_numpad: return dxKey.five_numlock_numpad; case key.printScreen: return dxKey.printScreen; case key.scrollLock: return dxKey.scrollLock; case key.pauseBreak: return dxKey.pauseBreak; case key.insert: return dxKey.insert; case key.home: return dxKey.home; case key.pageUp: return dxKey.pageUp; case key.delete: return dxKey.delete; case key.end: return dxKey.end; case key.pageDown: return dxKey.pageDown; case key.leftArrow: return dxKey.leftArrow; case key.upArrow: return dxKey.upArrow; case key.rightArrow: return dxKey.rightArrow; case key.downArrow: return dxKey.downArrow; case key.f1: return dxKey.f1; case key.f2: return dxKey.f2; case key.f3: return dxKey.f3; case key.f4: return dxKey.f4; case key.f5: return dxKey.f5; case key.f6: return dxKey.f6; case key.f7: return dxKey.f7; case key.f8: return dxKey.f8; case key.f9: return dxKey.f9; case key.f10: return dxKey.f10; case key.f11: return dxKey.f11; case key.f12: return dxKey.f12; case key.escape: return dxKey.escape; case key.tilde: return dxKey.tilde; case key.one: return dxKey.one; case key.two: return dxKey.two; case key.three: return dxKey.three; case key.four: return dxKey.four; case key.five: return dxKey.five; case key.six: return dxKey.six; case key.seven: return dxKey.seven; case key.eight: return dxKey.eight; case key.nine: return dxKey.nine; case key.zero: return dxKey.zero; case key.dash: return dxKey.dash; case key.equals: return dxKey.equals; case key.backspace: return dxKey.backspace; case key.tab: return dxKey.tab; case key.Q: return dxKey.Q; case key.W: return dxKey.W; case key.E: return dxKey.E; case key.R: return dxKey.R; case key.T: return dxKey.T; case key.Y: return dxKey.Y; case key.U: return dxKey.U; case key.I: return dxKey.I; case key.O: return dxKey.O; case key.P: return dxKey.P; case key.bracket_open: return dxKey.bracket_open; case key.bracket_close: return dxKey.bracket_close; case key.backSlash: return dxKey.backSlash; case key.capsLock: return dxKey.capsLock; case key.A: return dxKey.A; case key.S: return dxKey.S; case key.D: return dxKey.D; case key.F: return dxKey.F; case key.G: return dxKey.G; case key.H: return dxKey.H; case key.J: return dxKey.J; case key.K: return dxKey.K; case key.L: return dxKey.L; case key.semiColon: return dxKey.semiColon; case key.quote: return dxKey.quote; case key.enter: return dxKey.enter; case key.shift_left: return dxKey.shift_left; case key.Z: return dxKey.Z; case key.X: return dxKey.X; case key.C: return dxKey.C; case key.V: return dxKey.V; case key.B: return dxKey.B; case key.N: return dxKey.N; case key.M: return dxKey.M; case key.comma: return dxKey.comma; case key.period: return dxKey.period; case key.forwardSlash: return dxKey.forwardSlash; case key.shift_right: return dxKey.shift_right; case key.control_left: return dxKey.control_left; case key.windows_left: return dxKey.windows_left; case key.alt_left: return dxKey.alt_left; case key.spacebar: return dxKey.spacebar; case key.alt_right: return dxKey.alt_right; case key.windows_right: return dxKey.windows_right; case key.menu: return dxKey.menu; case key.control_right: return dxKey.control_right; default: return dxKey.Null; } }