Clone() 공개 메소드

public Clone ( ) : NamespaceList
리턴 NamespaceList
예제 #1
0
        public static NamespaceList Intersection(NamespaceList o1, NamespaceList o2)
        {
            NamespaceList nslist = null;

            if (o1.type == ListType.Any)
            {
                nslist = o2.Clone();
            }
            else if (o2.type == ListType.Any)
            {
                nslist = o1.Clone();
            }
            else if (o1.type == ListType.Other && o2.type == ListType.Other)
            {
                if (o1.targetNamespace == o2.targetNamespace)
                {
                    nslist = o1.Clone();
                }
            }
            else if (o1.type == ListType.Set && o2.type == ListType.Set)
            {
                nslist      = o1.Clone();
                nslist      = new NamespaceList();
                nslist.type = ListType.Set;
                nslist.set  = new Hashtable();
                foreach (string ns in o1.set.Keys)
                {
                    if (o2.set.Contains(ns))
                    {
                        nslist.set.Add(ns, ns);
                    }
                }
            }
            else if (o1.type == ListType.Set && o2.type == ListType.Other)
            {
                nslist = o1.Clone();
                if (nslist.set[o2.targetNamespace] != null)
                {
                    nslist.set.Remove(o2.targetNamespace);
                }
            }
            else if (o2.type == ListType.Set && o1.type == ListType.Other)
            {
                nslist = o2.Clone();
                if (nslist.set[o1.targetNamespace] != null)
                {
                    nslist.set.Remove(o1.targetNamespace);
                }
            }
            return(nslist);
        }
예제 #2
0
        private NamespaceList CompareSetToOther(NamespaceList other)
        {
            //clause 5.1
            NamespaceList nslist = null;

            if (this.set.Contains(other.targetNamespace)) //S contains negated ns
            {
                if (this.set.Contains(string.Empty))      // AND S contains absent
                {
                    nslist = new NamespaceList();         //any is the result
                }
                else                                      //clause 5.2
                {
                    nslist = new NamespaceList("##other", string.Empty);
                }
            }
            else if (this.set.Contains(string.Empty))   //clause 5.3 - Not expressible
            {
                nslist = null;
            }
            else   //clause 5.4 - Set S does not contain negated ns or absent
            {
                nslist = other.Clone();
            }
            return(nslist);
        }
예제 #3
0
        public static NamespaceList Union(NamespaceList o1, NamespaceList o2)
        {
            NamespaceList nslist = null;

            if (o1.type == ListType.Any)
            {
                nslist = new NamespaceList();
            }
            else if (o2.type == ListType.Any)
            {
                nslist = new NamespaceList();
            }
            else if (o1.type == ListType.Other && o2.type == ListType.Other)
            {
                if (o1.targetNamespace == o2.targetNamespace)
                {
                    nslist = o1.Clone();
                }
            }
            else if (o1.type == ListType.Set && o2.type == ListType.Set)
            {
                nslist = o1.Clone();
                foreach (string ns in o2.set.Keys)
                {
                    nslist.set[ns] = ns;
                }
            }
            else if (o1.type == ListType.Set && o2.type == ListType.Other)
            {
                if (o1.set.Contains(o2.targetNamespace))
                {
                    nslist = new NamespaceList();
                }
            }
            else if (o2.type == ListType.Set && o1.type == ListType.Other)
            {
                if (o2.set.Contains(o2.targetNamespace))
                {
                    nslist = new NamespaceList();
                }
                else
                {
                    nslist = o1.Clone();
                }
            }
            return(nslist);
        }
예제 #4
0
 private NamespaceList CompareSetToOther(NamespaceList other)
 {
     if (this.set.Contains(other.targetNamespace))
     {
         if (this.set.Contains(string.Empty))
         {
             return(new NamespaceList());
         }
         return(new NamespaceList("##other", string.Empty));
     }
     if (this.set.Contains(string.Empty))
     {
         return(null);
     }
     return(other.Clone());
 }
예제 #5
0
        public static NamespaceList Intersection(NamespaceList o1, NamespaceList o2, bool v1Compat)
        {
            NamespaceList nslist = null;

            Debug.Assert(o1 != o2);      //clause 1
            if (o1.type == ListType.Any) //clause 2 - o1 is any
            {
                nslist = o2.Clone();
            }
            else if (o2.type == ListType.Any)   //clause 2 - o2 is any
            {
                nslist = o1.Clone();
            }
            else if (o1.type == ListType.Set && o2.type == ListType.Other)   //Clause 3 o2 is other
            {
                nslist = o1.Clone();
                nslist.RemoveNamespace(o2.targetNamespace);
                if (!v1Compat)
                {
                    nslist.RemoveNamespace(string.Empty); //remove ##local
                }
            }
            else if (o1.type == ListType.Other && o2.type == ListType.Set)   //Clause 3 o1 is other
            {
                nslist = o2.Clone();
                nslist.RemoveNamespace(o1.targetNamespace);
                if (!v1Compat)
                {
                    nslist.RemoveNamespace(string.Empty); //remove ##local
                }
            }
            else if (o1.type == ListType.Set && o2.type == ListType.Set)   //clause 4
            {
                nslist      = o1.Clone();
                nslist      = new NamespaceList();
                nslist.type = ListType.Set;
                nslist.set  = new Hashtable();
                foreach (string ns in o1.set.Keys)
                {
                    if (o2.set.Contains(ns))
                    {
                        nslist.set.Add(ns, ns);
                    }
                }
            }
            else if (o1.type == ListType.Other && o2.type == ListType.Other)
            {
                if (o1.targetNamespace == o2.targetNamespace)   //negation of same namespace name
                {
                    nslist = o1.Clone();
                    return(nslist);
                }
                if (!v1Compat)
                {
                    if (o1.targetNamespace == string.Empty)   // clause 6 - o1 is negation of absent
                    {
                        nslist = o2.Clone();
                    }
                    else if (o2.targetNamespace == string.Empty)   //clause 6 - o1 is negation of absent
                    {
                        nslist = o1.Clone();
                    }
                }
                //if it comes here, its not expressible //clause 5
            }
            return(nslist);
        }
예제 #6
0
        public static NamespaceList Union(NamespaceList o1, NamespaceList o2, bool v1Compat)
        {
            NamespaceList nslist = null;

            Debug.Assert(o1 != o2);
            if (o1.type == ListType.Any)   //clause 2 - o1 is Any
            {
                nslist = new NamespaceList();
            }
            else if (o2.type == ListType.Any)   //clause 2 - o2 is Any
            {
                nslist = new NamespaceList();
            }
            else if (o1.type == ListType.Set && o2.type == ListType.Set)   //clause 3 , both are sets
            {
                nslist = o1.Clone();
                foreach (string ns in o2.set.Keys)
                {
                    nslist.set[ns] = ns;
                }
            }
            else if (o1.type == ListType.Other && o2.type == ListType.Other) //clause 4, both are negations
            {
                if (o1.targetNamespace == o2.targetNamespace)                //negation of same value
                {
                    nslist = o1.Clone();
                }
                else                                                     //Not a breaking change, going from not expressible to not(absent)
                {
                    nslist = new NamespaceList("##other", string.Empty); //clause 4, negations of different values, result is not(absent)
                }
            }
            else if (o1.type == ListType.Set && o2.type == ListType.Other)
            {
                if (v1Compat)
                {
                    if (o1.set.Contains(o2.targetNamespace))
                    {
                        nslist = new NamespaceList();
                    }
                    else   //This was not there originally in V1, added for consistency since its not breaking
                    {
                        nslist = o2.Clone();
                    }
                }
                else
                {
                    if (o2.targetNamespace != string.Empty)   //clause 5, o1 is set S, o2 is not(tns)
                    {
                        nslist = o1.CompareSetToOther(o2);
                    }
                    else if (o1.set.Contains(string.Empty))   //clause 6.1 - set S includes absent, o2 is not(absent)
                    {
                        nslist = new NamespaceList();
                    }
                    else   //clause 6.2 - set S does not include absent, result is not(absent)
                    {
                        nslist = new NamespaceList("##other", string.Empty);
                    }
                }
            }
            else if (o2.type == ListType.Set && o1.type == ListType.Other)
            {
                if (v1Compat)
                {
                    if (o2.set.Contains(o2.targetNamespace))
                    {
                        nslist = new NamespaceList();
                    }
                    else
                    {
                        nslist = o1.Clone();
                    }
                }
                else                                        //New rules
                {
                    if (o1.targetNamespace != string.Empty) //clause 5, o1 is set S, o2 is not(tns)
                    {
                        nslist = o2.CompareSetToOther(o1);
                    }
                    else if (o2.set.Contains(string.Empty))   //clause 6.1 - set S includes absent, o2 is not(absent)
                    {
                        nslist = new NamespaceList();
                    }
                    else   //clause 6.2 - set S does not include absent, result is not(absent)
                    {
                        nslist = new NamespaceList("##other", string.Empty);
                    }
                }
            }
            return(nslist);
        }
 public static NamespaceList Intersection(NamespaceList o1, NamespaceList o2, bool v1Compat) {
     NamespaceList nslist = null;
     Debug.Assert(o1 != o2); //clause 1
     if (o1.type == ListType.Any) { //clause 2 - o1 is any
         nslist = o2.Clone();
     }
     else if (o2.type == ListType.Any) { //clause 2 - o2 is any
         nslist = o1.Clone();
     }
     else if (o1.type == ListType.Set && o2.type == ListType.Other) { //Clause 3 o2 is other
         nslist = o1.Clone();
         nslist.RemoveNamespace(o2.targetNamespace);
         if (!v1Compat) {
             nslist.RemoveNamespace(string.Empty); //remove ##local
         }
     }
     else if (o1.type == ListType.Other && o2.type == ListType.Set) { //Clause 3 o1 is other
         nslist = o2.Clone();
         nslist.RemoveNamespace(o1.targetNamespace);
         if (!v1Compat) {
             nslist.RemoveNamespace(string.Empty); //remove ##local
         }
     }
     else if (o1.type == ListType.Set && o2.type == ListType.Set) { //clause 4
         nslist =  o1.Clone();
         nslist = new NamespaceList();
         nslist.type = ListType.Set;
         nslist.set = new Hashtable();
         foreach(string ns in o1.set.Keys) {
             if (o2.set.Contains(ns)) {
                 nslist.set.Add(ns, ns);
             }
         }
     }
     else if (o1.type == ListType.Other && o2.type == ListType.Other) {
         if (o1.targetNamespace == o2.targetNamespace) { //negation of same namespace name
             nslist = o1.Clone();
             return nslist;
         }
         if (!v1Compat) { 
             if (o1.targetNamespace == string.Empty) { // clause 6 - o1 is negation of absent
                 nslist = o2.Clone();
             }
             else if (o2.targetNamespace == string.Empty) { //clause 6 - o1 is negation of absent
                 nslist = o1.Clone();
             }
         }
         //if it comes here, its not expressible //clause 5
     }
     return nslist;
 }
 private NamespaceList CompareSetToOther(NamespaceList other) {
     //clause 5.1
     NamespaceList nslist = null;
     if (this.set.Contains(other.targetNamespace)) { //S contains negated ns
         if (this.set.Contains(string.Empty)) { // AND S contains absent
             nslist = new NamespaceList(); //any is the result
         }
         else { //clause 5.2
             nslist = new NamespaceList("##other", string.Empty);
         }
     }
     else if (this.set.Contains(string.Empty)) { //clause 5.3 - Not expressible
         nslist = null;
     }
     else { //clause 5.4 - Set S does not contain negated ns or absent 
         nslist = other.Clone();
     }
     return nslist;    
 }
 public static NamespaceList Union(NamespaceList o1, NamespaceList o2, bool v1Compat) {
     NamespaceList nslist = null;
     Debug.Assert(o1 != o2);
     if (o1.type == ListType.Any) { //clause 2 - o1 is Any
         nslist = new NamespaceList();
     }
     else if (o2.type == ListType.Any) { //clause 2 - o2 is Any
         nslist = new NamespaceList();
     }
     else if (o1.type == ListType.Set && o2.type == ListType.Set) { //clause 3 , both are sets
         nslist = o1.Clone();
         foreach (string ns in o2.set.Keys) {
             nslist.set[ns] = ns;
         }
     }
     else if (o1.type == ListType.Other && o2.type == ListType.Other) { //clause 4, both are negations
         if (o1.targetNamespace == o2.targetNamespace) { //negation of same value
             nslist = o1.Clone();
         }
         else {
             nslist = new NamespaceList("##other", string.Empty); //clause 4, negations of different values, result is not(absent)
         }
     }
     else if (o1.type == ListType.Set && o2.type == ListType.Other) {
         if (v1Compat) {
             if (o1.set.Contains(o2.targetNamespace)) {
                 nslist = new NamespaceList();
             }
             else { //This was not there originally in V1, added for consistency since its not breaking
                 nslist = o2.Clone();
             }
         }
         else {
             if (o2.targetNamespace != string.Empty) { //clause 5, o1 is set S, o2 is not(tns)
                 nslist = o1.CompareSetToOther(o2); 
             }
             else if (o1.set.Contains(string.Empty)) { //clause 6.1 - set S includes absent, o2 is not(absent) 
                 nslist = new NamespaceList();
             }
             else { //clause 6.2 - set S does not include absent, result is not(absent)
                 nslist = new NamespaceList("##other", string.Empty);
             }
         }
     }
     else if (o2.type == ListType.Set && o1.type == ListType.Other) {
         if (v1Compat) {
             if (o2.set.Contains(o2.targetNamespace)) {
                 nslist = new NamespaceList();
             }
             else {
                 nslist = o1.Clone();
             }
         }
         else { //New rules
             if (o1.targetNamespace != string.Empty) { //clause 5, o1 is set S, o2 is not(tns)
                 nslist = o2.CompareSetToOther(o1); 
             }
             else if (o2.set.Contains(string.Empty)) { //clause 6.1 - set S includes absent, o2 is not(absent) 
                 nslist = new NamespaceList();
             }
             else { //clause 6.2 - set S does not include absent, result is not(absent)
                 nslist = new NamespaceList("##other", string.Empty);
             }
         }
     }
     return nslist;
 }
예제 #10
0
 public static NamespaceList Intersection(NamespaceList o1, NamespaceList o2) { 
     NamespaceList nslist = null;
     if (o1.type == ListType.Any) {
         nslist = o2.Clone();
     }
     else if (o2.type == ListType.Any) {
         nslist = o1.Clone();
     }
     else if (o1.type == ListType.Other && o2.type == ListType.Other) {
         if (o1.targetNamespace == o2.targetNamespace) {
             nslist = o1.Clone();
         }
     }
     else if (o1.type == ListType.Set && o2.type == ListType.Set) {
         nslist =  o1.Clone();
         nslist = new NamespaceList();
         nslist.type = ListType.Set;
         nslist.set = new Hashtable();
         foreach(string ns in o1.set.Keys) {
             if (o2.set.Contains(ns)) {
                 nslist.set.Add(ns, ns);
             }
         }
     }
     else if (o1.type == ListType.Set && o2.type == ListType.Other) {
         nslist = o1.Clone();
         if (nslist.set[o2.targetNamespace] != null) {
             nslist.set.Remove(o2.targetNamespace);
         }
     }
     else if (o2.type == ListType.Set && o1.type == ListType.Other) {
         nslist = o2.Clone();
         if (nslist.set[o1.targetNamespace] != null) {
             nslist.set.Remove(o1.targetNamespace);
         }
     }
     return nslist;
 }
예제 #11
0
 public static NamespaceList Union(NamespaceList o1, NamespaceList o2) {
     NamespaceList nslist = null;
     if (o1.type == ListType.Any) {
         nslist = new NamespaceList();
     }
     else if (o2.type == ListType.Any) {
         nslist = new NamespaceList();
     }
     else if (o1.type == ListType.Other && o2.type == ListType.Other) {
         if (o1.targetNamespace == o2.targetNamespace) {
             nslist = o1.Clone();
         }
     }
     else if (o1.type == ListType.Set && o2.type == ListType.Set) {
         nslist = o1.Clone();
         foreach (string ns in o2.set.Keys) {
             nslist.set[ns] = ns;
         }
     }
     else if (o1.type == ListType.Set && o2.type == ListType.Other) {
         if (o1.set.Contains(o2.targetNamespace)) {
             nslist = new NamespaceList();
         }
     }
     else if (o2.type == ListType.Set && o1.type == ListType.Other) {
         if (o2.set.Contains(o2.targetNamespace)) {
             nslist = new NamespaceList();
         }
         else {
             nslist = o1.Clone();
         }
     }
     return nslist;
 }
 private NamespaceList CompareSetToOther(NamespaceList other)
 {
     if (this.set.Contains(other.targetNamespace))
     {
         if (this.set.Contains(string.Empty))
         {
             return new NamespaceList();
         }
         return new NamespaceList("##other", string.Empty);
     }
     if (this.set.Contains(string.Empty))
     {
         return null;
     }
     return other.Clone();
 }
 public static NamespaceList Union(NamespaceList o1, NamespaceList o2, bool v1Compat)
 {
     NamespaceList list = null;
     if (o1.type == ListType.Any)
     {
         return new NamespaceList();
     }
     if (o2.type == ListType.Any)
     {
         return new NamespaceList();
     }
     if ((o1.type == ListType.Set) && (o2.type == ListType.Set))
     {
         list = o1.Clone();
         foreach (string str in o2.set.Keys)
         {
             list.set[str] = str;
         }
         return list;
     }
     if ((o1.type == ListType.Other) && (o2.type == ListType.Other))
     {
         if (o1.targetNamespace == o2.targetNamespace)
         {
             return o1.Clone();
         }
         return new NamespaceList("##other", string.Empty);
     }
     if ((o1.type == ListType.Set) && (o2.type == ListType.Other))
     {
         if (v1Compat)
         {
             if (o1.set.Contains(o2.targetNamespace))
             {
                 return new NamespaceList();
             }
             return o2.Clone();
         }
         if (o2.targetNamespace != string.Empty)
         {
             return o1.CompareSetToOther(o2);
         }
         if (o1.set.Contains(string.Empty))
         {
             return new NamespaceList();
         }
         return new NamespaceList("##other", string.Empty);
     }
     if ((o2.type != ListType.Set) || (o1.type != ListType.Other))
     {
         return list;
     }
     if (v1Compat)
     {
         if (o2.set.Contains(o2.targetNamespace))
         {
             return new NamespaceList();
         }
         return o1.Clone();
     }
     if (o1.targetNamespace != string.Empty)
     {
         return o2.CompareSetToOther(o1);
     }
     if (o2.set.Contains(string.Empty))
     {
         return new NamespaceList();
     }
     return new NamespaceList("##other", string.Empty);
 }
 public static NamespaceList Intersection(NamespaceList o1, NamespaceList o2, bool v1Compat)
 {
     NamespaceList list = null;
     if (o1.type == ListType.Any)
     {
         return o2.Clone();
     }
     if (o2.type == ListType.Any)
     {
         return o1.Clone();
     }
     if ((o1.type == ListType.Set) && (o2.type == ListType.Other))
     {
         list = o1.Clone();
         list.RemoveNamespace(o2.targetNamespace);
         if (!v1Compat)
         {
             list.RemoveNamespace(string.Empty);
         }
         return list;
     }
     if ((o1.type == ListType.Other) && (o2.type == ListType.Set))
     {
         list = o2.Clone();
         list.RemoveNamespace(o1.targetNamespace);
         if (!v1Compat)
         {
             list.RemoveNamespace(string.Empty);
         }
         return list;
     }
     if ((o1.type == ListType.Set) && (o2.type == ListType.Set))
     {
         list = o1.Clone();
         list = new NamespaceList {
             type = ListType.Set,
             set = new Hashtable()
         };
         foreach (string str in o1.set.Keys)
         {
             if (o2.set.Contains(str))
             {
                 list.set.Add(str, str);
             }
         }
         return list;
     }
     if ((o1.type == ListType.Other) && (o2.type == ListType.Other))
     {
         if (o1.targetNamespace == o2.targetNamespace)
         {
             return o1.Clone();
         }
         if (v1Compat)
         {
             return list;
         }
         if (o1.targetNamespace == string.Empty)
         {
             return o2.Clone();
         }
         if (o2.targetNamespace == string.Empty)
         {
             list = o1.Clone();
         }
     }
     return list;
 }
예제 #15
0
        public static NamespaceList Union(NamespaceList o1, NamespaceList o2, bool v1Compat)
        {
            NamespaceList list = null;

            if (o1.type == ListType.Any)
            {
                return(new NamespaceList());
            }
            if (o2.type == ListType.Any)
            {
                return(new NamespaceList());
            }
            if ((o1.type == ListType.Set) && (o2.type == ListType.Set))
            {
                list = o1.Clone();
                foreach (string str in o2.set.Keys)
                {
                    list.set[str] = str;
                }
                return(list);
            }
            if ((o1.type == ListType.Other) && (o2.type == ListType.Other))
            {
                if (o1.targetNamespace == o2.targetNamespace)
                {
                    return(o1.Clone());
                }
                return(new NamespaceList("##other", string.Empty));
            }
            if ((o1.type == ListType.Set) && (o2.type == ListType.Other))
            {
                if (v1Compat)
                {
                    if (o1.set.Contains(o2.targetNamespace))
                    {
                        return(new NamespaceList());
                    }
                    return(o2.Clone());
                }
                if (o2.targetNamespace != string.Empty)
                {
                    return(o1.CompareSetToOther(o2));
                }
                if (o1.set.Contains(string.Empty))
                {
                    return(new NamespaceList());
                }
                return(new NamespaceList("##other", string.Empty));
            }
            if ((o2.type != ListType.Set) || (o1.type != ListType.Other))
            {
                return(list);
            }
            if (v1Compat)
            {
                if (o2.set.Contains(o2.targetNamespace))
                {
                    return(new NamespaceList());
                }
                return(o1.Clone());
            }
            if (o1.targetNamespace != string.Empty)
            {
                return(o2.CompareSetToOther(o1));
            }
            if (o2.set.Contains(string.Empty))
            {
                return(new NamespaceList());
            }
            return(new NamespaceList("##other", string.Empty));
        }
예제 #16
0
        public static NamespaceList Intersection(NamespaceList o1, NamespaceList o2, bool v1Compat)
        {
            NamespaceList list = null;

            if (o1.type == ListType.Any)
            {
                return(o2.Clone());
            }
            if (o2.type == ListType.Any)
            {
                return(o1.Clone());
            }
            if ((o1.type == ListType.Set) && (o2.type == ListType.Other))
            {
                list = o1.Clone();
                list.RemoveNamespace(o2.targetNamespace);
                if (!v1Compat)
                {
                    list.RemoveNamespace(string.Empty);
                }
                return(list);
            }
            if ((o1.type == ListType.Other) && (o2.type == ListType.Set))
            {
                list = o2.Clone();
                list.RemoveNamespace(o1.targetNamespace);
                if (!v1Compat)
                {
                    list.RemoveNamespace(string.Empty);
                }
                return(list);
            }
            if ((o1.type == ListType.Set) && (o2.type == ListType.Set))
            {
                list = o1.Clone();
                list = new NamespaceList {
                    type = ListType.Set,
                    set  = new Hashtable()
                };
                foreach (string str in o1.set.Keys)
                {
                    if (o2.set.Contains(str))
                    {
                        list.set.Add(str, str);
                    }
                }
                return(list);
            }
            if ((o1.type == ListType.Other) && (o2.type == ListType.Other))
            {
                if (o1.targetNamespace == o2.targetNamespace)
                {
                    return(o1.Clone());
                }
                if (v1Compat)
                {
                    return(list);
                }
                if (o1.targetNamespace == string.Empty)
                {
                    return(o2.Clone());
                }
                if (o2.targetNamespace == string.Empty)
                {
                    list = o1.Clone();
                }
            }
            return(list);
        }