code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
FormatStep quickPath(ChronoFormatter<?> formatter) {
AttributeSet as = formatter.getAttributes0();
if (this.sectionalAttrs != null) {
Attributes attrs =
new Attributes.Builder()
.setAll(as.getAttributes())
.setAll(this.sectionalAttrs.getAttributes())
.build();
as = as.withAttributes(attrs);
}
return new FormatStep(
this.processor.quickPath(formatter, as, this.reserved),
this.level,
this.section,
this.sectionalAttrs,
as,
this.reserved,
this.padLeft,
this.padRight,
this.orMarker,
this.lastOrBlockIndex
);
} }
|
public class class_name {
FormatStep quickPath(ChronoFormatter<?> formatter) {
AttributeSet as = formatter.getAttributes0();
if (this.sectionalAttrs != null) {
Attributes attrs =
new Attributes.Builder()
.setAll(as.getAttributes())
.setAll(this.sectionalAttrs.getAttributes())
.build();
as = as.withAttributes(attrs); // depends on control dependency: [if], data = [none]
}
return new FormatStep(
this.processor.quickPath(formatter, as, this.reserved),
this.level,
this.section,
this.sectionalAttrs,
as,
this.reserved,
this.padLeft,
this.padRight,
this.orMarker,
this.lastOrBlockIndex
);
} }
|
public class class_name {
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
getStyleClass().setAll("weather-symbol");
conditionIcon = new Region();
conditionIcon.setId(condition.get().styleClass);
conditionIcon.setStyle("-symbol-color: " + getSymbolColor().toString().replace("0x", "#") + ";");
pane = new Pane(conditionIcon);
getChildren().setAll(pane);
} }
|
public class class_name {
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight()); // depends on control dependency: [if], data = [(getPrefWidth()]
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); // depends on control dependency: [if], data = [none]
}
}
getStyleClass().setAll("weather-symbol");
conditionIcon = new Region();
conditionIcon.setId(condition.get().styleClass);
conditionIcon.setStyle("-symbol-color: " + getSymbolColor().toString().replace("0x", "#") + ";");
pane = new Pane(conditionIcon);
getChildren().setAll(pane);
} }
|
public class class_name {
public void marshall(StartOutboundVoiceContactRequest startOutboundVoiceContactRequest, ProtocolMarshaller protocolMarshaller) {
if (startOutboundVoiceContactRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getDestinationPhoneNumber(), DESTINATIONPHONENUMBER_BINDING);
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getContactFlowId(), CONTACTFLOWID_BINDING);
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getInstanceId(), INSTANCEID_BINDING);
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getClientToken(), CLIENTTOKEN_BINDING);
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getSourcePhoneNumber(), SOURCEPHONENUMBER_BINDING);
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getQueueId(), QUEUEID_BINDING);
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getAttributes(), ATTRIBUTES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(StartOutboundVoiceContactRequest startOutboundVoiceContactRequest, ProtocolMarshaller protocolMarshaller) {
if (startOutboundVoiceContactRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getDestinationPhoneNumber(), DESTINATIONPHONENUMBER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getContactFlowId(), CONTACTFLOWID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getInstanceId(), INSTANCEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getClientToken(), CLIENTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getSourcePhoneNumber(), SOURCEPHONENUMBER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getQueueId(), QUEUEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startOutboundVoiceContactRequest.getAttributes(), ATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, Long labelId)
throws RemoteException {
// Get the CampaignService.
CampaignServiceInterface campaignService =
adWordsServices.get(session, CampaignServiceInterface.class);
int offset = 0;
// Create selector.
SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder
.fields(CampaignField.Id, CampaignField.Name, CampaignField.Labels)
// Labels filtering is performed by ID. You can use containsAny to select campaigns with
// any of the label IDs, containsAll to select campaigns with all of the label IDs, or
// containsNone to select campaigns with none of the label IDs.
.containsAny(CampaignField.Labels, labelId.toString())
.orderAscBy(CampaignField.Name)
.offset(offset)
.limit(PAGE_SIZE)
.build();
CampaignPage page = null;
do {
// Get all campaigns.
page = campaignService.get(selector);
// Display campaigns.
if (page.getEntries() != null) {
for (Campaign campaign : page.getEntries()) {
String labels =
Joiner.on(", ")
.join(
Lists.transform(
Lists.newArrayList(campaign.getLabels()),
label -> String.format("%d/%s", label.getId(), label.getName())));
System.out.printf("Campaign found with name '%s' and ID %d and labels: %s.%n",
campaign.getName(), campaign.getId(), labels);
}
} else {
System.out.println("No campaigns were found.");
}
offset += PAGE_SIZE;
selector = builder.increaseOffsetBy(PAGE_SIZE).build();
} while (offset < page.getTotalNumEntries());
} }
|
public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, Long labelId)
throws RemoteException {
// Get the CampaignService.
CampaignServiceInterface campaignService =
adWordsServices.get(session, CampaignServiceInterface.class);
int offset = 0;
// Create selector.
SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder
.fields(CampaignField.Id, CampaignField.Name, CampaignField.Labels)
// Labels filtering is performed by ID. You can use containsAny to select campaigns with
// any of the label IDs, containsAll to select campaigns with all of the label IDs, or
// containsNone to select campaigns with none of the label IDs.
.containsAny(CampaignField.Labels, labelId.toString())
.orderAscBy(CampaignField.Name)
.offset(offset)
.limit(PAGE_SIZE)
.build();
CampaignPage page = null;
do {
// Get all campaigns.
page = campaignService.get(selector);
// Display campaigns.
if (page.getEntries() != null) {
for (Campaign campaign : page.getEntries()) {
String labels =
Joiner.on(", ")
.join(
Lists.transform(
Lists.newArrayList(campaign.getLabels()),
label -> String.format("%d/%s", label.getId(), label.getName())));
System.out.printf("Campaign found with name '%s' and ID %d and labels: %s.%n",
campaign.getName(), campaign.getId(), labels); // depends on control dependency: [for], data = [none]
}
} else {
System.out.println("No campaigns were found."); // depends on control dependency: [if], data = [none]
}
offset += PAGE_SIZE;
selector = builder.increaseOffsetBy(PAGE_SIZE).build();
} while (offset < page.getTotalNumEntries());
} }
|
public class class_name {
@Override
public void format(final LoggingEvent event, final StringBuffer toAppendTo) {
final ThrowableInformation information = event.getThrowableInformation();
if (information != null) {
final String[] stringRep = information.getThrowableStrRep();
int length = 0;
if (option == null) {
length = stringRep.length;
} else if ("full".equals(option)) {
length = stringRep.length;
} else if ("short".equals(option)) {
length = -1;
} else if ("none".equals(option)) {
return;
} else {
length = stringRep.length;
}
toAppendTo.append("\n[Exception: ");
if (length == -1) {
toAppendTo.append(generateAbbreviatedExceptionMessage(information.getThrowable()));
} else {
for (int i = 0; i < length; i++) {
final String string = stringRep[i];
toAppendTo.append(string).append('\n');
}
}
toAppendTo.append("]");
}
} }
|
public class class_name {
@Override
public void format(final LoggingEvent event, final StringBuffer toAppendTo) {
final ThrowableInformation information = event.getThrowableInformation();
if (information != null) {
final String[] stringRep = information.getThrowableStrRep();
int length = 0;
if (option == null) {
length = stringRep.length; // depends on control dependency: [if], data = [none]
} else if ("full".equals(option)) {
length = stringRep.length; // depends on control dependency: [if], data = [none]
} else if ("short".equals(option)) {
length = -1; // depends on control dependency: [if], data = [none]
} else if ("none".equals(option)) {
return; // depends on control dependency: [if], data = [none]
} else {
length = stringRep.length; // depends on control dependency: [if], data = [none]
}
toAppendTo.append("\n[Exception: "); // depends on control dependency: [if], data = [none]
if (length == -1) {
toAppendTo.append(generateAbbreviatedExceptionMessage(information.getThrowable())); // depends on control dependency: [if], data = [none]
} else {
for (int i = 0; i < length; i++) {
final String string = stringRep[i];
toAppendTo.append(string).append('\n'); // depends on control dependency: [for], data = [none]
}
}
toAppendTo.append("]"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(SetDataRetrievalPolicyRequest setDataRetrievalPolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (setDataRetrievalPolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(setDataRetrievalPolicyRequest.getAccountId(), ACCOUNTID_BINDING);
protocolMarshaller.marshall(setDataRetrievalPolicyRequest.getPolicy(), POLICY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(SetDataRetrievalPolicyRequest setDataRetrievalPolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (setDataRetrievalPolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(setDataRetrievalPolicyRequest.getAccountId(), ACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(setDataRetrievalPolicyRequest.getPolicy(), POLICY_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 {
protected void addModifiers(MemberDoc member, Content htmltree) {
String mod = modifierString(member);
// According to JLS, we should not be showing public modifier for
// interface methods.
if ((member.isField() || member.isMethod()) &&
writer instanceof ClassWriterImpl &&
((ClassWriterImpl) writer).getClassDoc().isInterface()) {
// This check for isDefault() and the default modifier needs to be
// added for it to appear on the method details section. Once the
// default modifier is added to the Modifier list on DocEnv and once
// it is updated to use the javax.lang.model.element.Modifier, we
// will need to remove this.
mod = (member.isMethod() && ((MethodDoc)member).isDefault()) ?
Util.replaceText(mod, "public", "default").trim() :
Util.replaceText(mod, "public", "").trim();
}
if(mod.length() > 0) {
htmltree.addContent(mod);
htmltree.addContent(writer.getSpace());
}
} }
|
public class class_name {
protected void addModifiers(MemberDoc member, Content htmltree) {
String mod = modifierString(member);
// According to JLS, we should not be showing public modifier for
// interface methods.
if ((member.isField() || member.isMethod()) &&
writer instanceof ClassWriterImpl &&
((ClassWriterImpl) writer).getClassDoc().isInterface()) {
// This check for isDefault() and the default modifier needs to be
// added for it to appear on the method details section. Once the
// default modifier is added to the Modifier list on DocEnv and once
// it is updated to use the javax.lang.model.element.Modifier, we
// will need to remove this.
mod = (member.isMethod() && ((MethodDoc)member).isDefault()) ?
Util.replaceText(mod, "public", "default").trim() :
Util.replaceText(mod, "public", "").trim(); // depends on control dependency: [if], data = [none]
}
if(mod.length() > 0) {
htmltree.addContent(mod); // depends on control dependency: [if], data = [none]
htmltree.addContent(writer.getSpace()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void writeTo(Object t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders,
OutputStream entityStream) throws IOException, WebApplicationException {
SerializeFilter filter = null;
if(pretty) {
if (fastJsonConfig.serializerFeatures == null)
fastJsonConfig.serializerFeatures = new SerializerFeature[]{SerializerFeature.PrettyFormat};
else {
List<SerializerFeature> serializerFeatures = Arrays.asList(fastJsonConfig.serializerFeatures);
serializerFeatures.add(SerializerFeature.PrettyFormat);
fastJsonConfig.serializerFeatures = serializerFeatures.toArray(new SerializerFeature[]{});
}
}
if (fastJsonConfig.serializeFilters != null)
filter = fastJsonConfig.serializeFilters.get(type);
String jsonStr = toJSONString(t, filter, fastJsonConfig.serializerFeatures);
if (jsonStr != null)
entityStream.write(jsonStr.getBytes());
} }
|
public class class_name {
public void writeTo(Object t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders,
OutputStream entityStream) throws IOException, WebApplicationException {
SerializeFilter filter = null;
if(pretty) {
if (fastJsonConfig.serializerFeatures == null)
fastJsonConfig.serializerFeatures = new SerializerFeature[]{SerializerFeature.PrettyFormat};
else {
List<SerializerFeature> serializerFeatures = Arrays.asList(fastJsonConfig.serializerFeatures);
serializerFeatures.add(SerializerFeature.PrettyFormat); // depends on control dependency: [if], data = [none]
fastJsonConfig.serializerFeatures = serializerFeatures.toArray(new SerializerFeature[]{}); // depends on control dependency: [if], data = [none]
}
}
if (fastJsonConfig.serializeFilters != null)
filter = fastJsonConfig.serializeFilters.get(type);
String jsonStr = toJSONString(t, filter, fastJsonConfig.serializerFeatures);
if (jsonStr != null)
entityStream.write(jsonStr.getBytes());
} }
|
public class class_name {
public ListFunctionsResult withFunctions(FunctionConfiguration... functions) {
if (this.functions == null) {
setFunctions(new com.amazonaws.internal.SdkInternalList<FunctionConfiguration>(functions.length));
}
for (FunctionConfiguration ele : functions) {
this.functions.add(ele);
}
return this;
} }
|
public class class_name {
public ListFunctionsResult withFunctions(FunctionConfiguration... functions) {
if (this.functions == null) {
setFunctions(new com.amazonaws.internal.SdkInternalList<FunctionConfiguration>(functions.length)); // depends on control dependency: [if], data = [none]
}
for (FunctionConfiguration ele : functions) {
this.functions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void lock(final CmsUUID structureId, final I_CmsSimpleCallback<Boolean> callback) {
CmsRpcAction<String> lockAction = new CmsRpcAction<String>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(200, false);
getService().lockTemp(structureId, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
public void onResponse(String result) {
stop(false);
if (result != null) {
// unable to lock
String text = Messages.get().key(Messages.GUI_LOCK_NOTIFICATION_2, structureId, result);
CmsNotification.get().sendDeferred(CmsNotification.Type.WARNING, text);
}
callback.execute(result == null ? Boolean.TRUE : Boolean.FALSE);
}
};
lockAction.execute();
} }
|
public class class_name {
public void lock(final CmsUUID structureId, final I_CmsSimpleCallback<Boolean> callback) {
CmsRpcAction<String> lockAction = new CmsRpcAction<String>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(200, false);
getService().lockTemp(structureId, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
public void onResponse(String result) {
stop(false);
if (result != null) {
// unable to lock
String text = Messages.get().key(Messages.GUI_LOCK_NOTIFICATION_2, structureId, result);
CmsNotification.get().sendDeferred(CmsNotification.Type.WARNING, text); // depends on control dependency: [if], data = [none]
}
callback.execute(result == null ? Boolean.TRUE : Boolean.FALSE);
}
};
lockAction.execute();
} }
|
public class class_name {
public static void horizontal(GrayF32 input, GrayF32 output, int radius) {
InputSanityCheck.checkSameShape(input , output);
Kernel1D_F32 kernel = FactoryKernel.table1D_F32(radius,false);
ConvolveJustBorder_General_SB.horizontal(kernel,ImageBorderValue.wrap(input,0),output);
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvolveBox_MT.horizontal(input, output, radius);
} else {
ImplConvolveBox.horizontal(input, output, radius);
}
} }
|
public class class_name {
public static void horizontal(GrayF32 input, GrayF32 output, int radius) {
InputSanityCheck.checkSameShape(input , output);
Kernel1D_F32 kernel = FactoryKernel.table1D_F32(radius,false);
ConvolveJustBorder_General_SB.horizontal(kernel,ImageBorderValue.wrap(input,0),output);
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvolveBox_MT.horizontal(input, output, radius); // depends on control dependency: [if], data = [none]
} else {
ImplConvolveBox.horizontal(input, output, radius); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void setText(String value) {
String oldValue = getText();
if (!oldValue.equals(value)) {
super.setText(value);
DomEvent.fireNativeEvent(Document.get().createChangeEvent(), this);
}
} }
|
public class class_name {
@Override
public void setText(String value) {
String oldValue = getText();
if (!oldValue.equals(value)) {
super.setText(value); // depends on control dependency: [if], data = [none]
DomEvent.fireNativeEvent(Document.get().createChangeEvent(), this); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void start() {
this.stateCache = cacheManager
.<ScopedState, CounterConfiguration>getCache(GlobalConfigurationManager.CONFIG_STATE_CACHE_NAME)
.getAdvancedCache();
listener = new CounterConfigurationListener();
Map<String, CounterConfiguration> persisted = storage.loadAll();
persisted.forEach((name, cfg) -> stateCache.putIfAbsent(stateKey(name), cfg));
counterCacheStarted.set(false);
stateCache.addListener(listener, new ScopeFilter(COUNTER_SCOPE));
if (!persisted.isEmpty() || stateCache.keySet().stream()
.anyMatch(scopedState -> COUNTER_SCOPE.equals(scopedState.getScope()))) {
//we have counter defined
startCounterCache();
}
} }
|
public class class_name {
public void start() {
this.stateCache = cacheManager
.<ScopedState, CounterConfiguration>getCache(GlobalConfigurationManager.CONFIG_STATE_CACHE_NAME)
.getAdvancedCache();
listener = new CounterConfigurationListener();
Map<String, CounterConfiguration> persisted = storage.loadAll();
persisted.forEach((name, cfg) -> stateCache.putIfAbsent(stateKey(name), cfg));
counterCacheStarted.set(false);
stateCache.addListener(listener, new ScopeFilter(COUNTER_SCOPE));
if (!persisted.isEmpty() || stateCache.keySet().stream()
.anyMatch(scopedState -> COUNTER_SCOPE.equals(scopedState.getScope()))) {
//we have counter defined
startCounterCache(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Type detect(final String payload) {
final Matcher m = ROOT_NAME.matcher(payload);
if (m.find() && m.groupCount() >= 1) {
final String root = m.group(1);
try {
return Type.valueOf(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, root));
} catch (IllegalArgumentException e) {
log.warn("Enable to detect notification type, no type for {}", root);
return null;
}
}
log.warn("Enable to detect notification type");
return null;
} }
|
public class class_name {
public static Type detect(final String payload) {
final Matcher m = ROOT_NAME.matcher(payload);
if (m.find() && m.groupCount() >= 1) {
final String root = m.group(1);
try {
return Type.valueOf(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, root)); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
log.warn("Enable to detect notification type, no type for {}", root);
return null;
} // depends on control dependency: [catch], data = [none]
}
log.warn("Enable to detect notification type");
return null;
} }
|
public class class_name {
public boolean isAuthorized(ChargingStationId chargingStationId, UserIdentity userIdentity, Class commandClass) {
// first search for this specific authorization
boolean isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), commandClass) != null;
if (!isAuthorized) {
// maybe the user identity has access to 'allPermissions'
isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), AllPermissions.class) != null;
}
return isAuthorized;
} }
|
public class class_name {
public boolean isAuthorized(ChargingStationId chargingStationId, UserIdentity userIdentity, Class commandClass) {
// first search for this specific authorization
boolean isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), commandClass) != null;
if (!isAuthorized) {
// maybe the user identity has access to 'allPermissions'
isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), AllPermissions.class) != null; // depends on control dependency: [if], data = [none]
}
return isAuthorized;
} }
|
public class class_name {
public static IoBufferEx getBufferForFile(IoBufferAllocatorEx<?> allocator, File requestFile) throws IOException {
FileInputStream in = new FileInputStream(requestFile);
IoBufferEx out = allocator.wrap(allocator.allocate(in.available())).setAutoExpander(allocator);
try {
int pos = out.position();
byte[] buf = new byte[1024 * 8];
int length;
while ((length = in.read(buf)) > 0) {
out.put(buf, 0, length);
}
out.position(pos);
} finally {
in.close();
}
return out;
} }
|
public class class_name {
public static IoBufferEx getBufferForFile(IoBufferAllocatorEx<?> allocator, File requestFile) throws IOException {
FileInputStream in = new FileInputStream(requestFile);
IoBufferEx out = allocator.wrap(allocator.allocate(in.available())).setAutoExpander(allocator);
try {
int pos = out.position();
byte[] buf = new byte[1024 * 8];
int length;
while ((length = in.read(buf)) > 0) {
out.put(buf, 0, length); // depends on control dependency: [while], data = [none]
}
out.position(pos);
} finally {
in.close();
}
return out;
} }
|
public class class_name {
private boolean willWriteBean(Bean bean) {
for (MetaProperty<?> prop : bean.metaBean().metaPropertyIterable()) {
if (prop.style().isSerializable() || (prop.style().isDerived() && settings.isIncludeDerived())) {
return true;
}
}
return false;
} }
|
public class class_name {
private boolean willWriteBean(Bean bean) {
for (MetaProperty<?> prop : bean.metaBean().metaPropertyIterable()) {
if (prop.style().isSerializable() || (prop.style().isDerived() && settings.isIncludeDerived())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@Override
public final T process(
final Map<String, Object> pAddParam,
final T pEntity, final IRequestData pRequestData) throws Exception {
String fileToUploadName = (String) pRequestData
.getAttribute("fileToUploadName");
String fieldNameFilePath = pRequestData.getParameter("fieldNameFilePath");
String fieldNameFileName = pRequestData.getParameter("fieldNameFileName");
if (fieldNameFileName != null) {
Method setterFileName = this.settersRapiHolder
.getFor(pEntity.getClass(), fieldNameFileName);
if (fileToUploadName != null) {
setterFileName.invoke(pEntity, fileToUploadName);
} else { // either uploaded path or null
Method getFpn = this.gettersRapiHolder
.getFor(pEntity.getClass(), fieldNameFilePath);
String pth = (String) getFpn.invoke(pEntity);
if (pth == null || "".equals(pth)) {
setterFileName.invoke(pEntity, null);
} else {
//uploaded URL separator is always "/"
int idxs = pth.lastIndexOf("/");
if (idxs > 1) {
setterFileName.invoke(pEntity, pth.substring(idxs + 1));
} else {
setterFileName.invoke(pEntity, pth);
}
}
}
}
if (fileToUploadName != null) {
OutputStream outs = null;
InputStream ins = null;
try {
//fill file and filePath field:
String ft = String.valueOf(new Date().getTime());
String filePath = this.webAppPath + File.separator
+ this.uploadDirectory + File.separator
+ ft + fileToUploadName;
ins = (InputStream) pRequestData
.getAttribute("fileToUploadInputStream");
outs = new BufferedOutputStream(
new FileOutputStream(filePath));
byte[] data = new byte[1024];
int count;
while ((count = ins.read(data)) != -1) {
outs.write(data, 0, count);
}
outs.flush();
Method setterFieldPath = this.settersRapiHolder
.getFor(pEntity.getClass(), fieldNameFilePath);
setterFieldPath.invoke(pEntity, filePath);
String fieldNameFileUrl = pRequestData
.getParameter("fieldNameFileUrl");
if (fieldNameFileUrl != null) {
Method setterFileUrl = this.settersRapiHolder
.getFor(pEntity.getClass(), fieldNameFileUrl);
setterFileUrl.invoke(pEntity, this.uploadDirectory
+ "/" + ft + fileToUploadName);
}
} finally {
if (ins != null) {
ins.close();
}
if (outs != null) {
outs.close();
}
}
} // else NULL or uploaded
if (pEntity.getIsNew()) {
this.srvOrm.insertEntity(pAddParam, pEntity);
pEntity.setIsNew(false);
} else {
this.srvOrm.updateEntity(pAddParam, pEntity);
}
return pEntity;
} }
|
public class class_name {
@Override
public final T process(
final Map<String, Object> pAddParam,
final T pEntity, final IRequestData pRequestData) throws Exception {
String fileToUploadName = (String) pRequestData
.getAttribute("fileToUploadName");
String fieldNameFilePath = pRequestData.getParameter("fieldNameFilePath");
String fieldNameFileName = pRequestData.getParameter("fieldNameFileName");
if (fieldNameFileName != null) {
Method setterFileName = this.settersRapiHolder
.getFor(pEntity.getClass(), fieldNameFileName);
if (fileToUploadName != null) {
setterFileName.invoke(pEntity, fileToUploadName);
} else { // either uploaded path or null
Method getFpn = this.gettersRapiHolder
.getFor(pEntity.getClass(), fieldNameFilePath);
String pth = (String) getFpn.invoke(pEntity);
if (pth == null || "".equals(pth)) {
setterFileName.invoke(pEntity, null); // depends on control dependency: [if], data = [none]
} else {
//uploaded URL separator is always "/"
int idxs = pth.lastIndexOf("/");
if (idxs > 1) {
setterFileName.invoke(pEntity, pth.substring(idxs + 1)); // depends on control dependency: [if], data = [(idxs]
} else {
setterFileName.invoke(pEntity, pth); // depends on control dependency: [if], data = [none]
}
}
}
}
if (fileToUploadName != null) {
OutputStream outs = null;
InputStream ins = null;
try {
//fill file and filePath field:
String ft = String.valueOf(new Date().getTime());
String filePath = this.webAppPath + File.separator
+ this.uploadDirectory + File.separator
+ ft + fileToUploadName;
ins = (InputStream) pRequestData
.getAttribute("fileToUploadInputStream");
outs = new BufferedOutputStream(
new FileOutputStream(filePath));
byte[] data = new byte[1024];
int count;
while ((count = ins.read(data)) != -1) {
outs.write(data, 0, count);
}
outs.flush();
Method setterFieldPath = this.settersRapiHolder
.getFor(pEntity.getClass(), fieldNameFilePath);
setterFieldPath.invoke(pEntity, filePath);
String fieldNameFileUrl = pRequestData
.getParameter("fieldNameFileUrl");
if (fieldNameFileUrl != null) {
Method setterFileUrl = this.settersRapiHolder
.getFor(pEntity.getClass(), fieldNameFileUrl);
setterFileUrl.invoke(pEntity, this.uploadDirectory
+ "/" + ft + fileToUploadName);
}
} finally {
if (ins != null) {
ins.close();
}
if (outs != null) {
outs.close();
}
}
} // else NULL or uploaded
if (pEntity.getIsNew()) {
this.srvOrm.insertEntity(pAddParam, pEntity);
pEntity.setIsNew(false);
} else {
this.srvOrm.updateEntity(pAddParam, pEntity);
}
return pEntity;
} }
|
public class class_name {
public ListCompilationJobsResult withCompilationJobSummaries(CompilationJobSummary... compilationJobSummaries) {
if (this.compilationJobSummaries == null) {
setCompilationJobSummaries(new java.util.ArrayList<CompilationJobSummary>(compilationJobSummaries.length));
}
for (CompilationJobSummary ele : compilationJobSummaries) {
this.compilationJobSummaries.add(ele);
}
return this;
} }
|
public class class_name {
public ListCompilationJobsResult withCompilationJobSummaries(CompilationJobSummary... compilationJobSummaries) {
if (this.compilationJobSummaries == null) {
setCompilationJobSummaries(new java.util.ArrayList<CompilationJobSummary>(compilationJobSummaries.length)); // depends on control dependency: [if], data = [none]
}
for (CompilationJobSummary ele : compilationJobSummaries) {
this.compilationJobSummaries.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public TrxMessageHeader createProcessMessageHeader(MessageDetailTarget recMessageDetailTarget, String strMessageTransport)
{
if ((this.getEditMode() != DBConstants.EDIT_CURRENT) && (this.getEditMode() != DBConstants.EDIT_IN_PROGRESS))
return null; // Must have a valid record
TrxMessageHeader trxMessageHeader = new TrxMessageHeader(null, null);
// Add properties from this process info
MessageInfo recMessageInfo = (MessageInfo)((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference();
if (recMessageInfo == null)
return null; // Impossible
trxMessageHeader = recMessageInfo.addMessageProperties(trxMessageHeader);
trxMessageHeader = this.addMessageProperties(trxMessageHeader);
if (recMessageDetailTarget != null)
{
if (m_recMessageDetail == null)
{
RecordOwner recordOwner = this.findRecordOwner();
m_recMessageDetail = new MessageDetail(recordOwner);
recordOwner.removeRecord(m_recMessageDetail);
this.addListener(new FreeOnFreeHandler(m_recMessageDetail));
}
Vector<MessageDetailTarget> vMessageDetailTarget = new Vector<MessageDetailTarget>();
while (recMessageDetailTarget != null)
{
vMessageDetailTarget.addElement(recMessageDetailTarget);
recMessageDetailTarget = recMessageDetailTarget.getNextMessageDetailTarget();
}
for (int i = vMessageDetailTarget.size() - 1; i >= 0; i--)
{
recMessageDetailTarget = vMessageDetailTarget.get(i);
trxMessageHeader = recMessageDetailTarget.addMessageProperties(trxMessageHeader);
}
MessageTransport recMessageTransport = null;
if ((strMessageTransport == null) || (strMessageTransport.length() == 0))
strMessageTransport = (String)trxMessageHeader.get(MessageTransport.SEND_MESSAGE_BY_PARAM);
if ((strMessageTransport != null) && (strMessageTransport.length() != 0))
recMessageTransport = this.getMessageTransport(strMessageTransport);
if (recMessageTransport == null)
{ // Still no transport, see if there is a default transport in the MessageDetail
for (int i = 0; i < vMessageDetailTarget.size(); i++)
{
recMessageDetailTarget = vMessageDetailTarget.get(i);
recMessageTransport = m_recMessageDetail.getDefaultMessageTransport(recMessageDetailTarget, this);
if (recMessageTransport != null)
break;
}
}
if (recMessageTransport == null)
{ // See if there is a default transport specified in this record
if (!this.getField(MessageProcessInfo.DEFAULT_MESSAGE_TRANSPORT_ID).isNull())
recMessageTransport = (MessageTransport)((ReferenceField)this.getField(MessageProcessInfo.DEFAULT_MESSAGE_TRANSPORT_ID)).getReference();
}
if (recMessageTransport == null)
{ // See if there is a default transport in the MessageDetailTarget chain.
for (int i = 0; i < vMessageDetailTarget.size(); i++)
{
recMessageDetailTarget = vMessageDetailTarget.get(i);
recMessageTransport = recMessageDetailTarget.getMessageTransport(trxMessageHeader);
if (recMessageTransport != null)
if ((recMessageTransport.getEditMode() == DBConstants.EDIT_CURRENT) || (recMessageTransport.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
break;
}
}
if ((recMessageTransport == null)
|| ((recMessageTransport.getEditMode() != DBConstants.EDIT_CURRENT) && (recMessageTransport.getEditMode() != DBConstants.EDIT_IN_PROGRESS)))
recMessageTransport = this.getMessageTransport(MessageTransport.DIRECT);
trxMessageHeader = recMessageTransport.addMessageProperties(trxMessageHeader);
for (int i = vMessageDetailTarget.size() - 1; i >= 0; i--)
{
recMessageDetailTarget = vMessageDetailTarget.get(i);
trxMessageHeader = m_recMessageDetail.addMessageProperties(trxMessageHeader, recMessageDetailTarget, this, recMessageTransport);
}
for (int i = vMessageDetailTarget.size() - 1; i >= 0; i--)
{
recMessageDetailTarget = vMessageDetailTarget.get(i);
trxMessageHeader = recMessageDetailTarget.addDestInfo(trxMessageHeader);
}
}
else
{ // If there is no target detail, at least try to get the transport
MessageTransport recMessageTransport = null;
if ((strMessageTransport == null) || (strMessageTransport.length() == 0))
strMessageTransport = (String)trxMessageHeader.get(MessageTransport.SEND_MESSAGE_BY_PARAM);
if ((strMessageTransport != null) && (strMessageTransport.length() != 0))
recMessageTransport = this.getMessageTransport(strMessageTransport);
if (recMessageTransport != null) if (true)
trxMessageHeader = recMessageTransport.addMessageProperties(trxMessageHeader);
}
trxMessageHeader = this.addTransportProperties(trxMessageHeader, null);
if (trxMessageHeader.get(MessageConstants.QUEUE_NAME) != null)
trxMessageHeader.setQueueName((String)trxMessageHeader.get(MessageConstants.QUEUE_NAME));
if (trxMessageHeader.get(MessageConstants.QUEUE_TYPE) != null)
trxMessageHeader.setQueueType((String)trxMessageHeader.get(MessageConstants.QUEUE_TYPE));
return trxMessageHeader;
} }
|
public class class_name {
public TrxMessageHeader createProcessMessageHeader(MessageDetailTarget recMessageDetailTarget, String strMessageTransport)
{
if ((this.getEditMode() != DBConstants.EDIT_CURRENT) && (this.getEditMode() != DBConstants.EDIT_IN_PROGRESS))
return null; // Must have a valid record
TrxMessageHeader trxMessageHeader = new TrxMessageHeader(null, null);
// Add properties from this process info
MessageInfo recMessageInfo = (MessageInfo)((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference();
if (recMessageInfo == null)
return null; // Impossible
trxMessageHeader = recMessageInfo.addMessageProperties(trxMessageHeader);
trxMessageHeader = this.addMessageProperties(trxMessageHeader);
if (recMessageDetailTarget != null)
{
if (m_recMessageDetail == null)
{
RecordOwner recordOwner = this.findRecordOwner();
m_recMessageDetail = new MessageDetail(recordOwner); // depends on control dependency: [if], data = [none]
recordOwner.removeRecord(m_recMessageDetail); // depends on control dependency: [if], data = [(m_recMessageDetail]
this.addListener(new FreeOnFreeHandler(m_recMessageDetail)); // depends on control dependency: [if], data = [(m_recMessageDetail]
}
Vector<MessageDetailTarget> vMessageDetailTarget = new Vector<MessageDetailTarget>();
while (recMessageDetailTarget != null)
{
vMessageDetailTarget.addElement(recMessageDetailTarget); // depends on control dependency: [while], data = [(recMessageDetailTarget]
recMessageDetailTarget = recMessageDetailTarget.getNextMessageDetailTarget(); // depends on control dependency: [while], data = [none]
}
for (int i = vMessageDetailTarget.size() - 1; i >= 0; i--)
{
recMessageDetailTarget = vMessageDetailTarget.get(i); // depends on control dependency: [for], data = [i]
trxMessageHeader = recMessageDetailTarget.addMessageProperties(trxMessageHeader); // depends on control dependency: [for], data = [none]
}
MessageTransport recMessageTransport = null;
if ((strMessageTransport == null) || (strMessageTransport.length() == 0))
strMessageTransport = (String)trxMessageHeader.get(MessageTransport.SEND_MESSAGE_BY_PARAM);
if ((strMessageTransport != null) && (strMessageTransport.length() != 0))
recMessageTransport = this.getMessageTransport(strMessageTransport);
if (recMessageTransport == null)
{ // Still no transport, see if there is a default transport in the MessageDetail
for (int i = 0; i < vMessageDetailTarget.size(); i++)
{
recMessageDetailTarget = vMessageDetailTarget.get(i); // depends on control dependency: [for], data = [i]
recMessageTransport = m_recMessageDetail.getDefaultMessageTransport(recMessageDetailTarget, this); // depends on control dependency: [for], data = [none]
if (recMessageTransport != null)
break;
}
}
if (recMessageTransport == null)
{ // See if there is a default transport specified in this record
if (!this.getField(MessageProcessInfo.DEFAULT_MESSAGE_TRANSPORT_ID).isNull())
recMessageTransport = (MessageTransport)((ReferenceField)this.getField(MessageProcessInfo.DEFAULT_MESSAGE_TRANSPORT_ID)).getReference();
}
if (recMessageTransport == null)
{ // See if there is a default transport in the MessageDetailTarget chain.
for (int i = 0; i < vMessageDetailTarget.size(); i++)
{
recMessageDetailTarget = vMessageDetailTarget.get(i); // depends on control dependency: [for], data = [i]
recMessageTransport = recMessageDetailTarget.getMessageTransport(trxMessageHeader); // depends on control dependency: [for], data = [none]
if (recMessageTransport != null)
if ((recMessageTransport.getEditMode() == DBConstants.EDIT_CURRENT) || (recMessageTransport.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
break;
}
}
if ((recMessageTransport == null)
|| ((recMessageTransport.getEditMode() != DBConstants.EDIT_CURRENT) && (recMessageTransport.getEditMode() != DBConstants.EDIT_IN_PROGRESS)))
recMessageTransport = this.getMessageTransport(MessageTransport.DIRECT);
trxMessageHeader = recMessageTransport.addMessageProperties(trxMessageHeader); // depends on control dependency: [if], data = [none]
for (int i = vMessageDetailTarget.size() - 1; i >= 0; i--)
{
recMessageDetailTarget = vMessageDetailTarget.get(i); // depends on control dependency: [for], data = [i]
trxMessageHeader = m_recMessageDetail.addMessageProperties(trxMessageHeader, recMessageDetailTarget, this, recMessageTransport); // depends on control dependency: [for], data = [none]
}
for (int i = vMessageDetailTarget.size() - 1; i >= 0; i--)
{
recMessageDetailTarget = vMessageDetailTarget.get(i); // depends on control dependency: [for], data = [i]
trxMessageHeader = recMessageDetailTarget.addDestInfo(trxMessageHeader); // depends on control dependency: [for], data = [none]
}
}
else
{ // If there is no target detail, at least try to get the transport
MessageTransport recMessageTransport = null;
if ((strMessageTransport == null) || (strMessageTransport.length() == 0))
strMessageTransport = (String)trxMessageHeader.get(MessageTransport.SEND_MESSAGE_BY_PARAM);
if ((strMessageTransport != null) && (strMessageTransport.length() != 0))
recMessageTransport = this.getMessageTransport(strMessageTransport);
if (recMessageTransport != null) if (true)
trxMessageHeader = recMessageTransport.addMessageProperties(trxMessageHeader);
}
trxMessageHeader = this.addTransportProperties(trxMessageHeader, null);
if (trxMessageHeader.get(MessageConstants.QUEUE_NAME) != null)
trxMessageHeader.setQueueName((String)trxMessageHeader.get(MessageConstants.QUEUE_NAME));
if (trxMessageHeader.get(MessageConstants.QUEUE_TYPE) != null)
trxMessageHeader.setQueueType((String)trxMessageHeader.get(MessageConstants.QUEUE_TYPE));
return trxMessageHeader;
} }
|
public class class_name {
@Override
public double membership(double x) {
if (this.root == null) {
throw new RuntimeException(String.format(
"[function error] function <%s> not loaded.", formula));
}
if (this.engine != null) {
for (InputVariable inputVariable : this.engine.getInputVariables()) {
this.variables.put(inputVariable.getName(), inputVariable.getValue());
}
for (OutputVariable outputVariable : this.engine.getOutputVariables()) {
this.variables.put(outputVariable.getName(), outputVariable.getValue());
}
}
this.variables.put("x", x);
return evaluate(this.variables);
} }
|
public class class_name {
@Override
public double membership(double x) {
if (this.root == null) {
throw new RuntimeException(String.format(
"[function error] function <%s> not loaded.", formula));
}
if (this.engine != null) {
for (InputVariable inputVariable : this.engine.getInputVariables()) {
this.variables.put(inputVariable.getName(), inputVariable.getValue()); // depends on control dependency: [for], data = [inputVariable]
}
for (OutputVariable outputVariable : this.engine.getOutputVariables()) {
this.variables.put(outputVariable.getName(), outputVariable.getValue()); // depends on control dependency: [for], data = [outputVariable]
}
}
this.variables.put("x", x);
return evaluate(this.variables);
} }
|
public class class_name {
@Override
public DefaultHttpClientConfigurator configure(Config httpClientConfig) {
Optional<HttpHost> proxy = getProxyAddr(httpClientConfig);
if (proxy.isPresent()) {
getBuilder().setProxy(proxy.get());
}
return this;
} }
|
public class class_name {
@Override
public DefaultHttpClientConfigurator configure(Config httpClientConfig) {
Optional<HttpHost> proxy = getProxyAddr(httpClientConfig);
if (proxy.isPresent()) {
getBuilder().setProxy(proxy.get()); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public boolean selectionChanged(Object source, int iStartRow, int iEndRow, int iSelectType)
{
boolean bChanged = super.selectionChanged(source, iStartRow, iEndRow, iSelectType);
if (bChanged)
{ // Notify all the listSelectionListeners
this.fireMySelectionChanged(new MyListSelectionEvent(source, this, m_iSelectedRow, iSelectType));
}
return bChanged;
} }
|
public class class_name {
public boolean selectionChanged(Object source, int iStartRow, int iEndRow, int iSelectType)
{
boolean bChanged = super.selectionChanged(source, iStartRow, iEndRow, iSelectType);
if (bChanged)
{ // Notify all the listSelectionListeners
this.fireMySelectionChanged(new MyListSelectionEvent(source, this, m_iSelectedRow, iSelectType)); // depends on control dependency: [if], data = [none]
}
return bChanged;
} }
|
public class class_name {
public void setDatabaseVariables() {
if (isPropertyTrue(db_readonly)) {
database.setReadOnly();
}
if (isPropertyTrue(hsqldb_files_readonly)) {
database.setFilesReadOnly();
}
database.sqlEnforceStrictSize =
isPropertyTrue(sql_enforce_strict_size);
if (isPropertyTrue(sql_compare_in_locale)) {
stringProps.remove(sql_compare_in_locale);
database.collation.setCollationAsLocale();
}
database.setMetaDirty(false);
} }
|
public class class_name {
public void setDatabaseVariables() {
if (isPropertyTrue(db_readonly)) {
database.setReadOnly(); // depends on control dependency: [if], data = [none]
}
if (isPropertyTrue(hsqldb_files_readonly)) {
database.setFilesReadOnly(); // depends on control dependency: [if], data = [none]
}
database.sqlEnforceStrictSize =
isPropertyTrue(sql_enforce_strict_size);
if (isPropertyTrue(sql_compare_in_locale)) {
stringProps.remove(sql_compare_in_locale); // depends on control dependency: [if], data = [none]
database.collation.setCollationAsLocale(); // depends on control dependency: [if], data = [none]
}
database.setMetaDirty(false);
} }
|
public class class_name {
private HashMap<DatanodeDescriptor, Integer> directoryDataNodeUsage(INodeDirectory dir,
int threshold) {
HashMap<DatanodeDescriptor, Integer> dataNodeUsage = new HashMap<DatanodeDescriptor, Integer>();
List<INode> children;
nameSystem.readLock();
try {
if (dir.getChildrenRaw() == null) {
return dataNodeUsage;
}
children = new ArrayList<INode>(dir.getChildrenRaw());
Collections.shuffle(children);
for (INode node : children) {
if (!(node instanceof INodeFile)) { // The condition is always false.
continue;
}
INodeFile file = (INodeFile) node;
BlockInfo[] blocks = file.getBlocks();
for (BlockInfo block : blocks) {
if (threshold == 0) {
return dataNodeUsage;
}
int replication = block.numNodes();
for (int i = 0; i < replication; i++) {
DatanodeDescriptor datanode = block.getDatanode(i);
Integer currentUsage = dataNodeUsage.get(datanode);
dataNodeUsage.put(datanode, currentUsage == null ? 1 : currentUsage + 1);
}
threshold--;
}
}
} finally {
nameSystem.readUnlock();
}
return dataNodeUsage;
} }
|
public class class_name {
private HashMap<DatanodeDescriptor, Integer> directoryDataNodeUsage(INodeDirectory dir,
int threshold) {
HashMap<DatanodeDescriptor, Integer> dataNodeUsage = new HashMap<DatanodeDescriptor, Integer>();
List<INode> children;
nameSystem.readLock();
try {
if (dir.getChildrenRaw() == null) {
return dataNodeUsage; // depends on control dependency: [if], data = [none]
}
children = new ArrayList<INode>(dir.getChildrenRaw()); // depends on control dependency: [try], data = [none]
Collections.shuffle(children); // depends on control dependency: [try], data = [none]
for (INode node : children) {
if (!(node instanceof INodeFile)) { // The condition is always false.
continue;
}
INodeFile file = (INodeFile) node;
BlockInfo[] blocks = file.getBlocks();
for (BlockInfo block : blocks) {
if (threshold == 0) {
return dataNodeUsage; // depends on control dependency: [if], data = [none]
}
int replication = block.numNodes();
for (int i = 0; i < replication; i++) {
DatanodeDescriptor datanode = block.getDatanode(i);
Integer currentUsage = dataNodeUsage.get(datanode);
dataNodeUsage.put(datanode, currentUsage == null ? 1 : currentUsage + 1); // depends on control dependency: [for], data = [none]
}
threshold--; // depends on control dependency: [for], data = [none]
}
}
} finally {
nameSystem.readUnlock();
}
return dataNodeUsage;
} }
|
public class class_name {
@Override
protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) {
final PortletContext portletContext = this.getPortletContext();
final PortletApplicationContext parentPortletApplicationContext = PortletApplicationContextUtils2.getPortletApplicationContext(portletContext);
if (parentPortletApplicationContext != null) {
//Found the parent PortletApplicationContext, use it as the parent
return super.createPortletApplicationContext(parentPortletApplicationContext);
}
//No parent PortletApplicationContext was found, use the root web application context as the parent
return super.createPortletApplicationContext(parent);
} }
|
public class class_name {
@Override
protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) {
final PortletContext portletContext = this.getPortletContext();
final PortletApplicationContext parentPortletApplicationContext = PortletApplicationContextUtils2.getPortletApplicationContext(portletContext);
if (parentPortletApplicationContext != null) {
//Found the parent PortletApplicationContext, use it as the parent
return super.createPortletApplicationContext(parentPortletApplicationContext); // depends on control dependency: [if], data = [(parentPortletApplicationContext]
}
//No parent PortletApplicationContext was found, use the root web application context as the parent
return super.createPortletApplicationContext(parent);
} }
|
public class class_name {
@Value("${studentSuccessPlanService.sspContext:/ssp}")
public void setSspContext(String sspContext) {
// ensure leading '/'
if (!sspContext.startsWith("/")) {
sspContext = "/" + sspContext;
}
// remove any trailing '/'
if (sspContext.endsWith("/")) {
sspContext = sspContext.replaceAll("/*$", "");
}
this.sspContext = sspContext;
} }
|
public class class_name {
@Value("${studentSuccessPlanService.sspContext:/ssp}")
public void setSspContext(String sspContext) {
// ensure leading '/'
if (!sspContext.startsWith("/")) {
sspContext = "/" + sspContext; // depends on control dependency: [if], data = [none]
}
// remove any trailing '/'
if (sspContext.endsWith("/")) {
sspContext = sspContext.replaceAll("/*$", ""); // depends on control dependency: [if], data = [none]
}
this.sspContext = sspContext;
} }
|
public class class_name {
@ThreadSafe public void stringEncode(String s, Writer writer) throws IOException {
char[] carr = s.toCharArray();
int len = carr.length;
for(int i = 0; i < len; i++) {
char c = carr[i];
switch (c) {
case '"':
writer.write("\\\"");
break;
case '/':
writer.write(escapeSlash ? "\\/" : "/");
break;
case '\\':
writer.write("\\\\");
break;
case '\b':
writer.write("\\b");
break;
case '\f':
writer.write("\\f");
break;
case '\n':
writer.write("\\n");
break;
case '\r':
writer.write("\\r");
break;
case '\t':
writer.write("\\t");
break;
default:
if(unicodeEscapeAll) {
if(c < 127) {
writer.append(c);
} else {
String hex = Integer.toHexString(c);
writer.write("\\u");
switch (hex.length()) {
case 1:
writer.write("000");
break;
case 2:
writer.write("00");
break;
case 3:
writer.write("0");
break;
default:
break;
}
writer.write(Integer.toHexString(c));
}
} else {
writer.append(c);
}
break;
}
}
} }
|
public class class_name {
@ThreadSafe public void stringEncode(String s, Writer writer) throws IOException {
char[] carr = s.toCharArray();
int len = carr.length;
for(int i = 0; i < len; i++) {
char c = carr[i];
switch (c) {
case '"':
writer.write("\\\"");
break;
case '/':
writer.write(escapeSlash ? "\\/" : "/");
break;
case '\\':
writer.write("\\\\");
break;
case '\b':
writer.write("\\b");
break;
case '\f':
writer.write("\\f");
break;
case '\n':
writer.write("\\n");
break;
case '\r':
writer.write("\\r");
break;
case '\t':
writer.write("\\t");
break;
default:
if(unicodeEscapeAll) {
if(c < 127) {
writer.append(c); // depends on control dependency: [if], data = [(c]
} else {
String hex = Integer.toHexString(c);
writer.write("\\u"); // depends on control dependency: [if], data = [none]
switch (hex.length()) {
case 1:
writer.write("000");
break;
case 2:
writer.write("00");
break;
case 3:
writer.write("0");
break;
default:
break;
}
writer.write(Integer.toHexString(c));
}
} else {
writer.append(c);
}
break;
}
}
} }
|
public class class_name {
@SneakyThrows
public static String getCasServerHostName() {
val hostName = InetAddress.getLocalHost().getHostName();
val index = hostName.indexOf('.');
if (index > 0) {
return hostName.substring(0, index);
}
return hostName;
} }
|
public class class_name {
@SneakyThrows
public static String getCasServerHostName() {
val hostName = InetAddress.getLocalHost().getHostName();
val index = hostName.indexOf('.');
if (index > 0) {
return hostName.substring(0, index); // depends on control dependency: [if], data = [none]
}
return hostName;
} }
|
public class class_name {
public List<App> getUserApps(long id) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_APPS_FOR_USER_URL, Long.toString(id)));
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
List<App> apps = new ArrayList<App>();
App app = null;
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.GET, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() == 200) {
JSONObject[] dataArray = oAuthResponse.getDataArray();
if (dataArray != null && dataArray.length > 0) {
for (JSONObject data: dataArray) {
app = new App(data);
apps.add(app);
}
}
} else {
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
}
return apps;
} }
|
public class class_name {
public List<App> getUserApps(long id) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_APPS_FOR_USER_URL, Long.toString(id)));
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
List<App> apps = new ArrayList<App>();
App app = null;
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.GET, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() == 200) {
JSONObject[] dataArray = oAuthResponse.getDataArray();
if (dataArray != null && dataArray.length > 0) {
for (JSONObject data: dataArray) {
app = new App(data); // depends on control dependency: [for], data = [data]
apps.add(app); // depends on control dependency: [for], data = [none]
}
}
} else {
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
}
return apps;
} }
|
public class class_name {
public void addListeners()
{
super.addListeners();
Record record = this.getMainRecord();
Record recClassInfo = this.getRecord(ClassInfo.CLASS_INFO_FILE);
if (recClassInfo != null)
{
record.setKeyArea(Issue.CLASS_INFO_ID_KEY);
SubFileFilter listener = new SubFileFilter(recClassInfo.getField(ClassInfo.ID), Issue.CLASS_INFO_ID, null, null, null, null, true);
record.addListener(listener);
recClassInfo.getField(ClassInfo.ID).addListener(new FieldReSelectHandler(this));
}
} }
|
public class class_name {
public void addListeners()
{
super.addListeners();
Record record = this.getMainRecord();
Record recClassInfo = this.getRecord(ClassInfo.CLASS_INFO_FILE);
if (recClassInfo != null)
{
record.setKeyArea(Issue.CLASS_INFO_ID_KEY); // depends on control dependency: [if], data = [none]
SubFileFilter listener = new SubFileFilter(recClassInfo.getField(ClassInfo.ID), Issue.CLASS_INFO_ID, null, null, null, null, true);
record.addListener(listener); // depends on control dependency: [if], data = [none]
recClassInfo.getField(ClassInfo.ID).addListener(new FieldReSelectHandler(this)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
protected void visitMsgNode(MsgNode node) {
MsgPartsAndIds msgPartsAndIds = MsgUtils.buildMsgPartsAndComputeMsgIdForDualFormat(node);
SoyMsg.Builder builder = SoyMsg.builder().setId(msgPartsAndIds.id);
if (node.getMeaning() != null) {
builder.setMeaning(node.getMeaning());
}
SoyMsg msg =
builder
.setDesc(node.getDesc())
.setIsHidden(node.isHidden())
.setContentType(node.getContentType())
.addSourceLocation(node.getSourceLocation())
.setIsPlrselMsg(node.isPlrselMsg())
.setParts(msgPartsAndIds.parts)
.build();
msgs.add(msg);
} }
|
public class class_name {
@Override
protected void visitMsgNode(MsgNode node) {
MsgPartsAndIds msgPartsAndIds = MsgUtils.buildMsgPartsAndComputeMsgIdForDualFormat(node);
SoyMsg.Builder builder = SoyMsg.builder().setId(msgPartsAndIds.id);
if (node.getMeaning() != null) {
builder.setMeaning(node.getMeaning()); // depends on control dependency: [if], data = [(node.getMeaning()]
}
SoyMsg msg =
builder
.setDesc(node.getDesc())
.setIsHidden(node.isHidden())
.setContentType(node.getContentType())
.addSourceLocation(node.getSourceLocation())
.setIsPlrselMsg(node.isPlrselMsg())
.setParts(msgPartsAndIds.parts)
.build();
msgs.add(msg);
} }
|
public class class_name {
private void initializeAuthority(String p_uriSpec)
throws MalformedURIException {
int index = 0;
int start = 0;
int end = p_uriSpec.length();
char testChar = '\0';
String userinfo = null;
// userinfo is everything up @
if (p_uriSpec.indexOf('@', start) != -1) {
while (index < end) {
testChar = p_uriSpec.charAt(index);
if (testChar == '@') {
break;
}
index++;
}
userinfo = p_uriSpec.substring(start, index);
index++;
}
// host is everything up to ':'
String host = null;
start = index;
while (index < end) {
testChar = p_uriSpec.charAt(index);
if (testChar == ':') {
break;
}
index++;
}
host = p_uriSpec.substring(start, index);
int port = -1;
if (host.length() > 0) {
// port
if (testChar == ':') {
index++;
start = index;
while (index < end) {
index++;
}
String portStr = p_uriSpec.substring(start, index);
if (portStr.length() > 0) {
for (int i = 0; i < portStr.length(); i++) {
if (!isDigit(portStr.charAt(i))) {
throw new MalformedURIException(
portStr
+ " is invalid. Port should only contain digits!");
}
}
try {
port = Integer.parseInt(portStr);
m_port = portStr;
} catch (NumberFormatException nfe) {
// can't happen
}
}
}
}
setHost(host);
setPort(port);
setUserinfo(userinfo);
} }
|
public class class_name {
private void initializeAuthority(String p_uriSpec)
throws MalformedURIException {
int index = 0;
int start = 0;
int end = p_uriSpec.length();
char testChar = '\0';
String userinfo = null;
// userinfo is everything up @
if (p_uriSpec.indexOf('@', start) != -1) {
while (index < end) {
testChar = p_uriSpec.charAt(index);
// depends on control dependency: [while], data = [(index]
if (testChar == '@') {
break;
}
index++;
// depends on control dependency: [while], data = [none]
}
userinfo = p_uriSpec.substring(start, index);
index++;
}
// host is everything up to ':'
String host = null;
start = index;
while (index < end) {
testChar = p_uriSpec.charAt(index);
if (testChar == ':') {
break;
}
index++;
}
host = p_uriSpec.substring(start, index);
int port = -1;
if (host.length() > 0) {
// port
if (testChar == ':') {
index++;
start = index;
while (index < end) {
index++;
}
String portStr = p_uriSpec.substring(start, index);
if (portStr.length() > 0) {
for (int i = 0; i < portStr.length(); i++) {
if (!isDigit(portStr.charAt(i))) {
throw new MalformedURIException(
portStr
+ " is invalid. Port should only contain digits!");
}
}
try {
port = Integer.parseInt(portStr);
m_port = portStr;
} catch (NumberFormatException nfe) {
// can't happen
}
}
}
}
setHost(host);
setPort(port);
setUserinfo(userinfo);
} }
|
public class class_name {
public static byte[] fromHexa(String s ) {
byte[] ret = new byte[s.length()/2];
for(int i=0;i<ret.length;i++){
ret[i] = (byte) Integer.parseInt(s.substring(i*2,i*2+2),16);
}
return ret;
} }
|
public class class_name {
public static byte[] fromHexa(String s ) {
byte[] ret = new byte[s.length()/2];
for(int i=0;i<ret.length;i++){
ret[i] = (byte) Integer.parseInt(s.substring(i*2,i*2+2),16); // depends on control dependency: [for], data = [i]
}
return ret;
} }
|
public class class_name {
public <E extends Exception> E findWrapped(Class<E> exceptionType) {
if (exceptionType == null) {
return null;
}
Throwable cause = getCause();
while (true) {
if (cause == null) {
return null;
}
if (exceptionType.isInstance(cause)) {
@SuppressWarnings("unchecked") E matchedCause = (E) cause;
return matchedCause;
}
if (cause.getCause() == cause) {
return null;
}
if (cause instanceof WrappedRuntimeException) {
return ((WrappedRuntimeException) cause).findWrapped(exceptionType);
}
if (cause instanceof WrappedCheckedException) {
return ((WrappedCheckedException) cause).findWrapped(exceptionType);
}
cause = cause.getCause();
}
} }
|
public class class_name {
public <E extends Exception> E findWrapped(Class<E> exceptionType) {
if (exceptionType == null) {
return null; // depends on control dependency: [if], data = [none]
}
Throwable cause = getCause();
while (true) {
if (cause == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (exceptionType.isInstance(cause)) {
@SuppressWarnings("unchecked") E matchedCause = (E) cause;
return matchedCause; // depends on control dependency: [if], data = [none]
}
if (cause.getCause() == cause) {
return null; // depends on control dependency: [if], data = [none]
}
if (cause instanceof WrappedRuntimeException) {
return ((WrappedRuntimeException) cause).findWrapped(exceptionType); // depends on control dependency: [if], data = [none]
}
if (cause instanceof WrappedCheckedException) {
return ((WrappedCheckedException) cause).findWrapped(exceptionType); // depends on control dependency: [if], data = [none]
}
cause = cause.getCause(); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
public static Query parameterExists(final String name)
{
Assert.notNull(name, "Parameter name pattern must not be null.");
return new Query() {
final ParameterizedPatternParser pattern = new RegexParameterizedPatternParser("{" + name + "}");
final String parameterName = name;
@Override
public boolean evaluateHttp(final HttpServletRewrite event, final EvaluationContext context)
{
QueryStringBuilder queryString = QueryStringBuilder.createFromEncoded(event.getAddress().getQuery())
.decode();
for (String name : queryString.getParameterNames()) {
String[] parameterValues = queryString.getParameterValues(name);
if (parameterName.equals(name))
{
if (parameterValues == null || (parameterValues.length == 0))
{
return pattern.parse("").matches();
}
else
{
for (String value : parameterValues) {
ParameterizedPatternResult parseResult = pattern.parse(value);
if (parseResult.matches())
{
return parseResult.submit(event, context);
}
}
}
}
}
return false;
}
@Override
public String toString()
{
return "Query.parameterExists(\"" + name + "\")";
}
@Override
public Set<String> getRequiredParameterNames()
{
return pattern.getRequiredParameterNames();
}
@Override
public void setParameterStore(ParameterStore store)
{
pattern.setParameterStore(store);
}
};
} }
|
public class class_name {
public static Query parameterExists(final String name)
{
Assert.notNull(name, "Parameter name pattern must not be null.");
return new Query() {
final ParameterizedPatternParser pattern = new RegexParameterizedPatternParser("{" + name + "}");
final String parameterName = name;
@Override
public boolean evaluateHttp(final HttpServletRewrite event, final EvaluationContext context)
{
QueryStringBuilder queryString = QueryStringBuilder.createFromEncoded(event.getAddress().getQuery())
.decode();
for (String name : queryString.getParameterNames()) {
String[] parameterValues = queryString.getParameterValues(name);
if (parameterName.equals(name))
{
if (parameterValues == null || (parameterValues.length == 0))
{
return pattern.parse("").matches(); // depends on control dependency: [if], data = [none]
}
else
{
for (String value : parameterValues) {
ParameterizedPatternResult parseResult = pattern.parse(value);
if (parseResult.matches())
{
return parseResult.submit(event, context); // depends on control dependency: [if], data = [none]
}
}
}
}
}
return false;
}
@Override
public String toString()
{
return "Query.parameterExists(\"" + name + "\")";
}
@Override
public Set<String> getRequiredParameterNames()
{
return pattern.getRequiredParameterNames();
}
@Override
public void setParameterStore(ParameterStore store)
{
pattern.setParameterStore(store);
}
};
} }
|
public class class_name {
public void grantPolicy(@NonNull ComponentName admin, int usesPolicy) {
enforceActiveAdmin(admin);
Set<Integer> policyGrantedSet = adminPolicyGrantedMap.get(admin);
if (policyGrantedSet == null) {
policyGrantedSet = new HashSet<>();
policyGrantedSet.add(usesPolicy);
adminPolicyGrantedMap.put(admin, policyGrantedSet);
} else {
policyGrantedSet.add(usesPolicy);
}
} }
|
public class class_name {
public void grantPolicy(@NonNull ComponentName admin, int usesPolicy) {
enforceActiveAdmin(admin);
Set<Integer> policyGrantedSet = adminPolicyGrantedMap.get(admin);
if (policyGrantedSet == null) {
policyGrantedSet = new HashSet<>(); // depends on control dependency: [if], data = [none]
policyGrantedSet.add(usesPolicy); // depends on control dependency: [if], data = [none]
adminPolicyGrantedMap.put(admin, policyGrantedSet); // depends on control dependency: [if], data = [none]
} else {
policyGrantedSet.add(usesPolicy); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public final void mFUNCT() throws RecognitionException {
try {
int _type = FUNCT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:122:6: ( ( 'F' | 'f' ) ( 'U' | 'u' ) ( 'N' | 'n' ) ( 'C' | 'c' ) ( 'T' | 't' ) )
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:122:8: ( 'F' | 'f' ) ( 'U' | 'u' ) ( 'N' | 'n' ) ( 'C' | 'c' ) ( 'T' | 't' )
{
if ( input.LA(1)=='F'||input.LA(1)=='f' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
if ( input.LA(1)=='U'||input.LA(1)=='u' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
if ( input.LA(1)=='C'||input.LA(1)=='c' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
if ( input.LA(1)=='T'||input.LA(1)=='t' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
} }
|
public class class_name {
public final void mFUNCT() throws RecognitionException {
try {
int _type = FUNCT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:122:6: ( ( 'F' | 'f' ) ( 'U' | 'u' ) ( 'N' | 'n' ) ( 'C' | 'c' ) ( 'T' | 't' ) )
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:122:8: ( 'F' | 'f' ) ( 'U' | 'u' ) ( 'N' | 'n' ) ( 'C' | 'c' ) ( 'T' | 't' )
{
if ( input.LA(1)=='F'||input.LA(1)=='f' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
if ( input.LA(1)=='U'||input.LA(1)=='u' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
if ( input.LA(1)=='C'||input.LA(1)=='c' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
if ( input.LA(1)=='T'||input.LA(1)=='t' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
} }
|
public class class_name {
@Override
public void configure(String parameters) {
if (parameters.isEmpty()) {
return;
}
setValue(Op.toDouble(parameters));
} }
|
public class class_name {
@Override
public void configure(String parameters) {
if (parameters.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
setValue(Op.toDouble(parameters));
} }
|
public class class_name {
@SuppressWarnings("unused")
public Template getTemplate(String path) {
ActContext.Base ctx = ActContext.Base.currentContext();
if (null != ctx) {
String curPath = ctx.templatePath();
ctx.templateLiteral(path);
try {
return load(ctx);
} finally {
ctx.templatePath(curPath);
}
}
final String templatePath = S.ensureStartsWith(path, '/');
Template template = null;
View defView = Act.appConfig().defaultView();
if (null != defView) {
template = !isTemplatePath(path) ? defView.loadInlineTemplate(path) : defView.loadTemplate(templatePath);
}
if (null == template && multiViews) {
for (View view : viewList) {
if (view == defView) continue;
template = view.loadTemplate(templatePath);
if (null != template) {
break;
}
}
}
if (null != template) {
cache(path, template);
}
return template;
} }
|
public class class_name {
@SuppressWarnings("unused")
public Template getTemplate(String path) {
ActContext.Base ctx = ActContext.Base.currentContext();
if (null != ctx) {
String curPath = ctx.templatePath();
ctx.templateLiteral(path); // depends on control dependency: [if], data = [none]
try {
return load(ctx); // depends on control dependency: [try], data = [none]
} finally {
ctx.templatePath(curPath);
}
}
final String templatePath = S.ensureStartsWith(path, '/');
Template template = null;
View defView = Act.appConfig().defaultView();
if (null != defView) {
template = !isTemplatePath(path) ? defView.loadInlineTemplate(path) : defView.loadTemplate(templatePath); // depends on control dependency: [if], data = [none]
}
if (null == template && multiViews) {
for (View view : viewList) {
if (view == defView) continue;
template = view.loadTemplate(templatePath); // depends on control dependency: [for], data = [view]
if (null != template) {
break;
}
}
}
if (null != template) {
cache(path, template); // depends on control dependency: [if], data = [template)]
}
return template;
} }
|
public class class_name {
protected void sortIndexMap() {
for (Iterator<List<Doc>> it = indexmap.values().iterator(); it.hasNext(); ) {
Collections.sort(it.next(), new DocComparator());
}
} }
|
public class class_name {
protected void sortIndexMap() {
for (Iterator<List<Doc>> it = indexmap.values().iterator(); it.hasNext(); ) {
Collections.sort(it.next(), new DocComparator()); // depends on control dependency: [for], data = [it]
}
} }
|
public class class_name {
protected PdfDictionary mergeAttrib(PdfDictionary parent, PdfDictionary child) {
PdfDictionary targ = new PdfDictionary();
if (parent != null) targ.putAll(parent);
for (Iterator it = child.getKeys().iterator(); it.hasNext();) {
PdfName key = (PdfName) it.next();
if (key.equals(PdfName.DR) || key.equals(PdfName.DA) ||
key.equals(PdfName.Q) || key.equals(PdfName.FF) ||
key.equals(PdfName.DV) || key.equals(PdfName.V)
|| key.equals(PdfName.FT)
|| key.equals(PdfName.F)) {
targ.put(key,child.get(key));
}
}
return targ;
} }
|
public class class_name {
protected PdfDictionary mergeAttrib(PdfDictionary parent, PdfDictionary child) {
PdfDictionary targ = new PdfDictionary();
if (parent != null) targ.putAll(parent);
for (Iterator it = child.getKeys().iterator(); it.hasNext();) {
PdfName key = (PdfName) it.next();
if (key.equals(PdfName.DR) || key.equals(PdfName.DA) ||
key.equals(PdfName.Q) || key.equals(PdfName.FF) ||
key.equals(PdfName.DV) || key.equals(PdfName.V)
|| key.equals(PdfName.FT)
|| key.equals(PdfName.F)) {
targ.put(key,child.get(key)); // depends on control dependency: [if], data = [none]
}
}
return targ;
} }
|
public class class_name {
@Override
public List<IndexableField> indexableFields(Columns columns) {
Date fromDate = readFrom(columns);
Date toDate = readTo(columns);
if (fromDate == null && toDate == null) {
return Collections.emptyList();
}
validate(fromDate, toDate);
NRShape shape = makeShape(fromDate, toDate);
return Arrays.asList(strategy.createIndexableFields(shape));
} }
|
public class class_name {
@Override
public List<IndexableField> indexableFields(Columns columns) {
Date fromDate = readFrom(columns);
Date toDate = readTo(columns);
if (fromDate == null && toDate == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
validate(fromDate, toDate);
NRShape shape = makeShape(fromDate, toDate);
return Arrays.asList(strategy.createIndexableFields(shape));
} }
|
public class class_name {
static void unescapeBraceFormat(StringBuilder out, String message, int start, int end) {
int pos = start;
boolean isQuoted = false;
while (pos < end) {
char c = message.charAt(pos++);
// We catch single quotes and escaped single quotes.
if (c != '\\' && c != '\'') {
continue;
}
int quoteStart = pos - 1;
if (c == '\\') {
// Shouldn't risk index out of bounds here because that would be a trailing single '\'.
c = message.charAt(pos++);
if (c != '\'') {
continue;
}
}
// Always skip the first single-quote we find.
out.append(message, start, quoteStart);
start = pos;
if (pos == end) {
break;
}
if (isQuoted) {
isQuoted = false;
} else if (message.charAt(pos) != '\'') {
isQuoted = true;
} else {
// If there are two adjacent single-quotes, advance our position so we don't detect it
// when we go back to the top of the loop (this does mean reading that same char twice
// if it wasn't a single quote, but this is relatively rare).
pos++;
}
}
// Append the last section (if it's non empty).
if (start < end) {
out.append(message, start, end);
}
} }
|
public class class_name {
static void unescapeBraceFormat(StringBuilder out, String message, int start, int end) {
int pos = start;
boolean isQuoted = false;
while (pos < end) {
char c = message.charAt(pos++);
// We catch single quotes and escaped single quotes.
if (c != '\\' && c != '\'') {
continue;
}
int quoteStart = pos - 1;
if (c == '\\') {
// Shouldn't risk index out of bounds here because that would be a trailing single '\'.
c = message.charAt(pos++); // depends on control dependency: [if], data = [none]
if (c != '\'') {
continue;
}
}
// Always skip the first single-quote we find.
out.append(message, start, quoteStart); // depends on control dependency: [while], data = [none]
start = pos; // depends on control dependency: [while], data = [none]
if (pos == end) {
break;
}
if (isQuoted) {
isQuoted = false; // depends on control dependency: [if], data = [none]
} else if (message.charAt(pos) != '\'') {
isQuoted = true; // depends on control dependency: [if], data = [none]
} else {
// If there are two adjacent single-quotes, advance our position so we don't detect it
// when we go back to the top of the loop (this does mean reading that same char twice
// if it wasn't a single quote, but this is relatively rare).
pos++; // depends on control dependency: [if], data = [none]
}
}
// Append the last section (if it's non empty).
if (start < end) {
out.append(message, start, end); // depends on control dependency: [if], data = [end)]
}
} }
|
public class class_name {
public int verify(Request request, Response response) {
String authValue = request.getHeaders().getValues("Authorization");
log.debug("Auth header value is: "+ authValue);
if (authValue == null) {
return Verifier.RESULT_MISSING;
}
String[] tokenValues = authValue.split(" ");
if (tokenValues.length < 2) {
return Verifier.RESULT_MISSING;
}
if (!"Bearer".equals(tokenValues[0])) {
return Verifier.RESULT_INVALID;
}
String token = tokenValues[1];
log.debug("Token: "+ token);
return checkToken(token);
} }
|
public class class_name {
public int verify(Request request, Response response) {
String authValue = request.getHeaders().getValues("Authorization");
log.debug("Auth header value is: "+ authValue);
if (authValue == null) {
return Verifier.RESULT_MISSING; // depends on control dependency: [if], data = [none]
}
String[] tokenValues = authValue.split(" ");
if (tokenValues.length < 2) {
return Verifier.RESULT_MISSING; // depends on control dependency: [if], data = [none]
}
if (!"Bearer".equals(tokenValues[0])) {
return Verifier.RESULT_INVALID; // depends on control dependency: [if], data = [none]
}
String token = tokenValues[1];
log.debug("Token: "+ token);
return checkToken(token);
} }
|
public class class_name {
private Object manageMapIfNecessary(Map<Object, Object> value) {
boolean containsRuntimeRefs = false;
for (Entry<Object, Object> e : value.entrySet()) {
Object v = e.getValue();
if (v instanceof RuntimeBeanReference) {
containsRuntimeRefs = true;
}
if (v instanceof BeanConfiguration) {
BeanConfiguration c = (BeanConfiguration) v;
e.setValue(c.getBeanDefinition());
containsRuntimeRefs = true;
}
}
if(containsRuntimeRefs) {
// return new ManagedMap(map);
ManagedMap m = new ManagedMap();
m.putAll(value);
return m;
}
return value;
} }
|
public class class_name {
private Object manageMapIfNecessary(Map<Object, Object> value) {
boolean containsRuntimeRefs = false;
for (Entry<Object, Object> e : value.entrySet()) {
Object v = e.getValue();
if (v instanceof RuntimeBeanReference) {
containsRuntimeRefs = true; // depends on control dependency: [if], data = [none]
}
if (v instanceof BeanConfiguration) {
BeanConfiguration c = (BeanConfiguration) v;
e.setValue(c.getBeanDefinition()); // depends on control dependency: [if], data = [none]
containsRuntimeRefs = true; // depends on control dependency: [if], data = [none]
}
}
if(containsRuntimeRefs) {
// return new ManagedMap(map);
ManagedMap m = new ManagedMap();
m.putAll(value); // depends on control dependency: [if], data = [none]
return m; // depends on control dependency: [if], data = [none]
}
return value;
} }
|
public class class_name {
public String shortKey(String keyName) {
String value = keyDefault(keyName + CmsMessages.KEY_SHORT_SUFFIX, (String)null);
if (value == null) {
// short key value not found, return "long" key value
return key(keyName);
}
return value;
} }
|
public class class_name {
public String shortKey(String keyName) {
String value = keyDefault(keyName + CmsMessages.KEY_SHORT_SUFFIX, (String)null);
if (value == null) {
// short key value not found, return "long" key value
return key(keyName); // depends on control dependency: [if], data = [none]
}
return value;
} }
|
public class class_name {
public double incBy(K o, double inc) {
Counter c = countMap.get(o);
if (c == null) {
c = new Counter();
countMap.put(o, c);
}
c.count += inc;
return c.count;
} }
|
public class class_name {
public double incBy(K o, double inc) {
Counter c = countMap.get(o);
if (c == null) {
c = new Counter(); // depends on control dependency: [if], data = [none]
countMap.put(o, c); // depends on control dependency: [if], data = [none]
}
c.count += inc;
return c.count;
} }
|
public class class_name {
@Override
protected boolean isCompressionAllowed() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "isCompressionAllowed");
}
// 1.1 will always allow compression, but 1.0 will only work with one
// single finishRequest call since we cannot do streaming compression
// with the request message
boolean rc = true;
if (!getRequest().getVersionValue().equals(VersionValues.V11)) {
rc = !isPartialBody();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "isCompressionAllowed: " + rc);
}
return rc;
} }
|
public class class_name {
@Override
protected boolean isCompressionAllowed() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "isCompressionAllowed"); // depends on control dependency: [if], data = [none]
}
// 1.1 will always allow compression, but 1.0 will only work with one
// single finishRequest call since we cannot do streaming compression
// with the request message
boolean rc = true;
if (!getRequest().getVersionValue().equals(VersionValues.V11)) {
rc = !isPartialBody(); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "isCompressionAllowed: " + rc); // depends on control dependency: [if], data = [none]
}
return rc;
} }
|
public class class_name {
private void compareToAparList(ExecutionContext context, CommandConsole console, Map<String, Set<String>> installedIFixes, File wlpInstallationDirectory) {
// console.printlnInfoMessage("WLP Directory [ " + wlpInstallationDirectory.getPath() + " ]");
// console.printlnInfoMessage("Installed IFixes [ " + installedIFixes.keySet() + " ]");
// First grab the apar list
String aparListString = context.getOptionValue(APAR_TO_COMPARE_OPTION);
List<String> aparList;
// Service 83179: String.split yields a singleton list on an empty string!
aparListString = aparListString.trim();
if (aparListString.isEmpty()) {
aparList = Collections.emptyList();
} else {
// Service 83179: Trim spaces and duplicates; delimit on space and tab, too.
aparList = new ArrayList<String>();
String[] aparListArray = aparListString.split(",| |\t");
for (String apar : aparListArray) {
apar = apar.trim();
if (!apar.isEmpty() && !aparList.contains(apar)) {
aparList.add(apar);
}
}
}
// console.printlnInfoMessage("APAR List String [ " + aparListString + " ]");
// console.printlnInfoMessage("APAR List [ " + Arrays.toString(aparList) + " ]");
// We now know what APARs to look for so load which ones are installed from both iFixes and Fix Packs
Set<String> aparsInstalled = null;
try {
aparsInstalled = findFixPackAparIds(wlpInstallationDirectory, console, context);
} catch (IllegalArgumentException e) {
// These are thrown by the methods when the inputs were invalid and should have the message set to something readable to the user
console.printlnErrorMessage(e.getMessage());
return;
} catch (ZipException e) {
console.printlnErrorMessage(getMessage("compare.error.reading.install", wlpInstallationDirectory, e.getMessage()));
return;
} catch (IOException e) {
console.printlnErrorMessage(getMessage("compare.error.reading.install", wlpInstallationDirectory, e.getMessage()));
return;
}
// console.printlnInfoMessage("Installed APARs [ " + aparsInstalled + " ]");
aparsInstalled.addAll(installedIFixes.keySet());
// Service 83179: Use a list: Keep the missing APARs in the order as originally specified.
List<String> missingApars = new ArrayList<String>();
for (String apar : aparList) {
if (!aparsInstalled.contains(apar)) {
missingApars.add(apar);
}
}
// console.printlnInfoMessage("Missing APARS [ " + missingApars.size() + " ] [ " + missingApars + " ]");
if (missingApars.isEmpty()) {
// Output a message saying all APARs were present
console.printlnInfoMessage(getMessage("compare.all.apars.present"));
} else {
// Output a message saying which APARs were missing
console.printlnInfoMessage(getMessage("compare.missing.apars", missingApars.toString()));
}
} }
|
public class class_name {
private void compareToAparList(ExecutionContext context, CommandConsole console, Map<String, Set<String>> installedIFixes, File wlpInstallationDirectory) {
// console.printlnInfoMessage("WLP Directory [ " + wlpInstallationDirectory.getPath() + " ]");
// console.printlnInfoMessage("Installed IFixes [ " + installedIFixes.keySet() + " ]");
// First grab the apar list
String aparListString = context.getOptionValue(APAR_TO_COMPARE_OPTION);
List<String> aparList;
// Service 83179: String.split yields a singleton list on an empty string!
aparListString = aparListString.trim();
if (aparListString.isEmpty()) {
aparList = Collections.emptyList(); // depends on control dependency: [if], data = [none]
} else {
// Service 83179: Trim spaces and duplicates; delimit on space and tab, too.
aparList = new ArrayList<String>(); // depends on control dependency: [if], data = [none]
String[] aparListArray = aparListString.split(",| |\t");
for (String apar : aparListArray) {
apar = apar.trim(); // depends on control dependency: [for], data = [apar]
if (!apar.isEmpty() && !aparList.contains(apar)) {
aparList.add(apar); // depends on control dependency: [if], data = [none]
}
}
}
// console.printlnInfoMessage("APAR List String [ " + aparListString + " ]");
// console.printlnInfoMessage("APAR List [ " + Arrays.toString(aparList) + " ]");
// We now know what APARs to look for so load which ones are installed from both iFixes and Fix Packs
Set<String> aparsInstalled = null;
try {
aparsInstalled = findFixPackAparIds(wlpInstallationDirectory, console, context); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
// These are thrown by the methods when the inputs were invalid and should have the message set to something readable to the user
console.printlnErrorMessage(e.getMessage());
return;
} catch (ZipException e) { // depends on control dependency: [catch], data = [none]
console.printlnErrorMessage(getMessage("compare.error.reading.install", wlpInstallationDirectory, e.getMessage()));
return;
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
console.printlnErrorMessage(getMessage("compare.error.reading.install", wlpInstallationDirectory, e.getMessage()));
return;
} // depends on control dependency: [catch], data = [none]
// console.printlnInfoMessage("Installed APARs [ " + aparsInstalled + " ]");
aparsInstalled.addAll(installedIFixes.keySet());
// Service 83179: Use a list: Keep the missing APARs in the order as originally specified.
List<String> missingApars = new ArrayList<String>();
for (String apar : aparList) {
if (!aparsInstalled.contains(apar)) {
missingApars.add(apar); // depends on control dependency: [if], data = [none]
}
}
// console.printlnInfoMessage("Missing APARS [ " + missingApars.size() + " ] [ " + missingApars + " ]");
if (missingApars.isEmpty()) {
// Output a message saying all APARs were present
console.printlnInfoMessage(getMessage("compare.all.apars.present"));
} else {
// Output a message saying which APARs were missing
console.printlnInfoMessage(getMessage("compare.missing.apars", missingApars.toString())); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void getResult(final ContentHandler retBuf) throws SAXException {
final String templateFilePath = paramTable.get(FileGenerator.PARAM_TEMPLATE);
for (final Value value: valueSet) {
final String resolvedValue = FileUtils.getRelativeUnixPath(templateFilePath, value.value);
if (FileUtils.isAbsolutePath(resolvedValue)) {
// if resolvedValue is absolute path
retBuf.startElement(NULL_NS_URI, "pathelement", "pathelement", new AttributesBuilder()
.add("location", resolvedValue)
.build());
retBuf.endElement(NULL_NS_URI, "pathelement", "pathelement");
} else {// if resolvedValue is relative path
retBuf.startElement(NULL_NS_URI, "pathelement", "pathelement", new AttributesBuilder()
.add("location", "${dita.dir}${file.separator}" + resolvedValue)
.build());
retBuf.endElement(NULL_NS_URI, "pathelement", "pathelement");
}
}
} }
|
public class class_name {
@Override
public void getResult(final ContentHandler retBuf) throws SAXException {
final String templateFilePath = paramTable.get(FileGenerator.PARAM_TEMPLATE);
for (final Value value: valueSet) {
final String resolvedValue = FileUtils.getRelativeUnixPath(templateFilePath, value.value);
if (FileUtils.isAbsolutePath(resolvedValue)) {
// if resolvedValue is absolute path
retBuf.startElement(NULL_NS_URI, "pathelement", "pathelement", new AttributesBuilder()
.add("location", resolvedValue)
.build()); // depends on control dependency: [if], data = [none]
retBuf.endElement(NULL_NS_URI, "pathelement", "pathelement"); // depends on control dependency: [if], data = [none]
} else {// if resolvedValue is relative path
retBuf.startElement(NULL_NS_URI, "pathelement", "pathelement", new AttributesBuilder()
.add("location", "${dita.dir}${file.separator}" + resolvedValue)
.build()); // depends on control dependency: [if], data = [none]
retBuf.endElement(NULL_NS_URI, "pathelement", "pathelement"); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public CmsJspResourceWrapper getPageResource() {
try {
if (m_pageResource == null) {
// get the container page itself, checking the history first
m_pageResource = CmsJspResourceWrapper.wrap(
m_cms,
(CmsResource)CmsHistoryResourceHandler.getHistoryResource(m_request));
if (m_pageResource == null) {
m_pageResource = CmsJspResourceWrapper.wrap(
m_cms,
m_cms.readResource(m_cms.getRequestContext().getUri()));
}
}
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
return m_pageResource;
} }
|
public class class_name {
public CmsJspResourceWrapper getPageResource() {
try {
if (m_pageResource == null) {
// get the container page itself, checking the history first
m_pageResource = CmsJspResourceWrapper.wrap(
m_cms,
(CmsResource)CmsHistoryResourceHandler.getHistoryResource(m_request)); // depends on control dependency: [if], data = [none]
if (m_pageResource == null) {
m_pageResource = CmsJspResourceWrapper.wrap(
m_cms,
m_cms.readResource(m_cms.getRequestContext().getUri())); // depends on control dependency: [if], data = [none]
}
}
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
return m_pageResource;
} }
|
public class class_name {
private void connectCTENodesIfAny(SeqScanPlanNode node) {
if (! node.isCommonTableScan()) {
return;
}
Integer CTEBaseNodeId = node.getCTEBaseNodeId();
assert(CTEBaseNodeId != null);
AbstractPlanNode CTEBaseNode = m_planNodesListMap.get(CTEBaseNodeId).get(0);
assert(CTEBaseNode instanceof CommonTablePlanNode);
node.setCTEBaseNode(CTEBaseNode);
CommonTablePlanNode cteNode = (CommonTablePlanNode)CTEBaseNode;
Integer CTERecursiveNodeId = cteNode.getRecursiveNodeId();
if (CTERecursiveNodeId != null) {
cteNode.setRecursiveNode(m_planNodesListMap.get(CTERecursiveNodeId).get(0));
}
} }
|
public class class_name {
private void connectCTENodesIfAny(SeqScanPlanNode node) {
if (! node.isCommonTableScan()) {
return; // depends on control dependency: [if], data = [none]
}
Integer CTEBaseNodeId = node.getCTEBaseNodeId();
assert(CTEBaseNodeId != null);
AbstractPlanNode CTEBaseNode = m_planNodesListMap.get(CTEBaseNodeId).get(0);
assert(CTEBaseNode instanceof CommonTablePlanNode);
node.setCTEBaseNode(CTEBaseNode);
CommonTablePlanNode cteNode = (CommonTablePlanNode)CTEBaseNode;
Integer CTERecursiveNodeId = cteNode.getRecursiveNodeId();
if (CTERecursiveNodeId != null) {
cteNode.setRecursiveNode(m_planNodesListMap.get(CTERecursiveNodeId).get(0)); // depends on control dependency: [if], data = [(CTERecursiveNodeId]
}
} }
|
public class class_name {
private List<File> locateModules() {
File[] files = modRoot.listFiles();
List<File> modFiles = new ArrayList<>();
for (File file : files) {
if (file.isDirectory()) {
// Check to determine whether the directory is a valid module directory.
boolean isValid = true;
try {
new ModuleIdentifier(file.getName());
} catch (Exception e) {
isValid = false;
}
// If the directory is a valid module name then check for a mod.json file.
if (isValid) {
File modJson = new File(file, MOD_JSON_FILE);
if (modJson.exists()) {
modFiles.add(file);
}
}
}
}
return modFiles;
} }
|
public class class_name {
private List<File> locateModules() {
File[] files = modRoot.listFiles();
List<File> modFiles = new ArrayList<>();
for (File file : files) {
if (file.isDirectory()) {
// Check to determine whether the directory is a valid module directory.
boolean isValid = true;
try {
new ModuleIdentifier(file.getName()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
isValid = false;
} // depends on control dependency: [catch], data = [none]
// If the directory is a valid module name then check for a mod.json file.
if (isValid) {
File modJson = new File(file, MOD_JSON_FILE);
if (modJson.exists()) {
modFiles.add(file); // depends on control dependency: [if], data = [none]
}
}
}
}
return modFiles;
} }
|
public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final String model) {
if (model.length() % 2 != 0) {
problems.add(ValidationBundle.getMessage(ValidHexadecimalNumberValidator.class, "ODD_LENGTH_HEX", compName)); // NOI18N
return false;
}
for (final char c : model.toCharArray()) {
final boolean good = c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f' || c >= '0' && c <= '9';
if (!good) {
problems.add(ValidationBundle.getMessage(ValidHexadecimalNumberValidator.class, "INVALID_HEX", // NOI18N
new String(new char[] { c }), compName));
return false;
}
}
return true;
} }
|
public class class_name {
@Override
public boolean validate(final Problems problems, final String compName, final String model) {
if (model.length() % 2 != 0) {
problems.add(ValidationBundle.getMessage(ValidHexadecimalNumberValidator.class, "ODD_LENGTH_HEX", compName)); // NOI18N // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
for (final char c : model.toCharArray()) {
final boolean good = c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f' || c >= '0' && c <= '9';
if (!good) {
problems.add(ValidationBundle.getMessage(ValidHexadecimalNumberValidator.class, "INVALID_HEX", // NOI18N
new String(new char[] { c }), compName)); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public static String getAbsolutePath(String servletPath, String relativeUrlPath) throws MalformedURLException {
char firstChar;
if(
relativeUrlPath.length() > 0
&& (firstChar=relativeUrlPath.charAt(0)) != '/'
&& firstChar != '#' // Skip anchor-only paths
&& !relativeUrlPath.startsWith("http:")
&& !relativeUrlPath.startsWith("https:")
&& !relativeUrlPath.startsWith("file:")
&& !relativeUrlPath.startsWith("mailto:")
&& !relativeUrlPath.startsWith("telnet:")
&& !relativeUrlPath.startsWith("tel:")
&& !relativeUrlPath.startsWith("cid:")
) {
NullArgumentException.checkNotNull(servletPath, "servletPath");
int slashPos = servletPath.lastIndexOf('/');
if(slashPos==-1) throw new MalformedURLException("No slash found in servlet path: "+servletPath);
final String newPath = relativeUrlPath;
final int newPathLen = newPath.length();
int newPathStart = 0;
boolean modified;
do {
modified = false;
if(
newPathLen >= (newPathStart+2)
&& newPath.regionMatches(newPathStart, "./", 0, 2)
) {
newPathStart += 2;
modified = true;
}
if(
newPathLen >= (newPathStart+3)
&& newPath.regionMatches(newPathStart, "../", 0, 3)
) {
slashPos = servletPath.lastIndexOf('/', slashPos-1);
if(slashPos==-1) throw new MalformedURLException("Too many ../ in relativeUrlPath: "+relativeUrlPath);
newPathStart += 3;
modified = true;
}
} while(modified);
relativeUrlPath =
new StringBuilder((slashPos+1) + (newPathLen-newPathStart))
.append(servletPath, 0, slashPos+1)
.append(newPath, newPathStart, newPathLen)
.toString();
}
return relativeUrlPath;
} }
|
public class class_name {
public static String getAbsolutePath(String servletPath, String relativeUrlPath) throws MalformedURLException {
char firstChar;
if(
relativeUrlPath.length() > 0
&& (firstChar=relativeUrlPath.charAt(0)) != '/'
&& firstChar != '#' // Skip anchor-only paths
&& !relativeUrlPath.startsWith("http:")
&& !relativeUrlPath.startsWith("https:")
&& !relativeUrlPath.startsWith("file:")
&& !relativeUrlPath.startsWith("mailto:")
&& !relativeUrlPath.startsWith("telnet:")
&& !relativeUrlPath.startsWith("tel:")
&& !relativeUrlPath.startsWith("cid:")
) {
NullArgumentException.checkNotNull(servletPath, "servletPath");
int slashPos = servletPath.lastIndexOf('/');
if(slashPos==-1) throw new MalformedURLException("No slash found in servlet path: "+servletPath);
final String newPath = relativeUrlPath;
final int newPathLen = newPath.length();
int newPathStart = 0;
boolean modified;
do {
modified = false;
if(
newPathLen >= (newPathStart+2)
&& newPath.regionMatches(newPathStart, "./", 0, 2)
) {
newPathStart += 2; // depends on control dependency: [if], data = []
modified = true; // depends on control dependency: [if], data = []
}
if(
newPathLen >= (newPathStart+3)
&& newPath.regionMatches(newPathStart, "../", 0, 3)
) {
slashPos = servletPath.lastIndexOf('/', slashPos-1); // depends on control dependency: [if], data = []
if(slashPos==-1) throw new MalformedURLException("Too many ../ in relativeUrlPath: "+relativeUrlPath);
newPathStart += 3; // depends on control dependency: [if], data = []
modified = true; // depends on control dependency: [if], data = []
}
} while(modified);
relativeUrlPath =
new StringBuilder((slashPos+1) + (newPathLen-newPathStart))
.append(servletPath, 0, slashPos+1)
.append(newPath, newPathStart, newPathLen)
.toString();
}
return relativeUrlPath;
} }
|
public class class_name {
public static synchronized void initialise()
{
// Only initialise if it has not already been created
if (_instance == null)
{
// Check what environment we are running in. If we are in server mode we must use the
// server diagnostic module.
//Liberty COMMS TODO:
//For now not enabling server side diagnostics as can not load SERVER_DIAG_MODULE_CLASS in a clean manner
// without having dependency of COMMs server ( at least more than 4/5 classes are needed) which defeat
// the purpose of COMMS client independence w.r.to COMMS server
//Has to rework on load SERVER_DIAG_MODULE_CLASS without too many dependencies of COMMS server.
/*
if (RuntimeInfo.isServer())
{
if (tc.isDebugEnabled()) SibTr.debug(tc, "We are in Server mode");
try
{
Class clazz = Class.forName(CommsConstants.SERVER_DIAG_MODULE_CLASS);
Method getInstanceMethod = clazz.getMethod("getInstance", new Class[0]);
_instance = (CommsDiagnosticModule) getInstanceMethod.invoke(null, (Object[]) null);
}
catch (Exception e)
{
FFDCFilter.processException(e, CLASS_NAME + ".initialise",
CommsConstants.COMMSDIAGMODULE_INITIALIZE_01,
CommsConstants.SERVER_DIAG_MODULE_CLASS);
if (tc.isDebugEnabled()) SibTr.debug(tc, "Unable to load the Comms Server Diagnostic Module", e);
// In this case, fall out of here with a null _instance and default to the client
// one. At least in that case we get _some_ diagnostics...
// This is the point where I mention that that shouldn't ever happen :-).
}
}
*/
// In all other cases use the client diagnostic module. Note we can instantiate this
// directly as we are located in the same build component
if (_instance == null)
{
if (tc.isDebugEnabled()) SibTr.debug(tc, "We are NOT in Server mode");
_instance = ClientCommsDiagnosticModule.getInstance();
}
// Now register the packages
_instance.register(packageList);
}
} }
|
public class class_name {
public static synchronized void initialise()
{
// Only initialise if it has not already been created
if (_instance == null)
{
// Check what environment we are running in. If we are in server mode we must use the
// server diagnostic module.
//Liberty COMMS TODO:
//For now not enabling server side diagnostics as can not load SERVER_DIAG_MODULE_CLASS in a clean manner
// without having dependency of COMMs server ( at least more than 4/5 classes are needed) which defeat
// the purpose of COMMS client independence w.r.to COMMS server
//Has to rework on load SERVER_DIAG_MODULE_CLASS without too many dependencies of COMMS server.
/*
if (RuntimeInfo.isServer())
{
if (tc.isDebugEnabled()) SibTr.debug(tc, "We are in Server mode");
try
{
Class clazz = Class.forName(CommsConstants.SERVER_DIAG_MODULE_CLASS);
Method getInstanceMethod = clazz.getMethod("getInstance", new Class[0]);
_instance = (CommsDiagnosticModule) getInstanceMethod.invoke(null, (Object[]) null);
}
catch (Exception e)
{
FFDCFilter.processException(e, CLASS_NAME + ".initialise",
CommsConstants.COMMSDIAGMODULE_INITIALIZE_01,
CommsConstants.SERVER_DIAG_MODULE_CLASS);
if (tc.isDebugEnabled()) SibTr.debug(tc, "Unable to load the Comms Server Diagnostic Module", e);
// In this case, fall out of here with a null _instance and default to the client
// one. At least in that case we get _some_ diagnostics...
// This is the point where I mention that that shouldn't ever happen :-).
}
}
*/
// In all other cases use the client diagnostic module. Note we can instantiate this
// directly as we are located in the same build component
if (_instance == null)
{
if (tc.isDebugEnabled()) SibTr.debug(tc, "We are NOT in Server mode");
_instance = ClientCommsDiagnosticModule.getInstance(); // depends on control dependency: [if], data = [none]
}
// Now register the packages
_instance.register(packageList); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
static int[] shiftLeftMultiPrecision(int[] number, int length, int shifts)
{
if (shifts == 0) {
return number;
}
// wordShifts = shifts / 32
int wordShifts = shifts >>> 5;
// we don't wan't to loose any leading bits
for (int i = 0; i < wordShifts; i++) {
checkState(number[length - i - 1] == 0);
}
if (wordShifts > 0) {
arraycopy(number, 0, number, wordShifts, length - wordShifts);
fill(number, 0, wordShifts, 0);
}
// bitShifts = shifts % 32
int bitShifts = shifts & 0b11111;
if (bitShifts > 0) {
// we don't wan't to loose any leading bits
checkState(number[length - 1] >>> (Integer.SIZE - bitShifts) == 0);
for (int position = length - 1; position > 0; position--) {
number[position] = (number[position] << bitShifts) | (number[position - 1] >>> (Integer.SIZE - bitShifts));
}
number[0] = number[0] << bitShifts;
}
return number;
} }
|
public class class_name {
static int[] shiftLeftMultiPrecision(int[] number, int length, int shifts)
{
if (shifts == 0) {
return number; // depends on control dependency: [if], data = [none]
}
// wordShifts = shifts / 32
int wordShifts = shifts >>> 5;
// we don't wan't to loose any leading bits
for (int i = 0; i < wordShifts; i++) {
checkState(number[length - i - 1] == 0); // depends on control dependency: [for], data = [i]
}
if (wordShifts > 0) {
arraycopy(number, 0, number, wordShifts, length - wordShifts); // depends on control dependency: [if], data = [none]
fill(number, 0, wordShifts, 0); // depends on control dependency: [if], data = [0)]
}
// bitShifts = shifts % 32
int bitShifts = shifts & 0b11111;
if (bitShifts > 0) {
// we don't wan't to loose any leading bits
checkState(number[length - 1] >>> (Integer.SIZE - bitShifts) == 0); // depends on control dependency: [if], data = [0)]
for (int position = length - 1; position > 0; position--) {
number[position] = (number[position] << bitShifts) | (number[position - 1] >>> (Integer.SIZE - bitShifts)); // depends on control dependency: [for], data = [position]
}
number[0] = number[0] << bitShifts; // depends on control dependency: [if], data = [none]
}
return number;
} }
|
public class class_name {
public Set<String> setEscapeJavaScript(final Set<?> target) {
if (target == null) {
return null;
}
final Set<String> result = new LinkedHashSet<String>(target.size() + 2);
for (final Object element : target) {
result.add(escapeJavaScript(element));
}
return result;
} }
|
public class class_name {
public Set<String> setEscapeJavaScript(final Set<?> target) {
if (target == null) {
return null; // depends on control dependency: [if], data = [none]
}
final Set<String> result = new LinkedHashSet<String>(target.size() + 2);
for (final Object element : target) {
result.add(escapeJavaScript(element)); // depends on control dependency: [for], data = [element]
}
return result;
} }
|
public class class_name {
public final EObject ruleXFeatureCall() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_3=null;
Token otherlv_5=null;
Token lv_explicitOperationCall_7_0=null;
Token otherlv_10=null;
Token otherlv_12=null;
EObject lv_typeArguments_2_0 = null;
EObject lv_typeArguments_4_0 = null;
EObject lv_featureCallArguments_8_0 = null;
EObject lv_featureCallArguments_9_0 = null;
EObject lv_featureCallArguments_11_0 = null;
EObject lv_featureCallArguments_13_0 = null;
enterRule();
try {
// InternalPureXbase.g:4773:2: ( ( () (otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' )? ( ( ruleIdOrSuper ) ) ( ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')' )? ( ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure ) )? ) )
// InternalPureXbase.g:4774:2: ( () (otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' )? ( ( ruleIdOrSuper ) ) ( ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')' )? ( ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure ) )? )
{
// InternalPureXbase.g:4774:2: ( () (otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' )? ( ( ruleIdOrSuper ) ) ( ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')' )? ( ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure ) )? )
// InternalPureXbase.g:4775:3: () (otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' )? ( ( ruleIdOrSuper ) ) ( ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')' )? ( ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure ) )?
{
// InternalPureXbase.g:4775:3: ()
// InternalPureXbase.g:4776:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXFeatureCallAccess().getXFeatureCallAction_0(),
current);
}
}
// InternalPureXbase.g:4782:3: (otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' )?
int alt85=2;
int LA85_0 = input.LA(1);
if ( (LA85_0==28) ) {
alt85=1;
}
switch (alt85) {
case 1 :
// InternalPureXbase.g:4783:4: otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>'
{
otherlv_1=(Token)match(input,28,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXFeatureCallAccess().getLessThanSignKeyword_1_0());
}
// InternalPureXbase.g:4787:4: ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:4788:5: (lv_typeArguments_2_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:4788:5: (lv_typeArguments_2_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:4789:6: lv_typeArguments_2_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getTypeArgumentsJvmArgumentTypeReferenceParserRuleCall_1_1_0());
}
pushFollow(FOLLOW_35);
lv_typeArguments_2_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule());
}
add(
current,
"typeArguments",
lv_typeArguments_2_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference");
afterParserOrEnumRuleCall();
}
}
}
// InternalPureXbase.g:4806:4: (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )*
loop84:
do {
int alt84=2;
int LA84_0 = input.LA(1);
if ( (LA84_0==57) ) {
alt84=1;
}
switch (alt84) {
case 1 :
// InternalPureXbase.g:4807:5: otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) )
{
otherlv_3=(Token)match(input,57,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getXFeatureCallAccess().getCommaKeyword_1_2_0());
}
// InternalPureXbase.g:4811:5: ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:4812:6: (lv_typeArguments_4_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:4812:6: (lv_typeArguments_4_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:4813:7: lv_typeArguments_4_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getTypeArgumentsJvmArgumentTypeReferenceParserRuleCall_1_2_1_0());
}
pushFollow(FOLLOW_35);
lv_typeArguments_4_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule());
}
add(
current,
"typeArguments",
lv_typeArguments_4_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference");
afterParserOrEnumRuleCall();
}
}
}
}
break;
default :
break loop84;
}
} while (true);
otherlv_5=(Token)match(input,29,FOLLOW_33); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_5, grammarAccess.getXFeatureCallAccess().getGreaterThanSignKeyword_1_3());
}
}
break;
}
// InternalPureXbase.g:4836:3: ( ( ruleIdOrSuper ) )
// InternalPureXbase.g:4837:4: ( ruleIdOrSuper )
{
// InternalPureXbase.g:4837:4: ( ruleIdOrSuper )
// InternalPureXbase.g:4838:5: ruleIdOrSuper
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXFeatureCallRule());
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getFeatureJvmIdentifiableElementCrossReference_2_0());
}
pushFollow(FOLLOW_64);
ruleIdOrSuper();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
}
}
// InternalPureXbase.g:4852:3: ( ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')' )?
int alt88=2;
alt88 = dfa88.predict(input);
switch (alt88) {
case 1 :
// InternalPureXbase.g:4853:4: ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')'
{
// InternalPureXbase.g:4853:4: ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) )
// InternalPureXbase.g:4854:5: ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' )
{
// InternalPureXbase.g:4858:5: (lv_explicitOperationCall_7_0= '(' )
// InternalPureXbase.g:4859:6: lv_explicitOperationCall_7_0= '('
{
lv_explicitOperationCall_7_0=(Token)match(input,15,FOLLOW_37); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_explicitOperationCall_7_0, grammarAccess.getXFeatureCallAccess().getExplicitOperationCallLeftParenthesisKeyword_3_0_0());
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXFeatureCallRule());
}
setWithLastConsumed(current, "explicitOperationCall", true, "(");
}
}
}
// InternalPureXbase.g:4871:4: ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )?
int alt87=3;
alt87 = dfa87.predict(input);
switch (alt87) {
case 1 :
// InternalPureXbase.g:4872:5: ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) )
{
// InternalPureXbase.g:4872:5: ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) )
// InternalPureXbase.g:4873:6: ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure )
{
// InternalPureXbase.g:4898:6: (lv_featureCallArguments_8_0= ruleXShortClosure )
// InternalPureXbase.g:4899:7: lv_featureCallArguments_8_0= ruleXShortClosure
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getFeatureCallArgumentsXShortClosureParserRuleCall_3_1_0_0());
}
pushFollow(FOLLOW_8);
lv_featureCallArguments_8_0=ruleXShortClosure();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule());
}
add(
current,
"featureCallArguments",
lv_featureCallArguments_8_0,
"org.eclipse.xtext.xbase.Xbase.XShortClosure");
afterParserOrEnumRuleCall();
}
}
}
}
break;
case 2 :
// InternalPureXbase.g:4917:5: ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* )
{
// InternalPureXbase.g:4917:5: ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* )
// InternalPureXbase.g:4918:6: ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )*
{
// InternalPureXbase.g:4918:6: ( (lv_featureCallArguments_9_0= ruleXExpression ) )
// InternalPureXbase.g:4919:7: (lv_featureCallArguments_9_0= ruleXExpression )
{
// InternalPureXbase.g:4919:7: (lv_featureCallArguments_9_0= ruleXExpression )
// InternalPureXbase.g:4920:8: lv_featureCallArguments_9_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getFeatureCallArgumentsXExpressionParserRuleCall_3_1_1_0_0());
}
pushFollow(FOLLOW_38);
lv_featureCallArguments_9_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule());
}
add(
current,
"featureCallArguments",
lv_featureCallArguments_9_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
// InternalPureXbase.g:4937:6: (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )*
loop86:
do {
int alt86=2;
int LA86_0 = input.LA(1);
if ( (LA86_0==57) ) {
alt86=1;
}
switch (alt86) {
case 1 :
// InternalPureXbase.g:4938:7: otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) )
{
otherlv_10=(Token)match(input,57,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_10, grammarAccess.getXFeatureCallAccess().getCommaKeyword_3_1_1_1_0());
}
// InternalPureXbase.g:4942:7: ( (lv_featureCallArguments_11_0= ruleXExpression ) )
// InternalPureXbase.g:4943:8: (lv_featureCallArguments_11_0= ruleXExpression )
{
// InternalPureXbase.g:4943:8: (lv_featureCallArguments_11_0= ruleXExpression )
// InternalPureXbase.g:4944:9: lv_featureCallArguments_11_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getFeatureCallArgumentsXExpressionParserRuleCall_3_1_1_1_1_0());
}
pushFollow(FOLLOW_38);
lv_featureCallArguments_11_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule());
}
add(
current,
"featureCallArguments",
lv_featureCallArguments_11_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
}
break;
default :
break loop86;
}
} while (true);
}
}
break;
}
otherlv_12=(Token)match(input,16,FOLLOW_65); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_12, grammarAccess.getXFeatureCallAccess().getRightParenthesisKeyword_3_2());
}
}
break;
}
// InternalPureXbase.g:4969:3: ( ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure ) )?
int alt89=2;
alt89 = dfa89.predict(input);
switch (alt89) {
case 1 :
// InternalPureXbase.g:4970:4: ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure )
{
// InternalPureXbase.g:4976:4: (lv_featureCallArguments_13_0= ruleXClosure )
// InternalPureXbase.g:4977:5: lv_featureCallArguments_13_0= ruleXClosure
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getFeatureCallArgumentsXClosureParserRuleCall_4_0());
}
pushFollow(FOLLOW_2);
lv_featureCallArguments_13_0=ruleXClosure();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule());
}
add(
current,
"featureCallArguments",
lv_featureCallArguments_13_0,
"org.eclipse.xtext.xbase.Xbase.XClosure");
afterParserOrEnumRuleCall();
}
}
}
break;
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject ruleXFeatureCall() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_3=null;
Token otherlv_5=null;
Token lv_explicitOperationCall_7_0=null;
Token otherlv_10=null;
Token otherlv_12=null;
EObject lv_typeArguments_2_0 = null;
EObject lv_typeArguments_4_0 = null;
EObject lv_featureCallArguments_8_0 = null;
EObject lv_featureCallArguments_9_0 = null;
EObject lv_featureCallArguments_11_0 = null;
EObject lv_featureCallArguments_13_0 = null;
enterRule();
try {
// InternalPureXbase.g:4773:2: ( ( () (otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' )? ( ( ruleIdOrSuper ) ) ( ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')' )? ( ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure ) )? ) )
// InternalPureXbase.g:4774:2: ( () (otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' )? ( ( ruleIdOrSuper ) ) ( ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')' )? ( ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure ) )? )
{
// InternalPureXbase.g:4774:2: ( () (otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' )? ( ( ruleIdOrSuper ) ) ( ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')' )? ( ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure ) )? )
// InternalPureXbase.g:4775:3: () (otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' )? ( ( ruleIdOrSuper ) ) ( ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')' )? ( ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure ) )?
{
// InternalPureXbase.g:4775:3: ()
// InternalPureXbase.g:4776:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXFeatureCallAccess().getXFeatureCallAction_0(),
current); // depends on control dependency: [if], data = [none]
}
}
// InternalPureXbase.g:4782:3: (otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>' )?
int alt85=2;
int LA85_0 = input.LA(1);
if ( (LA85_0==28) ) {
alt85=1; // depends on control dependency: [if], data = [none]
}
switch (alt85) {
case 1 :
// InternalPureXbase.g:4783:4: otherlv_1= '<' ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) ) (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )* otherlv_5= '>'
{
otherlv_1=(Token)match(input,28,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXFeatureCallAccess().getLessThanSignKeyword_1_0()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:4787:4: ( (lv_typeArguments_2_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:4788:5: (lv_typeArguments_2_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:4788:5: (lv_typeArguments_2_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:4789:6: lv_typeArguments_2_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getTypeArgumentsJvmArgumentTypeReferenceParserRuleCall_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_35);
lv_typeArguments_2_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"typeArguments",
lv_typeArguments_2_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:4806:4: (otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) ) )*
loop84:
do {
int alt84=2;
int LA84_0 = input.LA(1);
if ( (LA84_0==57) ) {
alt84=1; // depends on control dependency: [if], data = [none]
}
switch (alt84) {
case 1 :
// InternalPureXbase.g:4807:5: otherlv_3= ',' ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) )
{
otherlv_3=(Token)match(input,57,FOLLOW_34); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getXFeatureCallAccess().getCommaKeyword_1_2_0()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:4811:5: ( (lv_typeArguments_4_0= ruleJvmArgumentTypeReference ) )
// InternalPureXbase.g:4812:6: (lv_typeArguments_4_0= ruleJvmArgumentTypeReference )
{
// InternalPureXbase.g:4812:6: (lv_typeArguments_4_0= ruleJvmArgumentTypeReference )
// InternalPureXbase.g:4813:7: lv_typeArguments_4_0= ruleJvmArgumentTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getTypeArgumentsJvmArgumentTypeReferenceParserRuleCall_1_2_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_35);
lv_typeArguments_4_0=ruleJvmArgumentTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"typeArguments",
lv_typeArguments_4_0,
"org.eclipse.xtext.xbase.Xtype.JvmArgumentTypeReference"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
default :
break loop84;
}
} while (true);
otherlv_5=(Token)match(input,29,FOLLOW_33); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_5, grammarAccess.getXFeatureCallAccess().getGreaterThanSignKeyword_1_3()); // depends on control dependency: [if], data = [none]
}
}
break;
}
// InternalPureXbase.g:4836:3: ( ( ruleIdOrSuper ) )
// InternalPureXbase.g:4837:4: ( ruleIdOrSuper )
{
// InternalPureXbase.g:4837:4: ( ruleIdOrSuper )
// InternalPureXbase.g:4838:5: ruleIdOrSuper
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXFeatureCallRule()); // depends on control dependency: [if], data = [none]
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getFeatureJvmIdentifiableElementCrossReference_2_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_64);
ruleIdOrSuper();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:4852:3: ( ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')' )?
int alt88=2;
alt88 = dfa88.predict(input);
switch (alt88) {
case 1 :
// InternalPureXbase.g:4853:4: ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) ) ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )? otherlv_12= ')'
{
// InternalPureXbase.g:4853:4: ( ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' ) )
// InternalPureXbase.g:4854:5: ( ( '(' ) )=> (lv_explicitOperationCall_7_0= '(' )
{
// InternalPureXbase.g:4858:5: (lv_explicitOperationCall_7_0= '(' )
// InternalPureXbase.g:4859:6: lv_explicitOperationCall_7_0= '('
{
lv_explicitOperationCall_7_0=(Token)match(input,15,FOLLOW_37); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_explicitOperationCall_7_0, grammarAccess.getXFeatureCallAccess().getExplicitOperationCallLeftParenthesisKeyword_3_0_0()); // depends on control dependency: [if], data = [none]
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXFeatureCallRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "explicitOperationCall", true, "("); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:4871:4: ( ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) ) | ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* ) )?
int alt87=3;
alt87 = dfa87.predict(input);
switch (alt87) {
case 1 :
// InternalPureXbase.g:4872:5: ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) )
{
// InternalPureXbase.g:4872:5: ( ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure ) )
// InternalPureXbase.g:4873:6: ( ( () ( ( ( ruleJvmFormalParameter ) ) ( ',' ( ( ruleJvmFormalParameter ) ) )* )? ( ( '|' ) ) ) )=> (lv_featureCallArguments_8_0= ruleXShortClosure )
{
// InternalPureXbase.g:4898:6: (lv_featureCallArguments_8_0= ruleXShortClosure )
// InternalPureXbase.g:4899:7: lv_featureCallArguments_8_0= ruleXShortClosure
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getFeatureCallArgumentsXShortClosureParserRuleCall_3_1_0_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_8);
lv_featureCallArguments_8_0=ruleXShortClosure();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"featureCallArguments",
lv_featureCallArguments_8_0,
"org.eclipse.xtext.xbase.Xbase.XShortClosure"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
case 2 :
// InternalPureXbase.g:4917:5: ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* )
{
// InternalPureXbase.g:4917:5: ( ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )* )
// InternalPureXbase.g:4918:6: ( (lv_featureCallArguments_9_0= ruleXExpression ) ) (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )*
{
// InternalPureXbase.g:4918:6: ( (lv_featureCallArguments_9_0= ruleXExpression ) )
// InternalPureXbase.g:4919:7: (lv_featureCallArguments_9_0= ruleXExpression )
{
// InternalPureXbase.g:4919:7: (lv_featureCallArguments_9_0= ruleXExpression )
// InternalPureXbase.g:4920:8: lv_featureCallArguments_9_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getFeatureCallArgumentsXExpressionParserRuleCall_3_1_1_0_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_38);
lv_featureCallArguments_9_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"featureCallArguments",
lv_featureCallArguments_9_0,
"org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:4937:6: (otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) ) )*
loop86:
do {
int alt86=2;
int LA86_0 = input.LA(1);
if ( (LA86_0==57) ) {
alt86=1; // depends on control dependency: [if], data = [none]
}
switch (alt86) {
case 1 :
// InternalPureXbase.g:4938:7: otherlv_10= ',' ( (lv_featureCallArguments_11_0= ruleXExpression ) )
{
otherlv_10=(Token)match(input,57,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_10, grammarAccess.getXFeatureCallAccess().getCommaKeyword_3_1_1_1_0()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:4942:7: ( (lv_featureCallArguments_11_0= ruleXExpression ) )
// InternalPureXbase.g:4943:8: (lv_featureCallArguments_11_0= ruleXExpression )
{
// InternalPureXbase.g:4943:8: (lv_featureCallArguments_11_0= ruleXExpression )
// InternalPureXbase.g:4944:9: lv_featureCallArguments_11_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getFeatureCallArgumentsXExpressionParserRuleCall_3_1_1_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_38);
lv_featureCallArguments_11_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"featureCallArguments",
lv_featureCallArguments_11_0,
"org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
default :
break loop86;
}
} while (true);
}
}
break;
}
otherlv_12=(Token)match(input,16,FOLLOW_65); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_12, grammarAccess.getXFeatureCallAccess().getRightParenthesisKeyword_3_2()); // depends on control dependency: [if], data = [none]
}
}
break;
}
// InternalPureXbase.g:4969:3: ( ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure ) )?
int alt89=2;
alt89 = dfa89.predict(input);
switch (alt89) {
case 1 :
// InternalPureXbase.g:4970:4: ( ( () '[' ) )=> (lv_featureCallArguments_13_0= ruleXClosure )
{
// InternalPureXbase.g:4976:4: (lv_featureCallArguments_13_0= ruleXClosure )
// InternalPureXbase.g:4977:5: lv_featureCallArguments_13_0= ruleXClosure
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFeatureCallAccess().getFeatureCallArgumentsXClosureParserRuleCall_4_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_2);
lv_featureCallArguments_13_0=ruleXClosure();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFeatureCallRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"featureCallArguments",
lv_featureCallArguments_13_0,
"org.eclipse.xtext.xbase.Xbase.XClosure"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
break;
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
@Override
public <T> T get(String name, T defaultValue) {
if (!containsKey(name)) {
return defaultValue;
}
return get(name);
} }
|
public class class_name {
@Override
public <T> T get(String name, T defaultValue) {
if (!containsKey(name)) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
return get(name);
} }
|
public class class_name {
public void elemMultiply(VTensor other) {
checkEqualSize(this, other);
for (int c = 0; c < this.size(); c++) {
multiplyValue(c, other.getValue(c));
}
} }
|
public class class_name {
public void elemMultiply(VTensor other) {
checkEqualSize(this, other);
for (int c = 0; c < this.size(); c++) {
multiplyValue(c, other.getValue(c)); // depends on control dependency: [for], data = [c]
}
} }
|
public class class_name {
public void setUsers(java.util.Collection<UserType> users) {
if (users == null) {
this.users = null;
return;
}
this.users = new java.util.ArrayList<UserType>(users);
} }
|
public class class_name {
public void setUsers(java.util.Collection<UserType> users) {
if (users == null) {
this.users = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.users = new java.util.ArrayList<UserType>(users);
} }
|
public class class_name {
private static List<String> parseACLArray(String aclString) {
List<String> acls = new ArrayList<String>();
if (aclString == null || aclString.isEmpty()) {
return acls;
}
boolean inQuotes = false;
// start at 1 because of leading "{"
int beginIndex = 1;
char prevChar = ' ';
for (int i = beginIndex; i < aclString.length(); i++) {
char c = aclString.charAt(i);
if (c == '"' && prevChar != '\\') {
inQuotes = !inQuotes;
} else if (c == ',' && !inQuotes) {
acls.add(aclString.substring(beginIndex, i));
beginIndex = i + 1;
}
prevChar = c;
}
// add last element removing the trailing "}"
acls.add(aclString.substring(beginIndex, aclString.length() - 1));
// Strip out enclosing quotes, if any.
for (int i = 0; i < acls.size(); i++) {
String acl = acls.get(i);
if (acl.startsWith("\"") && acl.endsWith("\"")) {
acl = acl.substring(1, acl.length() - 1);
acls.set(i, acl);
}
}
return acls;
} }
|
public class class_name {
private static List<String> parseACLArray(String aclString) {
List<String> acls = new ArrayList<String>();
if (aclString == null || aclString.isEmpty()) {
return acls; // depends on control dependency: [if], data = [none]
}
boolean inQuotes = false;
// start at 1 because of leading "{"
int beginIndex = 1;
char prevChar = ' ';
for (int i = beginIndex; i < aclString.length(); i++) {
char c = aclString.charAt(i);
if (c == '"' && prevChar != '\\') {
inQuotes = !inQuotes; // depends on control dependency: [if], data = [none]
} else if (c == ',' && !inQuotes) {
acls.add(aclString.substring(beginIndex, i)); // depends on control dependency: [if], data = [none]
beginIndex = i + 1; // depends on control dependency: [if], data = [none]
}
prevChar = c; // depends on control dependency: [for], data = [none]
}
// add last element removing the trailing "}"
acls.add(aclString.substring(beginIndex, aclString.length() - 1));
// Strip out enclosing quotes, if any.
for (int i = 0; i < acls.size(); i++) {
String acl = acls.get(i);
if (acl.startsWith("\"") && acl.endsWith("\"")) {
acl = acl.substring(1, acl.length() - 1); // depends on control dependency: [if], data = [none]
acls.set(i, acl); // depends on control dependency: [if], data = [none]
}
}
return acls;
} }
|
public class class_name {
public String getCloseReason()
{
if (mPayload == null || mPayload.length < 3)
{
return null;
}
return Misc.toStringUTF8(mPayload, 2, mPayload.length - 2);
} }
|
public class class_name {
public String getCloseReason()
{
if (mPayload == null || mPayload.length < 3)
{
return null; // depends on control dependency: [if], data = [none]
}
return Misc.toStringUTF8(mPayload, 2, mPayload.length - 2);
} }
|
public class class_name {
public void update(Map conf) {
for (IUpdater updater : updaters) {
try {
updater.update(conf);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
}
} }
|
public class class_name {
public void update(Map conf) {
for (IUpdater updater : updaters) {
try {
updater.update(conf); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public void setExternalDiagram(Diagram diagram) {
for (int i=0;i<figures.size();i++) {
Figure figure = (Figure) figures.get(i);
for (int j=0;j<diagram.getFigureCount();j++) {
Figure newBase = diagram.getFigure(j);
if (newBase.getData().getMetaData().equals(figure.getData().getMetaData())) {
MorphShape shape = (MorphShape) figure.getShape();
shape.setExternalFrame(newBase.getShape());
break;
}
}
}
} }
|
public class class_name {
public void setExternalDiagram(Diagram diagram) {
for (int i=0;i<figures.size();i++) {
Figure figure = (Figure) figures.get(i);
for (int j=0;j<diagram.getFigureCount();j++) {
Figure newBase = diagram.getFigure(j);
if (newBase.getData().getMetaData().equals(figure.getData().getMetaData())) {
MorphShape shape = (MorphShape) figure.getShape();
shape.setExternalFrame(newBase.getShape());
// depends on control dependency: [if], data = [none]
break;
}
}
}
} }
|
public class class_name {
private String parseValue(String value) {
m_croppingParam = CmsCroppingParamBean.parseImagePath(value);
String path = "";
String params = "";
if (value.indexOf("?") > -1) {
path = value.substring(0, value.indexOf("?"));
params = value.substring(value.indexOf("?"));
} else {
path = value;
}
int indexofscale = params.indexOf(PARAMETER_SCALE);
if (indexofscale > -1) {
String scal = "";
int hasmoreValues = params.lastIndexOf("&");
if (hasmoreValues > indexofscale) {
scal = params.substring(indexofscale, params.indexOf("&")).replace(PARAMETER_SCALE, "");
} else {
scal = params.substring(indexofscale).replace(PARAMETER_SCALE, "");
}
if (!scal.equals(m_scaleValue)) {
m_scaleValue = scal;
}
params = params.replace(PARAMETER_SCALE + m_scaleValue, "");
}
int indexofformat = params.indexOf(PARAMETER_FORMAT);
if (indexofformat > -1) {
int hasmoreValues = params.lastIndexOf("&");
if (hasmoreValues > indexofformat) {
m_selectedFormat = params.substring(indexofformat, hasmoreValues).replace(PARAMETER_FORMAT, "");
} else {
m_selectedFormat = params.substring(indexofformat).replace(PARAMETER_FORMAT, "");
}
params = params.replace(PARAMETER_FORMAT + m_selectedFormat, "");
m_formatSelection.selectValue(m_selectedFormat);
}
int indexofdescritption = params.indexOf(PARAMETER_DESC);
if (indexofdescritption > -1) {
int hasmoreValues = params.lastIndexOf("&");
if (hasmoreValues > indexofdescritption) {
m_description = params.substring(indexofdescritption, hasmoreValues).replace(PARAMETER_DESC, "");
} else {
m_description = params.substring(indexofdescritption).replace(PARAMETER_DESC, "");
}
params = params.replace(PARAMETER_DESC + m_description, "");
m_description = URL.decode(m_description);
m_descriptionArea.setFormValueAsString(m_description);
}
updateUploadTarget(CmsResource.getFolderPath(path));
if (!path.isEmpty()) {
String imageLink = CmsCoreProvider.get().link(path);
setImagePreview(path, imageLink);
} else {
m_imagePreview.setInnerHTML("");
}
return path;
} }
|
public class class_name {
private String parseValue(String value) {
m_croppingParam = CmsCroppingParamBean.parseImagePath(value);
String path = "";
String params = "";
if (value.indexOf("?") > -1) {
path = value.substring(0, value.indexOf("?")); // depends on control dependency: [if], data = [none]
params = value.substring(value.indexOf("?")); // depends on control dependency: [if], data = [(value.indexOf("?")]
} else {
path = value; // depends on control dependency: [if], data = [none]
}
int indexofscale = params.indexOf(PARAMETER_SCALE);
if (indexofscale > -1) {
String scal = "";
int hasmoreValues = params.lastIndexOf("&");
if (hasmoreValues > indexofscale) {
scal = params.substring(indexofscale, params.indexOf("&")).replace(PARAMETER_SCALE, ""); // depends on control dependency: [if], data = [none]
} else {
scal = params.substring(indexofscale).replace(PARAMETER_SCALE, ""); // depends on control dependency: [if], data = [indexofscale)]
}
if (!scal.equals(m_scaleValue)) {
m_scaleValue = scal; // depends on control dependency: [if], data = [none]
}
params = params.replace(PARAMETER_SCALE + m_scaleValue, ""); // depends on control dependency: [if], data = [none]
}
int indexofformat = params.indexOf(PARAMETER_FORMAT);
if (indexofformat > -1) {
int hasmoreValues = params.lastIndexOf("&");
if (hasmoreValues > indexofformat) {
m_selectedFormat = params.substring(indexofformat, hasmoreValues).replace(PARAMETER_FORMAT, ""); // depends on control dependency: [if], data = [none]
} else {
m_selectedFormat = params.substring(indexofformat).replace(PARAMETER_FORMAT, ""); // depends on control dependency: [if], data = [indexofformat)]
}
params = params.replace(PARAMETER_FORMAT + m_selectedFormat, ""); // depends on control dependency: [if], data = [none]
m_formatSelection.selectValue(m_selectedFormat); // depends on control dependency: [if], data = [none]
}
int indexofdescritption = params.indexOf(PARAMETER_DESC);
if (indexofdescritption > -1) {
int hasmoreValues = params.lastIndexOf("&");
if (hasmoreValues > indexofdescritption) {
m_description = params.substring(indexofdescritption, hasmoreValues).replace(PARAMETER_DESC, ""); // depends on control dependency: [if], data = [none]
} else {
m_description = params.substring(indexofdescritption).replace(PARAMETER_DESC, ""); // depends on control dependency: [if], data = [indexofdescritption)]
}
params = params.replace(PARAMETER_DESC + m_description, ""); // depends on control dependency: [if], data = [none]
m_description = URL.decode(m_description); // depends on control dependency: [if], data = [none]
m_descriptionArea.setFormValueAsString(m_description); // depends on control dependency: [if], data = [none]
}
updateUploadTarget(CmsResource.getFolderPath(path));
if (!path.isEmpty()) {
String imageLink = CmsCoreProvider.get().link(path);
setImagePreview(path, imageLink); // depends on control dependency: [if], data = [none]
} else {
m_imagePreview.setInnerHTML(""); // depends on control dependency: [if], data = [none]
}
return path;
} }
|
public class class_name {
@Override
public EClass getIfcPlacement() {
if (ifcPlacementEClass == null) {
ifcPlacementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(424);
}
return ifcPlacementEClass;
} }
|
public class class_name {
@Override
public EClass getIfcPlacement() {
if (ifcPlacementEClass == null) {
ifcPlacementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(424);
// depends on control dependency: [if], data = [none]
}
return ifcPlacementEClass;
} }
|
public class class_name {
public void store(Activations metadata, XMLStreamWriter writer) throws Exception
{
if (metadata != null && writer != null)
{
writer.writeStartElement(XML.ELEMENT_RESOURCE_ADAPTERS);
for (Activation a : metadata.getActivations())
{
writer.writeStartElement(XML.ELEMENT_RESOURCE_ADAPTER);
if (a.getId() != null)
writer.writeAttribute(XML.ATTRIBUTE_ID, a.getValue(XML.ATTRIBUTE_ID, a.getId()));
writer.writeStartElement(XML.ELEMENT_ARCHIVE);
writer.writeCharacters(a.getValue(XML.ELEMENT_ARCHIVE, a.getArchive()));
writer.writeEndElement();
storeCommon(a, writer);
writer.writeEndElement();
}
writer.writeEndElement();
}
} }
|
public class class_name {
public void store(Activations metadata, XMLStreamWriter writer) throws Exception
{
if (metadata != null && writer != null)
{
writer.writeStartElement(XML.ELEMENT_RESOURCE_ADAPTERS);
for (Activation a : metadata.getActivations())
{
writer.writeStartElement(XML.ELEMENT_RESOURCE_ADAPTER); // depends on control dependency: [for], data = [a]
if (a.getId() != null)
writer.writeAttribute(XML.ATTRIBUTE_ID, a.getValue(XML.ATTRIBUTE_ID, a.getId()));
writer.writeStartElement(XML.ELEMENT_ARCHIVE); // depends on control dependency: [for], data = [a]
writer.writeCharacters(a.getValue(XML.ELEMENT_ARCHIVE, a.getArchive())); // depends on control dependency: [for], data = [a]
writer.writeEndElement(); // depends on control dependency: [for], data = [none]
storeCommon(a, writer); // depends on control dependency: [for], data = [a]
writer.writeEndElement(); // depends on control dependency: [for], data = [none]
}
writer.writeEndElement();
}
} }
|
public class class_name {
public static void main(String[] args) {
if (args.length == 0) {
System.out.println(
"Usage: SplittingBAMIndex [splitting BAM indices...]\n\n"+
"Writes a few statistics about each splitting BAM index.");
return;
}
for (String arg : args) {
final File f = new File(arg);
if (f.isFile() && f.canRead()) {
try {
System.err.printf("%s:\n", f);
final SplittingBAMIndex bi = new SplittingBAMIndex(f);
if (bi.size() == 1) {
System.err.printf("\t0 alignments\n" +
"\tassociated BAM file size %d\n", bi.bamSize());
} else {
final long first = bi.first();
final long last = bi.last();
System.err.printf(
"\t%d alignments\n" +
"\tfirst is at %#06x in BGZF block at %#014x\n" +
"\tlast is at %#06x in BGZF block at %#014x\n" +
"\tassociated BAM file size %d\n",
bi.size(),
first & 0xffff, first >>> 16,
last & 0xffff, last >>> 16,
bi.bamSize());
}
} catch (IOException e) {
System.err.printf("Failed to read %s!\n", f);
e.printStackTrace();
}
} else
System.err.printf("%s does not look like a readable file!\n", f);
}
} }
|
public class class_name {
public static void main(String[] args) {
if (args.length == 0) {
System.out.println(
"Usage: SplittingBAMIndex [splitting BAM indices...]\n\n"+
"Writes a few statistics about each splitting BAM index.");
return;
}
for (String arg : args) {
final File f = new File(arg);
if (f.isFile() && f.canRead()) {
try {
System.err.printf("%s:\n", f);
final SplittingBAMIndex bi = new SplittingBAMIndex(f);
if (bi.size() == 1) {
System.err.printf("\t0 alignments\n" +
"\tassociated BAM file size %d\n", bi.bamSize()); // depends on control dependency: [if], data = [none]
} else {
final long first = bi.first();
final long last = bi.last();
System.err.printf(
"\t%d alignments\n" +
"\tfirst is at %#06x in BGZF block at %#014x\n" +
"\tlast is at %#06x in BGZF block at %#014x\n" +
"\tassociated BAM file size %d\n",
bi.size(),
first & 0xffff, first >>> 16,
last & 0xffff, last >>> 16,
bi.bamSize()); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
System.err.printf("Failed to read %s!\n", f);
e.printStackTrace();
}
} else
System.err.printf("%s does not look like a readable file!\n", f);
}
} }
|
public class class_name {
public ColumnMapperSingle<?> getMapperSingle(String field) {
ColumnMapper columnMapper = getMapper(field);
if (columnMapper != null && columnMapper instanceof ColumnMapperSingle<?>) {
return (ColumnMapperSingle<?>) columnMapper;
} else {
return null;
}
} }
|
public class class_name {
public ColumnMapperSingle<?> getMapperSingle(String field) {
ColumnMapper columnMapper = getMapper(field);
if (columnMapper != null && columnMapper instanceof ColumnMapperSingle<?>) {
return (ColumnMapperSingle<?>) columnMapper; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public BufferedImage getBufferedImage(int width, int height, int type) {
int wDif,
hDif,
fWidth = 0,
fHeight = 0;
double imgWidth,
imgHeight;
double factor;
imgWidth = image.getWidth();
imgHeight = image.getHeight();
switch (type) {
case PROPORTIONAL:
wDif = (int) imgWidth - width;
hDif = (int) imgHeight - height;
if (wDif > hDif) {
factor = width / imgWidth;
} else {
factor = height / imgHeight;
}
fWidth = (int) Math.floor(imgWidth * factor);
fHeight = (int) Math.floor(imgHeight * factor);
break;
}
return getBufferedImage(fWidth, fHeight);
} }
|
public class class_name {
public BufferedImage getBufferedImage(int width, int height, int type) {
int wDif,
hDif,
fWidth = 0,
fHeight = 0;
double imgWidth,
imgHeight;
double factor;
imgWidth = image.getWidth();
imgHeight = image.getHeight();
switch (type) {
case PROPORTIONAL:
wDif = (int) imgWidth - width;
hDif = (int) imgHeight - height;
if (wDif > hDif) {
factor = width / imgWidth; // depends on control dependency: [if], data = [none]
} else {
factor = height / imgHeight; // depends on control dependency: [if], data = [none]
}
fWidth = (int) Math.floor(imgWidth * factor);
fHeight = (int) Math.floor(imgHeight * factor);
break;
}
return getBufferedImage(fWidth, fHeight);
} }
|
public class class_name {
private void markInstanceExecutionFailed(WSJobInstance jobInstance, WSJobExecution jobExecution, String correlationId) {
//Disregard any attempted transitions out of the ABANDONED state.
if (jobInstance.getBatchStatus() == BatchStatus.ABANDONED) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("Attempt to transition from BatchStatus ABANDONED to FAILED is disallowed. ");
}
return;
}
getPersistenceManagerService().updateJobInstanceWithInstanceStateAndBatchStatus(jobInstance.getInstanceId(),
InstanceState.FAILED,
BatchStatus.FAILED,
new Date());
publishEvent(jobInstance, BatchEventsPublisher.TOPIC_INSTANCE_FAILED, correlationId);
getPersistenceManagerService().updateJobExecutionAndInstanceOnStatusChange(jobExecution.getExecutionId(),
BatchStatus.FAILED,
new Date());
publishEvent(jobExecution, BatchEventsPublisher.TOPIC_EXECUTION_FAILED, correlationId);
} }
|
public class class_name {
private void markInstanceExecutionFailed(WSJobInstance jobInstance, WSJobExecution jobExecution, String correlationId) {
//Disregard any attempted transitions out of the ABANDONED state.
if (jobInstance.getBatchStatus() == BatchStatus.ABANDONED) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("Attempt to transition from BatchStatus ABANDONED to FAILED is disallowed. "); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
getPersistenceManagerService().updateJobInstanceWithInstanceStateAndBatchStatus(jobInstance.getInstanceId(),
InstanceState.FAILED,
BatchStatus.FAILED,
new Date());
publishEvent(jobInstance, BatchEventsPublisher.TOPIC_INSTANCE_FAILED, correlationId);
getPersistenceManagerService().updateJobExecutionAndInstanceOnStatusChange(jobExecution.getExecutionId(),
BatchStatus.FAILED,
new Date());
publishEvent(jobExecution, BatchEventsPublisher.TOPIC_EXECUTION_FAILED, correlationId);
} }
|
public class class_name {
private int[] findArrayDimensions(List<?> list, Class<?> arrayType) {
List<int[]> elementDims = new LinkedList<int[]>();
int dimCount = 0;
for (Object o : list) {
if (o != null && o.getClass().isArray() &&
isAssignableFromArray(arrayType, o.getClass().getComponentType())) {
final int[] dimensions = findArrayDimensions(o);
elementDims.add(dimensions);
dimCount = Math.max(dimCount, dimensions.length);
}
}
int[] dimsArr = new int[dimCount + 1];
// First dimension length is always size of given list
dimsArr[0] = list.size();
// Find the max length of each additional dimension
for (int[] childDim : elementDims) {
for (int i = 0; i < childDim.length; i++) {
dimsArr[i + 1] = Math.max(dimsArr[i + 1], childDim[i]);
}
}
return dimsArr;
} }
|
public class class_name {
private int[] findArrayDimensions(List<?> list, Class<?> arrayType) {
List<int[]> elementDims = new LinkedList<int[]>();
int dimCount = 0;
for (Object o : list) {
if (o != null && o.getClass().isArray() &&
isAssignableFromArray(arrayType, o.getClass().getComponentType())) {
final int[] dimensions = findArrayDimensions(o);
elementDims.add(dimensions); // depends on control dependency: [if], data = [none]
dimCount = Math.max(dimCount, dimensions.length); // depends on control dependency: [if], data = [none]
}
}
int[] dimsArr = new int[dimCount + 1];
// First dimension length is always size of given list
dimsArr[0] = list.size();
// Find the max length of each additional dimension
for (int[] childDim : elementDims) {
for (int i = 0; i < childDim.length; i++) {
dimsArr[i + 1] = Math.max(dimsArr[i + 1], childDim[i]); // depends on control dependency: [for], data = [i]
}
}
return dimsArr;
} }
|
public class class_name {
public synchronized boolean getAttribute(String key, boolean defaultValue)
{
if(attributes.containsKey(key))
{
Object obj = attributes.get(key);
if(obj instanceof Boolean)
{
return (Boolean) obj;
}
}
return defaultValue;
} }
|
public class class_name {
public synchronized boolean getAttribute(String key, boolean defaultValue)
{
if(attributes.containsKey(key))
{
Object obj = attributes.get(key);
if(obj instanceof Boolean)
{
return (Boolean) obj; // depends on control dependency: [if], data = [none]
}
}
return defaultValue;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <E extends SpecificRecord, S extends SpecificRecord> Dao<E> buildCompositeDao(
HTablePool tablePool, String tableName,
List<String> subEntitySchemaStrings, Class<E> entityClass) {
List<EntityMapper<S>> entityMappers = new ArrayList<EntityMapper<S>>();
for (String subEntitySchemaString : subEntitySchemaStrings) {
AvroEntitySchema subEntitySchema = parser
.parseEntitySchema(subEntitySchemaString);
Class<S> subEntityClass;
try {
subEntityClass = (Class<S>) Class.forName(subEntitySchema
.getAvroSchema().getFullName());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
entityMappers.add(SpecificAvroDao.<S> buildEntityMapper(
subEntitySchemaString, subEntitySchemaString, subEntityClass));
}
return new SpecificCompositeAvroDao<E, S>(tablePool, tableName,
entityMappers, entityClass);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <E extends SpecificRecord, S extends SpecificRecord> Dao<E> buildCompositeDao(
HTablePool tablePool, String tableName,
List<String> subEntitySchemaStrings, Class<E> entityClass) {
List<EntityMapper<S>> entityMappers = new ArrayList<EntityMapper<S>>();
for (String subEntitySchemaString : subEntitySchemaStrings) {
AvroEntitySchema subEntitySchema = parser
.parseEntitySchema(subEntitySchemaString);
Class<S> subEntityClass;
try {
subEntityClass = (Class<S>) Class.forName(subEntitySchema
.getAvroSchema().getFullName()); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
entityMappers.add(SpecificAvroDao.<S> buildEntityMapper(
subEntitySchemaString, subEntitySchemaString, subEntityClass)); // depends on control dependency: [for], data = [none]
}
return new SpecificCompositeAvroDao<E, S>(tablePool, tableName,
entityMappers, entityClass);
} }
|
public class class_name {
public Object get(final String key) {
int i = _getInt(key);
if (i < 0) {
return null;
}
if (i >= size()) {
return null;
}
return get(i);
} }
|
public class class_name {
public Object get(final String key) {
int i = _getInt(key);
if (i < 0) {
return null; // depends on control dependency: [if], data = [none]
}
if (i >= size()) {
return null; // depends on control dependency: [if], data = [none]
}
return get(i);
} }
|
public class class_name {
protected void afterEndDocument() {
if (stack[depth = 0] == WROTE_MARKUP) { // but not data
try {
writeNewLine(0);
} catch (Exception ignored) {
ignored.printStackTrace();
}
}
stack[depth] = 0; // start fresh
} }
|
public class class_name {
protected void afterEndDocument() {
if (stack[depth = 0] == WROTE_MARKUP) { // but not data
try {
writeNewLine(0); // depends on control dependency: [try], data = [none]
} catch (Exception ignored) {
ignored.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
stack[depth] = 0; // start fresh
} }
|
public class class_name {
public synchronized void onContextStatusMessages(final Iterable<ContextStatusPOJO>
contextStatusPOJOs,
final boolean notifyClientOnNewActiveContext) {
for (final ContextStatusPOJO contextStatus : contextStatusPOJOs) {
this.onContextStatusMessage(contextStatus, notifyClientOnNewActiveContext);
}
} }
|
public class class_name {
public synchronized void onContextStatusMessages(final Iterable<ContextStatusPOJO>
contextStatusPOJOs,
final boolean notifyClientOnNewActiveContext) {
for (final ContextStatusPOJO contextStatus : contextStatusPOJOs) {
this.onContextStatusMessage(contextStatus, notifyClientOnNewActiveContext); // depends on control dependency: [for], data = [contextStatus]
}
} }
|
public class class_name {
public void addTeamGraphicCommand(XPMImage xpm) {
for (int x = 0; x < xpm.getArrayWidth(); x++) {
for (int y = 0; y < xpm.getArrayHeight(); y++) {
StringBuilder buf = new StringBuilder();
String tile = xpm.getTile(x, y);
buf.append("(team_graphic (");
buf.append(x);
buf.append(' ');
buf.append(y);
buf.append(' ');
buf.append(tile);
buf.append(' ');
buf.append("))");
fifo.add(fifo.size(), buf.toString());
}
}
} }
|
public class class_name {
public void addTeamGraphicCommand(XPMImage xpm) {
for (int x = 0; x < xpm.getArrayWidth(); x++) {
for (int y = 0; y < xpm.getArrayHeight(); y++) {
StringBuilder buf = new StringBuilder();
String tile = xpm.getTile(x, y);
buf.append("(team_graphic ("); // depends on control dependency: [for], data = [none]
buf.append(x); // depends on control dependency: [for], data = [none]
buf.append(' '); // depends on control dependency: [for], data = [none]
buf.append(y); // depends on control dependency: [for], data = [y]
buf.append(' '); // depends on control dependency: [for], data = [none]
buf.append(tile); // depends on control dependency: [for], data = [none]
buf.append(' '); // depends on control dependency: [for], data = [none]
buf.append("))"); // depends on control dependency: [for], data = [none]
fifo.add(fifo.size(), buf.toString()); // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
public CBConnection header(Map<String, String> header) {
if (header != null) {
this.header = header;
} else {
header.clear();
}
return this;
} }
|
public class class_name {
public CBConnection header(Map<String, String> header) {
if (header != null) {
this.header = header; // depends on control dependency: [if], data = [none]
} else {
header.clear(); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
private MilestoneManager getHalfKilometerManager() {
final Path arrowPath = new Path(); // a simple arrow towards the right
arrowPath.moveTo(-5, -5);
arrowPath.lineTo(5, 0);
arrowPath.lineTo(-5, 5);
arrowPath.close();
final Paint backgroundPaint = getFillPaint(COLOR_BACKGROUND);
return new MilestoneManager( // display an arrow at 500m every 1km
new MilestoneMeterDistanceLister(500),
new MilestonePathDisplayer(0, true, arrowPath, backgroundPaint) {
@Override
protected void draw(final Canvas pCanvas, final Object pParameter) {
final int halfKilometers = (int)Math.round(((double)pParameter / 500));
if (halfKilometers % 2 == 0) {
return;
}
super.draw(pCanvas, pParameter);
}
}
);
} }
|
public class class_name {
private MilestoneManager getHalfKilometerManager() {
final Path arrowPath = new Path(); // a simple arrow towards the right
arrowPath.moveTo(-5, -5);
arrowPath.lineTo(5, 0);
arrowPath.lineTo(-5, 5);
arrowPath.close();
final Paint backgroundPaint = getFillPaint(COLOR_BACKGROUND);
return new MilestoneManager( // display an arrow at 500m every 1km
new MilestoneMeterDistanceLister(500),
new MilestonePathDisplayer(0, true, arrowPath, backgroundPaint) {
@Override
protected void draw(final Canvas pCanvas, final Object pParameter) {
final int halfKilometers = (int)Math.round(((double)pParameter / 500));
if (halfKilometers % 2 == 0) {
return; // depends on control dependency: [if], data = [none]
}
super.draw(pCanvas, pParameter);
}
}
);
} }
|
public class class_name {
public static long fix(FileSystem fs, Path dir,
Class<? extends Writable> keyClass,
Class<? extends Writable> valueClass, boolean dryrun,
Configuration conf) throws Exception {
String dr = (dryrun ? "[DRY RUN ] " : "");
Path data = new Path(dir, DATA_FILE_NAME);
Path index = new Path(dir, INDEX_FILE_NAME);
int indexInterval = 128;
if (!fs.exists(data)) {
// there's nothing we can do to fix this!
throw new Exception(dr + "Missing data file in " + dir + ", impossible to fix this.");
}
if (fs.exists(index)) {
// no fixing needed
return -1;
}
SequenceFile.Reader dataReader = new SequenceFile.Reader(fs, data, conf);
if (!dataReader.getKeyClass().equals(keyClass)) {
throw new Exception(dr + "Wrong key class in " + dir + ", expected" + keyClass.getName() +
", got " + dataReader.getKeyClass().getName());
}
if (!dataReader.getValueClass().equals(valueClass)) {
throw new Exception(dr + "Wrong value class in " + dir + ", expected" + valueClass.getName() +
", got " + dataReader.getValueClass().getName());
}
long cnt = 0L;
Writable key = ReflectionUtils.newInstance(keyClass, conf);
Writable value = ReflectionUtils.newInstance(valueClass, conf);
SequenceFile.Writer indexWriter = null;
if (!dryrun) indexWriter = SequenceFile.createWriter(fs, conf, index, keyClass, LongWritable.class);
try {
long pos = 0L;
LongWritable position = new LongWritable();
while(dataReader.next(key, value)) {
cnt++;
if (cnt % indexInterval == 0) {
position.set(pos);
if (!dryrun) indexWriter.append(key, position);
}
pos = dataReader.getPosition();
}
} catch(Throwable t) {
// truncated data file. swallow it.
}
dataReader.close();
if (!dryrun) indexWriter.close();
return cnt;
} }
|
public class class_name {
public static long fix(FileSystem fs, Path dir,
Class<? extends Writable> keyClass,
Class<? extends Writable> valueClass, boolean dryrun,
Configuration conf) throws Exception {
String dr = (dryrun ? "[DRY RUN ] " : "");
Path data = new Path(dir, DATA_FILE_NAME);
Path index = new Path(dir, INDEX_FILE_NAME);
int indexInterval = 128;
if (!fs.exists(data)) {
// there's nothing we can do to fix this!
throw new Exception(dr + "Missing data file in " + dir + ", impossible to fix this.");
}
if (fs.exists(index)) {
// no fixing needed
return -1;
}
SequenceFile.Reader dataReader = new SequenceFile.Reader(fs, data, conf);
if (!dataReader.getKeyClass().equals(keyClass)) {
throw new Exception(dr + "Wrong key class in " + dir + ", expected" + keyClass.getName() +
", got " + dataReader.getKeyClass().getName());
}
if (!dataReader.getValueClass().equals(valueClass)) {
throw new Exception(dr + "Wrong value class in " + dir + ", expected" + valueClass.getName() +
", got " + dataReader.getValueClass().getName());
}
long cnt = 0L;
Writable key = ReflectionUtils.newInstance(keyClass, conf);
Writable value = ReflectionUtils.newInstance(valueClass, conf);
SequenceFile.Writer indexWriter = null;
if (!dryrun) indexWriter = SequenceFile.createWriter(fs, conf, index, keyClass, LongWritable.class);
try {
long pos = 0L;
LongWritable position = new LongWritable();
while(dataReader.next(key, value)) {
cnt++;
if (cnt % indexInterval == 0) {
position.set(pos); // depends on control dependency: [if], data = [none]
if (!dryrun) indexWriter.append(key, position);
}
pos = dataReader.getPosition();
}
} catch(Throwable t) {
// truncated data file. swallow it.
}
dataReader.close();
if (!dryrun) indexWriter.close();
return cnt;
} }
|
public class class_name {
public void addNewSimpleCustomTag(String tagName, String header, String locations) {
if (tagName == null || locations == null) {
return;
}
Taglet tag = customTags.get(tagName);
locations = StringUtils.toLowerCase(locations);
if (tag == null || header != null) {
customTags.remove(tagName);
customTags.put(tagName, new SimpleTaglet(tagName, header, locations));
if (locations != null && locations.indexOf('x') == -1) {
checkTagName(tagName);
}
} else {
//Move to back
customTags.remove(tagName);
customTags.put(tagName, tag);
}
} }
|
public class class_name {
public void addNewSimpleCustomTag(String tagName, String header, String locations) {
if (tagName == null || locations == null) {
return; // depends on control dependency: [if], data = [none]
}
Taglet tag = customTags.get(tagName);
locations = StringUtils.toLowerCase(locations);
if (tag == null || header != null) {
customTags.remove(tagName); // depends on control dependency: [if], data = [(tag]
customTags.put(tagName, new SimpleTaglet(tagName, header, locations)); // depends on control dependency: [if], data = [(tag]
if (locations != null && locations.indexOf('x') == -1) {
checkTagName(tagName); // depends on control dependency: [if], data = [none]
}
} else {
//Move to back
customTags.remove(tagName); // depends on control dependency: [if], data = [(tag]
customTags.put(tagName, tag); // depends on control dependency: [if], data = [(tag]
}
} }
|
public class class_name {
public int compareTo(ExtensionComponent<T> that) {
double a = this.ordinal();
double b = that.ordinal();
if (a>b) return -1;
if (a<b) return 1;
// make the order bit more deterministic among extensions of the same ordinal
if (this.instance instanceof Descriptor && that.instance instanceof Descriptor) {
try {
return Util.fixNull(((Descriptor)this.instance).getDisplayName()).compareTo(Util.fixNull(((Descriptor)that.instance).getDisplayName()));
} catch (RuntimeException | LinkageError x) {
LOG.log(Level.WARNING, null, x);
}
}
return this.instance.getClass().getName().compareTo(that.instance.getClass().getName());
} }
|
public class class_name {
public int compareTo(ExtensionComponent<T> that) {
double a = this.ordinal();
double b = that.ordinal();
if (a>b) return -1;
if (a<b) return 1;
// make the order bit more deterministic among extensions of the same ordinal
if (this.instance instanceof Descriptor && that.instance instanceof Descriptor) {
try {
return Util.fixNull(((Descriptor)this.instance).getDisplayName()).compareTo(Util.fixNull(((Descriptor)that.instance).getDisplayName())); // depends on control dependency: [try], data = [none]
} catch (RuntimeException | LinkageError x) {
LOG.log(Level.WARNING, null, x);
} // depends on control dependency: [catch], data = [none]
}
return this.instance.getClass().getName().compareTo(that.instance.getClass().getName());
} }
|
public class class_name {
public TupleCombinerBuilder exclude( String... varNamePatterns)
{
for( String varNamePattern : varNamePatterns)
{
tupleCombiner_.addExcludedVar( varNamePattern);
}
return this;
} }
|
public class class_name {
public TupleCombinerBuilder exclude( String... varNamePatterns)
{
for( String varNamePattern : varNamePatterns)
{
tupleCombiner_.addExcludedVar( varNamePattern); // depends on control dependency: [for], data = [varNamePattern]
}
return this;
} }
|
public class class_name {
@Override
public synchronized void release() throws Exception
{
Exception baseException = null;
for ( InterProcessLock lock : reverse(locks) )
{
try
{
lock.release();
}
catch ( Exception e )
{
ThreadUtils.checkInterrupted(e);
if ( baseException == null )
{
baseException = e;
}
else
{
baseException = new Exception(baseException);
}
}
}
if ( baseException != null )
{
throw baseException;
}
} }
|
public class class_name {
@Override
public synchronized void release() throws Exception
{
Exception baseException = null;
for ( InterProcessLock lock : reverse(locks) )
{
try
{
lock.release(); // depends on control dependency: [try], data = [none]
}
catch ( Exception e )
{
ThreadUtils.checkInterrupted(e);
if ( baseException == null )
{
baseException = e; // depends on control dependency: [if], data = [none]
}
else
{
baseException = new Exception(baseException); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
if ( baseException != null )
{
throw baseException;
}
} }
|
public class class_name {
public Object toObject(String pStr){
String decoded = null;
try{
decoded = decoder.decode(pStr);
}catch(DecoderException ex){
ex.printStackTrace();
throw new TranslationException(ex.getMessage());
}
return decoded;
} }
|
public class class_name {
public Object toObject(String pStr){
String decoded = null;
try{
decoded = decoder.decode(pStr); // depends on control dependency: [try], data = [none]
}catch(DecoderException ex){
ex.printStackTrace();
throw new TranslationException(ex.getMessage());
} // depends on control dependency: [catch], data = [none]
return decoded;
} }
|
public class class_name {
AbstractJcrNode node( CachedNode cachedNode,
SessionCache cache,
AbstractJcrNode.Type expectedType,
NodeKey parentKey ) {
assert cachedNode != null;
NodeKey nodeKey = cachedNode.getKey();
AbstractJcrNode node = jcrNodes.get(nodeKey);
boolean mightBeShared = true;
if (node == null) {
if (expectedType == null) {
Name primaryType = cachedNode.getPrimaryType(cache);
expectedType = Type.typeForPrimaryType(primaryType);
if (expectedType == null) {
// If this node from the system workspace, then the default is Type.SYSTEM rather than Type.NODE ...
if (repository().systemWorkspaceKey().equals(nodeKey.getWorkspaceKey())) {
expectedType = Type.SYSTEM;
} else {
expectedType = Type.NODE;
}
assert expectedType != null;
}
}
// Check if the new node is in the system area ...
if (expectedType == Type.SYSTEM || expectedType == Type.VERSION || expectedType == Type.VERSION_HISTORY) {
Path path = cachedNode.getPath(cache);
assert path.size() > 0;
if (!path.getSegment(0).getName().equals(JcrLexicon.SYSTEM)) {
// It is NOT below "/jcr:system"; someone must be using a node type normally used in the system area ...
expectedType = Type.NODE;
}
}
switch (expectedType) {
case NODE:
node = new JcrNode(this, nodeKey);
break;
case VERSION:
node = new JcrVersionNode(this, nodeKey);
mightBeShared = false;
break;
case VERSION_HISTORY:
node = new JcrVersionHistoryNode(this, nodeKey);
mightBeShared = false;
break;
case SYSTEM:
node = new JcrSystemNode(this, nodeKey);
mightBeShared = false;
break;
case ROOT:
try {
return getRootNode();
} catch (RepositoryException e) {
assert false : "Should never happen: " + e.getMessage();
}
}
assert node != null;
AbstractJcrNode newNode = jcrNodes.putIfAbsent(nodeKey, node);
if (newNode != null) {
// Another thread snuck in and created the node object ...
node = newNode;
}
}
if (mightBeShared && parentKey != null && cachedNode.getMixinTypes(cache).contains(JcrMixLexicon.SHAREABLE)) {
// This is a shareable node, so we have to get the proper Node instance for the given parent ...
node = node.sharedSet().getSharedNode(cachedNode, parentKey);
}
return node;
} }
|
public class class_name {
AbstractJcrNode node( CachedNode cachedNode,
SessionCache cache,
AbstractJcrNode.Type expectedType,
NodeKey parentKey ) {
assert cachedNode != null;
NodeKey nodeKey = cachedNode.getKey();
AbstractJcrNode node = jcrNodes.get(nodeKey);
boolean mightBeShared = true;
if (node == null) {
if (expectedType == null) {
Name primaryType = cachedNode.getPrimaryType(cache);
expectedType = Type.typeForPrimaryType(primaryType); // depends on control dependency: [if], data = [none]
if (expectedType == null) {
// If this node from the system workspace, then the default is Type.SYSTEM rather than Type.NODE ...
if (repository().systemWorkspaceKey().equals(nodeKey.getWorkspaceKey())) {
expectedType = Type.SYSTEM; // depends on control dependency: [if], data = [none]
} else {
expectedType = Type.NODE; // depends on control dependency: [if], data = [none]
}
assert expectedType != null;
}
}
// Check if the new node is in the system area ...
if (expectedType == Type.SYSTEM || expectedType == Type.VERSION || expectedType == Type.VERSION_HISTORY) {
Path path = cachedNode.getPath(cache);
assert path.size() > 0;
if (!path.getSegment(0).getName().equals(JcrLexicon.SYSTEM)) {
// It is NOT below "/jcr:system"; someone must be using a node type normally used in the system area ...
expectedType = Type.NODE; // depends on control dependency: [if], data = [none]
}
}
switch (expectedType) {
case NODE:
node = new JcrNode(this, nodeKey);
break;
case VERSION:
node = new JcrVersionNode(this, nodeKey);
mightBeShared = false;
break;
case VERSION_HISTORY:
node = new JcrVersionHistoryNode(this, nodeKey);
mightBeShared = false;
break;
case SYSTEM:
node = new JcrSystemNode(this, nodeKey);
mightBeShared = false;
break;
case ROOT:
try {
return getRootNode(); // depends on control dependency: [try], data = [none]
} catch (RepositoryException e) {
assert false : "Should never happen: " + e.getMessage();
} // depends on control dependency: [catch], data = [none]
}
assert node != null;
AbstractJcrNode newNode = jcrNodes.putIfAbsent(nodeKey, node);
if (newNode != null) {
// Another thread snuck in and created the node object ...
node = newNode; // depends on control dependency: [if], data = [none]
}
}
if (mightBeShared && parentKey != null && cachedNode.getMixinTypes(cache).contains(JcrMixLexicon.SHAREABLE)) {
// This is a shareable node, so we have to get the proper Node instance for the given parent ...
node = node.sharedSet().getSharedNode(cachedNode, parentKey); // depends on control dependency: [if], data = [none]
}
return node;
} }
|
public class class_name {
public synchronized Set<Vulnerability> getSuppressedVulnerabilities(boolean sorted) {
final Set<Vulnerability> vulnerabilitySet;
if (sorted) {
vulnerabilitySet = new TreeSet<>(suppressedVulnerabilities);
} else {
vulnerabilitySet = suppressedVulnerabilities;
}
return Collections.unmodifiableSet(vulnerabilitySet);
} }
|
public class class_name {
public synchronized Set<Vulnerability> getSuppressedVulnerabilities(boolean sorted) {
final Set<Vulnerability> vulnerabilitySet;
if (sorted) {
vulnerabilitySet = new TreeSet<>(suppressedVulnerabilities); // depends on control dependency: [if], data = [none]
} else {
vulnerabilitySet = suppressedVulnerabilities; // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableSet(vulnerabilitySet);
} }
|
public class class_name {
protected void requestPermission(final PermissionModel model) {
new AlertDialog.Builder(this)
.setTitle(model.getTitle())
.setMessage(model.getExplanationMessage())
.setPositiveButton("Request", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (model.getPermissionName().equalsIgnoreCase(Manifest.permission.SYSTEM_ALERT_WINDOW)) {
permissionHelper.requestSystemAlertPermission();
} else {
permissionHelper.requestAfterExplanation(model.getPermissionName());
}
}
}).show();
} }
|
public class class_name {
protected void requestPermission(final PermissionModel model) {
new AlertDialog.Builder(this)
.setTitle(model.getTitle())
.setMessage(model.getExplanationMessage())
.setPositiveButton("Request", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (model.getPermissionName().equalsIgnoreCase(Manifest.permission.SYSTEM_ALERT_WINDOW)) {
permissionHelper.requestSystemAlertPermission(); // depends on control dependency: [if], data = [none]
} else {
permissionHelper.requestAfterExplanation(model.getPermissionName()); // depends on control dependency: [if], data = [none]
}
}
}).show();
} }
|
public class class_name {
private final String getFilename(Context context, String pid, String dsid, Date asOfDateTime, String MIMETYPE) throws Exception {
String filename = "";
String extension = "";
// check sources in order
for (String source : m_datastreamFilenameSource.split(" ")) {
// try and get filename and extension from specified source
if (source.equals("rels")) {
filename = getFilenameFromRels(context, pid, dsid, MIMETYPE);
if (!filename.isEmpty())
extension = getExtension(filename, m_datastreamExtensionMappingRels, MIMETYPE);
} else {
if (source.equals("id")) {
filename = getFilenameFromId(pid, dsid, MIMETYPE);
if (!filename.isEmpty())
extension = getExtension(filename, m_datastreamExtensionMappingId, MIMETYPE);
} else {
if (source.equals("label")) {
filename = getFilenameFromLabel(context, pid, dsid, asOfDateTime, MIMETYPE);
if (!filename.isEmpty())
extension = getExtension(filename, m_datastreamExtensionMappingLabel, MIMETYPE);
} else {
logger.warn("Unknown datastream filename source specified in datastreamFilenameSource in fedora.fcfg: " + source + ". Please specify zero or more of: rels id label");
}
}
}
// if we've got one by here, quit loop
if (!filename.isEmpty())
break;
}
// if not determined from above use the default
if (filename.isEmpty()) {
filename = m_datastreamDefaultFilename;
extension = getExtension(m_datastreamDefaultFilename, m_datastreamExtensionMappingDefault, MIMETYPE);
}
// clean up filename - remove illegal chars
if (extension.isEmpty()) {
return ILLEGAL_FILENAME_REGEX.matcher(filename).replaceAll("");
} else {
return ILLEGAL_FILENAME_REGEX.matcher(filename + "." + extension).replaceAll("");
}
} }
|
public class class_name {
private final String getFilename(Context context, String pid, String dsid, Date asOfDateTime, String MIMETYPE) throws Exception {
String filename = "";
String extension = "";
// check sources in order
for (String source : m_datastreamFilenameSource.split(" ")) {
// try and get filename and extension from specified source
if (source.equals("rels")) {
filename = getFilenameFromRels(context, pid, dsid, MIMETYPE);
if (!filename.isEmpty())
extension = getExtension(filename, m_datastreamExtensionMappingRels, MIMETYPE);
} else {
if (source.equals("id")) {
filename = getFilenameFromId(pid, dsid, MIMETYPE); // depends on control dependency: [if], data = [none]
if (!filename.isEmpty())
extension = getExtension(filename, m_datastreamExtensionMappingId, MIMETYPE);
} else {
if (source.equals("label")) {
filename = getFilenameFromLabel(context, pid, dsid, asOfDateTime, MIMETYPE); // depends on control dependency: [if], data = [none]
if (!filename.isEmpty())
extension = getExtension(filename, m_datastreamExtensionMappingLabel, MIMETYPE);
} else {
logger.warn("Unknown datastream filename source specified in datastreamFilenameSource in fedora.fcfg: " + source + ". Please specify zero or more of: rels id label"); // depends on control dependency: [if], data = [none]
}
}
}
// if we've got one by here, quit loop
if (!filename.isEmpty())
break;
}
// if not determined from above use the default
if (filename.isEmpty()) {
filename = m_datastreamDefaultFilename;
extension = getExtension(m_datastreamDefaultFilename, m_datastreamExtensionMappingDefault, MIMETYPE);
}
// clean up filename - remove illegal chars
if (extension.isEmpty()) {
return ILLEGAL_FILENAME_REGEX.matcher(filename).replaceAll("");
} else {
return ILLEGAL_FILENAME_REGEX.matcher(filename + "." + extension).replaceAll("");
}
} }
|
public class class_name {
public void setConvertLinks(boolean convert) {
try {
runner.callMethod("setConvertLinks", engine, convert);
} catch (ScriptRunnerException e) {
throw new IllegalArgumentException("Could not set option", e);
}
} }
|
public class class_name {
public void setConvertLinks(boolean convert) {
try {
runner.callMethod("setConvertLinks", engine, convert); // depends on control dependency: [try], data = [none]
} catch (ScriptRunnerException e) {
throw new IllegalArgumentException("Could not set option", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public double getDistance(S solution, L solutionList) {
List<Double> listOfDistances = knnDistances(solution, solutionList) ;
listOfDistances.sort(Comparator.naturalOrder());
int limit = Math.min(k, listOfDistances.size()) ;
double result ;
if (limit == 0) {
result = 0.0 ;
} else {
double sum = 0.0;
for (int i = 0; i < limit; i++) {
sum += listOfDistances.get(i);
}
result = sum/limit ;
}
return result;
} }
|
public class class_name {
@Override
public double getDistance(S solution, L solutionList) {
List<Double> listOfDistances = knnDistances(solution, solutionList) ;
listOfDistances.sort(Comparator.naturalOrder());
int limit = Math.min(k, listOfDistances.size()) ;
double result ;
if (limit == 0) {
result = 0.0 ; // depends on control dependency: [if], data = [none]
} else {
double sum = 0.0;
for (int i = 0; i < limit; i++) {
sum += listOfDistances.get(i); // depends on control dependency: [for], data = [i]
}
result = sum/limit ; // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public void setActionNames(java.util.Collection<String> actionNames) {
if (actionNames == null) {
this.actionNames = null;
return;
}
this.actionNames = new java.util.ArrayList<String>(actionNames);
} }
|
public class class_name {
public void setActionNames(java.util.Collection<String> actionNames) {
if (actionNames == null) {
this.actionNames = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.actionNames = new java.util.ArrayList<String>(actionNames);
} }
|
public class class_name {
public void marshall(RemediationConfiguration remediationConfiguration, ProtocolMarshaller protocolMarshaller) {
if (remediationConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(remediationConfiguration.getConfigRuleName(), CONFIGRULENAME_BINDING);
protocolMarshaller.marshall(remediationConfiguration.getTargetType(), TARGETTYPE_BINDING);
protocolMarshaller.marshall(remediationConfiguration.getTargetId(), TARGETID_BINDING);
protocolMarshaller.marshall(remediationConfiguration.getTargetVersion(), TARGETVERSION_BINDING);
protocolMarshaller.marshall(remediationConfiguration.getParameters(), PARAMETERS_BINDING);
protocolMarshaller.marshall(remediationConfiguration.getResourceType(), RESOURCETYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(RemediationConfiguration remediationConfiguration, ProtocolMarshaller protocolMarshaller) {
if (remediationConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(remediationConfiguration.getConfigRuleName(), CONFIGRULENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(remediationConfiguration.getTargetType(), TARGETTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(remediationConfiguration.getTargetId(), TARGETID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(remediationConfiguration.getTargetVersion(), TARGETVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(remediationConfiguration.getParameters(), PARAMETERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(remediationConfiguration.getResourceType(), RESOURCETYPE_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 addOrCriteria(Criteria pc)
{
if (!m_criteria.isEmpty())
{
pc.setEmbraced(true);
pc.setType(OR);
addCriteria(pc);
}
else
{
setEmbraced(false);
pc.setType(OR);
addCriteria(pc);
}
} }
|
public class class_name {
public void addOrCriteria(Criteria pc)
{
if (!m_criteria.isEmpty())
{
pc.setEmbraced(true);
// depends on control dependency: [if], data = [none]
pc.setType(OR);
// depends on control dependency: [if], data = [none]
addCriteria(pc);
// depends on control dependency: [if], data = [none]
}
else
{
setEmbraced(false);
// depends on control dependency: [if], data = [none]
pc.setType(OR);
// depends on control dependency: [if], data = [none]
addCriteria(pc);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Pure
public double[] toDoubleArray(Transform3D transform) {
double[] clone = new double[this.numCoordsProperty.get()];
if (transform==null) {
for(int i=0; i<this.numCoordsProperty.get(); ++i) {
clone[i] = this.coordsProperty[i].get();
}
}
else {
Point3f p = new Point3f();
for(int i=0; i<clone.length;) {
p.x = this.coordsProperty[i].get();
p.y = this.coordsProperty[i+1].get();
p.y = this.coordsProperty[i+2].get();
transform.transform(p);
clone[i++] = p.x;
clone[i++] = p.y;
clone[i++] = p.z;
}
}
return clone;
} }
|
public class class_name {
@Pure
public double[] toDoubleArray(Transform3D transform) {
double[] clone = new double[this.numCoordsProperty.get()];
if (transform==null) {
for(int i=0; i<this.numCoordsProperty.get(); ++i) {
clone[i] = this.coordsProperty[i].get(); // depends on control dependency: [for], data = [i]
}
}
else {
Point3f p = new Point3f();
for(int i=0; i<clone.length;) {
p.x = this.coordsProperty[i].get(); // depends on control dependency: [for], data = [i]
p.y = this.coordsProperty[i+1].get(); // depends on control dependency: [for], data = [i]
p.y = this.coordsProperty[i+2].get(); // depends on control dependency: [for], data = [i]
transform.transform(p); // depends on control dependency: [for], data = [none]
clone[i++] = p.x; // depends on control dependency: [for], data = [i]
clone[i++] = p.y; // depends on control dependency: [for], data = [i]
clone[i++] = p.z; // depends on control dependency: [for], data = [i]
}
}
return clone;
} }
|
public class class_name {
public static boolean makeSureMsgId(Map<String, Object> map) {
boolean newMsgIdGenerated = false;
if (StringUtil.isEmpty(map.get("$msgId"))) {
if (MsgIdHolder.get() == null) {
MsgIdHolder.init();
newMsgIdGenerated = true;
LOG.debug("没有提供$msgId,因此这里初始化一个!");
}
map.put("$msgId", MsgIdHolder.get());
} else {
MsgIdHolder.set(map.get("$msgId").toString());
}
return newMsgIdGenerated;
} }
|
public class class_name {
public static boolean makeSureMsgId(Map<String, Object> map) {
boolean newMsgIdGenerated = false;
if (StringUtil.isEmpty(map.get("$msgId"))) {
if (MsgIdHolder.get() == null) {
MsgIdHolder.init(); // depends on control dependency: [if], data = [none]
newMsgIdGenerated = true; // depends on control dependency: [if], data = [none]
LOG.debug("没有提供$msgId,因此这里初始化一个!"); // depends on control dependency: [if], data = [none]
}
map.put("$msgId", MsgIdHolder.get()); // depends on control dependency: [if], data = [none]
} else {
MsgIdHolder.set(map.get("$msgId").toString()); // depends on control dependency: [if], data = [none]
}
return newMsgIdGenerated;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.