This repository has been archived by the owner on Nov 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from reynoldsm88/master
First pass at porting the learner code to 7.x
- Loading branch information
Showing
92 changed files
with
10,020 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,19 @@ | ||
/target | ||
/local | ||
|
||
# Eclipse, Netbeans and IntelliJ files | ||
/.* | ||
!.gitignore | ||
/nbproject | ||
/*.ipr | ||
/*.iws | ||
/*.iml | ||
|
||
# Repository wide ignore mac DS_Store files | ||
.DS_Store | ||
|
||
# generated files | ||
dependency-reduced-pom.xml | ||
|
||
# these modules don't exist anymore on master | ||
/drools-clips/ |
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,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/classes" path="target/generated-sources/annotations"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/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 @@ | ||
/target/ |
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,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>drools-learner</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
4 changes: 4 additions & 0 deletions
4
machinelearning/7.0.x/drools-learner/.settings/org.eclipse.core.resources.prefs
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,4 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/main/java=UTF-8 | ||
encoding//target/generated-sources/annotations=UTF-8 | ||
encoding/<project>=UTF-8 |
5 changes: 5 additions & 0 deletions
5
machinelearning/7.0.x/drools-learner/.settings/org.eclipse.jdt.core.prefs
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,5 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
org.eclipse.jdt.core.compiler.source=1.8 |
4 changes: 4 additions & 0 deletions
4
machinelearning/7.0.x/drools-learner/.settings/org.eclipse.m2e.core.prefs
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,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=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,96 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools</artifactId> | ||
<version>7.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>drools-learner</artifactId> | ||
|
||
<name>Drools :: Learner</name> | ||
|
||
<properties> | ||
<surefire.forkCount>2</surefire.forkCount> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- Internal dependencies --> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.kie</groupId> | ||
<artifactId>kie-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.kie</groupId> | ||
<artifactId>kie-internal</artifactId> | ||
</dependency> | ||
|
||
<!-- Logging --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency><!-- For unit test logging: configure in src/test/resources/logback-test.xml --> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- test: byteman --> | ||
<dependency> | ||
<groupId>org.jboss.byteman</groupId> | ||
<artifactId>byteman</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.byteman</groupId> | ||
<artifactId>byteman-submit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.byteman</groupId> | ||
<artifactId>byteman-install</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.byteman</groupId> | ||
<artifactId>byteman-bmunit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- Required for TestListener in maven-surefire-plugin. --> | ||
<dependency> | ||
<groupId>org.kie</groupId> | ||
<artifactId>kie-test-util</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<pluginManagement> | ||
</pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<properties> | ||
<property> | ||
<name>listener</name> | ||
<value>org.kie.test.util.TestStatusListener</value> | ||
</property> | ||
</properties> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
40 changes: 40 additions & 0 deletions
40
machinelearning/7.0.x/drools-learner/src/main/java/org/drools/learner/Attribute.java
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,40 @@ | ||
package org.drools.learner; | ||
|
||
public class Attribute { | ||
|
||
private String name; | ||
private Object value; | ||
|
||
//final ClassFieldExtractor extractor = cache.getExtractor( class_obj, f_name, getClass().getClassLoader() ); | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName( String name ) { | ||
this.name = name; | ||
} | ||
|
||
public Object getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue( Object value ) { | ||
this.value = value; | ||
} | ||
|
||
/* we assume that "another" points to the same attribute type as this */ | ||
public int compareValue( Attribute another ) { | ||
/* Boolean, Double, Integer, String... */ | ||
return AttributeValueComparator.instance.compare( getValue(), another.getValue() ); | ||
} | ||
|
||
public int hashCode() { | ||
return this.value.hashCode(); | ||
} | ||
|
||
public String toString() { | ||
return value.toString(); | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
...rning/7.0.x/drools-learner/src/main/java/org/drools/learner/AttributeValueComparator.java
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 @@ | ||
package org.drools.learner; | ||
|
||
import java.util.Comparator; | ||
|
||
public class AttributeValueComparator implements Comparator<Object> { | ||
|
||
/* we assume that "another" points to the same attribute type as this */ | ||
public int compare( Object value1, Object value2 ) { | ||
if ( value1 instanceof Comparable ) { | ||
return ( (Comparable) value1 ).compareTo( value2 ); // Boolean, Double, Integer, String... | ||
} | ||
return value1.hashCode() - value2.hashCode(); | ||
} | ||
|
||
// singleton wannabe | ||
public static AttributeValueComparator instance = new AttributeValueComparator(); | ||
} |
Oops, something went wrong.