-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compatible to protobuf-java-2.3.0
- Loading branch information
0 parents
commit 2ed54c1
Showing
215 changed files
with
12,171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src/test"/> | ||
<classpathentry kind="src" path="src/java"/> | ||
<classpathentry kind="lib" path="lib/protobuf-java-2.3.0.jar"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> | ||
<classpathentry kind="lib" path="lib/1line-ferrari.jar"/> | ||
<classpathentry kind="lib" path="lib/hbase-0.90.4-cdh3u3.jar"/> | ||
<classpathentry kind="lib" path="lib/log4j-1.2.16.jar"/> | ||
<classpathentry kind="lib" path="lib/hadoop-core-0.20.2-cdh3u3.jar"/> | ||
<classpathentry kind="output" path="classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>hsearch-core</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name=hsearch-core | ||
version=1.00 | ||
|
||
company=Bizosys Technologies Pvt Ltd. | ||
|
||
basedir = . | ||
src.dir = ${basedir}/src/java | ||
lib.dir = ${basedir}/lib | ||
buildlib.dir = ${basedir}/buildlib | ||
conf.dir = ${basedir}/conf | ||
|
||
build.dir = ${basedir}/build | ||
build.classes = ${build.dir}/classes | ||
build.encoding = UTF-8 | ||
|
||
context.root = ${name} | ||
|
||
javac.debug=on | ||
javac.optimize=on | ||
javac.deprecation=off | ||
javac.version=1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?xml version="1.0"?> | ||
|
||
<!-- the normal classpath | ||
* Copyright 2010 Bizosys Technologies Limited | ||
* | ||
* Licensed to the Bizosys Technologies Limited (Bizosys) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The Bizosys licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
--> | ||
|
||
<project name="hsearch-core" basedir="."> | ||
|
||
<property name="currdir" value="${basedir}" /> | ||
<property file="${currdir}/build.properties" /> | ||
|
||
<tstamp> | ||
<format property="build.time" pattern="dd MMM yyyy hh:mm aa"/> | ||
</tstamp> | ||
|
||
<!-- the normal classpath --> | ||
<path id="classpath"> | ||
<pathelement location="${build.classes}" /> | ||
<fileset dir="${lib.dir}"> | ||
<include name="*.jar" /> | ||
</fileset> | ||
</path> | ||
|
||
<!-- ====================================================== --> | ||
<!-- Stuff needed by all targets --> | ||
<!-- ====================================================== --> | ||
<target name="init"> | ||
<mkdir dir="${build.dir}" /> | ||
<mkdir dir="${build.classes}" /> | ||
</target> | ||
|
||
<!-- ====================================================== --> | ||
<!-- Compile the Java files --> | ||
<!-- TODO:: Add depends="init,generator" once the code generation is fixed --> | ||
<!-- ====================================================== --> | ||
<target name="compile" depends="compile-core" /> | ||
|
||
<target name="compile-core" depends="init"> | ||
<echo message="Java home: ${java.home} - ${ant.java.version} : javac.version - ${javac.version}"/> | ||
<javac encoding="${build.encoding}" | ||
destdir="${build.classes}" debug="${javac.debug}" optimize="${javac.optimize}" | ||
target="${javac.version}" source="${javac.version}" deprecation="${javac.deprecation}"> | ||
<classpath refid="classpath" /> | ||
<src path="${src.dir}"/> | ||
</javac> | ||
</target> | ||
<!-- ================================================================== --> | ||
<!-- Make jar --> | ||
<!-- ================================================================== --> | ||
<!-- --> | ||
<!-- ================================================================== --> | ||
<target name="jar" depends="compile-core"> | ||
<jar jarfile="${build.dir}/${name}.jar" basedir="${build.classes}"> | ||
<manifest> | ||
<attribute name="Version" value="${version}"/> | ||
<attribute name="Company" value="${company}"/> | ||
<attribute name="BuildDate" value="${build.time}"/> | ||
</manifest> | ||
</jar> | ||
</target> | ||
|
||
<!-- ================================================================== --> | ||
<!-- D I S T R I B U T I O N Targets --> | ||
<!-- ================================================================== --> | ||
<target name="clean+build" depends="clean, jar"> | ||
</target> | ||
|
||
<!-- ================================================================== --> | ||
<!-- Clean. Delete the build files, and their directories --> | ||
<!-- ================================================================== --> | ||
<target name="clean"> | ||
<delete dir="${build.dir}" /> | ||
</target> | ||
|
||
</project> |
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+10.1 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayBool$Builder.class
Binary file not shown.
Binary file added
BIN
+8.55 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayBool.class
Binary file not shown.
Binary file added
BIN
+10.1 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayBytes$Builder.class
Binary file not shown.
Binary file added
BIN
+8.55 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayBytes.class
Binary file not shown.
Binary file added
BIN
+10.1 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayDouble$Builder.class
Binary file not shown.
Binary file added
BIN
+8.6 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayDouble.class
Binary file not shown.
Binary file added
BIN
+10.1 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayFloat$Builder.class
Binary file not shown.
Binary file added
BIN
+8.58 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayFloat.class
Binary file not shown.
Binary file added
BIN
+10.1 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayInt$Builder.class
Binary file not shown.
Binary file added
BIN
+8.58 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayInt.class
Binary file not shown.
Binary file added
BIN
+10.1 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayLong$Builder.class
Binary file not shown.
Binary file added
BIN
+8.66 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayLong.class
Binary file not shown.
Binary file added
BIN
+10 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayString$Builder.class
Binary file not shown.
Binary file added
BIN
+8.52 KB
build/classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayString.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+4.83 KB
build/classes/com/bizosys/hsearch/byteutils/IntegerByteOpsSorted.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+11.1 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashBool$Builder.class
Binary file not shown.
Binary file added
BIN
+9.29 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashBool.class
Binary file not shown.
Binary file added
BIN
+9.2 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashBytes$Builder.class
Binary file not shown.
Binary file added
BIN
+8.48 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashBytes.class
Binary file not shown.
Binary file added
BIN
+11.1 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashDouble$Builder.class
Binary file not shown.
Binary file added
BIN
+9.34 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashDouble.class
Binary file not shown.
Binary file added
BIN
+11.1 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashFloat$Builder.class
Binary file not shown.
Binary file added
BIN
+9.31 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashFloat.class
Binary file not shown.
Binary file added
BIN
+11 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashInt$Builder.class
Binary file not shown.
Binary file added
BIN
+9.36 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashInt.class
Binary file not shown.
Binary file added
BIN
+11.1 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashLong$Builder.class
Binary file not shown.
Binary file added
BIN
+9.39 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashLong.class
Binary file not shown.
Binary file added
BIN
+10.9 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashString$Builder.class
Binary file not shown.
Binary file added
BIN
+9.48 KB
build/classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashString.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.25 KB
build/classes/com/bizosys/hsearch/byteutils/SortedBytesUnsignedShort.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+6.48 KB
build/classes/com/bizosys/hsearch/byteutils/UnsignedShortByteOpsSorted.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+778 Bytes
build/classes/com/bizosys/hsearch/distribution/DistributionPartionDouble$GravityCenter.class
Binary file not shown.
Binary file added
BIN
+3.57 KB
build/classes/com/bizosys/hsearch/distribution/DistributionPartionDouble.class
Binary file not shown.
Binary file added
BIN
+772 Bytes
build/classes/com/bizosys/hsearch/distribution/DistributionPartionFloat$GravityCenter.class
Binary file not shown.
Binary file added
BIN
+3.43 KB
build/classes/com/bizosys/hsearch/distribution/DistributionPartionFloat.class
Binary file not shown.
Binary file added
BIN
+756 Bytes
build/classes/com/bizosys/hsearch/distribution/DistributionPartionInt$GravityCenter.class
Binary file not shown.
Binary file added
BIN
+3.5 KB
build/classes/com/bizosys/hsearch/distribution/DistributionPartionInt.class
Binary file not shown.
Binary file added
BIN
+766 Bytes
build/classes/com/bizosys/hsearch/distribution/DistributionPartionLong$GravityCenter.class
Binary file not shown.
Binary file added
BIN
+3.54 KB
build/classes/com/bizosys/hsearch/distribution/DistributionPartionLong.class
Binary file not shown.
Binary file added
BIN
+772 Bytes
build/classes/com/bizosys/hsearch/distribution/DistributionPartionShort$GravityCenter.class
Binary file not shown.
Binary file added
BIN
+3.51 KB
build/classes/com/bizosys/hsearch/distribution/DistributionPartionShort.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.43 KB
build/classes/com/bizosys/hsearch/hbase/HSearchLuncher$OZookeeper.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.16 KB
classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayBool$Builder.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.16 KB
classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayBytes$Builder.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.21 KB
classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayDouble$Builder.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.18 KB
classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayFloat$Builder.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.13 KB
classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayInt$Builder.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.16 KB
classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayLong$Builder.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.08 KB
classes/com/bizosys/hsearch/byteutils/ByteArrays$ArrayString$Builder.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+10.1 KB
classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashBool$Builder.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+8.25 KB
classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashBytes$Builder.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+10.1 KB
classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashDouble$Builder.class
Binary file not shown.
Binary file added
BIN
+9.08 KB
classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashDouble.class
Binary file not shown.
Binary file added
BIN
+10.1 KB
classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashFloat$Builder.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+10.1 KB
classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashInt$Builder.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+10.1 KB
classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashLong$Builder.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.97 KB
classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashString$Builder.class
Binary file not shown.
Binary file added
BIN
+9.22 KB
classes/com/bizosys/hsearch/byteutils/MultiHash$MultiHashString.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+6.31 KB
classes/com/bizosys/hsearch/byteutils/SortedBytesUnsignedShortTest.class
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.bizosys.hsearch.byteutils; | ||
|
||
message ArrayDouble { | ||
|
||
repeated double val = 1 [packed=true]; | ||
} | ||
|
||
|
||
message ArrayFloat { | ||
|
||
repeated float val = 1 [packed=true]; | ||
} | ||
|
||
|
||
message ArrayInt { | ||
|
||
repeated int32 val = 1 [packed=true]; | ||
} | ||
|
||
|
||
message ArrayLong { | ||
|
||
repeated int64 val = 1 [packed=true]; | ||
} | ||
|
||
|
||
message ArrayBool { | ||
|
||
repeated bool val = 1 [packed=true]; | ||
} | ||
|
||
|
||
message ArrayString { | ||
|
||
repeated string val = 1 ; | ||
} | ||
|
||
|
||
message ArrayBytes { | ||
|
||
repeated bytes val = 1 ; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.bizosys.hsearch.byteutils; | ||
|
||
|
||
message MultiHashDouble { | ||
|
||
required bytes key = 1; | ||
|
||
repeated double val = 2; | ||
} | ||
|
||
|
||
message MultiHashFloat { | ||
|
||
required bytes key = 1; | ||
|
||
repeated float val = 2; | ||
} | ||
|
||
|
||
message MultiHashInt { | ||
|
||
required bytes key = 1; | ||
|
||
repeated int32 val = 2; | ||
} | ||
|
||
|
||
message MultiHashLong { | ||
|
||
required bytes key = 1; | ||
|
||
repeated int64 val = 2; | ||
} | ||
|
||
|
||
|
||
message MultiHashBool { | ||
|
||
required bytes key = 1; | ||
|
||
repeated bool val = 2; | ||
} | ||
|
||
|
||
|
||
message MultiHashString { | ||
|
||
required bytes key = 1; | ||
|
||
repeated string val = 2; | ||
} | ||
|
||
|
||
|
||
message MultiHashBytes { | ||
|
||
required bytes key = 1; | ||
|
||
required bytes val = 2; | ||
} |
Binary file not shown.
Binary file added
BIN
+778 Bytes
classes/com/bizosys/hsearch/distribution/DistributionPartionDouble$GravityCenter.class
Binary file not shown.
Binary file added
BIN
+3.59 KB
classes/com/bizosys/hsearch/distribution/DistributionPartionDouble.class
Binary file not shown.
Binary file added
BIN
+772 Bytes
classes/com/bizosys/hsearch/distribution/DistributionPartionFloat$GravityCenter.class
Binary file not shown.
Binary file added
BIN
+3.45 KB
classes/com/bizosys/hsearch/distribution/DistributionPartionFloat.class
Binary file not shown.
Binary file added
BIN
+756 Bytes
classes/com/bizosys/hsearch/distribution/DistributionPartionInt$GravityCenter.class
Binary file not shown.
Binary file added
BIN
+3.51 KB
classes/com/bizosys/hsearch/distribution/DistributionPartionInt.class
Binary file not shown.
Binary file added
BIN
+766 Bytes
classes/com/bizosys/hsearch/distribution/DistributionPartionLong$GravityCenter.class
Binary file not shown.
Binary file added
BIN
+3.56 KB
classes/com/bizosys/hsearch/distribution/DistributionPartionLong.class
Binary file not shown.
Binary file added
BIN
+772 Bytes
classes/com/bizosys/hsearch/distribution/DistributionPartionShort$GravityCenter.class
Binary file not shown.
Binary file added
BIN
+3.53 KB
classes/com/bizosys/hsearch/distribution/DistributionPartionShort.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright 2010 Bizosys Technologies Limited | ||
* | ||
* Licensed to the Bizosys Technologies Limited (Bizosys) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The Bizosys licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.bizosys.hsearch.byteutils; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class BinaryFloat { | ||
|
||
public static final List<Float> emptyList = new ArrayList<Float>(0); | ||
|
||
private boolean isEmpty = true; | ||
public List<Float> values = emptyList; | ||
|
||
public BinaryFloat() { | ||
|
||
} | ||
|
||
public void add(float aFloat) { | ||
if ( isEmpty ) { | ||
isEmpty = false; | ||
values = new ArrayList<Float>(0); | ||
} | ||
|
||
values.add(aFloat); | ||
} | ||
|
||
public byte[] toBytes() { | ||
int val = -1; | ||
int valuesT = values.size(); | ||
byte[] b = new byte[4 * valuesT]; | ||
int arrII = 0; | ||
|
||
for (int arrI=0 ; arrI< valuesT; arrI++) { | ||
float f = values.get(arrI); | ||
arrII = arrI * 4; | ||
|
||
val = Float.floatToRawIntBits(f); | ||
for(int i = 3; i > 0; i--) { | ||
b[arrII + i] = (byte)(val); | ||
val >>>= 8; | ||
} | ||
b[arrII] = (byte)(val); | ||
} | ||
|
||
return b; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.