📄 aggregationmin.java
字号:
/* * @(#)$Id: AggregationMin.java,v 1.9 2005/04/13 20:17:44 huebsch Exp $ * * Copyright (c) 2001-2004 Regents of the University of California. * All rights reserved. * * This file is distributed under the terms in the attached BERKELEY-LICENSE * file. If you do not find these files, copies can be found by writing to: * Computer Science Division, Database Group, Universite of California, * 617 Soda Hall #1776, Berkeley, CA 94720-1776. Attention: Berkeley License * * Copyright (c) 2003-2004 Intel Corporation. All rights reserved. * * This file is distributed under the terms in the attached INTEL-LICENSE file. * If you do not find these files, copies can be found by writing to: * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, * Berkeley, CA, 94704. Attention: Intel License Inquiry. */package pier.helpers.aggregation;import pier.data.DataTypes;import util.network.serialization.GenericByteBuffer;import util.network.serialization.SerializationManager;/** * Class AggregationMin * */public class AggregationMin implements AggregationOperator { public static long serialVersionUID = SerializationManager.getSerialUID( "pier.helpers.aggregation.AggregationMin"); private Object lowVal; /** * DeSerialize the object from the provided GenericByteBuffer. * * @param inputBuffer */ /** * Constructor AggregationMin * * @param inputBuffer */ public AggregationMin(GenericByteBuffer inputBuffer) { this.lowVal = SerializationManager.deSerializeExtended(inputBuffer); } /** * Serialize the object into the provided GenericByteBuffer. * * @param outputBuffer * @return */ /** * Method serialize * * @param outputBuffer * @return */ public long serialize(GenericByteBuffer outputBuffer) { SerializationManager.serializeExtended(outputBuffer, lowVal); return serialVersionUID; } /** * Constructor AggregationMin */ public AggregationMin() { lowVal = null; } /** * Method addBaseValue * * @param data * @return */ public boolean addBaseValue(Object data) { if ((lowVal == null) || ((Comparable) lowVal).compareTo(data) > 0) { lowVal = data; return true; } else { return false; } } /** * Method addPartialResult * * @param data * @return */ public boolean addPartialResult(AggregationOperator data) { return addBaseValue(((AggregationMin) data).lowVal); } /** * Method result * @return */ public Object result() { return lowVal; } /** * Method getSize * @return */ public int getSize() { return DataTypes.getSize(lowVal); } /** * Method hashCode * @return */ public int hashCode() { return lowVal.hashCode(); } /** * Method equals * * @param other * @return */ public boolean equals(Object other) { return (lowVal.equals(((AggregationMin) other).lowVal)); } /** * Method compareTo * * @param o * @return */ public int compareTo(Object o) { return DataTypes.compareTo(lowVal, ((AggregationMin) o).lowVal); } /** * Method getClone * @return */ public Object getClone() { AggregationMin newObject = new AggregationMin(); newObject.lowVal = DataTypes.getClone(lowVal); return newObject; } /** * Method add * * @param other * @return */ public Object add(Object other) { throw new RuntimeException( "DataTypes: Unsupported data type for adding: " + this.getClass() + " and " + other.getClass()); } /** * Method divide * * @param denominator * @return */ public Object divide(long denominator) { throw new RuntimeException( "DataTypes: Unsupported data type for division: " + this.getClass()); } /** * Method toString * @return */ public String toString() { return new String("AGG-MIN:" + lowVal); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -