Guava Table - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava Table class.

This code example shows how to use the following methods:contains, get, put
 
        } 
 
        public Builder add(String source, String value, long time, double data) {
 
            if (!this.data.contains(source, value)) {
                this.data.put(source, value, Maps.<Long, Double>newHashMap());
            } 
 
            this.data.get(source, value).put(time, data);
 
            return this;
        } 
 
        public MonitoringSummary build() { 
            Table<String, String, MonitoringStats> newTable = HashBasedTable.create();
 
            for (Table.Cell<String, String, Map<Long, Double>> cell : data.cellSet()) {
 
                MonitoringStats stats = new MonitoringStats(cell.getValue());
6
CodeRank
This code example shows how to use the following methods:get, put, row
    addProperty( k, property, asList( values ) );
    } 
 
  public void addProperty( K k, String property, List<String> list )
    { 
    if( !properties.row( k ).containsKey( property ) )
      properties.put( k, property, new ArrayList<String>() );
 
    Set<String> previous = newHashSet( properties.get( k, property ) );
 
    previous.addAll( list );
 
    properties.put( k, property, new ArrayList<String>( previous ) );
    } 
 
  public Map<K, List<String>> getKeyFor( String property )
    { 
    return properties.column( property );
    } 
 
6
CodeRank
This code example shows how to use the following methods:put
  protected Table<Integer, Integer, String> actual;
 
  @Before 
  public void setUp() { 
    actual = HashBasedTable.create();
    actual.put(1, 3, "Millard Fillmore");
    actual.put(1, 4, "Franklin Pierce");
    actual.put(2, 5, "Grover Cleveland");
  } 
 
} 
6
CodeRank
This code example shows how to use the following methods:rowKeySet
    public Iterable<String> getPartsFor(Class<? extends UIWidget> widget) {
        Table<String, String, UIStyle> styles = elementStyleLookup.get(widget);
        if (styles == null) {
            return Collections.emptyList();
        } 
        return styles.rowKeySet();
    } 
 
    public Iterable<String> getModesFor(Class<? extends UIWidget> widget, String part) {
        Table<String, String, UIStyle> styles = elementStyleLookup.get(widget);
        if (styles == null) {
            return Collections.emptyList();
        } 
        return styles.row(part).keySet();
    } 
 
    public UIStyle getElementStyle(Class<? extends UIWidget> element) {
        List<Class<? extends UIWidget>> classes = getInheritanceTree(element);
        UIStyle style = null;
        for (int i = classes.size() - 1; i >= 0 && style == null; i--) {
5
CodeRank
This code example shows how to use the following methods:contains, get, put
	/** 
	 * Get a value at entry (row, col) 
	 */ 
	public double get(int row, int col) {
 
		if (data.contains(row, col))
			return data.get(row, col);
		else if (data.contains(col, row))
			return data.get(col, row);
 
		return 0.0; 
	} 
 
	/** 
	 * set a value to entry (row, col) 
	 */ 
	public void set(int row, int col, double val) {
		if (row >= col)
			data.put(row, col, val);
		else 

5
CodeRank
This code example shows how to use the following methods:get, put
     * @return The fresh entity.  Not {@code null}. 
     */ 
    @Override 
    @SuppressWarnings("unchecked") 
    public <E extends OWLEntity> E getFreshEntity(String browserText, EntityType<E> type) {
        OWLEntity entity = entitiesTable.get(browserText, type);
        if(entity != null) {
            return (E) entity;
        } 
        UserId userId = Application.get().getUserId();
        E freshEntity = DataFactory.getFreshOWLEntity(type, browserText);
        entitiesTable.put(browserText, type, freshEntity);
        return freshEntity;
    } 
 
    @Override 
    @SuppressWarnings("unchecked") 
    public <E extends OWLEntity> Optional<E> getRegisteredFreshEntity(String browserText, EntityType<E> entityType) {
        E entity = (E) entitiesTable.get(browserText, entityType);
        if(entity == null) {
5
CodeRank
This code example shows how to use the following methods:equals
        if(this == that) {
            return true; 
        } 
        if(that instanceof StoredEquivalenceResult) { 
            StoredEquivalenceResult other = (StoredEquivalenceResult) that;
            return id.equals(other.id) && title.equals(other.title) && results.equals(other.results) && totals.equals(other.totals) && resultTime.equals(resultTime);
        } 
        return super.equals(that); 
    } 
     
    @Override 
    public int hashCode() { 
        return Objects.hashCode(id, title, results, totals, resultTime);
    } 
 
} 
4
CodeRank
This code example shows how to use the following methods:get, put
This code example shows how to use the following methods:clear
        } 
        return comparison;
    } 
 
    public void resetCache() { 
        cache.clear();
    } 
 
    public int compareNonCache(String chr0, String chr1) {
 
 
        int[] range0 = findDigitRange(chr0);
        int[] range1 = findDigitRange(chr1);
 
        if (range0 == null || range1 == null || range0[0] != range1[0]) {
            // Special rule -- put the mitochondria at the end 
            boolean mito0 = isMito(chr0);
            boolean mito1 = isMito(chr1);
            if (mito0 && !mito1) {
                return +1; 
4
CodeRank
This code example shows how to use the following methods:containsRow
	} 
 
	@Override 
	public boolean exists(byte[] key) {
		ByteBuffer rowKey = wrap(key);
		return this.hashElements.containsRow(rowKey);
	} 
 
	@Override 
	public boolean renameKey(byte[] key, byte[] newKey) {
		ByteBuffer wrappedKey = wrap(key);
		if(this.hashElements.containsRow(wrappedKey )) {
			Map<ByteBuffer, ByteBuffer> row = this.hashElements.row(wrappedKey);
 
			deleteAllFields(wrap(newKey));
			 
			Set<Entry<ByteBuffer, ByteBuffer>> entries = row.entrySet();
			 
			for (Entry<ByteBuffer, ByteBuffer> entry : entries) {
				hashElements.put(wrap(newKey), entry.getKey(), entry.getValue());
4
CodeRank
See Code Examples for Guava Table Methods: