code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public Map<Object, Map<Object, String>> getElementCollectionCache()
{
if (this.elementCollectionCache == null)
{
this.elementCollectionCache = new HashMap<Object, Map<Object, String>>();
}
return this.elementCollectionCache;
} } | public class class_name {
public Map<Object, Map<Object, String>> getElementCollectionCache()
{
if (this.elementCollectionCache == null)
{
this.elementCollectionCache = new HashMap<Object, Map<Object, String>>();
// depends on control dependency: [if], data = [none]
}
return this.elementCollectionCache;
} } |
public class class_name {
protected void resetResourcesInProject(
CmsDbContext dbc,
CmsUUID projectId,
List<CmsResource> modifiedFiles,
List<CmsResource> modifiedFolders)
throws CmsException, CmsSecurityException, CmsDataAccessException {
// all resources inside the project have to be be reset to their online state.
// 1. step: delete all new files
for (int i = 0; i < modifiedFiles.size(); i++) {
CmsResource currentFile = modifiedFiles.get(i);
if (currentFile.getState().isNew()) {
CmsLock lock = getLock(dbc, currentFile);
if (lock.isNullLock()) {
// lock the resource
lockResource(dbc, currentFile, CmsLockType.EXCLUSIVE);
} else if (!lock.isOwnedBy(dbc.currentUser()) || !lock.isInProject(dbc.currentProject())) {
changeLock(dbc, currentFile, CmsLockType.EXCLUSIVE);
}
// delete the properties
getVfsDriver(dbc).deletePropertyObjects(
dbc,
projectId,
currentFile,
CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES);
// delete the file
getVfsDriver(dbc).removeFile(dbc, dbc.currentProject().getUuid(), currentFile);
// remove the access control entries
getUserDriver(dbc).removeAccessControlEntries(dbc, dbc.currentProject(), currentFile.getResourceId());
// fire the corresponding event
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFile)));
}
}
// 2. step: delete all new folders
for (int i = 0; i < modifiedFolders.size(); i++) {
CmsResource currentFolder = modifiedFolders.get(i);
if (currentFolder.getState().isNew()) {
// delete the properties
getVfsDriver(dbc).deletePropertyObjects(
dbc,
projectId,
currentFolder,
CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES);
// delete the folder
getVfsDriver(dbc).removeFolder(dbc, dbc.currentProject(), currentFolder);
// remove the access control entries
getUserDriver(dbc).removeAccessControlEntries(dbc, dbc.currentProject(), currentFolder.getResourceId());
// fire the corresponding event
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFolder)));
}
}
// 3. step: undo changes on all changed or deleted folders
for (int i = 0; i < modifiedFolders.size(); i++) {
CmsResource currentFolder = modifiedFolders.get(i);
if ((currentFolder.getState().isChanged()) || (currentFolder.getState().isDeleted())) {
CmsLock lock = getLock(dbc, currentFolder);
if (lock.isNullLock()) {
// lock the resource
lockResource(dbc, currentFolder, CmsLockType.EXCLUSIVE);
} else if (!lock.isOwnedBy(dbc.currentUser()) || !lock.isInProject(dbc.currentProject())) {
changeLock(dbc, currentFolder, CmsLockType.EXCLUSIVE);
}
// undo all changes in the folder
undoChanges(dbc, currentFolder, CmsResource.UNDO_CONTENT);
// fire the corresponding event
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFolder)));
}
}
// 4. step: undo changes on all changed or deleted files
for (int i = 0; i < modifiedFiles.size(); i++) {
CmsResource currentFile = modifiedFiles.get(i);
if (currentFile.getState().isChanged() || currentFile.getState().isDeleted()) {
CmsLock lock = getLock(dbc, currentFile);
if (lock.isNullLock()) {
// lock the resource
lockResource(dbc, currentFile, CmsLockType.EXCLUSIVE);
} else if (!lock.isOwnedInProjectBy(dbc.currentUser(), dbc.currentProject())) {
if (lock.isLockableBy(dbc.currentUser())) {
changeLock(dbc, currentFile, CmsLockType.EXCLUSIVE);
}
}
// undo all changes in the file
undoChanges(dbc, currentFile, CmsResource.UNDO_CONTENT);
// fire the corresponding event
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFile)));
}
}
} } | public class class_name {
protected void resetResourcesInProject(
CmsDbContext dbc,
CmsUUID projectId,
List<CmsResource> modifiedFiles,
List<CmsResource> modifiedFolders)
throws CmsException, CmsSecurityException, CmsDataAccessException {
// all resources inside the project have to be be reset to their online state.
// 1. step: delete all new files
for (int i = 0; i < modifiedFiles.size(); i++) {
CmsResource currentFile = modifiedFiles.get(i);
if (currentFile.getState().isNew()) {
CmsLock lock = getLock(dbc, currentFile);
if (lock.isNullLock()) {
// lock the resource
lockResource(dbc, currentFile, CmsLockType.EXCLUSIVE); // depends on control dependency: [if], data = [none]
} else if (!lock.isOwnedBy(dbc.currentUser()) || !lock.isInProject(dbc.currentProject())) {
changeLock(dbc, currentFile, CmsLockType.EXCLUSIVE); // depends on control dependency: [if], data = [none]
}
// delete the properties
getVfsDriver(dbc).deletePropertyObjects(
dbc,
projectId,
currentFile,
CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES); // depends on control dependency: [if], data = [none]
// delete the file
getVfsDriver(dbc).removeFile(dbc, dbc.currentProject().getUuid(), currentFile); // depends on control dependency: [if], data = [none]
// remove the access control entries
getUserDriver(dbc).removeAccessControlEntries(dbc, dbc.currentProject(), currentFile.getResourceId()); // depends on control dependency: [if], data = [none]
// fire the corresponding event
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFile))); // depends on control dependency: [if], data = [none]
}
}
// 2. step: delete all new folders
for (int i = 0; i < modifiedFolders.size(); i++) {
CmsResource currentFolder = modifiedFolders.get(i);
if (currentFolder.getState().isNew()) {
// delete the properties
getVfsDriver(dbc).deletePropertyObjects(
dbc,
projectId,
currentFolder,
CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES);
// delete the folder
getVfsDriver(dbc).removeFolder(dbc, dbc.currentProject(), currentFolder);
// remove the access control entries
getUserDriver(dbc).removeAccessControlEntries(dbc, dbc.currentProject(), currentFolder.getResourceId());
// fire the corresponding event
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFolder)));
}
}
// 3. step: undo changes on all changed or deleted folders
for (int i = 0; i < modifiedFolders.size(); i++) {
CmsResource currentFolder = modifiedFolders.get(i);
if ((currentFolder.getState().isChanged()) || (currentFolder.getState().isDeleted())) {
CmsLock lock = getLock(dbc, currentFolder);
if (lock.isNullLock()) {
// lock the resource
lockResource(dbc, currentFolder, CmsLockType.EXCLUSIVE);
} else if (!lock.isOwnedBy(dbc.currentUser()) || !lock.isInProject(dbc.currentProject())) {
changeLock(dbc, currentFolder, CmsLockType.EXCLUSIVE);
}
// undo all changes in the folder
undoChanges(dbc, currentFolder, CmsResource.UNDO_CONTENT);
// fire the corresponding event
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFolder)));
}
}
// 4. step: undo changes on all changed or deleted files
for (int i = 0; i < modifiedFiles.size(); i++) {
CmsResource currentFile = modifiedFiles.get(i);
if (currentFile.getState().isChanged() || currentFile.getState().isDeleted()) {
CmsLock lock = getLock(dbc, currentFile);
if (lock.isNullLock()) {
// lock the resource
lockResource(dbc, currentFile, CmsLockType.EXCLUSIVE);
} else if (!lock.isOwnedInProjectBy(dbc.currentUser(), dbc.currentProject())) {
if (lock.isLockableBy(dbc.currentUser())) {
changeLock(dbc, currentFile, CmsLockType.EXCLUSIVE);
}
}
// undo all changes in the file
undoChanges(dbc, currentFile, CmsResource.UNDO_CONTENT);
// fire the corresponding event
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFile)));
}
}
} } |
public class class_name {
public static byte[] generateHmacSha1Key() {
try {
KeyGenerator keyGenerator = KeyGenerator.getInstance(HMACSHA1_NAME);
keyGenerator.init(DEFAULT_HMACSHA1_KEYSIZE);
SecretKey secretKey = keyGenerator.generateKey();
return secretKey.getEncoded();
} catch (NoSuchAlgorithmException e) {
throw new ImpossibleException(e);
}
} } | public class class_name {
public static byte[] generateHmacSha1Key() {
try {
KeyGenerator keyGenerator = KeyGenerator.getInstance(HMACSHA1_NAME);
keyGenerator.init(DEFAULT_HMACSHA1_KEYSIZE); // depends on control dependency: [try], data = [none]
SecretKey secretKey = keyGenerator.generateKey();
return secretKey.getEncoded(); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
throw new ImpossibleException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Optional<MeteredInputStream> findWrappedMeteredInputStream(InputStream is) {
if (is instanceof FilterInputStream) {
try {
Optional<MeteredInputStream> meteredInputStream =
findWrappedMeteredInputStream(FilterStreamUnpacker.unpackFilterInputStream((FilterInputStream) is));
if (meteredInputStream.isPresent()) {
return meteredInputStream;
}
} catch (IllegalAccessException iae) {
log.warn("Cannot unpack input stream due to SecurityManager.", iae);
// Do nothing, we can't unpack the FilterInputStream due to security restrictions
}
}
if (is instanceof MeteredInputStream) {
return Optional.of((MeteredInputStream) is);
}
return Optional.absent();
} } | public class class_name {
public static Optional<MeteredInputStream> findWrappedMeteredInputStream(InputStream is) {
if (is instanceof FilterInputStream) {
try {
Optional<MeteredInputStream> meteredInputStream =
findWrappedMeteredInputStream(FilterStreamUnpacker.unpackFilterInputStream((FilterInputStream) is));
if (meteredInputStream.isPresent()) {
return meteredInputStream; // depends on control dependency: [if], data = [none]
}
} catch (IllegalAccessException iae) {
log.warn("Cannot unpack input stream due to SecurityManager.", iae);
// Do nothing, we can't unpack the FilterInputStream due to security restrictions
} // depends on control dependency: [catch], data = [none]
}
if (is instanceof MeteredInputStream) {
return Optional.of((MeteredInputStream) is); // depends on control dependency: [if], data = [none]
}
return Optional.absent();
} } |
public class class_name {
public boolean status(int responseCode) {
if (urlConnection instanceof HttpURLConnection) {
HttpURLConnection http = (HttpURLConnection) urlConnection;
try {
return http.getResponseCode() == responseCode;
} catch (IOException e) {
e.printStackTrace();
return false;
}
} else
return false;
} } | public class class_name {
public boolean status(int responseCode) {
if (urlConnection instanceof HttpURLConnection) {
HttpURLConnection http = (HttpURLConnection) urlConnection;
try {
return http.getResponseCode() == responseCode; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
return false;
} // depends on control dependency: [catch], data = [none]
} else
return false;
} } |
public class class_name {
public static Type classnameToType(@BinaryName String classname) {
classname = classname.intern();
if (classname == "int") { // interned
return Type.INT;
} else if (classname == "boolean") { // interned
return Type.BOOLEAN;
} else if (classname == "byte") { // interned
return Type.BYTE;
} else if (classname == "char") { // interned
return Type.CHAR;
} else if (classname == "double") { // interned
return Type.DOUBLE;
} else if (classname == "float") { // interned
return Type.FLOAT;
} else if (classname == "long") { // interned
return Type.LONG;
} else if (classname == "short") { // interned
return Type.SHORT;
} else { // must be a non-primitive
return new ObjectType(classname);
}
} } | public class class_name {
public static Type classnameToType(@BinaryName String classname) {
classname = classname.intern();
if (classname == "int") { // interned
return Type.INT; // depends on control dependency: [if], data = [none]
} else if (classname == "boolean") { // interned
return Type.BOOLEAN; // depends on control dependency: [if], data = [none]
} else if (classname == "byte") { // interned
return Type.BYTE; // depends on control dependency: [if], data = [none]
} else if (classname == "char") { // interned
return Type.CHAR; // depends on control dependency: [if], data = [none]
} else if (classname == "double") { // interned
return Type.DOUBLE; // depends on control dependency: [if], data = [none]
} else if (classname == "float") { // interned
return Type.FLOAT; // depends on control dependency: [if], data = [none]
} else if (classname == "long") { // interned
return Type.LONG; // depends on control dependency: [if], data = [none]
} else if (classname == "short") { // interned
return Type.SHORT; // depends on control dependency: [if], data = [none]
} else { // must be a non-primitive
return new ObjectType(classname); // depends on control dependency: [if], data = [(classname]
}
} } |
public class class_name {
@Nullable
public Transition inflateTransition(int resource) {
XmlResourceParser parser = mContext.getResources().getXml(resource);
try {
return createTransitionFromXml(parser, Xml.asAttributeSet(parser), null);
} catch (XmlPullParserException e) {
InflateException ex = new InflateException(e.getMessage());
ex.initCause(e);
throw ex;
} catch (IOException e) {
InflateException ex = new InflateException(
parser.getPositionDescription()
+ ": " + e.getMessage());
ex.initCause(e);
throw ex;
} finally {
parser.close();
}
} } | public class class_name {
@Nullable
public Transition inflateTransition(int resource) {
XmlResourceParser parser = mContext.getResources().getXml(resource);
try {
return createTransitionFromXml(parser, Xml.asAttributeSet(parser), null); // depends on control dependency: [try], data = [none]
} catch (XmlPullParserException e) {
InflateException ex = new InflateException(e.getMessage());
ex.initCause(e);
throw ex;
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
InflateException ex = new InflateException(
parser.getPositionDescription()
+ ": " + e.getMessage());
ex.initCause(e);
throw ex;
} finally { // depends on control dependency: [catch], data = [none]
parser.close();
}
} } |
public class class_name {
public void removeXmitQueuePoint(SIBUuid8 meUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeXmitQueuePoint", meUuid);
if (_xmitQueuePoints != null)
{
synchronized(_xmitQueuePoints)
{
_xmitQueuePoints.remove(meUuid);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeXmitQueuePoint");
} } | public class class_name {
public void removeXmitQueuePoint(SIBUuid8 meUuid)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeXmitQueuePoint", meUuid);
if (_xmitQueuePoints != null)
{
synchronized(_xmitQueuePoints) // depends on control dependency: [if], data = [(_xmitQueuePoints]
{
_xmitQueuePoints.remove(meUuid);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeXmitQueuePoint");
} } |
public class class_name {
public void setYearNames(String[] yearNames, int context, int width) {
if (context == FORMAT && width == ABBREVIATED) {
shortYearNames = duplicate(yearNames);
}
} } | public class class_name {
public void setYearNames(String[] yearNames, int context, int width) {
if (context == FORMAT && width == ABBREVIATED) {
shortYearNames = duplicate(yearNames); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public <S extends Service> S getService(Class<S> type) {
for (final Service serv : this.serviceManager.servicesByState().values()) {
if (serv.isRunning() && type.isInstance(serv)) {
return type.cast(serv);
}
}
return null;
} } | public class class_name {
public <S extends Service> S getService(Class<S> type) {
for (final Service serv : this.serviceManager.servicesByState().values()) {
if (serv.isRunning() && type.isInstance(serv)) {
return type.cast(serv); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static <Key, Value> Value putIfAbsent(final ObjectMap<Key, Value> map, final Key key, final Value value) {
if (!map.containsKey(key)) {
map.put(key, value);
return value;
}
return map.get(key);
} } | public class class_name {
public static <Key, Value> Value putIfAbsent(final ObjectMap<Key, Value> map, final Key key, final Value value) {
if (!map.containsKey(key)) {
map.put(key, value); // depends on control dependency: [if], data = [none]
return value; // depends on control dependency: [if], data = [none]
}
return map.get(key);
} } |
public class class_name {
public List<Citation> makeCitation(String... ids) {
CSLCitationItem[] items = new CSLCitationItem[ids.length];
for (int i = 0; i < ids.length; ++i) {
items[i] = new CSLCitationItem(ids[i]);
}
return makeCitation(new CSLCitation(items));
} } | public class class_name {
public List<Citation> makeCitation(String... ids) {
CSLCitationItem[] items = new CSLCitationItem[ids.length];
for (int i = 0; i < ids.length; ++i) {
items[i] = new CSLCitationItem(ids[i]); // depends on control dependency: [for], data = [i]
}
return makeCitation(new CSLCitation(items));
} } |
public class class_name {
public final static PolymerNotation addAnnotationToPolymer(final PolymerNotation polymer, final String annotation) {
if (polymer.getAnnotation() != null) {
return new PolymerNotation(polymer.getPolymerID(), polymer.getPolymerElements(),
polymer.getAnnotation() + " | " + annotation);
}
return new PolymerNotation(polymer.getPolymerID(), polymer.getPolymerElements(), annotation);
} } | public class class_name {
public final static PolymerNotation addAnnotationToPolymer(final PolymerNotation polymer, final String annotation) {
if (polymer.getAnnotation() != null) {
return new PolymerNotation(polymer.getPolymerID(), polymer.getPolymerElements(),
polymer.getAnnotation() + " | " + annotation);
// depends on control dependency: [if], data = [none]
}
return new PolymerNotation(polymer.getPolymerID(), polymer.getPolymerElements(), annotation);
} } |
public class class_name {
public static DeploymentEntry enrich(DeploymentEntry deployment, Map<String, String> prefixedProperties) {
final Map<String, String> enrichedProperties = new HashMap<>(deployment.asMap());
prefixedProperties.forEach((k, v) -> {
final String normalizedKey = k.toLowerCase();
if (k.startsWith(DEPLOYMENT_ENTRY + '.')) {
enrichedProperties.put(normalizedKey.substring(DEPLOYMENT_ENTRY.length() + 1), v);
}
});
final DescriptorProperties properties = new DescriptorProperties(true);
properties.putProperties(enrichedProperties);
return new DeploymentEntry(properties);
} } | public class class_name {
public static DeploymentEntry enrich(DeploymentEntry deployment, Map<String, String> prefixedProperties) {
final Map<String, String> enrichedProperties = new HashMap<>(deployment.asMap());
prefixedProperties.forEach((k, v) -> {
final String normalizedKey = k.toLowerCase();
if (k.startsWith(DEPLOYMENT_ENTRY + '.')) {
enrichedProperties.put(normalizedKey.substring(DEPLOYMENT_ENTRY.length() + 1), v); // depends on control dependency: [if], data = [none]
}
});
final DescriptorProperties properties = new DescriptorProperties(true);
properties.putProperties(enrichedProperties);
return new DeploymentEntry(properties);
} } |
public class class_name {
protected static Resources getDefaultResources() { // NOPMD it's thread save!
if (SelectBoxWithIconInputWidget.defaultResource == null) {
synchronized (Resources.class) {
if (SelectBoxWithIconInputWidget.defaultResource == null) {
SelectBoxWithIconInputWidget.defaultResource = GWT.create(Resources.class);
}
}
}
return SelectBoxWithIconInputWidget.defaultResource;
} } | public class class_name {
protected static Resources getDefaultResources() { // NOPMD it's thread save!
if (SelectBoxWithIconInputWidget.defaultResource == null) {
synchronized (Resources.class) { // depends on control dependency: [if], data = [none]
if (SelectBoxWithIconInputWidget.defaultResource == null) {
SelectBoxWithIconInputWidget.defaultResource = GWT.create(Resources.class); // depends on control dependency: [if], data = [none]
}
}
}
return SelectBoxWithIconInputWidget.defaultResource;
} } |
public class class_name {
public void setIndexRoots(int[] roots) {
if (!isCached) {
throw Error.error(ErrorCode.X_42501, tableName.name);
}
PersistentStore store =
database.persistentStoreCollection.getStore(this);
for (int i = 0; i < getIndexCount(); i++) {
store.setAccessor(indexList[i], roots[i]);
}
} } | public class class_name {
public void setIndexRoots(int[] roots) {
if (!isCached) {
throw Error.error(ErrorCode.X_42501, tableName.name);
}
PersistentStore store =
database.persistentStoreCollection.getStore(this);
for (int i = 0; i < getIndexCount(); i++) {
store.setAccessor(indexList[i], roots[i]); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public void marshall(BurnInDestinationSettings burnInDestinationSettings, ProtocolMarshaller protocolMarshaller) {
if (burnInDestinationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(burnInDestinationSettings.getAlignment(), ALIGNMENT_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getBackgroundColor(), BACKGROUNDCOLOR_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getBackgroundOpacity(), BACKGROUNDOPACITY_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getFont(), FONT_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getFontColor(), FONTCOLOR_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getFontOpacity(), FONTOPACITY_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getFontResolution(), FONTRESOLUTION_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getFontSize(), FONTSIZE_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getOutlineColor(), OUTLINECOLOR_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getOutlineSize(), OUTLINESIZE_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getShadowColor(), SHADOWCOLOR_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getShadowOpacity(), SHADOWOPACITY_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getShadowXOffset(), SHADOWXOFFSET_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getShadowYOffset(), SHADOWYOFFSET_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getTeletextGridControl(), TELETEXTGRIDCONTROL_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getXPosition(), XPOSITION_BINDING);
protocolMarshaller.marshall(burnInDestinationSettings.getYPosition(), YPOSITION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(BurnInDestinationSettings burnInDestinationSettings, ProtocolMarshaller protocolMarshaller) {
if (burnInDestinationSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(burnInDestinationSettings.getAlignment(), ALIGNMENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getBackgroundColor(), BACKGROUNDCOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getBackgroundOpacity(), BACKGROUNDOPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getFont(), FONT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getFontColor(), FONTCOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getFontOpacity(), FONTOPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getFontResolution(), FONTRESOLUTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getFontSize(), FONTSIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getOutlineColor(), OUTLINECOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getOutlineSize(), OUTLINESIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getShadowColor(), SHADOWCOLOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getShadowOpacity(), SHADOWOPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getShadowXOffset(), SHADOWXOFFSET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getShadowYOffset(), SHADOWYOFFSET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getTeletextGridControl(), TELETEXTGRIDCONTROL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getXPosition(), XPOSITION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(burnInDestinationSettings.getYPosition(), YPOSITION_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 {
boolean validatePasswords(String password1, String password2) {
if (!password1.equals(password2)) {
showPasswordMatchError(true);
return false;
}
showPasswordMatchError(false);
try {
OpenCms.getPasswordHandler().validatePassword(password1);
m_form.getPassword1Field().setComponentError(null);
return true;
} catch (CmsException e) {
m_form.setErrorPassword1(new UserError(e.getLocalizedMessage(m_locale)), OpenCmsTheme.SECURITY_INVALID);
return false;
}
} } | public class class_name {
boolean validatePasswords(String password1, String password2) {
if (!password1.equals(password2)) {
showPasswordMatchError(true); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
showPasswordMatchError(false);
try {
OpenCms.getPasswordHandler().validatePassword(password1); // depends on control dependency: [try], data = [none]
m_form.getPassword1Field().setComponentError(null); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
m_form.setErrorPassword1(new UserError(e.getLocalizedMessage(m_locale)), OpenCmsTheme.SECURITY_INVALID);
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String get_topology_id(StormClusterState zkCluster, String storm_name) throws Exception {
List<String> active_storms = zkCluster.active_storms();
String rtn = null;
if (active_storms != null) {
for (String topology_id : active_storms) {
if (!topology_id.contains(storm_name)) {
continue;
}
StormBase base = zkCluster.storm_base(topology_id, null);
if (base != null && storm_name.equals(Common.getTopologyNameById(topology_id))) {
rtn = topology_id;
break;
}
}
}
return rtn;
} } | public class class_name {
public static String get_topology_id(StormClusterState zkCluster, String storm_name) throws Exception {
List<String> active_storms = zkCluster.active_storms();
String rtn = null;
if (active_storms != null) {
for (String topology_id : active_storms) {
if (!topology_id.contains(storm_name)) {
continue;
}
StormBase base = zkCluster.storm_base(topology_id, null);
if (base != null && storm_name.equals(Common.getTopologyNameById(topology_id))) {
rtn = topology_id; // depends on control dependency: [if], data = [none]
break;
}
}
}
return rtn;
} } |
public class class_name {
public static Address from(String address) {
int lastColon = address.lastIndexOf(':');
int openBracket = address.indexOf('[');
int closeBracket = address.indexOf(']');
String host;
if (openBracket != -1 && closeBracket != -1) {
host = address.substring(openBracket + 1, closeBracket);
} else if (lastColon != -1) {
host = address.substring(0, lastColon);
} else {
host = address;
}
int port;
if (lastColon != -1) {
try {
port = Integer.parseInt(address.substring(lastColon + 1));
} catch (NumberFormatException e) {
throw new MalformedAddressException(address, e);
}
} else {
port = DEFAULT_PORT;
}
return new Address(host, port);
} } | public class class_name {
public static Address from(String address) {
int lastColon = address.lastIndexOf(':');
int openBracket = address.indexOf('[');
int closeBracket = address.indexOf(']');
String host;
if (openBracket != -1 && closeBracket != -1) {
host = address.substring(openBracket + 1, closeBracket); // depends on control dependency: [if], data = [(openBracket]
} else if (lastColon != -1) {
host = address.substring(0, lastColon); // depends on control dependency: [if], data = [none]
} else {
host = address; // depends on control dependency: [if], data = [none]
}
int port;
if (lastColon != -1) {
try {
port = Integer.parseInt(address.substring(lastColon + 1)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new MalformedAddressException(address, e);
} // depends on control dependency: [catch], data = [none]
} else {
port = DEFAULT_PORT; // depends on control dependency: [if], data = [none]
}
return new Address(host, port);
} } |
public class class_name {
protected void fill() throws IOException
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"fill", "fill");
}
// PK79219 Start
long longLeft = limit-total;
int len;
if (longLeft>Integer.MAX_VALUE)
len = buf.length;
else
len = Math.min(buf.length, (int)longLeft);
// PK79219 End
if ( len > 0 )
{
len = in.read(buf, 0, len);
if ( len > 0 )
{
pos = 0;
count = len;
}
}
} } | public class class_name {
protected void fill() throws IOException
{
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"fill", "fill");
}
// PK79219 Start
long longLeft = limit-total;
int len;
if (longLeft>Integer.MAX_VALUE)
len = buf.length;
else
len = Math.min(buf.length, (int)longLeft);
// PK79219 End
if ( len > 0 )
{
len = in.read(buf, 0, len);
if ( len > 0 )
{
pos = 0; // depends on control dependency: [if], data = [none]
count = len; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private static void addLineNo(Content pre, int lineno) {
HtmlTree span = new HtmlTree(HtmlTag.SPAN);
span.addStyle(HtmlStyle.sourceLineNo);
if (lineno < 10) {
span.addContent("00" + Integer.toString(lineno));
} else if (lineno < 100) {
span.addContent("0" + Integer.toString(lineno));
} else {
span.addContent(Integer.toString(lineno));
}
pre.addContent(span);
} } | public class class_name {
private static void addLineNo(Content pre, int lineno) {
HtmlTree span = new HtmlTree(HtmlTag.SPAN);
span.addStyle(HtmlStyle.sourceLineNo);
if (lineno < 10) {
span.addContent("00" + Integer.toString(lineno)); // depends on control dependency: [if], data = [(lineno]
} else if (lineno < 100) {
span.addContent("0" + Integer.toString(lineno)); // depends on control dependency: [if], data = [(lineno]
} else {
span.addContent(Integer.toString(lineno)); // depends on control dependency: [if], data = [(lineno]
}
pre.addContent(span);
} } |
public class class_name {
@Override
public void fire(StepStartedEvent event) {
for (LifecycleListener listener : listeners) {
try {
listener.fire(event);
} catch (Exception e) {
logError(listener, e);
}
}
} } | public class class_name {
@Override
public void fire(StepStartedEvent event) {
for (LifecycleListener listener : listeners) {
try {
listener.fire(event); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logError(listener, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static String getDidYouMeanString(Collection<String> available, String it) {
String message = "";
Collection<String> mins = Levenshtein.findSimilar(available, it);
if (mins.size() > 0) {
if (mins.size() == 1) {
message += "Did you mean this?";
} else {
message += "Did you mean one of these?";
}
for (String m : mins) {
message += "\n\t" + m;
}
}
return message;
} } | public class class_name {
public static String getDidYouMeanString(Collection<String> available, String it) {
String message = "";
Collection<String> mins = Levenshtein.findSimilar(available, it);
if (mins.size() > 0) {
if (mins.size() == 1) {
message += "Did you mean this?"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
} else {
message += "Did you mean one of these?"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
for (String m : mins) {
message += "\n\t" + m; // depends on control dependency: [for], data = [m]
}
}
return message;
} } |
public class class_name {
@SuppressFBWarnings("NP_BOOLEAN_RETURN_NULL")
static Boolean isObjectLayoutCompressedOopsOrNull() {
if (!UNSAFE_AVAILABLE) {
return null;
}
Integer referenceSize = ReferenceSizeEstimator.getReferenceSizeOrNull();
if (referenceSize == null) {
return null;
}
// when reference size does not equal address size then it's safe to assume references are compressed
return referenceSize != UNSAFE.addressSize();
} } | public class class_name {
@SuppressFBWarnings("NP_BOOLEAN_RETURN_NULL")
static Boolean isObjectLayoutCompressedOopsOrNull() {
if (!UNSAFE_AVAILABLE) {
return null; // depends on control dependency: [if], data = [none]
}
Integer referenceSize = ReferenceSizeEstimator.getReferenceSizeOrNull();
if (referenceSize == null) {
return null; // depends on control dependency: [if], data = [none]
}
// when reference size does not equal address size then it's safe to assume references are compressed
return referenceSize != UNSAFE.addressSize();
} } |
public class class_name {
public AwsSecurityFindingFilters withNetworkSourceDomain(StringFilter... networkSourceDomain) {
if (this.networkSourceDomain == null) {
setNetworkSourceDomain(new java.util.ArrayList<StringFilter>(networkSourceDomain.length));
}
for (StringFilter ele : networkSourceDomain) {
this.networkSourceDomain.add(ele);
}
return this;
} } | public class class_name {
public AwsSecurityFindingFilters withNetworkSourceDomain(StringFilter... networkSourceDomain) {
if (this.networkSourceDomain == null) {
setNetworkSourceDomain(new java.util.ArrayList<StringFilter>(networkSourceDomain.length)); // depends on control dependency: [if], data = [none]
}
for (StringFilter ele : networkSourceDomain) {
this.networkSourceDomain.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
URI resolveServiceEndpoint(String bucketName) {
if (getSignerRegion() != null || isSignerOverridden()) return endpoint;
final String regionStr = fetchRegionFromCache(bucketName);
final com.amazonaws.regions.Region region = RegionUtils.getRegion(regionStr);
if (region == null) {
log.warn("Region information for "
+ regionStr
+ " is not available. Please upgrade to latest version of AWS Java SDK");
}
return region != null
? RuntimeHttpUtils.toUri(region.getServiceEndpoint(S3_SERVICE_NAME), clientConfiguration)
: endpoint;
} } | public class class_name {
URI resolveServiceEndpoint(String bucketName) {
if (getSignerRegion() != null || isSignerOverridden()) return endpoint;
final String regionStr = fetchRegionFromCache(bucketName);
final com.amazonaws.regions.Region region = RegionUtils.getRegion(regionStr);
if (region == null) {
log.warn("Region information for "
+ regionStr
+ " is not available. Please upgrade to latest version of AWS Java SDK"); // depends on control dependency: [if], data = [none]
}
return region != null
? RuntimeHttpUtils.toUri(region.getServiceEndpoint(S3_SERVICE_NAME), clientConfiguration)
: endpoint;
} } |
public class class_name {
private boolean isCorrectLogType(ListBlobItem current) {
HashMap<String, String> metadata = ((CloudBlob) current).getMetadata();
String logType = metadata.get("LogType");
if (logType == null) {
return true;
}
if (this.operations.contains(LoggingOperations.READ) && logType.contains("read")) {
return true;
}
if (this.operations.contains(LoggingOperations.WRITE) && logType.contains("write")) {
return true;
}
if (this.operations.contains(LoggingOperations.DELETE) && logType.contains("delete")) {
return true;
}
return false;
} } | public class class_name {
private boolean isCorrectLogType(ListBlobItem current) {
HashMap<String, String> metadata = ((CloudBlob) current).getMetadata();
String logType = metadata.get("LogType");
if (logType == null) {
return true; // depends on control dependency: [if], data = [none]
}
if (this.operations.contains(LoggingOperations.READ) && logType.contains("read")) {
return true; // depends on control dependency: [if], data = [none]
}
if (this.operations.contains(LoggingOperations.WRITE) && logType.contains("write")) {
return true; // depends on control dependency: [if], data = [none]
}
if (this.operations.contains(LoggingOperations.DELETE) && logType.contains("delete")) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public String getFileName(State properties) {
String extension =
this.format.equals(WriterOutputFormat.OTHER) ? getExtension(properties) : this.format.getExtension();
String fileName = WriterUtils.getWriterFileName(properties, this.branches, this.branch, this.writerId, extension);
if (this.partition.isPresent()) {
fileName = getPartitionedFileName(properties, fileName);
}
List<StreamCodec> encoders = getEncoders();
if (!encoders.isEmpty()) {
StringBuilder filenameBuilder = new StringBuilder(fileName);
for (StreamCodec codec : encoders) {
filenameBuilder.append('.');
filenameBuilder.append(codec.getTag());
}
fileName = filenameBuilder.toString();
}
return fileName;
} } | public class class_name {
public String getFileName(State properties) {
String extension =
this.format.equals(WriterOutputFormat.OTHER) ? getExtension(properties) : this.format.getExtension();
String fileName = WriterUtils.getWriterFileName(properties, this.branches, this.branch, this.writerId, extension);
if (this.partition.isPresent()) {
fileName = getPartitionedFileName(properties, fileName); // depends on control dependency: [if], data = [none]
}
List<StreamCodec> encoders = getEncoders();
if (!encoders.isEmpty()) {
StringBuilder filenameBuilder = new StringBuilder(fileName);
for (StreamCodec codec : encoders) {
filenameBuilder.append('.'); // depends on control dependency: [for], data = [none]
filenameBuilder.append(codec.getTag()); // depends on control dependency: [for], data = [codec]
}
fileName = filenameBuilder.toString(); // depends on control dependency: [if], data = [none]
}
return fileName;
} } |
public class class_name {
public boolean recordDict() {
if (hasAnySingletonTypeTags()
|| currentInfo.makesDicts() || currentInfo.makesStructs()
|| currentInfo.makesUnrestricted()) {
return false;
}
currentInfo.setDict();
populated = true;
return true;
} } | public class class_name {
public boolean recordDict() {
if (hasAnySingletonTypeTags()
|| currentInfo.makesDicts() || currentInfo.makesStructs()
|| currentInfo.makesUnrestricted()) {
return false; // depends on control dependency: [if], data = [none]
}
currentInfo.setDict();
populated = true;
return true;
} } |
public class class_name {
protected synchronized Class loadClass(String classname, boolean resolve)
throws ClassNotFoundException {
// 'sync' is needed - otherwise 2 threads can load the same class
// twice, resulting in LinkageError: duplicated class definition.
// findLoadedClass avoids that, but without sync it won't work.
Class theClass = findLoadedClass(classname);
if (theClass != null) {
return theClass;
}
if (isParentFirst(classname)) {
try {
theClass = findBaseClass(classname);
log("Class " + classname + " loaded from parent loader " + "(parentFirst)",
Project.MSG_DEBUG);
} catch (ClassNotFoundException cnfe) {
theClass = findClass(classname);
log("Class " + classname + " loaded from ant loader " + "(parentFirst)",
Project.MSG_DEBUG);
}
} else {
try {
theClass = findClass(classname);
log("Class " + classname + " loaded from ant loader", Project.MSG_DEBUG);
} catch (ClassNotFoundException cnfe) {
if (ignoreBase) {
throw cnfe;
}
theClass = findBaseClass(classname);
log("Class " + classname + " loaded from parent loader", Project.MSG_DEBUG);
}
}
if (resolve) {
resolveClass(theClass);
}
return theClass;
} } | public class class_name {
protected synchronized Class loadClass(String classname, boolean resolve)
throws ClassNotFoundException {
// 'sync' is needed - otherwise 2 threads can load the same class
// twice, resulting in LinkageError: duplicated class definition.
// findLoadedClass avoids that, but without sync it won't work.
Class theClass = findLoadedClass(classname);
if (theClass != null) {
return theClass;
}
if (isParentFirst(classname)) {
try {
theClass = findBaseClass(classname); // depends on control dependency: [try], data = [none]
log("Class " + classname + " loaded from parent loader " + "(parentFirst)",
Project.MSG_DEBUG); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException cnfe) {
theClass = findClass(classname);
log("Class " + classname + " loaded from ant loader " + "(parentFirst)",
Project.MSG_DEBUG);
} // depends on control dependency: [catch], data = [none]
} else {
try {
theClass = findClass(classname); // depends on control dependency: [try], data = [none]
log("Class " + classname + " loaded from ant loader", Project.MSG_DEBUG); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException cnfe) {
if (ignoreBase) {
throw cnfe;
}
theClass = findBaseClass(classname);
log("Class " + classname + " loaded from parent loader", Project.MSG_DEBUG);
} // depends on control dependency: [catch], data = [none]
}
if (resolve) {
resolveClass(theClass);
}
return theClass;
} } |
public class class_name {
private <T, Y> TypedQuery<T> createTypedQueryIn(Class<T> entityCls,
SingularAttribute<T, Y> attribute, List<Y> values) {
EntityManager entityManager = this.entityManagerProvider.get();
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<T> criteriaQuery = builder.createQuery(entityCls);
Root<T> root = criteriaQuery.from(entityCls);
Path<Y> path = root.get(attribute);
CriteriaBuilder.In<Y> in = builder.in(path);
if (values != null) {
for (Y val : values) {
in.value(val);
}
}
return entityManager.createQuery(criteriaQuery.where(in));
} } | public class class_name {
private <T, Y> TypedQuery<T> createTypedQueryIn(Class<T> entityCls,
SingularAttribute<T, Y> attribute, List<Y> values) {
EntityManager entityManager = this.entityManagerProvider.get();
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<T> criteriaQuery = builder.createQuery(entityCls);
Root<T> root = criteriaQuery.from(entityCls);
Path<Y> path = root.get(attribute);
CriteriaBuilder.In<Y> in = builder.in(path);
if (values != null) {
for (Y val : values) {
in.value(val); // depends on control dependency: [for], data = [val]
}
}
return entityManager.createQuery(criteriaQuery.where(in));
} } |
public class class_name {
public static base_responses unset(nitro_service client, autoscalepolicy resources[], String[] args) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
autoscalepolicy unsetresources[] = new autoscalepolicy[resources.length];
for (int i=0;i<resources.length;i++){
unsetresources[i] = new autoscalepolicy();
unsetresources[i].name = resources[i].name;
unsetresources[i].rule = resources[i].rule;
unsetresources[i].action = resources[i].action;
unsetresources[i].comment = resources[i].comment;
unsetresources[i].logaction = resources[i].logaction;
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} } | public class class_name {
public static base_responses unset(nitro_service client, autoscalepolicy resources[], String[] args) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
autoscalepolicy unsetresources[] = new autoscalepolicy[resources.length];
for (int i=0;i<resources.length;i++){
unsetresources[i] = new autoscalepolicy(); // depends on control dependency: [for], data = [i]
unsetresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i]
unsetresources[i].rule = resources[i].rule; // depends on control dependency: [for], data = [i]
unsetresources[i].action = resources[i].action; // depends on control dependency: [for], data = [i]
unsetresources[i].comment = resources[i].comment; // depends on control dependency: [for], data = [i]
unsetresources[i].logaction = resources[i].logaction; // depends on control dependency: [for], data = [i]
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} } |
public class class_name {
public EClass getGSCA() {
if (gscaEClass == null) {
gscaEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(466);
}
return gscaEClass;
} } | public class class_name {
public EClass getGSCA() {
if (gscaEClass == null) {
gscaEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(466); // depends on control dependency: [if], data = [none]
}
return gscaEClass;
} } |
public class class_name {
public MongodbBuilder builder() {
List<IRuleParser> mongodbRuleParsers = new ArrayList<>();
for (IRuleParser parser : ruleParsers) {
if (parser instanceof AbstractMongodbRuleParser) {
mongodbRuleParsers.add(parser);
}
}
return new MongodbBuilder(groupParser, mongodbRuleParsers, filters);
} } | public class class_name {
public MongodbBuilder builder() {
List<IRuleParser> mongodbRuleParsers = new ArrayList<>();
for (IRuleParser parser : ruleParsers) {
if (parser instanceof AbstractMongodbRuleParser) {
mongodbRuleParsers.add(parser); // depends on control dependency: [if], data = [none]
}
}
return new MongodbBuilder(groupParser, mongodbRuleParsers, filters);
} } |
public class class_name {
private WFSharedContext extractWFDispatcherResult(
final DispatcherResult dispatcherResult,
final List<StepExecutionResult> results,
final Map<String, Collection<StepExecutionResult>> failures,
final Map<Integer, StepExecutionResult> stepFailures,
int index,
int max
)
{
WFSharedContext wfSharedContext = new WFSharedContext();
ArrayList<HashMap<String, NodeStepResult>> mergedStepResults = new ArrayList<>(max);
ArrayList<Boolean> successes = new ArrayList<>(max);
HashMap<Integer, Map<String, NodeStepResult>> mergedStepFailures
= new HashMap<>();
//Convert a dispatcher result to a list of StepExecutionResults.
//each result for node in the dispatcheresult contains a workflow result
//unroll each workflow result, append the result of each step into map of node results
//merge each step result with the mergedStepResults
//DispatcherResult contains map {nodename: NodeStepResult}
for (final String nodeName : dispatcherResult.getResults().keySet()) {
final NodeStepResult stepResult = dispatcherResult.getResults().get(nodeName);
if (stepResult.getSharedContext() != null) {
wfSharedContext.merge(stepResult.getSharedContext());
}
//This NodeStepResult is produced by the DispatchedWorkflow wrapper
WorkflowExecutionResult result = DispatchedWorkflow.extractWorkflowResult(stepResult);
failures.computeIfAbsent(nodeName, k -> new ArrayList<>());
//extract failures for this node
final Collection<StepExecutionResult> thisNodeFailures = result.getNodeFailures().get(nodeName);
if (null != thisNodeFailures && thisNodeFailures.size() > 0) {
failures.get(nodeName).addAll(thisNodeFailures);
}
//extract failures by step (for this node)
Map<Integer, NodeStepResult> perStepFailures = DispatchedWorkflow.extractStepFailures(result,
stepResult.getNode());
for (final Map.Entry<Integer, NodeStepResult> entry : perStepFailures.entrySet()) {
Integer stepNum = entry.getKey();
NodeStepResult value = entry.getValue();
mergedStepFailures.computeIfAbsent(stepNum, k -> new HashMap<>());
mergedStepFailures.get(stepNum).put(nodeName, value);
}
if (result.getResultSet().size() < 1 && result.getNodeFailures().size() < 1 && result.getStepFailures()
.size() < 1 && !result.isSuccess()) {
//failure could be prior to any node step
mergedStepFailures.computeIfAbsent(0, k -> new HashMap<>());
mergedStepFailures.get(0).put(nodeName, stepResult);
}
//The WorkflowExecutionResult has a list of StepExecutionResults produced by NodeDispatchStepExecutor
List<NodeStepResult> results1 = DispatchedWorkflow.extractNodeStepResults(result, stepResult.getNode());
int i = 0;
for (final NodeStepResult nodeStepResult : results1) {
while (mergedStepResults.size() <= i) {
mergedStepResults.add(new HashMap<>());
}
while (successes.size() <= i) {
successes.add(Boolean.TRUE);
}
HashMap<String, NodeStepResult> map = mergedStepResults.get(i);
map.put(nodeName, nodeStepResult);
if (!nodeStepResult.isSuccess()) {
successes.set(i, false);
// failures.get(nodeName).add(nodeStepResult);
}
i++;
}
}
//add a new wrapped DispatcherResults for each original step
int x = 0;
for (final HashMap<String, NodeStepResult> map : mergedStepResults) {
Boolean success = successes.get(x);
DispatcherResult r = new DispatcherResultImpl(map, null != success ? success : false);
results.add(NodeDispatchStepExecutor.wrapDispatcherResult(r));
x++;
}
//merge failures for each step
for (final Integer integer : mergedStepFailures.keySet()) {
Map<String, NodeStepResult> map = mergedStepFailures.get(integer);
DispatcherResult r = new DispatcherResultImpl(map, false);
stepFailures.put(integer, NodeDispatchStepExecutor.wrapDispatcherResult(r));
}
return wfSharedContext;
} } | public class class_name {
private WFSharedContext extractWFDispatcherResult(
final DispatcherResult dispatcherResult,
final List<StepExecutionResult> results,
final Map<String, Collection<StepExecutionResult>> failures,
final Map<Integer, StepExecutionResult> stepFailures,
int index,
int max
)
{
WFSharedContext wfSharedContext = new WFSharedContext();
ArrayList<HashMap<String, NodeStepResult>> mergedStepResults = new ArrayList<>(max);
ArrayList<Boolean> successes = new ArrayList<>(max);
HashMap<Integer, Map<String, NodeStepResult>> mergedStepFailures
= new HashMap<>();
//Convert a dispatcher result to a list of StepExecutionResults.
//each result for node in the dispatcheresult contains a workflow result
//unroll each workflow result, append the result of each step into map of node results
//merge each step result with the mergedStepResults
//DispatcherResult contains map {nodename: NodeStepResult}
for (final String nodeName : dispatcherResult.getResults().keySet()) {
final NodeStepResult stepResult = dispatcherResult.getResults().get(nodeName);
if (stepResult.getSharedContext() != null) {
wfSharedContext.merge(stepResult.getSharedContext()); // depends on control dependency: [if], data = [(stepResult.getSharedContext()]
}
//This NodeStepResult is produced by the DispatchedWorkflow wrapper
WorkflowExecutionResult result = DispatchedWorkflow.extractWorkflowResult(stepResult);
failures.computeIfAbsent(nodeName, k -> new ArrayList<>()); // depends on control dependency: [for], data = [nodeName]
//extract failures for this node
final Collection<StepExecutionResult> thisNodeFailures = result.getNodeFailures().get(nodeName);
if (null != thisNodeFailures && thisNodeFailures.size() > 0) {
failures.get(nodeName).addAll(thisNodeFailures); // depends on control dependency: [if], data = [none]
}
//extract failures by step (for this node)
Map<Integer, NodeStepResult> perStepFailures = DispatchedWorkflow.extractStepFailures(result,
stepResult.getNode());
for (final Map.Entry<Integer, NodeStepResult> entry : perStepFailures.entrySet()) {
Integer stepNum = entry.getKey();
NodeStepResult value = entry.getValue();
mergedStepFailures.computeIfAbsent(stepNum, k -> new HashMap<>()); // depends on control dependency: [for], data = [none]
mergedStepFailures.get(stepNum).put(nodeName, value); // depends on control dependency: [for], data = [none]
}
if (result.getResultSet().size() < 1 && result.getNodeFailures().size() < 1 && result.getStepFailures()
.size() < 1 && !result.isSuccess()) {
//failure could be prior to any node step
mergedStepFailures.computeIfAbsent(0, k -> new HashMap<>()); // depends on control dependency: [if], data = [none]
mergedStepFailures.get(0).put(nodeName, stepResult); // depends on control dependency: [if], data = [none]
}
//The WorkflowExecutionResult has a list of StepExecutionResults produced by NodeDispatchStepExecutor
List<NodeStepResult> results1 = DispatchedWorkflow.extractNodeStepResults(result, stepResult.getNode());
int i = 0;
for (final NodeStepResult nodeStepResult : results1) {
while (mergedStepResults.size() <= i) {
mergedStepResults.add(new HashMap<>()); // depends on control dependency: [while], data = [none]
}
while (successes.size() <= i) {
successes.add(Boolean.TRUE); // depends on control dependency: [while], data = [none]
}
HashMap<String, NodeStepResult> map = mergedStepResults.get(i);
map.put(nodeName, nodeStepResult); // depends on control dependency: [for], data = [nodeStepResult]
if (!nodeStepResult.isSuccess()) {
successes.set(i, false); // depends on control dependency: [if], data = [none]
// failures.get(nodeName).add(nodeStepResult);
}
i++; // depends on control dependency: [for], data = [none]
}
}
//add a new wrapped DispatcherResults for each original step
int x = 0;
for (final HashMap<String, NodeStepResult> map : mergedStepResults) {
Boolean success = successes.get(x);
DispatcherResult r = new DispatcherResultImpl(map, null != success ? success : false);
results.add(NodeDispatchStepExecutor.wrapDispatcherResult(r)); // depends on control dependency: [for], data = [none]
x++; // depends on control dependency: [for], data = [none]
}
//merge failures for each step
for (final Integer integer : mergedStepFailures.keySet()) {
Map<String, NodeStepResult> map = mergedStepFailures.get(integer);
DispatcherResult r = new DispatcherResultImpl(map, false);
stepFailures.put(integer, NodeDispatchStepExecutor.wrapDispatcherResult(r)); // depends on control dependency: [for], data = [integer]
}
return wfSharedContext;
} } |
public class class_name {
@Override
public void flush() {
Exceptions.checkNotClosed(this.closed, this);
if (!this.hasDataInCurrentFrame) {
// Nothing to do.
return;
}
// Seal the current frame for appends.
this.currentFrame.seal();
// Invoke the callback. At the end of this, the frame is committed so we can get rid of it.
if (!this.currentFrame.isEmpty()) {
// Only flush something if it's not empty.
this.bufferFactory.markUsed(this.currentFrame.getLength());
this.dataFrameCompleteCallback.accept(this.currentFrame);
}
reset();
} } | public class class_name {
@Override
public void flush() {
Exceptions.checkNotClosed(this.closed, this);
if (!this.hasDataInCurrentFrame) {
// Nothing to do.
return; // depends on control dependency: [if], data = [none]
}
// Seal the current frame for appends.
this.currentFrame.seal();
// Invoke the callback. At the end of this, the frame is committed so we can get rid of it.
if (!this.currentFrame.isEmpty()) {
// Only flush something if it's not empty.
this.bufferFactory.markUsed(this.currentFrame.getLength()); // depends on control dependency: [if], data = [none]
this.dataFrameCompleteCallback.accept(this.currentFrame); // depends on control dependency: [if], data = [none]
}
reset();
} } |
public class class_name {
public boolean attach() {
if (!attached) {
attached = true;
if (isLocalBeanStoreSyncNeeded()) {
if (!beanStore.delegate().isEmpty()) {
// The local bean store is authoritative, so copy everything to the backing store
for (BeanIdentifier id : beanStore) {
ContextualInstance<?> instance = beanStore.get(id);
String prefixedId = getNamingScheme().prefix(id);
ContextLogger.LOG.updatingStoreWithContextualUnderId(instance, id);
setAttribute(prefixedId, instance);
}
}
if (!isAttributeLazyFetchingEnabled()) {
// Additionally copy anything not in the local bean store but in the backing store
fetchUninitializedAttributes();
}
}
return true;
} else {
return false;
}
} } | public class class_name {
public boolean attach() {
if (!attached) {
attached = true; // depends on control dependency: [if], data = [none]
if (isLocalBeanStoreSyncNeeded()) {
if (!beanStore.delegate().isEmpty()) {
// The local bean store is authoritative, so copy everything to the backing store
for (BeanIdentifier id : beanStore) {
ContextualInstance<?> instance = beanStore.get(id);
String prefixedId = getNamingScheme().prefix(id);
ContextLogger.LOG.updatingStoreWithContextualUnderId(instance, id); // depends on control dependency: [for], data = [id]
setAttribute(prefixedId, instance); // depends on control dependency: [for], data = [none]
}
}
if (!isAttributeLazyFetchingEnabled()) {
// Additionally copy anything not in the local bean store but in the backing store
fetchUninitializedAttributes(); // 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 void registerCleanupTimer(W window) {
long cleanupTime = cleanupTime(window);
if (cleanupTime == Long.MAX_VALUE) {
// don't set a GC timer for "end of time"
return;
}
if (windowAssigner.isEventTime()) {
triggerContext.registerEventTimeTimer(cleanupTime);
} else {
triggerContext.registerProcessingTimeTimer(cleanupTime);
}
} } | public class class_name {
private void registerCleanupTimer(W window) {
long cleanupTime = cleanupTime(window);
if (cleanupTime == Long.MAX_VALUE) {
// don't set a GC timer for "end of time"
return; // depends on control dependency: [if], data = [none]
}
if (windowAssigner.isEventTime()) {
triggerContext.registerEventTimeTimer(cleanupTime); // depends on control dependency: [if], data = [none]
} else {
triggerContext.registerProcessingTimeTimer(cleanupTime); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public DataSet next() {
if (!iter.hasNext() && passes < numPasses) {
passes++;
batch = 0;
log.info("Epoch " + passes + " batch " + batch);
iter.reset();
}
batch++;
DataSet next = iter.next();
if (preProcessor != null)
preProcessor.preProcess(next);
return next;
} } | public class class_name {
@Override
public DataSet next() {
if (!iter.hasNext() && passes < numPasses) {
passes++; // depends on control dependency: [if], data = [none]
batch = 0; // depends on control dependency: [if], data = [none]
log.info("Epoch " + passes + " batch " + batch); // depends on control dependency: [if], data = [none]
iter.reset(); // depends on control dependency: [if], data = [none]
}
batch++;
DataSet next = iter.next();
if (preProcessor != null)
preProcessor.preProcess(next);
return next;
} } |
public class class_name {
public List<Long> selectPostIds() throws SQLException {
List<Long> ids = Lists.newArrayListWithExpectedSize(4096);
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
conn = connectionSupplier.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(selectAllPostIdsSQL);
while(rs.next()) {
ids.add(rs.getLong(1));
}
} finally {
SQLUtil.closeQuietly(conn, stmt, rs);
}
return ids;
} } | public class class_name {
public List<Long> selectPostIds() throws SQLException {
List<Long> ids = Lists.newArrayListWithExpectedSize(4096);
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
conn = connectionSupplier.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(selectAllPostIdsSQL);
while(rs.next()) {
ids.add(rs.getLong(1)); // depends on control dependency: [while], data = [none]
}
} finally {
SQLUtil.closeQuietly(conn, stmt, rs);
}
return ids;
} } |
public class class_name {
private static String commandRun(Command command) {
// Wait bind
if (I_COMMAND == null) {
synchronized (I_LOCK) {
if (I_COMMAND == null) {
try {
I_LOCK.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
// Cancel Destroy Service
cancelDestroyService();
// Get result
// In this we should try 5 count get the result
int count = 5;
Exception error = null;
while (count > 0) {
if (command.isCancel) {
if (command.mListener != null)
command.mListener.onCancel();
break;
}
try {
command.mResult = I_COMMAND.command(command.mId, command.mTimeout, command.mParameters);
if (command.mListener != null)
command.mListener.onCompleted(command.mResult);
break;
} catch (Exception e) {
error = e;
count--;
try {
Thread.sleep(3000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
// Check is Error
if (count <= 0 && command.mListener != null) {
command.mListener.onError(error);
}
// Check is end and call destroy service
if (I_COMMAND != null) {
try {
if (I_COMMAND.getTaskCount() <= 0)
destroyService();
} catch (Exception e) {
e.printStackTrace();
}
}
// Return
return command.mResult;
} } | public class class_name {
private static String commandRun(Command command) {
// Wait bind
if (I_COMMAND == null) {
synchronized (I_LOCK) { // depends on control dependency: [if], data = [none]
if (I_COMMAND == null) {
try {
I_LOCK.wait(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
}
}
// Cancel Destroy Service
cancelDestroyService();
// Get result
// In this we should try 5 count get the result
int count = 5;
Exception error = null;
while (count > 0) {
if (command.isCancel) {
if (command.mListener != null)
command.mListener.onCancel();
break;
}
try {
command.mResult = I_COMMAND.command(command.mId, command.mTimeout, command.mParameters); // depends on control dependency: [try], data = [none]
if (command.mListener != null)
command.mListener.onCompleted(command.mResult);
break;
} catch (Exception e) {
error = e;
count--;
try {
Thread.sleep(3000); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e1) {
e1.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
}
// Check is Error
if (count <= 0 && command.mListener != null) {
command.mListener.onError(error); // depends on control dependency: [if], data = [none]
}
// Check is end and call destroy service
if (I_COMMAND != null) {
try {
if (I_COMMAND.getTaskCount() <= 0)
destroyService();
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
// Return
return command.mResult;
} } |
public class class_name {
public static List<Field> getAllDeclaredFields(Class<? extends ParaObject> clazz) {
LinkedList<Field> fields = new LinkedList<>();
if (clazz == null) {
return fields;
}
Class<?> parent = clazz;
do {
for (Field field : parent.getDeclaredFields()) {
if (!Modifier.isTransient(field.getModifiers()) &&
!field.getName().equals("serialVersionUID")) {
fields.add(field);
}
}
parent = parent.getSuperclass();
} while (!parent.equals(Object.class));
return fields;
} } | public class class_name {
public static List<Field> getAllDeclaredFields(Class<? extends ParaObject> clazz) {
LinkedList<Field> fields = new LinkedList<>();
if (clazz == null) {
return fields; // depends on control dependency: [if], data = [none]
}
Class<?> parent = clazz;
do {
for (Field field : parent.getDeclaredFields()) {
if (!Modifier.isTransient(field.getModifiers()) &&
!field.getName().equals("serialVersionUID")) {
fields.add(field); // depends on control dependency: [if], data = [none]
}
}
parent = parent.getSuperclass();
} while (!parent.equals(Object.class));
return fields;
} } |
public class class_name {
@Override
protected HttpResponse convertResponse(Envelope response) {
ByteBuf responseBuffer = Unpooled.buffer();
try {
OutputStream outputStream = new ByteBufOutputStream(responseBuffer);
response.writeTo(outputStream);
outputStream.flush();
} catch (IOException e) {
// Deliberately ignored, as the underlying operation doesn't involve I/O
}
FullHttpResponse httpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.OK, responseBuffer);
httpResponse.headers().set(HttpHeaders.Names.CONTENT_LENGTH, responseBuffer.readableBytes());
httpResponse.headers().set(HttpHeaders.Names.CONTENT_TYPE, QuartzProtocol.CONTENT_TYPE);
return httpResponse;
} } | public class class_name {
@Override
protected HttpResponse convertResponse(Envelope response) {
ByteBuf responseBuffer = Unpooled.buffer();
try {
OutputStream outputStream = new ByteBufOutputStream(responseBuffer);
response.writeTo(outputStream); // depends on control dependency: [try], data = [none]
outputStream.flush(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// Deliberately ignored, as the underlying operation doesn't involve I/O
} // depends on control dependency: [catch], data = [none]
FullHttpResponse httpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.OK, responseBuffer);
httpResponse.headers().set(HttpHeaders.Names.CONTENT_LENGTH, responseBuffer.readableBytes());
httpResponse.headers().set(HttpHeaders.Names.CONTENT_TYPE, QuartzProtocol.CONTENT_TYPE);
return httpResponse;
} } |
public class class_name {
public void diagnostics() {
log.finest("Thread count = " + threadCounter);
if (threadCounter.get() > 0) {
log.finest("Thread names:");
synchronized (threadNames) {
for (String name : threadNames) {
log.finest("\t" + name);
}
}
}
} } | public class class_name {
public void diagnostics() {
log.finest("Thread count = " + threadCounter);
if (threadCounter.get() > 0) {
log.finest("Thread names:"); // depends on control dependency: [if], data = [none]
synchronized (threadNames) { // depends on control dependency: [if], data = [none]
for (String name : threadNames) {
log.finest("\t" + name); // depends on control dependency: [for], data = [name]
}
}
}
} } |
public class class_name {
@Action(name = "Convert JSON to XML",
outputs = {
@Output(RETURN_RESULT),
@Output(RETURN_CODE)
},
responses = {
@Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS),
@Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE)
})
public Map<String, String> execute(
@Param(value = JSON, required = true) String json,
@Param(value = PRETTY_PRINT) String prettyPrint,
@Param(value = SHOW_XML_DECLARATION) String showXmlDeclaration,
@Param(value = ROOT_TAG_NAME) String rootTagName,
@Param(value = DEFAULT_JSON_ARRAY_ITEM_NAME) String defaultJsonArrayItemName,
@Param(value = NAMESPACES_PREFIXES) String namespacesPrefixes,
@Param(value = NAMESPACES_URIS) String namespacesUris,
@Param(value = JSON_ARRAYS_NAMES) String jsonArraysNames,
@Param(value = JSON_ARRAYS_ITEM_NAMES) String jsonArraysItemNames,
@Param(value = DELIMITER) String delimiter) {
try {
showXmlDeclaration = StringUtils.defaultIfEmpty(showXmlDeclaration, TRUE);
prettyPrint = StringUtils.defaultIfEmpty(prettyPrint, TRUE);
ValidateUtils.validateInputs(prettyPrint, showXmlDeclaration);
final ConvertJsonToXmlInputs inputs = new ConvertJsonToXmlInputs.ConvertJsonToXmlInputsBuilder()
.withJson(json)
.withPrettyPrint(Boolean.parseBoolean(prettyPrint))
.withShowXmlDeclaration(Boolean.parseBoolean(showXmlDeclaration))
.withRootTagName(rootTagName)
.withDefaultJsonArrayItemName(defaultJsonArrayItemName)
.withNamespaces(namespacesUris, namespacesPrefixes, delimiter)
.withJsonArraysNames(jsonArraysNames, jsonArraysItemNames, delimiter)
.build();
final ConvertJsonToXmlService converter = new ConvertJsonToXmlService();
converter.setNamespaces(inputs.getNamespaces());
converter.setJsonArrayItemNames(inputs.getArraysItemNames());
converter.setJsonArrayItemName(inputs.getDefaultJsonArrayItemName());
final String xml = converter.convertToXmlString(inputs);
return getSuccessResultsMap(xml);
} catch (Exception e) {
return getFailureResultsMap(e);
}
} } | public class class_name {
@Action(name = "Convert JSON to XML",
outputs = {
@Output(RETURN_RESULT),
@Output(RETURN_CODE)
},
responses = {
@Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS),
@Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE)
})
public Map<String, String> execute(
@Param(value = JSON, required = true) String json,
@Param(value = PRETTY_PRINT) String prettyPrint,
@Param(value = SHOW_XML_DECLARATION) String showXmlDeclaration,
@Param(value = ROOT_TAG_NAME) String rootTagName,
@Param(value = DEFAULT_JSON_ARRAY_ITEM_NAME) String defaultJsonArrayItemName,
@Param(value = NAMESPACES_PREFIXES) String namespacesPrefixes,
@Param(value = NAMESPACES_URIS) String namespacesUris,
@Param(value = JSON_ARRAYS_NAMES) String jsonArraysNames,
@Param(value = JSON_ARRAYS_ITEM_NAMES) String jsonArraysItemNames,
@Param(value = DELIMITER) String delimiter) {
try {
showXmlDeclaration = StringUtils.defaultIfEmpty(showXmlDeclaration, TRUE); // depends on control dependency: [try], data = [none]
prettyPrint = StringUtils.defaultIfEmpty(prettyPrint, TRUE); // depends on control dependency: [try], data = [none]
ValidateUtils.validateInputs(prettyPrint, showXmlDeclaration); // depends on control dependency: [try], data = [none]
final ConvertJsonToXmlInputs inputs = new ConvertJsonToXmlInputs.ConvertJsonToXmlInputsBuilder()
.withJson(json)
.withPrettyPrint(Boolean.parseBoolean(prettyPrint))
.withShowXmlDeclaration(Boolean.parseBoolean(showXmlDeclaration))
.withRootTagName(rootTagName)
.withDefaultJsonArrayItemName(defaultJsonArrayItemName)
.withNamespaces(namespacesUris, namespacesPrefixes, delimiter)
.withJsonArraysNames(jsonArraysNames, jsonArraysItemNames, delimiter)
.build();
final ConvertJsonToXmlService converter = new ConvertJsonToXmlService();
converter.setNamespaces(inputs.getNamespaces()); // depends on control dependency: [try], data = [none]
converter.setJsonArrayItemNames(inputs.getArraysItemNames()); // depends on control dependency: [try], data = [none]
converter.setJsonArrayItemName(inputs.getDefaultJsonArrayItemName()); // depends on control dependency: [try], data = [none]
final String xml = converter.convertToXmlString(inputs);
return getSuccessResultsMap(xml); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return getFailureResultsMap(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Iterable<FieldDefinition> getNestedFields() {
if (m_type != FieldType.GROUP) {
return null;
}
assert m_nestedFieldMap != null;
assert m_nestedFieldMap.size() > 0;
return m_nestedFieldMap.values();
} } | public class class_name {
public Iterable<FieldDefinition> getNestedFields() {
if (m_type != FieldType.GROUP) {
return null;
// depends on control dependency: [if], data = [none]
}
assert m_nestedFieldMap != null;
assert m_nestedFieldMap.size() > 0;
return m_nestedFieldMap.values();
} } |
public class class_name {
public Observable<ServiceResponse<Page<SiteInner>>> listWebAppsSinglePageAsync(final String resourceGroupName, final String name) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final String skipToken = null;
final String filter = null;
final String top = null;
return service.listWebApps(resourceGroupName, name, this.client.subscriptionId(), skipToken, filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SiteInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SiteInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<SiteInner>> result = listWebAppsDelegate(response);
return Observable.just(new ServiceResponse<Page<SiteInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<SiteInner>>> listWebAppsSinglePageAsync(final String resourceGroupName, final String name) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final String skipToken = null;
final String filter = null;
final String top = null;
return service.listWebApps(resourceGroupName, name, this.client.subscriptionId(), skipToken, filter, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SiteInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SiteInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<SiteInner>> result = listWebAppsDelegate(response);
return Observable.just(new ServiceResponse<Page<SiteInner>>(result.body(), result.response())); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
@Override
public void open() {
if (isOpen()) {
return;
}
beforeOpen();
service = newExecutorService();
validateParameters();
try {
process = launch();
} catch (IOException e) {
LOGGER.error(e.toString(), e);
return;
}
out = process.getOutputStream();
in = process.getInputStream();
err = process.getErrorStream();
// error must be consumed, if not, too much data blocking will crash process or
// blocking IO
service.submit(newErrorConsumeWorker());
isOpen = true;
afterOpen();
} } | public class class_name {
@Override
public void open() {
if (isOpen()) {
return; // depends on control dependency: [if], data = [none]
}
beforeOpen();
service = newExecutorService();
validateParameters();
try {
process = launch(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOGGER.error(e.toString(), e);
return;
} // depends on control dependency: [catch], data = [none]
out = process.getOutputStream();
in = process.getInputStream();
err = process.getErrorStream();
// error must be consumed, if not, too much data blocking will crash process or
// blocking IO
service.submit(newErrorConsumeWorker());
isOpen = true;
afterOpen();
} } |
public class class_name {
public void marshall(PortfolioDetail portfolioDetail, ProtocolMarshaller protocolMarshaller) {
if (portfolioDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(portfolioDetail.getId(), ID_BINDING);
protocolMarshaller.marshall(portfolioDetail.getARN(), ARN_BINDING);
protocolMarshaller.marshall(portfolioDetail.getDisplayName(), DISPLAYNAME_BINDING);
protocolMarshaller.marshall(portfolioDetail.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(portfolioDetail.getCreatedTime(), CREATEDTIME_BINDING);
protocolMarshaller.marshall(portfolioDetail.getProviderName(), PROVIDERNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PortfolioDetail portfolioDetail, ProtocolMarshaller protocolMarshaller) {
if (portfolioDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(portfolioDetail.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(portfolioDetail.getARN(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(portfolioDetail.getDisplayName(), DISPLAYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(portfolioDetail.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(portfolioDetail.getCreatedTime(), CREATEDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(portfolioDetail.getProviderName(), PROVIDERNAME_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 static boolean nodeMatches(final Node nd, final QName tag) {
if (tag == null) {
return false;
}
String ns = nd.getNamespaceURI();
if (ns == null) {
/* It appears a node can have a NULL namespace but a QName has a zero length
*/
if ((tag.getNamespaceURI() != null) && (!"".equals(tag.getNamespaceURI()))) {
return false;
}
} else if (!ns.equals(tag.getNamespaceURI())) {
return false;
}
String ln = nd.getLocalName();
if (ln == null) {
if (tag.getLocalPart() != null) {
return false;
}
} else if (!ln.equals(tag.getLocalPart())) {
return false;
}
return true;
} } | public class class_name {
public static boolean nodeMatches(final Node nd, final QName tag) {
if (tag == null) {
return false; // depends on control dependency: [if], data = [none]
}
String ns = nd.getNamespaceURI();
if (ns == null) {
/* It appears a node can have a NULL namespace but a QName has a zero length
*/
if ((tag.getNamespaceURI() != null) && (!"".equals(tag.getNamespaceURI()))) {
return false; // depends on control dependency: [if], data = [none]
}
} else if (!ns.equals(tag.getNamespaceURI())) {
return false; // depends on control dependency: [if], data = [none]
}
String ln = nd.getLocalName();
if (ln == null) {
if (tag.getLocalPart() != null) {
return false; // depends on control dependency: [if], data = [none]
}
} else if (!ln.equals(tag.getLocalPart())) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
synchronized void checkEvict() throws IOException {
if (cacheSize.get() < cacheSizeMax) {
return; // nothing to do, plenty of free space
}
// Only one thread should be doing the eviction. Do not block
// current thread, it is ok to oversubscribe the cache size
// temporarily.
if (evictionInProgress) {
return;
}
// record the fact that eviction has started.
evictionInProgress = true;
try {
// if the cache has reached a threshold size, then free old entries.
long curSize = cacheSize.get();
// how much to evict in one iteration
long targetSize = cacheSizeMax -
(cacheSizeMax * cacheEvictPercent)/100;
if (LOG.isDebugEnabled()) {
LOG.debug("Cache size " + curSize + " has exceeded the " +
" maximum configured cacpacity " + cacheSizeMax +
". Eviction has to reduce cache size to " +
targetSize);
}
// sort all entries based on their accessTimes
Collection<CacheEntry> values = cacheMap.values();
CacheEntry[] records = values.toArray(new CacheEntry[values.size()]);
Arrays.sort(records, LRU_COMPARATOR);
for (int i = 0; i < records.length; i++) {
if (cacheSize.get() <= targetSize) {
break; // we reclaimed everything we wanted to
}
CacheEntry c = records[i];
evictCache(c.hdfsPath);
}
} finally {
evictionInProgress = false; // eviction done.
}
if (LOG.isDebugEnabled()) {
LOG.debug("Cache eviction complete. Current cache size is " +
cacheSize.get());
}
} } | public class class_name {
synchronized void checkEvict() throws IOException {
if (cacheSize.get() < cacheSizeMax) {
return; // nothing to do, plenty of free space
}
// Only one thread should be doing the eviction. Do not block
// current thread, it is ok to oversubscribe the cache size
// temporarily.
if (evictionInProgress) {
return;
}
// record the fact that eviction has started.
evictionInProgress = true;
try {
// if the cache has reached a threshold size, then free old entries.
long curSize = cacheSize.get();
// how much to evict in one iteration
long targetSize = cacheSizeMax -
(cacheSizeMax * cacheEvictPercent)/100;
if (LOG.isDebugEnabled()) {
LOG.debug("Cache size " + curSize + " has exceeded the " +
" maximum configured cacpacity " + cacheSizeMax +
". Eviction has to reduce cache size to " +
targetSize); // depends on control dependency: [if], data = [none]
}
// sort all entries based on their accessTimes
Collection<CacheEntry> values = cacheMap.values();
CacheEntry[] records = values.toArray(new CacheEntry[values.size()]);
Arrays.sort(records, LRU_COMPARATOR);
for (int i = 0; i < records.length; i++) {
if (cacheSize.get() <= targetSize) {
break; // we reclaimed everything we wanted to
}
CacheEntry c = records[i];
evictCache(c.hdfsPath); // depends on control dependency: [for], data = [none]
}
} finally {
evictionInProgress = false; // eviction done.
}
if (LOG.isDebugEnabled()) {
LOG.debug("Cache eviction complete. Current cache size is " +
cacheSize.get());
}
} } |
public class class_name {
public static float nextUpF(float f) {
if (Float.isNaN(f) || f == Float.POSITIVE_INFINITY) {
return f;
} else {
f += 0.0f;
return Float.intBitsToFloat(Float.floatToRawIntBits(f) + ((f >= 0.0f) ? +1 : -1));
}
} } | public class class_name {
public static float nextUpF(float f) {
if (Float.isNaN(f) || f == Float.POSITIVE_INFINITY) {
return f; // depends on control dependency: [if], data = [none]
} else {
f += 0.0f; // depends on control dependency: [if], data = [none]
return Float.intBitsToFloat(Float.floatToRawIntBits(f) + ((f >= 0.0f) ? +1 : -1)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public SharedSlot allocateSharedSlot(SlotSharingGroupAssignment sharingGroupAssignment)
throws InstanceDiedException {
synchronized (instanceLock) {
if (isDead) {
throw new InstanceDiedException(this);
}
Integer nextSlot = availableSlots.poll();
if (nextSlot == null) {
return null;
}
else {
SharedSlot slot = new SharedSlot(
this,
location,
nextSlot,
taskManagerGateway,
sharingGroupAssignment);
allocatedSlots.add(slot);
return slot;
}
}
} } | public class class_name {
public SharedSlot allocateSharedSlot(SlotSharingGroupAssignment sharingGroupAssignment)
throws InstanceDiedException {
synchronized (instanceLock) {
if (isDead) {
throw new InstanceDiedException(this);
}
Integer nextSlot = availableSlots.poll();
if (nextSlot == null) {
return null; // depends on control dependency: [if], data = [none]
}
else {
SharedSlot slot = new SharedSlot(
this,
location,
nextSlot,
taskManagerGateway,
sharingGroupAssignment);
allocatedSlots.add(slot); // depends on control dependency: [if], data = [none]
return slot; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public Convertor getConvertor(Class src, Class dest) {
if (src == dest) {
// 对相同类型的直接忽略,不做转换
return null;
}
// 按照src->dest来取映射
Convertor convertor = repository.getConvertor(src, dest);
// 处理下Array|Collection的映射
// 如果src|dest是array类型,取一下Array.class的映射,因为默认数组处理的注册直接注册了Array.class
boolean isSrcArray = src.isArray();
boolean isDestArray = dest.isArray();
if (convertor == null && src.isArray() && dest.isArray()) {
convertor = arrayToArray;
} else {
boolean isSrcCollection = Collection.class.isAssignableFrom(src);
boolean isDestCollection = Collection.class.isAssignableFrom(dest);
if (convertor == null && isSrcArray && isDestCollection) {
convertor = arrayToCollection;
}
if (convertor == null && isDestArray && isSrcCollection) {
convertor = collectionToArray;
}
if (convertor == null && isSrcCollection && isDestCollection) {
convertor = collectionToCollection;
}
}
// 如果dest是string,获取一下object->string. (系统默认注册了一个Object.class -> String.class的转化)
if (convertor == null && dest == String.class) {
if (src.isEnum()) {// 如果是枚举
convertor = enumToString;
} else { // 默认进行toString输出
convertor = objectToString;
}
}
// 如果是其中一个是String类
if (convertor == null && src == String.class) {
if (commonTypes.containsKey(dest)) { // 另一个是Common类型
convertor = stringToCommon;
} else if (dest.isEnum()) { // 另一个是枚举对象
convertor = stringToEnum;
}
}
// 如果src/dest都是Common类型,进行特殊处理
if (convertor == null && commonTypes.containsKey(src) && commonTypes.containsKey(dest)) {
convertor = commonToCommon;
}
return convertor;
} } | public class class_name {
public Convertor getConvertor(Class src, Class dest) {
if (src == dest) {
// 对相同类型的直接忽略,不做转换
return null; // depends on control dependency: [if], data = [none]
}
// 按照src->dest来取映射
Convertor convertor = repository.getConvertor(src, dest);
// 处理下Array|Collection的映射
// 如果src|dest是array类型,取一下Array.class的映射,因为默认数组处理的注册直接注册了Array.class
boolean isSrcArray = src.isArray();
boolean isDestArray = dest.isArray();
if (convertor == null && src.isArray() && dest.isArray()) {
convertor = arrayToArray; // depends on control dependency: [if], data = [none]
} else {
boolean isSrcCollection = Collection.class.isAssignableFrom(src);
boolean isDestCollection = Collection.class.isAssignableFrom(dest);
if (convertor == null && isSrcArray && isDestCollection) {
convertor = arrayToCollection; // depends on control dependency: [if], data = [none]
}
if (convertor == null && isDestArray && isSrcCollection) {
convertor = collectionToArray; // depends on control dependency: [if], data = [none]
}
if (convertor == null && isSrcCollection && isDestCollection) {
convertor = collectionToCollection; // depends on control dependency: [if], data = [none]
}
}
// 如果dest是string,获取一下object->string. (系统默认注册了一个Object.class -> String.class的转化)
if (convertor == null && dest == String.class) {
if (src.isEnum()) {// 如果是枚举
convertor = enumToString; // depends on control dependency: [if], data = [none]
} else { // 默认进行toString输出
convertor = objectToString; // depends on control dependency: [if], data = [none]
}
}
// 如果是其中一个是String类
if (convertor == null && src == String.class) {
if (commonTypes.containsKey(dest)) { // 另一个是Common类型
convertor = stringToCommon; // depends on control dependency: [if], data = [none]
} else if (dest.isEnum()) { // 另一个是枚举对象
convertor = stringToEnum; // depends on control dependency: [if], data = [none]
}
}
// 如果src/dest都是Common类型,进行特殊处理
if (convertor == null && commonTypes.containsKey(src) && commonTypes.containsKey(dest)) {
convertor = commonToCommon; // depends on control dependency: [if], data = [none]
}
return convertor;
} } |
public class class_name {
public static String getProtectionLevel(int value) {
List<String> levels = new ArrayList<>(3);
if ((value & 0x10) != 0) {
value = value ^ 0x10;
levels.add("system");
}
if ((value & 0x20) != 0) {
value = value ^ 0x20;
levels.add("development");
}
switch (value) {
case 0:
levels.add("normal");
break;
case 1:
levels.add("dangerous");
break;
case 2:
levels.add("signature");
break;
case 3:
levels.add("signatureOrSystem");
break;
default:
levels.add("ProtectionLevel:" + Integer.toHexString(value));
}
return Strings.join(levels, "|");
} } | public class class_name {
public static String getProtectionLevel(int value) {
List<String> levels = new ArrayList<>(3);
if ((value & 0x10) != 0) {
value = value ^ 0x10; // depends on control dependency: [if], data = [none]
levels.add("system"); // depends on control dependency: [if], data = [none]
}
if ((value & 0x20) != 0) {
value = value ^ 0x20; // depends on control dependency: [if], data = [none]
levels.add("development"); // depends on control dependency: [if], data = [none]
}
switch (value) {
case 0:
levels.add("normal");
break;
case 1:
levels.add("dangerous");
break;
case 2:
levels.add("signature");
break;
case 3:
levels.add("signatureOrSystem");
break;
default:
levels.add("ProtectionLevel:" + Integer.toHexString(value));
}
return Strings.join(levels, "|");
} } |
public class class_name {
private Pair<String, String> readBalancedLine() throws IOException {
String line = readCountedLine();
if (line == null) {
return null;
}
while (line.indexOf('\f') > 0) {
line = line.substring(line.indexOf('\f'));
}
if (line.length() != 0 && line.charAt(0) == '\f') {
String subjectLine = readCountedLine();
if (subjectLine != null && subjectLine.length() != 0
&& apparentConfFileHeader(line) && apparentXMLFileStart(subjectLine)) {
StringBuilder sb = new StringBuilder();
while (subjectLine != null && subjectLine.indexOf('\f') > 0) {
subjectLine = subjectLine.substring(subjectLine.indexOf('\f'));
}
while (subjectLine != null
&& (subjectLine.length() == 0 || subjectLine.charAt(0) != '\f')) {
sb.append(subjectLine);
subjectLine = readCountedLine();
}
if (subjectLine != null) {
unreadCountedLine(subjectLine);
}
return new Pair<String, String>(line, sb.toString());
}
// here we had a file line, but it introduced a log segment, not
// a conf file. We want to just ignore the file line.
return readBalancedLine();
}
String endlineString = (version == 0 ? " " : " .");
if (line.length() < endlineString.length()) {
return new Pair<String, String>(null, line);
}
if (!endlineString.equals(line.substring(line.length()
- endlineString.length()))) {
StringBuilder sb = new StringBuilder(line);
String addedLine;
do {
addedLine = readCountedLine();
if (addedLine == null) {
return new Pair<String, String>(null, sb.toString());
}
while (addedLine.indexOf('\f') > 0) {
addedLine = addedLine.substring(addedLine.indexOf('\f'));
}
if (addedLine.length() > 0 && addedLine.charAt(0) == '\f') {
unreadCountedLine(addedLine);
return new Pair<String, String>(null, sb.toString());
}
sb.append("\n");
sb.append(addedLine);
} while (addedLine.length() >= endlineString.length() &&
!endlineString.equals(addedLine.substring(addedLine.length()
- endlineString.length())));
line = sb.toString();
}
return new Pair<String, String>(null, line);
} } | public class class_name {
private Pair<String, String> readBalancedLine() throws IOException {
String line = readCountedLine();
if (line == null) {
return null;
}
while (line.indexOf('\f') > 0) {
line = line.substring(line.indexOf('\f'));
}
if (line.length() != 0 && line.charAt(0) == '\f') {
String subjectLine = readCountedLine();
if (subjectLine != null && subjectLine.length() != 0
&& apparentConfFileHeader(line) && apparentXMLFileStart(subjectLine)) {
StringBuilder sb = new StringBuilder();
while (subjectLine != null && subjectLine.indexOf('\f') > 0) {
subjectLine = subjectLine.substring(subjectLine.indexOf('\f')); // depends on control dependency: [while], data = [(subjectLine]
}
while (subjectLine != null
&& (subjectLine.length() == 0 || subjectLine.charAt(0) != '\f')) {
sb.append(subjectLine); // depends on control dependency: [while], data = [(subjectLine]
subjectLine = readCountedLine(); // depends on control dependency: [while], data = [none]
}
if (subjectLine != null) {
unreadCountedLine(subjectLine); // depends on control dependency: [if], data = [(subjectLine]
}
return new Pair<String, String>(line, sb.toString()); // depends on control dependency: [if], data = [none]
}
// here we had a file line, but it introduced a log segment, not
// a conf file. We want to just ignore the file line.
return readBalancedLine();
}
String endlineString = (version == 0 ? " " : " .");
if (line.length() < endlineString.length()) {
return new Pair<String, String>(null, line);
}
if (!endlineString.equals(line.substring(line.length()
- endlineString.length()))) {
StringBuilder sb = new StringBuilder(line);
String addedLine;
do {
addedLine = readCountedLine();
if (addedLine == null) {
return new Pair<String, String>(null, sb.toString()); // depends on control dependency: [if], data = [none]
}
while (addedLine.indexOf('\f') > 0) {
addedLine = addedLine.substring(addedLine.indexOf('\f')); // depends on control dependency: [while], data = [(addedLine.indexOf('\f')]
}
if (addedLine.length() > 0 && addedLine.charAt(0) == '\f') {
unreadCountedLine(addedLine); // depends on control dependency: [if], data = [none]
return new Pair<String, String>(null, sb.toString()); // depends on control dependency: [if], data = [none]
}
sb.append("\n");
sb.append(addedLine);
} while (addedLine.length() >= endlineString.length() &&
!endlineString.equals(addedLine.substring(addedLine.length()
- endlineString.length())));
line = sb.toString();
}
return new Pair<String, String>(null, line);
} } |
public class class_name {
@Override
protected Reader generateResourceForDebug(Reader rd, GeneratorContext context) {
// The following section is executed in DEBUG mode to retrieve the
// classpath CSS from the temporary folder,
// if the user defines that the image servlet should be used to retrieve
// the CSS images.
// It's not executed at the initialization process to be able to read
// data from classpath.
if (context.getConfig().isCssClasspathImageHandledByClasspathCss()) {
rd = super.generateResourceForDebug(rd, context);
}
return rd;
} } | public class class_name {
@Override
protected Reader generateResourceForDebug(Reader rd, GeneratorContext context) {
// The following section is executed in DEBUG mode to retrieve the
// classpath CSS from the temporary folder,
// if the user defines that the image servlet should be used to retrieve
// the CSS images.
// It's not executed at the initialization process to be able to read
// data from classpath.
if (context.getConfig().isCssClasspathImageHandledByClasspathCss()) {
rd = super.generateResourceForDebug(rd, context); // depends on control dependency: [if], data = [none]
}
return rd;
} } |
public class class_name {
public void addValue(String value, boolean isDefault) {
p("Adding " + (isDefault ? "default " : "") + "value:" + value + " to parameter:" + m_field.getName());
String name = m_wrappedParameter.names()[0];
if (m_assigned && !isMultiOption()) {
throw new ParameterException("Can only specify option " + name + " once.");
}
validateParameter(name, value);
Class<?> type = m_field.getType();
Object convertedValue = m_jCommander.convertValue(this, value);
boolean isCollection = Collection.class.isAssignableFrom(type);
try {
if (isCollection) {
@SuppressWarnings("unchecked") Collection<Object> l = (Collection<Object>) m_field.get(m_object);
if (l == null || fieldIsSetForTheFirstTime(isDefault)) {
l = newCollection(type);
m_field.set(m_object, l);
}
if (convertedValue instanceof Collection) {
l.addAll((Collection) convertedValue);
} else { // if (isMainParameter || m_parameterAnnotation.arity() > 1) {
l.add(convertedValue);
// } else {
// l.
}
} else {
m_wrappedParameter.addValue(m_field, m_object, convertedValue);
}
if (!isDefault) m_assigned = true;
} catch (IllegalAccessException ex) {
ex.printStackTrace();
}
} } | public class class_name {
public void addValue(String value, boolean isDefault) {
p("Adding " + (isDefault ? "default " : "") + "value:" + value + " to parameter:" + m_field.getName());
String name = m_wrappedParameter.names()[0];
if (m_assigned && !isMultiOption()) {
throw new ParameterException("Can only specify option " + name + " once.");
}
validateParameter(name, value);
Class<?> type = m_field.getType();
Object convertedValue = m_jCommander.convertValue(this, value);
boolean isCollection = Collection.class.isAssignableFrom(type);
try {
if (isCollection) {
@SuppressWarnings("unchecked") Collection<Object> l = (Collection<Object>) m_field.get(m_object);
if (l == null || fieldIsSetForTheFirstTime(isDefault)) {
l = newCollection(type); // depends on control dependency: [if], data = [none]
m_field.set(m_object, l); // depends on control dependency: [if], data = [none]
}
if (convertedValue instanceof Collection) {
l.addAll((Collection) convertedValue); // depends on control dependency: [if], data = [none]
} else { // if (isMainParameter || m_parameterAnnotation.arity() > 1) {
l.add(convertedValue); // depends on control dependency: [if], data = [none]
// } else {
// l.
}
} else {
m_wrappedParameter.addValue(m_field, m_object, convertedValue);
}
if (!isDefault) m_assigned = true;
} catch (IllegalAccessException ex) {
ex.printStackTrace();
}
} } |
public class class_name {
public String getName() {
String name = getName(m_rootPath);
if (name.charAt(name.length() - 1) == '/') {
return name.substring(0, name.length() - 1);
} else {
return name;
}
} } | public class class_name {
public String getName() {
String name = getName(m_rootPath);
if (name.charAt(name.length() - 1) == '/') {
return name.substring(0, name.length() - 1); // depends on control dependency: [if], data = [none]
} else {
return name; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
public final PipelineEventReader<R, E> getEventReader(
HttpServletRequest request, HttpServletResponse response) {
if (Included.PLAIN == this.resourcesElementsProvider.getDefaultIncludedType()) {
this.logger.trace(
"{} - Resoure Aggregation Disabled, ignoring event cache and returning parent event reader directly",
this.beanName);
return this.wrappedComponent.getEventReader(request, response);
}
// Get the key for this request from the target component and see if there is a cache entry
final CacheKey cacheKey = this.wrappedComponent.getCacheKey(request, response);
Element element = this.cache.get(cacheKey);
CachedEventReader<E> cachedEventReader = null;
if (element != null) {
cachedEventReader = (CachedEventReader<E>) element.getObjectValue();
}
// If there was a cached reader return it immediately
if (cachedEventReader == null) {
// No cached data for key, call target component to get events and an updated cache key
logger.debug(
"{} - No cached events found for key {}, calling parent",
this.beanName,
cacheKey);
final PipelineEventReader<R, E> pipelineEventReader =
this.wrappedComponent.getEventReader(request, response);
// Copy the events from the reader into a buffer to be cached
final List<E> eventCache = new LinkedList<E>();
for (final E event : pipelineEventReader) {
// TODO add de-duplication logic here
eventCache.add(event);
}
final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties();
cachedEventReader =
new CachedEventReader<E>(
eventCache, new LinkedHashMap<String, String>(outputProperties));
// Cache the buffer
element = new Element(cacheKey, cachedEventReader);
this.cache.put(element);
logger.debug(
"{} - Cached {} events for key {}", this.beanName, eventCache.size(), cacheKey);
} else {
logger.debug("{} - Found cached events for key {}", this.beanName, cacheKey);
}
final List<E> eventCache = cachedEventReader.getEventCache();
final Map<String, String> outputProperties = cachedEventReader.getOutputProperties();
final R eventReader = this.createEventReader(eventCache.listIterator());
return new PipelineEventReaderImpl<R, E>(eventReader, outputProperties);
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
public final PipelineEventReader<R, E> getEventReader(
HttpServletRequest request, HttpServletResponse response) {
if (Included.PLAIN == this.resourcesElementsProvider.getDefaultIncludedType()) {
this.logger.trace(
"{} - Resoure Aggregation Disabled, ignoring event cache and returning parent event reader directly",
this.beanName); // depends on control dependency: [if], data = [none]
return this.wrappedComponent.getEventReader(request, response); // depends on control dependency: [if], data = [none]
}
// Get the key for this request from the target component and see if there is a cache entry
final CacheKey cacheKey = this.wrappedComponent.getCacheKey(request, response);
Element element = this.cache.get(cacheKey);
CachedEventReader<E> cachedEventReader = null;
if (element != null) {
cachedEventReader = (CachedEventReader<E>) element.getObjectValue(); // depends on control dependency: [if], data = [none]
}
// If there was a cached reader return it immediately
if (cachedEventReader == null) {
// No cached data for key, call target component to get events and an updated cache key
logger.debug(
"{} - No cached events found for key {}, calling parent",
this.beanName,
cacheKey); // depends on control dependency: [if], data = [none]
final PipelineEventReader<R, E> pipelineEventReader =
this.wrappedComponent.getEventReader(request, response);
// Copy the events from the reader into a buffer to be cached
final List<E> eventCache = new LinkedList<E>();
for (final E event : pipelineEventReader) {
// TODO add de-duplication logic here
eventCache.add(event); // depends on control dependency: [for], data = [event]
}
final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties();
cachedEventReader =
new CachedEventReader<E>(
eventCache, new LinkedHashMap<String, String>(outputProperties)); // depends on control dependency: [if], data = [none]
// Cache the buffer
element = new Element(cacheKey, cachedEventReader); // depends on control dependency: [if], data = [none]
this.cache.put(element); // depends on control dependency: [if], data = [none]
logger.debug(
"{} - Cached {} events for key {}", this.beanName, eventCache.size(), cacheKey); // depends on control dependency: [if], data = [none]
} else {
logger.debug("{} - Found cached events for key {}", this.beanName, cacheKey); // depends on control dependency: [if], data = [none]
}
final List<E> eventCache = cachedEventReader.getEventCache();
final Map<String, String> outputProperties = cachedEventReader.getOutputProperties();
final R eventReader = this.createEventReader(eventCache.listIterator());
return new PipelineEventReaderImpl<R, E>(eventReader, outputProperties);
} } |
public class class_name {
public Collection<String> values(String group) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.values();
}
} finally {
readLock.unlock();
}
return Collections.emptyList();
} } | public class class_name {
public Collection<String> values(String group) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.values();
// depends on control dependency: [if], data = [none]
}
} finally {
readLock.unlock();
}
return Collections.emptyList();
} } |
public class class_name {
public EEnum getIfcPermeableCoveringOperationEnum() {
if (ifcPermeableCoveringOperationEnumEEnum == null) {
ifcPermeableCoveringOperationEnumEEnum = (EEnum) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(865);
}
return ifcPermeableCoveringOperationEnumEEnum;
} } | public class class_name {
public EEnum getIfcPermeableCoveringOperationEnum() {
if (ifcPermeableCoveringOperationEnumEEnum == null) {
ifcPermeableCoveringOperationEnumEEnum = (EEnum) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(865);
// depends on control dependency: [if], data = [none]
}
return ifcPermeableCoveringOperationEnumEEnum;
} } |
public class class_name {
private CacheMap getStatementCache() {
int newSize = dsConfig.get().statementCacheSize;
// Check if statement cache is dynamically enabled
if (statementCache == null && newSize > 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc,
"enable statement cache with size", newSize);
statementCache = new CacheMap(newSize);
}
// Check if statement cache is dynamically resized or disabled
else if (statementCache != null && statementCache.getMaxSize() != newSize) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc,
"resize statement cache to", newSize);
CacheMap oldCache = statementCache;
statementCache = newSize > 0 ? new CacheMap(newSize) : null;
Object[] discards = newSize > 0 ? statementCache.addAll(oldCache) : oldCache.removeAll();
for (Object stmt : discards)
destroyStatement(stmt);
}
return statementCache;
} } | public class class_name {
private CacheMap getStatementCache() {
int newSize = dsConfig.get().statementCacheSize;
// Check if statement cache is dynamically enabled
if (statementCache == null && newSize > 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc,
"enable statement cache with size", newSize);
statementCache = new CacheMap(newSize); // depends on control dependency: [if], data = [none]
}
// Check if statement cache is dynamically resized or disabled
else if (statementCache != null && statementCache.getMaxSize() != newSize) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc,
"resize statement cache to", newSize);
CacheMap oldCache = statementCache;
statementCache = newSize > 0 ? new CacheMap(newSize) : null; // depends on control dependency: [if], data = [none]
Object[] discards = newSize > 0 ? statementCache.addAll(oldCache) : oldCache.removeAll();
for (Object stmt : discards)
destroyStatement(stmt);
}
return statementCache;
} } |
public class class_name {
private List<Cell> checkEmptyRow(KV<ImmutableBytesWritable, Result> kv) {
List<Cell> cells = kv.getValue().listCells();
if (cells == null) {
cells = Collections.emptyList();
}
if (!isEmptyRowWarned && cells.isEmpty()) {
logger.warn("Encountered empty row. Was input file serialized by HBase 0.94?");
isEmptyRowWarned = true;
}
return cells;
} } | public class class_name {
private List<Cell> checkEmptyRow(KV<ImmutableBytesWritable, Result> kv) {
List<Cell> cells = kv.getValue().listCells();
if (cells == null) {
cells = Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
if (!isEmptyRowWarned && cells.isEmpty()) {
logger.warn("Encountered empty row. Was input file serialized by HBase 0.94?"); // depends on control dependency: [if], data = [none]
isEmptyRowWarned = true; // depends on control dependency: [if], data = [none]
}
return cells;
} } |
public class class_name {
@Override
@SuppressWarnings( "unchecked" )
public <T> T newInstance( final Class<T> type ) {
if (type == null) { throw new IllegalArgumentException("type cannot be null."); }
Constructor<?> constructor = _constructors.get( type );
if ( constructor == null ) {
constructor = getNoArgsConstructor( type );
if ( constructor == null ) {
constructor = newConstructorForSerialization( type );
}
_constructors.put( type, constructor );
}
return (T) newInstanceFrom( constructor );
} } | public class class_name {
@Override
@SuppressWarnings( "unchecked" )
public <T> T newInstance( final Class<T> type ) {
if (type == null) { throw new IllegalArgumentException("type cannot be null."); }
Constructor<?> constructor = _constructors.get( type );
if ( constructor == null ) {
constructor = getNoArgsConstructor( type ); // depends on control dependency: [if], data = [none]
if ( constructor == null ) {
constructor = newConstructorForSerialization( type ); // depends on control dependency: [if], data = [none]
}
_constructors.put( type, constructor ); // depends on control dependency: [if], data = [none]
}
return (T) newInstanceFrom( constructor );
} } |
public class class_name {
public Pair<List<Group>> getInterfacingResidues(double minAsaForSurface) {
List<Group> interf1 = new ArrayList<Group>();
List<Group> interf2 = new ArrayList<Group>();
for (GroupAsa groupAsa:groupAsas1.values()) {
if (groupAsa.getAsaU()>minAsaForSurface && groupAsa.getBsa()>0) {
interf1.add(groupAsa.getGroup());
}
}
for (GroupAsa groupAsa:groupAsas2.values()) {
if (groupAsa.getAsaU()>minAsaForSurface && groupAsa.getBsa()>0) {
interf2.add(groupAsa.getGroup());
}
}
return new Pair<List<Group>>(interf1, interf2);
} } | public class class_name {
public Pair<List<Group>> getInterfacingResidues(double minAsaForSurface) {
List<Group> interf1 = new ArrayList<Group>();
List<Group> interf2 = new ArrayList<Group>();
for (GroupAsa groupAsa:groupAsas1.values()) {
if (groupAsa.getAsaU()>minAsaForSurface && groupAsa.getBsa()>0) {
interf1.add(groupAsa.getGroup()); // depends on control dependency: [if], data = [none]
}
}
for (GroupAsa groupAsa:groupAsas2.values()) {
if (groupAsa.getAsaU()>minAsaForSurface && groupAsa.getBsa()>0) {
interf2.add(groupAsa.getGroup()); // depends on control dependency: [if], data = [none]
}
}
return new Pair<List<Group>>(interf1, interf2);
} } |
public class class_name {
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void getOutline(@NonNull Outline outline) {
final ChildDrawable[] array = mLayerState.mChildren;
final int N = mLayerState.mNum;
for (int i = 0; i < N; i++) {
final Drawable dr = array[i].mDrawable;
if (dr != null) {
dr.getOutline(outline);
if (!outline.isEmpty()) {
return;
}
}
}
} } | public class class_name {
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void getOutline(@NonNull Outline outline) {
final ChildDrawable[] array = mLayerState.mChildren;
final int N = mLayerState.mNum;
for (int i = 0; i < N; i++) {
final Drawable dr = array[i].mDrawable;
if (dr != null) {
dr.getOutline(outline); // depends on control dependency: [if], data = [none]
if (!outline.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
void add(Iterable<SGraphSegment> segments) {
for (final SGraphSegment segment : segments) {
this.segments.add(segment);
}
} } | public class class_name {
void add(Iterable<SGraphSegment> segments) {
for (final SGraphSegment segment : segments) {
this.segments.add(segment); // depends on control dependency: [for], data = [segment]
}
} } |
public class class_name {
public SortedSet<PackageDoc> findPackagesFromClassesInJavaDocRun() {
final SortedSet<PackageDoc> toReturn = new TreeSet<>(Comparators.PACKAGE_NAME_COMPARATOR);
final ClassDoc[] currentExecutionClasses = classes();
if (currentExecutionClasses != null) {
Arrays.stream(currentExecutionClasses)
.map(ProgramElementDoc::containingPackage)
.forEach(toReturn::add);
}
// All Done.
return toReturn;
} } | public class class_name {
public SortedSet<PackageDoc> findPackagesFromClassesInJavaDocRun() {
final SortedSet<PackageDoc> toReturn = new TreeSet<>(Comparators.PACKAGE_NAME_COMPARATOR);
final ClassDoc[] currentExecutionClasses = classes();
if (currentExecutionClasses != null) {
Arrays.stream(currentExecutionClasses)
.map(ProgramElementDoc::containingPackage)
.forEach(toReturn::add); // depends on control dependency: [if], data = [none]
}
// All Done.
return toReturn;
} } |
public class class_name {
public static Response createLinksHandler(ParaObject pobj, String id2) {
try (final Metrics.Context context = Metrics.time(null, RestUtils.class, "links", "create")) {
if (id2 != null && pobj != null) {
String linkid = pobj.link(id2);
if (linkid == null) {
return getStatusResponse(Response.Status.BAD_REQUEST, "Failed to create link.");
} else {
return Response.ok(linkid, MediaType.TEXT_PLAIN_TYPE).build();
}
} else {
return getStatusResponse(Response.Status.BAD_REQUEST, "Parameters 'type' and 'id' are missing.");
}
}
} } | public class class_name {
public static Response createLinksHandler(ParaObject pobj, String id2) {
try (final Metrics.Context context = Metrics.time(null, RestUtils.class, "links", "create")) {
if (id2 != null && pobj != null) {
String linkid = pobj.link(id2);
if (linkid == null) {
return getStatusResponse(Response.Status.BAD_REQUEST, "Failed to create link."); // depends on control dependency: [if], data = [none]
} else {
return Response.ok(linkid, MediaType.TEXT_PLAIN_TYPE).build(); // depends on control dependency: [if], data = [(linkid]
}
} else {
return getStatusResponse(Response.Status.BAD_REQUEST, "Parameters 'type' and 'id' are missing."); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public final void explicitGenericInvocationSuffix() throws RecognitionException {
int explicitGenericInvocationSuffix_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 137) ) { return; }
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1279:5: ( 'super' superSuffix | Identifier arguments )
int alt186=2;
int LA186_0 = input.LA(1);
if ( (LA186_0==108) ) {
alt186=1;
}
else if ( (LA186_0==Identifier) ) {
alt186=2;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
NoViableAltException nvae =
new NoViableAltException("", 186, 0, input);
throw nvae;
}
switch (alt186) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1279:7: 'super' superSuffix
{
match(input,108,FOLLOW_108_in_explicitGenericInvocationSuffix6239); if (state.failed) return;
pushFollow(FOLLOW_superSuffix_in_explicitGenericInvocationSuffix6241);
superSuffix();
state._fsp--;
if (state.failed) return;
}
break;
case 2 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1280:9: Identifier arguments
{
match(input,Identifier,FOLLOW_Identifier_in_explicitGenericInvocationSuffix6251); if (state.failed) return;
pushFollow(FOLLOW_arguments_in_explicitGenericInvocationSuffix6253);
arguments();
state._fsp--;
if (state.failed) return;
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 137, explicitGenericInvocationSuffix_StartIndex); }
}
} } | public class class_name {
public final void explicitGenericInvocationSuffix() throws RecognitionException {
int explicitGenericInvocationSuffix_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 137) ) { return; } // depends on control dependency: [if], data = [none]
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1279:5: ( 'super' superSuffix | Identifier arguments )
int alt186=2;
int LA186_0 = input.LA(1);
if ( (LA186_0==108) ) {
alt186=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA186_0==Identifier) ) {
alt186=2; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 186, 0, input);
throw nvae;
}
switch (alt186) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1279:7: 'super' superSuffix
{
match(input,108,FOLLOW_108_in_explicitGenericInvocationSuffix6239); if (state.failed) return;
pushFollow(FOLLOW_superSuffix_in_explicitGenericInvocationSuffix6241);
superSuffix();
state._fsp--;
if (state.failed) return;
}
break;
case 2 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1280:9: Identifier arguments
{
match(input,Identifier,FOLLOW_Identifier_in_explicitGenericInvocationSuffix6251); if (state.failed) return;
pushFollow(FOLLOW_arguments_in_explicitGenericInvocationSuffix6253);
arguments();
state._fsp--;
if (state.failed) return;
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 137, explicitGenericInvocationSuffix_StartIndex); } // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void doBatchEnd(final JsonObject message) {
if (currentBatch != null) {
Object args = deserializer.deserialize(message);
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Batch ended: Batch[batch=%s, args=%s]", this, currentBatch.id(), args));
}
currentBatch.handleEnd(args);
currentBatch = null;
}
} } | public class class_name {
private void doBatchEnd(final JsonObject message) {
if (currentBatch != null) {
Object args = deserializer.deserialize(message);
if (log.isDebugEnabled()) {
log.debug(String.format("%s - Batch ended: Batch[batch=%s, args=%s]", this, currentBatch.id(), args)); // depends on control dependency: [if], data = [none]
}
currentBatch.handleEnd(args); // depends on control dependency: [if], data = [none]
currentBatch = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void cleanupActiveSession() {
Session session = AbstractHandler.ACTIVE_SESSION.get();
if (session != null) {
try {
AbstractHandler.ACTIVE_SESSION.remove();
session.logout();
LOGGER.debug("Logged out REST service session");
} catch (Exception e) {
LOGGER.warn(e, "Error while trying to logout REST service session");
}
}
} } | public class class_name {
public static void cleanupActiveSession() {
Session session = AbstractHandler.ACTIVE_SESSION.get();
if (session != null) {
try {
AbstractHandler.ACTIVE_SESSION.remove(); // depends on control dependency: [try], data = [none]
session.logout(); // depends on control dependency: [try], data = [none]
LOGGER.debug("Logged out REST service session"); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.warn(e, "Error while trying to logout REST service session");
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public byte[] getData(byte[] dst, int offset)
{
final int items = Math.min(data.length, dst.length - offset) / stringLength;
final int end = items * stringLength;
if (end == 0)
logger.error("destination range has to be multiple of 14 bytes "
+ "for KNX strings");
for (int i = 0; i < end; ++i)
dst[offset + i] = (byte) data[i];
return dst;
}
/* (non-Javadoc)
* @see tuwien.auto.calimero.dptxlator.DPTXlator#getSubTypes()
*/
public final Map getSubTypes()
{
return types;
}
/**
* @return the subtypes of the string translator type
* @see DPTXlator#getSubTypesStatic()
*/
protected static Map getSubTypesStatic()
{
return types;
}
private String fromDPT(int index)
{
final int offset = index * stringLength;
final char[] output = new char[stringLength];
int strlen = 0;
for (int i = offset; i < (offset + stringLength) && data[i] != 0; ++i) {
output[strlen] = (char) data[i];
++strlen;
}
return new String(output, 0, strlen);
}
private void toDPT(byte[] buf, int offset)
{
// check character set, default to ASCII 7 bit encoding
int rangeMax = 0x7f;
if (dpt.equals(DPT_STRING_8859_1))
rangeMax = 0xff;
final int items = (buf.length - offset) / stringLength;
if (items == 0) {
logger.error("source range has to be multiple of 14 bytes for KNX strings");
return;
}
data = new short[items * stringLength];
// 7 bit encoded characters of ISO-8859-1 are equal to ASCII
// the lower 256 characters of UCS correspond to ISO-8859-1
for (int i = 0; i < data.length; ++i) {
final short c = ubyte(buf[offset + i]);
data[i] = c <= rangeMax ? c : replacement;
}
} } | public class class_name {
public byte[] getData(byte[] dst, int offset)
{
final int items = Math.min(data.length, dst.length - offset) / stringLength;
final int end = items * stringLength;
if (end == 0)
logger.error("destination range has to be multiple of 14 bytes "
+ "for KNX strings");
for (int i = 0; i < end; ++i)
dst[offset + i] = (byte) data[i];
return dst;
}
/* (non-Javadoc)
* @see tuwien.auto.calimero.dptxlator.DPTXlator#getSubTypes()
*/
public final Map getSubTypes()
{
return types;
}
/**
* @return the subtypes of the string translator type
* @see DPTXlator#getSubTypesStatic()
*/
protected static Map getSubTypesStatic()
{
return types;
}
private String fromDPT(int index)
{
final int offset = index * stringLength;
final char[] output = new char[stringLength];
int strlen = 0;
for (int i = offset; i < (offset + stringLength) && data[i] != 0; ++i) {
output[strlen] = (char) data[i];
// depends on control dependency: [for], data = [i]
++strlen;
// depends on control dependency: [for], data = [none]
}
return new String(output, 0, strlen);
}
private void toDPT(byte[] buf, int offset)
{
// check character set, default to ASCII 7 bit encoding
int rangeMax = 0x7f;
if (dpt.equals(DPT_STRING_8859_1))
rangeMax = 0xff;
final int items = (buf.length - offset) / stringLength;
if (items == 0) {
logger.error("source range has to be multiple of 14 bytes for KNX strings");
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
data = new short[items * stringLength];
// 7 bit encoded characters of ISO-8859-1 are equal to ASCII
// the lower 256 characters of UCS correspond to ISO-8859-1
for (int i = 0; i < data.length; ++i) {
final short c = ubyte(buf[offset + i]);
data[i] = c <= rangeMax ? c : replacement;
// depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public static StoredFile createLocalStoredFile(InputStream is, String sourceUrl, String localFilePath, String mimeType) {
if (is == null) {
return null;
}
// Copy the file contents over.
CountingOutputStream cos = null;
BufferedOutputStream bos = null;
FileOutputStream fos = null;
try {
File localFile = new File(localFilePath);
/* Local cache file name may not be unique, and can be reused, in which case, the previously created
* cache file need to be deleted before it is being copied over.
*/
if (localFile.exists()) {
localFile.delete();
}
fos = new FileOutputStream(localFile);
bos = new BufferedOutputStream(fos);
cos = new CountingOutputStream(bos);
byte[] buf = new byte[2048];
int count;
while ((count = is.read(buf, 0, 2048)) != -1) {
cos.write(buf, 0, count);
}
ApptentiveLog.v(UTIL, "File saved, size = " + (cos.getBytesWritten() / 1024) + "k");
} catch (IOException e) {
ApptentiveLog.e(UTIL, "Error creating local copy of file attachment.");
logException(e);
return null;
} finally {
Util.ensureClosed(cos);
Util.ensureClosed(bos);
Util.ensureClosed(fos);
}
// Create a StoredFile database entry for this locally saved file.
StoredFile storedFile = new StoredFile();
storedFile.setSourceUriOrPath(sourceUrl);
storedFile.setLocalFilePath(localFilePath);
storedFile.setMimeType(mimeType);
return storedFile;
} } | public class class_name {
public static StoredFile createLocalStoredFile(InputStream is, String sourceUrl, String localFilePath, String mimeType) {
if (is == null) {
return null; // depends on control dependency: [if], data = [none]
}
// Copy the file contents over.
CountingOutputStream cos = null;
BufferedOutputStream bos = null;
FileOutputStream fos = null;
try {
File localFile = new File(localFilePath);
/* Local cache file name may not be unique, and can be reused, in which case, the previously created
* cache file need to be deleted before it is being copied over.
*/
if (localFile.exists()) {
localFile.delete(); // depends on control dependency: [if], data = [none]
}
fos = new FileOutputStream(localFile); // depends on control dependency: [try], data = [none]
bos = new BufferedOutputStream(fos); // depends on control dependency: [try], data = [none]
cos = new CountingOutputStream(bos); // depends on control dependency: [try], data = [none]
byte[] buf = new byte[2048];
int count;
while ((count = is.read(buf, 0, 2048)) != -1) {
cos.write(buf, 0, count); // depends on control dependency: [while], data = [none]
}
ApptentiveLog.v(UTIL, "File saved, size = " + (cos.getBytesWritten() / 1024) + "k"); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
ApptentiveLog.e(UTIL, "Error creating local copy of file attachment.");
logException(e);
return null;
} finally { // depends on control dependency: [catch], data = [none]
Util.ensureClosed(cos);
Util.ensureClosed(bos);
Util.ensureClosed(fos);
}
// Create a StoredFile database entry for this locally saved file.
StoredFile storedFile = new StoredFile();
storedFile.setSourceUriOrPath(sourceUrl);
storedFile.setLocalFilePath(localFilePath);
storedFile.setMimeType(mimeType);
return storedFile;
} } |
public class class_name {
public static final String getStaticFieldName(Object value, Class<?> clazz) throws Exception {
Field[] fields = clazz.getFields();
for (Field field : fields) {
Object fVal = field.get(null);
if(fVal != null && fVal.equals(value)) {
return field.getName();
}
}
return null;
} } | public class class_name {
public static final String getStaticFieldName(Object value, Class<?> clazz) throws Exception {
Field[] fields = clazz.getFields();
for (Field field : fields) {
Object fVal = field.get(null);
if(fVal != null && fVal.equals(value)) {
return field.getName();
// depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static String encodePath(String path) {
if (path != null) {
path = encodeUrl(path);
path = path.replaceAll("/jcr:", "/_jcr_");
path = path.replaceAll("\\?", "%3F");
path = path.replaceAll("=", "%3D");
path = path.replaceAll(";", "%3B");
path = path.replaceAll(":", "%3A");
path = path.replaceAll("\\+", "%2B");
path = path.replaceAll("&", "%26");
path = path.replaceAll("#", "%23");
}
return path;
} } | public class class_name {
public static String encodePath(String path) {
if (path != null) {
path = encodeUrl(path); // depends on control dependency: [if], data = [(path]
path = path.replaceAll("/jcr:", "/_jcr_"); // depends on control dependency: [if], data = [none]
path = path.replaceAll("\\?", "%3F"); // depends on control dependency: [if], data = [none]
path = path.replaceAll("=", "%3D"); // depends on control dependency: [if], data = [none]
path = path.replaceAll(";", "%3B"); // depends on control dependency: [if], data = [none]
path = path.replaceAll(":", "%3A"); // depends on control dependency: [if], data = [none]
path = path.replaceAll("\\+", "%2B"); // depends on control dependency: [if], data = [none]
path = path.replaceAll("&", "%26"); // depends on control dependency: [if], data = [none]
path = path.replaceAll("#", "%23"); // depends on control dependency: [if], data = [none]
}
return path;
} } |
public class class_name {
public static <T> Iterator<T> concat(
final Iterator<? extends Iterator<? extends T>> inputs) {
checkNotNull(inputs);
return new Iterator<T>() {
Iterator<? extends T> current = Collections.<T>emptyList().iterator();
Iterator<? extends T> removeFrom;
@Override
public boolean hasNext() {
// http://code.google.com/p/google-collections/issues/detail?id=151
// current.hasNext() might be relatively expensive, worth minimizing.
boolean currentHasNext;
// checkNotNull eager for GWT
// note: it must be here & not where 'current' is assigned,
// because otherwise we'll have called inputs.next() before throwing
// the first NPE, and the next time around we'll call inputs.next()
// again, incorrectly moving beyond the error.
while (!(currentHasNext = checkNotNull(current).hasNext())
&& inputs.hasNext()) {
current = inputs.next();
}
return currentHasNext;
}
@Override
public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
removeFrom = current;
return current.next();
}
@Override
public void remove() {
checkState(removeFrom != null,
"no calls to next() since last call to remove()");
removeFrom.remove();
removeFrom = null;
}
};
} } | public class class_name {
public static <T> Iterator<T> concat(
final Iterator<? extends Iterator<? extends T>> inputs) {
checkNotNull(inputs);
return new Iterator<T>() {
Iterator<? extends T> current = Collections.<T>emptyList().iterator();
Iterator<? extends T> removeFrom;
@Override
public boolean hasNext() {
// http://code.google.com/p/google-collections/issues/detail?id=151
// current.hasNext() might be relatively expensive, worth minimizing.
boolean currentHasNext;
// checkNotNull eager for GWT
// note: it must be here & not where 'current' is assigned,
// because otherwise we'll have called inputs.next() before throwing
// the first NPE, and the next time around we'll call inputs.next()
// again, incorrectly moving beyond the error.
while (!(currentHasNext = checkNotNull(current).hasNext())
&& inputs.hasNext()) {
current = inputs.next(); // depends on control dependency: [while], data = [none]
}
return currentHasNext;
}
@Override
public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
removeFrom = current;
return current.next();
}
@Override
public void remove() {
checkState(removeFrom != null,
"no calls to next() since last call to remove()");
removeFrom.remove();
removeFrom = null;
}
};
} } |
public class class_name {
@GetMapping(value = "/v1/tickets/{id:.+}")
public ResponseEntity<String> getTicketStatus(@PathVariable("id") final String id) {
try {
val ticket = this.centralAuthenticationService.getTicket(id);
return new ResponseEntity<>(ticket.getId(), HttpStatus.OK);
} catch (final InvalidTicketException e) {
return new ResponseEntity<>("Ticket could not be found", HttpStatus.NOT_FOUND);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
} } | public class class_name {
@GetMapping(value = "/v1/tickets/{id:.+}")
public ResponseEntity<String> getTicketStatus(@PathVariable("id") final String id) {
try {
val ticket = this.centralAuthenticationService.getTicket(id);
return new ResponseEntity<>(ticket.getId(), HttpStatus.OK); // depends on control dependency: [try], data = [none]
} catch (final InvalidTicketException e) {
return new ResponseEntity<>("Ticket could not be found", HttpStatus.NOT_FOUND);
} catch (final Exception e) { // depends on control dependency: [catch], data = [none]
LOGGER.error(e.getMessage(), e);
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String rTrim(final String value) {
if (value == null) {
return null;
}
String trimmed = value;
int offset = value.length() - 1;
while (offset > -1 && (value.charAt(offset) == ' ' || value.charAt(offset) == '\t')) {
offset--;
}
if (offset < value.length() - 1) {
trimmed = value.substring(0, offset + 1);
}
return trimmed;
} } | public class class_name {
public static String rTrim(final String value) {
if (value == null) {
return null;
// depends on control dependency: [if], data = [none]
}
String trimmed = value;
int offset = value.length() - 1;
while (offset > -1 && (value.charAt(offset) == ' ' || value.charAt(offset) == '\t')) {
offset--;
// depends on control dependency: [while], data = [none]
}
if (offset < value.length() - 1) {
trimmed = value.substring(0, offset + 1);
// depends on control dependency: [if], data = [none]
}
return trimmed;
} } |
public class class_name {
public void marshall(ConfigurationRecorder configurationRecorder, ProtocolMarshaller protocolMarshaller) {
if (configurationRecorder == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(configurationRecorder.getName(), NAME_BINDING);
protocolMarshaller.marshall(configurationRecorder.getRoleARN(), ROLEARN_BINDING);
protocolMarshaller.marshall(configurationRecorder.getRecordingGroup(), RECORDINGGROUP_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ConfigurationRecorder configurationRecorder, ProtocolMarshaller protocolMarshaller) {
if (configurationRecorder == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(configurationRecorder.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(configurationRecorder.getRoleARN(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(configurationRecorder.getRecordingGroup(), RECORDINGGROUP_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 static String concatXpath(String prefix, String suffix) {
if (suffix == null) {
// ensure suffix is not null
suffix = "";
} else {
if ((suffix.length() > 0) && (suffix.charAt(0) == '/')) {
// remove leading '/' form suffix
suffix = suffix.substring(1);
}
}
if (prefix != null) {
StringBuffer result = new StringBuffer(32);
result.append(prefix);
if (!CmsResource.isFolder(prefix) && (suffix.length() > 0)) {
result.append('/');
}
result.append(suffix);
return result.toString();
}
return suffix;
} } | public class class_name {
public static String concatXpath(String prefix, String suffix) {
if (suffix == null) {
// ensure suffix is not null
suffix = ""; // depends on control dependency: [if], data = [none]
} else {
if ((suffix.length() > 0) && (suffix.charAt(0) == '/')) {
// remove leading '/' form suffix
suffix = suffix.substring(1); // depends on control dependency: [if], data = [none]
}
}
if (prefix != null) {
StringBuffer result = new StringBuffer(32);
result.append(prefix); // depends on control dependency: [if], data = [(prefix]
if (!CmsResource.isFolder(prefix) && (suffix.length() > 0)) {
result.append('/'); // depends on control dependency: [if], data = [none]
}
result.append(suffix); // depends on control dependency: [if], data = [none]
return result.toString(); // depends on control dependency: [if], data = [none]
}
return suffix;
} } |
public class class_name {
public TypeSignature getTypeDescriptor() {
if (typeDescriptorStr == null) {
return null;
}
if (typeDescriptor == null) {
try {
typeDescriptor = TypeSignature.parse(typeDescriptorStr, declaringClassName);
typeDescriptor.setScanResult(scanResult);
} catch (final ParseException e) {
throw new IllegalArgumentException(e);
}
}
return typeDescriptor;
} } | public class class_name {
public TypeSignature getTypeDescriptor() {
if (typeDescriptorStr == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (typeDescriptor == null) {
try {
typeDescriptor = TypeSignature.parse(typeDescriptorStr, declaringClassName); // depends on control dependency: [try], data = [none]
typeDescriptor.setScanResult(scanResult); // depends on control dependency: [try], data = [none]
} catch (final ParseException e) {
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
}
return typeDescriptor;
} } |
public class class_name {
public FeatureCollection toGeoServiceGeometry(final Geometry geometry) {
if (geometry == null) {
return GeoServiceGeometry.createFeatureCollection(
toLocationFeature(new LatLng(Double.NaN, Double.NaN),
LocationType.UNKNOWN),
null, null);
}
return GeoServiceGeometry.createFeatureCollection(
toLocationFeature(geometry.location, geometry.locationType),
toBox("bounds", geometry.bounds),
toBox("viewport", geometry.viewport));
} } | public class class_name {
public FeatureCollection toGeoServiceGeometry(final Geometry geometry) {
if (geometry == null) {
return GeoServiceGeometry.createFeatureCollection(
toLocationFeature(new LatLng(Double.NaN, Double.NaN),
LocationType.UNKNOWN),
null, null); // depends on control dependency: [if], data = [none]
}
return GeoServiceGeometry.createFeatureCollection(
toLocationFeature(geometry.location, geometry.locationType),
toBox("bounds", geometry.bounds),
toBox("viewport", geometry.viewport));
} } |
public class class_name {
public static List<CSNodeWrapper> getAllNodes(final ContentSpecWrapper contentSpec) {
final List<CSNodeWrapper> nodes = new LinkedList<CSNodeWrapper>();
if (contentSpec.getChildren() != null) {
final List<CSNodeWrapper> childrenNodes = contentSpec.getChildren().getItems();
for (final CSNodeWrapper childNode : childrenNodes) {
nodes.add(childNode);
nodes.addAll(getAllChildrenNodes(childNode));
}
}
return nodes;
} } | public class class_name {
public static List<CSNodeWrapper> getAllNodes(final ContentSpecWrapper contentSpec) {
final List<CSNodeWrapper> nodes = new LinkedList<CSNodeWrapper>();
if (contentSpec.getChildren() != null) {
final List<CSNodeWrapper> childrenNodes = contentSpec.getChildren().getItems();
for (final CSNodeWrapper childNode : childrenNodes) {
nodes.add(childNode); // depends on control dependency: [for], data = [childNode]
nodes.addAll(getAllChildrenNodes(childNode)); // depends on control dependency: [for], data = [childNode]
}
}
return nodes;
} } |
public class class_name {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (LOG_ATTACH_DETACH) {
Log.d(TAG, "onAttachedToWindow reattach =" + mDetached);
}
if (mDetached && (mRenderer != null)) {
int renderMode = RENDERMODE_CONTINUOUSLY;
if (mGLThread != null) {
renderMode = mGLThread.getRenderMode();
}
mGLThread = new GLThread(mThisWeakRef);
if (renderMode != RENDERMODE_CONTINUOUSLY) {
mGLThread.setRenderMode(renderMode);
}
mGLThread.start();
}
mDetached = false;
} } | public class class_name {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (LOG_ATTACH_DETACH) {
Log.d(TAG, "onAttachedToWindow reattach =" + mDetached); // depends on control dependency: [if], data = [none]
}
if (mDetached && (mRenderer != null)) {
int renderMode = RENDERMODE_CONTINUOUSLY;
if (mGLThread != null) {
renderMode = mGLThread.getRenderMode(); // depends on control dependency: [if], data = [none]
}
mGLThread = new GLThread(mThisWeakRef); // depends on control dependency: [if], data = [none]
if (renderMode != RENDERMODE_CONTINUOUSLY) {
mGLThread.setRenderMode(renderMode); // depends on control dependency: [if], data = [(renderMode]
}
mGLThread.start(); // depends on control dependency: [if], data = [none]
}
mDetached = false;
} } |
public class class_name {
static <E> boolean add(E[] d, E e) {
int pos = getPosition(d, e);
if (d[pos] == null) {
d[pos] = e;
return true;
}
// else the element is already there
return false;
} } | public class class_name {
static <E> boolean add(E[] d, E e) {
int pos = getPosition(d, e);
if (d[pos] == null) {
d[pos] = e; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
// else the element is already there
return false;
} } |
public class class_name {
public boolean isNullable() {
boolean isNullable = super.isNullable();
if (isNullable) {
if (dataType.isDomainType()) {
return dataType.userTypeModifier.isNullable();
}
}
return isNullable;
} } | public class class_name {
public boolean isNullable() {
boolean isNullable = super.isNullable();
if (isNullable) {
if (dataType.isDomainType()) {
return dataType.userTypeModifier.isNullable(); // depends on control dependency: [if], data = [none]
}
}
return isNullable;
} } |
public class class_name {
static Object adaptValue(Object value, boolean classValuesAsString, boolean nestedAnnotationsAsMap) {
if (classValuesAsString) {
if (value instanceof Class) {
value = ((Class<?>) value).getName();
}
else if (value instanceof Class[]) {
Class<?>[] clazzArray = (Class[]) value;
String[] newValue = new String[clazzArray.length];
for (int i = 0; i < clazzArray.length; i++) {
newValue[i] = clazzArray[i].getName();
}
value = newValue;
}
}
if (nestedAnnotationsAsMap && value instanceof Annotation) {
return getAnnotationAttributes((Annotation) value, classValuesAsString, true);
}
else if (nestedAnnotationsAsMap && value instanceof Annotation[]) {
Annotation[] realAnnotations = (Annotation[]) value;
AnnotationAttributes[] mappedAnnotations = new AnnotationAttributes[realAnnotations.length];
for (int i = 0; i < realAnnotations.length; i++) {
mappedAnnotations[i] = getAnnotationAttributes(realAnnotations[i], classValuesAsString, true);
}
return mappedAnnotations;
}
else {
return value;
}
} } | public class class_name {
static Object adaptValue(Object value, boolean classValuesAsString, boolean nestedAnnotationsAsMap) {
if (classValuesAsString) {
if (value instanceof Class) {
value = ((Class<?>) value).getName(); // depends on control dependency: [if], data = [none]
}
else if (value instanceof Class[]) {
Class<?>[] clazzArray = (Class[]) value; // depends on control dependency: [if], data = [none]
String[] newValue = new String[clazzArray.length];
for (int i = 0; i < clazzArray.length; i++) {
newValue[i] = clazzArray[i].getName(); // depends on control dependency: [for], data = [i]
}
value = newValue; // depends on control dependency: [if], data = [none]
}
}
if (nestedAnnotationsAsMap && value instanceof Annotation) {
return getAnnotationAttributes((Annotation) value, classValuesAsString, true); // depends on control dependency: [if], data = [none]
}
else if (nestedAnnotationsAsMap && value instanceof Annotation[]) {
Annotation[] realAnnotations = (Annotation[]) value;
AnnotationAttributes[] mappedAnnotations = new AnnotationAttributes[realAnnotations.length];
for (int i = 0; i < realAnnotations.length; i++) {
mappedAnnotations[i] = getAnnotationAttributes(realAnnotations[i], classValuesAsString, true); // depends on control dependency: [for], data = [i]
}
return mappedAnnotations; // depends on control dependency: [if], data = [none]
}
else {
return value; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ArrayList<Transition> possibleNextStates(Automaton source) {
ArrayList<Transition> r = possibleTransitions.get(source);
if (r == null) {
throw new UnsupportedOperationException(
"Not transitions registered from " + source.getName()
+ ", automaton " + this.getName());
}
ArrayList<Transition> activatedTransitions = new ArrayList<Transition>();
for (Transition t : r) {
if (t.evaluate()) {
activatedTransitions.add(t);
}
}
;
return activatedTransitions;
} } | public class class_name {
public ArrayList<Transition> possibleNextStates(Automaton source) {
ArrayList<Transition> r = possibleTransitions.get(source);
if (r == null) {
throw new UnsupportedOperationException(
"Not transitions registered from " + source.getName()
+ ", automaton " + this.getName());
}
ArrayList<Transition> activatedTransitions = new ArrayList<Transition>();
for (Transition t : r) {
if (t.evaluate()) {
activatedTransitions.add(t); // depends on control dependency: [if], data = [none]
}
}
;
return activatedTransitions;
} } |
public class class_name {
protected Promise<Integer> sendCallArray(Object[] req) {
final Promise<Integer> p = new Promise<>();
if (SENDDEBUG)
System.out.println("SENDING "+(req.length-1));
for (int i = 0; i < req.length; i++) {
Object o = req[i];
if ( o instanceof RemoteCallEntry ) {
((RemoteCallEntry) o).pack(conf);
}
}
byte[] message = conf.asByteArray(req);
HttpPost request = createRequest(sessionUrl, message);
if ( DumpProtocol ) {
try {
System.out.println("req:"+new String(message,"UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
getClient().execute(request, new FutureCallback<HttpResponse>() {
@Override
public void completed(HttpResponse result) {
if (result.getStatusLine().getStatusCode() != 200) {
String error = "Unexpected status:" + result.getStatusLine().getStatusCode();
p.reject(error);
return;
}
lastPing = System.currentTimeMillis();
String cl = result.getFirstHeader("Content-Length").getValue();
int len = Integer.parseInt(cl);
if (len > 0) {
final byte b[] = new byte[len];
try {
result.getEntity().getContent().read(b);
myExec.execute(new Runnable() {
@Override
public void run() {
int numMsgResp = 0;
try {
numMsgResp = processResponse(b);
} finally {
p.complete(numMsgResp,null);
}
}
});
} catch (Throwable e) {
p.complete(null,e);
log(e);
}
} else {
p.complete(0,null);
}
}
@Override
public void failed(Exception ex) {
p.complete(null,ex);
log(ex);
}
@Override
public void cancelled() {
p.complete(0,null);
log("request canceled");
}
});
return p;
} } | public class class_name {
protected Promise<Integer> sendCallArray(Object[] req) {
final Promise<Integer> p = new Promise<>();
if (SENDDEBUG)
System.out.println("SENDING "+(req.length-1));
for (int i = 0; i < req.length; i++) {
Object o = req[i];
if ( o instanceof RemoteCallEntry ) {
((RemoteCallEntry) o).pack(conf); // depends on control dependency: [if], data = [none]
}
}
byte[] message = conf.asByteArray(req);
HttpPost request = createRequest(sessionUrl, message);
if ( DumpProtocol ) {
try {
System.out.println("req:"+new String(message,"UTF-8")); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
getClient().execute(request, new FutureCallback<HttpResponse>() {
@Override
public void completed(HttpResponse result) {
if (result.getStatusLine().getStatusCode() != 200) {
String error = "Unexpected status:" + result.getStatusLine().getStatusCode();
p.reject(error); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
lastPing = System.currentTimeMillis();
String cl = result.getFirstHeader("Content-Length").getValue();
int len = Integer.parseInt(cl);
if (len > 0) {
final byte b[] = new byte[len];
try {
result.getEntity().getContent().read(b); // depends on control dependency: [try], data = [none]
myExec.execute(new Runnable() {
@Override
public void run() {
int numMsgResp = 0;
try {
numMsgResp = processResponse(b); // depends on control dependency: [try], data = [none]
} finally {
p.complete(numMsgResp,null);
}
}
}); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
p.complete(null,e);
log(e);
} // depends on control dependency: [catch], data = [none]
} else {
p.complete(0,null); // depends on control dependency: [if], data = [none]
}
}
@Override
public void failed(Exception ex) {
p.complete(null,ex);
log(ex);
}
@Override
public void cancelled() {
p.complete(0,null);
log("request canceled");
}
});
return p;
} } |
public class class_name {
public static String getPostfixFromValue(BytesRef term) {
int i = term.offset;
int length = term.offset + term.length;
byte[] postfix = new byte[length];
while (i < length) {
if ((term.bytes[i] & 0b10000000) == 0b00000000) {
if (term.bytes[i] == 0b00000001) {
i++;
break;
} else {
i++;
}
} else if ((term.bytes[i] & 0b11100000) == 0b11000000) {
i += 2;
} else if ((term.bytes[i] & 0b11110000) == 0b11100000) {
i += 3;
} else if ((term.bytes[i] & 0b11111000) == 0b11110000) {
i += 4;
} else if ((term.bytes[i] & 0b11111100) == 0b11111000) {
i += 5;
} else if ((term.bytes[i] & 0b11111110) == 0b11111100) {
i += 6;
} else {
return "";
}
}
int start = i;
while (i < length) {
if ((term.bytes[i] & 0b10000000) == 0b00000000) {
if (term.bytes[i] == 0b00000000) {
break;
}
postfix[i] = term.bytes[i];
i++;
} else if ((term.bytes[i] & 0b11100000) == 0b11000000) {
postfix[i] = term.bytes[i];
postfix[i + 1] = term.bytes[i + 1];
i += 2;
} else if ((term.bytes[i] & 0b11110000) == 0b11100000) {
postfix[i] = term.bytes[i];
postfix[i + 1] = term.bytes[i + 1];
postfix[i + 2] = term.bytes[i + 2];
i += 3;
} else if ((term.bytes[i] & 0b11111000) == 0b11110000) {
postfix[i] = term.bytes[i];
postfix[i + 1] = term.bytes[i + 1];
postfix[i + 2] = term.bytes[i + 2];
postfix[i + 3] = term.bytes[i + 3];
i += 4;
} else if ((term.bytes[i] & 0b11111100) == 0b11111000) {
postfix[i] = term.bytes[i];
postfix[i + 1] = term.bytes[i + 1];
postfix[i + 2] = term.bytes[i + 2];
postfix[i + 3] = term.bytes[i + 3];
postfix[i + 4] = term.bytes[i + 4];
i += 5;
} else if ((term.bytes[i] & 0b11111110) == 0b11111100) {
postfix[i] = term.bytes[i];
postfix[i + 1] = term.bytes[i + 1];
postfix[i + 2] = term.bytes[i + 2];
postfix[i + 3] = term.bytes[i + 3];
postfix[i + 4] = term.bytes[i + 4];
postfix[i + 5] = term.bytes[i + 5];
i += 6;
} else {
return "";
}
}
return new String(Arrays.copyOfRange(postfix, start, i),
StandardCharsets.UTF_8);
} } | public class class_name {
public static String getPostfixFromValue(BytesRef term) {
int i = term.offset;
int length = term.offset + term.length;
byte[] postfix = new byte[length];
while (i < length) {
if ((term.bytes[i] & 0b10000000) == 0b00000000) {
if (term.bytes[i] == 0b00000001) {
i++; // depends on control dependency: [if], data = [none]
break;
} else {
i++; // depends on control dependency: [if], data = [none]
}
} else if ((term.bytes[i] & 0b11100000) == 0b11000000) {
i += 2; // depends on control dependency: [if], data = [none]
} else if ((term.bytes[i] & 0b11110000) == 0b11100000) {
i += 3; // depends on control dependency: [if], data = [none]
} else if ((term.bytes[i] & 0b11111000) == 0b11110000) {
i += 4; // depends on control dependency: [if], data = [none]
} else if ((term.bytes[i] & 0b11111100) == 0b11111000) {
i += 5; // depends on control dependency: [if], data = [none]
} else if ((term.bytes[i] & 0b11111110) == 0b11111100) {
i += 6; // depends on control dependency: [if], data = [none]
} else {
return ""; // depends on control dependency: [if], data = [none]
}
}
int start = i;
while (i < length) {
if ((term.bytes[i] & 0b10000000) == 0b00000000) {
if (term.bytes[i] == 0b00000000) {
break;
}
postfix[i] = term.bytes[i]; // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
} else if ((term.bytes[i] & 0b11100000) == 0b11000000) {
postfix[i] = term.bytes[i]; // depends on control dependency: [if], data = [none]
postfix[i + 1] = term.bytes[i + 1]; // depends on control dependency: [if], data = [none]
i += 2; // depends on control dependency: [if], data = [none]
} else if ((term.bytes[i] & 0b11110000) == 0b11100000) {
postfix[i] = term.bytes[i]; // depends on control dependency: [if], data = [none]
postfix[i + 1] = term.bytes[i + 1]; // depends on control dependency: [if], data = [none]
postfix[i + 2] = term.bytes[i + 2]; // depends on control dependency: [if], data = [none]
i += 3; // depends on control dependency: [if], data = [none]
} else if ((term.bytes[i] & 0b11111000) == 0b11110000) {
postfix[i] = term.bytes[i]; // depends on control dependency: [if], data = [none]
postfix[i + 1] = term.bytes[i + 1]; // depends on control dependency: [if], data = [none]
postfix[i + 2] = term.bytes[i + 2]; // depends on control dependency: [if], data = [none]
postfix[i + 3] = term.bytes[i + 3]; // depends on control dependency: [if], data = [none]
i += 4; // depends on control dependency: [if], data = [none]
} else if ((term.bytes[i] & 0b11111100) == 0b11111000) {
postfix[i] = term.bytes[i]; // depends on control dependency: [if], data = [none]
postfix[i + 1] = term.bytes[i + 1]; // depends on control dependency: [if], data = [none]
postfix[i + 2] = term.bytes[i + 2]; // depends on control dependency: [if], data = [none]
postfix[i + 3] = term.bytes[i + 3]; // depends on control dependency: [if], data = [none]
postfix[i + 4] = term.bytes[i + 4]; // depends on control dependency: [if], data = [none]
i += 5; // depends on control dependency: [if], data = [none]
} else if ((term.bytes[i] & 0b11111110) == 0b11111100) {
postfix[i] = term.bytes[i]; // depends on control dependency: [if], data = [none]
postfix[i + 1] = term.bytes[i + 1]; // depends on control dependency: [if], data = [none]
postfix[i + 2] = term.bytes[i + 2]; // depends on control dependency: [if], data = [none]
postfix[i + 3] = term.bytes[i + 3]; // depends on control dependency: [if], data = [none]
postfix[i + 4] = term.bytes[i + 4]; // depends on control dependency: [if], data = [none]
postfix[i + 5] = term.bytes[i + 5]; // depends on control dependency: [if], data = [none]
i += 6; // depends on control dependency: [if], data = [none]
} else {
return ""; // depends on control dependency: [if], data = [none]
}
}
return new String(Arrays.copyOfRange(postfix, start, i),
StandardCharsets.UTF_8);
} } |
public class class_name {
public static Frame transpose(Frame src){
if(src.numRows() != (int)src.numRows())
throw H2O.unimpl();
int nchunks = Math.max(1,src.numCols()/10000);
long [] espc = new long[nchunks+1];
int rpc = (src.numCols() / nchunks);
int rem = (src.numCols() % nchunks);
Arrays.fill(espc, rpc);
for (int i = 0; i < rem; ++i) ++espc[i];
long sum = 0;
for (int i = 0; i < espc.length; ++i) {
long s = espc[i];
espc[i] = sum;
sum += s;
}
Key key = Vec.newKey();
int rowLayout = Vec.ESPC.rowLayout(key,espc);
return transpose(src, new Frame(new Vec(key,rowLayout).makeZeros((int)src.numRows())));
} } | public class class_name {
public static Frame transpose(Frame src){
if(src.numRows() != (int)src.numRows())
throw H2O.unimpl();
int nchunks = Math.max(1,src.numCols()/10000);
long [] espc = new long[nchunks+1];
int rpc = (src.numCols() / nchunks);
int rem = (src.numCols() % nchunks);
Arrays.fill(espc, rpc);
for (int i = 0; i < rem; ++i) ++espc[i];
long sum = 0;
for (int i = 0; i < espc.length; ++i) {
long s = espc[i];
espc[i] = sum; // depends on control dependency: [for], data = [i]
sum += s; // depends on control dependency: [for], data = [none]
}
Key key = Vec.newKey();
int rowLayout = Vec.ESPC.rowLayout(key,espc);
return transpose(src, new Frame(new Vec(key,rowLayout).makeZeros((int)src.numRows())));
} } |
public class class_name {
public static void pushContext() {
RpcInternalContext context = LOCAL.get();
if (context != null) {
Deque<RpcInternalContext> deque = DEQUE_LOCAL.get();
if (deque == null) {
deque = new ArrayDeque<RpcInternalContext>();
DEQUE_LOCAL.set(deque);
}
deque.push(context);
LOCAL.set(null);
}
} } | public class class_name {
public static void pushContext() {
RpcInternalContext context = LOCAL.get();
if (context != null) {
Deque<RpcInternalContext> deque = DEQUE_LOCAL.get();
if (deque == null) {
deque = new ArrayDeque<RpcInternalContext>(); // depends on control dependency: [if], data = [none]
DEQUE_LOCAL.set(deque); // depends on control dependency: [if], data = [(deque]
}
deque.push(context); // depends on control dependency: [if], data = [(context]
LOCAL.set(null); // depends on control dependency: [if], data = [null)]
}
} } |
public class class_name {
public void setArtwork(java.util.Collection<Artwork> artwork) {
if (artwork == null) {
this.artwork = null;
return;
}
this.artwork = new com.amazonaws.internal.SdkInternalList<Artwork>(artwork);
} } | public class class_name {
public void setArtwork(java.util.Collection<Artwork> artwork) {
if (artwork == null) {
this.artwork = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.artwork = new com.amazonaws.internal.SdkInternalList<Artwork>(artwork);
} } |
public class class_name {
public static byte[] decode(final byte[] input) {
final int lenInput = findEnd(input);
final int lenOutput = (lenInput * BITS_PER_B64_BYTE / 8);
final byte[] output = new byte[lenOutput];
final byte[] transTable = DECODE_TABLE;
for (int i = 0, j = 0; i < lenInput; i += BYTES_PER_BLOCK_OF_6_BITS) {
final int b1 = transTable[getByte(input, i)];
final int b2 = transTable[getByte(input, i + 1)];
final int b3 = transTable[getByte(input, i + 2)];
final int b4 = transTable[getByte(input, i + 3)];
final long block = ((b1 << 18) | (b2 << 12) | (b3 << 6) | b4) & 0x00FFFFFF;
final byte x1 = (byte) ((block >> 16) & 0xFF);
final byte x2 = (byte) ((block >> 8) & 0xFF);
final byte x3 = (byte) (block & 0xFF);
setByte(output, j++, lenOutput, x1);
setByte(output, j++, lenOutput, x2);
setByte(output, j++, lenOutput, x3);
}
return output;
} } | public class class_name {
public static byte[] decode(final byte[] input) {
final int lenInput = findEnd(input);
final int lenOutput = (lenInput * BITS_PER_B64_BYTE / 8);
final byte[] output = new byte[lenOutput];
final byte[] transTable = DECODE_TABLE;
for (int i = 0, j = 0; i < lenInput; i += BYTES_PER_BLOCK_OF_6_BITS) {
final int b1 = transTable[getByte(input, i)];
final int b2 = transTable[getByte(input, i + 1)];
final int b3 = transTable[getByte(input, i + 2)];
final int b4 = transTable[getByte(input, i + 3)];
final long block = ((b1 << 18) | (b2 << 12) | (b3 << 6) | b4) & 0x00FFFFFF;
final byte x1 = (byte) ((block >> 16) & 0xFF);
final byte x2 = (byte) ((block >> 8) & 0xFF);
final byte x3 = (byte) (block & 0xFF);
setByte(output, j++, lenOutput, x1); // depends on control dependency: [for], data = [none]
setByte(output, j++, lenOutput, x2); // depends on control dependency: [for], data = [none]
setByte(output, j++, lenOutput, x3); // depends on control dependency: [for], data = [none]
}
return output;
} } |
public class class_name {
@Override public void onStatusChange(JobExecutionState state, RunningState previousStatus,
RunningState newStatus) {
if (_log.isPresent()) {
_log.get().info("JobExection status change for " + state.getJobSpec().toShortString() +
": " + previousStatus + " --> " + newStatus);
}
} } | public class class_name {
@Override public void onStatusChange(JobExecutionState state, RunningState previousStatus,
RunningState newStatus) {
if (_log.isPresent()) {
_log.get().info("JobExection status change for " + state.getJobSpec().toShortString() +
": " + previousStatus + " --> " + newStatus); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SafeVarargs
/* #end */
public final int addAll(KType... elements) {
ensureCapacity(elements.length);
int count = 0;
for (KType e : elements) {
if (add(e)) {
count++;
}
}
return count;
} } | public class class_name {
@SafeVarargs
/* #end */
public final int addAll(KType... elements) {
ensureCapacity(elements.length);
int count = 0;
for (KType e : elements) {
if (add(e)) {
count++; // depends on control dependency: [if], data = [none]
}
}
return count;
} } |
public class class_name {
public void writeDouble(double value) {
try {
buffer.writeInt(8);
buffer.writeDouble(value);
} catch (Exception e) {
throw new BinaryWriteFailedException(e);
}
} } | public class class_name {
public void writeDouble(double value) {
try {
buffer.writeInt(8); // depends on control dependency: [try], data = [none]
buffer.writeDouble(value); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new BinaryWriteFailedException(e);
} // depends on control dependency: [catch], data = [none]
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.