code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static DataType largestOf(DataType... dataTypes) {
DataType widest = null;
for (DataType dataType : dataTypes) {
if (widest == null) {
widest = dataType;
} else if (rank(dataType) > rank(widest)) {
widest = dataType;
}
}
return widest;
} } | public class class_name {
public static DataType largestOf(DataType... dataTypes) {
DataType widest = null;
for (DataType dataType : dataTypes) {
if (widest == null) {
widest = dataType;
// depends on control dependency: [if], data = [none]
} else if (rank(dataType) > rank(widest)) {
widest = dataType;
// depends on control dependency: [if], data = [none]
}
}
return widest;
} } |
public class class_name {
static Bitmap decodeStream(InputStream stream, int requestedWidth,
int requestedHeight, final boolean canShrink,
Bitmap possibleAlternative, boolean closeStream) {
BitmapFactory.Options options = standardBitmapFactoryOptions();
try {
DecodeHelper helper;
if (stream instanceof FileInputStream) {
helper = new DecodeFileStreamHelper((FileInputStream) stream);
} else {
helper = new DecodeStreamHelper(stream);
}
helper.setInSampleSize(options, requestedWidth, requestedHeight);
if (useAlternativeBitmap(possibleAlternative, options)) {
return possibleAlternative;
}
do {
try {
return helper.decode(options, requestedWidth,
requestedHeight);
} catch (OutOfMemoryError m) {
// Rewind stream to read again
helper.rewind();
options.inSampleSize *= 2; // try again, at half-size
}
} while (canShrink);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (options != null && options.inTempStorage != null) {
bufferBin.put(options.inTempStorage);
}
if (stream != null && closeStream) {
try {
stream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
return null; // OutOfMemoryError, canShrink == false
} } | public class class_name {
static Bitmap decodeStream(InputStream stream, int requestedWidth,
int requestedHeight, final boolean canShrink,
Bitmap possibleAlternative, boolean closeStream) {
BitmapFactory.Options options = standardBitmapFactoryOptions();
try {
DecodeHelper helper;
if (stream instanceof FileInputStream) {
helper = new DecodeFileStreamHelper((FileInputStream) stream); // depends on control dependency: [if], data = [none]
} else {
helper = new DecodeStreamHelper(stream); // depends on control dependency: [if], data = [none]
}
helper.setInSampleSize(options, requestedWidth, requestedHeight); // depends on control dependency: [try], data = [none]
if (useAlternativeBitmap(possibleAlternative, options)) {
return possibleAlternative; // depends on control dependency: [if], data = [none]
}
do {
try {
return helper.decode(options, requestedWidth,
requestedHeight); // depends on control dependency: [try], data = [none]
} catch (OutOfMemoryError m) {
// Rewind stream to read again
helper.rewind();
options.inSampleSize *= 2; // try again, at half-size
} // depends on control dependency: [catch], data = [none]
} while (canShrink);
} catch (IOException e) {
e.printStackTrace();
} finally { // depends on control dependency: [catch], data = [none]
if (options != null && options.inTempStorage != null) {
bufferBin.put(options.inTempStorage); // depends on control dependency: [if], data = [(options]
}
if (stream != null && closeStream) {
try {
stream.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
}
return null; // OutOfMemoryError, canShrink == false
} } |
public class class_name {
@Override
public String getVirtualHostName() {
if (this.isNonSecurePortEnabled()) {
return configInstance.getStringProperty(namespace + VIRTUAL_HOSTNAME_KEY,
super.getVirtualHostName()).get();
} else {
return null;
}
} } | public class class_name {
@Override
public String getVirtualHostName() {
if (this.isNonSecurePortEnabled()) {
return configInstance.getStringProperty(namespace + VIRTUAL_HOSTNAME_KEY,
super.getVirtualHostName()).get(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String randomAlphaNumString(int length) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
sb.append(ALPHANUM.charAt(RANDOM.nextInt(ALPHANUM.length())));
}
return sb.toString();
} } | public class class_name {
public static String randomAlphaNumString(int length) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
sb.append(ALPHANUM.charAt(RANDOM.nextInt(ALPHANUM.length()))); // depends on control dependency: [for], data = [none]
}
return sb.toString();
} } |
public class class_name {
public void marshall(HlsEncryption hlsEncryption, ProtocolMarshaller protocolMarshaller) {
if (hlsEncryption == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(hlsEncryption.getConstantInitializationVector(), CONSTANTINITIALIZATIONVECTOR_BINDING);
protocolMarshaller.marshall(hlsEncryption.getEncryptionMethod(), ENCRYPTIONMETHOD_BINDING);
protocolMarshaller.marshall(hlsEncryption.getKeyRotationIntervalSeconds(), KEYROTATIONINTERVALSECONDS_BINDING);
protocolMarshaller.marshall(hlsEncryption.getRepeatExtXKey(), REPEATEXTXKEY_BINDING);
protocolMarshaller.marshall(hlsEncryption.getSpekeKeyProvider(), SPEKEKEYPROVIDER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(HlsEncryption hlsEncryption, ProtocolMarshaller protocolMarshaller) {
if (hlsEncryption == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(hlsEncryption.getConstantInitializationVector(), CONSTANTINITIALIZATIONVECTOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hlsEncryption.getEncryptionMethod(), ENCRYPTIONMETHOD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hlsEncryption.getKeyRotationIntervalSeconds(), KEYROTATIONINTERVALSECONDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hlsEncryption.getRepeatExtXKey(), REPEATEXTXKEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hlsEncryption.getSpekeKeyProvider(), SPEKEKEYPROVIDER_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 {
private static int resolveGravity(int gravity, int width, int height,
int intrinsicWidth, int intrinsicHeight) {
if (!Gravity.isHorizontal(gravity)) {
if (width < 0) {
gravity |= Gravity.FILL_HORIZONTAL;
} else {
gravity |= Gravity.START;
}
}
if (!Gravity.isVertical(gravity)) {
if (height < 0) {
gravity |= Gravity.FILL_VERTICAL;
} else {
gravity |= Gravity.TOP;
}
}
// If a dimension if not specified, either implicitly or explicitly,
// force FILL for that dimension's gravity. This ensures that colors
// are handled correctly and ensures backward compatibility.
if (width < 0 && intrinsicWidth < 0) {
gravity |= Gravity.FILL_HORIZONTAL;
}
if (height < 0 && intrinsicHeight < 0) {
gravity |= Gravity.FILL_VERTICAL;
}
return gravity;
} } | public class class_name {
private static int resolveGravity(int gravity, int width, int height,
int intrinsicWidth, int intrinsicHeight) {
if (!Gravity.isHorizontal(gravity)) {
if (width < 0) {
gravity |= Gravity.FILL_HORIZONTAL; // depends on control dependency: [if], data = [none]
} else {
gravity |= Gravity.START; // depends on control dependency: [if], data = [none]
}
}
if (!Gravity.isVertical(gravity)) {
if (height < 0) {
gravity |= Gravity.FILL_VERTICAL; // depends on control dependency: [if], data = [none]
} else {
gravity |= Gravity.TOP; // depends on control dependency: [if], data = [none]
}
}
// If a dimension if not specified, either implicitly or explicitly,
// force FILL for that dimension's gravity. This ensures that colors
// are handled correctly and ensures backward compatibility.
if (width < 0 && intrinsicWidth < 0) {
gravity |= Gravity.FILL_HORIZONTAL; // depends on control dependency: [if], data = [none]
}
if (height < 0 && intrinsicHeight < 0) {
gravity |= Gravity.FILL_VERTICAL; // depends on control dependency: [if], data = [none]
}
return gravity;
} } |
public class class_name {
@Override
public void putSystemContextItem(String name, Serializable item) throws IllegalArgumentException, IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "putSystemContextItem", new Object[] { name, item });
/* If we have a non-null name */
if (name != null) {
/* If we really have an item */
if (item != null) {
/* If the item is of a JMS supported type, we can store it as is. */
if (isValidForJms(item)) {
getSystemContextMap().put(name, item);
}
/* Otherwise, we need to take a safe copy & 'flatten it' suitably. */
else {
getSystemContextMap().put(name, flattenMapObject(item));
}
}
/* If item is null, just call deleteProperty */
else {
getSystemContextMap().remove(name);
}
}
/* A null name is invalid. */
else {
throw new IllegalArgumentException("null");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "putSystemContextItem");
} } | public class class_name {
@Override
public void putSystemContextItem(String name, Serializable item) throws IllegalArgumentException, IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "putSystemContextItem", new Object[] { name, item });
/* If we have a non-null name */
if (name != null) {
/* If we really have an item */
if (item != null) {
/* If the item is of a JMS supported type, we can store it as is. */
if (isValidForJms(item)) {
getSystemContextMap().put(name, item); // depends on control dependency: [if], data = [none]
}
/* Otherwise, we need to take a safe copy & 'flatten it' suitably. */
else {
getSystemContextMap().put(name, flattenMapObject(item)); // depends on control dependency: [if], data = [none]
}
}
/* If item is null, just call deleteProperty */
else {
getSystemContextMap().remove(name);
}
}
/* A null name is invalid. */
else {
throw new IllegalArgumentException("null");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "putSystemContextItem");
} } |
public class class_name {
public String toGroupPath() {
RegistryEntry rootEntry = getRootEntry();
ResourceInformation resourceInformation = rootEntry.getResourceInformation();
String resourcePath;
if (parentField != null) {
// TODO nested resource can be queried through two means, nested or direct flat (maybe). should be stored and considered somewhere here
ResourceInformation parentType = parentField.getParentResourceInformation();
resourcePath = parentType.getResourcePath() + "/{id}/" + parentField.getJsonName();
}
else {
resourcePath = resourceInformation.getResourcePath();
}
if (getIds() != null && (!resourceInformation.isNested() || !resourceInformation.isSingularNesting())) {
resourcePath += "/{id}";
}
return resourcePath;
} } | public class class_name {
public String toGroupPath() {
RegistryEntry rootEntry = getRootEntry();
ResourceInformation resourceInformation = rootEntry.getResourceInformation();
String resourcePath;
if (parentField != null) {
// TODO nested resource can be queried through two means, nested or direct flat (maybe). should be stored and considered somewhere here
ResourceInformation parentType = parentField.getParentResourceInformation();
resourcePath = parentType.getResourcePath() + "/{id}/" + parentField.getJsonName(); // depends on control dependency: [if], data = [none]
}
else {
resourcePath = resourceInformation.getResourcePath(); // depends on control dependency: [if], data = [none]
}
if (getIds() != null && (!resourceInformation.isNested() || !resourceInformation.isSingularNesting())) {
resourcePath += "/{id}"; // depends on control dependency: [if], data = [none]
}
return resourcePath;
} } |
public class class_name {
private void send(JainMgcpResponseEvent event) {
cancelLongtranTimer();
// to send response we already should know the address and port
// number from which the original request was received
if (remoteAddress == null) {
throw new IllegalArgumentException("Unknown orinator address");
}
// restore the original transaction handle parameter
// and encode event objet into MGCP response message
event.setTransactionHandle(remoteTID);
// encode event object into MGCP response message
if(originalPacket==null)
originalPacket=stack.allocatePacket();
originalPacket.setLength(encode(event,originalPacket.getRawData()));
InetSocketAddress inetSocketAddress = new InetSocketAddress(remoteAddress, remotePort);
originalPacket.setRemoteAddress(inetSocketAddress);
if (logger.isDebugEnabled()) {
logger.debug("--- TransactionHandler:" + this + " :LocalID=" + localTID + ", Send response event to "
+ remoteAddress + ":" + remotePort + ", message\n" + new String(originalPacket.getRawData(),0,originalPacket.getLength()));
}
stack.send(originalPacket);
/*
* Just reset timer in case of provisional response. Otherwise, release tx.
*/
if (isProvisional(event.getReturnCode())) {
// reset timer.
resetLongtranTimer();
} else {
release();
stack.getCompletedTransactions().put(Integer.valueOf(event.getTransactionHandle()), this);
resetTHISTTimerTask(true);
}
} } | public class class_name {
private void send(JainMgcpResponseEvent event) {
cancelLongtranTimer();
// to send response we already should know the address and port
// number from which the original request was received
if (remoteAddress == null) {
throw new IllegalArgumentException("Unknown orinator address");
}
// restore the original transaction handle parameter
// and encode event objet into MGCP response message
event.setTransactionHandle(remoteTID);
// encode event object into MGCP response message
if(originalPacket==null)
originalPacket=stack.allocatePacket();
originalPacket.setLength(encode(event,originalPacket.getRawData()));
InetSocketAddress inetSocketAddress = new InetSocketAddress(remoteAddress, remotePort);
originalPacket.setRemoteAddress(inetSocketAddress);
if (logger.isDebugEnabled()) {
logger.debug("--- TransactionHandler:" + this + " :LocalID=" + localTID + ", Send response event to "
+ remoteAddress + ":" + remotePort + ", message\n" + new String(originalPacket.getRawData(),0,originalPacket.getLength())); // depends on control dependency: [if], data = [none]
}
stack.send(originalPacket);
/*
* Just reset timer in case of provisional response. Otherwise, release tx.
*/
if (isProvisional(event.getReturnCode())) {
// reset timer.
resetLongtranTimer(); // depends on control dependency: [if], data = [none]
} else {
release(); // depends on control dependency: [if], data = [none]
stack.getCompletedTransactions().put(Integer.valueOf(event.getTransactionHandle()), this); // depends on control dependency: [if], data = [none]
resetTHISTTimerTask(true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ClassScanner scan(final URL... urls) {
for (final URL url : urls) {
final File file = FileUtil.toContainerFile(url);
if (file == null) {
if (!ignoreException) {
throw new FindFileException("URL is not a valid file: " + url);
}
}
else {
filesToScan.add(file);
}
}
return this;
} } | public class class_name {
public ClassScanner scan(final URL... urls) {
for (final URL url : urls) {
final File file = FileUtil.toContainerFile(url);
if (file == null) {
if (!ignoreException) {
throw new FindFileException("URL is not a valid file: " + url);
}
}
else {
filesToScan.add(file); // depends on control dependency: [if], data = [(file]
}
}
return this;
} } |
public class class_name {
public static ExpressionFactory getExpressionFactory(ELContext context) {
ExpressionFactory result = getContext(context, ExpressionFactory.class);
if (result == null) {
result = ExpressionFactory.newInstance();
context.putContext(ExpressionFactory.class, result);
}
return result;
} } | public class class_name {
public static ExpressionFactory getExpressionFactory(ELContext context) {
ExpressionFactory result = getContext(context, ExpressionFactory.class);
if (result == null) {
result = ExpressionFactory.newInstance(); // depends on control dependency: [if], data = [none]
context.putContext(ExpressionFactory.class, result); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static List<Method> getClassGetters(Class<?> beanClass) {
Map<String, Method> resultMap = new HashMap<>();
LinkedList<Method> results = new LinkedList<>();
Class<?> currentClass = beanClass;
while (currentClass != null && currentClass != Object.class) {
getDeclaredClassGetters(currentClass, resultMap, results);
currentClass = currentClass.getSuperclass();
}
return results;
} } | public class class_name {
public static List<Method> getClassGetters(Class<?> beanClass) {
Map<String, Method> resultMap = new HashMap<>();
LinkedList<Method> results = new LinkedList<>();
Class<?> currentClass = beanClass;
while (currentClass != null && currentClass != Object.class) {
getDeclaredClassGetters(currentClass, resultMap, results); // depends on control dependency: [while], data = [(currentClass]
currentClass = currentClass.getSuperclass(); // depends on control dependency: [while], data = [none]
}
return results;
} } |
public class class_name {
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
orderNumber = in.readInt();
byte[] data = new byte[in.readInt()];
if (data.length > 0)
{
try
{
in.readFully(data);
value = new JCRDateFormat().deserialize(new String(data, Constants.DEFAULT_ENCODING));
}
catch (ValueFormatException e)
{
throw new IOException("Deserialization data error", e);
}
}
} } | public class class_name {
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
orderNumber = in.readInt();
byte[] data = new byte[in.readInt()];
if (data.length > 0)
{
try
{
in.readFully(data); // depends on control dependency: [try], data = [none]
value = new JCRDateFormat().deserialize(new String(data, Constants.DEFAULT_ENCODING)); // depends on control dependency: [try], data = [none]
}
catch (ValueFormatException e)
{
throw new IOException("Deserialization data error", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public boolean isEffective(Tuple tuple,
RuleTerminalNode rtn,
WorkingMemory workingMemory) {
if ( !this.enabled.getValue( tuple,
rtn.getEnabledDeclarations(),
this,
workingMemory ) ) {
return false;
}
if ( this.dateEffective == null && this.dateExpires == null ) {
return true;
} else {
Calendar now = Calendar.getInstance();
now.setTimeInMillis( workingMemory.getSessionClock().getCurrentTime() );
if ( this.dateEffective != null && this.dateExpires != null ) {
return (now.after( this.dateEffective ) && now.before( this.dateExpires ));
} else if ( this.dateEffective != null ) {
return (now.after( this.dateEffective ));
} else {
return (now.before( this.dateExpires ));
}
}
} } | public class class_name {
public boolean isEffective(Tuple tuple,
RuleTerminalNode rtn,
WorkingMemory workingMemory) {
if ( !this.enabled.getValue( tuple,
rtn.getEnabledDeclarations(),
this,
workingMemory ) ) {
return false; // depends on control dependency: [if], data = [none]
}
if ( this.dateEffective == null && this.dateExpires == null ) {
return true; // depends on control dependency: [if], data = [none]
} else {
Calendar now = Calendar.getInstance();
now.setTimeInMillis( workingMemory.getSessionClock().getCurrentTime() ); // depends on control dependency: [if], data = [none]
if ( this.dateEffective != null && this.dateExpires != null ) {
return (now.after( this.dateEffective ) && now.before( this.dateExpires )); // depends on control dependency: [if], data = [( this.dateEffective]
} else if ( this.dateEffective != null ) {
return (now.after( this.dateEffective )); // depends on control dependency: [if], data = [( this.dateEffective]
} else {
return (now.before( this.dateExpires )); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void setCopyrightHolder(final String copyrightHolder) {
if (copyrightHolder == null && this.copyrightHolder == null) {
return;
} else if (copyrightHolder == null) {
removeChild(this.copyrightHolder);
this.copyrightHolder = null;
} else if (this.copyrightHolder == null) {
this.copyrightHolder = new KeyValueNode<String>(CommonConstants.CS_COPYRIGHT_HOLDER_TITLE, copyrightHolder);
appendChild(this.copyrightHolder, false);
} else {
this.copyrightHolder.setValue(copyrightHolder);
}
} } | public class class_name {
public void setCopyrightHolder(final String copyrightHolder) {
if (copyrightHolder == null && this.copyrightHolder == null) {
return; // depends on control dependency: [if], data = [none]
} else if (copyrightHolder == null) {
removeChild(this.copyrightHolder); // depends on control dependency: [if], data = [none]
this.copyrightHolder = null; // depends on control dependency: [if], data = [none]
} else if (this.copyrightHolder == null) {
this.copyrightHolder = new KeyValueNode<String>(CommonConstants.CS_COPYRIGHT_HOLDER_TITLE, copyrightHolder); // depends on control dependency: [if], data = [none]
appendChild(this.copyrightHolder, false); // depends on control dependency: [if], data = [(this.copyrightHolder]
} else {
this.copyrightHolder.setValue(copyrightHolder); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean setFilesChanged(String filesChangedStr) {
try {
this.filesChanged = Integer.parseInt(filesChangedStr);
return true;
} catch (NumberFormatException e) {
return false;
}
} } | public class class_name {
public boolean setFilesChanged(String filesChangedStr) {
try {
this.filesChanged = Integer.parseInt(filesChangedStr); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static synchronized <A extends Audio> A loadAudio(Media media, Class<A> type)
{
Check.notNull(media);
Check.notNull(type);
final String extension = UtilFile.getExtension(media.getPath());
try
{
return type.cast(Optional.ofNullable(FACTORIES.get(extension))
.orElseThrow(() -> new LionEngineException(media, ERROR_FORMAT))
.loadAudio(media));
}
catch (final ClassCastException exception)
{
throw new LionEngineException(exception, media, ERROR_FORMAT);
}
} } | public class class_name {
public static synchronized <A extends Audio> A loadAudio(Media media, Class<A> type)
{
Check.notNull(media);
Check.notNull(type);
final String extension = UtilFile.getExtension(media.getPath());
try
{
return type.cast(Optional.ofNullable(FACTORIES.get(extension))
.orElseThrow(() -> new LionEngineException(media, ERROR_FORMAT))
.loadAudio(media)); // depends on control dependency: [try], data = [none]
}
catch (final ClassCastException exception)
{
throw new LionEngineException(exception, media, ERROR_FORMAT);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected Set<QName> getProperties(HierarchicalProperty body)
{
HashSet<QName> properties = new HashSet<QName>();
HierarchicalProperty prop = body.getChild(new QName("DAV:", "prop"));
if (prop == null)
{
return properties;
}
for (int i = 0; i < prop.getChildren().size(); i++)
{
HierarchicalProperty property = prop.getChild(i);
properties.add(property.getName());
}
return properties;
} } | public class class_name {
protected Set<QName> getProperties(HierarchicalProperty body)
{
HashSet<QName> properties = new HashSet<QName>();
HierarchicalProperty prop = body.getChild(new QName("DAV:", "prop"));
if (prop == null)
{
return properties;
// depends on control dependency: [if], data = [none]
}
for (int i = 0; i < prop.getChildren().size(); i++)
{
HierarchicalProperty property = prop.getChild(i);
properties.add(property.getName());
// depends on control dependency: [for], data = [none]
}
return properties;
} } |
public class class_name {
@Override
public void visitField(Field obj) {
if (obj.isPrivate()) {
String signature = obj.getSignature();
if (signature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) {
try {
JavaClass cls = Repository.lookupClass(SignatureUtils.stripSignature(signature));
if (cls.implementationOf(collectionClass) || cls.implementationOf(mapClass)) {
FieldAnnotation fa = FieldAnnotation.fromVisitedField(this);
collectionFields.put(fa.getFieldName(), new FieldInfo(fa));
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
}
}
}
} } | public class class_name {
@Override
public void visitField(Field obj) {
if (obj.isPrivate()) {
String signature = obj.getSignature();
if (signature.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) {
try {
JavaClass cls = Repository.lookupClass(SignatureUtils.stripSignature(signature));
if (cls.implementationOf(collectionClass) || cls.implementationOf(mapClass)) {
FieldAnnotation fa = FieldAnnotation.fromVisitedField(this);
collectionFields.put(fa.getFieldName(), new FieldInfo(fa)); // depends on control dependency: [if], data = [none]
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
private Object writeTable(SerIterator itemIterator) {
List<Object> result = new ArrayList<>();
while (itemIterator.hasNext()) {
itemIterator.next();
Object outputKey = writeObject(itemIterator.keyType(), itemIterator.key(), null);
Object outputCol = writeObject(itemIterator.columnType(), itemIterator.column(), null);
Object outputValue = writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);
result.add(Arrays.asList(outputKey, outputCol, outputValue));
}
return result;
} } | public class class_name {
private Object writeTable(SerIterator itemIterator) {
List<Object> result = new ArrayList<>();
while (itemIterator.hasNext()) {
itemIterator.next(); // depends on control dependency: [while], data = [none]
Object outputKey = writeObject(itemIterator.keyType(), itemIterator.key(), null);
Object outputCol = writeObject(itemIterator.columnType(), itemIterator.column(), null);
Object outputValue = writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);
result.add(Arrays.asList(outputKey, outputCol, outputValue)); // depends on control dependency: [while], data = [none]
}
return result;
} } |
public class class_name {
protected void addProfilesList(Profiles profiles, String text,
String tableSummary, Content body) {
Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true,
profilesLabel);
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setTitle(profilesLabel);
String profileName;
for (int i = 1; i < profiles.getProfileCount(); i++) {
profileName = (Profile.lookup(i)).name;
// If the profile has valid packages to be documented, add it to the
// left-frame generated for profile index.
if (configuration.shouldDocumentProfile(profileName))
ul.addContent(getProfile(profileName));
}
div.addContent(ul);
body.addContent(div);
} } | public class class_name {
protected void addProfilesList(Profiles profiles, String text,
String tableSummary, Content body) {
Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true,
profilesLabel);
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setTitle(profilesLabel);
String profileName;
for (int i = 1; i < profiles.getProfileCount(); i++) {
profileName = (Profile.lookup(i)).name; // depends on control dependency: [for], data = [i]
// If the profile has valid packages to be documented, add it to the
// left-frame generated for profile index.
if (configuration.shouldDocumentProfile(profileName))
ul.addContent(getProfile(profileName));
}
div.addContent(ul);
body.addContent(div);
} } |
public class class_name {
public void recordCheckoutQueueLength(SocketDestination dest, int queueLength) {
if(dest != null) {
getOrCreateNodeStats(dest).recordCheckoutQueueLength(null, queueLength);
recordCheckoutQueueLength(null, queueLength);
} else {
this.checkoutQueueLengthHistogram.insert(queueLength);
checkMonitoringInterval();
}
} } | public class class_name {
public void recordCheckoutQueueLength(SocketDestination dest, int queueLength) {
if(dest != null) {
getOrCreateNodeStats(dest).recordCheckoutQueueLength(null, queueLength); // depends on control dependency: [if], data = [(dest]
recordCheckoutQueueLength(null, queueLength); // depends on control dependency: [if], data = [none]
} else {
this.checkoutQueueLengthHistogram.insert(queueLength); // depends on control dependency: [if], data = [none]
checkMonitoringInterval(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean appendSet(StringBuilder builder, Object value)
{
boolean isPresent = false;
if (value instanceof Collection)
{
Collection collection = ((Collection) value);
isPresent = true;
builder.append(Constants.OPEN_CURLY_BRACKET);
for (Object o : collection)
{
// Allowing null values.
appendValue(builder, o != null ? o.getClass() : null, o, false);
builder.append(Constants.COMMA);
}
if (!collection.isEmpty())
{
builder.deleteCharAt(builder.length() - 1);
}
builder.append(Constants.CLOSE_CURLY_BRACKET);
}
else
{
appendValue(builder, value.getClass(), value, false);
}
return isPresent;
} } | public class class_name {
private boolean appendSet(StringBuilder builder, Object value)
{
boolean isPresent = false;
if (value instanceof Collection)
{
Collection collection = ((Collection) value);
isPresent = true; // depends on control dependency: [if], data = [none]
builder.append(Constants.OPEN_CURLY_BRACKET); // depends on control dependency: [if], data = [none]
for (Object o : collection)
{
// Allowing null values.
appendValue(builder, o != null ? o.getClass() : null, o, false); // depends on control dependency: [for], data = [o]
builder.append(Constants.COMMA); // depends on control dependency: [for], data = [o]
}
if (!collection.isEmpty())
{
builder.deleteCharAt(builder.length() - 1); // depends on control dependency: [if], data = [none]
}
builder.append(Constants.CLOSE_CURLY_BRACKET); // depends on control dependency: [if], data = [none]
}
else
{
appendValue(builder, value.getClass(), value, false); // depends on control dependency: [if], data = [none]
}
return isPresent;
} } |
public class class_name {
protected boolean validOutcome(String outcome, Sequence sequence) {
if (outcome.equals(CONTINUE)) {
List tags = sequence.getOutcomes();
int li = tags.size() - 1;
if (li == -1) {
return false;
}
else if (((String) tags.get(li)).equals(OTHER)) {
return false;
}
}
return true;
} } | public class class_name {
protected boolean validOutcome(String outcome, Sequence sequence) {
if (outcome.equals(CONTINUE)) {
List tags = sequence.getOutcomes();
int li = tags.size() - 1;
if (li == -1) {
return false; // depends on control dependency: [if], data = [none]
}
else if (((String) tags.get(li)).equals(OTHER)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
private void inject(Object target, Field field) {
try {
/**
* Injection is actually quite a simple process. We resolve the
* field into a source of instances, and ask it to generate one.
*/
field.set(target, registrar.resolve(field).getInstance());
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new IrohException(e);
}
} } | public class class_name {
private void inject(Object target, Field field) {
try {
/**
* Injection is actually quite a simple process. We resolve the
* field into a source of instances, and ask it to generate one.
*/
field.set(target, registrar.resolve(field).getInstance()); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new IrohException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String[] toSourceArray() {
return runInCompilerThread(
() -> {
Tracer tracer = newTracer("toSourceArray");
try {
int numInputs = moduleGraph.getInputCount();
String[] sources = new String[numInputs];
CodeBuilder cb = new CodeBuilder();
int i = 0;
for (CompilerInput input : moduleGraph.getAllInputs()) {
Node scriptNode = input.getAstRoot(Compiler.this);
cb.reset();
toSource(cb, i, scriptNode);
sources[i] = cb.toString();
i++;
}
return sources;
} finally {
stopTracer(tracer, "toSourceArray");
}
});
} } | public class class_name {
public String[] toSourceArray() {
return runInCompilerThread(
() -> {
Tracer tracer = newTracer("toSourceArray");
try {
int numInputs = moduleGraph.getInputCount();
String[] sources = new String[numInputs];
CodeBuilder cb = new CodeBuilder();
int i = 0;
for (CompilerInput input : moduleGraph.getAllInputs()) {
Node scriptNode = input.getAstRoot(Compiler.this);
cb.reset(); // depends on control dependency: [for], data = [none]
toSource(cb, i, scriptNode); // depends on control dependency: [for], data = [none]
sources[i] = cb.toString(); // depends on control dependency: [for], data = [none]
i++; // depends on control dependency: [for], data = [none]
}
return sources; // depends on control dependency: [try], data = [none]
} finally {
stopTracer(tracer, "toSourceArray");
}
});
} } |
public class class_name {
private void fitImageToView() {
Drawable drawable = getDrawable();
if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) {
return;
}
if (matrix == null || prevMatrix == null) {
return;
}
int drawableWidth = drawable.getIntrinsicWidth();
int drawableHeight = drawable.getIntrinsicHeight();
//
// Scale image for view
//
float scaleX = (float) viewWidth / drawableWidth;
float scaleY = (float) viewHeight / drawableHeight;
switch (mScaleType) {
case CENTER:
scaleX = scaleY = 1;
break;
case CENTER_CROP:
scaleX = scaleY = Math.max(scaleX, scaleY);
break;
case CENTER_INSIDE:
scaleX = scaleY = Math.min(1, Math.min(scaleX, scaleY));
case FIT_CENTER:
scaleX = scaleY = Math.min(scaleX, scaleY);
break;
case FIT_XY:
break;
default:
//
// FIT_START and FIT_END not supported
//
throw new UnsupportedOperationException("TouchImageView does not support FIT_START or FIT_END");
}
//
// Center the image
//
float redundantXSpace = viewWidth - (scaleX * drawableWidth);
float redundantYSpace = viewHeight - (scaleY * drawableHeight);
matchViewWidth = viewWidth - redundantXSpace;
matchViewHeight = viewHeight - redundantYSpace;
if (!isZoomed() && !imageRenderedAtLeastOnce) {
//
// Stretch and center image to fit view
//
matrix.setScale(scaleX, scaleY);
matrix.postTranslate(redundantXSpace / 2, redundantYSpace / 2);
normalizedScale = 1;
} else {
//
// These values should never be 0 or we will set viewWidth and viewHeight
// to NaN in translateMatrixAfterRotate. To avoid this, call savePreviousImageValues
// to set them equal to the current values.
//
if (prevMatchViewWidth == 0 || prevMatchViewHeight == 0) {
savePreviousImageValues();
}
prevMatrix.getValues(m);
//
// Rescale Matrix after rotation
//
m[Matrix.MSCALE_X] = matchViewWidth / drawableWidth * normalizedScale;
m[Matrix.MSCALE_Y] = matchViewHeight / drawableHeight * normalizedScale;
//
// TransX and TransY from previous matrix
//
float transX = m[Matrix.MTRANS_X];
float transY = m[Matrix.MTRANS_Y];
//
// Width
//
float prevActualWidth = prevMatchViewWidth * normalizedScale;
float actualWidth = getImageWidth();
translateMatrixAfterRotate(Matrix.MTRANS_X, transX, prevActualWidth, actualWidth, prevViewWidth, viewWidth, drawableWidth);
//
// Height
//
float prevActualHeight = prevMatchViewHeight * normalizedScale;
float actualHeight = getImageHeight();
translateMatrixAfterRotate(Matrix.MTRANS_Y, transY, prevActualHeight, actualHeight, prevViewHeight, viewHeight, drawableHeight);
//
// Set the matrix to the adjusted scale and translate values.
//
matrix.setValues(m);
}
fixTrans();
setImageMatrix(matrix);
} } | public class class_name {
private void fitImageToView() {
Drawable drawable = getDrawable();
if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) {
return; // depends on control dependency: [if], data = [none]
}
if (matrix == null || prevMatrix == null) {
return; // depends on control dependency: [if], data = [none]
}
int drawableWidth = drawable.getIntrinsicWidth();
int drawableHeight = drawable.getIntrinsicHeight();
//
// Scale image for view
//
float scaleX = (float) viewWidth / drawableWidth;
float scaleY = (float) viewHeight / drawableHeight;
switch (mScaleType) {
case CENTER:
scaleX = scaleY = 1;
break;
case CENTER_CROP:
scaleX = scaleY = Math.max(scaleX, scaleY);
break;
case CENTER_INSIDE:
scaleX = scaleY = Math.min(1, Math.min(scaleX, scaleY));
case FIT_CENTER:
scaleX = scaleY = Math.min(scaleX, scaleY);
break;
case FIT_XY:
break;
default:
//
// FIT_START and FIT_END not supported
//
throw new UnsupportedOperationException("TouchImageView does not support FIT_START or FIT_END");
}
//
// Center the image
//
float redundantXSpace = viewWidth - (scaleX * drawableWidth);
float redundantYSpace = viewHeight - (scaleY * drawableHeight);
matchViewWidth = viewWidth - redundantXSpace;
matchViewHeight = viewHeight - redundantYSpace;
if (!isZoomed() && !imageRenderedAtLeastOnce) {
//
// Stretch and center image to fit view
//
matrix.setScale(scaleX, scaleY); // depends on control dependency: [if], data = [none]
matrix.postTranslate(redundantXSpace / 2, redundantYSpace / 2); // depends on control dependency: [if], data = [none]
normalizedScale = 1; // depends on control dependency: [if], data = [none]
} else {
//
// These values should never be 0 or we will set viewWidth and viewHeight
// to NaN in translateMatrixAfterRotate. To avoid this, call savePreviousImageValues
// to set them equal to the current values.
//
if (prevMatchViewWidth == 0 || prevMatchViewHeight == 0) {
savePreviousImageValues(); // depends on control dependency: [if], data = [none]
}
prevMatrix.getValues(m); // depends on control dependency: [if], data = [none]
//
// Rescale Matrix after rotation
//
m[Matrix.MSCALE_X] = matchViewWidth / drawableWidth * normalizedScale; // depends on control dependency: [if], data = [none]
m[Matrix.MSCALE_Y] = matchViewHeight / drawableHeight * normalizedScale; // depends on control dependency: [if], data = [none]
//
// TransX and TransY from previous matrix
//
float transX = m[Matrix.MTRANS_X];
float transY = m[Matrix.MTRANS_Y];
//
// Width
//
float prevActualWidth = prevMatchViewWidth * normalizedScale;
float actualWidth = getImageWidth();
translateMatrixAfterRotate(Matrix.MTRANS_X, transX, prevActualWidth, actualWidth, prevViewWidth, viewWidth, drawableWidth); // depends on control dependency: [if], data = [none]
//
// Height
//
float prevActualHeight = prevMatchViewHeight * normalizedScale;
float actualHeight = getImageHeight();
translateMatrixAfterRotate(Matrix.MTRANS_Y, transY, prevActualHeight, actualHeight, prevViewHeight, viewHeight, drawableHeight); // depends on control dependency: [if], data = [none]
//
// Set the matrix to the adjusted scale and translate values.
//
matrix.setValues(m); // depends on control dependency: [if], data = [none]
}
fixTrans();
setImageMatrix(matrix);
} } |
public class class_name {
public static void main(final String... args) {
// Configure command line options
final Options options = new Options();
options.addOption("c", "config", true, "use service configuration file / classpath "
+ "resource (default '" + DEFAULT_CONFIG + "')");
options.addOption("v", "version", false,
"display version and copyright information, then exit");
options.addOption("h", "help", false, "display usage information, then exit");
// Initialize exit status
int status = EX_OK;
try {
// Parse command line and handle different commands
final CommandLine cmd = new GnuParser().parse(options, args);
if (cmd.hasOption("v")) {
// Show version and copyright (http://www.gnu.org/prep/standards/standards.html)
System.out.println(String.format(
"%s (FBK KnowledgeStore) %s\njava %s bit (%s) %s\n%s", PROGRAM_EXECUTABLE,
PROGRAM_VERSION, System.getProperty("sun.arch.data.model"),
System.getProperty("java.vendor"), System.getProperty("java.version"),
PROGRAM_DISCLAIMER));
} else if (cmd.hasOption("h")) {
// Show usage (done later) and terminate
status = EX_USAGE;
} else {
// Run the service. Retrieve the configuration
final String configLocation = cmd.getOptionValue('c', DEFAULT_CONFIG);
// Differentiate between normal run, commons-daemon start, commons-daemon stop
if (cmd.getArgList().contains("__start")) {
start(configLocation); // commons-daemon start
} else if (cmd.getArgList().contains("__stop")) {
stop(); // commons-deamon stop
} else {
run(configLocation); // normal execution
}
}
} catch (final ParseException ex) {
// Display error message and then usage on syntax error
System.err.println("SYNTAX ERROR: " + ex.getMessage());
status = EX_USAGE;
} catch (final ServiceConfigurationError ex) {
// Display error message and stack trace and terminate on configuration error
System.err.println("INVALID CONFIGURATION: " + ex.getMessage());
Throwables.getRootCause(ex).printStackTrace();
status = EX_CONFIG;
} catch (final Throwable ex) {
// Display error message and stack trace on generic error
System.err.print("EXECUTION FAILED: ");
ex.printStackTrace();
status = ex instanceof IOException ? EX_IOERR : EX_UNAVAILABLE;
}
// Display usage information if necessary
if (status == EX_USAGE) {
final PrintWriter out = new PrintWriter(System.out);
final HelpFormatter formatter = new HelpFormatter();
formatter.printUsage(out, WIDTH, PROGRAM_EXECUTABLE, options);
if (PROGRAM_DESCRIPTION != null) {
formatter.printWrapped(out, WIDTH, "\n" + PROGRAM_DESCRIPTION.trim());
}
out.println("\nOptions");
formatter.printOptions(out, WIDTH, options, 2, 2);
out.flush();
}
// Display exit status for convenience
if (status != EX_OK) {
System.err.println("[exit status: " + status + "]");
} else {
System.out.println("[exit status: " + status + "]");
}
// Flush STDIN and STDOUT before exiting (we noted truncated outputs otherwise)
System.out.flush();
System.err.flush();
// Force exiting (in case there are threads still running)
System.exit(status);
} } | public class class_name {
public static void main(final String... args) {
// Configure command line options
final Options options = new Options();
options.addOption("c", "config", true, "use service configuration file / classpath "
+ "resource (default '" + DEFAULT_CONFIG + "')");
options.addOption("v", "version", false,
"display version and copyright information, then exit");
options.addOption("h", "help", false, "display usage information, then exit");
// Initialize exit status
int status = EX_OK;
try {
// Parse command line and handle different commands
final CommandLine cmd = new GnuParser().parse(options, args);
if (cmd.hasOption("v")) {
// Show version and copyright (http://www.gnu.org/prep/standards/standards.html)
System.out.println(String.format(
"%s (FBK KnowledgeStore) %s\njava %s bit (%s) %s\n%s", PROGRAM_EXECUTABLE,
PROGRAM_VERSION, System.getProperty("sun.arch.data.model"),
System.getProperty("java.vendor"), System.getProperty("java.version"),
PROGRAM_DISCLAIMER)); // depends on control dependency: [if], data = [none]
} else if (cmd.hasOption("h")) {
// Show usage (done later) and terminate
status = EX_USAGE; // depends on control dependency: [if], data = [none]
} else {
// Run the service. Retrieve the configuration
final String configLocation = cmd.getOptionValue('c', DEFAULT_CONFIG);
// Differentiate between normal run, commons-daemon start, commons-daemon stop
if (cmd.getArgList().contains("__start")) {
start(configLocation); // commons-daemon start // depends on control dependency: [if], data = [none]
} else if (cmd.getArgList().contains("__stop")) {
stop(); // commons-deamon stop // depends on control dependency: [if], data = [none]
} else {
run(configLocation); // normal execution // depends on control dependency: [if], data = [none]
}
}
} catch (final ParseException ex) {
// Display error message and then usage on syntax error
System.err.println("SYNTAX ERROR: " + ex.getMessage());
status = EX_USAGE;
} catch (final ServiceConfigurationError ex) { // depends on control dependency: [catch], data = [none]
// Display error message and stack trace and terminate on configuration error
System.err.println("INVALID CONFIGURATION: " + ex.getMessage());
Throwables.getRootCause(ex).printStackTrace();
status = EX_CONFIG;
} catch (final Throwable ex) { // depends on control dependency: [catch], data = [none]
// Display error message and stack trace on generic error
System.err.print("EXECUTION FAILED: ");
ex.printStackTrace();
status = ex instanceof IOException ? EX_IOERR : EX_UNAVAILABLE;
} // depends on control dependency: [catch], data = [none]
// Display usage information if necessary
if (status == EX_USAGE) {
final PrintWriter out = new PrintWriter(System.out);
final HelpFormatter formatter = new HelpFormatter();
formatter.printUsage(out, WIDTH, PROGRAM_EXECUTABLE, options); // depends on control dependency: [if], data = [none]
if (PROGRAM_DESCRIPTION != null) {
formatter.printWrapped(out, WIDTH, "\n" + PROGRAM_DESCRIPTION.trim()); // depends on control dependency: [if], data = [none]
}
out.println("\nOptions"); // depends on control dependency: [if], data = [none]
formatter.printOptions(out, WIDTH, options, 2, 2); // depends on control dependency: [if], data = [none]
out.flush(); // depends on control dependency: [if], data = [none]
}
// Display exit status for convenience
if (status != EX_OK) {
System.err.println("[exit status: " + status + "]"); // depends on control dependency: [if], data = [none]
} else {
System.out.println("[exit status: " + status + "]"); // depends on control dependency: [if], data = [none]
}
// Flush STDIN and STDOUT before exiting (we noted truncated outputs otherwise)
System.out.flush();
System.err.flush();
// Force exiting (in case there are threads still running)
System.exit(status);
} } |
public class class_name {
private HttpEntity<?> createHttpEntity(HttpHeaders httpHeaders, Object payload, HttpMethod method) {
if (httpMethodSupportsBody(method)) {
return new HttpEntity<>(payload, httpHeaders);
} else {
return new HttpEntity<>(httpHeaders);
}
} } | public class class_name {
private HttpEntity<?> createHttpEntity(HttpHeaders httpHeaders, Object payload, HttpMethod method) {
if (httpMethodSupportsBody(method)) {
return new HttpEntity<>(payload, httpHeaders); // depends on control dependency: [if], data = [none]
} else {
return new HttpEntity<>(httpHeaders); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getConfigAttributeWithDefaultValue(Map<String, Object> props, String key, String defaultValue) {
String result = getAndTrimConfigAttribute(props, key);
if (key != null && result == null) {
if (defaultValue != null) {
result = defaultValue;
}
}
return result;
} } | public class class_name {
public String getConfigAttributeWithDefaultValue(Map<String, Object> props, String key, String defaultValue) {
String result = getAndTrimConfigAttribute(props, key);
if (key != null && result == null) {
if (defaultValue != null) {
result = defaultValue; // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
private FixedStringSearchInterpolator mainProjectInterpolator(MavenProject mainProject)
{
if (mainProject != null) {
// 5
return FixedStringSearchInterpolator.create(
new org.codehaus.plexus.interpolation.fixed.PrefixedObjectValueSource(
InterpolationConstants.PROJECT_PREFIXES, mainProject, true ),
// 6
new org.codehaus.plexus.interpolation.fixed.PrefixedPropertiesValueSource(
InterpolationConstants.PROJECT_PROPERTIES_PREFIXES, mainProject.getProperties(), true ) );
}
else {
return FixedStringSearchInterpolator.empty();
}
} } | public class class_name {
private FixedStringSearchInterpolator mainProjectInterpolator(MavenProject mainProject)
{
if (mainProject != null) {
// 5
return FixedStringSearchInterpolator.create(
new org.codehaus.plexus.interpolation.fixed.PrefixedObjectValueSource(
InterpolationConstants.PROJECT_PREFIXES, mainProject, true ),
// 6
new org.codehaus.plexus.interpolation.fixed.PrefixedPropertiesValueSource(
InterpolationConstants.PROJECT_PROPERTIES_PREFIXES, mainProject.getProperties(), true ) ); // depends on control dependency: [if], data = [none]
}
else {
return FixedStringSearchInterpolator.empty(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void read() {
String pid = "-1";
try {
pid = getProcessId();
_pid = pid;
}
catch (Exception ignore) {}
File f = new File ("/proc/stat");
if (! f.exists()) {
return;
}
try {
readSystemProcFile();
readProcessProcFile(pid);
readProcessNumOpenFds(pid);
readProcessStatusFile(pid);
parseSystemProcFile(_systemData);
parseProcessProcFile(_processData);
parseProcessStatusFile(_processStatus);
}
catch (Exception ignore) {}
} } | public class class_name {
public void read() {
String pid = "-1";
try {
pid = getProcessId(); // depends on control dependency: [try], data = [none]
_pid = pid; // depends on control dependency: [try], data = [none]
}
catch (Exception ignore) {} // depends on control dependency: [catch], data = [none]
File f = new File ("/proc/stat");
if (! f.exists()) {
return; // depends on control dependency: [if], data = [none]
}
try {
readSystemProcFile(); // depends on control dependency: [try], data = [none]
readProcessProcFile(pid); // depends on control dependency: [try], data = [none]
readProcessNumOpenFds(pid); // depends on control dependency: [try], data = [none]
readProcessStatusFile(pid); // depends on control dependency: [try], data = [none]
parseSystemProcFile(_systemData); // depends on control dependency: [try], data = [none]
parseProcessProcFile(_processData); // depends on control dependency: [try], data = [none]
parseProcessStatusFile(_processStatus); // depends on control dependency: [try], data = [none]
}
catch (Exception ignore) {} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void started(Container moduleContainer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "application started. moduleContainer: " + moduleContainer.getName());
WebAppConfiguration webAppConfig;
try {
webAppConfig = (WebAppConfiguration) moduleContainer.adapt(WebAppConfig.class);
WebApp webApp = webAppConfig.getWebApp();
SessionCookieConfig sccfg = webApp.getSessionCookieConfig();
GeneratePluginConfigListener gpcl = GeneratePluginConfigListener.getGeneratePluginConfigListener();
if (gpcl != null) {
gpcl.applicationInitialized(webApp, sccfg);
}
} catch (UnableToAdaptException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "application started. cannot adapt to webapp - ignore");
}
} } | public class class_name {
@Override
public void started(Container moduleContainer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "application started. moduleContainer: " + moduleContainer.getName());
WebAppConfiguration webAppConfig;
try {
webAppConfig = (WebAppConfiguration) moduleContainer.adapt(WebAppConfig.class); // depends on control dependency: [try], data = [none]
WebApp webApp = webAppConfig.getWebApp();
SessionCookieConfig sccfg = webApp.getSessionCookieConfig();
GeneratePluginConfigListener gpcl = GeneratePluginConfigListener.getGeneratePluginConfigListener();
if (gpcl != null) {
gpcl.applicationInitialized(webApp, sccfg); // depends on control dependency: [if], data = [none]
}
} catch (UnableToAdaptException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "application started. cannot adapt to webapp - ignore");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public Content getPropertyDetails(Content propertyDetailsTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(propertyDetailsTree));
return htmlTree;
}
return getMemberTree(propertyDetailsTree);
} } | public class class_name {
@Override
public Content getPropertyDetails(Content propertyDetailsTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(propertyDetailsTree));
return htmlTree; // depends on control dependency: [if], data = [none]
}
return getMemberTree(propertyDetailsTree);
} } |
public class class_name {
private void parseGroupPattern(String groupPattern) {
List<String> patternList = StrUtil.split(groupPattern, '|');
for (String pattern : patternList) {
parseSinglePattern(pattern);
}
} } | public class class_name {
private void parseGroupPattern(String groupPattern) {
List<String> patternList = StrUtil.split(groupPattern, '|');
for (String pattern : patternList) {
parseSinglePattern(pattern);
// depends on control dependency: [for], data = [pattern]
}
} } |
public class class_name {
private WriterFlushResult updateStatePostFlush(FlushArgs flushArgs) {
// Update the metadata Storage Length.
long newLength = this.metadata.getStorageLength() + flushArgs.getLength();
this.metadata.setStorageLength(newLength);
// Remove operations from the outstanding list as long as every single byte it contains has been committed.
boolean reachedEnd = false;
while (this.operations.size() > 0 && !reachedEnd) {
StorageOperation first = this.operations.getFirst();
long lastOffset = first.getLastStreamSegmentOffset();
reachedEnd = lastOffset >= newLength;
// Verify that if we did reach the 'newLength' offset, we were on an append operation. Anything else is indicative of a bug.
assert reachedEnd || isAppendOperation(first) : "Flushed operation was not an Append.";
if (lastOffset <= newLength && isAppendOperation(first)) {
this.operations.removeFirst();
}
}
// Update the last flush checkpoint.
this.lastFlush.set(this.timer.getElapsed());
return new WriterFlushResult().withFlushedBytes(flushArgs.getLength())
.withFlushedAttributes(flushArgs.getAttributes().size());
} } | public class class_name {
private WriterFlushResult updateStatePostFlush(FlushArgs flushArgs) {
// Update the metadata Storage Length.
long newLength = this.metadata.getStorageLength() + flushArgs.getLength();
this.metadata.setStorageLength(newLength);
// Remove operations from the outstanding list as long as every single byte it contains has been committed.
boolean reachedEnd = false;
while (this.operations.size() > 0 && !reachedEnd) {
StorageOperation first = this.operations.getFirst();
long lastOffset = first.getLastStreamSegmentOffset();
reachedEnd = lastOffset >= newLength; // depends on control dependency: [while], data = [none]
// Verify that if we did reach the 'newLength' offset, we were on an append operation. Anything else is indicative of a bug.
assert reachedEnd || isAppendOperation(first) : "Flushed operation was not an Append."; // depends on control dependency: [while], data = [none] // depends on control dependency: [while], data = [none]
if (lastOffset <= newLength && isAppendOperation(first)) {
this.operations.removeFirst(); // depends on control dependency: [if], data = [none]
}
}
// Update the last flush checkpoint.
this.lastFlush.set(this.timer.getElapsed());
return new WriterFlushResult().withFlushedBytes(flushArgs.getLength())
.withFlushedAttributes(flushArgs.getAttributes().size());
} } |
public class class_name {
public void marshall(EngineAttribute engineAttribute, ProtocolMarshaller protocolMarshaller) {
if (engineAttribute == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(engineAttribute.getName(), NAME_BINDING);
protocolMarshaller.marshall(engineAttribute.getValue(), VALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(EngineAttribute engineAttribute, ProtocolMarshaller protocolMarshaller) {
if (engineAttribute == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(engineAttribute.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(engineAttribute.getValue(), VALUE_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 {
private void generateSheet(Workbook workbook, List<?> data, List<String> header, String sheetName) {
Sheet sheet;
if (null != sheetName && !"".equals(sheetName)) {
sheet = workbook.createSheet(sheetName);
} else {
sheet = workbook.createSheet();
}
int rowIndex = 0;
if (null != header && header.size() > 0) {
// 写标题
Row row = sheet.createRow(rowIndex++);
for (int i = 0; i < header.size(); i++) {
row.createCell(i, CellType.STRING).setCellValue(header.get(i));
}
}
for (Object object : data) {
Row row = sheet.createRow(rowIndex++);
if (object.getClass().isArray()) {
for (int j = 0; j < Array.getLength(object); j++) {
row.createCell(j, CellType.STRING).setCellValue(Array.get(object, j).toString());
}
} else if (object instanceof Collection) {
Collection<?> items = (Collection<?>) object;
int j = 0;
for (Object item : items) {
row.createCell(j++, CellType.STRING).setCellValue(item.toString());
}
} else {
row.createCell(0, CellType.STRING).setCellValue(object.toString());
}
}
} } | public class class_name {
private void generateSheet(Workbook workbook, List<?> data, List<String> header, String sheetName) {
Sheet sheet;
if (null != sheetName && !"".equals(sheetName)) {
sheet = workbook.createSheet(sheetName); // depends on control dependency: [if], data = [none]
} else {
sheet = workbook.createSheet(); // depends on control dependency: [if], data = [none]
}
int rowIndex = 0;
if (null != header && header.size() > 0) {
// 写标题
Row row = sheet.createRow(rowIndex++);
for (int i = 0; i < header.size(); i++) {
row.createCell(i, CellType.STRING).setCellValue(header.get(i)); // depends on control dependency: [for], data = [i]
}
}
for (Object object : data) {
Row row = sheet.createRow(rowIndex++);
if (object.getClass().isArray()) {
for (int j = 0; j < Array.getLength(object); j++) {
row.createCell(j, CellType.STRING).setCellValue(Array.get(object, j).toString()); // depends on control dependency: [for], data = [j]
}
} else if (object instanceof Collection) {
Collection<?> items = (Collection<?>) object;
int j = 0;
for (Object item : items) {
row.createCell(j++, CellType.STRING).setCellValue(item.toString()); // depends on control dependency: [for], data = [item]
}
} else {
row.createCell(0, CellType.STRING).setCellValue(object.toString()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private ClassReference processType(Type type, TypeReferenceLocation typeReferenceLocation, int lineNumber, int columnNumber, int length,
String line)
{
if (type == null)
return null;
ITypeBinding resolveBinding = type.resolveBinding();
if (resolveBinding == null)
{
ResolveClassnameResult resolvedResult = resolveClassname(type.toString());
ResolutionStatus status = resolvedResult.found ? ResolutionStatus.RECOVERED : ResolutionStatus.UNRESOLVED;
PackageAndClassName packageAndClassName = PackageAndClassName.parseFromQualifiedName(resolvedResult.result);
return processTypeAsString(resolvedResult.result, packageAndClassName.packageName, packageAndClassName.className, status,
typeReferenceLocation, lineNumber,
columnNumber, length, line);
}
else
{
return processTypeBinding(type.resolveBinding(), ResolutionStatus.RESOLVED, typeReferenceLocation, lineNumber,
columnNumber, length, line);
}
} } | public class class_name {
private ClassReference processType(Type type, TypeReferenceLocation typeReferenceLocation, int lineNumber, int columnNumber, int length,
String line)
{
if (type == null)
return null;
ITypeBinding resolveBinding = type.resolveBinding();
if (resolveBinding == null)
{
ResolveClassnameResult resolvedResult = resolveClassname(type.toString());
ResolutionStatus status = resolvedResult.found ? ResolutionStatus.RECOVERED : ResolutionStatus.UNRESOLVED;
PackageAndClassName packageAndClassName = PackageAndClassName.parseFromQualifiedName(resolvedResult.result);
return processTypeAsString(resolvedResult.result, packageAndClassName.packageName, packageAndClassName.className, status,
typeReferenceLocation, lineNumber,
columnNumber, length, line); // depends on control dependency: [if], data = [none]
}
else
{
return processTypeBinding(type.resolveBinding(), ResolutionStatus.RESOLVED, typeReferenceLocation, lineNumber,
columnNumber, length, line); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(ListSqlInjectionMatchSetsRequest listSqlInjectionMatchSetsRequest, ProtocolMarshaller protocolMarshaller) {
if (listSqlInjectionMatchSetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listSqlInjectionMatchSetsRequest.getNextMarker(), NEXTMARKER_BINDING);
protocolMarshaller.marshall(listSqlInjectionMatchSetsRequest.getLimit(), LIMIT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListSqlInjectionMatchSetsRequest listSqlInjectionMatchSetsRequest, ProtocolMarshaller protocolMarshaller) {
if (listSqlInjectionMatchSetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listSqlInjectionMatchSetsRequest.getNextMarker(), NEXTMARKER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listSqlInjectionMatchSetsRequest.getLimit(), LIMIT_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 {
public synchronized void reset(Reader input) {
this.input = input;
context.reset();
for(ISegmenter segmenter : segmenters){
segmenter.reset();
}
} } | public class class_name {
public synchronized void reset(Reader input) {
this.input = input;
context.reset();
for(ISegmenter segmenter : segmenters){
segmenter.reset();
// depends on control dependency: [for], data = [segmenter]
}
} } |
public class class_name {
public final AntlrDatatypeRuleToken ruleOpUnary() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
enterRule();
try {
// InternalPureXbase.g:2089:2: ( (kw= '!' | kw= '-' | kw= '+' ) )
// InternalPureXbase.g:2090:2: (kw= '!' | kw= '-' | kw= '+' )
{
// InternalPureXbase.g:2090:2: (kw= '!' | kw= '-' | kw= '+' )
int alt37=3;
switch ( input.LA(1) ) {
case 50:
{
alt37=1;
}
break;
case 45:
{
alt37=2;
}
break;
case 44:
{
alt37=3;
}
break;
default:
if (state.backtracking>0) {state.failed=true; return current;}
NoViableAltException nvae =
new NoViableAltException("", 37, 0, input);
throw nvae;
}
switch (alt37) {
case 1 :
// InternalPureXbase.g:2091:3: kw= '!'
{
kw=(Token)match(input,50,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getOpUnaryAccess().getExclamationMarkKeyword_0());
}
}
break;
case 2 :
// InternalPureXbase.g:2097:3: kw= '-'
{
kw=(Token)match(input,45,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getOpUnaryAccess().getHyphenMinusKeyword_1());
}
}
break;
case 3 :
// InternalPureXbase.g:2103:3: kw= '+'
{
kw=(Token)match(input,44,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getOpUnaryAccess().getPlusSignKeyword_2());
}
}
break;
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final AntlrDatatypeRuleToken ruleOpUnary() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
enterRule();
try {
// InternalPureXbase.g:2089:2: ( (kw= '!' | kw= '-' | kw= '+' ) )
// InternalPureXbase.g:2090:2: (kw= '!' | kw= '-' | kw= '+' )
{
// InternalPureXbase.g:2090:2: (kw= '!' | kw= '-' | kw= '+' )
int alt37=3;
switch ( input.LA(1) ) {
case 50:
{
alt37=1;
}
break;
case 45:
{
alt37=2;
}
break;
case 44:
{
alt37=3;
}
break;
default:
if (state.backtracking>0) {state.failed=true; return current;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 37, 0, input);
throw nvae;
}
switch (alt37) {
case 1 :
// InternalPureXbase.g:2091:3: kw= '!'
{
kw=(Token)match(input,50,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw); // depends on control dependency: [if], data = [none]
newLeafNode(kw, grammarAccess.getOpUnaryAccess().getExclamationMarkKeyword_0()); // depends on control dependency: [if], data = [none]
}
}
break;
case 2 :
// InternalPureXbase.g:2097:3: kw= '-'
{
kw=(Token)match(input,45,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw); // depends on control dependency: [if], data = [none]
newLeafNode(kw, grammarAccess.getOpUnaryAccess().getHyphenMinusKeyword_1()); // depends on control dependency: [if], data = [none]
}
}
break;
case 3 :
// InternalPureXbase.g:2103:3: kw= '+'
{
kw=(Token)match(input,44,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw); // depends on control dependency: [if], data = [none]
newLeafNode(kw, grammarAccess.getOpUnaryAccess().getPlusSignKeyword_2()); // depends on control dependency: [if], data = [none]
}
}
break;
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
public Instant truncatedTo(TemporalUnit unit) {
if (unit == ChronoUnit.NANOS) {
return this;
}
Duration unitDur = unit.getDuration();
if (unitDur.getSeconds() > LocalTime.SECONDS_PER_DAY) {
throw new UnsupportedTemporalTypeException("Unit is too large to be used for truncation");
}
long dur = unitDur.toNanos();
if ((LocalTime.NANOS_PER_DAY % dur) != 0) {
throw new UnsupportedTemporalTypeException("Unit must divide into a standard day without remainder");
}
long nod = (seconds % LocalTime.SECONDS_PER_DAY) * LocalTime.NANOS_PER_SECOND + nanos;
long result = (nod / dur) * dur;
return plusNanos(result - nod);
} } | public class class_name {
public Instant truncatedTo(TemporalUnit unit) {
if (unit == ChronoUnit.NANOS) {
return this; // depends on control dependency: [if], data = [none]
}
Duration unitDur = unit.getDuration();
if (unitDur.getSeconds() > LocalTime.SECONDS_PER_DAY) {
throw new UnsupportedTemporalTypeException("Unit is too large to be used for truncation");
}
long dur = unitDur.toNanos();
if ((LocalTime.NANOS_PER_DAY % dur) != 0) {
throw new UnsupportedTemporalTypeException("Unit must divide into a standard day without remainder");
}
long nod = (seconds % LocalTime.SECONDS_PER_DAY) * LocalTime.NANOS_PER_SECOND + nanos;
long result = (nod / dur) * dur;
return plusNanos(result - nod);
} } |
public class class_name {
protected void initSettingsObject() {
Object o;
if (CmsStringUtil.isEmpty(getParamAction())) {
o = new CmsSearchReplaceSettings();
} else {
// this is not the initial call, get the job object from session
o = getDialogObject();
}
if (o == null) {
// create a new export handler object
m_settings = new CmsSearchReplaceSettings();
} else {
// reuse export handler object stored in session
m_settings = (CmsSearchReplaceSettings)o;
}
} } | public class class_name {
protected void initSettingsObject() {
Object o;
if (CmsStringUtil.isEmpty(getParamAction())) {
o = new CmsSearchReplaceSettings(); // depends on control dependency: [if], data = [none]
} else {
// this is not the initial call, get the job object from session
o = getDialogObject(); // depends on control dependency: [if], data = [none]
}
if (o == null) {
// create a new export handler object
m_settings = new CmsSearchReplaceSettings(); // depends on control dependency: [if], data = [none]
} else {
// reuse export handler object stored in session
m_settings = (CmsSearchReplaceSettings)o; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private IIOMetadataNode getNode(IIOMetadataNode rootNode, String nodeName) {
IIOMetadataNode[] nodes = new IIOMetadataNode[rootNode.getLength()];
for (int i = 0; i < rootNode.getLength(); i++) {
nodes[i] = (IIOMetadataNode) rootNode.item(i);
}
return Arrays.stream(nodes)
.filter(n -> n.getNodeName().equalsIgnoreCase(nodeName))
.findFirst().orElseGet(() -> {
IIOMetadataNode node = new IIOMetadataNode(nodeName);
rootNode.appendChild(node);
return node;
});
} } | public class class_name {
private IIOMetadataNode getNode(IIOMetadataNode rootNode, String nodeName) {
IIOMetadataNode[] nodes = new IIOMetadataNode[rootNode.getLength()];
for (int i = 0; i < rootNode.getLength(); i++) {
nodes[i] = (IIOMetadataNode) rootNode.item(i); // depends on control dependency: [for], data = [i]
}
return Arrays.stream(nodes)
.filter(n -> n.getNodeName().equalsIgnoreCase(nodeName))
.findFirst().orElseGet(() -> {
IIOMetadataNode node = new IIOMetadataNode(nodeName);
rootNode.appendChild(node);
return node;
});
} } |
public class class_name {
static String serialize(UUID uuid) {
StringBuilder sb = new StringBuilder();
// Get UUID type version
ByteBuffer bb = UUIDType.instance.decompose(uuid);
int version = (bb.get(bb.position() + 6) >> 4) & 0x0f;
// Add version at the beginning
sb.append(ByteBufferUtils.toHex((byte) version));
// If it's a time based UUID, add the UNIX timestamp
if (version == 1) {
long timestamp = uuid.timestamp();
String timestampHex = ByteBufferUtils.toHex(Longs.toByteArray(timestamp));
sb.append(timestampHex);
}
// Add the UUID itself
sb.append(ByteBufferUtils.toHex(bb));
return sb.toString();
} } | public class class_name {
static String serialize(UUID uuid) {
StringBuilder sb = new StringBuilder();
// Get UUID type version
ByteBuffer bb = UUIDType.instance.decompose(uuid);
int version = (bb.get(bb.position() + 6) >> 4) & 0x0f;
// Add version at the beginning
sb.append(ByteBufferUtils.toHex((byte) version));
// If it's a time based UUID, add the UNIX timestamp
if (version == 1) {
long timestamp = uuid.timestamp();
String timestampHex = ByteBufferUtils.toHex(Longs.toByteArray(timestamp));
sb.append(timestampHex); // depends on control dependency: [if], data = [none]
}
// Add the UUID itself
sb.append(ByteBufferUtils.toHex(bb));
return sb.toString();
} } |
public class class_name {
@Override
public synchronized boolean removeHost(Host host, boolean refresh) {
HostConnectionPool<CL> pool = hosts.remove(host);
if (pool != null) {
topology.removePool(pool);
rebuildPartitions();
monitor.onHostRemoved(host);
pool.shutdown();
return true;
}
else {
return false;
}
} } | public class class_name {
@Override
public synchronized boolean removeHost(Host host, boolean refresh) {
HostConnectionPool<CL> pool = hosts.remove(host);
if (pool != null) {
topology.removePool(pool); // depends on control dependency: [if], data = [(pool]
rebuildPartitions(); // depends on control dependency: [if], data = [none]
monitor.onHostRemoved(host); // depends on control dependency: [if], data = [none]
pool.shutdown(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String getAccessLog(String ip, User visitor, Integer userId, String browser,
String url, long elapsedTime) {
StringBuilder sb = new StringBuilder();
sb.append(null != ip ? ip : "unknown").append("\t");
if (visitor == null) {
sb.append("-\t-\t");
} else {
if (userId == null) {
sb.append("-\t");
} else {
sb.append(
visitor.getUserId() == userId ? AccessLogType.PORTAL_USER
: AccessLogType.MANAGER).append("\t");
}
sb.append(visitor.getUserId()).append(",").append(visitor.getUserName()).append(",")
.append(visitor.getRoles()).append("\t");
}
sb.append(null != userId ? userId : "-").append("\t");
sb.append(url).append("\t");
sb.append(browser).append("\t");
sb.append(elapsedTime).append("ms");
return sb.toString();
} } | public class class_name {
private String getAccessLog(String ip, User visitor, Integer userId, String browser,
String url, long elapsedTime) {
StringBuilder sb = new StringBuilder();
sb.append(null != ip ? ip : "unknown").append("\t");
if (visitor == null) {
sb.append("-\t-\t"); // depends on control dependency: [if], data = [none]
} else {
if (userId == null) {
sb.append("-\t"); // depends on control dependency: [if], data = [none]
} else {
sb.append(
visitor.getUserId() == userId ? AccessLogType.PORTAL_USER
: AccessLogType.MANAGER).append("\t"); // depends on control dependency: [if], data = [none]
}
sb.append(visitor.getUserId()).append(",").append(visitor.getUserName()).append(",")
.append(visitor.getRoles()).append("\t"); // depends on control dependency: [if], data = [(visitor]
}
sb.append(null != userId ? userId : "-").append("\t");
sb.append(url).append("\t");
sb.append(browser).append("\t");
sb.append(elapsedTime).append("ms");
return sb.toString();
} } |
public class class_name {
public void setRequestMethods(String... requestMethods) {
this.allowedMethods = requestMethods;
if (this.allowedMethods != null) {
for (int i = 0; i < this.allowedMethods.length; i++) {
this.allowedMethods[i] = this.allowedMethods[i].toUpperCase();
}
}
} } | public class class_name {
public void setRequestMethods(String... requestMethods) {
this.allowedMethods = requestMethods;
if (this.allowedMethods != null) {
for (int i = 0; i < this.allowedMethods.length; i++) {
this.allowedMethods[i] = this.allowedMethods[i].toUpperCase(); // depends on control dependency: [for], data = [i]
}
}
} } |
public class class_name {
private void initialize(@StyleRes final int themeResourceId) {
int themeId = themeResourceId;
if (themeId == 0) {
TypedValue typedValue = new TypedValue();
getContext().getTheme().resolveAttribute(R.attr.materialDialogTheme, typedValue, true);
themeId = typedValue.resourceId;
themeId = themeId != 0 ? themeId : R.style.MaterialDialog_Light;
}
setContext(new ContextThemeWrapper(getContext(), themeId));
this.themeResourceId = themeId;
obtainStyledAttributes(themeId);
} } | public class class_name {
private void initialize(@StyleRes final int themeResourceId) {
int themeId = themeResourceId;
if (themeId == 0) {
TypedValue typedValue = new TypedValue();
getContext().getTheme().resolveAttribute(R.attr.materialDialogTheme, typedValue, true); // depends on control dependency: [if], data = [none]
themeId = typedValue.resourceId; // depends on control dependency: [if], data = [none]
themeId = themeId != 0 ? themeId : R.style.MaterialDialog_Light; // depends on control dependency: [if], data = [none]
}
setContext(new ContextThemeWrapper(getContext(), themeId));
this.themeResourceId = themeId;
obtainStyledAttributes(themeId);
} } |
public class class_name {
public By getElementLocatorForElementReference(String elementReference, String apendix) {
Map<String, By> objectReferenceMap = getObjectReferenceMap(By.class);
By elementLocator = objectReferenceMap.get(elementReference);
if (elementLocator instanceof ById) {
String xpathExpression = elementLocator.toString().replaceAll("By.id: ", "//*[@id='") + "']" + apendix;
elementLocator = By.xpath(xpathExpression);
} else if (elementLocator instanceof ByXPath) {
String xpathExpression = elementLocator.toString().replaceAll("By.xpath: ", "") + apendix;
elementLocator = By.xpath(xpathExpression);
} else {
fail("ElementLocator conversion error");
}
if (elementLocator == null) {
fail("No elementLocator is found for element name: '" + elementReference + "'. Available element references are: " + objectReferenceMap.keySet().toString());
}
return elementLocator;
} } | public class class_name {
public By getElementLocatorForElementReference(String elementReference, String apendix) {
Map<String, By> objectReferenceMap = getObjectReferenceMap(By.class);
By elementLocator = objectReferenceMap.get(elementReference);
if (elementLocator instanceof ById) {
String xpathExpression = elementLocator.toString().replaceAll("By.id: ", "//*[@id='") + "']" + apendix;
elementLocator = By.xpath(xpathExpression);
} else if (elementLocator instanceof ByXPath) {
String xpathExpression = elementLocator.toString().replaceAll("By.xpath: ", "") + apendix;
elementLocator = By.xpath(xpathExpression); // depends on control dependency: [if], data = [none]
} else {
fail("ElementLocator conversion error"); // depends on control dependency: [if], data = [none]
}
if (elementLocator == null) {
fail("No elementLocator is found for element name: '" + elementReference + "'. Available element references are: " + objectReferenceMap.keySet().toString()); // depends on control dependency: [if], data = [none]
}
return elementLocator;
} } |
public class class_name {
public void showNavMesh(boolean enabled) {
if (enabled) {
if (geoNavMesh == null) {
Geometry debugNavMesh = (Geometry) logicalEntities
.getChild("NavMesh");
this.geoNavMesh = SpatialFactory.createShape("NavMesh",
debugNavMesh.getMesh(), ColorRGBA.Green);
this.geoNavMesh.setLocalTranslation(this.geoNavMesh
.getLocalTranslation());
}
house.attachChild(geoNavMesh);
} else if (geoNavMesh != null) {
geoNavMesh.removeFromParent();
}
} } | public class class_name {
public void showNavMesh(boolean enabled) {
if (enabled) {
if (geoNavMesh == null) {
Geometry debugNavMesh = (Geometry) logicalEntities
.getChild("NavMesh");
this.geoNavMesh = SpatialFactory.createShape("NavMesh",
debugNavMesh.getMesh(), ColorRGBA.Green); // depends on control dependency: [if], data = [none]
this.geoNavMesh.setLocalTranslation(this.geoNavMesh
.getLocalTranslation()); // depends on control dependency: [if], data = [none]
}
house.attachChild(geoNavMesh); // depends on control dependency: [if], data = [none]
} else if (geoNavMesh != null) {
geoNavMesh.removeFromParent(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int calculateDyToMakeVisible(View view, int snapPreference) {
final RecyclerView.LayoutManager layoutManager = getLayoutManager();
if (!layoutManager.canScrollVertically()) {
return 0;
}
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)
view.getLayoutParams();
final int top = layoutManager.getDecoratedTop(view) - params.topMargin;
final int bottom = layoutManager.getDecoratedBottom(view) + params.bottomMargin;
final int start = layoutManager.getPaddingTop();
final int end = layoutManager.getHeight() - layoutManager.getPaddingBottom();
return calculateDtToFit(top, bottom, start, end, snapPreference);
} } | public class class_name {
public int calculateDyToMakeVisible(View view, int snapPreference) {
final RecyclerView.LayoutManager layoutManager = getLayoutManager();
if (!layoutManager.canScrollVertically()) {
return 0; // depends on control dependency: [if], data = [none]
}
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)
view.getLayoutParams();
final int top = layoutManager.getDecoratedTop(view) - params.topMargin;
final int bottom = layoutManager.getDecoratedBottom(view) + params.bottomMargin;
final int start = layoutManager.getPaddingTop();
final int end = layoutManager.getHeight() - layoutManager.getPaddingBottom();
return calculateDtToFit(top, bottom, start, end, snapPreference);
} } |
public class class_name {
public final void shiftExpression() throws RecognitionException {
int shiftExpression_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 120) ) { return; }
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1178:5: ( additiveExpression ( shiftOp additiveExpression )* )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1178:9: additiveExpression ( shiftOp additiveExpression )*
{
pushFollow(FOLLOW_additiveExpression_in_shiftExpression5337);
additiveExpression();
state._fsp--;
if (state.failed) return;
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1178:28: ( shiftOp additiveExpression )*
loop152:
while (true) {
int alt152=2;
alt152 = dfa152.predict(input);
switch (alt152) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1178:30: shiftOp additiveExpression
{
pushFollow(FOLLOW_shiftOp_in_shiftExpression5341);
shiftOp();
state._fsp--;
if (state.failed) return;
pushFollow(FOLLOW_additiveExpression_in_shiftExpression5343);
additiveExpression();
state._fsp--;
if (state.failed) return;
}
break;
default :
break loop152;
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 120, shiftExpression_StartIndex); }
}
} } | public class class_name {
public final void shiftExpression() throws RecognitionException {
int shiftExpression_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 120) ) { return; } // depends on control dependency: [if], data = [none]
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1178:5: ( additiveExpression ( shiftOp additiveExpression )* )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1178:9: additiveExpression ( shiftOp additiveExpression )*
{
pushFollow(FOLLOW_additiveExpression_in_shiftExpression5337);
additiveExpression();
state._fsp--;
if (state.failed) return;
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1178:28: ( shiftOp additiveExpression )*
loop152:
while (true) {
int alt152=2;
alt152 = dfa152.predict(input); // depends on control dependency: [while], data = [none]
switch (alt152) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1178:30: shiftOp additiveExpression
{
pushFollow(FOLLOW_shiftOp_in_shiftExpression5341);
shiftOp();
state._fsp--;
if (state.failed) return;
pushFollow(FOLLOW_additiveExpression_in_shiftExpression5343);
additiveExpression();
state._fsp--;
if (state.failed) return;
}
break;
default :
break loop152;
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 120, shiftExpression_StartIndex); } // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Optional<SectionHeader> maybeGetSectionHeaderByRVA(long rva) {
List<SectionHeader> headers = table.getSectionHeaders();
for (SectionHeader header : headers) {
VirtualLocation vLoc = getVirtualSectionLocation(header);
if (addressIsWithin(vLoc, rva)) {
return Optional.of(header);
}
}
return Optional.absent();
} } | public class class_name {
public Optional<SectionHeader> maybeGetSectionHeaderByRVA(long rva) {
List<SectionHeader> headers = table.getSectionHeaders();
for (SectionHeader header : headers) {
VirtualLocation vLoc = getVirtualSectionLocation(header);
if (addressIsWithin(vLoc, rva)) {
return Optional.of(header); // depends on control dependency: [if], data = [none]
}
}
return Optional.absent();
} } |
public class class_name {
public void generateGetterForField(JavacNode fieldNode, DiagnosticPosition pos, AccessLevel level, boolean lazy, List<JCAnnotation> onMethod) {
if (hasAnnotation(Getter.class, fieldNode)) {
//The annotation will make it happen, so we can skip it.
return;
}
createGetterForField(level, fieldNode, fieldNode, false, lazy, onMethod);
} } | public class class_name {
public void generateGetterForField(JavacNode fieldNode, DiagnosticPosition pos, AccessLevel level, boolean lazy, List<JCAnnotation> onMethod) {
if (hasAnnotation(Getter.class, fieldNode)) {
//The annotation will make it happen, so we can skip it.
return; // depends on control dependency: [if], data = [none]
}
createGetterForField(level, fieldNode, fieldNode, false, lazy, onMethod);
} } |
public class class_name {
@Override
public Logger getLogger(String name) {
// get the logger from the super impl
Logger logger = super.getLogger(name);
// At this point we don't know which concrete class to use until the
// ras/logging provider is initialized enough to provide a
// wsLogger class
if (wsLogger == null) {
return logger;
}
// The Java Logging (JSR47) spec requires that the method,
// LogManager.getLogManager().getLogger(...) returns null if the logger
// with the passed in name does not exist. However, the method
// Logger.getLogger(...)
// calls this method in order to create a new Logger object. In WAS, we
// always want the call to Logger.getLogger(...) to return an instance
// of WsLogger. If this method returns null to it (as the spec requires),
// then Logger.getLogger() would return an instance of java.util.logging.Logger
// rather than our WsLogger.
// To account for this "issue", we need to return null when a customer
// calls this method and passes in a non-existent logger name, but must
// create a new WsLogger when Logger.getLogger() calls this method. As
// such, the following code will get the current thread's stack trace
// and look for a pattern like:
// ...
// at com.ibm.ws.bootstrap.WsLogManager.getLogger ...
// at java.util.logging.Logger.getLogger ...
// ...
// If it identifies this pattern in the stacktrace, this method will
// create a new logger. If not, it will return null.
if (logger == null) {
boolean createNewLogger = false;
boolean foundCaller = false;
Exception ex = new Exception();
StackTraceElement[] ste = ex.getStackTrace();
Class<?> caller = null;
int i = 0;
while (!foundCaller && i < ste.length) {
StackTraceElement s = ste[i++];
// A) look for com.ibm.ws.bootstrap.WsLogManager.getLogger
if (s.getClassName().equals(CLASS_NAME) && s.getMethodName().equals("getLogger")) {
// B) java.util.logging.Logger.getLogger
while (!foundCaller && i < ste.length) {
s = ste[i++];
if (s.getClassName().equals("java.util.logging.Logger") && s.getMethodName().equals("getLogger")) {
createNewLogger = true;
} else if (createNewLogger) {
caller = StackFinderSingleton.instance.getCaller(i, s.getClassName());
foundCaller = caller != null;
}
}
}
}
if (createNewLogger) {
try {
logger = (Logger) wsLogger.newInstance(name, caller, null);
// constructing the new logger will add the logger to the log manager
// See the constructor com.ibm.ws.logging.internal.WsLogger.WsLogger(String, Class<?>, String)
// This is pretty unfortunate escaping of 'this' out of the constructor, but may be risky to try and fix that.
// Instead add a hack here to double check that another thread did not win in creating and adding the WsLogger instance
Logger checkLogger = super.getLogger(name);
if (checkLogger != null) {
// Simply reassign because checkLogger is for sure the one that got added.
// Not really sure what it would mean if null was returned from super.getLogger, but do nothing in that case
logger = checkLogger;
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
return logger;
} } | public class class_name {
@Override
public Logger getLogger(String name) {
// get the logger from the super impl
Logger logger = super.getLogger(name);
// At this point we don't know which concrete class to use until the
// ras/logging provider is initialized enough to provide a
// wsLogger class
if (wsLogger == null) {
return logger; // depends on control dependency: [if], data = [none]
}
// The Java Logging (JSR47) spec requires that the method,
// LogManager.getLogManager().getLogger(...) returns null if the logger
// with the passed in name does not exist. However, the method
// Logger.getLogger(...)
// calls this method in order to create a new Logger object. In WAS, we
// always want the call to Logger.getLogger(...) to return an instance
// of WsLogger. If this method returns null to it (as the spec requires),
// then Logger.getLogger() would return an instance of java.util.logging.Logger
// rather than our WsLogger.
// To account for this "issue", we need to return null when a customer
// calls this method and passes in a non-existent logger name, but must
// create a new WsLogger when Logger.getLogger() calls this method. As
// such, the following code will get the current thread's stack trace
// and look for a pattern like:
// ...
// at com.ibm.ws.bootstrap.WsLogManager.getLogger ...
// at java.util.logging.Logger.getLogger ...
// ...
// If it identifies this pattern in the stacktrace, this method will
// create a new logger. If not, it will return null.
if (logger == null) {
boolean createNewLogger = false;
boolean foundCaller = false;
Exception ex = new Exception();
StackTraceElement[] ste = ex.getStackTrace();
Class<?> caller = null; // depends on control dependency: [if], data = [none]
int i = 0;
while (!foundCaller && i < ste.length) {
StackTraceElement s = ste[i++];
// A) look for com.ibm.ws.bootstrap.WsLogManager.getLogger
if (s.getClassName().equals(CLASS_NAME) && s.getMethodName().equals("getLogger")) {
// B) java.util.logging.Logger.getLogger
while (!foundCaller && i < ste.length) {
s = ste[i++]; // depends on control dependency: [while], data = [none]
if (s.getClassName().equals("java.util.logging.Logger") && s.getMethodName().equals("getLogger")) {
createNewLogger = true; // depends on control dependency: [if], data = [none]
} else if (createNewLogger) {
caller = StackFinderSingleton.instance.getCaller(i, s.getClassName()); // depends on control dependency: [if], data = [none]
foundCaller = caller != null; // depends on control dependency: [if], data = [none]
}
}
}
}
if (createNewLogger) {
try {
logger = (Logger) wsLogger.newInstance(name, caller, null); // depends on control dependency: [try], data = [none]
// constructing the new logger will add the logger to the log manager
// See the constructor com.ibm.ws.logging.internal.WsLogger.WsLogger(String, Class<?>, String)
// This is pretty unfortunate escaping of 'this' out of the constructor, but may be risky to try and fix that.
// Instead add a hack here to double check that another thread did not win in creating and adding the WsLogger instance
Logger checkLogger = super.getLogger(name);
if (checkLogger != null) {
// Simply reassign because checkLogger is for sure the one that got added.
// Not really sure what it would mean if null was returned from super.getLogger, but do nothing in that case
logger = checkLogger; // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
}
return logger;
} } |
public class class_name {
public User deActivateUser(User userParam)
{
if(userParam != null && this.serviceTicket != null)
{
userParam.setServiceTicket(this.serviceTicket);
}
return new User(this.postJson(
userParam,
WS.Path.User.Version1.userDeActivate()));
} } | public class class_name {
public User deActivateUser(User userParam)
{
if(userParam != null && this.serviceTicket != null)
{
userParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none]
}
return new User(this.postJson(
userParam,
WS.Path.User.Version1.userDeActivate()));
} } |
public class class_name {
@Override
public RandomVariableInterface getVolatility(int timeIndex, int component) {
synchronized (volatility) {
if(volatility[timeIndex][component] == null) {
volatility[timeIndex][component] = randomVariableFactory.createRandomVariable(getTimeDiscretization().getTime(timeIndex), volatilityMatrix[timeIndex][component]);
}
}
return volatility[timeIndex][component];
} } | public class class_name {
@Override
public RandomVariableInterface getVolatility(int timeIndex, int component) {
synchronized (volatility) {
if(volatility[timeIndex][component] == null) {
volatility[timeIndex][component] = randomVariableFactory.createRandomVariable(getTimeDiscretization().getTime(timeIndex), volatilityMatrix[timeIndex][component]); // depends on control dependency: [if], data = [none]
}
}
return volatility[timeIndex][component];
} } |
public class class_name {
public static double[] minusEquals(final double[] v1, final double[] v2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
for(int i = 0; i < v1.length; i++) {
v1[i] -= v2[i];
}
return v1;
} } | public class class_name {
public static double[] minusEquals(final double[] v1, final double[] v2) {
assert v1.length == v2.length : ERR_VEC_DIMENSIONS;
for(int i = 0; i < v1.length; i++) {
v1[i] -= v2[i]; // depends on control dependency: [for], data = [i]
}
return v1;
} } |
public class class_name {
@CheckReturnValue
public Expression build(CodeChunk.Generator codeGenerator) {
ImmutableList<IfThenPair<Expression>> pairs = conditions.build();
Expression ternary = tryCreateTernary(pairs);
if (ternary != null) {
return ternary;
}
// Otherwise we need to introduce a temporary and assign to it in each branch
VariableDeclaration decl = codeGenerator.declarationBuilder().build();
Expression var = decl.ref();
ConditionalBuilder builder = null;
for (IfThenPair<Expression> oldCondition : pairs) {
Expression newConsequent = var.assign(oldCondition.consequent);
if (builder == null) {
builder = ifStatement(oldCondition.predicate, newConsequent.asStatement());
} else {
builder.addElseIf(oldCondition.predicate, newConsequent.asStatement());
}
}
if (trailingElse != null) {
builder.setElse(var.assign(trailingElse).asStatement());
}
return var.withInitialStatements(ImmutableList.of(decl, builder.build()));
} } | public class class_name {
@CheckReturnValue
public Expression build(CodeChunk.Generator codeGenerator) {
ImmutableList<IfThenPair<Expression>> pairs = conditions.build();
Expression ternary = tryCreateTernary(pairs);
if (ternary != null) {
return ternary; // depends on control dependency: [if], data = [none]
}
// Otherwise we need to introduce a temporary and assign to it in each branch
VariableDeclaration decl = codeGenerator.declarationBuilder().build();
Expression var = decl.ref();
ConditionalBuilder builder = null;
for (IfThenPair<Expression> oldCondition : pairs) {
Expression newConsequent = var.assign(oldCondition.consequent);
if (builder == null) {
builder = ifStatement(oldCondition.predicate, newConsequent.asStatement()); // depends on control dependency: [if], data = [none]
} else {
builder.addElseIf(oldCondition.predicate, newConsequent.asStatement()); // depends on control dependency: [if], data = [none]
}
}
if (trailingElse != null) {
builder.setElse(var.assign(trailingElse).asStatement()); // depends on control dependency: [if], data = [(trailingElse]
}
return var.withInitialStatements(ImmutableList.of(decl, builder.build()));
} } |
public class class_name {
@Override
public CommerceNotificationTemplate fetchByG_E_First(long groupId,
boolean enabled,
OrderByComparator<CommerceNotificationTemplate> orderByComparator) {
List<CommerceNotificationTemplate> list = findByG_E(groupId, enabled,
0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CommerceNotificationTemplate fetchByG_E_First(long groupId,
boolean enabled,
OrderByComparator<CommerceNotificationTemplate> orderByComparator) {
List<CommerceNotificationTemplate> list = findByG_E(groupId, enabled,
0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
public Result<Void> delAdminFromNS(AuthzTrans trans, HttpServletResponse resp, String ns, String id) {
TimeTaken tt = trans.start(DELETE_NS_ADMIN + ' ' + ns + ' ' + id, Env.SUB|Env.ALWAYS);
try {
Result<Void> rp = service.delAdminNS(trans, ns, id);
switch(rp.status) {
case OK:
setContentType(resp,nsRequestDF.getOutType());
return Result.ok();
default:
return Result.err(rp);
}
} catch (Exception e) {
trans.error().log(e,IN,DELETE_NS_ADMIN);
return Result.err(e);
} finally {
tt.done();
}
} } | public class class_name {
@Override
public Result<Void> delAdminFromNS(AuthzTrans trans, HttpServletResponse resp, String ns, String id) {
TimeTaken tt = trans.start(DELETE_NS_ADMIN + ' ' + ns + ' ' + id, Env.SUB|Env.ALWAYS);
try {
Result<Void> rp = service.delAdminNS(trans, ns, id);
switch(rp.status) {
case OK:
setContentType(resp,nsRequestDF.getOutType());
return Result.ok();
default:
return Result.err(rp);
}
} catch (Exception e) {
trans.error().log(e,IN,DELETE_NS_ADMIN);
return Result.err(e);
} finally {
// depends on control dependency: [catch], data = [none]
tt.done();
}
} } |
public class class_name {
private ColorRgba getTileColor(Tile tile)
{
final ColorRgba color;
if (tile == null)
{
color = NO_TILE;
}
else
{
final TileRef ref = new TileRef(tile.getSheet(), tile.getNumber());
if (!pixels.containsKey(ref))
{
color = DEFAULT_COLOR;
}
else
{
color = pixels.get(ref);
}
}
return color;
} } | public class class_name {
private ColorRgba getTileColor(Tile tile)
{
final ColorRgba color;
if (tile == null)
{
color = NO_TILE;
// depends on control dependency: [if], data = [none]
}
else
{
final TileRef ref = new TileRef(tile.getSheet(), tile.getNumber());
if (!pixels.containsKey(ref))
{
color = DEFAULT_COLOR;
// depends on control dependency: [if], data = [none]
}
else
{
color = pixels.get(ref);
// depends on control dependency: [if], data = [none]
}
}
return color;
} } |
public class class_name {
public final EObject ruleXMultiplicativeExpression() throws RecognitionException {
EObject current = null;
EObject this_XUnaryOperation_0 = null;
EObject lv_rightOperand_3_0 = null;
enterRule();
try {
// InternalPureXbase.g:1890:2: ( (this_XUnaryOperation_0= ruleXUnaryOperation ( ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) ) )* ) )
// InternalPureXbase.g:1891:2: (this_XUnaryOperation_0= ruleXUnaryOperation ( ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) ) )* )
{
// InternalPureXbase.g:1891:2: (this_XUnaryOperation_0= ruleXUnaryOperation ( ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) ) )* )
// InternalPureXbase.g:1892:3: this_XUnaryOperation_0= ruleXUnaryOperation ( ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) ) )*
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXMultiplicativeExpressionAccess().getXUnaryOperationParserRuleCall_0());
}
pushFollow(FOLLOW_29);
this_XUnaryOperation_0=ruleXUnaryOperation();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_XUnaryOperation_0;
afterParserOrEnumRuleCall();
}
// InternalPureXbase.g:1900:3: ( ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) ) )*
loop34:
do {
int alt34=2;
switch ( input.LA(1) ) {
case 46:
{
int LA34_2 = input.LA(2);
if ( (synpred19_InternalPureXbase()) ) {
alt34=1;
}
}
break;
case 47:
{
int LA34_3 = input.LA(2);
if ( (synpred19_InternalPureXbase()) ) {
alt34=1;
}
}
break;
case 48:
{
int LA34_4 = input.LA(2);
if ( (synpred19_InternalPureXbase()) ) {
alt34=1;
}
}
break;
case 49:
{
int LA34_5 = input.LA(2);
if ( (synpred19_InternalPureXbase()) ) {
alt34=1;
}
}
break;
}
switch (alt34) {
case 1 :
// InternalPureXbase.g:1901:4: ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) )
{
// InternalPureXbase.g:1901:4: ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) )
// InternalPureXbase.g:1902:5: ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) )
{
// InternalPureXbase.g:1912:5: ( () ( ( ruleOpMulti ) ) )
// InternalPureXbase.g:1913:6: () ( ( ruleOpMulti ) )
{
// InternalPureXbase.g:1913:6: ()
// InternalPureXbase.g:1914:7:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getXMultiplicativeExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0(),
current);
}
}
// InternalPureXbase.g:1920:6: ( ( ruleOpMulti ) )
// InternalPureXbase.g:1921:7: ( ruleOpMulti )
{
// InternalPureXbase.g:1921:7: ( ruleOpMulti )
// InternalPureXbase.g:1922:8: ruleOpMulti
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXMultiplicativeExpressionRule());
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXMultiplicativeExpressionAccess().getFeatureJvmIdentifiableElementCrossReference_1_0_0_1_0());
}
pushFollow(FOLLOW_3);
ruleOpMulti();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
}
}
}
}
// InternalPureXbase.g:1938:4: ( (lv_rightOperand_3_0= ruleXUnaryOperation ) )
// InternalPureXbase.g:1939:5: (lv_rightOperand_3_0= ruleXUnaryOperation )
{
// InternalPureXbase.g:1939:5: (lv_rightOperand_3_0= ruleXUnaryOperation )
// InternalPureXbase.g:1940:6: lv_rightOperand_3_0= ruleXUnaryOperation
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXMultiplicativeExpressionAccess().getRightOperandXUnaryOperationParserRuleCall_1_1_0());
}
pushFollow(FOLLOW_29);
lv_rightOperand_3_0=ruleXUnaryOperation();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXMultiplicativeExpressionRule());
}
set(
current,
"rightOperand",
lv_rightOperand_3_0,
"org.eclipse.xtext.xbase.Xbase.XUnaryOperation");
afterParserOrEnumRuleCall();
}
}
}
}
break;
default :
break loop34;
}
} while (true);
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleXMultiplicativeExpression() throws RecognitionException {
EObject current = null;
EObject this_XUnaryOperation_0 = null;
EObject lv_rightOperand_3_0 = null;
enterRule();
try {
// InternalPureXbase.g:1890:2: ( (this_XUnaryOperation_0= ruleXUnaryOperation ( ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) ) )* ) )
// InternalPureXbase.g:1891:2: (this_XUnaryOperation_0= ruleXUnaryOperation ( ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) ) )* )
{
// InternalPureXbase.g:1891:2: (this_XUnaryOperation_0= ruleXUnaryOperation ( ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) ) )* )
// InternalPureXbase.g:1892:3: this_XUnaryOperation_0= ruleXUnaryOperation ( ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) ) )*
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXMultiplicativeExpressionAccess().getXUnaryOperationParserRuleCall_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_29);
this_XUnaryOperation_0=ruleXUnaryOperation();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_XUnaryOperation_0; // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:1900:3: ( ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) ) )*
loop34:
do {
int alt34=2;
switch ( input.LA(1) ) {
case 46:
{
int LA34_2 = input.LA(2);
if ( (synpred19_InternalPureXbase()) ) {
alt34=1; // depends on control dependency: [if], data = [none]
}
}
break;
case 47:
{
int LA34_3 = input.LA(2);
if ( (synpred19_InternalPureXbase()) ) {
alt34=1; // depends on control dependency: [if], data = [none]
}
}
break;
case 48:
{
int LA34_4 = input.LA(2);
if ( (synpred19_InternalPureXbase()) ) {
alt34=1; // depends on control dependency: [if], data = [none]
}
}
break;
case 49:
{
int LA34_5 = input.LA(2);
if ( (synpred19_InternalPureXbase()) ) {
alt34=1; // depends on control dependency: [if], data = [none]
}
}
break;
}
switch (alt34) {
case 1 :
// InternalPureXbase.g:1901:4: ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) ) ( (lv_rightOperand_3_0= ruleXUnaryOperation ) )
{
// InternalPureXbase.g:1901:4: ( ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) ) )
// InternalPureXbase.g:1902:5: ( ( () ( ( ruleOpMulti ) ) ) )=> ( () ( ( ruleOpMulti ) ) )
{
// InternalPureXbase.g:1912:5: ( () ( ( ruleOpMulti ) ) )
// InternalPureXbase.g:1913:6: () ( ( ruleOpMulti ) )
{
// InternalPureXbase.g:1913:6: ()
// InternalPureXbase.g:1914:7:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getXMultiplicativeExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0(),
current); // depends on control dependency: [if], data = [none]
}
}
// InternalPureXbase.g:1920:6: ( ( ruleOpMulti ) )
// InternalPureXbase.g:1921:7: ( ruleOpMulti )
{
// InternalPureXbase.g:1921:7: ( ruleOpMulti )
// InternalPureXbase.g:1922:8: ruleOpMulti
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXMultiplicativeExpressionRule()); // depends on control dependency: [if], data = [none]
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXMultiplicativeExpressionAccess().getFeatureJvmIdentifiableElementCrossReference_1_0_0_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_3);
ruleOpMulti();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
// InternalPureXbase.g:1938:4: ( (lv_rightOperand_3_0= ruleXUnaryOperation ) )
// InternalPureXbase.g:1939:5: (lv_rightOperand_3_0= ruleXUnaryOperation )
{
// InternalPureXbase.g:1939:5: (lv_rightOperand_3_0= ruleXUnaryOperation )
// InternalPureXbase.g:1940:6: lv_rightOperand_3_0= ruleXUnaryOperation
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXMultiplicativeExpressionAccess().getRightOperandXUnaryOperationParserRuleCall_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_29);
lv_rightOperand_3_0=ruleXUnaryOperation();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXMultiplicativeExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"rightOperand",
lv_rightOperand_3_0,
"org.eclipse.xtext.xbase.Xbase.XUnaryOperation"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
default :
break loop34;
}
} while (true);
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
@Override
public String getPrefixedKey(final String key, final boolean useOnlyLocalPrefixes) {
lock.readLock().lock();
try {
final String prefix = (useOnlyLocalPrefixes) ? getLocalPrefix() : getPrefix();
return (prefix != null) ? getPrefixedKey(prefix, key) : key;
} finally {
lock.readLock().unlock();
}
} } | public class class_name {
@Override
public String getPrefixedKey(final String key, final boolean useOnlyLocalPrefixes) {
lock.readLock().lock();
try {
final String prefix = (useOnlyLocalPrefixes) ? getLocalPrefix() : getPrefix();
return (prefix != null) ? getPrefixedKey(prefix, key) : key; // depends on control dependency: [try], data = [none]
} finally {
lock.readLock().unlock();
}
} } |
public class class_name {
public ListRegexPatternSetsResult withRegexPatternSets(RegexPatternSetSummary... regexPatternSets) {
if (this.regexPatternSets == null) {
setRegexPatternSets(new java.util.ArrayList<RegexPatternSetSummary>(regexPatternSets.length));
}
for (RegexPatternSetSummary ele : regexPatternSets) {
this.regexPatternSets.add(ele);
}
return this;
} } | public class class_name {
public ListRegexPatternSetsResult withRegexPatternSets(RegexPatternSetSummary... regexPatternSets) {
if (this.regexPatternSets == null) {
setRegexPatternSets(new java.util.ArrayList<RegexPatternSetSummary>(regexPatternSets.length)); // depends on control dependency: [if], data = [none]
}
for (RegexPatternSetSummary ele : regexPatternSets) {
this.regexPatternSets.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected void postInstantiate(Object name, Map attributes, Object node) {
for (Closure postInstantiateDelegate : getProxyBuilder().getPostInstantiateDelegates()) {
(postInstantiateDelegate).call(new Object[]{this, attributes, node});
}
} } | public class class_name {
protected void postInstantiate(Object name, Map attributes, Object node) {
for (Closure postInstantiateDelegate : getProxyBuilder().getPostInstantiateDelegates()) {
(postInstantiateDelegate).call(new Object[]{this, attributes, node}); // depends on control dependency: [for], data = [postInstantiateDelegate]
}
} } |
public class class_name {
@Override
public T decode(final String s) {
checkNotNull(s);
try {
return Enum.valueOf(type, s);
} catch (final IllegalArgumentException ignored) {
}
try {
return Enum.valueOf(type, s.toUpperCase());
} catch (final IllegalArgumentException ignored) {
}
try {
return Enum.valueOf(type, s.toLowerCase());
} catch (final IllegalArgumentException ignored) {
}
throw new ConversionException(
"Unable to instantiate a " + type + " from value " + s + ". Valid values: " + Joiner
.on(", ").join(EnumSet.allOf(type)));
} } | public class class_name {
@Override
public T decode(final String s) {
checkNotNull(s);
try {
return Enum.valueOf(type, s); // depends on control dependency: [try], data = [none]
} catch (final IllegalArgumentException ignored) {
} // depends on control dependency: [catch], data = [none]
try {
return Enum.valueOf(type, s.toUpperCase()); // depends on control dependency: [try], data = [none]
} catch (final IllegalArgumentException ignored) {
} // depends on control dependency: [catch], data = [none]
try {
return Enum.valueOf(type, s.toLowerCase()); // depends on control dependency: [try], data = [none]
} catch (final IllegalArgumentException ignored) {
} // depends on control dependency: [catch], data = [none]
throw new ConversionException(
"Unable to instantiate a " + type + " from value " + s + ". Valid values: " + Joiner
.on(", ").join(EnumSet.allOf(type)));
} } |
public class class_name {
public void setAsText(final String text)
{
if (PropertyEditors.isNull(text))
{
setValue(null);
return;
}
Object newValue = Byte.decode(text);
setValue(newValue);
} } | public class class_name {
public void setAsText(final String text)
{
if (PropertyEditors.isNull(text))
{
setValue(null); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
Object newValue = Byte.decode(text);
setValue(newValue);
} } |
public class class_name {
@Override
public PropertyDescriptor[] getPropertyDescriptors() {
List<PropertyDescriptor> proplist = new ArrayList<>();
try {
proplist.add(new PropertyDescriptor("type", ELJavascriptBundleTag.class, null, "setTypeExpr"));
} catch (IntrospectionException ex) {
}
try {
proplist.add(new PropertyDescriptor("async", ELJavascriptBundleTag.class, null, "setAsync"));
} catch (IntrospectionException ex) {
}
try {
proplist.add(new PropertyDescriptor("defer", ELJavascriptBundleTag.class, null, "setDefer"));
} catch (IntrospectionException ex) {
}
try {
proplist.add(new PropertyDescriptor("src", ELJavascriptBundleTag.class, null, "setSrcExpr"));
} catch (IntrospectionException ex) {
}
try {
proplist.add(new PropertyDescriptor("useRandomParam", ELJavascriptBundleTag.class, null,
"setUseRandomParamExpr"));
} catch (IntrospectionException ex) {
}
PropertyDescriptor[] result = new PropertyDescriptor[proplist.size()];
return ((PropertyDescriptor[]) proplist.toArray(result));
} } | public class class_name {
@Override
public PropertyDescriptor[] getPropertyDescriptors() {
List<PropertyDescriptor> proplist = new ArrayList<>();
try {
proplist.add(new PropertyDescriptor("type", ELJavascriptBundleTag.class, null, "setTypeExpr")); // depends on control dependency: [try], data = [none]
} catch (IntrospectionException ex) {
} // depends on control dependency: [catch], data = [none]
try {
proplist.add(new PropertyDescriptor("async", ELJavascriptBundleTag.class, null, "setAsync")); // depends on control dependency: [try], data = [none]
} catch (IntrospectionException ex) {
} // depends on control dependency: [catch], data = [none]
try {
proplist.add(new PropertyDescriptor("defer", ELJavascriptBundleTag.class, null, "setDefer")); // depends on control dependency: [try], data = [none]
} catch (IntrospectionException ex) {
} // depends on control dependency: [catch], data = [none]
try {
proplist.add(new PropertyDescriptor("src", ELJavascriptBundleTag.class, null, "setSrcExpr")); // depends on control dependency: [try], data = [none]
} catch (IntrospectionException ex) {
} // depends on control dependency: [catch], data = [none]
try {
proplist.add(new PropertyDescriptor("useRandomParam", ELJavascriptBundleTag.class, null,
"setUseRandomParamExpr")); // depends on control dependency: [try], data = [none]
} catch (IntrospectionException ex) {
} // depends on control dependency: [catch], data = [none]
PropertyDescriptor[] result = new PropertyDescriptor[proplist.size()];
return ((PropertyDescriptor[]) proplist.toArray(result));
} } |
public class class_name {
private synchronized Map<String, Map<String, Collection<Index<Node>>>> initIndexConfiguration() {
Map<String, Map<String, Collection<Index<Node>>>> indexesByLabelAndProperty = new HashMap<>();
try (Transaction tx = graphDatabaseService.beginTx() ) {
final IndexManager indexManager = graphDatabaseService.index();
for (String indexName : indexManager.nodeIndexNames()) {
final Index<Node> index = indexManager.forNodes(indexName);
Map<String, String> indexConfig = indexManager.getConfiguration(index);
if (Util.toBoolean(indexConfig.get("autoUpdate"))) {
String labels = indexConfig.getOrDefault("labels", "");
for (String label : labels.split(":")) {
Map<String, Collection<Index<Node>>> propertyKeyToIndexMap = indexesByLabelAndProperty.computeIfAbsent(label, s -> new HashMap<>());
String[] keysForLabel = indexConfig.getOrDefault("keysForLabel:" + label, "").split(":");
for (String property : keysForLabel) {
propertyKeyToIndexMap.computeIfAbsent(property, s -> new ArrayList<>()).add(index);
}
}
}
}
tx.success();
}
return indexesByLabelAndProperty;
} } | public class class_name {
private synchronized Map<String, Map<String, Collection<Index<Node>>>> initIndexConfiguration() {
Map<String, Map<String, Collection<Index<Node>>>> indexesByLabelAndProperty = new HashMap<>();
try (Transaction tx = graphDatabaseService.beginTx() ) {
final IndexManager indexManager = graphDatabaseService.index();
for (String indexName : indexManager.nodeIndexNames()) {
final Index<Node> index = indexManager.forNodes(indexName);
Map<String, String> indexConfig = indexManager.getConfiguration(index);
if (Util.toBoolean(indexConfig.get("autoUpdate"))) {
String labels = indexConfig.getOrDefault("labels", "");
for (String label : labels.split(":")) {
Map<String, Collection<Index<Node>>> propertyKeyToIndexMap = indexesByLabelAndProperty.computeIfAbsent(label, s -> new HashMap<>());
String[] keysForLabel = indexConfig.getOrDefault("keysForLabel:" + label, "").split(":");
for (String property : keysForLabel) {
propertyKeyToIndexMap.computeIfAbsent(property, s -> new ArrayList<>()).add(index); // depends on control dependency: [for], data = [property]
}
}
}
}
tx.success();
}
return indexesByLabelAndProperty;
} } |
public class class_name {
public void setRenderingHint(Key arg0, Object arg1) {
if (arg1 != null) {
rhints.put(arg0, arg1);
} else {
if (arg0 instanceof HyperLinkKey)
{
rhints.put(arg0, HyperLinkKey.VALUE_HYPERLINKKEY_OFF);
}
else
{
rhints.remove(arg0);
}
}
} } | public class class_name {
public void setRenderingHint(Key arg0, Object arg1) {
if (arg1 != null) {
rhints.put(arg0, arg1); // depends on control dependency: [if], data = [none]
} else {
if (arg0 instanceof HyperLinkKey)
{
rhints.put(arg0, HyperLinkKey.VALUE_HYPERLINKKEY_OFF); // depends on control dependency: [if], data = [none]
}
else
{
rhints.remove(arg0); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public final void ruleXSetLiteral() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXbase.g:746:2: ( ( ( rule__XSetLiteral__Group__0 ) ) )
// InternalXbase.g:747:2: ( ( rule__XSetLiteral__Group__0 ) )
{
// InternalXbase.g:747:2: ( ( rule__XSetLiteral__Group__0 ) )
// InternalXbase.g:748:3: ( rule__XSetLiteral__Group__0 )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getXSetLiteralAccess().getGroup());
}
// InternalXbase.g:749:3: ( rule__XSetLiteral__Group__0 )
// InternalXbase.g:749:4: rule__XSetLiteral__Group__0
{
pushFollow(FOLLOW_2);
rule__XSetLiteral__Group__0();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getXSetLiteralAccess().getGroup());
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} } | public class class_name {
public final void ruleXSetLiteral() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXbase.g:746:2: ( ( ( rule__XSetLiteral__Group__0 ) ) )
// InternalXbase.g:747:2: ( ( rule__XSetLiteral__Group__0 ) )
{
// InternalXbase.g:747:2: ( ( rule__XSetLiteral__Group__0 ) )
// InternalXbase.g:748:3: ( rule__XSetLiteral__Group__0 )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getXSetLiteralAccess().getGroup()); // depends on control dependency: [if], data = [none]
}
// InternalXbase.g:749:3: ( rule__XSetLiteral__Group__0 )
// InternalXbase.g:749:4: rule__XSetLiteral__Group__0
{
pushFollow(FOLLOW_2);
rule__XSetLiteral__Group__0();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getXSetLiteralAccess().getGroup()); // depends on control dependency: [if], data = [none]
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} } |
public class class_name {
public static boolean osSensitiveEquals( String s1, String s2 )
{
if ( OS_CASE_SENSITIVE )
{
return s1.equals( s2 );
}
else
{
return s1.equalsIgnoreCase( s2 );
}
} } | public class class_name {
public static boolean osSensitiveEquals( String s1, String s2 )
{
if ( OS_CASE_SENSITIVE )
{
return s1.equals( s2 ); // depends on control dependency: [if], data = [none]
}
else
{
return s1.equalsIgnoreCase( s2 ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Iterator<ImageWriter> getImageWriters(ImageTypeSpecifier type, String formatName) {
if (type == null) {
throw new IllegalArgumentException("type == null!");
}
if (formatName == null) {
throw new IllegalArgumentException("formatName == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageWriterSpi.class, new CanEncodeImageAndFormatFilter(type, formatName), true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageWriterIterator(iter);
} } | public class class_name {
public static Iterator<ImageWriter> getImageWriters(ImageTypeSpecifier type, String formatName) {
if (type == null) {
throw new IllegalArgumentException("type == null!");
}
if (formatName == null) {
throw new IllegalArgumentException("formatName == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageWriterSpi.class, new CanEncodeImageAndFormatFilter(type, formatName), true);
// depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
// depends on control dependency: [catch], data = [none]
return new ImageWriterIterator(iter);
} } |
public class class_name {
private void loadLastSavedPreferences() {
fLastSelectedTemplateName = ""; //$NON-NLS-1$
boolean setSelection = false;
String templateName = GlassmakerUIPlugin.getDefault().getPreferenceStore().getString(HTMLUIPreferenceNames.NEW_FILE_TEMPLATE_NAME);
if (templateName == null || templateName.length() == 0) {
templateName = GlassmakerUIPlugin.getDefault().getPreferenceStore().getString(HTMLUIPreferenceNames.NEW_FILE_TEMPLATE_ID);
if (templateName != null && templateName.length() > 0) {
Template template = fTemplateStore.findTemplateById(templateName);
if (template != null) {
fLastSelectedTemplateName = template.getName();
setSelection = true;
}
}
}
else {
fLastSelectedTemplateName = templateName;
setSelection = true;
}
fUseTemplateButton.setSelection(setSelection);
enableTemplates();
} } | public class class_name {
private void loadLastSavedPreferences() {
fLastSelectedTemplateName = ""; //$NON-NLS-1$
boolean setSelection = false;
String templateName = GlassmakerUIPlugin.getDefault().getPreferenceStore().getString(HTMLUIPreferenceNames.NEW_FILE_TEMPLATE_NAME);
if (templateName == null || templateName.length() == 0) {
templateName = GlassmakerUIPlugin.getDefault().getPreferenceStore().getString(HTMLUIPreferenceNames.NEW_FILE_TEMPLATE_ID); // depends on control dependency: [if], data = [none]
if (templateName != null && templateName.length() > 0) {
Template template = fTemplateStore.findTemplateById(templateName);
if (template != null) {
fLastSelectedTemplateName = template.getName(); // depends on control dependency: [if], data = [none]
setSelection = true; // depends on control dependency: [if], data = [none]
}
}
}
else {
fLastSelectedTemplateName = templateName; // depends on control dependency: [if], data = [none]
setSelection = true; // depends on control dependency: [if], data = [none]
}
fUseTemplateButton.setSelection(setSelection);
enableTemplates();
} } |
public class class_name {
public boolean removeFieldsFromPage(int page) {
if (page < 1)
return false;
String names[] = new String[fields.size()];
fields.keySet().toArray(names);
boolean found = false;
for (int k = 0; k < names.length; ++k) {
boolean fr = removeField(names[k], page);
found = (found || fr);
}
return found;
} } | public class class_name {
public boolean removeFieldsFromPage(int page) {
if (page < 1)
return false;
String names[] = new String[fields.size()];
fields.keySet().toArray(names);
boolean found = false;
for (int k = 0; k < names.length; ++k) {
boolean fr = removeField(names[k], page);
found = (found || fr); // depends on control dependency: [for], data = [none]
}
return found;
} } |
public class class_name {
public void setBaseEndpointDnsNames(java.util.Collection<String> baseEndpointDnsNames) {
if (baseEndpointDnsNames == null) {
this.baseEndpointDnsNames = null;
return;
}
this.baseEndpointDnsNames = new com.amazonaws.internal.SdkInternalList<String>(baseEndpointDnsNames);
} } | public class class_name {
public void setBaseEndpointDnsNames(java.util.Collection<String> baseEndpointDnsNames) {
if (baseEndpointDnsNames == null) {
this.baseEndpointDnsNames = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.baseEndpointDnsNames = new com.amazonaws.internal.SdkInternalList<String>(baseEndpointDnsNames);
} } |
public class class_name {
public List<FacesConfigAttributeType<FacesConfigRendererType<T>>> getAllAttribute()
{
List<FacesConfigAttributeType<FacesConfigRendererType<T>>> list = new ArrayList<FacesConfigAttributeType<FacesConfigRendererType<T>>>();
List<Node> nodeList = childNode.get("attribute");
for(Node node: nodeList)
{
FacesConfigAttributeType<FacesConfigRendererType<T>> type = new FacesConfigAttributeTypeImpl<FacesConfigRendererType<T>>(this, "attribute", childNode, node);
list.add(type);
}
return list;
} } | public class class_name {
public List<FacesConfigAttributeType<FacesConfigRendererType<T>>> getAllAttribute()
{
List<FacesConfigAttributeType<FacesConfigRendererType<T>>> list = new ArrayList<FacesConfigAttributeType<FacesConfigRendererType<T>>>();
List<Node> nodeList = childNode.get("attribute");
for(Node node: nodeList)
{
FacesConfigAttributeType<FacesConfigRendererType<T>> type = new FacesConfigAttributeTypeImpl<FacesConfigRendererType<T>>(this, "attribute", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
public void add(ESRIPoint point) {
if (point.getX() < this.minx) {
this.minx = point.getX();
}
if (point.getX() > this.maxx) {
this.maxx = point.getX();
}
if (point.getY() < this.miny) {
this.miny = point.getY();
}
if (point.getY() > this.maxy) {
this.maxy = point.getY();
}
if (point.getZ() < this.minz) {
this.minz = point.getZ();
}
if (point.getZ() > this.maxz) {
this.maxz = point.getZ();
}
if (point.getM() < this.minm) {
this.minm = point.getM();
}
if (point.getM() > this.maxm) {
this.maxm = point.getM();
}
} } | public class class_name {
public void add(ESRIPoint point) {
if (point.getX() < this.minx) {
this.minx = point.getX(); // depends on control dependency: [if], data = [none]
}
if (point.getX() > this.maxx) {
this.maxx = point.getX(); // depends on control dependency: [if], data = [none]
}
if (point.getY() < this.miny) {
this.miny = point.getY(); // depends on control dependency: [if], data = [none]
}
if (point.getY() > this.maxy) {
this.maxy = point.getY(); // depends on control dependency: [if], data = [none]
}
if (point.getZ() < this.minz) {
this.minz = point.getZ(); // depends on control dependency: [if], data = [none]
}
if (point.getZ() > this.maxz) {
this.maxz = point.getZ(); // depends on control dependency: [if], data = [none]
}
if (point.getM() < this.minm) {
this.minm = point.getM(); // depends on control dependency: [if], data = [none]
}
if (point.getM() > this.maxm) {
this.maxm = point.getM(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Map<String, Map<String, List<DColumn>>> getColumnUpdatesMap() {
Map<String, Map<String, List<DColumn>>> storeMap = new HashMap<>();
for(ColumnUpdate mutation: getColumnUpdates()) {
String storeName = mutation.getStoreName();
String rowKey = mutation.getRowKey();
DColumn column = mutation.getColumn();
Map<String, List<DColumn>> rowMap = storeMap.get(storeName);
if(rowMap == null) {
rowMap = new HashMap<>();
storeMap.put(storeName, rowMap);
}
List<DColumn> columnsList = rowMap.get(rowKey);
if(columnsList == null) {
columnsList = new ArrayList<>();
rowMap.put(rowKey, columnsList);
}
columnsList.add(column);
}
return storeMap;
} } | public class class_name {
public Map<String, Map<String, List<DColumn>>> getColumnUpdatesMap() {
Map<String, Map<String, List<DColumn>>> storeMap = new HashMap<>();
for(ColumnUpdate mutation: getColumnUpdates()) {
String storeName = mutation.getStoreName();
String rowKey = mutation.getRowKey();
DColumn column = mutation.getColumn();
Map<String, List<DColumn>> rowMap = storeMap.get(storeName);
if(rowMap == null) {
rowMap = new HashMap<>();
// depends on control dependency: [if], data = [none]
storeMap.put(storeName, rowMap);
// depends on control dependency: [if], data = [none]
}
List<DColumn> columnsList = rowMap.get(rowKey);
if(columnsList == null) {
columnsList = new ArrayList<>();
// depends on control dependency: [if], data = [none]
rowMap.put(rowKey, columnsList);
// depends on control dependency: [if], data = [none]
}
columnsList.add(column);
// depends on control dependency: [for], data = [none]
}
return storeMap;
} } |
public class class_name {
@Override
public void setFromCorners(double x1, double y1, double z1, double x2, double y2, double z2) {
if (x1<x2) {
this.minxProperty.set(x1);
this.maxxProperty.set(x2);
}
else {
this.minxProperty.set(x2);
this.maxxProperty.set(x1);
}
if (y1<y2) {
this.minyProperty.set(y1);
this.maxyProperty.set(y2);
}
else {
this.minyProperty.set(y2);
this.maxyProperty.set(y1);
}
if (z1<z2) {
this.minzProperty.set(z1);
this.maxzProperty.set(z2);
}
else {
this.minzProperty.set(z2);
this.maxzProperty.set(z1);
}
} } | public class class_name {
@Override
public void setFromCorners(double x1, double y1, double z1, double x2, double y2, double z2) {
if (x1<x2) {
this.minxProperty.set(x1); // depends on control dependency: [if], data = [(x1]
this.maxxProperty.set(x2); // depends on control dependency: [if], data = [x2)]
}
else {
this.minxProperty.set(x2); // depends on control dependency: [if], data = [x2)]
this.maxxProperty.set(x1); // depends on control dependency: [if], data = [(x1]
}
if (y1<y2) {
this.minyProperty.set(y1); // depends on control dependency: [if], data = [(y1]
this.maxyProperty.set(y2); // depends on control dependency: [if], data = [y2)]
}
else {
this.minyProperty.set(y2); // depends on control dependency: [if], data = [y2)]
this.maxyProperty.set(y1); // depends on control dependency: [if], data = [(y1]
}
if (z1<z2) {
this.minzProperty.set(z1); // depends on control dependency: [if], data = [(z1]
this.maxzProperty.set(z2); // depends on control dependency: [if], data = [z2)]
}
else {
this.minzProperty.set(z2); // depends on control dependency: [if], data = [z2)]
this.maxzProperty.set(z1); // depends on control dependency: [if], data = [(z1]
}
} } |
public class class_name {
private void verifiedCopyFile(File sourceFile, File destFile) throws IOException {
if(!destFile.exists()) {
destFile.createNewFile();
}
FileInputStream source = null;
FileOutputStream destination = null;
LogVerificationInputStream verifyStream = null;
try {
source = new FileInputStream(sourceFile);
destination = new FileOutputStream(destFile);
verifyStream = new LogVerificationInputStream(env, source, sourceFile.getName());
final byte[] buf = new byte[LOGVERIFY_BUFSIZE];
while(true) {
final int len = verifyStream.read(buf);
if(len < 0) {
break;
}
destination.write(buf, 0, len);
}
} finally {
if(verifyStream != null) {
verifyStream.close();
}
if(destination != null) {
destination.close();
}
}
} } | public class class_name {
private void verifiedCopyFile(File sourceFile, File destFile) throws IOException {
if(!destFile.exists()) {
destFile.createNewFile();
}
FileInputStream source = null;
FileOutputStream destination = null;
LogVerificationInputStream verifyStream = null;
try {
source = new FileInputStream(sourceFile);
destination = new FileOutputStream(destFile);
verifyStream = new LogVerificationInputStream(env, source, sourceFile.getName());
final byte[] buf = new byte[LOGVERIFY_BUFSIZE];
while(true) {
final int len = verifyStream.read(buf);
if(len < 0) {
break;
}
destination.write(buf, 0, len); // depends on control dependency: [while], data = [none]
}
} finally {
if(verifyStream != null) {
verifyStream.close(); // depends on control dependency: [if], data = [none]
}
if(destination != null) {
destination.close(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
static GVRPickedObject makeObjectHit(long colliderPointer, int collidableIndex, float distance, float hitx, float hity, float hitz)
{
GVRCollider collider = GVRCollider.lookup(colliderPointer);
if (collider == null)
{
Log.d("GVRBoundsPicker", "makeObjectHit: cannot find collider for %x", colliderPointer);
return null;
}
GVRPicker.GVRPickedObject hit = new GVRPicker.GVRPickedObject(collider, new float[] { hitx, hity, hitz }, distance);
hit.collidableIndex = collidableIndex;
return hit;
} } | public class class_name {
static GVRPickedObject makeObjectHit(long colliderPointer, int collidableIndex, float distance, float hitx, float hity, float hitz)
{
GVRCollider collider = GVRCollider.lookup(colliderPointer);
if (collider == null)
{
Log.d("GVRBoundsPicker", "makeObjectHit: cannot find collider for %x", colliderPointer); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
GVRPicker.GVRPickedObject hit = new GVRPicker.GVRPickedObject(collider, new float[] { hitx, hity, hitz }, distance);
hit.collidableIndex = collidableIndex;
return hit;
} } |
public class class_name {
@Override
public void gbmv(char order, char TransA, int KL, int KU, double alpha, INDArray A, INDArray X, double beta,
INDArray Y) {
if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
OpProfiler.getInstance().processBlasCall(false, A, X, Y);
// FIXME: int cast
if (A.data().dataType() == DataType.DOUBLE) {
DefaultOpExecutioner.validateDataType(DataType.DOUBLE, A, X, Y);
dgbmv(order, TransA, (int) A.rows(), (int) A.columns(), KL, KU, alpha, A, (int) A.size(0), X, X.stride(-1), beta, Y,
Y.stride(-1));
} else {
DefaultOpExecutioner.validateDataType(DataType.FLOAT, A, X, Y);
sgbmv(order, TransA, (int) A.rows(), (int) A.columns(), KL, KU, (float) alpha, A, (int) A.size(0), X, X.stride(-1), (float) beta, Y, Y.stride(-1));
}
OpExecutionerUtil.checkForAny(Y);
} } | public class class_name {
@Override
public void gbmv(char order, char TransA, int KL, int KU, double alpha, INDArray A, INDArray X, double beta,
INDArray Y) {
if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
OpProfiler.getInstance().processBlasCall(false, A, X, Y);
// FIXME: int cast
if (A.data().dataType() == DataType.DOUBLE) {
DefaultOpExecutioner.validateDataType(DataType.DOUBLE, A, X, Y); // depends on control dependency: [if], data = [none]
dgbmv(order, TransA, (int) A.rows(), (int) A.columns(), KL, KU, alpha, A, (int) A.size(0), X, X.stride(-1), beta, Y,
Y.stride(-1)); // depends on control dependency: [if], data = [none]
} else {
DefaultOpExecutioner.validateDataType(DataType.FLOAT, A, X, Y); // depends on control dependency: [if], data = [none]
sgbmv(order, TransA, (int) A.rows(), (int) A.columns(), KL, KU, (float) alpha, A, (int) A.size(0), X, X.stride(-1), (float) beta, Y, Y.stride(-1)); // depends on control dependency: [if], data = [none]
}
OpExecutionerUtil.checkForAny(Y);
} } |
public class class_name {
private void calculateMinimapAreaBounds() {
if (minimapBounds == null) {
return;
}
if (zoom == 1f) {
miniMapRequired = false;
} else {
// Calculates the bounds of the current displayed area
float x = (-currentXOffset - toCurrentScale(currentFilteredPage * optimalPageWidth)) //
/ toCurrentScale(optimalPageWidth) * minimapBounds.width();
float width = getWidth() / toCurrentScale(optimalPageWidth) * minimapBounds.width();
float y = -currentYOffset / toCurrentScale(optimalPageHeight) * minimapBounds.height();
float height = getHeight() / toCurrentScale(optimalPageHeight) * minimapBounds.height();
minimapScreenBounds = new RectF(minimapBounds.left + x, minimapBounds.top + y, //
minimapBounds.left + x + width, minimapBounds.top + y + height);
minimapScreenBounds.intersect(minimapBounds);
miniMapRequired = true;
}
} } | public class class_name {
private void calculateMinimapAreaBounds() {
if (minimapBounds == null) {
return;
// depends on control dependency: [if], data = [none]
}
if (zoom == 1f) {
miniMapRequired = false;
// depends on control dependency: [if], data = [none]
} else {
// Calculates the bounds of the current displayed area
float x = (-currentXOffset - toCurrentScale(currentFilteredPage * optimalPageWidth)) //
/ toCurrentScale(optimalPageWidth) * minimapBounds.width();
float width = getWidth() / toCurrentScale(optimalPageWidth) * minimapBounds.width();
float y = -currentYOffset / toCurrentScale(optimalPageHeight) * minimapBounds.height();
float height = getHeight() / toCurrentScale(optimalPageHeight) * minimapBounds.height();
minimapScreenBounds = new RectF(minimapBounds.left + x, minimapBounds.top + y, //
minimapBounds.left + x + width, minimapBounds.top + y + height);
// depends on control dependency: [if], data = [none]
minimapScreenBounds.intersect(minimapBounds);
// depends on control dependency: [if], data = [none]
miniMapRequired = true;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(Service service, ProtocolMarshaller protocolMarshaller) {
if (service == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(service.getServiceCode(), SERVICECODE_BINDING);
protocolMarshaller.marshall(service.getAttributeNames(), ATTRIBUTENAMES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Service service, ProtocolMarshaller protocolMarshaller) {
if (service == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(service.getServiceCode(), SERVICECODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(service.getAttributeNames(), ATTRIBUTENAMES_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 {
private void doGribIndex(Formatter f, MCollection dcm, boolean eachFile) throws IOException {
Counters counters = new Counters();
// must open collection again without gbx filtering
try (MCollection dcm2 = getCollectionUnfiltered(spec, f)) {
for (MFile mfile : dcm2.getFilesSorted()) {
String path = mfile.getPath();
f.format(" %s%n", path);
doGribIndex(f, mfile, counters, eachFile);
}
}
counters.show(f);
} } | public class class_name {
private void doGribIndex(Formatter f, MCollection dcm, boolean eachFile) throws IOException {
Counters counters = new Counters();
// must open collection again without gbx filtering
try (MCollection dcm2 = getCollectionUnfiltered(spec, f)) {
for (MFile mfile : dcm2.getFilesSorted()) {
String path = mfile.getPath();
f.format(" %s%n", path); // depends on control dependency: [for], data = [none]
doGribIndex(f, mfile, counters, eachFile); // depends on control dependency: [for], data = [mfile]
}
}
counters.show(f);
} } |
public class class_name {
private static Collection<String> getFromAppliesTo(final Asset asset, final AppliesToFilterGetter getter) {
Collection<AppliesToFilterInfo> atfis = asset.getWlpInformation().getAppliesToFilterInfo();
Collection<String> ret = new ArrayList<String>();
if (atfis != null) {
for (AppliesToFilterInfo at : atfis) {
if (at != null) {
String val = getter.getValue(at);
if (val != null) {
ret.add(val);
}
}
}
}
return ret;
} } | public class class_name {
private static Collection<String> getFromAppliesTo(final Asset asset, final AppliesToFilterGetter getter) {
Collection<AppliesToFilterInfo> atfis = asset.getWlpInformation().getAppliesToFilterInfo();
Collection<String> ret = new ArrayList<String>();
if (atfis != null) {
for (AppliesToFilterInfo at : atfis) {
if (at != null) {
String val = getter.getValue(at);
if (val != null) {
ret.add(val); // depends on control dependency: [if], data = [(val]
}
}
}
}
return ret;
} } |
public class class_name {
public void setWaveform(WaveformDetail waveform, TrackMetadata metadata, BeatGrid beatGrid) {
this.waveform.set(waveform);
if (metadata != null) {
cueList.set(metadata.getCueList());
} else {
cueList.set(null);
}
this.beatGrid.set(beatGrid);
clearPlaybackState();
repaint();
if (!autoScroll.get()) {
invalidate();
}
} } | public class class_name {
public void setWaveform(WaveformDetail waveform, TrackMetadata metadata, BeatGrid beatGrid) {
this.waveform.set(waveform);
if (metadata != null) {
cueList.set(metadata.getCueList()); // depends on control dependency: [if], data = [(metadata]
} else {
cueList.set(null); // depends on control dependency: [if], data = [null)]
}
this.beatGrid.set(beatGrid);
clearPlaybackState();
repaint();
if (!autoScroll.get()) {
invalidate(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void iterateGroupNodes(long groupdId, NodeReader nodeReader)
{
// while the index can be a long, the value is always an int
int currentPointer = (int) headPointers.get(groupdId);
checkArgument(currentPointer != NULL, "valid group must have non-null head pointer");
while (currentPointer != NULL) {
checkState(currentPointer < nextNodePointer, "error, corrupt pointer; max valid %s, found %s", nextNodePointer, currentPointer);
nodeReader.read(currentPointer);
currentPointer = nextPointers.get(currentPointer);
}
} } | public class class_name {
private void iterateGroupNodes(long groupdId, NodeReader nodeReader)
{
// while the index can be a long, the value is always an int
int currentPointer = (int) headPointers.get(groupdId);
checkArgument(currentPointer != NULL, "valid group must have non-null head pointer");
while (currentPointer != NULL) {
checkState(currentPointer < nextNodePointer, "error, corrupt pointer; max valid %s, found %s", nextNodePointer, currentPointer);
nodeReader.read(currentPointer);
currentPointer = nextPointers.get(currentPointer); // depends on control dependency: [while], data = [(currentPointer]
}
} } |
public class class_name {
public static boolean isKindOf(Type t, Type... typesToMatch) throws IllegalArgumentException
{
Params.notNullOrEmpty(typesToMatch, "Types to match");
for(Type typeToMatch : typesToMatch) {
if(isKindOf(t, typeToMatch)) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean isKindOf(Type t, Type... typesToMatch) throws IllegalArgumentException
{
Params.notNullOrEmpty(typesToMatch, "Types to match");
for(Type typeToMatch : typesToMatch) {
if(isKindOf(t, typeToMatch)) {
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public OperableTrigger build() {
// if (scheduleBuilder == null) {
// scheduleBuilder = SimpleScheduleBuilder.simpleScheduleBuilder();
// }
// get a trigger impl. but without the meta data filled in yet
// OperableTrigger operableTrigger = operableTrigger;
operableTrigger = instantiate();
// fill in metadata
operableTrigger.setCalendarName(calendarName);
operableTrigger.setDescription(description);
operableTrigger.setEndTime(endTime);
if (name == null) {
name = UUID.randomUUID().toString();
}
operableTrigger.setName(name);
if (jobName != null) {
operableTrigger.setJobName(jobName);
}
operableTrigger.setPriority(priority);
operableTrigger.setStartTime(startTime);
if (!jobDataMap.isEmpty()) {
operableTrigger.setJobDataMap(jobDataMap);
}
return operableTrigger;
} } | public class class_name {
public OperableTrigger build() {
// if (scheduleBuilder == null) {
// scheduleBuilder = SimpleScheduleBuilder.simpleScheduleBuilder();
// }
// get a trigger impl. but without the meta data filled in yet
// OperableTrigger operableTrigger = operableTrigger;
operableTrigger = instantiate();
// fill in metadata
operableTrigger.setCalendarName(calendarName);
operableTrigger.setDescription(description);
operableTrigger.setEndTime(endTime);
if (name == null) {
name = UUID.randomUUID().toString(); // depends on control dependency: [if], data = [none]
}
operableTrigger.setName(name);
if (jobName != null) {
operableTrigger.setJobName(jobName); // depends on control dependency: [if], data = [(jobName]
}
operableTrigger.setPriority(priority);
operableTrigger.setStartTime(startTime);
if (!jobDataMap.isEmpty()) {
operableTrigger.setJobDataMap(jobDataMap); // depends on control dependency: [if], data = [none]
}
return operableTrigger;
} } |
public class class_name {
private void init(final Map<DistributedDataSetPartition, InputSplit[]> splitsPerPartition) {
final Pair<InputSplit[], DistributedDataSetPartition[]>
splitsAndPartitions = getSplitsAndPartitions(splitsPerPartition);
final InputSplit[] splits = splitsAndPartitions.getFirst();
final DistributedDataSetPartition[] partitions = splitsAndPartitions.getSecond();
Validate.isTrue(splits.length == partitions.length);
for (int splitNum = 0; splitNum < splits.length; splitNum++) {
LOG.log(Level.FINE, "Processing split: " + splitNum);
final InputSplit split = splits[splitNum];
final NumberedSplit<InputSplit> numberedSplit = new NumberedSplit<>(split, splitNum,
partitions[splitNum]);
unallocatedSplits.add(numberedSplit);
updateLocations(numberedSplit);
}
if (LOG.isLoggable(Level.FINE)) {
for (final Map.Entry<String, BlockingQueue<NumberedSplit<InputSplit>>> locSplit : locationToSplits.entrySet()) {
LOG.log(Level.FINE, locSplit.getKey() + ": " + locSplit.getValue().toString());
}
}
} } | public class class_name {
private void init(final Map<DistributedDataSetPartition, InputSplit[]> splitsPerPartition) {
final Pair<InputSplit[], DistributedDataSetPartition[]>
splitsAndPartitions = getSplitsAndPartitions(splitsPerPartition);
final InputSplit[] splits = splitsAndPartitions.getFirst();
final DistributedDataSetPartition[] partitions = splitsAndPartitions.getSecond();
Validate.isTrue(splits.length == partitions.length);
for (int splitNum = 0; splitNum < splits.length; splitNum++) {
LOG.log(Level.FINE, "Processing split: " + splitNum); // depends on control dependency: [for], data = [splitNum]
final InputSplit split = splits[splitNum];
final NumberedSplit<InputSplit> numberedSplit = new NumberedSplit<>(split, splitNum,
partitions[splitNum]);
unallocatedSplits.add(numberedSplit); // depends on control dependency: [for], data = [none]
updateLocations(numberedSplit); // depends on control dependency: [for], data = [none]
}
if (LOG.isLoggable(Level.FINE)) {
for (final Map.Entry<String, BlockingQueue<NumberedSplit<InputSplit>>> locSplit : locationToSplits.entrySet()) {
LOG.log(Level.FINE, locSplit.getKey() + ": " + locSplit.getValue().toString()); // depends on control dependency: [for], data = [locSplit]
}
}
} } |
public class class_name {
public BigInteger getPrivKey() {
if (privKey == null) {
throw new MissingPrivateKeyException();
} else if (privKey instanceof BCECPrivateKey) {
return ((BCECPrivateKey) privKey).getD();
} else {
throw new MissingPrivateKeyException();
}
} } | public class class_name {
public BigInteger getPrivKey() {
if (privKey == null) {
throw new MissingPrivateKeyException();
} else if (privKey instanceof BCECPrivateKey) {
return ((BCECPrivateKey) privKey).getD(); // depends on control dependency: [if], data = [none]
} else {
throw new MissingPrivateKeyException();
}
} } |
public class class_name {
public byte[] toByteArray() {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(32);
outputStream.write(commandByte);
if (serialize(outputStream)) {
return outputStream.toByteArray();
}
return null;
} } | public class class_name {
public byte[] toByteArray() {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(32);
outputStream.write(commandByte);
if (serialize(outputStream)) {
return outputStream.toByteArray(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
protected String guessDefaultLanguage(File file, Collection<File> xwikiXmlFiles)
{
String fileName = file.getName();
// Note that we need to check for content pages before technical pages because some pages are both content
// pages (Translation pages for example) and technical pages.
// Is it in the list of defined content pages?
String language = guessDefaultLanguageForPatterns(fileName, this.contentPagePatterns, this.defaultLanguage);
if (language != null) {
return language;
}
// Is it in the list of defined technical pages?
language = guessDefaultLanguageForPatterns(fileName, this.technicalPagePatterns, "");
if (language != null) {
return language;
}
language = "";
// Check if the doc is a translation
Matcher matcher = TRANSLATION_PATTERN.matcher(fileName);
if (matcher.matches()) {
// We're in a translation, use the default language
language = this.defaultLanguage;
} else {
// We're not in a translation, check if there are translations. First get the doc name before the extension
String prefix = StringUtils.substringBeforeLast(fileName, EXTENSION);
// Check for a translation now
Pattern translationPattern = Pattern.compile(String.format("%s\\..*\\.xml", Pattern.quote(prefix)));
for (File xwikiXmlFile : xwikiXmlFiles) {
Matcher translationMatcher = translationPattern.matcher(xwikiXmlFile.getName());
if (translationMatcher.matches()) {
// Found a translation, use the default language
language = this.defaultLanguage;
break;
}
}
}
return language;
} } | public class class_name {
protected String guessDefaultLanguage(File file, Collection<File> xwikiXmlFiles)
{
String fileName = file.getName();
// Note that we need to check for content pages before technical pages because some pages are both content
// pages (Translation pages for example) and technical pages.
// Is it in the list of defined content pages?
String language = guessDefaultLanguageForPatterns(fileName, this.contentPagePatterns, this.defaultLanguage);
if (language != null) {
return language; // depends on control dependency: [if], data = [none]
}
// Is it in the list of defined technical pages?
language = guessDefaultLanguageForPatterns(fileName, this.technicalPagePatterns, "");
if (language != null) {
return language; // depends on control dependency: [if], data = [none]
}
language = "";
// Check if the doc is a translation
Matcher matcher = TRANSLATION_PATTERN.matcher(fileName);
if (matcher.matches()) {
// We're in a translation, use the default language
language = this.defaultLanguage; // depends on control dependency: [if], data = [none]
} else {
// We're not in a translation, check if there are translations. First get the doc name before the extension
String prefix = StringUtils.substringBeforeLast(fileName, EXTENSION);
// Check for a translation now
Pattern translationPattern = Pattern.compile(String.format("%s\\..*\\.xml", Pattern.quote(prefix)));
for (File xwikiXmlFile : xwikiXmlFiles) {
Matcher translationMatcher = translationPattern.matcher(xwikiXmlFile.getName());
if (translationMatcher.matches()) {
// Found a translation, use the default language
language = this.defaultLanguage; // depends on control dependency: [if], data = [none]
break;
}
}
}
return language;
} } |
public class class_name {
public int findCellX(int x)
{
int ofs = abspos.getX1();
for (int i = 0; i < cols.length; i++)
{
ofs += cols[i];
if (x < ofs)
return i;
}
return -1;
} } | public class class_name {
public int findCellX(int x)
{
int ofs = abspos.getX1();
for (int i = 0; i < cols.length; i++)
{
ofs += cols[i]; // depends on control dependency: [for], data = [i]
if (x < ofs)
return i;
}
return -1;
} } |
public class class_name {
public static <T> T fromJSON(final Class<T> targetClass, final String json) {
if (targetClass.equals(Bson.class) || targetClass.equals(Document.class)) {
final Document doc = new Document();
jsonParser.readString(doc, json);
return (T) doc;
} else if (targetClass.equals(BasicBSONObject.class)) {
final BasicBSONObject result = new BasicBSONObject();
jsonParser.readString(result, json);
return (T) result;
} else if (targetClass.equals(BasicDBObject.class)) {
final BasicDBObject result = new BasicDBObject();
jsonParser.readString(result, json);
return (T) result;
} else {
throw new IllegalArgumentException("Unsupported type: " + ClassUtil.getCanonicalClassName(targetClass));
}
} } | public class class_name {
public static <T> T fromJSON(final Class<T> targetClass, final String json) {
if (targetClass.equals(Bson.class) || targetClass.equals(Document.class)) {
final Document doc = new Document();
jsonParser.readString(doc, json);
// depends on control dependency: [if], data = [none]
return (T) doc;
// depends on control dependency: [if], data = [none]
} else if (targetClass.equals(BasicBSONObject.class)) {
final BasicBSONObject result = new BasicBSONObject();
jsonParser.readString(result, json);
// depends on control dependency: [if], data = [none]
return (T) result;
// depends on control dependency: [if], data = [none]
} else if (targetClass.equals(BasicDBObject.class)) {
final BasicDBObject result = new BasicDBObject();
jsonParser.readString(result, json);
// depends on control dependency: [if], data = [none]
return (T) result;
// depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unsupported type: " + ClassUtil.getCanonicalClassName(targetClass));
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.