code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public UNode getStatistics(ApplicationDefinition appDef, String shard, Map<String, String> paramMap) {
checkServiceState();
CubeSearcher searcher = m_olap.getSearcher(appDef, shard);
String file = paramMap.get("file");
if(file != null) {
return OlapStatistics.getFileData(searcher, file);
}
String sort = paramMap.get("sort");
boolean memStats = !"false".equals(paramMap.get("mem"));
return OlapStatistics.getStatistics(searcher, sort, memStats);
} } | public class class_name {
public UNode getStatistics(ApplicationDefinition appDef, String shard, Map<String, String> paramMap) {
checkServiceState();
CubeSearcher searcher = m_olap.getSearcher(appDef, shard);
String file = paramMap.get("file");
if(file != null) {
return OlapStatistics.getFileData(searcher, file);
// depends on control dependency: [if], data = [none]
}
String sort = paramMap.get("sort");
boolean memStats = !"false".equals(paramMap.get("mem"));
return OlapStatistics.getStatistics(searcher, sort, memStats);
} } |
public class class_name {
private List<ResourceBuilderModel> getRegisteredListForResource(ResourceModel resource) {
if(resourceIDs.containsKey(resource.getResourceID())) {
return resourceIDs.get(resource.getResourceID());
} else {
LinkedList<ResourceBuilderModel> tempList = new LinkedList<>();
resourceIDs.put(resource.getResourceID(), tempList);
return tempList;
}
} } | public class class_name {
private List<ResourceBuilderModel> getRegisteredListForResource(ResourceModel resource) {
if(resourceIDs.containsKey(resource.getResourceID())) {
return resourceIDs.get(resource.getResourceID()); // depends on control dependency: [if], data = [none]
} else {
LinkedList<ResourceBuilderModel> tempList = new LinkedList<>();
resourceIDs.put(resource.getResourceID(), tempList); // depends on control dependency: [if], data = [none]
return tempList; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(GlobalSecondaryIndex globalSecondaryIndex, ProtocolMarshaller protocolMarshaller) {
if (globalSecondaryIndex == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(globalSecondaryIndex.getIndexName(), INDEXNAME_BINDING);
protocolMarshaller.marshall(globalSecondaryIndex.getKeySchema(), KEYSCHEMA_BINDING);
protocolMarshaller.marshall(globalSecondaryIndex.getProjection(), PROJECTION_BINDING);
protocolMarshaller.marshall(globalSecondaryIndex.getProvisionedThroughput(), PROVISIONEDTHROUGHPUT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GlobalSecondaryIndex globalSecondaryIndex, ProtocolMarshaller protocolMarshaller) {
if (globalSecondaryIndex == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(globalSecondaryIndex.getIndexName(), INDEXNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(globalSecondaryIndex.getKeySchema(), KEYSCHEMA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(globalSecondaryIndex.getProjection(), PROJECTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(globalSecondaryIndex.getProvisionedThroughput(), PROVISIONEDTHROUGHPUT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void setSomePendingWrites(
final long atTime,
final BsonDocument atVersion,
final long atHash,
final ChangeEvent<BsonDocument> changeEvent
) {
docLock.writeLock().lock();
try {
this.lastUncommittedChangeEvent = changeEvent;
this.lastResolution = atTime;
this.lastKnownRemoteVersion = atVersion;
this.lastKnownHash = atHash;
} finally {
docLock.writeLock().unlock();
}
} } | public class class_name {
void setSomePendingWrites(
final long atTime,
final BsonDocument atVersion,
final long atHash,
final ChangeEvent<BsonDocument> changeEvent
) {
docLock.writeLock().lock();
try {
this.lastUncommittedChangeEvent = changeEvent; // depends on control dependency: [try], data = [none]
this.lastResolution = atTime; // depends on control dependency: [try], data = [none]
this.lastKnownRemoteVersion = atVersion; // depends on control dependency: [try], data = [none]
this.lastKnownHash = atHash; // depends on control dependency: [try], data = [none]
} finally {
docLock.writeLock().unlock();
}
} } |
public class class_name {
@Override
public Map<String, Object> toSource() {
Map<String, Object> sourceMap = new HashMap<>();
if (elevateWordId != null) {
addFieldToSource(sourceMap, "elevateWordId", elevateWordId);
}
if (labelTypeId != null) {
addFieldToSource(sourceMap, "labelTypeId", labelTypeId);
}
return sourceMap;
} } | public class class_name {
@Override
public Map<String, Object> toSource() {
Map<String, Object> sourceMap = new HashMap<>();
if (elevateWordId != null) {
addFieldToSource(sourceMap, "elevateWordId", elevateWordId); // depends on control dependency: [if], data = [none]
}
if (labelTypeId != null) {
addFieldToSource(sourceMap, "labelTypeId", labelTypeId); // depends on control dependency: [if], data = [none]
}
return sourceMap;
} } |
public class class_name {
private void paintProgressIndicator(SeaGlassContext context, Graphics2D g2d, int width, int height, int size, boolean isFinished) {
JProgressBar pBar = (JProgressBar) context.getComponent();
if (tileWhenIndeterminate && pBar.isIndeterminate()) {
double offsetFraction = (double) getAnimationIndex() / (double) getFrameCount();
int offset = (int) (offsetFraction * tileWidth);
if (pBar.getOrientation() == JProgressBar.HORIZONTAL) {
// If we're right-to-left, flip the direction of animation.
if (!SeaGlassLookAndFeel.isLeftToRight(pBar)) {
offset = tileWidth - offset;
}
// paint each tile horizontally
for (int i = -tileWidth + offset; i <= width; i += tileWidth) {
context.getPainter().paintProgressBarForeground(context, g2d, i, 0, tileWidth, height, pBar.getOrientation());
}
} else {
// paint each tile vertically
for (int i = -offset; i < height + tileWidth; i += tileWidth) {
context.getPainter().paintProgressBarForeground(context, g2d, 0, i, width, tileWidth, pBar.getOrientation());
}
}
} else {
if (pBar.getOrientation() == JProgressBar.HORIZONTAL) {
int start = 0;
if (isFinished) {
size = width;
} else if (!SeaGlassLookAndFeel.isLeftToRight(pBar)) {
start = width - size;
}
context.getPainter().paintProgressBarForeground(context, g2d, start, 0, size, height, pBar.getOrientation());
} else {
// When the progress bar is vertical we always paint from bottom
// to top, not matter what the component orientation is.
int start = height;
if (isFinished) {
size = height;
}
context.getPainter().paintProgressBarForeground(context, g2d, 0, start, width, size, pBar.getOrientation());
}
}
} } | public class class_name {
private void paintProgressIndicator(SeaGlassContext context, Graphics2D g2d, int width, int height, int size, boolean isFinished) {
JProgressBar pBar = (JProgressBar) context.getComponent();
if (tileWhenIndeterminate && pBar.isIndeterminate()) {
double offsetFraction = (double) getAnimationIndex() / (double) getFrameCount();
int offset = (int) (offsetFraction * tileWidth);
if (pBar.getOrientation() == JProgressBar.HORIZONTAL) {
// If we're right-to-left, flip the direction of animation.
if (!SeaGlassLookAndFeel.isLeftToRight(pBar)) {
offset = tileWidth - offset; // depends on control dependency: [if], data = [none]
}
// paint each tile horizontally
for (int i = -tileWidth + offset; i <= width; i += tileWidth) {
context.getPainter().paintProgressBarForeground(context, g2d, i, 0, tileWidth, height, pBar.getOrientation()); // depends on control dependency: [for], data = [i]
}
} else {
// paint each tile vertically
for (int i = -offset; i < height + tileWidth; i += tileWidth) {
context.getPainter().paintProgressBarForeground(context, g2d, 0, i, width, tileWidth, pBar.getOrientation()); // depends on control dependency: [for], data = [i]
}
}
} else {
if (pBar.getOrientation() == JProgressBar.HORIZONTAL) {
int start = 0;
if (isFinished) {
size = width; // depends on control dependency: [if], data = [none]
} else if (!SeaGlassLookAndFeel.isLeftToRight(pBar)) {
start = width - size; // depends on control dependency: [if], data = [none]
}
context.getPainter().paintProgressBarForeground(context, g2d, start, 0, size, height, pBar.getOrientation()); // depends on control dependency: [if], data = [none]
} else {
// When the progress bar is vertical we always paint from bottom
// to top, not matter what the component orientation is.
int start = height;
if (isFinished) {
size = height; // depends on control dependency: [if], data = [none]
}
context.getPainter().paintProgressBarForeground(context, g2d, 0, start, width, size, pBar.getOrientation()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public int calcuStartIndex(int pageNum,int onePageCount){
int startIndex=0;
String tempType=calcuDbType();
if(tempType!=null && tempType.equals("mysql")){
//if(dbType!=null && dbType.equals("mysql")){
startIndex=pageNum*onePageCount;
}else{
startIndex=pageNum*onePageCount+1;
}
return startIndex;
} } | public class class_name {
public int calcuStartIndex(int pageNum,int onePageCount){
int startIndex=0;
String tempType=calcuDbType();
if(tempType!=null && tempType.equals("mysql")){
//if(dbType!=null && dbType.equals("mysql")){
startIndex=pageNum*onePageCount;
// depends on control dependency: [if], data = [none]
}else{
startIndex=pageNum*onePageCount+1;
// depends on control dependency: [if], data = [none]
}
return startIndex;
} } |
public class class_name {
private static IObjectSerializer getSerializer( Class clazz )
{
Iterator<Map.Entry<Class, IObjectSerializer>> iterator = serializers.entrySet().iterator();
IObjectSerializer serializer = DEFAULT_SERIALIZER;
while( iterator.hasNext() )
{
Map.Entry<Class, IObjectSerializer> entry = iterator.next();
if( entry.getKey().isAssignableFrom( clazz ) )
{
serializer = entry.getValue();
break;
}
}
return serializer;
} } | public class class_name {
private static IObjectSerializer getSerializer( Class clazz )
{
Iterator<Map.Entry<Class, IObjectSerializer>> iterator = serializers.entrySet().iterator();
IObjectSerializer serializer = DEFAULT_SERIALIZER;
while( iterator.hasNext() )
{
Map.Entry<Class, IObjectSerializer> entry = iterator.next();
if( entry.getKey().isAssignableFrom( clazz ) )
{
serializer = entry.getValue(); // depends on control dependency: [if], data = [none]
break;
}
}
return serializer;
} } |
public class class_name {
@Override
public boolean next() {
if (!this.iteratingBrlw.next()) {
if (!this.masterIterator.hasNext()) {
return false;
} else {
this.iteratingBrlw = new IteratingBufferedRunningLengthWord32(this.masterIterator.next());
}
}
return true;
} } | public class class_name {
@Override
public boolean next() {
if (!this.iteratingBrlw.next()) {
if (!this.masterIterator.hasNext()) {
return false; // depends on control dependency: [if], data = [none]
} else {
this.iteratingBrlw = new IteratingBufferedRunningLengthWord32(this.masterIterator.next()); // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static int compare(String ns1, String ln1, String ns2, String ln2) {
if (ns1 == null) {
ns1 = Constants.XML_NULL_NS_URI;
}
if (ns2 == null) {
ns2 = Constants.XML_NULL_NS_URI;
}
int cLocalPart = ln1.compareTo(ln2);
return (cLocalPart == 0 ? ns1.compareTo(ns2) : cLocalPart);
} } | public class class_name {
public static int compare(String ns1, String ln1, String ns2, String ln2) {
if (ns1 == null) {
ns1 = Constants.XML_NULL_NS_URI; // depends on control dependency: [if], data = [none]
}
if (ns2 == null) {
ns2 = Constants.XML_NULL_NS_URI; // depends on control dependency: [if], data = [none]
}
int cLocalPart = ln1.compareTo(ln2);
return (cLocalPart == 0 ? ns1.compareTo(ns2) : cLocalPart);
} } |
public class class_name {
public void marshall(ListFunctionDefinitionsRequest listFunctionDefinitionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listFunctionDefinitionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listFunctionDefinitionsRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listFunctionDefinitionsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListFunctionDefinitionsRequest listFunctionDefinitionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listFunctionDefinitionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listFunctionDefinitionsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listFunctionDefinitionsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public Geldbetrag divide(Number divisor) {
BigDecimal d = toBigDecimal(divisor, context);
if (BigDecimal.ONE.compareTo(d) == 0) {
return this;
}
return Geldbetrag
.valueOf(betrag.setScale(4, RoundingMode.HALF_UP).divide(d, RoundingMode.HALF_UP), currency);
} } | public class class_name {
@Override
public Geldbetrag divide(Number divisor) {
BigDecimal d = toBigDecimal(divisor, context);
if (BigDecimal.ONE.compareTo(d) == 0) {
return this; // depends on control dependency: [if], data = [none]
}
return Geldbetrag
.valueOf(betrag.setScale(4, RoundingMode.HALF_UP).divide(d, RoundingMode.HALF_UP), currency);
} } |
public class class_name {
public CalendarQuarter plus(Years<CalendarUnit> years) {
if (years.isEmpty()) {
return this;
}
return CalendarQuarter.of(MathUtils.safeAdd(this.year, years.getAmount()), this.quarter);
} } | public class class_name {
public CalendarQuarter plus(Years<CalendarUnit> years) {
if (years.isEmpty()) {
return this; // depends on control dependency: [if], data = [none]
}
return CalendarQuarter.of(MathUtils.safeAdd(this.year, years.getAmount()), this.quarter);
} } |
public class class_name {
private static long getInvalidOffsetBehavior(Properties config) {
final String val = config.getProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "largest");
if (val.equals("largest") || val.equals("latest")) { // largest is kafka 0.8, latest is kafka 0.9
return OffsetRequest.LatestTime();
} else {
return OffsetRequest.EarliestTime();
}
} } | public class class_name {
private static long getInvalidOffsetBehavior(Properties config) {
final String val = config.getProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "largest");
if (val.equals("largest") || val.equals("latest")) { // largest is kafka 0.8, latest is kafka 0.9
return OffsetRequest.LatestTime(); // depends on control dependency: [if], data = [none]
} else {
return OffsetRequest.EarliestTime(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static final void encode(int tag, int length, StringBuilder buffer) {
if (tag == PATTERN_ISO_ZONE && length >= 4) {
throw new IllegalArgumentException("invalid ISO 8601 format: length=" + length);
}
if (length < 255) {
buffer.append((char)(tag << 8 | length));
} else {
buffer.append((char)((tag << 8) | 0xff));
buffer.append((char)(length >>> 16));
buffer.append((char)(length & 0xffff));
}
} } | public class class_name {
private static final void encode(int tag, int length, StringBuilder buffer) {
if (tag == PATTERN_ISO_ZONE && length >= 4) {
throw new IllegalArgumentException("invalid ISO 8601 format: length=" + length);
}
if (length < 255) {
buffer.append((char)(tag << 8 | length)); // depends on control dependency: [if], data = [none]
} else {
buffer.append((char)((tag << 8) | 0xff)); // depends on control dependency: [if], data = [none]
buffer.append((char)(length >>> 16)); // depends on control dependency: [if], data = [(length]
buffer.append((char)(length & 0xffff)); // depends on control dependency: [if], data = [(length]
}
} } |
public class class_name {
public StringDictionary reverse()
{
StringDictionary dictionary = new StringDictionary(separator);
for (Map.Entry<String, String> entry : entrySet())
{
dictionary.trie.put(entry.getValue(), entry.getKey());
}
return dictionary;
} } | public class class_name {
public StringDictionary reverse()
{
StringDictionary dictionary = new StringDictionary(separator);
for (Map.Entry<String, String> entry : entrySet())
{
dictionary.trie.put(entry.getValue(), entry.getKey()); // depends on control dependency: [for], data = [entry]
}
return dictionary;
} } |
public class class_name {
public StackTraceElement get(StackTraceElement[] stackTraceElements) {
Preconditions.checkNotNull(stackTraceElements, "The stack trace elements cannot be null.");
for (final StackTraceElement element : stackTraceElements) {
String className = element.getClassName();
if (!shouldBeSkipped(className)) {
return element;
}
}
throw new AssertionError();
} } | public class class_name {
public StackTraceElement get(StackTraceElement[] stackTraceElements) {
Preconditions.checkNotNull(stackTraceElements, "The stack trace elements cannot be null.");
for (final StackTraceElement element : stackTraceElements) {
String className = element.getClassName();
if (!shouldBeSkipped(className)) {
return element; // depends on control dependency: [if], data = [none]
}
}
throw new AssertionError();
} } |
public class class_name {
private void onConnectionClosed()
{
ConnectionEvent evt = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
for (ConnectionEventListener listener : listeners)
{
try
{
listener.connectionClosed(evt);
}
catch (Exception e1)
{
LOG.warn("An error occurs while notifying the listener " + listener, e1);
}
}
} } | public class class_name {
private void onConnectionClosed()
{
ConnectionEvent evt = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
for (ConnectionEventListener listener : listeners)
{
try
{
listener.connectionClosed(evt); // depends on control dependency: [try], data = [none]
}
catch (Exception e1)
{
LOG.warn("An error occurs while notifying the listener " + listener, e1);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public Dataset createDataset(String datasetName) {
// [START bigquery_create_dataset]
Dataset dataset = null;
DatasetInfo datasetInfo = DatasetInfo.newBuilder(datasetName).build();
try {
// the dataset was created
dataset = bigquery.create(datasetInfo);
} catch (BigQueryException e) {
// the dataset was not created
}
// [END bigquery_create_dataset]
return dataset;
} } | public class class_name {
public Dataset createDataset(String datasetName) {
// [START bigquery_create_dataset]
Dataset dataset = null;
DatasetInfo datasetInfo = DatasetInfo.newBuilder(datasetName).build();
try {
// the dataset was created
dataset = bigquery.create(datasetInfo); // depends on control dependency: [try], data = [none]
} catch (BigQueryException e) {
// the dataset was not created
} // depends on control dependency: [catch], data = [none]
// [END bigquery_create_dataset]
return dataset;
} } |
public class class_name {
private String readNotationEntry(char c, PrefixedName attrName, Location refLoc)
throws XMLStreamException
{
String id = readDTDName(c);
/* Need to check whether we have a reference to a "pre-defined"
* notation: pre-defined here means that it was defined in the
* internal subset (prior to this parsing which then would external
* subset). This is needed to know if the subset can be cached or
* not.
*/
if (mPredefdNotations != null) {
NotationDeclaration decl = mPredefdNotations.get(id);
if (decl != null) {
mUsesPredefdNotations = true;
return decl.getName();
}
}
NotationDeclaration decl = (mNotations == null) ? null :mNotations.get(id);
if (decl == null) {
// In validating mode, this may be a problem (otherwise not)
if (mCfgFullyValidating) {
if (mNotationForwardRefs == null) {
mNotationForwardRefs = new LinkedHashMap<String,Location>();
}
mNotationForwardRefs.put(id, refLoc);
}
return id;
}
return decl.getName();
} } | public class class_name {
private String readNotationEntry(char c, PrefixedName attrName, Location refLoc)
throws XMLStreamException
{
String id = readDTDName(c);
/* Need to check whether we have a reference to a "pre-defined"
* notation: pre-defined here means that it was defined in the
* internal subset (prior to this parsing which then would external
* subset). This is needed to know if the subset can be cached or
* not.
*/
if (mPredefdNotations != null) {
NotationDeclaration decl = mPredefdNotations.get(id);
if (decl != null) {
mUsesPredefdNotations = true;
return decl.getName();
}
}
NotationDeclaration decl = (mNotations == null) ? null :mNotations.get(id);
if (decl == null) {
// In validating mode, this may be a problem (otherwise not)
if (mCfgFullyValidating) {
if (mNotationForwardRefs == null) {
mNotationForwardRefs = new LinkedHashMap<String,Location>(); // depends on control dependency: [if], data = [none]
}
mNotationForwardRefs.put(id, refLoc);
}
return id;
}
return decl.getName();
} } |
public class class_name {
@Trivial
@Override
public String getJandexIndexPath() {
String jandexIndexPath = super.getJandexIndexPath();
Container useContainer = getContainer();
if ( !useContainer.isRoot() && useContainer.getPath().equals("/WEB-INF/classes") ) {
jandexIndexPath = "../.." + jandexIndexPath;
}
return jandexIndexPath;
} } | public class class_name {
@Trivial
@Override
public String getJandexIndexPath() {
String jandexIndexPath = super.getJandexIndexPath();
Container useContainer = getContainer();
if ( !useContainer.isRoot() && useContainer.getPath().equals("/WEB-INF/classes") ) {
jandexIndexPath = "../.." + jandexIndexPath; // depends on control dependency: [if], data = [none]
}
return jandexIndexPath;
} } |
public class class_name {
public static int estimatedSizeOf(Collection<QueryableEntry> result) {
if (result instanceof AndResultSet) {
return ((AndResultSet) result).estimatedSize();
} else if (result instanceof OrResultSet) {
return ((OrResultSet) result).estimatedSize();
}
return result.size();
} } | public class class_name {
public static int estimatedSizeOf(Collection<QueryableEntry> result) {
if (result instanceof AndResultSet) {
return ((AndResultSet) result).estimatedSize(); // depends on control dependency: [if], data = [none]
} else if (result instanceof OrResultSet) {
return ((OrResultSet) result).estimatedSize(); // depends on control dependency: [if], data = [none]
}
return result.size();
} } |
public class class_name {
static Polygon fromLngLats(@NonNull double[][][] coordinates) {
List<List<Point>> converted = new ArrayList<>(coordinates.length);
for (double[][] coordinate : coordinates) {
List<Point> innerList = new ArrayList<>(coordinate.length);
for (double[] pointCoordinate : coordinate) {
innerList.add(Point.fromLngLat(pointCoordinate));
}
converted.add(innerList);
}
return new Polygon(TYPE, null, converted);
} } | public class class_name {
static Polygon fromLngLats(@NonNull double[][][] coordinates) {
List<List<Point>> converted = new ArrayList<>(coordinates.length);
for (double[][] coordinate : coordinates) {
List<Point> innerList = new ArrayList<>(coordinate.length);
for (double[] pointCoordinate : coordinate) {
innerList.add(Point.fromLngLat(pointCoordinate)); // depends on control dependency: [for], data = [pointCoordinate]
}
converted.add(innerList); // depends on control dependency: [for], data = [none]
}
return new Polygon(TYPE, null, converted);
} } |
public class class_name {
@Nullable
private static String _getFieldName (@Nullable final String sContentDisposition)
{
String sFieldName = null;
if (sContentDisposition != null && sContentDisposition.toLowerCase (Locale.US).startsWith (RequestHelper.FORM_DATA))
{
// Parameter parser can handle null input
final ICommonsMap <String, String> aParams = new ParameterParser ().setLowerCaseNames (true)
.parse (sContentDisposition, ';');
sFieldName = aParams.get ("name");
if (sFieldName != null)
sFieldName = sFieldName.trim ();
}
return sFieldName;
} } | public class class_name {
@Nullable
private static String _getFieldName (@Nullable final String sContentDisposition)
{
String sFieldName = null;
if (sContentDisposition != null && sContentDisposition.toLowerCase (Locale.US).startsWith (RequestHelper.FORM_DATA))
{
// Parameter parser can handle null input
final ICommonsMap <String, String> aParams = new ParameterParser ().setLowerCaseNames (true)
.parse (sContentDisposition, ';');
sFieldName = aParams.get ("name"); // depends on control dependency: [if], data = [none]
if (sFieldName != null)
sFieldName = sFieldName.trim ();
}
return sFieldName;
} } |
public class class_name {
public boolean containsAll(Iterable<? extends C> values) {
if (Iterables.isEmpty(values)) {
return true;
}
// this optimizes testing equality of two range-backed sets
if (values instanceof SortedSet) {
SortedSet<? extends C> set = cast(values);
Comparator<?> comparator = set.comparator();
if (Ordering.natural().equals(comparator) || comparator == null) {
return contains(set.first()) && contains(set.last());
}
}
for (C value : values) {
if (!contains(value)) {
return false;
}
}
return true;
} } | public class class_name {
public boolean containsAll(Iterable<? extends C> values) {
if (Iterables.isEmpty(values)) {
return true; // depends on control dependency: [if], data = [none]
}
// this optimizes testing equality of two range-backed sets
if (values instanceof SortedSet) {
SortedSet<? extends C> set = cast(values); // depends on control dependency: [if], data = [none]
Comparator<?> comparator = set.comparator();
if (Ordering.natural().equals(comparator) || comparator == null) {
return contains(set.first()) && contains(set.last()); // depends on control dependency: [if], data = [none]
}
}
for (C value : values) {
if (!contains(value)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
@Override
protected void fireError(int type, String propName, Object propValue, Throwable ex)
{
if (errorListeners == null || errorListeners.size() == 0) {
return;
}
ConfigurationErrorEvent event = createErrorEvent(type, propName, propValue, ex);
for (ConfigurationErrorListener l: errorListeners) {
try {
l.configurationError(event);
} catch (Throwable e) {
logger.error("Error firing configuration error event", e);
}
}
} } | public class class_name {
@Override
protected void fireError(int type, String propName, Object propValue, Throwable ex)
{
if (errorListeners == null || errorListeners.size() == 0) {
return; // depends on control dependency: [if], data = [none]
}
ConfigurationErrorEvent event = createErrorEvent(type, propName, propValue, ex);
for (ConfigurationErrorListener l: errorListeners) {
try {
l.configurationError(event); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
logger.error("Error firing configuration error event", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Override
public Resource resourceOfId(ResourceId id) {
lock.readLock().lock();
try {
return resources.get(id);
} finally {
lock.readLock().unlock();
}
} } | public class class_name {
@Override
public Resource resourceOfId(ResourceId id) {
lock.readLock().lock();
try {
return resources.get(id); // depends on control dependency: [try], data = [none]
} finally {
lock.readLock().unlock();
}
} } |
public class class_name {
public RRset []
getSectionRRsets(int section) {
if (sections[section] == null)
return emptyRRsetArray;
List sets = new LinkedList();
Record [] recs = getSectionArray(section);
Set hash = new HashSet();
for (int i = 0; i < recs.length; i++) {
Name name = recs[i].getName();
boolean newset = true;
if (hash.contains(name)) {
for (int j = sets.size() - 1; j >= 0; j--) {
RRset set = (RRset) sets.get(j);
if (set.getType() == recs[i].getRRsetType() &&
set.getDClass() == recs[i].getDClass() &&
set.getName().equals(name))
{
set.addRR(recs[i]);
newset = false;
break;
}
}
}
if (newset) {
RRset set = new RRset(recs[i]);
sets.add(set);
hash.add(name);
}
}
return (RRset []) sets.toArray(new RRset[sets.size()]);
} } | public class class_name {
public RRset []
getSectionRRsets(int section) {
if (sections[section] == null)
return emptyRRsetArray;
List sets = new LinkedList();
Record [] recs = getSectionArray(section);
Set hash = new HashSet();
for (int i = 0; i < recs.length; i++) {
Name name = recs[i].getName();
boolean newset = true;
if (hash.contains(name)) {
for (int j = sets.size() - 1; j >= 0; j--) {
RRset set = (RRset) sets.get(j);
if (set.getType() == recs[i].getRRsetType() &&
set.getDClass() == recs[i].getDClass() &&
set.getName().equals(name))
{
set.addRR(recs[i]); // depends on control dependency: [if], data = [none]
newset = false; // depends on control dependency: [if], data = [none]
break;
}
}
}
if (newset) {
RRset set = new RRset(recs[i]);
sets.add(set); // depends on control dependency: [if], data = [none]
hash.add(name); // depends on control dependency: [if], data = [none]
}
}
return (RRset []) sets.toArray(new RRset[sets.size()]);
} } |
public class class_name {
public void addComponents(final Model<UIHeading> _headingmodel)
{
final WebMarkupContainer container = new WebMarkupContainer("container");
this.add(container);
if (_headingmodel.getObject().getLevel() == 0) {
container.add(AttributeModifier.replace("class", "eFapsFrameTitle"));
} else {
container.add(AttributeModifier.replace("class", "eFapsHeading" + _headingmodel.getObject().getLevel()));
}
container.add(new Label("heading", _headingmodel.getObject().getLabel()));
final String toggleId = this.getMarkupId(true);
final Component span = new WebComponent("toggle") {
private static final long serialVersionUID = 1L;
@Override
protected void onComponentTag(final ComponentTag _tag)
{
super.onComponentTag(_tag);
_tag.put("onclick", "toggleSection('" + toggleId + "');");
}
@Override
public boolean isVisible()
{
return _headingmodel.getObject().getLevel() > 0 && _headingmodel.getObject().isCollapsible();
}
};
container.add(span);
final Component status = new WebComponent("status") {
private static final long serialVersionUID = 1L;
@Override
protected void onComponentTag(final ComponentTag _tag)
{
super.onComponentTag(_tag);
_tag.put("name", _headingmodel.getObject().getName());
_tag.put("value", false);
}
@Override
public boolean isVisible()
{
return _headingmodel.getObject().getLevel() > 0 && _headingmodel.getObject().isCollapsible();
}
};
status.setMarkupId("status_" + toggleId);
container.add(status);
} } | public class class_name {
public void addComponents(final Model<UIHeading> _headingmodel)
{
final WebMarkupContainer container = new WebMarkupContainer("container");
this.add(container);
if (_headingmodel.getObject().getLevel() == 0) {
container.add(AttributeModifier.replace("class", "eFapsFrameTitle")); // depends on control dependency: [if], data = [none]
} else {
container.add(AttributeModifier.replace("class", "eFapsHeading" + _headingmodel.getObject().getLevel())); // depends on control dependency: [if], data = [none]
}
container.add(new Label("heading", _headingmodel.getObject().getLabel()));
final String toggleId = this.getMarkupId(true);
final Component span = new WebComponent("toggle") {
private static final long serialVersionUID = 1L;
@Override
protected void onComponentTag(final ComponentTag _tag)
{
super.onComponentTag(_tag);
_tag.put("onclick", "toggleSection('" + toggleId + "');");
}
@Override
public boolean isVisible()
{
return _headingmodel.getObject().getLevel() > 0 && _headingmodel.getObject().isCollapsible();
}
};
container.add(span);
final Component status = new WebComponent("status") {
private static final long serialVersionUID = 1L;
@Override
protected void onComponentTag(final ComponentTag _tag)
{
super.onComponentTag(_tag);
_tag.put("name", _headingmodel.getObject().getName());
_tag.put("value", false);
}
@Override
public boolean isVisible()
{
return _headingmodel.getObject().getLevel() > 0 && _headingmodel.getObject().isCollapsible();
}
};
status.setMarkupId("status_" + toggleId);
container.add(status);
} } |
public class class_name {
public void clazz(String expectedClass, double seconds) {
double end = System.currentTimeMillis() + (seconds * 1000);
try {
elementPresent(seconds);
while (!(expectedClass == null ? element.get().attribute(CLASS) == null : expectedClass.equals(element.get().attribute(CLASS))) && System.currentTimeMillis() < end) ;
double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
checkClazz(expectedClass, seconds, timeTook);
} catch (TimeoutException e) {
checkClazz(expectedClass, seconds, seconds);
}
} } | public class class_name {
public void clazz(String expectedClass, double seconds) {
double end = System.currentTimeMillis() + (seconds * 1000);
try {
elementPresent(seconds); // depends on control dependency: [try], data = [none]
while (!(expectedClass == null ? element.get().attribute(CLASS) == null : expectedClass.equals(element.get().attribute(CLASS))) && System.currentTimeMillis() < end) ;
double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
checkClazz(expectedClass, seconds, timeTook); // depends on control dependency: [try], data = [none]
} catch (TimeoutException e) {
checkClazz(expectedClass, seconds, seconds);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean isAssignableFrom(ClassNode superClass, ClassNode childClass) {
ClassNode currentSuper = childClass;
while (currentSuper != null) {
if (currentSuper.equals(superClass)) {
return true;
}
currentSuper = currentSuper.getSuperClass();
}
return false;
} } | public class class_name {
public static boolean isAssignableFrom(ClassNode superClass, ClassNode childClass) {
ClassNode currentSuper = childClass;
while (currentSuper != null) {
if (currentSuper.equals(superClass)) {
return true; // depends on control dependency: [if], data = [none]
}
currentSuper = currentSuper.getSuperClass(); // depends on control dependency: [while], data = [none]
}
return false;
} } |
public class class_name {
public boolean setFieldProperty(String field, String name, int value, int inst[]) {
if (writer == null)
throw new RuntimeException("This AcroFields instance is read-only.");
Item item = (Item)fields.get(field);
if (item == null)
return false;
InstHit hit = new InstHit(inst);
if (name.equalsIgnoreCase("flags")) {
PdfNumber num = new PdfNumber(value);
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
item.getMerged(k).put(PdfName.F, num);
item.getWidget(k).put(PdfName.F, num);
markUsed(item.getWidget(k));
}
}
}
else if (name.equalsIgnoreCase("setflags")) {
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
PdfNumber num = item.getWidget(k).getAsNumber(PdfName.F);
int val = 0;
if (num != null)
val = num.intValue();
num = new PdfNumber(val | value);
item.getMerged(k).put(PdfName.F, num);
item.getWidget(k).put(PdfName.F, num);
markUsed(item.getWidget(k));
}
}
}
else if (name.equalsIgnoreCase("clrflags")) {
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
PdfDictionary widget = item.getWidget( k );
PdfNumber num = widget.getAsNumber(PdfName.F);
int val = 0;
if (num != null)
val = num.intValue();
num = new PdfNumber(val & (~value));
item.getMerged(k).put(PdfName.F, num);
widget.put(PdfName.F, num);
markUsed(widget);
}
}
}
else if (name.equalsIgnoreCase("fflags")) {
PdfNumber num = new PdfNumber(value);
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
item.getMerged(k).put(PdfName.FF, num);
item.getValue(k).put(PdfName.FF, num);
markUsed(item.getValue(k));
}
}
}
else if (name.equalsIgnoreCase("setfflags")) {
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
PdfDictionary valDict = item.getValue( k );
PdfNumber num = valDict.getAsNumber( PdfName.FF );
int val = 0;
if (num != null)
val = num.intValue();
num = new PdfNumber(val | value);
item.getMerged(k).put(PdfName.FF, num);
valDict.put(PdfName.FF, num);
markUsed(valDict);
}
}
}
else if (name.equalsIgnoreCase("clrfflags")) {
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
PdfDictionary valDict = item.getValue( k );
PdfNumber num = valDict.getAsNumber(PdfName.FF);
int val = 0;
if (num != null)
val = num.intValue();
num = new PdfNumber(val & (~value));
item.getMerged(k).put(PdfName.FF, num);
valDict.put(PdfName.FF, num);
markUsed(valDict);
}
}
}
else
return false;
return true;
} } | public class class_name {
public boolean setFieldProperty(String field, String name, int value, int inst[]) {
if (writer == null)
throw new RuntimeException("This AcroFields instance is read-only.");
Item item = (Item)fields.get(field);
if (item == null)
return false;
InstHit hit = new InstHit(inst);
if (name.equalsIgnoreCase("flags")) {
PdfNumber num = new PdfNumber(value);
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
item.getMerged(k).put(PdfName.F, num); // depends on control dependency: [if], data = [none]
item.getWidget(k).put(PdfName.F, num); // depends on control dependency: [if], data = [none]
markUsed(item.getWidget(k)); // depends on control dependency: [if], data = [none]
}
}
}
else if (name.equalsIgnoreCase("setflags")) {
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
PdfNumber num = item.getWidget(k).getAsNumber(PdfName.F);
int val = 0;
if (num != null)
val = num.intValue();
num = new PdfNumber(val | value); // depends on control dependency: [if], data = [none]
item.getMerged(k).put(PdfName.F, num); // depends on control dependency: [if], data = [none]
item.getWidget(k).put(PdfName.F, num); // depends on control dependency: [if], data = [none]
markUsed(item.getWidget(k)); // depends on control dependency: [if], data = [none]
}
}
}
else if (name.equalsIgnoreCase("clrflags")) {
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
PdfDictionary widget = item.getWidget( k );
PdfNumber num = widget.getAsNumber(PdfName.F);
int val = 0;
if (num != null)
val = num.intValue();
num = new PdfNumber(val & (~value)); // depends on control dependency: [if], data = [none]
item.getMerged(k).put(PdfName.F, num); // depends on control dependency: [if], data = [none]
widget.put(PdfName.F, num); // depends on control dependency: [if], data = [none]
markUsed(widget); // depends on control dependency: [if], data = [none]
}
}
}
else if (name.equalsIgnoreCase("fflags")) {
PdfNumber num = new PdfNumber(value);
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
item.getMerged(k).put(PdfName.FF, num); // depends on control dependency: [if], data = [none]
item.getValue(k).put(PdfName.FF, num); // depends on control dependency: [if], data = [none]
markUsed(item.getValue(k)); // depends on control dependency: [if], data = [none]
}
}
}
else if (name.equalsIgnoreCase("setfflags")) {
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
PdfDictionary valDict = item.getValue( k );
PdfNumber num = valDict.getAsNumber( PdfName.FF );
int val = 0;
if (num != null)
val = num.intValue();
num = new PdfNumber(val | value); // depends on control dependency: [if], data = [none]
item.getMerged(k).put(PdfName.FF, num); // depends on control dependency: [if], data = [none]
valDict.put(PdfName.FF, num); // depends on control dependency: [if], data = [none]
markUsed(valDict); // depends on control dependency: [if], data = [none]
}
}
}
else if (name.equalsIgnoreCase("clrfflags")) {
for (int k = 0; k < item.size(); ++k) {
if (hit.isHit(k)) {
PdfDictionary valDict = item.getValue( k );
PdfNumber num = valDict.getAsNumber(PdfName.FF);
int val = 0;
if (num != null)
val = num.intValue();
num = new PdfNumber(val & (~value)); // depends on control dependency: [if], data = [none]
item.getMerged(k).put(PdfName.FF, num); // depends on control dependency: [if], data = [none]
valDict.put(PdfName.FF, num); // depends on control dependency: [if], data = [none]
markUsed(valDict); // depends on control dependency: [if], data = [none]
}
}
}
else
return false;
return true;
} } |
public class class_name {
public void propagateActions( InternalWorkingMemory workingMemory ) {
final PropagationQueueingNodeMemory memory = workingMemory.getNodeMemory( this );
// first we clear up the action queued flag
memory.isQueued().compareAndSet( true,
false );
// we limit the propagation to avoid a hang when this queue is never empty
Action next;
for ( int counter = 0; counter < PROPAGATION_SLICE_LIMIT; counter++ ) {
next = memory.getNextAction();
if ( next != null ) {
next.execute( this.sink,
workingMemory );
} else {
break;
}
}
if ( memory.hasNextAction() && memory.isQueued().compareAndSet( false,
true ) ) {
// add action to the queue again.
workingMemory.queueWorkingMemoryAction( this.action );
}
} } | public class class_name {
public void propagateActions( InternalWorkingMemory workingMemory ) {
final PropagationQueueingNodeMemory memory = workingMemory.getNodeMemory( this );
// first we clear up the action queued flag
memory.isQueued().compareAndSet( true,
false );
// we limit the propagation to avoid a hang when this queue is never empty
Action next;
for ( int counter = 0; counter < PROPAGATION_SLICE_LIMIT; counter++ ) {
next = memory.getNextAction(); // depends on control dependency: [for], data = [none]
if ( next != null ) {
next.execute( this.sink,
workingMemory ); // depends on control dependency: [if], data = [none]
} else {
break;
}
}
if ( memory.hasNextAction() && memory.isQueued().compareAndSet( false,
true ) ) {
// add action to the queue again.
workingMemory.queueWorkingMemoryAction( this.action ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void put(final K key, final V value) {
incrementReportEntity(this.putCount);
final CacheEntry<V> entry = new CacheEntry<V>(value, this.useSoftReferences);
// newSize will be -1 if traceExecution is false
final int newSize = this.dataContainer.put(key, entry);
if (this.traceExecution) {
this.logger.trace(
"[THYMELEAF][{}][{}][CACHE_ADD][{}] Adding cache entry in cache \"{}\" for key \"{}\". New size is {}.",
new Object[] {TemplateEngine.threadIndex(), this.name, Integer.valueOf(newSize), this.name, key, Integer.valueOf(newSize)});
outputReportIfNeeded();
}
} } | public class class_name {
public void put(final K key, final V value) {
incrementReportEntity(this.putCount);
final CacheEntry<V> entry = new CacheEntry<V>(value, this.useSoftReferences);
// newSize will be -1 if traceExecution is false
final int newSize = this.dataContainer.put(key, entry);
if (this.traceExecution) {
this.logger.trace(
"[THYMELEAF][{}][{}][CACHE_ADD][{}] Adding cache entry in cache \"{}\" for key \"{}\". New size is {}.",
new Object[] {TemplateEngine.threadIndex(), this.name, Integer.valueOf(newSize), this.name, key, Integer.valueOf(newSize)}); // depends on control dependency: [if], data = [none]
outputReportIfNeeded(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public Set<Entry<K, V>> entrySet() {
processQueue();
Set<Entry<K, V>> result = new LinkedHashSet<Entry<K, V>>();
for (final Entry<K, SoftValue<V>> entry : map.entrySet()) {
final V value = entry.getValue().get();
if (value != null) {
result.add(new Entry<K, V>() {
@Override
public K getKey() {
return entry.getKey();
}
@Override
public V getValue() {
return value;
}
@Override
public V setValue(V v) {
entry.setValue(new SoftValue<V>(v, entry.getKey(), queue));
return value;
}
});
}
}
return result;
} } | public class class_name {
@Override
public Set<Entry<K, V>> entrySet() {
processQueue();
Set<Entry<K, V>> result = new LinkedHashSet<Entry<K, V>>();
for (final Entry<K, SoftValue<V>> entry : map.entrySet()) {
final V value = entry.getValue().get();
if (value != null) {
result.add(new Entry<K, V>() {
@Override
public K getKey() {
return entry.getKey();
}
@Override
public V getValue() {
return value;
}
@Override
public V setValue(V v) {
entry.setValue(new SoftValue<V>(v, entry.getKey(), queue));
return value;
}
}); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public static void reply(AutoReply reply) {
if(FbBotApi.botDefinition == null) {
botDefinition = new FbBotApiBot();
}
((FbBot)FbBotApi.botDefinition).reply(reply);
} } | public class class_name {
public static void reply(AutoReply reply) {
if(FbBotApi.botDefinition == null) {
botDefinition = new FbBotApiBot(); // depends on control dependency: [if], data = [none]
}
((FbBot)FbBotApi.botDefinition).reply(reply);
} } |
public class class_name {
private String createServiceCredentials(AuthleteConfiguration configuration)
{
if (configuration.getServiceAccessToken() != null)
{
return "Bearer " + configuration.getServiceAccessToken();
}
else
{
String key = configuration.getServiceApiKey();
String secret = configuration.getServiceApiSecret();
return new BasicCredentials(key, secret).format();
}
} } | public class class_name {
private String createServiceCredentials(AuthleteConfiguration configuration)
{
if (configuration.getServiceAccessToken() != null)
{
return "Bearer " + configuration.getServiceAccessToken(); // depends on control dependency: [if], data = [none]
}
else
{
String key = configuration.getServiceApiKey();
String secret = configuration.getServiceApiSecret();
return new BasicCredentials(key, secret).format(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public MimeType getMimeTypeForExtension(String extension) {
if (extension == null) {
return null;
}
return extensionToMimeMap.get(extension);
} } | public class class_name {
public MimeType getMimeTypeForExtension(String extension) {
if (extension == null) {
return null; // depends on control dependency: [if], data = [none]
}
return extensionToMimeMap.get(extension);
} } |
public class class_name {
private Collection<String> deleteUntrackedLocalBranches(
Collection<TrackingRefUpdate> trackingRefUpdates, Git git) {
if (CollectionUtils.isEmpty(trackingRefUpdates)) {
return Collections.emptyList();
}
Collection<String> branchesToDelete = new ArrayList<>();
for (TrackingRefUpdate trackingRefUpdate : trackingRefUpdates) {
ReceiveCommand receiveCommand = trackingRefUpdate.asReceiveCommand();
if (receiveCommand.getType() == DELETE) {
String localRefName = trackingRefUpdate.getLocalName();
if (StringUtils.startsWithIgnoreCase(localRefName,
LOCAL_BRANCH_REF_PREFIX)) {
String localBranchName = localRefName.substring(
LOCAL_BRANCH_REF_PREFIX.length(), localRefName.length());
branchesToDelete.add(localBranchName);
}
}
}
if (CollectionUtils.isEmpty(branchesToDelete)) {
return Collections.emptyList();
}
try {
// make sure that deleted branch not a current one
checkout(git, this.defaultLabel);
return deleteBranches(git, branchesToDelete);
}
catch (Exception ex) {
String message = format("Failed to delete %s branches.", branchesToDelete);
warn(message, ex);
return Collections.emptyList();
}
} } | public class class_name {
private Collection<String> deleteUntrackedLocalBranches(
Collection<TrackingRefUpdate> trackingRefUpdates, Git git) {
if (CollectionUtils.isEmpty(trackingRefUpdates)) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
Collection<String> branchesToDelete = new ArrayList<>();
for (TrackingRefUpdate trackingRefUpdate : trackingRefUpdates) {
ReceiveCommand receiveCommand = trackingRefUpdate.asReceiveCommand();
if (receiveCommand.getType() == DELETE) {
String localRefName = trackingRefUpdate.getLocalName();
if (StringUtils.startsWithIgnoreCase(localRefName,
LOCAL_BRANCH_REF_PREFIX)) {
String localBranchName = localRefName.substring(
LOCAL_BRANCH_REF_PREFIX.length(), localRefName.length());
branchesToDelete.add(localBranchName); // depends on control dependency: [if], data = [none]
}
}
}
if (CollectionUtils.isEmpty(branchesToDelete)) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
try {
// make sure that deleted branch not a current one
checkout(git, this.defaultLabel); // depends on control dependency: [try], data = [none]
return deleteBranches(git, branchesToDelete); // depends on control dependency: [try], data = [none]
}
catch (Exception ex) {
String message = format("Failed to delete %s branches.", branchesToDelete);
warn(message, ex);
return Collections.emptyList();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static CmsJspContentAccessValueWrapper createWrapper(
CmsObject cms,
I_CmsXmlContentValue value,
I_CmsXmlContentValue parentValue,
String valueName) {
if ((value != null) && (cms != null)) {
return new CmsJspContentAccessValueWrapper(cms, value);
}
if ((parentValue != null) && (valueName != null) && (cms != null)) {
CmsJspContentAccessValueWrapper wrapper = new CmsJspContentAccessValueWrapper();
wrapper.m_nullValueInfo = new NullValueInfo(parentValue, valueName);
wrapper.m_cms = cms;
return wrapper;
}
// if no value is available,
return NULL_VALUE_WRAPPER;
} } | public class class_name {
public static CmsJspContentAccessValueWrapper createWrapper(
CmsObject cms,
I_CmsXmlContentValue value,
I_CmsXmlContentValue parentValue,
String valueName) {
if ((value != null) && (cms != null)) {
return new CmsJspContentAccessValueWrapper(cms, value); // depends on control dependency: [if], data = [none]
}
if ((parentValue != null) && (valueName != null) && (cms != null)) {
CmsJspContentAccessValueWrapper wrapper = new CmsJspContentAccessValueWrapper();
wrapper.m_nullValueInfo = new NullValueInfo(parentValue, valueName); // depends on control dependency: [if], data = [none]
wrapper.m_cms = cms; // depends on control dependency: [if], data = [none]
return wrapper; // depends on control dependency: [if], data = [none]
}
// if no value is available,
return NULL_VALUE_WRAPPER;
} } |
public class class_name {
boolean handleEndOfSegment(Segment segmentCompleted) throws ReaderNotInReaderGroupException {
final Map<Segment, List<Long>> segmentToPredecessor;
if (sync.getState().getEndSegments().containsKey(segmentCompleted)) {
segmentToPredecessor = Collections.emptyMap();
} else {
val successors = getAndHandleExceptions(controller.getSuccessors(segmentCompleted), RuntimeException::new);
segmentToPredecessor = successors.getSegmentToPredecessor();
}
AtomicBoolean reinitRequired = new AtomicBoolean(false);
boolean result = sync.updateState((state, updates) -> {
if (!state.isReaderOnline(readerId)) {
reinitRequired.set(true);
} else {
log.debug("Marking segment {} as completed in reader group. CurrentState is: {}", segmentCompleted, state);
reinitRequired.set(false);
//This check guards against another checkpoint having started.
if (state.getCheckpointForReader(readerId) == null) {
updates.add(new SegmentCompleted(readerId, segmentCompleted, segmentToPredecessor));
return true;
}
}
return false;
});
if (reinitRequired.get()) {
throw new ReaderNotInReaderGroupException(readerId);
}
acquireTimer.zero();
return result;
} } | public class class_name {
boolean handleEndOfSegment(Segment segmentCompleted) throws ReaderNotInReaderGroupException {
final Map<Segment, List<Long>> segmentToPredecessor;
if (sync.getState().getEndSegments().containsKey(segmentCompleted)) {
segmentToPredecessor = Collections.emptyMap();
} else {
val successors = getAndHandleExceptions(controller.getSuccessors(segmentCompleted), RuntimeException::new);
segmentToPredecessor = successors.getSegmentToPredecessor();
}
AtomicBoolean reinitRequired = new AtomicBoolean(false);
boolean result = sync.updateState((state, updates) -> {
if (!state.isReaderOnline(readerId)) {
reinitRequired.set(true);
} else {
log.debug("Marking segment {} as completed in reader group. CurrentState is: {}", segmentCompleted, state);
reinitRequired.set(false);
//This check guards against another checkpoint having started.
if (state.getCheckpointForReader(readerId) == null) {
updates.add(new SegmentCompleted(readerId, segmentCompleted, segmentToPredecessor)); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
});
if (reinitRequired.get()) {
throw new ReaderNotInReaderGroupException(readerId);
}
acquireTimer.zero();
return result;
} } |
public class class_name {
private void readSingleDataFile(Task task, DdlUtilsDataHandling handling, File dataFile)
{
if (!dataFile.exists())
{
task.log("Could not find data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
}
else if (!dataFile.isFile())
{
task.log("Path "+dataFile.getAbsolutePath()+" does not denote a data file", Project.MSG_ERR);
}
else if (!dataFile.canRead())
{
task.log("Could not read data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
}
else
{
int batchSize = 1;
if ((_useBatchMode != null) && _useBatchMode.booleanValue())
{
if (_batchSize != null)
{
batchSize = _batchSize.intValue();
}
}
try
{
handling.insertData(new FileReader(dataFile), batchSize);
task.log("Read data file "+dataFile.getAbsolutePath(), Project.MSG_INFO);
}
catch (Exception ex)
{
if (isFailOnError())
{
throw new BuildException("Could not read data file "+dataFile.getAbsolutePath(), ex);
}
else
{
task.log("Could not read data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
}
}
}
} } | public class class_name {
private void readSingleDataFile(Task task, DdlUtilsDataHandling handling, File dataFile)
{
if (!dataFile.exists())
{
task.log("Could not find data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
// depends on control dependency: [if], data = [none]
}
else if (!dataFile.isFile())
{
task.log("Path "+dataFile.getAbsolutePath()+" does not denote a data file", Project.MSG_ERR);
// depends on control dependency: [if], data = [none]
}
else if (!dataFile.canRead())
{
task.log("Could not read data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
// depends on control dependency: [if], data = [none]
}
else
{
int batchSize = 1;
if ((_useBatchMode != null) && _useBatchMode.booleanValue())
{
if (_batchSize != null)
{
batchSize = _batchSize.intValue();
// depends on control dependency: [if], data = [none]
}
}
try
{
handling.insertData(new FileReader(dataFile), batchSize);
// depends on control dependency: [try], data = [none]
task.log("Read data file "+dataFile.getAbsolutePath(), Project.MSG_INFO);
// depends on control dependency: [try], data = [none]
}
catch (Exception ex)
{
if (isFailOnError())
{
throw new BuildException("Could not read data file "+dataFile.getAbsolutePath(), ex);
}
else
{
task.log("Could not read data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
// depends on control dependency: [if], data = [none]
}
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Override
public EClass getIfcRelAggregates() {
if (ifcRelAggregatesEClass == null) {
ifcRelAggregatesEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(517);
}
return ifcRelAggregatesEClass;
} } | public class class_name {
@Override
public EClass getIfcRelAggregates() {
if (ifcRelAggregatesEClass == null) {
ifcRelAggregatesEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(517);
// depends on control dependency: [if], data = [none]
}
return ifcRelAggregatesEClass;
} } |
public class class_name {
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
if (cv != null) {
return cv.visitAnnotation(descriptor, visible);
}
return null;
} } | public class class_name {
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
if (cv != null) {
return cv.visitAnnotation(descriptor, visible); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
void sampleReceived(SolverAggregatorInterface aggregator,
SampleMessage sample) {
if (!this.sampleQueue.offer(sample) && this.warnBufferFull) {
log.warn("Unable to insert a sample due to a full buffer.");
}
} } | public class class_name {
void sampleReceived(SolverAggregatorInterface aggregator,
SampleMessage sample) {
if (!this.sampleQueue.offer(sample) && this.warnBufferFull) {
log.warn("Unable to insert a sample due to a full buffer."); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public boolean isValid(Object input) {
long epochMillisec;
try {
epochMillisec = Long.parseLong(input.toString());
} catch (NumberFormatException e) {
return false;
}
if (minValidTime != null && epochMillisec < minValidTime)
return false;
return !(maxValidTime != null && epochMillisec > maxValidTime);
} } | public class class_name {
@Override
public boolean isValid(Object input) {
long epochMillisec;
try {
epochMillisec = Long.parseLong(input.toString()); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
return false;
} // depends on control dependency: [catch], data = [none]
if (minValidTime != null && epochMillisec < minValidTime)
return false;
return !(maxValidTime != null && epochMillisec > maxValidTime);
} } |
public class class_name {
private void _release(TestSlot testSlot, SessionTerminationReason reason) {
if (!testSlot.startReleaseProcess()) {
return;
}
if (!testSlot.performAfterSessionEvent()) {
return;
}
final String internalKey = testSlot.getInternalKey();
try {
lock.lock();
testSlot.finishReleaseProcess();
release(internalKey, reason);
} finally {
lock.unlock();
}
} } | public class class_name {
private void _release(TestSlot testSlot, SessionTerminationReason reason) {
if (!testSlot.startReleaseProcess()) {
return; // depends on control dependency: [if], data = [none]
}
if (!testSlot.performAfterSessionEvent()) {
return; // depends on control dependency: [if], data = [none]
}
final String internalKey = testSlot.getInternalKey();
try {
lock.lock(); // depends on control dependency: [try], data = [none]
testSlot.finishReleaseProcess(); // depends on control dependency: [try], data = [none]
release(internalKey, reason); // depends on control dependency: [try], data = [none]
} finally {
lock.unlock();
}
} } |
public class class_name {
public static DefaultConnectionFactory newConnectionFactory(final AbstractLdapProperties l) {
final ConnectionConfig cc = newConnectionConfig(l);
final DefaultConnectionFactory bindCf = new DefaultConnectionFactory(cc);
if (l.getProviderClass() != null) {
try {
final Constructor<? extends Provider> constructor = CommonHelper.getConstructor(l.getProviderClass());
bindCf.setProvider(constructor.newInstance());
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
return bindCf;
} } | public class class_name {
public static DefaultConnectionFactory newConnectionFactory(final AbstractLdapProperties l) {
final ConnectionConfig cc = newConnectionConfig(l);
final DefaultConnectionFactory bindCf = new DefaultConnectionFactory(cc);
if (l.getProviderClass() != null) {
try {
final Constructor<? extends Provider> constructor = CommonHelper.getConstructor(l.getProviderClass());
bindCf.setProvider(constructor.newInstance()); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
return bindCf;
} } |
public class class_name {
private void depthFirstSearchReverse(X500Principal dN,
ReverseState currentState,
ReverseBuilder builder,
List<List<Vertex>> adjList,
LinkedList<X509Certificate> cpList)
throws GeneralSecurityException, IOException
{
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse(" + dN
+ ", " + currentState.toString() + ")");
/*
* Find all the certificates issued by dN which
* satisfy the PKIX certification path constraints.
*/
Collection<X509Certificate> certs =
builder.getMatchingCerts(currentState, buildParams.certStores());
List<Vertex> vertices = addVertices(certs, adjList);
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse(): "
+ "certs.size=" + vertices.size());
/*
* For each cert in the collection, verify anything
* that hasn't been checked yet (signature, revocation, etc)
* and check for loops. Call depthFirstSearchReverse()
* recursively for each good cert.
*/
for (Vertex vertex : vertices) {
/**
* Restore state to currentState each time through the loop.
* This is important because some of the user-defined
* checkers modify the state, which MUST be restored if
* the cert eventually fails to lead to the target and
* the next matching cert is tried.
*/
ReverseState nextState = (ReverseState) currentState.clone();
X509Certificate cert = vertex.getCertificate();
try {
builder.verifyCert(cert, nextState, cpList);
} catch (GeneralSecurityException gse) {
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse()"
+ ": validation failed: " + gse);
vertex.setThrowable(gse);
continue;
}
/*
* Certificate is good, add it to the path (if it isn't a
* self-signed cert) and update state
*/
if (!currentState.isInitial())
builder.addCertToPath(cert, cpList);
// save trust anchor
this.trustAnchor = currentState.trustAnchor;
/*
* Check if path is completed, return ASAP if so.
*/
if (builder.isPathCompleted(cert)) {
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse()"
+ ": path completed!");
pathCompleted = true;
PolicyNodeImpl rootNode = nextState.rootNode;
if (rootNode == null)
policyTreeResult = null;
else {
policyTreeResult = rootNode.copyTree();
((PolicyNodeImpl)policyTreeResult).setImmutable();
}
/*
* Extract and save the final target public key
*/
finalPublicKey = cert.getPublicKey();
if (PKIX.isDSAPublicKeyWithoutParams(finalPublicKey)) {
finalPublicKey =
BasicChecker.makeInheritedParamsKey
(finalPublicKey, currentState.pubKey);
}
return;
}
/* Update the PKIX state */
nextState.updateState(cert);
/*
* Append an entry for cert in adjacency list and
* set index for current vertex.
*/
adjList.add(new LinkedList<Vertex>());
vertex.setIndex(adjList.size() - 1);
/* recursively search for matching certs at next dN */
depthFirstSearchReverse(cert.getSubjectX500Principal(), nextState,
builder, adjList, cpList);
/*
* If path has been completed, return ASAP!
*/
if (pathCompleted) {
return;
} else {
/*
* If we get here, it means we have searched all possible
* certs issued by the dN w/o finding any matching certs. This
* means we have to backtrack to the previous cert in the path
* and try some other paths.
*/
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse()"
+ ": backtracking");
if (!currentState.isInitial())
builder.removeFinalCertFromPath(cpList);
}
}
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse() all "
+ "certs in this adjacency list checked");
} } | public class class_name {
private void depthFirstSearchReverse(X500Principal dN,
ReverseState currentState,
ReverseBuilder builder,
List<List<Vertex>> adjList,
LinkedList<X509Certificate> cpList)
throws GeneralSecurityException, IOException
{
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse(" + dN
+ ", " + currentState.toString() + ")");
/*
* Find all the certificates issued by dN which
* satisfy the PKIX certification path constraints.
*/
Collection<X509Certificate> certs =
builder.getMatchingCerts(currentState, buildParams.certStores());
List<Vertex> vertices = addVertices(certs, adjList);
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse(): "
+ "certs.size=" + vertices.size());
/*
* For each cert in the collection, verify anything
* that hasn't been checked yet (signature, revocation, etc)
* and check for loops. Call depthFirstSearchReverse()
* recursively for each good cert.
*/
for (Vertex vertex : vertices) {
/**
* Restore state to currentState each time through the loop.
* This is important because some of the user-defined
* checkers modify the state, which MUST be restored if
* the cert eventually fails to lead to the target and
* the next matching cert is tried.
*/
ReverseState nextState = (ReverseState) currentState.clone();
X509Certificate cert = vertex.getCertificate();
try {
builder.verifyCert(cert, nextState, cpList); // depends on control dependency: [try], data = [none]
} catch (GeneralSecurityException gse) {
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse()"
+ ": validation failed: " + gse);
vertex.setThrowable(gse);
continue;
} // depends on control dependency: [catch], data = [none]
/*
* Certificate is good, add it to the path (if it isn't a
* self-signed cert) and update state
*/
if (!currentState.isInitial())
builder.addCertToPath(cert, cpList);
// save trust anchor
this.trustAnchor = currentState.trustAnchor;
/*
* Check if path is completed, return ASAP if so.
*/
if (builder.isPathCompleted(cert)) {
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse()"
+ ": path completed!");
pathCompleted = true; // depends on control dependency: [if], data = [none]
PolicyNodeImpl rootNode = nextState.rootNode;
if (rootNode == null)
policyTreeResult = null;
else {
policyTreeResult = rootNode.copyTree(); // depends on control dependency: [if], data = [none]
((PolicyNodeImpl)policyTreeResult).setImmutable(); // depends on control dependency: [if], data = [none]
}
/*
* Extract and save the final target public key
*/
finalPublicKey = cert.getPublicKey(); // depends on control dependency: [if], data = [none]
if (PKIX.isDSAPublicKeyWithoutParams(finalPublicKey)) {
finalPublicKey =
BasicChecker.makeInheritedParamsKey
(finalPublicKey, currentState.pubKey); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
/* Update the PKIX state */
nextState.updateState(cert);
/*
* Append an entry for cert in adjacency list and
* set index for current vertex.
*/
adjList.add(new LinkedList<Vertex>());
vertex.setIndex(adjList.size() - 1);
/* recursively search for matching certs at next dN */
depthFirstSearchReverse(cert.getSubjectX500Principal(), nextState,
builder, adjList, cpList);
/*
* If path has been completed, return ASAP!
*/
if (pathCompleted) {
return; // depends on control dependency: [if], data = [none]
} else {
/*
* If we get here, it means we have searched all possible
* certs issued by the dN w/o finding any matching certs. This
* means we have to backtrack to the previous cert in the path
* and try some other paths.
*/
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse()"
+ ": backtracking");
if (!currentState.isInitial())
builder.removeFinalCertFromPath(cpList);
}
}
if (debug != null)
debug.println("SunCertPathBuilder.depthFirstSearchReverse() all "
+ "certs in this adjacency list checked");
} } |
public class class_name {
protected Object getAttribute(Token token) {
Object object = null;
if (activity.getProcessResult() != null) {
object = activity.getProcessResult().getResultValue(token.getName());
}
if (object == null && activity.getRequestAdapter() != null) {
object = activity.getRequestAdapter().getAttribute(token.getName());
}
if (object != null && token.getGetterName() != null) {
object = getBeanProperty(object, token.getGetterName());
}
return (object != null ? object : token.getDefaultValue());
} } | public class class_name {
protected Object getAttribute(Token token) {
Object object = null;
if (activity.getProcessResult() != null) {
object = activity.getProcessResult().getResultValue(token.getName()); // depends on control dependency: [if], data = [none]
}
if (object == null && activity.getRequestAdapter() != null) {
object = activity.getRequestAdapter().getAttribute(token.getName()); // depends on control dependency: [if], data = [none]
}
if (object != null && token.getGetterName() != null) {
object = getBeanProperty(object, token.getGetterName()); // depends on control dependency: [if], data = [(object]
}
return (object != null ? object : token.getDefaultValue());
} } |
public class class_name {
private void computeImplicitFrame(final Context context) {
String methodDescriptor = context.currentMethodDescriptor;
Object[] locals = context.currentFrameLocalTypes;
int numLocal = 0;
if ((context.currentMethodAccessFlags & Opcodes.ACC_STATIC) == 0) {
if ("<init>".equals(context.currentMethodName)) {
locals[numLocal++] = Opcodes.UNINITIALIZED_THIS;
} else {
locals[numLocal++] = readClass(header + 2, context.charBuffer);
}
}
// Parse the method descriptor, one argument type descriptor at each iteration. Start by
// skipping the first method descriptor character, which is always '('.
int currentMethodDescritorOffset = 1;
while (true) {
int currentArgumentDescriptorStartOffset = currentMethodDescritorOffset;
switch (methodDescriptor.charAt(currentMethodDescritorOffset++)) {
case 'Z':
case 'C':
case 'B':
case 'S':
case 'I':
locals[numLocal++] = Opcodes.INTEGER;
break;
case 'F':
locals[numLocal++] = Opcodes.FLOAT;
break;
case 'J':
locals[numLocal++] = Opcodes.LONG;
break;
case 'D':
locals[numLocal++] = Opcodes.DOUBLE;
break;
case '[':
while (methodDescriptor.charAt(currentMethodDescritorOffset) == '[') {
++currentMethodDescritorOffset;
}
if (methodDescriptor.charAt(currentMethodDescritorOffset) == 'L') {
++currentMethodDescritorOffset;
while (methodDescriptor.charAt(currentMethodDescritorOffset) != ';') {
++currentMethodDescritorOffset;
}
}
locals[numLocal++] =
methodDescriptor.substring(
currentArgumentDescriptorStartOffset, ++currentMethodDescritorOffset);
break;
case 'L':
while (methodDescriptor.charAt(currentMethodDescritorOffset) != ';') {
++currentMethodDescritorOffset;
}
locals[numLocal++] =
methodDescriptor.substring(
currentArgumentDescriptorStartOffset + 1, currentMethodDescritorOffset++);
break;
default:
context.currentFrameLocalCount = numLocal;
return;
}
}
} } | public class class_name {
private void computeImplicitFrame(final Context context) {
String methodDescriptor = context.currentMethodDescriptor;
Object[] locals = context.currentFrameLocalTypes;
int numLocal = 0;
if ((context.currentMethodAccessFlags & Opcodes.ACC_STATIC) == 0) {
if ("<init>".equals(context.currentMethodName)) {
locals[numLocal++] = Opcodes.UNINITIALIZED_THIS; // depends on control dependency: [if], data = [none]
} else {
locals[numLocal++] = readClass(header + 2, context.charBuffer); // depends on control dependency: [if], data = [none]
}
}
// Parse the method descriptor, one argument type descriptor at each iteration. Start by
// skipping the first method descriptor character, which is always '('.
int currentMethodDescritorOffset = 1;
while (true) {
int currentArgumentDescriptorStartOffset = currentMethodDescritorOffset;
switch (methodDescriptor.charAt(currentMethodDescritorOffset++)) {
case 'Z':
case 'C':
case 'B':
case 'S':
case 'I':
locals[numLocal++] = Opcodes.INTEGER;
break;
case 'F':
locals[numLocal++] = Opcodes.FLOAT;
break;
case 'J':
locals[numLocal++] = Opcodes.LONG;
break;
case 'D':
locals[numLocal++] = Opcodes.DOUBLE;
break;
case '[':
while (methodDescriptor.charAt(currentMethodDescritorOffset) == '[') {
++currentMethodDescritorOffset; // depends on control dependency: [while], data = [none]
}
if (methodDescriptor.charAt(currentMethodDescritorOffset) == 'L') {
++currentMethodDescritorOffset; // depends on control dependency: [if], data = [none]
while (methodDescriptor.charAt(currentMethodDescritorOffset) != ';') {
++currentMethodDescritorOffset; // depends on control dependency: [while], data = [none]
}
}
locals[numLocal++] =
methodDescriptor.substring(
currentArgumentDescriptorStartOffset, ++currentMethodDescritorOffset); // depends on control dependency: [while], data = [none]
break;
case 'L':
while (methodDescriptor.charAt(currentMethodDescritorOffset) != ';') {
++currentMethodDescritorOffset; // depends on control dependency: [while], data = [none]
}
locals[numLocal++] =
methodDescriptor.substring(
currentArgumentDescriptorStartOffset + 1, currentMethodDescritorOffset++); // depends on control dependency: [while], data = [none]
break;
default:
context.currentFrameLocalCount = numLocal;
return; // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
public final void setMaxPriority(int pri) {
int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot;
synchronized (this) {
checkAccess();
// Android-changed: Clamp to MIN_PRIORITY, MAX_PRIORITY.
// if (pri < Thread.MIN_PRIORITY || pri > Thread.MAX_PRIORITY) {
// return;
// }
if (pri < Thread.MIN_PRIORITY) {
pri = Thread.MIN_PRIORITY;
}
if (pri > Thread.MAX_PRIORITY) {
pri = Thread.MAX_PRIORITY;
}
maxPriority = (parent != null) ? Math.min(pri, parent.maxPriority) : pri;
ngroupsSnapshot = ngroups;
if (groups != null) {
groupsSnapshot = Arrays.copyOf(groups, ngroupsSnapshot);
} else {
groupsSnapshot = null;
}
}
for (int i = 0 ; i < ngroupsSnapshot ; i++) {
groupsSnapshot[i].setMaxPriority(pri);
}
} } | public class class_name {
public final void setMaxPriority(int pri) {
int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot;
synchronized (this) {
checkAccess();
// Android-changed: Clamp to MIN_PRIORITY, MAX_PRIORITY.
// if (pri < Thread.MIN_PRIORITY || pri > Thread.MAX_PRIORITY) {
// return;
// }
if (pri < Thread.MIN_PRIORITY) {
pri = Thread.MIN_PRIORITY; // depends on control dependency: [if], data = [none]
}
if (pri > Thread.MAX_PRIORITY) {
pri = Thread.MAX_PRIORITY; // depends on control dependency: [if], data = [none]
}
maxPriority = (parent != null) ? Math.min(pri, parent.maxPriority) : pri;
ngroupsSnapshot = ngroups;
if (groups != null) {
groupsSnapshot = Arrays.copyOf(groups, ngroupsSnapshot); // depends on control dependency: [if], data = [(groups]
} else {
groupsSnapshot = null; // depends on control dependency: [if], data = [none]
}
}
for (int i = 0 ; i < ngroupsSnapshot ; i++) {
groupsSnapshot[i].setMaxPriority(pri); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
@Override
public ProjectionRect getBoundingBox() {
if (mapArea == null) {
if ((horizXaxis == null) || !horizXaxis.isNumeric() || (horizYaxis == null) || !horizYaxis.isNumeric())
return null; // impossible
// x,y may be 2D
if (!(horizXaxis instanceof CoordinateAxis1D) || !(horizYaxis instanceof CoordinateAxis1D)) {
/* could try to optimize this - just get cord=ners or something
CoordinateAxis2D xaxis2 = (CoordinateAxis2D) horizXaxis;
CoordinateAxis2D yaxis2 = (CoordinateAxis2D) horizYaxis;
MAMath.MinMax
*/
mapArea = new ProjectionRect(horizXaxis.getMinValue(), horizYaxis.getMinValue(),
horizXaxis.getMaxValue(), horizYaxis.getMaxValue());
} else {
CoordinateAxis1D xaxis1 = (CoordinateAxis1D) horizXaxis;
CoordinateAxis1D yaxis1 = (CoordinateAxis1D) horizYaxis;
/* add one percent on each side if its a projection. WHY?
double dx = 0.0, dy = 0.0;
if (!isLatLon()) {
dx = .01 * (xaxis1.getCoordEdge((int) xaxis1.getSize()) - xaxis1.getCoordEdge(0));
dy = .01 * (yaxis1.getCoordEdge((int) yaxis1.getSize()) - yaxis1.getCoordEdge(0));
}
mapArea = new ProjectionRect(xaxis1.getCoordEdge(0) - dx, yaxis1.getCoordEdge(0) - dy,
xaxis1.getCoordEdge((int) xaxis1.getSize()) + dx,
yaxis1.getCoordEdge((int) yaxis1.getSize()) + dy); */
mapArea = new ProjectionRect(xaxis1.getCoordEdge(0), yaxis1.getCoordEdge(0),
xaxis1.getCoordEdge((int) xaxis1.getSize()),
yaxis1.getCoordEdge((int) yaxis1.getSize()));
}
}
return mapArea;
} } | public class class_name {
@Override
public ProjectionRect getBoundingBox() {
if (mapArea == null) {
if ((horizXaxis == null) || !horizXaxis.isNumeric() || (horizYaxis == null) || !horizYaxis.isNumeric())
return null; // impossible
// x,y may be 2D
if (!(horizXaxis instanceof CoordinateAxis1D) || !(horizYaxis instanceof CoordinateAxis1D)) {
/* could try to optimize this - just get cord=ners or something
CoordinateAxis2D xaxis2 = (CoordinateAxis2D) horizXaxis;
CoordinateAxis2D yaxis2 = (CoordinateAxis2D) horizYaxis;
MAMath.MinMax
*/
mapArea = new ProjectionRect(horizXaxis.getMinValue(), horizYaxis.getMinValue(),
horizXaxis.getMaxValue(), horizYaxis.getMaxValue());
// depends on control dependency: [if], data = [none]
} else {
CoordinateAxis1D xaxis1 = (CoordinateAxis1D) horizXaxis;
CoordinateAxis1D yaxis1 = (CoordinateAxis1D) horizYaxis;
/* add one percent on each side if its a projection. WHY?
double dx = 0.0, dy = 0.0;
if (!isLatLon()) {
dx = .01 * (xaxis1.getCoordEdge((int) xaxis1.getSize()) - xaxis1.getCoordEdge(0));
dy = .01 * (yaxis1.getCoordEdge((int) yaxis1.getSize()) - yaxis1.getCoordEdge(0));
}
mapArea = new ProjectionRect(xaxis1.getCoordEdge(0) - dx, yaxis1.getCoordEdge(0) - dy,
xaxis1.getCoordEdge((int) xaxis1.getSize()) + dx,
yaxis1.getCoordEdge((int) yaxis1.getSize()) + dy); */
mapArea = new ProjectionRect(xaxis1.getCoordEdge(0), yaxis1.getCoordEdge(0),
xaxis1.getCoordEdge((int) xaxis1.getSize()),
yaxis1.getCoordEdge((int) yaxis1.getSize()));
// depends on control dependency: [if], data = [none]
}
}
return mapArea;
} } |
public class class_name {
@Override
public EClass getIfcFurnishingElement() {
if (ifcFurnishingElementEClass == null) {
ifcFurnishingElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(296);
}
return ifcFurnishingElementEClass;
} } | public class class_name {
@Override
public EClass getIfcFurnishingElement() {
if (ifcFurnishingElementEClass == null) {
ifcFurnishingElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(296);
// depends on control dependency: [if], data = [none]
}
return ifcFurnishingElementEClass;
} } |
public class class_name {
private void labelIndicatorMouseEntered(MouseEvent e) {
// Skip this function if the settings have not been applied.
if (settings == null) {
return;
}
JLabel label = ((JLabel) e.getSource());
// Do not highlight the today label if today is vetoed.
if (label == labelSetDateToToday) {
DateVetoPolicy vetoPolicy = settings.getVetoPolicy();
boolean todayIsVetoed = InternalUtilities.isDateVetoed(vetoPolicy, LocalDate.now());
if (todayIsVetoed) {
return;
}
}
// Do not highlight the month label if the month menu is disabled.
if ((label == labelMonth) && (settings.getEnableMonthMenu() == false)) {
return;
}
// Do not highlight the year label if the year menu is disabled.
if ((label == labelYear) && (settings.getEnableYearMenu() == false)) {
return;
}
// Highlight the label.
label.setBackground(new Color(184, 207, 229));
label.setBorder(new CompoundBorder(
new LineBorder(Color.GRAY), labelIndicatorEmptyBorder));
} } | public class class_name {
private void labelIndicatorMouseEntered(MouseEvent e) {
// Skip this function if the settings have not been applied.
if (settings == null) {
return; // depends on control dependency: [if], data = [none]
}
JLabel label = ((JLabel) e.getSource());
// Do not highlight the today label if today is vetoed.
if (label == labelSetDateToToday) {
DateVetoPolicy vetoPolicy = settings.getVetoPolicy();
boolean todayIsVetoed = InternalUtilities.isDateVetoed(vetoPolicy, LocalDate.now());
if (todayIsVetoed) {
return; // depends on control dependency: [if], data = [none]
}
}
// Do not highlight the month label if the month menu is disabled.
if ((label == labelMonth) && (settings.getEnableMonthMenu() == false)) {
return; // depends on control dependency: [if], data = [none]
}
// Do not highlight the year label if the year menu is disabled.
if ((label == labelYear) && (settings.getEnableYearMenu() == false)) {
return; // depends on control dependency: [if], data = [none]
}
// Highlight the label.
label.setBackground(new Color(184, 207, 229));
label.setBorder(new CompoundBorder(
new LineBorder(Color.GRAY), labelIndicatorEmptyBorder));
} } |
public class class_name {
public static String getRequestIp(HttpServletRequest request) throws UnknownHostException {
String ip = request.getHeader("x-forwarded-for");
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
if(ip.equals("127.0.0.1")){
//根据网卡取本机配置的IP
InetAddress inetAddress = InetAddress.getLocalHost();
ip= inetAddress.getHostAddress();
}
}
// 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
if(ip != null && ip.length() > 15){
if(ip.indexOf(",")>0){
ip = ip.substring(0,ip.indexOf(","));
}
}
//return ip;
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
} } | public class class_name {
public static String getRequestIp(HttpServletRequest request) throws UnknownHostException {
String ip = request.getHeader("x-forwarded-for");
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
if(ip.equals("127.0.0.1")){
//根据网卡取本机配置的IP
InetAddress inetAddress = InetAddress.getLocalHost();
ip= inetAddress.getHostAddress(); // depends on control dependency: [if], data = [none]
}
}
// 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
if(ip != null && ip.length() > 15){
if(ip.indexOf(",")>0){
ip = ip.substring(0,ip.indexOf(",")); // depends on control dependency: [if], data = [none]
}
}
//return ip;
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
} } |
public class class_name {
public static boolean isDate(String str) {
try {
DateUtils.parseDate(str);
return true;
} catch (Exception e) {
return false;
}
} } | public class class_name {
public static boolean isDate(String str) {
try {
DateUtils.parseDate(str); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void initialize()
{
if (m_backend == BackendTarget.NONE) {
m_non_voltdb_backend = null;
m_ee = new MockExecutionEngine();
}
else if (m_backend == BackendTarget.HSQLDB_BACKEND) {
m_non_voltdb_backend = HsqlBackend.initializeHSQLBackend(m_siteId, m_context);
m_ee = new MockExecutionEngine();
}
else if (m_backend == BackendTarget.POSTGRESQL_BACKEND) {
m_non_voltdb_backend = PostgreSQLBackend.initializePostgreSQLBackend(m_context);
m_ee = new MockExecutionEngine();
}
else if (m_backend == BackendTarget.POSTGIS_BACKEND) {
m_non_voltdb_backend = PostGISBackend.initializePostGISBackend(m_context);
m_ee = new MockExecutionEngine();
}
else {
m_non_voltdb_backend = null;
m_ee = initializeEE();
}
m_ee.loadFunctions(m_context);
m_snapshotter = new SnapshotSiteProcessor(m_scheduler,
m_snapshotPriority,
new SnapshotSiteProcessor.IdlePredicate() {
@Override
public boolean idle(long now) {
return (now - 5) > m_lastTxnTime;
}
});
} } | public class class_name {
void initialize()
{
if (m_backend == BackendTarget.NONE) {
m_non_voltdb_backend = null; // depends on control dependency: [if], data = [none]
m_ee = new MockExecutionEngine(); // depends on control dependency: [if], data = [none]
}
else if (m_backend == BackendTarget.HSQLDB_BACKEND) {
m_non_voltdb_backend = HsqlBackend.initializeHSQLBackend(m_siteId, m_context); // depends on control dependency: [if], data = [none]
m_ee = new MockExecutionEngine(); // depends on control dependency: [if], data = [none]
}
else if (m_backend == BackendTarget.POSTGRESQL_BACKEND) {
m_non_voltdb_backend = PostgreSQLBackend.initializePostgreSQLBackend(m_context); // depends on control dependency: [if], data = [none]
m_ee = new MockExecutionEngine(); // depends on control dependency: [if], data = [none]
}
else if (m_backend == BackendTarget.POSTGIS_BACKEND) {
m_non_voltdb_backend = PostGISBackend.initializePostGISBackend(m_context); // depends on control dependency: [if], data = [none]
m_ee = new MockExecutionEngine(); // depends on control dependency: [if], data = [none]
}
else {
m_non_voltdb_backend = null; // depends on control dependency: [if], data = [none]
m_ee = initializeEE(); // depends on control dependency: [if], data = [none]
}
m_ee.loadFunctions(m_context);
m_snapshotter = new SnapshotSiteProcessor(m_scheduler,
m_snapshotPriority,
new SnapshotSiteProcessor.IdlePredicate() {
@Override
public boolean idle(long now) {
return (now - 5) > m_lastTxnTime;
}
});
} } |
public class class_name {
@Override
public void delete() throws IOException {
boolean rollback = false;
final OAtomicOperation atomicOperation = startAtomicOperation(false);
try {
final Lock lock = FILE_LOCK_MANAGER.acquireExclusiveLock(fileId);
try {
final Queue<OBonsaiBucketPointer> subTreesToDelete = new LinkedList<>();
subTreesToDelete.add(rootBucketPointer);
recycleSubTrees(subTreesToDelete, atomicOperation);
} finally {
lock.unlock();
}
} catch (final Exception e) {
rollback = true;
throw e;
} finally {
endAtomicOperation(rollback);
}
} } | public class class_name {
@Override
public void delete() throws IOException {
boolean rollback = false;
final OAtomicOperation atomicOperation = startAtomicOperation(false);
try {
final Lock lock = FILE_LOCK_MANAGER.acquireExclusiveLock(fileId);
try {
final Queue<OBonsaiBucketPointer> subTreesToDelete = new LinkedList<>();
subTreesToDelete.add(rootBucketPointer); // depends on control dependency: [try], data = [none]
recycleSubTrees(subTreesToDelete, atomicOperation); // depends on control dependency: [try], data = [none]
} finally {
lock.unlock();
}
} catch (final Exception e) {
rollback = true;
throw e;
} finally {
endAtomicOperation(rollback);
}
} } |
public class class_name {
public void sendWarning(Object source, String msg)
{
try {
String s = getClass().getSimpleName() + ": " + msg;
// if warning is high-priority then send to high priority handlers first
System.err.println(s);
for (WarningHandler handler : _priorityHandlers) {
handler.warning(source, msg);
}
// now send to the all handlers regardless of if its high priority
for (WarningHandler handler : _handlers) {
handler.warning(source, msg);
}
log.warning(msg);
} catch (Throwable e) {
// WarningService must not throw exception
log.log(Level.WARNING, e.toString(), e);
}
} } | public class class_name {
public void sendWarning(Object source, String msg)
{
try {
String s = getClass().getSimpleName() + ": " + msg;
// if warning is high-priority then send to high priority handlers first
System.err.println(s); // depends on control dependency: [try], data = [none]
for (WarningHandler handler : _priorityHandlers) {
handler.warning(source, msg); // depends on control dependency: [for], data = [handler]
}
// now send to the all handlers regardless of if its high priority
for (WarningHandler handler : _handlers) {
handler.warning(source, msg); // depends on control dependency: [for], data = [handler]
}
log.warning(msg); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
// WarningService must not throw exception
log.log(Level.WARNING, e.toString(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected Content getNextFile() throws IOException {
JarEntry entry;
if ((entry = jis.getNextJarEntry()) != null) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] data = new byte[BUFFER];
int size;
while ((size = jis.read(data, 0, data.length)) != -1) {
bos.write(data, 0, size);
}
Content file = new Content(entry.getName(), bos.toByteArray());
bos.close();
return file;
}
return null;
} } | public class class_name {
protected Content getNextFile() throws IOException {
JarEntry entry;
if ((entry = jis.getNextJarEntry()) != null) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] data = new byte[BUFFER];
int size;
while ((size = jis.read(data, 0, data.length)) != -1) {
bos.write(data, 0, size); // depends on control dependency: [while], data = [none]
}
Content file = new Content(entry.getName(), bos.toByteArray());
bos.close();
return file;
}
return null;
} } |
public class class_name {
private void startScript(String line, DispatchCallback callback) {
OutputFile outFile = sqlLine.getScriptOutputFile();
if (outFile != null) {
callback.setToFailure();
sqlLine.error(sqlLine.loc("script-already-running", outFile));
return;
}
String filename;
if (line.length() == "script".length()
|| (filename =
sqlLine.dequote(line.substring("script".length() + 1))) == null) {
sqlLine.error("Usage: script <file name>");
callback.setToFailure();
return;
}
try {
outFile = new OutputFile(expand(filename));
sqlLine.setScriptOutputFile(outFile);
sqlLine.output(sqlLine.loc("script-started", outFile));
callback.setToSuccess();
} catch (Exception e) {
callback.setToFailure();
sqlLine.error(e);
}
} } | public class class_name {
private void startScript(String line, DispatchCallback callback) {
OutputFile outFile = sqlLine.getScriptOutputFile();
if (outFile != null) {
callback.setToFailure(); // depends on control dependency: [if], data = [none]
sqlLine.error(sqlLine.loc("script-already-running", outFile)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
String filename;
if (line.length() == "script".length()
|| (filename =
sqlLine.dequote(line.substring("script".length() + 1))) == null) {
sqlLine.error("Usage: script <file name>"); // depends on control dependency: [if], data = [none]
callback.setToFailure(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
try {
outFile = new OutputFile(expand(filename)); // depends on control dependency: [try], data = [none]
sqlLine.setScriptOutputFile(outFile); // depends on control dependency: [try], data = [none]
sqlLine.output(sqlLine.loc("script-started", outFile)); // depends on control dependency: [try], data = [none]
callback.setToSuccess(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
callback.setToFailure();
sqlLine.error(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public RangeSet getConditionsTo(NFAState<T> state)
{
RangeSet rs = new RangeSet();
for (CharRange range : transitions.keySet())
{
if (range != null)
{
Set<Transition<NFAState<T>>> set2 = transitions.get(range);
for (Transition<NFAState<T>> tr : set2)
{
if (state.equals(tr.getTo()))
{
rs.add(range);
}
}
}
}
return rs;
} } | public class class_name {
public RangeSet getConditionsTo(NFAState<T> state)
{
RangeSet rs = new RangeSet();
for (CharRange range : transitions.keySet())
{
if (range != null)
{
Set<Transition<NFAState<T>>> set2 = transitions.get(range);
for (Transition<NFAState<T>> tr : set2)
{
if (state.equals(tr.getTo()))
{
rs.add(range);
// depends on control dependency: [if], data = [none]
}
}
}
}
return rs;
} } |
public class class_name {
@Override
public @NotNull ObjectArrayAssert isEqualTo(@Nullable Object[] expected) {
if (Arrays.deepEquals(actual, expected)) {
return this;
}
failIfCustomMessageIsSet();
throw failure(unexpectedNotEqual(actual, expected));
} } | public class class_name {
@Override
public @NotNull ObjectArrayAssert isEqualTo(@Nullable Object[] expected) {
if (Arrays.deepEquals(actual, expected)) {
return this; // depends on control dependency: [if], data = [none]
}
failIfCustomMessageIsSet();
throw failure(unexpectedNotEqual(actual, expected));
} } |
public class class_name {
public void completeGroup() {
// Copy initial set to allow permutations to grow
List<List<Integer>> gens = new ArrayList<List<Integer>>(permutations);
// Keep HashSet version of permutations for fast lookup.
Set<List<Integer>> known = new HashSet<List<Integer>>(permutations);
//breadth-first search through the map of all members
List<List<Integer>> currentLevel = new ArrayList<List<Integer>>(permutations);
while( currentLevel.size() > 0) {
List<List<Integer>> nextLevel = new ArrayList<List<Integer>>();
for( List<Integer> p : currentLevel) {
for(List<Integer> gen : gens) {
List<Integer> y = combine(p,gen);
if(!known.contains(y)) {
nextLevel.add(y);
//bypass addPermutation(y) for performance
permutations.add(y);
known.add(y);
}
}
}
currentLevel = nextLevel;
}
} } | public class class_name {
public void completeGroup() {
// Copy initial set to allow permutations to grow
List<List<Integer>> gens = new ArrayList<List<Integer>>(permutations);
// Keep HashSet version of permutations for fast lookup.
Set<List<Integer>> known = new HashSet<List<Integer>>(permutations);
//breadth-first search through the map of all members
List<List<Integer>> currentLevel = new ArrayList<List<Integer>>(permutations);
while( currentLevel.size() > 0) {
List<List<Integer>> nextLevel = new ArrayList<List<Integer>>();
for( List<Integer> p : currentLevel) {
for(List<Integer> gen : gens) {
List<Integer> y = combine(p,gen);
if(!known.contains(y)) {
nextLevel.add(y); // depends on control dependency: [if], data = [none]
//bypass addPermutation(y) for performance
permutations.add(y); // depends on control dependency: [if], data = [none]
known.add(y); // depends on control dependency: [if], data = [none]
}
}
}
currentLevel = nextLevel; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
@Override
public PointersPair malloc(AllocationShape shape, AllocationPoint point, AllocationStatus location) {
long reqMemory = AllocationUtils.getRequiredMemory(shape);
if (location == AllocationStatus.HOST && reqMemory < CudaEnvironment.getInstance().getConfiguration().getMaximumHostCacheableLength()) {
CacheHolder cache = zeroCache.get(shape);
if (cache != null) {
Pointer pointer = cache.poll();
if (pointer != null) {
cacheZeroHit.incrementAndGet();
// since this memory chunk is going to be used now, remove it's amount from
zeroCachedAmount.addAndGet(-1 * reqMemory);
PointersPair pair = new PointersPair();
pair.setDevicePointer(new CudaPointer(pointer.address()));
pair.setHostPointer(new CudaPointer(pointer.address()));
point.setAllocationStatus(AllocationStatus.HOST);
return pair;
}
}
cacheZeroMiss.incrementAndGet();
if (CudaEnvironment.getInstance().getConfiguration().isUsePreallocation() && zeroCachedAmount.get() < CudaEnvironment.getInstance().getConfiguration().getMaximumHostCache() / 10
&& reqMemory < 16 * 1024 * 1024L) {
CachePreallocator preallocator = new CachePreallocator(shape, location, CudaEnvironment.getInstance().getConfiguration().getPreallocationCalls());
preallocator.start();
}
cacheZeroMiss.incrementAndGet();
return super.malloc(shape, point, location);
}
return super.malloc(shape, point, location);
} } | public class class_name {
@Override
public PointersPair malloc(AllocationShape shape, AllocationPoint point, AllocationStatus location) {
long reqMemory = AllocationUtils.getRequiredMemory(shape);
if (location == AllocationStatus.HOST && reqMemory < CudaEnvironment.getInstance().getConfiguration().getMaximumHostCacheableLength()) {
CacheHolder cache = zeroCache.get(shape);
if (cache != null) {
Pointer pointer = cache.poll();
if (pointer != null) {
cacheZeroHit.incrementAndGet(); // depends on control dependency: [if], data = [none]
// since this memory chunk is going to be used now, remove it's amount from
zeroCachedAmount.addAndGet(-1 * reqMemory); // depends on control dependency: [if], data = [none]
PointersPair pair = new PointersPair();
pair.setDevicePointer(new CudaPointer(pointer.address())); // depends on control dependency: [if], data = [(pointer]
pair.setHostPointer(new CudaPointer(pointer.address())); // depends on control dependency: [if], data = [(pointer]
point.setAllocationStatus(AllocationStatus.HOST); // depends on control dependency: [if], data = [none]
return pair; // depends on control dependency: [if], data = [none]
}
}
cacheZeroMiss.incrementAndGet(); // depends on control dependency: [if], data = [none]
if (CudaEnvironment.getInstance().getConfiguration().isUsePreallocation() && zeroCachedAmount.get() < CudaEnvironment.getInstance().getConfiguration().getMaximumHostCache() / 10
&& reqMemory < 16 * 1024 * 1024L) {
CachePreallocator preallocator = new CachePreallocator(shape, location, CudaEnvironment.getInstance().getConfiguration().getPreallocationCalls());
preallocator.start(); // depends on control dependency: [if], data = [none]
}
cacheZeroMiss.incrementAndGet(); // depends on control dependency: [if], data = [none]
return super.malloc(shape, point, location); // depends on control dependency: [if], data = [none]
}
return super.malloc(shape, point, location);
} } |
public class class_name {
private static RenameHandler createInstance() {
// log errors to System.err, as problems in static initializers can be troublesome to diagnose
RenameHandler instance = create(false);
try {
// calling loadFromClasspath() is the best option even though it mutates INSTANCE
// only serious errors will be caught here, most errors will log from parseRenameFile()
instance.loadFromClasspath();
} catch (IllegalStateException ex) {
System.err.println("ERROR: " + ex.getMessage());
ex.printStackTrace();
} catch (Throwable ex) {
System.err.println("ERROR: Failed to load Renamed.ini files: " + ex.getMessage());
ex.printStackTrace();
}
return instance;
} } | public class class_name {
private static RenameHandler createInstance() {
// log errors to System.err, as problems in static initializers can be troublesome to diagnose
RenameHandler instance = create(false);
try {
// calling loadFromClasspath() is the best option even though it mutates INSTANCE
// only serious errors will be caught here, most errors will log from parseRenameFile()
instance.loadFromClasspath(); // depends on control dependency: [try], data = [none]
} catch (IllegalStateException ex) {
System.err.println("ERROR: " + ex.getMessage());
ex.printStackTrace();
} catch (Throwable ex) { // depends on control dependency: [catch], data = [none]
System.err.println("ERROR: Failed to load Renamed.ini files: " + ex.getMessage());
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return instance;
} } |
public class class_name {
@Override
protected void prim() throws ContradictionException {
minVal = propHK.getMinArcVal();
if (FILTER) {
maxTArc = minVal;
}
chooseOneNode();
inTree.set(oneNode);
ISet nei = g.getNeighOf(oneNode);
int min1 = -1;
int min2 = -1;
boolean b1 = false, b2 = false;
for (int j : nei) {
if (!b1) {
if (min1 == -1) {
min1 = j;
}
if (costs[oneNode][j] < costs[oneNode][min1]) {
min2 = min1;
min1 = j;
}
if (propHK.isMandatory(oneNode, j)) {
if (min1 != j) {
min2 = min1;
}
min1 = j;
b1 = true;
}
}
if (min1 != j && !b2) {
if (min2 == -1 || costs[oneNode][j] < costs[oneNode][min2]) {
min2 = j;
}
if (propHK.isMandatory(oneNode, j)) {
min2 = j;
b2 = true;
}
}
}
if (min1 == -1 || min2 == -1) {
propHK.contradiction();
}
if (FILTER) {
if (!propHK.isMandatory(oneNode, min1)) {
maxTArc = Math.max(maxTArc, costs[oneNode][min1]);
}
if (!propHK.isMandatory(oneNode, min2)) {
maxTArc = Math.max(maxTArc, costs[oneNode][min2]);
}
}
int first = -1, sizeFirst = n + 1;
for (int i = 0; i < n; i++) {
if (i != oneNode && g.getNeighOf(i).size() < sizeFirst) {
first = i;
sizeFirst = g.getNeighOf(i).size();
}
}
if (first == -1) {
propHK.contradiction();
}
addNode(first);
int from, to;
while (tSize < n - 2 && !heap.isEmpty()) {
to = heap.removeFirstElement();
from = mate[to];
addArc(from, to);
}
if (tSize != n - 2) {
propHK.contradiction();
}
addArc(oneNode, min1);
addArc(oneNode, min2);
if (Tree.getNeighOf(oneNode).size() != 2) {
throw new UnsupportedOperationException();
}
} } | public class class_name {
@Override
protected void prim() throws ContradictionException {
minVal = propHK.getMinArcVal();
if (FILTER) {
maxTArc = minVal;
}
chooseOneNode();
inTree.set(oneNode);
ISet nei = g.getNeighOf(oneNode);
int min1 = -1;
int min2 = -1;
boolean b1 = false, b2 = false;
for (int j : nei) {
if (!b1) {
if (min1 == -1) {
min1 = j; // depends on control dependency: [if], data = [none]
}
if (costs[oneNode][j] < costs[oneNode][min1]) {
min2 = min1; // depends on control dependency: [if], data = [none]
min1 = j; // depends on control dependency: [if], data = [none]
}
if (propHK.isMandatory(oneNode, j)) {
if (min1 != j) {
min2 = min1; // depends on control dependency: [if], data = [none]
}
min1 = j; // depends on control dependency: [if], data = [none]
b1 = true; // depends on control dependency: [if], data = [none]
}
}
if (min1 != j && !b2) {
if (min2 == -1 || costs[oneNode][j] < costs[oneNode][min2]) {
min2 = j; // depends on control dependency: [if], data = [none]
}
if (propHK.isMandatory(oneNode, j)) {
min2 = j; // depends on control dependency: [if], data = [none]
b2 = true; // depends on control dependency: [if], data = [none]
}
}
}
if (min1 == -1 || min2 == -1) {
propHK.contradiction();
}
if (FILTER) {
if (!propHK.isMandatory(oneNode, min1)) {
maxTArc = Math.max(maxTArc, costs[oneNode][min1]); // depends on control dependency: [if], data = [none]
}
if (!propHK.isMandatory(oneNode, min2)) {
maxTArc = Math.max(maxTArc, costs[oneNode][min2]); // depends on control dependency: [if], data = [none]
}
}
int first = -1, sizeFirst = n + 1;
for (int i = 0; i < n; i++) {
if (i != oneNode && g.getNeighOf(i).size() < sizeFirst) {
first = i;
sizeFirst = g.getNeighOf(i).size();
}
}
if (first == -1) {
propHK.contradiction();
}
addNode(first);
int from, to;
while (tSize < n - 2 && !heap.isEmpty()) {
to = heap.removeFirstElement();
from = mate[to];
addArc(from, to);
}
if (tSize != n - 2) {
propHK.contradiction();
}
addArc(oneNode, min1);
addArc(oneNode, min2);
if (Tree.getNeighOf(oneNode).size() != 2) {
throw new UnsupportedOperationException();
}
} } |
public class class_name {
void onSealExclusive(Batch batch)
{
buffersToEmit.add(batch);
wakeUpEmittingThread();
if (!isTerminated()) {
int nextBatchNumber = EmittedBatchCounter.nextBatchNumber(batch.batchNumber);
if (!concurrentBatch.compareAndSet(batch, new Batch(this, acquireBuffer(), nextBatchNumber))) {
// If compareAndSet failed, the service is closed concurrently.
Preconditions.checkState(isTerminated());
}
}
} } | public class class_name {
void onSealExclusive(Batch batch)
{
buffersToEmit.add(batch);
wakeUpEmittingThread();
if (!isTerminated()) {
int nextBatchNumber = EmittedBatchCounter.nextBatchNumber(batch.batchNumber);
if (!concurrentBatch.compareAndSet(batch, new Batch(this, acquireBuffer(), nextBatchNumber))) {
// If compareAndSet failed, the service is closed concurrently.
Preconditions.checkState(isTerminated()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public Object getStateToBind(Object orig, Name name, Context ctx,
Hashtable<?, ?> env) throws NamingException {
if (orig instanceof org.omg.CORBA.Object) {
// Already a CORBA object, just use it
return null;
}
if (orig instanceof Remote) {
// Turn remote object into org.omg.CORBA.Object
try {
// Returns null if JRMP; let next factory try
// CNCtx will eventually throw IllegalArgumentException if
// no CORBA object gotten
return
CorbaUtils.remoteToCorba((Remote) orig, ((CNCtx) ctx)._orb);
} catch (ClassNotFoundException e) {
// RMI-IIOP library not available
throw IIOPLogger.ROOT_LOGGER.unavailableRMIPackages();
}
}
return null; // pass and let next state factory try
} } | public class class_name {
public Object getStateToBind(Object orig, Name name, Context ctx,
Hashtable<?, ?> env) throws NamingException {
if (orig instanceof org.omg.CORBA.Object) {
// Already a CORBA object, just use it
return null;
}
if (orig instanceof Remote) {
// Turn remote object into org.omg.CORBA.Object
try {
// Returns null if JRMP; let next factory try
// CNCtx will eventually throw IllegalArgumentException if
// no CORBA object gotten
return
CorbaUtils.remoteToCorba((Remote) orig, ((CNCtx) ctx)._orb); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
// RMI-IIOP library not available
throw IIOPLogger.ROOT_LOGGER.unavailableRMIPackages();
} // depends on control dependency: [catch], data = [none]
}
return null; // pass and let next state factory try
} } |
public class class_name {
private long getIPv4Count(boolean excludeZeroHosts, int segCount) {
if(!isMultiple()) {
if(excludeZeroHosts && isZero()) {
return 0L;
}
return 1L;
}
long result = getCount(i -> getSegment(i).getValueCount(), segCount);
if(excludeZeroHosts && includesZeroHost()) {
int prefixedSegment = getNetworkSegmentIndex(getNetworkPrefixLength(), IPv4Address.BYTES_PER_SEGMENT, IPv4Address.BITS_PER_SEGMENT);
long zeroHostCount = getCount(i -> {
if(i == prefixedSegment) {
IPAddressSegment seg = getSegment(i);
int shift = seg.getBitCount() - seg.getSegmentPrefixLength();
int count = ((seg.getUpperSegmentValue() >>> shift) - (seg.getSegmentValue() >>> shift)) + 1;
return count;
}
return getSegment(i).getValueCount();
}, prefixedSegment + 1);
result -= zeroHostCount;
}
return result;
} } | public class class_name {
private long getIPv4Count(boolean excludeZeroHosts, int segCount) {
if(!isMultiple()) {
if(excludeZeroHosts && isZero()) {
return 0L; // depends on control dependency: [if], data = [none]
}
return 1L; // depends on control dependency: [if], data = [none]
}
long result = getCount(i -> getSegment(i).getValueCount(), segCount);
if(excludeZeroHosts && includesZeroHost()) {
int prefixedSegment = getNetworkSegmentIndex(getNetworkPrefixLength(), IPv4Address.BYTES_PER_SEGMENT, IPv4Address.BITS_PER_SEGMENT);
long zeroHostCount = getCount(i -> {
if(i == prefixedSegment) {
IPAddressSegment seg = getSegment(i);
int shift = seg.getBitCount() - seg.getSegmentPrefixLength();
int count = ((seg.getUpperSegmentValue() >>> shift) - (seg.getSegmentValue() >>> shift)) + 1;
return count; // depends on control dependency: [if], data = [none]
}
return getSegment(i).getValueCount();
}, prefixedSegment + 1);
result -= zeroHostCount;
}
return result;
} } |
public class class_name {
public void onExecutionFailed(ExecutionContext<I> context, Throwable finalException, ExecutionInfo info) {
for (ExecutionListener<I, O> listener: listeners) {
try {
if (!isListenerDisabled(listener)) {
listener.onExecutionFailed(context.getChildContext(listener), finalException, info);
}
} catch (Throwable e) {
logger.error("Error invoking listener " + listener, e);
}
}
} } | public class class_name {
public void onExecutionFailed(ExecutionContext<I> context, Throwable finalException, ExecutionInfo info) {
for (ExecutionListener<I, O> listener: listeners) {
try {
if (!isListenerDisabled(listener)) {
listener.onExecutionFailed(context.getChildContext(listener), finalException, info); // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
logger.error("Error invoking listener " + listener, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected void enterPredicate(Predicate predicate)
{
if (predicate instanceof WAMCompiledPredicate)
{
WAMOptimizeableListing compiledPredicate = (WAMCompiledPredicate) predicate;
for (WAMInstruction instruction : compiledPredicate.getUnoptimizedInstructions())
{
addLineToRow(instruction.toString());
nextRow();
}
}
} } | public class class_name {
protected void enterPredicate(Predicate predicate)
{
if (predicate instanceof WAMCompiledPredicate)
{
WAMOptimizeableListing compiledPredicate = (WAMCompiledPredicate) predicate;
for (WAMInstruction instruction : compiledPredicate.getUnoptimizedInstructions())
{
addLineToRow(instruction.toString()); // depends on control dependency: [for], data = [instruction]
nextRow(); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
protected void repairAfterLazy() {
for (int k = 0; k < highLowContainer.size(); ++k) {
MappeableContainer c = highLowContainer.getContainerAtIndex(k);
((MutableRoaringArray) highLowContainer).setContainerAtIndex(k, c.repairAfterLazy());
}
} } | public class class_name {
protected void repairAfterLazy() {
for (int k = 0; k < highLowContainer.size(); ++k) {
MappeableContainer c = highLowContainer.getContainerAtIndex(k);
((MutableRoaringArray) highLowContainer).setContainerAtIndex(k, c.repairAfterLazy()); // depends on control dependency: [for], data = [k]
}
} } |
public class class_name {
public ListBuffer<A> append(A x) {
Assert.checkNonNull(x);
if (shared) copy();
List<A> newLast = List.of(x);
if (last != null) {
last.tail = newLast;
last = newLast;
} else {
elems = last = newLast;
}
count++;
return this;
} } | public class class_name {
public ListBuffer<A> append(A x) {
Assert.checkNonNull(x);
if (shared) copy();
List<A> newLast = List.of(x);
if (last != null) {
last.tail = newLast; // depends on control dependency: [if], data = [none]
last = newLast; // depends on control dependency: [if], data = [none]
} else {
elems = last = newLast; // depends on control dependency: [if], data = [none]
}
count++;
return this;
} } |
public class class_name {
public int execute(String binary, String... args) throws MojoExecutionException {
File destination = getNPMDirectory();
if (!destination.isDirectory()) {
throw new IllegalStateException("The npm module " + this.npmName + " is not installed");
}
CommandLine cmdLine = new CommandLine(node.getNodeExecutable());
File npmExec = null;
try {
npmExec = findExecutable(binary);
} catch (IOException | ParseException e) { //NOSONAR
log.error(e);
}
if (npmExec == null) {
throw new IllegalStateException("Cannot execute NPM " + this.npmName + " - cannot find the JavaScript file " +
"matching " + binary + " in the " + PACKAGE_JSON + " file");
}
// NPM is launched using the main file.
cmdLine.addArgument(npmExec.getAbsolutePath(), false);
for (String arg : args) {
cmdLine.addArgument(arg, this.handleQuoting);
}
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
errorStreamFromLastExecution = new LoggedOutputStream(log, true, true);
outputStreamFromLastExecution = new LoggedOutputStream(log, false, registerOutputStream);
PumpStreamHandler streamHandler = new PumpStreamHandler(
outputStreamFromLastExecution,
errorStreamFromLastExecution);
executor.setStreamHandler(streamHandler);
executor.setWorkingDirectory(node.getWorkDir());
log.info("Executing " + cmdLine.toString() + " from " + executor.getWorkingDirectory().getAbsolutePath());
try {
return executor.execute(cmdLine, extendEnvironmentWithNodeInPath(node));
} catch (IOException e) {
throw new MojoExecutionException("Error during the execution of the NPM " + npmName, e);
}
} } | public class class_name {
public int execute(String binary, String... args) throws MojoExecutionException {
File destination = getNPMDirectory();
if (!destination.isDirectory()) {
throw new IllegalStateException("The npm module " + this.npmName + " is not installed");
}
CommandLine cmdLine = new CommandLine(node.getNodeExecutable());
File npmExec = null;
try {
npmExec = findExecutable(binary); // depends on control dependency: [try], data = [none]
} catch (IOException | ParseException e) { //NOSONAR
log.error(e);
} // depends on control dependency: [catch], data = [none]
if (npmExec == null) {
throw new IllegalStateException("Cannot execute NPM " + this.npmName + " - cannot find the JavaScript file " +
"matching " + binary + " in the " + PACKAGE_JSON + " file");
}
// NPM is launched using the main file.
cmdLine.addArgument(npmExec.getAbsolutePath(), false);
for (String arg : args) {
cmdLine.addArgument(arg, this.handleQuoting); // depends on control dependency: [for], data = [arg]
}
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
errorStreamFromLastExecution = new LoggedOutputStream(log, true, true);
outputStreamFromLastExecution = new LoggedOutputStream(log, false, registerOutputStream);
PumpStreamHandler streamHandler = new PumpStreamHandler(
outputStreamFromLastExecution,
errorStreamFromLastExecution);
executor.setStreamHandler(streamHandler);
executor.setWorkingDirectory(node.getWorkDir());
log.info("Executing " + cmdLine.toString() + " from " + executor.getWorkingDirectory().getAbsolutePath());
try {
return executor.execute(cmdLine, extendEnvironmentWithNodeInPath(node)); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new MojoExecutionException("Error during the execution of the NPM " + npmName, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static void writeProperties(Properties props, String keyPrefix, Map<String, Boolean> filters) {
int counter = 0;
Set<Entry<String, Boolean>> entrySet = filters.entrySet();
for (Entry<String, Boolean> entry : entrySet) {
props.setProperty(keyPrefix + counter, entry.getKey() + BOOL_SEPARATOR + entry.getValue());
counter++;
}
// remove obsolete keys from the properties file
boolean keyFound = true;
while (keyFound) {
String key = keyPrefix + counter;
String property = props.getProperty(key);
if (property == null) {
keyFound = false;
} else {
props.remove(key);
}
}
} } | public class class_name {
private static void writeProperties(Properties props, String keyPrefix, Map<String, Boolean> filters) {
int counter = 0;
Set<Entry<String, Boolean>> entrySet = filters.entrySet();
for (Entry<String, Boolean> entry : entrySet) {
props.setProperty(keyPrefix + counter, entry.getKey() + BOOL_SEPARATOR + entry.getValue()); // depends on control dependency: [for], data = [entry]
counter++; // depends on control dependency: [for], data = [none]
}
// remove obsolete keys from the properties file
boolean keyFound = true;
while (keyFound) {
String key = keyPrefix + counter;
String property = props.getProperty(key);
if (property == null) {
keyFound = false; // depends on control dependency: [if], data = [none]
} else {
props.remove(key); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public boolean openAt(@NotNull final DayOpeningHours other) {
Contract.requireArgNotNull("other", other);
if (dayOfTheWeek != other.dayOfTheWeek) {
return false;
}
for (final HourRange otherRange : other.hourRanges) {
if (!hourRanges.openAt(otherRange)) {
return false;
}
}
return true;
} } | public class class_name {
public boolean openAt(@NotNull final DayOpeningHours other) {
Contract.requireArgNotNull("other", other);
if (dayOfTheWeek != other.dayOfTheWeek) {
return false; // depends on control dependency: [if], data = [none]
}
for (final HourRange otherRange : other.hourRanges) {
if (!hourRanges.openAt(otherRange)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public String confirmation() {
if (!is.confirmationPresent()) {
return null;
}
try {
Alert alert = driver.switchTo().alert();
return alert.getText();
} catch (Exception e) {
log.warn(e);
return null;
}
} } | public class class_name {
public String confirmation() {
if (!is.confirmationPresent()) {
return null; // depends on control dependency: [if], data = [none]
}
try {
Alert alert = driver.switchTo().alert();
return alert.getText(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.warn(e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void scale( double alphaReal, double alphaImag , ZMatrixD1 a )
{
// on very small matrices (2 by 2) the call to getNumElements() can slow it down
// slightly compared to other libraries since it involves an extra multiplication.
final int size = a.getNumElements()*2;
for( int i = 0; i < size; i += 2 ) {
double real = a.data[i];
double imag = a.data[i+1];
a.data[i] = real*alphaReal - imag*alphaImag;
a.data[i+1] = real*alphaImag + imag*alphaReal;
}
} } | public class class_name {
public static void scale( double alphaReal, double alphaImag , ZMatrixD1 a )
{
// on very small matrices (2 by 2) the call to getNumElements() can slow it down
// slightly compared to other libraries since it involves an extra multiplication.
final int size = a.getNumElements()*2;
for( int i = 0; i < size; i += 2 ) {
double real = a.data[i];
double imag = a.data[i+1];
a.data[i] = real*alphaReal - imag*alphaImag; // depends on control dependency: [for], data = [i]
a.data[i+1] = real*alphaImag + imag*alphaReal; // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
@Override
public void beforeMethodSent(final MethodCallBuilder methodBuilder) {
if (methodBuilder.getOriginatingRequest() == null) {
final Optional<Request<Object>> request = requestContext.getRequest();
if (request.isPresent()) {
methodBuilder.setOriginatingRequest(request.get());
}
}
} } | public class class_name {
@Override
public void beforeMethodSent(final MethodCallBuilder methodBuilder) {
if (methodBuilder.getOriginatingRequest() == null) {
final Optional<Request<Object>> request = requestContext.getRequest();
if (request.isPresent()) {
methodBuilder.setOriginatingRequest(request.get()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static void remove() {
final String current = System.getProperties().getProperty(HANDLER_PKGS, "");
// Only one
if (current.equals(PKG)) {
System.getProperties().put(HANDLER_PKGS, "");
return;
}
// Middle
String token = "|" + PKG + "|";
int idx = current.indexOf(token);
if (idx > -1) {
final String removed = current.substring(0, idx) + "|" + current.substring(idx + token.length());
System.getProperties().put(HANDLER_PKGS, removed);
return;
}
// Beginning
token = PKG + "|";
idx = current.indexOf(token);
if (idx > -1) {
final String removed = current.substring(idx + token.length());
System.getProperties().put(HANDLER_PKGS, removed);
return;
}
// End
token = "|" + PKG;
idx = current.indexOf(token);
if (idx > -1) {
final String removed = current.substring(0, idx);
System.getProperties().put(HANDLER_PKGS, removed);
return;
}
} } | public class class_name {
public static void remove() {
final String current = System.getProperties().getProperty(HANDLER_PKGS, "");
// Only one
if (current.equals(PKG)) {
System.getProperties().put(HANDLER_PKGS, ""); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Middle
String token = "|" + PKG + "|";
int idx = current.indexOf(token);
if (idx > -1) {
final String removed = current.substring(0, idx) + "|" + current.substring(idx + token.length());
System.getProperties().put(HANDLER_PKGS, removed); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Beginning
token = PKG + "|";
idx = current.indexOf(token);
if (idx > -1) {
final String removed = current.substring(idx + token.length());
System.getProperties().put(HANDLER_PKGS, removed); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// End
token = "|" + PKG;
idx = current.indexOf(token);
if (idx > -1) {
final String removed = current.substring(0, idx);
System.getProperties().put(HANDLER_PKGS, removed); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String format(String worldName, Currency currency, double balance, DisplayFormat format) {
StringBuilder string = new StringBuilder();
if (worldName != null && !worldName.equals(WorldGroupsManager.DEFAULT_GROUP_NAME)) {
// We put the world name if the conf is true
string.append(worldName).append(": ");
}
if (currency != null) {
// We removes some cents if it's something like 20.20381 it would set it
// to 20.20
String[] theAmount = BigDecimal.valueOf(balance).toPlainString().split("\\.");
DecimalFormatSymbols unusualSymbols = new DecimalFormatSymbols();
unusualSymbols.setGroupingSeparator(',');
DecimalFormat decimalFormat = new DecimalFormat("###,###", unusualSymbols);
String name = currency.getName();
if (balance > 1.0 || balance < 1.0) {
name = currency.getPlural();
}
String coin;
if (theAmount.length == 2) {
if (theAmount[1].length() >= 2) {
coin = theAmount[1].substring(0, 2);
} else {
coin = theAmount[1] + "0";
}
} else {
coin = "0";
}
String amount;
try {
amount = decimalFormat.format(Double.parseDouble(theAmount[0]));
} catch (NumberFormatException e) {
amount = theAmount[0];
}
// Do we seperate money and dollar or not?
if (format == DisplayFormat.LONG) {
String subName = currency.getMinor();
if (Long.parseLong(coin) > 1) {
subName = currency.getMinorPlural();
}
string.append(amount).append(" ").append(name).append(" ").append(coin).append(" ").append(subName);
} else if (format == DisplayFormat.SMALL) {
string.append(amount).append(".").append(coin).append(" ").append(name);
} else if (format == DisplayFormat.SIGN) {
string.append(currency.getSign()).append(amount).append(".").append(coin);
} else if (format == DisplayFormat.SIGNFRONT) {
string.append(amount).append(".").append(coin).append(currency.getSign());
}else if (format == DisplayFormat.MAJORONLY) {
string.append(amount).append(" ").append(name);
}
}
return string.toString();
} } | public class class_name {
public String format(String worldName, Currency currency, double balance, DisplayFormat format) {
StringBuilder string = new StringBuilder();
if (worldName != null && !worldName.equals(WorldGroupsManager.DEFAULT_GROUP_NAME)) {
// We put the world name if the conf is true
string.append(worldName).append(": "); // depends on control dependency: [if], data = [(worldName]
}
if (currency != null) {
// We removes some cents if it's something like 20.20381 it would set it
// to 20.20
String[] theAmount = BigDecimal.valueOf(balance).toPlainString().split("\\.");
DecimalFormatSymbols unusualSymbols = new DecimalFormatSymbols();
unusualSymbols.setGroupingSeparator(','); // depends on control dependency: [if], data = [none]
DecimalFormat decimalFormat = new DecimalFormat("###,###", unusualSymbols);
String name = currency.getName();
if (balance > 1.0 || balance < 1.0) {
name = currency.getPlural(); // depends on control dependency: [if], data = [none]
}
String coin;
if (theAmount.length == 2) {
if (theAmount[1].length() >= 2) {
coin = theAmount[1].substring(0, 2); // depends on control dependency: [if], data = [none]
} else {
coin = theAmount[1] + "0"; // depends on control dependency: [if], data = [none]
}
} else {
coin = "0"; // depends on control dependency: [if], data = [none]
}
String amount;
try {
amount = decimalFormat.format(Double.parseDouble(theAmount[0])); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
amount = theAmount[0];
} // depends on control dependency: [catch], data = [none]
// Do we seperate money and dollar or not?
if (format == DisplayFormat.LONG) {
String subName = currency.getMinor();
if (Long.parseLong(coin) > 1) {
subName = currency.getMinorPlural(); // depends on control dependency: [if], data = [none]
}
string.append(amount).append(" ").append(name).append(" ").append(coin).append(" ").append(subName); // depends on control dependency: [if], data = [none]
} else if (format == DisplayFormat.SMALL) {
string.append(amount).append(".").append(coin).append(" ").append(name); // depends on control dependency: [if], data = [none]
} else if (format == DisplayFormat.SIGN) {
string.append(currency.getSign()).append(amount).append(".").append(coin); // depends on control dependency: [if], data = [none]
} else if (format == DisplayFormat.SIGNFRONT) {
string.append(amount).append(".").append(coin).append(currency.getSign()); // depends on control dependency: [if], data = [none]
}else if (format == DisplayFormat.MAJORONLY) {
string.append(amount).append(" ").append(name); // depends on control dependency: [if], data = [none]
}
}
return string.toString();
} } |
public class class_name {
public static String s(int count) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < count; i++) {
result.append(" ");
}
return result.toString();
} } | public class class_name {
public static String s(int count) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < count; i++) {
result.append(" "); // depends on control dependency: [for], data = [none]
}
return result.toString();
} } |
public class class_name {
@Procedure(mode = Mode.WRITE)
@Description("apoc.index.addNode(node,['prop1',...]) add node to an index for each label it has")
public void addNode(@Name("node") Node node, @Name("properties") List<String> propKeys) {
for (Label label : node.getLabels()) {
addNodeByLabel(label.name(),node,propKeys);
}
} } | public class class_name {
@Procedure(mode = Mode.WRITE)
@Description("apoc.index.addNode(node,['prop1',...]) add node to an index for each label it has")
public void addNode(@Name("node") Node node, @Name("properties") List<String> propKeys) {
for (Label label : node.getLabels()) {
addNodeByLabel(label.name(),node,propKeys); // depends on control dependency: [for], data = [label]
}
} } |
public class class_name {
private void removeAllResourcesFromViewRoot(final FacesContext context,
final List<UIComponent> resources,
final UIViewRoot view) {
final Iterator<UIComponent> it = resources.iterator();
while (it.hasNext()) {
final UIComponent resource = it.next();
final String resourceLibrary = (String) resource.getAttributes().get("library");
removeResource(context, resource, view);
if (resourceLibrary != null && resourceLibrary.startsWith("butterfaces"))
it.remove();
}
} } | public class class_name {
private void removeAllResourcesFromViewRoot(final FacesContext context,
final List<UIComponent> resources,
final UIViewRoot view) {
final Iterator<UIComponent> it = resources.iterator();
while (it.hasNext()) {
final UIComponent resource = it.next();
final String resourceLibrary = (String) resource.getAttributes().get("library");
removeResource(context, resource, view); // depends on control dependency: [while], data = [none]
if (resourceLibrary != null && resourceLibrary.startsWith("butterfaces"))
it.remove();
}
} } |
public class class_name {
public <O> O get(Class<O> clazz, String key){
// canWrite(); TODO disabled for now
Object o = null;
try{
o = user_data.get(key);
return clazz.cast( o );
} catch (Exception e){
e.printStackTrace();
System.out.println("Get(" + clazz.getSimpleName() + "," + key + ")");
System.out.println(o);
return null;
}
} } | public class class_name {
public <O> O get(Class<O> clazz, String key){
// canWrite(); TODO disabled for now
Object o = null;
try{
o = user_data.get(key); // depends on control dependency: [try], data = [none]
return clazz.cast( o ); // depends on control dependency: [try], data = [none]
} catch (Exception e){
e.printStackTrace();
System.out.println("Get(" + clazz.getSimpleName() + "," + key + ")");
System.out.println(o);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String[] getCountersAsString() {
synchronized (counters) {
final String[] output = new String[counters.size()];
int i = 0;
for (Entry<String, Long> entry : counters.entrySet()) {
output[i++] = entry.getKey() + ": " + entry.getValue().toString();
}
return output;
}
} } | public class class_name {
public String[] getCountersAsString() {
synchronized (counters) {
final String[] output = new String[counters.size()];
int i = 0;
for (Entry<String, Long> entry : counters.entrySet()) {
output[i++] = entry.getKey() + ": " + entry.getValue().toString();
// depends on control dependency: [for], data = [entry]
}
return output;
}
} } |
public class class_name {
public void process(List<T> objects) {
for (T message : objects) {
// If this batcher has been shutdown, do not accept any more
// messages
if (isShutDown) {
return;
}
process(message);
}
} } | public class class_name {
public void process(List<T> objects) {
for (T message : objects) {
// If this batcher has been shutdown, do not accept any more
// messages
if (isShutDown) {
return; // depends on control dependency: [if], data = [none]
}
process(message); // depends on control dependency: [for], data = [message]
}
} } |
public class class_name {
ArrayList basicFindClassLoaders() {
Class[] stack = contextFinder.getClassContext();
ArrayList result = new ArrayList(1);
ClassLoader previousLoader = null;
for (int i = 1; i < stack.length; i++) {
ClassLoader tmp = stack[i].getClassLoader();
if (checkClass(stack[i]) && tmp != null && tmp != this) {
if (checkClassLoader(tmp)) {
if (previousLoader != tmp) {
result.add(tmp);
previousLoader = tmp;
}
}
// stop at the framework classloader or the first bundle classloader
if (Activator.getBundle(stack[i]) != null)
break;
}
}
return result;
} } | public class class_name {
ArrayList basicFindClassLoaders() {
Class[] stack = contextFinder.getClassContext();
ArrayList result = new ArrayList(1);
ClassLoader previousLoader = null;
for (int i = 1; i < stack.length; i++) {
ClassLoader tmp = stack[i].getClassLoader();
if (checkClass(stack[i]) && tmp != null && tmp != this) {
if (checkClassLoader(tmp)) {
if (previousLoader != tmp) {
result.add(tmp); // depends on control dependency: [if], data = [tmp)]
previousLoader = tmp; // depends on control dependency: [if], data = [none]
}
}
// stop at the framework classloader or the first bundle classloader
if (Activator.getBundle(stack[i]) != null)
break;
}
}
return result;
} } |
public class class_name {
protected void prepareImplicitWayRelations(TDWay tdWay) {
if (tdWay.isCoastline()) {
// find matching tiles on zoom level 12
Set<TileCoordinate> coastLineTiles = GeoUtils.mapWayToTiles(tdWay, TileInfo.TILE_INFO_ZOOMLEVEL, 0);
for (TileCoordinate tileCoordinate : coastLineTiles) {
TLongHashSet coastlines = this.tilesToCoastlines.get(tileCoordinate);
if (coastlines == null) {
coastlines = new TLongHashSet();
this.tilesToCoastlines.put(tileCoordinate, coastlines);
}
coastlines.add(tdWay.getId());
}
} else if (this.tagValues) {
if (tdWay.isRootElement()) {
Set<TileCoordinate> rootTiles = GeoUtils.mapWayToTiles(tdWay, TileInfo.TILE_INFO_ZOOMLEVEL, 0);
for (TileCoordinate tileCoordinate : rootTiles) {
TLongHashSet roots = this.tilesToRootElements.get(tileCoordinate);
if (roots == null) {
roots = new TLongHashSet();
this.tilesToRootElements.put(tileCoordinate, roots);
}
roots.add(tdWay.getId());
}
} else if (tdWay.isPartElement()) {
Set<TileCoordinate> partTiles = GeoUtils.mapWayToTiles(tdWay, TileInfo.TILE_INFO_ZOOMLEVEL, 0);
for (TileCoordinate tileCoordinate : partTiles) {
TLongHashSet parts = this.tilesToPartElements.get(tileCoordinate);
if (parts == null) {
parts = new TLongHashSet();
this.tilesToPartElements.put(tileCoordinate, parts);
}
parts.add(tdWay.getId());
}
}
}
} } | public class class_name {
protected void prepareImplicitWayRelations(TDWay tdWay) {
if (tdWay.isCoastline()) {
// find matching tiles on zoom level 12
Set<TileCoordinate> coastLineTiles = GeoUtils.mapWayToTiles(tdWay, TileInfo.TILE_INFO_ZOOMLEVEL, 0);
for (TileCoordinate tileCoordinate : coastLineTiles) {
TLongHashSet coastlines = this.tilesToCoastlines.get(tileCoordinate);
if (coastlines == null) {
coastlines = new TLongHashSet(); // depends on control dependency: [if], data = [none]
this.tilesToCoastlines.put(tileCoordinate, coastlines); // depends on control dependency: [if], data = [none]
}
coastlines.add(tdWay.getId()); // depends on control dependency: [for], data = [none]
}
} else if (this.tagValues) {
if (tdWay.isRootElement()) {
Set<TileCoordinate> rootTiles = GeoUtils.mapWayToTiles(tdWay, TileInfo.TILE_INFO_ZOOMLEVEL, 0);
for (TileCoordinate tileCoordinate : rootTiles) {
TLongHashSet roots = this.tilesToRootElements.get(tileCoordinate);
if (roots == null) {
roots = new TLongHashSet(); // depends on control dependency: [if], data = [none]
this.tilesToRootElements.put(tileCoordinate, roots); // depends on control dependency: [if], data = [none]
}
roots.add(tdWay.getId()); // depends on control dependency: [for], data = [none]
}
} else if (tdWay.isPartElement()) {
Set<TileCoordinate> partTiles = GeoUtils.mapWayToTiles(tdWay, TileInfo.TILE_INFO_ZOOMLEVEL, 0);
for (TileCoordinate tileCoordinate : partTiles) {
TLongHashSet parts = this.tilesToPartElements.get(tileCoordinate);
if (parts == null) {
parts = new TLongHashSet(); // depends on control dependency: [if], data = [none]
this.tilesToPartElements.put(tileCoordinate, parts); // depends on control dependency: [if], data = [none]
}
parts.add(tdWay.getId()); // depends on control dependency: [for], data = [none]
}
}
}
} } |
public class class_name {
private String evaluateEmphasis(String message, Ansi.Color msgColor) {
// Split but keep the content by splitting on [[ and ]] separately when they
// are followed or preceded by their counterpart. This lets the split retain
// the character in the center.
String[] parts = message.split("(\\[\\[(?=.]])|(?<=\\[\\[.)]])");
if (parts.length == 1) {
return message;
}
// The split up string is comprised of a leading plain part, followed
// by groups of colorization that are <SET> color-part <RESET> plain-part.
// To avoid emitting needless color changes, we skip the set or reset
// if the subsequent part is empty.
String msgColorS = ansi().fg(msgColor).toString();
StringBuilder ret = new StringBuilder(parts[0]);
for (int i = 1; i < parts.length; i += 4) {
boolean colorPart = i + 1 < parts.length && parts[i + 1].length() > 0;
boolean plainPart = i + 3 < parts.length && parts[i + 3].length() > 0;
if (colorPart) {
ret.append(getEmphasisColor(parts[i]));
ret.append(parts[i + 1]);
if(plainPart) {
ret.append(msgColorS);
}
}
if (plainPart) {
ret.append(parts[i + 3]);
}
}
return ret.toString();
} } | public class class_name {
private String evaluateEmphasis(String message, Ansi.Color msgColor) {
// Split but keep the content by splitting on [[ and ]] separately when they
// are followed or preceded by their counterpart. This lets the split retain
// the character in the center.
String[] parts = message.split("(\\[\\[(?=.]])|(?<=\\[\\[.)]])");
if (parts.length == 1) {
return message; // depends on control dependency: [if], data = [none]
}
// The split up string is comprised of a leading plain part, followed
// by groups of colorization that are <SET> color-part <RESET> plain-part.
// To avoid emitting needless color changes, we skip the set or reset
// if the subsequent part is empty.
String msgColorS = ansi().fg(msgColor).toString();
StringBuilder ret = new StringBuilder(parts[0]);
for (int i = 1; i < parts.length; i += 4) {
boolean colorPart = i + 1 < parts.length && parts[i + 1].length() > 0;
boolean plainPart = i + 3 < parts.length && parts[i + 3].length() > 0;
if (colorPart) {
ret.append(getEmphasisColor(parts[i])); // depends on control dependency: [if], data = [none]
ret.append(parts[i + 1]); // depends on control dependency: [if], data = [none]
if(plainPart) {
ret.append(msgColorS); // depends on control dependency: [if], data = [none]
}
}
if (plainPart) {
ret.append(parts[i + 3]); // depends on control dependency: [if], data = [none]
}
}
return ret.toString();
} } |
public class class_name {
private void destroy() {
Lock writerLock = ctxLock.writeLock();
writerLock.lock();
try {
if (ctx != 0) {
if (enableOcsp) {
SSLContext.disableOcsp(ctx);
}
SSLContext.free(ctx);
ctx = 0;
OpenSslSessionContext context = sessionContext();
if (context != null) {
context.destroy();
}
}
} finally {
writerLock.unlock();
}
} } | public class class_name {
private void destroy() {
Lock writerLock = ctxLock.writeLock();
writerLock.lock();
try {
if (ctx != 0) {
if (enableOcsp) {
SSLContext.disableOcsp(ctx); // depends on control dependency: [if], data = [none]
}
SSLContext.free(ctx); // depends on control dependency: [if], data = [(ctx]
ctx = 0; // depends on control dependency: [if], data = [none]
OpenSslSessionContext context = sessionContext();
if (context != null) {
context.destroy(); // depends on control dependency: [if], data = [none]
}
}
} finally {
writerLock.unlock();
}
} } |
public class class_name {
private void dailyBackup() {
try {
BackupResponse resp = mMetaMaster.backup(BackupPOptions.newBuilder()
.setTargetDirectory(mBackupDir).setLocalFileSystem(mIsLocal).build());
if (mIsLocal) {
LOG.info("Successfully backed up journal to {} on master {}",
resp.getBackupUri(), resp.getHostname());
} else {
LOG.info("Successfully backed up journal to {}", resp.getBackupUri());
}
} catch (Throwable t) {
LOG.error("Failed to execute daily backup at {}", mBackupDir, t);
return;
}
try {
deleteStaleBackups();
} catch (Throwable t) {
LOG.error("Failed to delete outdated backup files at {}", mBackupDir, t);
}
} } | public class class_name {
private void dailyBackup() {
try {
BackupResponse resp = mMetaMaster.backup(BackupPOptions.newBuilder()
.setTargetDirectory(mBackupDir).setLocalFileSystem(mIsLocal).build());
if (mIsLocal) {
LOG.info("Successfully backed up journal to {} on master {}",
resp.getBackupUri(), resp.getHostname()); // depends on control dependency: [if], data = [none]
} else {
LOG.info("Successfully backed up journal to {}", resp.getBackupUri()); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
LOG.error("Failed to execute daily backup at {}", mBackupDir, t);
return;
} // depends on control dependency: [catch], data = [none]
try {
deleteStaleBackups(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
LOG.error("Failed to delete outdated backup files at {}", mBackupDir, t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int count(final String host, final String searchStr) {
int count = 0;
for (int startIndex = 0; startIndex < host.length(); startIndex++) {
int findLoc = host.indexOf(searchStr, startIndex);
if (findLoc == -1) {
break;
} else {
count++;
startIndex = findLoc + searchStr.length() - 1;
}
}
return count;
} } | public class class_name {
public static int count(final String host, final String searchStr) {
int count = 0;
for (int startIndex = 0; startIndex < host.length(); startIndex++) {
int findLoc = host.indexOf(searchStr, startIndex);
if (findLoc == -1) {
break;
} else {
count++; // depends on control dependency: [if], data = [none]
startIndex = findLoc + searchStr.length() - 1; // depends on control dependency: [if], data = [none]
}
}
return count;
} } |
public class class_name {
public static void setProperties(SystemStoreClient<String, String> versionStore,
Properties props) {
if (props == null) {
logger.info("Ignoring set for empty properties");
return;
}
try {
String versionString = getPropertiesString(props);
versionStore.putSysStore(SystemStoreConstants.VERSIONS_METADATA_KEY,
versionString);
} catch(Exception e) {
logger.info("Got exception in setting properties : ", e);
}
} } | public class class_name {
public static void setProperties(SystemStoreClient<String, String> versionStore,
Properties props) {
if (props == null) {
logger.info("Ignoring set for empty properties"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
try {
String versionString = getPropertiesString(props);
versionStore.putSysStore(SystemStoreConstants.VERSIONS_METADATA_KEY,
versionString); // depends on control dependency: [try], data = [none]
} catch(Exception e) {
logger.info("Got exception in setting properties : ", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean isCancelled() {
if (futures == null) {
return false;
}
for (Future<?> future : futures) {
if (!future.isCancelled()) {
return false;
}
}
return true;
} } | public class class_name {
public boolean isCancelled() {
if (futures == null) {
return false; // depends on control dependency: [if], data = [none]
}
for (Future<?> future : futures) {
if (!future.isCancelled()) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static synchronized void init ()
{
// only initialize ourselves once
if (_keys != null) {
return;
} else {
_keys = new ArrayList<Class<?>>();
_values = new ArrayList<String>();
}
// first try loading the properties file without a leading slash
ClassLoader cld = ExceptionMap.class.getClassLoader();
InputStream config = ConfigUtil.getStream(PROPS_NAME, cld);
if (config == null) {
log.warning("Unable to load " + PROPS_NAME + " from CLASSPATH.");
} else {
// otherwise process ye old config file.
try {
// we'll do some serious jiggery pokery to leverage the parsing
// implementation provided by java.util.Properties. god bless
// method overloading
final ArrayList<String> classes = new ArrayList<String>();
Properties loader = new Properties() {
@Override public Object put (Object key, Object value) {
classes.add((String)key);
_values.add((String)value);
return key;
}
};
loader.load(config);
// now cruise through and resolve the exceptions named as
// keys and throw out any that don't appear to exist
for (int i = 0; i < classes.size(); i++) {
String exclass = classes.get(i);
try {
Class<?> cl = Class.forName(exclass);
// replace the string with the class object
_keys.add(cl);
} catch (Throwable t) {
log.warning("Unable to resolve exception class.", "class", exclass,
"error", t);
_values.remove(i);
i--; // back on up a notch
}
}
} catch (IOException ioe) {
log.warning("Error reading exception mapping file: " + ioe);
}
}
} } | public class class_name {
public static synchronized void init ()
{
// only initialize ourselves once
if (_keys != null) {
return; // depends on control dependency: [if], data = [none]
} else {
_keys = new ArrayList<Class<?>>(); // depends on control dependency: [if], data = [none]
_values = new ArrayList<String>(); // depends on control dependency: [if], data = [none]
}
// first try loading the properties file without a leading slash
ClassLoader cld = ExceptionMap.class.getClassLoader();
InputStream config = ConfigUtil.getStream(PROPS_NAME, cld);
if (config == null) {
log.warning("Unable to load " + PROPS_NAME + " from CLASSPATH."); // depends on control dependency: [if], data = [none]
} else {
// otherwise process ye old config file.
try {
// we'll do some serious jiggery pokery to leverage the parsing
// implementation provided by java.util.Properties. god bless
// method overloading
final ArrayList<String> classes = new ArrayList<String>();
Properties loader = new Properties() {
@Override public Object put (Object key, Object value) {
classes.add((String)key);
_values.add((String)value);
return key;
}
};
loader.load(config); // depends on control dependency: [try], data = [none]
// now cruise through and resolve the exceptions named as
// keys and throw out any that don't appear to exist
for (int i = 0; i < classes.size(); i++) {
String exclass = classes.get(i);
try {
Class<?> cl = Class.forName(exclass);
// replace the string with the class object
_keys.add(cl);
} catch (Throwable t) {
log.warning("Unable to resolve exception class.", "class", exclass,
"error", t);
_values.remove(i);
i--; // back on up a notch
} // depends on control dependency: [catch], data = [none]
}
} catch (IOException ioe) {
log.warning("Error reading exception mapping file: " + ioe);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Check(CheckType.NORMAL)
public void checkUnusedCapacities(SarlCapacityUses uses) {
if (!isIgnored(UNUSED_AGENT_CAPACITY)) {
final XtendTypeDeclaration container = uses.getDeclaringType();
final JvmDeclaredType jvmContainer = (JvmDeclaredType) this.associations.getPrimaryJvmElement(container);
final Map<String, JvmOperation> importedFeatures = CollectionLiterals.newHashMap();
for (final JvmOperation operation : jvmContainer.getDeclaredOperations()) {
if (Utils.isNameForHiddenCapacityImplementationCallingMethod(operation.getSimpleName())) {
importedFeatures.put(operation.getSimpleName(), operation);
}
}
final boolean isSkill = container instanceof SarlSkill;
int index = 0;
for (final JvmTypeReference capacity : uses.getCapacities()) {
final LightweightTypeReference lreference = toLightweightTypeReference(capacity);
if (isSkill && lreference.isAssignableFrom(jvmContainer)) {
addIssue(MessageFormat.format(
Messages.SARLValidator_22,
capacity.getSimpleName()),
uses,
SARL_CAPACITY_USES__CAPACITIES,
index, UNUSED_AGENT_CAPACITY,
capacity.getSimpleName());
} else {
final String fieldName = Utils.createNameForHiddenCapacityImplementationAttribute(capacity.getIdentifier());
final String operationName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName(fieldName);
final JvmOperation operation = importedFeatures.get(operationName);
if (operation != null && !isLocallyUsed(operation, container)) {
addIssue(MessageFormat.format(
Messages.SARLValidator_78,
capacity.getSimpleName()),
uses,
SARL_CAPACITY_USES__CAPACITIES,
index, UNUSED_AGENT_CAPACITY,
capacity.getSimpleName());
}
}
++index;
}
}
} } | public class class_name {
@Check(CheckType.NORMAL)
public void checkUnusedCapacities(SarlCapacityUses uses) {
if (!isIgnored(UNUSED_AGENT_CAPACITY)) {
final XtendTypeDeclaration container = uses.getDeclaringType();
final JvmDeclaredType jvmContainer = (JvmDeclaredType) this.associations.getPrimaryJvmElement(container);
final Map<String, JvmOperation> importedFeatures = CollectionLiterals.newHashMap();
for (final JvmOperation operation : jvmContainer.getDeclaredOperations()) {
if (Utils.isNameForHiddenCapacityImplementationCallingMethod(operation.getSimpleName())) {
importedFeatures.put(operation.getSimpleName(), operation); // depends on control dependency: [if], data = [none]
}
}
final boolean isSkill = container instanceof SarlSkill;
int index = 0;
for (final JvmTypeReference capacity : uses.getCapacities()) {
final LightweightTypeReference lreference = toLightweightTypeReference(capacity);
if (isSkill && lreference.isAssignableFrom(jvmContainer)) {
addIssue(MessageFormat.format(
Messages.SARLValidator_22,
capacity.getSimpleName()),
uses,
SARL_CAPACITY_USES__CAPACITIES,
index, UNUSED_AGENT_CAPACITY,
capacity.getSimpleName()); // depends on control dependency: [if], data = [none]
} else {
final String fieldName = Utils.createNameForHiddenCapacityImplementationAttribute(capacity.getIdentifier());
final String operationName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName(fieldName);
final JvmOperation operation = importedFeatures.get(operationName);
if (operation != null && !isLocallyUsed(operation, container)) {
addIssue(MessageFormat.format(
Messages.SARLValidator_78,
capacity.getSimpleName()),
uses,
SARL_CAPACITY_USES__CAPACITIES,
index, UNUSED_AGENT_CAPACITY,
capacity.getSimpleName()); // depends on control dependency: [if], data = [none]
}
}
++index; // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public void update(PeerState state, long uploaded, long downloaded,
long left) {
if (PeerState.STARTED.equals(state) && left == 0) {
state = PeerState.COMPLETED;
}
if (!state.equals(this.state)) {
logger.trace("Peer {} {} download of {}.",
new Object[]{
this,
state.name().toLowerCase(),
this.torrent,
});
}
this.state = state;
this.lastAnnounce = myTimeService.now();
this.uploaded = uploaded;
this.downloaded = downloaded;
this.left = left;
} } | public class class_name {
public void update(PeerState state, long uploaded, long downloaded,
long left) {
if (PeerState.STARTED.equals(state) && left == 0) {
state = PeerState.COMPLETED; // depends on control dependency: [if], data = [none]
}
if (!state.equals(this.state)) {
logger.trace("Peer {} {} download of {}.",
new Object[]{
this,
state.name().toLowerCase(),
this.torrent,
}); // depends on control dependency: [if], data = [none]
}
this.state = state;
this.lastAnnounce = myTimeService.now();
this.uploaded = uploaded;
this.downloaded = downloaded;
this.left = left;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.