0

我是java新手,我有一门课HashSet<Proposition>Propositions

类命题有 4 个类变量:

public class Proposition extends HashSet<Proposition> implements RSTNode{
private String productName;
    private Property     property;
    private Serializable value;
    private Type         type;
    private Rating       rating;
}

和类Propositions如下:

public class Propositions extends ArrayList<Proposition>{ 
........
}

我的课程RST Rule如下:

public class RSTRule{
    protected String ruleName;
    protected String discourseRelation;
    protected RSTNode nucleus;
    protected RSTNode satellite;
    protected Condition condition;
    int heuristic;
    }

现在我有另一个类RSTRules,,它包含一些方法,例如 generate_1(),generate_2(),... 在这个方法中我想在字段条件中写一些条件,如果这个条件为真,那么我应该运行相关的生成方法但是如果条件不正确,我应该去另一个生成方法并检查它的条件等等,我认为对于这个问题我应该有一个单独的类,即“条件”来检查条件,但我不知道应该如何编写方法在条件类或构造函数中,这意味着我的条件类现在是空的!!!!!!

public class RSTRules extends ArrayList<RSTRule>  {
    RSTRule rstRule=new RSTRule();            
    Proposition prop1= new Proposition();
    Proposition prop2= new Proposition();   

    public RSTRule generate_1(){    
    my condition for generate_1() is like this:if(prop1.getName().equals.prop2.getName();
       rstRule.condition=.....
       rstRule.satellite=propSat;
       rstRule.nucleus=propNuc;
       rstRule.ruleName="BothSatisfy_ProductsSimilarities"
       rstRule.discourseRelation="Similarity"
       rstRule.heuristic=10;
       return rstRule;
    }



    public RSTRule generate_2(){
    my condition for generate_2() is like this: if(prop1.getValue().equals.prop2.getValue()

    rstRule.condition=.....
    rstRule.satellite=propSat;
    rstRule.nucleus=propNuc;
    rstRule.ruleName="BothFunction"
    rstRule.discourseRelation="Similarity"
    rstRule.heuristic=10;
    return rstRule;
    }
}
4

0 回答 0