Skip to content

Commit

Permalink
pluggable canopy
Browse files Browse the repository at this point in the history
  • Loading branch information
sonalgoyal committed Mar 27, 2024
1 parent 0e1c23c commit f4bbebd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
20 changes: 12 additions & 8 deletions common/core/src/main/java/zingg/common/core/block/Block.java
Expand Up @@ -66,16 +66,13 @@ public void setDupes(ZFrame<D,R,C> dupes) {
/**
* @return the types
*
* public Class[] getTypes() { return types; }
*/

/**
* @param types
* the types to set
* the types to set
*
* public void setTypes(Class[] types) { this.types = types; }
*
* /**
*
* @return the maxSize
*/
public long getMaxSize() {
Expand All @@ -84,7 +81,7 @@ public long getMaxSize() {

/**
* @param maxSize
* the maxSize to set
* the maxSize to set
*/
public void setMaxSize(long maxSize) {
this.maxSize = maxSize;
Expand All @@ -102,17 +99,24 @@ protected void setFunctionsMap(ListMap<T, HashFunction<D,R,C,T>> m) {
this.functionsMap = m;
}

protected Canopy<R> getCanopy(){
return new Canopy<R>();
}

public Canopy<R>getNodeFromCurrent(Canopy<R>node, HashFunction<D,R,C,T> function,
FieldDefinition context) {
Canopy<R>trial = new Canopy<R>();
Canopy<R>trial = getCanopy();
trial = node.copyTo(trial);
// node.training, node.dupeN, function, context);
trial.function = function;
trial.context = context;
return trial;
}

public void estimateElimCount(Canopy<R> c, long elimCount) {
c.estimateElimCount();
}

public abstract T getDataTypeFromString(String t);

public Canopy<R>getBestNode(Tree<Canopy<R>> tree, Canopy<R>parent, Canopy<R>node,
Expand Down Expand Up @@ -144,7 +148,7 @@ protected void setFunctionsMap(ListMap<T, HashFunction<D,R,C,T>> m) {
+ " and function " + function + " for " + field.dataType);
Canopy<R>trial = getNodeFromCurrent(node, function,
context);
trial.estimateElimCount();
estimateElimCount(trial, least);
long elimCount = trial.getElimCount();


Expand Down
14 changes: 7 additions & 7 deletions common/core/src/main/java/zingg/common/core/block/Canopy.java
Expand Up @@ -20,19 +20,19 @@ public class Canopy<R> implements Serializable {
public static final Log LOG = LogFactory.getLog(Canopy.class);

// created by function edge leading from parent to this node
HashFunction function;
protected HashFunction function;
// aplied on field
FieldDefinition context;
protected FieldDefinition context;
// list of duplicates passed from parent
List<R> dupeN;
protected List<R> dupeN;
// number of duplicates eliminated after function applied on fn context
long elimCount;
protected long elimCount;
// hash of canopy
Object hash;
protected Object hash;
// training set
List<R> training;
protected List<R> training;
// duplicates remaining after function is applied
List<R> dupeRemaining;
protected List<R> dupeRemaining;

public Canopy() {
}
Expand Down

0 comments on commit f4bbebd

Please sign in to comment.