Tabnine Logo
HollowSetTypeDataAccess
Code IndexAdd Tabnine to your IDE (free)

How to use
HollowSetTypeDataAccess
in
com.netflix.hollow.core.read.dataaccess

Best Java code snippets using com.netflix.hollow.core.read.dataaccess.HollowSetTypeDataAccess (Showing top 20 results out of 315)

origin: Netflix/hollow

@Override
public boolean contains(int ordinal, int value) {
  return currentDataAccess().contains(ordinal, value);
}
origin: Netflix/hollow

public HollowOrdinalIterator potentialMatchOrdinalIterator(int ordinal, int hashCode) {
  return getTypeDataAccess().potentialMatchOrdinalIterator(ordinal, hashCode);
}

origin: Netflix/hollow

@Override
public int size(int ordinal) {
  return dataAccess.size(ordinal);
}
origin: Netflix/hollow

private HollowSetCachedDelegate(HollowSetTypeDataAccess dataAccess, HollowSetTypeAPI typeAPI, int ordinal) {
  int size = dataAccess.size(ordinal);
  int ordinals[] = new int[HashCodes.hashTableSize(size)];
  for(int i=0;i<ordinals.length;i++) {
    ordinals[i] = dataAccess.relativeBucketValue(ordinal, i);
  }
  this.ordinals = ordinals;
  this.size = size;
  this.hashMask = ordinals.length - 1;
  this.dataAccess = dataAccess;
  this.typeAPI = typeAPI;
}
origin: Netflix/hollow

@Override
public boolean contains(HollowSet<T> set, int ordinal, Object o) {
  HollowOrdinalIterator iter;
  
  if(getSchema().getHashKey() != null) {
    iter = dataAccess.ordinalIterator(ordinal);
  } else {
    int hashCode = dataAccess.getDataAccess().getHashCodeFinder().hashCode(o);
    iter = dataAccess.potentialMatchOrdinalIterator(ordinal, hashCode);
  }
  int potentialOrdinal = iter.next();
  while(potentialOrdinal != HollowOrdinalIterator.NO_MORE_ORDINALS) {
    if(set.equalsElement(potentialOrdinal, o))
      return true;
    potentialOrdinal = iter.next();
  }
  return false;
}

origin: Netflix/hollow

Assert.assertEquals(3, setDataAccess.size(i));
Assert.assertTrue(setDataAccess.contains(i, i));
Assert.assertTrue(setDataAccess.contains(i, i+1));
Assert.assertTrue(setDataAccess.contains(i, i+2));
Assert.assertEquals(3, setDataAccess.size(ordinal));
Assert.assertTrue(setDataAccess.contains(ordinal, expectedValue));
Assert.assertTrue(setDataAccess.contains(ordinal, expectedValue+1));
Assert.assertTrue(setDataAccess.contains(ordinal, expectedValue+2));
origin: Netflix/hollow

private void appendSetStringify(Writer writer, HollowDataAccess dataAccess,
    HollowSetTypeDataAccess typeDataAccess, int ordinal, int indentation) throws IOException {
  HollowSetSchema schema = typeDataAccess.getSchema();
  if(showTypes)
    writer.append("(").append(schema.getName()).append(")");
  if(showOrdinals)
    writer.append(" (ordinal ").append(Integer.toString(ordinal)).append(")");
  indentation++;
  String elementType = schema.getElementType();
  HollowOrdinalIterator iter = typeDataAccess.ordinalIterator(ordinal);
  int elementOrdinal = iter.next();
  while(elementOrdinal != NO_MORE_ORDINALS) {
    writer.append(NEWLINE);
    appendIndentation(writer, indentation);
    writer.append("e: ");
    appendStringify(writer, dataAccess, elementType, elementOrdinal, indentation);
    elementOrdinal = iter.next();
  }
}
origin: Netflix/hollow

@Override
public T findElement(HollowSet<T> set, int ordinal, Object... keys) {
  int elementOrdinal = dataAccess.findElement(ordinal, keys);
  if(elementOrdinal != -1)
    return set.instantiateElement(elementOrdinal);
  return null;
}
origin: Netflix/hollow

@Override
public int next() {
  int currentBucketValue;
  currentBucketValue = dataAccess.relativeBucketValue(setOrdinal, currentBucket);
  if(currentBucketValue == ORDINAL_NONE) {
    return NO_MORE_ORDINALS;
  }
  currentBucket++;
  currentBucket &= (numBuckets - 1);
  return currentBucketValue;
}
origin: Netflix/hollow

@Override
public HollowOrdinalIterator iterator(int ordinal) {
  return dataAccess.ordinalIterator(ordinal);
}
origin: Netflix/hollow

@Override
public HollowSetSchema getSchema() {
  return dataAccess.getSchema();
}
origin: Netflix/hollow

@Override
public HollowRecord instantiateElement(int elementOrdinal) {
  return GenericHollowRecordHelper.instantiate(getTypeDataAccess().getDataAccess(), getSchema().getElementType(), elementOrdinal);
}
origin: Netflix/hollow

private void appendSetStringify(Writer writer, HollowDataAccess dataAccess, HollowSetTypeDataAccess typeDataAccess, int ordinal, int indentation) throws IOException {
  HollowSetSchema schema = typeDataAccess.getSchema();
  indentation++;
  String elementType = schema.getElementType();
  HollowOrdinalIterator iter = typeDataAccess.ordinalIterator(ordinal);
  int elementOrdinal = iter.next();
  if(elementOrdinal == HollowOrdinalIterator.NO_MORE_ORDINALS) {
    writer.append("[]");
  } else {
    boolean firstElement = true;
    writer.append("[");
    if(prettyPrint)
      writer.append(NEWLINE);
    while(elementOrdinal != HollowOrdinalIterator.NO_MORE_ORDINALS) {
      if(firstElement)
        firstElement = false;
      else
        writer.append(",");
      if(prettyPrint)
        appendIndentation(writer, indentation);
      appendStringify(writer, dataAccess, elementType, elementOrdinal, indentation);
      elementOrdinal = iter.next();
    }
    if(prettyPrint) {
      writer.append(NEWLINE);
      appendIndentation(writer, indentation - 1);
    }
    writer.append("]");
  }
}
origin: Netflix/hollow

@Override
public T findElement(HollowSet<T> set, int ordinal, Object... keys) {
  int elementOrdinal = dataAccess.findElement(ordinal, keys);
  if(elementOrdinal != -1)
    return set.instantiateElement(elementOrdinal);
  return null;
}
origin: Netflix/hollow

@Override
public int next() {
  int bucketValue;
  bucketValue = ORDINAL_NONE;
  while(bucketValue == ORDINAL_NONE) {
    currentBucket++;
    if(currentBucket >= numBuckets)
      return NO_MORE_ORDINALS;
    bucketValue = dataAccess.relativeBucketValue(setOrdinal, currentBucket);
  }
  return bucketValue;
}
origin: Netflix/hollow

public HollowOrdinalIterator getOrdinalIterator(int ordinal) {
  return getTypeDataAccess().ordinalIterator(ordinal);
}
origin: Netflix/hollow

@Override
public HollowSetSchema getSchema() {
  return dataAccess.getSchema();
}
origin: Netflix/hollow

@Override
public boolean contains(HollowSet<T> set, int ordinal, Object o) {
  if(getSchema().getHashKey() != null) {
    for(int i=0;i<ordinals.length;i++) {
      if(ordinals[i] != -1 && set.equalsElement(ordinals[i], o))
        return true;
    }
  } else {
    int hashCode = dataAccess.getDataAccess().getHashCodeFinder().hashCode(o);

    int bucket = HashCodes.hashInt(hashCode) & hashMask;

    while(ordinals[bucket] != -1) {
      if(set.equalsElement(ordinals[bucket], o))
        return true;
      bucket ++;
      bucket &= hashMask;
    }
  }
  return false;
}

origin: Netflix/hollow

public HollowSetOrdinalIterator(int setOrdinal, HollowSetTypeDataAccess dataAccess) {
  this.setOrdinal = setOrdinal;
  this.dataAccess = dataAccess;
  this.numBuckets = HashCodes.hashTableSize(dataAccess.size(setOrdinal));
}
origin: Netflix/hollow

@Override
public boolean contains(int ordinal, int value, int hashCode) {
  return currentDataAccess().contains(ordinal, value, hashCode);
}
com.netflix.hollow.core.read.dataaccessHollowSetTypeDataAccess

Javadoc

A handle for all of the records of a specific SET type in a Hollow dataset. The most common type of HollowSetTypeDataAccessis a HollowSetTypeReadState.

Most used methods

  • contains
    Generally, the method #findElement(int,Object...) may be more useful.
  • potentialMatchOrdinalIterator
  • size
  • findElement
    Returns The matching ordinal of the element from the set at the specified ordinal which matches the
  • getDataAccess
  • getSchema
  • ordinalIterator
  • relativeBucketValue

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • scheduleAtFixedRate (Timer)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • BoxLayout (javax.swing)
  • Top 12 Jupyter Notebook extensions
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