From 6fd776b7ca81da4c1a6d8e09f529f4b840592fac Mon Sep 17 00:00:00 2001 From: patham9 <patham9@91dfdad4-c543-0410-b26a-7d79dded8189> Date: Fri, 25 Jul 2014 18:09:49 +0000 Subject: [PATCH] fix for issue33, now hopefully correct. --- nars-dist/Examples/Example-NAL6-edited.txt | 15 +- nars-dist/Examples/Example-NAL6-unedited.txt | 14 +- .../nars/inference/CompositionalRules.java | 111 ++++++++++--- .../nars/language/CompoundTerm.java | 8 + nbproject/build-impl.xml | 81 +++++++--- nbproject/genfiles.properties | 6 +- nbproject/project.properties | 148 +++++++++--------- nbproject/project.xml | 29 ++-- 8 files changed, 271 insertions(+), 141 deletions(-) diff --git a/nars-dist/Examples/Example-NAL6-edited.txt b/nars-dist/Examples/Example-NAL6-edited.txt index 2fb6a14..72908d8 100644 --- a/nars-dist/Examples/Example-NAL6-edited.txt +++ b/nars-dist/Examples/Example-NAL6-edited.txt @@ -234,7 +234,20 @@ OUT: <<$1 --> lock> ==> (&&,<#2 --> key>,<$1 --> (/,open,#2,_)>)>. %1.00;0.45% // I guess every lock can be opened by some key. -********** recursion +***** second level unification + IN: <<$1 --> lock> ==> (&&,<#2 --> key>,<$1 --> (/,open,#2,_)>)>. %1.00;0.90% {0 : 1} + IN: <{key1} --> key>. %1.00;0.90% {0 : 2} +5 + OUT: <<$1 --> lock> ==> <$1 --> (/,open,{key1},_)>>. %1.00;0.43% {5 : 2;1} + +***** second level unification + IN: (&&,<#1 --> lock>,<<$2 --> key> ==> <#1 --> (/,open,$2,_)>>). %1.00;0.90% {0 : 1} + IN: <{key1} --> key>. %1.00;0.90% {0 : 2} +5 + OUT: (&&,<#1 --> lock>,<#1 --> (/,open,{key1},_)>). %1.00;0.81% {5 : 2;1} + + +********** recursion (multistep) IN: <0 --> num>. %1.00;0.90% {0 : 1} // 0 is a number IN: <<$1 --> num> ==> <(*,$1) --> num>>. %1.00;0.90% {0 : 2} diff --git a/nars-dist/Examples/Example-NAL6-unedited.txt b/nars-dist/Examples/Example-NAL6-unedited.txt index 03a6a82..5430f88 100644 --- a/nars-dist/Examples/Example-NAL6-unedited.txt +++ b/nars-dist/Examples/Example-NAL6-unedited.txt @@ -247,7 +247,19 @@ OUT: (&&,<#1 --> key>,<#2 --> lock>,<#2 --> (/,open,#1,_)>). %1.00;0.81% {17 : 2;1} OUT: <<$1 --> lock> ==> (&&,<#2 --> key>,<$1 --> (/,open,#2,_)>)>. %1.00;0.45% {17 : 2;1} -********** recursion +***** second level unification + IN: <<$1 --> lock> ==> (&&,<#2 --> key>,<$1 --> (/,open,#2,_)>)>. %1.00;0.90% {0 : 1} + IN: <{key1} --> key>. %1.00;0.90% {0 : 2} +5 + OUT: <<$1 --> lock> ==> <$1 --> (/,open,{key1},_)>>. %1.00;0.43% {5 : 2;1} + +***** second level unification + IN: (&&,<#1 --> lock>,<<$2 --> key> ==> <#1 --> (/,open,$2,_)>>). %1.00;0.90% {0 : 1} + IN: <{key1} --> key>. %1.00;0.90% {0 : 2} +5 + OUT: (&&,<#1 --> lock>,<#1 --> (/,open,{key1},_)>). %1.00;0.81% {5 : 2;1} + +********** recursion (multistep) IN: <0 --> num>. %1.00;0.90% {0 : 1} IN: <<$1 --> num> ==> <(*,$1) --> num>>. %1.00;0.90% {0 : 2} IN: <(*,(*,(*,0))) --> num>? {0 : 3} diff --git a/nars_core_java/nars/inference/CompositionalRules.java b/nars_core_java/nars/inference/CompositionalRules.java index d1584da..2f41eaa 100644 --- a/nars_core_java/nars/inference/CompositionalRules.java +++ b/nars_core_java/nars/inference/CompositionalRules.java @@ -26,6 +26,7 @@ import nars.entity.*; import nars.entity.Task; import nars.io.Symbols; import nars.language.*; +import static nars.language.CompoundTerm.make; import nars.storage.Memory; /** @@ -36,24 +37,67 @@ import nars.storage.Memory; */ public final class CompositionalRules { + //2 helper functions for dedSecondLayerVariableUnification: static Term unwrapNegation(Term T) //negation is not counting as depth { if(T!=null && T instanceof Negation) - return (Term) ((CompoundTerm)T).getComponents().get(0).clone(); + return (Term) ((CompoundTerm)T).getComponents().get(0); return T; } + public static Term reduceComponentOneLayer(CompoundTerm t1, Term t2, Memory memory) { + boolean success; + ArrayList<Term> list = t1.cloneComponents(); + if (t1.getClass() == t2.getClass()) { + success = list.removeAll(((CompoundTerm) t2).getComponents()); + } else { + success = list.remove(t2); + } + if (success) { + if (list.size() > 1) { + return make(t1, list, memory); + } + if (list.size() == 1) { + if (t1 instanceof CompoundTerm) { + return list.get(0); + } + } + } + return t1; + } + static CompoundTerm ReduceTillLayer2(CompoundTerm itself, Term replacement, Memory memory) + { + if(!(itself instanceof CompoundTerm)) { + return null; + } + itself=(CompoundTerm) reduceComponentOneLayer((CompoundTerm) itself, replacement, memory); + int j=0; + for(Term t : ((CompoundTerm) itself).getComponents()) { + Term t2 = unwrapNegation(t); + if(!(t2 instanceof Implication) && !(t2 instanceof Equivalence) && !(t2 instanceof Conjunction) && !(t2 instanceof Disjunction)) { + j++; + continue; + } + Term ret2=reduceComponentOneLayer((CompoundTerm) t2,replacement,memory); + CompoundTerm replaced=(CompoundTerm) CompoundTerm.setComponent((CompoundTerm) itself, j, ret2, memory); + if(replaced!=null) { + itself=replaced; + } + j++; + } + return (CompoundTerm) itself; + } public static Random rand = new Random(1); static boolean dedSecondLayerVariableUnification(Task task, Memory memory) { Sentence taskSentence=task.getSentence(); - Term taskterm=taskSentence.getContent(); if(taskSentence==null || taskSentence.isQuestion()) { return false; } + Term taskterm=taskSentence.getContent(); if(taskterm instanceof CompoundTerm && (taskterm instanceof Disjunction || taskterm instanceof Conjunction || taskterm instanceof Equivalence || taskterm instanceof Implication)) { //lets just allow conjunctions, implication and equivalence for now if(!Variable.containVar(taskterm.toString())) { return false; - } + } Concept second=memory.getConceptBag().takeOut(); if(second==null) { return false; @@ -62,25 +106,35 @@ public final class CompositionalRules { if(second.getBeliefs()==null || second.getBeliefs().size()==0) { return false; } - + Sentence second_belief=second.getBeliefs().get(rand.nextInt(second.getBeliefs().size())); TruthValue truthSecond=second_belief.getTruth(); //we have to select a random belief - ArrayList<HashMap<Term, Term>> terms_dependent=new ArrayList<HashMap<Term, Term>>(); - ArrayList<HashMap<Term, Term>> terms_independent=new ArrayList<HashMap<Term, Term>>(); + ArrayList<CompoundTerm> terms_dependent=new ArrayList<CompoundTerm>(); + ArrayList<CompoundTerm> terms_independent=new ArrayList<CompoundTerm>(); //ok, we have selected a second concept, we know the truth value of a belief of it, lets now go through taskterms components //for two levels, and remember the terms which unify with second ArrayList<Term> components_level1=((CompoundTerm) taskterm).getComponents(); - Term secterm_unwrap=unwrapNegation(secterm); + Term secterm_unwrap=(Term) unwrapNegation(secterm).clone(); for(Term T1 : components_level1) { Term T1_unwrap=unwrapNegation(T1); HashMap<Term, Term> Values = new HashMap<Term, Term>(); //we are only interested in first variables - if(Variable.findSubstitute(Symbols.VAR_DEPENDENT, T1_unwrap, secterm_unwrap,Values,new HashMap<Term, Term>())) { - terms_dependent.add(Values); + if(Variable.findSubstitute(Symbols.VAR_DEPENDENT, T1_unwrap, secterm_unwrap,Values,new HashMap<Term, Term>())) { + CompoundTerm taskterm_subs=((CompoundTerm)taskterm.clone()); + taskterm_subs.applySubstitute(Values); + taskterm_subs=ReduceTillLayer2(taskterm_subs,secterm,memory); + if(taskterm_subs!=null) { + terms_dependent.add(taskterm_subs); + } } HashMap<Term, Term> Values2 = new HashMap<Term, Term>(); //we are only interested in first variables if(Variable.findSubstitute(Symbols.VAR_INDEPENDENT, T1_unwrap, secterm_unwrap,Values2,new HashMap<Term, Term>())) { - terms_independent.add(Values2); + CompoundTerm taskterm_subs=((CompoundTerm)taskterm.clone()); + taskterm_subs.applySubstitute(Values2); + taskterm_subs=ReduceTillLayer2(taskterm_subs,secterm,memory); + if(taskterm_subs!=null) { + terms_independent.add(taskterm_subs); + } } if(!((T1_unwrap instanceof Implication) || (T1_unwrap instanceof Equivalence) || (T1_unwrap instanceof Conjunction) || (T1_unwrap instanceof Disjunction))) { continue; @@ -88,29 +142,36 @@ public final class CompositionalRules { if(T1_unwrap instanceof CompoundTerm) { ArrayList<Term> components_level2=((CompoundTerm) T1_unwrap).getComponents(); for(Term T2 : components_level2) { - Term T2_unwrap=unwrapNegation(T2); + Term T2_unwrap=(Term) unwrapNegation(T2).clone(); HashMap<Term, Term> Values3 = new HashMap<Term, Term>(); //we are only interested in first variables if(Variable.findSubstitute(Symbols.VAR_DEPENDENT, T2_unwrap, secterm_unwrap,Values3,new HashMap<Term, Term>())) { - terms_dependent.add(Values3); + //terms_dependent_compound_terms.put(Values3, (CompoundTerm)T1_unwrap); + CompoundTerm taskterm_subs=((CompoundTerm)taskterm.clone()); + taskterm_subs.applySubstitute(Values3); + taskterm_subs=ReduceTillLayer2(taskterm_subs,secterm,memory); + if(taskterm_subs!=null) { + terms_dependent.add(taskterm_subs); + } } HashMap<Term, Term> Values4 = new HashMap<Term, Term>(); //we are only interested in first variables if(Variable.findSubstitute(Symbols.VAR_INDEPENDENT, T2_unwrap, secterm_unwrap,Values4,new HashMap<Term, Term>())) { - terms_independent.add(Values4); + //terms_independent_compound_terms.put(Values4, (CompoundTerm)T1_unwrap); + CompoundTerm taskterm_subs=((CompoundTerm)taskterm.clone()); + taskterm_subs.applySubstitute(Values4); + taskterm_subs=ReduceTillLayer2(taskterm_subs,secterm,memory); + if(taskterm_subs!=null) { + terms_independent.add(taskterm_subs); + } } } } } Term result; TruthValue truth; - if(!terms_dependent.isEmpty()) { //dependent or independent - if(terms_dependent.isEmpty()) { - return false; - } - HashMap<Term, Term> substi=terms_dependent.get(rand.nextInt(terms_dependent.size())); - result=(CompoundTerm)taskterm.clone(); - ((CompoundTerm)result).applySubstitute(substi); + for(int i=0;i<terms_dependent.size();i++) { + result=terms_dependent.get(i); truth=TruthFunctions.anonymousAnalogy(taskSentence.getTruth(), truthSecond); - + Sentence newSentence = new Sentence(result, Symbols.JUDGMENT_MARK, truth, taskSentence.getStamp()); newSentence.getStamp().creationTime=memory.getTime(); Stamp useEvidentalbase=new Stamp(taskSentence.getStamp(),second_belief.getStamp(),memory.getTime()); @@ -123,12 +184,10 @@ public final class CompositionalRules { memory.currentTask=dummy; memory.derivedTask(newTask, false, false); } - if(!terms_independent.isEmpty()) { - HashMap<Term, Term> substi=terms_independent.get(rand.nextInt(terms_independent.size())); - result=(CompoundTerm)taskterm.clone(); - ((CompoundTerm)result).applySubstitute(substi); + for(int i=0;i<terms_independent.size();i++) { + result=terms_independent.get(i); truth=TruthFunctions.deduction(taskSentence.getTruth(), truthSecond); - + Sentence newSentence = new Sentence(result, Symbols.JUDGMENT_MARK, truth, taskSentence.getStamp()); newSentence.getStamp().creationTime=memory.getTime(); Stamp useEvidentalbase=new Stamp(taskSentence.getStamp(),second_belief.getStamp(),memory.getTime()); diff --git a/nars_core_java/nars/language/CompoundTerm.java b/nars_core_java/nars/language/CompoundTerm.java index 46ff0af..6f87a0c 100644 --- a/nars_core_java/nars/language/CompoundTerm.java +++ b/nars_core_java/nars/language/CompoundTerm.java @@ -245,6 +245,14 @@ public abstract class CompoundTerm extends Term { return Conjunction.make(arg, memory); } } + if (op.length() == 3) { + if(op.equals(Symbols.IMPLICATION_RELATION)) { + return Implication.make(arg.get(0), arg.get(1), memory); + } + if(op.equals(Symbols.EQUIVALENCE_RELATION)) { + return Equivalence.make(arg.get(0), arg.get(1), memory); + } + } return null; } diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 185eb3a..15d596f 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -54,7 +54,43 @@ is divided into following sections: <property file="nbproject/project.properties"/> </target> <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init"> - <property name="platform.java" value="${java.home}/bin/java"/> + <j2seproject1:property name="platform.home" value="platforms.${platform.active}.home"/> + <j2seproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/> + <j2seproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/> + <j2seproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/> + <condition property="platform.javac" value="${platform.home}/bin/javac"> + <equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/> + </condition> + <property name="platform.javac" value="${platform.javac.tmp}"/> + <j2seproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/> + <condition property="platform.java" value="${platform.home}/bin/java"> + <equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/> + </condition> + <property name="platform.java" value="${platform.java.tmp}"/> + <j2seproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/> + <condition property="platform.javadoc" value="${platform.home}/bin/javadoc"> + <equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/> + </condition> + <property name="platform.javadoc" value="${platform.javadoc.tmp}"/> + <condition property="platform.invalid" value="true"> + <or> + <contains string="${platform.javac}" substring="$${platforms."/> + <contains string="${platform.java}" substring="$${platforms."/> + <contains string="${platform.javadoc}" substring="$${platforms."/> + </or> + </condition> + <fail unless="platform.home">Must set platform.home</fail> + <fail unless="platform.bootcp">Must set platform.bootcp</fail> + <fail unless="platform.java">Must set platform.java</fail> + <fail unless="platform.javac">Must set platform.javac</fail> + <fail if="platform.invalid"> + The J2SE Platform is not correctly set up. + Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. + Either open the project in the IDE and setup the Platform with the same name or add it manually. + For example like this: + ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file) + or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> jar (where no properties file is used) + </fail> <available file="${manifest.file}" property="manifest.available"/> <condition property="splashscreen.available"> <and> @@ -182,15 +218,6 @@ is divided into following sections: <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> <isset property="profile.available"/> </condition> - <condition else="false" property="jdkBug6558476"> - <and> - <matches pattern="1\.[56]" string="${java.specification.version}"/> - <not> - <os family="unix"/> - </not> - </and> - </condition> - <property name="javac.fork" value="${jdkBug6558476}"/> <property name="jar.index" value="false"/> <property name="jar.index.metainf" value="${jar.index}"/> <property name="copylibs.rebase" value="true"/> @@ -259,7 +286,7 @@ is divided into following sections: <property location="${build.dir}/empty" name="empty.dir"/> <mkdir dir="${empty.dir}"/> <mkdir dir="@{apgeneratedsrcdir}"/> - <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> <src> <dirset dir="@{gensrcdir}" erroronmissingdir="false"> <include name="*"/> @@ -299,7 +326,7 @@ is divided into following sections: <sequential> <property location="${build.dir}/empty" name="empty.dir"/> <mkdir dir="${empty.dir}"/> - <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> <src> <dirset dir="@{gensrcdir}" erroronmissingdir="false"> <include name="*"/> @@ -380,7 +407,7 @@ is divided into following sections: <element name="customize" optional="true"/> <sequential> <property name="junit.forkmode" value="perTest"/> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}"> <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> <syspropertyset> <propertyref prefix="test-sys-prop."/> @@ -403,7 +430,7 @@ is divided into following sections: <element name="customize" optional="true"/> <sequential> <property name="junit.forkmode" value="perTest"/> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}"> <batchtest todir="${build.test.results.dir}"> <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> <filename name="${test.binarytestincludes}"/> @@ -435,7 +462,7 @@ is divided into following sections: </condition> <union id="test.set"/> <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> - <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="open-nars" testname="TestNG tests" workingDir="${work.dir}"> + <testng classfilesetref="test.set" failureProperty="tests.failed" jvm="${platform.java}" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="open-nars" testname="TestNG tests" workingDir="${work.dir}"> <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> <propertyset> <propertyref prefix="test-sys-prop."/> @@ -515,7 +542,7 @@ is divided into following sections: <element name="customize" optional="true"/> <sequential> <property name="junit.forkmode" value="perTest"/> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}"> <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> <syspropertyset> <propertyref prefix="test-sys-prop."/> @@ -540,7 +567,7 @@ is divided into following sections: <element name="customize" optional="true"/> <sequential> <property name="junit.forkmode" value="perTest"/> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}"> <batchtest todir="${build.test.results.dir}"> <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> <filename name="${test.binarytestincludes}"/> @@ -717,6 +744,9 @@ is divided into following sections: <classpath> <path path="@{classpath}"/> </classpath> + <bootclasspath> + <path path="${platform.bootcp}"/> + </bootclasspath> </nbjpdastart> </sequential> </macrodef> @@ -732,7 +762,9 @@ is divided into following sections: </macrodef> </target> <target name="-init-debug-args"> - <property name="version-output" value="java version "${ant.java.version}"/> + <exec executable="${platform.java}" outputproperty="version-output"> + <arg value="-version"/> + </exec> <condition property="have-jdk-older-than-1.4"> <or> <contains string="${version-output}" substring="java version "1.0"/> @@ -757,7 +789,7 @@ is divided into following sections: <attribute default="${debug.classpath}" name="classpath"/> <element name="customize" optional="true"/> <sequential> - <java classname="@{classname}" dir="${work.dir}" fork="true"> + <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}"> <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> <jvmarg line="${debug-args-line}"/> <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> @@ -784,7 +816,7 @@ is divided into following sections: <attribute default="jvm" name="jvm"/> <element name="customize" optional="true"/> <sequential> - <java classname="@{classname}" dir="${work.dir}" fork="true"> + <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}"> <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> @@ -983,7 +1015,7 @@ is divided into following sections: <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> <echo level="info">To run this application from the command line without Ant, try:</echo> <property location="${dist.jar}" name="dist.jar.resolved"/> - <echo level="info">java -jar "${dist.jar.resolved}"</echo> + <echo level="info">${platform.java} -jar "${dist.jar.resolved}"</echo> </target> <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> <j2seproject1:jar manifest="${tmp.manifest.file}"/> @@ -1192,10 +1224,13 @@ is divided into following sections: </not> </and> </condition> + <exec executable="${platform.java}" failonerror="false" outputproperty="platform.version.output"> + <arg value="-version"/> + </exec> <condition else="" property="bug5101868workaround" value="*.java"> - <matches pattern="1\.[56](\..*)?" string="${java.version}"/> + <matches multiline="true" pattern="1\.[56](\..*)?" string="${platform.version.output}"/> </condition> - <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> + <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> <classpath> <path path="${javac.classpath}"/> </classpath> diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 7109d49..6d6d61b 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=e8ec4146 +build.xml.data.CRC32=c7d10995 build.xml.script.CRC32=a2699d88 build.xml.stylesheet.CRC32=8064a381@1.74.1.48 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=e8ec4146 -nbproject/build-impl.xml.script.CRC32=913c3e9c +nbproject/build-impl.xml.data.CRC32=c7d10995 +nbproject/build-impl.xml.script.CRC32=5038746e nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.74.1.48 diff --git a/nbproject/project.properties b/nbproject/project.properties index f2114d3..6724293 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,73 +1,75 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processor.options= -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/open-nars.jar -dist.javadoc.dir=${dist.dir}/javadoc -excludes= -file.reference.open-nars-nars_core_java=nars_core_java -file.reference.open-nars-nars_gui=nars_gui -includes=** -jar.compress=false -javac.classpath= -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.7 -javac.target=1.7 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -main.class=nars.main.NARS -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -nars_gui.dir=${file.reference.open-nars-nars_gui} -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -src.dir=${file.reference.open-nars-nars_core_java} +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=open-nars +application.vendor=tc +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/open-nars.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.open-nars-nars_core_java=nars_core_java +file.reference.open-nars-nars_gui=nars_gui +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=nars.main.NARS +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +nars_gui.dir=${file.reference.open-nars-nars_gui} +platform.active=JDK_1.8 +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=${file.reference.open-nars-nars_core_java} diff --git a/nbproject/project.xml b/nbproject/project.xml index c16fd05..cc5eda3 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -1,14 +1,15 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://www.netbeans.org/ns/project/1"> - <type>org.netbeans.modules.java.j2seproject</type> - <configuration> - <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> - <name>open-nars</name> - <source-roots> - <root id="src.dir"/> - <root id="nars_gui.dir"/> - </source-roots> - <test-roots/> - </data> - </configuration> -</project> +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://www.netbeans.org/ns/project/1"> + <type>org.netbeans.modules.java.j2seproject</type> + <configuration> + <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> + <name>open-nars</name> + <explicit-platform explicit-source-supported="true"/> + <source-roots> + <root id="src.dir"/> + <root id="nars_gui.dir"/> + </source-roots> + <test-roots/> + </data> + </configuration> +</project> -- GitLab