Example usage for java.lang Integer MAX_VALUE

List of usage examples for java.lang Integer MAX_VALUE

Introduction

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

Prototype

int MAX_VALUE

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

Click Source Link

Document

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

Usage

From source file:geogebra.kernel.statistics.AlgoInversePascal.java

protected final void compute() {

    if (input[0].isDefined() && input[1].isDefined() && input[2].isDefined()) {
        int param = (int) Math.round(a.getDouble());
        double param2 = b.getDouble();
        double val = c.getDouble();
        try {/*from   w  w  w . j  av  a 2 s  .c o m*/
            PascalDistribution dist = getPascalDistribution(param, param2);

            double result = dist.inverseCumulativeProbability(val);

            // eg InversePascal[1,1,1] returns  2147483647 
            if (result >= Integer.MAX_VALUE)
                num.setValue(param);
            else
                num.setValue(result + 1);

        } catch (Exception e) {
            num.setUndefined();
        }
    } else
        num.setUndefined();
}

From source file:com.bukanir.android.utils.Utils.java

public static boolean isServiceRunning(Context context) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (Torrent2HttpService.class.getName().equals(service.service.getClassName())) {
            return true;
        }/*from  www . j a va  2  s . c  om*/
    }
    return false;
}

From source file:com.netflix.loadbalancer.SubsetFilterTest.java

@BeforeClass
public static void init() {
    Configuration config = ConfigurationManager.getConfigInstance();
    config.setProperty(DefaultClientConfigImpl.DEFAULT_PROPERTY_NAME_SPACE
            + ".ServerListSubsetFilter.forceEliminatePercent", "0.6");
    config.setProperty(DefaultClientConfigImpl.DEFAULT_PROPERTY_NAME_SPACE
            + ".ServerListSubsetFilter.eliminationFailureThresold", 2);
    config.setProperty(DefaultClientConfigImpl.DEFAULT_PROPERTY_NAME_SPACE
            + ".ServerListSubsetFilter.eliminationConnectionThresold", 2);
    config.setProperty(DefaultClientConfigImpl.DEFAULT_PROPERTY_NAME_SPACE + ".ServerListSubsetFilter.size",
            "5");

    config.setProperty("SubsetFilerTest.ribbon.NFLoadBalancerClassName",
            com.netflix.loadbalancer.DynamicServerListLoadBalancer.class.getName());
    config.setProperty("SubsetFilerTest.ribbon.NIWSServerListClassName", MockServerList.class.getName());
    config.setProperty("SubsetFilerTest.ribbon.NIWSServerListFilterClassName",
            ServerListSubsetFilter.class.getName());
    // turn off auto refresh
    config.setProperty("SubsetFilerTest.ribbon.ServerListRefreshInterval", String.valueOf(Integer.MAX_VALUE));
    config.setProperty("SubsetFilerTest.ribbon.ServerListSubsetFilter.forceEliminatePercent", "0.6");
    config.setProperty("SubsetFilerTest.ribbon.ServerListSubsetFilter.eliminationFailureThresold", 2);
    config.setProperty("SubsetFilerTest.ribbon.ServerListSubsetFilter.eliminationConnectionThresold", 2);
    config.setProperty("SubsetFilerTest.ribbon.ServerListSubsetFilter.size", "5");
}

From source file:edu.mayo.cts2.framework.plugin.service.bprdf.util.SparqlUtils.java

/**
 * Gets the namespace name tuple.//from  ww w  . j  a  v  a  2s.  c  o  m
 * The first element in the array will be the name
 * The seconed element in the array wil be the namespace uri
 *
 * @param uri the uri
 * @return the namespace name tuple
 */
public static <T> List<T> iterate(TwinkqlTemplate template, String namespace, String query,
        Map<String, Object> parameters, Page page, Class<T> requiredType) {
    int start;
    int end;
    if (parameters == null) {
        parameters = new HashMap<String, Object>();
    }
    if (page == null) {
        start = 0;
        end = Integer.MAX_VALUE;
    } else {
        start = page.getStart();
        end = page.getEnd();
    }

    List<T> totalResults = new ArrayList<T>();

    int currentPos = start;

    while (currentPos < end) {
        setLimitOffsetParams(parameters, currentPos, calculateEnd(currentPos, end));
        List<T> resultPage = template.selectForList(namespace, query, parameters, requiredType);

        if (CollectionUtils.isEmpty(resultPage)) {
            break;
        } else {
            totalResults.addAll(resultPage);
            currentPos += resultPage.size();
        }
    }

    return totalResults;
}

From source file:com.fantasy.stataggregator.workers.StatCompilerTask.java

@Override
public void setYear(int year) throws Exception {
    this.year = year;

    GameDataRepository gdr = ctx.getBean(GameDataRepository.class);
    if (year == Integer.MAX_VALUE) {
        gamesData = gdr.findAll();//from   ww w .  j  a v  a 2 s .co  m
    } else {
        SimpleDateFormat sdf = ctx.getBean(SimpleDateFormat.class);
        sdf.applyLocalizedPattern("yyyyMMdd");

        Date min = sdf.parse(year + START_OF_YEAR);
        Date max = sdf.parse(year + END_OF_YEAR);

        CriteriaBuilder cb = gdr.getCriteriaBuilder();
        CriteriaQuery<GameData> cq = gdr.getCriteriaQuery();
        Root<GameData> gameData = gdr.getRoot();
        Path<GameDataPK> pk = gameData.get(GameData_.gameDataPK);
        cq.select(gameData).where(cb.equal(pk.get(GameDataPK_.year), year))
                .orderBy(cb.asc(pk.get(GameDataPK_.gameIdentifier)));

        gamesData = gdr.getCriteriaList(cq);
        System.out.println(gamesData.size());
    }
}

From source file:it.unimi.di.big.mg4j.io.IOFactories.java

public static byte[] loadBytes(final IOFactory ioFactory, final String filename) throws IOException {
    final long length = ioFactory.length(filename);
    if (length >= Integer.MAX_VALUE)
        throw new IllegalArgumentException("File is too long (" + length + " bytes).");
    final byte[] array = new byte[(int) length];
    final InputStream is = ioFactory.getInputStream(filename);
    if (read(is, array, 0, (int) length) < length)
        throw new EOFException();
    is.close();/*from  w ww . j  av  a2 s  . com*/
    return array;
}

From source file:com.amalto.core.storage.hibernate.MultiTypeStrategy.java

@Override
public StorageResults visit(Select select) {
    /*/* ww  w  .  ja v a 2 s  .c o m*/
     * Implementation consumes all results before they're sent back to user: current API doesn't allow "long"
     * conversation with storage. Using iterators, the first iterator would close the connection for the remaining
     * ones.
     */
    List<ComplexTypeMetadata> types = select.getTypes();
    if (types.isEmpty()) {
        throw new IllegalArgumentException("Select clause must select one type.");
    }
    int start = 0;
    int limit = Integer.MAX_VALUE;
    Paging paging = select.getPaging();
    if (paging != null) {
        start = paging.getStart();
        limit = select.getPaging().getLimit();
    }
    int currentStart = 0;
    int currentLimit = 0;
    int count = 0;
    final Set<DataRecord> results = new ListOrderedSet();
    for (ComplexTypeMetadata type : types) {
        UserQueryBuilder qb = UserQueryBuilder.from(type);
        qb.where(select.getCondition()); // TODO Would be better to ensure condition applies to type.
        for (OrderBy current : select.getOrderBy()) {
            qb.orderBy(current.getExpression(), current.getDirection());
        }
        StorageResults dataRecords = storage.fetch(qb.getSelect()); // Expects an active transaction here
        try {
            count += dataRecords.getCount();
            for (DataRecord result : dataRecords) {
                if (currentLimit < limit) {
                    if (currentStart >= start) {
                        if (results.add(result)) { // Avoids duplicates in results (if any).
                            currentLimit++;
                        }
                    }
                    currentStart++;
                }
            }
        } finally {
            dataRecords.close();
        }
    }
    final int totalCount = count;
    return new StorageResults() {
        @Override
        public int getSize() {
            return results.size();
        }

        @Override
        public int getCount() {
            return totalCount;
        }

        @Override
        public void close() {
        }

        @Override
        public Iterator<DataRecord> iterator() {
            return results.iterator();
        }
    };
}

From source file:be.redtree.beidsign.service.BeidSignService.java

public NodeRef getUserSignatureNode(NodeRef person, QName assoc) {
    NodeRef node = null;/*from www.ja  va2  s.c  om*/
    List<ChildAssociationRef> nodes = serviceRegistry.getNodeService().getChildAssocs(person, assoc, null,
            Integer.MAX_VALUE, false);

    if (nodes != null && nodes.size() > 0) {
        node = nodes.get(0).getChildRef();
    }

    return node;
}

From source file:com.liferay.alloy.util.DefaultValueUtil.java

public static String getDefaultValue(String className, String value) {
    String defaultValue = StringPool.BLANK;

    if (className.equals(ArrayList.class.getName()) || className.equals(HashMap.class.getName())
            || className.equals(Object.class.getName()) || className.equals(String.class.getName())) {

        if (!isValidStringValue(value)) {
            return defaultValue;
        }/*  w  w  w .j  av a  2  s . c o  m*/

        if (_EMPTY_STRINGS.contains(value)) {
            value = StringPool.BLANK;
        } else if (className.equals(ArrayList.class.getName())
                && !StringUtil.startsWith(value.trim(), StringPool.OPEN_BRACKET)) {

            value = "[]";
        } else if (className.equals(HashMap.class.getName())
                && !StringUtil.startsWith(value.trim(), StringPool.OPEN_CURLY_BRACE)) {

            value = "{}";
        }

        defaultValue = StringUtil.unquote(value);
    } else if (className.equals(boolean.class.getName()) || className.equals(Boolean.class.getName())) {

        defaultValue = String.valueOf(GetterUtil.getBoolean(value));
    } else if (className.equals(int.class.getName()) || className.equals(Integer.class.getName())) {

        if (_INFINITY.contains(value)) {
            value = String.valueOf(Integer.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getInteger(value));
    } else if (className.equals(double.class.getName()) || className.equals(Double.class.getName())) {

        if (_INFINITY.contains(value)) {
            value = String.valueOf(Double.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getDouble(value));
    } else if (className.equals(float.class.getName()) || className.equals(Float.class.getName())) {

        if (_INFINITY.contains(value)) {
            value = String.valueOf(Float.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getFloat(value));
    } else if (className.equals(long.class.getName()) || className.equals(Long.class.getName())) {

        if (_INFINITY.contains(value)) {
            value = String.valueOf(Long.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getLong(value));
    } else if (className.equals(short.class.getName()) || className.equals(Short.class.getName())) {

        if (_INFINITY.contains(value)) {
            value = String.valueOf(Short.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getShort(value));
    } else if (className.equals(Number.class.getName())) {
        if (_INFINITY.contains(value)) {
            value = String.valueOf(Integer.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getNumber(value));
    }

    return defaultValue;
}

From source file:uk.co.threeonefour.ifictionary.svc.GameServiceImpl.java

@Transactional
public List<GameInfo> listFeaturedGames() {
    List<GameInfo> games = gameInfoDao.list(0, Integer.MAX_VALUE);
    return games;
}