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:com.opengamma.util.timeseries.fast.integer.FastArrayIntDoubleTimeSeries.java

@Override
public FastIntDoubleTimeSeries subSeriesFast(final int startTime, final int endTime) {
    if (isEmpty()) {
        return EMPTY_SERIES;
    }/*from   w ww.ja  v a 2  s  . co m*/
    // throw new NoSuchElementException("Series is empty")
    int startPos = Arrays.binarySearch(_times, startTime);
    int endPos = (endTime == Integer.MIN_VALUE) ? _times.length : Arrays.binarySearch(_times, endTime);
    // if either is -1, make it zero
    startPos = startPos >= 0 ? startPos : -(startPos + 1);
    endPos = endPos >= 0 ? endPos : -(endPos + 1);
    final int length = endPos - startPos; // trying it out anyway.
    if (endPos >= _times.length) {
        endPos--;
    }

    final int[] resultTimes = new int[length];
    final double[] resultValues = new double[length];
    System.arraycopy(_times, startPos, resultTimes, 0, length);
    System.arraycopy(_values, startPos, resultValues, 0, length);
    return new FastArrayIntDoubleTimeSeries(getEncoding(), resultTimes, resultValues);
}

From source file:com.espertech.esper.epl.core.ResultSetProcessorFactoryFactory.java

/**
 * Returns the result set process for the given select expression, group-by clause and
 * having clause given a set of types describing each stream in the from-clause.
 * @param statementSpec - a subset of the statement specification
 * @param stmtContext - engine and statement and agent-instance level services
 * @param typeService - for information about the streams in the from clause
 * @param viewResourceDelegate - delegates views resource factory to expression resources requirements
 * @param isUnidirectionalStream - true if unidirectional join for any of the streams
 * @param allowAggregation - indicator whether to allow aggregation functions in any expressions
 * @return result set processor instance
 * @throws ExprValidationException when any of the expressions is invalid
 *//*from w w w  .  j a v a  2 s . com*/
public static ResultSetProcessorFactoryDesc getProcessorPrototype(StatementSpecCompiled statementSpec,
        StatementContext stmtContext, StreamTypeService typeService,
        ViewResourceDelegateUnverified viewResourceDelegate, boolean[] isUnidirectionalStream,
        boolean allowAggregation, ContextPropertyRegistry contextPropertyRegistry,
        SelectExprProcessorDeliveryCallback selectExprProcessorCallback) throws ExprValidationException {
    OrderByItem[] orderByListUnexpanded = statementSpec.getOrderByList();
    SelectClauseSpecCompiled selectClauseSpec = statementSpec.getSelectClauseSpec();
    InsertIntoDesc insertIntoDesc = statementSpec.getInsertIntoDesc();
    ExprNode[] groupByNodes = statementSpec.getGroupByExpressions();
    ExprNode optionalHavingNode = statementSpec.getHavingExprRootNode();
    OutputLimitSpec outputLimitSpec = statementSpec.getOutputLimitSpec();

    if (log.isDebugEnabled()) {
        log.debug(".getProcessor Getting processor for " + " selectionList="
                + Arrays.toString(selectClauseSpec.getSelectExprList()) + " groupByNodes="
                + Arrays.toString(groupByNodes) + " optionalHavingNode=" + optionalHavingNode);
    }

    boolean isUnidirectional = false;
    for (int i = 0; i < isUnidirectionalStream.length; i++) {
        isUnidirectional |= isUnidirectionalStream[i];
    }

    // Expand any instances of select-clause names in the
    // order-by clause with the full expression
    List<OrderByItem> orderByList = expandColumnNames(selectClauseSpec.getSelectExprList(),
            orderByListUnexpanded);

    // Validate selection expressions, if any (could be wildcard i.e. empty list)
    List<SelectClauseExprCompiledSpec> namedSelectionList = new LinkedList<SelectClauseExprCompiledSpec>();
    ExprEvaluatorContextStatement evaluatorContextStmt = new ExprEvaluatorContextStatement(stmtContext);
    ExprValidationContext validationContext = new ExprValidationContext(typeService,
            stmtContext.getMethodResolutionService(), viewResourceDelegate, stmtContext.getSchedulingService(),
            stmtContext.getVariableService(), evaluatorContextStmt, stmtContext.getEventAdapterService(),
            stmtContext.getStatementName(), stmtContext.getStatementId(), stmtContext.getAnnotations(),
            stmtContext.getContextDescriptor());

    assignSelectClauseNames(selectClauseSpec, namedSelectionList, validationContext);
    boolean isUsingWildcard = selectClauseSpec.isUsingWildcard();

    // Validate stream selections, if any (such as stream.*)
    boolean isUsingStreamSelect = false;
    for (SelectClauseElementCompiled compiled : selectClauseSpec.getSelectExprList()) {
        if (!(compiled instanceof SelectClauseStreamCompiledSpec)) {
            continue;
        }
        SelectClauseStreamCompiledSpec streamSelectSpec = (SelectClauseStreamCompiledSpec) compiled;
        int streamNum = Integer.MIN_VALUE;
        boolean isFragmentEvent = false;
        boolean isProperty = false;
        Class propertyType = null;
        isUsingStreamSelect = true;
        for (int i = 0; i < typeService.getStreamNames().length; i++) {
            String streamName = streamSelectSpec.getStreamName();
            if (typeService.getStreamNames()[i].equals(streamName)) {
                streamNum = i;
                break;
            }

            // see if the stream name is known as a nested event type
            EventType candidateProviderOfFragments = typeService.getEventTypes()[i];
            // for the native event type we don't need to fragment, we simply use the property itself since all wrappers understand Java objects
            if (!(candidateProviderOfFragments instanceof NativeEventType)
                    && (candidateProviderOfFragments.getFragmentType(streamName) != null)) {
                streamNum = i;
                isFragmentEvent = true;
                break;
            }
        }

        // stream name not found
        if (streamNum == Integer.MIN_VALUE) {
            // see if the stream name specified resolves as a property
            PropertyResolutionDescriptor desc = null;
            try {
                desc = typeService.resolveByPropertyName(streamSelectSpec.getStreamName(), false);
            } catch (StreamTypesException e) {
                // not handled
            }

            if (desc == null) {
                throw new ExprValidationException("Stream selector '" + streamSelectSpec.getStreamName()
                        + ".*' does not match any stream name in the from clause");
            }
            isProperty = true;
            propertyType = desc.getPropertyType();
            streamNum = desc.getStreamNum();
        }

        streamSelectSpec.setStreamNumber(streamNum);
        streamSelectSpec.setFragmentEvent(isFragmentEvent);
        streamSelectSpec.setProperty(isProperty, propertyType);
    }

    // Validate group-by expressions, if any (could be empty list for no group-by)
    Class[] groupByTypes = new Class[groupByNodes.length];
    for (int i = 0; i < groupByNodes.length; i++) {
        // Ensure there is no subselects
        ExprNodeSubselectDeclaredDotVisitor visitor = new ExprNodeSubselectDeclaredDotVisitor();
        groupByNodes[i].accept(visitor);
        if (visitor.getSubselects().size() > 0) {
            throw new ExprValidationException("Subselects not allowed within group-by");
        }

        ExprNode validatedGroupBy = ExprNodeUtility.getValidatedSubtree(groupByNodes[i], validationContext);
        groupByNodes[i] = validatedGroupBy;
        groupByTypes[i] = validatedGroupBy.getExprEvaluator().getType();
    }
    stmtContext.getMethodResolutionService().setGroupKeyTypes(groupByTypes);

    // Validate having clause, if present
    if (optionalHavingNode != null) {
        optionalHavingNode = ExprNodeUtility.getValidatedSubtree(optionalHavingNode, validationContext);
    }

    // Validate order-by expressions, if any (could be empty list for no order-by)
    for (int i = 0; i < orderByList.size(); i++) {
        ExprNode orderByNode = orderByList.get(i).getExprNode();

        // Ensure there is no subselects
        ExprNodeSubselectDeclaredDotVisitor visitor = new ExprNodeSubselectDeclaredDotVisitor();
        orderByNode.accept(visitor);
        if (visitor.getSubselects().size() > 0) {
            throw new ExprValidationException("Subselects not allowed within order-by clause");
        }

        Boolean isDescending = orderByList.get(i).isDescending();
        OrderByItem validatedOrderBy = new OrderByItem(
                ExprNodeUtility.getValidatedSubtree(orderByNode, validationContext), isDescending);
        orderByList.set(i, validatedOrderBy);
    }

    // Get the select expression nodes
    List<ExprNode> selectNodes = new ArrayList<ExprNode>();
    for (SelectClauseExprCompiledSpec element : namedSelectionList) {
        selectNodes.add(element.getSelectExpression());
    }

    // Get the order-by expression nodes
    List<ExprNode> orderByNodes = new ArrayList<ExprNode>();
    for (OrderByItem element : orderByList) {
        orderByNodes.add(element.getExprNode());
    }

    // Determine aggregate functions used in select, if any
    List<ExprAggregateNode> selectAggregateExprNodes = new LinkedList<ExprAggregateNode>();
    for (SelectClauseExprCompiledSpec element : namedSelectionList) {
        ExprAggregateNodeUtil.getAggregatesBottomUp(element.getSelectExpression(), selectAggregateExprNodes);
    }
    if (!allowAggregation && !selectAggregateExprNodes.isEmpty()) {
        throw new ExprValidationException("Aggregation functions are not allowed in this context");
    }

    // Determine if we have a having clause with aggregation
    List<ExprAggregateNode> havingAggregateExprNodes = new LinkedList<ExprAggregateNode>();
    Set<Pair<Integer, String>> propertiesAggregatedHaving = new HashSet<Pair<Integer, String>>();
    if (optionalHavingNode != null) {
        ExprAggregateNodeUtil.getAggregatesBottomUp(optionalHavingNode, havingAggregateExprNodes);
        propertiesAggregatedHaving = ExprNodeUtility.getAggregatedProperties(havingAggregateExprNodes);
    }
    if (!allowAggregation && !havingAggregateExprNodes.isEmpty()) {
        throw new ExprValidationException("Aggregation functions are not allowed in this context");
    }

    // Determine if we have a order-by clause with aggregation
    List<ExprAggregateNode> orderByAggregateExprNodes = new LinkedList<ExprAggregateNode>();
    if (orderByNodes != null) {
        for (ExprNode orderByNode : orderByNodes) {
            ExprAggregateNodeUtil.getAggregatesBottomUp(orderByNode, orderByAggregateExprNodes);
        }
        if (!allowAggregation && !orderByAggregateExprNodes.isEmpty()) {
            throw new ExprValidationException("Aggregation functions are not allowed in this context");
        }
    }

    // Construct the appropriate aggregation service
    boolean hasGroupBy = groupByNodes.length > 0;
    AggregationServiceFactoryDesc aggregationServiceFactory = AggregationServiceFactoryFactory.getService(
            selectAggregateExprNodes, havingAggregateExprNodes, orderByAggregateExprNodes, hasGroupBy,
            evaluatorContextStmt, statementSpec.getAnnotations(), stmtContext.getVariableService(),
            typeService.getEventTypes().length > 1, statementSpec.getFilterRootNode(),
            statementSpec.getHavingExprRootNode(), stmtContext.getAggregationServiceFactoryService(),
            typeService.getEventTypes());

    boolean useCollatorSort = false;
    if (stmtContext.getConfigSnapshot() != null) {
        useCollatorSort = stmtContext.getConfigSnapshot().getEngineDefaults().getLanguage()
                .isSortUsingCollator();
    }

    // Construct the processor for sorting output events
    OrderByProcessorFactory orderByProcessorFactory = OrderByProcessorFactoryFactory.getProcessor(
            namedSelectionList, groupByNodes, orderByList, statementSpec.getRowLimitSpec(),
            stmtContext.getVariableService(), useCollatorSort);

    // Construct the processor for evaluating the select clause
    SelectExprEventTypeRegistry selectExprEventTypeRegistry = new SelectExprEventTypeRegistry(
            stmtContext.getStatementName(), stmtContext.getStatementEventTypeRef());
    SelectExprProcessor selectExprProcessor = SelectExprProcessorFactory.getProcessor(
            Collections.<Integer>emptyList(), selectClauseSpec.getSelectExprList(), isUsingWildcard,
            insertIntoDesc, statementSpec.getForClauseSpec(), typeService, stmtContext.getEventAdapterService(),
            stmtContext.getStatementResultService(), stmtContext.getValueAddEventService(),
            selectExprEventTypeRegistry, stmtContext.getMethodResolutionService(), evaluatorContextStmt,
            stmtContext.getVariableService(), stmtContext.getTimeProvider(), stmtContext.getEngineURI(),
            stmtContext.getStatementId(), stmtContext.getStatementName(), stmtContext.getAnnotations(),
            stmtContext.getContextDescriptor(), stmtContext.getConfigSnapshot(), selectExprProcessorCallback);

    // Get a list of event properties being aggregated in the select clause, if any
    Set<Pair<Integer, String>> propertiesGroupBy = getGroupByProperties(groupByNodes);
    // Figure out all non-aggregated event properties in the select clause (props not under a sum/avg/max aggregation node)
    Set<Pair<Integer, String>> nonAggregatedProps = ExprNodeUtility
            .getNonAggregatedProps(typeService.getEventTypes(), selectNodes, contextPropertyRegistry);
    if (optionalHavingNode != null) {
        ExprNodeUtility.addNonAggregatedProps(optionalHavingNode, nonAggregatedProps);
    }

    // Validate that group-by is filled with sensible nodes (identifiers, and not part of aggregates selected, no aggregates)
    validateGroupBy(groupByNodes);

    // Validate the having-clause (selected aggregate nodes and all in group-by are allowed)
    boolean hasAggregation = (!selectAggregateExprNodes.isEmpty()) || (!havingAggregateExprNodes.isEmpty())
            || (!orderByAggregateExprNodes.isEmpty()) || (!propertiesAggregatedHaving.isEmpty());
    if (optionalHavingNode != null && hasAggregation) {
        validateHaving(propertiesGroupBy, optionalHavingNode);
    }

    // We only generate Remove-Stream events if they are explicitly selected, or the insert-into requires them
    boolean isSelectRStream = (statementSpec
            .getSelectStreamSelectorEnum() == SelectClauseStreamSelectorEnum.RSTREAM_ISTREAM_BOTH
            || statementSpec.getSelectStreamSelectorEnum() == SelectClauseStreamSelectorEnum.RSTREAM_ONLY);
    if ((statementSpec.getInsertIntoDesc() != null)
            && (statementSpec.getInsertIntoDesc().getStreamSelector().isSelectsRStream())) {
        isSelectRStream = true;
    }

    // Determine if any output rate limiting must be performed early while processing results
    boolean isOutputLimiting = outputLimitSpec != null;
    if ((outputLimitSpec != null) && outputLimitSpec.getDisplayLimit() == OutputLimitLimitType.SNAPSHOT) {
        isOutputLimiting = false; // Snapshot output does not count in terms of limiting output for grouping/aggregation purposes
    }

    ExprEvaluator optionHavingEval = optionalHavingNode == null ? null : optionalHavingNode.getExprEvaluator();

    // (1)
    // There is no group-by clause and no aggregate functions with event properties in the select clause and having clause (simplest case)
    if ((groupByNodes.length == 0) && (selectAggregateExprNodes.isEmpty())
            && (havingAggregateExprNodes.isEmpty())) {
        // (1a)
        // There is no need to perform select expression processing, the single view itself (no join) generates
        // events in the desired format, therefore there is no output processor. There are no order-by expressions.
        if (orderByNodes.isEmpty() && optionalHavingNode == null && !isOutputLimiting
                && statementSpec.getRowLimitSpec() == null) {
            log.debug(".getProcessor Using no result processor");
            ResultSetProcessorHandThrougFactory factory = new ResultSetProcessorHandThrougFactory(
                    selectExprProcessor, isSelectRStream);
            return new ResultSetProcessorFactoryDesc(factory, orderByProcessorFactory,
                    aggregationServiceFactory);
        }

        // (1b)
        // We need to process the select expression in a simple fashion, with each event (old and new)
        // directly generating one row, and no need to update aggregate state since there is no aggregate function.
        // There might be some order-by expressions.
        log.debug(".getProcessor Using ResultSetProcessorSimple");
        ResultSetProcessorSimpleFactory factory = new ResultSetProcessorSimpleFactory(selectExprProcessor,
                optionHavingEval, isSelectRStream);
        return new ResultSetProcessorFactoryDesc(factory, orderByProcessorFactory, aggregationServiceFactory);
    }

    // (2)
    // A wildcard select-clause has been specified and the group-by is ignored since no aggregation functions are used, and no having clause
    boolean isLast = statementSpec.getOutputLimitSpec() != null
            && statementSpec.getOutputLimitSpec().getDisplayLimit() == OutputLimitLimitType.LAST;
    if ((namedSelectionList.isEmpty()) && (propertiesAggregatedHaving.isEmpty())
            && (havingAggregateExprNodes.isEmpty()) && (!isLast)) {
        log.debug(".getProcessor Using ResultSetProcessorSimple");
        ResultSetProcessorSimpleFactory factory = new ResultSetProcessorSimpleFactory(selectExprProcessor,
                optionHavingEval, isSelectRStream);
        return new ResultSetProcessorFactoryDesc(factory, orderByProcessorFactory, aggregationServiceFactory);
    }

    if ((groupByNodes.length == 0) && hasAggregation) {
        // (3)
        // There is no group-by clause and there are aggregate functions with event properties in the select clause (aggregation case)
        // or having class, and all event properties are aggregated (all properties are under aggregation functions).
        if ((nonAggregatedProps.isEmpty()) && (!isUsingWildcard) && (!isUsingStreamSelect)
                && (viewResourceDelegate == null || viewResourceDelegate.getPreviousRequests().isEmpty())) {
            log.debug(".getProcessor Using ResultSetProcessorRowForAll");
            ResultSetProcessorRowForAllFactory factory = new ResultSetProcessorRowForAllFactory(
                    selectExprProcessor, optionHavingEval, isSelectRStream, isUnidirectional);
            return new ResultSetProcessorFactoryDesc(factory, orderByProcessorFactory,
                    aggregationServiceFactory);
        }

        // (4)
        // There is no group-by clause but there are aggregate functions with event properties in the select clause (aggregation case)
        // or having clause and not all event properties are aggregated (some properties are not under aggregation functions).
        log.debug(".getProcessor Using ResultSetProcessorAggregateAll");
        ResultSetProcessorAggregateAllFactory factory = new ResultSetProcessorAggregateAllFactory(
                selectExprProcessor, optionHavingEval, isSelectRStream, isUnidirectional);
        return new ResultSetProcessorFactoryDesc(factory, orderByProcessorFactory, aggregationServiceFactory);
    }

    // Handle group-by cases
    if (groupByNodes.length == 0) {
        throw new IllegalStateException("Unexpected empty group-by expression list");
    }

    // Figure out if all non-aggregated event properties in the select clause are listed in the group by
    Set<Pair<Integer, String>> nonAggregatedPropsSelect = ExprNodeUtility
            .getNonAggregatedProps(typeService.getEventTypes(), selectNodes, contextPropertyRegistry);
    boolean allInGroupBy = true;
    if (isUsingStreamSelect) {
        allInGroupBy = false;
    }
    for (Pair<Integer, String> nonAggregatedProp : nonAggregatedPropsSelect) {
        if (!propertiesGroupBy.contains(nonAggregatedProp)) {
            allInGroupBy = false;
        }
    }

    // Wildcard select-clause means we do not have all selected properties in the group
    if (isUsingWildcard) {
        allInGroupBy = false;
    }

    // Figure out if all non-aggregated event properties in the order-by clause are listed in the select expression
    Set<Pair<Integer, String>> nonAggregatedPropsOrderBy = ExprNodeUtility
            .getNonAggregatedProps(typeService.getEventTypes(), orderByNodes, contextPropertyRegistry);

    boolean allInSelect = true;
    for (Pair<Integer, String> nonAggregatedProp : nonAggregatedPropsOrderBy) {
        if (!nonAggregatedPropsSelect.contains(nonAggregatedProp)) {
            allInSelect = false;
        }
    }

    // Wildcard select-clause means that all order-by props in the select expression
    if (isUsingWildcard) {
        allInSelect = true;
    }

    // (4)
    // There is a group-by clause, and all event properties in the select clause that are not under an aggregation
    // function are listed in the group-by clause, and if there is an order-by clause, all non-aggregated properties
    // referred to in the order-by clause also appear in the select (output one row per group, not one row per event)
    ExprEvaluator[] groupByEval = ExprNodeUtility.getEvaluators(groupByNodes);
    if (allInGroupBy && allInSelect) {
        log.debug(".getProcessor Using ResultSetProcessorRowPerGroup");
        boolean noDataWindowSingleStream = typeService.getIStreamOnly()[0]
                && typeService.getEventTypes().length < 2;
        ResultSetProcessorRowPerGroupFactory factory = new ResultSetProcessorRowPerGroupFactory(
                selectExprProcessor, groupByEval, optionHavingEval, isSelectRStream, isUnidirectional,
                outputLimitSpec, orderByProcessorFactory != null, noDataWindowSingleStream);
        return new ResultSetProcessorFactoryDesc(factory, orderByProcessorFactory, aggregationServiceFactory);
    }

    // (6)
    // There is a group-by clause, and one or more event properties in the select clause that are not under an aggregation
    // function are not listed in the group-by clause (output one row per event, not one row per group)
    log.debug(".getProcessor Using ResultSetProcessorAggregateGrouped");
    ResultSetProcessorAggregateGroupedFactory factory = new ResultSetProcessorAggregateGroupedFactory(
            selectExprProcessor, groupByEval, optionHavingEval, isSelectRStream, isUnidirectional,
            outputLimitSpec, orderByProcessorFactory != null);
    return new ResultSetProcessorFactoryDesc(factory, orderByProcessorFactory, aggregationServiceFactory);
}

From source file:ch.unil.genescore.pathway.GeneSetLibrary.java

License:asdf

/** Count min, max and total number of merged genes per meta-gene */
public int[] countMergedGenes() {

    // Initialize
    int[] minMaxTot = new int[3];
    minMaxTot[0] = Integer.MAX_VALUE;
    minMaxTot[1] = Integer.MIN_VALUE;
    minMaxTot[2] = 0;//from ww w.  j a v  a2 s.co  m

    for (GeneSet set : geneSets_)
        set.countMergedGenes(minMaxTot);

    return minMaxTot;
}

From source file:com.sun.faces.taglib.html_basic.PanelGridTag.java

protected void setProperties(UIComponent component) {
    super.setProperties(component);
    UIPanel panel = null;// www.j a  v  a  2s.c o m
    try {
        panel = (UIPanel) component;
    } catch (ClassCastException cce) {
        throw new IllegalStateException("Component " + component.toString()
                + " not expected type.  Expected: UIPanel.  Perhaps you're missing a tag?");
    }

    if (bgcolor != null) {
        if (isValueReference(bgcolor)) {
            ValueBinding vb = Util.getValueBinding(bgcolor);
            panel.setValueBinding("bgcolor", vb);
        } else {
            panel.getAttributes().put("bgcolor", bgcolor);
        }
    }
    if (border != null) {
        if (isValueReference(border)) {
            ValueBinding vb = Util.getValueBinding(border);
            panel.setValueBinding("border", vb);
        } else {
            int _border = new Integer(border).intValue();
            if (_border != Integer.MIN_VALUE) {
                panel.getAttributes().put("border", new Integer(_border));
            }
        }
    }
    if (cellpadding != null) {
        if (isValueReference(cellpadding)) {
            ValueBinding vb = Util.getValueBinding(cellpadding);
            panel.setValueBinding("cellpadding", vb);
        } else {
            panel.getAttributes().put("cellpadding", cellpadding);
        }
    }
    if (cellspacing != null) {
        if (isValueReference(cellspacing)) {
            ValueBinding vb = Util.getValueBinding(cellspacing);
            panel.setValueBinding("cellspacing", vb);
        } else {
            panel.getAttributes().put("cellspacing", cellspacing);
        }
    }
    if (columnClasses != null) {
        if (isValueReference(columnClasses)) {
            ValueBinding vb = Util.getValueBinding(columnClasses);
            panel.setValueBinding("columnClasses", vb);
        } else {
            panel.getAttributes().put("columnClasses", columnClasses);
        }
    }
    if (columns != null) {
        if (isValueReference(columns)) {
            ValueBinding vb = Util.getValueBinding(columns);
            panel.setValueBinding("columns", vb);
        } else {
            int _columns = new Integer(columns).intValue();
            if (_columns != Integer.MIN_VALUE) {
                panel.getAttributes().put("columns", new Integer(_columns));
            }
        }
    }
    if (dir != null) {
        if (isValueReference(dir)) {
            ValueBinding vb = Util.getValueBinding(dir);
            panel.setValueBinding("dir", vb);
        } else {
            panel.getAttributes().put("dir", dir);
        }
    }
    if (footerClass != null) {
        if (isValueReference(footerClass)) {
            ValueBinding vb = Util.getValueBinding(footerClass);
            panel.setValueBinding("footerClass", vb);
        } else {
            panel.getAttributes().put("footerClass", footerClass);
        }
    }
    if (frame != null) {
        if (isValueReference(frame)) {
            ValueBinding vb = Util.getValueBinding(frame);
            panel.setValueBinding("frame", vb);
        } else {
            panel.getAttributes().put("frame", frame);
        }
    }
    if (headerClass != null) {
        if (isValueReference(headerClass)) {
            ValueBinding vb = Util.getValueBinding(headerClass);
            panel.setValueBinding("headerClass", vb);
        } else {
            panel.getAttributes().put("headerClass", headerClass);
        }
    }
    if (lang != null) {
        if (isValueReference(lang)) {
            ValueBinding vb = Util.getValueBinding(lang);
            panel.setValueBinding("lang", vb);
        } else {
            panel.getAttributes().put("lang", lang);
        }
    }
    if (onclick != null) {
        if (isValueReference(onclick)) {
            ValueBinding vb = Util.getValueBinding(onclick);
            panel.setValueBinding("onclick", vb);
        } else {
            panel.getAttributes().put("onclick", onclick);
        }
    }
    if (ondblclick != null) {
        if (isValueReference(ondblclick)) {
            ValueBinding vb = Util.getValueBinding(ondblclick);
            panel.setValueBinding("ondblclick", vb);
        } else {
            panel.getAttributes().put("ondblclick", ondblclick);
        }
    }
    if (onkeydown != null) {
        if (isValueReference(onkeydown)) {
            ValueBinding vb = Util.getValueBinding(onkeydown);
            panel.setValueBinding("onkeydown", vb);
        } else {
            panel.getAttributes().put("onkeydown", onkeydown);
        }
    }
    if (onkeypress != null) {
        if (isValueReference(onkeypress)) {
            ValueBinding vb = Util.getValueBinding(onkeypress);
            panel.setValueBinding("onkeypress", vb);
        } else {
            panel.getAttributes().put("onkeypress", onkeypress);
        }
    }
    if (onkeyup != null) {
        if (isValueReference(onkeyup)) {
            ValueBinding vb = Util.getValueBinding(onkeyup);
            panel.setValueBinding("onkeyup", vb);
        } else {
            panel.getAttributes().put("onkeyup", onkeyup);
        }
    }
    if (onmousedown != null) {
        if (isValueReference(onmousedown)) {
            ValueBinding vb = Util.getValueBinding(onmousedown);
            panel.setValueBinding("onmousedown", vb);
        } else {
            panel.getAttributes().put("onmousedown", onmousedown);
        }
    }
    if (onmousemove != null) {
        if (isValueReference(onmousemove)) {
            ValueBinding vb = Util.getValueBinding(onmousemove);
            panel.setValueBinding("onmousemove", vb);
        } else {
            panel.getAttributes().put("onmousemove", onmousemove);
        }
    }
    if (onmouseout != null) {
        if (isValueReference(onmouseout)) {
            ValueBinding vb = Util.getValueBinding(onmouseout);
            panel.setValueBinding("onmouseout", vb);
        } else {
            panel.getAttributes().put("onmouseout", onmouseout);
        }
    }
    if (onmouseover != null) {
        if (isValueReference(onmouseover)) {
            ValueBinding vb = Util.getValueBinding(onmouseover);
            panel.setValueBinding("onmouseover", vb);
        } else {
            panel.getAttributes().put("onmouseover", onmouseover);
        }
    }
    if (onmouseup != null) {
        if (isValueReference(onmouseup)) {
            ValueBinding vb = Util.getValueBinding(onmouseup);
            panel.setValueBinding("onmouseup", vb);
        } else {
            panel.getAttributes().put("onmouseup", onmouseup);
        }
    }
    if (rowClasses != null) {
        if (isValueReference(rowClasses)) {
            ValueBinding vb = Util.getValueBinding(rowClasses);
            panel.setValueBinding("rowClasses", vb);
        } else {
            panel.getAttributes().put("rowClasses", rowClasses);
        }
    }
    if (rules != null) {
        if (isValueReference(rules)) {
            ValueBinding vb = Util.getValueBinding(rules);
            panel.setValueBinding("rules", vb);
        } else {
            panel.getAttributes().put("rules", rules);
        }
    }
    if (style != null) {
        if (isValueReference(style)) {
            ValueBinding vb = Util.getValueBinding(style);
            panel.setValueBinding("style", vb);
        } else {
            panel.getAttributes().put("style", style);
        }
    }
    if (styleClass != null) {
        if (isValueReference(styleClass)) {
            ValueBinding vb = Util.getValueBinding(styleClass);
            panel.setValueBinding("styleClass", vb);
        } else {
            panel.getAttributes().put("styleClass", styleClass);
        }
    }
    if (summary != null) {
        if (isValueReference(summary)) {
            ValueBinding vb = Util.getValueBinding(summary);
            panel.setValueBinding("summary", vb);
        } else {
            panel.getAttributes().put("summary", summary);
        }
    }
    if (title != null) {
        if (isValueReference(title)) {
            ValueBinding vb = Util.getValueBinding(title);
            panel.setValueBinding("title", vb);
        } else {
            panel.getAttributes().put("title", title);
        }
    }
    if (width != null) {
        if (isValueReference(width)) {
            ValueBinding vb = Util.getValueBinding(width);
            panel.setValueBinding("width", vb);
        } else {
            panel.getAttributes().put("width", width);
        }
    }
}

From source file:com.magnet.android.mms.request.GenericResponseParserPrimitiveTest.java

@SmallTest
public void testNumberResponse() throws MobileException, JSONException {
    GenericResponseParser<Integer> parser = new GenericResponseParser<Integer>(Integer.class);
    String response = Integer.toString(Integer.MIN_VALUE);

    Integer result = (Integer) parser.parseResponse(response.toString().getBytes());
    assertEquals(Integer.MIN_VALUE, result.intValue());

    Object nullresult = parser.parseResponse((byte[]) null);
    assertEquals(null, nullresult);//from ww  w .j av a 2s  . c  o  m

    long longvalue = new Random().nextLong();
    GenericResponseParser<Long> lparser = new GenericResponseParser<Long>(Long.class);
    long longresult = (Long) lparser.parseResponse(Long.toString(longvalue).getBytes());
    assertEquals(longvalue, longresult);

    short shortvalue = Short.MAX_VALUE;
    GenericResponseParser<Short> sparser = new GenericResponseParser<Short>(short.class);
    short shortresult = (Short) sparser.parseResponse(Short.toString(shortvalue).getBytes());
    assertEquals(shortvalue, shortresult);

    float floatvalue = new Random().nextFloat();
    GenericResponseParser<Float> fparser = new GenericResponseParser<Float>(Float.class);
    float floatresult = (Float) fparser.parseResponse(Float.toString(floatvalue).getBytes());
    assertEquals(String.valueOf(floatvalue), String.valueOf(floatresult));
    // use string as the value of the float

    double doublevalue = new Random().nextDouble();
    GenericResponseParser<Double> dparser = new GenericResponseParser<Double>(double.class);
    Double doubleresult = (Double) dparser.parseResponse(Double.toString(doublevalue).getBytes());
    assertEquals(String.valueOf(doublevalue), String.valueOf(doubleresult));

    byte bytevalue = Byte.MIN_VALUE + 10;
    GenericResponseParser<Byte> bparser = new GenericResponseParser<Byte>(Byte.class);
    Byte byteresult = (Byte) bparser.parseResponse(Byte.toString(bytevalue).getBytes());
    assertEquals(bytevalue, byteresult.byteValue());

}

From source file:cn.org.once.cstack.volumes.VolumeControllerTestIT.java

/**
 * Delete a missing volume//w w  w .j  av a 2  s.  c o  m
 *
 * @throws Exception
 */
@Test
public void deleteMissingVolume() throws Exception {
    // delete the volume
    deleteVolume(Integer.MIN_VALUE, HttpStatus.BAD_REQUEST);
}

From source file:com.stgmastek.core.comm.main.StartCoreCommunication.java

static void getBundleDetails() {
    strBundleDetailsArray_ = new String[] { "Unknown", "Unknown", "Unknown", Integer.MIN_VALUE + "",
            Integer.MIN_VALUE + "", Integer.MIN_VALUE + "" };
    String localFile = StartCoreCommunication.class.getProtectionDomain().getCodeSource().getLocation()
            .toString();/*from  w w w .  jav  a2 s. com*/
    localFile = localFile.concat("!/");
    String tmpString = "jar:";
    String localJarFileString = tmpString.concat(localFile);
    URL localJarFileURL;
    try {
        localJarFileURL = new URL(localJarFileString);
        JarURLConnection localJarFile = (JarURLConnection) localJarFileURL.openConnection();
        Manifest mf = localJarFile.getManifest();
        Attributes attributes = mf.getMainAttributes();
        strBundleDetailsArray_[0] = (String) attributes.getValue("Bundle-Name");
        strBundleDetailsArray_[1] = (String) attributes.getValue("Bundle-Version");
        strBundleDetailsArray_[2] = (String) attributes.getValue("Bundled-On");
        strBundleDetailsArray_[3] = (String) attributes.getValue("Major-Version");
        strBundleDetailsArray_[4] = (String) attributes.getValue("Minor-Version");
        strBundleDetailsArray_[5] = (String) attributes.getValue("Build-Number");
    } catch (MalformedURLException e) {
        // do nothing
    } catch (FileNotFoundException fnfe) {
        // do nothing
    } catch (IOException ioe) {
        // do nothing
    }
}

From source file:eu.abc4trust.cryptoEngine.uprove.util.UProveLauncher.java

public int stop() {
    // System.out.println("UProveLauncher.stop instance : " + this + " : " + launchName + " - port : " + launchPort + " - is stopped == " + stopped + " - process : " + this.uproveProcess);
    if (this.uproveProcess != null) {
        try {//from  w  ww .j  a  v a  2s . co  m
            OutputStream outputStream = this.uproveProcess.getOutputStream();
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
            BufferedWriter out = new BufferedWriter(outputStreamWriter);
            out.newLine();
            out.flush();
            int exitCode = -1;
            boolean done = false;
            while (!done) {
                try {
                    exitCode = this.uproveProcess.exitValue();
                    done = true;
                    break;
                } catch (IllegalThreadStateException ex) {
                    // System.out.println("process not terminated");
                    this.waitFor(1);
                }
            }
            this.debugOutputCollector.stop();
            this.debugOutput.interrupt();
            this.uproveProcess = null;
            return exitCode;
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
    if (this.startCalled) {
        return Integer.MIN_VALUE;
    } else {
        return 0;
    }
}

From source file:org.activiti.rest.util.ActivitiWebScript.java

/**
 * Gets an int parameter value./*from   ww  w . j  a  v a 2s  . c o m*/
 *
 * @param req The webscript request
 * @param param The name of the int parameter
 * @return The int parameter value or Integer.MIN_VALUE if not present
 */
protected int getInt(WebScriptRequest req, String param) {
    String value = getString(req, param);
    return value != null ? Integer.parseInt(value) : Integer.MIN_VALUE;
}

From source file:com.github.lynxdb.server.core.Aggregator.java

protected TimeSerie doDefaultIfMissing(List<TimeSerie> _series, Reducer _reducer, double _default) {
    Assert.notEmpty(_series);//from   www  .  j  a v a  2  s  .  c o m

    List<SuperIterator> sil = new ArrayList<>();

    _series.forEach((TimeSerie t) -> {
        if (t.hasNext()) {
            SuperIterator<Entry> si = new SuperIterator<>(t);
            si.next();
            sil.add(si);
        }
    });

    Map<String, String> tags = new HashMap<>();
    tags.putAll(_series.get(0).getTags());

    _series.forEach((TimeSerie t) -> {
        Iterator<Map.Entry<String, String>> i = tags.entrySet().iterator();
        while (i.hasNext()) {
            Map.Entry<String, String> e = i.next();
            if (!t.getTags().containsKey(e.getKey()) || !t.getTags().get(e.getKey()).equals(e.getValue())) {
                i.remove();
            }

        }
    });

    return new TimeSerie(_series.get(0).getName(), tags, new ChainableIterator<Entry>() {

        @Override
        public boolean hasNext() {
            return sil.stream().anyMatch((SuperIterator t) -> t.hasNext() || t.getCurrent() != null);
        }

        @Override
        public Entry next() {
            _reducer.reset();

            Iterator<SuperIterator> rr = sil.iterator();
            while (rr.hasNext()) {
                if (rr.next().getCurrent() == null) {
                    rr.remove();
                }
            }

            int max = Integer.MIN_VALUE;

            for (SuperIterator<Entry> r : sil) {
                max = Integer.max(max, r.getCurrent().getTime());
            }

            for (SuperIterator<Entry> r : sil) {
                if (r.getCurrent().getTime() == max) {
                    _reducer.update(r.getCurrent());
                    r.next();
                } else if (r.getPrevious() != null) {
                    _reducer.update(new Entry(max, _default));
                }
            }
            return new Entry(max, _reducer.result());
        }
    });
}