src/main/java/org/thegalactic/context/Context.java
private ArrayList<Couple> recursiveGenProd(Couple c, LinkedList<ConceptLattice> clParts) {
        LinkedList<ConceptLattice> copy = (LinkedList<ConceptLattice>) clParts.clone();
        if (copy.isEmpty()) {
            ArrayList<Couple> result = new ArrayList<Couple>();
            result.add(c);
            return result;
        } else {
            ConceptLattice cl = (ConceptLattice) copy.poll();
            ArrayList<Couple> nodes = new ArrayList<Couple>();
            for (Object node : cl.getNodes()) {
                ArrayList<Concept> listCopy = new ArrayList<Concept>();
                for (Concept cpt : (ArrayList<Concept>) c.getLeft()) {
                    listCopy.add(cpt);
                }
                Couple coupleCopy = new Couple(listCopy, c.getRight());
                ((ArrayList<Concept>) coupleCopy.getLeft()).add((Concept) node);
                nodes.addAll(recursiveGenProd(coupleCopy, copy));
            }
            return nodes;
        }
    }
/**
     * Reccursively generates nodes of the product lattice.
     *
     * @param c       couple to be completed
     * @param clParts list of last context to deal with
     *
     * @return a list of nodes to add to the product.
     */
Reccursively generates nodes of the product lattice.
@param c       couple to be completed
@param clParts list of last context to deal with

@return a list of nodes to add to the product.
Reccursively generates nodes of the product lattice . @param c couple to be completed @param clParts list of last context to deal with @return a list of nodes to add to the product .
private ArrayList<Couple> recursiveGenProd(Couple c, LinkedList<ConceptLattice> clParts) {
        LinkedList<ConceptLattice> copy = (LinkedList<ConceptLattice>) clParts.clone();
        if (copy.isEmpty()) {
            ArrayList<Couple> result = new ArrayList<Couple>();
            result.add(c);
            return result;
        } else {
            ConceptLattice cl = (ConceptLattice) copy.poll();
            ArrayList<Couple> nodes = new ArrayList<Couple>();
            for (Object node : cl.getNodes()) {
                ArrayList<Concept> listCopy = new ArrayList<Concept>();
                for (Concept cpt : (ArrayList<Concept>) c.getLeft()) {
                    listCopy.add(cpt);
                }
                Couple coupleCopy = new Couple(listCopy, c.getRight());
                ((ArrayList<Concept>) coupleCopy.getLeft()).add((Concept) node);
                nodes.addAll(recursiveGenProd(coupleCopy, copy));
            }
            return nodes;
        }
    }
private ArrayList < Couple > recursiveGenProd ( Couple c , LinkedList < ConceptLattice > clParts ) { LinkedList < ConceptLattice > copy = ( LinkedList < ConceptLattice > ) clParts . clone ( ) ; if ( copy . isEmpty ( ) ) { ArrayList < Couple > result = new ArrayList < Couple > ( ) ; result . add ( c ) ; return result ; } else { ConceptLattice cl = ( ConceptLattice ) copy . poll ( ) ; ArrayList < Couple > nodes = new ArrayList < Couple > ( ) ; for ( Object node : cl . getNodes ( ) ) { ArrayList < Concept > listCopy = new ArrayList < Concept > ( ) ; for ( Concept cpt : ( ArrayList < Concept > ) c . getLeft ( ) ) { listCopy . add ( cpt ) ; } Couple coupleCopy = new Couple ( listCopy , c . getRight ( ) ) ; ( ( ArrayList < Concept > ) coupleCopy . getLeft ( ) ) . add ( ( Concept ) node ) ; nodes . addAll ( recursiveGenProd ( coupleCopy , copy ) ) ; } return nodes ; } }
Reccursively generates nodes of the product lattice.
Reccursively generates nodes of the product lattice .