get method

bool get(
  1. ClipProc proc,
  2. ClipParam param,
  3. double x,
  4. ParamFloat y1,
  5. ParamFloat y2,
)

Implementation

bool get( ClipProc proc, ClipParam param, double x, ParamFloat y1, ParamFloat y2 ){
	int i;
	int num;
	ParamFloat ratio = ParamFloat();
	List<ClipGraphAns> tmp;

	if( (num = _search( x, ratio )) < -1 ){
		return false;
	}
	if( num == -1 ){
		if( !_process( proc, param, _info[_curIndex]._expr1, x, y1 ) ){
			return false;
		}
		if( _info[_curIndex]._mode == ClipGlobal.graphModeParam ){
			if( !_process( proc, param, _info[_curIndex]._expr2, x, y2 ) ){
				return false;
			}
		}

		// 既存のデータをコピー
		tmp = ClipGraphAns.newArray( _info[_curIndex]._ansNum.val() + 1 );
		for( i = 0; i < _info[_curIndex]._ansNum.val(); i++ ){
//				tmp[i + 1].set( _info[_curIndex]._ans[i] );
			tmp[i + 1] = _info[_curIndex]._ans[i];
		}

		num = 0;
	} else if( num == _info[_curIndex]._ansNum.val() ){
		if( !_process( proc, param, _info[_curIndex]._expr1, x, y1 ) ){
			return false;
		}
		if( _info[_curIndex]._mode == ClipGlobal.graphModeParam ){
			if( !_process( proc, param, _info[_curIndex]._expr2, x, y2 ) ){
				return false;
			}
		}

		// 既存のデータをコピー
		tmp = ClipGraphAns.newArray( _info[_curIndex]._ansNum.val() + 1 );
		for( i = 0; i < _info[_curIndex]._ansNum.val(); i++ ){
//				tmp[i].set( _info[_curIndex]._ans[i] );
			tmp[i] = _info[_curIndex]._ans[i];
		}

		num = _info[_curIndex]._ansNum.val();
	} else if( ratio.val() == 0.0 ){
		y1.set( _info[_curIndex]._ans[num]._y1 );
		y2.set( _info[_curIndex]._ans[num]._y2 );
		return true;
	} else {
		if( !_process( proc, param, _info[_curIndex]._expr1, x, y1 ) ){
			return false;
		}
		if( _info[_curIndex]._mode == ClipGlobal.graphModeParam ){
			if( !_process( proc, param, _info[_curIndex]._expr2, x, y2 ) ){
				return false;
			}
		}

		// 既存のデータをコピー
		tmp = ClipGraphAns.newArray( _info[_curIndex]._ansNum.val() + 1 );
		for( i = 0; i <= num; i++ ){
//				tmp[i].set( _info[_curIndex]._ans[i] );
			tmp[i] = _info[_curIndex]._ans[i];
		}
		for( ; i < _info[_curIndex]._ansNum.val(); i++ ){
//				tmp[i + 1].set( _info[_curIndex]._ans[i] );
			tmp[i + 1] = _info[_curIndex]._ans[i];
		}

		num++;
	}

	// 新規データをセット
	tmp[num]._x  = x;
	tmp[num]._y1 = y1.val();
	tmp[num]._y2 = y2.val();
	_info[_curIndex]._ansNum.set( _info[_curIndex]._ansNum.val() + 1 );
	_info[_curIndex]._ans = tmp;

	return true;
}