code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static boolean hasConstructorInTheCorrectForm(Class<?> clazz) {
if (clazz.getConstructors().length != 1) {
return false;
}
Constructor<?> con = clazz.getConstructors()[0];
if (con.getParameterTypes().length == 0) {
return false;
}
Annotation[][] parameterAnnotations = con.getParameterAnnotations();
for (Annotation[] as : parameterAnnotations) {
if (!hasColumnAnnotation(as)) {
return false;
}
}
return true;
} }
|
public class class_name {
public static boolean hasConstructorInTheCorrectForm(Class<?> clazz) {
if (clazz.getConstructors().length != 1) {
return false; // depends on control dependency: [if], data = [none]
}
Constructor<?> con = clazz.getConstructors()[0];
if (con.getParameterTypes().length == 0) {
return false; // depends on control dependency: [if], data = [none]
}
Annotation[][] parameterAnnotations = con.getParameterAnnotations();
for (Annotation[] as : parameterAnnotations) {
if (!hasColumnAnnotation(as)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public static void main(final String[] args) {
if (System.getProperty("db.name") == null) {
System.out.println("Not running in multi-instance mode: no DB to connect to");
System.exit(1);
}
while (true) {
try {
Class.forName("org.postgresql.Driver");
DriverManager.getConnection("jdbc:postgresql://" + System.getProperty("db.host") + ":5432/" +
System.getProperty("db.name"),
System.getProperty("db.username"),
System.getProperty("db.password"));
System.out.println("Opened database successfully. Running in multi-instance mode");
System.exit(0);
return;
} catch (Exception e) {
System.out.println("Failed to connect to the DB: " + e.toString());
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
//ignored
}
}
}
} }
|
public class class_name {
public static void main(final String[] args) {
if (System.getProperty("db.name") == null) {
System.out.println("Not running in multi-instance mode: no DB to connect to"); // depends on control dependency: [if], data = [none]
System.exit(1); // depends on control dependency: [if], data = [none]
}
while (true) {
try {
Class.forName("org.postgresql.Driver");
DriverManager.getConnection("jdbc:postgresql://" + System.getProperty("db.host") + ":5432/" +
System.getProperty("db.name"),
System.getProperty("db.username"),
System.getProperty("db.password"));
System.out.println("Opened database successfully. Running in multi-instance mode");
System.exit(0); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
System.out.println("Failed to connect to the DB: " + e.toString());
try {
Thread.sleep(1000); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e1) {
//ignored
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
protected Field getField( Class<?> targetClass,
String propertyName ) throws NoSuchFieldException {
Field field = null;
try {
field = targetClass.getDeclaredField(Inflector.getInstance().lowerCamelCase(propertyName));
} catch (NoSuchFieldException e) {
Class<?> clazz = targetClass.getSuperclass();
if (clazz != null) {
field = getField(clazz, propertyName);
} else {
throw e;
}
}
return field;
} }
|
public class class_name {
protected Field getField( Class<?> targetClass,
String propertyName ) throws NoSuchFieldException {
Field field = null;
try {
field = targetClass.getDeclaredField(Inflector.getInstance().lowerCamelCase(propertyName));
} catch (NoSuchFieldException e) {
Class<?> clazz = targetClass.getSuperclass();
if (clazz != null) {
field = getField(clazz, propertyName); // depends on control dependency: [if], data = [(clazz]
} else {
throw e;
}
}
return field;
} }
|
public class class_name {
public static Scope from(CompositeData cd) {
IScope parent = null;
ScopeType type = ScopeType.UNDEFINED;
String name = null;
boolean persistent = false;
if (cd.containsKey("parent")) {
parent = (IScope) cd.get("parent");
}
if (cd.containsKey("type")) {
type = (ScopeType) cd.get("type");
}
if (cd.containsKey("name")) {
name = (String) cd.get("name");
}
if (cd.containsKey("persistent")) {
persistent = (Boolean) cd.get("persistent");
}
return new Scope(new Builder(parent, type, name, persistent));
} }
|
public class class_name {
public static Scope from(CompositeData cd) {
IScope parent = null;
ScopeType type = ScopeType.UNDEFINED;
String name = null;
boolean persistent = false;
if (cd.containsKey("parent")) {
parent = (IScope) cd.get("parent");
// depends on control dependency: [if], data = [none]
}
if (cd.containsKey("type")) {
type = (ScopeType) cd.get("type");
// depends on control dependency: [if], data = [none]
}
if (cd.containsKey("name")) {
name = (String) cd.get("name");
// depends on control dependency: [if], data = [none]
}
if (cd.containsKey("persistent")) {
persistent = (Boolean) cd.get("persistent");
// depends on control dependency: [if], data = [none]
}
return new Scope(new Builder(parent, type, name, persistent));
} }
|
public class class_name {
@Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!isInitialised()) {
setInitialised(true);
setBean(new MyDemoBean());
}
// Handle readOnly state
checkBoxSelect.setReadOnly(readOnly.isSelected());
multiDropdown.setReadOnly(readOnly.isSelected());
multiSelect.setReadOnly(readOnly.isSelected());
multiSelectPair.setReadOnly(readOnly.isSelected());
dropdown.setReadOnly(readOnly.isSelected());
radioButtonSelect.setReadOnly(readOnly.isSelected());
singleSelect.setReadOnly(readOnly.isSelected());
checkBox.setReadOnly(readOnly.isSelected());
dateField.setReadOnly(readOnly.isSelected());
emailField.setReadOnly(readOnly.isSelected());
fileWidget.setReadOnly(readOnly.isSelected());
multiFileWidget.setReadOnly(readOnly.isSelected());
multiTextField.setReadOnly(readOnly.isSelected());
numberField.setReadOnly(readOnly.isSelected());
partialDateField.setReadOnly(readOnly.isSelected());
phoneNumberField.setReadOnly(readOnly.isSelected());
radioButton.setReadOnly(readOnly.isSelected());
shuffler.setReadOnly(readOnly.isSelected());
textField.setReadOnly(readOnly.isSelected());
textArea.setReadOnly(readOnly.isSelected());
radioButton1.setReadOnly(readOnly.isSelected());
radioButton2.setReadOnly(readOnly.isSelected());
radioButton3.setReadOnly(readOnly.isSelected());
radioButtonGroupValue.setText("Value: " + radioButtonGroup2.getValueAsString());
// Handle RadioButtonGroup (not a subordinate target)
radioButtonGroup2.setMandatory(mandatory.isSelected());
radioButtonGroup2.setDisabled(disabled.isSelected());
} }
|
public class class_name {
@Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!isInitialised()) {
setInitialised(true); // depends on control dependency: [if], data = [none]
setBean(new MyDemoBean()); // depends on control dependency: [if], data = [none]
}
// Handle readOnly state
checkBoxSelect.setReadOnly(readOnly.isSelected());
multiDropdown.setReadOnly(readOnly.isSelected());
multiSelect.setReadOnly(readOnly.isSelected());
multiSelectPair.setReadOnly(readOnly.isSelected());
dropdown.setReadOnly(readOnly.isSelected());
radioButtonSelect.setReadOnly(readOnly.isSelected());
singleSelect.setReadOnly(readOnly.isSelected());
checkBox.setReadOnly(readOnly.isSelected());
dateField.setReadOnly(readOnly.isSelected());
emailField.setReadOnly(readOnly.isSelected());
fileWidget.setReadOnly(readOnly.isSelected());
multiFileWidget.setReadOnly(readOnly.isSelected());
multiTextField.setReadOnly(readOnly.isSelected());
numberField.setReadOnly(readOnly.isSelected());
partialDateField.setReadOnly(readOnly.isSelected());
phoneNumberField.setReadOnly(readOnly.isSelected());
radioButton.setReadOnly(readOnly.isSelected());
shuffler.setReadOnly(readOnly.isSelected());
textField.setReadOnly(readOnly.isSelected());
textArea.setReadOnly(readOnly.isSelected());
radioButton1.setReadOnly(readOnly.isSelected());
radioButton2.setReadOnly(readOnly.isSelected());
radioButton3.setReadOnly(readOnly.isSelected());
radioButtonGroupValue.setText("Value: " + radioButtonGroup2.getValueAsString());
// Handle RadioButtonGroup (not a subordinate target)
radioButtonGroup2.setMandatory(mandatory.isSelected());
radioButtonGroup2.setDisabled(disabled.isSelected());
} }
|
public class class_name {
public void marshall(ListTargetsForSecurityProfileRequest listTargetsForSecurityProfileRequest, ProtocolMarshaller protocolMarshaller) {
if (listTargetsForSecurityProfileRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listTargetsForSecurityProfileRequest.getSecurityProfileName(), SECURITYPROFILENAME_BINDING);
protocolMarshaller.marshall(listTargetsForSecurityProfileRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listTargetsForSecurityProfileRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListTargetsForSecurityProfileRequest listTargetsForSecurityProfileRequest, ProtocolMarshaller protocolMarshaller) {
if (listTargetsForSecurityProfileRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listTargetsForSecurityProfileRequest.getSecurityProfileName(), SECURITYPROFILENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listTargetsForSecurityProfileRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listTargetsForSecurityProfileRequest.getMaxResults(), MAXRESULTS_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 Interval<C> gap(final Interval<C> that) {
if(this.before(that)) {
return this.ahead().intersect(that.behind());
}
if(this.after(that)) {
return this.behind().intersect(that.ahead());
}
return NULL;
} }
|
public class class_name {
public Interval<C> gap(final Interval<C> that) {
if(this.before(that)) {
return this.ahead().intersect(that.behind()); // depends on control dependency: [if], data = [none]
}
if(this.after(that)) {
return this.behind().intersect(that.ahead()); // depends on control dependency: [if], data = [none]
}
return NULL;
} }
|
public class class_name {
public void setLanguages(java.util.Collection<EnvironmentLanguage> languages) {
if (languages == null) {
this.languages = null;
return;
}
this.languages = new java.util.ArrayList<EnvironmentLanguage>(languages);
} }
|
public class class_name {
public void setLanguages(java.util.Collection<EnvironmentLanguage> languages) {
if (languages == null) {
this.languages = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.languages = new java.util.ArrayList<EnvironmentLanguage>(languages);
} }
|
public class class_name {
public int makeReplacement() {
if (replacementString != null) return 0;
byte[] insEnc = encodingToInsertOutput();
final byte[] replEnc;
final int len;
final byte[] replacement;
if (insEnc.length != 0) {
// Transcoding transcoding = lastTranscoding;
// Transcoder transcoder = transcoding.transcoder;
// Encoding enc = EncodingDB.getEncodings().get(transcoder.destination).getEncoding();
// get_replacement_character
if (caseInsensitiveEquals(insEnc, "UTF-8".getBytes())) {
len = 3;
replEnc = "UTF-8".getBytes();
replacement = new byte[] { (byte) 0xEF, (byte) 0xBF, (byte) 0xBD };
} else {
len = 1;
replEnc = "US-ASCII".getBytes();
replacement = new byte[] { '?' };
}
} else {
len = 1;
replEnc = NULL_STRING;
replacement = new byte[] { '?' };
}
replacementString = replacement;
replacementLength = len;
replacementEncoding = replEnc;
return 0;
} }
|
public class class_name {
public int makeReplacement() {
if (replacementString != null) return 0;
byte[] insEnc = encodingToInsertOutput();
final byte[] replEnc;
final int len;
final byte[] replacement;
if (insEnc.length != 0) {
// Transcoding transcoding = lastTranscoding;
// Transcoder transcoder = transcoding.transcoder;
// Encoding enc = EncodingDB.getEncodings().get(transcoder.destination).getEncoding();
// get_replacement_character
if (caseInsensitiveEquals(insEnc, "UTF-8".getBytes())) {
len = 3;
// depends on control dependency: [if], data = [none]
replEnc = "UTF-8".getBytes();
// depends on control dependency: [if], data = [none]
replacement = new byte[] { (byte) 0xEF, (byte) 0xBF, (byte) 0xBD };
// depends on control dependency: [if], data = [none]
} else {
len = 1;
// depends on control dependency: [if], data = [none]
replEnc = "US-ASCII".getBytes();
// depends on control dependency: [if], data = [none]
replacement = new byte[] { '?' };
// depends on control dependency: [if], data = [none]
}
} else {
len = 1;
// depends on control dependency: [if], data = [none]
replEnc = NULL_STRING;
// depends on control dependency: [if], data = [none]
replacement = new byte[] { '?' };
// depends on control dependency: [if], data = [none]
}
replacementString = replacement;
replacementLength = len;
replacementEncoding = replEnc;
return 0;
} }
|
public class class_name {
public void add(PropertyData data, ChangedSizeHandler sizeHandler) throws RepositoryException,
UnsupportedOperationException, InvalidItemStateException, IllegalStateException
{
checkIfOpened();
try
{
addPropertyRecord(data);
if (data.getType() == PropertyType.REFERENCE)
{
try
{
addReference(data);
}
catch (IOException e)
{
throw new RepositoryException("Can't read REFERENCE property (" + data.getQPath() + " "
+ data.getIdentifier() + ") value: " + e.getMessage(), e);
}
}
addValues(getInternalId(data.getIdentifier()), data, sizeHandler);
if (LOG.isDebugEnabled())
{
LOG.debug("Property added " + data.getQPath().getAsString() + ", " + data.getIdentifier()
+ (data.getValues() != null ? ", values count: " + data.getValues().size() : ", NULL data"));
}
}
catch (IOException e)
{
if (LOG.isDebugEnabled())
{
LOG.error("Property add. IO error: " + e, e);
}
throw new RepositoryException("Error of Property Value add " + e, e);
}
catch (SQLException e)
{
if (LOG.isDebugEnabled())
{
LOG.error("Property add. Database error: " + e, e);
}
exceptionHandler.handleAddException(e, data);
}
} }
|
public class class_name {
public void add(PropertyData data, ChangedSizeHandler sizeHandler) throws RepositoryException,
UnsupportedOperationException, InvalidItemStateException, IllegalStateException
{
checkIfOpened();
try
{
addPropertyRecord(data);
if (data.getType() == PropertyType.REFERENCE)
{
try
{
addReference(data); // depends on control dependency: [try], data = [none]
}
catch (IOException e)
{
throw new RepositoryException("Can't read REFERENCE property (" + data.getQPath() + " "
+ data.getIdentifier() + ") value: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
addValues(getInternalId(data.getIdentifier()), data, sizeHandler);
if (LOG.isDebugEnabled())
{
LOG.debug("Property added " + data.getQPath().getAsString() + ", " + data.getIdentifier()
+ (data.getValues() != null ? ", values count: " + data.getValues().size() : ", NULL data")); // depends on control dependency: [if], data = [none]
}
}
catch (IOException e)
{
if (LOG.isDebugEnabled())
{
LOG.error("Property add. IO error: " + e, e); // depends on control dependency: [if], data = [none]
}
throw new RepositoryException("Error of Property Value add " + e, e);
}
catch (SQLException e)
{
if (LOG.isDebugEnabled())
{
LOG.error("Property add. Database error: " + e, e); // depends on control dependency: [if], data = [none]
}
exceptionHandler.handleAddException(e, data);
}
} }
|
public class class_name {
private void saveAddInfo(String key, String value) {
int pos = key.indexOf("@");
String className = "";
if (pos > -1) {
className = key.substring(pos + 1);
key = key.substring(0, pos);
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) {
m_user.deleteAdditionalInfo(key);
return;
}
if (pos < 0) {
m_user.setAdditionalInfo(key, value);
return;
}
Class<?> clazz;
try {
// try the class name
clazz = Class.forName(className);
} catch (Throwable e) {
try {
// try the class in the java.lang package
clazz = Class.forName(Integer.class.getPackage().getName() + "." + className);
} catch (Throwable e1) {
clazz = String.class;
}
}
m_user.setAdditionalInfo(key, CmsDataTypeUtil.parse(value, clazz));
} }
|
public class class_name {
private void saveAddInfo(String key, String value) {
int pos = key.indexOf("@");
String className = "";
if (pos > -1) {
className = key.substring(pos + 1); // depends on control dependency: [if], data = [(pos]
key = key.substring(0, pos); // depends on control dependency: [if], data = [none]
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) {
m_user.deleteAdditionalInfo(key); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (pos < 0) {
m_user.setAdditionalInfo(key, value); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
Class<?> clazz;
try {
// try the class name
clazz = Class.forName(className); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
try {
// try the class in the java.lang package
clazz = Class.forName(Integer.class.getPackage().getName() + "." + className); // depends on control dependency: [try], data = [none]
} catch (Throwable e1) {
clazz = String.class;
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
m_user.setAdditionalInfo(key, CmsDataTypeUtil.parse(value, clazz));
} }
|
public class class_name {
@Override
protected UIComponent createVerbatimComponentFromBodyContent()
{
UIOutput component = (UIOutput)super.createVerbatimComponentFromBodyContent();
FacesContext facesContext = FacesContext.getCurrentInstance();
Object response = facesContext.getExternalContext().getResponse();
String wrappedOutput;
if (response instanceof ServletViewResponseWrapper)
{
ServletViewResponseWrapper wrappedResponse = (ServletViewResponseWrapper)response;
wrappedOutput = wrappedResponse.toString();
if (wrappedOutput != null && wrappedOutput.length() > 0)
{
String componentvalue = null;
if (component != null)
{
// save the Value of the Bodycontent
componentvalue = (String)component.getValue();
}
component = super.createVerbatimComponent();
if (componentvalue != null)
{
component.setValue(wrappedOutput + componentvalue);
}
else
{
component.setValue(wrappedOutput);
}
wrappedResponse.reset();
}
}
return component;
} }
|
public class class_name {
@Override
protected UIComponent createVerbatimComponentFromBodyContent()
{
UIOutput component = (UIOutput)super.createVerbatimComponentFromBodyContent();
FacesContext facesContext = FacesContext.getCurrentInstance();
Object response = facesContext.getExternalContext().getResponse();
String wrappedOutput;
if (response instanceof ServletViewResponseWrapper)
{
ServletViewResponseWrapper wrappedResponse = (ServletViewResponseWrapper)response;
wrappedOutput = wrappedResponse.toString(); // depends on control dependency: [if], data = [none]
if (wrappedOutput != null && wrappedOutput.length() > 0)
{
String componentvalue = null;
if (component != null)
{
// save the Value of the Bodycontent
componentvalue = (String)component.getValue(); // depends on control dependency: [if], data = [none]
}
component = super.createVerbatimComponent(); // depends on control dependency: [if], data = [none]
if (componentvalue != null)
{
component.setValue(wrappedOutput + componentvalue); // depends on control dependency: [if], data = [none]
}
else
{
component.setValue(wrappedOutput); // depends on control dependency: [if], data = [none]
}
wrappedResponse.reset(); // depends on control dependency: [if], data = [none]
}
}
return component;
} }
|
public class class_name {
@Modified
protected void modified(Map<String, Object> config) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config modified: " + this);
}
if (null == config) {
return;
}
final String ENC = "encoding.";
final String CONV = "converter.";
for (Map.Entry<String, Object> entry : config.entrySet()) {
String key = entry.getKey();
int len = key.length();
try {
if (len > ENC.length() && key.startsWith(ENC)) {
String value = (String) entry.getValue();
localeMap.put(key.substring(ENC.length()), value);
} else if (len > CONV.length() && key.startsWith(CONV)) {
String value = (String) entry.getValue();
converterMap.put(key.substring(CONV.length()).toLowerCase(),
value.toLowerCase());
}
} catch (Throwable t) {
FFDCFilter.processException(t,
"EncodingUtils.processConfig", "1",
new Object[] { key, entry.getValue() });
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Invalid property: [" + key
+ "]=[" + config.get(key) + "]");
}
}
} // loop on the entries
} }
|
public class class_name {
@Modified
protected void modified(Map<String, Object> config) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config modified: " + this); // depends on control dependency: [if], data = [none]
}
if (null == config) {
return; // depends on control dependency: [if], data = [none]
}
final String ENC = "encoding.";
final String CONV = "converter.";
for (Map.Entry<String, Object> entry : config.entrySet()) {
String key = entry.getKey();
int len = key.length();
try {
if (len > ENC.length() && key.startsWith(ENC)) {
String value = (String) entry.getValue();
localeMap.put(key.substring(ENC.length()), value); // depends on control dependency: [if], data = [none]
} else if (len > CONV.length() && key.startsWith(CONV)) {
String value = (String) entry.getValue();
converterMap.put(key.substring(CONV.length()).toLowerCase(),
value.toLowerCase()); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
FFDCFilter.processException(t,
"EncodingUtils.processConfig", "1",
new Object[] { key, entry.getValue() });
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Invalid property: [" + key
+ "]=[" + config.get(key) + "]"); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} // loop on the entries
} }
|
public class class_name {
public static void serialize(Serializable obj, ByteArrayOutputStream bout) {
try {
ObjectOutputStream out = new ObjectOutputStream(bout);
out.writeObject(obj);
out.close();
} catch (IOException e) {
throw new IllegalStateException("Could not serialize " + obj, e);
}
} }
|
public class class_name {
public static void serialize(Serializable obj, ByteArrayOutputStream bout) {
try {
ObjectOutputStream out = new ObjectOutputStream(bout);
out.writeObject(obj); // depends on control dependency: [try], data = [none]
out.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IllegalStateException("Could not serialize " + obj, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static boolean mergeLTI2Custom(Properties custom, String customstr)
{
if ( customstr == null || customstr.length() < 1 ) return true;
JSONObject json = null;
try {
json = (JSONObject) JSONValue.parse(customstr.trim());
} catch(Exception e) {
M_log.warning("mergeLTI2Custom could not parse\n"+customstr);
M_log.warning(e.getLocalizedMessage());
return false;
}
// This could happen if the old settings service was used
// on an LTI 2.x placement to put in settings that are not
// JSON - we just ignore it.
if ( json == null ) return false;
Iterator<?> keys = json.keySet().iterator();
while( keys.hasNext() ){
String key = (String)keys.next();
if ( custom.containsKey(key) ) continue;
Object value = json.get(key);
if ( value instanceof String ){
setProperty(custom, key, (String) value);
}
}
return true;
} }
|
public class class_name {
public static boolean mergeLTI2Custom(Properties custom, String customstr)
{
if ( customstr == null || customstr.length() < 1 ) return true;
JSONObject json = null;
try {
json = (JSONObject) JSONValue.parse(customstr.trim()); // depends on control dependency: [try], data = [none]
} catch(Exception e) {
M_log.warning("mergeLTI2Custom could not parse\n"+customstr);
M_log.warning(e.getLocalizedMessage());
return false;
} // depends on control dependency: [catch], data = [none]
// This could happen if the old settings service was used
// on an LTI 2.x placement to put in settings that are not
// JSON - we just ignore it.
if ( json == null ) return false;
Iterator<?> keys = json.keySet().iterator();
while( keys.hasNext() ){
String key = (String)keys.next();
if ( custom.containsKey(key) ) continue;
Object value = json.get(key);
if ( value instanceof String ){
setProperty(custom, key, (String) value); // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public EEnum getMDDXmBase() {
if (mddXmBaseEEnum == null) {
mddXmBaseEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(44);
}
return mddXmBaseEEnum;
} }
|
public class class_name {
public EEnum getMDDXmBase() {
if (mddXmBaseEEnum == null) {
mddXmBaseEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(44); // depends on control dependency: [if], data = [none]
}
return mddXmBaseEEnum;
} }
|
public class class_name {
public static Locale getLocale() {
final Locale ret = LOCALE.get();
if (null == ret) {
return Latkes.getLocale();
}
return ret;
} }
|
public class class_name {
public static Locale getLocale() {
final Locale ret = LOCALE.get();
if (null == ret) {
return Latkes.getLocale(); // depends on control dependency: [if], data = [none]
}
return ret;
} }
|
public class class_name {
@Override
public void publish(String channel, Tree message) {
if (connected.get()) {
try {
if (debug && (debugHeartbeats || !channel.endsWith(heartbeatChannel))) {
logger.info("Submitting message to channel \"" + channel + "\":\r\n" + message.toString());
}
byte[] bytes = serializer.write(message);
PubsubMessage msg = PubsubMessage.newBuilder().setData(ByteString.copyFrom(bytes)).build();
getOrCreatePublisher(channel).publish(msg);
} catch (Exception cause) {
logger.warn("Unable to send message to Google Cloud service!", cause);
}
}
} }
|
public class class_name {
@Override
public void publish(String channel, Tree message) {
if (connected.get()) {
try {
if (debug && (debugHeartbeats || !channel.endsWith(heartbeatChannel))) {
logger.info("Submitting message to channel \"" + channel + "\":\r\n" + message.toString());
// depends on control dependency: [if], data = [none]
}
byte[] bytes = serializer.write(message);
PubsubMessage msg = PubsubMessage.newBuilder().setData(ByteString.copyFrom(bytes)).build();
getOrCreatePublisher(channel).publish(msg);
// depends on control dependency: [try], data = [none]
} catch (Exception cause) {
logger.warn("Unable to send message to Google Cloud service!", cause);
}
// depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static String getFirstFreeBusLineName(BusNetwork network) {
if (network == null) {
return null;
}
int nb = network.getBusLineCount();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (network.getBusLine(name) != null);
return name;
} }
|
public class class_name {
public static String getFirstFreeBusLineName(BusNetwork network) {
if (network == null) {
return null; // depends on control dependency: [if], data = [none]
}
int nb = network.getBusLineCount();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (network.getBusLine(name) != null);
return name;
} }
|
public class class_name {
@VisibleForTesting
static int getNextAvailablePort(InetAddress address, PortAllocator portAllocator) {
for (int i = 0; i < PORT_MAX_TRIES; i++) {
int port = portAllocator.getAvailable(address);
if (isValidPort(port)) {
PORTS_ALREADY_ALLOCATED.add(port);
return port;
}
}
throw new IllegalStateException("Fail to find an available port on " + address);
} }
|
public class class_name {
@VisibleForTesting
static int getNextAvailablePort(InetAddress address, PortAllocator portAllocator) {
for (int i = 0; i < PORT_MAX_TRIES; i++) {
int port = portAllocator.getAvailable(address);
if (isValidPort(port)) {
PORTS_ALREADY_ALLOCATED.add(port); // depends on control dependency: [if], data = [none]
return port; // depends on control dependency: [if], data = [none]
}
}
throw new IllegalStateException("Fail to find an available port on " + address);
} }
|
public class class_name {
@Override
@SuppressWarnings("checkstyle:illegalcatch") // Catch throwable to feed it to error handler
public void close() {
LOG.entering(CLASS_NAME, "close");
try {
this.clock.close();
} catch (final Throwable ex) {
LOG.log(Level.SEVERE, "Error while closing the clock", ex);
try {
this.errorHandler.onNext(ex);
} catch (final Throwable exHandling) {
LOG.log(Level.SEVERE, "Error while handling the exception " + ex, exHandling);
}
} finally {
try {
this.errorHandler.close();
} catch (final Throwable ex) {
LOG.log(Level.SEVERE, "Error while closing the error handler", ex);
}
}
LOG.exiting(CLASS_NAME, "close");
} }
|
public class class_name {
@Override
@SuppressWarnings("checkstyle:illegalcatch") // Catch throwable to feed it to error handler
public void close() {
LOG.entering(CLASS_NAME, "close");
try {
this.clock.close(); // depends on control dependency: [try], data = [none]
} catch (final Throwable ex) {
LOG.log(Level.SEVERE, "Error while closing the clock", ex);
try {
this.errorHandler.onNext(ex); // depends on control dependency: [try], data = [none]
} catch (final Throwable exHandling) {
LOG.log(Level.SEVERE, "Error while handling the exception " + ex, exHandling);
} // depends on control dependency: [catch], data = [none]
} finally { // depends on control dependency: [catch], data = [none]
try {
this.errorHandler.close(); // depends on control dependency: [try], data = [none]
} catch (final Throwable ex) {
LOG.log(Level.SEVERE, "Error while closing the error handler", ex);
} // depends on control dependency: [catch], data = [none]
}
LOG.exiting(CLASS_NAME, "close");
} }
|
public class class_name {
public static Class<?> getGenericMultivalueType(final Field p) {
if (p.getType() instanceof Class<?>) {
final Type genericType = p.getGenericType();
if (genericType != null && genericType instanceof ParameterizedType) {
final ParameterizedType pt = (ParameterizedType) genericType;
if (pt.getActualTypeArguments() != null && pt.getActualTypeArguments().length > 0) {
if (((Class<?>) pt.getRawType()).isAssignableFrom(Map.class)) {
if (pt.getActualTypeArguments()[1] instanceof Class<?>) {
return (Class<?>) pt.getActualTypeArguments()[1];
} else if (pt.getActualTypeArguments()[1] instanceof ParameterizedType)
return (Class<?>) ((ParameterizedType) pt.getActualTypeArguments()[1]).getRawType();
} else if (pt.getActualTypeArguments()[0] instanceof Class<?>) {
return (Class<?>) pt.getActualTypeArguments()[0];
} else if (pt.getActualTypeArguments()[0] instanceof ParameterizedType)
return (Class<?>) ((ParameterizedType) pt.getActualTypeArguments()[0]).getRawType();
}
} else if (p.getType().isArray())
return p.getType().getComponentType();
}
return null;
} }
|
public class class_name {
public static Class<?> getGenericMultivalueType(final Field p) {
if (p.getType() instanceof Class<?>) {
final Type genericType = p.getGenericType();
if (genericType != null && genericType instanceof ParameterizedType) {
final ParameterizedType pt = (ParameterizedType) genericType;
if (pt.getActualTypeArguments() != null && pt.getActualTypeArguments().length > 0) {
if (((Class<?>) pt.getRawType()).isAssignableFrom(Map.class)) {
if (pt.getActualTypeArguments()[1] instanceof Class<?>) {
return (Class<?>) pt.getActualTypeArguments()[1]; // depends on control dependency: [if], data = [)]
} else if (pt.getActualTypeArguments()[1] instanceof ParameterizedType)
return (Class<?>) ((ParameterizedType) pt.getActualTypeArguments()[1]).getRawType();
} else if (pt.getActualTypeArguments()[0] instanceof Class<?>) {
return (Class<?>) pt.getActualTypeArguments()[0]; // depends on control dependency: [if], data = [)]
} else if (pt.getActualTypeArguments()[0] instanceof ParameterizedType)
return (Class<?>) ((ParameterizedType) pt.getActualTypeArguments()[0]).getRawType();
}
} else if (p.getType().isArray())
return p.getType().getComponentType();
}
return null;
} }
|
public class class_name {
public static Months ofYears(int years) {
if (years == 0) {
return ZERO;
}
return new Months(Math.multiplyExact(years, MONTHS_PER_YEAR));
} }
|
public class class_name {
public static Months ofYears(int years) {
if (years == 0) {
return ZERO; // depends on control dependency: [if], data = [none]
}
return new Months(Math.multiplyExact(years, MONTHS_PER_YEAR));
} }
|
public class class_name {
private static String getEndpointName(Field field) {
if (field.getAnnotation(CitrusEndpoint.class) != null && StringUtils.hasText(field.getAnnotation(CitrusEndpoint.class).name())) {
return field.getAnnotation(CitrusEndpoint.class).name();
}
return field.getName();
} }
|
public class class_name {
private static String getEndpointName(Field field) {
if (field.getAnnotation(CitrusEndpoint.class) != null && StringUtils.hasText(field.getAnnotation(CitrusEndpoint.class).name())) {
return field.getAnnotation(CitrusEndpoint.class).name(); // depends on control dependency: [if], data = [none]
}
return field.getName();
} }
|
public class class_name {
protected int getFeatureCountLabelIndices(Set<Integer> iLabels, double threshold, boolean useMagnitude)
{
int n = 0;
for (int feat = 0; feat < weights.length; feat++) {
for (int labIndex:iLabels) {
double thisWeight = (useMagnitude)? Math.abs(weights[feat][labIndex]):weights[feat][labIndex];
if (thisWeight > threshold) {
n++;
}
}
}
return n;
} }
|
public class class_name {
protected int getFeatureCountLabelIndices(Set<Integer> iLabels, double threshold, boolean useMagnitude)
{
int n = 0;
for (int feat = 0; feat < weights.length; feat++) {
for (int labIndex:iLabels) {
double thisWeight = (useMagnitude)? Math.abs(weights[feat][labIndex]):weights[feat][labIndex];
if (thisWeight > threshold) {
n++;
// depends on control dependency: [if], data = [none]
}
}
}
return n;
} }
|
public class class_name {
public Date getBaselineFinish()
{
Object result = getCachedValue(TaskField.BASELINE_FINISH);
if (result == null)
{
result = getCachedValue(TaskField.BASELINE_ESTIMATED_FINISH);
}
if (!(result instanceof Date))
{
result = null;
}
return (Date) result;
} }
|
public class class_name {
public Date getBaselineFinish()
{
Object result = getCachedValue(TaskField.BASELINE_FINISH);
if (result == null)
{
result = getCachedValue(TaskField.BASELINE_ESTIMATED_FINISH); // depends on control dependency: [if], data = [none]
}
if (!(result instanceof Date))
{
result = null; // depends on control dependency: [if], data = [none]
}
return (Date) result;
} }
|
public class class_name {
public void setProxyBranchTimeout(int seconds) {
if(logger.isDebugEnabled()) {
logger.debug("setProxyBranchTimeout");
}
if(seconds<=0)
throw new IllegalArgumentException("Negative or zero timeout not allowed");
if(isCanceled() || isTimedOut()) {
logger.error("Cancelled or timed out proxy branch should not be updated with new timeout values");
return;
}
this.proxyBranchTimeout = seconds;
if(this.started) updateTimer(false, originalRequest.getSipApplicationSession(false));
} }
|
public class class_name {
public void setProxyBranchTimeout(int seconds) {
if(logger.isDebugEnabled()) {
logger.debug("setProxyBranchTimeout"); // depends on control dependency: [if], data = [none]
}
if(seconds<=0)
throw new IllegalArgumentException("Negative or zero timeout not allowed");
if(isCanceled() || isTimedOut()) {
logger.error("Cancelled or timed out proxy branch should not be updated with new timeout values"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.proxyBranchTimeout = seconds;
if(this.started) updateTimer(false, originalRequest.getSipApplicationSession(false));
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <V, T extends Enum & Option> V parseValue(final T option, final String value) {
Preconditions.checkState(StringUtils.isNotBlank(value),
"Empty value is not allowed for option %s", option);
try {
return (V) StringConverter.convert(option.getType(), value);
} catch (Exception ex) {
throw new IllegalStateException(String.format("Failed to convert '%s' value for option %s.%s",
value, option.getDeclaringClass().getSimpleName(), option), ex);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <V, T extends Enum & Option> V parseValue(final T option, final String value) {
Preconditions.checkState(StringUtils.isNotBlank(value),
"Empty value is not allowed for option %s", option);
try {
return (V) StringConverter.convert(option.getType(), value); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw new IllegalStateException(String.format("Failed to convert '%s' value for option %s.%s",
value, option.getDeclaringClass().getSimpleName(), option), ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public JobRequest addParameters(Map<String, String> prms)
{
for (Map.Entry<String, String> e : prms.entrySet())
{
validateParameter(e.getKey(), e.getValue());
}
parameters.putAll(prms);
return this;
} }
|
public class class_name {
public JobRequest addParameters(Map<String, String> prms)
{
for (Map.Entry<String, String> e : prms.entrySet())
{
validateParameter(e.getKey(), e.getValue()); // depends on control dependency: [for], data = [e]
}
parameters.putAll(prms);
return this;
} }
|
public class class_name {
public static List<Class<? extends CompressionCodec>> getCodecClasses(Configuration conf) {
String codecsString = conf.get("io.compression.codecs");
if (codecsString != null) {
List<Class<? extends CompressionCodec>> result
= new ArrayList<Class<? extends CompressionCodec>>();
StringTokenizer codecSplit = new StringTokenizer(codecsString, ",");
while (codecSplit.hasMoreElements()) {
String codecSubstring = codecSplit.nextToken();
if (codecSubstring.length() != 0) {
try {
Class<?> cls = conf.getClassByName(codecSubstring);
if (!CompressionCodec.class.isAssignableFrom(cls)) {
throw new IllegalArgumentException("Class " + codecSubstring +
" is not a CompressionCodec");
}
result.add(cls.asSubclass(CompressionCodec.class));
} catch (ClassNotFoundException ex) {
throw new IllegalArgumentException("Compression codec " +
codecSubstring + " not found.",
ex);
}
}
}
return result;
} else {
return null;
}
} }
|
public class class_name {
public static List<Class<? extends CompressionCodec>> getCodecClasses(Configuration conf) {
String codecsString = conf.get("io.compression.codecs");
if (codecsString != null) {
List<Class<? extends CompressionCodec>> result
= new ArrayList<Class<? extends CompressionCodec>>(); // depends on control dependency: [if], data = [none]
StringTokenizer codecSplit = new StringTokenizer(codecsString, ",");
while (codecSplit.hasMoreElements()) {
String codecSubstring = codecSplit.nextToken();
if (codecSubstring.length() != 0) {
try {
Class<?> cls = conf.getClassByName(codecSubstring);
if (!CompressionCodec.class.isAssignableFrom(cls)) {
throw new IllegalArgumentException("Class " + codecSubstring +
" is not a CompressionCodec");
}
result.add(cls.asSubclass(CompressionCodec.class)); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException ex) {
throw new IllegalArgumentException("Compression codec " +
codecSubstring + " not found.",
ex);
} // depends on control dependency: [catch], data = [none]
}
}
return result; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void record(long amount) {
if (amount >= 0) {
totalAmount.increment(amount);
count.increment();
max.update(amount);
min.update(amount);
}
} }
|
public class class_name {
public void record(long amount) {
if (amount >= 0) {
totalAmount.increment(amount); // depends on control dependency: [if], data = [(amount]
count.increment(); // depends on control dependency: [if], data = [none]
max.update(amount); // depends on control dependency: [if], data = [(amount]
min.update(amount); // depends on control dependency: [if], data = [(amount]
}
} }
|
public class class_name {
public static String decode(String s) {
int n = s.length();
if ((n == 0) || (s.indexOf('%') < 0))
return s;
StringBuilder sb = new StringBuilder(n);
ByteBuffer bb = ByteBuffer.allocate(n);
CharBuffer cb = CharBuffer.allocate(n);
CharsetDecoder dec = ThreadLocalCoders.decoderFor("UTF-8")
.onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
char c = s.charAt(0);
for (int i = 0; i < n;) {
assert c == s.charAt(i);
if (c != '%') {
sb.append(c);
if (++i >= n)
break;
c = s.charAt(i);
continue;
}
bb.clear();
int ui = i;
for (;;) {
assert (n - i >= 2);
try {
bb.put(unescape(s, i));
} catch (NumberFormatException e) {
throw new IllegalArgumentException();
}
i += 3;
if (i >= n)
break;
c = s.charAt(i);
if (c != '%')
break;
}
bb.flip();
cb.clear();
dec.reset();
CoderResult cr = dec.decode(bb, cb, true);
if (cr.isError())
throw new IllegalArgumentException("Error decoding percent encoded characters");
cr = dec.flush(cb);
if (cr.isError())
throw new IllegalArgumentException("Error decoding percent encoded characters");
sb.append(cb.flip().toString());
}
return sb.toString();
} }
|
public class class_name {
public static String decode(String s) {
int n = s.length();
if ((n == 0) || (s.indexOf('%') < 0))
return s;
StringBuilder sb = new StringBuilder(n);
ByteBuffer bb = ByteBuffer.allocate(n);
CharBuffer cb = CharBuffer.allocate(n);
CharsetDecoder dec = ThreadLocalCoders.decoderFor("UTF-8")
.onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
char c = s.charAt(0);
for (int i = 0; i < n;) {
assert c == s.charAt(i);
if (c != '%') {
sb.append(c);
if (++i >= n)
break;
c = s.charAt(i);
continue;
}
bb.clear();
int ui = i;
for (;;) {
assert (n - i >= 2); // depends on control dependency: [for], data = [i]
try {
bb.put(unescape(s, i)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new IllegalArgumentException();
} // depends on control dependency: [catch], data = [none]
i += 3; // depends on control dependency: [for], data = [i]
if (i >= n)
break;
c = s.charAt(i); // depends on control dependency: [for], data = [i]
if (c != '%')
break;
}
bb.flip();
cb.clear();
dec.reset();
CoderResult cr = dec.decode(bb, cb, true);
if (cr.isError())
throw new IllegalArgumentException("Error decoding percent encoded characters");
cr = dec.flush(cb);
if (cr.isError())
throw new IllegalArgumentException("Error decoding percent encoded characters");
sb.append(cb.flip().toString());
}
return sb.toString();
} }
|
public class class_name {
private static JsonObject getFieldOperationJsonObject(FieldOperation fieldOperation) {
JsonObject jsonObject = new JsonObject();
jsonObject.add("op", fieldOperation.getOp().toString());
String fieldKey = fieldOperation.getFieldKey();
if (fieldKey != null) {
jsonObject.add("fieldKey", fieldKey);
}
Field field = fieldOperation.getData();
if (field != null) {
JsonObject fieldObj = new JsonObject();
String type = field.getType();
if (type != null) {
fieldObj.add("type", type);
}
String key = field.getKey();
if (key != null) {
fieldObj.add("key", key);
}
String displayName = field.getDisplayName();
if (displayName != null) {
fieldObj.add("displayName", displayName);
}
String description = field.getDescription();
if (description != null) {
fieldObj.add("description", description);
}
Boolean hidden = field.getIsHidden();
if (hidden != null) {
fieldObj.add("hidden", hidden);
}
List<String> options = field.getOptions();
if (options != null) {
JsonArray array = new JsonArray();
for (String option: options) {
JsonObject optionObj = new JsonObject();
optionObj.add("key", option);
array.add(optionObj);
}
fieldObj.add("options", array);
}
jsonObject.add("data", fieldObj);
}
List<String> fieldKeys = fieldOperation.getFieldKeys();
if (fieldKeys != null) {
jsonObject.add("fieldKeys", getJsonArray(fieldKeys));
}
List<String> enumOptionKeys = fieldOperation.getEnumOptionKeys();
if (enumOptionKeys != null) {
jsonObject.add("enumOptionKeys", getJsonArray(enumOptionKeys));
}
String enumOptionKey = fieldOperation.getEnumOptionKey();
if (enumOptionKey != null) {
jsonObject.add("enumOptionKey", enumOptionKey);
}
String multiSelectOptionKey = fieldOperation.getMultiSelectOptionKey();
if (multiSelectOptionKey != null) {
jsonObject.add("multiSelectOptionKey", multiSelectOptionKey);
}
List<String> multiSelectOptionKeys = fieldOperation.getMultiSelectOptionKeys();
if (multiSelectOptionKeys != null) {
jsonObject.add("multiSelectOptionKeys", getJsonArray(multiSelectOptionKeys));
}
return jsonObject;
} }
|
public class class_name {
private static JsonObject getFieldOperationJsonObject(FieldOperation fieldOperation) {
JsonObject jsonObject = new JsonObject();
jsonObject.add("op", fieldOperation.getOp().toString());
String fieldKey = fieldOperation.getFieldKey();
if (fieldKey != null) {
jsonObject.add("fieldKey", fieldKey); // depends on control dependency: [if], data = [none]
}
Field field = fieldOperation.getData();
if (field != null) {
JsonObject fieldObj = new JsonObject();
String type = field.getType();
if (type != null) {
fieldObj.add("type", type); // depends on control dependency: [if], data = [none]
}
String key = field.getKey();
if (key != null) {
fieldObj.add("key", key); // depends on control dependency: [if], data = [none]
}
String displayName = field.getDisplayName();
if (displayName != null) {
fieldObj.add("displayName", displayName); // depends on control dependency: [if], data = [none]
}
String description = field.getDescription();
if (description != null) {
fieldObj.add("description", description); // depends on control dependency: [if], data = [none]
}
Boolean hidden = field.getIsHidden();
if (hidden != null) {
fieldObj.add("hidden", hidden); // depends on control dependency: [if], data = [none]
}
List<String> options = field.getOptions();
if (options != null) {
JsonArray array = new JsonArray();
for (String option: options) {
JsonObject optionObj = new JsonObject();
optionObj.add("key", option); // depends on control dependency: [for], data = [option]
array.add(optionObj); // depends on control dependency: [for], data = [option]
}
fieldObj.add("options", array); // depends on control dependency: [if], data = [none]
}
jsonObject.add("data", fieldObj); // depends on control dependency: [if], data = [none]
}
List<String> fieldKeys = fieldOperation.getFieldKeys();
if (fieldKeys != null) {
jsonObject.add("fieldKeys", getJsonArray(fieldKeys)); // depends on control dependency: [if], data = [(fieldKeys]
}
List<String> enumOptionKeys = fieldOperation.getEnumOptionKeys();
if (enumOptionKeys != null) {
jsonObject.add("enumOptionKeys", getJsonArray(enumOptionKeys)); // depends on control dependency: [if], data = [(enumOptionKeys]
}
String enumOptionKey = fieldOperation.getEnumOptionKey();
if (enumOptionKey != null) {
jsonObject.add("enumOptionKey", enumOptionKey); // depends on control dependency: [if], data = [none]
}
String multiSelectOptionKey = fieldOperation.getMultiSelectOptionKey();
if (multiSelectOptionKey != null) {
jsonObject.add("multiSelectOptionKey", multiSelectOptionKey); // depends on control dependency: [if], data = [none]
}
List<String> multiSelectOptionKeys = fieldOperation.getMultiSelectOptionKeys();
if (multiSelectOptionKeys != null) {
jsonObject.add("multiSelectOptionKeys", getJsonArray(multiSelectOptionKeys)); // depends on control dependency: [if], data = [(multiSelectOptionKeys]
}
return jsonObject;
} }
|
public class class_name {
protected JwtClaims buildJwtClaims(final HttpServletRequest request,
final AccessToken accessTokenId,
final long timeoutInSeconds,
final OidcRegisteredService service,
final UserProfile profile,
final J2EContext context,
final OAuth20ResponseTypes responseType) {
val authentication = accessTokenId.getAuthentication();
val principal = authentication.getPrincipal();
val oidc = getConfigurationContext().getCasProperties().getAuthn().getOidc();
val claims = new JwtClaims();
val jwtId = getJwtId(accessTokenId.getTicketGrantingTicket());
claims.setJwtId(jwtId);
claims.setIssuer(oidc.getIssuer());
claims.setAudience(accessTokenId.getClientId());
val expirationDate = NumericDate.now();
expirationDate.addSeconds(timeoutInSeconds);
claims.setExpirationTime(expirationDate);
claims.setIssuedAtToNow();
claims.setNotBeforeMinutesInThePast(oidc.getSkew());
claims.setSubject(principal.getId());
val mfa = getConfigurationContext().getCasProperties().getAuthn().getMfa();
val attributes = authentication.getAttributes();
if (attributes.containsKey(mfa.getAuthenticationContextAttribute())) {
val val = CollectionUtils.toCollection(attributes.get(mfa.getAuthenticationContextAttribute()));
claims.setStringClaim(OidcConstants.ACR, val.iterator().next().toString());
}
if (attributes.containsKey(AuthenticationHandler.SUCCESSFUL_AUTHENTICATION_HANDLERS)) {
val val = CollectionUtils.toCollection(attributes.get(AuthenticationHandler.SUCCESSFUL_AUTHENTICATION_HANDLERS));
claims.setStringListClaim(OidcConstants.AMR, val.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
}
claims.setStringClaim(OAuth20Constants.CLIENT_ID, service.getClientId());
if (attributes.containsKey(OAuth20Constants.STATE)) {
claims.setClaim(OAuth20Constants.STATE, attributes.get(OAuth20Constants.STATE).get(0));
}
if (attributes.containsKey(OAuth20Constants.NONCE)) {
claims.setClaim(OAuth20Constants.NONCE, attributes.get(OAuth20Constants.NONCE).get(0));
}
claims.setClaim(OidcConstants.CLAIM_AT_HASH, generateAccessTokenHash(accessTokenId, service));
LOGGER.trace("Comparing principal attributes [{}] with supported claims [{}]", principal.getAttributes(), oidc.getClaims());
principal.getAttributes().entrySet().stream()
.filter(entry -> {
if (oidc.getClaims().contains(entry.getKey())) {
LOGGER.trace("Found supported claim [{}]", entry.getKey());
return true;
}
LOGGER.warn("Claim [{}] is not defined as a supported claim in CAS configuration. Skipping...", entry.getKey());
return false;
})
.forEach(entry -> claims.setClaim(entry.getKey(), entry.getValue()));
if (!claims.hasClaim(OidcConstants.CLAIM_PREFERRED_USERNAME)) {
claims.setClaim(OidcConstants.CLAIM_PREFERRED_USERNAME, profile.getId());
}
return claims;
} }
|
public class class_name {
protected JwtClaims buildJwtClaims(final HttpServletRequest request,
final AccessToken accessTokenId,
final long timeoutInSeconds,
final OidcRegisteredService service,
final UserProfile profile,
final J2EContext context,
final OAuth20ResponseTypes responseType) {
val authentication = accessTokenId.getAuthentication();
val principal = authentication.getPrincipal();
val oidc = getConfigurationContext().getCasProperties().getAuthn().getOidc();
val claims = new JwtClaims();
val jwtId = getJwtId(accessTokenId.getTicketGrantingTicket());
claims.setJwtId(jwtId);
claims.setIssuer(oidc.getIssuer());
claims.setAudience(accessTokenId.getClientId());
val expirationDate = NumericDate.now();
expirationDate.addSeconds(timeoutInSeconds);
claims.setExpirationTime(expirationDate);
claims.setIssuedAtToNow();
claims.setNotBeforeMinutesInThePast(oidc.getSkew());
claims.setSubject(principal.getId());
val mfa = getConfigurationContext().getCasProperties().getAuthn().getMfa();
val attributes = authentication.getAttributes();
if (attributes.containsKey(mfa.getAuthenticationContextAttribute())) {
val val = CollectionUtils.toCollection(attributes.get(mfa.getAuthenticationContextAttribute()));
claims.setStringClaim(OidcConstants.ACR, val.iterator().next().toString()); // depends on control dependency: [if], data = [none]
}
if (attributes.containsKey(AuthenticationHandler.SUCCESSFUL_AUTHENTICATION_HANDLERS)) {
val val = CollectionUtils.toCollection(attributes.get(AuthenticationHandler.SUCCESSFUL_AUTHENTICATION_HANDLERS));
claims.setStringListClaim(OidcConstants.AMR, val.toArray(ArrayUtils.EMPTY_STRING_ARRAY)); // depends on control dependency: [if], data = [none]
}
claims.setStringClaim(OAuth20Constants.CLIENT_ID, service.getClientId());
if (attributes.containsKey(OAuth20Constants.STATE)) {
claims.setClaim(OAuth20Constants.STATE, attributes.get(OAuth20Constants.STATE).get(0)); // depends on control dependency: [if], data = [none]
}
if (attributes.containsKey(OAuth20Constants.NONCE)) {
claims.setClaim(OAuth20Constants.NONCE, attributes.get(OAuth20Constants.NONCE).get(0)); // depends on control dependency: [if], data = [none]
}
claims.setClaim(OidcConstants.CLAIM_AT_HASH, generateAccessTokenHash(accessTokenId, service));
LOGGER.trace("Comparing principal attributes [{}] with supported claims [{}]", principal.getAttributes(), oidc.getClaims());
principal.getAttributes().entrySet().stream()
.filter(entry -> {
if (oidc.getClaims().contains(entry.getKey())) {
LOGGER.trace("Found supported claim [{}]", entry.getKey());
return true;
}
LOGGER.warn("Claim [{}] is not defined as a supported claim in CAS configuration. Skipping...", entry.getKey());
return false;
})
.forEach(entry -> claims.setClaim(entry.getKey(), entry.getValue()));
if (!claims.hasClaim(OidcConstants.CLAIM_PREFERRED_USERNAME)) {
claims.setClaim(OidcConstants.CLAIM_PREFERRED_USERNAME, profile.getId());
}
return claims;
} }
|
public class class_name {
public Observable<ServiceResponse<Void>> disableAllForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (siteName == null) {
throw new IllegalArgumentException("Parameter siteName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.disableAllForWebApp(resourceGroupName, siteName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = disableAllForWebAppDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Void>> disableAllForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (siteName == null) {
throw new IllegalArgumentException("Parameter siteName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.disableAllForWebApp(resourceGroupName, siteName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = disableAllForWebAppDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public void setChartRotation(int rotation, boolean isAnimated) {
if (isAnimated) {
rotationAnimator.cancelAnimation();
rotationAnimator.startAnimation(pieChartRenderer.getChartRotation(), rotation);
} else {
pieChartRenderer.setChartRotation(rotation);
}
ViewCompat.postInvalidateOnAnimation(this);
} }
|
public class class_name {
public void setChartRotation(int rotation, boolean isAnimated) {
if (isAnimated) {
rotationAnimator.cancelAnimation(); // depends on control dependency: [if], data = [none]
rotationAnimator.startAnimation(pieChartRenderer.getChartRotation(), rotation); // depends on control dependency: [if], data = [none]
} else {
pieChartRenderer.setChartRotation(rotation); // depends on control dependency: [if], data = [none]
}
ViewCompat.postInvalidateOnAnimation(this);
} }
|
public class class_name {
private static String concat(Collection<String> col)
{
StringBuilder b = new StringBuilder();
boolean first = true;
for (String s : col)
{
if (first)
first = false;
else
b.append(";");
b.append(s);
}
return b.toString();
} }
|
public class class_name {
private static String concat(Collection<String> col)
{
StringBuilder b = new StringBuilder();
boolean first = true;
for (String s : col)
{
if (first)
first = false;
else
b.append(";");
b.append(s); // depends on control dependency: [for], data = [s]
}
return b.toString();
} }
|
public class class_name {
public static TSInterfaceType getNestedInterface(TSType type, String name, boolean create) {
TSModule module = getNestedTypeContainer(type, create);
if (module == null && !create) {
return null;
} else if (module == null) {
throw new IllegalStateException("cannot setup interface as no parent container is available");
}
for (TSElement element : module.getElements()) {
if (element instanceof TSInterfaceType && ((TSInterfaceType) element).getName().equals(name)) {
return (TSInterfaceType) element;
}
}
if (create) {
TSInterfaceType interfaceType = new TSInterfaceType();
interfaceType.setExported(true);
interfaceType.setName(name);
interfaceType.setParent(module);
module.getElements().add(interfaceType);
return interfaceType;
} else {
return null;
}
} }
|
public class class_name {
public static TSInterfaceType getNestedInterface(TSType type, String name, boolean create) {
TSModule module = getNestedTypeContainer(type, create);
if (module == null && !create) {
return null; // depends on control dependency: [if], data = [none]
} else if (module == null) {
throw new IllegalStateException("cannot setup interface as no parent container is available");
}
for (TSElement element : module.getElements()) {
if (element instanceof TSInterfaceType && ((TSInterfaceType) element).getName().equals(name)) {
return (TSInterfaceType) element; // depends on control dependency: [if], data = [none]
}
}
if (create) {
TSInterfaceType interfaceType = new TSInterfaceType();
interfaceType.setExported(true); // depends on control dependency: [if], data = [none]
interfaceType.setName(name); // depends on control dependency: [if], data = [none]
interfaceType.setParent(module); // depends on control dependency: [if], data = [none]
module.getElements().add(interfaceType); // depends on control dependency: [if], data = [none]
return interfaceType; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public T remove(int index)
{
if (size == 0) {
return null;
}
final T old = elementData[index];
final int numMoved = size - index - 1;
if (numMoved > 0) {
System.arraycopy(elementData, index + 1, elementData, index, numMoved);
}
elementData[--size] = null;
return old;
} }
|
public class class_name {
@Override
public T remove(int index)
{
if (size == 0) {
return null; // depends on control dependency: [if], data = [none]
}
final T old = elementData[index];
final int numMoved = size - index - 1;
if (numMoved > 0) {
System.arraycopy(elementData, index + 1, elementData, index, numMoved); // depends on control dependency: [if], data = [none]
}
elementData[--size] = null;
return old;
} }
|
public class class_name {
public List<WebElement> getElements() {
List<WebElement> foundElements = null;
try {
if (parent == null) {
foundElements = HtmlElementUtils.locateElements(getLocator());
} else {
foundElements = parent.locateChildElements(getLocator());
}
} catch (NoSuchElementException n) {
addInfoForNoSuchElementException(n);
}
return foundElements;
} }
|
public class class_name {
public List<WebElement> getElements() {
List<WebElement> foundElements = null;
try {
if (parent == null) {
foundElements = HtmlElementUtils.locateElements(getLocator()); // depends on control dependency: [if], data = [none]
} else {
foundElements = parent.locateChildElements(getLocator()); // depends on control dependency: [if], data = [none]
}
} catch (NoSuchElementException n) {
addInfoForNoSuchElementException(n);
} // depends on control dependency: [catch], data = [none]
return foundElements;
} }
|
public class class_name {
@Override
public String getParameter(String arg0) {
try {
collaborator.preInvoke(componentMetaData);
return request.getParameter(arg0);
} finally {
collaborator.postInvoke();
}
} }
|
public class class_name {
@Override
public String getParameter(String arg0) {
try {
collaborator.preInvoke(componentMetaData); // depends on control dependency: [try], data = [none]
return request.getParameter(arg0); // depends on control dependency: [try], data = [none]
} finally {
collaborator.postInvoke();
}
} }
|
public class class_name {
public void initPopulation() {
for (int i = 0; i < populationSize; i++) {
S newSolution = problem.createSolution();
problem.evaluate(newSolution);
evaluations++;
population.add(newSolution);
subregionIdx[i][i] = 1;
}
} }
|
public class class_name {
public void initPopulation() {
for (int i = 0; i < populationSize; i++) {
S newSolution = problem.createSolution();
problem.evaluate(newSolution); // depends on control dependency: [for], data = [none]
evaluations++; // depends on control dependency: [for], data = [none]
population.add(newSolution); // depends on control dependency: [for], data = [none]
subregionIdx[i][i] = 1; // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public static ColumnSlice[] deoverlapSlices(ColumnSlice[] slices, final Comparator<Composite> comparator)
{
if (slices.length <= 1)
return slices;
Arrays.sort(slices, new Comparator<ColumnSlice>()
{
@Override
public int compare(ColumnSlice s1, ColumnSlice s2)
{
if (s1.start.isEmpty() || s2.start.isEmpty())
{
if (s1.start.isEmpty() != s2.start.isEmpty())
return s1.start.isEmpty() ? -1 : 1;
}
else
{
int c = comparator.compare(s1.start, s2.start);
if (c != 0)
return c;
}
// For the finish, empty always means greater
return s1.finish.isEmpty() || s2.finish.isEmpty()
? (s1.finish.isEmpty() ? 1 : -1)
: comparator.compare(s1.finish, s2.finish);
}
});
List<ColumnSlice> slicesCopy = new ArrayList<>(slices.length);
ColumnSlice last = slices[0];
for (int i = 1; i < slices.length; i++)
{
ColumnSlice s2 = slices[i];
boolean includesStart = last.includes(comparator, s2.start);
boolean includesFinish = s2.finish.isEmpty() ? last.finish.isEmpty() : last.includes(comparator, s2.finish);
if (includesStart && includesFinish)
continue;
if (!includesStart && !includesFinish)
{
slicesCopy.add(last);
last = s2;
continue;
}
if (includesStart)
{
last = new ColumnSlice(last.start, s2.finish);
continue;
}
assert !includesFinish;
}
slicesCopy.add(last);
return slicesCopy.toArray(new ColumnSlice[slicesCopy.size()]);
} }
|
public class class_name {
public static ColumnSlice[] deoverlapSlices(ColumnSlice[] slices, final Comparator<Composite> comparator)
{
if (slices.length <= 1)
return slices;
Arrays.sort(slices, new Comparator<ColumnSlice>()
{
@Override
public int compare(ColumnSlice s1, ColumnSlice s2)
{
if (s1.start.isEmpty() || s2.start.isEmpty())
{
if (s1.start.isEmpty() != s2.start.isEmpty())
return s1.start.isEmpty() ? -1 : 1;
}
else
{
int c = comparator.compare(s1.start, s2.start);
if (c != 0)
return c;
}
// For the finish, empty always means greater
return s1.finish.isEmpty() || s2.finish.isEmpty()
? (s1.finish.isEmpty() ? 1 : -1)
: comparator.compare(s1.finish, s2.finish);
}
});
List<ColumnSlice> slicesCopy = new ArrayList<>(slices.length);
ColumnSlice last = slices[0];
for (int i = 1; i < slices.length; i++)
{
ColumnSlice s2 = slices[i];
boolean includesStart = last.includes(comparator, s2.start);
boolean includesFinish = s2.finish.isEmpty() ? last.finish.isEmpty() : last.includes(comparator, s2.finish);
if (includesStart && includesFinish)
continue;
if (!includesStart && !includesFinish)
{
slicesCopy.add(last); // depends on control dependency: [if], data = [none]
last = s2; // depends on control dependency: [if], data = [none]
continue;
}
if (includesStart)
{
last = new ColumnSlice(last.start, s2.finish); // depends on control dependency: [if], data = [none]
continue;
}
assert !includesFinish;
}
slicesCopy.add(last);
return slicesCopy.toArray(new ColumnSlice[slicesCopy.size()]);
} }
|
public class class_name {
public static Optional<ElementKind> resolveKind(Element element, ElementKind expected) {
final Optional<ElementKind> elementKind = resolveKind(element);
if (elementKind.isPresent() && elementKind.get() == expected) {
return elementKind;
}
return Optional.empty();
} }
|
public class class_name {
public static Optional<ElementKind> resolveKind(Element element, ElementKind expected) {
final Optional<ElementKind> elementKind = resolveKind(element);
if (elementKind.isPresent() && elementKind.get() == expected) {
return elementKind; // depends on control dependency: [if], data = [none]
}
return Optional.empty();
} }
|
public class class_name {
private boolean shouldDisplayTooltipAbove() {
boolean displayAbove;
if (isSimpleValue()) {
Direction direction = Direction.none;
if (m_widget instanceof I_CmsHasDisplayDirection) {
direction = ((I_CmsHasDisplayDirection)m_widget).getDisplayingDirection();
}
switch (direction) {
case above:
displayAbove = true;
break;
case below:
case none:
default:
displayAbove = true;
break;
}
} else {
displayAbove = true;
}
m_helpBubble.getStyle().setDisplay(Display.BLOCK);
int bubbleHeight = m_helpBubble.getOffsetHeight();
m_helpBubble.getStyle().clearDisplay();
Element widgetElement = m_widget.asWidget().getElement();
// Calculate top position for the popup
int top = widgetElement.getAbsoluteTop();
int windowTop = Window.getScrollTop();
int windowBottom = Window.getScrollTop() + Window.getClientHeight();
CmsDebugLog.consoleLog("window bottom: " + windowBottom + " window height: " + Window.getClientHeight());
int distanceFromWindowTop = top - windowTop - TOOLBAR_HEIGHT;
int distanceToWindowBottom = windowBottom - (top + widgetElement.getOffsetHeight());
if (displayAbove
&& ((distanceFromWindowTop < bubbleHeight) && (distanceToWindowBottom > distanceFromWindowTop))) {
// in case there is too little space above, and there is more below, change direction
displayAbove = false;
} else if (!displayAbove
&& ((distanceToWindowBottom < bubbleHeight) && (distanceFromWindowTop > distanceToWindowBottom))) {
// in case there is too little space below, and there is more above, change direction
displayAbove = true;
}
return displayAbove;
} }
|
public class class_name {
private boolean shouldDisplayTooltipAbove() {
boolean displayAbove;
if (isSimpleValue()) {
Direction direction = Direction.none;
if (m_widget instanceof I_CmsHasDisplayDirection) {
direction = ((I_CmsHasDisplayDirection)m_widget).getDisplayingDirection();
// depends on control dependency: [if], data = [none]
}
switch (direction) {
case above:
displayAbove = true;
break;
case below:
case none:
default:
displayAbove = true;
break;
}
} else {
displayAbove = true;
// depends on control dependency: [if], data = [none]
}
m_helpBubble.getStyle().setDisplay(Display.BLOCK);
int bubbleHeight = m_helpBubble.getOffsetHeight();
m_helpBubble.getStyle().clearDisplay();
Element widgetElement = m_widget.asWidget().getElement();
// Calculate top position for the popup
int top = widgetElement.getAbsoluteTop();
int windowTop = Window.getScrollTop();
int windowBottom = Window.getScrollTop() + Window.getClientHeight();
CmsDebugLog.consoleLog("window bottom: " + windowBottom + " window height: " + Window.getClientHeight());
int distanceFromWindowTop = top - windowTop - TOOLBAR_HEIGHT;
int distanceToWindowBottom = windowBottom - (top + widgetElement.getOffsetHeight());
if (displayAbove
&& ((distanceFromWindowTop < bubbleHeight) && (distanceToWindowBottom > distanceFromWindowTop))) {
// in case there is too little space above, and there is more below, change direction
displayAbove = false;
} else if (!displayAbove
&& ((distanceToWindowBottom < bubbleHeight) && (distanceFromWindowTop > distanceToWindowBottom))) {
// in case there is too little space below, and there is more above, change direction
displayAbove = true;
}
return displayAbove;
} }
|
public class class_name {
public HTTPRequest createHTTPRequest(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob)
{
//setup common request data
HTTPRequest httpRequest=this.createCommonHTTPRequest(faxClientSpi,faxActionType);
//create content
List<ContentPart<?>> contentList=new LinkedList<HTTPRequest.ContentPart<?>>();
switch(faxActionType)
{
case SUBMIT_FAX_JOB:
String value=faxJob.getTargetAddress();
this.addContentPart(contentList,this.submitTargetAddressParameter,value);
value=faxJob.getTargetName();
this.addContentPart(contentList,this.submitTargetNameParameter,value);
value=faxJob.getSenderName();
this.addContentPart(contentList,this.submitSenderNameParameter,value);
value=faxJob.getSenderFaxNumber();
this.addContentPart(contentList,this.submitSenderFaxNumberParameter,value);
value=faxJob.getSenderEmail();
this.addContentPart(contentList,this.submitSenderEMailParameter,value);
File file=faxJob.getFile();
contentList.add(new ContentPart<File>(this.submitFileContentParameter,file,ContentPartType.FILE));
if(this.shouldAddFileNamePart())
{
value=file.getName();
this.addContentPart(contentList,this.submitFileNameParameter,value);
}
break;
case SUSPEND_FAX_JOB:
this.addContentPart(contentList,this.suspendFaxJobIDParameter,faxJob.getID());
break;
case RESUME_FAX_JOB:
this.addContentPart(contentList,this.resumeFaxJobIDParameter,faxJob.getID());
break;
case CANCEL_FAX_JOB:
this.addContentPart(contentList,this.cancelFaxJobIDParameter,faxJob.getID());
break;
case GET_FAX_JOB_STATUS:
this.addContentPart(contentList,this.getStatusFaxJobIDParameter,faxJob.getID());
break;
default:
throw new FaxException("Fax action type: "+faxActionType+" not supported.");
}
//add additional parameters
this.addAdditionalParameters(contentList);
//add additional parts
this.addAdditionalContentParts(faxClientSpi,faxActionType,faxJob,contentList);
//convert to array
ContentPart<?>[] content=contentList.toArray(new ContentPart<?>[contentList.size()]);
//set content
httpRequest.setContent(content);
return httpRequest;
} }
|
public class class_name {
public HTTPRequest createHTTPRequest(HTTPFaxClientSpi faxClientSpi,FaxActionType faxActionType,FaxJob faxJob)
{
//setup common request data
HTTPRequest httpRequest=this.createCommonHTTPRequest(faxClientSpi,faxActionType);
//create content
List<ContentPart<?>> contentList=new LinkedList<HTTPRequest.ContentPart<?>>();
switch(faxActionType)
{
case SUBMIT_FAX_JOB:
String value=faxJob.getTargetAddress();
this.addContentPart(contentList,this.submitTargetAddressParameter,value);
value=faxJob.getTargetName();
this.addContentPart(contentList,this.submitTargetNameParameter,value);
value=faxJob.getSenderName();
this.addContentPart(contentList,this.submitSenderNameParameter,value);
value=faxJob.getSenderFaxNumber();
this.addContentPart(contentList,this.submitSenderFaxNumberParameter,value);
value=faxJob.getSenderEmail();
this.addContentPart(contentList,this.submitSenderEMailParameter,value);
File file=faxJob.getFile();
contentList.add(new ContentPart<File>(this.submitFileContentParameter,file,ContentPartType.FILE));
if(this.shouldAddFileNamePart())
{
value=file.getName(); // depends on control dependency: [if], data = [none]
this.addContentPart(contentList,this.submitFileNameParameter,value); // depends on control dependency: [if], data = [none]
}
break;
case SUSPEND_FAX_JOB:
this.addContentPart(contentList,this.suspendFaxJobIDParameter,faxJob.getID());
break;
case RESUME_FAX_JOB:
this.addContentPart(contentList,this.resumeFaxJobIDParameter,faxJob.getID());
break;
case CANCEL_FAX_JOB:
this.addContentPart(contentList,this.cancelFaxJobIDParameter,faxJob.getID());
break;
case GET_FAX_JOB_STATUS:
this.addContentPart(contentList,this.getStatusFaxJobIDParameter,faxJob.getID());
break;
default:
throw new FaxException("Fax action type: "+faxActionType+" not supported.");
}
//add additional parameters
this.addAdditionalParameters(contentList);
//add additional parts
this.addAdditionalContentParts(faxClientSpi,faxActionType,faxJob,contentList);
//convert to array
ContentPart<?>[] content=contentList.toArray(new ContentPart<?>[contentList.size()]);
//set content
httpRequest.setContent(content);
return httpRequest;
} }
|
public class class_name {
public String getRemoteRealAddr(String realIpHeader) {
String host = getProxyRemoteAddr(realIpHeader);
if (host == null || host.equals("unknown")) {
host = getRemoteAddr();
}
return host;
} }
|
public class class_name {
public String getRemoteRealAddr(String realIpHeader) {
String host = getProxyRemoteAddr(realIpHeader);
if (host == null || host.equals("unknown")) {
host = getRemoteAddr(); // depends on control dependency: [if], data = [none]
}
return host;
} }
|
public class class_name {
public Term build()
{
Term result;
if (!isCompound())
{
result = getFunctor();
}
else
{
if (getFunctor().isAtom())
{
List<Term> args = getArgs();
int arity = args.size();
Functor functor = (Functor) getFunctor();
int name = interner.internFunctorName(interner.getFunctorName(functor.getName()), arity);
result = new Functor(name, args.toArray(new Term[arity]));
}
else
{
throw new IllegalStateException("Invalid functor type.");
}
}
return result;
} }
|
public class class_name {
public Term build()
{
Term result;
if (!isCompound())
{
result = getFunctor(); // depends on control dependency: [if], data = [none]
}
else
{
if (getFunctor().isAtom())
{
List<Term> args = getArgs();
int arity = args.size();
Functor functor = (Functor) getFunctor();
int name = interner.internFunctorName(interner.getFunctorName(functor.getName()), arity);
result = new Functor(name, args.toArray(new Term[arity])); // depends on control dependency: [if], data = [none]
}
else
{
throw new IllegalStateException("Invalid functor type.");
}
}
return result;
} }
|
public class class_name {
@Override
public DescriptorValue calculate(IAtomContainer container) {
int atomCount = 0;
if (container == null) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
(int) Double.NaN), getDescriptorNames(), new CDKException("The supplied AtomContainer was NULL"));
}
if (container.getAtomCount() == 0) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
(int) Double.NaN), getDescriptorNames(), new CDKException(
"The supplied AtomContainer did not have any atoms"));
}
if (elementName.equals("*")) {
for (int i = 0; i < container.getAtomCount(); i++) {
// we assume that UNSET is equivalent to 0 implicit H's
Integer hcount = container.getAtom(i).getImplicitHydrogenCount();
if (hcount != CDKConstants.UNSET) atomCount += hcount;
}
atomCount += container.getAtomCount();
} else if (elementName.equals("H")) {
for (int i = 0; i < container.getAtomCount(); i++) {
if (container.getAtom(i).getSymbol().equals(elementName)) {
atomCount += 1;
} else {
// we assume that UNSET is equivalent to 0 implicit H's
Integer hcount = container.getAtom(i).getImplicitHydrogenCount();
if (hcount != CDKConstants.UNSET) atomCount += hcount;
}
}
} else {
for (int i = 0; i < container.getAtomCount(); i++) {
if (container.getAtom(i).getSymbol().equals(elementName)) {
atomCount += 1;
}
}
}
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
atomCount), getDescriptorNames());
} }
|
public class class_name {
@Override
public DescriptorValue calculate(IAtomContainer container) {
int atomCount = 0;
if (container == null) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
(int) Double.NaN), getDescriptorNames(), new CDKException("The supplied AtomContainer was NULL")); // depends on control dependency: [if], data = [none]
}
if (container.getAtomCount() == 0) {
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
(int) Double.NaN), getDescriptorNames(), new CDKException(
"The supplied AtomContainer did not have any atoms")); // depends on control dependency: [if], data = [none]
}
if (elementName.equals("*")) {
for (int i = 0; i < container.getAtomCount(); i++) {
// we assume that UNSET is equivalent to 0 implicit H's
Integer hcount = container.getAtom(i).getImplicitHydrogenCount();
if (hcount != CDKConstants.UNSET) atomCount += hcount;
}
atomCount += container.getAtomCount(); // depends on control dependency: [if], data = [none]
} else if (elementName.equals("H")) {
for (int i = 0; i < container.getAtomCount(); i++) {
if (container.getAtom(i).getSymbol().equals(elementName)) {
atomCount += 1; // depends on control dependency: [if], data = [none]
} else {
// we assume that UNSET is equivalent to 0 implicit H's
Integer hcount = container.getAtom(i).getImplicitHydrogenCount();
if (hcount != CDKConstants.UNSET) atomCount += hcount;
}
}
} else {
for (int i = 0; i < container.getAtomCount(); i++) {
if (container.getAtom(i).getSymbol().equals(elementName)) {
atomCount += 1; // depends on control dependency: [if], data = [none]
}
}
}
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
atomCount), getDescriptorNames());
} }
|
public class class_name {
private void showKeyspace(PrintStream output, KsDef ksDef)
{
output.append("create keyspace ").append(CliUtils.maybeEscapeName(ksDef.name));
writeAttr(output, true, "placement_strategy", normaliseType(ksDef.strategy_class, "org.apache.cassandra.locator"));
if (ksDef.strategy_options != null && !ksDef.strategy_options.isEmpty())
{
final StringBuilder opts = new StringBuilder();
opts.append("{");
String prefix = "";
for (Map.Entry<String, String> opt : ksDef.strategy_options.entrySet())
{
opts.append(prefix).append(CliUtils.escapeSQLString(opt.getKey())).append(" : ").append(CliUtils.escapeSQLString(opt.getValue()));
prefix = ", ";
}
opts.append("}");
writeAttrRaw(output, false, "strategy_options", opts.toString());
}
writeAttr(output, false, "durable_writes", ksDef.durable_writes);
output.append(";").append(NEWLINE);
output.append(NEWLINE);
output.append("use ").append(CliUtils.maybeEscapeName(ksDef.name)).append(";");
output.append(NEWLINE);
output.append(NEWLINE);
Collections.sort(ksDef.cf_defs, new CfDefNamesComparator());
for (CfDef cfDef : ksDef.cf_defs)
showColumnFamily(output, cfDef);
output.append(NEWLINE);
output.append(NEWLINE);
}
/**
* Creates a CLI script for the CfDef including meta data to the supplied StringBuilder.
*
* @param output File to write to.
* @param cfDef CfDef to export attributes from.
*/
private void showColumnFamily(PrintStream output, CfDef cfDef)
{
output.append("create column family ").append(CliUtils.maybeEscapeName(cfDef.name));
writeAttr(output, true, "column_type", cfDef.column_type);
writeAttr(output, false, "comparator", normaliseType(cfDef.comparator_type, "org.apache.cassandra.db.marshal"));
if (cfDef.column_type.equals("Super"))
writeAttr(output, false, "subcomparator", normaliseType(cfDef.subcomparator_type, "org.apache.cassandra.db.marshal"));
if (!StringUtils.isEmpty(cfDef.default_validation_class))
writeAttr(output, false, "default_validation_class",
normaliseType(cfDef.default_validation_class, "org.apache.cassandra.db.marshal"));
writeAttr(output, false, "key_validation_class",
normaliseType(cfDef.key_validation_class, "org.apache.cassandra.db.marshal"));
writeAttr(output, false, "read_repair_chance", cfDef.read_repair_chance);
writeAttr(output, false, "dclocal_read_repair_chance", cfDef.dclocal_read_repair_chance);
writeAttr(output, false, "gc_grace", cfDef.gc_grace_seconds);
writeAttr(output, false, "min_compaction_threshold", cfDef.min_compaction_threshold);
writeAttr(output, false, "max_compaction_threshold", cfDef.max_compaction_threshold);
writeAttr(output, false, "compaction_strategy", cfDef.compaction_strategy);
writeAttr(output, false, "caching", cfDef.caching);
writeAttr(output, false, "cells_per_row_to_cache", cfDef.cells_per_row_to_cache);
writeAttr(output, false, "default_time_to_live", cfDef.default_time_to_live);
writeAttr(output, false, "speculative_retry", cfDef.speculative_retry);
if (cfDef.isSetBloom_filter_fp_chance())
writeAttr(output, false, "bloom_filter_fp_chance", cfDef.bloom_filter_fp_chance);
if (!cfDef.compaction_strategy_options.isEmpty())
{
StringBuilder cOptions = new StringBuilder();
cOptions.append("{");
Map<String, String> options = cfDef.compaction_strategy_options;
int i = 0, size = options.size();
for (Map.Entry<String, String> entry : options.entrySet())
{
cOptions.append(CliUtils.quote(entry.getKey())).append(" : ").append(CliUtils.quote(entry.getValue()));
if (i != size - 1)
cOptions.append(", ");
i++;
}
cOptions.append("}");
writeAttrRaw(output, false, "compaction_strategy_options", cOptions.toString());
}
if (!StringUtils.isEmpty(cfDef.comment))
writeAttr(output, false, "comment", cfDef.comment);
if (!cfDef.column_metadata.isEmpty())
{
output.append(NEWLINE)
.append(TAB)
.append("and column_metadata = [");
boolean first = true;
for (ColumnDef colDef : cfDef.column_metadata)
{
if (!first)
output.append(",");
first = false;
showColumnMeta(output, cfDef, colDef);
}
output.append("]");
}
if (cfDef.compression_options != null && !cfDef.compression_options.isEmpty())
{
StringBuilder compOptions = new StringBuilder();
compOptions.append("{");
int i = 0, size = cfDef.compression_options.size();
for (Map.Entry<String, String> entry : cfDef.compression_options.entrySet())
{
compOptions.append(CliUtils.quote(entry.getKey())).append(" : ").append(CliUtils.quote(entry.getValue()));
if (i != size - 1)
compOptions.append(", ");
i++;
}
compOptions.append("}");
writeAttrRaw(output, false, "compression_options", compOptions.toString());
}
if (cfDef.isSetIndex_interval())
writeAttr(output, false, "index_interval", cfDef.index_interval);
output.append(";");
output.append(NEWLINE);
output.append(NEWLINE);
} }
|
public class class_name {
private void showKeyspace(PrintStream output, KsDef ksDef)
{
output.append("create keyspace ").append(CliUtils.maybeEscapeName(ksDef.name));
writeAttr(output, true, "placement_strategy", normaliseType(ksDef.strategy_class, "org.apache.cassandra.locator"));
if (ksDef.strategy_options != null && !ksDef.strategy_options.isEmpty())
{
final StringBuilder opts = new StringBuilder();
opts.append("{");
String prefix = "";
for (Map.Entry<String, String> opt : ksDef.strategy_options.entrySet())
{
opts.append(prefix).append(CliUtils.escapeSQLString(opt.getKey())).append(" : ").append(CliUtils.escapeSQLString(opt.getValue())); // depends on control dependency: [for], data = [opt]
prefix = ", "; // depends on control dependency: [for], data = [none]
}
opts.append("}");
writeAttrRaw(output, false, "strategy_options", opts.toString());
}
writeAttr(output, false, "durable_writes", ksDef.durable_writes);
output.append(";").append(NEWLINE);
output.append(NEWLINE);
output.append("use ").append(CliUtils.maybeEscapeName(ksDef.name)).append(";");
output.append(NEWLINE);
output.append(NEWLINE);
Collections.sort(ksDef.cf_defs, new CfDefNamesComparator());
for (CfDef cfDef : ksDef.cf_defs)
showColumnFamily(output, cfDef);
output.append(NEWLINE);
output.append(NEWLINE);
}
/**
* Creates a CLI script for the CfDef including meta data to the supplied StringBuilder.
*
* @param output File to write to.
* @param cfDef CfDef to export attributes from.
*/
private void showColumnFamily(PrintStream output, CfDef cfDef)
{
output.append("create column family ").append(CliUtils.maybeEscapeName(cfDef.name));
writeAttr(output, true, "column_type", cfDef.column_type);
writeAttr(output, false, "comparator", normaliseType(cfDef.comparator_type, "org.apache.cassandra.db.marshal"));
if (cfDef.column_type.equals("Super"))
writeAttr(output, false, "subcomparator", normaliseType(cfDef.subcomparator_type, "org.apache.cassandra.db.marshal"));
if (!StringUtils.isEmpty(cfDef.default_validation_class))
writeAttr(output, false, "default_validation_class",
normaliseType(cfDef.default_validation_class, "org.apache.cassandra.db.marshal"));
writeAttr(output, false, "key_validation_class",
normaliseType(cfDef.key_validation_class, "org.apache.cassandra.db.marshal"));
writeAttr(output, false, "read_repair_chance", cfDef.read_repair_chance);
writeAttr(output, false, "dclocal_read_repair_chance", cfDef.dclocal_read_repair_chance);
writeAttr(output, false, "gc_grace", cfDef.gc_grace_seconds);
writeAttr(output, false, "min_compaction_threshold", cfDef.min_compaction_threshold);
writeAttr(output, false, "max_compaction_threshold", cfDef.max_compaction_threshold);
writeAttr(output, false, "compaction_strategy", cfDef.compaction_strategy);
writeAttr(output, false, "caching", cfDef.caching);
writeAttr(output, false, "cells_per_row_to_cache", cfDef.cells_per_row_to_cache);
writeAttr(output, false, "default_time_to_live", cfDef.default_time_to_live);
writeAttr(output, false, "speculative_retry", cfDef.speculative_retry);
if (cfDef.isSetBloom_filter_fp_chance())
writeAttr(output, false, "bloom_filter_fp_chance", cfDef.bloom_filter_fp_chance);
if (!cfDef.compaction_strategy_options.isEmpty())
{
StringBuilder cOptions = new StringBuilder();
cOptions.append("{");
Map<String, String> options = cfDef.compaction_strategy_options;
int i = 0, size = options.size();
for (Map.Entry<String, String> entry : options.entrySet())
{
cOptions.append(CliUtils.quote(entry.getKey())).append(" : ").append(CliUtils.quote(entry.getValue()));
if (i != size - 1)
cOptions.append(", ");
i++;
}
cOptions.append("}");
writeAttrRaw(output, false, "compaction_strategy_options", cOptions.toString());
}
if (!StringUtils.isEmpty(cfDef.comment))
writeAttr(output, false, "comment", cfDef.comment);
if (!cfDef.column_metadata.isEmpty())
{
output.append(NEWLINE)
.append(TAB)
.append("and column_metadata = [");
boolean first = true;
for (ColumnDef colDef : cfDef.column_metadata)
{
if (!first)
output.append(",");
first = false;
showColumnMeta(output, cfDef, colDef);
}
output.append("]");
}
if (cfDef.compression_options != null && !cfDef.compression_options.isEmpty())
{
StringBuilder compOptions = new StringBuilder();
compOptions.append("{");
int i = 0, size = cfDef.compression_options.size();
for (Map.Entry<String, String> entry : cfDef.compression_options.entrySet())
{
compOptions.append(CliUtils.quote(entry.getKey())).append(" : ").append(CliUtils.quote(entry.getValue()));
if (i != size - 1)
compOptions.append(", ");
i++;
}
compOptions.append("}");
writeAttrRaw(output, false, "compression_options", compOptions.toString());
}
if (cfDef.isSetIndex_interval())
writeAttr(output, false, "index_interval", cfDef.index_interval);
output.append(";");
output.append(NEWLINE);
output.append(NEWLINE);
} }
|
public class class_name {
public void initialize(CmsObject cms) {
m_adminCms = cms;
// initialize static export RFS path (relative to web application)
m_staticExportPath = normalizeExportPath(m_staticExportPathConfigured);
m_staticExportWorkPath = normalizeExportPath(getExportWorkPathForConfiguration());
if (m_staticExportPath.equals(OpenCms.getSystemInfo().getWebApplicationRfsPath())) {
throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_INVALID_EXPORT_PATH_0));
}
// initialize prefix variables
m_rfsPrefix = normalizeRfsPrefix(m_rfsPrefixConfigured);
Iterator<CmsStaticExportRfsRule> itRfsRules = m_rfsRules.iterator();
while (itRfsRules.hasNext()) {
CmsStaticExportRfsRule rule = itRfsRules.next();
try {
rule.setExportPath(normalizeExportPath(rule.getExportPathConfigured()));
} catch (CmsIllegalArgumentException e) {
CmsLog.INIT.warn(e.getMessageContainer());
rule.setExportPath(m_staticExportPath);
}
try {
rule.setExportWorkPath(normalizeExportPath(rule.getExportWorkPathConfigured()));
} catch (CmsIllegalArgumentException e) {
CmsLog.INIT.warn(e.getMessageContainer());
rule.setExportWorkPath(m_staticExportWorkPath);
}
rule.setRfsPrefix(normalizeRfsPrefix(rule.getRfsPrefixConfigured()));
}
m_vfsPrefix = insertContextStrings(m_vfsPrefixConfigured);
m_vfsPrefix = CmsFileUtil.normalizePath(m_vfsPrefix, '/');
if (CmsResource.isFolder(m_vfsPrefix)) {
// ensure prefix does NOT end with a folder '/'
m_vfsPrefix = m_vfsPrefix.substring(0, m_vfsPrefix.length() - 1);
}
if (CmsLog.INIT.isDebugEnabled()) {
if (cms != null) {
CmsLog.INIT.debug(Messages.get().getBundle().key(Messages.INIT_SE_MANAGER_CREATED_1, cms));
} else {
CmsLog.INIT.debug(Messages.get().getBundle().key(Messages.INIT_SE_MANAGER_CREATED_0));
}
}
m_cacheOnlineLinks = CmsMemoryMonitor.createLRUCacheMap(2048);
OpenCms.getMemoryMonitor().register(this.getClass().getName() + ".m_cacheOnlineLinks", m_cacheOnlineLinks);
m_cacheExportUris = CmsMemoryMonitor.createLRUCacheMap(2048);
OpenCms.getMemoryMonitor().register(this.getClass().getName() + ".m_cacheExportUris", m_cacheExportUris);
m_cacheSecureLinks = CmsMemoryMonitor.createLRUCacheMap(2048);
OpenCms.getMemoryMonitor().register(this.getClass().getName() + ".m_cacheSecureLinks", m_cacheSecureLinks);
m_cacheExportLinks = CmsMemoryMonitor.createLRUCacheMap(2048);
OpenCms.getMemoryMonitor().register(this.getClass().getName() + ".m_cacheExportLinks", m_cacheExportLinks);
// register this object as event listener
OpenCms.addCmsEventListener(
this,
new int[] {
I_CmsEventListener.EVENT_PUBLISH_PROJECT,
I_CmsEventListener.EVENT_CLEAR_CACHES,
I_CmsEventListener.EVENT_UPDATE_EXPORTS});
m_exportFolderMatcher = new CmsExportFolderMatcher(m_exportFolders, m_testResource);
// get the default accept-language header value
m_defaultAcceptLanguageHeader = CmsAcceptLanguageHeaderParser.createLanguageHeader();
// get the default accept-charset header value
m_defaultAcceptCharsetHeader = OpenCms.getSystemInfo().getDefaultEncoding();
// get the export url prefix
int pos = m_exportUrl.indexOf("://");
if (pos > 0) {
// absolute link, remove http://servername
int pos2 = m_exportUrl.indexOf('/', pos + 3);
if (pos2 > 0) {
m_exportUrlPrefix = m_exportUrl.substring(pos2);
} else {
// should never happen
m_exportUrlPrefix = "";
}
} else {
m_exportUrlPrefix = m_exportUrl;
}
if (CmsLog.INIT.isInfoEnabled()) {
if (isStaticExportEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_STATIC_EXPORT_ENABLED_0));
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_DEFAULT_1,
Boolean.valueOf(getExportPropertyDefault())));
itRfsRules = m_rfsRules.iterator();
while (itRfsRules.hasNext()) {
CmsStaticExportRfsRule rfsRule = itRfsRules.next();
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_RFS_RULE_EXPORT_PATH_2,
rfsRule.getSource(),
rfsRule.getExportPath()));
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_RFS_RULE_RFS_PREFIX_2,
rfsRule.getSource(),
rfsRule.getRfsPrefix()));
if (rfsRule.getUseRelativeLinks() != null) {
if (rfsRule.getUseRelativeLinks().booleanValue()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_RFS_RULE_RELATIVE_LINKS_1,
rfsRule.getSource()));
} else {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_RFS_RULE_ABSOLUTE_LINKS_1,
rfsRule.getSource()));
}
}
}
// default rule
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_RFS_RULE_EXPORT_PATH_2,
"/",
m_staticExportPath));
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_RFS_RULE_RFS_PREFIX_2, "/", m_rfsPrefix));
if (m_exportRelativeLinks) {
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_RFS_RULE_RELATIVE_LINKS_1, "/"));
} else {
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_RFS_RULE_ABSOLUTE_LINKS_1, "/"));
}
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_EXPORT_VFS_PREFIX_1, getVfsPrefix()));
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_EXPORT_HANDLER_1,
getHandler().getClass().getName()));
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_EXPORT_URL_1, getExportUrl()));
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_OPTIMIZATION_1, getPlainExportOptimization()));
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_TESTRESOURCE_1, getTestResource()));
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_LINKSUBSTITUTION_HANDLER_1,
getLinkSubstitutionHandler().getClass().getName()));
} else {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_STATIC_EXPORT_DISABLED_0));
}
}
} }
|
public class class_name {
public void initialize(CmsObject cms) {
m_adminCms = cms;
// initialize static export RFS path (relative to web application)
m_staticExportPath = normalizeExportPath(m_staticExportPathConfigured);
m_staticExportWorkPath = normalizeExportPath(getExportWorkPathForConfiguration());
if (m_staticExportPath.equals(OpenCms.getSystemInfo().getWebApplicationRfsPath())) {
throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_INVALID_EXPORT_PATH_0));
}
// initialize prefix variables
m_rfsPrefix = normalizeRfsPrefix(m_rfsPrefixConfigured);
Iterator<CmsStaticExportRfsRule> itRfsRules = m_rfsRules.iterator();
while (itRfsRules.hasNext()) {
CmsStaticExportRfsRule rule = itRfsRules.next();
try {
rule.setExportPath(normalizeExportPath(rule.getExportPathConfigured())); // depends on control dependency: [try], data = [none]
} catch (CmsIllegalArgumentException e) {
CmsLog.INIT.warn(e.getMessageContainer());
rule.setExportPath(m_staticExportPath);
} // depends on control dependency: [catch], data = [none]
try {
rule.setExportWorkPath(normalizeExportPath(rule.getExportWorkPathConfigured())); // depends on control dependency: [try], data = [none]
} catch (CmsIllegalArgumentException e) {
CmsLog.INIT.warn(e.getMessageContainer());
rule.setExportWorkPath(m_staticExportWorkPath);
} // depends on control dependency: [catch], data = [none]
rule.setRfsPrefix(normalizeRfsPrefix(rule.getRfsPrefixConfigured())); // depends on control dependency: [while], data = [none]
}
m_vfsPrefix = insertContextStrings(m_vfsPrefixConfigured);
m_vfsPrefix = CmsFileUtil.normalizePath(m_vfsPrefix, '/');
if (CmsResource.isFolder(m_vfsPrefix)) {
// ensure prefix does NOT end with a folder '/'
m_vfsPrefix = m_vfsPrefix.substring(0, m_vfsPrefix.length() - 1); // depends on control dependency: [if], data = [none]
}
if (CmsLog.INIT.isDebugEnabled()) {
if (cms != null) {
CmsLog.INIT.debug(Messages.get().getBundle().key(Messages.INIT_SE_MANAGER_CREATED_1, cms)); // depends on control dependency: [if], data = [none]
} else {
CmsLog.INIT.debug(Messages.get().getBundle().key(Messages.INIT_SE_MANAGER_CREATED_0)); // depends on control dependency: [if], data = [none]
}
}
m_cacheOnlineLinks = CmsMemoryMonitor.createLRUCacheMap(2048);
OpenCms.getMemoryMonitor().register(this.getClass().getName() + ".m_cacheOnlineLinks", m_cacheOnlineLinks);
m_cacheExportUris = CmsMemoryMonitor.createLRUCacheMap(2048);
OpenCms.getMemoryMonitor().register(this.getClass().getName() + ".m_cacheExportUris", m_cacheExportUris);
m_cacheSecureLinks = CmsMemoryMonitor.createLRUCacheMap(2048);
OpenCms.getMemoryMonitor().register(this.getClass().getName() + ".m_cacheSecureLinks", m_cacheSecureLinks);
m_cacheExportLinks = CmsMemoryMonitor.createLRUCacheMap(2048);
OpenCms.getMemoryMonitor().register(this.getClass().getName() + ".m_cacheExportLinks", m_cacheExportLinks);
// register this object as event listener
OpenCms.addCmsEventListener(
this,
new int[] {
I_CmsEventListener.EVENT_PUBLISH_PROJECT,
I_CmsEventListener.EVENT_CLEAR_CACHES,
I_CmsEventListener.EVENT_UPDATE_EXPORTS});
m_exportFolderMatcher = new CmsExportFolderMatcher(m_exportFolders, m_testResource);
// get the default accept-language header value
m_defaultAcceptLanguageHeader = CmsAcceptLanguageHeaderParser.createLanguageHeader();
// get the default accept-charset header value
m_defaultAcceptCharsetHeader = OpenCms.getSystemInfo().getDefaultEncoding();
// get the export url prefix
int pos = m_exportUrl.indexOf("://");
if (pos > 0) {
// absolute link, remove http://servername
int pos2 = m_exportUrl.indexOf('/', pos + 3);
if (pos2 > 0) {
m_exportUrlPrefix = m_exportUrl.substring(pos2); // depends on control dependency: [if], data = [(pos2]
} else {
// should never happen
m_exportUrlPrefix = ""; // depends on control dependency: [if], data = [none]
}
} else {
m_exportUrlPrefix = m_exportUrl;
}
if (CmsLog.INIT.isInfoEnabled()) {
if (isStaticExportEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_STATIC_EXPORT_ENABLED_0));
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_DEFAULT_1,
Boolean.valueOf(getExportPropertyDefault())));
itRfsRules = m_rfsRules.iterator();
while (itRfsRules.hasNext()) {
CmsStaticExportRfsRule rfsRule = itRfsRules.next();
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_RFS_RULE_EXPORT_PATH_2,
rfsRule.getSource(),
rfsRule.getExportPath())); // depends on control dependency: [while], data = [none]
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_RFS_RULE_RFS_PREFIX_2,
rfsRule.getSource(),
rfsRule.getRfsPrefix())); // depends on control dependency: [while], data = [none]
if (rfsRule.getUseRelativeLinks() != null) {
if (rfsRule.getUseRelativeLinks().booleanValue()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_RFS_RULE_RELATIVE_LINKS_1,
rfsRule.getSource())); // depends on control dependency: [if], data = [none]
} else {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_RFS_RULE_ABSOLUTE_LINKS_1,
rfsRule.getSource())); // depends on control dependency: [if], data = [none]
}
}
}
// default rule
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_RFS_RULE_EXPORT_PATH_2,
"/",
m_staticExportPath));
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_RFS_RULE_RFS_PREFIX_2, "/", m_rfsPrefix));
if (m_exportRelativeLinks) {
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_RFS_RULE_RELATIVE_LINKS_1, "/")); // depends on control dependency: [if], data = [none]
} else {
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_RFS_RULE_ABSOLUTE_LINKS_1, "/")); // depends on control dependency: [if], data = [none]
}
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_EXPORT_VFS_PREFIX_1, getVfsPrefix()));
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_EXPORT_EXPORT_HANDLER_1,
getHandler().getClass().getName()));
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_EXPORT_URL_1, getExportUrl()));
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_OPTIMIZATION_1, getPlainExportOptimization()));
CmsLog.INIT.info(
Messages.get().getBundle().key(Messages.INIT_EXPORT_TESTRESOURCE_1, getTestResource()));
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_LINKSUBSTITUTION_HANDLER_1,
getLinkSubstitutionHandler().getClass().getName()));
} else {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_STATIC_EXPORT_DISABLED_0));
}
}
} }
|
public class class_name {
@Override
protected boolean isColumnVisible(int colFlag) {
if (colFlag == LIST_COLUMN_TYPEICON.hashCode()) {
return true;
}
if (colFlag == LIST_COLUMN_NAME.hashCode()) {
return true;
}
if (colFlag == CmsUserSettings.FILELIST_TITLE) {
return true;
}
if (colFlag == CmsUserSettings.FILELIST_DATE_LASTMODIFIED) {
return true;
}
return false;
} }
|
public class class_name {
@Override
protected boolean isColumnVisible(int colFlag) {
if (colFlag == LIST_COLUMN_TYPEICON.hashCode()) {
return true; // depends on control dependency: [if], data = [none]
}
if (colFlag == LIST_COLUMN_NAME.hashCode()) {
return true; // depends on control dependency: [if], data = [none]
}
if (colFlag == CmsUserSettings.FILELIST_TITLE) {
return true; // depends on control dependency: [if], data = [none]
}
if (colFlag == CmsUserSettings.FILELIST_DATE_LASTMODIFIED) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public JSONResult getJSON(URL url) {
try {
logger.debug("Requesting {}", url);
StringBuilder text = new StringBuilder();
String line;
HttpURLConnection urlconn = (HttpURLConnection) url.openConnection();
urlconn.setReadTimeout(msTimeout);
urlconn.setConnectTimeout(msTimeout);
urlconn.setRequestMethod("GET");
urlconn.connect();
BufferedReader br = new BufferedReader(new InputStreamReader(urlconn.getInputStream()));
while ((line = br.readLine()) != null) {
text.append(line);
}
return new JSONResult(text.toString());
}
catch (Throwable e) {
throw new FireRESTException(url.toString(), e);
}
} }
|
public class class_name {
public JSONResult getJSON(URL url) {
try {
logger.debug("Requesting {}", url); // depends on control dependency: [try], data = [none]
StringBuilder text = new StringBuilder();
String line;
HttpURLConnection urlconn = (HttpURLConnection) url.openConnection();
urlconn.setReadTimeout(msTimeout); // depends on control dependency: [try], data = [none]
urlconn.setConnectTimeout(msTimeout); // depends on control dependency: [try], data = [none]
urlconn.setRequestMethod("GET"); // depends on control dependency: [try], data = [none]
urlconn.connect(); // depends on control dependency: [try], data = [none]
BufferedReader br = new BufferedReader(new InputStreamReader(urlconn.getInputStream()));
while ((line = br.readLine()) != null) {
text.append(line); // depends on control dependency: [while], data = [none]
}
return new JSONResult(text.toString()); // depends on control dependency: [try], data = [none]
}
catch (Throwable e) {
throw new FireRESTException(url.toString(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void init()
{
_offset = 0;
if (_tempBuffer == null) {
_tempBuffer = TempBuffer.create();
_buffer = _tempBuffer.buffer();
_bufferEnd = _buffer.length;
}
} }
|
public class class_name {
public void init()
{
_offset = 0;
if (_tempBuffer == null) {
_tempBuffer = TempBuffer.create(); // depends on control dependency: [if], data = [none]
_buffer = _tempBuffer.buffer(); // depends on control dependency: [if], data = [none]
_bufferEnd = _buffer.length; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Field[] jlClassGetFields(Class<?> clazz) {
ReloadableType rtype = getRType(clazz);
if (rtype == null) {
return clazz.getFields();
}
else {
List<Field> allFields = new ArrayList<Field>();
gatherFields(clazz, allFields, new HashSet<Class<?>>());
return allFields.toArray(new Field[allFields.size()]);
}
} }
|
public class class_name {
public static Field[] jlClassGetFields(Class<?> clazz) {
ReloadableType rtype = getRType(clazz);
if (rtype == null) {
return clazz.getFields(); // depends on control dependency: [if], data = [none]
}
else {
List<Field> allFields = new ArrayList<Field>();
gatherFields(clazz, allFields, new HashSet<Class<?>>()); // depends on control dependency: [if], data = [none]
return allFields.toArray(new Field[allFields.size()]); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void insertFringeMigrate(
InsertStack stack,
GBSNode p,
Object mkey)
{
GBSNode endp = p;
int endIndex = stack.index();
/* Maximum number of right child nodes */
/* before the fringe must be rebalanced */
int maxBal = maximumFringeImbalance();
stack.setMigratingKey(mkey);
if (mkey != null) /* Have a key to migrate */
{
stack.processSubFringe(p); /* See InsertStack.processNode */
endp = stack.lastNode();
endIndex = stack.lastIndex();
}
if (stack.migrating()) /* Need a right child for migrating key */
{
_xno++;
endp.addRightLeaf(stack.migratingKey());
}
insertCheckFringeBalance(
stack,
endp,
endIndex,
maxBal);
} }
|
public class class_name {
private void insertFringeMigrate(
InsertStack stack,
GBSNode p,
Object mkey)
{
GBSNode endp = p;
int endIndex = stack.index();
/* Maximum number of right child nodes */
/* before the fringe must be rebalanced */
int maxBal = maximumFringeImbalance();
stack.setMigratingKey(mkey);
if (mkey != null) /* Have a key to migrate */
{
stack.processSubFringe(p); /* See InsertStack.processNode */ // depends on control dependency: [if], data = [none]
endp = stack.lastNode(); // depends on control dependency: [if], data = [none]
endIndex = stack.lastIndex(); // depends on control dependency: [if], data = [none]
}
if (stack.migrating()) /* Need a right child for migrating key */
{
_xno++; // depends on control dependency: [if], data = [none]
endp.addRightLeaf(stack.migratingKey()); // depends on control dependency: [if], data = [none]
}
insertCheckFringeBalance(
stack,
endp,
endIndex,
maxBal);
} }
|
public class class_name {
public <T extends Message> T sendMessageSynchronous(Class<T> responseType, TransmittableMessage message) {
T responseMessage = null;
SynchronousMessageListener<T> messageListener = new SynchronousMessageListener<>(responseType);
addMessageListener(messageListener);
if (sendMessage(message)) {
if (messageListener.waitForResponse()) {
responseMessage = messageListener.getResponseMessage();
}
}
removeMessageListener(messageListener);
return responseMessage;
} }
|
public class class_name {
public <T extends Message> T sendMessageSynchronous(Class<T> responseType, TransmittableMessage message) {
T responseMessage = null;
SynchronousMessageListener<T> messageListener = new SynchronousMessageListener<>(responseType);
addMessageListener(messageListener);
if (sendMessage(message)) {
if (messageListener.waitForResponse()) {
responseMessage = messageListener.getResponseMessage(); // depends on control dependency: [if], data = [none]
}
}
removeMessageListener(messageListener);
return responseMessage;
} }
|
public class class_name {
private void removeInstancePrefix() {
Properties newProperties = new Properties();
for (Map.Entry<Object, Object> entry : mProperties.entrySet()) {
String key = entry.getKey().toString();
if (key.startsWith("*") || key.startsWith("worker") || key.startsWith("master")) {
String newKey = key.substring(key.indexOf('.') + 1);
newProperties.put(newKey, entry.getValue());
} else {
newProperties.put(key, entry.getValue());
}
}
mProperties = newProperties;
} }
|
public class class_name {
private void removeInstancePrefix() {
Properties newProperties = new Properties();
for (Map.Entry<Object, Object> entry : mProperties.entrySet()) {
String key = entry.getKey().toString();
if (key.startsWith("*") || key.startsWith("worker") || key.startsWith("master")) {
String newKey = key.substring(key.indexOf('.') + 1);
newProperties.put(newKey, entry.getValue()); // depends on control dependency: [if], data = [none]
} else {
newProperties.put(key, entry.getValue()); // depends on control dependency: [if], data = [none]
}
}
mProperties = newProperties;
} }
|
public class class_name {
public static JWTPayload getPayload(String tokenString) {
JWTPayload payload = null;
String[] jwtParts = splitTokenString(tokenString);
if (jwtParts.length >= 2) {
WSJsonToken token = deserialize(jwtParts, tokenString);
payload = new JWTPayload();
fromJsonToken(token, payload);
}
return payload;
} }
|
public class class_name {
public static JWTPayload getPayload(String tokenString) {
JWTPayload payload = null;
String[] jwtParts = splitTokenString(tokenString);
if (jwtParts.length >= 2) {
WSJsonToken token = deserialize(jwtParts, tokenString);
payload = new JWTPayload(); // depends on control dependency: [if], data = [none]
fromJsonToken(token, payload); // depends on control dependency: [if], data = [none]
}
return payload;
} }
|
public class class_name {
private void doPrecalculateProcess()
{
if(discreteProcess != null && discreteProcess.length != 0) {
return;
}
// Allocate Memory
discreteProcess = new RandomVariableInterface[timeDiscretization.getNumberOfTimeSteps()+1][numberOfComponents];
discreteProcessWeights = new RandomVariableInterface[getTimeDiscretization().getNumberOfTimeSteps()+1];
// Set initial Monte-Carlo weights
discreteProcessWeights[0] = new RandomVariable(0.0, 1.0/numberOfPaths);
// Store components
discreteProcess[0] = getInitialValue();
// Evolve process
for(int timeIndex = 1; timeIndex < timeDiscretization.getNumberOfTimeSteps()+1; timeIndex++)
{
// Generate process at timeIndex
double deltaT = timeDiscretization.getTime(timeIndex) - timeDiscretization.getTime(timeIndex-1);
// Temp storage for variance and diffusion
RandomVariableInterface[] variance = new RandomVariableInterface[numberOfComponents];
RandomVariableInterface[] diffusion = new RandomVariableInterface[numberOfComponents];
// Calculate new realization
for(int componentIndex = numberOfComponents-1; componentIndex >= 0; componentIndex--)
{
// Calculate diffusion
// Temp storage for variance and diffusion
RandomVariableInterface varianceOfComponent = new RandomVariable(getTime(timeIndex-1),0.0);
RandomVariableInterface diffusionOfComponent = new RandomVariable(getTime(timeIndex-1),0.0);
// Generate values for diffusionOfComponent and varianceOfComponent
for(int factor=0; factor<numberOfFactors; factor++) {
RandomVariableInterface factorLoading = getFactorLoading(timeIndex-1, factor, componentIndex, null);
RandomVariableInterface brownianIncrement = brownianMotion.getBrownianIncrement(timeIndex-1,factor);
varianceOfComponent = varianceOfComponent.addProduct(factorLoading, factorLoading);
diffusionOfComponent = diffusionOfComponent.addProduct(factorLoading, brownianIncrement);
}
variance[componentIndex] = varianceOfComponent;
diffusion[componentIndex] = diffusionOfComponent;
}
RandomVariableInterface[] drift;
if(scheme == Scheme.PREDICTOR_USING_LASTREALIZATION) {
drift = getDrift(timeIndex-1, discreteProcess[timeIndex-1], discreteProcess[timeIndex]);
} else {
drift = getDrift(timeIndex-1, discreteProcess[timeIndex-1], null );
}
// Calculate drift
for(int componentIndex = numberOfComponents-1; componentIndex >= 0; componentIndex--)
{
RandomVariableInterface driftOfComponent = drift[componentIndex];
RandomVariableInterface varianceOfComponent = variance[componentIndex];
RandomVariableInterface diffusionOfComponent = diffusion[componentIndex];
if(driftOfComponent == null) {
discreteProcess[timeIndex][componentIndex] = discreteProcess[timeIndex-1][componentIndex];
continue;
}
// Allocate memory for on path-realizations
double[] newRealization = new double[numberOfPaths];
// Euler Scheme
RandomVariableInterface previouseRealization = discreteProcess[timeIndex-1][componentIndex];
// Generate values
for(int pathIndex = 0; pathIndex < numberOfPaths; pathIndex++)
{
double previousValue = previouseRealization.get(pathIndex);
double driftOnPath = driftOfComponent.get(pathIndex);
double varianceOnPath = varianceOfComponent.get(pathIndex);
double diffusionOnPath = diffusionOfComponent.get(pathIndex);
// The scheme
newRealization[pathIndex] = previousValue * Math.exp(driftOnPath * deltaT - 0.5 * varianceOnPath * deltaT + diffusionOnPath);
}
// Store components
discreteProcess[timeIndex][componentIndex] = new RandomVariable(getTime(timeIndex),newRealization);
}
if(scheme == Scheme.PREDICTOR_USING_EULERSTEP) {
RandomVariableInterface[] newRealization = new RandomVariable[numberOfComponents];
// Note: This is actually more than a predictor corrector: The drift of componentIndex already uses the corrected predictor from the previous components
drift = getDrift(timeIndex-1, discreteProcess[timeIndex-1], discreteProcess[timeIndex]);
// Apply corrector step to realizations at next time step
for(int componentIndex = 0; componentIndex < numberOfComponents; componentIndex++)
{
RandomVariableInterface driftOfComponent = drift[componentIndex];
RandomVariableInterface varianceOfComponent = variance[componentIndex];
RandomVariableInterface diffusionOfComponent = diffusion[componentIndex];
// Euler Scheme with corrected drift
RandomVariableInterface previouseRealization = discreteProcess[timeIndex-1][componentIndex];
// The scheme
// newValue = previousValue * Math.exp(driftValue * deltaT - 0.5 * varianceOnPath * deltaT + diffusionOnPath);
newRealization[componentIndex] = previouseRealization.mult((driftOfComponent.mult(deltaT).sub(varianceOfComponent.mult(0.5 * deltaT)).add(diffusionOfComponent)).exp());
} // End for(componentIndex)
// Store predictor-corrector corrected process.
discreteProcess[timeIndex] = newRealization;
} // End if(scheme == LogNormalProcess.SCHEME_PREDICTOR_USES_EULER)
// Set Monte-Carlo weights (since there is no Monte-Carlo weighting, the weights remain the same (namely 1.0/numberOfPaths).
discreteProcessWeights[timeIndex] = discreteProcessWeights[timeIndex-1];
} // End for(timeIndex)
} }
|
public class class_name {
private void doPrecalculateProcess()
{
if(discreteProcess != null && discreteProcess.length != 0) {
return; // depends on control dependency: [if], data = [none]
}
// Allocate Memory
discreteProcess = new RandomVariableInterface[timeDiscretization.getNumberOfTimeSteps()+1][numberOfComponents];
discreteProcessWeights = new RandomVariableInterface[getTimeDiscretization().getNumberOfTimeSteps()+1];
// Set initial Monte-Carlo weights
discreteProcessWeights[0] = new RandomVariable(0.0, 1.0/numberOfPaths);
// Store components
discreteProcess[0] = getInitialValue();
// Evolve process
for(int timeIndex = 1; timeIndex < timeDiscretization.getNumberOfTimeSteps()+1; timeIndex++)
{
// Generate process at timeIndex
double deltaT = timeDiscretization.getTime(timeIndex) - timeDiscretization.getTime(timeIndex-1);
// Temp storage for variance and diffusion
RandomVariableInterface[] variance = new RandomVariableInterface[numberOfComponents];
RandomVariableInterface[] diffusion = new RandomVariableInterface[numberOfComponents];
// Calculate new realization
for(int componentIndex = numberOfComponents-1; componentIndex >= 0; componentIndex--)
{
// Calculate diffusion
// Temp storage for variance and diffusion
RandomVariableInterface varianceOfComponent = new RandomVariable(getTime(timeIndex-1),0.0);
RandomVariableInterface diffusionOfComponent = new RandomVariable(getTime(timeIndex-1),0.0);
// Generate values for diffusionOfComponent and varianceOfComponent
for(int factor=0; factor<numberOfFactors; factor++) {
RandomVariableInterface factorLoading = getFactorLoading(timeIndex-1, factor, componentIndex, null);
RandomVariableInterface brownianIncrement = brownianMotion.getBrownianIncrement(timeIndex-1,factor);
varianceOfComponent = varianceOfComponent.addProduct(factorLoading, factorLoading); // depends on control dependency: [for], data = [none]
diffusionOfComponent = diffusionOfComponent.addProduct(factorLoading, brownianIncrement); // depends on control dependency: [for], data = [none]
}
variance[componentIndex] = varianceOfComponent; // depends on control dependency: [for], data = [componentIndex]
diffusion[componentIndex] = diffusionOfComponent; // depends on control dependency: [for], data = [componentIndex]
}
RandomVariableInterface[] drift;
if(scheme == Scheme.PREDICTOR_USING_LASTREALIZATION) {
drift = getDrift(timeIndex-1, discreteProcess[timeIndex-1], discreteProcess[timeIndex]); // depends on control dependency: [if], data = [none]
} else {
drift = getDrift(timeIndex-1, discreteProcess[timeIndex-1], null ); // depends on control dependency: [if], data = [none]
}
// Calculate drift
for(int componentIndex = numberOfComponents-1; componentIndex >= 0; componentIndex--)
{
RandomVariableInterface driftOfComponent = drift[componentIndex];
RandomVariableInterface varianceOfComponent = variance[componentIndex];
RandomVariableInterface diffusionOfComponent = diffusion[componentIndex];
if(driftOfComponent == null) {
discreteProcess[timeIndex][componentIndex] = discreteProcess[timeIndex-1][componentIndex]; // depends on control dependency: [if], data = [none]
continue;
}
// Allocate memory for on path-realizations
double[] newRealization = new double[numberOfPaths];
// Euler Scheme
RandomVariableInterface previouseRealization = discreteProcess[timeIndex-1][componentIndex];
// Generate values
for(int pathIndex = 0; pathIndex < numberOfPaths; pathIndex++)
{
double previousValue = previouseRealization.get(pathIndex);
double driftOnPath = driftOfComponent.get(pathIndex);
double varianceOnPath = varianceOfComponent.get(pathIndex);
double diffusionOnPath = diffusionOfComponent.get(pathIndex);
// The scheme
newRealization[pathIndex] = previousValue * Math.exp(driftOnPath * deltaT - 0.5 * varianceOnPath * deltaT + diffusionOnPath); // depends on control dependency: [for], data = [pathIndex]
}
// Store components
discreteProcess[timeIndex][componentIndex] = new RandomVariable(getTime(timeIndex),newRealization); // depends on control dependency: [for], data = [componentIndex]
}
if(scheme == Scheme.PREDICTOR_USING_EULERSTEP) {
RandomVariableInterface[] newRealization = new RandomVariable[numberOfComponents];
// Note: This is actually more than a predictor corrector: The drift of componentIndex already uses the corrected predictor from the previous components
drift = getDrift(timeIndex-1, discreteProcess[timeIndex-1], discreteProcess[timeIndex]); // depends on control dependency: [if], data = [none]
// Apply corrector step to realizations at next time step
for(int componentIndex = 0; componentIndex < numberOfComponents; componentIndex++)
{
RandomVariableInterface driftOfComponent = drift[componentIndex];
RandomVariableInterface varianceOfComponent = variance[componentIndex];
RandomVariableInterface diffusionOfComponent = diffusion[componentIndex];
// Euler Scheme with corrected drift
RandomVariableInterface previouseRealization = discreteProcess[timeIndex-1][componentIndex];
// The scheme
// newValue = previousValue * Math.exp(driftValue * deltaT - 0.5 * varianceOnPath * deltaT + diffusionOnPath);
newRealization[componentIndex] = previouseRealization.mult((driftOfComponent.mult(deltaT).sub(varianceOfComponent.mult(0.5 * deltaT)).add(diffusionOfComponent)).exp()); // depends on control dependency: [for], data = [componentIndex]
} // End for(componentIndex)
// Store predictor-corrector corrected process.
discreteProcess[timeIndex] = newRealization; // depends on control dependency: [if], data = [none]
} // End if(scheme == LogNormalProcess.SCHEME_PREDICTOR_USES_EULER)
// Set Monte-Carlo weights (since there is no Monte-Carlo weighting, the weights remain the same (namely 1.0/numberOfPaths).
discreteProcessWeights[timeIndex] = discreteProcessWeights[timeIndex-1]; // depends on control dependency: [for], data = [timeIndex]
} // End for(timeIndex)
} }
|
public class class_name {
@NonNull
private View.OnFocusChangeListener createFocusChangeListener() {
return new View.OnFocusChangeListener() {
@Override
public void onFocusChange(final View v, final boolean hasFocus) {
if (!hasFocus && validateOnFocusLost) {
validate();
}
}
};
} }
|
public class class_name {
@NonNull
private View.OnFocusChangeListener createFocusChangeListener() {
return new View.OnFocusChangeListener() {
@Override
public void onFocusChange(final View v, final boolean hasFocus) {
if (!hasFocus && validateOnFocusLost) {
validate(); // depends on control dependency: [if], data = [none]
}
}
};
} }
|
public class class_name {
private ItemStack transferSlotOutOfInventory(MalisisInventory inventory, MalisisSlot slot)
{
ItemStack itemStack = slot.getItemStack();
if (itemStack.isEmpty() || !inventory.state.is(PLAYER_EXTRACT) || !slot.state.is(PLAYER_INSERT))
return itemStack;
//comes from PlayerInventory
if (inventory == getPlayerInventory())
{
for (MalisisInventory inv : getInventories())
{
if (inv.state.is(PLAYER_INSERT))
{
itemStack = inv.transferInto(itemStack);
//placed the full itemStack into the target inventory
if (itemStack.isEmpty())
break;
}
}
}
//transfer into PlayerInventory
else if (getPlayerInventory().state.is(PLAYER_INSERT))
itemStack = getPlayerInventory().transferInto(itemStack);
return itemStack;
} }
|
public class class_name {
private ItemStack transferSlotOutOfInventory(MalisisInventory inventory, MalisisSlot slot)
{
ItemStack itemStack = slot.getItemStack();
if (itemStack.isEmpty() || !inventory.state.is(PLAYER_EXTRACT) || !slot.state.is(PLAYER_INSERT))
return itemStack;
//comes from PlayerInventory
if (inventory == getPlayerInventory())
{
for (MalisisInventory inv : getInventories())
{
if (inv.state.is(PLAYER_INSERT))
{
itemStack = inv.transferInto(itemStack); // depends on control dependency: [if], data = [none]
//placed the full itemStack into the target inventory
if (itemStack.isEmpty())
break;
}
}
}
//transfer into PlayerInventory
else if (getPlayerInventory().state.is(PLAYER_INSERT))
itemStack = getPlayerInventory().transferInto(itemStack);
return itemStack;
} }
|
public class class_name {
public static Bundle getBundle( BundleContext bc, String symbolicName, String version )
{
for( Bundle bundle : bc.getBundles() )
{
if( bundle.getSymbolicName().equals( symbolicName ) )
{
if( version == null || version.equals( bundle.getVersion() ) )
{
return bundle;
}
}
}
return null;
} }
|
public class class_name {
public static Bundle getBundle( BundleContext bc, String symbolicName, String version )
{
for( Bundle bundle : bc.getBundles() )
{
if( bundle.getSymbolicName().equals( symbolicName ) )
{
if( version == null || version.equals( bundle.getVersion() ) )
{
return bundle; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
public PutObjectResponse putObject(String bucketName, String key, String value) {
try {
return this.putObject(bucketName, key, value.getBytes(DEFAULT_ENCODING), new ObjectMetadata());
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Fail to get bytes.", e);
}
} }
|
public class class_name {
public PutObjectResponse putObject(String bucketName, String key, String value) {
try {
return this.putObject(bucketName, key, value.getBytes(DEFAULT_ENCODING), new ObjectMetadata()); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Fail to get bytes.", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private String[] extractDispositionInfo(String line) throws IOException {
// Return the line's data as an array: disposition, name, filename
String[] retval = new String[4];
// Convert the line to a lowercase string without the ending \r\n
// Keep the original line for error messages and for variable names.
String origline = line;
line = origline.toLowerCase();
// Get the content disposition, should be "form-data"
int start = line.indexOf("content-disposition: ");
int end = line.indexOf(";");
if (start == -1 || end == -1) {
throw new IOException("Content disposition corrupt: " + origline);
}
String disposition = line.substring(start + 21, end).trim();
if (!disposition.equals("form-data")) {
throw new IOException("Invalid content disposition: " + disposition);
}
// Get the field name
start = line.indexOf("name=\"", end); // start at last semicolon
end = line.indexOf("\"", start + 7); // skip name=\"
int startOffset = 6;
if (start == -1 || end == -1) {
// Some browsers like lynx don't surround with ""
// Thanks to Deon van der Merwe, dvdm@truteq.co.za, for noticing
start = line.indexOf("name=", end);
end = line.indexOf(";", start + 6);
if (start == -1) {
throw new IOException("Content disposition corrupt: " + origline);
}
else if (end == -1) {
end = line.length();
}
startOffset = 5; // without quotes we have one fewer char to skip
}
String name = origline.substring(start + startOffset, end);
// Get the filename, if given
String filename = null;
String origname = null;
start = line.indexOf("filename=\"", end + 2); // start after name
end = line.indexOf("\"", start + 10); // skip filename=\"
if (start != -1 && end != -1) { // note the !=
filename = origline.substring(start + 10, end);
origname = filename;
// The filename may contain a full path. Cut to just the filename.
int slash =
Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
if (slash > -1) {
filename = filename.substring(slash + 1); // past last slash
}
}
// Return a String array: disposition, name, filename
// empty filename denotes no file posted!
retval[0] = disposition;
retval[1] = name;
retval[2] = filename;
retval[3] = origname;
return retval;
} }
|
public class class_name {
private String[] extractDispositionInfo(String line) throws IOException {
// Return the line's data as an array: disposition, name, filename
String[] retval = new String[4];
// Convert the line to a lowercase string without the ending \r\n
// Keep the original line for error messages and for variable names.
String origline = line;
line = origline.toLowerCase();
// Get the content disposition, should be "form-data"
int start = line.indexOf("content-disposition: ");
int end = line.indexOf(";");
if (start == -1 || end == -1) {
throw new IOException("Content disposition corrupt: " + origline);
}
String disposition = line.substring(start + 21, end).trim();
if (!disposition.equals("form-data")) {
throw new IOException("Invalid content disposition: " + disposition);
}
// Get the field name
start = line.indexOf("name=\"", end); // start at last semicolon
end = line.indexOf("\"", start + 7); // skip name=\"
int startOffset = 6;
if (start == -1 || end == -1) {
// Some browsers like lynx don't surround with ""
// Thanks to Deon van der Merwe, dvdm@truteq.co.za, for noticing
start = line.indexOf("name=", end);
end = line.indexOf(";", start + 6);
if (start == -1) {
throw new IOException("Content disposition corrupt: " + origline);
}
else if (end == -1) {
end = line.length(); // depends on control dependency: [if], data = [none]
}
startOffset = 5; // without quotes we have one fewer char to skip
}
String name = origline.substring(start + startOffset, end);
// Get the filename, if given
String filename = null;
String origname = null;
start = line.indexOf("filename=\"", end + 2); // start after name
end = line.indexOf("\"", start + 10); // skip filename=\"
if (start != -1 && end != -1) { // note the !=
filename = origline.substring(start + 10, end);
origname = filename;
// The filename may contain a full path. Cut to just the filename.
int slash =
Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
if (slash > -1) {
filename = filename.substring(slash + 1); // past last slash // depends on control dependency: [if], data = [(slash]
}
}
// Return a String array: disposition, name, filename
// empty filename denotes no file posted!
retval[0] = disposition;
retval[1] = name;
retval[2] = filename;
retval[3] = origname;
return retval;
} }
|
public class class_name {
@Override
public boolean process(WeaveEnvironment environment, Scanner scanner) {
// interested in all classes:
final ScanResult scanResult = scanner.scan(new ScanRequest());
final Worker w = new Worker(environment);
boolean result = false;
for (WeavableClass<?> weavableClass : scanResult.getClasses()) {
result = w.weave(weavableClass.getTarget()) || result;
}
return result;
} }
|
public class class_name {
@Override
public boolean process(WeaveEnvironment environment, Scanner scanner) {
// interested in all classes:
final ScanResult scanResult = scanner.scan(new ScanRequest());
final Worker w = new Worker(environment);
boolean result = false;
for (WeavableClass<?> weavableClass : scanResult.getClasses()) {
result = w.weave(weavableClass.getTarget()) || result; // depends on control dependency: [for], data = [weavableClass]
}
return result;
} }
|
public class class_name {
void apply(final ConfigurationContext ctx, final ParsedConfiguration _parsedCfg, final Object cfg) {
ParsedConfiguration _templates = ctx.getTemplates();
ConfigurationTokenizer.Property _include = _parsedCfg.getPropertyMap().get("include");
if (_include != null) {
for (String _template : _include.getValue().split(",")) {
ParsedConfiguration c2 = null;
if (_templates != null) { c2 = _templates.getSection(_template); }
if (c2 == null) {
throw new ConfigurationException("Template not found \'" + _template + "\'", _include);
}
apply(ctx, c2, cfg);
}
}
applyPropertyValues(_parsedCfg, cfg);
if (!(cfg instanceof ConfigurationWithSections)) {
return;
}
ConfigurationWithSections _configurationWithSections = (ConfigurationWithSections) cfg;
for(ParsedConfiguration _parsedSection : _parsedCfg.getSections()) {
String _sectionType = ctx.getPredefinedSectionTypes().get(_parsedSection.getName());
if (_sectionType == null) {
_sectionType = _parsedSection.getType();
}
if (_sectionType == null) {
throw new ConfigurationException("type missing or unknown", _parsedSection);
}
Class<?> _type;
try {
_type = Class.forName(_sectionType);
} catch (ClassNotFoundException ex) {
throw new ConfigurationException(
"class not found '" + _sectionType + "'", _parsedSection);
}
if (!handleSection(ctx, _type, _configurationWithSections, _parsedSection)
&& !handleCollection(ctx, _type, cfg, _parsedSection)
&& !handleBean(ctx, _type, cfg, _parsedSection)) {
throw new ConfigurationException("Unknown property '" + _parsedSection.getContainer() + "'", _parsedSection);
}
}
} }
|
public class class_name {
void apply(final ConfigurationContext ctx, final ParsedConfiguration _parsedCfg, final Object cfg) {
ParsedConfiguration _templates = ctx.getTemplates();
ConfigurationTokenizer.Property _include = _parsedCfg.getPropertyMap().get("include");
if (_include != null) {
for (String _template : _include.getValue().split(",")) {
ParsedConfiguration c2 = null;
if (_templates != null) { c2 = _templates.getSection(_template); } // depends on control dependency: [if], data = [none]
if (c2 == null) {
throw new ConfigurationException("Template not found \'" + _template + "\'", _include);
}
apply(ctx, c2, cfg); // depends on control dependency: [for], data = [none]
}
}
applyPropertyValues(_parsedCfg, cfg);
if (!(cfg instanceof ConfigurationWithSections)) {
return; // depends on control dependency: [if], data = [none]
}
ConfigurationWithSections _configurationWithSections = (ConfigurationWithSections) cfg;
for(ParsedConfiguration _parsedSection : _parsedCfg.getSections()) {
String _sectionType = ctx.getPredefinedSectionTypes().get(_parsedSection.getName());
if (_sectionType == null) {
_sectionType = _parsedSection.getType(); // depends on control dependency: [if], data = [none]
}
if (_sectionType == null) {
throw new ConfigurationException("type missing or unknown", _parsedSection);
}
Class<?> _type;
try {
_type = Class.forName(_sectionType); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException ex) {
throw new ConfigurationException(
"class not found '" + _sectionType + "'", _parsedSection);
} // depends on control dependency: [catch], data = [none]
if (!handleSection(ctx, _type, _configurationWithSections, _parsedSection)
&& !handleCollection(ctx, _type, cfg, _parsedSection)
&& !handleBean(ctx, _type, cfg, _parsedSection)) {
throw new ConfigurationException("Unknown property '" + _parsedSection.getContainer() + "'", _parsedSection);
}
}
} }
|
public class class_name {
private void populateCumulatedStats(final ProducerDecoratorBean decorator) {
if (decorator == null || decorator.getProducers().isEmpty()) {
LOGGER.warn("Producer's are empty");
return;
}
// Used to calculate cumulated Avg stat
int cumulatedStatsCounter = 0;
// Aggregating values
for (ProducerAO producer : decorator.getProducers()) {
for (StatLineAO line : producer.getLines()) {
if (!CUMULATED_STAT_NAME_VALUE.equals(line.getStatName())) {
final StatLineAO cumulatedStatLine = new StatLineAO();
cumulatedStatLine.setStatName(CUMULATED_STAT_NAME_VALUE);
if (decorator.getCumulatedStat() != null) {
cumulatedStatLine.setValues(mergeStatValues(decorator.getCumulatedStat().getValues(), line.getValues()));
} else {
cumulatedStatLine.setValues(line.getValues());
}
decorator.setCumulatedStat(cumulatedStatLine);
cumulatedStatsCounter++;
}
}
}
// Calculating specific values like ERate and Avg
if (decorator.getCumulatedStat() != null) {
// Finding Err and Req stats to calculate ERate
StatValueAO reqStat = null;
StatValueAO errStat = null;
for (StatValueAO value : decorator.getCumulatedStat().getValues()) {
if ("req".equalsIgnoreCase(value.getName())) {
reqStat = value;
} else if ("err".equalsIgnoreCase(value.getName())) {
errStat = value;
}
}
// After merging cumulated stats recalculate ERate and Avg
List<StatValueAO> cumulatedValues = new ArrayList<>();
for (StatValueAO value : decorator.getCumulatedStat().getValues()) {
try {
if ("avg".equalsIgnoreCase(value.getName())) {
Number averageSumNumber = NumberFormat.getNumberInstance(Locale.US).parse(value.getValue());
final DoubleValueAO average = new DoubleValueAO(value.getName(), averageSumNumber.doubleValue() / cumulatedStatsCounter);
cumulatedValues.add(average);
} else if ("erate".equalsIgnoreCase(value.getName()) && reqStat != null && errStat != null) {
Number errNumber = NumberFormat.getNumberInstance(Locale.US).parse(errStat.getValue());
Number reqNumber = NumberFormat.getNumberInstance(Locale.US).parse(reqStat.getValue());
final DoubleValueAO erate = new DoubleValueAO(value.getName(), errNumber.doubleValue() * 100 / reqNumber.doubleValue());
cumulatedValues.add(erate);
} else {
cumulatedValues.add(value);
}
}
catch (ParseException ex) {
LOGGER.warn("Can't parse stat values", ex);
}
}
decorator.getCumulatedStat().setValues(cumulatedValues);
}
} }
|
public class class_name {
private void populateCumulatedStats(final ProducerDecoratorBean decorator) {
if (decorator == null || decorator.getProducers().isEmpty()) {
LOGGER.warn("Producer's are empty");
return;
}
// Used to calculate cumulated Avg stat
int cumulatedStatsCounter = 0;
// Aggregating values
for (ProducerAO producer : decorator.getProducers()) {
for (StatLineAO line : producer.getLines()) {
if (!CUMULATED_STAT_NAME_VALUE.equals(line.getStatName())) {
final StatLineAO cumulatedStatLine = new StatLineAO();
cumulatedStatLine.setStatName(CUMULATED_STAT_NAME_VALUE);
if (decorator.getCumulatedStat() != null) {
cumulatedStatLine.setValues(mergeStatValues(decorator.getCumulatedStat().getValues(), line.getValues()));
} else {
cumulatedStatLine.setValues(line.getValues());
}
decorator.setCumulatedStat(cumulatedStatLine);
cumulatedStatsCounter++;
}
}
}
// Calculating specific values like ERate and Avg
if (decorator.getCumulatedStat() != null) {
// Finding Err and Req stats to calculate ERate
StatValueAO reqStat = null;
StatValueAO errStat = null;
for (StatValueAO value : decorator.getCumulatedStat().getValues()) {
if ("req".equalsIgnoreCase(value.getName())) {
reqStat = value;
} else if ("err".equalsIgnoreCase(value.getName())) {
errStat = value;
}
}
// After merging cumulated stats recalculate ERate and Avg
List<StatValueAO> cumulatedValues = new ArrayList<>();
for (StatValueAO value : decorator.getCumulatedStat().getValues()) {
try {
if ("avg".equalsIgnoreCase(value.getName())) {
Number averageSumNumber = NumberFormat.getNumberInstance(Locale.US).parse(value.getValue());
final DoubleValueAO average = new DoubleValueAO(value.getName(), averageSumNumber.doubleValue() / cumulatedStatsCounter);
cumulatedValues.add(average);
} else if ("erate".equalsIgnoreCase(value.getName()) && reqStat != null && errStat != null) {
Number errNumber = NumberFormat.getNumberInstance(Locale.US).parse(errStat.getValue());
Number reqNumber = NumberFormat.getNumberInstance(Locale.US).parse(reqStat.getValue());
final DoubleValueAO erate = new DoubleValueAO(value.getName(), errNumber.doubleValue() * 100 / reqNumber.doubleValue());
cumulatedValues.add(erate);
} else {
cumulatedValues.add(value);
}
}
catch (ParseException ex) {
LOGGER.warn("Can't parse stat values", ex); // depends on control dependency: [if], data = [none]
}
}
decorator.getCumulatedStat().setValues(cumulatedValues);
}
} }
|
public class class_name {
void handleGet(Object value,
MatchSpaceKey msg,
EvalCache cache,
Object contextValue,
SearchResults result)
throws MatchingException, BadMessageFormatMatchingException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.entry(this,
cclass,
"handleGet",
new Object[] {value,msg,cache,contextValue,result});
// Call the handleGet() method in the parent class but
// provide a context and we may need to call it multiple times
if (value != null && value instanceof SetValEvaluationContext)
{
// The "value" we get back is a list of wrapped string values and
// DOM nodes that we need to process individually
ArrayList nodeList = ((SetValEvaluationContext)value).getWrappedNodeList();
// Iterate over the nodes that were passed into us
Iterator iter = nodeList.iterator();
while(iter.hasNext())
{
WrappedNodeResults wrappedNode = (WrappedNodeResults)iter.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
tc.debug(this,cclass, "handleGet", "Processing node: " + wrappedNode);
// Need to be careful here, we propagate a Number, but the
// context for subsequent operations is the parent node.
// We retrieve a list of numbers each of which are processed
// in turn
ArrayList numberList = wrappedNode.getNumberList(id.getName());
if(numberList != null)
{
Iterator iterNumber= numberList.iterator();
while(iterNumber.hasNext())
{
Number num = (Number)iterNumber.next();
// Need to pass in an XPathEvaluationContext
SetValEvaluationContext xpEval = new SetValEvaluationContext(wrappedNode);
super.handleGet(num, msg, cache, xpEval, result);
} // eof while
} // eof if numberList not null
} // eof iteration over nodes
} // value not null
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "handleGet");
} }
|
public class class_name {
void handleGet(Object value,
MatchSpaceKey msg,
EvalCache cache,
Object contextValue,
SearchResults result)
throws MatchingException, BadMessageFormatMatchingException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.entry(this,
cclass,
"handleGet",
new Object[] {value,msg,cache,contextValue,result});
// Call the handleGet() method in the parent class but
// provide a context and we may need to call it multiple times
if (value != null && value instanceof SetValEvaluationContext)
{
// The "value" we get back is a list of wrapped string values and
// DOM nodes that we need to process individually
ArrayList nodeList = ((SetValEvaluationContext)value).getWrappedNodeList();
// Iterate over the nodes that were passed into us
Iterator iter = nodeList.iterator();
while(iter.hasNext())
{
WrappedNodeResults wrappedNode = (WrappedNodeResults)iter.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
tc.debug(this,cclass, "handleGet", "Processing node: " + wrappedNode);
// Need to be careful here, we propagate a Number, but the
// context for subsequent operations is the parent node.
// We retrieve a list of numbers each of which are processed
// in turn
ArrayList numberList = wrappedNode.getNumberList(id.getName());
if(numberList != null)
{
Iterator iterNumber= numberList.iterator();
while(iterNumber.hasNext())
{
Number num = (Number)iterNumber.next();
// Need to pass in an XPathEvaluationContext
SetValEvaluationContext xpEval = new SetValEvaluationContext(wrappedNode);
super.handleGet(num, msg, cache, xpEval, result); // depends on control dependency: [while], data = [none]
} // eof while
} // eof if numberList not null
} // eof iteration over nodes
} // value not null
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "handleGet");
} }
|
public class class_name {
public final Serializable nextValue(final String columName, final int columnIndex, final int type, final int meta,
boolean isBinary) {
fNull = nullBits.get(nullBitIndex++);
if (fNull) {
value = null;
javaType = mysqlToJavaType(type, meta, isBinary);
length = 0;
return null;
} else {
// Extracting field value from packed buffer.
return fetchValue(columName, columnIndex, type, meta, isBinary);
}
} }
|
public class class_name {
public final Serializable nextValue(final String columName, final int columnIndex, final int type, final int meta,
boolean isBinary) {
fNull = nullBits.get(nullBitIndex++);
if (fNull) {
value = null;
// depends on control dependency: [if], data = [none]
javaType = mysqlToJavaType(type, meta, isBinary);
// depends on control dependency: [if], data = [none]
length = 0;
// depends on control dependency: [if], data = [none]
return null;
// depends on control dependency: [if], data = [none]
} else {
// Extracting field value from packed buffer.
return fetchValue(columName, columnIndex, type, meta, isBinary);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void setParameters(Object[] args) {
//d470721 throw IllegalStateException if called from a
// lifecycle callback interceptor method. ivMethod is only
// set for AroundInvoke methods, so ivMethod being null
// indicates a lifecycle callback interceptor method.
if (ivMethod == null && !ivIsAroundConstruct) {
throw new IllegalStateException("InvocationContext.setParameter can not be called by lifecycle callback methods");
}
Constructor<?> con = getConstructor();
Class<?>[] parmTypes = con != null ? con.getParameterTypes() : ivMethod.getParameterTypes();
String debug = con != null ? "constructor: " + con.getName() : "business method: " + ivMethod.getName();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setParameters for " + debug);
}
int n = parmTypes.length;
if (args == null) // d386227
{
if (n > 0) {
throw new IllegalArgumentException("null not valid as argument for setParameters method.");
}
} else {
if (args.length != n) {
throw new IllegalArgumentException("wrong number of parameters for method being invoked.");
} else {
for (int i = 0; i < n; ++i) {
Class<?> parmType = parmTypes[i];
if (parmType.isPrimitive() == false) // d367572.6
{
if (args[i] != null && // d611096
(!parmType.isInstance(args[i]))) // d386227
{
throw new IllegalArgumentException("wrong data type for parameter " + (i + 1));
}
} else {
// d367572.6
// Verify argument corresponds to correct java primitive type.
if ((parmType == Integer.TYPE) && (!(args[i] instanceof Integer))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Integer");
} else if ((parmType == Long.TYPE) && (!(args[i] instanceof Long))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Long");
} else if ((parmType == Short.TYPE) && (!(args[i] instanceof Short))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Short");
} else if ((parmType == Boolean.TYPE) && (!(args[i] instanceof Boolean))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Boolean");
} else if ((parmType == Byte.TYPE) && (!(args[i] instanceof Byte))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Byte");
} else if ((parmType == Character.TYPE) && (!(args[i] instanceof Character))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Character");
} else if ((parmType == Float.TYPE) && (!(args[i] instanceof Float))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Float");
} else if ((parmType == Double.TYPE) && (!(args[i] instanceof Double))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Double");
}
}
}
// All of the arguments are of the correct data type, so set the parameters.
ivParameters = args;
ivParametersModified = true; //LIDB3294-41
}
}
} }
|
public class class_name {
@Override
public void setParameters(Object[] args) {
//d470721 throw IllegalStateException if called from a
// lifecycle callback interceptor method. ivMethod is only
// set for AroundInvoke methods, so ivMethod being null
// indicates a lifecycle callback interceptor method.
if (ivMethod == null && !ivIsAroundConstruct) {
throw new IllegalStateException("InvocationContext.setParameter can not be called by lifecycle callback methods");
}
Constructor<?> con = getConstructor();
Class<?>[] parmTypes = con != null ? con.getParameterTypes() : ivMethod.getParameterTypes();
String debug = con != null ? "constructor: " + con.getName() : "business method: " + ivMethod.getName();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setParameters for " + debug); // depends on control dependency: [if], data = [none]
}
int n = parmTypes.length;
if (args == null) // d386227
{
if (n > 0) {
throw new IllegalArgumentException("null not valid as argument for setParameters method.");
}
} else {
if (args.length != n) {
throw new IllegalArgumentException("wrong number of parameters for method being invoked.");
} else {
for (int i = 0; i < n; ++i) {
Class<?> parmType = parmTypes[i];
if (parmType.isPrimitive() == false) // d367572.6
{
if (args[i] != null && // d611096
(!parmType.isInstance(args[i]))) // d386227
{
throw new IllegalArgumentException("wrong data type for parameter " + (i + 1));
}
} else {
// d367572.6
// Verify argument corresponds to correct java primitive type.
if ((parmType == Integer.TYPE) && (!(args[i] instanceof Integer))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Integer");
} else if ((parmType == Long.TYPE) && (!(args[i] instanceof Long))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Long");
} else if ((parmType == Short.TYPE) && (!(args[i] instanceof Short))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Short");
} else if ((parmType == Boolean.TYPE) && (!(args[i] instanceof Boolean))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Boolean");
} else if ((parmType == Byte.TYPE) && (!(args[i] instanceof Byte))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Byte");
} else if ((parmType == Character.TYPE) && (!(args[i] instanceof Character))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Character");
} else if ((parmType == Float.TYPE) && (!(args[i] instanceof Float))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Float");
} else if ((parmType == Double.TYPE) && (!(args[i] instanceof Double))) {
throw new IllegalArgumentException("parameter " + (i + 1) + " is a "
+ args[i].getClass().getName()
+ ", but it is required to be a Double");
}
}
}
// All of the arguments are of the correct data type, so set the parameters.
ivParameters = args; // depends on control dependency: [if], data = [none]
ivParametersModified = true; //LIDB3294-41 // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
protected File getScriptUriAsFile(HttpServletRequest request) {
String uri = getScriptUri(request);
String real = servletContext.getRealPath(uri);
if (real == null) {
return null;
}
return new File(real).getAbsoluteFile();
} }
|
public class class_name {
protected File getScriptUriAsFile(HttpServletRequest request) {
String uri = getScriptUri(request);
String real = servletContext.getRealPath(uri);
if (real == null) {
return null; // depends on control dependency: [if], data = [none]
}
return new File(real).getAbsoluteFile();
} }
|
public class class_name {
public static void showPanel(final View panelLayout) {
final Activity activity = (Activity) panelLayout.getContext();
panelLayout.setVisibility(View.VISIBLE);
if (activity.getCurrentFocus() != null) {
KeyboardUtil.hideKeyboard(activity.getCurrentFocus());
}
} }
|
public class class_name {
public static void showPanel(final View panelLayout) {
final Activity activity = (Activity) panelLayout.getContext();
panelLayout.setVisibility(View.VISIBLE);
if (activity.getCurrentFocus() != null) {
KeyboardUtil.hideKeyboard(activity.getCurrentFocus()); // depends on control dependency: [if], data = [(activity.getCurrentFocus()]
}
} }
|
public class class_name {
void associate(final JmsJcaManagedConnection managedConnection) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "associate", managedConnection);
}
if (_managedConnection != null) {
_managedConnection.disassociateSession(this);
}
_managedConnection = managedConnection;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "associate");
}
} }
|
public class class_name {
void associate(final JmsJcaManagedConnection managedConnection) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "associate", managedConnection); // depends on control dependency: [if], data = [none]
}
if (_managedConnection != null) {
_managedConnection.disassociateSession(this); // depends on control dependency: [if], data = [none]
}
_managedConnection = managedConnection;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "associate"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public List<GoogleCloudStorageItemInfo> getItemInfos(List<StorageResourceId> resourceIds)
throws IOException {
List<GoogleCloudStorageItemInfo> result = new ArrayList<>(resourceIds.size());
List<StorageResourceId> request = new ArrayList<>(resourceIds.size());
// Populate the result list with items in the cache, and the request list with resources that
// still need to be resolved. Null items are added to the result list to preserve ordering.
for (StorageResourceId resourceId : resourceIds) {
GoogleCloudStorageItemInfo item = cache.getItem(resourceId);
if (item == null) {
request.add(resourceId);
}
result.add(item);
}
// Resolve all the resources which were not cached, cache them, and add them to the result list.
// Null entries in the result list are replaced by the fresh entries from the underlying
// GoogleCloudStorage.
if (!request.isEmpty()) {
List<GoogleCloudStorageItemInfo> response = super.getItemInfos(request);
Iterator<GoogleCloudStorageItemInfo> responseIterator = response.iterator();
// Iterate through the result set, replacing the null entries added previously with entries
// from the response.
for (int i = 0; i < result.size() && responseIterator.hasNext(); i++) {
if (result.get(i) == null) {
GoogleCloudStorageItemInfo item = responseIterator.next();
cache.putItem(item);
result.set(i, item);
}
}
}
return result;
} }
|
public class class_name {
@Override
public List<GoogleCloudStorageItemInfo> getItemInfos(List<StorageResourceId> resourceIds)
throws IOException {
List<GoogleCloudStorageItemInfo> result = new ArrayList<>(resourceIds.size());
List<StorageResourceId> request = new ArrayList<>(resourceIds.size());
// Populate the result list with items in the cache, and the request list with resources that
// still need to be resolved. Null items are added to the result list to preserve ordering.
for (StorageResourceId resourceId : resourceIds) {
GoogleCloudStorageItemInfo item = cache.getItem(resourceId);
if (item == null) {
request.add(resourceId); // depends on control dependency: [if], data = [none]
}
result.add(item);
}
// Resolve all the resources which were not cached, cache them, and add them to the result list.
// Null entries in the result list are replaced by the fresh entries from the underlying
// GoogleCloudStorage.
if (!request.isEmpty()) {
List<GoogleCloudStorageItemInfo> response = super.getItemInfos(request);
Iterator<GoogleCloudStorageItemInfo> responseIterator = response.iterator();
// Iterate through the result set, replacing the null entries added previously with entries
// from the response.
for (int i = 0; i < result.size() && responseIterator.hasNext(); i++) {
if (result.get(i) == null) {
GoogleCloudStorageItemInfo item = responseIterator.next();
cache.putItem(item);
result.set(i, item);
}
}
}
return result;
} }
|
public class class_name {
public String getUrl(String domain, String region) {
if (url != null) {
return url;
}
return urlFromUri(domain, region, uri);
} }
|
public class class_name {
public String getUrl(String domain, String region) {
if (url != null) {
return url; // depends on control dependency: [if], data = [none]
}
return urlFromUri(domain, region, uri);
} }
|
public class class_name {
private String toSQLPattern(String attribute) {
String pattern = attribute.replace("*", "%");
if (!pattern.startsWith("%")) {
pattern = "%" + pattern;
}
if (!pattern.endsWith("%")) {
pattern = pattern.concat("%");
}
return pattern;
} }
|
public class class_name {
private String toSQLPattern(String attribute) {
String pattern = attribute.replace("*", "%");
if (!pattern.startsWith("%")) {
pattern = "%" + pattern; // depends on control dependency: [if], data = [none]
}
if (!pattern.endsWith("%")) {
pattern = pattern.concat("%"); // depends on control dependency: [if], data = [none]
}
return pattern;
} }
|
public class class_name {
public Document next() {
if (!hasNext())
throw new NoSuchElementException("No further documents");
if (bufferError != null)
throw bufferError;
try {
return documentsToReturn.take();
} catch (InterruptedException ie) {
throw new IOError(ie);
}
} }
|
public class class_name {
public Document next() {
if (!hasNext())
throw new NoSuchElementException("No further documents");
if (bufferError != null)
throw bufferError;
try {
return documentsToReturn.take(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ie) {
throw new IOError(ie);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public double lookupPosterior( int value ) {
TldFernFeature found = table[value];
if( found == null ) {
return 0;
}
return found.posterior;
} }
|
public class class_name {
public double lookupPosterior( int value ) {
TldFernFeature found = table[value];
if( found == null ) {
return 0; // depends on control dependency: [if], data = [none]
}
return found.posterior;
} }
|
public class class_name {
public Optional<File> getLibDirectory() {
File[] directories = getParentDirectory().listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
return file.isDirectory() && file.getName().endsWith("lib");
}
});
if (directories.length == 0 || directories[0] == null) {
return Optional.empty();
}
return Optional.ofNullable(directories[0].getAbsoluteFile());
} }
|
public class class_name {
public Optional<File> getLibDirectory() {
File[] directories = getParentDirectory().listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
return file.isDirectory() && file.getName().endsWith("lib");
}
});
if (directories.length == 0 || directories[0] == null) {
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
return Optional.ofNullable(directories[0].getAbsoluteFile());
} }
|
public class class_name {
public static Map<String, String> toMap(String source) {
HashMap<String, String> responses = new HashMap<String, String>();
String values[] = source.split(";");
for (String value : values) {
String nv[] = value.split("=");
if (nv.length >= 2) {
responses.put(nv[0], nv[1]);
} else if (nv.length == 1) {
responses.put(nv[0], null);
}
}
return responses.size() != 0 ? responses : null;
} }
|
public class class_name {
public static Map<String, String> toMap(String source) {
HashMap<String, String> responses = new HashMap<String, String>();
String values[] = source.split(";");
for (String value : values) {
String nv[] = value.split("=");
if (nv.length >= 2) {
responses.put(nv[0], nv[1]); // depends on control dependency: [if], data = [none]
} else if (nv.length == 1) {
responses.put(nv[0], null); // depends on control dependency: [if], data = [none]
}
}
return responses.size() != 0 ? responses : null;
} }
|
public class class_name {
public int[] getPositions() {
int[] list;
if (assumeSinglePosition) {
list = new int[1];
list[0] = super.startPosition();
return list;
} else {
try {
processEncodedPayload();
list = mtasPosition.getPositions();
if (list != null) {
return mtasPosition.getPositions();
}
} catch (IOException e) {
log.debug(e);
// do nothing
}
int start = super.startPosition();
int end = super.endPosition();
list = new int[end - start];
for (int i = start; i < end; i++)
list[i - start] = i;
return list;
}
} }
|
public class class_name {
public int[] getPositions() {
int[] list;
if (assumeSinglePosition) {
list = new int[1]; // depends on control dependency: [if], data = [none]
list[0] = super.startPosition(); // depends on control dependency: [if], data = [none]
return list; // depends on control dependency: [if], data = [none]
} else {
try {
processEncodedPayload(); // depends on control dependency: [try], data = [none]
list = mtasPosition.getPositions(); // depends on control dependency: [try], data = [none]
if (list != null) {
return mtasPosition.getPositions(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
log.debug(e);
// do nothing
} // depends on control dependency: [catch], data = [none]
int start = super.startPosition();
int end = super.endPosition();
list = new int[end - start]; // depends on control dependency: [if], data = [none]
for (int i = start; i < end; i++)
list[i - start] = i;
return list; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public long[] executeInsert(Connection conn, DataObject object, boolean generatedKeys) throws SQLException {
PreparedStatement statement = conn.prepareStatement(_sql, generatedKeys ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS);
try {
load(statement, object);
long[] keys = new long[statement.executeUpdate()];
if (generatedKeys) {
ResultSet rs = statement.getGeneratedKeys();
for (int i = 0; rs.next(); ++i) {
keys[i] = rs.getLong(1);
}
rs.close();
}
return keys;
} finally {
statement.close();
}
} }
|
public class class_name {
public long[] executeInsert(Connection conn, DataObject object, boolean generatedKeys) throws SQLException {
PreparedStatement statement = conn.prepareStatement(_sql, generatedKeys ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS);
try {
load(statement, object);
long[] keys = new long[statement.executeUpdate()];
if (generatedKeys) {
ResultSet rs = statement.getGeneratedKeys();
for (int i = 0; rs.next(); ++i) {
keys[i] = rs.getLong(1); // depends on control dependency: [for], data = [i]
}
rs.close(); // depends on control dependency: [if], data = [none]
}
return keys;
} finally {
statement.close();
}
} }
|
public class class_name {
protected void processLink(Tag tag, String attr, CmsRelationType type) {
if (tag.getAttribute(attr) == null) {
return;
}
CmsLink link = null;
switch (m_mode) {
case PROCESS_LINKS:
// macros are replaced with links
link = m_linkTable.getLink(CmsMacroResolver.stripMacro(tag.getAttribute(attr)));
if (link != null) {
// link management check
String l = link.getLink(m_cms);
if (TAG_PARAM.equals(tag.getTagName())) {
// HACK: to distinguish link parameters the link itself has to end with '&' or '?'
// another solution should be a kind of macro...
if (!l.endsWith(CmsRequestUtil.URL_DELIMITER)
&& !l.endsWith(CmsRequestUtil.PARAMETER_DELIMITER)) {
if (l.indexOf(CmsRequestUtil.URL_DELIMITER) > 0) {
l += CmsRequestUtil.PARAMETER_DELIMITER;
} else {
l += CmsRequestUtil.URL_DELIMITER;
}
}
}
// set the real target
tag.setAttribute(attr, CmsEncoder.escapeXml(l));
}
break;
case REPLACE_LINKS:
// links are replaced with macros
String targetUri = tag.getAttribute(attr);
if (CmsStringUtil.isNotEmpty(targetUri)) {
String internalUri = null;
if (!CmsMacroResolver.isMacro(targetUri)) {
m_cms.getRequestContext().setAttribute(
CmsDefaultLinkSubstitutionHandler.DONT_USE_CURRENT_SITE_FOR_WORKPLACE_REQUESTS,
"true");
internalUri = OpenCms.getLinkManager().getRootPath(m_cms, targetUri, m_relativePath);
}
// HACK: to distinguish link parameters the link itself has to end with '&' or '?'
// another solution should be a kind of macro...
if (!TAG_PARAM.equals(tag.getTagName())
|| targetUri.endsWith(CmsRequestUtil.URL_DELIMITER)
|| targetUri.endsWith(CmsRequestUtil.PARAMETER_DELIMITER)) {
if (internalUri != null) {
internalUri = rewriteUri(internalUri);
// this is an internal link
link = m_linkTable.addLink(type, internalUri, true);
// link management check
link.checkConsistency(m_cms);
if ("IMG".equals(tag.getTagName()) || TAG_AREA.equals(tag.getTagName())) {
// now ensure the image has the "alt" attribute set
setAltAttributeFromTitle(tag, internalUri);
}
} else {
// this is an external link
link = m_linkTable.addLink(type, targetUri, false);
}
}
if (link != null) {
tag.setAttribute(attr, CmsMacroResolver.formatMacro(link.getName()));
}
}
break;
default: // empty
}
} }
|
public class class_name {
protected void processLink(Tag tag, String attr, CmsRelationType type) {
if (tag.getAttribute(attr) == null) {
return; // depends on control dependency: [if], data = [none]
}
CmsLink link = null;
switch (m_mode) {
case PROCESS_LINKS:
// macros are replaced with links
link = m_linkTable.getLink(CmsMacroResolver.stripMacro(tag.getAttribute(attr)));
if (link != null) {
// link management check
String l = link.getLink(m_cms);
if (TAG_PARAM.equals(tag.getTagName())) {
// HACK: to distinguish link parameters the link itself has to end with '&' or '?'
// another solution should be a kind of macro...
if (!l.endsWith(CmsRequestUtil.URL_DELIMITER)
&& !l.endsWith(CmsRequestUtil.PARAMETER_DELIMITER)) {
if (l.indexOf(CmsRequestUtil.URL_DELIMITER) > 0) {
l += CmsRequestUtil.PARAMETER_DELIMITER; // depends on control dependency: [if], data = [none]
} else {
l += CmsRequestUtil.URL_DELIMITER; // depends on control dependency: [if], data = [none]
}
}
}
// set the real target
tag.setAttribute(attr, CmsEncoder.escapeXml(l)); // depends on control dependency: [if], data = [none]
}
break;
case REPLACE_LINKS:
// links are replaced with macros
String targetUri = tag.getAttribute(attr);
if (CmsStringUtil.isNotEmpty(targetUri)) {
String internalUri = null;
if (!CmsMacroResolver.isMacro(targetUri)) {
m_cms.getRequestContext().setAttribute(
CmsDefaultLinkSubstitutionHandler.DONT_USE_CURRENT_SITE_FOR_WORKPLACE_REQUESTS,
"true"); // depends on control dependency: [if], data = [none]
internalUri = OpenCms.getLinkManager().getRootPath(m_cms, targetUri, m_relativePath); // depends on control dependency: [if], data = [none]
}
// HACK: to distinguish link parameters the link itself has to end with '&' or '?'
// another solution should be a kind of macro...
if (!TAG_PARAM.equals(tag.getTagName())
|| targetUri.endsWith(CmsRequestUtil.URL_DELIMITER)
|| targetUri.endsWith(CmsRequestUtil.PARAMETER_DELIMITER)) {
if (internalUri != null) {
internalUri = rewriteUri(internalUri); // depends on control dependency: [if], data = [(internalUri]
// this is an internal link
link = m_linkTable.addLink(type, internalUri, true); // depends on control dependency: [if], data = [none]
// link management check
link.checkConsistency(m_cms); // depends on control dependency: [if], data = [none]
if ("IMG".equals(tag.getTagName()) || TAG_AREA.equals(tag.getTagName())) {
// now ensure the image has the "alt" attribute set
setAltAttributeFromTitle(tag, internalUri); // depends on control dependency: [if], data = [none]
}
} else {
// this is an external link
link = m_linkTable.addLink(type, targetUri, false); // depends on control dependency: [if], data = [none]
}
}
if (link != null) {
tag.setAttribute(attr, CmsMacroResolver.formatMacro(link.getName())); // depends on control dependency: [if], data = [(link]
}
}
break;
default: // empty
}
} }
|
public class class_name {
private ServletEvent getServletEvent() {
if (event == null) {
event = new ServletEvent(this, getServletContext(), this.getServletAndFileName(), getFileName());
}
return event;
} }
|
public class class_name {
private ServletEvent getServletEvent() {
if (event == null) {
event = new ServletEvent(this, getServletContext(), this.getServletAndFileName(), getFileName()); // depends on control dependency: [if], data = [none]
}
return event;
} }
|
public class class_name {
@Override
public boolean cancel(final boolean mayInterruptIfRunning) {
synchronized (lock) {
if (isDone()) {
return false;
}
throwable = new CancellationException();
lock.notifyAll();
return true;
}
} }
|
public class class_name {
@Override
public boolean cancel(final boolean mayInterruptIfRunning) {
synchronized (lock) {
if (isDone()) {
return false; // depends on control dependency: [if], data = [none]
}
throwable = new CancellationException();
lock.notifyAll();
return true;
}
} }
|
public class class_name {
public final boolean registerProgramAsMBean(final Class<?> clazz) {
RemoteProgram remoteProgram = RemotePrograms.getRemoteProgram(clazz.getCanonicalName());
if (remoteProgram==null) {
LaunchingMessageKind.EJMX0003.format(clazz.getCanonicalName());
return false;
}
if (this.mbs == null) {
LaunchingMessageKind.EJMX0002.format();
return false;
}
try {
final String fqnName = remoteProgram.getAdapterClass().getCanonicalName();
final String domain = fqnName.substring(0, fqnName.lastIndexOf('.'));
final String type = fqnName.substring(fqnName.lastIndexOf('.') + 1);
if (Arrays.asList(clazz.getInterfaces()).contains(
Adapter.class)) {
final DynamicLegacyProgram dprogram = new DynamicLegacyProgram(
remoteProgram);
final ObjectName objectName = new ObjectName(String.format(
beanNameFormat, domain, type));
this.beanNames.add(objectName);
if (!mbs.isRegistered(objectName)) {
LaunchingMessageKind.IJMX0004.format(objectName);
mbs.registerMBean(dprogram, objectName);
LaunchingMessageKind.IJMX0005.format(objectName);
}
} else {
LaunchingMessageKind.EJMX0003.format(clazz);
return false;
}
} catch (MalformedObjectNameException e) {
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
} catch (NullPointerException e) {
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
} catch (InstanceAlreadyExistsException e) {
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
} catch (MBeanRegistrationException e) {
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
} catch (NotCompliantMBeanException e) {
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
}
return true;
} }
|
public class class_name {
public final boolean registerProgramAsMBean(final Class<?> clazz) {
RemoteProgram remoteProgram = RemotePrograms.getRemoteProgram(clazz.getCanonicalName());
if (remoteProgram==null) {
LaunchingMessageKind.EJMX0003.format(clazz.getCanonicalName()); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
if (this.mbs == null) {
LaunchingMessageKind.EJMX0002.format(); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
try {
final String fqnName = remoteProgram.getAdapterClass().getCanonicalName();
final String domain = fqnName.substring(0, fqnName.lastIndexOf('.'));
final String type = fqnName.substring(fqnName.lastIndexOf('.') + 1);
if (Arrays.asList(clazz.getInterfaces()).contains(
Adapter.class)) {
final DynamicLegacyProgram dprogram = new DynamicLegacyProgram(
remoteProgram);
final ObjectName objectName = new ObjectName(String.format(
beanNameFormat, domain, type));
this.beanNames.add(objectName); // depends on control dependency: [if], data = [none]
if (!mbs.isRegistered(objectName)) {
LaunchingMessageKind.IJMX0004.format(objectName); // depends on control dependency: [if], data = [none]
mbs.registerMBean(dprogram, objectName); // depends on control dependency: [if], data = [none]
LaunchingMessageKind.IJMX0005.format(objectName); // depends on control dependency: [if], data = [none]
}
} else {
LaunchingMessageKind.EJMX0003.format(clazz); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
} catch (MalformedObjectNameException e) {
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
} catch (NullPointerException e) { // depends on control dependency: [catch], data = [none]
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
} catch (InstanceAlreadyExistsException e) { // depends on control dependency: [catch], data = [none]
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
} catch (MBeanRegistrationException e) { // depends on control dependency: [catch], data = [none]
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
} catch (NotCompliantMBeanException e) { // depends on control dependency: [catch], data = [none]
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
} // depends on control dependency: [catch], data = [none]
return true;
} }
|
public class class_name {
@Override
public Map<SocketAddress, String> getVersions() {
final Map<SocketAddress, String> rv =
new ConcurrentHashMap<SocketAddress, String>();
CountDownLatch blatch = broadcastOp(new BroadcastOpFactory() {
@Override
public Operation newOp(final MemcachedNode n,
final CountDownLatch latch) {
final SocketAddress sa = n.getSocketAddress();
return opFact.version(new OperationCallback() {
@Override
public void receivedStatus(OperationStatus s) {
rv.put(sa, s.getMessage());
}
@Override
public void complete() {
latch.countDown();
}
});
}
});
try {
blatch.await(operationTimeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for versions", e);
}
return rv;
} }
|
public class class_name {
@Override
public Map<SocketAddress, String> getVersions() {
final Map<SocketAddress, String> rv =
new ConcurrentHashMap<SocketAddress, String>();
CountDownLatch blatch = broadcastOp(new BroadcastOpFactory() {
@Override
public Operation newOp(final MemcachedNode n,
final CountDownLatch latch) {
final SocketAddress sa = n.getSocketAddress();
return opFact.version(new OperationCallback() {
@Override
public void receivedStatus(OperationStatus s) {
rv.put(sa, s.getMessage());
}
@Override
public void complete() {
latch.countDown();
}
});
}
});
try {
blatch.await(operationTimeout, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for versions", e);
} // depends on control dependency: [catch], data = [none]
return rv;
} }
|
public class class_name {
public void receive(IncomingT element) {
assert adminExecutor.inEventLoop();
if (stopped) {
return;
}
if (window.isZero() || maxEvents == 1) {
LOG.debug(
"Received {}, flushing immediately (window = {}, maxEvents = {})",
element,
window,
maxEvents);
onFlush.accept(coalescer.apply(ImmutableList.of(element)));
} else {
currentBatch.add(element);
if (currentBatch.size() == maxEvents) {
LOG.debug(
"Received {}, flushing immediately (because {} accumulated events)",
element,
maxEvents);
flushNow();
} else {
LOG.debug("Received {}, scheduling next flush in {}", element, window);
scheduleFlush();
}
}
} }
|
public class class_name {
public void receive(IncomingT element) {
assert adminExecutor.inEventLoop();
if (stopped) {
return; // depends on control dependency: [if], data = [none]
}
if (window.isZero() || maxEvents == 1) {
LOG.debug(
"Received {}, flushing immediately (window = {}, maxEvents = {})",
element,
window,
maxEvents);
onFlush.accept(coalescer.apply(ImmutableList.of(element))); // depends on control dependency: [if], data = [none]
} else {
currentBatch.add(element); // depends on control dependency: [if], data = [none]
if (currentBatch.size() == maxEvents) {
LOG.debug(
"Received {}, flushing immediately (because {} accumulated events)",
element,
maxEvents); // depends on control dependency: [if], data = [none]
flushNow(); // depends on control dependency: [if], data = [none]
} else {
LOG.debug("Received {}, scheduling next flush in {}", element, window); // depends on control dependency: [if], data = [none]
scheduleFlush(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
protected Object[] setupSubmitFaxJobInput(FaxJob faxJob)
{
//init list
List<Object> inputList=new LinkedList<Object>();
//set fax server information
inputList.add(this.faxServerName);
//set fax values
File file=faxJob.getFile();
inputList.add(file);
String documentName=faxJob.getProperty(FaxJobExtendedPropertyConstants.DOCUMENT_NAME_FAX_JOB_PROPERTY_KEY.toString(),null);
if((documentName==null)||(documentName.length()==0))
{
documentName=file.getName();
}
inputList.add(documentName);
if(this.useWin2kAPI)
{
//set target information
inputList.add(faxJob.getTargetAddress());
inputList.add(faxJob.getTargetName());
//set sender information
inputList.add(faxJob.getSenderName());
inputList.add(faxJob.getSenderFaxNumber());
}
else
{
FaxJobPriority priority=faxJob.getPriority();
String valueStr="fptNORMAL";
if(priority!=null)
{
switch(priority)
{
case LOW_PRIORITY:
valueStr="fptLOW";
break;
case MEDIUM_PRIORITY:
valueStr="fptNORMAL";
break;
case HIGH_PRIORITY:
valueStr="fptHIGH";
break;
}
}
inputList.add(valueStr);
//set target information
inputList.add(faxJob.getTargetAddress());
inputList.add(faxJob.getTargetName());
//set sender information
inputList.add(faxJob.getSenderName());
inputList.add(faxJob.getSenderFaxNumber());
inputList.add(faxJob.getSenderEmail());
}
//convert to array
int size=inputList.size();
Object[] input=inputList.toArray(new Object[size]);
return input;
} }
|
public class class_name {
protected Object[] setupSubmitFaxJobInput(FaxJob faxJob)
{
//init list
List<Object> inputList=new LinkedList<Object>();
//set fax server information
inputList.add(this.faxServerName);
//set fax values
File file=faxJob.getFile();
inputList.add(file);
String documentName=faxJob.getProperty(FaxJobExtendedPropertyConstants.DOCUMENT_NAME_FAX_JOB_PROPERTY_KEY.toString(),null);
if((documentName==null)||(documentName.length()==0))
{
documentName=file.getName(); // depends on control dependency: [if], data = [none]
}
inputList.add(documentName);
if(this.useWin2kAPI)
{
//set target information
inputList.add(faxJob.getTargetAddress()); // depends on control dependency: [if], data = [none]
inputList.add(faxJob.getTargetName()); // depends on control dependency: [if], data = [none]
//set sender information
inputList.add(faxJob.getSenderName()); // depends on control dependency: [if], data = [none]
inputList.add(faxJob.getSenderFaxNumber()); // depends on control dependency: [if], data = [none]
}
else
{
FaxJobPriority priority=faxJob.getPriority();
String valueStr="fptNORMAL";
if(priority!=null)
{
switch(priority)
{
case LOW_PRIORITY:
valueStr="fptLOW";
break;
case MEDIUM_PRIORITY:
valueStr="fptNORMAL";
break;
case HIGH_PRIORITY:
valueStr="fptHIGH";
break;
}
}
inputList.add(valueStr); // depends on control dependency: [if], data = [none]
//set target information
inputList.add(faxJob.getTargetAddress()); // depends on control dependency: [if], data = [none]
inputList.add(faxJob.getTargetName()); // depends on control dependency: [if], data = [none]
//set sender information
inputList.add(faxJob.getSenderName()); // depends on control dependency: [if], data = [none]
inputList.add(faxJob.getSenderFaxNumber()); // depends on control dependency: [if], data = [none]
inputList.add(faxJob.getSenderEmail()); // depends on control dependency: [if], data = [none]
}
//convert to array
int size=inputList.size();
Object[] input=inputList.toArray(new Object[size]);
return input;
} }
|
public class class_name {
public Node wrap(String html) {
Validate.notEmpty(html);
Element context = parent() instanceof Element ? (Element) parent() : null;
List<Node> wrapChildren = NodeUtils.parser(this).parseFragmentInput(html, context, baseUri());
Node wrapNode = wrapChildren.get(0);
if (!(wrapNode instanceof Element)) // nothing to wrap with; noop
return null;
Element wrap = (Element) wrapNode;
Element deepest = getDeepChild(wrap);
parentNode.replaceChild(this, wrap);
deepest.addChildren(this);
// remainder (unbalanced wrap, like <div></div><p></p> -- The <p> is remainder
if (wrapChildren.size() > 0) {
//noinspection ForLoopReplaceableByForEach (beacause it allocates an Iterator which is wasteful here)
for (int i = 0; i < wrapChildren.size(); i++) {
Node remainder = wrapChildren.get(i);
remainder.parentNode.removeChild(remainder);
wrap.appendChild(remainder);
}
}
return this;
} }
|
public class class_name {
public Node wrap(String html) {
Validate.notEmpty(html);
Element context = parent() instanceof Element ? (Element) parent() : null;
List<Node> wrapChildren = NodeUtils.parser(this).parseFragmentInput(html, context, baseUri());
Node wrapNode = wrapChildren.get(0);
if (!(wrapNode instanceof Element)) // nothing to wrap with; noop
return null;
Element wrap = (Element) wrapNode;
Element deepest = getDeepChild(wrap);
parentNode.replaceChild(this, wrap);
deepest.addChildren(this);
// remainder (unbalanced wrap, like <div></div><p></p> -- The <p> is remainder
if (wrapChildren.size() > 0) {
//noinspection ForLoopReplaceableByForEach (beacause it allocates an Iterator which is wasteful here)
for (int i = 0; i < wrapChildren.size(); i++) {
Node remainder = wrapChildren.get(i);
remainder.parentNode.removeChild(remainder); // depends on control dependency: [for], data = [none]
wrap.appendChild(remainder); // depends on control dependency: [for], data = [none]
}
}
return this;
} }
|
public class class_name {
@Override
public void updateComponent(final Object data) {
MyDataBean myBean = (MyDataBean) data;
StringBuffer out = new StringBuffer();
out.append("Name: ").append(myBean.getName()).append("\n\n");
for (SomeDataBean bean : myBean.getMyBeans()) {
out.append("Field1: ").append(bean.getField1());
out.append("\nField2: ").append(bean.getField2()).append("\n\n");
}
beanDetails.setText(out.toString());
} }
|
public class class_name {
@Override
public void updateComponent(final Object data) {
MyDataBean myBean = (MyDataBean) data;
StringBuffer out = new StringBuffer();
out.append("Name: ").append(myBean.getName()).append("\n\n");
for (SomeDataBean bean : myBean.getMyBeans()) {
out.append("Field1: ").append(bean.getField1()); // depends on control dependency: [for], data = [bean]
out.append("\nField2: ").append(bean.getField2()).append("\n\n"); // depends on control dependency: [for], data = [bean]
}
beanDetails.setText(out.toString());
} }
|
public class class_name {
@Override
protected void validateComponent(final List<Diagnostic> diags) {
super.validateComponent(diags);
if (isMandatory() && !hasInputWithValue()) {
diags.add(createMandatoryDiagnostic());
}
} }
|
public class class_name {
@Override
protected void validateComponent(final List<Diagnostic> diags) {
super.validateComponent(diags);
if (isMandatory() && !hasInputWithValue()) {
diags.add(createMandatoryDiagnostic()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private boolean shouldRoundUp(int maximumDigits) {
if (maximumDigits < count) {
switch(roundingMode) {
case UP:
for (int i=maximumDigits; i<count; ++i) {
if (digits[i] != '0') {
return true;
}
}
break;
case DOWN:
break;
case CEILING:
for (int i=maximumDigits; i<count; ++i) {
if (digits[i] != '0') {
return !isNegative;
}
}
break;
case FLOOR:
for (int i=maximumDigits; i<count; ++i) {
if (digits[i] != '0') {
return isNegative;
}
}
break;
case HALF_UP:
if (digits[maximumDigits] >= '5') {
return true;
}
break;
case HALF_DOWN:
if (digits[maximumDigits] > '5') {
return true;
} else if (digits[maximumDigits] == '5' ) {
for (int i=maximumDigits+1; i<count; ++i) {
if (digits[i] != '0') {
return true;
}
}
}
break;
case HALF_EVEN:
// Implement IEEE half-even rounding
if (digits[maximumDigits] > '5') {
return true;
} else if (digits[maximumDigits] == '5' ) {
for (int i=maximumDigits+1; i<count; ++i) {
if (digits[i] != '0') {
return true;
}
}
return maximumDigits > 0 && (digits[maximumDigits-1] % 2 != 0);
}
break;
case UNNECESSARY:
for (int i=maximumDigits; i<count; ++i) {
if (digits[i] != '0') {
throw new ArithmeticException(
"Rounding needed with the rounding mode being set to RoundingMode.UNNECESSARY");
}
}
break;
default:
assert false;
}
}
return false;
} }
|
public class class_name {
private boolean shouldRoundUp(int maximumDigits) {
if (maximumDigits < count) {
switch(roundingMode) {
case UP:
for (int i=maximumDigits; i<count; ++i) {
if (digits[i] != '0') {
return true; // depends on control dependency: [if], data = [none]
}
}
break;
case DOWN:
break;
case CEILING:
for (int i=maximumDigits; i<count; ++i) {
if (digits[i] != '0') {
return !isNegative; // depends on control dependency: [if], data = [none]
}
}
break;
case FLOOR:
for (int i=maximumDigits; i<count; ++i) {
if (digits[i] != '0') {
return isNegative; // depends on control dependency: [if], data = [none]
}
}
break;
case HALF_UP:
if (digits[maximumDigits] >= '5') {
return true; // depends on control dependency: [if], data = [none]
}
break;
case HALF_DOWN:
if (digits[maximumDigits] > '5') {
return true; // depends on control dependency: [if], data = [none]
} else if (digits[maximumDigits] == '5' ) {
for (int i=maximumDigits+1; i<count; ++i) {
if (digits[i] != '0') {
return true; // depends on control dependency: [if], data = [none]
}
}
}
break;
case HALF_EVEN:
// Implement IEEE half-even rounding
if (digits[maximumDigits] > '5') {
return true; // depends on control dependency: [if], data = [none]
} else if (digits[maximumDigits] == '5' ) {
for (int i=maximumDigits+1; i<count; ++i) {
if (digits[i] != '0') {
return true; // depends on control dependency: [if], data = [none]
}
}
return maximumDigits > 0 && (digits[maximumDigits-1] % 2 != 0); // depends on control dependency: [if], data = [none]
}
break;
case UNNECESSARY:
for (int i=maximumDigits; i<count; ++i) {
if (digits[i] != '0') {
throw new ArithmeticException(
"Rounding needed with the rounding mode being set to RoundingMode.UNNECESSARY");
}
}
break;
default:
assert false;
}
}
return false;
} }
|
public class class_name {
public Matrix insertRow(int i, Vector row) {
if (i > rows || i < 0) {
throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + rows);
}
Matrix result;
if (columns == 0) {
result = blankOfShape(rows + 1, row.length());
} else {
result = blankOfShape(rows + 1, columns);
}
for (int ii = 0; ii < i; ii++) {
result.setRow(ii, getRow(ii));
}
result.setRow(i, row);
for (int ii = i; ii < rows; ii++) {
result.setRow(ii + 1, getRow(ii));
}
return result;
} }
|
public class class_name {
public Matrix insertRow(int i, Vector row) {
if (i > rows || i < 0) {
throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + rows);
}
Matrix result;
if (columns == 0) {
result = blankOfShape(rows + 1, row.length()); // depends on control dependency: [if], data = [none]
} else {
result = blankOfShape(rows + 1, columns); // depends on control dependency: [if], data = [none]
}
for (int ii = 0; ii < i; ii++) {
result.setRow(ii, getRow(ii)); // depends on control dependency: [for], data = [ii]
}
result.setRow(i, row);
for (int ii = i; ii < rows; ii++) {
result.setRow(ii + 1, getRow(ii)); // depends on control dependency: [for], data = [ii]
}
return result;
} }
|
public class class_name {
public static void add(short magic, Class clazz) {
if(magic < MIN_CUSTOM_MAGIC_NUMBER)
throw new IllegalArgumentException("magic ID (" + magic + ") must be >= " + MIN_CUSTOM_MAGIC_NUMBER);
if(magicMapUser.containsKey(magic) || classMap.containsKey(clazz))
alreadyInMagicMap(magic, clazz.getName());
Object inst=null;
try {
inst=clazz.getDeclaredConstructor().newInstance();
}
catch(Exception e) {
throw new IllegalStateException("failed creating instance " + clazz, e);
}
Object val=clazz;
if(Header.class.isAssignableFrom(clazz)) { // class is a header
checkSameId((Header)inst, magic);
val=((Header)inst).create();
}
if(Constructable.class.isAssignableFrom(clazz)) {
val=((Constructable)inst).create();
inst=((Supplier<?>)val).get();
if(!inst.getClass().equals(clazz))
throw new IllegalStateException(String.format("%s.create() returned the wrong class: %s\n",
clazz.getSimpleName(), inst.getClass().getSimpleName()));
}
magicMapUser.put(magic, val);
classMap.put(clazz, magic);
} }
|
public class class_name {
public static void add(short magic, Class clazz) {
if(magic < MIN_CUSTOM_MAGIC_NUMBER)
throw new IllegalArgumentException("magic ID (" + magic + ") must be >= " + MIN_CUSTOM_MAGIC_NUMBER);
if(magicMapUser.containsKey(magic) || classMap.containsKey(clazz))
alreadyInMagicMap(magic, clazz.getName());
Object inst=null;
try {
inst=clazz.getDeclaredConstructor().newInstance(); // depends on control dependency: [try], data = [none]
}
catch(Exception e) {
throw new IllegalStateException("failed creating instance " + clazz, e);
} // depends on control dependency: [catch], data = [none]
Object val=clazz;
if(Header.class.isAssignableFrom(clazz)) { // class is a header
checkSameId((Header)inst, magic); // depends on control dependency: [if], data = [none]
val=((Header)inst).create(); // depends on control dependency: [if], data = [none]
}
if(Constructable.class.isAssignableFrom(clazz)) {
val=((Constructable)inst).create(); // depends on control dependency: [if], data = [none]
inst=((Supplier<?>)val).get(); // depends on control dependency: [if], data = [none]
if(!inst.getClass().equals(clazz))
throw new IllegalStateException(String.format("%s.create() returned the wrong class: %s\n",
clazz.getSimpleName(), inst.getClass().getSimpleName()));
}
magicMapUser.put(magic, val);
classMap.put(clazz, magic);
} }
|
public class class_name {
@Override
public EClass getIfcFan() {
if (ifcFanEClass == null) {
ifcFanEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(261);
}
return ifcFanEClass;
} }
|
public class class_name {
@Override
public EClass getIfcFan() {
if (ifcFanEClass == null) {
ifcFanEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(261);
// depends on control dependency: [if], data = [none]
}
return ifcFanEClass;
} }
|
public class class_name {
public void update()
{
IProcess process = fConsole.getProcess();
if (process != null)
{
setEnabled(process.canTerminate());
}
} }
|
public class class_name {
public void update()
{
IProcess process = fConsole.getProcess();
if (process != null)
{
setEnabled(process.canTerminate()); // depends on control dependency: [if], data = [(process]
}
} }
|
public class class_name {
public static int copyToSheet(HSSFSheet parentSheet, int parentSheetRow, int parentSheetColumn, HSSFSheet sheet, boolean copyStyle) {
int maxColumnNum = 0;
Map<Integer, HSSFCellStyle> styleMap = (copyStyle) ? new HashMap<Integer, HSSFCellStyle>() : null;
for (int i = sheet.getFirstRowNum(); i <= sheet.getLastRowNum(); i++) {
HSSFRow srcRow = sheet.getRow(i);
HSSFRow destRow;
// subreport is not the first cell in a row
if ((parentSheetColumn > 0) && (i == sheet.getFirstRowNum())) {
destRow = parentSheet.getRow(parentSheetRow);
} else {
destRow = parentSheet.getRow(parentSheetRow+i);
if (destRow == null) {
destRow = parentSheet.createRow(parentSheetRow + i);
}
}
if (srcRow != null) {
XlsUtil.copyRow(sheet, parentSheet, parentSheetRow, parentSheetColumn, srcRow, destRow, styleMap);
if (srcRow.getLastCellNum() > maxColumnNum) {
maxColumnNum = srcRow.getLastCellNum();
}
}
}
for (int i = 0; i <= maxColumnNum; i++) {
parentSheet.setColumnWidth(i, sheet.getColumnWidth(i));
}
return maxColumnNum;
} }
|
public class class_name {
public static int copyToSheet(HSSFSheet parentSheet, int parentSheetRow, int parentSheetColumn, HSSFSheet sheet, boolean copyStyle) {
int maxColumnNum = 0;
Map<Integer, HSSFCellStyle> styleMap = (copyStyle) ? new HashMap<Integer, HSSFCellStyle>() : null;
for (int i = sheet.getFirstRowNum(); i <= sheet.getLastRowNum(); i++) {
HSSFRow srcRow = sheet.getRow(i);
HSSFRow destRow;
// subreport is not the first cell in a row
if ((parentSheetColumn > 0) && (i == sheet.getFirstRowNum())) {
destRow = parentSheet.getRow(parentSheetRow); // depends on control dependency: [if], data = [none]
} else {
destRow = parentSheet.getRow(parentSheetRow+i); // depends on control dependency: [if], data = [none]
if (destRow == null) {
destRow = parentSheet.createRow(parentSheetRow + i); // depends on control dependency: [if], data = [none]
}
}
if (srcRow != null) {
XlsUtil.copyRow(sheet, parentSheet, parentSheetRow, parentSheetColumn, srcRow, destRow, styleMap); // depends on control dependency: [if], data = [none]
if (srcRow.getLastCellNum() > maxColumnNum) {
maxColumnNum = srcRow.getLastCellNum(); // depends on control dependency: [if], data = [none]
}
}
}
for (int i = 0; i <= maxColumnNum; i++) {
parentSheet.setColumnWidth(i, sheet.getColumnWidth(i)); // depends on control dependency: [for], data = [i]
}
return maxColumnNum;
} }
|
public class class_name {
@Override
public byte[] toBytes(Object object)
{
Short s = null;
if (object != null)
{
if (object.getClass().isAssignableFrom(String.class))
{
s = Short.valueOf(object.toString());
}
else
{
s = (Short) object;
}
return new byte[] { (byte) ((s >> 8) & 0xff), (byte) ((s >> 0) & 0xff), };
}
return null;
} }
|
public class class_name {
@Override
public byte[] toBytes(Object object)
{
Short s = null;
if (object != null)
{
if (object.getClass().isAssignableFrom(String.class))
{
s = Short.valueOf(object.toString()); // depends on control dependency: [if], data = [none]
}
else
{
s = (Short) object; // depends on control dependency: [if], data = [none]
}
return new byte[] { (byte) ((s >> 8) & 0xff), (byte) ((s >> 0) & 0xff), }; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.