Pointer Problem (URGENT!!!)

I have a problem with my code, it goes like this:

I have a set of rules e.g

rule 1:if getIncome() < 0 && getProfit() >5

rule 2:if getIncome() > 0 && getProfit() < 6

such that some actions are carried out for the rules. whereby getIncome() and getProfit() are both methods that obtain the income and profit variables of a specific objects of a specific class

I now create another rule with its own income and profit variables but now replace its own first part with the first part of rule1 and its second part with the second part of rule 2:

new rule:if getIncome() < 0 && getProfit < 6

Problem: I realised that getIncome() of newrule starts to point to income of rule1 and getProfit of newrule starts to point to profit of rule2. All i am interested in is changing the rules not pointing to the values stored in the parent rules. I want the rules adjusted, but new rule points to its own variables.

[1121 byte] By [dupsy] at [2007-9-26 2:58:49]
# 1

I'm not sure I understand but if you calculate

say lots of different sets of income and profit

you can store them in a vector or array.

Even a two dimensional array if you want

could store both.

if one dimensional array you could be calling income[0]

for the first and income[1]

for the second.

like that == does that make sense?

say

<code>

public Array getIncome(int i) {

return income;

}

</code>

garyjones32 at 2007-6-29 10:54:08 > top of Java-index,Archived Forums,New To Java Technology Archive...