Skip to content

Commit

Permalink
adding D-gap parameter
Browse files Browse the repository at this point in the history
Signed-off-by: floodfill <canly.xiao@gmail.com>
  • Loading branch information
floodfill committed Apr 30, 2012
1 parent 18fd968 commit 0298379
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 10 additions & 9 deletions DataGenerator.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.xiaokan.generator;

import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.EOFException;
Expand All @@ -11,22 +13,21 @@ public class DataGenerator {

public static int maxNumberOfPostingsInList = 10000;

public static boolean highByteFirst = false;
public static int minDGap = 100, maxDGap = 200;

public static void main(String[] args) throws IOException {

FileOutputStream fos = new FileOutputStream("d:/data.dat");
Random rand = new Random();
BufferedOutputStream fout = new BufferedOutputStream(fos);
DataInputStream dis;
for (int i = 0; i < numberOfLists; i++) {
int nOPIL = rand.nextInt(maxNumberOfPostingsInList);
int buf[] = int2bytes(nOPIL);
for (int k = 0; k < 4; k++)
fout.write(buf[k]);

int now = 1;
for (int j = 1; j <= nOPIL; j++) {
buf = int2bytes(j);
buf = int2bytes(now);
now += rand.nextInt(maxDGap - minDGap) + maxDGap;
for (int k = 0; k < 4; k++)
fout.write(buf[k]);
}
Expand All @@ -36,10 +37,10 @@ public static void main(String[] args) throws IOException {

public static int[] int2bytes(int v) {
int b[] = new int[4];
b[3] = (v >>> 24) & 0xFF;
b[2] = (v >>> 16) & 0xFF;
b[1] = (v >>> 8) & 0xFF;
b[0] = (v >>> 0) & 0xFF;
b[3] = (v >>> 24) & 0xFF;
b[2] = (v >>> 16) & 0xFF;
b[1] = (v >>> 8) & 0xFF;
b[0] = (v >>> 0) & 0xFF;
return b;
}

Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ files overview:

2> checkIncrease.cpp // check whether the data to be compressed is valid


3> Pro2_Inverted_Indexing.tar.bz2 // Inverted list analyzer and merger

4> DataGenerator.java // Simple Inverted List data generator
Expand Down

0 comments on commit 0298379

Please sign in to comment.