Example usage for java.lang Integer MIN_VALUE

List of usage examples for java.lang Integer MIN_VALUE

Introduction

In this page you can find the example usage for java.lang Integer MIN_VALUE.

Prototype

int MIN_VALUE

To view the source code for java.lang Integer MIN_VALUE.

Click Source Link

Document

A constant holding the minimum value an int can have, -231.

Usage

From source file:gov.nih.nci.cabig.caaers.accesscontrol.filter.query.QuerySecurityFilterer.java

/**
 * If returns true will apply the filtering. 
 * @return - true - if the logged in user is not global 
 */// w  w w.  j av  a 2 s  . c  o  m
public boolean shouldFilter() {
    if (SecurityUtils.hasGlobalScopedRoles())
        return false; //if global scoped user- ignore filtering.
    int role = indexDao.findAssociatedRole(getLoginId(), Integer.MIN_VALUE);
    if ((role & getRole()) > 0)
        return false; //has a role that is ALL-SITE
    return true;
}

From source file:net.pms.newgui.ViewLevelTest.java

/**
 * Test ViewLevel class/*from  w  ww  .j  a v a2  s  . c o  m*/
 */
@Test
public void testViewLevel() {
    // Test level values
    assertEquals("ViewLevelNormalInt", ViewLevel.NORMAL_INT, 0);
    assertEquals("ViewLevelNormalInteger", ViewLevel.NORMAL_INTEGER, Integer.valueOf(0));
    assertEquals("ViewLevelAdvancedInt", ViewLevel.ADVANCED_INT, 200);
    assertEquals("ViewLevelAdvancedInteger", ViewLevel.ADVANCED_INTEGER, Integer.valueOf(200));
    assertEquals("ViewLevelExpertInt", ViewLevel.EXPERT_INT, 500);
    assertEquals("ViewLevelExpertInteger", ViewLevel.EXPERT_INTEGER, Integer.valueOf(500));
    assertEquals("ViewLevelDeveloperInt", ViewLevel.DEVELOPER_INT, 1000);
    assertEquals("ViewLevelDeveloperInteger", ViewLevel.DEVELOPER_INTEGER, Integer.valueOf(1000));
    assertEquals("ViewLevelUnknownInt", ViewLevel.UNKNOWN_INT, Integer.MIN_VALUE);
    assertEquals("ViewLevelUnknownInteger", ViewLevel.UNKNOWN_INTEGER, Integer.valueOf(Integer.MIN_VALUE));

    // Test instance creation
    assertEquals("ViewLevelNormal", ViewLevel.NORMAL.toInt(), ViewLevel.NORMAL_INT);
    assertEquals("ViewLevelAdvanced", ViewLevel.ADVANCED.toInt(), ViewLevel.ADVANCED_INT);
    assertEquals("ViewLevelExpert", ViewLevel.EXPERT.toInt(), ViewLevel.EXPERT_INT);
    assertEquals("ViewLevelDeveloper", ViewLevel.DEVELOPER.toInt(), ViewLevel.DEVELOPER_INT);
    assertEquals("ViewLevelUnknown", ViewLevel.UNKNOWN.toInt(), ViewLevel.UNKNOWN_INT);

    // Test Integer mapping
    assertEquals("ViewLevelNormalIntegerMapping", ViewLevel.NORMAL.toInteger(),
            Integer.valueOf(ViewLevel.NORMAL_INT));
    assertEquals("ViewLevelAdvancedIntegerMapping", ViewLevel.ADVANCED.toInteger(),
            Integer.valueOf(ViewLevel.ADVANCED_INT));
    assertEquals("ViewLevelExpertIntegerMapping", ViewLevel.EXPERT.toInteger(),
            Integer.valueOf(ViewLevel.EXPERT_INT));
    assertEquals("ViewLevelDeveloperIntegerMapping", ViewLevel.DEVELOPER.toInteger(),
            Integer.valueOf(ViewLevel.DEVELOPER_INT));
    assertEquals("ViewLevelUnknownIntegerMapping", ViewLevel.UNKNOWN.toInteger(),
            Integer.valueOf(ViewLevel.UNKNOWN_INT));

    // Test String values
    assertEquals("ViewLevelNormalString", ViewLevel.NORMAL.toString(), "Normal");
    assertEquals("ViewLevelAdvancedString", ViewLevel.ADVANCED.toString(), "Advanced");
    assertEquals("ViewLevelExpertString", ViewLevel.EXPERT.toString(), "Expert");
    assertEquals("ViewLevelDeveloperString", ViewLevel.DEVELOPER.toString(), "Developer");
    assertEquals("ViewLevelUnknownString", ViewLevel.UNKNOWN.toString(), "Unknown");

    // Test toViewLevel(int val)
    assertEquals("IntToViewLevelNormal", ViewLevel.toViewLevel(0), ViewLevel.NORMAL);
    assertEquals("IntToViewLevelAdvanced", ViewLevel.toViewLevel(200), ViewLevel.ADVANCED);
    assertEquals("IntToViewLevelExpert", ViewLevel.toViewLevel(500), ViewLevel.EXPERT);
    assertEquals("IntToViewLevelDeveloper", ViewLevel.toViewLevel(1000), ViewLevel.DEVELOPER);
    assertEquals("IntToViewLevelUnknown", ViewLevel.toViewLevel(Integer.MIN_VALUE), ViewLevel.UNKNOWN);
    assertEquals("IllegalIntToViewLevel", ViewLevel.toViewLevel(100), ViewLevel.UNKNOWN);
    assertEquals("IllegalIntToViewLevel", ViewLevel.toViewLevel(-400), ViewLevel.UNKNOWN);
    assertEquals("IllegalIntToViewLevel", ViewLevel.toViewLevel(Integer.MAX_VALUE), ViewLevel.UNKNOWN);

    // Test toViewLevel(String sArg)
    assertEquals("StringToViewLevelNormal", ViewLevel.toViewLevel("Normal"), ViewLevel.NORMAL);
    assertEquals("StringToViewLevelNormal", ViewLevel.toViewLevel("nORMAL"), ViewLevel.NORMAL);
    assertEquals("StringToViewLevelNormal", ViewLevel.toViewLevel("Advanced"), ViewLevel.ADVANCED);
    assertEquals("StringToViewLevelNormal", ViewLevel.toViewLevel("aDVANCED"), ViewLevel.ADVANCED);
    assertEquals("StringToViewLevelNormal", ViewLevel.toViewLevel("Expert"), ViewLevel.EXPERT);
    assertEquals("StringToViewLevelNormal", ViewLevel.toViewLevel("eXPERT"), ViewLevel.EXPERT);
    assertEquals("StringToViewLevelNormal", ViewLevel.toViewLevel("Developer"), ViewLevel.DEVELOPER);
    assertEquals("StringToViewLevelNormal", ViewLevel.toViewLevel("dEVELOPER"), ViewLevel.DEVELOPER);
    assertEquals("StringToViewLevelNormal", ViewLevel.toViewLevel("Unknown"), ViewLevel.UNKNOWN);
    assertEquals("StringToViewLevelNormal", ViewLevel.toViewLevel("uNKNOWN"), ViewLevel.UNKNOWN);
    assertEquals("IllegalStringToViewLevel", ViewLevel.toViewLevel("Foo"), ViewLevel.UNKNOWN);
    assertEquals("IllegalStringToViewLevel", ViewLevel.toViewLevel("BAR"), ViewLevel.UNKNOWN);
}

From source file:com.sisrni.managedbean.CategoriaDocumentoMB.java

/** 
 * Metodo para guardar una instancia de 'CategoriaDocumento' en la tabla 
 * correspondiente de la base de datos//from  w w w. j  av  a2s  . co m
 */
public void guardarCategoriaDocumento() {
    String msg = "Categoria de Documento Almacenada Exitosamente!";
    try {
        categoriaDocumento.setIdCategoriaDoc(Integer.MIN_VALUE);
        categoriaDocumentoService.save(categoriaDocumento);
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_INFO, "Guardada!!", msg));

    } catch (Exception e) {
        JsfUtil.addErrorMessage("Error al Guardar Categoria de Documento!");
        e.printStackTrace();
    }
    cargarCategoriaDocumento();
}

From source file:com.sisrni.managedbean.AreaConocimientoMB.java

/** 
 * Metodo para guardar una instancia de 'AreaConocimiento' en la tabla 
 * correspondiente de la base de datos//from   w  ww .j a  v  a 2s .c o m
 */
public void guardarAreaConocimiento() {
    String msg = "Area de Conocimiento Almacenada Exitosamente!";
    try {
        areaConocimiento.setIdAreaConocimiento(Integer.MIN_VALUE);
        areaConocimientoService.save(areaConocimiento);
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_INFO, "Guardada!!", msg));

    } catch (Exception e) {
        JsfUtil.addErrorMessage("Error al Guardar Area de Conocimiento!");
        e.printStackTrace();
    }
    cargarAreaConocimiento();
}

From source file:com.sisrni.managedbean.ProvinciaMB.java

/** 
 * Metodo para guardar una instancia de 'Provincia' en la tabla 
 * correspondiente de la base de datos//from ww w .  java  2s . c om
 */
public void guardarProvincia() {
    String msg = "Estado/Departamento/Provincia Almacenado Exitosamente!";
    try {
        provincia.setIdProvincia(Integer.MIN_VALUE);
        provincia.setIdPais(paisService.findById(pais.getIdPais()));
        provinciaService.save(provincia);
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_INFO, "Guardado!!", msg));

    } catch (Exception e) {
        JsfUtil.addErrorMessage("Error al Guardar Estado/Departamento/Provincia!");
        e.printStackTrace();
    }
    cargarProvincia();
}

From source file:net.aksingh.owmjapis.AbstractResponse.java

/**
 * @return <code>true</code> if response code is available, otherwise <code>false</code>.
 *//*  w  ww.j  a va 2  s  .  co m*/
public boolean hasResponseCode() {
    return this.responseCode != Integer.MIN_VALUE;
}

From source file:com.couchbase.sqoop.mapreduce.db.CouchbaseRecordReadSerializeTest.java

@Before
@Override/*  www.  j  a  v a  2  s.  com*/
public void setUp() throws Exception {
    super.setUp();

    tappedStuff = new HashMap<String, ResponseMessage>();

    URI uri = new URI(CouchbaseUtils.CONNECT_STRING);
    String user = CouchbaseUtils.COUCHBASE_USER_NAME;
    String pass = CouchbaseUtils.COUCHBASE_USER_PASS;

    try {
        cb = new CouchbaseClient(Arrays.asList(uri), user, pass);
    } catch (IOException e) {
        LOG.error("Couldn't connect to server" + e.getMessage());
        fail(e.toString());
    }
    this.client = new TapClient(Arrays.asList(uri), user, pass);

    cb.flush();
    Thread.sleep(500);

    // set up the items we're going to deserialize
    Integer anint = new Integer(Integer.MIN_VALUE);
    cb.set(anint.toString(), 0x300, anint).get();

    Long along = new Long(Long.MAX_VALUE);
    cb.set(along.toString(), 0, along).get();

    Float afloat = new Float(Float.MAX_VALUE);
    cb.set(afloat.toString(), 0, afloat).get();

    Double doubleBase = new Double(Double.NEGATIVE_INFINITY);
    cb.set(doubleBase.toString(), 0, doubleBase).get();

    Boolean booleanBase = true;
    cb.set(booleanBase.toString(), 0, booleanBase).get();

    rightnow = new Date(); // instance, needed later
    dateText = rightnow.toString().replaceAll(" ", "_");
    cb.set(dateText, 0, rightnow).get();

    Byte byteMeSix = new Byte("6");
    cb.set(byteMeSix.toString(), 0, byteMeSix).get();

    String ourString = "hi,there";
    cb.set(ourString.toString(), 0, ourString).get();

    client.tapDump("tester");
    while (client.hasMoreMessages()) {
        ResponseMessage m = client.getNextMessage();
        if (m == null) {
            continue;
        }
        tappedStuff.put(m.getKey(), m);
    }
}

From source file:com.sisrni.managedbean.PaisMB.java

/** 
 * Metodo para guardar una instancia de 'Pais' en la tabla 
 * correspondiente de la base de datos//from   w ww  .java2  s . c  o m
 */
public void guardarPais() {
    String msg = "Pais Almacenado Exitosamente!";
    try {
        pais.setIdPais(Integer.MIN_VALUE);
        pais.setIdRegion(regionService.findById(region.getIdRegion()));
        paisService.save(pais);
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_INFO, "Guardado!!", msg));

    } catch (Exception e) {
        JsfUtil.addErrorMessage("Error al Guardar Pais!");
        e.printStackTrace();
    }
    cargarPais();
}

From source file:com.sisrni.managedbean.CategoriaMovilidadMB.java

/**
 * Metodo para guardar una instancia de 'CategoriaMovilidad' en la tabla
 * correspondiente de la base de datos/*from  w w  w. ja  va2s .c o  m*/
 */
public void guardarCategoriaMovilidad() {
    String msg = "Categoria de Movilidad Almacenada Exitosamente!";
    try {
        categoriaMovilidad.setIdCategoriaMovilidad(Integer.MIN_VALUE);
        categoriaMovilidadService.save(categoriaMovilidad);
        FacesContext.getCurrentInstance().addMessage(null,
                new FacesMessage(FacesMessage.SEVERITY_INFO, "Guardada!!", msg));

    } catch (Exception e) {
        JsfUtil.addErrorMessage("Error al Guardar Categoria de Movilidad!");
        e.printStackTrace();
    }
    cargarCategoriaMovilidad();
}

From source file:com.linkedin.pinot.core.realtime.converter.stats.RealtimeNoDictionaryColStatistics.java

private void computeIntMinMax(int[] rows) {
    int values[] = new int[_numDocIds];
    _blockValSet.getIntValues(rows, 0, _numDocIds, values, 0);
    int min = Integer.MAX_VALUE;
    int max = Integer.MIN_VALUE;
    for (int i = 0; i < _numDocIds; i++) {
        if (values[i] < min) {
            min = values[i];//from  w w  w  .  j  a  va 2s.co  m
        }
        if (values[i] > max) {
            max = values[i];
        }
    }
    _minValue = Integer.valueOf(min);
    _maxValue = Integer.valueOf(max);
}