コード例 #1
0
        public TInnerRelation Create(RelationBase nParent, RelationBase aParent, out bool isNew)
        {
            //lock (this.innerRelations)
            //{
            TInnerRelation child = this.Get(nParent, aParent);

            isNew = child == null;

            if (isNew)
            {
                child = new TInnerRelation();
                child.Initialize(nParent, aParent);

                Hashtable assocRelations;
                if (this.innerRelations.ContainsKey(nParent.Id))
                {
                    assocRelations = (Hashtable)this.innerRelations[nParent.Id];
                }
                else
                {
                    assocRelations = new Hashtable();
                    this.innerRelations.Add(nParent.Id, assocRelations);
                }
                assocRelations.Add(aParent.Id, child);
            }

            return(child);
            //}
        }
コード例 #2
0
        public RelationBase()
        {
            this.id = RelationBase.GenerateId();
#if WITH_CHILDREN
            this.nChildren = new List <InnerRelation>();
            this.aChildren = new List <InnerRelation>();
#endif
        }
コード例 #3
0
ファイル: TextAssimilator.cs プロジェクト: RalfBarkow/pile
 public string GenerateWithRecursion(RelationBase top)
 {
     if (top is RootRelation)
         return (top as RootRelation).Key;
     else
     {
         InnerRelation iRel = top as InnerRelation;
         return GenerateWithRecursion(iRel.NormParent) + ((RootRelation)iRel.AssocParent).Key;
     }
 }
コード例 #4
0
        internal void Initialize(RelationBase nParent, RelationBase aParent)
        {
            this.nParent = nParent;

            this.aParent = aParent;
#if WITH_CHILDREN
            this.nParent.AddChild(this, true);
            this.aParent.AddChild(this, false);
#endif
        }
コード例 #5
0
ファイル: InnerRelation.cs プロジェクト: RalfBarkow/pile
        internal void Initialize(RelationBase nParent, RelationBase aParent)
        {
            this.nParent = nParent;

            this.aParent = aParent;
            #if WITH_CHILDREN
            this.nParent.AddChild(this, true);
            this.aParent.AddChild(this, false);
            #endif
        }
コード例 #6
0
        public TInnerRelation Get(RelationBase nParent, RelationBase aParent)
        {
            TInnerRelation child = null;
            Hashtable      assocRelations;

            if (this.innerRelations.ContainsKey(nParent.Id))
            {
                assocRelations = (Hashtable)this.innerRelations[nParent.Id];
                if (assocRelations.ContainsKey(aParent.Id))
                {
                    child = (TInnerRelation)assocRelations[aParent.Id];
                }
            }
            return(child);
        }
コード例 #7
0
ファイル: TextAssimilator.cs プロジェクト: RalfBarkow/pile
        public string Generate(RelationBase top)
        {
            StringBuilder text = new StringBuilder();

            do
            {
                if (top is RootRelation)
                    text.Insert(0, (top as RootRelation).Key);
                else
                {
                    InnerRelation inner = top as InnerRelation;
                    text.Insert(0, ((RootRelation)inner.AssocParent).Key);
                    top = inner.NormParent;
                }
            } while (top is InnerRelation);
            text.Insert(0, ((RootRelation)top).Key);

            return text.ToString();
        }
コード例 #8
0
        public TInnerRelation Create(RelationBase nParent, RelationBase aParent)
        {
            bool isNew;

            return(this.Create(nParent, aParent, out isNew));
        }