mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-11 20:15:03 -05:00
Fixed wrong construction of leaf sets and unrightfully ignored exceptions.
This commit is contained in:
parent
442805fe62
commit
9883148b2f
@ -153,8 +153,13 @@ public class LocalSearch implements SearchSpecification {
|
|||||||
* @return New top AND node, new root.
|
* @return New top AND node, new root.
|
||||||
*/
|
*/
|
||||||
public ConditionsTreeNode and(SearchCondition condition) {
|
public ConditionsTreeNode and(SearchCondition condition) {
|
||||||
ConditionsTreeNode tmp = new ConditionsTreeNode(condition);
|
try {
|
||||||
return and(tmp);
|
ConditionsTreeNode tmp = new ConditionsTreeNode(condition);
|
||||||
|
return and(tmp);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// impossible
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,22 +168,17 @@ public class LocalSearch implements SearchSpecification {
|
|||||||
*
|
*
|
||||||
* @param node Node to 'AND' with.
|
* @param node Node to 'AND' with.
|
||||||
* @return New top AND node, new root.
|
* @return New top AND node, new root.
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public ConditionsTreeNode and(ConditionsTreeNode node) {
|
public ConditionsTreeNode and(ConditionsTreeNode node) throws Exception {
|
||||||
try {
|
mLeafSet.addAll(node.getLeafSet());
|
||||||
mLeafSet.add(node);
|
|
||||||
|
if (mConditions == null) {
|
||||||
if (mConditions == null) {
|
mConditions = node;
|
||||||
mConditions = node;
|
return node;
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
mConditions = mConditions.and(node);
|
|
||||||
return mConditions;
|
|
||||||
} catch (Exception e) {
|
|
||||||
// IMPOSSIBLE!
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return mConditions.and(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -189,8 +189,13 @@ public class LocalSearch implements SearchSpecification {
|
|||||||
* @return New top OR node, new root.
|
* @return New top OR node, new root.
|
||||||
*/
|
*/
|
||||||
public ConditionsTreeNode or(SearchCondition condition) {
|
public ConditionsTreeNode or(SearchCondition condition) {
|
||||||
ConditionsTreeNode tmp = new ConditionsTreeNode(condition);
|
try {
|
||||||
return or(tmp);
|
ConditionsTreeNode tmp = new ConditionsTreeNode(condition);
|
||||||
|
return or(tmp);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// impossible
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -199,22 +204,17 @@ public class LocalSearch implements SearchSpecification {
|
|||||||
*
|
*
|
||||||
* @param node Node to 'OR' with.
|
* @param node Node to 'OR' with.
|
||||||
* @return New top OR node, new root.
|
* @return New top OR node, new root.
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public ConditionsTreeNode or(ConditionsTreeNode node) {
|
public ConditionsTreeNode or(ConditionsTreeNode node) throws Exception {
|
||||||
try {
|
mLeafSet.addAll(node.getLeafSet());
|
||||||
mLeafSet.add(node);
|
|
||||||
|
if (mConditions == null) {
|
||||||
if (mConditions == null) {
|
mConditions = node;
|
||||||
mConditions = node;
|
return node;
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
mConditions = mConditions.or(node);
|
|
||||||
return mConditions;
|
|
||||||
} catch (Exception e) {
|
|
||||||
// IMPOSSIBLE!
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return mConditions.or(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user