code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public void setPuName(String puName)
{
// re-initialize puName only if it has not been set to avoid
// overriding valid relative puName defined in annotation/dd.
if (ivPuName == null || ivPuName.length() == 0) // d442457
{
ivPuName = puName;
reComputeHashCode(); // d416151.3.9
}
} } | public class class_name {
public void setPuName(String puName)
{
// re-initialize puName only if it has not been set to avoid
// overriding valid relative puName defined in annotation/dd.
if (ivPuName == null || ivPuName.length() == 0) // d442457
{
ivPuName = puName; // depends on control dependency: [if], data = [none]
reComputeHashCode(); // d416151.3.9 // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int compareTo(EntryPosition o) {
final int val = journalName.compareTo(o.journalName);
if (val == 0) {
return (int) (position - o.position);
}
return val;
} } | public class class_name {
public int compareTo(EntryPosition o) {
final int val = journalName.compareTo(o.journalName);
if (val == 0) {
return (int) (position - o.position); // depends on control dependency: [if], data = [none]
}
return val;
} } |
public class class_name {
public Set<Group> findGroups(final User user, final boolean inheritOnly)
{
final Set<Group> result = new HashSet<Group>();
List<Group> stack;
// Recursively find user groups
for(final Group group : this.getRootGroups())
{
stack = new ArrayList<Group>();
this.addGroups(user, result, group, stack, inheritOnly);
}
return result;
} } | public class class_name {
public Set<Group> findGroups(final User user, final boolean inheritOnly)
{
final Set<Group> result = new HashSet<Group>();
List<Group> stack;
// Recursively find user groups
for(final Group group : this.getRootGroups())
{
stack = new ArrayList<Group>(); // depends on control dependency: [for], data = [none]
this.addGroups(user, result, group, stack, inheritOnly); // depends on control dependency: [for], data = [group]
}
return result;
} } |
public class class_name {
public FunctionConfigurationEnvironment withResourceAccessPolicies(ResourceAccessPolicy... resourceAccessPolicies) {
if (this.resourceAccessPolicies == null) {
setResourceAccessPolicies(new java.util.ArrayList<ResourceAccessPolicy>(resourceAccessPolicies.length));
}
for (ResourceAccessPolicy ele : resourceAccessPolicies) {
this.resourceAccessPolicies.add(ele);
}
return this;
} } | public class class_name {
public FunctionConfigurationEnvironment withResourceAccessPolicies(ResourceAccessPolicy... resourceAccessPolicies) {
if (this.resourceAccessPolicies == null) {
setResourceAccessPolicies(new java.util.ArrayList<ResourceAccessPolicy>(resourceAccessPolicies.length)); // depends on control dependency: [if], data = [none]
}
for (ResourceAccessPolicy ele : resourceAccessPolicies) {
this.resourceAccessPolicies.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static <T1> TypeAdapterFactory newTypeHierarchyFactory(
final Class<T1> clazz, final TypeAdapter<T1> typeAdapter) {
return new TypeAdapterFactory() {
@SuppressWarnings("unchecked")
@Override public <T2> TypeAdapter<T2> create(Gson gson, TypeToken<T2> typeToken) {
final Class<? super T2> requestedType = typeToken.getRawType();
if (!clazz.isAssignableFrom(requestedType)) {
return null;
}
return (TypeAdapter<T2>) new TypeAdapter<T1>() {
@Override public void write(JsonWriter out, T1 value) throws IOException {
typeAdapter.write(out, value);
}
@Override public T1 read(JsonReader in) throws IOException {
T1 result = typeAdapter.read(in);
if (result != null && !requestedType.isInstance(result)) {
throw new JsonSyntaxException("Expected a " + requestedType.getName()
+ " but was " + result.getClass().getName());
}
return result;
}
};
}
@Override public String toString() {
return "Factory[typeHierarchy=" + clazz.getName() + ",adapter=" + typeAdapter + "]";
}
};
} } | public class class_name {
public static <T1> TypeAdapterFactory newTypeHierarchyFactory(
final Class<T1> clazz, final TypeAdapter<T1> typeAdapter) {
return new TypeAdapterFactory() {
@SuppressWarnings("unchecked")
@Override public <T2> TypeAdapter<T2> create(Gson gson, TypeToken<T2> typeToken) {
final Class<? super T2> requestedType = typeToken.getRawType();
if (!clazz.isAssignableFrom(requestedType)) {
return null; // depends on control dependency: [if], data = [none]
}
return (TypeAdapter<T2>) new TypeAdapter<T1>() {
@Override public void write(JsonWriter out, T1 value) throws IOException {
typeAdapter.write(out, value);
}
@Override public T1 read(JsonReader in) throws IOException {
T1 result = typeAdapter.read(in);
if (result != null && !requestedType.isInstance(result)) {
throw new JsonSyntaxException("Expected a " + requestedType.getName()
+ " but was " + result.getClass().getName());
}
return result;
}
};
}
@Override public String toString() {
return "Factory[typeHierarchy=" + clazz.getName() + ",adapter=" + typeAdapter + "]";
}
};
} } |
public class class_name {
@Deprecated
public long getAccessExpires() {
Session s = getSession();
if (s != null) {
return s.getExpirationDate().getTime();
} else {
return accessExpiresMillisecondsAfterEpoch;
}
} } | public class class_name {
@Deprecated
public long getAccessExpires() {
Session s = getSession();
if (s != null) {
return s.getExpirationDate().getTime(); // depends on control dependency: [if], data = [none]
} else {
return accessExpiresMillisecondsAfterEpoch; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static List<String> filterDelimeterElement(List<String> arr, char[] delimeter){
List<String> list = new ArrayList<String>();
for(String s : arr){
if(s == null || s.isEmpty()){
continue;
}
if(s.length() > 1){
list.add(s);
continue;
}
char strChar = s.charAt(0);
boolean find = false;
for(char c : delimeter){
if(c == strChar){
find = true;
break;
}
}
if(find == false){
list.add(s);
}
}
return list;
} } | public class class_name {
private static List<String> filterDelimeterElement(List<String> arr, char[] delimeter){
List<String> list = new ArrayList<String>();
for(String s : arr){
if(s == null || s.isEmpty()){
continue;
}
if(s.length() > 1){
list.add(s); // depends on control dependency: [if], data = [none]
continue;
}
char strChar = s.charAt(0);
boolean find = false;
for(char c : delimeter){
if(c == strChar){
find = true; // depends on control dependency: [if], data = [none]
break;
}
}
if(find == false){
list.add(s); // depends on control dependency: [if], data = [none]
}
}
return list;
} } |
public class class_name {
private JButton getBtnOK() {
if (btnOK == null) {
btnOK = new JButton();
btnOK.setName("btnOK");
btnOK.setText(Constant.messages.getString("all.button.ok"));
btnOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
validateParam();
saveParam();
exitResult = JOptionPane.OK_OPTION;
AbstractParamDialog.this.setVisible(false);
} catch (NullPointerException ex) {
LOGGER.error("Failed to validate or save the panels: ", ex);
showSaveErrorDialog(ex.getMessage());
} catch (Exception ex) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Failed to validate or save the panels: ", ex);
}
showSaveErrorDialog(ex.getMessage());
}
}
});
}
return btnOK;
} } | public class class_name {
private JButton getBtnOK() {
if (btnOK == null) {
btnOK = new JButton(); // depends on control dependency: [if], data = [none]
btnOK.setName("btnOK"); // depends on control dependency: [if], data = [none]
btnOK.setText(Constant.messages.getString("all.button.ok")); // depends on control dependency: [if], data = [none]
btnOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
validateParam(); // depends on control dependency: [try], data = [none]
saveParam(); // depends on control dependency: [try], data = [none]
exitResult = JOptionPane.OK_OPTION; // depends on control dependency: [try], data = [none]
AbstractParamDialog.this.setVisible(false); // depends on control dependency: [try], data = [none]
} catch (NullPointerException ex) {
LOGGER.error("Failed to validate or save the panels: ", ex);
showSaveErrorDialog(ex.getMessage());
} catch (Exception ex) { // depends on control dependency: [catch], data = [none]
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Failed to validate or save the panels: ", ex); // depends on control dependency: [if], data = [none]
}
showSaveErrorDialog(ex.getMessage());
} // depends on control dependency: [catch], data = [none]
}
}); // depends on control dependency: [if], data = [none]
}
return btnOK;
} } |
public class class_name {
public static <T extends ImageGray<T>> StereoDisparitySparse<T>
regionSparseWta( int minDisparity , int maxDisparity,
int regionRadiusX, int regionRadiusY ,
double maxPerPixelError ,
double texture ,
boolean subpixelInterpolation ,
Class<T> imageType ) {
double maxError = (regionRadiusX*2+1)*(regionRadiusY*2+1)*maxPerPixelError;
if( imageType == GrayU8.class ) {
DisparitySparseSelect<int[]> select;
if( subpixelInterpolation)
select = selectDisparitySparseSubpixel_S32((int) maxError, texture);
else
select = selectDisparitySparse_S32((int) maxError, texture);
DisparitySparseScoreSadRect<int[],GrayU8>
score = scoreDisparitySparseSadRect_U8(minDisparity,maxDisparity, regionRadiusX, regionRadiusY);
return new WrapDisparitySparseSadRect(score,select);
} else if( imageType == GrayF32.class ) {
DisparitySparseSelect<float[]> select;
if( subpixelInterpolation )
select = selectDisparitySparseSubpixel_F32((int) maxError, texture);
else
select = selectDisparitySparse_F32((int) maxError, texture);
DisparitySparseScoreSadRect<float[],GrayF32>
score = scoreDisparitySparseSadRect_F32(minDisparity,maxDisparity, regionRadiusX, regionRadiusY);
return new WrapDisparitySparseSadRect(score,select);
} else
throw new RuntimeException("Image type not supported: "+imageType.getSimpleName() );
} } | public class class_name {
public static <T extends ImageGray<T>> StereoDisparitySparse<T>
regionSparseWta( int minDisparity , int maxDisparity,
int regionRadiusX, int regionRadiusY ,
double maxPerPixelError ,
double texture ,
boolean subpixelInterpolation ,
Class<T> imageType ) {
double maxError = (regionRadiusX*2+1)*(regionRadiusY*2+1)*maxPerPixelError;
if( imageType == GrayU8.class ) {
DisparitySparseSelect<int[]> select;
if( subpixelInterpolation)
select = selectDisparitySparseSubpixel_S32((int) maxError, texture);
else
select = selectDisparitySparse_S32((int) maxError, texture);
DisparitySparseScoreSadRect<int[],GrayU8>
score = scoreDisparitySparseSadRect_U8(minDisparity,maxDisparity, regionRadiusX, regionRadiusY);
return new WrapDisparitySparseSadRect(score,select); // depends on control dependency: [if], data = [none]
} else if( imageType == GrayF32.class ) {
DisparitySparseSelect<float[]> select;
if( subpixelInterpolation )
select = selectDisparitySparseSubpixel_F32((int) maxError, texture);
else
select = selectDisparitySparse_F32((int) maxError, texture);
DisparitySparseScoreSadRect<float[],GrayF32>
score = scoreDisparitySparseSadRect_F32(minDisparity,maxDisparity, regionRadiusX, regionRadiusY);
return new WrapDisparitySparseSadRect(score,select); // depends on control dependency: [if], data = [none]
} else
throw new RuntimeException("Image type not supported: "+imageType.getSimpleName() );
} } |
public class class_name {
public void setDeletedResources(java.util.Collection<Resource> deletedResources) {
if (deletedResources == null) {
this.deletedResources = null;
return;
}
this.deletedResources = new java.util.ArrayList<Resource>(deletedResources);
} } | public class class_name {
public void setDeletedResources(java.util.Collection<Resource> deletedResources) {
if (deletedResources == null) {
this.deletedResources = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.deletedResources = new java.util.ArrayList<Resource>(deletedResources);
} } |
public class class_name {
private WaveformPreview requestPreviewInternal(final DataReference trackReference, final boolean failIfPassive) {
// First check if we are using cached data for this slot
MetadataCache cache = MetadataFinder.getInstance().getMetadataCache(SlotReference.getSlotReference(trackReference));
if (cache != null) {
return cache.getWaveformPreview(null, trackReference);
}
// Then see if any registered metadata providers can offer it for us.
final MediaDetails sourceDetails = MetadataFinder.getInstance().getMediaDetailsFor(trackReference.getSlotReference());
if (sourceDetails != null) {
final WaveformPreview provided = MetadataFinder.getInstance().allMetadataProviders.getWaveformPreview(sourceDetails, trackReference);
if (provided != null) {
return provided;
}
}
// At this point, unless we are allowed to actively request the data, we are done. We can always actively
// request tracks from rekordbox.
if (MetadataFinder.getInstance().isPassive() && failIfPassive && trackReference.slot != CdjStatus.TrackSourceSlot.COLLECTION) {
return null;
}
// We have to actually request the preview using the dbserver protocol.
ConnectionManager.ClientTask<WaveformPreview> task = new ConnectionManager.ClientTask<WaveformPreview>() {
@Override
public WaveformPreview useClient(Client client) throws Exception {
return getWaveformPreview(trackReference.rekordboxId, SlotReference.getSlotReference(trackReference), client);
}
};
try {
return ConnectionManager.getInstance().invokeWithClientSession(trackReference.player, task, "requesting waveform preview");
} catch (Exception e) {
logger.error("Problem requesting waveform preview, returning null", e);
}
return null;
} } | public class class_name {
private WaveformPreview requestPreviewInternal(final DataReference trackReference, final boolean failIfPassive) {
// First check if we are using cached data for this slot
MetadataCache cache = MetadataFinder.getInstance().getMetadataCache(SlotReference.getSlotReference(trackReference));
if (cache != null) {
return cache.getWaveformPreview(null, trackReference); // depends on control dependency: [if], data = [none]
}
// Then see if any registered metadata providers can offer it for us.
final MediaDetails sourceDetails = MetadataFinder.getInstance().getMediaDetailsFor(trackReference.getSlotReference());
if (sourceDetails != null) {
final WaveformPreview provided = MetadataFinder.getInstance().allMetadataProviders.getWaveformPreview(sourceDetails, trackReference);
if (provided != null) {
return provided; // depends on control dependency: [if], data = [none]
}
}
// At this point, unless we are allowed to actively request the data, we are done. We can always actively
// request tracks from rekordbox.
if (MetadataFinder.getInstance().isPassive() && failIfPassive && trackReference.slot != CdjStatus.TrackSourceSlot.COLLECTION) {
return null; // depends on control dependency: [if], data = [none]
}
// We have to actually request the preview using the dbserver protocol.
ConnectionManager.ClientTask<WaveformPreview> task = new ConnectionManager.ClientTask<WaveformPreview>() {
@Override
public WaveformPreview useClient(Client client) throws Exception {
return getWaveformPreview(trackReference.rekordboxId, SlotReference.getSlotReference(trackReference), client);
}
};
try {
return ConnectionManager.getInstance().invokeWithClientSession(trackReference.player, task, "requesting waveform preview"); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("Problem requesting waveform preview, returning null", e);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public boolean selectAll() {
boolean result = false;
WebElement element = getActiveElement();
if (element != null) {
if (connectedToMac()) {
executeJavascript("arguments[0].select()", element);
} else {
element.sendKeys(Keys.CONTROL, "a");
}
result = true;
}
return result;
} } | public class class_name {
public boolean selectAll() {
boolean result = false;
WebElement element = getActiveElement();
if (element != null) {
if (connectedToMac()) {
executeJavascript("arguments[0].select()", element); // depends on control dependency: [if], data = [none]
} else {
element.sendKeys(Keys.CONTROL, "a"); // depends on control dependency: [if], data = [none]
}
result = true; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
static void init() {
Callback temporaryDebugCallback = new SystemDebugCallback();
manager.callback().addCallback(temporaryDebugCallback); // just for reporting warnings, will be removed
try {
manager.configuration().clear();
String fileName = System.getProperty(PROPERTY_CONFIG_FILE_NAME);
if (fileName != null) {
try (FileReader fileReader = new FileReader(fileName)) {
manager.configuration().readConfig(fileReader);
}
}
String resourceName = System.getProperty(PROPERTY_CONFIG_RESOURCE_NAME);
if (resourceName != null) {
InputStream is = SimonManager.class.getClassLoader().getResourceAsStream(resourceName);
if (is == null) {
throw new FileNotFoundException(resourceName);
}
manager.configuration().readConfig(new InputStreamReader(is));
}
} catch (Exception e) {
manager.callback().onManagerWarning("SimonManager initialization error", e);
}
manager.callback().removeCallback(temporaryDebugCallback);
} } | public class class_name {
static void init() {
Callback temporaryDebugCallback = new SystemDebugCallback();
manager.callback().addCallback(temporaryDebugCallback); // just for reporting warnings, will be removed
try {
manager.configuration().clear();
String fileName = System.getProperty(PROPERTY_CONFIG_FILE_NAME);
if (fileName != null) {
try (FileReader fileReader = new FileReader(fileName)) {
manager.configuration().readConfig(fileReader);
}
}
String resourceName = System.getProperty(PROPERTY_CONFIG_RESOURCE_NAME);
if (resourceName != null) {
InputStream is = SimonManager.class.getClassLoader().getResourceAsStream(resourceName);
if (is == null) {
throw new FileNotFoundException(resourceName);
}
manager.configuration().readConfig(new InputStreamReader(is)); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
manager.callback().onManagerWarning("SimonManager initialization error", e);
}
manager.callback().removeCallback(temporaryDebugCallback);
} } |
public class class_name {
public void moveToStartOfLine() {
String currentLine = getContent(getLine());
LinkedList<String> toDisplayLines = toDisplayLines(currentLine);
int remainingLines = toDisplayLines.size() - getColumn() / terminal.getWidth();
for (int r = 0; r < remainingLines; r++) {
toDisplayLines.removeLast();
}
frameColumn = 1;
delegate.moveToStartOfLine();
for (int l = toDisplayLines.size() - 1; l >= 0; l--) {
frameLine--;
if (frameLine <= 0) {
frameLine = 1;
scrollDown(1);
console.out().print(ansi().cursor(frameLine + getHeaderSize(), 1));
displayText(toDisplayLines.get(l));
console.out().print(ansi().cursor(frameLine + getHeaderSize(), getColumn()));
}
}
console.out().print(ansi().cursor(frameLine + getHeaderSize(), frameColumn));
} } | public class class_name {
public void moveToStartOfLine() {
String currentLine = getContent(getLine());
LinkedList<String> toDisplayLines = toDisplayLines(currentLine);
int remainingLines = toDisplayLines.size() - getColumn() / terminal.getWidth();
for (int r = 0; r < remainingLines; r++) {
toDisplayLines.removeLast(); // depends on control dependency: [for], data = [none]
}
frameColumn = 1;
delegate.moveToStartOfLine();
for (int l = toDisplayLines.size() - 1; l >= 0; l--) {
frameLine--; // depends on control dependency: [for], data = [none]
if (frameLine <= 0) {
frameLine = 1; // depends on control dependency: [if], data = [none]
scrollDown(1); // depends on control dependency: [if], data = [none]
console.out().print(ansi().cursor(frameLine + getHeaderSize(), 1)); // depends on control dependency: [if], data = [(frameLine]
displayText(toDisplayLines.get(l)); // depends on control dependency: [if], data = [none]
console.out().print(ansi().cursor(frameLine + getHeaderSize(), getColumn())); // depends on control dependency: [if], data = [(frameLine]
}
}
console.out().print(ansi().cursor(frameLine + getHeaderSize(), frameColumn));
} } |
public class class_name {
public Observable<ServiceResponse<EventHubConsumerGroupInfoInner>> getEventHubConsumerGroupWithServiceResponseAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (eventHubEndpointName == null) {
throw new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.getEventHubConsumerGroup(this.client.subscriptionId(), resourceGroupName, resourceName, eventHubEndpointName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<EventHubConsumerGroupInfoInner>>>() {
@Override
public Observable<ServiceResponse<EventHubConsumerGroupInfoInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<EventHubConsumerGroupInfoInner> clientResponse = getEventHubConsumerGroupDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<EventHubConsumerGroupInfoInner>> getEventHubConsumerGroupWithServiceResponseAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (eventHubEndpointName == null) {
throw new IllegalArgumentException("Parameter eventHubEndpointName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.getEventHubConsumerGroup(this.client.subscriptionId(), resourceGroupName, resourceName, eventHubEndpointName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<EventHubConsumerGroupInfoInner>>>() {
@Override
public Observable<ServiceResponse<EventHubConsumerGroupInfoInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<EventHubConsumerGroupInfoInner> clientResponse = getEventHubConsumerGroupDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
@Override
protected void initializeImpl(Map<String,String> configuration)
{
//create configuration holder
ConfigurationHolder configurationHolder=new ConfigurationHolderImpl(configuration);
this.fileContentParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.FILE_CONTENT_PARAMETER_NAME_PROPERTY_KEY);
if(this.fileContentParameter==null)
{
this.fileContentParameter="file";
}
this.fileNameParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.FILE_NAME_PARAMETER_NAME_PROPERTY_KEY);
if(this.fileNameParameter==null)
{
this.fileNameParameter="filename";
}
this.priorityParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.PRIORITY_PARAMETER_NAME_PROPERTY_KEY);
if(this.priorityParameter==null)
{
this.priorityParameter="priority";
}
this.targetAddressParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.TARGET_ADDRESS_PARAMETER_NAME_PROPERTY_KEY);
if(this.targetAddressParameter==null)
{
this.targetAddressParameter="targetaddress";
}
this.targetNameParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.TARGET_NAME_PARAMETER_NAME_PROPERTY_KEY);
if(this.targetNameParameter==null)
{
this.targetNameParameter="targetname";
}
this.senderNameParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.SENDER_NAME_PARAMETER_NAME_PROPERTY_KEY);
if(this.senderNameParameter==null)
{
this.senderNameParameter="sendername";
}
this.senderFaxNumberParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.SENDER_FAX_NUMBER_PARAMETER_NAME_PROPERTY_KEY);
if(this.senderFaxNumberParameter==null)
{
this.senderFaxNumberParameter="senderfaxnumber";
}
this.senderEMailParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.SENDER_EMAIL_PARAMETER_NAME_PROPERTY_KEY);
if(this.senderEMailParameter==null)
{
this.senderEMailParameter="senderemail";
}
} } | public class class_name {
@Override
protected void initializeImpl(Map<String,String> configuration)
{
//create configuration holder
ConfigurationHolder configurationHolder=new ConfigurationHolderImpl(configuration);
this.fileContentParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.FILE_CONTENT_PARAMETER_NAME_PROPERTY_KEY);
if(this.fileContentParameter==null)
{
this.fileContentParameter="file"; // depends on control dependency: [if], data = [none]
}
this.fileNameParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.FILE_NAME_PARAMETER_NAME_PROPERTY_KEY);
if(this.fileNameParameter==null)
{
this.fileNameParameter="filename"; // depends on control dependency: [if], data = [none]
}
this.priorityParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.PRIORITY_PARAMETER_NAME_PROPERTY_KEY);
if(this.priorityParameter==null)
{
this.priorityParameter="priority"; // depends on control dependency: [if], data = [none]
}
this.targetAddressParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.TARGET_ADDRESS_PARAMETER_NAME_PROPERTY_KEY);
if(this.targetAddressParameter==null)
{
this.targetAddressParameter="targetaddress"; // depends on control dependency: [if], data = [none]
}
this.targetNameParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.TARGET_NAME_PARAMETER_NAME_PROPERTY_KEY);
if(this.targetNameParameter==null)
{
this.targetNameParameter="targetname"; // depends on control dependency: [if], data = [none]
}
this.senderNameParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.SENDER_NAME_PARAMETER_NAME_PROPERTY_KEY);
if(this.senderNameParameter==null)
{
this.senderNameParameter="sendername"; // depends on control dependency: [if], data = [none]
}
this.senderFaxNumberParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.SENDER_FAX_NUMBER_PARAMETER_NAME_PROPERTY_KEY);
if(this.senderFaxNumberParameter==null)
{
this.senderFaxNumberParameter="senderfaxnumber"; // depends on control dependency: [if], data = [none]
}
this.senderEMailParameter=configurationHolder.getConfigurationValue(HTTPRequestParserConfigurationConstants.SENDER_EMAIL_PARAMETER_NAME_PROPERTY_KEY);
if(this.senderEMailParameter==null)
{
this.senderEMailParameter="senderemail"; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static BigDecimal bigSqrt(final BigDecimal c) {
if (c == null) {
return null;
}
return c.signum() == 0 ? BigDecimal.ZERO : sqrtNewtonRaphson(c, BigDecimal.ONE, BigDecimal.ONE.divide(SQRT_PRE));
} } | public class class_name {
public static BigDecimal bigSqrt(final BigDecimal c) {
if (c == null) {
return null;
// depends on control dependency: [if], data = [none]
}
return c.signum() == 0 ? BigDecimal.ZERO : sqrtNewtonRaphson(c, BigDecimal.ONE, BigDecimal.ONE.divide(SQRT_PRE));
} } |
public class class_name {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String exceptions[]) {
// skip static initializers
if (name.equals("<clinit>")) {
return null;
}
MethodInfoImpl methodInfo = new MethodInfoImpl(name, desc, exceptions, access, classInfo);
if (name.equals("<init>")) {
constructorInfos.add(methodInfo);
} else {
methodInfos.add(methodInfo);
}
if (logParms != null) {
logParms[1] = name;
logParms[2] = methodInfo.getHashText();
}
methodVisitor.setMethodInfo(methodInfo);
return methodVisitor;
} } | public class class_name {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String exceptions[]) {
// skip static initializers
if (name.equals("<clinit>")) {
return null; // depends on control dependency: [if], data = [none]
}
MethodInfoImpl methodInfo = new MethodInfoImpl(name, desc, exceptions, access, classInfo);
if (name.equals("<init>")) {
constructorInfos.add(methodInfo); // depends on control dependency: [if], data = [none]
} else {
methodInfos.add(methodInfo); // depends on control dependency: [if], data = [none]
}
if (logParms != null) {
logParms[1] = name; // depends on control dependency: [if], data = [none]
logParms[2] = methodInfo.getHashText(); // depends on control dependency: [if], data = [none]
}
methodVisitor.setMethodInfo(methodInfo);
return methodVisitor;
} } |
public class class_name {
@Override
public @NotNull ListAssert onProperty(@NotNull String propertyName) {
isNotNull();
if (actual.isEmpty()) {
return new ListAssert(emptyList());
}
return new ListAssert(PropertySupport.instance().propertyValues(propertyName, actual));
} } | public class class_name {
@Override
public @NotNull ListAssert onProperty(@NotNull String propertyName) {
isNotNull();
if (actual.isEmpty()) {
return new ListAssert(emptyList()); // depends on control dependency: [if], data = [none]
}
return new ListAssert(PropertySupport.instance().propertyValues(propertyName, actual));
} } |
public class class_name {
public void store(Long simhash) {
final int fracCount = this.fracCount;
final List<Map<String, List<Long>>> storage = this.storage;
final List<String> lFrac = splitSimhash(simhash);
String frac;
Map<String, List<Long>> fracMap;
final WriteLock writeLock = this.lock.writeLock();
writeLock.lock();
try {
for (int i = 0; i < fracCount; i++) {
frac = lFrac.get(i);
fracMap = storage.get(i);
if (fracMap.containsKey(frac)) {
fracMap.get(frac).add(simhash);
} else {
final List<Long> ls = new ArrayList<Long>();
ls.add(simhash);
fracMap.put(frac, ls);
}
}
} finally {
writeLock.unlock();
}
} } | public class class_name {
public void store(Long simhash) {
final int fracCount = this.fracCount;
final List<Map<String, List<Long>>> storage = this.storage;
final List<String> lFrac = splitSimhash(simhash);
String frac;
Map<String, List<Long>> fracMap;
final WriteLock writeLock = this.lock.writeLock();
writeLock.lock();
try {
for (int i = 0; i < fracCount; i++) {
frac = lFrac.get(i);
// depends on control dependency: [for], data = [i]
fracMap = storage.get(i);
// depends on control dependency: [for], data = [i]
if (fracMap.containsKey(frac)) {
fracMap.get(frac).add(simhash);
// depends on control dependency: [if], data = [none]
} else {
final List<Long> ls = new ArrayList<Long>();
ls.add(simhash);
// depends on control dependency: [if], data = [none]
fracMap.put(frac, ls);
// depends on control dependency: [if], data = [none]
}
}
} finally {
writeLock.unlock();
}
} } |
public class class_name {
private boolean selfAssign()
{
// if we aren't permitted to assign in this state, fail
if (!get().canAssign(true))
return false;
for (SEPExecutor exec : pool.executors)
{
if (exec.takeWorkPermit(true))
{
Work work = new Work(exec);
// we successfully started work on this executor, so we must either assign it to ourselves or ...
if (assign(work, true))
return true;
// ... if we fail, schedule it to another worker
pool.schedule(work);
// and return success as we must have already been assigned a task
assert get().assigned != null;
return true;
}
}
return false;
} } | public class class_name {
private boolean selfAssign()
{
// if we aren't permitted to assign in this state, fail
if (!get().canAssign(true))
return false;
for (SEPExecutor exec : pool.executors)
{
if (exec.takeWorkPermit(true))
{
Work work = new Work(exec);
// we successfully started work on this executor, so we must either assign it to ourselves or ...
if (assign(work, true))
return true;
// ... if we fail, schedule it to another worker
pool.schedule(work); // depends on control dependency: [if], data = [none]
// and return success as we must have already been assigned a task
assert get().assigned != null;
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void removeTransportListener(JingleTransportListener li) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getTransportNegotiator() != null) {
contentNegotiator.getTransportNegotiator().removeListener(li);
}
}
} } | public class class_name {
public void removeTransportListener(JingleTransportListener li) {
for (ContentNegotiator contentNegotiator : contentNegotiators) {
if (contentNegotiator.getTransportNegotiator() != null) {
contentNegotiator.getTransportNegotiator().removeListener(li); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected Long retrieveObjectIdentityPrimaryKey(ObjectIdentity oid) {
try {
return jdbcOperations.queryForObject(selectObjectIdentityPrimaryKey, Long.class,
oid.getType(), oid.getIdentifier().toString());
}
catch (DataAccessException notFound) {
return null;
}
} } | public class class_name {
protected Long retrieveObjectIdentityPrimaryKey(ObjectIdentity oid) {
try {
return jdbcOperations.queryForObject(selectObjectIdentityPrimaryKey, Long.class,
oid.getType(), oid.getIdentifier().toString()); // depends on control dependency: [try], data = [none]
}
catch (DataAccessException notFound) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String readQuery(String queryKey) {
String value = m_queries.get(queryKey);
if (value == null) {
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_QUERY_NOT_FOUND_1, queryKey));
}
}
return value;
} } | public class class_name {
public String readQuery(String queryKey) {
String value = m_queries.get(queryKey);
if (value == null) {
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_QUERY_NOT_FOUND_1, queryKey)); // depends on control dependency: [if], data = [none]
}
}
return value;
} } |
public class class_name {
@Override
public ObjectWriter modify(final EndpointConfigBase<?> endpoint,
final MultivaluedMap<String, Object> responseHeaders,
final Object valueToWrite,
final ObjectWriter w,
final JsonGenerator g) throws IOException {
final ObjectWriter writer = original == null ? w : original.modify(endpoint, responseHeaders, valueToWrite, w, g);
final FilterProvider customFilterProvider = writer.getConfig().getFilterProvider();
// Try the custom (user) filter provider first.
return customFilterProvider == null
? writer.with(filterProvider)
: writer.with(new FilterProvider() {
@Override
public BeanPropertyFilter findFilter(final Object filterId) {
return customFilterProvider.findFilter(filterId);
}
@Override
public PropertyFilter findPropertyFilter(final Object filterId, final Object valueToFilter) {
final PropertyFilter filter = customFilterProvider.findPropertyFilter(filterId, valueToFilter);
if (filter != null) {
return filter;
}
return filterProvider.findPropertyFilter(filterId, valueToFilter);
}
});
} } | public class class_name {
@Override
public ObjectWriter modify(final EndpointConfigBase<?> endpoint,
final MultivaluedMap<String, Object> responseHeaders,
final Object valueToWrite,
final ObjectWriter w,
final JsonGenerator g) throws IOException {
final ObjectWriter writer = original == null ? w : original.modify(endpoint, responseHeaders, valueToWrite, w, g);
final FilterProvider customFilterProvider = writer.getConfig().getFilterProvider();
// Try the custom (user) filter provider first.
return customFilterProvider == null
? writer.with(filterProvider)
: writer.with(new FilterProvider() {
@Override
public BeanPropertyFilter findFilter(final Object filterId) {
return customFilterProvider.findFilter(filterId);
}
@Override
public PropertyFilter findPropertyFilter(final Object filterId, final Object valueToFilter) {
final PropertyFilter filter = customFilterProvider.findPropertyFilter(filterId, valueToFilter);
if (filter != null) {
return filter; // depends on control dependency: [if], data = [none]
}
return filterProvider.findPropertyFilter(filterId, valueToFilter);
}
});
} } |
public class class_name {
public final TypeParser.typeParameterization_return typeParameterization() throws RecognitionException {
TypeParser.typeParameterization_return retval = new TypeParser.typeParameterization_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token UNKNOWN8=null;
Token UNKNOWN9=null;
Token EXTENDS10=null;
Token UNKNOWN11=null;
Token SUPER12=null;
TypeParser.typeExpression_return typExp = null;
TypeParser.typeExpression_return typeExpression7 = null;
CommonTree UNKNOWN8_tree=null;
CommonTree UNKNOWN9_tree=null;
CommonTree EXTENDS10_tree=null;
CommonTree UNKNOWN11_tree=null;
CommonTree SUPER12_tree=null;
RewriteRuleTokenStream stream_SUPER=new RewriteRuleTokenStream(adaptor,"token SUPER");
RewriteRuleTokenStream stream_UNKNOWN=new RewriteRuleTokenStream(adaptor,"token UNKNOWN");
RewriteRuleTokenStream stream_EXTENDS=new RewriteRuleTokenStream(adaptor,"token EXTENDS");
RewriteRuleSubtreeStream stream_typeExpression=new RewriteRuleSubtreeStream(adaptor,"rule typeExpression");
try {
// org/javaruntype/type/parser/Type.g:112:5: ( typeExpression | UNKNOWN | UNKNOWN EXTENDS typExp= typeExpression -> ^( EXT $typExp) | UNKNOWN SUPER typExp= typeExpression -> ^( SUP $typExp) )
int alt5=4;
int LA5_0 = input.LA(1);
if ( (LA5_0==CLASSNAME) ) {
alt5=1;
}
else if ( (LA5_0==UNKNOWN) ) {
switch ( input.LA(2) ) {
case EXTENDS:
{
alt5=3;
}
break;
case SUPER:
{
alt5=4;
}
break;
case ENDTYPEPARAM:
case COMMA:
{
alt5=2;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 5, 2, input);
throw nvae;
}
}
else {
NoViableAltException nvae =
new NoViableAltException("", 5, 0, input);
throw nvae;
}
switch (alt5) {
case 1 :
// org/javaruntype/type/parser/Type.g:112:7: typeExpression
{
root_0 = (CommonTree)adaptor.nil();
pushFollow(FOLLOW_typeExpression_in_typeParameterization291);
typeExpression7=typeExpression();
state._fsp--;
adaptor.addChild(root_0, typeExpression7.getTree());
}
break;
case 2 :
// org/javaruntype/type/parser/Type.g:113:7: UNKNOWN
{
root_0 = (CommonTree)adaptor.nil();
UNKNOWN8=(Token)match(input,UNKNOWN,FOLLOW_UNKNOWN_in_typeParameterization299);
UNKNOWN8_tree = (CommonTree)adaptor.create(UNKNOWN8);
adaptor.addChild(root_0, UNKNOWN8_tree);
}
break;
case 3 :
// org/javaruntype/type/parser/Type.g:114:7: UNKNOWN EXTENDS typExp= typeExpression
{
UNKNOWN9=(Token)match(input,UNKNOWN,FOLLOW_UNKNOWN_in_typeParameterization307);
stream_UNKNOWN.add(UNKNOWN9);
EXTENDS10=(Token)match(input,EXTENDS,FOLLOW_EXTENDS_in_typeParameterization309);
stream_EXTENDS.add(EXTENDS10);
pushFollow(FOLLOW_typeExpression_in_typeParameterization313);
typExp=typeExpression();
state._fsp--;
stream_typeExpression.add(typExp.getTree());
// AST REWRITE
// elements: typExp
// token labels:
// rule labels: retval, typExp
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
RewriteRuleSubtreeStream stream_typExp=new RewriteRuleSubtreeStream(adaptor,"rule typExp",typExp!=null?typExp.tree:null);
root_0 = (CommonTree)adaptor.nil();
// 114:45: -> ^( EXT $typExp)
{
// org/javaruntype/type/parser/Type.g:114:48: ^( EXT $typExp)
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(EXT, "EXT"), root_1);
adaptor.addChild(root_1, stream_typExp.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
case 4 :
// org/javaruntype/type/parser/Type.g:115:7: UNKNOWN SUPER typExp= typeExpression
{
UNKNOWN11=(Token)match(input,UNKNOWN,FOLLOW_UNKNOWN_in_typeParameterization330);
stream_UNKNOWN.add(UNKNOWN11);
SUPER12=(Token)match(input,SUPER,FOLLOW_SUPER_in_typeParameterization332);
stream_SUPER.add(SUPER12);
pushFollow(FOLLOW_typeExpression_in_typeParameterization336);
typExp=typeExpression();
state._fsp--;
stream_typeExpression.add(typExp.getTree());
// AST REWRITE
// elements: typExp
// token labels:
// rule labels: retval, typExp
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
RewriteRuleSubtreeStream stream_typExp=new RewriteRuleSubtreeStream(adaptor,"rule typExp",typExp!=null?typExp.tree:null);
root_0 = (CommonTree)adaptor.nil();
// 115:43: -> ^( SUP $typExp)
{
// org/javaruntype/type/parser/Type.g:115:46: ^( SUP $typExp)
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(SUP, "SUP"), root_1);
adaptor.addChild(root_1, stream_typExp.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException e) {
throw e;
}
finally {
}
return retval;
} } | public class class_name {
public final TypeParser.typeParameterization_return typeParameterization() throws RecognitionException {
TypeParser.typeParameterization_return retval = new TypeParser.typeParameterization_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token UNKNOWN8=null;
Token UNKNOWN9=null;
Token EXTENDS10=null;
Token UNKNOWN11=null;
Token SUPER12=null;
TypeParser.typeExpression_return typExp = null;
TypeParser.typeExpression_return typeExpression7 = null;
CommonTree UNKNOWN8_tree=null;
CommonTree UNKNOWN9_tree=null;
CommonTree EXTENDS10_tree=null;
CommonTree UNKNOWN11_tree=null;
CommonTree SUPER12_tree=null;
RewriteRuleTokenStream stream_SUPER=new RewriteRuleTokenStream(adaptor,"token SUPER");
RewriteRuleTokenStream stream_UNKNOWN=new RewriteRuleTokenStream(adaptor,"token UNKNOWN");
RewriteRuleTokenStream stream_EXTENDS=new RewriteRuleTokenStream(adaptor,"token EXTENDS");
RewriteRuleSubtreeStream stream_typeExpression=new RewriteRuleSubtreeStream(adaptor,"rule typeExpression");
try {
// org/javaruntype/type/parser/Type.g:112:5: ( typeExpression | UNKNOWN | UNKNOWN EXTENDS typExp= typeExpression -> ^( EXT $typExp) | UNKNOWN SUPER typExp= typeExpression -> ^( SUP $typExp) )
int alt5=4;
int LA5_0 = input.LA(1);
if ( (LA5_0==CLASSNAME) ) {
alt5=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA5_0==UNKNOWN) ) {
switch ( input.LA(2) ) {
case EXTENDS:
{
alt5=3;
}
break;
case SUPER:
{
alt5=4;
}
break;
case ENDTYPEPARAM:
case COMMA:
{
alt5=2;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 5, 2, input);
throw nvae;
}
}
else {
NoViableAltException nvae =
new NoViableAltException("", 5, 0, input);
throw nvae;
}
switch (alt5) {
case 1 :
// org/javaruntype/type/parser/Type.g:112:7: typeExpression
{
root_0 = (CommonTree)adaptor.nil();
pushFollow(FOLLOW_typeExpression_in_typeParameterization291);
typeExpression7=typeExpression();
state._fsp--;
adaptor.addChild(root_0, typeExpression7.getTree());
}
break;
case 2 :
// org/javaruntype/type/parser/Type.g:113:7: UNKNOWN
{
root_0 = (CommonTree)adaptor.nil();
UNKNOWN8=(Token)match(input,UNKNOWN,FOLLOW_UNKNOWN_in_typeParameterization299);
UNKNOWN8_tree = (CommonTree)adaptor.create(UNKNOWN8);
adaptor.addChild(root_0, UNKNOWN8_tree);
}
break;
case 3 :
// org/javaruntype/type/parser/Type.g:114:7: UNKNOWN EXTENDS typExp= typeExpression
{
UNKNOWN9=(Token)match(input,UNKNOWN,FOLLOW_UNKNOWN_in_typeParameterization307);
stream_UNKNOWN.add(UNKNOWN9);
EXTENDS10=(Token)match(input,EXTENDS,FOLLOW_EXTENDS_in_typeParameterization309);
stream_EXTENDS.add(EXTENDS10);
pushFollow(FOLLOW_typeExpression_in_typeParameterization313);
typExp=typeExpression();
state._fsp--;
stream_typeExpression.add(typExp.getTree());
// AST REWRITE
// elements: typExp
// token labels:
// rule labels: retval, typExp
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
RewriteRuleSubtreeStream stream_typExp=new RewriteRuleSubtreeStream(adaptor,"rule typExp",typExp!=null?typExp.tree:null);
root_0 = (CommonTree)adaptor.nil();
// 114:45: -> ^( EXT $typExp)
{
// org/javaruntype/type/parser/Type.g:114:48: ^( EXT $typExp)
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(EXT, "EXT"), root_1);
adaptor.addChild(root_1, stream_typExp.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
case 4 :
// org/javaruntype/type/parser/Type.g:115:7: UNKNOWN SUPER typExp= typeExpression
{
UNKNOWN11=(Token)match(input,UNKNOWN,FOLLOW_UNKNOWN_in_typeParameterization330);
stream_UNKNOWN.add(UNKNOWN11);
SUPER12=(Token)match(input,SUPER,FOLLOW_SUPER_in_typeParameterization332);
stream_SUPER.add(SUPER12);
pushFollow(FOLLOW_typeExpression_in_typeParameterization336);
typExp=typeExpression();
state._fsp--;
stream_typeExpression.add(typExp.getTree());
// AST REWRITE
// elements: typExp
// token labels:
// rule labels: retval, typExp
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
RewriteRuleSubtreeStream stream_typExp=new RewriteRuleSubtreeStream(adaptor,"rule typExp",typExp!=null?typExp.tree:null);
root_0 = (CommonTree)adaptor.nil();
// 115:43: -> ^( SUP $typExp)
{
// org/javaruntype/type/parser/Type.g:115:46: ^( SUP $typExp)
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(SUP, "SUP"), root_1);
adaptor.addChild(root_1, stream_typExp.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException e) {
throw e;
}
finally {
}
return retval;
} } |
public class class_name {
public static Object getValue(Object instance, String name) {
assert instance != null;
assert name != null;
try {
Class<?> clazz = instance.getClass();
Object value = null;
Method property = findProperty(clazz, name);
if (property != null) {
value = property.invoke(instance);
}
else {
Field field = findField(clazz, name);
if (field != null) {
value = field.get(instance);
}
}
log.debug("Value for field/property '{}' is: '{}'", name, value);
return value;
}
catch (Exception e) {
log.error("Could not get a value for field/property '" + name + "'", e);
return null;
}
} } | public class class_name {
public static Object getValue(Object instance, String name) {
assert instance != null;
assert name != null;
try {
Class<?> clazz = instance.getClass();
Object value = null;
// depends on control dependency: [try], data = [none]
Method property = findProperty(clazz, name);
if (property != null) {
value = property.invoke(instance);
// depends on control dependency: [if], data = [none]
}
else {
Field field = findField(clazz, name);
if (field != null) {
value = field.get(instance);
// depends on control dependency: [if], data = [none]
}
}
log.debug("Value for field/property '{}' is: '{}'", name, value);
// depends on control dependency: [try], data = [none]
return value;
// depends on control dependency: [try], data = [none]
}
catch (Exception e) {
log.error("Could not get a value for field/property '" + name + "'", e);
return null;
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static String parms(String types) {
int[] pos = new int[] { 0 };
StringBuilder sb = new StringBuilder();
boolean first = true;
String t;
while ((t = desc(types, pos)) != null) {
if (first) {
first = false;
} else {
sb.append(',');
}
sb.append(t);
}
return sb.toString();
} } | public class class_name {
static String parms(String types) {
int[] pos = new int[] { 0 };
StringBuilder sb = new StringBuilder();
boolean first = true;
String t;
while ((t = desc(types, pos)) != null) {
if (first) {
first = false; // depends on control dependency: [if], data = [none]
} else {
sb.append(','); // depends on control dependency: [if], data = [none]
}
sb.append(t); // depends on control dependency: [while], data = [none]
}
return sb.toString();
} } |
public class class_name {
public boolean getBooleanFrom(JsonValue json) {
if (json.isBoolean()) {
return json.asBoolean();
}
if (json.isNumber()) {
if (json.asInt() == 0) {
return Boolean.FALSE;
}
if (json.asInt() == 1) {
return Boolean.TRUE;
}
}
if (json.isString()) {
String value = json.asString();
if (value.equalsIgnoreCase("false")) {
return Boolean.FALSE;
}
if (value.equalsIgnoreCase("true")) {
return Boolean.TRUE;
}
}
throw new UnsupportedOperationException("Json is not a boolean: " + json);
} } | public class class_name {
public boolean getBooleanFrom(JsonValue json) {
if (json.isBoolean()) {
return json.asBoolean(); // depends on control dependency: [if], data = [none]
}
if (json.isNumber()) {
if (json.asInt() == 0) {
return Boolean.FALSE; // depends on control dependency: [if], data = [none]
}
if (json.asInt() == 1) {
return Boolean.TRUE; // depends on control dependency: [if], data = [none]
}
}
if (json.isString()) {
String value = json.asString();
if (value.equalsIgnoreCase("false")) {
return Boolean.FALSE; // depends on control dependency: [if], data = [none]
}
if (value.equalsIgnoreCase("true")) {
return Boolean.TRUE; // depends on control dependency: [if], data = [none]
}
}
throw new UnsupportedOperationException("Json is not a boolean: " + json);
} } |
public class class_name {
private Map<Optional<Executor>, List<ExecutableFlow>> getFlowToExecutorMap() {
final HashMap<Optional<Executor>, List<ExecutableFlow>> exFlowMap =
new HashMap<>();
for (final Pair<ExecutionReference, ExecutableFlow> runningFlow : this.runningExecutions.get()
.values()) {
final ExecutionReference ref = runningFlow.getFirst();
final ExecutableFlow flow = runningFlow.getSecond();
final Optional<Executor> executor = ref.getExecutor();
// We can set the next check time to prevent the checking of certain
// flows.
if (ref.getNextCheckTime() >= DateTime.now().getMillis()) {
continue;
}
List<ExecutableFlow> flows = exFlowMap.get(executor);
if (flows == null) {
flows = new ArrayList<>();
exFlowMap.put(executor, flows);
}
flows.add(flow);
}
return exFlowMap;
} } | public class class_name {
private Map<Optional<Executor>, List<ExecutableFlow>> getFlowToExecutorMap() {
final HashMap<Optional<Executor>, List<ExecutableFlow>> exFlowMap =
new HashMap<>();
for (final Pair<ExecutionReference, ExecutableFlow> runningFlow : this.runningExecutions.get()
.values()) {
final ExecutionReference ref = runningFlow.getFirst();
final ExecutableFlow flow = runningFlow.getSecond();
final Optional<Executor> executor = ref.getExecutor();
// We can set the next check time to prevent the checking of certain
// flows.
if (ref.getNextCheckTime() >= DateTime.now().getMillis()) {
continue;
}
List<ExecutableFlow> flows = exFlowMap.get(executor);
if (flows == null) {
flows = new ArrayList<>(); // depends on control dependency: [if], data = [none]
exFlowMap.put(executor, flows); // depends on control dependency: [if], data = [none]
}
flows.add(flow); // depends on control dependency: [for], data = [none]
}
return exFlowMap;
} } |
public class class_name {
protected void addConstructors(ClassFile proxyClassType, List<DeferredBytecode> initialValueBytecode) {
try {
if (getBeanType().isInterface()) {
ConstructorUtils.addDefaultConstructor(proxyClassType, initialValueBytecode, !useConstructedFlag());
} else {
boolean constructorFound = false;
for (Constructor<?> constructor : AccessController.doPrivileged(new GetDeclaredConstructorsAction(getBeanType()))) {
if ((constructor.getModifiers() & Modifier.PRIVATE) == 0) {
constructorFound = true;
String[] exceptions = new String[constructor.getExceptionTypes().length];
for (int i = 0; i < exceptions.length; ++i) {
exceptions[i] = constructor.getExceptionTypes()[i].getName();
}
ConstructorUtils.addConstructor(BytecodeUtils.VOID_CLASS_DESCRIPTOR, DescriptorUtils.parameterDescriptors(constructor.getParameterTypes()), exceptions, proxyClassType, initialValueBytecode, !useConstructedFlag());
}
}
if (!constructorFound) {
// the bean only has private constructors, we need to generate
// two fake constructors that call each other
addConstructorsForBeanWithPrivateConstructors(proxyClassType);
}
}
} catch (Exception e) {
throw new WeldException(e);
}
} } | public class class_name {
protected void addConstructors(ClassFile proxyClassType, List<DeferredBytecode> initialValueBytecode) {
try {
if (getBeanType().isInterface()) {
ConstructorUtils.addDefaultConstructor(proxyClassType, initialValueBytecode, !useConstructedFlag()); // depends on control dependency: [if], data = [none]
} else {
boolean constructorFound = false;
for (Constructor<?> constructor : AccessController.doPrivileged(new GetDeclaredConstructorsAction(getBeanType()))) {
if ((constructor.getModifiers() & Modifier.PRIVATE) == 0) {
constructorFound = true; // depends on control dependency: [if], data = [none]
String[] exceptions = new String[constructor.getExceptionTypes().length];
for (int i = 0; i < exceptions.length; ++i) {
exceptions[i] = constructor.getExceptionTypes()[i].getName(); // depends on control dependency: [for], data = [i]
}
ConstructorUtils.addConstructor(BytecodeUtils.VOID_CLASS_DESCRIPTOR, DescriptorUtils.parameterDescriptors(constructor.getParameterTypes()), exceptions, proxyClassType, initialValueBytecode, !useConstructedFlag()); // depends on control dependency: [if], data = [none]
}
}
if (!constructorFound) {
// the bean only has private constructors, we need to generate
// two fake constructors that call each other
addConstructorsForBeanWithPrivateConstructors(proxyClassType); // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e) {
throw new WeldException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static String unsignedToString(int value) {
if (value >= 0) {
return Integer.toString(value);
} else {
return Long.toString((value) & 0x00000000FFFFFFFFL);
}
} } | public class class_name {
private static String unsignedToString(int value) {
if (value >= 0) {
return Integer.toString(value); // depends on control dependency: [if], data = [(value]
} else {
return Long.toString((value) & 0x00000000FFFFFFFFL); // depends on control dependency: [if], data = [(value]
}
} } |
public class class_name {
public synchronized void shutdown()
{
for (ManagedConnectionPool mcp : pools.values())
{
mcp.shutdown();
if (Tracer.isEnabled())
Tracer.destroyManagedConnectionPool(poolConfiguration.getId(), mcp);
}
pools.clear();
} } | public class class_name {
public synchronized void shutdown()
{
for (ManagedConnectionPool mcp : pools.values())
{
mcp.shutdown(); // depends on control dependency: [for], data = [mcp]
if (Tracer.isEnabled())
Tracer.destroyManagedConnectionPool(poolConfiguration.getId(), mcp);
}
pools.clear();
} } |
public class class_name {
public Object getListener(Class<?> listenerClass) {
Object listener = listeners.get(listenerClass);
if (listener == null) {
listener = loadListener(listenerClass);
}
return listener;
} } | public class class_name {
public Object getListener(Class<?> listenerClass) {
Object listener = listeners.get(listenerClass);
if (listener == null) {
listener = loadListener(listenerClass); // depends on control dependency: [if], data = [(listener]
}
return listener;
} } |
public class class_name {
public static OptionalLong createLong(final String str) {
if (N.isNullOrEmpty(str)) {
return OptionalLong.empty();
}
try {
return OptionalLong.of(Long.decode(str));
} catch (NumberFormatException e) {
return OptionalLong.empty();
}
} } | public class class_name {
public static OptionalLong createLong(final String str) {
if (N.isNullOrEmpty(str)) {
return OptionalLong.empty();
// depends on control dependency: [if], data = [none]
}
try {
return OptionalLong.of(Long.decode(str));
// depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
return OptionalLong.empty();
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean isAllNumeric(TokenStream stream) {
List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens();
for(Token token:tokens) {
try {
Integer.parseInt(token.getText());
} catch(NumberFormatException e) {
return false;
}
}
return true;
} } | public class class_name {
private boolean isAllNumeric(TokenStream stream) {
List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens();
for(Token token:tokens) {
try {
Integer.parseInt(token.getText()); // depends on control dependency: [try], data = [none]
} catch(NumberFormatException e) {
return false;
} // depends on control dependency: [catch], data = [none]
}
return true;
} } |
public class class_name {
static JbcSrcJavaValue of(Expression expr, Method method, JbcSrcValueErrorReporter reporter) {
checkNotNull(method);
if (expr instanceof SoyExpression) {
return new JbcSrcJavaValue(
expr,
method,
/* allowedType= */ ((SoyExpression) expr).soyType(),
/* constantNull= */ false,
/* error= */ false,
reporter);
}
return new JbcSrcJavaValue(
expr,
method,
/* allowedType= */ null,
/* constantNull= */ false,
/* error= */ false,
reporter);
} } | public class class_name {
static JbcSrcJavaValue of(Expression expr, Method method, JbcSrcValueErrorReporter reporter) {
checkNotNull(method);
if (expr instanceof SoyExpression) {
return new JbcSrcJavaValue(
expr,
method,
/* allowedType= */ ((SoyExpression) expr).soyType(),
/* constantNull= */ false,
/* error= */ false,
reporter); // depends on control dependency: [if], data = [none]
}
return new JbcSrcJavaValue(
expr,
method,
/* allowedType= */ null,
/* constantNull= */ false,
/* error= */ false,
reporter);
} } |
public class class_name {
public static boolean verifySignature(Map<String, CharSequence> params, String secret,
String expected) {
assert !(null == secret || "".equals(secret));
if (null == params || params.isEmpty() )
return false;
if (null == expected || "".equals(expected)) {
return false;
}
params.remove(FacebookParam.SIGNATURE.toString());
List<String> sigParams = convert(params.entrySet());
return verifySignature(sigParams, secret, expected);
} } | public class class_name {
public static boolean verifySignature(Map<String, CharSequence> params, String secret,
String expected) {
assert !(null == secret || "".equals(secret));
if (null == params || params.isEmpty() )
return false;
if (null == expected || "".equals(expected)) {
return false; // depends on control dependency: [if], data = [none]
}
params.remove(FacebookParam.SIGNATURE.toString());
List<String> sigParams = convert(params.entrySet());
return verifySignature(sigParams, secret, expected);
} } |
public class class_name {
private void trialConnect() throws IOException, RetryDirectly, IllegalAccessException,
FileDownloadSecurityException {
FileDownloadConnection trialConnection = null;
try {
final ConnectionProfile trialConnectionProfile;
if (isNeedForceDiscardRange) {
trialConnectionProfile = ConnectionProfile.ConnectionProfileBuild
.buildTrialConnectionProfileNoRange();
} else {
trialConnectionProfile = ConnectionProfile.ConnectionProfileBuild
.buildTrialConnectionProfile();
}
final ConnectTask trialConnectTask = new ConnectTask.Builder()
.setDownloadId(model.getId())
.setUrl(model.getUrl())
.setEtag(model.getETag())
.setHeader(userRequestHeader)
.setConnectionProfile(trialConnectionProfile)
.build();
trialConnection = trialConnectTask.connect();
handleTrialConnectResult(trialConnectTask.getRequestHeader(),
trialConnectTask, trialConnection);
} finally {
if (trialConnection != null) trialConnection.ending();
}
} } | public class class_name {
private void trialConnect() throws IOException, RetryDirectly, IllegalAccessException,
FileDownloadSecurityException {
FileDownloadConnection trialConnection = null;
try {
final ConnectionProfile trialConnectionProfile;
if (isNeedForceDiscardRange) {
trialConnectionProfile = ConnectionProfile.ConnectionProfileBuild
.buildTrialConnectionProfileNoRange(); // depends on control dependency: [if], data = [none]
} else {
trialConnectionProfile = ConnectionProfile.ConnectionProfileBuild
.buildTrialConnectionProfile(); // depends on control dependency: [if], data = [none]
}
final ConnectTask trialConnectTask = new ConnectTask.Builder()
.setDownloadId(model.getId())
.setUrl(model.getUrl())
.setEtag(model.getETag())
.setHeader(userRequestHeader)
.setConnectionProfile(trialConnectionProfile)
.build();
trialConnection = trialConnectTask.connect();
handleTrialConnectResult(trialConnectTask.getRequestHeader(),
trialConnectTask, trialConnection);
} finally {
if (trialConnection != null) trialConnection.ending();
}
} } |
public class class_name {
public Expression constructTree(ArrayList<String> postTokens)
{
Expression root = null;
Stack<Expression> nodes = new Stack<>();
for(String str: postTokens)
{
if(str.isEmpty()){
continue;
}
if(str.matches("[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?")) {
nodes.push(new Constant(Double.parseDouble(str)));
}
else if(str.equals(var)) {
nodes.push(new Variable(var));
}
else if(!nodes.isEmpty() && ExpressionParser.isFunction(str)) {
Expression function = matchFunc(str, nodes.pop());
nodes.push(function);
}
else if(!nodes.isEmpty() && str.equals("$")) {
Expression unaryMinus = new Negation(nodes.pop());
nodes.push(unaryMinus);
}
else if(!nodes.isEmpty()){
Expression right = nodes.pop();
Expression binaryOperator = matchOperator(str, nodes.pop(), right);
nodes.push(binaryOperator);
}
}
if(!nodes.isEmpty())
root = nodes.pop();
return root;
} } | public class class_name {
public Expression constructTree(ArrayList<String> postTokens)
{
Expression root = null;
Stack<Expression> nodes = new Stack<>();
for(String str: postTokens)
{
if(str.isEmpty()){
continue;
}
if(str.matches("[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?")) {
nodes.push(new Constant(Double.parseDouble(str))); // depends on control dependency: [if], data = [none]
}
else if(str.equals(var)) {
nodes.push(new Variable(var)); // depends on control dependency: [if], data = [none]
}
else if(!nodes.isEmpty() && ExpressionParser.isFunction(str)) {
Expression function = matchFunc(str, nodes.pop());
nodes.push(function); // depends on control dependency: [if], data = [none]
}
else if(!nodes.isEmpty() && str.equals("$")) {
Expression unaryMinus = new Negation(nodes.pop());
nodes.push(unaryMinus); // depends on control dependency: [if], data = [none]
}
else if(!nodes.isEmpty()){
Expression right = nodes.pop();
Expression binaryOperator = matchOperator(str, nodes.pop(), right);
nodes.push(binaryOperator); // depends on control dependency: [if], data = [none]
}
}
if(!nodes.isEmpty())
root = nodes.pop();
return root;
} } |
public class class_name {
@Override
public void calcInnerBounds() {
final Insets INSETS = getInsets();
final int SIZE = (getWidth() - INSETS.left - INSETS.right) <= (getHeight() - INSETS.top - INSETS.bottom) ? (getWidth() - INSETS.left - INSETS.right) : (getHeight() - INSETS.top - INSETS.bottom);
if (!isFrameVisible()) {
INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, (int)(SIZE * 1.202247191), (int)(SIZE * 1.202247191));
} else {
INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, SIZE, SIZE);
}
} } | public class class_name {
@Override
public void calcInnerBounds() {
final Insets INSETS = getInsets();
final int SIZE = (getWidth() - INSETS.left - INSETS.right) <= (getHeight() - INSETS.top - INSETS.bottom) ? (getWidth() - INSETS.left - INSETS.right) : (getHeight() - INSETS.top - INSETS.bottom);
if (!isFrameVisible()) {
INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, (int)(SIZE * 1.202247191), (int)(SIZE * 1.202247191)); // depends on control dependency: [if], data = [none]
} else {
INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, SIZE, SIZE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void output(final LogEntry logEntry, final Iterable<Writer> writers) {
if (writingThread == null) {
for (Writer writer : writers) {
try {
writer.write(logEntry);
} catch (Exception ex) {
InternalLogger.log(Level.ERROR, ex, "Failed to write log entry '" + logEntry.getMessage() + "'");
}
}
} else {
for (Writer writer : writers) {
writingThread.add(writer, logEntry);
}
}
} } | public class class_name {
private void output(final LogEntry logEntry, final Iterable<Writer> writers) {
if (writingThread == null) {
for (Writer writer : writers) {
try {
writer.write(logEntry); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
InternalLogger.log(Level.ERROR, ex, "Failed to write log entry '" + logEntry.getMessage() + "'");
} // depends on control dependency: [catch], data = [none]
}
} else {
for (Writer writer : writers) {
writingThread.add(writer, logEntry); // depends on control dependency: [for], data = [writer]
}
}
} } |
public class class_name {
public static void main(String[] args)
{
Context cx = Context.enter();
try {
// Set version to JavaScript1.2 so that we get object-literal style
// printing instead of "[object Object]"
cx.setLanguageVersion(Context.VERSION_1_2);
// Initialize the standard objects (Object, Function, etc.)
// This must be done before scripts can be executed.
Scriptable scope = cx.initStandardObjects();
// Now we can evaluate a script. Let's create a new object
// using the object literal notation.
Object result = cx.evaluateString(scope, "obj = {a:1, b:['x','y']}",
"MySource", 1, null);
Scriptable obj = (Scriptable) scope.get("obj", scope);
// Should print "obj == result" (Since the result of an assignment
// expression is the value that was assigned)
System.out.println("obj " + (obj == result ? "==" : "!=") +
" result");
// Should print "obj.a == 1"
System.out.println("obj.a == " + obj.get("a", obj));
Scriptable b = (Scriptable) obj.get("b", obj);
// Should print "obj.b[0] == x"
System.out.println("obj.b[0] == " + b.get(0, b));
// Should print "obj.b[1] == y"
System.out.println("obj.b[1] == " + b.get(1, b));
// Should print {a:1, b:["x", "y"]}
Function fn = (Function) ScriptableObject.getProperty(obj, "toString");
System.out.println(fn.call(cx, scope, obj, new Object[0]));
} finally {
Context.exit();
}
} } | public class class_name {
public static void main(String[] args)
{
Context cx = Context.enter();
try {
// Set version to JavaScript1.2 so that we get object-literal style
// printing instead of "[object Object]"
cx.setLanguageVersion(Context.VERSION_1_2); // depends on control dependency: [try], data = [none]
// Initialize the standard objects (Object, Function, etc.)
// This must be done before scripts can be executed.
Scriptable scope = cx.initStandardObjects();
// Now we can evaluate a script. Let's create a new object
// using the object literal notation.
Object result = cx.evaluateString(scope, "obj = {a:1, b:['x','y']}",
"MySource", 1, null);
Scriptable obj = (Scriptable) scope.get("obj", scope);
// Should print "obj == result" (Since the result of an assignment
// expression is the value that was assigned)
System.out.println("obj " + (obj == result ? "==" : "!=") +
" result"); // depends on control dependency: [try], data = [none]
// Should print "obj.a == 1"
System.out.println("obj.a == " + obj.get("a", obj)); // depends on control dependency: [try], data = [none]
Scriptable b = (Scriptable) obj.get("b", obj);
// Should print "obj.b[0] == x"
System.out.println("obj.b[0] == " + b.get(0, b)); // depends on control dependency: [try], data = [none]
// Should print "obj.b[1] == y"
System.out.println("obj.b[1] == " + b.get(1, b)); // depends on control dependency: [try], data = [none]
// Should print {a:1, b:["x", "y"]}
Function fn = (Function) ScriptableObject.getProperty(obj, "toString");
System.out.println(fn.call(cx, scope, obj, new Object[0])); // depends on control dependency: [try], data = [none]
} finally {
Context.exit();
}
} } |
public class class_name {
public Drawer append(@NonNull Drawer result) {
if (mUsed) {
throw new RuntimeException("you must not reuse a DrawerBuilder builder");
}
if (mDrawerGravity == null) {
throw new RuntimeException("please set the gravity for the drawer");
}
//set that this builder was used. now you have to create a new one
mUsed = true;
mAppended = true;
//get the drawer layout from the previous drawer
mDrawerLayout = result.getDrawerLayout();
// get the slider view
mSliderLayout = (ScrimInsetsRelativeLayout) mActivity.getLayoutInflater().inflate(R.layout.material_drawer_slider, mDrawerLayout, false);
mSliderLayout.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(mActivity, R.attr.material_drawer_background, R.color.material_drawer_background));
// get the layout params
DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) mSliderLayout.getLayoutParams();
// set the gravity of this drawerGravity
params.gravity = mDrawerGravity;
// if this is a drawer from the right, change the margins :D
params = DrawerUtils.processDrawerLayoutParams(this, params);
// set the new params
mSliderLayout.setLayoutParams(params);
//define id for the sliderLayout
mSliderLayout.setId(R.id.material_drawer_slider_layout);
// add the slider to the drawer
mDrawerLayout.addView(mSliderLayout, 1);
//create the content
createContent();
//create the result object
Drawer appendedResult = new Drawer(this);
//toggle selection list if we were previously on the account list
if (mSavedInstance != null && mSavedInstance.getBoolean(Drawer.BUNDLE_DRAWER_CONTENT_SWITCHED_APPENDED, false)) {
mAccountHeader.toggleSelectionList(mActivity);
}
//forget the reference to the activity
mActivity = null;
return appendedResult;
} } | public class class_name {
public Drawer append(@NonNull Drawer result) {
if (mUsed) {
throw new RuntimeException("you must not reuse a DrawerBuilder builder");
}
if (mDrawerGravity == null) {
throw new RuntimeException("please set the gravity for the drawer");
}
//set that this builder was used. now you have to create a new one
mUsed = true;
mAppended = true;
//get the drawer layout from the previous drawer
mDrawerLayout = result.getDrawerLayout();
// get the slider view
mSliderLayout = (ScrimInsetsRelativeLayout) mActivity.getLayoutInflater().inflate(R.layout.material_drawer_slider, mDrawerLayout, false);
mSliderLayout.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(mActivity, R.attr.material_drawer_background, R.color.material_drawer_background));
// get the layout params
DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) mSliderLayout.getLayoutParams();
// set the gravity of this drawerGravity
params.gravity = mDrawerGravity;
// if this is a drawer from the right, change the margins :D
params = DrawerUtils.processDrawerLayoutParams(this, params);
// set the new params
mSliderLayout.setLayoutParams(params);
//define id for the sliderLayout
mSliderLayout.setId(R.id.material_drawer_slider_layout);
// add the slider to the drawer
mDrawerLayout.addView(mSliderLayout, 1);
//create the content
createContent();
//create the result object
Drawer appendedResult = new Drawer(this);
//toggle selection list if we were previously on the account list
if (mSavedInstance != null && mSavedInstance.getBoolean(Drawer.BUNDLE_DRAWER_CONTENT_SWITCHED_APPENDED, false)) {
mAccountHeader.toggleSelectionList(mActivity); // depends on control dependency: [if], data = [none]
}
//forget the reference to the activity
mActivity = null;
return appendedResult;
} } |
public class class_name {
public static void unRegisterExternalConfigLoader(ExternalConfigLoader configLoader) {
wLock.lock();
try {
CONFIG_LOADERS.remove(configLoader);
Collections.sort(CONFIG_LOADERS, new OrderedComparator<ExternalConfigLoader>());
} finally {
wLock.unlock();
}
} } | public class class_name {
public static void unRegisterExternalConfigLoader(ExternalConfigLoader configLoader) {
wLock.lock();
try {
CONFIG_LOADERS.remove(configLoader); // depends on control dependency: [try], data = [none]
Collections.sort(CONFIG_LOADERS, new OrderedComparator<ExternalConfigLoader>()); // depends on control dependency: [try], data = [none]
} finally {
wLock.unlock();
}
} } |
public class class_name {
public HtmlPolicyBuilder allowTextIn(String... elementNames) {
invalidateCompiledState();
for (String elementName : elementNames) {
elementName = HtmlLexer.canonicalName(elementName);
textContainers.put(elementName, true);
}
return this;
} } | public class class_name {
public HtmlPolicyBuilder allowTextIn(String... elementNames) {
invalidateCompiledState();
for (String elementName : elementNames) {
elementName = HtmlLexer.canonicalName(elementName); // depends on control dependency: [for], data = [elementName]
textContainers.put(elementName, true); // depends on control dependency: [for], data = [elementName]
}
return this;
} } |
public class class_name {
public Set<RedisURI> getClusterNodes() {
Set<RedisURI> result = new HashSet<>();
Map<String, RedisURI> knownUris = new HashMap<>();
for (NodeTopologyView view : views) {
knownUris.put(view.getNodeId(), view.getRedisURI());
}
for (NodeTopologyView view : views) {
for (RedisClusterNode redisClusterNode : view.getPartitions()) {
if (knownUris.containsKey(redisClusterNode.getNodeId())) {
result.add(knownUris.get(redisClusterNode.getNodeId()));
} else {
result.add(redisClusterNode.getUri());
}
}
}
return result;
} } | public class class_name {
public Set<RedisURI> getClusterNodes() {
Set<RedisURI> result = new HashSet<>();
Map<String, RedisURI> knownUris = new HashMap<>();
for (NodeTopologyView view : views) {
knownUris.put(view.getNodeId(), view.getRedisURI()); // depends on control dependency: [for], data = [view]
}
for (NodeTopologyView view : views) {
for (RedisClusterNode redisClusterNode : view.getPartitions()) {
if (knownUris.containsKey(redisClusterNode.getNodeId())) {
result.add(knownUris.get(redisClusterNode.getNodeId())); // depends on control dependency: [if], data = [none]
} else {
result.add(redisClusterNode.getUri()); // depends on control dependency: [if], data = [none]
}
}
}
return result;
} } |
public class class_name {
private void checkInstancesMatchRegex(@Nullable String regex) {
if (regex != null) {
Pattern pattern = Pattern.compile(regex);
instances().forEach(resource -> {
String value = (String) resource.value();
Matcher matcher = pattern.matcher(value);
if (!matcher.matches()) {
throw TransactionException.regexFailure(this, value, regex);
}
});
}
} } | public class class_name {
private void checkInstancesMatchRegex(@Nullable String regex) {
if (regex != null) {
Pattern pattern = Pattern.compile(regex);
instances().forEach(resource -> {
String value = (String) resource.value(); // depends on control dependency: [if], data = [none]
Matcher matcher = pattern.matcher(value);
if (!matcher.matches()) {
throw TransactionException.regexFailure(this, value, regex);
}
});
}
} } |
public class class_name {
protected void parseMetaDataLine(final ParserData parserData, final String line, int lineNumber) throws ParsingException {
// Parse the line and break it up into the key/value pair
Pair<String, String> keyValue = null;
try {
keyValue = ProcessorUtilities.getAndValidateKeyValuePair(line);
} catch (InvalidKeyValueException e) {
throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_METADATA_FORMAT_MSG, lineNumber, line));
}
final String key = keyValue.getFirst();
final String value = keyValue.getSecond();
if (parserData.getParsedMetaDataKeys().contains(key.toLowerCase())) {
throw new ParsingException(format(ProcessorConstants.ERROR_DUPLICATE_METADATA_FORMAT_MSG, lineNumber, key, line));
} else {
parserData.getParsedMetaDataKeys().add(key.toLowerCase());
// first deal with metadata that is used by the parser or needs to be parsed further
if (key.equalsIgnoreCase(CommonConstants.CS_SPACES_TITLE)) {
// Read in the amount of spaces that were used for the content specification
try {
parserData.setIndentationSize(Integer.parseInt(value));
if (parserData.getIndentationSize() <= 0) {
parserData.setIndentationSize(2);
}
} catch (NumberFormatException e) {
throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_NUMBER_MSG, lineNumber, line));
}
} else if (key.equalsIgnoreCase(CSConstants.DEBUG_TITLE)) {
if (value.equals("1")) {
log.setVerboseDebug(1);
} else if (value.equals("2")) {
log.setVerboseDebug(2);
} else if (value.equals("0")) {
log.setVerboseDebug(0);
} else {
log.warn(ProcessorConstants.WARN_DEBUG_IGNORE_MSG);
}
} else if (key.equalsIgnoreCase(CommonConstants.CS_INLINE_INJECTION_TITLE)) {
final InjectionOptions injectionOptions = new InjectionOptions();
String[] types = null;
if (StringUtilities.indexOf(value, '[') != -1) {
if (StringUtilities.indexOf(value, ']') != -1) {
final Matcher matcher = SQUARE_BRACKET_PATTERN.matcher(value);
// Find all of the variables inside of the brackets defined by the regex
while (matcher.find()) {
final String topicTypes = matcher.group(ProcessorConstants.BRACKET_CONTENTS);
types = StringUtilities.split(topicTypes, ',');
for (final String type : types) {
injectionOptions.addStrictTopicType(type.trim());
}
}
} else {
throw new ParsingException(
format(ProcessorConstants.ERROR_NO_ENDING_BRACKET_MSG + ProcessorConstants.CSLINE_MSG, lineNumber, ']',
line));
}
}
String injectionSetting = getTitle(value, '[');
if (injectionSetting == null) {
throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_INJECTION_MSG, lineNumber, line));
} else if (injectionSetting.trim().equalsIgnoreCase("on")) {
if (types != null) {
injectionOptions.setContentSpecType(InjectionOptions.UserType.STRICT);
} else {
injectionOptions.setContentSpecType(InjectionOptions.UserType.ON);
}
} else if (injectionSetting.trim().equalsIgnoreCase("off")) {
injectionOptions.setContentSpecType(InjectionOptions.UserType.OFF);
} else {
throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_INJECTION_MSG, lineNumber, line));
}
parserData.getContentSpec().setInjectionOptions(injectionOptions);
} else if (key.equalsIgnoreCase(CommonConstants.CS_FILE_TITLE) || key.equalsIgnoreCase(CommonConstants.CS_FILE_SHORT_TITLE)) {
final FileList files = parseFilesMetaData(parserData, value, lineNumber, line);
parserData.getContentSpec().appendKeyValueNode(files);
} else if (isSpecTopicMetaData(key, value)) {
final SpecTopic specTopic = parseSpecTopicMetaData(parserData, value, key, lineNumber);
parserData.getContentSpec().appendKeyValueNode(new KeyValueNode<SpecTopic>(key, specTopic, lineNumber));
} else {
try {
final KeyValueNode<String> node;
if (ContentSpecUtilities.isMetaDataMultiLine(key)) {
node = parseMultiLineMetaData(parserData, key, value, lineNumber);
} else {
node = new KeyValueNode<String>(key, value, lineNumber);
}
parserData.getContentSpec().appendKeyValueNode(node);
} catch (NumberFormatException e) {
throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_METADATA_FORMAT_MSG, lineNumber, line));
}
}
}
} } | public class class_name {
protected void parseMetaDataLine(final ParserData parserData, final String line, int lineNumber) throws ParsingException {
// Parse the line and break it up into the key/value pair
Pair<String, String> keyValue = null;
try {
keyValue = ProcessorUtilities.getAndValidateKeyValuePair(line);
} catch (InvalidKeyValueException e) {
throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_METADATA_FORMAT_MSG, lineNumber, line));
}
final String key = keyValue.getFirst();
final String value = keyValue.getSecond();
if (parserData.getParsedMetaDataKeys().contains(key.toLowerCase())) {
throw new ParsingException(format(ProcessorConstants.ERROR_DUPLICATE_METADATA_FORMAT_MSG, lineNumber, key, line));
} else {
parserData.getParsedMetaDataKeys().add(key.toLowerCase());
// first deal with metadata that is used by the parser or needs to be parsed further
if (key.equalsIgnoreCase(CommonConstants.CS_SPACES_TITLE)) {
// Read in the amount of spaces that were used for the content specification
try {
parserData.setIndentationSize(Integer.parseInt(value)); // depends on control dependency: [try], data = [none]
if (parserData.getIndentationSize() <= 0) {
parserData.setIndentationSize(2); // depends on control dependency: [if], data = [none]
}
} catch (NumberFormatException e) {
throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_NUMBER_MSG, lineNumber, line));
} // depends on control dependency: [catch], data = [none]
} else if (key.equalsIgnoreCase(CSConstants.DEBUG_TITLE)) {
if (value.equals("1")) {
log.setVerboseDebug(1); // depends on control dependency: [if], data = [none]
} else if (value.equals("2")) {
log.setVerboseDebug(2); // depends on control dependency: [if], data = [none]
} else if (value.equals("0")) {
log.setVerboseDebug(0); // depends on control dependency: [if], data = [none]
} else {
log.warn(ProcessorConstants.WARN_DEBUG_IGNORE_MSG); // depends on control dependency: [if], data = [none]
}
} else if (key.equalsIgnoreCase(CommonConstants.CS_INLINE_INJECTION_TITLE)) {
final InjectionOptions injectionOptions = new InjectionOptions();
String[] types = null;
if (StringUtilities.indexOf(value, '[') != -1) {
if (StringUtilities.indexOf(value, ']') != -1) {
final Matcher matcher = SQUARE_BRACKET_PATTERN.matcher(value);
// Find all of the variables inside of the brackets defined by the regex
while (matcher.find()) {
final String topicTypes = matcher.group(ProcessorConstants.BRACKET_CONTENTS);
types = StringUtilities.split(topicTypes, ','); // depends on control dependency: [while], data = [none]
for (final String type : types) {
injectionOptions.addStrictTopicType(type.trim()); // depends on control dependency: [for], data = [type]
}
}
} else {
throw new ParsingException(
format(ProcessorConstants.ERROR_NO_ENDING_BRACKET_MSG + ProcessorConstants.CSLINE_MSG, lineNumber, ']',
line));
}
}
String injectionSetting = getTitle(value, '[');
if (injectionSetting == null) {
throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_INJECTION_MSG, lineNumber, line));
} else if (injectionSetting.trim().equalsIgnoreCase("on")) {
if (types != null) {
injectionOptions.setContentSpecType(InjectionOptions.UserType.STRICT); // depends on control dependency: [if], data = [none]
} else {
injectionOptions.setContentSpecType(InjectionOptions.UserType.ON); // depends on control dependency: [if], data = [none]
}
} else if (injectionSetting.trim().equalsIgnoreCase("off")) {
injectionOptions.setContentSpecType(InjectionOptions.UserType.OFF); // depends on control dependency: [if], data = [none]
} else {
throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_INJECTION_MSG, lineNumber, line));
}
parserData.getContentSpec().setInjectionOptions(injectionOptions); // depends on control dependency: [if], data = [none]
} else if (key.equalsIgnoreCase(CommonConstants.CS_FILE_TITLE) || key.equalsIgnoreCase(CommonConstants.CS_FILE_SHORT_TITLE)) {
final FileList files = parseFilesMetaData(parserData, value, lineNumber, line);
parserData.getContentSpec().appendKeyValueNode(files); // depends on control dependency: [if], data = [none]
} else if (isSpecTopicMetaData(key, value)) {
final SpecTopic specTopic = parseSpecTopicMetaData(parserData, value, key, lineNumber);
parserData.getContentSpec().appendKeyValueNode(new KeyValueNode<SpecTopic>(key, specTopic, lineNumber)); // depends on control dependency: [if], data = [none]
} else {
try {
final KeyValueNode<String> node;
if (ContentSpecUtilities.isMetaDataMultiLine(key)) {
node = parseMultiLineMetaData(parserData, key, value, lineNumber); // depends on control dependency: [if], data = [none]
} else {
node = new KeyValueNode<String>(key, value, lineNumber); // depends on control dependency: [if], data = [none]
}
parserData.getContentSpec().appendKeyValueNode(node); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_METADATA_FORMAT_MSG, lineNumber, line));
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
@Override
public boolean add(S solution) {
//Iterator of individuals over the list
Iterator<S> iterator = getSolutionList().iterator();
while (iterator.hasNext()) {
S element = iterator.next();
int flag = dominanceComparator.compare(solution, element);
if (flag == -1) { // The Individual to insert dominates other
// individuals in the setArchive
iterator.remove(); //Delete it from the setArchive
int location = grid.location(element);
if (grid.getLocationDensity(location) > 1) {//The hypercube contains
grid.removeSolution(location); //more than one individual
} else {
grid.updateGrid(getSolutionList());
}
}
else if (flag == 1) { // An Individual into the file dominates the
// solution to insert
return false; // The solution will not be inserted
}
}
// At this point, the solution may be inserted
if (this.size() == 0) { //The setArchive is empty
this.getSolutionList().add(solution);
grid.updateGrid(getSolutionList());
return true;
}
if (this.getSolutionList().size() < this.getMaxSize()) { //The setArchive is not full
grid.updateGrid(solution, getSolutionList()); // Update the grid if applicable
int location;
location = grid.location(solution); // Get the location of the solution
grid.addSolution(location); // Increment the density of the hypercube
getSolutionList().add(solution); // Add the solution to the list
return true;
}
// At this point, the solution has to be inserted and the setArchive is full
grid.updateGrid(solution, getSolutionList());
int location = grid.location(solution);
if (location == grid.getMostPopulatedHypercube()) { // The solution is in the
// most populated hypercube
return false; // Not inserted
} else {
// Remove an solution from most populated area
prune();
// A solution from most populated hypercube has been removed,
// insert now the solution
grid.addSolution(location);
getSolutionList().add(solution);
}
return true;
} } | public class class_name {
@Override
public boolean add(S solution) {
//Iterator of individuals over the list
Iterator<S> iterator = getSolutionList().iterator();
while (iterator.hasNext()) {
S element = iterator.next();
int flag = dominanceComparator.compare(solution, element);
if (flag == -1) { // The Individual to insert dominates other
// individuals in the setArchive
iterator.remove(); //Delete it from the setArchive // depends on control dependency: [if], data = [none]
int location = grid.location(element);
if (grid.getLocationDensity(location) > 1) {//The hypercube contains
grid.removeSolution(location); //more than one individual // depends on control dependency: [if], data = [none]
} else {
grid.updateGrid(getSolutionList()); // depends on control dependency: [if], data = [none]
}
}
else if (flag == 1) { // An Individual into the file dominates the
// solution to insert
return false; // The solution will not be inserted // depends on control dependency: [if], data = [none]
}
}
// At this point, the solution may be inserted
if (this.size() == 0) { //The setArchive is empty
this.getSolutionList().add(solution); // depends on control dependency: [if], data = [none]
grid.updateGrid(getSolutionList()); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
if (this.getSolutionList().size() < this.getMaxSize()) { //The setArchive is not full
grid.updateGrid(solution, getSolutionList()); // Update the grid if applicable // depends on control dependency: [if], data = [none]
int location;
location = grid.location(solution); // Get the location of the solution // depends on control dependency: [if], data = [none]
grid.addSolution(location); // Increment the density of the hypercube // depends on control dependency: [if], data = [none]
getSolutionList().add(solution); // Add the solution to the list // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
// At this point, the solution has to be inserted and the setArchive is full
grid.updateGrid(solution, getSolutionList());
int location = grid.location(solution);
if (location == grid.getMostPopulatedHypercube()) { // The solution is in the
// most populated hypercube
return false; // Not inserted // depends on control dependency: [if], data = [none]
} else {
// Remove an solution from most populated area
prune(); // depends on control dependency: [if], data = [none]
// A solution from most populated hypercube has been removed,
// insert now the solution
grid.addSolution(location); // depends on control dependency: [if], data = [(location]
getSolutionList().add(solution); // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
private IResource[] getSelectedResources() {
ISelection selection = LocalSelectionTransfer.getTransfer()
.getSelection();
if (selection instanceof IStructuredSelection) {
return getSelectedResources((IStructuredSelection) selection);
}
return NO_RESOURCES;
} } | public class class_name {
private IResource[] getSelectedResources() {
ISelection selection = LocalSelectionTransfer.getTransfer()
.getSelection();
if (selection instanceof IStructuredSelection) {
return getSelectedResources((IStructuredSelection) selection); // depends on control dependency: [if], data = [none]
}
return NO_RESOURCES;
} } |
public class class_name {
private static void appendFullDigits(final Appendable buffer, int value, int minFieldWidth) throws IOException {
// specialized paths for 1 to 4 digits -> avoid the memory allocation from the temporary work array
// see LANG-1248
if (value < 10000) {
// less memory allocation path works for four digits or less
int nDigits = 4;
if (value < 1000) {
--nDigits;
if (value < 100) {
--nDigits;
if (value < 10) {
--nDigits;
}
}
}
// left zero pad
for (int i = minFieldWidth - nDigits; i > 0; --i) {
buffer.append('0');
}
switch (nDigits) {
case 4:
buffer.append((char) (value / 1000 + '0'));
value %= 1000;
case 3:
if (value >= 100) {
buffer.append((char) (value / 100 + '0'));
value %= 100;
} else {
buffer.append('0');
}
case 2:
if (value >= 10) {
buffer.append((char) (value / 10 + '0'));
value %= 10;
} else {
buffer.append('0');
}
case 1:
buffer.append((char) (value + '0'));
}
} else {
// more memory allocation path works for any digits
// build up decimal representation in reverse
final char[] work = new char[MAX_DIGITS];
int digit = 0;
while (value != 0) {
work[digit++] = (char) (value % 10 + '0');
value = value / 10;
}
// pad with zeros
while (digit < minFieldWidth) {
buffer.append('0');
--minFieldWidth;
}
// reverse
while (--digit >= 0) {
buffer.append(work[digit]);
}
}
} } | public class class_name {
private static void appendFullDigits(final Appendable buffer, int value, int minFieldWidth) throws IOException {
// specialized paths for 1 to 4 digits -> avoid the memory allocation from the temporary work array
// see LANG-1248
if (value < 10000) {
// less memory allocation path works for four digits or less
int nDigits = 4;
if (value < 1000) {
--nDigits;
if (value < 100) {
--nDigits;
if (value < 10) {
--nDigits;
}
}
}
// left zero pad
for (int i = minFieldWidth - nDigits; i > 0; --i) {
buffer.append('0');
}
switch (nDigits) {
case 4:
buffer.append((char) (value / 1000 + '0'));
value %= 1000;
case 3:
if (value >= 100) {
buffer.append((char) (value / 100 + '0')); // depends on control dependency: [if], data = [(value]
value %= 100; // depends on control dependency: [if], data = [none]
} else {
buffer.append('0'); // depends on control dependency: [if], data = [none]
}
case 2:
if (value >= 10) {
buffer.append((char) (value / 10 + '0')); // depends on control dependency: [if], data = [(value]
value %= 10; // depends on control dependency: [if], data = [none]
} else {
buffer.append('0'); // depends on control dependency: [if], data = [none]
}
case 1:
buffer.append((char) (value + '0'));
}
} else {
// more memory allocation path works for any digits
// build up decimal representation in reverse
final char[] work = new char[MAX_DIGITS];
int digit = 0;
while (value != 0) {
work[digit++] = (char) (value % 10 + '0');
value = value / 10;
}
// pad with zeros
while (digit < minFieldWidth) {
buffer.append('0');
--minFieldWidth;
}
// reverse
while (--digit >= 0) {
buffer.append(work[digit]);
}
}
} } |
public class class_name {
@Override
public Icon getIcon(JTable table, int column) {
float computedAlpha = 1.0F;
for (RowSorter.SortKey sortKey : table.getRowSorter().getSortKeys()) {
if (table.convertColumnIndexToView(sortKey.getColumn()) == column) {
switch (sortKey.getSortOrder()) {
case ASCENDING:
return new AlphaIcon(UIManager.getIcon("Table.ascendingSortIcon"), computedAlpha);
case DESCENDING:
return new AlphaIcon(UIManager.getIcon("Table.descendingSortIcon"), computedAlpha);
default:
// Just to remove unmatched case warning
}
}
computedAlpha *= alpha;
}
return null;
} } | public class class_name {
@Override
public Icon getIcon(JTable table, int column) {
float computedAlpha = 1.0F;
for (RowSorter.SortKey sortKey : table.getRowSorter().getSortKeys()) {
if (table.convertColumnIndexToView(sortKey.getColumn()) == column) {
switch (sortKey.getSortOrder()) {
case ASCENDING:
return new AlphaIcon(UIManager.getIcon("Table.ascendingSortIcon"), computedAlpha);
case DESCENDING:
return new AlphaIcon(UIManager.getIcon("Table.descendingSortIcon"), computedAlpha);
default:
// Just to remove unmatched case warning
}
}
computedAlpha *= alpha; // depends on control dependency: [for], data = [none]
}
return null;
} } |
public class class_name {
public static SelectedRule rule(String rule, ArgumentBuilder arguments) throws Exception
{
if (AunitRuntime.getParserFactory() == null) throw new IllegalStateException("Parser factory not set by configuration");
for (Method method : collectMethods(AunitRuntime.getParserFactory().getParserClass()))
{
if (method.getName().equals(rule))
{
return new SelectedRule(method, arguments.get());
}
}
throw new Exception("Rule " + rule + " not found");
} } | public class class_name {
public static SelectedRule rule(String rule, ArgumentBuilder arguments) throws Exception
{
if (AunitRuntime.getParserFactory() == null) throw new IllegalStateException("Parser factory not set by configuration");
for (Method method : collectMethods(AunitRuntime.getParserFactory().getParserClass()))
{
if (method.getName().equals(rule))
{
return new SelectedRule(method, arguments.get()); // depends on control dependency: [if], data = [none]
}
}
throw new Exception("Rule " + rule + " not found");
} } |
public class class_name {
public void setResourceBase(String resourceBase)
{
try{
_resourceBase=Resource.newResource(resourceBase);
if(log.isDebugEnabled())log.debug("resourceBase="+_resourceBase+" for "+this);
}
catch(IOException e)
{
log.debug(LogSupport.EXCEPTION,e);
throw new IllegalArgumentException(resourceBase+":"+e.toString());
}
} } | public class class_name {
public void setResourceBase(String resourceBase)
{
try{
_resourceBase=Resource.newResource(resourceBase); // depends on control dependency: [try], data = [none]
if(log.isDebugEnabled())log.debug("resourceBase="+_resourceBase+" for "+this);
}
catch(IOException e)
{
log.debug(LogSupport.EXCEPTION,e);
throw new IllegalArgumentException(resourceBase+":"+e.toString());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected Method mapControlBeanMethodToEJB(Method m) {
Method ejbMethod = findEjbMethod(m, _homeInterface);
if (ejbMethod == null) {
if (_beanInstance == null) {
_beanInstance = resolveBeanInstance();
if (_beanInstance == null) {
throw new ControlException("Unable to resolve bean instance");
}
}
ejbMethod = findEjbMethod(m, _beanInstance.getClass());
if (ejbMethod == null) {
throw new ControlException("Unable to map ejb control interface method to EJB method: " + m.getName());
}
}
return ejbMethod;
} } | public class class_name {
protected Method mapControlBeanMethodToEJB(Method m) {
Method ejbMethod = findEjbMethod(m, _homeInterface);
if (ejbMethod == null) {
if (_beanInstance == null) {
_beanInstance = resolveBeanInstance(); // depends on control dependency: [if], data = [none]
if (_beanInstance == null) {
throw new ControlException("Unable to resolve bean instance");
}
}
ejbMethod = findEjbMethod(m, _beanInstance.getClass()); // depends on control dependency: [if], data = [none]
if (ejbMethod == null) {
throw new ControlException("Unable to map ejb control interface method to EJB method: " + m.getName()); // depends on control dependency: [if], data = [none]
}
}
return ejbMethod;
} } |
public class class_name {
private static void sendMessageBatchOperationMd5Check(SendMessageBatchRequest sendMessageBatchRequest,
SendMessageBatchResult sendMessageBatchResult) {
Map<String, SendMessageBatchRequestEntry> idToRequestEntryMap = new HashMap<String, SendMessageBatchRequestEntry>();
if (sendMessageBatchRequest.getEntries() != null) {
for (SendMessageBatchRequestEntry entry : sendMessageBatchRequest.getEntries()) {
idToRequestEntryMap.put(entry.getId(), entry);
}
}
if (sendMessageBatchResult.getSuccessful() != null) {
for (SendMessageBatchResultEntry entry : sendMessageBatchResult.getSuccessful()) {
String messageBody = idToRequestEntryMap.get(entry.getId()).getMessageBody();
String bodyMd5Returned = entry.getMD5OfMessageBody();
String clientSideBodyMd5 = calculateMessageBodyMd5(messageBody);
if (!clientSideBodyMd5.equals(bodyMd5Returned)) {
throw new AmazonClientException(String.format(MD5_MISMATCH_ERROR_MESSAGE_WITH_ID, MESSAGE_BODY,
entry.getId(), clientSideBodyMd5, bodyMd5Returned));
}
Map<String, MessageAttributeValue> messageAttr = idToRequestEntryMap.get(entry.getId())
.getMessageAttributes();
if (messageAttr != null && !messageAttr.isEmpty()) {
String attrMd5Returned = entry.getMD5OfMessageAttributes();
String clientSideAttrMd5 = calculateMessageAttributesMd5(messageAttr);
if (!clientSideAttrMd5.equals(attrMd5Returned)) {
throw new AmazonClientException(String.format(MD5_MISMATCH_ERROR_MESSAGE_WITH_ID,
MESSAGE_ATTRIBUTES, entry.getId(), clientSideAttrMd5, attrMd5Returned));
}
}
}
}
} } | public class class_name {
private static void sendMessageBatchOperationMd5Check(SendMessageBatchRequest sendMessageBatchRequest,
SendMessageBatchResult sendMessageBatchResult) {
Map<String, SendMessageBatchRequestEntry> idToRequestEntryMap = new HashMap<String, SendMessageBatchRequestEntry>();
if (sendMessageBatchRequest.getEntries() != null) {
for (SendMessageBatchRequestEntry entry : sendMessageBatchRequest.getEntries()) {
idToRequestEntryMap.put(entry.getId(), entry); // depends on control dependency: [for], data = [entry]
}
}
if (sendMessageBatchResult.getSuccessful() != null) {
for (SendMessageBatchResultEntry entry : sendMessageBatchResult.getSuccessful()) {
String messageBody = idToRequestEntryMap.get(entry.getId()).getMessageBody();
String bodyMd5Returned = entry.getMD5OfMessageBody();
String clientSideBodyMd5 = calculateMessageBodyMd5(messageBody);
if (!clientSideBodyMd5.equals(bodyMd5Returned)) {
throw new AmazonClientException(String.format(MD5_MISMATCH_ERROR_MESSAGE_WITH_ID, MESSAGE_BODY,
entry.getId(), clientSideBodyMd5, bodyMd5Returned));
}
Map<String, MessageAttributeValue> messageAttr = idToRequestEntryMap.get(entry.getId())
.getMessageAttributes();
if (messageAttr != null && !messageAttr.isEmpty()) {
String attrMd5Returned = entry.getMD5OfMessageAttributes();
String clientSideAttrMd5 = calculateMessageAttributesMd5(messageAttr);
if (!clientSideAttrMd5.equals(attrMd5Returned)) {
throw new AmazonClientException(String.format(MD5_MISMATCH_ERROR_MESSAGE_WITH_ID,
MESSAGE_ATTRIBUTES, entry.getId(), clientSideAttrMd5, attrMd5Returned));
}
}
}
}
} } |
public class class_name {
public java.util.List<String> getMatchingEventTypes() {
if (matchingEventTypes == null) {
matchingEventTypes = new com.amazonaws.internal.SdkInternalList<String>();
}
return matchingEventTypes;
} } | public class class_name {
public java.util.List<String> getMatchingEventTypes() {
if (matchingEventTypes == null) {
matchingEventTypes = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return matchingEventTypes;
} } |
public class class_name {
public Statement createStatement() throws SQLException {
Statement result = null;
checkClosed();
try {
result =new StatementHandle(this.connection.createStatement(), this, this.logStatementsEnabled);
if (this.closeOpenStatements){
this.trackedStatement.put(result, maybeCaptureStackTrace());
}
} catch (SQLException e) {
throw markPossiblyBroken(e);
}
return result;
} } | public class class_name {
public Statement createStatement() throws SQLException {
Statement result = null;
checkClosed();
try {
result =new StatementHandle(this.connection.createStatement(), this, this.logStatementsEnabled);
if (this.closeOpenStatements){
this.trackedStatement.put(result, maybeCaptureStackTrace());
// depends on control dependency: [if], data = [none]
}
} catch (SQLException e) {
throw markPossiblyBroken(e);
}
return result;
} } |
public class class_name {
static byte[] marshallIDL5Config(AttributeConfig_5 config) {
XLOGGER.entry();
// System.out.println("config "+ ToStringBuilder.reflectionToString(config, ToStringStyle.MULTI_LINE_STYLE));
final CDROutputStream os = new CDROutputStream();
try {
AttributeConfig_5Helper.write(os, config);
XLOGGER.exit();
return cppAlignment(os.getBufferCopy());
} finally {
os.close();
}
} } | public class class_name {
static byte[] marshallIDL5Config(AttributeConfig_5 config) {
XLOGGER.entry();
// System.out.println("config "+ ToStringBuilder.reflectionToString(config, ToStringStyle.MULTI_LINE_STYLE));
final CDROutputStream os = new CDROutputStream();
try {
AttributeConfig_5Helper.write(os, config); // depends on control dependency: [try], data = [none]
XLOGGER.exit(); // depends on control dependency: [try], data = [none]
return cppAlignment(os.getBufferCopy()); // depends on control dependency: [try], data = [none]
} finally {
os.close();
}
} } |
public class class_name {
private void reset() {
int count = 0;
for (int i = 0; i < table.length; i++) {
count += Long.bitCount(table[i] & ONE_MASK);
table[i] = (table[i] >>> 1) & RESET_MASK;
}
size = (size >>> 1) - (count >>> 2);
} } | public class class_name {
private void reset() {
int count = 0;
for (int i = 0; i < table.length; i++) {
count += Long.bitCount(table[i] & ONE_MASK); // depends on control dependency: [for], data = [i]
table[i] = (table[i] >>> 1) & RESET_MASK; // depends on control dependency: [for], data = [i]
}
size = (size >>> 1) - (count >>> 2);
} } |
public class class_name {
public boolean matches(ServiceType serviceType)
{
if (serviceType == null) return false;
if (equals(serviceType)) return true;
if (isAbstractType())
{
if (serviceType.isAbstractType())
{
if (!getPrincipleTypeName().equals(serviceType.getPrincipleTypeName())) return false;
return getConcreteTypeName().equals(serviceType.getConcreteTypeName());
}
else
{
return false;
}
}
else
{
if (serviceType.isAbstractType())
{
return getPrincipleTypeName().equals(serviceType.getPrincipleTypeName());
}
else
{
return getPrincipleTypeName().equals(serviceType.getPrincipleTypeName());
}
}
} } | public class class_name {
public boolean matches(ServiceType serviceType)
{
if (serviceType == null) return false;
if (equals(serviceType)) return true;
if (isAbstractType())
{
if (serviceType.isAbstractType())
{
if (!getPrincipleTypeName().equals(serviceType.getPrincipleTypeName())) return false;
return getConcreteTypeName().equals(serviceType.getConcreteTypeName()); // depends on control dependency: [if], data = [none]
}
else
{
return false; // depends on control dependency: [if], data = [none]
}
}
else
{
if (serviceType.isAbstractType())
{
return getPrincipleTypeName().equals(serviceType.getPrincipleTypeName()); // depends on control dependency: [if], data = [none]
}
else
{
return getPrincipleTypeName().equals(serviceType.getPrincipleTypeName()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void onFailure(JoynrException newException) {
exception = newException;
status = new RequestStatus(RequestStatusCode.ERROR);
try {
statusLock.lock();
statusLockChangedCondition.signalAll();
} finally {
statusLock.unlock();
}
} } | public class class_name {
public void onFailure(JoynrException newException) {
exception = newException;
status = new RequestStatus(RequestStatusCode.ERROR);
try {
statusLock.lock(); // depends on control dependency: [try], data = [none]
statusLockChangedCondition.signalAll(); // depends on control dependency: [try], data = [none]
} finally {
statusLock.unlock();
}
} } |
public class class_name {
public void shutDown() {
vectorizationExecutor.shutdown(); // Disable new tasks from being submitted
try {
// Wait a while for existing tasks to terminate
if (!vectorizationExecutor.awaitTermination(10, TimeUnit.SECONDS)) {
vectorizationExecutor.shutdownNow(); // Cancel currently executing tasks
// Wait a while for tasks to respond to being cancelled
if (!vectorizationExecutor.awaitTermination(10, TimeUnit.SECONDS))
System.err.println("Pool did not terminate");
}
} catch (InterruptedException ie) {
// (Re-)Cancel if current thread also interrupted
vectorizationExecutor.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
}
} } | public class class_name {
public void shutDown() {
vectorizationExecutor.shutdown(); // Disable new tasks from being submitted
try {
// Wait a while for existing tasks to terminate
if (!vectorizationExecutor.awaitTermination(10, TimeUnit.SECONDS)) {
vectorizationExecutor.shutdownNow(); // Cancel currently executing tasks
// depends on control dependency: [if], data = [none]
// Wait a while for tasks to respond to being cancelled
if (!vectorizationExecutor.awaitTermination(10, TimeUnit.SECONDS))
System.err.println("Pool did not terminate");
}
} catch (InterruptedException ie) {
// (Re-)Cancel if current thread also interrupted
vectorizationExecutor.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Object deserialize(JsonObject message) {
String type = message.getString("type");
if (type == null) {
return message.getValue("value");
} else {
switch (type) {
case "buffer":
return new Buffer(message.getBinary("value"));
case "bytes":
return message.getBinary("value");
case "serialized":
byte[] bytes = message.getBinary("value");
ObjectInputStream stream = null;
try {
stream = new ThreadObjectInputStream(new ByteArrayInputStream(bytes));
return stream.readObject();
} catch (ClassNotFoundException | IOException e) {
throw new SerializationException(e.getMessage());
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
}
}
}
default:
return message.getValue("value");
}
}
} } | public class class_name {
public Object deserialize(JsonObject message) {
String type = message.getString("type");
if (type == null) {
return message.getValue("value"); // depends on control dependency: [if], data = [none]
} else {
switch (type) {
case "buffer":
return new Buffer(message.getBinary("value"));
case "bytes":
return message.getBinary("value");
case "serialized":
byte[] bytes = message.getBinary("value");
ObjectInputStream stream = null;
try {
stream = new ThreadObjectInputStream(new ByteArrayInputStream(bytes)); // depends on control dependency: [try], data = [none]
return stream.readObject(); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException | IOException e) {
throw new SerializationException(e.getMessage());
} finally { // depends on control dependency: [catch], data = [none]
if (stream != null) {
try {
stream.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
} // depends on control dependency: [catch], data = [none]
}
}
default:
return message.getValue("value");
}
}
} } |
public class class_name {
public static void stopPollingForMessages(String queueURL) {
if (!StringUtils.isBlank(queueURL) && POLLING_THREADS.containsKey(queueURL)) {
logger.info("Stopping SQS river on queue {} ...", queueURL);
POLLING_THREADS.get(queueURL).cancel(true);
POLLING_THREADS.remove(queueURL);
}
} } | public class class_name {
public static void stopPollingForMessages(String queueURL) {
if (!StringUtils.isBlank(queueURL) && POLLING_THREADS.containsKey(queueURL)) {
logger.info("Stopping SQS river on queue {} ...", queueURL); // depends on control dependency: [if], data = [none]
POLLING_THREADS.get(queueURL).cancel(true); // depends on control dependency: [if], data = [none]
POLLING_THREADS.remove(queueURL); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void buildWhereClause(KunderaQuery kunderaQuery, EntityMetadata metadata, MetamodelImpl metaModel,
CQLTranslator translator, StringBuilder builder) {
for (Object clause : kunderaQuery.getFilterClauseQueue()) {
FilterClause filterClause = (FilterClause) clause;
Field f = (Field) metaModel.entity(metadata.getEntityClazz())
.getAttribute(metadata.getFieldName(filterClause.getProperty())).getJavaMember();
String jpaColumnName = getColumnName(metadata, filterClause.getProperty());
if (metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) {
Field[] fields = metadata.getIdAttribute().getBindableJavaType().getDeclaredFields();
EmbeddableType compoundKey = metaModel.embeddable(metadata.getIdAttribute().getBindableJavaType());
for (Field field : fields) {
if (field != null && !Modifier.isStatic(field.getModifiers())
&& !Modifier.isTransient(field.getModifiers()) && !field.isAnnotationPresent(Transient.class)) {
Attribute attribute = compoundKey.getAttribute(field.getName());
String columnName = ((AbstractAttribute) attribute).getJPAColumnName();
Object value = PropertyAccessorHelper.getObject(filterClause.getValue().get(0), field);
// TODO
translator.buildWhereClause(builder, field.getType(), columnName, value,
filterClause.getCondition(), false);
}
}
} else {
translator.buildWhereClause(builder, f.getType(), jpaColumnName, filterClause.getValue().get(0),
filterClause.getCondition(), false);
}
}
builder.delete(builder.lastIndexOf(CQLTranslator.AND_CLAUSE), builder.length());
} } | public class class_name {
private void buildWhereClause(KunderaQuery kunderaQuery, EntityMetadata metadata, MetamodelImpl metaModel,
CQLTranslator translator, StringBuilder builder) {
for (Object clause : kunderaQuery.getFilterClauseQueue()) {
FilterClause filterClause = (FilterClause) clause;
Field f = (Field) metaModel.entity(metadata.getEntityClazz())
.getAttribute(metadata.getFieldName(filterClause.getProperty())).getJavaMember();
String jpaColumnName = getColumnName(metadata, filterClause.getProperty());
if (metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) {
Field[] fields = metadata.getIdAttribute().getBindableJavaType().getDeclaredFields();
EmbeddableType compoundKey = metaModel.embeddable(metadata.getIdAttribute().getBindableJavaType());
for (Field field : fields) {
if (field != null && !Modifier.isStatic(field.getModifiers())
&& !Modifier.isTransient(field.getModifiers()) && !field.isAnnotationPresent(Transient.class)) {
Attribute attribute = compoundKey.getAttribute(field.getName());
String columnName = ((AbstractAttribute) attribute).getJPAColumnName();
Object value = PropertyAccessorHelper.getObject(filterClause.getValue().get(0), field);
// TODO
translator.buildWhereClause(builder, field.getType(), columnName, value,
filterClause.getCondition(), false); // depends on control dependency: [if], data = [none]
}
}
} else {
translator.buildWhereClause(builder, f.getType(), jpaColumnName, filterClause.getValue().get(0),
filterClause.getCondition(), false); // depends on control dependency: [if], data = [none]
}
}
builder.delete(builder.lastIndexOf(CQLTranslator.AND_CLAUSE), builder.length());
} } |
public class class_name {
public static boolean parseFloatAttribute(String attribute, String value,
TypedValue outValue, boolean requireUnit) {
assert requireUnit == false || attribute != null;
// remove the space before and after
value = value.trim();
int len = value.length();
if (len <= 0) {
return false;
}
// check that there's no non ascii characters.
char[] buf = value.toCharArray();
for (int i = 0 ; i < len ; i++) {
if (buf[i] > 255) {
return false;
}
}
// check the first character
if (buf[0] < '0' && buf[0] > '9' && buf[0] != '.' && buf[0] != '-') {
return false;
}
// now look for the string that is after the float...
Matcher m = sFloatPattern.matcher(value);
if (m.matches()) {
String f_str = m.group(1);
String end = m.group(2);
float f;
try {
f = Float.parseFloat(f_str);
} catch (NumberFormatException e) {
// this shouldn't happen with the regexp above.
return false;
}
if (end.length() > 0 && end.charAt(0) != ' ') {
// Might be a unit...
if (parseUnit(end, outValue, sFloatOut)) {
computeTypedValue(outValue, f, sFloatOut[0]);
return true;
}
return false;
}
// make sure it's only spaces at the end.
end = end.trim();
if (end.length() == 0) {
if (outValue != null) {
outValue.assetCookie = 0;
outValue.string = null;
if (requireUnit == false) {
outValue.type = TypedValue.TYPE_FLOAT;
outValue.data = Float.floatToIntBits(f);
} else {
// no unit when required? Use dp and out an error.
applyUnit(sUnitNames[1], outValue, sFloatOut);
computeTypedValue(outValue, f, sFloatOut[0]);
System.out.println(String.format(
"Dimension \"%1$s\" in attribute \"%2$s\" is missing unit!",
value, attribute));
}
return true;
}
}
}
return false;
} } | public class class_name {
public static boolean parseFloatAttribute(String attribute, String value,
TypedValue outValue, boolean requireUnit) {
assert requireUnit == false || attribute != null;
// remove the space before and after
value = value.trim();
int len = value.length();
if (len <= 0) {
return false; // depends on control dependency: [if], data = [none]
}
// check that there's no non ascii characters.
char[] buf = value.toCharArray();
for (int i = 0 ; i < len ; i++) {
if (buf[i] > 255) {
return false; // depends on control dependency: [if], data = [none]
}
}
// check the first character
if (buf[0] < '0' && buf[0] > '9' && buf[0] != '.' && buf[0] != '-') {
return false; // depends on control dependency: [if], data = [none]
}
// now look for the string that is after the float...
Matcher m = sFloatPattern.matcher(value);
if (m.matches()) {
String f_str = m.group(1);
String end = m.group(2);
float f;
try {
f = Float.parseFloat(f_str); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
// this shouldn't happen with the regexp above.
return false;
} // depends on control dependency: [catch], data = [none]
if (end.length() > 0 && end.charAt(0) != ' ') {
// Might be a unit...
if (parseUnit(end, outValue, sFloatOut)) {
computeTypedValue(outValue, f, sFloatOut[0]); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false; // depends on control dependency: [if], data = [none]
}
// make sure it's only spaces at the end.
end = end.trim(); // depends on control dependency: [if], data = [none]
if (end.length() == 0) {
if (outValue != null) {
outValue.assetCookie = 0; // depends on control dependency: [if], data = [none]
outValue.string = null; // depends on control dependency: [if], data = [none]
if (requireUnit == false) {
outValue.type = TypedValue.TYPE_FLOAT; // depends on control dependency: [if], data = [none]
outValue.data = Float.floatToIntBits(f); // depends on control dependency: [if], data = [none]
} else {
// no unit when required? Use dp and out an error.
applyUnit(sUnitNames[1], outValue, sFloatOut); // depends on control dependency: [if], data = [none]
computeTypedValue(outValue, f, sFloatOut[0]); // depends on control dependency: [if], data = [none]
System.out.println(String.format(
"Dimension \"%1$s\" in attribute \"%2$s\" is missing unit!",
value, attribute)); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
public static Set<Artifact> getArtifactsToConsider(AbstractWisdomMojo mojo, DependencyGraphBuilder graph,
boolean transitive, ArtifactFilter filter) {
// No transitive.
Set<Artifact> artifacts;
if (!transitive) {
// Direct dependencies that the current project has (no transitives)
artifacts = mojo.project.getDependencyArtifacts();
} else {
// All dependencies that the current project has, including transitive ones. Contents are lazily
// populated, so depending on what phases have run dependencies in some scopes won't be
// included.
artifacts = getTransitiveDependencies(mojo, graph, filter);
}
return artifacts;
} } | public class class_name {
public static Set<Artifact> getArtifactsToConsider(AbstractWisdomMojo mojo, DependencyGraphBuilder graph,
boolean transitive, ArtifactFilter filter) {
// No transitive.
Set<Artifact> artifacts;
if (!transitive) {
// Direct dependencies that the current project has (no transitives)
artifacts = mojo.project.getDependencyArtifacts(); // depends on control dependency: [if], data = [none]
} else {
// All dependencies that the current project has, including transitive ones. Contents are lazily
// populated, so depending on what phases have run dependencies in some scopes won't be
// included.
artifacts = getTransitiveDependencies(mojo, graph, filter); // depends on control dependency: [if], data = [none]
}
return artifacts;
} } |
public class class_name {
private void removeStaleEntries() {
FileLockReference ref;
while ((ref = (FileLockReference)queue.poll()) != null) {
FileKey fk = ref.fileKey();
List<FileLockReference> list = lockMap.get(fk);
if (list != null) {
synchronized (list) {
list.remove(ref);
removeKeyIfEmpty(fk, list);
}
}
}
} } | public class class_name {
private void removeStaleEntries() {
FileLockReference ref;
while ((ref = (FileLockReference)queue.poll()) != null) {
FileKey fk = ref.fileKey();
List<FileLockReference> list = lockMap.get(fk);
if (list != null) {
synchronized (list) { // depends on control dependency: [if], data = [(list]
list.remove(ref);
removeKeyIfEmpty(fk, list);
}
}
}
} } |
public class class_name {
public List<Factor> getMinimalFactors() {
// Sort factors in descending order of size.
List<Factor> sortedFactors = Lists.newArrayList(factors);
Collections.sort(sortedFactors, new Comparator<Factor>() {
public int compare(Factor f1, Factor f2) {
return f2.getVars().size() - f1.getVars().size();
}
});
List<List<Factor>> factorsToMerge = Lists.newArrayList();
Set<Integer> factorNums = Sets.newHashSet();
Multimap<Integer, Integer> varFactorIndex = HashMultimap.create();
for (Factor f : sortedFactors) {
Set<Integer> mergeableFactors = Sets.newHashSet(factorNums);
for (int varNum : f.getVars().getVariableNumsArray()) {
mergeableFactors.retainAll(varFactorIndex.get(varNum));
}
if (mergeableFactors.size() > 0) {
int factorIndex = Iterables.getFirst(mergeableFactors, -1);
factorsToMerge.get(factorIndex).add(f);
} else {
for (int varNum : f.getVars().getVariableNumsArray()) {
varFactorIndex.put(varNum, factorsToMerge.size());
}
factorNums.add(factorsToMerge.size());
factorsToMerge.add(Lists.newArrayList(f));
}
}
// Merge factors using size as a guideline
List<Factor> finalFactors = Lists.newArrayListWithCapacity(factorsToMerge.size());
for (List<Factor> toMerge : factorsToMerge) {
// Sort the factors by their .size() attribute, sparsest factors
// first.
Collections.sort(toMerge, new Comparator<Factor>() {
public int compare(Factor f1, Factor f2) {
return (int) (f1.size() - f2.size());
}
});
finalFactors.add(Factors.product(toMerge));
}
return finalFactors;
} } | public class class_name {
public List<Factor> getMinimalFactors() {
// Sort factors in descending order of size.
List<Factor> sortedFactors = Lists.newArrayList(factors);
Collections.sort(sortedFactors, new Comparator<Factor>() {
public int compare(Factor f1, Factor f2) {
return f2.getVars().size() - f1.getVars().size();
}
});
List<List<Factor>> factorsToMerge = Lists.newArrayList();
Set<Integer> factorNums = Sets.newHashSet();
Multimap<Integer, Integer> varFactorIndex = HashMultimap.create();
for (Factor f : sortedFactors) {
Set<Integer> mergeableFactors = Sets.newHashSet(factorNums);
for (int varNum : f.getVars().getVariableNumsArray()) {
mergeableFactors.retainAll(varFactorIndex.get(varNum)); // depends on control dependency: [for], data = [varNum]
}
if (mergeableFactors.size() > 0) {
int factorIndex = Iterables.getFirst(mergeableFactors, -1);
factorsToMerge.get(factorIndex).add(f); // depends on control dependency: [if], data = [none]
} else {
for (int varNum : f.getVars().getVariableNumsArray()) {
varFactorIndex.put(varNum, factorsToMerge.size()); // depends on control dependency: [for], data = [varNum]
}
factorNums.add(factorsToMerge.size()); // depends on control dependency: [if], data = [none]
factorsToMerge.add(Lists.newArrayList(f)); // depends on control dependency: [if], data = [none]
}
}
// Merge factors using size as a guideline
List<Factor> finalFactors = Lists.newArrayListWithCapacity(factorsToMerge.size());
for (List<Factor> toMerge : factorsToMerge) {
// Sort the factors by their .size() attribute, sparsest factors
// first.
Collections.sort(toMerge, new Comparator<Factor>() {
public int compare(Factor f1, Factor f2) {
return (int) (f1.size() - f2.size());
}
}); // depends on control dependency: [for], data = [none]
finalFactors.add(Factors.product(toMerge)); // depends on control dependency: [for], data = [toMerge]
}
return finalFactors;
} } |
public class class_name {
public final void annotationArgs(AnnotationDescr descr) throws RecognitionException {
Token value=null;
try {
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:188:3: ( LEFT_PAREN (value= ID | annotationElementValuePairs[descr] )? RIGHT_PAREN )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:188:5: LEFT_PAREN (value= ID | annotationElementValuePairs[descr] )? RIGHT_PAREN
{
match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_annotationArgs945); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:189:5: (value= ID | annotationElementValuePairs[descr] )?
int alt19=3;
int LA19_0 = input.LA(1);
if ( (LA19_0==ID) ) {
int LA19_1 = input.LA(2);
if ( (LA19_1==EQUALS_ASSIGN) ) {
alt19=2;
}
else if ( (LA19_1==RIGHT_PAREN) ) {
alt19=1;
}
}
switch (alt19) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:190:8: value= ID
{
value=(Token)match(input,ID,FOLLOW_ID_in_annotationArgs962); if (state.failed) return;
if ( state.backtracking==0 ) { if ( buildDescr ) { descr.setValue( (value!=null?value.getText():null) ); } }
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:191:10: annotationElementValuePairs[descr]
{
pushFollow(FOLLOW_annotationElementValuePairs_in_annotationArgs975);
annotationElementValuePairs(descr);
state._fsp--;
if (state.failed) return;
}
break;
}
match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_annotationArgs989); if (state.failed) return;
}
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
} } | public class class_name {
public final void annotationArgs(AnnotationDescr descr) throws RecognitionException {
Token value=null;
try {
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:188:3: ( LEFT_PAREN (value= ID | annotationElementValuePairs[descr] )? RIGHT_PAREN )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:188:5: LEFT_PAREN (value= ID | annotationElementValuePairs[descr] )? RIGHT_PAREN
{
match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_annotationArgs945); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:189:5: (value= ID | annotationElementValuePairs[descr] )?
int alt19=3;
int LA19_0 = input.LA(1);
if ( (LA19_0==ID) ) {
int LA19_1 = input.LA(2);
if ( (LA19_1==EQUALS_ASSIGN) ) {
alt19=2; // depends on control dependency: [if], data = [none]
}
else if ( (LA19_1==RIGHT_PAREN) ) {
alt19=1; // depends on control dependency: [if], data = [none]
}
}
switch (alt19) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:190:8: value= ID
{
value=(Token)match(input,ID,FOLLOW_ID_in_annotationArgs962); if (state.failed) return;
if ( state.backtracking==0 ) { if ( buildDescr ) { descr.setValue( (value!=null?value.getText():null) ); } } // depends on control dependency: [if], data = [none]
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:191:10: annotationElementValuePairs[descr]
{
pushFollow(FOLLOW_annotationElementValuePairs_in_annotationArgs975);
annotationElementValuePairs(descr);
state._fsp--;
if (state.failed) return;
}
break;
}
match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_annotationArgs989); if (state.failed) return;
}
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
} } |
public class class_name {
public void remove( int index ) {
T removed = data[index];
for( int i = index+1; i < size; i++ ) {
data[i-1] = data[i];
}
data[size-1] = removed;
size--;
} } | public class class_name {
public void remove( int index ) {
T removed = data[index];
for( int i = index+1; i < size; i++ ) {
data[i-1] = data[i]; // depends on control dependency: [for], data = [i]
}
data[size-1] = removed;
size--;
} } |
public class class_name {
public Country getCountryV6(String ipAddress) {
InetAddress addr;
try {
addr = InetAddress.getByName(ipAddress);
} catch (UnknownHostException e) {
return UNKNOWN_COUNTRY;
}
return getCountryV6(addr);
} } | public class class_name {
public Country getCountryV6(String ipAddress) {
InetAddress addr;
try {
addr = InetAddress.getByName(ipAddress); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
return UNKNOWN_COUNTRY;
} // depends on control dependency: [catch], data = [none]
return getCountryV6(addr);
} } |
public class class_name {
protected <T extends CSSProperty> boolean genericTermIdent(Class<T> type,
Term<?> term, boolean avoidInherit, String propertyName,
Map<String, CSSProperty> properties) {
if (term instanceof TermIdent) {
return genericProperty(type, (TermIdent) term, avoidInherit,
properties, propertyName);
}
return false;
} } | public class class_name {
protected <T extends CSSProperty> boolean genericTermIdent(Class<T> type,
Term<?> term, boolean avoidInherit, String propertyName,
Map<String, CSSProperty> properties) {
if (term instanceof TermIdent) {
return genericProperty(type, (TermIdent) term, avoidInherit,
properties, propertyName); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void tag(String tagString) throws LiquibaseException {
LockService lockService = LockServiceFactory.getInstance().getLockService(database);
lockService.waitForLock();
try {
ChangeLogHistoryServiceFactory.getInstance().getChangeLogService(database).generateDeploymentId();
checkLiquibaseTables(false, null, new Contexts(),
new LabelExpression());
getDatabase().tag(tagString);
} finally {
try {
lockService.releaseLock();
} catch (LockException e) {
LOG.severe(LogType.LOG, MSG_COULD_NOT_RELEASE_LOCK, e);
}
}
} } | public class class_name {
public void tag(String tagString) throws LiquibaseException {
LockService lockService = LockServiceFactory.getInstance().getLockService(database);
lockService.waitForLock();
try {
ChangeLogHistoryServiceFactory.getInstance().getChangeLogService(database).generateDeploymentId();
checkLiquibaseTables(false, null, new Contexts(),
new LabelExpression());
getDatabase().tag(tagString);
} finally {
try {
lockService.releaseLock(); // depends on control dependency: [try], data = [none]
} catch (LockException e) {
LOG.severe(LogType.LOG, MSG_COULD_NOT_RELEASE_LOCK, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static StringConsumers buildConsumer(
final String zookeeperConfig,//
final String topic,//
final String groupId,//
final IMessageListener<String> listener, //
final int threads) {
Properties props = new Properties();
props.put("zk.connect", zookeeperConfig);
props.put("zk.sessiontimeout.ms", "30000");
props.put("zk.connectiontimeout.ms", "30000");
final String JAFKA_PREFIX = "jafka.";
for (Map.Entry<Object, Object> e : System.getProperties().entrySet()) {
String name = (String) e.getKey();
if (name.startsWith(JAFKA_PREFIX)) {
props.put(name.substring(JAFKA_PREFIX.length()), (String) e.getValue());
}
}
return buildConsumer(props, topic, groupId, listener, threads);
} } | public class class_name {
public static StringConsumers buildConsumer(
final String zookeeperConfig,//
final String topic,//
final String groupId,//
final IMessageListener<String> listener, //
final int threads) {
Properties props = new Properties();
props.put("zk.connect", zookeeperConfig);
props.put("zk.sessiontimeout.ms", "30000");
props.put("zk.connectiontimeout.ms", "30000");
final String JAFKA_PREFIX = "jafka.";
for (Map.Entry<Object, Object> e : System.getProperties().entrySet()) {
String name = (String) e.getKey();
if (name.startsWith(JAFKA_PREFIX)) {
props.put(name.substring(JAFKA_PREFIX.length()), (String) e.getValue()); // depends on control dependency: [if], data = [none]
}
}
return buildConsumer(props, topic, groupId, listener, threads);
} } |
public class class_name {
public void marshall(AssociateTagOptionWithResourceRequest associateTagOptionWithResourceRequest, ProtocolMarshaller protocolMarshaller) {
if (associateTagOptionWithResourceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(associateTagOptionWithResourceRequest.getResourceId(), RESOURCEID_BINDING);
protocolMarshaller.marshall(associateTagOptionWithResourceRequest.getTagOptionId(), TAGOPTIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AssociateTagOptionWithResourceRequest associateTagOptionWithResourceRequest, ProtocolMarshaller protocolMarshaller) {
if (associateTagOptionWithResourceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(associateTagOptionWithResourceRequest.getResourceId(), RESOURCEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(associateTagOptionWithResourceRequest.getTagOptionId(), TAGOPTIONID_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 String getSelectorString() {
StringBuilder sb = new StringBuilder();
for (List<String> selector : selectors) {
if (sb.length() > 0) {
sb.append(",");
}
for (String s : selector) {
if (sb.length() > 0) {
sb.append(" ");
}
sb.append(s);
}
}
return sb.toString();
} } | public class class_name {
public String getSelectorString() {
StringBuilder sb = new StringBuilder();
for (List<String> selector : selectors) {
if (sb.length() > 0) {
sb.append(","); // depends on control dependency: [if], data = [none]
}
for (String s : selector) {
if (sb.length() > 0) {
sb.append(" "); // depends on control dependency: [if], data = [none]
}
sb.append(s); // depends on control dependency: [for], data = [s]
}
}
return sb.toString();
} } |
public class class_name {
public void marshall(WebsiteCaSummary websiteCaSummary, ProtocolMarshaller protocolMarshaller) {
if (websiteCaSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(websiteCaSummary.getWebsiteCaId(), WEBSITECAID_BINDING);
protocolMarshaller.marshall(websiteCaSummary.getCreatedTime(), CREATEDTIME_BINDING);
protocolMarshaller.marshall(websiteCaSummary.getDisplayName(), DISPLAYNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(WebsiteCaSummary websiteCaSummary, ProtocolMarshaller protocolMarshaller) {
if (websiteCaSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(websiteCaSummary.getWebsiteCaId(), WEBSITECAID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(websiteCaSummary.getCreatedTime(), CREATEDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(websiteCaSummary.getDisplayName(), DISPLAYNAME_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 void removeBlockQuotePrefix ()
{
Line aLine = m_aLines;
while (aLine != null)
{
if (!aLine.m_bIsEmpty)
{
if (aLine.m_sValue.charAt (aLine.m_nLeading) == '>')
{
int rem = aLine.m_nLeading + 1;
if (aLine.m_nLeading + 1 < aLine.m_sValue.length () && aLine.m_sValue.charAt (aLine.m_nLeading + 1) == ' ')
rem++;
aLine.m_sValue = aLine.m_sValue.substring (rem);
aLine.initLeading ();
}
}
aLine = aLine.m_aNext;
}
} } | public class class_name {
public void removeBlockQuotePrefix ()
{
Line aLine = m_aLines;
while (aLine != null)
{
if (!aLine.m_bIsEmpty)
{
if (aLine.m_sValue.charAt (aLine.m_nLeading) == '>')
{
int rem = aLine.m_nLeading + 1;
if (aLine.m_nLeading + 1 < aLine.m_sValue.length () && aLine.m_sValue.charAt (aLine.m_nLeading + 1) == ' ')
rem++;
aLine.m_sValue = aLine.m_sValue.substring (rem); // depends on control dependency: [if], data = [none]
aLine.initLeading (); // depends on control dependency: [if], data = [none]
}
}
aLine = aLine.m_aNext; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public GroovyExpression optimize(GroovyExpression source) {
LOGGER.debug("Optimizing gremlin query: " + source);
OptimizationContext context = new OptimizationContext();
GroovyExpression updatedExpression = source;
for (GremlinOptimization opt : optimizations) {
updatedExpression = optimize(updatedExpression, opt, context);
LOGGER.debug("After "+ opt.getClass().getSimpleName() + ", query = " + updatedExpression);
}
StatementListExpression result = new StatementListExpression();
result.addStatements(context.getInitialStatements());
result.addStatement(updatedExpression);
LOGGER.debug("Final optimized query: " + result.toString());
return result;
} } | public class class_name {
public GroovyExpression optimize(GroovyExpression source) {
LOGGER.debug("Optimizing gremlin query: " + source);
OptimizationContext context = new OptimizationContext();
GroovyExpression updatedExpression = source;
for (GremlinOptimization opt : optimizations) {
updatedExpression = optimize(updatedExpression, opt, context); // depends on control dependency: [for], data = [opt]
LOGGER.debug("After "+ opt.getClass().getSimpleName() + ", query = " + updatedExpression); // depends on control dependency: [for], data = [opt]
}
StatementListExpression result = new StatementListExpression();
result.addStatements(context.getInitialStatements());
result.addStatement(updatedExpression);
LOGGER.debug("Final optimized query: " + result.toString());
return result;
} } |
public class class_name {
@NonNull
public Triple<Boolean, Item, Integer> recursive(AdapterPredicate<Item> predicate, int globalStartPosition, boolean stopOnMatch) {
for (int i = globalStartPosition; i < getItemCount(); i++) {
//retrieve the item + it's adapter
RelativeInfo<Item> relativeInfo = getRelativeInfo(i);
Item item = relativeInfo.item;
if (predicate.apply(relativeInfo.adapter, i, item, i) && stopOnMatch) {
return new Triple<>(true, item, i);
}
if (item instanceof IExpandable) {
Triple<Boolean, Item, Integer> res = FastAdapter.recursiveSub(relativeInfo.adapter, i, (IExpandable) item, predicate, stopOnMatch);
if (res.first && stopOnMatch) {
return res;
}
}
}
return new Triple<>(false, null, null);
} } | public class class_name {
@NonNull
public Triple<Boolean, Item, Integer> recursive(AdapterPredicate<Item> predicate, int globalStartPosition, boolean stopOnMatch) {
for (int i = globalStartPosition; i < getItemCount(); i++) {
//retrieve the item + it's adapter
RelativeInfo<Item> relativeInfo = getRelativeInfo(i);
Item item = relativeInfo.item;
if (predicate.apply(relativeInfo.adapter, i, item, i) && stopOnMatch) {
return new Triple<>(true, item, i); // depends on control dependency: [if], data = [none]
}
if (item instanceof IExpandable) {
Triple<Boolean, Item, Integer> res = FastAdapter.recursiveSub(relativeInfo.adapter, i, (IExpandable) item, predicate, stopOnMatch);
if (res.first && stopOnMatch) {
return res; // depends on control dependency: [if], data = [none]
}
}
}
return new Triple<>(false, null, null);
} } |
public class class_name {
public void concatenate(JavaMethod tail)
{
CodeAttribute codeAttr = getCode();
CodeAttribute tailCodeAttr = tail.getCode();
byte []code = codeAttr.getCode();
byte []tailCode = tailCodeAttr.getCode();
int codeLength = code.length;
if ((code[codeLength - 1] & 0xff) == CodeVisitor.RETURN)
codeLength = codeLength - 1;
byte []newCode = new byte[codeLength + tailCode.length];
System.arraycopy(code, 0, newCode, 0, codeLength);
System.arraycopy(tailCode, 0, newCode, codeLength, tailCode.length);
codeAttr.setCode(newCode);
if (codeAttr.getMaxStack() < tailCodeAttr.getMaxStack())
codeAttr.setMaxStack(tailCodeAttr.getMaxStack());
if (codeAttr.getMaxLocals() < tailCodeAttr.getMaxLocals())
codeAttr.setMaxLocals(tailCodeAttr.getMaxLocals());
ArrayList<CodeAttribute.ExceptionItem> exns = tailCodeAttr.getExceptions();
for (int i = 0; i < exns.size(); i++) {
CodeAttribute.ExceptionItem exn = exns.get(i);
CodeAttribute.ExceptionItem newExn = new CodeAttribute.ExceptionItem();
newExn.setType(exn.getType());
newExn.setStart(exn.getStart() + codeLength);
newExn.setEnd(exn.getEnd() + codeLength);
newExn.setHandler(exn.getHandler() + codeLength);
}
} } | public class class_name {
public void concatenate(JavaMethod tail)
{
CodeAttribute codeAttr = getCode();
CodeAttribute tailCodeAttr = tail.getCode();
byte []code = codeAttr.getCode();
byte []tailCode = tailCodeAttr.getCode();
int codeLength = code.length;
if ((code[codeLength - 1] & 0xff) == CodeVisitor.RETURN)
codeLength = codeLength - 1;
byte []newCode = new byte[codeLength + tailCode.length];
System.arraycopy(code, 0, newCode, 0, codeLength);
System.arraycopy(tailCode, 0, newCode, codeLength, tailCode.length);
codeAttr.setCode(newCode);
if (codeAttr.getMaxStack() < tailCodeAttr.getMaxStack())
codeAttr.setMaxStack(tailCodeAttr.getMaxStack());
if (codeAttr.getMaxLocals() < tailCodeAttr.getMaxLocals())
codeAttr.setMaxLocals(tailCodeAttr.getMaxLocals());
ArrayList<CodeAttribute.ExceptionItem> exns = tailCodeAttr.getExceptions();
for (int i = 0; i < exns.size(); i++) {
CodeAttribute.ExceptionItem exn = exns.get(i);
CodeAttribute.ExceptionItem newExn = new CodeAttribute.ExceptionItem();
newExn.setType(exn.getType()); // depends on control dependency: [for], data = [none]
newExn.setStart(exn.getStart() + codeLength); // depends on control dependency: [for], data = [none]
newExn.setEnd(exn.getEnd() + codeLength); // depends on control dependency: [for], data = [none]
newExn.setHandler(exn.getHandler() + codeLength); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static <T, A, R> Collector<T, ?, R> filtering(final Predicate<? super T> predicate, final Collector<? super T, A, R> downstream) {
final BiConsumer<A, ? super T> downstreamAccumulator = downstream.accumulator();
final BiConsumer<A, T> accumulator = new BiConsumer<A, T>() {
@Override
public void accept(A a, T t) {
if (predicate.test(t)) {
downstreamAccumulator.accept(a, t);
}
}
};
return new CollectorImpl<>(downstream.supplier(), accumulator, downstream.combiner(), downstream.finisher(), downstream.characteristics());
} } | public class class_name {
public static <T, A, R> Collector<T, ?, R> filtering(final Predicate<? super T> predicate, final Collector<? super T, A, R> downstream) {
final BiConsumer<A, ? super T> downstreamAccumulator = downstream.accumulator();
final BiConsumer<A, T> accumulator = new BiConsumer<A, T>() {
@Override
public void accept(A a, T t) {
if (predicate.test(t)) {
downstreamAccumulator.accept(a, t);
// depends on control dependency: [if], data = [none]
}
}
};
return new CollectorImpl<>(downstream.supplier(), accumulator, downstream.combiner(), downstream.finisher(), downstream.characteristics());
} } |
public class class_name {
@Override
public int getNotationAttrIndex()
{
/* If necessary, we could find this index when resolving the
* element, could avoid linear search. But who knows how often
* it's really needed...
*/
for (int i = 0, len = mAttrCount; i < len; ++i) {
if (mAttrSpecs[i].typeIsNotation()) {
return i;
}
}
return -1;
} } | public class class_name {
@Override
public int getNotationAttrIndex()
{
/* If necessary, we could find this index when resolving the
* element, could avoid linear search. But who knows how often
* it's really needed...
*/
for (int i = 0, len = mAttrCount; i < len; ++i) {
if (mAttrSpecs[i].typeIsNotation()) {
return i; // depends on control dependency: [if], data = [none]
}
}
return -1;
} } |
public class class_name {
protected static Object getImpl(String className, Class[] types, Object[] args) {
// No tracing as this is used to load the trace factory.
Object Impl; // For return.
try {
Class classToInstantiate = Class.forName(className);
java.lang.reflect.Constructor constructor = classToInstantiate.getDeclaredConstructor(types);
constructor.setAccessible(true);
Impl = constructor.newInstance(args);
} catch (Exception exception) {
// No FFDC Code Needed.
// We may not have any FFDC instantiated so simply print the stack.
exception.printStackTrace(new java.io.PrintWriter(System.out, true));
// Assume we have no chained exception support.
throw new Error(exception.toString());
} // catch.
return Impl;
} } | public class class_name {
protected static Object getImpl(String className, Class[] types, Object[] args) {
// No tracing as this is used to load the trace factory.
Object Impl; // For return.
try {
Class classToInstantiate = Class.forName(className); // depends on control dependency: [try], data = [none]
java.lang.reflect.Constructor constructor = classToInstantiate.getDeclaredConstructor(types);
constructor.setAccessible(true); // depends on control dependency: [try], data = [none]
Impl = constructor.newInstance(args); // depends on control dependency: [try], data = [none]
} catch (Exception exception) {
// No FFDC Code Needed.
// We may not have any FFDC instantiated so simply print the stack.
exception.printStackTrace(new java.io.PrintWriter(System.out, true));
// Assume we have no chained exception support.
throw new Error(exception.toString());
} // catch. // depends on control dependency: [catch], data = [none]
return Impl;
} } |
public class class_name {
public void create(String firstName, String lastName, boolean married) {
long ts = System.currentTimeMillis();
UserProfileModel profileModel = UserProfileModel.newBuilder()
.setFirstName(firstName).setLastName(lastName).setMarried(married)
.setCreated(ts).build();
UserActionsModel actionsModel = UserActionsModel.newBuilder()
.setFirstName(firstName).setLastName(lastName)
.setActions(new HashMap<String, String>()).build();
actionsModel.getActions().put("profile_created", Long.toString(ts));
UserProfileActionsModel profileActionsModel = UserProfileActionsModel
.newBuilder().setUserProfileModel(profileModel)
.setUserActionsModel(actionsModel).build();
if (!userProfileActionsDao.put(profileActionsModel)) {
// If put returns false, a user already existed at this row
System.out
.println("Creating a new user profile failed due to a write conflict.");
}
} } | public class class_name {
public void create(String firstName, String lastName, boolean married) {
long ts = System.currentTimeMillis();
UserProfileModel profileModel = UserProfileModel.newBuilder()
.setFirstName(firstName).setLastName(lastName).setMarried(married)
.setCreated(ts).build();
UserActionsModel actionsModel = UserActionsModel.newBuilder()
.setFirstName(firstName).setLastName(lastName)
.setActions(new HashMap<String, String>()).build();
actionsModel.getActions().put("profile_created", Long.toString(ts));
UserProfileActionsModel profileActionsModel = UserProfileActionsModel
.newBuilder().setUserProfileModel(profileModel)
.setUserActionsModel(actionsModel).build();
if (!userProfileActionsDao.put(profileActionsModel)) {
// If put returns false, a user already existed at this row
System.out
.println("Creating a new user profile failed due to a write conflict."); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public TagFileType<TldTaglibType<T>> getOrCreateTagFile()
{
List<Node> nodeList = childNode.get("tag-file");
if (nodeList != null && nodeList.size() > 0)
{
return new TagFileTypeImpl<TldTaglibType<T>>(this, "tag-file", childNode, nodeList.get(0));
}
return createTagFile();
} } | public class class_name {
public TagFileType<TldTaglibType<T>> getOrCreateTagFile()
{
List<Node> nodeList = childNode.get("tag-file");
if (nodeList != null && nodeList.size() > 0)
{
return new TagFileTypeImpl<TldTaglibType<T>>(this, "tag-file", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createTagFile();
} } |
public class class_name {
protected void transform(SarlCapacityUses source, JvmGenericType container) {
final GenerationContext context = getContext(container);
if (context == null) {
return;
}
for (final JvmTypeReference capacityType : source.getCapacities()) {
final JvmType type = capacityType.getType();
if (type instanceof JvmGenericType
/*&& this.inheritanceHelper.isSubTypeOf(capacityType, Capacity.class, SarlCapacity.class)*/
&& !context.getGeneratedCapacityUseFields().contains(capacityType.getIdentifier())) {
// Generate the buffer field
final String fieldName = Utils.createNameForHiddenCapacityImplementationAttribute(capacityType.getIdentifier());
final JvmField field = this.typesFactory.createJvmField();
container.getMembers().add(field);
field.setVisibility(JvmVisibility.PRIVATE);
field.setSimpleName(fieldName);
field.setTransient(true);
final JvmType clearableReferenceType = this.typeReferences.findDeclaredType(ClearableReference.class, container);
final JvmTypeReference skillClearableReference = this.typeReferences.createTypeRef(
clearableReferenceType,
this.typeReferences.createTypeRef(this.typeReferences.findDeclaredType(Skill.class, container)));
field.setType(skillClearableReference);
this.associator.associatePrimary(source, field);
addAnnotationSafe(field, Extension.class);
field.getAnnotations().add(annotationClassRef(ImportedCapacityFeature.class,
Collections.singletonList(capacityType)));
appendGeneratedAnnotation(field, getContext(container));
// Generate the calling function
final String methodName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName(
fieldName);
final JvmOperation operation = this.typesFactory.createJvmOperation();
container.getMembers().add(operation);
operation.setVisibility(JvmVisibility.PRIVATE);
operation.setReturnType(cloneWithTypeParametersAndProxies(capacityType, operation));
operation.setSimpleName(methodName);
this.associator.associatePrimary(source, operation);
setBody(operation, it -> {
it.append("if (this.").append(fieldName).append(" == null || this."); //$NON-NLS-1$ //$NON-NLS-2$
it.append(fieldName).append(".get() == null) {"); //$NON-NLS-1$
it.increaseIndentation();
it.newLine();
it.append("this.").append(fieldName).append(" = ") //$NON-NLS-1$ //$NON-NLS-2$
.append(Utils.HIDDEN_MEMBER_CHARACTER).append("getSkill("); //$NON-NLS-1$
it.append(capacityType.getType()).append(".class);"); //$NON-NLS-1$
it.decreaseIndentation();
it.newLine();
it.append("}"); //$NON-NLS-1$
it.newLine();
it.append("return ").append(Utils.HIDDEN_MEMBER_CHARACTER) //$NON-NLS-1$
.append("castSkill(").append(capacityType.getType()).append(".class, this.") //$NON-NLS-1$ //$NON-NLS-2$
.append(fieldName).append(");"); //$NON-NLS-1$
});
// Add the annotation dedicated to this particular method
if (context.isAtLeastJava8()) {
context.getPostFinalizationElements().add(() -> {
final String inlineExpression = Utils.HIDDEN_MEMBER_CHARACTER
+ "castSkill(" + capacityType.getSimpleName() //$NON-NLS-1$
+ ".class, ($0" + fieldName //$NON-NLS-1$
+ " == null || $0" + fieldName //$NON-NLS-1$
+ ".get() == null) ? ($0" + fieldName //$NON-NLS-1$
+ " = $0" + Utils.HIDDEN_MEMBER_CHARACTER + "getSkill(" //$NON-NLS-1$ //$NON-NLS-2$
+ capacityType.getSimpleName()
+ ".class)) : $0" + fieldName + ")"; //$NON-NLS-1$ //$NON-NLS-2$;
this.inlineExpressionCompiler.appendInlineAnnotation(
operation, source.eResource().getResourceSet(), inlineExpression, capacityType);
});
}
appendGeneratedAnnotation(operation, context);
if (context.getGeneratorConfig2().isGeneratePureAnnotation()) {
addAnnotationSafe(operation, Pure.class);
}
context.addGeneratedCapacityUseField(capacityType.getIdentifier());
context.incrementSerial(capacityType.getIdentifier().hashCode());
}
}
} } | public class class_name {
protected void transform(SarlCapacityUses source, JvmGenericType container) {
final GenerationContext context = getContext(container);
if (context == null) {
return; // depends on control dependency: [if], data = [none]
}
for (final JvmTypeReference capacityType : source.getCapacities()) {
final JvmType type = capacityType.getType();
if (type instanceof JvmGenericType
/*&& this.inheritanceHelper.isSubTypeOf(capacityType, Capacity.class, SarlCapacity.class)*/
&& !context.getGeneratedCapacityUseFields().contains(capacityType.getIdentifier())) {
// Generate the buffer field
final String fieldName = Utils.createNameForHiddenCapacityImplementationAttribute(capacityType.getIdentifier());
final JvmField field = this.typesFactory.createJvmField();
container.getMembers().add(field); // depends on control dependency: [if], data = [none]
field.setVisibility(JvmVisibility.PRIVATE); // depends on control dependency: [if], data = [none]
field.setSimpleName(fieldName); // depends on control dependency: [if], data = [none]
field.setTransient(true); // depends on control dependency: [if], data = [none]
final JvmType clearableReferenceType = this.typeReferences.findDeclaredType(ClearableReference.class, container);
final JvmTypeReference skillClearableReference = this.typeReferences.createTypeRef(
clearableReferenceType,
this.typeReferences.createTypeRef(this.typeReferences.findDeclaredType(Skill.class, container)));
field.setType(skillClearableReference); // depends on control dependency: [if], data = [none]
this.associator.associatePrimary(source, field); // depends on control dependency: [if], data = [none]
addAnnotationSafe(field, Extension.class); // depends on control dependency: [if], data = [none]
field.getAnnotations().add(annotationClassRef(ImportedCapacityFeature.class,
Collections.singletonList(capacityType))); // depends on control dependency: [if], data = [none]
appendGeneratedAnnotation(field, getContext(container)); // depends on control dependency: [if], data = [none]
// Generate the calling function
final String methodName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName(
fieldName);
final JvmOperation operation = this.typesFactory.createJvmOperation();
container.getMembers().add(operation); // depends on control dependency: [if], data = [none]
operation.setVisibility(JvmVisibility.PRIVATE); // depends on control dependency: [if], data = [none]
operation.setReturnType(cloneWithTypeParametersAndProxies(capacityType, operation)); // depends on control dependency: [if], data = [none]
operation.setSimpleName(methodName); // depends on control dependency: [if], data = [none]
this.associator.associatePrimary(source, operation); // depends on control dependency: [if], data = [none]
setBody(operation, it -> {
it.append("if (this.").append(fieldName).append(" == null || this."); //$NON-NLS-1$ //$NON-NLS-2$
it.append(fieldName).append(".get() == null) {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.increaseIndentation(); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("this.").append(fieldName).append(" = ") //$NON-NLS-1$ //$NON-NLS-2$
.append(Utils.HIDDEN_MEMBER_CHARACTER).append("getSkill("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(capacityType.getType()).append(".class);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.decreaseIndentation(); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("return ").append(Utils.HIDDEN_MEMBER_CHARACTER) //$NON-NLS-1$
.append("castSkill(").append(capacityType.getType()).append(".class, this.") //$NON-NLS-1$ //$NON-NLS-2$
.append(fieldName).append(");"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
});
// Add the annotation dedicated to this particular method
if (context.isAtLeastJava8()) {
context.getPostFinalizationElements().add(() -> {
final String inlineExpression = Utils.HIDDEN_MEMBER_CHARACTER
+ "castSkill(" + capacityType.getSimpleName() //$NON-NLS-1$
+ ".class, ($0" + fieldName //$NON-NLS-1$
+ " == null || $0" + fieldName //$NON-NLS-1$
+ ".get() == null) ? ($0" + fieldName //$NON-NLS-1$
+ " = $0" + Utils.HIDDEN_MEMBER_CHARACTER + "getSkill(" //$NON-NLS-1$ //$NON-NLS-2$
+ capacityType.getSimpleName()
+ ".class)) : $0" + fieldName + ")"; //$NON-NLS-1$ //$NON-NLS-2$;
this.inlineExpressionCompiler.appendInlineAnnotation(
operation, source.eResource().getResourceSet(), inlineExpression, capacityType);
});
}
appendGeneratedAnnotation(operation, context); // depends on control dependency: [for], data = [none]
if (context.getGeneratorConfig2().isGeneratePureAnnotation()) {
addAnnotationSafe(operation, Pure.class); // depends on control dependency: [if], data = [none]
}
context.addGeneratedCapacityUseField(capacityType.getIdentifier()); // depends on control dependency: [for], data = [capacityType]
context.incrementSerial(capacityType.getIdentifier().hashCode()); // depends on control dependency: [for], data = [capacityType]
}
}
} } |
public class class_name {
public void triggerRegisteredSessionEndedObserver(int observerId) {
UsageSessionObserver observer = usageSessionObserversById.get(observerId);
Intent intent = new Intent().putExtra(UsageStatsManager.EXTRA_OBSERVER_ID, observerId);
try {
observer.sessionEndedIntent.send(RuntimeEnvironment.application, 0, intent);
} catch (CanceledException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public void triggerRegisteredSessionEndedObserver(int observerId) {
UsageSessionObserver observer = usageSessionObserversById.get(observerId);
Intent intent = new Intent().putExtra(UsageStatsManager.EXTRA_OBSERVER_ID, observerId);
try {
observer.sessionEndedIntent.send(RuntimeEnvironment.application, 0, intent); // depends on control dependency: [try], data = [none]
} catch (CanceledException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public DescribeReservedInstancesOfferingsRequest withReservedInstancesOfferingIds(String... reservedInstancesOfferingIds) {
if (this.reservedInstancesOfferingIds == null) {
setReservedInstancesOfferingIds(new com.amazonaws.internal.SdkInternalList<String>(reservedInstancesOfferingIds.length));
}
for (String ele : reservedInstancesOfferingIds) {
this.reservedInstancesOfferingIds.add(ele);
}
return this;
} } | public class class_name {
public DescribeReservedInstancesOfferingsRequest withReservedInstancesOfferingIds(String... reservedInstancesOfferingIds) {
if (this.reservedInstancesOfferingIds == null) {
setReservedInstancesOfferingIds(new com.amazonaws.internal.SdkInternalList<String>(reservedInstancesOfferingIds.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : reservedInstancesOfferingIds) {
this.reservedInstancesOfferingIds.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public String initValuesImpl(final FieldCase c) {
if (c == FieldCase.NULL) {
return null;
}
String value = source.initValues(c);
if (value == null) {
return defaultValue;
}
return value;
} } | public class class_name {
@Override
public String initValuesImpl(final FieldCase c) {
if (c == FieldCase.NULL) {
return null;
// depends on control dependency: [if], data = [none]
}
String value = source.initValues(c);
if (value == null) {
return defaultValue;
// depends on control dependency: [if], data = [none]
}
return value;
} } |
public class class_name {
private boolean isSourceNewer(URL source, ClassNode cls) {
try {
long lastMod;
// Special handling for file:// protocol, as getLastModified() often reports
// incorrect results (-1)
if (source.getProtocol().equals("file")) {
// Coerce the file URL to a File
String path = source.getPath().replace('/', File.separatorChar).replace('|', ':');
File file = new File(path);
lastMod = file.lastModified();
} else {
URLConnection conn = source.openConnection();
lastMod = conn.getLastModified();
conn.getInputStream().close();
}
return lastMod > getTimeStamp(cls);
} catch (IOException e) {
// if the stream can't be opened, let's keep the old reference
return false;
}
} } | public class class_name {
private boolean isSourceNewer(URL source, ClassNode cls) {
try {
long lastMod;
// Special handling for file:// protocol, as getLastModified() often reports
// incorrect results (-1)
if (source.getProtocol().equals("file")) {
// Coerce the file URL to a File
String path = source.getPath().replace('/', File.separatorChar).replace('|', ':');
File file = new File(path);
lastMod = file.lastModified(); // depends on control dependency: [if], data = [none]
} else {
URLConnection conn = source.openConnection();
lastMod = conn.getLastModified(); // depends on control dependency: [if], data = [none]
conn.getInputStream().close(); // depends on control dependency: [if], data = [none]
}
return lastMod > getTimeStamp(cls); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// if the stream can't be opened, let's keep the old reference
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static GrayU8 createMask( CameraUniversalOmni model ,
LensDistortionWideFOV distortion , double fov ) {
GrayU8 mask = new GrayU8(model.width,model.height);
Point2Transform3_F64 p2s = distortion.undistortPtoS_F64();
Point3D_F64 ref = new Point3D_F64(0,0,1);
Point3D_F64 X = new Point3D_F64();
p2s.compute(model.cx,model.cy,X);
for (int y = 0; y < model.height; y++) {
for (int x = 0; x < model.width; x++) {
p2s.compute(x,y,X);
if( Double.isNaN(X.x) || Double.isNaN(X.y) || Double.isNaN(X.z)) {
continue;
}
double angle = UtilVector3D_F64.acute(ref,X);
if( Double.isNaN(angle)) {
continue;
}
if( angle <= fov/2.0 )
mask.unsafe_set(x,y,1);
}
}
return mask;
} } | public class class_name {
public static GrayU8 createMask( CameraUniversalOmni model ,
LensDistortionWideFOV distortion , double fov ) {
GrayU8 mask = new GrayU8(model.width,model.height);
Point2Transform3_F64 p2s = distortion.undistortPtoS_F64();
Point3D_F64 ref = new Point3D_F64(0,0,1);
Point3D_F64 X = new Point3D_F64();
p2s.compute(model.cx,model.cy,X);
for (int y = 0; y < model.height; y++) {
for (int x = 0; x < model.width; x++) {
p2s.compute(x,y,X); // depends on control dependency: [for], data = [x]
if( Double.isNaN(X.x) || Double.isNaN(X.y) || Double.isNaN(X.z)) {
continue;
}
double angle = UtilVector3D_F64.acute(ref,X);
if( Double.isNaN(angle)) {
continue;
}
if( angle <= fov/2.0 )
mask.unsafe_set(x,y,1);
}
}
return mask;
} } |
public class class_name {
public void add(ByteArrayList values) {
ensureCapacity(size + values.size);
for (int i=0; i<values.size; i++) {
this.add(values.elements[i]);
}
} } | public class class_name {
public void add(ByteArrayList values) {
ensureCapacity(size + values.size);
for (int i=0; i<values.size; i++) {
this.add(values.elements[i]); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
protected int startsWithIgnoredWord(String word, boolean caseSensitive) {
if (word.length() < 4) {
return 0;
}
Optional<String> match = Optional.empty();
if(caseSensitive) {
Set<String> subset = wordsToBeIgnoredDictionary.get(word.substring(0, 1));
if (subset != null) {
match = subset.stream().filter(s -> word.startsWith(s)).max(STRING_LENGTH_COMPARATOR);
}
} else {
String lowerCaseWord = word.toLowerCase();
Set<String> subset = wordsToBeIgnoredDictionaryIgnoreCase.get(lowerCaseWord.substring(0, 1));
if (subset != null) {
match = subset.stream().filter(s -> lowerCaseWord.startsWith(s)).max(STRING_LENGTH_COMPARATOR);
}
}
return match.isPresent() ? match.get().length() : 0;
} } | public class class_name {
protected int startsWithIgnoredWord(String word, boolean caseSensitive) {
if (word.length() < 4) {
return 0; // depends on control dependency: [if], data = [none]
}
Optional<String> match = Optional.empty();
if(caseSensitive) {
Set<String> subset = wordsToBeIgnoredDictionary.get(word.substring(0, 1));
if (subset != null) {
match = subset.stream().filter(s -> word.startsWith(s)).max(STRING_LENGTH_COMPARATOR); // depends on control dependency: [if], data = [none]
}
} else {
String lowerCaseWord = word.toLowerCase();
Set<String> subset = wordsToBeIgnoredDictionaryIgnoreCase.get(lowerCaseWord.substring(0, 1));
if (subset != null) {
match = subset.stream().filter(s -> lowerCaseWord.startsWith(s)).max(STRING_LENGTH_COMPARATOR); // depends on control dependency: [if], data = [none]
}
}
return match.isPresent() ? match.get().length() : 0;
} } |
public class class_name {
public static void main(String[] args) {
try {
Twitter twitter = new TwitterFactory().getInstance();
long cursor = -1;
IDs ids;
System.out.println("Showing outgoing pending follow request(s).");
do {
ids = twitter.getOutgoingFriendships(cursor);
for (long id : ids.getIDs()) {
System.out.println(id);
}
} while ((cursor = ids.getNextCursor()) != 0);
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to get outgoing friendships: " + te.getMessage());
System.exit(-1);
}
} } | public class class_name {
public static void main(String[] args) {
try {
Twitter twitter = new TwitterFactory().getInstance();
long cursor = -1;
IDs ids;
System.out.println("Showing outgoing pending follow request(s)."); // depends on control dependency: [try], data = [none]
do {
ids = twitter.getOutgoingFriendships(cursor);
for (long id : ids.getIDs()) {
System.out.println(id); // depends on control dependency: [for], data = [id]
}
} while ((cursor = ids.getNextCursor()) != 0);
System.exit(0); // depends on control dependency: [try], data = [none]
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to get outgoing friendships: " + te.getMessage());
System.exit(-1);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public CPDAvailabilityEstimate fetchByCProductId(long CProductId,
boolean retrieveFromCache) {
Object[] finderArgs = new Object[] { CProductId };
Object result = null;
if (retrieveFromCache) {
result = finderCache.getResult(FINDER_PATH_FETCH_BY_CPRODUCTID,
finderArgs, this);
}
if (result instanceof CPDAvailabilityEstimate) {
CPDAvailabilityEstimate cpdAvailabilityEstimate = (CPDAvailabilityEstimate)result;
if ((CProductId != cpdAvailabilityEstimate.getCProductId())) {
result = null;
}
}
if (result == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_SELECT_CPDAVAILABILITYESTIMATE_WHERE);
query.append(_FINDER_COLUMN_CPRODUCTID_CPRODUCTID_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(CProductId);
List<CPDAvailabilityEstimate> list = q.list();
if (list.isEmpty()) {
finderCache.putResult(FINDER_PATH_FETCH_BY_CPRODUCTID,
finderArgs, list);
}
else {
CPDAvailabilityEstimate cpdAvailabilityEstimate = list.get(0);
result = cpdAvailabilityEstimate;
cacheResult(cpdAvailabilityEstimate);
}
}
catch (Exception e) {
finderCache.removeResult(FINDER_PATH_FETCH_BY_CPRODUCTID,
finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
if (result instanceof List<?>) {
return null;
}
else {
return (CPDAvailabilityEstimate)result;
}
} } | public class class_name {
@Override
public CPDAvailabilityEstimate fetchByCProductId(long CProductId,
boolean retrieveFromCache) {
Object[] finderArgs = new Object[] { CProductId };
Object result = null;
if (retrieveFromCache) {
result = finderCache.getResult(FINDER_PATH_FETCH_BY_CPRODUCTID,
finderArgs, this); // depends on control dependency: [if], data = [none]
}
if (result instanceof CPDAvailabilityEstimate) {
CPDAvailabilityEstimate cpdAvailabilityEstimate = (CPDAvailabilityEstimate)result;
if ((CProductId != cpdAvailabilityEstimate.getCProductId())) {
result = null; // depends on control dependency: [if], data = [none]
}
}
if (result == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_SELECT_CPDAVAILABILITYESTIMATE_WHERE); // depends on control dependency: [if], data = [none]
query.append(_FINDER_COLUMN_CPRODUCTID_CPRODUCTID_2); // depends on control dependency: [if], data = [none]
String sql = query.toString();
Session session = null;
try {
session = openSession(); // depends on control dependency: [try], data = [none]
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(CProductId); // depends on control dependency: [try], data = [none]
List<CPDAvailabilityEstimate> list = q.list();
if (list.isEmpty()) {
finderCache.putResult(FINDER_PATH_FETCH_BY_CPRODUCTID,
finderArgs, list); // depends on control dependency: [if], data = [none]
}
else {
CPDAvailabilityEstimate cpdAvailabilityEstimate = list.get(0);
result = cpdAvailabilityEstimate; // depends on control dependency: [if], data = [none]
cacheResult(cpdAvailabilityEstimate); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e) {
finderCache.removeResult(FINDER_PATH_FETCH_BY_CPRODUCTID,
finderArgs);
throw processException(e);
} // depends on control dependency: [catch], data = [none]
finally {
closeSession(session);
}
}
if (result instanceof List<?>) {
return null; // depends on control dependency: [if], data = [none]
}
else {
return (CPDAvailabilityEstimate)result; // depends on control dependency: [if], data = [)]
}
} } |
public class class_name {
public BaseRobotRules getRobotRulesSetFromCache(URL url) {
String cacheKey = getCacheKey(url);
BaseRobotRules robotRules = CACHE.getIfPresent(cacheKey);
if (robotRules != null) {
return robotRules;
}
return EMPTY_RULES;
} } | public class class_name {
public BaseRobotRules getRobotRulesSetFromCache(URL url) {
String cacheKey = getCacheKey(url);
BaseRobotRules robotRules = CACHE.getIfPresent(cacheKey);
if (robotRules != null) {
return robotRules; // depends on control dependency: [if], data = [none]
}
return EMPTY_RULES;
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.