|
|
@@ -74,9 +74,10 @@
|
|
|
if ($sum <= 3) echo str_pad($bin, 10, "0", STR_PAD_LEFT) . " = " . $i . "\n";
|
|
|
}-->
|
|
|
<xsl:param name="variant" required="yes"/>
|
|
|
- <xsl:param name="bit_limit" required="yes"/>
|
|
|
- <xsl:param name="no_more_variants" required="yes"/>
|
|
|
+ <xsl:param name="bit_limit" required="yes"/> <!-- like 6 -->
|
|
|
+ <xsl:param name="max_possible_bit" required="yes"/><!-- like 1111111 -->
|
|
|
<xsl:param name="loop" required="no"/>
|
|
|
+ <!--<xsl:message>#80 f. v:<xsl:value-of select="$variant"/>;$bit_limit=<xsl:value-of select="$bit_limit"/>;$max_possible_bit=<xsl:value-of select="$max_possible_bit"/>; $loop=<xsl:value-of select="$loop"/>;</xsl:message>-->
|
|
|
<xsl:variable name="variant" select="number($variant) + 1"/><!-- dodajemy 1 aby sprawdzic jak wyglada -->
|
|
|
<xsl:variable name="curr_bit" select="bp:decimalToBit($variant)"/>
|
|
|
<xsl:variable name="digits">
|
|
|
@@ -88,22 +89,28 @@
|
|
|
</xsl:variable>
|
|
|
<xsl:variable name="cur_bit_len" select=" string-length($digits)"/>
|
|
|
<xsl:choose>
|
|
|
- <xsl:when test="number($loop) > 60000">
|
|
|
+ <xsl:when test="number($loop) > 1000">
|
|
|
<!--<xsl:message>#91 loop:<xsl:value-of select="$loop"/>; hit returning $variant=<xsl:value-of select="$variant"/>; $curr_bit=<xsl:value-of select="$curr_bit"/>;</xsl:message>-->
|
|
|
<xsl:value-of select="$variant"/>
|
|
|
</xsl:when>
|
|
|
- <xsl:when test="number($cur_bit_len)= number($no_more_variants)">
|
|
|
+ <xsl:when test="$curr_bit = $max_possible_bit">
|
|
|
<!--<xsl:message>#90 brak kolejnych wariantow $variant=<xsl:value-of select="$variant"/>;$bit_limit=<xsl:value-of select="$bit_limit"/>; $curr_bit=<xsl:value-of select="$curr_bit"/></xsl:message>-->
|
|
|
<xsl:value-of select="$variant"/>
|
|
|
</xsl:when>
|
|
|
- <xsl:when test="number($cur_bit_len) <= number($bit_limit)">
|
|
|
- <xsl:value-of select="$variant"/>
|
|
|
+ <xsl:when test="number($cur_bit_len) <= number($bit_limit)">
|
|
|
+ <!--<xsl:variable name="next_bit" select="bp:decimalToBit($variant+1)"/>-->
|
|
|
+ <!--<xsl:message>#104 next <xsl:value-of select="$variant"/></xsl:message>-->
|
|
|
+ <xsl:value-of select="$variant"/>
|
|
|
</xsl:when>
|
|
|
+
|
|
|
<xsl:when test="number($cur_bit_len) > number($bit_limit)">
|
|
|
<!--<xsl:variable name="next_bit" select="bp:decimalToBit($variant+1)"/>-->
|
|
|
<!--<xsl:message>#104 next <xsl:value-of select="$variant"/></xsl:message>-->
|
|
|
- <xsl:value-of select="bp:next_bit_max($variant ,$bit_limit,$no_more_variants,$loop+1)"/>
|
|
|
+ <xsl:value-of select="bp:next_bit_max($variant ,$bit_limit,$max_possible_bit,$loop+1)"/>
|
|
|
</xsl:when>
|
|
|
+ <!--<xsl:otherwise>
|
|
|
+ <xsl:message terminate="yes">#107 f. else $variant=<xsl:value-of select="$variant"/>; $curr_bit=<xsl:value-of select="$curr_bit"/>; $digits=<xsl:value-of select="$digits"/>;</xsl:message>
|
|
|
+ <xsl:value-of select="$variant"/></xsl:otherwise>-->
|
|
|
</xsl:choose>
|
|
|
</xsl:function>
|
|
|
|
|
|
@@ -111,26 +118,26 @@
|
|
|
<xsl:param name="wariant_id" required="yes"/>
|
|
|
<xsl:param name="elements_cnt" required="yes"/>
|
|
|
<xsl:param name="bit" required="yes"/>
|
|
|
- <xsl:param name="bit_limit" required="yes"/>
|
|
|
- <xsl:variable name="table">
|
|
|
+ <xsl:param name="max_possible_bit" required="yes"/>
|
|
|
+ <!--<xsl:variable name="table">
|
|
|
<variant>
|
|
|
<xsl:for-each select="1 to $elements_cnt">
|
|
|
<pos>
|
|
|
<xsl:attribute name="pos" select="."/>
|
|
|
- <!--<xsl:attribute name="bin_pos" select=" bp:if_bit_pos($bit,.)"/>-->
|
|
|
+ <!-\-<xsl:attribute name="bin_pos" select=" bp:if_bit_pos($bit,.)"/>-\->
|
|
|
<xsl:if test=" string-length($bit) > 0">
|
|
|
<xsl:attribute name="bin_pos" select="substring($bit,.,1)"/>
|
|
|
</xsl:if>
|
|
|
- <!--<xsl:attribute name="bin_poss" select="$bit"/>-->
|
|
|
- <!--<xsl:value-of select="substring($bit,.,1)"/>-->
|
|
|
+ <!-\-<xsl:attribute name="bin_poss" select="$bit"/>-\->
|
|
|
+ <!-\-<xsl:value-of select="substring($bit,.,1)"/>-\->
|
|
|
</pos>
|
|
|
</xsl:for-each>
|
|
|
</variant>
|
|
|
- </xsl:variable>
|
|
|
+ </xsl:variable>-->
|
|
|
|
|
|
- <xsl:variable name="sum_bit" select="sum($table/variant/pos/@bin_pos)"/>
|
|
|
+ <!--<xsl:variable name="sum_bit" select="sum($table/variant/pos/@bin_pos)"/>-->
|
|
|
<!--<xsl:variable name="sum_bit" select="1"/>-->
|
|
|
- <xsl:choose>
|
|
|
+ <!--<xsl:choose> errory
|
|
|
<xsl:when test="$sum_bit = $elements_cnt and $sum_bit <= $bit_limit">
|
|
|
<variant>
|
|
|
<xsl:attribute name="no_more_variants" select="$sum_bit"/>
|
|
|
@@ -156,7 +163,7 @@
|
|
|
<xsl:attribute name="bit_limit_hit" select="$sum_bit"/>
|
|
|
</variant>
|
|
|
</xsl:otherwise>
|
|
|
- </xsl:choose>
|
|
|
+ </xsl:choose>-->
|
|
|
|
|
|
</xsl:template>
|
|
|
|
|
|
@@ -168,8 +175,9 @@
|
|
|
|
|
|
<xsl:template name="PE_wariant">
|
|
|
<xsl:param name="elements_cnt" select="10"/>
|
|
|
- <xsl:param name="bit_max" select="3"/>
|
|
|
+ <xsl:param name="max_possible_bit" select="1111111111"/>
|
|
|
<xsl:param name="EconomicDistanceCut2"/><!-- tabela do podstawiania danych i wyliczen -->
|
|
|
+
|
|
|
<PE_wariant_bit_table>
|
|
|
<!--<xsl:variable name="no_more_variants" select=" math:power(2,$elements_cnt)"/>-->
|
|
|
<xsl:variable name="no_more_variants" select="6"/>
|
|
|
@@ -183,7 +191,7 @@
|
|
|
</test>-->
|
|
|
<xsl:variable name="bit" select=" string-join(bp:decimalToBitFill(.,$elements_cnt),'')"/>
|
|
|
<xsl:variable name="bit2" select=" string-join(bp:decimalToBit($wariant_id),'')"/>
|
|
|
- <xsl:variable name="bp:next_bit_max" select="bp:next_bit_max($wariant_id,$bit_max,$elements_cnt,0)"/>
|
|
|
+ <xsl:variable name="bp:next_bit_max" select="bp:next_bit_max($wariant_id,$max_possible_bit,$elements_cnt,0)"/>
|
|
|
|
|
|
<xsl:variable name="PE_wariant_bit_table">
|
|
|
<PE_wariant_bit_table>
|
|
|
@@ -196,7 +204,7 @@
|
|
|
<xsl:with-param name="wariant_id" select="$wariant_id"/>
|
|
|
<xsl:with-param name="elements_cnt" select="$elements_cnt"/>
|
|
|
<xsl:with-param name="bit" select="bp:decimalToBitFill($wariant_id,$elements_cnt)"/>
|
|
|
- <xsl:with-param name="bit_limit" select="$bit_max"/>
|
|
|
+ <xsl:with-param name="max_possible_bit" select="$max_possible_bit"/>
|
|
|
</xsl:call-template>
|
|
|
</PE_wariant_bit_table>
|
|
|
</xsl:variable>
|