Example usage for java.lang Byte equals

List of usage examples for java.lang Byte equals

Introduction

In this page you can find the example usage for java.lang Byte equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Compares this object to the specified object.

Usage

From source file:Main.java

public static void main(String[] args) {

    Byte byte1 = new Byte("1");
    Byte byte2 = new Byte("2");
    System.out.println(byte1.equals(byte2));
}

From source file:edu.ku.brc.specify.tasks.services.PickListUtils.java

public static boolean equals(Byte v1, Byte v2) {
    return (v1 == null ? v2 == null : v1.equals(v2));
}

From source file:com.healthmarketscience.jackcess.query.QueryTest.java

private static void removeRows(Query query, Byte attr) {
    for (Iterator<Row> iter = ((QueryImpl) query).getRows().iterator(); iter.hasNext();) {
        if (attr.equals(iter.next().attribute)) {
            iter.remove();//from   ww w  . j  a va2 s  .c om
        }
    }
}

From source file:com.healthmarketscience.jackcess.impl.query.QueryImpl.java

private static List<Row> getRowsByAttribute(List<Row> rows, Byte attribute) {
    List<Row> result = new ArrayList<Row>();
    for (Row row : rows) {
        if (attribute.equals(row.attribute)) {
            result.add(row);//  w  w w.j  a  va2s  . co m
        }
    }
    return result;
}

From source file:com.jaspersoft.ireport.designer.sheet.properties.charts.OrientationProperty.java

@Override
public void setByte(Byte position) {
    if (position.equals(ORIENTATION_VERTICAL)) {
        plot.setOrientation(PlotOrientation.VERTICAL);
    } else {//from   w  w w . j  ava2 s  .  c  o  m
        plot.setOrientation(PlotOrientation.HORIZONTAL);
    }
}

From source file:ch.epfl.lis.gnwgui.jungtransformers.EdgeArrowColorTransformer.java

/**
 * Return the color that should be used for each edge/arrow of the network.
 *//*from w  w  w.  ja  va  2s  .  co  m*/
public Paint transform(E e) {

    Edge edge = (Edge) e;
    Byte type = edge.getType();

    if (type.equals(enhancerType_))
        return enhancerColor_;
    else if (type.equals(inhibitorType_))
        return inhibitoryColor_;
    else if (type.equals(dualType_))
        return dualColor_;
    else if (type.equals(unknownType_))
        return unknownColor_;
    else
        return Color.BLACK;
}

From source file:ch.epfl.lis.gnwgui.jungtransformers.EdgeTransformer.java

/**
 * Return the color that should be used for each edge/arrow of the network.
 *//*from  w  w  w.  j  a va 2  s  .c o m*/
public Stroke transform(E e) {

    Edge edge = (Edge) e;
    Byte type = edge.getType();

    if (type.equals(enhancerType_))
        return enhancerStroke_;
    else if (type.equals(inhibitorType_))
        return inhibitoryStroke_;
    else if (type.equals(dualType_))
        return dualStroke_;
    else if (type.equals(unknownType_))
        return unknownStroke_;
    else
        return getBasicStroke(10.0f);
}

From source file:ch.epfl.lis.gnwgui.jungtransformers.ArrowShapeTransformer.java

/**
 * Return the arrow that should be used for each edge of the network.
 *///from w  w w  . j  a  v  a2s.c o  m
public Shape transform(Context<Graph<V, E>, E> context) {

    Edge e = (Edge) context.element;
    Byte type = e.getType();

    if (type.equals(enhancerType_))
        return enhancerArrow_;
    else if (type.equals(inhibitorType_))
        return inhibitoryArrow_;
    else if (type.equals(dualType_))
        return dualArrow_;
    else if (type.equals(unknownType_))
        return unknownArrow_;
    else
        return unknownArrow_;
}

From source file:edu.ku.brc.specify.datamodel.PickListItem.java

public int compareTo(PickListItemIFace obj) {
    Byte sortType = null;

    if (pickList != null) {
        sortType = pickList.getSortType();
    }/*from   ww w. ja va2s. c  om*/

    if (sortType != null && sortType.equals(PickListIFace.PL_ORDINAL_SORT)) {
        if (ordinal.equals(obj.getOrdinal())) {
            return 0;
        }
        // else
        return ordinal.compareTo(obj.getOrdinal());
    }

    // Default to title
    if (title != null && obj != null && obj.getTitle() != null) {
        return title.compareTo(obj.getTitle());
    }
    // else
    return 0;
}

From source file:com.ebay.erl.mobius.core.mapred.DefaultMobiusReducer.java

@Override
public void joinreduce(Tuple key, DataJoinValueGroup<Tuple> values,
        OutputCollector<NullWritable, WritableComparable<?>> output, Reporter reporter) throws IOException {

    // set reporter for all projectable
    if (!reporterSet) {
        for (Projectable p : this._projections) {
            LOGGER.info("Set reporter to " + p.getClass().getCanonicalName());
            p.setReporter(reporter);/*from   w  w  w  .  ja v a  2  s  .  c om*/
        }
        reporterSet = true;
    }

    this.clearPreviousResults();

    int expectingDatasetIDX = 0;
    // don't keep the values from last dataset into {@BigTupleList},
    // using iterator to iterate them through to perform
    // cross product
    Iterator<Tuple> valuesFromLastDataset = null;

    //////////////////////////////////////////
    // compute the result for the projections
    //////////////////////////////////////////
    while (values.hasNext()) {
        Byte datasetID = values.nextDatasetID();

        if (!datasetID.equals(_allDatasetIDs[expectingDatasetIDX])) {
            // no records coming from the expected dataset, means
            // 1) not full inner join-able, 
            // 2) no records from the left dataset when this is a left-outer-join, or 
            // 3) no records from the right dataset when this is a right-outer-join, return
            return;
        }

        expectingDatasetIDX++;
        if (!datasetID.equals(this._lastDatasetID))// values not from the last dataset
        {
            Iterator<Tuple> valuesForCurrentDataset = values.next();
            computeSingleDSFunctionsResults(valuesForCurrentDataset, datasetID, reporter);
        } else {
            // the remaining values are all from the last
            // dataset, keep the reference of the value
            // iterator to perform cross product later
            valuesFromLastDataset = values.next();
            break;
        }
    }

    if (valuesFromLastDataset == null) {
        if (!this.isOuterJoin) {
            // no records from the last dataset, not be able to
            // do full inner join, return
            return;
        } else {
            // no records from the last dataset, but this is a 
            // outer-join job, continue.
        }
    }

    //////////////////////////////////////////////////////////////
    // cross product the results for all the datasets except
    // the last one, the result only contain projectable functions
    // that don't require columns from multiple datasets only.
    /////////////////////////////////////////////////////////////
    Iterable<Tuple> resultsFromOtherDatasets = this.crossProduct(reporter, false, _allButNotLastDatasetIDs);

    List<Iterable<Tuple>> toBeCrossProduct = new ArrayList<Iterable<Tuple>>();
    if (resultsFromOtherDatasets != null)
        toBeCrossProduct.add(resultsFromOtherDatasets);

    /////////////////////////////////////////////////////
    // start to compute the results for the final dataset
    /////////////////////////////////////////////////////

    boolean hasMultiDSFunctions = this.requirePreCrossProduct;

    if (hasMultiDSFunctions) {
        // there are functions require columns from multiple
        // dataset, so save the values from last dataset
        // into BigTupleList so we can iterate it multiple
        // times.
        if (valuesFromLastDataset != null) {
            while (valuesFromLastDataset.hasNext()) {
                Tuple aRow = valuesFromLastDataset.next();
                this.rememberTuple(_lastDatasetID, aRow, reporter);
            }

            Iterable<Tuple> preCrossProduct = Util.crossProduct(conf, reporter,
                    this.valuesForAllDatasets.values().toArray(new BigTupleList[0]));
            BigTupleList btl = new BigTupleList(reporter);
            for (Tuple aRow : preCrossProduct) {
                this.computeExtendFunctions(aRow, btl, this.multiDatasetExtendFunction);
                this.computeGroupFunctions(aRow, this.multiDatasetGroupFunction);
            }

            if (btl.size() > 0)
                toBeCrossProduct.add(btl);
            for (GroupFunction fun : this.multiDatasetGroupFunction)
                toBeCrossProduct.add(fun.getResult());

            valuesFromLastDataset = this.valuesForAllDatasets.get(_lastDatasetID).iterator();
        } else {
            if (this.multiDatasetExtendFunction.size() > 0) {
                BigTupleList btl = new BigTupleList(reporter);
                this.computeExtendFunctions(null, btl, this.multiDatasetExtendFunction);
                toBeCrossProduct.add(btl);
            }
            for (GroupFunction fun : this.multiDatasetGroupFunction)
                toBeCrossProduct.add(fun.getNoMatchResult(nullReplacement));
        }
    }
    // finished the computation of multi-dataset functions, start
    // to compute the projectable funcitons results for last
    // dataset
    //
    // first compute the cross product of all other functions
    Iterable<Tuple> others = null;
    if (toBeCrossProduct.size() > 0) {
        Iterable<Tuple>[] array = new Iterable[toBeCrossProduct.size()];
        for (int i = 0; i < toBeCrossProduct.size(); i++) {
            array[i] = toBeCrossProduct.get(i);
        }

        others = Util.crossProduct(conf, reporter, array);
    }

    if (valuesFromLastDataset == null) {// outer-join, so <code>others</code> is always not null.
        List<BigTupleList> nullResult = new ArrayList<BigTupleList>();

        if (this.singleDatasetExtendFunction.get(_lastDatasetID) != null) {
            BigTupleList btl = new BigTupleList(reporter);
            this.computeExtendFunctions(null, btl, this.singleDatasetExtendFunction.get(_lastDatasetID));
            nullResult.add(btl);
        }
        if (this.singleDatasetGroupFunction.get(_lastDatasetID) != null) {
            for (GroupFunction fun : this.singleDatasetGroupFunction.get(_lastDatasetID))
                nullResult.add(fun.getNoMatchResult(nullReplacement));
        }

        for (Tuple t1 : Util.crossProduct(conf, reporter, nullResult)) {
            for (Tuple t2 : others) {
                this.output(Tuple.merge(t1, t2), output, reporter);
            }
        }
    } else {
        boolean hasNoGroupFunctionForLastDS = this.singleDatasetGroupFunction.get(this._lastDatasetID) == null;
        while (valuesFromLastDataset.hasNext()) {
            Tuple aRow = valuesFromLastDataset.next();
            aRow.setSchema(this.getSchemaByDatasetID(_lastDatasetID));
            if (hasNoGroupFunctionForLastDS) {
                // there is no group function from the last DS, we can
                // do some optimization here: as we streaming over the
                // values of last dataset, we also emit outputs.

                Tuple merged = new Tuple();
                for (ExtendFunction func : this.singleDatasetExtendFunction.get(_lastDatasetID)) {
                    merged = Tuple.merge(merged, func.getResult(aRow));
                }

                if (others != null) {
                    for (Tuple t : others) {
                        this.output(Tuple.merge(t, merged), output, reporter);
                    }
                } else {
                    this.output(merged, output, reporter);
                }
            } else {
                this.processExtendFunctions(_lastDatasetID, aRow, reporter);
                this.computeGroupFunctions(_lastDatasetID, aRow);
            }
        }

        if (!hasNoGroupFunctionForLastDS) {
            for (Tuple t1 : this.crossProduct(reporter, false, _lastDatasetID)) {
                if (others != null) {
                    for (Tuple t2 : others) {
                        this.output(Tuple.merge(t1, t2), output, reporter);
                    }
                } else {
                    this.output(t1, output, reporter);
                }
            }
        }
    }
}