Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: LGPL 

import java.io.FileNotFoundException;

import java.io.PrintWriter;

import java.util.Hashtable;

import java.util.Vector;

public class Main {
    /**
     * dump bipartite community affiliation into a text file with node names
     * 
     * @param OutFNm
     * @param CmtyVV
     * @param NIDNmH
     */
    static void dumpCmtyVV(final String OutFNm, Vector<Vector<Integer>> CmtyVV, Hashtable<Integer, String> NIDNmH) {
        PrintWriter f;
        try {
            f = new PrintWriter(OutFNm);

            for (int c = 0; c < CmtyVV.size(); c++) {
                for (int u = 0; u < CmtyVV.get(c).size(); u++) {
                    if (NIDNmH.containsKey(CmtyVV.get(c).get(u))) {
                        f.printf("%s\t", NIDNmH.get(CmtyVV.get(c).get(u)));
                    } else {
                        f.printf("%d\t", (int) CmtyVV.get(c).get(u));
                    }
                }
                f.printf("\n");
            }
            f.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}