[jboss-cvs] JBossAS SVN: r95745 - in projects/jboss-deployers/trunk/deployers-impl/src: test/java/org/jboss/test/deployers/deployer/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 29 07:46:56 EDT 2009
Author: alesj
Date: 2009-10-29 07:46:56 -0400 (Thu, 29 Oct 2009)
New Revision: 95745
Modified:
projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DominoOrdering.java
projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/Dots.java
projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/SetDots.java
projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/DeployerFlowUnitTestCase.java
Log:
[JBDEPLOY-201]; simplify Dots, check for more exact intersection in pass-through.
Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DominoOrdering.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DominoOrdering.java 2009-10-29 10:54:08 UTC (rev 95744)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/DominoOrdering.java 2009-10-29 11:46:56 UTC (rev 95745)
@@ -70,25 +70,24 @@
Dots oneTail = one.getTail();
Dots twoHead = two.getHead();
Dots twoTail = two.getTail();
- boolean fstXsnd = oneTail.match(twoHead);
- boolean sndXfst = twoTail.match(oneHead);
+ int fstXsnd = oneTail.intersect(twoHead);
+ int sndXfst = twoTail.intersect(oneHead);
int relation = 0;
- if (fstXsnd && sndXfst)
+ if (fstXsnd > 0 && sndXfst > 0)
{
// pass-through deployers
- if (oneHead.match(twoHead) && oneTail.match(twoTail))
+ if (oneHead.intersect(twoHead) > 0 && oneTail.intersect(twoTail) > 0)
{
// lets try to do more exact match
// although we should aviod singe dimension checks
// which are already part of match() check
- // in order not to break comparator comparison
- if ((twoHead.dimension() > 1 && oneTail.dimension() >= twoHead.dimension() && oneTail.contains(twoHead)) ||
- (oneTail.dimension() > 1 && twoHead.dimension() >= oneTail.dimension() && twoHead.contains(oneTail)))
+ if ((twoHead.dimension() > 1 && oneTail.dimension() > 1 && fstXsnd > 1) ||
+ (oneTail.dimension() > 1 && twoHead.dimension() > 1 && twoHead.intersect(oneTail) > 1))
{
relation = -1;
}
- else if ((oneHead.dimension() > 1 && twoTail.dimension() >= oneHead.dimension() && twoTail.contains(oneHead)) ||
- (twoTail.dimension() > 1 && oneHead.dimension() >= twoTail.dimension() && oneHead.contains(twoTail)))
+ else if ((oneHead.dimension() > 1 && twoTail.dimension() > 1 && sndXfst > 1) ||
+ (twoTail.dimension() > 1 && oneHead.dimension() > 1 && oneHead.intersect(twoTail) > 1))
{
relation = 1;
}
@@ -102,7 +101,7 @@
}
else
{
- relation = fstXsnd ? -1 : (sndXfst ? 1 : 0);
+ relation = fstXsnd > 0 ? -1 : (sndXfst > 0 ? 1 : 0);
}
if (relation == 0)
Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/Dots.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/Dots.java 2009-10-29 10:54:08 UTC (rev 95744)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/Dots.java 2009-10-29 11:46:56 UTC (rev 95745)
@@ -37,23 +37,16 @@
T getValue();
/**
- * Do this dots match with the param dots.
+ * Return the dimension of intersection.
+ * For strict domino that matches this would be one,
+ * in our case is the size of intersection set.
*
* @param dots the dots
- * @return true if these dots match param dots
+ * @return the intersection dimension
*/
- boolean match(Dots<T> dots);
+ int intersect(Dots<T> dots);
/**
- * Do this dots contain the param dots.
- * In most cases this should be te same as a match.
- *
- * @param dots the dots
- * @return true if these dots contain param dots
- */
- boolean contains(Dots<T> dots);
-
- /**
* The dimension of different dots.
* For strict domino dots this would be one,
* in our string set case this is the size of the set.
Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/SetDots.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/SetDots.java 2009-10-29 10:54:08 UTC (rev 95744)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/SetDots.java 2009-10-29 11:46:56 UTC (rev 95745)
@@ -46,26 +46,12 @@
return set;
}
- public boolean match(Dots<Set<V>> containable)
+ public int intersect(Dots<Set<V>> containable)
{
- if (set.isEmpty() == false)
- {
- for(V value : containable.getValue())
- {
- if (set.contains(value))
- {
- return true;
- }
- }
- }
- return false;
- }
-
- public boolean contains(Dots<Set<V>> containable)
- {
Set<V> otherSet = containable.getValue();
Set<V> copy = new HashSet<V>(otherSet);
- return copy.retainAll(set) == false;
+ copy.retainAll(set);
+ return copy.size();
}
public int dimension()
Modified: projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/DeployerFlowUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/DeployerFlowUnitTestCase.java 2009-10-29 10:54:08 UTC (rev 95744)
+++ projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/deployer/test/DeployerFlowUnitTestCase.java 2009-10-29 11:46:56 UTC (rev 95745)
@@ -1092,7 +1092,7 @@
main.process();
}
- public void testRemovingOverlapping2() throws Exception
+ public void testPartialOverlapping() throws Exception
{
DeployerClient main = createMainDeployer();
More information about the jboss-cvs-commits
mailing list