public Derived(string message)
    {
        Type     type = typeof(Ancestor);
        Ancestor a    = (Ancestor)this;

        type.GetProperty("Property").SetMethod.Invoke(a, new[] { message });
    }
Exemple #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ProjectId.Length != 0)
            {
                hash ^= ProjectId.GetHashCode();
            }
            if (IndexId.Length != 0)
            {
                hash ^= IndexId.GetHashCode();
            }
            if (Kind.Length != 0)
            {
                hash ^= Kind.GetHashCode();
            }
            if (Ancestor != global::Google.Cloud.Datastore.Admin.V1.Index.Types.AncestorMode.Unspecified)
            {
                hash ^= Ancestor.GetHashCode();
            }
            hash ^= properties_.GetHashCode();
            if (State != global::Google.Cloud.Datastore.Admin.V1.Index.Types.State.Unspecified)
            {
                hash ^= State.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemple #3
0
        //...

        public Source(PropertyGrid.Element input, Ancestor ancestor)
        {
            Parent = ancestor;
            Items  = input.Values;

            Type = Count > 1 ? SharesWith(Types) : First.GetType();
            Type = Type.Equals(typeof(object)) ? null : Type; //No anonymous objects
        }
 public AttributeFieldMap FindIdentField(string name)
 {
     return
         (Fields.FirstOrDefault(
              f =>
              f.AttrDefId == Guid.Empty &&
              String.Equals(f.FieldName, name, StringComparison.OrdinalIgnoreCase)) ??
          (Ancestor != null ? Ancestor.FindIdentField(name) : null));
 }
Exemple #5
0
 public void Dispose()
 {
     if (_observer != null)
     {
         _observer.Dispose();
     }
     if (Ancestor != null)
     {
         Ancestor.Dispose();
     }
 }
        public override int GetHashCode()
        {
            int hash = 17;

            unchecked
            {
                hash = 23 * hash + (Ancestor?.GetHashCode() ?? 0);
                hash = 23 * hash + (ScopedX?.GetHashCode() ?? 0);
                hash = 23 * hash + (ScopedY?.GetHashCode() ?? 0);
            }

            return(hash);
        }
Exemple #7
0
    public Ancestor(Ancestor parent, Player player)
    {
        this.parent = parent;

        if (parent != null)
        {
            parent.setChild(this);
        }

        firstName        = player.firstName;
        lastName         = player.lastName;
        spriteController = player.getSpriteController();

        revengeTarget = new RevengeTarget((Enemy)player.getAttacker());
    }
        public override IEnumerable <KeyValuePair <string, TypeInformation[]> > Members()
        {
            foreach (KeyValuePair <string, TypeInformation[]> member in _scope)
            {
                yield return(member);
            }

            if (Ancestor != null)
            {
                foreach (KeyValuePair <string, TypeInformation[]> member in Ancestor.Members())
                {
                    yield return(member);
                }
            }
        }
Exemple #9
0
    /// <summary>
    /// Takes an enemy, and if they are a previous revenge target, it sets them to dead
    /// </summary>
    /// <param name="enemy"></param>
    public void killRevengeTarget(Enemy enemy)
    {
        Ancestor      an = this;
        RevengeTarget rt = new RevengeTarget(enemy);

        while (an != null)
        {
            if (an.revengeTarget != null && an.revengeTarget.equals(rt))
            {
                an.revengeTarget.dead = true;
                return;
            }

            an = an.parent;
        }
    }
Exemple #10
0
 protected virtual void Dispose(bool disposing)
 {
     if (_disposed)
     {
         return;
     }
     if (disposing)
     {
         Uninstall();
         if (DisposeAncestor == DisposeAncestor.Yes)
         {
             Ancestor?.Dispose();
         }
         //TODO ancestor is not set in constructor and wont be disposed, but can break existing functionality, must be analyzed!
     }
     _disposed = true;
     //base.Dispose(disposing);
 }
 public List <TaxonomySitemapItem> GetSitemapSubtree(ContentNamespace ns, int publicationId, string taxonomyNodeId,
                                                     int descendantLevels, Ancestor ancestor,
                                                     IContextData contextData)
 {
     try
     {
         var response =
             _client.Execute <ContentQuery>(GraphQLRequests.SitemapSubtree(ns, publicationId, taxonomyNodeId,
                                                                           descendantLevels, ancestor, contextData, GlobalContextDataInternal));
         return(response.TypedResponseData.SitemapSubtree);
     }
     catch (RuntimeBinderException e)
     {
         throw new ApiException(
                   $"Failed to get sitemap subtree (namespaceId:{ns}, publicationId:{publicationId}, taxonomyNodeId{taxonomyNodeId}, descendantLevels:{descendantLevels}",
                   e);
     }
 }
Exemple #12
0
        public static IGraphQLRequest SitemapSubtree(ContentNamespace ns, int publicationId, string taxonomyNodeId,
                                                     int descendantLevels, Ancestor ancestor,
                                                     IContextData contextData, IContextData globalContextData)
        {
            QueryBuilder builder =
                new QueryBuilder().WithQueryResource(
                    descendantLevels == 0 ? "SitemapSubtreeNoRecurse" : "SitemapSubtree", true);

            return
                (builder.WithNamespace(ns)
                 .WithPublicationId(publicationId)
                 .WithVariable("taxonomyNodeId", taxonomyNodeId)
                 .WithVariable("ancestor", ancestor)
                 .WithContextData(contextData)
                 .WithContextData(globalContextData)
                 .WithDescendantLevels(descendantLevels)
                 .WithConvertor(new TaxonomyItemConvertor())
                 .Build());
        }
Exemple #13
0
	void Start()
	{
		//_ancestor = FindObjectOfType<Ancestor>();
		foreach(Ancestor ancestor in FindObjectsOfType<Ancestor>())
		{
			if (ancestor._isPlayer==true)
			{
				_ancestor = ancestor;
			}
		}
		_ancestor.PassUI(this);
		_hero = FindObjectOfType<HeroController>();
		_hero.PassUI(this);
		_enemy = FindObjectOfType<EnemyController>();
		_enemy.PassUI(this);
		_enemyManager = FindObjectOfType<EnemyManager>();
		_enemyManager.PassUI(this);

		VictoryScreen.SetActive (false);
		LossScreen.SetActive (false);
		
		//_intervalIndicator.value = 0;
		_heroHealth.value = 1;
		_enemyHealth.value = 1;
		
		_playerIcon.transform.FindChild("Icon").GetComponent<UnityEngine.UI.Image>().sprite = _ancestor._ancestorIcon;
		_playerIcon.transform.FindChild("Background").GetComponent<UnityEngine.UI.Image>().sprite = _ancestor._ancestorBg;
		_button1.transform.FindChild("Icon").GetComponent<UnityEngine.UI.Image>().sprite = _ancestor._action1._actionIcon;
		_button1.transform.FindChild("Background").GetComponent<UnityEngine.UI.Image>().sprite = _ancestor._ancestorBg;
		_button2.transform.FindChild("Icon").GetComponent<UnityEngine.UI.Image>().sprite = _ancestor._action2._actionIcon;
		_button2.transform.FindChild("Background").GetComponent<UnityEngine.UI.Image>().sprite = _ancestor._ancestorBg;
		_button3.transform.FindChild("Icon").GetComponent<UnityEngine.UI.Image>().sprite = _ancestor._action3._actionIcon;
		_button3.transform.FindChild("Background").GetComponent<UnityEngine.UI.Image>().sprite = _ancestor._ancestorBg;
		ExitButton.transform.FindChild("Background").GetComponent<UnityEngine.UI.Image>().sprite = _ancestor._ancestorBg;



	}
Exemple #14
0
        public bool TryAddAncestor(Primitive type)
        {
            if (type == null)
            {
                return(true);
            }

            if (Ancestor == null)
            {
                Ancestor = type;
            }
            else
            {
                var res = Ancestor.GetFirstCommonDescendantOrNull(type);
                if (res == null)
                {
                    return(false);
                }
                Ancestor = res;
            }

            return(true);
        }
Exemple #15
0
    public void playerDied(Player player)
    {
        player.bag.closeBag();

        //Turn off Boss UI in case its on
        UIManager.instance.closeBossGUI();

        CameraFollow.screenLocked = false;

        MusicManager.instance.resetDeath();

        zoomIn(player.getAttacker().transform);

        //Craete a new Ancestor
        tailAncestor = new Ancestor(tailAncestor, player);

        if (headAncestor == null)
        {
            headAncestor = tailAncestor;
        }

        Invoke("deathScreen", respawnTime / 2 * Time.timeScale);
    }
        public override TypeInformation[] FindSymbol(string symbol)
        {
            if (_scope == null)
            {
                return(null);
            }

            //SLOW! Lots of copying from array to array. Why did we not just return IEnumerable<TypeInformation>?
            TypeInformation[] self;
            _scope.TryGetValue(symbol, out self);

            TypeInformation[] ancestots = Ancestor?.FindSymbol(symbol);

            //If not null, add lenght
            int lenght = self?.Length ?? 0 + ancestots?.Length ?? 0;

            //Seems most others return null in case of no match, keeping consistent
            if (lenght == 0)
            {
                return(null);
            }

            TypeInformation[] all = new TypeInformation[lenght];

            if (self != null)
            {
                Array.Copy(self, all, self.Length);
            }

            if (ancestots != null)
            {
                Array.Copy(ancestots, 0, all, self?.Length ?? 0, ancestots.Length);
            }

            return(all);
        }
Exemple #17
0
        //internal List<MediaQuery> MediaQueries { get; set; }

        internal bool MatchesStyleClient(IStyleClient client)
        {
            bool match = false;

            //CSSCondition condition = null;

            // If we have an ancestor then this is part of a descendant selector
            if (null != Ancestor)
            {
                if (null != Conditions)
                {
                    // First, test if the conditions match
                    foreach (CSSCondition condition in Conditions)
                    {
                        match = condition.MatchesStyleClient(client);
                        if (!match)
                        {
                            return(false);
                        }
                    }
                }

                // Then reset and test if any ancestor matches
                match = false;
                IStyleClient parent = client.StyleParent;
                while (parent != null)
                {
                    if (parent.MatchesCSSType(Ancestor.Subject) ||
                        "*" == Ancestor.Subject)
                    {
                        match = Ancestor.MatchesStyleClient(parent);
                        if (match)
                        {
                            break;
                        }
                    }
                    parent = parent.StyleParent;
                }
            }
            else
            {
                // Check the type selector matches
                if (Subject == "*" || Subject == "" || client.MatchesCSSType(Subject))
                {
                    match = true;
                }

                // Then check if any conditions match
                if (match && Conditions != null)
                {
                    foreach (CSSCondition condition in Conditions)
                    {
                        match = condition.MatchesStyleClient(client);
                        if (!match)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(match);
        }
 public override IEnumerable <KeyValuePair <string, TypeInformation[]> > Members() => Ancestor.Members();
 public override TypeInformation[] FindSymbol(string symbol) => Ancestor.FindSymbol(symbol);
Exemple #20
0
 public void setChild(Ancestor child)
 {
     this.child = child;
 }
Exemple #21
0
 public Ancestor(Macro macro, Ancestor parent)
 {
     m_macro  = macro;
     m_parent = parent;
 }
        private IBitMatrix CompactMatrix()
        {
            var deletedRows = new bool[matrix.Rows];
            var deletedCols = new bool[matrix.Cols];

            ancestors = new Ancestor[matrix.Cols];
            for (int i = 0; i < matrix.Cols; i++)
            {
                ancestors[i] = new Ancestor {
                    Column = i
                }
            }
            ;
            if (diagnostics)
            {
                Console.WriteLine("initial density = {0:F3}/col", (double)matrix.GetRowWeights().Sum() / matrix.Rows);
            }

            int surplusCols = 0;
            int pass        = 1;

            while (true)
            {
                int deleted = 0;
                for (int n = matrix.Rows - 1; n >= 0; n--)
                {
                    if (deletedRows[n])
                    {
                        continue;
                    }
                    var weight = matrix.GetRowWeight(n);

                    // Delete entirely empty rows.
                    if (weight == 0)
                    {
                        deletedRows[n] = true;
                        ++surplusCols;
                        ++deleted;
                        continue;
                    }

                    // Delete rows with a single non-zero entry.
                    if (weight == 1)
                    {
                        var col = matrix.GetNonZeroCols(n).First();
                        deletedRows[n] = true;
                        MergeColumns(col);
                        deletedCols[col] = true;
                        ++deleted;
                        continue;
                    }

                    // Use surplus rows to bring weight down to merge limit.
                    int limit = Math.Min(pass, mergeLimit);
                    if (weight > limit && surplusCols > 0 && weight - surplusCols <= limit)
                    {
                        while (weight > limit)
                        {
                            var col = matrix.GetNonZeroCols(n)
                                      .OrderByDescending(index => matrix.GetColWeight(index))
                                      .First();
                            MergeColumns(col);
                            deletedCols[col] = true;
                            ++deleted;
                            --surplusCols;
                            --weight;
                        }
                    }

                    // Merge low weight rows.
                    if (weight <= limit)
                    {
                        var cols = matrix.GetNonZeroCols(n)
                                   .OrderByDescending(index => matrix.GetColWeight(index))
                                   .ToArray();
                        Debug.Assert(cols.Length == weight);
                        var srcCol = cols[0];
                        MergeColumns(cols);
                        for (var ancestor = ancestors[srcCol]; ancestor != null; ancestor = ancestor.Next)
                        {
                            for (int j = 1; j < weight; j++)
                            {
                                ancestors[cols[j]] = new Ancestor {
                                    Column = ancestor.Column, Next = ancestors[cols[j]]
                                }
                            }
                            ;
                        }
                        deletedRows[n]      = true;
                        ancestors[srcCol]   = null;
                        deletedCols[srcCol] = true;
                        ++deleted;
                        continue;
                    }
                }

                if (diagnostics)
                {
                    Console.WriteLine("pass {0}: deleted {1} rows", pass, deleted);
                }
                if (deleted == 0)
                {
                    break;
                }
                ++pass;
            }

            // Compute mapping between original matrix and compact matrix.
            ancestors = deletedCols
                        .Select((deleted, index) => deleted ? null : ancestors[index])
                        .Where(ancestor => ancestor != null)
                        .ToArray();
            var rowMap = deletedRows
                         .Select((deleted, index) => deleted ? -1 : index)
                         .Where(index => index != -1)
                         .ToArray();
            var colMap = deletedCols
                         .Select((deleted, index) => deleted ? -1 : index)
                         .Where(index => index != -1)
                         .ToArray();

            // Permute columns to sort by increasing column weight.
            var order = Enumerable.Range(0, colMap.Length)
                        .OrderBy(index => matrix.GetColWeight(colMap[index]))
                        .ToArray();

            ancestors = Enumerable.Range(0, colMap.Length)
                        .Select(index => ancestors[order[index]])
                        .ToArray();
            colMap = Enumerable.Range(0, colMap.Length)
                     .Select(index => colMap[order[index]])
                     .ToArray();

            // Create compact matrix.
            var revColMap = new int[matrix.Cols];

            for (int i = 0; i < colMap.Length; i++)
            {
                revColMap[colMap[i]] = i;
            }
            var compactMatrix = (IBitMatrix)Activator.CreateInstance(typeof(TMatrix), rowMap.Length, colMap.Length);

            for (int i = 0; i < rowMap.Length; i++)
            {
                int row = rowMap[i];
                foreach (var col in matrix.GetNonZeroCols(row))
                {
                    compactMatrix[i, revColMap[col]] = true;
                }
            }

            if (diagnostics)
            {
                Console.WriteLine("completed compaction in {0} passes", pass);
                Console.WriteLine("final density = {0:F3}/col", (double)matrix.GetRowWeights().Sum() / compactMatrix.Rows);
            }

            return(compactMatrix);
        }
 public AttributeFieldMap FindField(Guid id)
 {
     return(Fields.FirstOrDefault(f => f.AttrDefId == id) ?? (Ancestor != null ? Ancestor.FindField(id) : null));
 }
Exemple #24
0
 public override int GetHashCode()
 {
     return(Ancestor.GetHashCode());
 }
Exemple #25
0
        public void CanConvertAncestorToDescendant()
        {
            var ancestor = new Ancestor();

            CanConvert <Descendant>(ancestor, ancestor);
        }
Exemple #26
0
 internal static extern IntPtr GetAncestor(IntPtr hwnd, Ancestor flags);
        public async Task <List <TaxonomySitemapItem> > GetSitemapSubtreeAsync(ContentNamespace ns, int publicationId,
                                                                               string taxonomyNodeId, int descendantLevels, Ancestor ancestor,
                                                                               IContextData contextData, CancellationToken cancellationToken = default(CancellationToken))
        {
            try
            {
                var response =
                    await
                    _client.ExecuteAsync(
                        GraphQLRequests.SitemapSubtree(ns, publicationId, taxonomyNodeId, descendantLevels,
                                                       ancestor, contextData, GlobalContextDataInternal), cancellationToken)
                    .ConfigureAwait(false);

                return(response.Data.sitemapSubtree);
            }
            catch (RuntimeBinderException e)
            {
                throw new ApiException(
                          $"Failed to get sitemap subtree (namespaceId:{ns}, publicationId:{publicationId}, taxonomyNodeId{taxonomyNodeId}, descendantLevels:{descendantLevels}",
                          e);
            }
        }