All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.objectspace.jgl.algorithms.Replacing

java.lang.Object
   |
   +----COM.objectspace.jgl.algorithms.Replacing

public final class Replacing
extends Object
The Replacing class contains generic replacing algorithms.

See Also:
ReplacingExamples

Method Index

 o replace(Container, Object, Object)
Traverse a container and replace every occurrence of a particular object with another.
 o replace(ForwardIterator, ForwardIterator, Object, Object)
Traverse a sequence and replace every occurrence of a particular object with another.
 o replaceCopy(Container, Container, Object, Object)
Copy a container to another container, replacing all occurrences of a particular object with another.
 o replaceCopy(Container, OutputIterator, Object, Object)
Copy a container to a sequence, replacing all occurrences of a particular object with another.
 o replaceCopy(InputIterator, InputIterator, OutputIterator, Object, Object)
Copy one sequence to another of the same size, replacing all occurrences of a particular object with another.
 o replaceCopyIf(Container, Container, UnaryPredicate, Object)
Copy a container to another container, replacing all objects that satisfy a predicate with another.
 o replaceCopyIf(Container, OutputIterator, UnaryPredicate, Object)
Copy a container to a sequence, replacing all objects that satisfy a predicate with another.
 o replaceCopyIf(InputIterator, InputIterator, OutputIterator, UnaryPredicate, Object)
Copy one sequence to another of the same size, replacing all objects that satisfy a predicate with another.
 o replaceIf(Container, UnaryPredicate, Object)
Traverse a container and replace every object that satisfies a predicate with another.
 o replaceIf(ForwardIterator, ForwardIterator, UnaryPredicate, Object)
Traverse a sequence and replace every object that satisfies a predicate with another.

Methods

 o replace
 public static int replace(ForwardIterator first,
                           ForwardIterator last,
                           Object oldValue,
                           Object newValue)
Traverse a sequence and replace every occurrence of a particular object with another. The time complexity is linear and the space complexity is constant.

Parameters:
first - An iterator positioned at the first element of the sequence.
last - An iterator positioned immediately after the last element of the sequence.
oldValue - The object to be replaced.
newValue - The replacement object.
Returns:
The number of objects that were replaced.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o replace
 public static int replace(Container container,
                           Object oldValue,
                           Object newValue)
Traverse a container and replace every occurrence of a particular object with another. The time complexity is linear and the space complexity is constant.

Parameters:
container - The container.
last - An iterator positioned immediately after the last element of the sequence.
oldValue - The object to be replaced.
newValue - The replacement object.
Returns:
The number of objects that were replaced.
 o replaceIf
 public static int replaceIf(ForwardIterator first,
                             ForwardIterator last,
                             UnaryPredicate predicate,
                             Object newValue)
Traverse a sequence and replace every object that satisfies a predicate with another. The time complexity is linear and the space complexity is constant.

Parameters:
first - An iterator positioned at the first element of the sequence.
last - An iterator positioned immediately after the last element of the sequence.
predicate - A unary predicate.
newValue - The replacement object.
Returns:
The number of objects that were replaced.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o replaceIf
 public static int replaceIf(Container container,
                             UnaryPredicate predicate,
                             Object newValue)
Traverse a container and replace every object that satisfies a predicate with another. The time complexity is linear and the space complexity is constant.

Parameters:
container - The container.
predicate - A unary predicate.
newValue - The replacement object.
Returns:
The number of objects that were replaced.
 o replaceCopy
 public static OutputIterator replaceCopy(InputIterator first,
                                          InputIterator last,
                                          OutputIterator result,
                                          Object oldValue,
                                          Object newValue)
Copy one sequence to another of the same size, replacing all occurrences of a particular object with another. The time complexity is linear and the space complexity is constant.

Parameters:
first - An iterator positioned at the first element of the input sequence.
last - An iterator positioned immediately after the last element of the input sequence.
result - An iterator positioned at the first element of the output sequence.
oldValue - The object to be replaced.
newValue - The replacement object.
Returns:
An iterator positioned immediately after the last element of the output sequence.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o replaceCopy
 public static OutputIterator replaceCopy(Container input,
                                          OutputIterator result,
                                          Object oldValue,
                                          Object newValue)
Copy a container to a sequence, replacing all occurrences of a particular object with another. The time complexity is linear and the space complexity is constant.

Parameters:
input - The input container.
result - An iterator positioned at the first element of the output sequence.
oldValue - The object to be replaced.
newValue - The replacement object.
Returns:
An iterator positioned immediately after the last element of the output sequence.
 o replaceCopy
 public static void replaceCopy(Container source,
                                Container destination,
                                Object oldValue,
                                Object newValue)
Copy a container to another container, replacing all occurrences of a particular object with another. The time complexity is linear and the space complexity is constant.

Parameters:
source - The source container.
destination - The destination container.
oldValue - The object to be replaced.
newValue - The replacement object.
 o replaceCopyIf
 public static OutputIterator replaceCopyIf(InputIterator first,
                                            InputIterator last,
                                            OutputIterator result,
                                            UnaryPredicate predicate,
                                            Object newValue)
Copy one sequence to another of the same size, replacing all objects that satisfy a predicate with another. The time complexity is linear and the space complexity is constant.

Parameters:
first - An iterator positioned at the first element of the input sequence.
last - An iterator positioned immediately after the last element of the input sequence.
result - An iterator positioned at the first element of the output sequence.
predicate - A unary predicate.
newValue - The replacement object.
Returns:
An iterator positioned immediately after the last element of the output sequence.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o replaceCopyIf
 public static OutputIterator replaceCopyIf(Container input,
                                            OutputIterator result,
                                            UnaryPredicate predicate,
                                            Object newValue)
Copy a container to a sequence, replacing all objects that satisfy a predicate with another. The time complexity is linear and the space complexity is constant.

Parameters:
input - The input container.
result - An iterator positioned at the first element of the output sequence.
predicate - A unary predicate.
newValue - The replacement object.
Returns:
An iterator positioned immediately after the last element of the output sequence.
 o replaceCopyIf
 public static void replaceCopyIf(Container source,
                                  Container destination,
                                  UnaryPredicate predicate,
                                  Object newValue)
Copy a container to another container, replacing all objects that satisfy a predicate with another. The time complexity is linear and the space complexity is constant.

Parameters:
source - The source container.
destination - The destination container.
predicate - A unary predicate.
newValue - The replacement object.

All Packages  Class Hierarchy  This Package  Previous  Next  Index