curiter计划是什么手机品牌

[08/48] incubator-ignite git commit: #IGNITE-53: wip
ignite-commits mailing list archives
Message view
sboi...@apache.org
[08/48] incubator-ignite git commit: #IGNITE-53: wip
#IGNITE-53: wip
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/adf6bf9f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/adf6bf9f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/adf6bf9f
Branch: refs/heads/sprint-1
Commit: adf6bf9f9ea810beb6e77dde5bd3f3
Parents: 984ac18
Author: ivasilinets &&
Authored: Thu Jan 15 11:27:52
Committer: ivasilinets &&
Committed: Thu Jan 15 11:27:52
----------------------------------------------------------------------
.../processors/cache/IgniteCacheProxy.java
| 66 ++++++++++++--------
.../cache/GridCacheAbstractFullApiSelfTest.java | 15 ++---
2 files changed, 47 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/adf6bf9f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 3d8c75c..6a75ebb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -78,49 @@ public class IgniteCacheProxy&K, V& extends IgniteAsyncSupportAdapter
implements
private class IgniteCacheIterator implements Iterator&Cache.Entry&K, V&&
/** Cache query future for all entries in distributed ignite cache. */
private final GridCacheQueryFuture&Map.Entry&K, V&&
private GridCacheQueryFuture&Map.Entry&K, V&&
/** Current element. */
private Map.Entry&K, V& curI
private Map.Entry&K, V& curE
/** Next element. */
private Map.Entry&K,V& nextI
private Map.Entry&K,V& nextE
* No-arg constructor.
public IgniteCacheIterator() {
fut = delegate.queries().createScanQuery(null).execute();
nextIter = fut.next();
catch (IgniteCheckedException e) {
throw cacheException(e);
/** Init first time. */
private boolean firstTime =
/** {@inheritDoc} */
@Override public boolean hasNext() {
return nextIter !=
initFirstTime();
return nextEntry !=
/** {@inheritDoc} */
@Override public Entry&K, V& next() {
curIter = nextI
initFirstTime();
if (curIter == null) {
curEntry = nextE
if (curEntry == null)
throw new NoSuchElementException();
nextIter = fut.next();
nextEntry = fut.next();
catch (IgniteCheckedException e) {
curEntry =
throw cacheException(e);
return new Cache.Entry&K, V&() {
@Override public K getKey() {
return curIter.getKey();
return curEntry.getKey();
@Override public V getValue() {
return curIter.getValue();
return curEntry.getValue();
@Override public &T& T unwrap(Class&T& clazz) {
@@ -31,36 @@ public class IgniteCacheProxy&K, V& extends IgniteAsyncSupportAdapter
implements
/** {@inheritDoc} */
@Override public void remove() {
if (curIter == null)
if (curEntry == null)
throw new IllegalStateException();
delegate.removex(curIter.getKey());
delegate.removex(curEntry.getKey());
catch (IgniteCheckedException e) {
throw cacheException(e);
curEntry =
* Initialize fields at first call
private void initFirstTime() {
if (!firstTime) {
firstTime =
fut = delegate.queries().createScanQuery(null).execute();
nextEntry = fut.next();
catch (IgniteCheckedException e) {
throw cacheException(e);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/adf6bf9f/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -91,20 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
checkIteratorCache(entries);
//check that we cannot call Iterator.remove() without next().
Iterator&Cache.Entry&String, Integer&& iter = jcache(0).iterator();
//check that we cannot call Iterator.remove() without next().
Iterator&Cache.Entry&String, Integer&& iter = jcache(0).iterator();
assertTrue(iter.hasNext());
assertTrue(iter.hasNext());
iter.next();
iter.remove();
iter.next();
iter.remove();
iter.remove();
catch (Exception e) {
catch (IllegalStateException e) {
(inline, 7-Bit, 6584 bytes)&nbsp>&nbsp
&nbsp>&nbsp
&nbsp>&nbsp
一个整数数组,长度为n,将其分为m份,使各份的和相等,求m.(下)
摘要:之前那篇说另外一种写法的雏形出现在我的脑海中,现在终于都写完并且调试完成了。现在放上来,以免到时候又忘记了写过的东西。#include&vector&#include&list&#include&iostream&typedefvector&int&intArray_t;classStrangeInt{public:StrangeInt();StrangeInt(intvalue);Stran
之前那篇说另外一种写法的雏形出现在我的脑海中,现在终于都写完并且调试完成了。现在放上来,以免到时候又忘记了写过的东西。
#include&vector&#include&list&#include&iostream&typedef vector&int& intArray_t;class StrangeInt {public:StrangeInt();StrangeInt(int value);StrangeInt(const StrangeInt &;ref);bool isDeleted();void setDeleted(bool deleted);int getValue();int getRefCount();void incRefCount();void decRefCount();bool operator & (const StrangeInt &;ref);private:int refC};class StrangeIter {public:StrangeIter(list&StrangeInt&::iterator er, list&StrangeInt& *array);list&StrangeInt&::iterator incIter();list&StrangeInt&::iterator decIter();list&StrangeInt&::iterator firstElem();list&StrangeInt&::iterator lastElem();void erase();void insert(int value);bool isFirstElem();list&StrangeInt&::iterator getCurIter();void incItsRefCount();void decItsRefCount();bool isEmpty();private:list&StrangeInt&::list&StrangeInt& *list&StrangeInt&::iterator lastDelPbool lastHadDbool isF};StrangeInt::StrangeInt(){}StrangeInt::StrangeInt(int value) : value(value), refCount(0), deleted(false){}StrangeInt::StrangeInt(const StrangeInt&; ref) : value(ref.value), refCount(ref.refCount), deleted(ref.deleted) {}bool StrangeInt::isDeleted() {}void StrangeInt::setDeleted(bool deleted) {this-&deleted =}int StrangeInt::getValue() {}int StrangeInt::getRefCount() {return refC}void StrangeInt::incRefCount() {refCount++;}void StrangeInt::decRefCount() {refCount--;}bool StrangeInt::operator & (const StrangeInt &;ref) {return value & ref.}StrangeIter::StrangeIter(list&StrangeInt&::iterator er, list&StrangeInt& *array) : iter(iter), array(array), lastHadDel(false), isFirst(false){}list&StrangeInt&::iterator StrangeIter::incIter() {if (iter != array-&end()) {while (++iter != array-&end() &;&; iter-&isDeleted());}}list&StrangeInt&::iterator StrangeIter::decIter() {if (!isFirstElem()) {while ((--iter)-&isDeleted());}}list&StrangeInt&::iterator StrangeIter::firstElem() {list&StrangeInt&::iterator retIter = array-&begin();if (retIter != array-&end() &;&; retIter-&isDeleted()) {while (++retIter != array-&end() &;&; retIter-&isDeleted());}return retI}list&StrangeInt&::iterator StrangeIter::lastElem() {list&StrangeInt&::iterator retIter = array-&end();if (retIter != firstElem()) {while ((--retIter)-&isDeleted());}return retI}bool StrangeIter::isFirstElem() {if (firstElem() == iter)}void StrangeIter::erase() {if (iter-&getRefCount() & 0) {iter-&setDeleted(true);lastDelPos =lastHadDel =incIter();}else {if (iter == array-&begin()) {isFirst =array-&erase(iter++);if (iter != array-&end() &;&; iter-&isDeleted())incIter();}else {array-&erase(iter--);lastDelPos =if (!iter-&isDeleted()) {iter-&incRefCount();}incIter();}lastHadDel =}}void StrangeIter::insert(int value) {if (lastHadDel) {StrangeInt retInt(value);if (isFirst) {iter = array-&begin();array-&insert(iter, retInt);}else {iter = lastDelPif (!iter-&isDeleted()) {iter-&decRefCount();}array-&insert(++iter, retInt);}if (iter != array-&end() &;&; iter-&isDeleted())incIter();}else {lastDelPos-&setDeleted(false);iter = lastDelPincIter();}}list&StrangeInt&::iterator StrangeIter::getCurIter() {}void StrangeIter::incItsRefCount() {iter-&incRefCount();}void StrangeIter::decItsRefCount() {iter-&decRefCount();}bool StrangeIter::isEmpty() {return firstElem() == array-&end();}int sumOfArray(const vector&int& &;array) {int sum = 0;int size = array.size();for (int i = 0; i & i++) {sum += array.at(i);}}bool maxDivFun(list&StrangeInt& &;array, vector&intArray_t& &;result, int groupSize, int preSize, vector&int& ?Array, list&StrangeInt&::iterator er) {while (iter != array.end()) {if ((preSize + iter-&getValue()) &= groupSize) {preArray.push_back(iter-&getValue());StrangeIter autoInsertIter(iter, &;array);autoInsertIter.erase();if ((preSize + preArray.back()) == groupSize) {if (autoInsertIter.isEmpty()) {result.push_back(preArray);}else {vector&int& grpArray(1, array.back().getValue());array.pop_back();if (maxDivFun(array, result, groupSize, grpArray.at(0), grpArray, autoInsertIter.firstElem())) {result.push_back(preArray);}array.push_back(grpArray.at(0));}}else {if (maxDivFun(array, result, groupSize, preSize + preArray.back(), preArray, iter))}autoInsertIter.insert(preArray.back());preArray.pop_back();}}}void maxDiv(const vector&int& &;array, vector&intArray_t& &;result) {if (array.empty())list&StrangeInt& retList(array.begin(), array.end());retList.sort();int maxNum = retList.back().getValue();vector&int& preArray(1, maxNum);if (retList.size() == 1) {result.push_back(preArray);}retList.pop_back();int sum = sumOfArray(array);if (sum % maxNum == 0) {result.push_back(preArray);int n = 0;while (retList.back().getValue() == maxNum) {result.push_back(preArray);retList.pop_back();if (retList.empty())n++;}preArray.at(0) = retList.back().getValue();retList.pop_back();if (maxDivFun(retList, result, maxNum, preArray.at(0), preArray, retList.begin())) {}retList.push_back(preArray.at(0));for (; n != 0; n--) {retList.push_back(maxNum);}preArray.at(0) = maxNresult.clear();}for (int m = sum/maxN m & 0; m--) {if (sum % m == 0 &;&; maxDivFun(retList, result, sum/m, preArray.at(0), preArray, retList.begin())) {}}} 我的测试代码还是和以前一样很简单,现在暂时想不到什么比较好的测试代码。
int main() {int a[10000];//int a[] = { 1, 2, 4, 5, 100 };//int a[] = { 1, 1, 1, 1, 1, 1 };//int a[] = { 3, 3, 4, 6, 2 };//rand();for (int i = 0; i & (sizeof(a) / sizeof(int)); i++) {//a[i] = i + 1;if (i % 2 != 0)a[i] = 1000 - a[i - 1];elsewhile ((a[i] = (rand() % 1000)) &= 0);}vector&int& array(a, a + (sizeof(a)/sizeof(int)));vector&intArray_t&maxDiv(array, result);cout && &{&;int resultSize = result.size();for (int i = 0; i & resultS i++) {if (i != 0)cout && &, &;cout && &{&;vector&int& group = result.at(i);int groupSize = group.size();for (int j = 0; j & groupS j++) {if (j != 0)cout && &, &;cout && group.at(j);}cout && &}&;}cout && &}&;cout && &/n&;cout && &The max group num that can divide to have same sum group is: & && resultSreturn 0;}好像跑完上面这段代码花了几毫秒的时间吧。数据再大就堆栈溢出了。
以上是的内容,更多
的内容,请您使用右上方搜索功能获取相关信息。
若你要投稿、删除文章请联系邮箱:zixun-group@service.aliyun.com,工作人员会在五个工作日内给你回复。
云服务器 ECS
可弹性伸缩、安全稳定、简单易用
&40.8元/月起
预测未发生的攻击
&24元/月起
邮箱低至5折
推荐购买再奖现金,最高25%
&200元/3月起
你可能还喜欢
你可能感兴趣
阿里云教程中心为您免费提供
一个整数数组,长度为n,将其分为m份,使各份的和相等,求m.(下)相关信息,包括
的信息,所有一个整数数组,长度为n,将其分为m份,使各份的和相等,求m.(下)相关内容均不代表阿里云的意见!投稿删除文章请联系邮箱:zixun-group@service.aliyun.com,工作人员会在五个工作日内答复
售前咨询热线
支持与服务
资源和社区
关注阿里云
International求vector&int& 和stack&int&的简单应用
[问题点数:120分,结帖人elmnd]
本版专家分:917
结帖率 99.23%
CSDN今日推荐
本版专家分:917
本版专家分:917
本版专家分:134
本版专家分:16233
本版专家分:917
本版专家分:475
本版专家分:917
本版专家分:2771
本版专家分:2771
本版专家分:2241
本版专家分:42355
2008年11月 C/C++大版内专家分月排行榜第二
本版专家分:917
本版专家分:917
本版专家分:7860
本版专家分:7860
本版专家分:7860
匿名用户不能发表回复!|
其他相关推荐网上收集整合出来的,算是剽窃吧,IE6下用过,其他的没试。
&script language="javascript">
function TFly_Init(name, offsetLeft, offsetTop, alignment, anyIter, anyTime, staticHover, popupHover, popupLatency, hideLatency, onInit, onPopup, onHide) {
var TFly = document.getElementById(name);
TFly.DT = document.getElementById(name + "_Popup");
TFly.F = document.getElementById(name + "_Anim");
TFly.oX = offsetL
TFly.oY = offsetT
TFly.alignment =
TFly.AnyIter = anyI
TFly.AnyTime = anyT
TFly.popupLatency = popupL
TFly.hideLatency = hideL
TFly.onPopup = onP
TFly.onHide = onH
TFly.onmouseover = function() {
if (staticHover != '') {
TFly.className_ = TFly.classN
TFly.className = staticH
TFly_Popup(TFly, true);
TFly.onmouseout = function() {
if (staticHover != '') {
TFly.className = TFly.className_;
TFly_Popup(TFly, false);
if (document.all) {
TFly.onactivate = TFly.
TFly.ondeactivate = TFly.
TFly.onfocus = TFly.
TFly.onblur = TFly.
TFly.DT.onmouseover = function() {
if (popupHover != '') {
TFly.DT.className_ = TFly.DT.classN
TFly.DT.className = popupH
TFly_Popup(TFly, true);
TFly.DT.onmouseout = function() {
if (popupHover != '') {
TFly.DT.className = TFly.DT.className_;
TFly_Popup(TFly, false);
TFly_CallClientFunction(onInit, TFly);
function TFly_CallClientFunction(name, TFly) {
if (name != null && name != "")
eval(name + "(TFly);");
function TFly_SetPosition(TFly, obj) {
obj.style.top = TFly.oY + TFly.offsetHeight + "px";
obj.style.left = TFly.oX + (TFly.offsetWidth - obj.offsetWidth ) * (1 + TFly.alignment) / 2 + "px";
function TFly_Popup(TFly, value) {
if (TFly.timer != null) window.clearTimeout(TFly.timer);
if (value) {
if (TFly.status == "on")
var timeout = (TFly.status == "active") ? 0 : TFly.popupL
if (TFly.AnyIter > 0 && TFly.AnyTime > 0)
TFly.timer = window.setTimeout(function() {TFly_AnimateStart(TFly, true, TFly.F.curIter);}, timeout);
TFly.timer = window.setTimeout(function() {TFly_SetVisibility(TFly, true);}, timeout);
if (TFly.status == "off")
var timeout = (TFly.status == "active") ? 0 : TFly.hideL
if (TFly.AnyIter > 0 && TFly.AnyTime > 0)
TFly.timer = window.setTimeout(function() {TFly_AnimateStart(TFly, false, TFly.F.curIter);}, timeout);
TFly.timer = window.setTimeout(function() {TFly_SetVisibility(TFly, false);}, timeout);
function TFly_SetVisibility(TFly, value) {
if (value == true) {
TFly_SetPosition(TFly, TFly.DT);
TFly.DT.style.visibility = "visible";
TFly.style.zIndex = "999";
TFly.DT.style.visibility = "hidden";
TFly.style.zIndex = "0";
TFly.DT.style.left = "-10000px";
function TFly_AnimateStart (TFly, inout, curIter) {
if (TFly.F.timer != null) window.clearTimeout(TFly.F.timer);
if (curIter == null) curIter=0;
if (TFly.status != "active") {
TFly.status = "active";
TFly.F.style.visibility = "visible";
TFly.DT.style.visibility = "hidden";
if (curIter
TFly.AnyIter) {
TFly.F.curIter = (curIter < 1) ? 0 : TFly.AnyI
TFly.status = (TFly.F.curIter == TFly.AnyIter) ? "on": "off";
TFly.F.style.visibility = "hidden";
TFly_SetPosition(TFly, TFly.DT);
TFly.style.zIndex = (TFly.F.curIter == TFly.AnyIter) ? "999" : "0";
if (TFly.F.curIter == TFly.AnyIter) {
TFly.status = "on";
TFly_SetVisibility(TFly, true);
TFly_CallClientFunction(TFly.onPopup, TFly);
TFly.status = "off";
TFly_SetVisibility(TFly, false);
TFly_CallClientFunction(TFly.onHide, TFly);
var per = curIter * (95 / TFly.AnyIter) + 5;
TFly.F.style.visibility = "hidden";
TFly.F.style.width = TFly.DT.offsetWidth / 100 * per + "px";
TFly.F.style.height = TFly.DT.offsetHeight / 100 * per + "px";
TFly_SetPosition(TFly, TFly.F);
TFly.F.style.visibility = "visible";
var timeout = (per == 100 ) ? 0 : TFly.AnyTime - (TFly.AnyTime / (TFly.AnyIter) * (curIter));
curIter += (inout) ? 1 : -1;
TFly.F.timer = window.setTimeout(function() {TFly_AnimateStart(TFly, inout, curIter)}, timeout);
TFly.F.curIter = curI
4月份年休假人员名单公布
请大家尽快上交4月份交通燃油发票。
4月25日文艺晚会推迟至4月29日,请互相转告! 查看全部
企务直通车
党务公开专栏
招投标工程
投诉与意见
TFly_Init('MS_user', 0, 0, -1, 2, 60, 'MSFlyoutStaticHover_msdn', '', 100, 400, '', '', '');
TFly_Init('MS_shortcut', 0, 0, 1, 2, 60, 'MSFlyoutStaticHover_msdn', '', 100, 400, '', '', '');
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

我要回帖

更多关于 iter 的文章

 

随机推荐