Example usage for com.google.common.base Preconditions checkElementIndex

List of usage examples for com.google.common.base Preconditions checkElementIndex

Introduction

In this page you can find the example usage for com.google.common.base Preconditions checkElementIndex.

Prototype

public static int checkElementIndex(int index, int size) 

Source Link

Document

Ensures that index specifies a valid element in an array, list or string of size size .

Usage

From source file:com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils.java

public static boolean validateStatusCode(final int statusCode, final int... expectedStatuses) {
    Preconditions.checkElementIndex(0, 1);
    final ImmutableSet<Integer> expectedSet = createExpectedSet(expectedStatuses);
    return expectedSet.contains(statusCode);
}

From source file:org.tal.data.recordset.built.BuiltRecord.java

@Override
protected Object readValue(int column) {
    Preconditions.checkElementIndex(column, data.length);
    return data[column];
}

From source file:org.tal.data.recordset.support.StaticRecordSchema.java

@Override
public String columnName(int columnIndex) {
    Preconditions.checkElementIndex(columnIndex, columns.size());
    return columns.get(columnIndex).name();
}

From source file:com.cloudera.oryx.rdf.common.tree.TreePath.java

boolean isLeftAt(int index) {
    Preconditions.checkElementIndex(index, pathLength);
    return ((Long.MIN_VALUE >>> index) & leftRight) == 0;
}

From source file:org.eclipse.incquery.tooling.ui.retevis.theme.ColorTheme.java

public Color getNodeColor(int id) {
    Preconditions.checkElementIndex(id, size);
    return nodeColors[id];
}

From source file:org.tal.data.recordset.built.BuiltRecord.java

protected void addColumnValue(int index, Object value) {
    Preconditions.checkElementIndex(index, data.length);
    data[index] = value;
}

From source file:org.tal.data.recordset.support.StaticRecordSchema.java

@Override
public String columnLabel(int columnIndex) {
    Preconditions.checkElementIndex(columnIndex, columns.size());
    return columns.get(columnIndex).label();
}

From source file:org.eclipse.incquery.tooling.ui.retevis.theme.ColorTheme.java

public Color getTextColor(int id) {
    Preconditions.checkElementIndex(id, size);
    return textColors[id];
}

From source file:org.tal.data.recordset.support.StaticRecordSchema.java

@Override
public ColumnType columnType(int columnIndex) {
    Preconditions.checkElementIndex(columnIndex, columns.size());
    return columns.get(columnIndex).type();
}

From source file:org.grouplens.lenskit.indexes.ImmutableIdIndexMapping.java

@Override
public long getId(int idx) {
    Preconditions.checkElementIndex(idx, domain.domainSize());
    return domain.getKey(idx);
}