Tabnine Logo
FunctionList.setReverseFunction
Code IndexAdd Tabnine to your IDE (free)

How to use
setReverseFunction
method
in
ca.odell.glazedlists.FunctionList

Best Java code snippets using ca.odell.glazedlists.FunctionList.setReverseFunction (Showing top 3 results out of 315)

origin: net.java.dev.glazedlists/glazedlists_java16

/**
 * Construct a {@link FunctionList} which stores the result of transforming
 * each source element using the given forward {@link Function}. If the
 * reverse {@link Function} is not null, {@link #add(Object)},
 * {@link #add(int, Object)} and {@link #set(int, Object)} will execute
 * as expected.
 *
 * <p> Note: an {@link AdvancedFunction} can be specified for the forward
 * {@link Function} which allows the implementor a chance to examine the
 * prior value that was mapped to a source element when it must be remapped
 * due to a modification (from a call to {@link List#set}).
 *
 * @param source the EventList to decorate with a function transformation
 * @param forward the function to execute on each source element
 * @param reverse the function to map elements of FunctionList back to
 *      element values in the source list
 */
public FunctionList(EventList<S> source, Function<S,E> forward, Function<E,S> reverse) {
  super(source);
  updateForwardFunction(forward);
  setReverseFunction(reverse);
  // save a reference to the source elements
  this.sourceElements = new ArrayList<S>(source);
  // map all of the elements within source
  this.mappedElements = new ArrayList<E>(source.size());
  for (int i = 0, n = source.size(); i < n; i++) {
    this.mappedElements.add(forward(source.get(i)));
  }
  source.addListEventListener(this);
}
origin: net.java.dev.glazedlists/glazedlists_java15

/**
 * Construct a {@link FunctionList} which stores the result of transforming
 * each source element using the given forward {@link Function}. If the
 * reverse {@link Function} is not null, {@link #add(Object)},
 * {@link #add(int, Object)} and {@link #set(int, Object)} will execute
 * as expected.
 *
 * <p> Note: an {@link AdvancedFunction} can be specified for the forward
 * {@link Function} which allows the implementor a chance to examine the
 * prior value that was mapped to a source element when it must be remapped
 * due to a modification (from a call to {@link List#set}).
 *
 * @param source the EventList to decorate with a function transformation
 * @param forward the function to execute on each source element
 * @param reverse the function to map elements of FunctionList back to
 *      element values in the source list
 */
public FunctionList(EventList<S> source, Function<S,E> forward, Function<E,S> reverse) {
  super(source);
  updateForwardFunction(forward);
  setReverseFunction(reverse);
  // save a reference to the source elements
  this.sourceElements = new ArrayList<S>(source);
  // map all of the elements within source
  this.mappedElements = new ArrayList<E>(source.size());
  for (int i = 0, n = source.size(); i < n; i++) {
    this.mappedElements.add(forward(source.get(i)));
  }
  source.addListEventListener(this);
}
origin: com.haulmont.thirdparty/glazedlists

/**
 * Construct a {@link FunctionList} which stores the result of transforming
 * each source element using the given forward {@link Function}. If the
 * reverse {@link Function} is not null, {@link #add(Object)},
 * {@link #add(int, Object)} and {@link #set(int, Object)} will execute
 * as expected.
 *
 * <p> Note: an {@link AdvancedFunction} can be specified for the forward
 * {@link Function} which allows the implementor a chance to examine the
 * prior value that was mapped to a source element when it must be remapped
 * due to a modification (from a call to {@link List#set}).
 *
 * @param source the EventList to decorate with a function transformation
 * @param forward the function to execute on each source element
 * @param reverse the function to map elements of FunctionList back to
 *      element values in the source list
 */
public FunctionList(EventList<S> source, Function<S,E> forward, Function<E,S> reverse) {
  super(source);
  updateForwardFunction(forward);
  setReverseFunction(reverse);
  // save a reference to the source elements
  this.sourceElements = new ArrayList<S>(source);
  // map all of the elements within source
  this.mappedElements = new ArrayList<E>(source.size());
  for (int i = 0, n = source.size(); i < n; i++) {
    this.mappedElements.add(forward(source.get(i)));
  }
  source.addListEventListener(this);
}
ca.odell.glazedlistsFunctionListsetReverseFunction

Javadoc

Changes the Function that evaluates FunctionList elements to produce the original source element with which it corresponds. The reverse Function will be used in all subsequent calls to:
  • #add(Object)
  • #add(int,Object)
  • #set(int,Object)
This method should typically be called at the same time the forward function is changed using #setForwardFunction.

Popular methods of FunctionList

  • <init>
    Construct a FunctionList which stores the result of transforming each source element using the given
  • dispose
  • addListEventListener
  • forward
    A convenience method to remap a source element to a FunctionListelement using the forward Function.
  • get
  • indexOf
  • iterator
  • removeListEventListener
  • reverse
    A convenience method to map a FunctionList element to a source element using the reverse Function.
  • size
  • updateForwardFunction
    A convenience method to run a null check on the givenforward Function and to wrap it in a delegating
  • updateForwardFunction

Popular in Java

  • Reading from database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • findViewById (Activity)
  • startActivity (Activity)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now