remove() public method

public remove ( java arg0 ) : bool
arg0 java
return bool
	public static int test() {
		Set<Short> s = new HashSet<Short>();
		for (short i = 0; i < 100; i++) {
			s.add(i);
			s.remove(i - 1);
		}
		return s.size();
	}
Exemplo n.º 2
0
		/**
		 * Report the boundary of a Set of Simplices.
		 * The boundary is a Set of facets where each facet is a Set of vertices.
		 * @return an Iterator for the facets that make up the boundary
		 */
		public static Set boundary(Set simplexSet)
		{
			Set theBoundary = new HashSet();
			for (Iterator it = simplexSet.iterator(); it.hasNext(); )
			{
				Simplex simplex = (Simplex)it.next();
				for (Iterator otherIt = simplex.facets().iterator(); otherIt.hasNext(); )
				{
					Set facet = (Set)otherIt.next();
					if (theBoundary.contains(facet)) theBoundary.remove(facet);
					else theBoundary.add(facet);
				}
			}
			return theBoundary;
		}
Exemplo n.º 3
0
		/* Modification */

		/**
		 * Update by replacing one set of Simplices with another.
		 * Both sets of simplices must fill the same "hole" in the
		 * Triangulation.
		 * @param oldSet set of Simplices to be replaced
		 * @param newSet set of replacement Simplices
		 */
		public void update(Set oldSet,
							Set newSet)
		{
			// Collect all simplices neighboring the oldSet
			Set allNeighbors = new HashSet();
			for (Iterator it = oldSet.iterator(); it.hasNext(); )
				allNeighbors.addAll((Set)_neighbors.get((Simplex)it.next()));
			// Delete the oldSet
			for (Iterator it = oldSet.iterator(); it.hasNext(); )
			{
				Simplex simplex = (Simplex)it.next();
				for (Iterator otherIt = ((Set)_neighbors.get(simplex)).iterator();
					 otherIt.hasNext(); )
					((Set)_neighbors.get(otherIt.next())).remove(simplex);
				_neighbors.remove(simplex);
				allNeighbors.remove(simplex);
			}
			// Include the newSet simplices as possible neighbors
			allNeighbors.addAll(newSet);
			// Create entries for the simplices in the newSet
			for (Iterator it = newSet.iterator(); it.hasNext(); )
				_neighbors.put((Simplex)it.next(), new HashSet());
			// Update all the neighbors info
			for (Iterator it = newSet.iterator(); it.hasNext(); )
			{
				Simplex s1 = (Simplex)it.next();
				for (Iterator otherIt = allNeighbors.iterator(); otherIt.hasNext(); )
				{
					Simplex s2 = (Simplex)otherIt.next();
					if (!s1.isNeighbor(s2)) continue;
					((Set)_neighbors.get(s1)).add(s2);
					((Set)_neighbors.get(s2)).add(s1);
				}
			}
		}
Exemplo n.º 4
0
		/**
		 * Report the facets of this Simplex.
		 * Each facet is a set of vertices.
		 * @return an Iterable for the facets of this Simplex
		 */
		public List facets()
		{
			List theFacets = new java.util.LinkedList();
			for (Iterator it = this.iterator(); it.hasNext(); )
			{
				Object v = it.next();
				Set facet = new HashSet(this);
				facet.remove(v);
				theFacets.add(facet);
			}
			return theFacets;
		}
 static TypeInfo getFixedType(Library typeSystem, Collection<TypeInfo> bounds) {
     var filteredBounds = new HashSet<TypeInfo>(bounds);
     foreach (var ti in bounds) {
         foreach (var tj in bounds) {
             if (!BytecodeHelper.hasImplicitConversion(ti, tj)) {
                 filteredBounds.remove(tj);
             }
         }
     }
     if (filteredBounds.size() != 1) {
         return null;
     } else {
         var result = filteredBounds.single();
         if (result == null) {
             return typeSystem.ObjectType;
         } else {
             return result;
         }
     }
 }