📄 aggregationconcat.java
字号:
/* * @(#)$Id: AggregationConcat.java,v 1.4 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;import util.network.serialization.SerializeString;/** * Class AggregationSum * */public class AggregationConcat implements AggregationOperator { public static long serialVersionUID = SerializationManager.getSerialUID( "pier.helpers.aggregation.AggregationConcat"); private String value; /** * DeSerialize the object from the provided GenericByteBuffer. * * @param inputBuffer */ /** * Constructor AggregationSum * * @param inputBuffer */ public AggregationConcat(GenericByteBuffer inputBuffer) { this.value = SerializeString.deSerialize(inputBuffer); } /** * Serialize the object into the provided GenericByteBuffer. * * @param outputBuffer * @return */ /** * Method serialize * * @param outputBuffer * @return */ public long serialize(GenericByteBuffer outputBuffer) { SerializeString.serialize(outputBuffer, value); return serialVersionUID; } /** * Constructor AggregationSum */ public AggregationConcat() { value = null; } /** * Method addBaseValue * * @param data * @return */ public boolean addBaseValue(Object data) { if (value == null) { value = data.toString(); } else { value += data.toString(); } return true; } /** * Method addPartialResult * * @param data * @return */ public boolean addPartialResult(AggregationOperator data) { return addBaseValue(((AggregationConcat) data).value); } /** * Method result * @return */ public Object result() { return value; } /** * Method getSize * @return */ public int getSize() { return value.length(); } /** * Method hashCode * @return */ public int hashCode() { return value.hashCode(); } /** * Method equals * * @param other * @return */ public boolean equals(Object other) { return (value.equals(((AggregationConcat) other).value)); } /** * Method compareTo * * @param o * @return */ public int compareTo(Object o) { return DataTypes.compareTo(value, ((AggregationConcat) o).value); } /** * Method getClone * @return */ public Object getClone() { AggregationConcat newObject = new AggregationConcat(); newObject.value = value.toString(); 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-CONCAT:" + value); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -