Package com.tangosol.util

Examples of com.tangosol.util.Filter


class TxUtils {

  public static final Filter transformFilter(Filter f, int readVersion) {
    if (f instanceof KeyAssociatedFilter) {
      KeyAssociatedFilter kaf = (KeyAssociatedFilter)f;
      Filter nested = kaf.getFilter();
      Object hostKey = kaf.getHostKey();
      return new KeyAssociatedFilter(transformFilter(nested, readVersion), hostKey);
    }
    else if (f instanceof IndexAwareFilter){
      return new TxIndexAwareFilterWrapper((IndexAwareFilter) f, readVersion);
View Full Code Here


    writerA.put("A", "A");
    writerA.put("B", "B");
    writerA.put("C", "C");
    writerA.put("D", "D");

    Filter f = new EqualsFilter(new FirstCharExtractor(), "A");
   
    Assert.assertEquals("[A]", writerA.keySet(f).toString());
    Assert.assertEquals("[A]", dirtyA.keySet(f).toString());
    Assert.assertEquals("[]", rrA.keySet(f).toString());
    Assert.assertEquals("[]", rcA.keySet(f).toString());
View Full Code Here

    writerA.put("B", "B");
    writerA.put("C", "C");
    writerA.put("D", "D");
   
    FirstCharExtractor extractor = new FirstCharExtractor();
    Filter f = new EqualsFilter(extractor, "A");
   
    Assert.assertEquals("[A]", writerA.keySet(f).toString());
    Assert.assertEquals("[A]", dirtyA.keySet(f).toString());
    Assert.assertEquals("[]", rrA.keySet(f).toString());
    Assert.assertEquals("[]", rcA.keySet(f).toString());
View Full Code Here

     
      InFilter f = new InFilter(IdentityExtractor.INSTANCE, set);
      AllFilter af = new AllFilter(new Filter[]{f});
     
      cache.put("---", af);
      Filter af2 = (Filter) cache.get("---");
     
      ObjectOutputStream oos = new ObjectOutputStream(new ByteArrayOutputStream());
      oos.writeObject(af2);
      oos.close();
     
View Full Code Here

  @Override
  @SuppressWarnings("unchecked")
  public Set keySet(Filter filter) {
    adapter.beforeOperation(this);
    Filter transformed = adapter.transformFilter(this, filter);
    Set keys = new HashSet(nestedCache.keySet(transformed));
    WrapperSetView wrapperSetView = new WrapperSetView(keys) {
           
      @Override
      protected void delete(Object element) {
View Full Code Here

  @Override
  @SuppressWarnings("unchecked")
  public Set entrySet(Filter filter) {
    adapter.beforeOperation(this);
    Filter transformedFilter = adapter.transformFilter(this, filter);
    Set entries = new HashSet(nestedCache.entrySet(transformedFilter));
    Set result = new HashSet(entries.size());
    for(Object x: entries) {
      Map.Entry centry = (Map.Entry) x;
      result.add(new EntryWrapper(centry.getKey(), adapter.transformValue(this, (ValueContatiner) centry.getValue())));
View Full Code Here

 
  @Override
  @SuppressWarnings("unchecked")
  public Set entrySet(Filter filter, final Comparator comparator) {
    adapter.beforeOperation(this);
    Filter transformedFilter = adapter.transformFilter(this, filter);
    Set entries = new HashSet(nestedCache.entrySet(transformedFilter));
    List result = new ArrayList(entries.size());
    for(Object x: entries) {
      Map.Entry centry = (Map.Entry) x;
      result.add(new EntryWrapper(centry.getKey(), adapter.transformValue(this, (ValueContatiner) centry.getValue())));
View Full Code Here

  }

  @Override
  public Object aggregate(Filter filter, EntryAggregator agent) {
    adapter.beforeOperation(this);
    Filter transformedFilter = adapter.transformFilter(this, filter);
    EntryAggregator transformedAgent = adapter.transformAggregator(this, agent);
    Object result = nestedCache.aggregate(transformedFilter, transformedAgent);
    adapter.afterOperation(this);
    return result;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public Map invokeAll(Filter filter, EntryProcessor agent) {
    if (adapter.isReadOnly(this)) {
      adapter.beforeOperation(this);
      EntryProcessor transformedAgent = adapter.transformProcessor(this, agent);
      Filter transformedFilter = adapter.transformFilter(this, filter);
      Map result = nestedCache.invokeAll(transformedFilter, transformedAgent);
      adapter.afterOperation(this);
      return result;
    }
    else {
      adapter.beforeOperation(this);
      EntryProcessor transformedAgent = adapter.transformProcessor(this, agent);
      Filter transformedFilter = adapter.transformFilter(this, filter);
      // all keys affected by processor should be marked as dirty in transaction
      Collection keys = nestedCache.keySet(transformedFilter);
      adapter.markDirty(this, keys);
      Map result = nestedCache.invokeAll(keys, transformedAgent);
      adapter.afterOperation(this);
View Full Code Here

  }

  @Override
  public void addMapListener(MapListener listener, Filter filter, boolean lite) {
    MapListener transformend = adapter.transformListener(this, listener);
    Filter transformedFilter = adapter.transformListenerFilter(this, filter);
    nestedCache.addMapListener(transformend, transformedFilter, true);
  }
View Full Code Here

TOP

Related Classes of com.tangosol.util.Filter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.