code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public Map<String,Object> handleUpdateFilterMap(Map<String,Object> propFilter)
{
if (propFilter != null)
{
Object bookmark = propFilter.get(ADD_BOOKMARK);
if (bookmark != null)
{
if (CLEAR_BOOKMARKS.equals(bookmark))
{
if (m_htBookmarks != null)
m_htBookmarks.clear();
m_strSecondaryKey = null; // The secondary key to watch for.
m_objKeyData = null; // The reference value to watch for.
String strHint = (String)propFilter.get(SECOND_KEY_HINT);
if (strHint != null)
{
Object objKeyData = propFilter.get(strHint); // The value of the 2nd key reference data.
m_strSecondaryKey = strHint; // The secondary key to watch for.
m_objKeyData = objKeyData; // The reference value to watch for.
}
}
else
{
if (m_htBookmarks != null)
if (!m_htBookmarks.contains(bookmark))
m_htBookmarks.add(bookmark);
}
}
}
return super.handleUpdateFilterMap(propFilter); // Update any remote copy of this.
} } | public class class_name {
public Map<String,Object> handleUpdateFilterMap(Map<String,Object> propFilter)
{
if (propFilter != null)
{
Object bookmark = propFilter.get(ADD_BOOKMARK);
if (bookmark != null)
{
if (CLEAR_BOOKMARKS.equals(bookmark))
{
if (m_htBookmarks != null)
m_htBookmarks.clear();
m_strSecondaryKey = null; // The secondary key to watch for. // depends on control dependency: [if], data = [none]
m_objKeyData = null; // The reference value to watch for. // depends on control dependency: [if], data = [none]
String strHint = (String)propFilter.get(SECOND_KEY_HINT);
if (strHint != null)
{
Object objKeyData = propFilter.get(strHint); // The value of the 2nd key reference data.
m_strSecondaryKey = strHint; // The secondary key to watch for. // depends on control dependency: [if], data = [none]
m_objKeyData = objKeyData; // The reference value to watch for. // depends on control dependency: [if], data = [none]
}
}
else
{
if (m_htBookmarks != null)
if (!m_htBookmarks.contains(bookmark))
m_htBookmarks.add(bookmark);
}
}
}
return super.handleUpdateFilterMap(propFilter); // Update any remote copy of this.
} } |
public class class_name {
public static void scale(GVRMesh mesh, float x, float y, float z) {
final float [] vertices = mesh.getVertices();
final int vsize = vertices.length;
for (int i = 0; i < vsize; i += 3) {
vertices[i] *= x;
vertices[i + 1] *= y;
vertices[i + 2] *= z;
}
mesh.setVertices(vertices);
} } | public class class_name {
public static void scale(GVRMesh mesh, float x, float y, float z) {
final float [] vertices = mesh.getVertices();
final int vsize = vertices.length;
for (int i = 0; i < vsize; i += 3) {
vertices[i] *= x; // depends on control dependency: [for], data = [i]
vertices[i + 1] *= y; // depends on control dependency: [for], data = [i]
vertices[i + 2] *= z; // depends on control dependency: [for], data = [i]
}
mesh.setVertices(vertices);
} } |
public class class_name {
CharSequence render()
{
StringBuilder stringBuilder = new StringBuilder();
for (JsStatement statement : statements)
{
stringBuilder.append("\t");
stringBuilder.append(statement.render());
stringBuilder.append("\n");
}
return stringBuilder;
} } | public class class_name {
CharSequence render()
{
StringBuilder stringBuilder = new StringBuilder();
for (JsStatement statement : statements)
{
stringBuilder.append("\t"); // depends on control dependency: [for], data = [none]
stringBuilder.append(statement.render()); // depends on control dependency: [for], data = [statement]
stringBuilder.append("\n"); // depends on control dependency: [for], data = [none]
}
return stringBuilder;
} } |
public class class_name {
private <T> void invoke(Map<Object, Set<Method>> methods, T instance) {
for (Map.Entry<Object, Set<Method>> entry : methods.entrySet()) {
Object listener = entry.getKey();
Set<Method> listenerMethods = entry.getValue();
if (listenerMethods != null) {
for (Method method : listenerMethods) {
Class<?> parameterType = method.getParameterTypes()[0];
if (parameterType.isAssignableFrom(instance.getClass())) {
try {
method.invoke(listener, instance);
} catch (IllegalAccessException e) {
throw new XOException("Cannot access instance listener method " + method.toGenericString(), e);
} catch (InvocationTargetException e) {
throw new XOException("Cannot invoke instance listener method " + method.toGenericString(), e);
}
}
}
}
}
} } | public class class_name {
private <T> void invoke(Map<Object, Set<Method>> methods, T instance) {
for (Map.Entry<Object, Set<Method>> entry : methods.entrySet()) {
Object listener = entry.getKey();
Set<Method> listenerMethods = entry.getValue();
if (listenerMethods != null) {
for (Method method : listenerMethods) {
Class<?> parameterType = method.getParameterTypes()[0];
if (parameterType.isAssignableFrom(instance.getClass())) {
try {
method.invoke(listener, instance); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
throw new XOException("Cannot access instance listener method " + method.toGenericString(), e);
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
throw new XOException("Cannot invoke instance listener method " + method.toGenericString(), e);
} // depends on control dependency: [catch], data = [none]
}
}
}
}
} } |
public class class_name {
public void marshall(CreatePartitionRequest createPartitionRequest, ProtocolMarshaller protocolMarshaller) {
if (createPartitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createPartitionRequest.getCatalogId(), CATALOGID_BINDING);
protocolMarshaller.marshall(createPartitionRequest.getDatabaseName(), DATABASENAME_BINDING);
protocolMarshaller.marshall(createPartitionRequest.getTableName(), TABLENAME_BINDING);
protocolMarshaller.marshall(createPartitionRequest.getPartitionInput(), PARTITIONINPUT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreatePartitionRequest createPartitionRequest, ProtocolMarshaller protocolMarshaller) {
if (createPartitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createPartitionRequest.getCatalogId(), CATALOGID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createPartitionRequest.getDatabaseName(), DATABASENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createPartitionRequest.getTableName(), TABLENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createPartitionRequest.getPartitionInput(), PARTITIONINPUT_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 Boolean getLifecycleInitRequiredDefault() {
String property = getProperty(LIFECYCLE_INITREQUIREDDEFAULT);
if (property != null) {
return Boolean.parseBoolean(property);
}
return null;
} } | public class class_name {
public Boolean getLifecycleInitRequiredDefault() {
String property = getProperty(LIFECYCLE_INITREQUIREDDEFAULT);
if (property != null) {
return Boolean.parseBoolean(property); // depends on control dependency: [if], data = [(property]
}
return null;
} } |
public class class_name {
public List<Object> getEntities(String name) {
List<Object> entitiesList = new LinkedList<Object>();
for (Result result : results) {
if (result.getResultName().equals(name)) {
entitiesList.add(result.getObject());
}
}
return entitiesList;
} } | public class class_name {
public List<Object> getEntities(String name) {
List<Object> entitiesList = new LinkedList<Object>();
for (Result result : results) {
if (result.getResultName().equals(name)) {
entitiesList.add(result.getObject()); // depends on control dependency: [if], data = [none]
}
}
return entitiesList;
} } |
public class class_name {
public void explore() {
if (isLeaf) return;
if (isGeneric) return;
removeAllChildren();
try {
String addressPath = addressPath();
ModelNode resourceDesc = executor.doCommand(addressPath + ":read-resource-description");
resourceDesc = resourceDesc.get("result");
ModelNode response = executor.doCommand(addressPath + ":read-resource(include-runtime=true,include-defaults=true)");
ModelNode result = response.get("result");
if (!result.isDefined()) return;
List<String> childrenTypes = getChildrenTypes(addressPath);
for (ModelNode node : result.asList()) {
Property prop = node.asProperty();
if (childrenTypes.contains(prop.getName())) { // resource node
if (hasGenericOperations(addressPath, prop.getName())) {
add(new ManagementModelNode(cliGuiCtx, new UserObject(node, prop.getName())));
}
if (prop.getValue().isDefined()) {
for (ModelNode innerNode : prop.getValue().asList()) {
UserObject usrObj = new UserObject(innerNode, prop.getName(), innerNode.asProperty().getName());
add(new ManagementModelNode(cliGuiCtx, usrObj));
}
}
} else { // attribute node
UserObject usrObj = new UserObject(node, resourceDesc, prop.getName(), prop.getValue().asString());
add(new ManagementModelNode(cliGuiCtx, usrObj));
}
}
} catch (Exception e) {
e.printStackTrace();
}
} } | public class class_name {
public void explore() {
if (isLeaf) return;
if (isGeneric) return;
removeAllChildren();
try {
String addressPath = addressPath();
ModelNode resourceDesc = executor.doCommand(addressPath + ":read-resource-description");
resourceDesc = resourceDesc.get("result"); // depends on control dependency: [try], data = [none]
ModelNode response = executor.doCommand(addressPath + ":read-resource(include-runtime=true,include-defaults=true)");
ModelNode result = response.get("result");
if (!result.isDefined()) return;
List<String> childrenTypes = getChildrenTypes(addressPath);
for (ModelNode node : result.asList()) {
Property prop = node.asProperty();
if (childrenTypes.contains(prop.getName())) { // resource node
if (hasGenericOperations(addressPath, prop.getName())) {
add(new ManagementModelNode(cliGuiCtx, new UserObject(node, prop.getName()))); // depends on control dependency: [if], data = [none]
}
if (prop.getValue().isDefined()) {
for (ModelNode innerNode : prop.getValue().asList()) {
UserObject usrObj = new UserObject(innerNode, prop.getName(), innerNode.asProperty().getName());
add(new ManagementModelNode(cliGuiCtx, usrObj)); // depends on control dependency: [for], data = [none]
}
}
} else { // attribute node
UserObject usrObj = new UserObject(node, resourceDesc, prop.getName(), prop.getValue().asString());
add(new ManagementModelNode(cliGuiCtx, usrObj)); // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setupLookAndFeel(PropertyOwner propertyOwner)
{
Map<String,Object> properties = null;
if (propertyOwner == null)
propertyOwner = this.retrieveUserProperties(Params.SCREEN);
if (propertyOwner == null)
{ // Thin only
RemoteTask task = (RemoteTask)this.getApplication().getRemoteTask(null, null, false);
if (task != null)
{
try {
properties = (Map)task.doRemoteAction(Params.RETRIEVE_USER_PROPERTIES, properties);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
String backgroundName = null;
if (propertyOwner != null)
if (propertyOwner.getProperty(Params.BACKGROUNDCOLOR) != null)
backgroundName = propertyOwner.getProperty(Params.BACKGROUNDCOLOR);
if (backgroundName == null)
if (properties != null)
backgroundName = (String)properties.get(Params.BACKGROUNDCOLOR);
if (backgroundName != null)
this.setBackgroundColor(BaseApplet.nameToColor(backgroundName));
Container top = this;
while (top.getParent() != null)
{
top = top.getParent();
}
ScreenUtil.updateLookAndFeel(top, propertyOwner, properties);
} } | public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setupLookAndFeel(PropertyOwner propertyOwner)
{
Map<String,Object> properties = null;
if (propertyOwner == null)
propertyOwner = this.retrieveUserProperties(Params.SCREEN);
if (propertyOwner == null)
{ // Thin only
RemoteTask task = (RemoteTask)this.getApplication().getRemoteTask(null, null, false);
if (task != null)
{
try {
properties = (Map)task.doRemoteAction(Params.RETRIEVE_USER_PROPERTIES, properties); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
}
String backgroundName = null;
if (propertyOwner != null)
if (propertyOwner.getProperty(Params.BACKGROUNDCOLOR) != null)
backgroundName = propertyOwner.getProperty(Params.BACKGROUNDCOLOR);
if (backgroundName == null)
if (properties != null)
backgroundName = (String)properties.get(Params.BACKGROUNDCOLOR);
if (backgroundName != null)
this.setBackgroundColor(BaseApplet.nameToColor(backgroundName));
Container top = this;
while (top.getParent() != null)
{
top = top.getParent(); // depends on control dependency: [while], data = [none]
}
ScreenUtil.updateLookAndFeel(top, propertyOwner, properties);
} } |
public class class_name {
boolean scanSpecialIdentifier(String identifier) {
int length = identifier.length();
if (limit - currentPosition < length) {
return false;
}
for (int i = 0; i < length; i++) {
int character = identifier.charAt(i);
if (character == sqlString.charAt(currentPosition + i)) {
continue;
}
if (character
== Character.toUpperCase(sqlString.charAt(currentPosition
+ i))) {
continue;
}
return false;
}
currentPosition += length;
return true;
} } | public class class_name {
boolean scanSpecialIdentifier(String identifier) {
int length = identifier.length();
if (limit - currentPosition < length) {
return false; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < length; i++) {
int character = identifier.charAt(i);
if (character == sqlString.charAt(currentPosition + i)) {
continue;
}
if (character
== Character.toUpperCase(sqlString.charAt(currentPosition
+ i))) {
continue;
}
return false; // depends on control dependency: [for], data = [none]
}
currentPosition += length;
return true;
} } |
public class class_name {
protected LinkedList<ModificationRecord> getModificationRecords(ClassDoc classDoc) {
ClassDoc superClass = classDoc.superclass();
if (superClass == null) {
return new LinkedList<ModificationRecord>();
}
LinkedList<ModificationRecord> result = this.getModificationRecords(superClass);
result.addAll(this.parseModificationRecords(classDoc.tags()));
return result;
} } | public class class_name {
protected LinkedList<ModificationRecord> getModificationRecords(ClassDoc classDoc) {
ClassDoc superClass = classDoc.superclass();
if (superClass == null) {
return new LinkedList<ModificationRecord>(); // depends on control dependency: [if], data = [none]
}
LinkedList<ModificationRecord> result = this.getModificationRecords(superClass);
result.addAll(this.parseModificationRecords(classDoc.tags()));
return result;
} } |
public class class_name {
public boolean setRxMasterKey(byte[] key) {
boolean res = false;
if ((key.length == MASTER_KEY_SIZE_32_BYTES)
|| (key.length == MASTER_KEY_SIZE_16_BYTES)) {
rxMasterKey = null;
rxMasterKey = platform.getUtils().copy(key);
res = true;
logDebug("setRxMasterKey "
+ platform.getUtils().byteToHexString(rxMasterKey));
} else {
logError("Wrong length iRxMasterKey: " + key.length);
}
return res;
} } | public class class_name {
public boolean setRxMasterKey(byte[] key) {
boolean res = false;
if ((key.length == MASTER_KEY_SIZE_32_BYTES)
|| (key.length == MASTER_KEY_SIZE_16_BYTES)) {
rxMasterKey = null; // depends on control dependency: [if], data = [none]
rxMasterKey = platform.getUtils().copy(key); // depends on control dependency: [if], data = [none]
res = true; // depends on control dependency: [if], data = [none]
logDebug("setRxMasterKey "
+ platform.getUtils().byteToHexString(rxMasterKey)); // depends on control dependency: [if], data = [none]
} else {
logError("Wrong length iRxMasterKey: " + key.length); // depends on control dependency: [if], data = [none]
}
return res;
} } |
public class class_name {
@Override
public void onCreate(SQLiteDatabase db) {
for (TableHelper th : getTableHelpers()) {
th.onCreate(db);
}
} } | public class class_name {
@Override
public void onCreate(SQLiteDatabase db) {
for (TableHelper th : getTableHelpers()) {
th.onCreate(db); // depends on control dependency: [for], data = [th]
}
} } |
public class class_name {
@Deprecated
public <T> Collection<Class<? extends T>> discover( Class<T> spi ) {
Set<Class<? extends T>> result = new HashSet<>();
for (PluginWrapper p : activePlugins) {
Service.load(spi, p.classLoader, result);
}
return result;
} } | public class class_name {
@Deprecated
public <T> Collection<Class<? extends T>> discover( Class<T> spi ) {
Set<Class<? extends T>> result = new HashSet<>();
for (PluginWrapper p : activePlugins) {
Service.load(spi, p.classLoader, result); // depends on control dependency: [for], data = [p]
}
return result;
} } |
public class class_name {
private ClassTemplateSpec createFromDataSchema(DataSchema schema)
{
if (schema instanceof MapDataSchema)
{
return new CourierMapTemplateSpec((MapDataSchema) schema);
}
return ClassTemplateSpec.createFromDataSchema(schema);
} } | public class class_name {
private ClassTemplateSpec createFromDataSchema(DataSchema schema)
{
if (schema instanceof MapDataSchema)
{
return new CourierMapTemplateSpec((MapDataSchema) schema); // depends on control dependency: [if], data = [none]
}
return ClassTemplateSpec.createFromDataSchema(schema);
} } |
public class class_name {
public EClass getIfcVertexLoop() {
if (ifcVertexLoopEClass == null) {
ifcVertexLoopEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(635);
}
return ifcVertexLoopEClass;
} } | public class class_name {
public EClass getIfcVertexLoop() {
if (ifcVertexLoopEClass == null) {
ifcVertexLoopEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(635);
// depends on control dependency: [if], data = [none]
}
return ifcVertexLoopEClass;
} } |
public class class_name {
public static <T> List<Optional<LocalProperty<T>>> normalize(List<? extends LocalProperty<T>> localProperties)
{
List<Optional<LocalProperty<T>>> normalizedProperties = new ArrayList<>(localProperties.size());
Set<T> constants = new HashSet<>();
for (LocalProperty<T> localProperty : localProperties) {
normalizedProperties.add(localProperty.withConstants(constants));
constants.addAll(localProperty.getColumns());
}
return normalizedProperties;
} } | public class class_name {
public static <T> List<Optional<LocalProperty<T>>> normalize(List<? extends LocalProperty<T>> localProperties)
{
List<Optional<LocalProperty<T>>> normalizedProperties = new ArrayList<>(localProperties.size());
Set<T> constants = new HashSet<>();
for (LocalProperty<T> localProperty : localProperties) {
normalizedProperties.add(localProperty.withConstants(constants)); // depends on control dependency: [for], data = [localProperty]
constants.addAll(localProperty.getColumns()); // depends on control dependency: [for], data = [localProperty]
}
return normalizedProperties;
} } |
public class class_name {
public Sequence[] getWorkerSequences()
{
final Sequence[] sequences = new Sequence[workProcessors.length + 1];
for (int i = 0, size = workProcessors.length; i < size; i++)
{
sequences[i] = workProcessors[i].getSequence();
}
sequences[sequences.length - 1] = workSequence;
return sequences;
} } | public class class_name {
public Sequence[] getWorkerSequences()
{
final Sequence[] sequences = new Sequence[workProcessors.length + 1];
for (int i = 0, size = workProcessors.length; i < size; i++)
{
sequences[i] = workProcessors[i].getSequence(); // depends on control dependency: [for], data = [i]
}
sequences[sequences.length - 1] = workSequence;
return sequences;
} } |
public class class_name {
public static void remove(Object mock) {
if (mock instanceof Class<?>) {
if (newSubstitutions.containsKey(mock)) {
newSubstitutions.remove(mock);
}
if (classMocks.containsKey(mock)) {
classMocks.remove(mock);
}
} else if (instanceMocks.containsKey(mock)) {
instanceMocks.remove(mock);
}
} } | public class class_name {
public static void remove(Object mock) {
if (mock instanceof Class<?>) {
if (newSubstitutions.containsKey(mock)) {
newSubstitutions.remove(mock); // depends on control dependency: [if], data = [none]
}
if (classMocks.containsKey(mock)) {
classMocks.remove(mock); // depends on control dependency: [if], data = [none]
}
} else if (instanceMocks.containsKey(mock)) {
instanceMocks.remove(mock); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static IDataSet toDataSet(final IDataModel dataModel) {
if (dataModel == null) { return null; }
IDataSet dataSet = new DataSet(dataModel.getName());
if (dataModel.rowCount() == 0) { return dataSet; }
for (IDmRow dmRow : dataModel) {
IDsRow dsRow = dataSet.addRow();
for (IDmCell dmCell : dmRow) {
IDsCell dsCell = dsRow.addCell(dmCell.getAddress().a1Address().column());
if (dmCell.getValue().isPresent()) {
dsCell.setValue(dmCell.getValue().get());
}
}
}
return dataSet;
} } | public class class_name {
static IDataSet toDataSet(final IDataModel dataModel) {
if (dataModel == null) { return null; } // depends on control dependency: [if], data = [none]
IDataSet dataSet = new DataSet(dataModel.getName());
if (dataModel.rowCount() == 0) { return dataSet; } // depends on control dependency: [if], data = [none]
for (IDmRow dmRow : dataModel) {
IDsRow dsRow = dataSet.addRow();
for (IDmCell dmCell : dmRow) {
IDsCell dsCell = dsRow.addCell(dmCell.getAddress().a1Address().column());
if (dmCell.getValue().isPresent()) {
dsCell.setValue(dmCell.getValue().get()); // depends on control dependency: [if], data = [none]
}
}
}
return dataSet;
} } |
public class class_name {
public EClass getIfcRelNests() {
if (ifcRelNestsEClass == null) {
ifcRelNestsEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(476);
}
return ifcRelNestsEClass;
} } | public class class_name {
public EClass getIfcRelNests() {
if (ifcRelNestsEClass == null) {
ifcRelNestsEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(476);
// depends on control dependency: [if], data = [none]
}
return ifcRelNestsEClass;
} } |
public class class_name {
public static IDifference difference(IChemObject first, IChemObject second) {
if (!(first instanceof IChemObject && second instanceof IChemObject)) {
return null;
}
IChemObject firstElem = (IChemObject) first;
IChemObject secondElem = (IChemObject) second;
ChemObjectDifference coDiff = new ChemObjectDifference("ChemObjectDiff");
// Compare flags
boolean[] firstFlags = firstElem.getFlags();
boolean[] secondFlags = secondElem.getFlags();
coDiff.addChild(BooleanArrayDifference.construct("flag", firstFlags, secondFlags));
if (coDiff.childCount() > 0) {
return coDiff;
} else {
return null;
}
} } | public class class_name {
public static IDifference difference(IChemObject first, IChemObject second) {
if (!(first instanceof IChemObject && second instanceof IChemObject)) {
return null; // depends on control dependency: [if], data = [none]
}
IChemObject firstElem = (IChemObject) first;
IChemObject secondElem = (IChemObject) second;
ChemObjectDifference coDiff = new ChemObjectDifference("ChemObjectDiff");
// Compare flags
boolean[] firstFlags = firstElem.getFlags();
boolean[] secondFlags = secondElem.getFlags();
coDiff.addChild(BooleanArrayDifference.construct("flag", firstFlags, secondFlags));
if (coDiff.childCount() > 0) {
return coDiff; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public DescribeFleetHistoryResult withHistoryRecords(HistoryRecordEntry... historyRecords) {
if (this.historyRecords == null) {
setHistoryRecords(new com.amazonaws.internal.SdkInternalList<HistoryRecordEntry>(historyRecords.length));
}
for (HistoryRecordEntry ele : historyRecords) {
this.historyRecords.add(ele);
}
return this;
} } | public class class_name {
public DescribeFleetHistoryResult withHistoryRecords(HistoryRecordEntry... historyRecords) {
if (this.historyRecords == null) {
setHistoryRecords(new com.amazonaws.internal.SdkInternalList<HistoryRecordEntry>(historyRecords.length)); // depends on control dependency: [if], data = [none]
}
for (HistoryRecordEntry ele : historyRecords) {
this.historyRecords.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void hasLastKey(@NullableDecl Object key) {
if (actualAsNavigableMap().isEmpty()) {
failWithActual("expected to have last key", key);
return;
}
if (!Objects.equal(actualAsNavigableMap().lastKey(), key)) {
if (actualAsNavigableMap().containsKey(key)) {
failWithoutActual(
simpleFact(
lenientFormat(
"Not true that %s has last key <%s>. "
+ "It does contain this key, but the last key is <%s>",
actualAsString(), key, actualAsNavigableMap().lastKey())));
return;
}
failWithoutActual(
simpleFact(
lenientFormat(
"Not true that %s has last key <%s>. "
+ "It does not contain this key, and the last key is <%s>",
actualAsString(), key, actualAsNavigableMap().lastKey())));
}
} } | public class class_name {
public void hasLastKey(@NullableDecl Object key) {
if (actualAsNavigableMap().isEmpty()) {
failWithActual("expected to have last key", key); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (!Objects.equal(actualAsNavigableMap().lastKey(), key)) {
if (actualAsNavigableMap().containsKey(key)) {
failWithoutActual(
simpleFact(
lenientFormat(
"Not true that %s has last key <%s>. "
+ "It does contain this key, but the last key is <%s>",
actualAsString(), key, actualAsNavigableMap().lastKey()))); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
failWithoutActual(
simpleFact(
lenientFormat(
"Not true that %s has last key <%s>. "
+ "It does not contain this key, and the last key is <%s>",
actualAsString(), key, actualAsNavigableMap().lastKey()))); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
final private String printBalance(Integer p, N n) {
StringBuilder text = new StringBuilder();
if (n != null) {
text.append(printBalance((p + 1), n.leftChild));
String format = "%" + (3 * p) + "s";
text.append(String.format(format, ""));
if (n.left == n.right) {
text.append("[" + n.left + "] (" + n.max + ") : " + n.lists.size()
+ " lists\n");
} else {
text.append("[" + n.left + "-" + n.right + "] (" + n.max + ") : "
+ n.lists.size() + " lists\n");
}
text.append(printBalance((p + 1), n.rightChild));
}
return text.toString();
} } | public class class_name {
final private String printBalance(Integer p, N n) {
StringBuilder text = new StringBuilder();
if (n != null) {
text.append(printBalance((p + 1), n.leftChild)); // depends on control dependency: [if], data = [none]
String format = "%" + (3 * p) + "s";
text.append(String.format(format, "")); // depends on control dependency: [if], data = [none]
if (n.left == n.right) {
text.append("[" + n.left + "] (" + n.max + ") : " + n.lists.size()
+ " lists\n"); // depends on control dependency: [if], data = [none]
} else {
text.append("[" + n.left + "-" + n.right + "] (" + n.max + ") : "
+ n.lists.size() + " lists\n"); // depends on control dependency: [if], data = [none]
}
text.append(printBalance((p + 1), n.rightChild)); // depends on control dependency: [if], data = [none]
}
return text.toString();
} } |
public class class_name {
public final void addElement(Object value)
{
if ((m_firstFree + 1) >= m_mapSize)
{
m_mapSize += m_blocksize;
Object newMap[] = new Object[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
m_map = newMap;
}
m_map[m_firstFree] = value;
m_firstFree++;
} } | public class class_name {
public final void addElement(Object value)
{
if ((m_firstFree + 1) >= m_mapSize)
{
m_mapSize += m_blocksize; // depends on control dependency: [if], data = [none]
Object newMap[] = new Object[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); // depends on control dependency: [if], data = [none]
m_map = newMap; // depends on control dependency: [if], data = [none]
}
m_map[m_firstFree] = value;
m_firstFree++;
} } |
public class class_name {
@Override
public synchronized void invalidate() {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[INVALIDATE], appNameAndIdString);
}
if (invalInProgress) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[INVALIDATE], "Invalidation in Progress");
}
return;
}
if (!_isValid) {
throw new IllegalStateException();
}
invalInProgress = true;
// PM03375: Remove duplicate call to sessionCacheDiscard for persistence case
if (_smc.isUsingMemory()) {
_storeCallback.sessionCacheDiscard(this);
}
_storeCallback.sessionInvalidated(this);
_store.removeSession(_sessionId);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[INVALIDATE], "_removeAttrOnInvalidate = " + _removeAttrOnInvalidate );
if(_attributes != null) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[INVALIDATE], "session _attributes.size() = " + _attributes.size() );
}
}
//CTS defect expects removal of session attributes
if(_attributes != null && _removeAttrOnInvalidate) {
Enumeration<String> attrKey = _attributes.keys();
while(attrKey.hasMoreElements()){
String key = attrKey.nextElement();
this.removeAttribute(key);
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[INVALIDATE], "session attributes removed");
}
}
setIsValid(false);
invalInProgress = false;
_attributes = null;
_attributeNames.clear();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[INVALIDATE]);
}
} } | public class class_name {
@Override
public synchronized void invalidate() {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[INVALIDATE], appNameAndIdString); // depends on control dependency: [if], data = [none]
}
if (invalInProgress) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[INVALIDATE], "Invalidation in Progress"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
if (!_isValid) {
throw new IllegalStateException();
}
invalInProgress = true;
// PM03375: Remove duplicate call to sessionCacheDiscard for persistence case
if (_smc.isUsingMemory()) {
_storeCallback.sessionCacheDiscard(this); // depends on control dependency: [if], data = [none]
}
_storeCallback.sessionInvalidated(this);
_store.removeSession(_sessionId);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[INVALIDATE], "_removeAttrOnInvalidate = " + _removeAttrOnInvalidate ); // depends on control dependency: [if], data = [none]
if(_attributes != null) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[INVALIDATE], "session _attributes.size() = " + _attributes.size() ); // depends on control dependency: [if], data = [none]
}
}
//CTS defect expects removal of session attributes
if(_attributes != null && _removeAttrOnInvalidate) {
Enumeration<String> attrKey = _attributes.keys();
while(attrKey.hasMoreElements()){
String key = attrKey.nextElement();
this.removeAttribute(key); // depends on control dependency: [while], data = [none]
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[INVALIDATE], "session attributes removed"); // depends on control dependency: [if], data = [none]
}
}
setIsValid(false);
invalInProgress = false;
_attributes = null;
_attributeNames.clear();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[INVALIDATE]); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static void pullDataSourceProperties(String name, DataSource dataSource) {
// CHECKSTYLE:ON
final String dataSourceClassName = dataSource.getClass().getName();
if ("org.apache.tomcat.dbcp.dbcp.BasicDataSource".equals(dataSourceClassName)
&& dataSource instanceof BasicDataSource) {
pullTomcatDbcpDataSourceProperties(name, dataSource);
} else if ("org.apache.tomcat.dbcp.dbcp2.BasicDataSource".equals(dataSourceClassName)
&& dataSource instanceof org.apache.tomcat.dbcp.dbcp2.BasicDataSource) {
pullTomcatDbcp2DataSourceProperties(name, dataSource);
} else if ("org.apache.commons.dbcp.BasicDataSource".equals(dataSourceClassName)
&& dataSource instanceof org.apache.commons.dbcp.BasicDataSource) {
pullCommonsDbcpDataSourceProperties(name, dataSource);
} else if ("org.apache.commons.dbcp2.BasicDataSource".equals(dataSourceClassName)
&& dataSource instanceof org.apache.commons.dbcp2.BasicDataSource) {
pullCommonsDbcp2DataSourceProperties(name, dataSource);
} else if ("org.apache.tomcat.jdbc.pool.DataSource".equals(dataSourceClassName)
&& dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource) {
pullTomcatJdbcDataSourceProperties(name, dataSource);
}
} } | public class class_name {
static void pullDataSourceProperties(String name, DataSource dataSource) {
// CHECKSTYLE:ON
final String dataSourceClassName = dataSource.getClass().getName();
if ("org.apache.tomcat.dbcp.dbcp.BasicDataSource".equals(dataSourceClassName)
&& dataSource instanceof BasicDataSource) {
pullTomcatDbcpDataSourceProperties(name, dataSource);
// depends on control dependency: [if], data = [none]
} else if ("org.apache.tomcat.dbcp.dbcp2.BasicDataSource".equals(dataSourceClassName)
&& dataSource instanceof org.apache.tomcat.dbcp.dbcp2.BasicDataSource) {
pullTomcatDbcp2DataSourceProperties(name, dataSource);
// depends on control dependency: [if], data = [none]
} else if ("org.apache.commons.dbcp.BasicDataSource".equals(dataSourceClassName)
&& dataSource instanceof org.apache.commons.dbcp.BasicDataSource) {
pullCommonsDbcpDataSourceProperties(name, dataSource);
// depends on control dependency: [if], data = [none]
} else if ("org.apache.commons.dbcp2.BasicDataSource".equals(dataSourceClassName)
&& dataSource instanceof org.apache.commons.dbcp2.BasicDataSource) {
pullCommonsDbcp2DataSourceProperties(name, dataSource);
// depends on control dependency: [if], data = [none]
} else if ("org.apache.tomcat.jdbc.pool.DataSource".equals(dataSourceClassName)
&& dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource) {
pullTomcatJdbcDataSourceProperties(name, dataSource);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setRoundedCorners(final boolean ROUNDED) {
if (null == roundedCorners) {
_roundedCorners = ROUNDED;
fireTileEvent(REDRAW_EVENT);
} else {
roundedCorners.set(ROUNDED);
}
} } | public class class_name {
public void setRoundedCorners(final boolean ROUNDED) {
if (null == roundedCorners) {
_roundedCorners = ROUNDED; // depends on control dependency: [if], data = [none]
fireTileEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none]
} else {
roundedCorners.set(ROUNDED); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void close() {
try {
// Request BMP to create a new HAR for this Proxy
HttpDelete shutdownProxyDELETE = new HttpDelete(requestURIBuilder()
.setPath(proxyURIPath())
.build());
// Execute request
CloseableHttpResponse response = HTTPclient.execute(shutdownProxyDELETE);
// Check request was successful
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
throw new BMPCUnableToCloseProxyException(String.format(
"Invalid HTTP Response when attempting to close " +
"Proxy '%d'. Status code: %d",
proxyPort, statusCode));
}
// Close HTTP Response
response.close();
// Close HTTP Client
HTTPclient.close();
} catch (Exception e) {
throw new BMPCUnableToCloseProxyException(e);
}
} } | public class class_name {
public void close() {
try {
// Request BMP to create a new HAR for this Proxy
HttpDelete shutdownProxyDELETE = new HttpDelete(requestURIBuilder()
.setPath(proxyURIPath())
.build());
// Execute request
CloseableHttpResponse response = HTTPclient.execute(shutdownProxyDELETE);
// Check request was successful
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
throw new BMPCUnableToCloseProxyException(String.format(
"Invalid HTTP Response when attempting to close " +
"Proxy '%d'. Status code: %d",
proxyPort, statusCode));
}
// Close HTTP Response
response.close(); // depends on control dependency: [try], data = [none]
// Close HTTP Client
HTTPclient.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new BMPCUnableToCloseProxyException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int hashBytes(byte[] bytes, int offset, int length) {
int hash = 1;
for (int i = offset; i < offset + length; i++) {
hash = (31 * hash) + bytes[i];
}
return hash;
} } | public class class_name {
public static int hashBytes(byte[] bytes, int offset, int length) {
int hash = 1;
for (int i = offset; i < offset + length; i++) {
hash = (31 * hash) + bytes[i]; // depends on control dependency: [for], data = [i]
}
return hash;
} } |
public class class_name {
@SuppressWarnings("rawtypes")
public static Collection createConcreteCollection(Class interfaceType) {
Collection elements;
if (interfaceType.equals(List.class) || interfaceType.equals(Collection.class)) {
elements = new ArrayList();
}
else if (interfaceType.equals(SortedSet.class)) {
elements = new TreeSet();
}
else {
elements = new HashSet();
}
return elements;
} } | public class class_name {
@SuppressWarnings("rawtypes")
public static Collection createConcreteCollection(Class interfaceType) {
Collection elements;
if (interfaceType.equals(List.class) || interfaceType.equals(Collection.class)) {
elements = new ArrayList(); // depends on control dependency: [if], data = [none]
}
else if (interfaceType.equals(SortedSet.class)) {
elements = new TreeSet(); // depends on control dependency: [if], data = [none]
}
else {
elements = new HashSet(); // depends on control dependency: [if], data = [none]
}
return elements;
} } |
public class class_name {
public static Object[] transformArgs(Val<Expression>[] args) {
Object[] objects = new Object[args.length];
for (int i = 0; i < args.length; i++) {
objects[i] = args[i].object();
}
return objects;
} } | public class class_name {
public static Object[] transformArgs(Val<Expression>[] args) {
Object[] objects = new Object[args.length];
for (int i = 0; i < args.length; i++) {
objects[i] = args[i].object(); // depends on control dependency: [for], data = [i]
}
return objects;
} } |
public class class_name {
private static void parseOptions(String args[])
{
if (!(args.length == 14 || args.length == 12 || args.length == 5)) {
usage();
}
/*
* As described in usage():
* -s dfs-server
* -p dfs-port [-t [create|create-write|stat|readdir|read|rename|delete]
* -a planfile-path
* -c host
* -n process-name
* -P prefix
*/
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-s") && i+1 < args.length) {
dfsServer_ = args[i+1];
System.out.println(args[i+1]);
i++;
} else if (args[i].equals("-p") && i+1 < args.length) {
dfsPort_ = Integer.parseInt(args[i+1]);
System.out.println(args[i+1]);
i++;
} else if (args[i].equals("-t") && i+1 < args.length) {
testName_ = args[i+1];
System.out.println(args[i+1]);
i++;
} else if (args[i].equals("-a") && i+1 < args.length) {
planfilePath_ = args[i+1];
System.out.println(args[i+1]);
i++;
} else if (args[i].equals("-c") && i+1 < args.length) {
hostName_ = args[i+1];
System.out.println(args[i+1]);
i++;
} else if (args[i].equals("-n") && i+1 < args.length) {
processName_ = args[i+1];
System.out.println(args[i+1]);
i++;
} else if (args[i].equals("-P") && i+1 < args.length) {
prefix_ = args[i+1];
System.out.println(args[i+1]);
i++;
}
}
if (dfsServer_.length() == 0 ||
testName_.length() == 0 ||
planfilePath_.length() == 0 ||
hostName_.length() == 0 ||
processName_.length() == 0 ||
dfsPort_ == 0) {
usage();
}
if (prefix_ == null) {
prefix_ = new String("PATH_PREFIX_");
}
prefixLen_ = prefix_.length();
} } | public class class_name {
private static void parseOptions(String args[])
{
if (!(args.length == 14 || args.length == 12 || args.length == 5)) {
usage(); // depends on control dependency: [if], data = [none]
}
/*
* As described in usage():
* -s dfs-server
* -p dfs-port [-t [create|create-write|stat|readdir|read|rename|delete]
* -a planfile-path
* -c host
* -n process-name
* -P prefix
*/
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-s") && i+1 < args.length) {
dfsServer_ = args[i+1]; // depends on control dependency: [if], data = [none]
System.out.println(args[i+1]); // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-p") && i+1 < args.length) {
dfsPort_ = Integer.parseInt(args[i+1]); // depends on control dependency: [if], data = [none]
System.out.println(args[i+1]); // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-t") && i+1 < args.length) {
testName_ = args[i+1]; // depends on control dependency: [if], data = [none]
System.out.println(args[i+1]); // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-a") && i+1 < args.length) {
planfilePath_ = args[i+1]; // depends on control dependency: [if], data = [none]
System.out.println(args[i+1]); // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-c") && i+1 < args.length) {
hostName_ = args[i+1]; // depends on control dependency: [if], data = [none]
System.out.println(args[i+1]); // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-n") && i+1 < args.length) {
processName_ = args[i+1]; // depends on control dependency: [if], data = [none]
System.out.println(args[i+1]); // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-P") && i+1 < args.length) {
prefix_ = args[i+1]; // depends on control dependency: [if], data = [none]
System.out.println(args[i+1]); // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
}
}
if (dfsServer_.length() == 0 ||
testName_.length() == 0 ||
planfilePath_.length() == 0 ||
hostName_.length() == 0 ||
processName_.length() == 0 ||
dfsPort_ == 0) {
usage(); // depends on control dependency: [if], data = [none]
}
if (prefix_ == null) {
prefix_ = new String("PATH_PREFIX_"); // depends on control dependency: [if], data = [none]
}
prefixLen_ = prefix_.length();
} } |
public class class_name {
private void writeFields(String objectName, FieldContainer container, FieldType[] fields) throws IOException
{
m_writer.writeStartObject(objectName);
for (FieldType field : fields)
{
Object value = container.getCurrentValue(field);
if (value != null)
{
writeField(field, value);
}
}
m_writer.writeEndObject();
} } | public class class_name {
private void writeFields(String objectName, FieldContainer container, FieldType[] fields) throws IOException
{
m_writer.writeStartObject(objectName);
for (FieldType field : fields)
{
Object value = container.getCurrentValue(field);
if (value != null)
{
writeField(field, value); // depends on control dependency: [if], data = [none]
}
}
m_writer.writeEndObject();
} } |
public class class_name {
@Override
public String getCloneID() {
if (allowedProps != null) {
return (String) allowedProps.get(CFG_CLONE_ID);
}
return null;
} } | public class class_name {
@Override
public String getCloneID() {
if (allowedProps != null) {
return (String) allowedProps.get(CFG_CLONE_ID); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
boolean lock(final Integer permit, final long timeout, final TimeUnit unit) {
boolean result = false;
try {
result = lockInterruptibly(permit, timeout, unit);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return result;
} } | public class class_name {
boolean lock(final Integer permit, final long timeout, final TimeUnit unit) {
boolean result = false;
try {
result = lockInterruptibly(permit, timeout, unit); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} // depends on control dependency: [catch], data = [none]
return result;
} } |
public class class_name {
void onPatternChange() {
PatternType patternType = m_model.getPatternType();
boolean isSeries = !patternType.equals(PatternType.NONE);
setSerialOptionsVisible(isSeries);
m_seriesCheckBox.setChecked(isSeries);
if (isSeries) {
m_groupPattern.selectButton(m_patternButtons.get(patternType));
m_controller.getPatternView().onValueChange();
m_patternOptions.setWidget(m_controller.getPatternView());
onEndTypeChange();
}
m_controller.sizeChanged();
} } | public class class_name {
void onPatternChange() {
PatternType patternType = m_model.getPatternType();
boolean isSeries = !patternType.equals(PatternType.NONE);
setSerialOptionsVisible(isSeries);
m_seriesCheckBox.setChecked(isSeries);
if (isSeries) {
m_groupPattern.selectButton(m_patternButtons.get(patternType)); // depends on control dependency: [if], data = [none]
m_controller.getPatternView().onValueChange(); // depends on control dependency: [if], data = [none]
m_patternOptions.setWidget(m_controller.getPatternView()); // depends on control dependency: [if], data = [none]
onEndTypeChange(); // depends on control dependency: [if], data = [none]
}
m_controller.sizeChanged();
} } |
public class class_name {
private void initStandardCommands() {
finishCommand = new ActionCommand(getFinishCommandId()) {
public void doExecuteCommand() {
boolean result = onFinish();
if (result) {
if (getDisplayFinishSuccessMessage()) {
showFinishSuccessMessageDialog();
}
executeCloseAction();
}
}
};
finishCommand.setSecurityControllerId(getFinishSecurityControllerId());
finishCommand.setEnabled(defaultEnabled);
cancelCommand = new ActionCommand(getCancelCommandId()) {
public void doExecuteCommand() {
onCancel();
}
};
} } | public class class_name {
private void initStandardCommands() {
finishCommand = new ActionCommand(getFinishCommandId()) {
public void doExecuteCommand() {
boolean result = onFinish();
if (result) {
if (getDisplayFinishSuccessMessage()) {
showFinishSuccessMessageDialog(); // depends on control dependency: [if], data = [none]
}
executeCloseAction(); // depends on control dependency: [if], data = [none]
}
}
};
finishCommand.setSecurityControllerId(getFinishSecurityControllerId());
finishCommand.setEnabled(defaultEnabled);
cancelCommand = new ActionCommand(getCancelCommandId()) {
public void doExecuteCommand() {
onCancel();
}
};
} } |
public class class_name {
static void rcvCloseProducerSess(CommsByteBuffer request, Conversation conversation,
int requestNumber, boolean allocatedFromBufferPool,
boolean partOfExchange)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "rcvCloseProducerSess",
new Object[]
{
request,
conversation,
"" + requestNumber,
"" + allocatedFromBufferPool,
"" + partOfExchange
});
ConversationState convState = (ConversationState) conversation.getAttachment();
short connectionObjectID = request.getShort(); // BIT16 ConnectionObjectId
short producerObjectID = request.getShort(); // BIT16 SyncProducerSessionId
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "connectionObjectID", connectionObjectID);
SibTr.debug(tc, "producerObjectID", producerObjectID);
}
ProducerSession producerSession = ((ProducerSession) convState.getObject(producerObjectID));
try
{
producerSession.close();
convState.removeObject(producerObjectID);
try
{
conversation.send(poolManager.allocate(),
JFapChannelConstants.SEG_CLOSE_PRODUCER_SESS_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null);
} catch (SIException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvCloseProducerSess",
CommsConstants.STATICCATPRODUCER_CLOSE_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2024", e);
}
} catch (SIException e)
{
//No FFDC code needed - processor will have already FFDC'ed any interesting ones....
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATPRODUCER_CLOSE_02, // d186970
conversation, requestNumber); // f172297
}
request.release(allocatedFromBufferPool);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "rcvCloseProducerSess");
} } | public class class_name {
static void rcvCloseProducerSess(CommsByteBuffer request, Conversation conversation,
int requestNumber, boolean allocatedFromBufferPool,
boolean partOfExchange)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "rcvCloseProducerSess",
new Object[]
{
request,
conversation,
"" + requestNumber,
"" + allocatedFromBufferPool,
"" + partOfExchange
});
ConversationState convState = (ConversationState) conversation.getAttachment();
short connectionObjectID = request.getShort(); // BIT16 ConnectionObjectId
short producerObjectID = request.getShort(); // BIT16 SyncProducerSessionId
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "connectionObjectID", connectionObjectID); // depends on control dependency: [if], data = [none]
SibTr.debug(tc, "producerObjectID", producerObjectID); // depends on control dependency: [if], data = [none]
}
ProducerSession producerSession = ((ProducerSession) convState.getObject(producerObjectID));
try
{
producerSession.close(); // depends on control dependency: [try], data = [none]
convState.removeObject(producerObjectID); // depends on control dependency: [try], data = [none]
try
{
conversation.send(poolManager.allocate(),
JFapChannelConstants.SEG_CLOSE_PRODUCER_SESS_R,
requestNumber,
JFapChannelConstants.PRIORITY_MEDIUM,
true,
ThrottlingPolicy.BLOCK_THREAD,
null); // depends on control dependency: [try], data = [none]
} catch (SIException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvCloseProducerSess",
CommsConstants.STATICCATPRODUCER_CLOSE_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
SibTr.error(tc, "COMMUNICATION_ERROR_SICO2024", e);
} // depends on control dependency: [catch], data = [none]
} catch (SIException e)
{
//No FFDC code needed - processor will have already FFDC'ed any interesting ones....
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATPRODUCER_CLOSE_02, // d186970
conversation, requestNumber); // f172297
} // depends on control dependency: [catch], data = [none]
request.release(allocatedFromBufferPool);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "rcvCloseProducerSess");
} } |
public class class_name {
public static OExecutionPlan get(String statement, OCommandContext ctx, ODatabaseDocumentInternal db) {
if (db == null) {
throw new IllegalArgumentException("DB cannot be null");
}
if (statement == null) {
return null;
}
OExecutionPlanCache resource = db.getSharedContext().getExecutionPlanCache();
OExecutionPlan result = resource.getInternal(statement, ctx, db);
return result;
} } | public class class_name {
public static OExecutionPlan get(String statement, OCommandContext ctx, ODatabaseDocumentInternal db) {
if (db == null) {
throw new IllegalArgumentException("DB cannot be null");
}
if (statement == null) {
return null; // depends on control dependency: [if], data = [none]
}
OExecutionPlanCache resource = db.getSharedContext().getExecutionPlanCache();
OExecutionPlan result = resource.getInternal(statement, ctx, db);
return result;
} } |
public class class_name {
public static BufferedImage watersheds(GrayS32 segments , BufferedImage output , int radius ) {
if( output == null )
output = new BufferedImage(segments.width,segments.height,BufferedImage.TYPE_INT_RGB);
if( radius <= 0 ) {
for (int y = 0; y < segments.height; y++) {
for (int x = 0; x < segments.width; x++) {
int index = segments.unsafe_get(x, y);
if (index == 0)
output.setRGB(x, y, 0xFF0000);
}
}
} else {
for (int y = 0; y < segments.height; y++) {
for (int x = 0; x < segments.width; x++) {
int index = segments.unsafe_get(x, y);
if (index == 0) {
for (int i = -radius; i <= radius; i++) {
int yy = y + i;
for (int j = -radius; j <= radius; j++) {
int xx = x + j;
if (segments.isInBounds(xx, yy)) {
output.setRGB(xx, yy, 0xFF0000);
}
}
}
}
}
}
}
return output;
} } | public class class_name {
public static BufferedImage watersheds(GrayS32 segments , BufferedImage output , int radius ) {
if( output == null )
output = new BufferedImage(segments.width,segments.height,BufferedImage.TYPE_INT_RGB);
if( radius <= 0 ) {
for (int y = 0; y < segments.height; y++) {
for (int x = 0; x < segments.width; x++) {
int index = segments.unsafe_get(x, y);
if (index == 0)
output.setRGB(x, y, 0xFF0000);
}
}
} else {
for (int y = 0; y < segments.height; y++) {
for (int x = 0; x < segments.width; x++) {
int index = segments.unsafe_get(x, y);
if (index == 0) {
for (int i = -radius; i <= radius; i++) {
int yy = y + i;
for (int j = -radius; j <= radius; j++) {
int xx = x + j;
if (segments.isInBounds(xx, yy)) {
output.setRGB(xx, yy, 0xFF0000); // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
}
return output;
} } |
public class class_name {
protected <T> T initialize(final T object, final Map<?, ?> parameters) {
if (object instanceof ParameterizedInitable) {
((ParameterizedInitable) object).init(parameters);
return object;
}
else {
return initialize(object, parameters.values());
}
} } | public class class_name {
protected <T> T initialize(final T object, final Map<?, ?> parameters) {
if (object instanceof ParameterizedInitable) {
((ParameterizedInitable) object).init(parameters); // depends on control dependency: [if], data = [none]
return object; // depends on control dependency: [if], data = [none]
}
else {
return initialize(object, parameters.values()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ConsumerDispatcher getConsumerDispatcher()
{
if (tc.isEntryEnabled())
{
SibTr.entry(tc, "getConsumerDispatcher");
SibTr.exit(tc, "getConsumerDispatcher", consumerDispatcher);
}
return consumerDispatcher;
} } | public class class_name {
public ConsumerDispatcher getConsumerDispatcher()
{
if (tc.isEntryEnabled())
{
SibTr.entry(tc, "getConsumerDispatcher"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "getConsumerDispatcher", consumerDispatcher); // depends on control dependency: [if], data = [none]
}
return consumerDispatcher;
} } |
public class class_name {
static TypedConstant getConstant(Object value) {
if (value == null) {
return CstKnownNull.THE_ONE;
} else if (value instanceof Boolean) {
return CstBoolean.make((Boolean) value);
} else if (value instanceof Byte) {
return CstByte.make((Byte) value);
} else if (value instanceof Character) {
return CstChar.make((Character) value);
} else if (value instanceof Double) {
return CstDouble.make(Double.doubleToLongBits((Double) value));
} else if (value instanceof Float) {
return CstFloat.make(Float.floatToIntBits((Float) value));
} else if (value instanceof Integer) {
return CstInteger.make((Integer) value);
} else if (value instanceof Long) {
return CstLong.make((Long) value);
} else if (value instanceof Short) {
return CstShort.make((Short) value);
} else if (value instanceof String) {
return new CstString((String) value);
} else if (value instanceof Class) {
return new CstType(TypeId.get((Class<?>) value).ropType);
} else if (value instanceof TypeId) {
return new CstType(((TypeId) value).ropType);
} else {
throw new UnsupportedOperationException("Not a constant: " + value);
}
} } | public class class_name {
static TypedConstant getConstant(Object value) {
if (value == null) {
return CstKnownNull.THE_ONE; // depends on control dependency: [if], data = [none]
} else if (value instanceof Boolean) {
return CstBoolean.make((Boolean) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Byte) {
return CstByte.make((Byte) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Character) {
return CstChar.make((Character) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Double) {
return CstDouble.make(Double.doubleToLongBits((Double) value)); // depends on control dependency: [if], data = [none]
} else if (value instanceof Float) {
return CstFloat.make(Float.floatToIntBits((Float) value)); // depends on control dependency: [if], data = [none]
} else if (value instanceof Integer) {
return CstInteger.make((Integer) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Long) {
return CstLong.make((Long) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Short) {
return CstShort.make((Short) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof String) {
return new CstString((String) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Class) {
return new CstType(TypeId.get((Class<?>) value).ropType); // depends on control dependency: [if], data = [none]
} else if (value instanceof TypeId) {
return new CstType(((TypeId) value).ropType); // depends on control dependency: [if], data = [none]
} else {
throw new UnsupportedOperationException("Not a constant: " + value);
}
} } |
public class class_name {
private static boolean applySingletonSubstitution(Function functionalTerm, SingletonSubstitution substitution) {
List<Term> innerTerms = functionalTerm.getTerms();
boolean innerchanges = false;
// TODO this ways of changing inner terms in functions is not
// optimal, modify
for (int i = 0; i < innerTerms.size(); i++) {
Term innerTerm = innerTerms.get(i);
if (innerTerm instanceof Function) {
// Recursive call
innerchanges = innerchanges || applySingletonSubstitution((Function)innerTerm, substitution);
}
else if (substitution.getVariable().equals(innerTerm)) { // ROMAN: no need in isEqual(innerTerm, s.getVariable())
functionalTerm.getTerms().set(i, substitution.getTerm());
innerchanges = true;
}
}
return innerchanges;
} } | public class class_name {
private static boolean applySingletonSubstitution(Function functionalTerm, SingletonSubstitution substitution) {
List<Term> innerTerms = functionalTerm.getTerms();
boolean innerchanges = false;
// TODO this ways of changing inner terms in functions is not
// optimal, modify
for (int i = 0; i < innerTerms.size(); i++) {
Term innerTerm = innerTerms.get(i);
if (innerTerm instanceof Function) {
// Recursive call
innerchanges = innerchanges || applySingletonSubstitution((Function)innerTerm, substitution); // depends on control dependency: [if], data = [none]
}
else if (substitution.getVariable().equals(innerTerm)) { // ROMAN: no need in isEqual(innerTerm, s.getVariable())
functionalTerm.getTerms().set(i, substitution.getTerm()); // depends on control dependency: [if], data = [none]
innerchanges = true; // depends on control dependency: [if], data = [none]
}
}
return innerchanges;
} } |
public class class_name {
private boolean waitTheMinimalDurationToExecuteTheNextProvisioningRequest() {
if (m_lastGetShardIteratorRequestTime != null) {
long delay = m_durationBetweenRequests.get() - (System.currentTimeMillis() - m_lastGetShardIteratorRequestTime);
if (delay > 0) {
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
}
}
m_lastGetShardIteratorRequestTime = System.currentTimeMillis();
return true;
} } | public class class_name {
private boolean waitTheMinimalDurationToExecuteTheNextProvisioningRequest() {
if (m_lastGetShardIteratorRequestTime != null) {
long delay = m_durationBetweenRequests.get() - (System.currentTimeMillis() - m_lastGetShardIteratorRequestTime);
if (delay > 0) {
try {
Thread.sleep(delay); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return false;
} // depends on control dependency: [catch], data = [none]
}
}
m_lastGetShardIteratorRequestTime = System.currentTimeMillis();
return true;
} } |
public class class_name {
public void setSeverityNormalized(java.util.Collection<NumberFilter> severityNormalized) {
if (severityNormalized == null) {
this.severityNormalized = null;
return;
}
this.severityNormalized = new java.util.ArrayList<NumberFilter>(severityNormalized);
} } | public class class_name {
public void setSeverityNormalized(java.util.Collection<NumberFilter> severityNormalized) {
if (severityNormalized == null) {
this.severityNormalized = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.severityNormalized = new java.util.ArrayList<NumberFilter>(severityNormalized);
} } |
public class class_name {
public boolean saveEncryptionKeyData(KeyData data) {
JSONObject objectToSave = new JSONObject();
try {
objectToSave.put(KEY_DPK, DPKEncryptionUtil.byteArrayToHexString(data
.getEncryptedDPK()));
objectToSave.put(KEY_IV, DPKEncryptionUtil.byteArrayToHexString(data.getIv()));
objectToSave.put(KEY_SALT, DPKEncryptionUtil.byteArrayToHexString(data.getSalt()));
objectToSave.put(KEY_ITERATIONS, data.iterations);
objectToSave.put(KEY_VERSION, data.version);
String valueToSave = objectToSave.toString();
SharedPreferences.Editor editor = this.prefs.edit();
editor.putString(preferenceKey, valueToSave);
editor.commit();
} catch (JSONException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
return false;
}
return true;
} } | public class class_name {
public boolean saveEncryptionKeyData(KeyData data) {
JSONObject objectToSave = new JSONObject();
try {
objectToSave.put(KEY_DPK, DPKEncryptionUtil.byteArrayToHexString(data
.getEncryptedDPK())); // depends on control dependency: [try], data = [none]
objectToSave.put(KEY_IV, DPKEncryptionUtil.byteArrayToHexString(data.getIv())); // depends on control dependency: [try], data = [none]
objectToSave.put(KEY_SALT, DPKEncryptionUtil.byteArrayToHexString(data.getSalt())); // depends on control dependency: [try], data = [none]
objectToSave.put(KEY_ITERATIONS, data.iterations); // depends on control dependency: [try], data = [none]
objectToSave.put(KEY_VERSION, data.version); // depends on control dependency: [try], data = [none]
String valueToSave = objectToSave.toString();
SharedPreferences.Editor editor = this.prefs.edit();
editor.putString(preferenceKey, valueToSave); // depends on control dependency: [try], data = [none]
editor.commit(); // depends on control dependency: [try], data = [none]
} catch (JSONException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
return false;
} // depends on control dependency: [catch], data = [none]
return true;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static final <C> FieldModel<C> get(Field f, FieldAccess<C> fieldAccess) {
String fieldModelKey = (fieldAccess.getClass().getSimpleName() + ":" + f.getClass().getName() + "#" + f.getName());
FieldModel<C> fieldModel = (FieldModel<C>)fieldModels.get(fieldModelKey);
if (fieldModel != null) {
return fieldModel;
}
synchronized(MONITOR) {
fieldModel = (FieldModel<C>)fieldModels.get(fieldModelKey);
if (fieldModel != null) {
return fieldModel;
} else {
fieldModel = new FieldModel<C>(f, fieldAccess);
fieldModels.putIfAbsent(fieldModelKey, fieldModel);
return fieldModel;
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public static final <C> FieldModel<C> get(Field f, FieldAccess<C> fieldAccess) {
String fieldModelKey = (fieldAccess.getClass().getSimpleName() + ":" + f.getClass().getName() + "#" + f.getName());
FieldModel<C> fieldModel = (FieldModel<C>)fieldModels.get(fieldModelKey);
if (fieldModel != null) {
return fieldModel; // depends on control dependency: [if], data = [none]
}
synchronized(MONITOR) {
fieldModel = (FieldModel<C>)fieldModels.get(fieldModelKey);
if (fieldModel != null) {
return fieldModel; // depends on control dependency: [if], data = [none]
} else {
fieldModel = new FieldModel<C>(f, fieldAccess); // depends on control dependency: [if], data = [none]
fieldModels.putIfAbsent(fieldModelKey, fieldModel); // depends on control dependency: [if], data = [(fieldModel]
return fieldModel; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public DescribePipelinesResult withPipelineDescriptionList(PipelineDescription... pipelineDescriptionList) {
if (this.pipelineDescriptionList == null) {
setPipelineDescriptionList(new com.amazonaws.internal.SdkInternalList<PipelineDescription>(pipelineDescriptionList.length));
}
for (PipelineDescription ele : pipelineDescriptionList) {
this.pipelineDescriptionList.add(ele);
}
return this;
} } | public class class_name {
public DescribePipelinesResult withPipelineDescriptionList(PipelineDescription... pipelineDescriptionList) {
if (this.pipelineDescriptionList == null) {
setPipelineDescriptionList(new com.amazonaws.internal.SdkInternalList<PipelineDescription>(pipelineDescriptionList.length)); // depends on control dependency: [if], data = [none]
}
for (PipelineDescription ele : pipelineDescriptionList) {
this.pipelineDescriptionList.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected boolean checkCitationIds(List<String> citationIds, ItemDataProvider provider) {
for (String id : citationIds) {
if (provider.retrieveItem(id) == null) {
String message = "unknown citation id: " + id;
//find alternatives
List<String> availableIds = Arrays.asList(provider.getIds());
if (!availableIds.isEmpty()) {
Collection<String> mins = Levenshtein.findSimilar(availableIds, id);
if (mins.size() > 0) {
if (mins.size() == 1) {
message += "\n\nDid you mean this?";
} else {
message += "\n\nDid you mean one of these?";
}
for (String m : mins) {
message += "\n\t" + m;
}
}
}
error(message);
return false;
}
}
return true;
} } | public class class_name {
protected boolean checkCitationIds(List<String> citationIds, ItemDataProvider provider) {
for (String id : citationIds) {
if (provider.retrieveItem(id) == null) {
String message = "unknown citation id: " + id;
//find alternatives
List<String> availableIds = Arrays.asList(provider.getIds());
if (!availableIds.isEmpty()) {
Collection<String> mins = Levenshtein.findSimilar(availableIds, id);
if (mins.size() > 0) {
if (mins.size() == 1) {
message += "\n\nDid you mean this?"; // depends on control dependency: [if], data = [none]
} else {
message += "\n\nDid you mean one of these?"; // depends on control dependency: [if], data = [none]
}
for (String m : mins) {
message += "\n\t" + m; // depends on control dependency: [for], data = [m]
}
}
}
error(message); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static BufferedImage composeMaskedImage (
ImageCreator isrc, Shape mask, BufferedImage base)
{
int wid = base.getWidth();
int hei = base.getHeight();
// alternate method for composition:
// 1. create WriteableRaster with base data
// 2. test each pixel with mask.contains() and set the alpha channel to fully-alpha if false
// 3. create buffered image from raster
// (I didn't use this method because it depends on the colormodel of the source image, and
// was booching when the souce image was a cut-up from a tileset, and it seems like it
// would take longer than the method we are using. But it's something to consider)
// composite them by rendering them with an alpha rule
BufferedImage target = isrc.createImage(wid, hei, Transparency.TRANSLUCENT);
Graphics2D g2 = target.createGraphics();
try {
g2.setColor(Color.BLACK); // whatever, really
g2.fill(mask);
g2.setComposite(AlphaComposite.SrcIn);
g2.drawImage(base, 0, 0, null);
} finally {
g2.dispose();
}
return target;
} } | public class class_name {
public static BufferedImage composeMaskedImage (
ImageCreator isrc, Shape mask, BufferedImage base)
{
int wid = base.getWidth();
int hei = base.getHeight();
// alternate method for composition:
// 1. create WriteableRaster with base data
// 2. test each pixel with mask.contains() and set the alpha channel to fully-alpha if false
// 3. create buffered image from raster
// (I didn't use this method because it depends on the colormodel of the source image, and
// was booching when the souce image was a cut-up from a tileset, and it seems like it
// would take longer than the method we are using. But it's something to consider)
// composite them by rendering them with an alpha rule
BufferedImage target = isrc.createImage(wid, hei, Transparency.TRANSLUCENT);
Graphics2D g2 = target.createGraphics();
try {
g2.setColor(Color.BLACK); // whatever, really // depends on control dependency: [try], data = [none]
g2.fill(mask); // depends on control dependency: [try], data = [none]
g2.setComposite(AlphaComposite.SrcIn); // depends on control dependency: [try], data = [none]
g2.drawImage(base, 0, 0, null); // depends on control dependency: [try], data = [none]
} finally {
g2.dispose();
}
return target;
} } |
public class class_name {
public static void annotateRoot(String... keyValueSequence) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(keyValueSequence);
}
} } | public class class_name {
public static void annotateRoot(String... keyValueSequence) {
TracyThreadContext ctx = threadContext.get();
if (isValidContext(ctx)) {
ctx.annotateRoot(keyValueSequence); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static RSAPublicKey getRSAPublicKeyFromPEM(Provider provider, String pem) {
try {
KeyFactory keyFactory = KeyFactory.getInstance("RSA", provider);
return (RSAPublicKey) keyFactory.generatePublic(new X509EncodedKeySpec(getKeyBytesFromPEM(pem)));
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("Algorithm SHA256withRSA is not available", e);
} catch (InvalidKeySpecException e) {
throw new IllegalArgumentException("Invalid PEM provided", e);
}
} } | public class class_name {
public static RSAPublicKey getRSAPublicKeyFromPEM(Provider provider, String pem) {
try {
KeyFactory keyFactory = KeyFactory.getInstance("RSA", provider);
return (RSAPublicKey) keyFactory.generatePublic(new X509EncodedKeySpec(getKeyBytesFromPEM(pem))); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("Algorithm SHA256withRSA is not available", e);
} catch (InvalidKeySpecException e) { // depends on control dependency: [catch], data = [none]
throw new IllegalArgumentException("Invalid PEM provided", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void doBrowse(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
if (!common.checkGet(request, response)) return;
User user = common.getLoggedInUser(request);
if (user == null) {
common.pageSoftError(response, "Can't do /browse. Nobody is logged in.");
return;
}
DbxClientV2 dbxClient = requireDbxClient(request, response, user);
if (dbxClient == null) return;
String path = request.getParameter("path");
if (path == null || path.length() == 0) {
renderFolder(response, user, dbxClient, "");
} else {
String pathError = DbxPathV2.findError(path);
if (pathError != null) {
response.sendError(400, "Invalid path: " + jq(path) + ": " + pathError);
return;
}
Metadata metadata;
try {
metadata = dbxClient.files()
.getMetadata(path);
}
catch (GetMetadataErrorException ex) {
if (ex.errorValue.isPath()) {
LookupError le = ex.errorValue.getPathValue();
if (le.isNotFound()) {
response.sendError(400, "Path doesn't exist on Dropbox: " + jq(path));
return;
}
}
common.handleException(response, ex, "getMetadata(" + jq(path) + ")");
return;
}
catch (DbxException ex) {
common.handleDbxException(response, user, ex, "getMetadata(" + jq(path) + ")");
return;
}
path = DbxPathV2.getParent(path) + "/" + metadata.getName();
if (metadata instanceof FolderMetadata) {
renderFolder(response, user, dbxClient, path);
}
else {
renderFile(response, path, (FileMetadata) metadata);
}
}
} } | public class class_name {
public void doBrowse(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
if (!common.checkGet(request, response)) return;
User user = common.getLoggedInUser(request);
if (user == null) {
common.pageSoftError(response, "Can't do /browse. Nobody is logged in.");
return;
}
DbxClientV2 dbxClient = requireDbxClient(request, response, user);
if (dbxClient == null) return;
String path = request.getParameter("path");
if (path == null || path.length() == 0) {
renderFolder(response, user, dbxClient, "");
} else {
String pathError = DbxPathV2.findError(path);
if (pathError != null) {
response.sendError(400, "Invalid path: " + jq(path) + ": " + pathError); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
Metadata metadata;
try {
metadata = dbxClient.files()
.getMetadata(path);
}
catch (GetMetadataErrorException ex) {
if (ex.errorValue.isPath()) {
LookupError le = ex.errorValue.getPathValue();
if (le.isNotFound()) {
response.sendError(400, "Path doesn't exist on Dropbox: " + jq(path)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
common.handleException(response, ex, "getMetadata(" + jq(path) + ")");
return;
}
catch (DbxException ex) {
common.handleDbxException(response, user, ex, "getMetadata(" + jq(path) + ")");
return;
}
path = DbxPathV2.getParent(path) + "/" + metadata.getName();
if (metadata instanceof FolderMetadata) {
renderFolder(response, user, dbxClient, path);
}
else {
renderFile(response, path, (FileMetadata) metadata);
}
}
} } |
public class class_name {
public void marshall(StartImportRequest startImportRequest, ProtocolMarshaller protocolMarshaller) {
if (startImportRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startImportRequest.getPayload(), PAYLOAD_BINDING);
protocolMarshaller.marshall(startImportRequest.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(startImportRequest.getMergeStrategy(), MERGESTRATEGY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(StartImportRequest startImportRequest, ProtocolMarshaller protocolMarshaller) {
if (startImportRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startImportRequest.getPayload(), PAYLOAD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startImportRequest.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startImportRequest.getMergeStrategy(), MERGESTRATEGY_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Set<Integer> getSuccessors(Graph g, Integer vertex) {
if (g instanceof DirectedGraph) {
DirectedGraph<?> dg = (DirectedGraph)g;
return dg.successors(vertex);
}
else
return Collections.<Integer>emptySet();
} } | public class class_name {
private Set<Integer> getSuccessors(Graph g, Integer vertex) {
if (g instanceof DirectedGraph) {
DirectedGraph<?> dg = (DirectedGraph)g;
return dg.successors(vertex); // depends on control dependency: [if], data = [none]
}
else
return Collections.<Integer>emptySet();
} } |
public class class_name {
private static void arcConstructor(CDKRGraph graph, IAtomContainer ac1, IAtomContainer ac2) throws CDKException {
// each node is incompatible with itself
for (int i = 0; i < graph.getGraph().size(); i++) {
CDKRNode rNodeX = graph.getGraph().get(i);
rNodeX.getForbidden().set(i);
}
IBond bondA1;
IBond bondA2;
IBond bondB1;
IBond bondB2;
graph.setFirstGraphSize(ac1.getBondCount());
graph.setSecondGraphSize(ac2.getBondCount());
for (int i = 0; i < graph.getGraph().size(); i++) {
CDKRNode rNodeX = graph.getGraph().get(i);
// two nodes are neighbours if their adjacency
// relationship in are equivalent in G1 and G2
// else they are incompatible.
for (int j = i + 1; j < graph.getGraph().size(); j++) {
CDKRNode rNodeY = graph.getGraph().get(j);
bondA1 = ac1.getBond(graph.getGraph().get(i).getRMap().getId1());
bondA2 = ac2.getBond(graph.getGraph().get(i).getRMap().getId2());
bondB1 = ac1.getBond(graph.getGraph().get(j).getRMap().getId1());
bondB2 = ac2.getBond(graph.getGraph().get(j).getRMap().getId2());
if (bondA2 instanceof IQueryBond) {
if (bondA1.equals(bondB1) || bondA2.equals(bondB2)
|| !queryAdjacencyAndOrder(bondA1, bondB1, bondA2, bondB2)) {
rNodeX.getForbidden().set(j);
rNodeY.getForbidden().set(i);
} else if (hasCommonAtom(bondA1, bondB1)) {
rNodeX.getExtension().set(j);
rNodeY.getExtension().set(i);
}
} else {
if (bondA1.equals(bondB1) || bondA2.equals(bondB2)
|| (!getCommonSymbol(bondA1, bondB1).equals(getCommonSymbol(bondA2, bondB2)))) {
rNodeX.getForbidden().set(j);
rNodeY.getForbidden().set(i);
} else if (hasCommonAtom(bondA1, bondB1)) {
rNodeX.getExtension().set(j);
rNodeY.getExtension().set(i);
}
}
}
}
} } | public class class_name {
private static void arcConstructor(CDKRGraph graph, IAtomContainer ac1, IAtomContainer ac2) throws CDKException {
// each node is incompatible with itself
for (int i = 0; i < graph.getGraph().size(); i++) {
CDKRNode rNodeX = graph.getGraph().get(i);
rNodeX.getForbidden().set(i);
}
IBond bondA1;
IBond bondA2;
IBond bondB1;
IBond bondB2;
graph.setFirstGraphSize(ac1.getBondCount());
graph.setSecondGraphSize(ac2.getBondCount());
for (int i = 0; i < graph.getGraph().size(); i++) {
CDKRNode rNodeX = graph.getGraph().get(i);
// two nodes are neighbours if their adjacency
// relationship in are equivalent in G1 and G2
// else they are incompatible.
for (int j = i + 1; j < graph.getGraph().size(); j++) {
CDKRNode rNodeY = graph.getGraph().get(j);
bondA1 = ac1.getBond(graph.getGraph().get(i).getRMap().getId1());
bondA2 = ac2.getBond(graph.getGraph().get(i).getRMap().getId2());
bondB1 = ac1.getBond(graph.getGraph().get(j).getRMap().getId1());
bondB2 = ac2.getBond(graph.getGraph().get(j).getRMap().getId2());
if (bondA2 instanceof IQueryBond) {
if (bondA1.equals(bondB1) || bondA2.equals(bondB2)
|| !queryAdjacencyAndOrder(bondA1, bondB1, bondA2, bondB2)) {
rNodeX.getForbidden().set(j); // depends on control dependency: [if], data = [none]
rNodeY.getForbidden().set(i); // depends on control dependency: [if], data = [none]
} else if (hasCommonAtom(bondA1, bondB1)) {
rNodeX.getExtension().set(j); // depends on control dependency: [if], data = [none]
rNodeY.getExtension().set(i); // depends on control dependency: [if], data = [none]
}
} else {
if (bondA1.equals(bondB1) || bondA2.equals(bondB2)
|| (!getCommonSymbol(bondA1, bondB1).equals(getCommonSymbol(bondA2, bondB2)))) {
rNodeX.getForbidden().set(j); // depends on control dependency: [if], data = [none]
rNodeY.getForbidden().set(i); // depends on control dependency: [if], data = [none]
} else if (hasCommonAtom(bondA1, bondB1)) {
rNodeX.getExtension().set(j); // depends on control dependency: [if], data = [none]
rNodeY.getExtension().set(i); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
protected void fireAfterPersist() {
PersistableListener l = _listener;
if(l != null) {
try {
l.afterPersist();
} catch(Exception e) {
_log.error("failure on calling afterPersist", e);
}
}
} } | public class class_name {
protected void fireAfterPersist() {
PersistableListener l = _listener;
if(l != null) {
try {
l.afterPersist(); // depends on control dependency: [try], data = [none]
} catch(Exception e) {
_log.error("failure on calling afterPersist", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public <T> void forAllDo
(final Collection<? extends T> collection,
final Closure<T> closure)
{
for (final T current : collection)
{
closure.execute(current);
}
} } | public class class_name {
public <T> void forAllDo
(final Collection<? extends T> collection,
final Closure<T> closure)
{
for (final T current : collection)
{
closure.execute(current); // depends on control dependency: [for], data = [current]
}
} } |
public class class_name {
public com.google.privacy.dlp.v2.UnwrappedCryptoKey getUnwrapped() {
if (sourceCase_ == 2) {
return (com.google.privacy.dlp.v2.UnwrappedCryptoKey) source_;
}
return com.google.privacy.dlp.v2.UnwrappedCryptoKey.getDefaultInstance();
} } | public class class_name {
public com.google.privacy.dlp.v2.UnwrappedCryptoKey getUnwrapped() {
if (sourceCase_ == 2) {
return (com.google.privacy.dlp.v2.UnwrappedCryptoKey) source_; // depends on control dependency: [if], data = [none]
}
return com.google.privacy.dlp.v2.UnwrappedCryptoKey.getDefaultInstance();
} } |
public class class_name {
public int drainTo(Collection<? super E> collection, int maxElements)
{
if (collection == null)
{
throw new IllegalArgumentException("The 'collection' parameter may not be null.");
}
if (collection == this)
{
throw new IllegalArgumentException("The 'collection' parameter may not be this object.");
}
// final Queue<E> items = this.buffer;
ReentrantLock lock = this.lock;
lock.lock();
try
{
int n = 0;
for (int max = ((maxElements >= count) || (maxElements < 0)) ? count : maxElements; n < max; n++)
{
// Take items from the queue, do unblock the producers, but don't send not full signals yet.
collection.add(extract(true, false).getElement());
}
if (n > 0)
{
// count -= n;
notFull.signalAll();
}
return n;
}
finally
{
lock.unlock();
}
} } | public class class_name {
public int drainTo(Collection<? super E> collection, int maxElements)
{
if (collection == null)
{
throw new IllegalArgumentException("The 'collection' parameter may not be null.");
}
if (collection == this)
{
throw new IllegalArgumentException("The 'collection' parameter may not be this object.");
}
// final Queue<E> items = this.buffer;
ReentrantLock lock = this.lock;
lock.lock();
try
{
int n = 0;
for (int max = ((maxElements >= count) || (maxElements < 0)) ? count : maxElements; n < max; n++)
{
// Take items from the queue, do unblock the producers, but don't send not full signals yet.
collection.add(extract(true, false).getElement()); // depends on control dependency: [for], data = [none]
}
if (n > 0)
{
// count -= n;
notFull.signalAll(); // depends on control dependency: [if], data = [none]
}
return n; // depends on control dependency: [try], data = [none]
}
finally
{
lock.unlock();
}
} } |
public class class_name {
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEResourceReferenceProcessorRegistry registry = deploymentUnit.getAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY);
//setup ejb context jndi handlers
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(EJBContext.class));
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(SessionContext.class));
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(EntityContext.class));
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(MessageDrivenContext.class));
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final Collection<ComponentDescription> componentConfigurations = eeModuleDescription.getComponentDescriptions();
if (componentConfigurations == null || componentConfigurations.isEmpty()) {
return;
}
for (ComponentDescription componentConfiguration : componentConfigurations) {
final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
if (index != null) {
processComponentConfig(componentConfiguration);
}
}
} } | public class class_name {
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEResourceReferenceProcessorRegistry registry = deploymentUnit.getAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY);
//setup ejb context jndi handlers
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(EJBContext.class));
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(SessionContext.class));
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(EntityContext.class));
registry.registerResourceReferenceProcessor(new EjbContextResourceReferenceProcessor(MessageDrivenContext.class));
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final Collection<ComponentDescription> componentConfigurations = eeModuleDescription.getComponentDescriptions();
if (componentConfigurations == null || componentConfigurations.isEmpty()) {
return;
}
for (ComponentDescription componentConfiguration : componentConfigurations) {
final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
if (index != null) {
processComponentConfig(componentConfiguration); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@SuppressWarnings("ConstantConditions")
private List<JBBPAbstractField> parseStruct(final JBBPBitInputStream inStream, final JBBPIntCounter positionAtCompiledBlock, final JBBPVarFieldProcessor varFieldProcessor, final JBBPNamedNumericFieldMap namedNumericFieldMap, final JBBPIntCounter positionAtNamedFieldList, final JBBPIntCounter positionAtVarLengthProcessors, final boolean skipStructureFields) throws IOException {
final List<JBBPAbstractField> structureFields = skipStructureFields ? null : new ArrayList<>();
final byte[] compiled = this.compiledBlock.getCompiledData();
boolean endStructureNotMet = true;
while (endStructureNotMet && positionAtCompiledBlock.get() < compiled.length) {
if (!inStream.hasAvailableData() && (flags & FLAG_SKIP_REMAINING_FIELDS_IF_EOF) != 0) {
// Break reading because the ignore flag for EOF has been set
break;
}
final int c = compiled[positionAtCompiledBlock.getAndIncrement()] & 0xFF;
final boolean wideCode = (c & JBBPCompiler.FLAG_WIDE) != 0;
final int ec = wideCode ? compiled[positionAtCompiledBlock.getAndIncrement()] & 0xFF : 0;
final boolean extraFieldNumAsExpr = (ec & JBBPCompiler.EXT_FLAG_EXTRA_AS_EXPRESSION) != 0;
final int code = (ec << 8) | c;
final boolean fieldTypeDiff = (ec & JBBPCompiler.EXT_FLAG_EXTRA_DIFF_TYPE) != 0;
final JBBPNamedFieldInfo name = (code & JBBPCompiler.FLAG_NAMED) == 0 ? null : compiledBlock.getNamedFields()[positionAtNamedFieldList.getAndIncrement()];
final JBBPByteOrder byteOrder = (code & JBBPCompiler.FLAG_LITTLE_ENDIAN) == 0 ? JBBPByteOrder.BIG_ENDIAN : JBBPByteOrder.LITTLE_ENDIAN;
final boolean resultNotIgnored = !skipStructureFields;
final int extraFieldNumExprResult;
if (extraFieldNumAsExpr) {
final JBBPIntegerValueEvaluator evaluator = this.compiledBlock.getArraySizeEvaluators()[positionAtVarLengthProcessors.getAndIncrement()];
int resultOfExpression;
if (resultNotIgnored) {
resultOfExpression = evaluator.eval(inStream, positionAtCompiledBlock.get(), this.compiledBlock, namedNumericFieldMap);
if ((this.flags & FLAG_NEGATIVE_EXPRESSION_RESULT_AS_ZERO) != 0) {
resultOfExpression = Math.max(resultOfExpression, 0);
}
} else {
resultOfExpression = 0;
}
extraFieldNumExprResult = resultOfExpression;
} else {
extraFieldNumExprResult = 0;
}
final boolean wholeStreamArray;
final int arrayLength;
final int packedArraySizeOffset;
switch (code & (JBBPCompiler.FLAG_ARRAY | (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8))) {
case JBBPCompiler.FLAG_ARRAY: {
final int pos = positionAtCompiledBlock.get();
arrayLength = JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
packedArraySizeOffset = positionAtCompiledBlock.get() - pos;
wholeStreamArray = false;
}
break;
case (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8): {
wholeStreamArray = resultNotIgnored;
packedArraySizeOffset = 0;
arrayLength = 0;
}
break;
case JBBPCompiler.FLAG_ARRAY | (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8): {
final JBBPIntegerValueEvaluator evaluator = this.compiledBlock.getArraySizeEvaluators()[positionAtVarLengthProcessors.getAndIncrement()];
int resultOfExpression;
if (resultNotIgnored) {
resultOfExpression = evaluator.eval(inStream, positionAtCompiledBlock.get(), this.compiledBlock, namedNumericFieldMap);
if ((this.flags & FLAG_NEGATIVE_EXPRESSION_RESULT_AS_ZERO) != 0) {
resultOfExpression = Math.max(resultOfExpression, 0);
}
} else {
resultOfExpression = 0;
}
arrayLength = resultOfExpression;
packedArraySizeOffset = 0;
assertArrayLength(arrayLength, name);
wholeStreamArray = false;
}
break;
default: {
// it is not an array, just a single field
packedArraySizeOffset = 0;
wholeStreamArray = false;
arrayLength = -1;
}
break;
}
JBBPAbstractField singleAtomicField = null;
try {
switch (code & 0xF) {
case JBBPCompiler.CODE_RESET_COUNTER: {
if (resultNotIgnored) {
inStream.resetCounter();
}
}
break;
case JBBPCompiler.CODE_ALIGN: {
final int alignValue = extraFieldNumAsExpr ? extraFieldNumExprResult : JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
inStream.align(alignValue);
}
}
break;
case JBBPCompiler.CODE_SKIP: {
final int skipByteNumber = extraFieldNumAsExpr ? extraFieldNumExprResult : JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
if (fieldTypeDiff) {
singleAtomicField = new JBBPFieldInt(name, skipByteNumber);
} else {
if (skipByteNumber > 0) {
final long skippedBytes = inStream.skip(skipByteNumber);
if (skippedBytes != skipByteNumber) {
throw new EOFException("Can't skip " + skipByteNumber + " byte(s), skipped only " + skippedBytes + " byte(s)");
}
}
}
}
}
break;
case JBBPCompiler.CODE_BIT: {
final int numberOfBits = extraFieldNumAsExpr ? extraFieldNumExprResult : JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
final JBBPBitNumber bitNumber = JBBPBitNumber.decode(numberOfBits);
if (arrayLength < 0) {
final int read = inStream.readBitField(bitNumber);
singleAtomicField = new JBBPFieldBit(name, read & 0xFF, bitNumber);
} else {
structureFields.add(new JBBPFieldArrayBit(name, inStream.readBitsArray(wholeStreamArray ? -1 : arrayLength, bitNumber), bitNumber));
}
}
}
break;
case JBBPCompiler.CODE_VAR: {
final int extraField = extraFieldNumAsExpr ? extraFieldNumExprResult : JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = varFieldProcessor.readVarField(inStream, name, extraField, byteOrder, namedNumericFieldMap);
JBBPUtils.assertNotNull(singleAtomicField, "A Var processor must not return null as a result of a field reading");
if (singleAtomicField instanceof JBBPAbstractArrayField) {
throw new JBBPParsingException("A Var field processor has returned an array value instead of a field value [" + name + ':' + extraField + ']');
}
if (singleAtomicField.getNameInfo() != name) {
throw new JBBPParsingException("Detected wrong name for a read field , must be " + name + " but detected " + singleAtomicField.getNameInfo() + ']');
}
} else {
final JBBPAbstractArrayField<? extends JBBPAbstractField> array = varFieldProcessor.readVarArray(inStream, wholeStreamArray ? -1 : arrayLength, name, extraField, byteOrder, namedNumericFieldMap);
JBBPUtils.assertNotNull(array, "A Var processor must not return null as a result of an array field reading [" + name + ':' + extraField + ']');
if (array.getNameInfo() != name) {
throw new JBBPParsingException("Detected wrong name for a read field array, must be " + name + " but detected " + array.getNameInfo() + ']');
}
structureFields.add(array);
}
}
}
break;
case JBBPCompiler.CODE_CUSTOMTYPE: {
final int extraData = extraFieldNumAsExpr ? extraFieldNumExprResult : JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
final JBBPFieldTypeParameterContainer fieldTypeInfo = this.compiledBlock.getCustomTypeFields()[JBBPUtils.unpackInt(compiled, positionAtCompiledBlock)];
final JBBPAbstractField field = this.customFieldTypeProcessor.readCustomFieldType(inStream, this.bitOrder, this.flags, fieldTypeInfo, name, extraData, wholeStreamArray, arrayLength);
JBBPUtils.assertNotNull(field, "Must not return null as read result");
if (arrayLength < 0) {
singleAtomicField = field;
} else {
structureFields.add(field);
}
}
}
break;
case JBBPCompiler.CODE_BYTE: {
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = new JBBPFieldByte(name, (byte) inStream.readByte());
} else {
structureFields.add(new JBBPFieldArrayByte(name, inStream.readByteArray(wholeStreamArray ? -1 : arrayLength, byteOrder)));
}
}
}
break;
case JBBPCompiler.CODE_UBYTE: {
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = new JBBPFieldUByte(name, (byte) inStream.readByte());
} else {
structureFields.add(new JBBPFieldArrayUByte(name, inStream.readByteArray(wholeStreamArray ? -1 : arrayLength, byteOrder)));
}
}
}
break;
case JBBPCompiler.CODE_BOOL: {
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = fieldTypeDiff ? new JBBPFieldString(name, inStream.readString(byteOrder)) : new JBBPFieldBoolean(name, inStream.readBoolean());
} else {
structureFields.add(fieldTypeDiff ?
new JBBPFieldArrayString(name, inStream.readStringArray(wholeStreamArray ? -1 : arrayLength, byteOrder)) :
new JBBPFieldArrayBoolean(name, inStream.readBoolArray(wholeStreamArray ? -1 : arrayLength))
);
}
}
}
break;
case JBBPCompiler.CODE_INT: {
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = fieldTypeDiff ? new JBBPFieldFloat(name, inStream.readFloat(byteOrder)) : new JBBPFieldInt(name, inStream.readInt(byteOrder));
} else {
structureFields.add(fieldTypeDiff ?
new JBBPFieldArrayFloat(name, inStream.readFloatArray(wholeStreamArray ? -1 : arrayLength, byteOrder)) :
new JBBPFieldArrayInt(name, inStream.readIntArray(wholeStreamArray ? -1 : arrayLength, byteOrder))
);
}
}
}
break;
case JBBPCompiler.CODE_LONG: {
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = fieldTypeDiff ? new JBBPFieldDouble(name, inStream.readDouble(byteOrder)) : new JBBPFieldLong(name, inStream.readLong(byteOrder));
} else {
structureFields.add(fieldTypeDiff ?
new JBBPFieldArrayDouble(name, inStream.readDoubleArray(wholeStreamArray ? -1 : arrayLength, byteOrder)) :
new JBBPFieldArrayLong(name, inStream.readLongArray(wholeStreamArray ? -1 : arrayLength, byteOrder))
);
}
}
}
break;
case JBBPCompiler.CODE_SHORT: {
if (resultNotIgnored) {
if (arrayLength < 0) {
final int value = inStream.readUnsignedShort(byteOrder);
singleAtomicField = new JBBPFieldShort(name, (short) value);
} else {
structureFields.add(new JBBPFieldArrayShort(name, inStream.readShortArray(wholeStreamArray ? -1 : arrayLength, byteOrder)));
}
}
}
break;
case JBBPCompiler.CODE_USHORT: {
if (resultNotIgnored) {
if (arrayLength < 0) {
final int value = inStream.readUnsignedShort(byteOrder);
singleAtomicField = new JBBPFieldUShort(name, (short) value);
} else {
structureFields.add(new JBBPFieldArrayUShort(name, inStream.readShortArray(wholeStreamArray ? -1 : arrayLength, byteOrder)));
}
}
}
break;
case JBBPCompiler.CODE_STRUCT_START: {
if (arrayLength < 0) {
final List<JBBPAbstractField> structFields = parseStruct(inStream, positionAtCompiledBlock, varFieldProcessor, namedNumericFieldMap, positionAtNamedFieldList, positionAtVarLengthProcessors, skipStructureFields);
// skip offset
JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
structureFields.add(new JBBPFieldStruct(name, structFields.toArray(ARRAY_FIELD_EMPTY)));
}
} else {
final int nameFieldCurrent = positionAtNamedFieldList.get();
final int varLenProcCurrent = positionAtVarLengthProcessors.get();
final JBBPFieldStruct[] result;
if (resultNotIgnored) {
if (wholeStreamArray) {
// read till the stream end
final List<JBBPFieldStruct> list = new ArrayList<>();
while (inStream.hasAvailableData()) {
positionAtNamedFieldList.set(nameFieldCurrent);
positionAtVarLengthProcessors.set(varLenProcCurrent);
final List<JBBPAbstractField> fieldsForStruct = parseStruct(inStream, positionAtCompiledBlock, varFieldProcessor, namedNumericFieldMap, positionAtNamedFieldList, positionAtVarLengthProcessors, skipStructureFields);
list.add(new JBBPFieldStruct(name, fieldsForStruct));
final int structStart = JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (inStream.hasAvailableData()) {
positionAtCompiledBlock.set(structStart + (wideCode ? 2 : 1));
}
}
result = list.isEmpty() ? EMPTY_STRUCT_ARRAY : list.toArray(EMPTY_STRUCT_ARRAY);
} else {
// read number of items
if (arrayLength == 0) {
// skip the structure
result = EMPTY_STRUCT_ARRAY;
parseStruct(inStream, positionAtCompiledBlock, varFieldProcessor, namedNumericFieldMap, positionAtNamedFieldList, positionAtVarLengthProcessors, true);
JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
} else {
result = new JBBPFieldStruct[arrayLength];
for (int i = 0; i < arrayLength; i++) {
final List<JBBPAbstractField> fieldsForStruct = parseStruct(inStream, positionAtCompiledBlock, varFieldProcessor, namedNumericFieldMap, positionAtNamedFieldList, positionAtVarLengthProcessors, skipStructureFields);
final int structBodyStart = JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
result[i] = new JBBPFieldStruct(name, fieldsForStruct);
if (i < arrayLength - 1) {
// not the last
positionAtNamedFieldList.set(nameFieldCurrent);
positionAtVarLengthProcessors.set(varLenProcCurrent);
positionAtCompiledBlock.set(structBodyStart + packedArraySizeOffset + (wideCode ? 2 : 1));
}
}
}
}
if (result != null) {
structureFields.add(new JBBPFieldArrayStruct(name, result));
}
} else {
parseStruct(inStream, positionAtCompiledBlock, varFieldProcessor, namedNumericFieldMap, positionAtNamedFieldList, positionAtVarLengthProcessors, skipStructureFields);
JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
}
}
}
break;
case JBBPCompiler.CODE_STRUCT_END: {
// we just left the method and the caller must process the structure offset start address for the structure
endStructureNotMet = false;
}
break;
default:
throw new Error("Detected unexpected field type! Contact developer! [" + code + ']');
}
} catch (IOException ex) {
if (name == null) {
throw ex;
} else {
throw new JBBPParsingException("Can't parse field '" + name.getFieldPath() + "' for IOException", ex);
}
}
if (singleAtomicField != null) {
structureFields.add(singleAtomicField);
if (namedNumericFieldMap != null && singleAtomicField instanceof JBBPNumericField && name != null) {
namedNumericFieldMap.putField((JBBPNumericField) singleAtomicField);
}
}
}
return structureFields;
} } | public class class_name {
@SuppressWarnings("ConstantConditions")
private List<JBBPAbstractField> parseStruct(final JBBPBitInputStream inStream, final JBBPIntCounter positionAtCompiledBlock, final JBBPVarFieldProcessor varFieldProcessor, final JBBPNamedNumericFieldMap namedNumericFieldMap, final JBBPIntCounter positionAtNamedFieldList, final JBBPIntCounter positionAtVarLengthProcessors, final boolean skipStructureFields) throws IOException {
final List<JBBPAbstractField> structureFields = skipStructureFields ? null : new ArrayList<>();
final byte[] compiled = this.compiledBlock.getCompiledData();
boolean endStructureNotMet = true;
while (endStructureNotMet && positionAtCompiledBlock.get() < compiled.length) {
if (!inStream.hasAvailableData() && (flags & FLAG_SKIP_REMAINING_FIELDS_IF_EOF) != 0) {
// Break reading because the ignore flag for EOF has been set
break;
}
final int c = compiled[positionAtCompiledBlock.getAndIncrement()] & 0xFF;
final boolean wideCode = (c & JBBPCompiler.FLAG_WIDE) != 0;
final int ec = wideCode ? compiled[positionAtCompiledBlock.getAndIncrement()] & 0xFF : 0;
final boolean extraFieldNumAsExpr = (ec & JBBPCompiler.EXT_FLAG_EXTRA_AS_EXPRESSION) != 0;
final int code = (ec << 8) | c;
final boolean fieldTypeDiff = (ec & JBBPCompiler.EXT_FLAG_EXTRA_DIFF_TYPE) != 0;
final JBBPNamedFieldInfo name = (code & JBBPCompiler.FLAG_NAMED) == 0 ? null : compiledBlock.getNamedFields()[positionAtNamedFieldList.getAndIncrement()];
final JBBPByteOrder byteOrder = (code & JBBPCompiler.FLAG_LITTLE_ENDIAN) == 0 ? JBBPByteOrder.BIG_ENDIAN : JBBPByteOrder.LITTLE_ENDIAN;
final boolean resultNotIgnored = !skipStructureFields;
final int extraFieldNumExprResult;
if (extraFieldNumAsExpr) {
final JBBPIntegerValueEvaluator evaluator = this.compiledBlock.getArraySizeEvaluators()[positionAtVarLengthProcessors.getAndIncrement()];
int resultOfExpression;
if (resultNotIgnored) {
resultOfExpression = evaluator.eval(inStream, positionAtCompiledBlock.get(), this.compiledBlock, namedNumericFieldMap); // depends on control dependency: [if], data = [none]
if ((this.flags & FLAG_NEGATIVE_EXPRESSION_RESULT_AS_ZERO) != 0) {
resultOfExpression = Math.max(resultOfExpression, 0); // depends on control dependency: [if], data = [0)]
}
} else {
resultOfExpression = 0; // depends on control dependency: [if], data = [none]
}
extraFieldNumExprResult = resultOfExpression; // depends on control dependency: [if], data = [none]
} else {
extraFieldNumExprResult = 0; // depends on control dependency: [if], data = [none]
}
final boolean wholeStreamArray;
final int arrayLength;
final int packedArraySizeOffset;
switch (code & (JBBPCompiler.FLAG_ARRAY | (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8))) {
case JBBPCompiler.FLAG_ARRAY: {
final int pos = positionAtCompiledBlock.get();
arrayLength = JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
packedArraySizeOffset = positionAtCompiledBlock.get() - pos;
wholeStreamArray = false;
}
break;
case (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8): {
wholeStreamArray = resultNotIgnored;
packedArraySizeOffset = 0;
arrayLength = 0;
}
break;
case JBBPCompiler.FLAG_ARRAY | (JBBPCompiler.EXT_FLAG_EXPRESSION_OR_WHOLESTREAM << 8): {
final JBBPIntegerValueEvaluator evaluator = this.compiledBlock.getArraySizeEvaluators()[positionAtVarLengthProcessors.getAndIncrement()];
int resultOfExpression;
if (resultNotIgnored) {
resultOfExpression = evaluator.eval(inStream, positionAtCompiledBlock.get(), this.compiledBlock, namedNumericFieldMap);
if ((this.flags & FLAG_NEGATIVE_EXPRESSION_RESULT_AS_ZERO) != 0) {
resultOfExpression = Math.max(resultOfExpression, 0);
}
} else {
resultOfExpression = 0;
}
arrayLength = resultOfExpression;
packedArraySizeOffset = 0;
assertArrayLength(arrayLength, name);
wholeStreamArray = false;
}
break;
default: {
// it is not an array, just a single field
packedArraySizeOffset = 0;
wholeStreamArray = false;
arrayLength = -1;
}
break;
}
JBBPAbstractField singleAtomicField = null;
try {
switch (code & 0xF) {
case JBBPCompiler.CODE_RESET_COUNTER: {
if (resultNotIgnored) {
inStream.resetCounter();
}
}
break;
case JBBPCompiler.CODE_ALIGN: {
final int alignValue = extraFieldNumAsExpr ? extraFieldNumExprResult : JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
inStream.align(alignValue);
}
}
break;
case JBBPCompiler.CODE_SKIP: {
final int skipByteNumber = extraFieldNumAsExpr ? extraFieldNumExprResult : JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
if (fieldTypeDiff) {
singleAtomicField = new JBBPFieldInt(name, skipByteNumber);
} else {
if (skipByteNumber > 0) {
final long skippedBytes = inStream.skip(skipByteNumber);
if (skippedBytes != skipByteNumber) {
throw new EOFException("Can't skip " + skipByteNumber + " byte(s), skipped only " + skippedBytes + " byte(s)");
}
}
}
}
}
break;
case JBBPCompiler.CODE_BIT: {
final int numberOfBits = extraFieldNumAsExpr ? extraFieldNumExprResult : JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
final JBBPBitNumber bitNumber = JBBPBitNumber.decode(numberOfBits);
if (arrayLength < 0) {
final int read = inStream.readBitField(bitNumber);
singleAtomicField = new JBBPFieldBit(name, read & 0xFF, bitNumber);
} else {
structureFields.add(new JBBPFieldArrayBit(name, inStream.readBitsArray(wholeStreamArray ? -1 : arrayLength, bitNumber), bitNumber));
}
}
}
break;
case JBBPCompiler.CODE_VAR: {
final int extraField = extraFieldNumAsExpr ? extraFieldNumExprResult : JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = varFieldProcessor.readVarField(inStream, name, extraField, byteOrder, namedNumericFieldMap);
JBBPUtils.assertNotNull(singleAtomicField, "A Var processor must not return null as a result of a field reading");
if (singleAtomicField instanceof JBBPAbstractArrayField) {
throw new JBBPParsingException("A Var field processor has returned an array value instead of a field value [" + name + ':' + extraField + ']');
}
if (singleAtomicField.getNameInfo() != name) {
throw new JBBPParsingException("Detected wrong name for a read field , must be " + name + " but detected " + singleAtomicField.getNameInfo() + ']');
}
} else {
final JBBPAbstractArrayField<? extends JBBPAbstractField> array = varFieldProcessor.readVarArray(inStream, wholeStreamArray ? -1 : arrayLength, name, extraField, byteOrder, namedNumericFieldMap);
JBBPUtils.assertNotNull(array, "A Var processor must not return null as a result of an array field reading [" + name + ':' + extraField + ']');
if (array.getNameInfo() != name) {
throw new JBBPParsingException("Detected wrong name for a read field array, must be " + name + " but detected " + array.getNameInfo() + ']');
}
structureFields.add(array);
}
}
}
break;
case JBBPCompiler.CODE_CUSTOMTYPE: {
final int extraData = extraFieldNumAsExpr ? extraFieldNumExprResult : JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
final JBBPFieldTypeParameterContainer fieldTypeInfo = this.compiledBlock.getCustomTypeFields()[JBBPUtils.unpackInt(compiled, positionAtCompiledBlock)];
final JBBPAbstractField field = this.customFieldTypeProcessor.readCustomFieldType(inStream, this.bitOrder, this.flags, fieldTypeInfo, name, extraData, wholeStreamArray, arrayLength);
JBBPUtils.assertNotNull(field, "Must not return null as read result");
if (arrayLength < 0) {
singleAtomicField = field;
} else {
structureFields.add(field);
}
}
}
break;
case JBBPCompiler.CODE_BYTE: {
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = new JBBPFieldByte(name, (byte) inStream.readByte());
} else {
structureFields.add(new JBBPFieldArrayByte(name, inStream.readByteArray(wholeStreamArray ? -1 : arrayLength, byteOrder)));
}
}
}
break;
case JBBPCompiler.CODE_UBYTE: {
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = new JBBPFieldUByte(name, (byte) inStream.readByte());
} else {
structureFields.add(new JBBPFieldArrayUByte(name, inStream.readByteArray(wholeStreamArray ? -1 : arrayLength, byteOrder)));
}
}
}
break;
case JBBPCompiler.CODE_BOOL: {
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = fieldTypeDiff ? new JBBPFieldString(name, inStream.readString(byteOrder)) : new JBBPFieldBoolean(name, inStream.readBoolean());
} else {
structureFields.add(fieldTypeDiff ?
new JBBPFieldArrayString(name, inStream.readStringArray(wholeStreamArray ? -1 : arrayLength, byteOrder)) :
new JBBPFieldArrayBoolean(name, inStream.readBoolArray(wholeStreamArray ? -1 : arrayLength))
);
}
}
}
break;
case JBBPCompiler.CODE_INT: {
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = fieldTypeDiff ? new JBBPFieldFloat(name, inStream.readFloat(byteOrder)) : new JBBPFieldInt(name, inStream.readInt(byteOrder));
} else {
structureFields.add(fieldTypeDiff ?
new JBBPFieldArrayFloat(name, inStream.readFloatArray(wholeStreamArray ? -1 : arrayLength, byteOrder)) :
new JBBPFieldArrayInt(name, inStream.readIntArray(wholeStreamArray ? -1 : arrayLength, byteOrder))
);
}
}
}
break;
case JBBPCompiler.CODE_LONG: {
if (resultNotIgnored) {
if (arrayLength < 0) {
singleAtomicField = fieldTypeDiff ? new JBBPFieldDouble(name, inStream.readDouble(byteOrder)) : new JBBPFieldLong(name, inStream.readLong(byteOrder));
} else {
structureFields.add(fieldTypeDiff ?
new JBBPFieldArrayDouble(name, inStream.readDoubleArray(wholeStreamArray ? -1 : arrayLength, byteOrder)) :
new JBBPFieldArrayLong(name, inStream.readLongArray(wholeStreamArray ? -1 : arrayLength, byteOrder))
);
}
}
}
break;
case JBBPCompiler.CODE_SHORT: {
if (resultNotIgnored) {
if (arrayLength < 0) {
final int value = inStream.readUnsignedShort(byteOrder);
singleAtomicField = new JBBPFieldShort(name, (short) value);
} else {
structureFields.add(new JBBPFieldArrayShort(name, inStream.readShortArray(wholeStreamArray ? -1 : arrayLength, byteOrder)));
}
}
}
break;
case JBBPCompiler.CODE_USHORT: {
if (resultNotIgnored) {
if (arrayLength < 0) {
final int value = inStream.readUnsignedShort(byteOrder);
singleAtomicField = new JBBPFieldUShort(name, (short) value);
} else {
structureFields.add(new JBBPFieldArrayUShort(name, inStream.readShortArray(wholeStreamArray ? -1 : arrayLength, byteOrder)));
}
}
}
break;
case JBBPCompiler.CODE_STRUCT_START: {
if (arrayLength < 0) {
final List<JBBPAbstractField> structFields = parseStruct(inStream, positionAtCompiledBlock, varFieldProcessor, namedNumericFieldMap, positionAtNamedFieldList, positionAtVarLengthProcessors, skipStructureFields);
// skip offset
JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (resultNotIgnored) {
structureFields.add(new JBBPFieldStruct(name, structFields.toArray(ARRAY_FIELD_EMPTY)));
}
} else {
final int nameFieldCurrent = positionAtNamedFieldList.get();
final int varLenProcCurrent = positionAtVarLengthProcessors.get();
final JBBPFieldStruct[] result;
if (resultNotIgnored) {
if (wholeStreamArray) {
// read till the stream end
final List<JBBPFieldStruct> list = new ArrayList<>();
while (inStream.hasAvailableData()) {
positionAtNamedFieldList.set(nameFieldCurrent);
positionAtVarLengthProcessors.set(varLenProcCurrent);
final List<JBBPAbstractField> fieldsForStruct = parseStruct(inStream, positionAtCompiledBlock, varFieldProcessor, namedNumericFieldMap, positionAtNamedFieldList, positionAtVarLengthProcessors, skipStructureFields);
list.add(new JBBPFieldStruct(name, fieldsForStruct));
final int structStart = JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
if (inStream.hasAvailableData()) {
positionAtCompiledBlock.set(structStart + (wideCode ? 2 : 1));
}
}
result = list.isEmpty() ? EMPTY_STRUCT_ARRAY : list.toArray(EMPTY_STRUCT_ARRAY);
} else {
// read number of items
if (arrayLength == 0) {
// skip the structure
result = EMPTY_STRUCT_ARRAY;
parseStruct(inStream, positionAtCompiledBlock, varFieldProcessor, namedNumericFieldMap, positionAtNamedFieldList, positionAtVarLengthProcessors, true);
JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
} else {
result = new JBBPFieldStruct[arrayLength];
for (int i = 0; i < arrayLength; i++) {
final List<JBBPAbstractField> fieldsForStruct = parseStruct(inStream, positionAtCompiledBlock, varFieldProcessor, namedNumericFieldMap, positionAtNamedFieldList, positionAtVarLengthProcessors, skipStructureFields);
final int structBodyStart = JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
result[i] = new JBBPFieldStruct(name, fieldsForStruct);
if (i < arrayLength - 1) {
// not the last
positionAtNamedFieldList.set(nameFieldCurrent);
positionAtVarLengthProcessors.set(varLenProcCurrent);
positionAtCompiledBlock.set(structBodyStart + packedArraySizeOffset + (wideCode ? 2 : 1));
}
}
}
}
if (result != null) {
structureFields.add(new JBBPFieldArrayStruct(name, result));
}
} else {
parseStruct(inStream, positionAtCompiledBlock, varFieldProcessor, namedNumericFieldMap, positionAtNamedFieldList, positionAtVarLengthProcessors, skipStructureFields);
JBBPUtils.unpackInt(compiled, positionAtCompiledBlock);
}
}
}
break;
case JBBPCompiler.CODE_STRUCT_END: {
// we just left the method and the caller must process the structure offset start address for the structure
endStructureNotMet = false;
}
break;
default:
throw new Error("Detected unexpected field type! Contact developer! [" + code + ']');
}
} catch (IOException ex) {
if (name == null) {
throw ex;
} else {
throw new JBBPParsingException("Can't parse field '" + name.getFieldPath() + "' for IOException", ex);
}
}
if (singleAtomicField != null) {
structureFields.add(singleAtomicField);
if (namedNumericFieldMap != null && singleAtomicField instanceof JBBPNumericField && name != null) {
namedNumericFieldMap.putField((JBBPNumericField) singleAtomicField);
}
}
}
return structureFields;
} } |
public class class_name {
@Nullable
public DnsQueryCacheResult tryToResolve(DnsQuery query) {
CachedDnsQueryResult cachedResult = cache.get(query);
if (cachedResult == null) {
logger.trace("{} cache miss", query);
return null;
}
DnsResponse result = cachedResult.response;
assert result != null; // results with null responses should never be in cache map
if (result.isSuccessful()) {
logger.trace("{} cache hit", query);
} else {
logger.trace("{} error cache hit", query);
}
if (isExpired(cachedResult)) {
logger.trace("{} hard TTL expired", query);
return null;
} else if (isSoftExpired(cachedResult)) {
logger.trace("{} soft TTL expired", query);
return new DnsQueryCacheResult(result, true);
}
return new DnsQueryCacheResult(result, false);
} } | public class class_name {
@Nullable
public DnsQueryCacheResult tryToResolve(DnsQuery query) {
CachedDnsQueryResult cachedResult = cache.get(query);
if (cachedResult == null) {
logger.trace("{} cache miss", query); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
DnsResponse result = cachedResult.response;
assert result != null; // results with null responses should never be in cache map
if (result.isSuccessful()) {
logger.trace("{} cache hit", query);
} else {
logger.trace("{} error cache hit", query);
}
if (isExpired(cachedResult)) {
logger.trace("{} hard TTL expired", query);
return null;
} else if (isSoftExpired(cachedResult)) {
logger.trace("{} soft TTL expired", query);
return new DnsQueryCacheResult(result, true);
}
return new DnsQueryCacheResult(result, false);
} } |
public class class_name {
public static boolean contains(Iterable<?> iterable, Object value)
{
if (iterable instanceof Collection)
{
return ((Collection<?>) iterable).contains(value);
}
if (iterable instanceof RichIterable)
{
return ((RichIterable<?>) iterable).contains(value);
}
return IterableIterate.detectIndex(iterable, Predicates.equal(value)) > -1;
} } | public class class_name {
public static boolean contains(Iterable<?> iterable, Object value)
{
if (iterable instanceof Collection)
{
return ((Collection<?>) iterable).contains(value); // depends on control dependency: [if], data = [none]
}
if (iterable instanceof RichIterable)
{
return ((RichIterable<?>) iterable).contains(value); // depends on control dependency: [if], data = [none]
}
return IterableIterate.detectIndex(iterable, Predicates.equal(value)) > -1;
} } |
public class class_name {
private static int readDataBlock(String text, int offset, int length, List<byte[]> blocks)
{
int bytes = length / 2;
byte[] data = new byte[bytes];
for (int index = 0; index < bytes; index++)
{
data[index] = (byte) Integer.parseInt(text.substring(offset, offset + 2), 16);
offset += 2;
}
blocks.add(data);
return (offset);
} } | public class class_name {
private static int readDataBlock(String text, int offset, int length, List<byte[]> blocks)
{
int bytes = length / 2;
byte[] data = new byte[bytes];
for (int index = 0; index < bytes; index++)
{
data[index] = (byte) Integer.parseInt(text.substring(offset, offset + 2), 16); // depends on control dependency: [for], data = [index]
offset += 2; // depends on control dependency: [for], data = [none]
}
blocks.add(data);
return (offset);
} } |
public class class_name {
public Color getColorForBond(IBond bond, RendererModel model) {
if (this.overrideColor != null) {
return overrideColor;
}
Color color = model.getParameter(ColorHash.class).getValue().get(bond);
if (color == null) {
return model.getParameter(DefaultBondColor.class).getValue();
} else {
return color;
}
} } | public class class_name {
public Color getColorForBond(IBond bond, RendererModel model) {
if (this.overrideColor != null) {
return overrideColor; // depends on control dependency: [if], data = [none]
}
Color color = model.getParameter(ColorHash.class).getValue().get(bond);
if (color == null) {
return model.getParameter(DefaultBondColor.class).getValue(); // depends on control dependency: [if], data = [none]
} else {
return color; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private File findFile(final SecurityContext securityContext, final HttpServletRequest request, final String path) throws FrameworkException {
List<Linkable> entryPoints = findPossibleEntryPoints(securityContext, request, path);
// If no results were found, try to replace whitespace by '+' or '%20'
if (entryPoints.isEmpty()) {
entryPoints = findPossibleEntryPoints(securityContext, request, PathHelper.replaceWhitespaceByPlus(path));
}
if (entryPoints.isEmpty()) {
entryPoints = findPossibleEntryPoints(securityContext, request, PathHelper.replaceWhitespaceByPercentTwenty(path));
}
for (Linkable node : entryPoints) {
if (node instanceof File && (path.equals(node.getPath()) || node.getUuid().equals(PathHelper.getName(path)))) {
return (File) node;
}
}
return null;
} } | public class class_name {
private File findFile(final SecurityContext securityContext, final HttpServletRequest request, final String path) throws FrameworkException {
List<Linkable> entryPoints = findPossibleEntryPoints(securityContext, request, path);
// If no results were found, try to replace whitespace by '+' or '%20'
if (entryPoints.isEmpty()) {
entryPoints = findPossibleEntryPoints(securityContext, request, PathHelper.replaceWhitespaceByPlus(path));
}
if (entryPoints.isEmpty()) {
entryPoints = findPossibleEntryPoints(securityContext, request, PathHelper.replaceWhitespaceByPercentTwenty(path));
}
for (Linkable node : entryPoints) {
if (node instanceof File && (path.equals(node.getPath()) || node.getUuid().equals(PathHelper.getName(path)))) {
return (File) node; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public void sendRequestPacket(String nodeID, Context ctx) {
FastBuildTree msg = new FastBuildTree(11);
// Add basic properties (version, sender's nodeID, etc.)
msg.putUnsafe("ver", PROTOCOL_VERSION);
msg.putUnsafe("sender", this.nodeID);
msg.putUnsafe("id", ctx.id);
msg.putUnsafe("action", ctx.name);
// Add params and meta
if (ctx.params != null) {
msg.putUnsafe("params", ctx.params.asObject());
Tree meta = ctx.params.getMeta(false);
if (meta != null && !meta.isEmpty()) {
msg.putUnsafe("meta", meta.asObject());
}
}
// Timeout
if (ctx.opts != null && ctx.opts.timeout > 0) {
msg.putUnsafe("timeout", ctx.opts.timeout);
}
// Call level
msg.putUnsafe("level", ctx.level);
// Parent ID
if (ctx.parentID != null) {
msg.putUnsafe("parentID", ctx.parentID);
}
// Request ID
msg.putUnsafe("requestID", ctx.requestID);
// Stream packet counter (default is "0" = packet isn't streamed)
if (ctx.stream != null) {
// Streaming in progress
msg.putUnsafe("stream", true);
// First sequence
msg.putUnsafe("seq", 0);
}
// Send message
publish(Transporter.PACKET_REQUEST, nodeID, msg);
} } | public class class_name {
public void sendRequestPacket(String nodeID, Context ctx) {
FastBuildTree msg = new FastBuildTree(11);
// Add basic properties (version, sender's nodeID, etc.)
msg.putUnsafe("ver", PROTOCOL_VERSION);
msg.putUnsafe("sender", this.nodeID);
msg.putUnsafe("id", ctx.id);
msg.putUnsafe("action", ctx.name);
// Add params and meta
if (ctx.params != null) {
msg.putUnsafe("params", ctx.params.asObject());
// depends on control dependency: [if], data = [none]
Tree meta = ctx.params.getMeta(false);
if (meta != null && !meta.isEmpty()) {
msg.putUnsafe("meta", meta.asObject());
// depends on control dependency: [if], data = [none]
}
}
// Timeout
if (ctx.opts != null && ctx.opts.timeout > 0) {
msg.putUnsafe("timeout", ctx.opts.timeout);
// depends on control dependency: [if], data = [none]
}
// Call level
msg.putUnsafe("level", ctx.level);
// Parent ID
if (ctx.parentID != null) {
msg.putUnsafe("parentID", ctx.parentID);
// depends on control dependency: [if], data = [none]
}
// Request ID
msg.putUnsafe("requestID", ctx.requestID);
// Stream packet counter (default is "0" = packet isn't streamed)
if (ctx.stream != null) {
// Streaming in progress
msg.putUnsafe("stream", true);
// depends on control dependency: [if], data = [none]
// First sequence
msg.putUnsafe("seq", 0);
// depends on control dependency: [if], data = [none]
}
// Send message
publish(Transporter.PACKET_REQUEST, nodeID, msg);
} } |
public class class_name {
public void massage( T input , T output ) {
if( clip ) {
T inputAdjusted = clipInput(input, output);
// configure a simple change in scale for both axises
transform.a11 = input.width / (float) output.width;
transform.a22 = input.height / (float) output.height;
// this change is automatically reflected in the distortion class. It is configured to cache nothing
distort.apply(inputAdjusted, output);
} else {
// scale each axis independently. It will have the whole image but it will be distorted
transform.a11 = input.width / (float) output.width;
transform.a22 = input.height / (float) output.height;
distort.apply(input, output);
}
} } | public class class_name {
public void massage( T input , T output ) {
if( clip ) {
T inputAdjusted = clipInput(input, output);
// configure a simple change in scale for both axises
transform.a11 = input.width / (float) output.width; // depends on control dependency: [if], data = [none]
transform.a22 = input.height / (float) output.height; // depends on control dependency: [if], data = [none]
// this change is automatically reflected in the distortion class. It is configured to cache nothing
distort.apply(inputAdjusted, output); // depends on control dependency: [if], data = [none]
} else {
// scale each axis independently. It will have the whole image but it will be distorted
transform.a11 = input.width / (float) output.width; // depends on control dependency: [if], data = [none]
transform.a22 = input.height / (float) output.height; // depends on control dependency: [if], data = [none]
distort.apply(input, output); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void transferTo(Decoder newDecoder) {
super.transferTo(newDecoder);
if (remainingBytesLength > 0) {
if (currentBuffer == null || !currentBuffer.hasRemaining())
currentBuffer = ByteBuffer.wrap(remainingBytes, 0, remainingBytesLength);
else {
byte[] b = new byte[remainingBytesLength + currentBuffer.remaining()];
System.arraycopy(remainingBytes, 0, b, 0, remainingBytesLength);
currentBuffer.get(b, remainingBytesLength, currentBuffer.remaining());
currentBuffer = ByteBuffer.wrap(b);
}
}
} } | public class class_name {
@Override
public void transferTo(Decoder newDecoder) {
super.transferTo(newDecoder);
if (remainingBytesLength > 0) {
if (currentBuffer == null || !currentBuffer.hasRemaining())
currentBuffer = ByteBuffer.wrap(remainingBytes, 0, remainingBytesLength);
else {
byte[] b = new byte[remainingBytesLength + currentBuffer.remaining()];
System.arraycopy(remainingBytes, 0, b, 0, remainingBytesLength); // depends on control dependency: [if], data = [none]
currentBuffer.get(b, remainingBytesLength, currentBuffer.remaining()); // depends on control dependency: [if], data = [none]
currentBuffer = ByteBuffer.wrap(b); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void setDateProperty(String pstrSection, String pstrProp,
Date pdtVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, utilDateToStr(pdtVal, this.mstrDateFmt),
pstrComments);
} } | public class class_name {
public void setDateProperty(String pstrSection, String pstrProp,
Date pdtVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
// depends on control dependency: [if], data = [none]
this.mhmapSections.put(pstrSection, objSec);
// depends on control dependency: [if], data = [none]
}
objSec.setProperty(pstrProp, utilDateToStr(pdtVal, this.mstrDateFmt),
pstrComments);
} } |
public class class_name {
public synchronized long nextId() {
long timestamp = timeGen();
if (timestamp < lastTimestamp) {
throw new RuntimeException(
String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
//如果是同一时间生成的,则进行毫秒内序列
if (lastTimestamp == timestamp) {
sequence = (sequence + 1) & sequenceMask;
//毫秒内序列溢出
if (sequence == 0) {
//阻塞到下一个毫秒,获得新的时间戳
timestamp = tilNextMillis(lastTimestamp);
}
}
//时间戳改变,毫秒内序列重置
else {
sequence = 0L;
}
//上次生成ID的时间截
lastTimestamp = timestamp;
//移位并通过或运算拼到一起组成64位的ID
return ((timestamp - twepoch) << timestampLeftShift)
| (dataCenterId << dataCenterIdShift)
| (workerId << workerIdShift)
| sequence;
} } | public class class_name {
public synchronized long nextId() {
long timestamp = timeGen();
if (timestamp < lastTimestamp) {
throw new RuntimeException(
String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
//如果是同一时间生成的,则进行毫秒内序列
if (lastTimestamp == timestamp) {
sequence = (sequence + 1) & sequenceMask; // depends on control dependency: [if], data = [none]
//毫秒内序列溢出
if (sequence == 0) {
//阻塞到下一个毫秒,获得新的时间戳
timestamp = tilNextMillis(lastTimestamp); // depends on control dependency: [if], data = [none]
}
}
//时间戳改变,毫秒内序列重置
else {
sequence = 0L; // depends on control dependency: [if], data = [none]
}
//上次生成ID的时间截
lastTimestamp = timestamp;
//移位并通过或运算拼到一起组成64位的ID
return ((timestamp - twepoch) << timestampLeftShift)
| (dataCenterId << dataCenterIdShift)
| (workerId << workerIdShift)
| sequence;
} } |
public class class_name {
public void setVolumeStatuses(java.util.Collection<VolumeStatusItem> volumeStatuses) {
if (volumeStatuses == null) {
this.volumeStatuses = null;
return;
}
this.volumeStatuses = new com.amazonaws.internal.SdkInternalList<VolumeStatusItem>(volumeStatuses);
} } | public class class_name {
public void setVolumeStatuses(java.util.Collection<VolumeStatusItem> volumeStatuses) {
if (volumeStatuses == null) {
this.volumeStatuses = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.volumeStatuses = new com.amazonaws.internal.SdkInternalList<VolumeStatusItem>(volumeStatuses);
} } |
public class class_name {
public String join(List<String> list) {
if (list == null) {
return null;
}
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String s : list) {
if (s == null) {
if (convertEmptyToNull) {
s = "";
} else {
throw new IllegalArgumentException("StringListFlattener does not support null strings in the list. Consider calling setConvertEmptyToNull(true).");
}
}
if (!first) {
sb.append(separator);
}
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == escapeChar || c == separator) {
sb.append(escapeChar);
}
sb.append(c);
}
first = false;
}
return sb.toString();
} } | public class class_name {
public String join(List<String> list) {
if (list == null) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String s : list) {
if (s == null) {
if (convertEmptyToNull) {
s = ""; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("StringListFlattener does not support null strings in the list. Consider calling setConvertEmptyToNull(true).");
}
}
if (!first) {
sb.append(separator); // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == escapeChar || c == separator) {
sb.append(escapeChar); // depends on control dependency: [if], data = [none]
}
sb.append(c); // depends on control dependency: [for], data = [none]
}
first = false; // depends on control dependency: [for], data = [s]
}
return sb.toString();
} } |
public class class_name {
public DependencyExplorerOutput explore(GinjectorBindings origin) {
DependencyExplorerOutput output = new DependencyExplorerOutput();
DependencyGraph.Builder builder = new DependencyGraph.Builder(origin);
for (Dependency edge : origin.getDependencies()) {
Preconditions.checkState(
Dependency.GINJECTOR.equals(edge.getSource()) || origin.isBound(edge.getSource()),
"Expected non-null source %s to be bound in origin!", edge.getSource());
builder.addEdge(edge);
if (!edge.getSource().equals(Dependency.GINJECTOR) && visited.add(edge.getSource())) {
// Need to register where we can find the "source". Note that this will be always be
// available somewhere, because it's already available at the origin (that's how we found
// this dependency).
PrettyPrinter.log(logger, TreeLogger.DEBUG,
"Registering %s as available at %s because of the dependency %s", edge.getSource(),
origin, edge);
output.preExistingBindings.put(edge.getSource(),
locateHighestAccessibleSource(edge.getSource(), origin));
}
PrettyPrinter.log(logger, TreeLogger.DEBUG,
"Exploring from %s in %s because of the dependency %s", edge.getTarget(), origin, edge);
// Visit the target of the dependency to find additional bindings
visit(edge.getTarget(), builder, output, origin);
}
output.setGraph(builder.build());
return output;
} } | public class class_name {
public DependencyExplorerOutput explore(GinjectorBindings origin) {
DependencyExplorerOutput output = new DependencyExplorerOutput();
DependencyGraph.Builder builder = new DependencyGraph.Builder(origin);
for (Dependency edge : origin.getDependencies()) {
Preconditions.checkState(
Dependency.GINJECTOR.equals(edge.getSource()) || origin.isBound(edge.getSource()),
"Expected non-null source %s to be bound in origin!", edge.getSource()); // depends on control dependency: [for], data = [none]
builder.addEdge(edge); // depends on control dependency: [for], data = [edge]
if (!edge.getSource().equals(Dependency.GINJECTOR) && visited.add(edge.getSource())) {
// Need to register where we can find the "source". Note that this will be always be
// available somewhere, because it's already available at the origin (that's how we found
// this dependency).
PrettyPrinter.log(logger, TreeLogger.DEBUG,
"Registering %s as available at %s because of the dependency %s", edge.getSource(),
origin, edge); // depends on control dependency: [if], data = [none]
output.preExistingBindings.put(edge.getSource(),
locateHighestAccessibleSource(edge.getSource(), origin)); // depends on control dependency: [if], data = [none]
}
PrettyPrinter.log(logger, TreeLogger.DEBUG,
"Exploring from %s in %s because of the dependency %s", edge.getTarget(), origin, edge); // depends on control dependency: [for], data = [none]
// Visit the target of the dependency to find additional bindings
visit(edge.getTarget(), builder, output, origin); // depends on control dependency: [for], data = [edge]
}
output.setGraph(builder.build());
return output;
} } |
public class class_name {
public static String getRepoPropertiesFileLocation() {
String installDirPath = Utils.getInstallDir().getAbsolutePath();
String overrideLocation = System.getProperty(InstallConstants.OVERRIDE_PROPS_LOCATION_ENV_VAR);
//Gets the repository properties file path from the default location
if (overrideLocation == null) {
return installDirPath + InstallConstants.DEFAULT_REPO_PROPERTIES_LOCATION;
} else {
//Gets the repository properties file from user specified location
return overrideLocation;
}
} } | public class class_name {
public static String getRepoPropertiesFileLocation() {
String installDirPath = Utils.getInstallDir().getAbsolutePath();
String overrideLocation = System.getProperty(InstallConstants.OVERRIDE_PROPS_LOCATION_ENV_VAR);
//Gets the repository properties file path from the default location
if (overrideLocation == null) {
return installDirPath + InstallConstants.DEFAULT_REPO_PROPERTIES_LOCATION; // depends on control dependency: [if], data = [none]
} else {
//Gets the repository properties file from user specified location
return overrideLocation; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String join(String[] array, String sep) {
if (array == null) {
return null;
}
int arraySize = array.length;
int sepSize = 0;
if (sep != null && !sep.equals("")) {
sepSize = sep.length();
}
int bufSize = (arraySize == 0 ? 0 : ((array[0] == null ? 16 : array[0].length()) + sepSize) * arraySize);
StringBuilder buf = new StringBuilder(bufSize);
for (int i = 0; i < arraySize; i++) {
if (i > 0) {
buf.append(sep);
}
if (array[i] != null) {
buf.append(array[i]);
}
}
return buf.toString();
} } | public class class_name {
public static String join(String[] array, String sep) {
if (array == null) {
return null; // depends on control dependency: [if], data = [none]
}
int arraySize = array.length;
int sepSize = 0;
if (sep != null && !sep.equals("")) {
sepSize = sep.length(); // depends on control dependency: [if], data = [none]
}
int bufSize = (arraySize == 0 ? 0 : ((array[0] == null ? 16 : array[0].length()) + sepSize) * arraySize);
StringBuilder buf = new StringBuilder(bufSize);
for (int i = 0; i < arraySize; i++) {
if (i > 0) {
buf.append(sep); // depends on control dependency: [if], data = [none]
}
if (array[i] != null) {
buf.append(array[i]); // depends on control dependency: [if], data = [(array[i]]
}
}
return buf.toString();
} } |
public class class_name {
public Object getLock(Object key)
{
int index = (key.hashCode() & 0x7FFFFFFF) % locks.length;
// Double-checked locking. Safe since Object has no state.
Object lock = locks[index];
if (lock == null)
{
synchronized (this)
{
lock = locks[index];
if (lock == null)
{
lock = new Object();
locks[index] = lock;
}
}
}
return lock;
} } | public class class_name {
public Object getLock(Object key)
{
int index = (key.hashCode() & 0x7FFFFFFF) % locks.length;
// Double-checked locking. Safe since Object has no state.
Object lock = locks[index];
if (lock == null)
{
synchronized (this) // depends on control dependency: [if], data = [none]
{
lock = locks[index];
if (lock == null)
{
lock = new Object(); // depends on control dependency: [if], data = [none]
locks[index] = lock; // depends on control dependency: [if], data = [none]
}
}
}
return lock;
} } |
public class class_name {
@Nullable
public ResultStrength getAddressRisk() {
if (addressRisk == null) {
return null;
}
return ResultStrength.toEnum(addressRisk.toLowerCase());
} } | public class class_name {
@Nullable
public ResultStrength getAddressRisk() {
if (addressRisk == null) {
return null; // depends on control dependency: [if], data = [none]
}
return ResultStrength.toEnum(addressRisk.toLowerCase());
} } |
public class class_name {
public static CacheKeyGenerator getCacheKeyGenerator(BeanManager beanManager, Class<? extends CacheKeyGenerator> methodCacheKeyGeneratorClass, CacheDefaults cacheDefaultsAnnotation) {
assertNotNull(beanManager, "beanManager parameter must not be null");
Class<? extends CacheKeyGenerator> cacheKeyGeneratorClass = DefaultCacheKeyGenerator.class;
if (!CacheKeyGenerator.class.equals(methodCacheKeyGeneratorClass)) {
cacheKeyGeneratorClass = methodCacheKeyGeneratorClass;
} else if (cacheDefaultsAnnotation != null && !CacheKeyGenerator.class.equals(cacheDefaultsAnnotation.cacheKeyGenerator())) {
cacheKeyGeneratorClass = cacheDefaultsAnnotation.cacheKeyGenerator();
}
final CreationalContext<?> creationalContext = beanManager.createCreationalContext(null);
final Set<Bean<?>> beans = beanManager.getBeans(cacheKeyGeneratorClass);
if (!beans.isEmpty()) {
final Bean<?> bean = beanManager.resolve(beans);
return (CacheKeyGenerator) beanManager.getReference(bean, CacheKeyGenerator.class, creationalContext);
}
// the CacheKeyGenerator implementation is not managed by CDI
try {
return cacheKeyGeneratorClass.newInstance();
} catch (InstantiationException e) {
throw log.unableToInstantiateCacheKeyGenerator(cacheKeyGeneratorClass, e);
} catch (IllegalAccessException e) {
throw log.unableToInstantiateCacheKeyGenerator(cacheKeyGeneratorClass, e);
}
} } | public class class_name {
public static CacheKeyGenerator getCacheKeyGenerator(BeanManager beanManager, Class<? extends CacheKeyGenerator> methodCacheKeyGeneratorClass, CacheDefaults cacheDefaultsAnnotation) {
assertNotNull(beanManager, "beanManager parameter must not be null");
Class<? extends CacheKeyGenerator> cacheKeyGeneratorClass = DefaultCacheKeyGenerator.class;
if (!CacheKeyGenerator.class.equals(methodCacheKeyGeneratorClass)) {
cacheKeyGeneratorClass = methodCacheKeyGeneratorClass; // depends on control dependency: [if], data = [none]
} else if (cacheDefaultsAnnotation != null && !CacheKeyGenerator.class.equals(cacheDefaultsAnnotation.cacheKeyGenerator())) {
cacheKeyGeneratorClass = cacheDefaultsAnnotation.cacheKeyGenerator(); // depends on control dependency: [if], data = [none]
}
final CreationalContext<?> creationalContext = beanManager.createCreationalContext(null);
final Set<Bean<?>> beans = beanManager.getBeans(cacheKeyGeneratorClass);
if (!beans.isEmpty()) {
final Bean<?> bean = beanManager.resolve(beans);
return (CacheKeyGenerator) beanManager.getReference(bean, CacheKeyGenerator.class, creationalContext); // depends on control dependency: [if], data = [none]
}
// the CacheKeyGenerator implementation is not managed by CDI
try {
return cacheKeyGeneratorClass.newInstance(); // depends on control dependency: [try], data = [none]
} catch (InstantiationException e) {
throw log.unableToInstantiateCacheKeyGenerator(cacheKeyGeneratorClass, e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
throw log.unableToInstantiateCacheKeyGenerator(cacheKeyGeneratorClass, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void firePropertyReset(T property)
{
PropertyEvent<T> event = null;
for (PropertyListener<T> l : listeners)
{
if (event == null)
{
event = new PropertyEvent<T>(this, property);
}
l.reset(event);
}
} } | public class class_name {
private void firePropertyReset(T property)
{
PropertyEvent<T> event = null;
for (PropertyListener<T> l : listeners)
{
if (event == null)
{
event = new PropertyEvent<T>(this, property);
// depends on control dependency: [if], data = [none]
}
l.reset(event);
// depends on control dependency: [for], data = [l]
}
} } |
public class class_name {
public static String convertEOL(String input, EOLType type) {
if (null == input || 0 == input.length()) {
return input;
}
// Convert line endings to Unix LF,
// which also sets up the string for other conversions
input = input.replace("\r\n","\n");
input = input.replace("\r","\n");
switch (type) {
case CR:
case Mac:
// Convert line endings to CR
input = input.replace("\n", "\r");
break;
case CRLF:
case Windows:
// Convert line endings to Windows CR/LF
input = input.replace("\n", "\r\n");
break;
default:
case LF:
case Unix:
// Conversion already completed
return input;
case LFCR:
// Convert line endings to LF/CR
input = input.replace("\n", "\n\r");
break;
}
return input;
} } | public class class_name {
public static String convertEOL(String input, EOLType type) {
if (null == input || 0 == input.length()) {
return input; // depends on control dependency: [if], data = [none]
}
// Convert line endings to Unix LF,
// which also sets up the string for other conversions
input = input.replace("\r\n","\n");
input = input.replace("\r","\n");
switch (type) {
case CR:
case Mac:
// Convert line endings to CR
input = input.replace("\n", "\r");
break;
case CRLF:
case Windows:
// Convert line endings to Windows CR/LF
input = input.replace("\n", "\r\n");
break;
default:
case LF:
case Unix:
// Conversion already completed
return input;
case LFCR:
// Convert line endings to LF/CR
input = input.replace("\n", "\n\r");
break;
}
return input;
} } |
public class class_name {
public Option getOption(String name) {
if (shortOpts.containsKey(name)) {
return shortOpts.get(name);
}
return longOpts.get(name);
} } | public class class_name {
public Option getOption(String name) {
if (shortOpts.containsKey(name)) {
return shortOpts.get(name); // depends on control dependency: [if], data = [none]
}
return longOpts.get(name);
} } |
public class class_name {
public static String getKeyManagerFactoryAlgorithm() {
if (keyManagerFactoryAlgorithm == null) {
keyManagerFactoryAlgorithm = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return Security.getProperty("ssl.KeyManagerFactory.algorithm");
}
});
}
return keyManagerFactoryAlgorithm;
} } | public class class_name {
public static String getKeyManagerFactoryAlgorithm() {
if (keyManagerFactoryAlgorithm == null) {
keyManagerFactoryAlgorithm = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return Security.getProperty("ssl.KeyManagerFactory.algorithm");
}
}); // depends on control dependency: [if], data = [none]
}
return keyManagerFactoryAlgorithm;
} } |
public class class_name {
public void setMetricDataResults(java.util.Collection<MetricDataResult> metricDataResults) {
if (metricDataResults == null) {
this.metricDataResults = null;
return;
}
this.metricDataResults = new com.amazonaws.internal.SdkInternalList<MetricDataResult>(metricDataResults);
} } | public class class_name {
public void setMetricDataResults(java.util.Collection<MetricDataResult> metricDataResults) {
if (metricDataResults == null) {
this.metricDataResults = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.metricDataResults = new com.amazonaws.internal.SdkInternalList<MetricDataResult>(metricDataResults);
} } |
public class class_name {
public void setSelectableDateRange(Date min, Date max) {
if (min == null) {
minSelectableDate = defaultMinSelectableDate;
} else {
minSelectableDate = min;
}
if (max == null) {
maxSelectableDate = defaultMaxSelectableDate;
} else {
maxSelectableDate = max;
}
if (maxSelectableDate.before(minSelectableDate)) {
minSelectableDate = defaultMinSelectableDate;
maxSelectableDate = defaultMaxSelectableDate;
}
} } | public class class_name {
public void setSelectableDateRange(Date min, Date max) {
if (min == null) {
minSelectableDate = defaultMinSelectableDate; // depends on control dependency: [if], data = [none]
} else {
minSelectableDate = min; // depends on control dependency: [if], data = [none]
}
if (max == null) {
maxSelectableDate = defaultMaxSelectableDate; // depends on control dependency: [if], data = [none]
} else {
maxSelectableDate = max; // depends on control dependency: [if], data = [none]
}
if (maxSelectableDate.before(minSelectableDate)) {
minSelectableDate = defaultMinSelectableDate; // depends on control dependency: [if], data = [none]
maxSelectableDate = defaultMaxSelectableDate; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected Object toJavaType(FieldWithAnnotation<Facebook> fieldWithAnnotation, JsonObject jsonObject,
String facebookFieldName) {
Class<?> type = fieldWithAnnotation.getField().getType();
JsonValue rawValue = jsonObject.get(facebookFieldName);
// Short-circuit right off the bat if we've got a null value.
if (rawValue.isNull()) {
return null;
}
if (String.class.equals(type)) {
/*
* Special handling here for better error checking.
*
* Since {@code JsonObject.getString()} will return literal JSON text even if it's _not_ a JSON string, we check
* the marshaled type and bail if needed. For example, calling {@code JsonObject.getString("results")} on the
* below JSON...
*
* <code> { "results":[ {"name":"Mark Allen"} ] } </code>
*
* ... would return the string {@code "[{"name":"Mark Allen"}]"} instead of throwing an error. So we throw the
* error ourselves.
*
* Per Antonello Naccarato, sometimes FB will return an empty JSON array instead of an empty string. Look for that
* here.
*/
if (rawValue.isArray() && rawValue.asArray().isEmpty()) {
MAPPER_LOGGER.trace("Coercing an empty JSON array to an empty string for {}", fieldWithAnnotation);
return "";
}
/*
* If the user wants a string, _always_ give her a string.
*
* This is useful if, for example, you've got a @Facebook-annotated string field that you'd like to have a numeric
* type shoved into.
*
* User beware: this will turn *anything* into a string, which might lead to results you don't expect.
*/
return jsonHelper.getStringFrom(rawValue);
}
if (Integer.class.equals(type) || Integer.TYPE.equals(type)) {
return jsonHelper.getIntegerFrom(rawValue);
}
if (Boolean.class.equals(type) || Boolean.TYPE.equals(type)) {
return jsonHelper.getBooleanFrom(rawValue);
}
if (Long.class.equals(type) || Long.TYPE.equals(type)) {
return jsonHelper.getLongFrom(rawValue);
}
if (Double.class.equals(type) || Double.TYPE.equals(type)) {
return jsonHelper.getDoubleFrom(rawValue);
}
if (Float.class.equals(type) || Float.TYPE.equals(type)) {
return jsonHelper.getFloatFrom(rawValue);
}
if (BigInteger.class.equals(type)) {
return jsonHelper.getBigIntegerFrom(rawValue);
}
if (BigDecimal.class.equals(type)) {
return jsonHelper.getBigDecimalFrom(rawValue);
}
if (List.class.equals(type)) {
return toJavaList(rawValue.toString(), getFirstParameterizedTypeArgument(fieldWithAnnotation.getField()));
}
if (Map.class.equals(type)) {
return convertJsonObjectToMap(rawValue.toString(), fieldWithAnnotation.getField());
}
if (type.isEnum()) {
Class<? extends Enum> enumType = type.asSubclass(Enum.class);
try {
return Enum.valueOf(enumType, rawValue.asString());
} catch (IllegalArgumentException iae) {
MAPPER_LOGGER.debug("Cannot map string {} to enum {}, try fallback toUpperString next...", rawValue.asString(),
enumType.getName());
}
try {
return Enum.valueOf(enumType, rawValue.asString().toUpperCase());
} catch (IllegalArgumentException iae) {
MAPPER_LOGGER.debug("Mapping string {} to enum {} not possible", rawValue.asString(), enumType.getName());
}
}
if (Date.class.equals(type)) {
return DateUtils.toDateFromLongFormat(jsonHelper.getStringFrom(rawValue));
}
String rawValueAsString = jsonHelper.getStringFrom(rawValue);
// Hack for issue #76 where FB will sometimes return a Post's Comments as
// "[]" instead of an object type (wtf)F
if (Comments.class.isAssignableFrom(type) && rawValue instanceof JsonArray) {
MAPPER_LOGGER.debug(
"Encountered comment array '{}' but expected a {} object instead. Working around that by coercing "
+ "into an empty {} instance...",
rawValueAsString, Comments.class.getSimpleName(), Comments.class.getSimpleName());
JsonObject workaroundJsonObject = new JsonObject();
workaroundJsonObject.add("total_count", 0);
workaroundJsonObject.add("data", new JsonArray());
rawValueAsString = workaroundJsonObject.toString();
}
// Some other type - recurse into it
return toJavaObject(rawValueAsString, type);
} } | public class class_name {
protected Object toJavaType(FieldWithAnnotation<Facebook> fieldWithAnnotation, JsonObject jsonObject,
String facebookFieldName) {
Class<?> type = fieldWithAnnotation.getField().getType();
JsonValue rawValue = jsonObject.get(facebookFieldName);
// Short-circuit right off the bat if we've got a null value.
if (rawValue.isNull()) {
return null; // depends on control dependency: [if], data = [none]
}
if (String.class.equals(type)) {
/*
* Special handling here for better error checking.
*
* Since {@code JsonObject.getString()} will return literal JSON text even if it's _not_ a JSON string, we check
* the marshaled type and bail if needed. For example, calling {@code JsonObject.getString("results")} on the
* below JSON...
*
* <code> { "results":[ {"name":"Mark Allen"} ] } </code>
*
* ... would return the string {@code "[{"name":"Mark Allen"}]"} instead of throwing an error. So we throw the
* error ourselves.
*
* Per Antonello Naccarato, sometimes FB will return an empty JSON array instead of an empty string. Look for that
* here.
*/
if (rawValue.isArray() && rawValue.asArray().isEmpty()) {
MAPPER_LOGGER.trace("Coercing an empty JSON array to an empty string for {}", fieldWithAnnotation); // depends on control dependency: [if], data = [none]
return ""; // depends on control dependency: [if], data = [none]
}
/*
* If the user wants a string, _always_ give her a string.
*
* This is useful if, for example, you've got a @Facebook-annotated string field that you'd like to have a numeric
* type shoved into.
*
* User beware: this will turn *anything* into a string, which might lead to results you don't expect.
*/
return jsonHelper.getStringFrom(rawValue); // depends on control dependency: [if], data = [none]
}
if (Integer.class.equals(type) || Integer.TYPE.equals(type)) {
return jsonHelper.getIntegerFrom(rawValue); // depends on control dependency: [if], data = [none]
}
if (Boolean.class.equals(type) || Boolean.TYPE.equals(type)) {
return jsonHelper.getBooleanFrom(rawValue); // depends on control dependency: [if], data = [none]
}
if (Long.class.equals(type) || Long.TYPE.equals(type)) {
return jsonHelper.getLongFrom(rawValue); // depends on control dependency: [if], data = [none]
}
if (Double.class.equals(type) || Double.TYPE.equals(type)) {
return jsonHelper.getDoubleFrom(rawValue); // depends on control dependency: [if], data = [none]
}
if (Float.class.equals(type) || Float.TYPE.equals(type)) {
return jsonHelper.getFloatFrom(rawValue); // depends on control dependency: [if], data = [none]
}
if (BigInteger.class.equals(type)) {
return jsonHelper.getBigIntegerFrom(rawValue); // depends on control dependency: [if], data = [none]
}
if (BigDecimal.class.equals(type)) {
return jsonHelper.getBigDecimalFrom(rawValue); // depends on control dependency: [if], data = [none]
}
if (List.class.equals(type)) {
return toJavaList(rawValue.toString(), getFirstParameterizedTypeArgument(fieldWithAnnotation.getField())); // depends on control dependency: [if], data = [none]
}
if (Map.class.equals(type)) {
return convertJsonObjectToMap(rawValue.toString(), fieldWithAnnotation.getField()); // depends on control dependency: [if], data = [none]
}
if (type.isEnum()) {
Class<? extends Enum> enumType = type.asSubclass(Enum.class);
try {
return Enum.valueOf(enumType, rawValue.asString()); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException iae) {
MAPPER_LOGGER.debug("Cannot map string {} to enum {}, try fallback toUpperString next...", rawValue.asString(),
enumType.getName());
} // depends on control dependency: [catch], data = [none]
try {
return Enum.valueOf(enumType, rawValue.asString().toUpperCase());
} catch (IllegalArgumentException iae) {
MAPPER_LOGGER.debug("Mapping string {} to enum {} not possible", rawValue.asString(), enumType.getName());
}
}
if (Date.class.equals(type)) {
return DateUtils.toDateFromLongFormat(jsonHelper.getStringFrom(rawValue));
}
String rawValueAsString = jsonHelper.getStringFrom(rawValue);
// Hack for issue #76 where FB will sometimes return a Post's Comments as
// "[]" instead of an object type (wtf)F
if (Comments.class.isAssignableFrom(type) && rawValue instanceof JsonArray) {
MAPPER_LOGGER.debug(
"Encountered comment array '{}' but expected a {} object instead. Working around that by coercing "
+ "into an empty {} instance...",
rawValueAsString, Comments.class.getSimpleName(), Comments.class.getSimpleName());
JsonObject workaroundJsonObject = new JsonObject();
workaroundJsonObject.add("total_count", 0);
workaroundJsonObject.add("data", new JsonArray());
rawValueAsString = workaroundJsonObject.toString();
}
// Some other type - recurse into it
return toJavaObject(rawValueAsString, type);
} } |
public class class_name {
@Override
public void report() {
for (Map.Entry<KeyType, Map<String, Map<String, List<SourceInfo>>>> entry : parmInfo.entrySet()) {
KeyType type = entry.getKey();
Map<String, Map<String, List<SourceInfo>>> typeMap = entry.getValue();
for (Map<String, List<SourceInfo>> parmCaseInfo : typeMap.values()) {
if (parmCaseInfo.size() > 1) {
BugInstance bi = new BugInstance(this, type.getDescription(), NORMAL_PRIORITY);
for (Map.Entry<String, List<SourceInfo>> sourceInfos : parmCaseInfo.entrySet()) {
for (SourceInfo sourceInfo : sourceInfos.getValue()) {
bi.addClass(sourceInfo.clsName);
bi.addMethod(sourceInfo.clsName, sourceInfo.methodName, sourceInfo.signature, sourceInfo.isStatic);
bi.addSourceLine(sourceInfo.srcLine);
bi.addString(sourceInfos.getKey());
}
}
bugReporter.reportBug(bi);
}
}
}
parmInfo.clear();
} } | public class class_name {
@Override
public void report() {
for (Map.Entry<KeyType, Map<String, Map<String, List<SourceInfo>>>> entry : parmInfo.entrySet()) {
KeyType type = entry.getKey();
Map<String, Map<String, List<SourceInfo>>> typeMap = entry.getValue();
for (Map<String, List<SourceInfo>> parmCaseInfo : typeMap.values()) {
if (parmCaseInfo.size() > 1) {
BugInstance bi = new BugInstance(this, type.getDescription(), NORMAL_PRIORITY);
for (Map.Entry<String, List<SourceInfo>> sourceInfos : parmCaseInfo.entrySet()) {
for (SourceInfo sourceInfo : sourceInfos.getValue()) {
bi.addClass(sourceInfo.clsName); // depends on control dependency: [for], data = [sourceInfo]
bi.addMethod(sourceInfo.clsName, sourceInfo.methodName, sourceInfo.signature, sourceInfo.isStatic); // depends on control dependency: [for], data = [sourceInfo]
bi.addSourceLine(sourceInfo.srcLine); // depends on control dependency: [for], data = [sourceInfo]
bi.addString(sourceInfos.getKey()); // depends on control dependency: [for], data = [sourceInfo]
}
}
bugReporter.reportBug(bi); // depends on control dependency: [if], data = [none]
}
}
}
parmInfo.clear();
} } |
public class class_name {
SchemaFactory createInstance( String className ) {
try {
if (debug) debugPrintln("instantiating "+className);
Class clazz;
if( classLoader!=null )
clazz = classLoader.loadClass(className);
else
clazz = Class.forName(className);
if(debug) debugPrintln("loaded it from "+which(clazz));
Object o = clazz.newInstance();
if( o instanceof SchemaFactory )
return (SchemaFactory)o;
if (debug) debugPrintln(className+" is not assignable to "+SERVICE_CLASS.getName());
}
// The VM ran out of memory or there was some other serious problem. Re-throw.
catch (VirtualMachineError vme) {
throw vme;
}
// ThreadDeath should always be re-thrown
catch (ThreadDeath td) {
throw td;
}
catch (Throwable t) {
debugPrintln("failed to instantiate "+className);
if(debug) t.printStackTrace();
}
return null;
} } | public class class_name {
SchemaFactory createInstance( String className ) {
try {
if (debug) debugPrintln("instantiating "+className);
Class clazz;
if( classLoader!=null )
clazz = classLoader.loadClass(className);
else
clazz = Class.forName(className);
if(debug) debugPrintln("loaded it from "+which(clazz));
Object o = clazz.newInstance();
if( o instanceof SchemaFactory )
return (SchemaFactory)o;
if (debug) debugPrintln(className+" is not assignable to "+SERVICE_CLASS.getName());
}
// The VM ran out of memory or there was some other serious problem. Re-throw.
catch (VirtualMachineError vme) {
throw vme;
} // depends on control dependency: [catch], data = [none]
// ThreadDeath should always be re-thrown
catch (ThreadDeath td) {
throw td;
} // depends on control dependency: [catch], data = [none]
catch (Throwable t) {
debugPrintln("failed to instantiate "+className);
if(debug) t.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public static RC5CBCParameter getInstance(Object obj)
{
if (obj instanceof RC5CBCParameter) {
return (RC5CBCParameter) obj;
}
if (obj != null) {
return new RC5CBCParameter(ASN1Sequence.getInstance(obj));
}
return null;
} } | public class class_name {
public static RC5CBCParameter getInstance(Object obj)
{
if (obj instanceof RC5CBCParameter) {
return (RC5CBCParameter) obj; // depends on control dependency: [if], data = [none]
}
if (obj != null) {
return new RC5CBCParameter(ASN1Sequence.getInstance(obj)); // depends on control dependency: [if], data = [(obj]
}
return null;
} } |
public class class_name {
private Expression handleThisSuffix(Java7Parser.PrimaryContext primaryContext, AdapterParameters adapterParameters) {
/*
thisSuffix
locals [int operationType]
: (LBRACKET expression RBRACKET)+ {$operationType = 1;}
| arguments {$operationType = 2;}
| DOT nonWildcardTypeArguments Identifier arguments {$operationType = 3;}
| innerCreator {$operationType = 4;}
;
//this.m.m.m[].class; // 0 : (LBRACKET RBRACKET)+ DOT CLASS // ClassOrInterfaceType ClassOrInterfaceType ClassOrInterfaceType ReferenceType ClassExpr
this.m.m.m[1]; // 1 | (LBRACKET expression RBRACKET)+ // NameExpr FieldAccessExpr FieldAccessExpr ArrayAccessExpr
this.m.m.m(""); // 2 | arguments // NameExpr FieldAccessExpr MethodCallExpr
//this.m.m.m.class; // 3 | DOT CLASS // ClassOrInterfaceType ClassOrInterfaceType ClassOrInterfaceType ReferenceType ClassExpr
this.m.m.<T>m(""); // 4 | DOT nonWildcardTypeArguments Identifier arguments // NameExpr FieldAccessExpr MethodCallExpr
this.m.m.m.this; // 5 | DOT THIS // NameExpr FieldAccessExpr FieldAccessExpr ThisExpr
//m.m.super(""); // 6 | DOT SUPER arguments
*/
ThisExpr thisExpr = new ThisExpr();
Expression leftExpression = thisExpr;
for (int i = 0; i < primaryContext.Identifier().size(); i++) {
FieldAccessExpr fieldAccessExpr = new FieldAccessExpr();
fieldAccessExpr.setField(primaryContext.Identifier(i).getText());
fieldAccessExpr.setScope(leftExpression);
leftExpression = fieldAccessExpr;
}
// if thisSuffix is null/not specified
if (primaryContext.thisSuffix() == null) {
return leftExpression;
}
ClassOrInterfaceType rootType = new ClassOrInterfaceType();
if (primaryContext.Identifier() != null && primaryContext.Identifier().size() > 0) {
rootType.setName(primaryContext.Identifier(0).getText());
}
switch (primaryContext.thisSuffix().operationType) {
case 1:
for (int i = 0; i < primaryContext.thisSuffix().LBRACKET().size(); i++) {
ArrayAccessExpr arrayAccessExpr = new ArrayAccessExpr();
arrayAccessExpr.setName(leftExpression);
arrayAccessExpr.setIndex(Adapters.getExpressionContextAdapter().adapt(primaryContext.thisSuffix().expression(i), adapterParameters));
leftExpression = arrayAccessExpr;
}
return leftExpression;
case 2:
MethodCallExpr methodCallExpr = new MethodCallExpr();
if (leftExpression instanceof FieldAccessExpr) {
methodCallExpr.setName(((FieldAccessExpr)leftExpression).getField());
// Set the leftExpression back one since we're changing the top one to a method call
leftExpression = ((FieldAccessExpr) leftExpression).getScope();
methodCallExpr.setScope(leftExpression);
}
if (methodCallExpr.getName() == null) {
throw new RuntimeException("Syntax Error: possibly calling 'this' as a method with arguments. Something like 'this(\"\")'");
}
methodCallExpr.setArgs(Adapters.getArgumentsContextAdapter().adapt(primaryContext.thisSuffix().arguments(), adapterParameters));
leftExpression = methodCallExpr;
return leftExpression;
case 3:
List<Type> typeList = Adapters.getTypeListContextAdapter().adapt(primaryContext.thisSuffix().nonWildcardTypeArguments().typeList(), adapterParameters);
MethodCallExpr typeArgMethodCallExpr = new MethodCallExpr();
typeArgMethodCallExpr.setName(primaryContext.thisSuffix().Identifier().getText());
typeArgMethodCallExpr.setTypeArgs(typeList);
typeArgMethodCallExpr.setScope(leftExpression);
typeArgMethodCallExpr.setArgs(Adapters.getArgumentsContextAdapter().adapt(primaryContext.thisSuffix().arguments(), adapterParameters));
leftExpression = typeArgMethodCallExpr;
return leftExpression;
case 4:
ObjectCreationExpr objectCreationExpr = Adapters.getInnerCreatorContextAdapter().adapt(primaryContext.thisSuffix().innerCreator(), adapterParameters);
objectCreationExpr.setScope(leftExpression);
return objectCreationExpr;
}
return null;
} } | public class class_name {
private Expression handleThisSuffix(Java7Parser.PrimaryContext primaryContext, AdapterParameters adapterParameters) {
/*
thisSuffix
locals [int operationType]
: (LBRACKET expression RBRACKET)+ {$operationType = 1;}
| arguments {$operationType = 2;}
| DOT nonWildcardTypeArguments Identifier arguments {$operationType = 3;}
| innerCreator {$operationType = 4;}
;
//this.m.m.m[].class; // 0 : (LBRACKET RBRACKET)+ DOT CLASS // ClassOrInterfaceType ClassOrInterfaceType ClassOrInterfaceType ReferenceType ClassExpr
this.m.m.m[1]; // 1 | (LBRACKET expression RBRACKET)+ // NameExpr FieldAccessExpr FieldAccessExpr ArrayAccessExpr
this.m.m.m(""); // 2 | arguments // NameExpr FieldAccessExpr MethodCallExpr
//this.m.m.m.class; // 3 | DOT CLASS // ClassOrInterfaceType ClassOrInterfaceType ClassOrInterfaceType ReferenceType ClassExpr
this.m.m.<T>m(""); // 4 | DOT nonWildcardTypeArguments Identifier arguments // NameExpr FieldAccessExpr MethodCallExpr
this.m.m.m.this; // 5 | DOT THIS // NameExpr FieldAccessExpr FieldAccessExpr ThisExpr
//m.m.super(""); // 6 | DOT SUPER arguments
*/
ThisExpr thisExpr = new ThisExpr();
Expression leftExpression = thisExpr;
for (int i = 0; i < primaryContext.Identifier().size(); i++) {
FieldAccessExpr fieldAccessExpr = new FieldAccessExpr();
fieldAccessExpr.setField(primaryContext.Identifier(i).getText()); // depends on control dependency: [for], data = [i]
fieldAccessExpr.setScope(leftExpression); // depends on control dependency: [for], data = [none]
leftExpression = fieldAccessExpr; // depends on control dependency: [for], data = [none]
}
// if thisSuffix is null/not specified
if (primaryContext.thisSuffix() == null) {
return leftExpression; // depends on control dependency: [if], data = [none]
}
ClassOrInterfaceType rootType = new ClassOrInterfaceType();
if (primaryContext.Identifier() != null && primaryContext.Identifier().size() > 0) {
rootType.setName(primaryContext.Identifier(0).getText()); // depends on control dependency: [if], data = [none]
}
switch (primaryContext.thisSuffix().operationType) {
case 1:
for (int i = 0; i < primaryContext.thisSuffix().LBRACKET().size(); i++) {
ArrayAccessExpr arrayAccessExpr = new ArrayAccessExpr();
arrayAccessExpr.setName(leftExpression); // depends on control dependency: [for], data = [none]
arrayAccessExpr.setIndex(Adapters.getExpressionContextAdapter().adapt(primaryContext.thisSuffix().expression(i), adapterParameters)); // depends on control dependency: [for], data = [i]
leftExpression = arrayAccessExpr; // depends on control dependency: [for], data = [none]
}
return leftExpression;
case 2:
MethodCallExpr methodCallExpr = new MethodCallExpr();
if (leftExpression instanceof FieldAccessExpr) {
methodCallExpr.setName(((FieldAccessExpr)leftExpression).getField()); // depends on control dependency: [if], data = [none]
// Set the leftExpression back one since we're changing the top one to a method call
leftExpression = ((FieldAccessExpr) leftExpression).getScope(); // depends on control dependency: [if], data = [none]
methodCallExpr.setScope(leftExpression); // depends on control dependency: [if], data = [none]
}
if (methodCallExpr.getName() == null) {
throw new RuntimeException("Syntax Error: possibly calling 'this' as a method with arguments. Something like 'this(\"\")'");
}
methodCallExpr.setArgs(Adapters.getArgumentsContextAdapter().adapt(primaryContext.thisSuffix().arguments(), adapterParameters));
leftExpression = methodCallExpr;
return leftExpression;
case 3:
List<Type> typeList = Adapters.getTypeListContextAdapter().adapt(primaryContext.thisSuffix().nonWildcardTypeArguments().typeList(), adapterParameters);
MethodCallExpr typeArgMethodCallExpr = new MethodCallExpr();
typeArgMethodCallExpr.setName(primaryContext.thisSuffix().Identifier().getText());
typeArgMethodCallExpr.setTypeArgs(typeList);
typeArgMethodCallExpr.setScope(leftExpression);
typeArgMethodCallExpr.setArgs(Adapters.getArgumentsContextAdapter().adapt(primaryContext.thisSuffix().arguments(), adapterParameters));
leftExpression = typeArgMethodCallExpr;
return leftExpression;
case 4:
ObjectCreationExpr objectCreationExpr = Adapters.getInnerCreatorContextAdapter().adapt(primaryContext.thisSuffix().innerCreator(), adapterParameters);
objectCreationExpr.setScope(leftExpression);
return objectCreationExpr;
}
return null;
} } |
public class class_name {
public static boolean startDefaultHandlers(HttpServerExchange httpServerExchange) {
// check if defaultHandlers is empty
if(defaultHandlers != null && defaultHandlers.size() > 0) {
httpServerExchange.putAttachment(CHAIN_ID, "defaultHandlers");
httpServerExchange.putAttachment(CHAIN_SEQ, 0);
return true;
}
return false;
} } | public class class_name {
public static boolean startDefaultHandlers(HttpServerExchange httpServerExchange) {
// check if defaultHandlers is empty
if(defaultHandlers != null && defaultHandlers.size() > 0) {
httpServerExchange.putAttachment(CHAIN_ID, "defaultHandlers"); // depends on control dependency: [if], data = [none]
httpServerExchange.putAttachment(CHAIN_SEQ, 0); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
private JSONObject appendDebugParams(JSONObject originalParams) {
try {
if (originalParams != null && deeplinkDebugParams_ != null) {
if (deeplinkDebugParams_.length() > 0) {
PrefHelper.Debug("You're currently in deep link debug mode. Please comment out 'setDeepLinkDebugMode' to receive the deep link parameters from a real Branch link");
}
Iterator<String> keys = deeplinkDebugParams_.keys();
while (keys.hasNext()) {
String key = keys.next();
originalParams.put(key, deeplinkDebugParams_.get(key));
}
}
} catch (Exception ignore) {
}
return originalParams;
} } | public class class_name {
private JSONObject appendDebugParams(JSONObject originalParams) {
try {
if (originalParams != null && deeplinkDebugParams_ != null) {
if (deeplinkDebugParams_.length() > 0) {
PrefHelper.Debug("You're currently in deep link debug mode. Please comment out 'setDeepLinkDebugMode' to receive the deep link parameters from a real Branch link"); // depends on control dependency: [if], data = [none]
}
Iterator<String> keys = deeplinkDebugParams_.keys();
while (keys.hasNext()) {
String key = keys.next();
originalParams.put(key, deeplinkDebugParams_.get(key)); // depends on control dependency: [while], data = [none]
}
}
} catch (Exception ignore) {
} // depends on control dependency: [catch], data = [none]
return originalParams;
} } |
public class class_name {
public void marshall(StartLambdaFunctionFailedEventAttributes startLambdaFunctionFailedEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (startLambdaFunctionFailedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startLambdaFunctionFailedEventAttributes.getScheduledEventId(), SCHEDULEDEVENTID_BINDING);
protocolMarshaller.marshall(startLambdaFunctionFailedEventAttributes.getCause(), CAUSE_BINDING);
protocolMarshaller.marshall(startLambdaFunctionFailedEventAttributes.getMessage(), MESSAGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(StartLambdaFunctionFailedEventAttributes startLambdaFunctionFailedEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (startLambdaFunctionFailedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startLambdaFunctionFailedEventAttributes.getScheduledEventId(), SCHEDULEDEVENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startLambdaFunctionFailedEventAttributes.getCause(), CAUSE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startLambdaFunctionFailedEventAttributes.getMessage(), MESSAGE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public IndividualHelper externalIndividual(final URI uri) {
Individual<?, ?> individual=null;
if(uri.isAbsolute()) {
individual=this.dataSet.individual(uri, ExternalIndividual.class);
} else {
individual=this.dataSet.individual(uri, NewIndividual.class);
}
return new IndividualHelperImpl(individual);
} } | public class class_name {
@Override
public IndividualHelper externalIndividual(final URI uri) {
Individual<?, ?> individual=null;
if(uri.isAbsolute()) {
individual=this.dataSet.individual(uri, ExternalIndividual.class); // depends on control dependency: [if], data = [none]
} else {
individual=this.dataSet.individual(uri, NewIndividual.class); // depends on control dependency: [if], data = [none]
}
return new IndividualHelperImpl(individual);
} } |
public class class_name {
private static synchronized Database getDatabaseObject(String type,
String path, HsqlProperties props) {
Database db;
String key = path;
// A VoltDB extension to work around ENG-6044
/* disable 13 lines ...
HashMap databaseMap;
if (type == DatabaseURL.S_FILE) {
databaseMap = fileDatabaseMap;
key = filePathToKey(path);
} else if (type == DatabaseURL.S_RES) {
databaseMap = resDatabaseMap;
} else if (type == DatabaseURL.S_MEM) {
databaseMap = memDatabaseMap;
} else {
throw Error.runtimeError(ErrorCode.U_S0500,
"DatabaseManager.getDatabaseObject");
}
... disabled 13 lines */
assert (type == DatabaseURL.S_MEM);
java.util.HashMap<String, Database> databaseMap = memDatabaseMap;
// End of VoltDB extension
db = (Database) databaseMap.get(key);
if (db == null) {
db = new Database(type, path, type + key, props);
db.databaseID = dbIDCounter;
databaseIDMap.put(dbIDCounter, db);
dbIDCounter++;
databaseMap.put(key, db);
}
return db;
} } | public class class_name {
private static synchronized Database getDatabaseObject(String type,
String path, HsqlProperties props) {
Database db;
String key = path;
// A VoltDB extension to work around ENG-6044
/* disable 13 lines ...
HashMap databaseMap;
if (type == DatabaseURL.S_FILE) {
databaseMap = fileDatabaseMap;
key = filePathToKey(path);
} else if (type == DatabaseURL.S_RES) {
databaseMap = resDatabaseMap;
} else if (type == DatabaseURL.S_MEM) {
databaseMap = memDatabaseMap;
} else {
throw Error.runtimeError(ErrorCode.U_S0500,
"DatabaseManager.getDatabaseObject");
}
... disabled 13 lines */
assert (type == DatabaseURL.S_MEM);
java.util.HashMap<String, Database> databaseMap = memDatabaseMap;
// End of VoltDB extension
db = (Database) databaseMap.get(key);
if (db == null) {
db = new Database(type, path, type + key, props); // depends on control dependency: [if], data = [none]
db.databaseID = dbIDCounter; // depends on control dependency: [if], data = [none]
databaseIDMap.put(dbIDCounter, db); // depends on control dependency: [if], data = [(db]
dbIDCounter++; // depends on control dependency: [if], data = [none]
databaseMap.put(key, db); // depends on control dependency: [if], data = [none]
}
return db;
} } |
public class class_name {
@Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPDefinition cpDefinition : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition);
}
} } | public class class_name {
@Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPDefinition cpDefinition : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition); // depends on control dependency: [for], data = [cpDefinition]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.