Kaydet (Commit) 38272ba9 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Scope reduction by throwing early.

Change-Id: Ic0b7b69b8c4e57064b31ef62ddceaf6094ca9991
üst 059ce597
...@@ -335,41 +335,38 @@ Reference< beans::XPropertySet > ...@@ -335,41 +335,38 @@ Reference< beans::XPropertySet >
::std::vector< Reference< chart2::data::XLabeledDataSequence > > aValuesSeries( ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aValuesSeries(
DataSeriesHelper::getAllDataSequencesByRole( aSequences , "values", true ) ); DataSeriesHelper::getAllDataSequencesByRole( aSequences , "values", true ) );
if( !aValuesSeries.empty() )
if (aValuesSeries.empty())
throw lang::IndexOutOfBoundsException();
Reference< chart2::data::XDataSequence > xSeq( aValuesSeries.front()->getValues() );
if( 0 <= nIndex && nIndex < xSeq->getData().getLength() )
{ {
Reference< chart2::data::XDataSequence > xSeq( aValuesSeries.front()->getValues() );
if( 0 <= nIndex && nIndex < xSeq->getData().getLength() )
{ {
MutexGuard aGuard( GetMutex() );
tDataPointAttributeContainer::iterator aIt( m_aAttributedDataPoints.find( nIndex ) );
if( aIt != m_aAttributedDataPoints.end() )
xResult = (*aIt).second;
}
if( !xResult.is() )
{
Reference< beans::XPropertySet > xParentProperties;
Reference< util::XModifyListener > xModifyEventForwarder;
{ {
MutexGuard aGuard( GetMutex() ); MutexGuard aGuard( GetMutex() );
tDataPointAttributeContainer::iterator aIt( m_aAttributedDataPoints.find( nIndex ) ); xParentProperties = this;
if( aIt != m_aAttributedDataPoints.end() ) xModifyEventForwarder = m_xModifyEventForwarder;
xResult = (*aIt).second;
} }
if( !xResult.is() )
{
Reference< beans::XPropertySet > xParentProperties;
Reference< util::XModifyListener > xModifyEventForwarder;
{
MutexGuard aGuard( GetMutex() );
xParentProperties = this;
xModifyEventForwarder = m_xModifyEventForwarder;
}
// create a new XPropertySet for this data point // create a new XPropertySet for this data point
xResult.set( new DataPoint( xParentProperties ) ); xResult.set( new DataPoint( xParentProperties ) );
{ {
MutexGuard aGuard( GetMutex() ); MutexGuard aGuard( GetMutex() );
m_aAttributedDataPoints[ nIndex ] = xResult; m_aAttributedDataPoints[ nIndex ] = xResult;
}
ModifyListenerHelper::addListener( xResult, xModifyEventForwarder );
} }
ModifyListenerHelper::addListener( xResult, xModifyEventForwarder );
} }
} }
else
{
throw lang::IndexOutOfBoundsException();
}
return xResult; return xResult;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment