/// <summary> /// Retains the elements in the target collection that are contained in the specified collection /// </summary> /// <param name="target">Collection where the elements will be removed.</param> /// <param name="c">Elements to be retained in the target collection.</param> /// <returns>true</returns> public static bool RetainAll(System.Collections.ICollection target, System.Collections.ICollection c) { System.Collections.IEnumerator e = new System.Collections.ArrayList(target).GetEnumerator(); System.Collections.ArrayList al = new System.Collections.ArrayList(c); //Reflection. Invoke "retainAll" method for proprietary classes or "Remove" for each element in the collection System.Reflection.MethodInfo method; try { method = c.GetType().GetMethod("retainAll"); if (method != null) { method.Invoke(target, new Object[] { c }); } else { method = c.GetType().GetMethod("Remove"); while (e.MoveNext() == true) { if (al.Contains(e.Current) == false) { method.Invoke(target, new Object[] { e.Current }); } } } } catch (Exception ex) { throw ex; } return(true); }
/// <summary> /// Adds all of the elements of the "c" collection to the "target" collection. /// </summary> /// <param name="target">Collection where the new elements will be added.</param> /// <param name="c">Collection whose elements will be added.</param> /// <returns>Returns true if at least one element was added, false otherwise.</returns> public static bool AddAll(System.Collections.ICollection target, System.Collections.ICollection c) { System.Collections.IEnumerator e = new System.Collections.ArrayList(c).GetEnumerator(); bool added = false; //Reflection. Invoke "addAll" method for proprietary classes System.Reflection.MethodInfo method; try { method = target.GetType().GetMethod("addAll"); if (method != null) { added = (bool)method.Invoke(target, new Object[] { c }); } else { method = target.GetType().GetMethod("Add"); while (e.MoveNext() == true) { bool tempBAdded = (int)method.Invoke(target, new Object[] { e.Current }) >= 0; added = added ? added : tempBAdded; } } } catch (Exception ex) { throw ex; } return(added); }
/// <summary>(non-Javadoc)</summary> /// <seealso cref="org.javarosa.core.services.properties.IPropertyRules.allowableProperties()"> /// </seealso> public virtual System.Collections.ArrayList allowableProperties() { System.Collections.ArrayList propList = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)); //UPGRADE_TODO: Method 'java.util.HashMap.keySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapkeySet'" System.Collections.IEnumerator iter = new System.Collections.ArrayList(rules.Keys).GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'" while (iter.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'" propList.Add(iter.Current); } return(propList); }
/// <summary> /// Adds all the elements of the specified collection that are not present to the list. /// </summary> /// <param name="c">Collection where the new elements will be added</param> /// <returns>Returns true if at least one element was added, false otherwise.</returns> public bool AddAll(System.Collections.ICollection c) { System.Collections.IEnumerator e = new System.Collections.ArrayList(c).GetEnumerator(); bool added = false; while (e.MoveNext() == true) { if (this.Add(e.Current) == true) added = true; } return added; }
/// <summary> /// Removes all the elements contained into the specified collection. /// </summary> /// <param name="collection">The collection used to extract the elements that will be removed.</param> /// <returns>Returns true if all the elements were successfuly removed. Otherwise returns false.</returns> public virtual bool RemoveAll(System.Collections.ICollection collection) { bool result = false; System.Collections.IEnumerator tempEnumerator = new System.Collections.ArrayList(collection).GetEnumerator(); while (tempEnumerator.MoveNext()) { if (this.Contains(tempEnumerator.Current)) { result = this.Remove(tempEnumerator.Current); } } return(result); }
/// <summary>(non-Javadoc)</summary> /// <seealso cref="org.javarosa.core.services.properties.IPropertyRules.checkPropertyAllowed)"> /// </seealso> public virtual bool checkPropertyAllowed(System.String propertyName) { //UPGRADE_TODO: Method 'java.util.HashMap.keySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapkeySet'" System.Collections.IEnumerator iter = new System.Collections.ArrayList(rules.Keys).GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'" while (iter.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'" if (propertyName.Equals(iter.Current)) { return(true); } } return(false); }
/// <summary> /// Adds all the elements of the specified collection that are not present to the list. /// </summary> /// <param name="c">Collection where the new elements will be added</param> /// <returns>Returns true if at least one element was added, false otherwise.</returns> public bool AddAll(System.Collections.ICollection c) { System.Collections.IEnumerator e = new System.Collections.ArrayList(c).GetEnumerator(); bool added = false; while (e.MoveNext() == true) { if (Add(e.Current) == true) { added = true; } } return(added); }
/// <summary> /// Adds all the elements contained in the specified collection. /// </summary> /// <param name="collection">The collection used to extract the elements that will be added.</param> /// <returns>Returns true if all the elements were successfuly added. Otherwise returns false.</returns> public virtual bool AddAll(System.Collections.ICollection collection) { bool result = false; if (collection != null) { System.Collections.IEnumerator tempEnumerator = new System.Collections.ArrayList(collection).GetEnumerator(); while (tempEnumerator.MoveNext()) { if (tempEnumerator.Current != null) { result = this.Add(tempEnumerator.Current); } } } return(result); }
/// <summary> /// Adds all of the elements of the "c" collection to the "target" collection. /// </summary> /// <param gridTemplateName="target">Collection where the new elements will be added.</param> /// <param gridTemplateName="c">Collection whose elements will be added.</param> /// <returns>Returns true if at least one element was added, false otherwise.</returns> public static bool AddAll(System.Collections.ICollection target, System.Collections.ICollection c) { System.Collections.IEnumerator e = new System.Collections.ArrayList(c).GetEnumerator(); bool added = false; //Reflection. Invoke "addAll" method for proprietary classes System.Reflection.MethodInfo method; try { method = target.GetType().GetMethod("addAll"); if (method != null) added = (bool) method.Invoke(target, new System.Object[] {c}); else { method = target.GetType().GetMethod("Add"); while (e.MoveNext() == true) { bool tempBAdded = (int) method.Invoke(target, new System.Object[] {e.Current}) >= 0; added = added ? added : tempBAdded; } } } catch (System.Exception ex) { throw ex; } return added; }
/// <summary> /// Retains the elements in the target collection that are contained in the specified collection /// </summary> /// <param gridTemplateName="target">Collection where the elements will be removed.</param> /// <param gridTemplateName="c">Elements to be retained in the target collection.</param> /// <returns>true</returns> public static bool RetainAll(System.Collections.ICollection target, System.Collections.ICollection c) { System.Collections.IEnumerator e = new System.Collections.ArrayList(target).GetEnumerator(); System.Collections.ArrayList al = new System.Collections.ArrayList(c); //Reflection. Invoke "retainAll" method for proprietary classes or "Remove" for each element in the collection System.Reflection.MethodInfo method; try { method = c.GetType().GetMethod("retainAll"); if (method != null) method.Invoke(target, new System.Object[] {c}); else { method = c.GetType().GetMethod("Remove"); while (e.MoveNext() == true) { if (al.Contains(e.Current) == false) method.Invoke(target, new System.Object[] {e.Current}); } } } catch (System.Exception ex) { throw ex; } return true; }
/// <summary> /// Adds all the elements contained in the specified collection. /// </summary> /// <param name="collection">The collection used to extract the elements that will be added.</param> /// <returns>Returns true if all the elements were successfuly added. Otherwise returns false.</returns> public virtual bool AddAll(System.Collections.ICollection collection) { bool result = false; if (collection!=null) { System.Collections.IEnumerator tempEnumerator = new System.Collections.ArrayList(collection).GetEnumerator(); while (tempEnumerator.MoveNext()) { if (tempEnumerator.Current != null) result = this.Add(tempEnumerator.Current); } } return result; }
/// <summary> /// Removes all the elements contained into the specified collection. /// </summary> /// <param name="collection">The collection used to extract the elements that will be removed.</param> /// <returns>Returns true if all the elements were successfuly removed. Otherwise returns false.</returns> public virtual bool RemoveAll(System.Collections.ICollection collection) { bool result = false; System.Collections.IEnumerator tempEnumerator = new System.Collections.ArrayList(collection).GetEnumerator(); while (tempEnumerator.MoveNext()) { if (this.Contains(tempEnumerator.Current)) result = this.Remove(tempEnumerator.Current); } return result; }
/// <summary> /// Verifies if all the elements of the specified collection are contained into the current collection. /// </summary> /// <param name="collection">The collection used to extract the elements that will be verified.</param> /// <returns>Returns true if all the elements are contained in the collection. Otherwise returns false.</returns> public virtual bool ContainsAll(System.Collections.ICollection collection) { bool result = false; System.Collections.IEnumerator tempEnumerator = new System.Collections.ArrayList(collection).GetEnumerator(); while (tempEnumerator.MoveNext()) if (!(result = this.Contains(tempEnumerator.Current))) break; return result; }