code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public Component resolveComponent(Dependency dependency)
throws InvalidComponentNameException, DependencyNotMeetException {
List<Component> meets = resolveComponents(dependency);
if (meets.isEmpty()) {
Set<Dependency> dependencies = new HashSet<Dependency>(cache.keySet());
for (Dependency dep : dependencies) {
if (dependency.accept(dep)) {
Resource resource = cache.get(dep);
meets.add(resolver.resolveComponent(dependency, resource));
//cache.remove(dep);
}
}
}
if (meets.isEmpty()) {
logger.trace("Can't find {} in current repository", dependency);
throw new DependencyNotMeetException(dependency);
}
return meets.get(0);
} } | public class class_name {
@Override
public Component resolveComponent(Dependency dependency)
throws InvalidComponentNameException, DependencyNotMeetException {
List<Component> meets = resolveComponents(dependency);
if (meets.isEmpty()) {
Set<Dependency> dependencies = new HashSet<Dependency>(cache.keySet());
for (Dependency dep : dependencies) {
if (dependency.accept(dep)) {
Resource resource = cache.get(dep);
meets.add(resolver.resolveComponent(dependency, resource)); // depends on control dependency: [if], data = [none]
//cache.remove(dep);
}
}
}
if (meets.isEmpty()) {
logger.trace("Can't find {} in current repository", dependency);
throw new DependencyNotMeetException(dependency);
}
return meets.get(0);
} } |
public class class_name {
public <T> void destroy() {
final Set<Entry<Bean<?>, Object>> beanSet = beanReferences.entrySet();
final Iterator<Entry<Bean<?>, Object>> i = beanSet.iterator();
Bean<?> bean;
while (i.hasNext()) {
bean = i.next().getKey();
final T instance = (T) beanReferences.get(bean);
destroyReference((Bean<T>) bean, instance);
}
beanReferences.clear();
} } | public class class_name {
public <T> void destroy() {
final Set<Entry<Bean<?>, Object>> beanSet = beanReferences.entrySet();
final Iterator<Entry<Bean<?>, Object>> i = beanSet.iterator();
Bean<?> bean;
while (i.hasNext()) {
bean = i.next().getKey(); // depends on control dependency: [while], data = [none]
final T instance = (T) beanReferences.get(bean);
destroyReference((Bean<T>) bean, instance); // depends on control dependency: [while], data = [none]
}
beanReferences.clear();
} } |
public class class_name {
public SimpleOrderedMap<Object> rewrite(
MtasSolrSearchComponent searchComponent) throws IOException {
SimpleOrderedMap<Object> response = new SimpleOrderedMap<>();
Iterator<Entry<String, Object>> it;
switch (action) {
case ComponentCollection.ACTION_LIST:
response.add("now", now);
response.add("list", list);
break;
case ComponentCollection.ACTION_CREATE:
case ComponentCollection.ACTION_POST:
case ComponentCollection.ACTION_IMPORT:
if (componentCollection != null && status != null) {
it = status.iterator();
while (it.hasNext()) {
Entry<String, Object> entry = it.next();
response.add(entry.getKey(), entry.getValue());
}
}
break;
case ComponentCollection.ACTION_CHECK:
if (status != null) {
it = status.iterator();
while (it.hasNext()) {
Entry<String, Object> entry = it.next();
response.add(entry.getKey(), entry.getValue());
}
}
break;
case ComponentCollection.ACTION_GET:
if (status != null) {
it = status.iterator();
while (it.hasNext()) {
Entry<String, Object> entry = it.next();
response.add(entry.getKey(), entry.getValue());
}
}
if (values != null) {
response.add("values", values);
}
break;
default:
break;
}
return response;
} } | public class class_name {
public SimpleOrderedMap<Object> rewrite(
MtasSolrSearchComponent searchComponent) throws IOException {
SimpleOrderedMap<Object> response = new SimpleOrderedMap<>();
Iterator<Entry<String, Object>> it;
switch (action) {
case ComponentCollection.ACTION_LIST:
response.add("now", now);
response.add("list", list);
break;
case ComponentCollection.ACTION_CREATE:
case ComponentCollection.ACTION_POST:
case ComponentCollection.ACTION_IMPORT:
if (componentCollection != null && status != null) {
it = status.iterator(); // depends on control dependency: [if], data = [none]
while (it.hasNext()) {
Entry<String, Object> entry = it.next();
response.add(entry.getKey(), entry.getValue()); // depends on control dependency: [while], data = [none]
}
}
break;
case ComponentCollection.ACTION_CHECK:
if (status != null) {
it = status.iterator(); // depends on control dependency: [if], data = [none]
while (it.hasNext()) {
Entry<String, Object> entry = it.next();
response.add(entry.getKey(), entry.getValue()); // depends on control dependency: [while], data = [none]
}
}
break;
case ComponentCollection.ACTION_GET:
if (status != null) {
it = status.iterator(); // depends on control dependency: [if], data = [none]
while (it.hasNext()) {
Entry<String, Object> entry = it.next();
response.add(entry.getKey(), entry.getValue()); // depends on control dependency: [while], data = [none]
}
}
if (values != null) {
response.add("values", values); // depends on control dependency: [if], data = [none]
}
break;
default:
break;
}
return response;
} } |
public class class_name {
public final void run(Closure templateCallback) {
reset();
setRunning();
doSetup();
while (processing()) {
templateCallback.call(doWork());
}
setCompleted();
doCleanup();
} } | public class class_name {
public final void run(Closure templateCallback) {
reset();
setRunning();
doSetup();
while (processing()) {
templateCallback.call(doWork()); // depends on control dependency: [while], data = [none]
}
setCompleted();
doCleanup();
} } |
public class class_name {
public static String stripSqlCommentsAndWhitespacesFromTheEnd(String sqlString) {
if (isEmpty(sqlString)) {
return sqlString;
}
StringBuilder str = new StringBuilder(sqlString);
boolean strModified = true;
while (strModified) {
strModified = false;
// first check for last block comment
// since line comments could be inside block comments, we want to
// remove them first.
String lastBlockComment = getLastBlockComment(str.toString());
if (isNotEmpty(lastBlockComment)) {
str.setLength(str.length() - lastBlockComment.length());
// we just modified the end of the string,
// do another loop to check for next block or line comments
strModified = true;
}
// now check for the line comments
String lastLineComment = getLastLineComment(str.toString());
if (isNotEmpty(lastLineComment)) {
str.setLength(str.length() - lastLineComment.length());
// we just modified the end of the string,
// do another loop to check for next block or line comments
strModified = true;
}
}
return trimRight(str.toString());
} } | public class class_name {
public static String stripSqlCommentsAndWhitespacesFromTheEnd(String sqlString) {
if (isEmpty(sqlString)) {
return sqlString; // depends on control dependency: [if], data = [none]
}
StringBuilder str = new StringBuilder(sqlString);
boolean strModified = true;
while (strModified) {
strModified = false; // depends on control dependency: [while], data = [none]
// first check for last block comment
// since line comments could be inside block comments, we want to
// remove them first.
String lastBlockComment = getLastBlockComment(str.toString());
if (isNotEmpty(lastBlockComment)) {
str.setLength(str.length() - lastBlockComment.length()); // depends on control dependency: [if], data = [none]
// we just modified the end of the string,
// do another loop to check for next block or line comments
strModified = true; // depends on control dependency: [if], data = [none]
}
// now check for the line comments
String lastLineComment = getLastLineComment(str.toString());
if (isNotEmpty(lastLineComment)) {
str.setLength(str.length() - lastLineComment.length()); // depends on control dependency: [if], data = [none]
// we just modified the end of the string,
// do another loop to check for next block or line comments
strModified = true; // depends on control dependency: [if], data = [none]
}
}
return trimRight(str.toString());
} } |
public class class_name {
public boolean mapWorldToTarget()
{
GVRSkeleton srcskel = mSourceSkeleton;
GVRSkeleton dstskel = mDestSkeleton;
if ((dstskel == null) || (srcskel == null))
{
return false;
}
if (mBoneMap == null)
{
mBoneMap = makeBoneMap(srcskel, dstskel);
}
GVRPose srcpose = srcskel.getPose();
GVRPose dstpose = dstskel.getPose();
Vector3f v = new Vector3f();
int numsrcbones = srcpose.getNumBones();
Matrix4f mtx = new Matrix4f();
srcpose.sync();
srcpose.getWorldPosition(0, v);
dstpose.setPosition(v.x, v.y, v.z);
for (int i = 0; i < numsrcbones; ++i)
{
int boneindex = mBoneMap[i];
if (boneindex >= 0)
{
srcpose.getWorldMatrix(i, mtx);
dstpose.setWorldMatrix(boneindex, mtx);
}
}
dstpose.sync();
return true;
} } | public class class_name {
public boolean mapWorldToTarget()
{
GVRSkeleton srcskel = mSourceSkeleton;
GVRSkeleton dstskel = mDestSkeleton;
if ((dstskel == null) || (srcskel == null))
{
return false; // depends on control dependency: [if], data = [none]
}
if (mBoneMap == null)
{
mBoneMap = makeBoneMap(srcskel, dstskel); // depends on control dependency: [if], data = [none]
}
GVRPose srcpose = srcskel.getPose();
GVRPose dstpose = dstskel.getPose();
Vector3f v = new Vector3f();
int numsrcbones = srcpose.getNumBones();
Matrix4f mtx = new Matrix4f();
srcpose.sync();
srcpose.getWorldPosition(0, v);
dstpose.setPosition(v.x, v.y, v.z);
for (int i = 0; i < numsrcbones; ++i)
{
int boneindex = mBoneMap[i];
if (boneindex >= 0)
{
srcpose.getWorldMatrix(i, mtx); // depends on control dependency: [if], data = [none]
dstpose.setWorldMatrix(boneindex, mtx); // depends on control dependency: [if], data = [(boneindex]
}
}
dstpose.sync();
return true;
} } |
public class class_name {
public String getClassification() {
Metadata metadata;
try {
metadata = this.getMetadata(Metadata.CLASSIFICATION_TEMPLATE_KEY);
} catch (BoxAPIException e) {
JsonObject responseObject = JsonObject.readFrom(e.getResponse());
String code = responseObject.get("code").asString();
if (e.getResponseCode() == 404 && code.equals("instance_not_found")) {
return null;
} else {
throw e;
}
}
return metadata.getString(Metadata.CLASSIFICATION_KEY);
} } | public class class_name {
public String getClassification() {
Metadata metadata;
try {
metadata = this.getMetadata(Metadata.CLASSIFICATION_TEMPLATE_KEY); // depends on control dependency: [try], data = [none]
} catch (BoxAPIException e) {
JsonObject responseObject = JsonObject.readFrom(e.getResponse());
String code = responseObject.get("code").asString();
if (e.getResponseCode() == 404 && code.equals("instance_not_found")) {
return null; // depends on control dependency: [if], data = [none]
} else {
throw e;
}
} // depends on control dependency: [catch], data = [none]
return metadata.getString(Metadata.CLASSIFICATION_KEY);
} } |
public class class_name {
public void add(String metricIndex, long docCount) {
final String[] tokens = metricIndex.split(METRIC_TOKEN_SEPARATOR_REGEX);
/**
*
* For the ES response shown in class description, for a baseLevel of 2,
* the data is classified as follows
*
* metricNamesWithNextLevelSet -> {foo.bar.baz} (Metric Names which are at base + 1 level and also have a subsequent level.)
*
* For count map, data is in the form {metricIndex, (actualDocCount, childrenTotalDocCount)}
*
* metricNameBaseLevelMap -> {foo.bar.baz -> (2, 1)} (all indexes which are of same length as baseLevel)
*
*/
switch (tokens.length - baseLevel) {
case 1:
if (baseLevel > 0) {
metricNamesWithNextLevelSet.add(metricIndex.substring(0, metricIndex.lastIndexOf(".")));
} else {
metricNamesWithNextLevelSet.add(metricIndex.substring(0, metricIndex.indexOf(".")));
}
//For foo.bar.baz, baseLevel=3 we update children doc count of foo.bar.baz
addChildrenDocCount(metricNameBaseLevelMap,
metricIndex.substring(0, metricIndex.lastIndexOf(".")),
docCount);
break;
case 0:
setActualDocCount(metricNameBaseLevelMap, metricIndex, docCount);
break;
default:
break;
}
} } | public class class_name {
public void add(String metricIndex, long docCount) {
final String[] tokens = metricIndex.split(METRIC_TOKEN_SEPARATOR_REGEX);
/**
*
* For the ES response shown in class description, for a baseLevel of 2,
* the data is classified as follows
*
* metricNamesWithNextLevelSet -> {foo.bar.baz} (Metric Names which are at base + 1 level and also have a subsequent level.)
*
* For count map, data is in the form {metricIndex, (actualDocCount, childrenTotalDocCount)}
*
* metricNameBaseLevelMap -> {foo.bar.baz -> (2, 1)} (all indexes which are of same length as baseLevel)
*
*/
switch (tokens.length - baseLevel) {
case 1:
if (baseLevel > 0) {
metricNamesWithNextLevelSet.add(metricIndex.substring(0, metricIndex.lastIndexOf("."))); // depends on control dependency: [if], data = [none]
} else {
metricNamesWithNextLevelSet.add(metricIndex.substring(0, metricIndex.indexOf("."))); // depends on control dependency: [if], data = [none]
}
//For foo.bar.baz, baseLevel=3 we update children doc count of foo.bar.baz
addChildrenDocCount(metricNameBaseLevelMap,
metricIndex.substring(0, metricIndex.lastIndexOf(".")),
docCount);
break;
case 0:
setActualDocCount(metricNameBaseLevelMap, metricIndex, docCount);
break;
default:
break;
}
} } |
public class class_name {
public FleetData withLaunchTemplateConfigs(FleetLaunchTemplateConfig... launchTemplateConfigs) {
if (this.launchTemplateConfigs == null) {
setLaunchTemplateConfigs(new com.amazonaws.internal.SdkInternalList<FleetLaunchTemplateConfig>(launchTemplateConfigs.length));
}
for (FleetLaunchTemplateConfig ele : launchTemplateConfigs) {
this.launchTemplateConfigs.add(ele);
}
return this;
} } | public class class_name {
public FleetData withLaunchTemplateConfigs(FleetLaunchTemplateConfig... launchTemplateConfigs) {
if (this.launchTemplateConfigs == null) {
setLaunchTemplateConfigs(new com.amazonaws.internal.SdkInternalList<FleetLaunchTemplateConfig>(launchTemplateConfigs.length)); // depends on control dependency: [if], data = [none]
}
for (FleetLaunchTemplateConfig ele : launchTemplateConfigs) {
this.launchTemplateConfigs.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@PublicAPI(usage = ACCESS)
public JavaClasses importPaths(String... paths) {
Set<Path> pathSet = new HashSet<>();
for (String path : paths) {
pathSet.add(Paths.get(path));
}
return importPaths(pathSet);
} } | public class class_name {
@PublicAPI(usage = ACCESS)
public JavaClasses importPaths(String... paths) {
Set<Path> pathSet = new HashSet<>();
for (String path : paths) {
pathSet.add(Paths.get(path)); // depends on control dependency: [for], data = [path]
}
return importPaths(pathSet);
} } |
public class class_name {
static String findName(Param param, Object nameRetrievalTarget) {
requireNonNull(nameRetrievalTarget, "nameRetrievalTarget");
final String value = param.value();
if (DefaultValues.isSpecified(value)) {
checkArgument(!value.isEmpty(), "value is empty");
return value;
}
return getName(nameRetrievalTarget);
} } | public class class_name {
static String findName(Param param, Object nameRetrievalTarget) {
requireNonNull(nameRetrievalTarget, "nameRetrievalTarget");
final String value = param.value();
if (DefaultValues.isSpecified(value)) {
checkArgument(!value.isEmpty(), "value is empty"); // depends on control dependency: [if], data = [none]
return value; // depends on control dependency: [if], data = [none]
}
return getName(nameRetrievalTarget);
} } |
public class class_name {
public synchronized List<Long> getTicksOnStream()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getTicksOnStream");
List<Long> msgs = new ArrayList<Long>();
StateStream stateStream = getStateStream();
// Initial range in stream is always completed Range
stateStream.setCursor(0);
// skip this and move to next range
stateStream.getNext();
// Get the first TickRange after completed range and move cursor to the next one
TickRange tr = stateStream.getNext();
// Iterate until we reach final Unknown range
while (tr.endstamp < RangeList.INFINITY)
{
if( !(tr.type == TickRange.Completed) )
{
msgs.add(new Long(tr.startstamp));
}
tr = stateStream.getNext();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getTicksOnStream", msgs);
return msgs;
} } | public class class_name {
public synchronized List<Long> getTicksOnStream()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getTicksOnStream");
List<Long> msgs = new ArrayList<Long>();
StateStream stateStream = getStateStream();
// Initial range in stream is always completed Range
stateStream.setCursor(0);
// skip this and move to next range
stateStream.getNext();
// Get the first TickRange after completed range and move cursor to the next one
TickRange tr = stateStream.getNext();
// Iterate until we reach final Unknown range
while (tr.endstamp < RangeList.INFINITY)
{
if( !(tr.type == TickRange.Completed) )
{
msgs.add(new Long(tr.startstamp)); // depends on control dependency: [if], data = [none]
}
tr = stateStream.getNext(); // depends on control dependency: [while], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getTicksOnStream", msgs);
return msgs;
} } |
public class class_name {
protected void configureDescription(DescriptionConfigurable configurable, String objectName) {
Assert.notNull(configurable, "configurable");
Assert.notNull(objectName, "objectName");
String caption = loadMessage(objectName + "." + CAPTION_KEY);
if (StringUtils.hasText(caption)) {
configurable.setCaption(caption);
}
String description = loadMessage(objectName + "." + DESCRIPTION_KEY);
if (StringUtils.hasText(description)) {
configurable.setDescription(description);
}
} } | public class class_name {
protected void configureDescription(DescriptionConfigurable configurable, String objectName) {
Assert.notNull(configurable, "configurable");
Assert.notNull(objectName, "objectName");
String caption = loadMessage(objectName + "." + CAPTION_KEY);
if (StringUtils.hasText(caption)) {
configurable.setCaption(caption); // depends on control dependency: [if], data = [none]
}
String description = loadMessage(objectName + "." + DESCRIPTION_KEY);
if (StringUtils.hasText(description)) {
configurable.setDescription(description); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static Optional<JClassType> extractBeanType( TreeLogger logger, JacksonTypeOracle typeOracle, JType type, String propertyName
) {
if ( null != type.isWildcard() ) {
// we use the base type to find the serializer to use
type = type.isWildcard().getBaseType();
}
if ( null != type.isRawType() ) {
type = type.isRawType().getBaseType();
}
JArrayType arrayType = type.isArray();
if ( null != arrayType ) {
return extractBeanType( logger, typeOracle, arrayType.getComponentType(), propertyName );
}
JClassType classType = type.isClassOrInterface();
if ( null == classType ) {
return Optional.absent();
} else if ( typeOracle.isIterable( classType ) ) {
if ( (null == classType.isParameterized() || classType.isParameterized().getTypeArgs().length != 1) && (null == classType
.isGenericType() || classType.isGenericType().getTypeParameters().length != 1) ) {
logger.log( Type.INFO, "Expected one argument for the java.lang.Iterable '" + propertyName + "'. Applying annotations to " +
"type " + classType.getParameterizedQualifiedSourceName() );
return Optional.of( classType );
}
if ( null != classType.isParameterized() ) {
return extractBeanType( logger, typeOracle, classType.isParameterized().getTypeArgs()[0], propertyName );
} else {
return extractBeanType( logger, typeOracle, classType.isGenericType().getTypeParameters()[0].getBaseType(), propertyName );
}
} else if ( typeOracle.isMap( classType ) ) {
if ( (null == classType.isParameterized() || classType.isParameterized().getTypeArgs().length != 2) && (null == classType
.isGenericType() || classType.isGenericType().getTypeParameters().length != 2) ) {
logger.log( Type.INFO, "Expected two arguments for the java.util.Map '" + propertyName + "'. Applying annotations to " +
"type " + classType.getParameterizedQualifiedSourceName() );
return Optional.of( classType );
}
if ( null != classType.isParameterized() ) {
return extractBeanType( logger, typeOracle, classType.isParameterized().getTypeArgs()[1], propertyName );
} else {
return extractBeanType( logger, typeOracle, classType.isGenericType().getTypeParameters()[1].getBaseType(), propertyName );
}
} else {
return Optional.of( classType );
}
} } | public class class_name {
private static Optional<JClassType> extractBeanType( TreeLogger logger, JacksonTypeOracle typeOracle, JType type, String propertyName
) {
if ( null != type.isWildcard() ) {
// we use the base type to find the serializer to use
type = type.isWildcard().getBaseType(); // depends on control dependency: [if], data = [none]
}
if ( null != type.isRawType() ) {
type = type.isRawType().getBaseType(); // depends on control dependency: [if], data = [none]
}
JArrayType arrayType = type.isArray();
if ( null != arrayType ) {
return extractBeanType( logger, typeOracle, arrayType.getComponentType(), propertyName ); // depends on control dependency: [if], data = [none]
}
JClassType classType = type.isClassOrInterface();
if ( null == classType ) {
return Optional.absent(); // depends on control dependency: [if], data = [none]
} else if ( typeOracle.isIterable( classType ) ) {
if ( (null == classType.isParameterized() || classType.isParameterized().getTypeArgs().length != 1) && (null == classType
.isGenericType() || classType.isGenericType().getTypeParameters().length != 1) ) {
logger.log( Type.INFO, "Expected one argument for the java.lang.Iterable '" + propertyName + "'. Applying annotations to " +
"type " + classType.getParameterizedQualifiedSourceName() ); // depends on control dependency: [if], data = [none]
return Optional.of( classType ); // depends on control dependency: [if], data = [none]
}
if ( null != classType.isParameterized() ) {
return extractBeanType( logger, typeOracle, classType.isParameterized().getTypeArgs()[0], propertyName ); // depends on control dependency: [if], data = [none]
} else {
return extractBeanType( logger, typeOracle, classType.isGenericType().getTypeParameters()[0].getBaseType(), propertyName ); // depends on control dependency: [if], data = [none]
}
} else if ( typeOracle.isMap( classType ) ) {
if ( (null == classType.isParameterized() || classType.isParameterized().getTypeArgs().length != 2) && (null == classType
.isGenericType() || classType.isGenericType().getTypeParameters().length != 2) ) {
logger.log( Type.INFO, "Expected two arguments for the java.util.Map '" + propertyName + "'. Applying annotations to " +
"type " + classType.getParameterizedQualifiedSourceName() ); // depends on control dependency: [if], data = [none]
return Optional.of( classType ); // depends on control dependency: [if], data = [none]
}
if ( null != classType.isParameterized() ) {
return extractBeanType( logger, typeOracle, classType.isParameterized().getTypeArgs()[1], propertyName ); // depends on control dependency: [if], data = [none]
} else {
return extractBeanType( logger, typeOracle, classType.isGenericType().getTypeParameters()[1].getBaseType(), propertyName ); // depends on control dependency: [if], data = [none]
}
} else {
return Optional.of( classType ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public KeyArea setupKey(int iKeyArea)
{
KeyArea keyArea = null;
if (iKeyArea == 0)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY);
keyArea.addKeyField(ID, DBConstants.ASCENDING);
}
if (iKeyArea == 1)
{
keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, DESCRIPTION_KEY);
keyArea.addKeyField(DESCRIPTION, DBConstants.ASCENDING);
}
if (iKeyArea == 2)
{
keyArea = this.makeIndex(DBConstants.SECONDARY_KEY, CODE_KEY);
keyArea.addKeyField(CODE, DBConstants.ASCENDING);
}
if (iKeyArea == 3)
{
keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, MESSAGE_INFO_TYPE_ID_KEY);
keyArea.addKeyField(MESSAGE_INFO_TYPE_ID, DBConstants.ASCENDING);
keyArea.addKeyField(CONTACT_TYPE_ID, DBConstants.ASCENDING);
keyArea.addKeyField(REQUEST_TYPE_ID, DBConstants.ASCENDING);
}
if (keyArea == null)
keyArea = super.setupKey(iKeyArea);
return keyArea;
} } | public class class_name {
public KeyArea setupKey(int iKeyArea)
{
KeyArea keyArea = null;
if (iKeyArea == 0)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (iKeyArea == 1)
{
keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, DESCRIPTION_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(DESCRIPTION, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (iKeyArea == 2)
{
keyArea = this.makeIndex(DBConstants.SECONDARY_KEY, CODE_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(CODE, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (iKeyArea == 3)
{
keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, MESSAGE_INFO_TYPE_ID_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(MESSAGE_INFO_TYPE_ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(CONTACT_TYPE_ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(REQUEST_TYPE_ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (keyArea == null)
keyArea = super.setupKey(iKeyArea);
return keyArea;
} } |
public class class_name {
protected List<Reference> mergeReferences(
List<? extends Reference> references1,
List<? extends Reference> references2) {
List<Reference> result = new ArrayList<>();
for (Reference reference : references1) {
addBestReferenceToList(reference, result);
}
for (Reference reference : references2) {
addBestReferenceToList(reference, result);
}
return result;
} } | public class class_name {
protected List<Reference> mergeReferences(
List<? extends Reference> references1,
List<? extends Reference> references2) {
List<Reference> result = new ArrayList<>();
for (Reference reference : references1) {
addBestReferenceToList(reference, result); // depends on control dependency: [for], data = [reference]
}
for (Reference reference : references2) {
addBestReferenceToList(reference, result); // depends on control dependency: [for], data = [reference]
}
return result;
} } |
public class class_name {
public static <T> void reverseForEach(ArrayList<T> list, Procedure<? super T> procedure)
{
if (!list.isEmpty())
{
ArrayListIterate.forEach(list, list.size() - 1, 0, procedure);
}
} } | public class class_name {
public static <T> void reverseForEach(ArrayList<T> list, Procedure<? super T> procedure)
{
if (!list.isEmpty())
{
ArrayListIterate.forEach(list, list.size() - 1, 0, procedure); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void addWeekdayLabels() {
weekdayLabels = new ArrayList<JLabel>();
int weekdayLabelRowY = constantFirstWeekdayLabelCell.y;
int weekdayLabelWidthInCells = 1;
int weekdayLabelHeightInCells = 3;
for (int i = 0; i < 7; ++i) {
int weekdayLabelColumnX = (i + constantFirstWeekdayLabelCell.x);
JLabel weekdayLabel = new JLabel();
weekdayLabel.setHorizontalAlignment(SwingConstants.CENTER);
weekdayLabel.setVerticalAlignment(SwingConstants.CENTER);
weekdayLabel.setBorder(new EmptyBorder(0, 2, 0, 2));
weekdayLabel.setOpaque(true);
weekdayLabel.setText("wd" + i);
CellConstraints constraints = CC.xywh(weekdayLabelColumnX, weekdayLabelRowY,
weekdayLabelWidthInCells, weekdayLabelHeightInCells);
centerPanel.add(weekdayLabel, constraints);
weekdayLabels.add(weekdayLabel);
}
} } | public class class_name {
private void addWeekdayLabels() {
weekdayLabels = new ArrayList<JLabel>();
int weekdayLabelRowY = constantFirstWeekdayLabelCell.y;
int weekdayLabelWidthInCells = 1;
int weekdayLabelHeightInCells = 3;
for (int i = 0; i < 7; ++i) {
int weekdayLabelColumnX = (i + constantFirstWeekdayLabelCell.x);
JLabel weekdayLabel = new JLabel();
weekdayLabel.setHorizontalAlignment(SwingConstants.CENTER); // depends on control dependency: [for], data = [none]
weekdayLabel.setVerticalAlignment(SwingConstants.CENTER); // depends on control dependency: [for], data = [none]
weekdayLabel.setBorder(new EmptyBorder(0, 2, 0, 2)); // depends on control dependency: [for], data = [none]
weekdayLabel.setOpaque(true); // depends on control dependency: [for], data = [none]
weekdayLabel.setText("wd" + i); // depends on control dependency: [for], data = [i]
CellConstraints constraints = CC.xywh(weekdayLabelColumnX, weekdayLabelRowY,
weekdayLabelWidthInCells, weekdayLabelHeightInCells);
centerPanel.add(weekdayLabel, constraints); // depends on control dependency: [for], data = [none]
weekdayLabels.add(weekdayLabel); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public LinearInterpolatedTimeDiscreteProcess apply(DoubleUnaryOperator function) {
Map<Double, RandomVariable> result = new HashMap<>();
for(double time: timeDiscretization) {
result.put(time, realizations.get(time).apply(function));
}
return new LinearInterpolatedTimeDiscreteProcess(timeDiscretization, result);
} } | public class class_name {
public LinearInterpolatedTimeDiscreteProcess apply(DoubleUnaryOperator function) {
Map<Double, RandomVariable> result = new HashMap<>();
for(double time: timeDiscretization) {
result.put(time, realizations.get(time).apply(function)); // depends on control dependency: [for], data = [time]
}
return new LinearInterpolatedTimeDiscreteProcess(timeDiscretization, result);
} } |
public class class_name {
private static Writable getWritableFromObject(Object object) {
Writable writable = null;
if (object instanceof String) {
writable = new Text(object.toString());
} else if (object instanceof Long) {
writable = new LongWritable((Long) object);
} else {
writable = new IntWritable((Integer) object);
}
// writable = writable!=null?writable:new Text("");
return writable;
} } | public class class_name {
private static Writable getWritableFromObject(Object object) {
Writable writable = null;
if (object instanceof String) {
writable = new Text(object.toString()); // depends on control dependency: [if], data = [none]
} else if (object instanceof Long) {
writable = new LongWritable((Long) object); // depends on control dependency: [if], data = [none]
} else {
writable = new IntWritable((Integer) object); // depends on control dependency: [if], data = [none]
}
// writable = writable!=null?writable:new Text("");
return writable;
} } |
public class class_name {
protected List<String> prepareExtraArgs(Stack<String> pElements) {
if (pElements == null || pElements.size() == 0) {
return null;
}
List<String> ret = new ArrayList<String>();
while (!pElements.isEmpty()) {
String element = pElements.pop();
ret.add("*".equals(element) ? null : element);
}
return ret;
} } | public class class_name {
protected List<String> prepareExtraArgs(Stack<String> pElements) {
if (pElements == null || pElements.size() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
List<String> ret = new ArrayList<String>();
while (!pElements.isEmpty()) {
String element = pElements.pop();
ret.add("*".equals(element) ? null : element); // depends on control dependency: [while], data = [none]
}
return ret;
} } |
public class class_name {
public void start(Map<String, Object> variables) {
if (isProcessInstanceExecution()) {
if (startContext == null) {
startContext = new ProcessInstanceStartContext(processDefinition.getInitial());
}
}
super.start(variables);
} } | public class class_name {
public void start(Map<String, Object> variables) {
if (isProcessInstanceExecution()) {
if (startContext == null) {
startContext = new ProcessInstanceStartContext(processDefinition.getInitial()); // depends on control dependency: [if], data = [none]
}
}
super.start(variables);
} } |
public class class_name {
public void addFriend(Friend friend) {
try {
get().addEntry(friend.get());
} catch (NoResponseException | XMPPErrorException
| NotConnectedException e) {
e.printStackTrace();
}
} } | public class class_name {
public void addFriend(Friend friend) {
try {
get().addEntry(friend.get());
// depends on control dependency: [try], data = [none]
} catch (NoResponseException | XMPPErrorException
| NotConnectedException e) {
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Map<String, List<String>> buildDepsForAllModules(String rfsAbsPath, boolean mode)
throws CmsConfigurationException {
Map<String, List<String>> ret = new HashMap<String, List<String>>();
List<CmsModule> modules;
if (rfsAbsPath == null) {
modules = OpenCms.getModuleManager().getAllInstalledModules();
} else {
modules = new ArrayList<CmsModule>(getAllModulesFromPath(rfsAbsPath).keySet());
}
Iterator<CmsModule> itMods = modules.iterator();
while (itMods.hasNext()) {
CmsModule module = itMods.next();
// if module a depends on module b, and module c depends also on module b:
// build a map with a list containing "a" and "c" keyed by "b" to get a
// list of modules depending on module "b"...
Iterator<CmsModuleDependency> itDeps = module.getDependencies().iterator();
while (itDeps.hasNext()) {
CmsModuleDependency dependency = itDeps.next();
// module dependency package name
String moduleDependencyName = dependency.getName();
if (mode) {
// get the list of dependent modules
List<String> moduleDependencies = ret.get(moduleDependencyName);
if (moduleDependencies == null) {
// build a new list if "b" has no dependent modules yet
moduleDependencies = new ArrayList<String>();
ret.put(moduleDependencyName, moduleDependencies);
}
// add "a" as a module depending on "b"
moduleDependencies.add(module.getName());
} else {
List<String> moduleDependencies = ret.get(module.getName());
if (moduleDependencies == null) {
moduleDependencies = new ArrayList<String>();
ret.put(module.getName(), moduleDependencies);
}
moduleDependencies.add(dependency.getName());
}
}
}
itMods = modules.iterator();
while (itMods.hasNext()) {
CmsModule module = itMods.next();
if (ret.get(module.getName()) == null) {
ret.put(module.getName(), new ArrayList<String>());
}
}
return ret;
} } | public class class_name {
public static Map<String, List<String>> buildDepsForAllModules(String rfsAbsPath, boolean mode)
throws CmsConfigurationException {
Map<String, List<String>> ret = new HashMap<String, List<String>>();
List<CmsModule> modules;
if (rfsAbsPath == null) {
modules = OpenCms.getModuleManager().getAllInstalledModules();
} else {
modules = new ArrayList<CmsModule>(getAllModulesFromPath(rfsAbsPath).keySet());
}
Iterator<CmsModule> itMods = modules.iterator();
while (itMods.hasNext()) {
CmsModule module = itMods.next();
// if module a depends on module b, and module c depends also on module b:
// build a map with a list containing "a" and "c" keyed by "b" to get a
// list of modules depending on module "b"...
Iterator<CmsModuleDependency> itDeps = module.getDependencies().iterator();
while (itDeps.hasNext()) {
CmsModuleDependency dependency = itDeps.next();
// module dependency package name
String moduleDependencyName = dependency.getName();
if (mode) {
// get the list of dependent modules
List<String> moduleDependencies = ret.get(moduleDependencyName);
if (moduleDependencies == null) {
// build a new list if "b" has no dependent modules yet
moduleDependencies = new ArrayList<String>(); // depends on control dependency: [if], data = [none]
ret.put(moduleDependencyName, moduleDependencies); // depends on control dependency: [if], data = [none]
}
// add "a" as a module depending on "b"
moduleDependencies.add(module.getName());
} else {
List<String> moduleDependencies = ret.get(module.getName());
if (moduleDependencies == null) {
moduleDependencies = new ArrayList<String>(); // depends on control dependency: [if], data = [none]
ret.put(module.getName(), moduleDependencies); // depends on control dependency: [if], data = [none]
}
moduleDependencies.add(dependency.getName());
}
}
}
itMods = modules.iterator();
while (itMods.hasNext()) {
CmsModule module = itMods.next();
if (ret.get(module.getName()) == null) {
ret.put(module.getName(), new ArrayList<String>());
}
}
return ret;
} } |
public class class_name {
public UNode toDoc() {
UNode resultNode = UNode.createMapNode("doc");
for (String fieldName : getUpdatedFieldNames()) {
leafFieldtoDoc(resultNode, fieldName);
}
return resultNode;
} } | public class class_name {
public UNode toDoc() {
UNode resultNode = UNode.createMapNode("doc");
for (String fieldName : getUpdatedFieldNames()) {
leafFieldtoDoc(resultNode, fieldName);
// depends on control dependency: [for], data = [fieldName]
}
return resultNode;
} } |
public class class_name {
public TypeMirror getDeclaredType(Collection<TypeMirror> values,
TypeElement enclosing, TypeMirror target) {
TypeElement targetElement = asTypeElement(target);
List<? extends TypeParameterElement> targetTypeArgs = targetElement.getTypeParameters();
if (targetTypeArgs.isEmpty()) {
return target;
}
List<? extends TypeParameterElement> enclosingTypeArgs = enclosing.getTypeParameters();
List<TypeMirror> targetTypeArgTypes = new ArrayList<>(targetTypeArgs.size());
if (enclosingTypeArgs.isEmpty()) {
for (TypeMirror te : values) {
List<? extends TypeMirror> typeArguments = ((DeclaredType)te).getTypeArguments();
if (typeArguments.size() >= targetTypeArgs.size()) {
for (int i = 0 ; i < targetTypeArgs.size(); i++) {
targetTypeArgTypes.add(typeArguments.get(i));
}
break;
}
}
// we found no matches in the hierarchy
if (targetTypeArgTypes.isEmpty()) {
return target;
}
} else {
if (targetTypeArgs.size() > enclosingTypeArgs.size()) {
return target;
}
for (int i = 0; i < targetTypeArgs.size(); i++) {
TypeParameterElement tpe = enclosingTypeArgs.get(i);
targetTypeArgTypes.add(tpe.asType());
}
}
TypeMirror dt = typeUtils.getDeclaredType(targetElement,
targetTypeArgTypes.toArray(new TypeMirror[targetTypeArgTypes.size()]));
return dt;
} } | public class class_name {
public TypeMirror getDeclaredType(Collection<TypeMirror> values,
TypeElement enclosing, TypeMirror target) {
TypeElement targetElement = asTypeElement(target);
List<? extends TypeParameterElement> targetTypeArgs = targetElement.getTypeParameters();
if (targetTypeArgs.isEmpty()) {
return target; // depends on control dependency: [if], data = [none]
}
List<? extends TypeParameterElement> enclosingTypeArgs = enclosing.getTypeParameters();
List<TypeMirror> targetTypeArgTypes = new ArrayList<>(targetTypeArgs.size());
if (enclosingTypeArgs.isEmpty()) {
for (TypeMirror te : values) {
List<? extends TypeMirror> typeArguments = ((DeclaredType)te).getTypeArguments(); // depends on control dependency: [for], data = [te]
if (typeArguments.size() >= targetTypeArgs.size()) {
for (int i = 0 ; i < targetTypeArgs.size(); i++) {
targetTypeArgTypes.add(typeArguments.get(i)); // depends on control dependency: [for], data = [i]
}
break;
}
}
// we found no matches in the hierarchy
if (targetTypeArgTypes.isEmpty()) {
return target; // depends on control dependency: [if], data = [none]
}
} else {
if (targetTypeArgs.size() > enclosingTypeArgs.size()) {
return target; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < targetTypeArgs.size(); i++) {
TypeParameterElement tpe = enclosingTypeArgs.get(i);
targetTypeArgTypes.add(tpe.asType()); // depends on control dependency: [for], data = [none]
}
}
TypeMirror dt = typeUtils.getDeclaredType(targetElement,
targetTypeArgTypes.toArray(new TypeMirror[targetTypeArgTypes.size()]));
return dt;
} } |
public class class_name {
public static void store(DataNode node, OutputStream out, boolean addChecksum, boolean ignoreMissingMarshallers,
ProgressListener progressListener, AbstractDataMarshaller<?>... marshallers) throws IOException {
final Map<String, AbstractDataMarshaller<?>> marshallerMap = generateMarshallerMap(true, Arrays.asList(marshallers));
marshallerMap.putAll(generateMarshallerMap(true, DEFAULT_MARSHALLERS));
GZIPOutputStream gzipOutputStream = null;
try {
gzipOutputStream = new GZIPOutputStream(out);
OutputStream outputStream = gzipOutputStream;
MessageDigestOutputStream messageDigestOutputStream = null;
if (addChecksum) {
messageDigestOutputStream = new MessageDigestOutputStream(outputStream, CHECKSUM_ALGORITHM);
outputStream = messageDigestOutputStream;
}
final DataOutputStream dOut = new DataOutputStream(outputStream);
//write header
dOut.write(XDATA_HEADER);
//serialize the node
serialize(marshallerMap, dOut, node, ignoreMissingMarshallers, progressListener);
if (addChecksum) {
final byte[] digest = messageDigestOutputStream.getDigest();
dOut.writeBoolean(true);
dOut.write(digest);
}
} catch (NoSuchAlgorithmException ex) {
throw new IOException("Checksum algorithm not available", ex);
} finally {
gzipOutputStream.close();
}
} } | public class class_name {
public static void store(DataNode node, OutputStream out, boolean addChecksum, boolean ignoreMissingMarshallers,
ProgressListener progressListener, AbstractDataMarshaller<?>... marshallers) throws IOException {
final Map<String, AbstractDataMarshaller<?>> marshallerMap = generateMarshallerMap(true, Arrays.asList(marshallers));
marshallerMap.putAll(generateMarshallerMap(true, DEFAULT_MARSHALLERS));
GZIPOutputStream gzipOutputStream = null;
try {
gzipOutputStream = new GZIPOutputStream(out); // depends on control dependency: [try], data = [none]
OutputStream outputStream = gzipOutputStream;
MessageDigestOutputStream messageDigestOutputStream = null;
if (addChecksum) {
messageDigestOutputStream = new MessageDigestOutputStream(outputStream, CHECKSUM_ALGORITHM); // depends on control dependency: [if], data = [none]
outputStream = messageDigestOutputStream; // depends on control dependency: [if], data = [none]
}
final DataOutputStream dOut = new DataOutputStream(outputStream);
//write header
dOut.write(XDATA_HEADER); // depends on control dependency: [try], data = [none]
//serialize the node
serialize(marshallerMap, dOut, node, ignoreMissingMarshallers, progressListener); // depends on control dependency: [try], data = [none]
if (addChecksum) {
final byte[] digest = messageDigestOutputStream.getDigest();
dOut.writeBoolean(true); // depends on control dependency: [if], data = [none]
dOut.write(digest); // depends on control dependency: [if], data = [none]
}
} catch (NoSuchAlgorithmException ex) {
throw new IOException("Checksum algorithm not available", ex);
} finally { // depends on control dependency: [catch], data = [none]
gzipOutputStream.close();
}
} } |
public class class_name {
public static File zip(File zipFile, String[] paths, InputStream[] ins, Charset charset) throws UtilException {
if (ArrayUtil.isEmpty(paths) || ArrayUtil.isEmpty(ins)) {
throw new IllegalArgumentException("Paths or ins is empty !");
}
if (paths.length != ins.length) {
throw new IllegalArgumentException("Paths length is not equals to ins length !");
}
ZipOutputStream out = null;
try {
out = getZipOutputStream(zipFile, charset);
for (int i = 0; i < paths.length; i++) {
addFile(ins[i], paths[i], out);
}
} finally {
IoUtil.close(out);
}
return zipFile;
} } | public class class_name {
public static File zip(File zipFile, String[] paths, InputStream[] ins, Charset charset) throws UtilException {
if (ArrayUtil.isEmpty(paths) || ArrayUtil.isEmpty(ins)) {
throw new IllegalArgumentException("Paths or ins is empty !");
}
if (paths.length != ins.length) {
throw new IllegalArgumentException("Paths length is not equals to ins length !");
}
ZipOutputStream out = null;
try {
out = getZipOutputStream(zipFile, charset);
for (int i = 0; i < paths.length; i++) {
addFile(ins[i], paths[i], out);
// depends on control dependency: [for], data = [i]
}
} finally {
IoUtil.close(out);
}
return zipFile;
} } |
public class class_name {
public static LimitedTextArea newTextArea (String text, int width, int height, int maxLength)
{
LimitedTextArea area = new LimitedTextArea(maxLength, width, height);
if (text != null) {
area.setText(text);
}
return area;
} } | public class class_name {
public static LimitedTextArea newTextArea (String text, int width, int height, int maxLength)
{
LimitedTextArea area = new LimitedTextArea(maxLength, width, height);
if (text != null) {
area.setText(text); // depends on control dependency: [if], data = [(text]
}
return area;
} } |
public class class_name {
@Override
public long getLastModified() {
if (spi != null && spi instanceof AbstractIOServiceProvider) {
AbstractIOServiceProvider aspi = (AbstractIOServiceProvider) spi;
return aspi.getLastModified();
}
return 0;
} } | public class class_name {
@Override
public long getLastModified() {
if (spi != null && spi instanceof AbstractIOServiceProvider) {
AbstractIOServiceProvider aspi = (AbstractIOServiceProvider) spi;
return aspi.getLastModified(); // depends on control dependency: [if], data = [none]
}
return 0;
} } |
public class class_name {
public static double invGamma1pm1(final double x) {
assert x >= -0.5;
assert x <= 1.5;
final double ret;
final double t = x <= 0.5 ? x : (x - 0.5) - 0.5;
if (t < 0.0) {
final double a = INV_GAMMA1P_M1_A0 + t * INV_GAMMA1P_M1_A1;
double b = INV_GAMMA1P_M1_B8;
b = INV_GAMMA1P_M1_B7 + t * b;
b = INV_GAMMA1P_M1_B6 + t * b;
b = INV_GAMMA1P_M1_B5 + t * b;
b = INV_GAMMA1P_M1_B4 + t * b;
b = INV_GAMMA1P_M1_B3 + t * b;
b = INV_GAMMA1P_M1_B2 + t * b;
b = INV_GAMMA1P_M1_B1 + t * b;
b = 1.0 + t * b;
double c = INV_GAMMA1P_M1_C13 + t * (a / b);
c = INV_GAMMA1P_M1_C12 + t * c;
c = INV_GAMMA1P_M1_C11 + t * c;
c = INV_GAMMA1P_M1_C10 + t * c;
c = INV_GAMMA1P_M1_C9 + t * c;
c = INV_GAMMA1P_M1_C8 + t * c;
c = INV_GAMMA1P_M1_C7 + t * c;
c = INV_GAMMA1P_M1_C6 + t * c;
c = INV_GAMMA1P_M1_C5 + t * c;
c = INV_GAMMA1P_M1_C4 + t * c;
c = INV_GAMMA1P_M1_C3 + t * c;
c = INV_GAMMA1P_M1_C2 + t * c;
c = INV_GAMMA1P_M1_C1 + t * c;
c = INV_GAMMA1P_M1_C + t * c;
if (x > 0.5) {
ret = t * c / x;
} else {
ret = x * ((c + 0.5) + 0.5);
}
} else {
double p = INV_GAMMA1P_M1_P6;
p = INV_GAMMA1P_M1_P5 + t * p;
p = INV_GAMMA1P_M1_P4 + t * p;
p = INV_GAMMA1P_M1_P3 + t * p;
p = INV_GAMMA1P_M1_P2 + t * p;
p = INV_GAMMA1P_M1_P1 + t * p;
p = INV_GAMMA1P_M1_P0 + t * p;
double q = INV_GAMMA1P_M1_Q4;
q = INV_GAMMA1P_M1_Q3 + t * q;
q = INV_GAMMA1P_M1_Q2 + t * q;
q = INV_GAMMA1P_M1_Q1 + t * q;
q = 1.0 + t * q;
double c = INV_GAMMA1P_M1_C13 + (p / q) * t;
c = INV_GAMMA1P_M1_C12 + t * c;
c = INV_GAMMA1P_M1_C11 + t * c;
c = INV_GAMMA1P_M1_C10 + t * c;
c = INV_GAMMA1P_M1_C9 + t * c;
c = INV_GAMMA1P_M1_C8 + t * c;
c = INV_GAMMA1P_M1_C7 + t * c;
c = INV_GAMMA1P_M1_C6 + t * c;
c = INV_GAMMA1P_M1_C5 + t * c;
c = INV_GAMMA1P_M1_C4 + t * c;
c = INV_GAMMA1P_M1_C3 + t * c;
c = INV_GAMMA1P_M1_C2 + t * c;
c = INV_GAMMA1P_M1_C1 + t * c;
c = INV_GAMMA1P_M1_C0 + t * c;
if (x > 0.5) {
ret = (t / x) * ((c - 0.5) - 0.5);
} else {
ret = x * c;
}
}
return ret;
} } | public class class_name {
public static double invGamma1pm1(final double x) {
assert x >= -0.5;
assert x <= 1.5;
final double ret;
final double t = x <= 0.5 ? x : (x - 0.5) - 0.5;
if (t < 0.0) {
final double a = INV_GAMMA1P_M1_A0 + t * INV_GAMMA1P_M1_A1;
double b = INV_GAMMA1P_M1_B8;
b = INV_GAMMA1P_M1_B7 + t * b; // depends on control dependency: [if], data = [none]
b = INV_GAMMA1P_M1_B6 + t * b; // depends on control dependency: [if], data = [none]
b = INV_GAMMA1P_M1_B5 + t * b; // depends on control dependency: [if], data = [none]
b = INV_GAMMA1P_M1_B4 + t * b; // depends on control dependency: [if], data = [none]
b = INV_GAMMA1P_M1_B3 + t * b; // depends on control dependency: [if], data = [none]
b = INV_GAMMA1P_M1_B2 + t * b; // depends on control dependency: [if], data = [none]
b = INV_GAMMA1P_M1_B1 + t * b; // depends on control dependency: [if], data = [none]
b = 1.0 + t * b; // depends on control dependency: [if], data = [none]
double c = INV_GAMMA1P_M1_C13 + t * (a / b);
c = INV_GAMMA1P_M1_C12 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C11 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C10 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C9 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C8 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C7 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C6 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C5 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C4 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C3 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C2 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C1 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C + t * c; // depends on control dependency: [if], data = [none]
if (x > 0.5) {
ret = t * c / x; // depends on control dependency: [if], data = [none]
} else {
ret = x * ((c + 0.5) + 0.5); // depends on control dependency: [if], data = [0.5)]
}
} else {
double p = INV_GAMMA1P_M1_P6;
p = INV_GAMMA1P_M1_P5 + t * p; // depends on control dependency: [if], data = [none]
p = INV_GAMMA1P_M1_P4 + t * p; // depends on control dependency: [if], data = [none]
p = INV_GAMMA1P_M1_P3 + t * p; // depends on control dependency: [if], data = [none]
p = INV_GAMMA1P_M1_P2 + t * p; // depends on control dependency: [if], data = [none]
p = INV_GAMMA1P_M1_P1 + t * p; // depends on control dependency: [if], data = [none]
p = INV_GAMMA1P_M1_P0 + t * p; // depends on control dependency: [if], data = [none]
double q = INV_GAMMA1P_M1_Q4;
q = INV_GAMMA1P_M1_Q3 + t * q; // depends on control dependency: [if], data = [none]
q = INV_GAMMA1P_M1_Q2 + t * q; // depends on control dependency: [if], data = [none]
q = INV_GAMMA1P_M1_Q1 + t * q; // depends on control dependency: [if], data = [none]
q = 1.0 + t * q; // depends on control dependency: [if], data = [none]
double c = INV_GAMMA1P_M1_C13 + (p / q) * t;
c = INV_GAMMA1P_M1_C12 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C11 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C10 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C9 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C8 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C7 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C6 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C5 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C4 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C3 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C2 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C1 + t * c; // depends on control dependency: [if], data = [none]
c = INV_GAMMA1P_M1_C0 + t * c; // depends on control dependency: [if], data = [none]
if (x > 0.5) {
ret = (t / x) * ((c - 0.5) - 0.5); // depends on control dependency: [if], data = [0.5)]
} else {
ret = x * c; // depends on control dependency: [if], data = [none]
}
}
return ret;
} } |
public class class_name {
public static String extractAccessURL(String publicURL, String scheme) throws IOException {
if (publicURL != null && !publicURL.startsWith("http")) {
String startScheme = scheme + "://";
int end = publicURL.length();
if (publicURL.indexOf("/", startScheme.length()) >= 0) {
end = publicURL.indexOf("/", startScheme.length());
}
return publicURL.substring(0, end);
}
try {
String hostName = new URI(publicURL).getAuthority();
int start = publicURL.indexOf("//") + 2 + hostName.length() + 1;
for (int i = 0; i < 2; i++) {
start = publicURL.indexOf("/", start) + 1;
}
String authURL = publicURL.substring(0, start);
if (authURL.endsWith("/")) {
authURL = authURL.substring(0, authURL.length() - 1);
}
return authURL;
} catch (URISyntaxException e) {
throw new IOException("Public URL: " + publicURL + " is not valid");
}
} } | public class class_name {
public static String extractAccessURL(String publicURL, String scheme) throws IOException {
if (publicURL != null && !publicURL.startsWith("http")) {
String startScheme = scheme + "://";
int end = publicURL.length();
if (publicURL.indexOf("/", startScheme.length()) >= 0) {
end = publicURL.indexOf("/", startScheme.length()); // depends on control dependency: [if], data = [none]
}
return publicURL.substring(0, end);
}
try {
String hostName = new URI(publicURL).getAuthority();
int start = publicURL.indexOf("//") + 2 + hostName.length() + 1;
for (int i = 0; i < 2; i++) {
start = publicURL.indexOf("/", start) + 1;
}
String authURL = publicURL.substring(0, start);
if (authURL.endsWith("/")) {
authURL = authURL.substring(0, authURL.length() - 1); // depends on control dependency: [if], data = [none]
}
return authURL;
} catch (URISyntaxException e) {
throw new IOException("Public URL: " + publicURL + " is not valid");
}
} } |
public class class_name {
public byte[] getAsByteArray(String key) {
Object value = mValues.get(key);
if (value instanceof byte[]) {
return (byte[]) value;
} else {
return null;
}
}
/**
* Returns a set of all of the keys and values
*
* @return a set of all of the keys and values
*/
public Set<Map.Entry<String, Object>> valueSet() {
return mValues.entrySet();
}
/**
* Returns a set of all of the keys
*
* @return a set of all of the keys
*/
public Set<String> keySet() {
return mValues.keySet();
}
/**
* Unsupported, here until we get proper bulk insert APIs.
* {@hide}
*/
@Deprecated
public void putStringArrayList(String key, ArrayList<String> value) {
mValues.put(key, value);
}
/**
* Unsupported, here until we get proper bulk insert APIs.
* {@hide}
*/
@SuppressWarnings("unchecked")
@Deprecated
public ArrayList<String> getStringArrayList(String key) {
return (ArrayList<String>) mValues.get(key);
}
/**
* Returns a string containing a concise, human-readable description of this object.
* @return a printable representation of this object.
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (String name : mValues.keySet()) {
String value = getAsString(name);
if (sb.length() > 0) sb.append(" ");
sb.append(name + "=" + value);
}
return sb.toString();
} } | public class class_name {
public byte[] getAsByteArray(String key) {
Object value = mValues.get(key);
if (value instanceof byte[]) {
return (byte[]) value; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
}
/**
* Returns a set of all of the keys and values
*
* @return a set of all of the keys and values
*/
public Set<Map.Entry<String, Object>> valueSet() {
return mValues.entrySet();
}
/**
* Returns a set of all of the keys
*
* @return a set of all of the keys
*/
public Set<String> keySet() {
return mValues.keySet();
}
/**
* Unsupported, here until we get proper bulk insert APIs.
* {@hide}
*/
@Deprecated
public void putStringArrayList(String key, ArrayList<String> value) {
mValues.put(key, value);
}
/**
* Unsupported, here until we get proper bulk insert APIs.
* {@hide}
*/
@SuppressWarnings("unchecked")
@Deprecated
public ArrayList<String> getStringArrayList(String key) {
return (ArrayList<String>) mValues.get(key);
}
/**
* Returns a string containing a concise, human-readable description of this object.
* @return a printable representation of this object.
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (String name : mValues.keySet()) {
String value = getAsString(name);
if (sb.length() > 0) sb.append(" ");
sb.append(name + "=" + value); // depends on control dependency: [for], data = [name]
}
return sb.toString();
} } |
public class class_name {
public<U> Optional<U> flatMap(Function<? super T, Optional<U>> mapper) {
Objects.requireNonNull(mapper);
if (!isPresent())
return empty();
else {
return Objects.requireNonNull(mapper.apply(value));
}
} } | public class class_name {
public<U> Optional<U> flatMap(Function<? super T, Optional<U>> mapper) {
Objects.requireNonNull(mapper);
if (!isPresent())
return empty();
else {
return Objects.requireNonNull(mapper.apply(value)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public byte[] encrypt(byte[] key, byte[] initializationVector, byte[] message) {
try {
IvParameterSpec initializationVectorSpec = new IvParameterSpec(initializationVector);
final SecretKeySpec skey = new SecretKeySpec(key, keyAlgorithm);
final Cipher cipher = (((provider == null) || (provider.length() == 0))
? Cipher.getInstance(cipherAlgorithm)
: Cipher.getInstance(cipherAlgorithm, provider));
switch (mode) {
case ENCRYPT:
cipher.init(Cipher.ENCRYPT_MODE, skey, initializationVectorSpec);
break;
case DECRYPT:
cipher.init(Cipher.DECRYPT_MODE, skey, initializationVectorSpec);
break;
default:
throw new SymmetricEncryptionException("error encrypting/decrypting message: invalid mode; mode=" + mode);
}
return cipher.doFinal(message);
} catch (Exception e) {
throw new SymmetricEncryptionException("error encrypting/decrypting message; mode=" + mode, e);
}
} } | public class class_name {
public byte[] encrypt(byte[] key, byte[] initializationVector, byte[] message) {
try {
IvParameterSpec initializationVectorSpec = new IvParameterSpec(initializationVector);
final SecretKeySpec skey = new SecretKeySpec(key, keyAlgorithm);
final Cipher cipher = (((provider == null) || (provider.length() == 0))
? Cipher.getInstance(cipherAlgorithm)
: Cipher.getInstance(cipherAlgorithm, provider));
switch (mode) {
case ENCRYPT:
cipher.init(Cipher.ENCRYPT_MODE, skey, initializationVectorSpec);
break;
case DECRYPT:
cipher.init(Cipher.DECRYPT_MODE, skey, initializationVectorSpec);
break;
default:
throw new SymmetricEncryptionException("error encrypting/decrypting message: invalid mode; mode=" + mode);
}
return cipher.doFinal(message); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SymmetricEncryptionException("error encrypting/decrypting message; mode=" + mode, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static String getTabBasedOnLevel(int level, int indentSize) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < level; i ++) {
for(int j = 0; j < indentSize; j++) {
sb.append(" ");
}
}
return sb.toString();
} } | public class class_name {
private static String getTabBasedOnLevel(int level, int indentSize) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < level; i ++) {
for(int j = 0; j < indentSize; j++) {
sb.append(" "); // depends on control dependency: [for], data = [none]
}
}
return sb.toString();
} } |
public class class_name {
@Override
// thanks to
// http://binkley.blogspot.fr/2009/04/jumping-work-queue-in-executor.html
// for backward compat to SDK 8 (JDK 5)
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value) {
// makes findbugs happy, there must be some @Nullable
// annotation in JDK..
if (runnable == null) {
return null;
}
return new PriorityFuture<T>(runnable, ((PriorityRunnable) runnable).getPriority(), value);
} } | public class class_name {
@Override
// thanks to
// http://binkley.blogspot.fr/2009/04/jumping-work-queue-in-executor.html
// for backward compat to SDK 8 (JDK 5)
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value) {
// makes findbugs happy, there must be some @Nullable
// annotation in JDK..
if (runnable == null) {
return null; // depends on control dependency: [if], data = [none]
}
return new PriorityFuture<T>(runnable, ((PriorityRunnable) runnable).getPriority(), value);
} } |
public class class_name {
static public void recursiveDeleteDirectory(FTPClient ftpClient, String path) throws IOException {
logger.info("Delete directory: {}", path);
FTPFile[] ftpFiles = ftpClient.listFiles(path);
logger.debug("Number of files that will be deleted: {}", ftpFiles.length);
for (FTPFile ftpFile : ftpFiles){
String filename = path + "/" + ftpFile.getName();
if (ftpFile.getType() == FTPFile.FILE_TYPE) {
boolean deleted = ftpClient.deleteFile(filename);
logger.debug("Deleted {}? {}", filename, deleted);
} else {
recursiveDeleteDirectory(ftpClient, filename);
}
}
boolean dirDeleted = ftpClient.deleteFile(path);
logger.debug("Directory {} deleted: {}", path, dirDeleted);
} } | public class class_name {
static public void recursiveDeleteDirectory(FTPClient ftpClient, String path) throws IOException {
logger.info("Delete directory: {}", path);
FTPFile[] ftpFiles = ftpClient.listFiles(path);
logger.debug("Number of files that will be deleted: {}", ftpFiles.length);
for (FTPFile ftpFile : ftpFiles){
String filename = path + "/" + ftpFile.getName();
if (ftpFile.getType() == FTPFile.FILE_TYPE) {
boolean deleted = ftpClient.deleteFile(filename);
logger.debug("Deleted {}? {}", filename, deleted); // depends on control dependency: [if], data = [none]
} else {
recursiveDeleteDirectory(ftpClient, filename); // depends on control dependency: [if], data = [none]
}
}
boolean dirDeleted = ftpClient.deleteFile(path);
logger.debug("Directory {} deleted: {}", path, dirDeleted);
} } |
public class class_name {
public static Double st3darea(Geometry geometry) {
if (geometry == null) {
return null;
}
double area = 0;
for (int idPoly = 0; idPoly < geometry.getNumGeometries(); idPoly++) {
Geometry subGeom = geometry.getGeometryN(idPoly);
if (subGeom instanceof Polygon) {
area += compute3DArea((Polygon) subGeom);
}
}
return area;
} } | public class class_name {
public static Double st3darea(Geometry geometry) {
if (geometry == null) {
return null; // depends on control dependency: [if], data = [none]
}
double area = 0;
for (int idPoly = 0; idPoly < geometry.getNumGeometries(); idPoly++) {
Geometry subGeom = geometry.getGeometryN(idPoly);
if (subGeom instanceof Polygon) {
area += compute3DArea((Polygon) subGeom); // depends on control dependency: [if], data = [none]
}
}
return area;
} } |
public class class_name {
public static ByteBuffer getImageData(BufferedImage image, Format format) {
final int width = image.getWidth();
final int height = image.getHeight();
final int type = image.getType();
final int[] pixels;
if (type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB) {
pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
} else {
pixels = new int[width * height];
image.getRGB(0, 0, width, height, pixels, 0, width);
}
return getImageData(pixels, format, width, height);
} } | public class class_name {
public static ByteBuffer getImageData(BufferedImage image, Format format) {
final int width = image.getWidth();
final int height = image.getHeight();
final int type = image.getType();
final int[] pixels;
if (type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB) {
pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); // depends on control dependency: [if], data = [none]
} else {
pixels = new int[width * height]; // depends on control dependency: [if], data = [none]
image.getRGB(0, 0, width, height, pixels, 0, width); // depends on control dependency: [if], data = [none]
}
return getImageData(pixels, format, width, height);
} } |
public class class_name {
public void setCompilationJobSummaries(java.util.Collection<CompilationJobSummary> compilationJobSummaries) {
if (compilationJobSummaries == null) {
this.compilationJobSummaries = null;
return;
}
this.compilationJobSummaries = new java.util.ArrayList<CompilationJobSummary>(compilationJobSummaries);
} } | public class class_name {
public void setCompilationJobSummaries(java.util.Collection<CompilationJobSummary> compilationJobSummaries) {
if (compilationJobSummaries == null) {
this.compilationJobSummaries = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.compilationJobSummaries = new java.util.ArrayList<CompilationJobSummary>(compilationJobSummaries);
} } |
public class class_name {
private static boolean shouldCheckBuffer(PrintNode node) {
if (!(node.getExpr().getRoot() instanceof FunctionNode)) {
return true;
}
FunctionNode fn = (FunctionNode) node.getExpr().getRoot();
if (!(fn.getSoyFunction() instanceof BuiltinFunction)) {
return true;
}
BuiltinFunction bfn = (BuiltinFunction) fn.getSoyFunction();
if (bfn != BuiltinFunction.XID && bfn != BuiltinFunction.CSS) {
return true;
}
return false;
} } | public class class_name {
private static boolean shouldCheckBuffer(PrintNode node) {
if (!(node.getExpr().getRoot() instanceof FunctionNode)) {
return true; // depends on control dependency: [if], data = [none]
}
FunctionNode fn = (FunctionNode) node.getExpr().getRoot();
if (!(fn.getSoyFunction() instanceof BuiltinFunction)) {
return true; // depends on control dependency: [if], data = [none]
}
BuiltinFunction bfn = (BuiltinFunction) fn.getSoyFunction();
if (bfn != BuiltinFunction.XID && bfn != BuiltinFunction.CSS) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public MobicentsSipApplicationSession findSipApplicationSession(HttpSession httpSession) {
for (MobicentsSipApplicationSession sipApplicationSessionImpl : sipApplicationSessions.values()) {
if(sipApplicationSessionImpl.findHttpSession(httpSession.getId()) != null) {
return sipApplicationSessionImpl;
}
}
return null;
} } | public class class_name {
public MobicentsSipApplicationSession findSipApplicationSession(HttpSession httpSession) {
for (MobicentsSipApplicationSession sipApplicationSessionImpl : sipApplicationSessions.values()) {
if(sipApplicationSessionImpl.findHttpSession(httpSession.getId()) != null) {
return sipApplicationSessionImpl; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("VISIBILITY".equals(EVENT_TYPE)) {
title.setVisible(getSkinnable().isTitleVisible());
title.setManaged(getSkinnable().isTitleVisible());
text.setVisible(getSkinnable().isTextVisible());
text.setManaged(getSkinnable().isTextVisible());
dateText.setVisible(getSkinnable().isDateVisible());
dateText.setManaged(getSkinnable().isDateVisible());
second.setVisible(getSkinnable().isSecondsVisible());
second.setManaged(getSkinnable().isSecondsVisible());
boolean alarmsVisible = getSkinnable().isAlarmsVisible();
for (Shape shape : alarmMap.values()) {
shape.setManaged(alarmsVisible);
shape.setVisible(alarmsVisible);
}
} else if ("SECTION".equals(EVENT_TYPE)) {
sections = getSkinnable().getSections();
highlightSections = getSkinnable().isHighlightSections();
sectionsVisible = getSkinnable().getSectionsVisible();
areas = getSkinnable().getAreas();
highlightAreas = getSkinnable().isHighlightAreas();
areasVisible = getSkinnable().getAreasVisible();
redraw();
} else if ("FINISHED".equals(EVENT_TYPE)) {
}
} } | public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("VISIBILITY".equals(EVENT_TYPE)) {
title.setVisible(getSkinnable().isTitleVisible()); // depends on control dependency: [if], data = [none]
title.setManaged(getSkinnable().isTitleVisible()); // depends on control dependency: [if], data = [none]
text.setVisible(getSkinnable().isTextVisible()); // depends on control dependency: [if], data = [none]
text.setManaged(getSkinnable().isTextVisible()); // depends on control dependency: [if], data = [none]
dateText.setVisible(getSkinnable().isDateVisible()); // depends on control dependency: [if], data = [none]
dateText.setManaged(getSkinnable().isDateVisible()); // depends on control dependency: [if], data = [none]
second.setVisible(getSkinnable().isSecondsVisible()); // depends on control dependency: [if], data = [none]
second.setManaged(getSkinnable().isSecondsVisible()); // depends on control dependency: [if], data = [none]
boolean alarmsVisible = getSkinnable().isAlarmsVisible();
for (Shape shape : alarmMap.values()) {
shape.setManaged(alarmsVisible); // depends on control dependency: [for], data = [shape]
shape.setVisible(alarmsVisible); // depends on control dependency: [for], data = [shape]
}
} else if ("SECTION".equals(EVENT_TYPE)) {
sections = getSkinnable().getSections(); // depends on control dependency: [if], data = [none]
highlightSections = getSkinnable().isHighlightSections(); // depends on control dependency: [if], data = [none]
sectionsVisible = getSkinnable().getSectionsVisible(); // depends on control dependency: [if], data = [none]
areas = getSkinnable().getAreas(); // depends on control dependency: [if], data = [none]
highlightAreas = getSkinnable().isHighlightAreas(); // depends on control dependency: [if], data = [none]
areasVisible = getSkinnable().getAreasVisible(); // depends on control dependency: [if], data = [none]
redraw(); // depends on control dependency: [if], data = [none]
} else if ("FINISHED".equals(EVENT_TYPE)) {
}
} } |
public class class_name {
@SuppressWarnings({"WeakerAccess", "unused", "unchecked"})
@Internal
@UsedByGeneratedCode
protected Object postConstruct(BeanResolutionContext resolutionContext, BeanContext context, Object bean) {
DefaultBeanContext defaultContext = (DefaultBeanContext) context;
Collection<BeanRegistration<BeanInitializedEventListener>> beanInitializedEventListeners = ((DefaultBeanContext) context).beanInitializedEventListeners;
if (CollectionUtils.isNotEmpty(beanInitializedEventListeners)) {
for (BeanRegistration<BeanInitializedEventListener> registration : beanInitializedEventListeners) {
BeanDefinition<BeanInitializedEventListener> definition = registration.getBeanDefinition();
List<Argument<?>> typeArguments = definition.getTypeArguments(BeanInitializedEventListener.class);
if (CollectionUtils.isEmpty(typeArguments) || typeArguments.get(0).getType().isAssignableFrom(getBeanType())) {
BeanInitializedEventListener listener = registration.getBean();
bean = listener.onInitialized(new BeanInitializingEvent(context, this, bean));
if (bean == null) {
throw new BeanInstantiationException(resolutionContext, "Listener [" + listener + "] returned null from onInitialized event");
}
}
}
}
for (int i = 0; i < methodInjectionPoints.size(); i++) {
MethodInjectionPoint methodInjectionPoint = methodInjectionPoints.get(i);
if (methodInjectionPoint.isPostConstructMethod() && methodInjectionPoint.requiresReflection()) {
injectBeanMethod(resolutionContext, defaultContext, i, bean);
}
}
if (bean instanceof LifeCycle) {
bean = ((LifeCycle) bean).start();
}
return bean;
} } | public class class_name {
@SuppressWarnings({"WeakerAccess", "unused", "unchecked"})
@Internal
@UsedByGeneratedCode
protected Object postConstruct(BeanResolutionContext resolutionContext, BeanContext context, Object bean) {
DefaultBeanContext defaultContext = (DefaultBeanContext) context;
Collection<BeanRegistration<BeanInitializedEventListener>> beanInitializedEventListeners = ((DefaultBeanContext) context).beanInitializedEventListeners;
if (CollectionUtils.isNotEmpty(beanInitializedEventListeners)) {
for (BeanRegistration<BeanInitializedEventListener> registration : beanInitializedEventListeners) {
BeanDefinition<BeanInitializedEventListener> definition = registration.getBeanDefinition();
List<Argument<?>> typeArguments = definition.getTypeArguments(BeanInitializedEventListener.class); // depends on control dependency: [for], data = [none]
if (CollectionUtils.isEmpty(typeArguments) || typeArguments.get(0).getType().isAssignableFrom(getBeanType())) {
BeanInitializedEventListener listener = registration.getBean();
bean = listener.onInitialized(new BeanInitializingEvent(context, this, bean)); // depends on control dependency: [if], data = [none]
if (bean == null) {
throw new BeanInstantiationException(resolutionContext, "Listener [" + listener + "] returned null from onInitialized event");
}
}
}
}
for (int i = 0; i < methodInjectionPoints.size(); i++) {
MethodInjectionPoint methodInjectionPoint = methodInjectionPoints.get(i);
if (methodInjectionPoint.isPostConstructMethod() && methodInjectionPoint.requiresReflection()) {
injectBeanMethod(resolutionContext, defaultContext, i, bean); // depends on control dependency: [if], data = [none]
}
}
if (bean instanceof LifeCycle) {
bean = ((LifeCycle) bean).start(); // depends on control dependency: [if], data = [none]
}
return bean;
} } |
public class class_name {
public Whitelist removeProtocols(String tag, String attribute, String... removeProtocols) {
Validate.notEmpty(tag);
Validate.notEmpty(attribute);
Validate.notNull(removeProtocols);
TagName tagName = TagName.valueOf(tag);
AttributeKey attr = AttributeKey.valueOf(attribute);
// make sure that what we're removing actually exists; otherwise can open the tag to any data and that can
// be surprising
Validate.isTrue(protocols.containsKey(tagName), "Cannot remove a protocol that is not set.");
Map<AttributeKey, Set<Protocol>> tagProtocols = protocols.get(tagName);
Validate.isTrue(tagProtocols.containsKey(attr), "Cannot remove a protocol that is not set.");
Set<Protocol> attrProtocols = tagProtocols.get(attr);
for (String protocol : removeProtocols) {
Validate.notEmpty(protocol);
attrProtocols.remove(Protocol.valueOf(protocol));
}
if (attrProtocols.isEmpty()) { // Remove protocol set if empty
tagProtocols.remove(attr);
if (tagProtocols.isEmpty()) // Remove entry for tag if empty
protocols.remove(tagName);
}
return this;
} } | public class class_name {
public Whitelist removeProtocols(String tag, String attribute, String... removeProtocols) {
Validate.notEmpty(tag);
Validate.notEmpty(attribute);
Validate.notNull(removeProtocols);
TagName tagName = TagName.valueOf(tag);
AttributeKey attr = AttributeKey.valueOf(attribute);
// make sure that what we're removing actually exists; otherwise can open the tag to any data and that can
// be surprising
Validate.isTrue(protocols.containsKey(tagName), "Cannot remove a protocol that is not set.");
Map<AttributeKey, Set<Protocol>> tagProtocols = protocols.get(tagName);
Validate.isTrue(tagProtocols.containsKey(attr), "Cannot remove a protocol that is not set.");
Set<Protocol> attrProtocols = tagProtocols.get(attr);
for (String protocol : removeProtocols) {
Validate.notEmpty(protocol); // depends on control dependency: [for], data = [protocol]
attrProtocols.remove(Protocol.valueOf(protocol)); // depends on control dependency: [for], data = [protocol]
}
if (attrProtocols.isEmpty()) { // Remove protocol set if empty
tagProtocols.remove(attr); // depends on control dependency: [if], data = [none]
if (tagProtocols.isEmpty()) // Remove entry for tag if empty
protocols.remove(tagName);
}
return this;
} } |
public class class_name {
public ListAcceptedPortfolioSharesResult withPortfolioDetails(PortfolioDetail... portfolioDetails) {
if (this.portfolioDetails == null) {
setPortfolioDetails(new java.util.ArrayList<PortfolioDetail>(portfolioDetails.length));
}
for (PortfolioDetail ele : portfolioDetails) {
this.portfolioDetails.add(ele);
}
return this;
} } | public class class_name {
public ListAcceptedPortfolioSharesResult withPortfolioDetails(PortfolioDetail... portfolioDetails) {
if (this.portfolioDetails == null) {
setPortfolioDetails(new java.util.ArrayList<PortfolioDetail>(portfolioDetails.length)); // depends on control dependency: [if], data = [none]
}
for (PortfolioDetail ele : portfolioDetails) {
this.portfolioDetails.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public List<List<String>> getRecordsAsString() {
if(records == null)
records = new ArrayList<>();
List<List<String>> ret = new ArrayList<>();
for(SingleCSVRecord csvRecord : records) {
ret.add(csvRecord.getValues());
}
return ret;
} } | public class class_name {
public List<List<String>> getRecordsAsString() {
if(records == null)
records = new ArrayList<>();
List<List<String>> ret = new ArrayList<>();
for(SingleCSVRecord csvRecord : records) {
ret.add(csvRecord.getValues()); // depends on control dependency: [for], data = [csvRecord]
}
return ret;
} } |
public class class_name {
void startup() {
logger.info("Logger startup: " + this);
new Thread(() -> {
try {
String path = "pods/" + pod.getName() + "/log?follow=true";
URL url = new URL(Context.getBaseUrl() + "/" + path);
HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection();
HttpHelper helper = new HttpHelper(urlConnection);
Map<String, String> requestHeaders = new HashMap<>();
requestHeaders.put("Authorization", "Bearer " + Context.getServiceToken());
helper.setHeaders(requestHeaders);
HttpConnection connection = helper.getConnection();
connection.prepare("GET");
byte[] buffer = new byte[2048];
in = urlConnection.getInputStream();
File logFile = getFile();
out = new FileOutputStream(logFile, true);
while (!isTerminating) {
int bytesRead = in.read(buffer);
if (bytesRead == -1) {
logger.warn("Logger: " + this + " terminating due to EOF");
terminate();
}
else {
out.write(buffer, 0, bytesRead);
out.flush();
if (logFile.length() > maxBytes) {
out.close();
Files.copy(logFile.toPath(), new File(logFile + ".old").toPath(), StandardCopyOption.REPLACE_EXISTING);
Files.write(logFile.toPath(), new byte[0], StandardOpenOption.TRUNCATE_EXISTING);
out = new FileOutputStream(logFile, true);
}
}
}
}
catch (IOException ex) {
logger.severeException(ex.getMessage(), ex);
}
finally {
shutdown();
}
}).start();
} } | public class class_name {
void startup() {
logger.info("Logger startup: " + this);
new Thread(() -> {
try {
String path = "pods/" + pod.getName() + "/log?follow=true";
URL url = new URL(Context.getBaseUrl() + "/" + path);
HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection();
HttpHelper helper = new HttpHelper(urlConnection);
Map<String, String> requestHeaders = new HashMap<>();
requestHeaders.put("Authorization", "Bearer " + Context.getServiceToken()); // depends on control dependency: [try], data = [none]
helper.setHeaders(requestHeaders); // depends on control dependency: [try], data = [none]
HttpConnection connection = helper.getConnection();
connection.prepare("GET"); // depends on control dependency: [try], data = [none]
byte[] buffer = new byte[2048];
in = urlConnection.getInputStream(); // depends on control dependency: [try], data = [none]
File logFile = getFile();
out = new FileOutputStream(logFile, true); // depends on control dependency: [try], data = [none]
while (!isTerminating) {
int bytesRead = in.read(buffer);
if (bytesRead == -1) {
logger.warn("Logger: " + this + " terminating due to EOF"); // depends on control dependency: [if], data = [none]
terminate(); // depends on control dependency: [if], data = [none]
}
else {
out.write(buffer, 0, bytesRead); // depends on control dependency: [if], data = [none]
out.flush(); // depends on control dependency: [if], data = [none]
if (logFile.length() > maxBytes) {
out.close(); // depends on control dependency: [if], data = [none]
Files.copy(logFile.toPath(), new File(logFile + ".old").toPath(), StandardCopyOption.REPLACE_EXISTING); // depends on control dependency: [if], data = [none]
Files.write(logFile.toPath(), new byte[0], StandardOpenOption.TRUNCATE_EXISTING); // depends on control dependency: [if], data = [none]
out = new FileOutputStream(logFile, true); // depends on control dependency: [if], data = [none]
}
}
}
}
catch (IOException ex) {
logger.severeException(ex.getMessage(), ex);
} // depends on control dependency: [catch], data = [none]
finally {
shutdown();
}
}).start();
} } |
public class class_name {
protected void generateRecordingMetadataFile(Recording recording) {
String folder = this.openviduConfig.getOpenViduRecordingPath() + recording.getId();
boolean newFolderCreated = this.fileWriter.createFolderIfNotExists(folder);
if (newFolderCreated) {
log.info(
"New folder {} created. This means the recording started for a session with no publishers or no media type compatible publishers",
folder);
} else {
log.info("Folder {} already existed. Some publisher is already being recorded", folder);
}
String filePath = this.openviduConfig.getOpenViduRecordingPath() + recording.getId() + "/"
+ RecordingManager.RECORDING_ENTITY_FILE + recording.getId();
String text = recording.toJson().toString();
this.fileWriter.createAndWriteFile(filePath, text);
log.info("Generated recording metadata file at {}", filePath);
} } | public class class_name {
protected void generateRecordingMetadataFile(Recording recording) {
String folder = this.openviduConfig.getOpenViduRecordingPath() + recording.getId();
boolean newFolderCreated = this.fileWriter.createFolderIfNotExists(folder);
if (newFolderCreated) {
log.info(
"New folder {} created. This means the recording started for a session with no publishers or no media type compatible publishers",
folder); // depends on control dependency: [if], data = [none]
} else {
log.info("Folder {} already existed. Some publisher is already being recorded", folder); // depends on control dependency: [if], data = [none]
}
String filePath = this.openviduConfig.getOpenViduRecordingPath() + recording.getId() + "/"
+ RecordingManager.RECORDING_ENTITY_FILE + recording.getId();
String text = recording.toJson().toString();
this.fileWriter.createAndWriteFile(filePath, text);
log.info("Generated recording metadata file at {}", filePath);
} } |
public class class_name {
public String savePageSource(String fileName) {
List<WebElement> framesWithFakeSources = new ArrayList<>(2);
Map<String, String> sourceReplacements = new HashMap<>();
List<WebElement> frames = getFrames();
for (WebElement frame : frames) {
String newLocation = saveFrameSource(frame);
if (newLocation != null) {
String fullUrlOfFrame = frame.getAttribute("src");
if (StringUtils.isEmpty(fullUrlOfFrame)) {
framesWithFakeSources.add(frame);
fullUrlOfFrame = "anonymousFrame" + frames.indexOf(frame);
addFakeSourceAttr(frame, fullUrlOfFrame);
}
addSourceReplacementsForFrame(sourceReplacements, newLocation, fullUrlOfFrame);
}
}
String source = getCurrentFrameSource(sourceReplacements);
if (!framesWithFakeSources.isEmpty()) {
// replace fake_src by src
source = source.replace(" " + FAKE_SRC_ATTR + "=", " src=");
removeFakeSourceAttr(framesWithFakeSources);
}
return saveSourceAsPageSource(fileName, source);
} } | public class class_name {
public String savePageSource(String fileName) {
List<WebElement> framesWithFakeSources = new ArrayList<>(2);
Map<String, String> sourceReplacements = new HashMap<>();
List<WebElement> frames = getFrames();
for (WebElement frame : frames) {
String newLocation = saveFrameSource(frame);
if (newLocation != null) {
String fullUrlOfFrame = frame.getAttribute("src");
if (StringUtils.isEmpty(fullUrlOfFrame)) {
framesWithFakeSources.add(frame); // depends on control dependency: [if], data = [none]
fullUrlOfFrame = "anonymousFrame" + frames.indexOf(frame); // depends on control dependency: [if], data = [none]
addFakeSourceAttr(frame, fullUrlOfFrame); // depends on control dependency: [if], data = [none]
}
addSourceReplacementsForFrame(sourceReplacements, newLocation, fullUrlOfFrame); // depends on control dependency: [if], data = [none]
}
}
String source = getCurrentFrameSource(sourceReplacements);
if (!framesWithFakeSources.isEmpty()) {
// replace fake_src by src
source = source.replace(" " + FAKE_SRC_ATTR + "=", " src="); // depends on control dependency: [if], data = [none]
removeFakeSourceAttr(framesWithFakeSources); // depends on control dependency: [if], data = [none]
}
return saveSourceAsPageSource(fileName, source);
} } |
public class class_name {
private static boolean anyInterfaceSupportsIpV6() {
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface iface = interfaces.nextElement();
Enumeration<InetAddress> addresses = iface.getInetAddresses();
while (addresses.hasMoreElements()) {
if (addresses.nextElement() instanceof Inet6Address) {
return true;
}
}
}
} catch (SocketException e) {
logger.debug("Unable to detect if any interface supports IPv6, assuming IPv4-only", e);
// ignore
}
return false;
} } | public class class_name {
private static boolean anyInterfaceSupportsIpV6() {
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface iface = interfaces.nextElement();
Enumeration<InetAddress> addresses = iface.getInetAddresses();
while (addresses.hasMoreElements()) {
if (addresses.nextElement() instanceof Inet6Address) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
} catch (SocketException e) {
logger.debug("Unable to detect if any interface supports IPv6, assuming IPv4-only", e);
// ignore
} // depends on control dependency: [catch], data = [none]
return false;
} } |
public class class_name {
public static void main(String[] args)
{
if (args == null || args.length != 1) {
System.out
.println(("You need to specify the database configuration file. \n"
+ "It should contain the access credentials to you revision database in the following format: \n"
+ " host=dbhost \n"
+ " db=revisiondb \n"
+ " user=username \n"
+ " password=pwd \n"
+ " language=english \n"
+ " output=outputFile \n"
+ " charset=UTF8 (optional)\n"
+ " pagebuffer=5000 (optional)\n"
+ " maxAllowedPackets=16760832 (optional)"));
throw new IllegalArgumentException();
}
else {
Properties props = load(args[0]);
DatabaseConfiguration config = new DatabaseConfiguration();
config.setHost(props.getProperty("host"));
config.setDatabase(props.getProperty("db"));
config.setUser(props.getProperty("user"));
config.setPassword(props.getProperty("password"));
config.setLanguage(Language.valueOf(props.getProperty("language")));
String charset = props.getProperty("charset");
String pagebufferString = props.getProperty("pagebuffer");
int pageBuffer;
String maxAllowedPacketsString = props.getProperty("maxAllowedPackets");
long maxAllowedPackets;
try {
if (charset == null) {
charset = "UTF-8";
}
if (pagebufferString != null) {
pageBuffer = Integer.parseInt(pagebufferString);
}
else {
pageBuffer = 5000;
}
if (maxAllowedPacketsString != null) {
maxAllowedPackets = Long.parseLong(maxAllowedPacketsString);
}
else {
maxAllowedPackets = (16 * 1024 * 1023);
}
String output = props.getProperty("output");
File outfile = new File(output);
if (outfile.isDirectory()) {
try {
output = outfile.getCanonicalPath()
+ File.separatorChar + "templateInfo.sql";
}
catch (IOException e) {
output = outfile.getPath() + File.separatorChar
+ "templateInfo.sql";
}
}
String active_for_pages = props
.getProperty(FILTERING_ACTIVE_FOR_PAGES);
String active_for_revisions = props
.getProperty(FILTERING_ACTIVE_FOR_REVISIONS);
String useRevisionIterator = props
.getProperty(USE_REVISION_ITERATOR);
GeneratorMode mode = new GeneratorMode();
if (active_for_pages.equals("true")) {
mode.active_for_pages = true;
}
if (active_for_revisions.equals("true")) {
mode.active_for_revisions = true;
}
if(useRevisionIterator.equals("true")||useRevisionIterator==null||useRevisionIterator.equals("")){
mode.useRevisionIterator=true;
}
TemplateFilter pageFilter = new TemplateFilter(
createSetFromProperty(props
.getProperty(PAGES_WHITE_LIST)),
createSetFromProperty(props
.getProperty(PAGES_WHITE_PREFIX_LIST)),
createSetFromProperty(props
.getProperty(PAGES_BLACK_LIST)),
createSetFromProperty(props
.getProperty(PAGES_BLACK_PREFIX_LIST)));
TemplateFilter revisionFilter = new TemplateFilter(
createSetFromProperty(props
.getProperty(REVISIONS_WHITE_LIST)),
createSetFromProperty(props
.getProperty(REVISIONS_WHITE_PREFIX_LIST)),
createSetFromProperty(props
.getProperty(REVISIONS_BLACK_LIST)),
createSetFromProperty(props
.getProperty(REVISIONS_BLACK_PREFIX_LIST)));
WikipediaTemplateInfoGenerator generator = new WikipediaTemplateInfoGenerator(
config, pageBuffer, charset, output,
maxAllowedPackets, pageFilter, revisionFilter, mode);
// Start processing now
generator.process();
}
catch (Exception e) {
e.printStackTrace();
}
}
} } | public class class_name {
public static void main(String[] args)
{
if (args == null || args.length != 1) {
System.out
.println(("You need to specify the database configuration file. \n"
+ "It should contain the access credentials to you revision database in the following format: \n"
+ " host=dbhost \n"
+ " db=revisiondb \n"
+ " user=username \n"
+ " password=pwd \n"
+ " language=english \n"
+ " output=outputFile \n"
+ " charset=UTF8 (optional)\n"
+ " pagebuffer=5000 (optional)\n"
+ " maxAllowedPackets=16760832 (optional)"));
throw new IllegalArgumentException(); // depends on control dependency: [if], data = [none]
}
else {
Properties props = load(args[0]);
DatabaseConfiguration config = new DatabaseConfiguration();
config.setHost(props.getProperty("host")); // depends on control dependency: [if], data = [none]
config.setDatabase(props.getProperty("db")); // depends on control dependency: [if], data = [none]
config.setUser(props.getProperty("user")); // depends on control dependency: [if], data = [none]
config.setPassword(props.getProperty("password")); // depends on control dependency: [if], data = [none]
config.setLanguage(Language.valueOf(props.getProperty("language"))); // depends on control dependency: [if], data = [none]
String charset = props.getProperty("charset");
String pagebufferString = props.getProperty("pagebuffer");
int pageBuffer;
String maxAllowedPacketsString = props.getProperty("maxAllowedPackets");
long maxAllowedPackets;
try {
if (charset == null) {
charset = "UTF-8"; // depends on control dependency: [if], data = [none]
}
if (pagebufferString != null) {
pageBuffer = Integer.parseInt(pagebufferString); // depends on control dependency: [if], data = [(pagebufferString]
}
else {
pageBuffer = 5000; // depends on control dependency: [if], data = [none]
}
if (maxAllowedPacketsString != null) {
maxAllowedPackets = Long.parseLong(maxAllowedPacketsString); // depends on control dependency: [if], data = [(maxAllowedPacketsString]
}
else {
maxAllowedPackets = (16 * 1024 * 1023); // depends on control dependency: [if], data = [none]
}
String output = props.getProperty("output");
File outfile = new File(output);
if (outfile.isDirectory()) {
try {
output = outfile.getCanonicalPath()
+ File.separatorChar + "templateInfo.sql"; // depends on control dependency: [try], data = [none]
}
catch (IOException e) {
output = outfile.getPath() + File.separatorChar
+ "templateInfo.sql";
} // depends on control dependency: [catch], data = [none]
}
String active_for_pages = props
.getProperty(FILTERING_ACTIVE_FOR_PAGES);
String active_for_revisions = props
.getProperty(FILTERING_ACTIVE_FOR_REVISIONS);
String useRevisionIterator = props
.getProperty(USE_REVISION_ITERATOR);
GeneratorMode mode = new GeneratorMode();
if (active_for_pages.equals("true")) {
mode.active_for_pages = true; // depends on control dependency: [if], data = [none]
}
if (active_for_revisions.equals("true")) {
mode.active_for_revisions = true; // depends on control dependency: [if], data = [none]
}
if(useRevisionIterator.equals("true")||useRevisionIterator==null||useRevisionIterator.equals("")){
mode.useRevisionIterator=true; // depends on control dependency: [if], data = [none]
}
TemplateFilter pageFilter = new TemplateFilter(
createSetFromProperty(props
.getProperty(PAGES_WHITE_LIST)),
createSetFromProperty(props
.getProperty(PAGES_WHITE_PREFIX_LIST)),
createSetFromProperty(props
.getProperty(PAGES_BLACK_LIST)),
createSetFromProperty(props
.getProperty(PAGES_BLACK_PREFIX_LIST)));
TemplateFilter revisionFilter = new TemplateFilter(
createSetFromProperty(props
.getProperty(REVISIONS_WHITE_LIST)),
createSetFromProperty(props
.getProperty(REVISIONS_WHITE_PREFIX_LIST)),
createSetFromProperty(props
.getProperty(REVISIONS_BLACK_LIST)),
createSetFromProperty(props
.getProperty(REVISIONS_BLACK_PREFIX_LIST)));
WikipediaTemplateInfoGenerator generator = new WikipediaTemplateInfoGenerator(
config, pageBuffer, charset, output,
maxAllowedPackets, pageFilter, revisionFilter, mode);
// Start processing now
generator.process(); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public char[] getRawName() {
if (_path == null) {
return null;
}
int at = 0;
for (int i = _path.length - 1; i >= 0; i--) {
if (_path[i] == '/') {
at = i + 1;
break;
}
}
int len = _path.length - at;
char[] basename = new char[len];
System.arraycopy(_path, at, basename, 0, len);
return basename;
} } | public class class_name {
public char[] getRawName() {
if (_path == null) {
return null; // depends on control dependency: [if], data = [none]
}
int at = 0;
for (int i = _path.length - 1; i >= 0; i--) {
if (_path[i] == '/') {
at = i + 1; // depends on control dependency: [if], data = [none]
break;
}
}
int len = _path.length - at;
char[] basename = new char[len];
System.arraycopy(_path, at, basename, 0, len);
return basename;
} } |
public class class_name {
long addBarrierNode(long nodeId) {
ReaderNode newNode;
int graphIndex = getNodeMap().get(nodeId);
if (graphIndex < TOWER_NODE) {
graphIndex = -graphIndex - 3;
newNode = new ReaderNode(createNewNodeId(), nodeAccess, graphIndex);
} else {
graphIndex = graphIndex - 3;
newNode = new ReaderNode(createNewNodeId(), pillarInfo, graphIndex);
}
final long id = newNode.getId();
prepareHighwayNode(id);
addNode(newNode);
return id;
} } | public class class_name {
long addBarrierNode(long nodeId) {
ReaderNode newNode;
int graphIndex = getNodeMap().get(nodeId);
if (graphIndex < TOWER_NODE) {
graphIndex = -graphIndex - 3; // depends on control dependency: [if], data = [none]
newNode = new ReaderNode(createNewNodeId(), nodeAccess, graphIndex); // depends on control dependency: [if], data = [none]
} else {
graphIndex = graphIndex - 3; // depends on control dependency: [if], data = [none]
newNode = new ReaderNode(createNewNodeId(), pillarInfo, graphIndex); // depends on control dependency: [if], data = [none]
}
final long id = newNode.getId();
prepareHighwayNode(id);
addNode(newNode);
return id;
} } |
public class class_name {
@Nonnull
@SuppressFBWarnings("NP_NONNULL_RETURN_VIOLATION")
public String getApiToken() {
LOGGER.log(Level.FINE, "Deprecated usage of getApiToken");
if(LOGGER.isLoggable(Level.FINER)){
LOGGER.log(Level.FINER, "Deprecated usage of getApiToken (trace)", new Exception());
}
return hasPermissionToSeeToken()
? getApiTokenInsecure()
: Messages.ApiTokenProperty_ChangeToken_TokenIsHidden();
} } | public class class_name {
@Nonnull
@SuppressFBWarnings("NP_NONNULL_RETURN_VIOLATION")
public String getApiToken() {
LOGGER.log(Level.FINE, "Deprecated usage of getApiToken");
if(LOGGER.isLoggable(Level.FINER)){
LOGGER.log(Level.FINER, "Deprecated usage of getApiToken (trace)", new Exception()); // depends on control dependency: [if], data = [none]
}
return hasPermissionToSeeToken()
? getApiTokenInsecure()
: Messages.ApiTokenProperty_ChangeToken_TokenIsHidden();
} } |
public class class_name {
private static synchronized Map<String, List<String>> load(Map<String, Object> config, boolean start, boolean restart) {
final boolean bTrace = TraceComponent.isAnyTracingEnabled();
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Loading CHFW config from " + config);
}
Map<String, Map<String, String[]>> parsed = extractConfig(config);
// if a restart is set, then stop and remove existing chains
// that may be running already
if (restart) {
unloadChains(parsed.get("chains").keySet().iterator());
}
// handle any factory config first
List<String> createdFactories = loadFactories(parsed.get("factories"));
// load any endpoints
List<String> createdEndpoints = loadEndPoints(parsed.get("endpoints"));
// now load any channels
List<String> createdChannels = loadChannels(parsed.get("channels"));
// now load any chains
List<String> createdChains = loadChains(parsed.get("chains"), start, restart);
// now load the chain group definitions
List<String> createdGroups = loadGroups(parsed.get("groups"), start, restart);
Map<String, List<String>> rc = new HashMap<String, List<String>>();
rc.put("factory", createdFactories);
rc.put("channel", createdChannels);
rc.put("chain", createdChains);
rc.put("group", createdGroups);
rc.put("endpoint", createdEndpoints);
return rc;
} } | public class class_name {
private static synchronized Map<String, List<String>> load(Map<String, Object> config, boolean start, boolean restart) {
final boolean bTrace = TraceComponent.isAnyTracingEnabled();
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Loading CHFW config from " + config); // depends on control dependency: [if], data = [none]
}
Map<String, Map<String, String[]>> parsed = extractConfig(config);
// if a restart is set, then stop and remove existing chains
// that may be running already
if (restart) {
unloadChains(parsed.get("chains").keySet().iterator()); // depends on control dependency: [if], data = [none]
}
// handle any factory config first
List<String> createdFactories = loadFactories(parsed.get("factories"));
// load any endpoints
List<String> createdEndpoints = loadEndPoints(parsed.get("endpoints"));
// now load any channels
List<String> createdChannels = loadChannels(parsed.get("channels"));
// now load any chains
List<String> createdChains = loadChains(parsed.get("chains"), start, restart);
// now load the chain group definitions
List<String> createdGroups = loadGroups(parsed.get("groups"), start, restart);
Map<String, List<String>> rc = new HashMap<String, List<String>>();
rc.put("factory", createdFactories);
rc.put("channel", createdChannels);
rc.put("chain", createdChains);
rc.put("group", createdGroups);
rc.put("endpoint", createdEndpoints);
return rc;
} } |
public class class_name {
public static int stringSize(long x) {
long p = 10;
for (int i = 1; i < 19; i++) {
if (x < p) return i;
p = 10 * p;
}
return 19;
} } | public class class_name {
public static int stringSize(long x) {
long p = 10;
for (int i = 1; i < 19; i++) {
if (x < p) return i;
p = 10 * p;
// depends on control dependency: [for], data = [none]
}
return 19;
} } |
public class class_name {
public String getRequestBaggage(String key) {
if (BAGGAGE_ENABLE && key != null) {
return requestBaggage.get(key);
}
return null;
} } | public class class_name {
public String getRequestBaggage(String key) {
if (BAGGAGE_ENABLE && key != null) {
return requestBaggage.get(key); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public Field forceDeleteField(Field fieldParam)
{
if(fieldParam != null && this.serviceTicket != null)
{
fieldParam.setServiceTicket(this.serviceTicket);
}
return new Field(this.postJson(
fieldParam, WS.Path.FormField.Version1.formFieldDelete(true)));
} } | public class class_name {
public Field forceDeleteField(Field fieldParam)
{
if(fieldParam != null && this.serviceTicket != null)
{
fieldParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none]
}
return new Field(this.postJson(
fieldParam, WS.Path.FormField.Version1.formFieldDelete(true)));
} } |
public class class_name {
public <SignatureType> BrokenDownProvenancedConfusionMatrix<SignatureType, CellFiller>
breakdown(Function<? super CellFiller, SignatureType> signatureFunction,
Ordering<SignatureType> keyOrdering) {
final Map<SignatureType, Builder<CellFiller>> ret = Maps.newHashMap();
// a more efficient implementation should be used if the confusion matrix is
// large and sparse, but this is unlikely. ~ rgabbard
for (final Symbol leftLabel : leftLabels()) {
for (final Symbol rightLabel : rightLabels()) {
for (final CellFiller provenance : cell(leftLabel, rightLabel)) {
final SignatureType signature = signatureFunction.apply(provenance);
checkNotNull(signature, "Provenance function may never return null");
if (!ret.containsKey(signature)) {
ret.put(signature, ProvenancedConfusionMatrix.<CellFiller>builder());
}
ret.get(signature).record(leftLabel, rightLabel, provenance);
}
}
}
final ImmutableMap.Builder<SignatureType, ProvenancedConfusionMatrix<CellFiller>> trueRet =
ImmutableMap.builder();
// to get consistent output, we make sure to sort by the keys
for (final Map.Entry<SignatureType, Builder<CellFiller>> entry :
MapUtils.<SignatureType, Builder<CellFiller>>byKeyOrdering(keyOrdering).sortedCopy(
ret.entrySet())) {
trueRet.put(entry.getKey(), entry.getValue().build());
}
return BrokenDownProvenancedConfusionMatrix.fromMap(trueRet.build());
} } | public class class_name {
public <SignatureType> BrokenDownProvenancedConfusionMatrix<SignatureType, CellFiller>
breakdown(Function<? super CellFiller, SignatureType> signatureFunction,
Ordering<SignatureType> keyOrdering) {
final Map<SignatureType, Builder<CellFiller>> ret = Maps.newHashMap();
// a more efficient implementation should be used if the confusion matrix is
// large and sparse, but this is unlikely. ~ rgabbard
for (final Symbol leftLabel : leftLabels()) {
for (final Symbol rightLabel : rightLabels()) {
for (final CellFiller provenance : cell(leftLabel, rightLabel)) {
final SignatureType signature = signatureFunction.apply(provenance);
checkNotNull(signature, "Provenance function may never return null"); // depends on control dependency: [for], data = [none]
if (!ret.containsKey(signature)) {
ret.put(signature, ProvenancedConfusionMatrix.<CellFiller>builder()); // depends on control dependency: [if], data = [none]
}
ret.get(signature).record(leftLabel, rightLabel, provenance); // depends on control dependency: [for], data = [provenance]
}
}
}
final ImmutableMap.Builder<SignatureType, ProvenancedConfusionMatrix<CellFiller>> trueRet =
ImmutableMap.builder();
// to get consistent output, we make sure to sort by the keys
for (final Map.Entry<SignatureType, Builder<CellFiller>> entry :
MapUtils.<SignatureType, Builder<CellFiller>>byKeyOrdering(keyOrdering).sortedCopy(
ret.entrySet())) {
trueRet.put(entry.getKey(), entry.getValue().build()); // depends on control dependency: [for], data = [entry]
}
return BrokenDownProvenancedConfusionMatrix.fromMap(trueRet.build());
} } |
public class class_name {
private void notifyOnValidationFailure(@NonNull final Validator<CharSequence> validator) {
for (ValidationListener<CharSequence> validationListener : validationListeners) {
validationListener.onValidationFailure(this, validator);
}
} } | public class class_name {
private void notifyOnValidationFailure(@NonNull final Validator<CharSequence> validator) {
for (ValidationListener<CharSequence> validationListener : validationListeners) {
validationListener.onValidationFailure(this, validator); // depends on control dependency: [for], data = [validationListener]
}
} } |
public class class_name {
private Map<String, Object> getConfigParams(Class<?> clazz) {
Map<String, Object> params = new HashMap<>();
for (Field field : clazz.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && field.getName().endsWith("_CONFIG")) {
try {
String key = field.get(null).toString();
String value = SpringUtil.getProperty("org.carewebframework.messaging.kafka." + key);
if (value != null) {
params.put(key, value);
}
} catch (Exception e) {}
}
}
return params;
} } | public class class_name {
private Map<String, Object> getConfigParams(Class<?> clazz) {
Map<String, Object> params = new HashMap<>();
for (Field field : clazz.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && field.getName().endsWith("_CONFIG")) {
try {
String key = field.get(null).toString();
String value = SpringUtil.getProperty("org.carewebframework.messaging.kafka." + key);
if (value != null) {
params.put(key, value); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {} // depends on control dependency: [catch], data = [none]
}
}
return params;
} } |
public class class_name {
public static String getTempDir() {
// default is user home directory
String tempDir = System.getProperty("user.home");
try{
//create a temp file
File temp = File.createTempFile("A0393939", ".tmp");
//Get tempropary file path
String absolutePath = temp.getAbsolutePath();
tempDir = absolutePath.substring(0,absolutePath.lastIndexOf(File.separator));
}catch(IOException e){}
return tempDir;
} } | public class class_name {
public static String getTempDir() {
// default is user home directory
String tempDir = System.getProperty("user.home");
try{
//create a temp file
File temp = File.createTempFile("A0393939", ".tmp");
//Get tempropary file path
String absolutePath = temp.getAbsolutePath();
tempDir = absolutePath.substring(0,absolutePath.lastIndexOf(File.separator)); // depends on control dependency: [try], data = [none]
}catch(IOException e){} // depends on control dependency: [catch], data = [none]
return tempDir;
} } |
public class class_name {
void toggleDefaultPage() {
if (treeViewer.getTree().getItemCount() < 1) {
book.showPage(noServersPage);
} else {
book.showPage(mainPage);
}
} } | public class class_name {
void toggleDefaultPage() {
if (treeViewer.getTree().getItemCount() < 1) {
book.showPage(noServersPage); // depends on control dependency: [if], data = [none]
} else {
book.showPage(mainPage); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public PoolRemoveNodesOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null;
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate);
}
return this;
} } | public class class_name {
public PoolRemoveNodesOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null; // depends on control dependency: [if], data = [none]
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate]
}
return this;
} } |
public class class_name {
public static boolean supportsStyle(String style) {
String styleFileName = style;
if (!styleFileName.endsWith(".csl")) {
styleFileName = styleFileName + ".csl";
}
if (!styleFileName.startsWith("/")) {
styleFileName = "/" + styleFileName;
}
URL url = CSL.class.getResource(styleFileName);
return (url != null);
} } | public class class_name {
public static boolean supportsStyle(String style) {
String styleFileName = style;
if (!styleFileName.endsWith(".csl")) {
styleFileName = styleFileName + ".csl"; // depends on control dependency: [if], data = [none]
}
if (!styleFileName.startsWith("/")) {
styleFileName = "/" + styleFileName; // depends on control dependency: [if], data = [none]
}
URL url = CSL.class.getResource(styleFileName);
return (url != null);
} } |
public class class_name {
private int findFileIndexAndUpdateCounter(String dateString) {
if (dateString.equals(lastDateString)) {
if (maxFiles <= 0) {
// addFile is a no-op, so it doesn't matter what we return.
return -1;
}
// Current date is the same, so the file goes at the end.
return files.size();
}
// Use the new date string.
lastDateString = dateString;
lastCounter = 0;
if (maxFiles <= 0) {
// addFile is a no-op, so it doesn't matter what we return.
return -1;
}
if (files.isEmpty() || dateString.compareTo(lastDateString) > 0) {
// Current date is newer, so the file goes at the end.
return files.size();
}
// Current date is older, so determine where it goes.
String partialFileName = fileName + dateString + '.';
return -Collections.binarySearch(files, partialFileName, NaturalComparator.instance) - 1;
} } | public class class_name {
private int findFileIndexAndUpdateCounter(String dateString) {
if (dateString.equals(lastDateString)) {
if (maxFiles <= 0) {
// addFile is a no-op, so it doesn't matter what we return.
return -1; // depends on control dependency: [if], data = [none]
}
// Current date is the same, so the file goes at the end.
return files.size(); // depends on control dependency: [if], data = [none]
}
// Use the new date string.
lastDateString = dateString;
lastCounter = 0;
if (maxFiles <= 0) {
// addFile is a no-op, so it doesn't matter what we return.
return -1; // depends on control dependency: [if], data = [none]
}
if (files.isEmpty() || dateString.compareTo(lastDateString) > 0) {
// Current date is newer, so the file goes at the end.
return files.size(); // depends on control dependency: [if], data = [none]
}
// Current date is older, so determine where it goes.
String partialFileName = fileName + dateString + '.';
return -Collections.binarySearch(files, partialFileName, NaturalComparator.instance) - 1;
} } |
public class class_name {
private boolean checkIeVatId(final String pvatId) {
final char checkSum = pvatId.charAt(9);
String vatId = pvatId;
if (pvatId.charAt(3) >= 'A' && pvatId.charAt(3) <= 'Z') {
// old id, can be transfered to new form
vatId = pvatId.substring(0, 2) + "0" + pvatId.substring(4, 9) + pvatId.substring(2, 3)
+ pvatId.substring(9);
}
final int sum = (vatId.charAt(2) - '0') * 8 + (vatId.charAt(3) - '0') * 7
+ (vatId.charAt(4) - '0') * 6 + (vatId.charAt(5) - '0') * 5 + (vatId.charAt(6) - '0') * 4
+ (vatId.charAt(7) - '0') * 3 + (vatId.charAt(8) - '0') * 2;
final int calculatedCheckSum = sum % 23;
final char calculatedCheckSumCharIe;
if (calculatedCheckSum == 0) {
calculatedCheckSumCharIe = 'W';
} else {
calculatedCheckSumCharIe = (char) ('A' + calculatedCheckSum - 1);
}
return checkSum == calculatedCheckSumCharIe;
} } | public class class_name {
private boolean checkIeVatId(final String pvatId) {
final char checkSum = pvatId.charAt(9);
String vatId = pvatId;
if (pvatId.charAt(3) >= 'A' && pvatId.charAt(3) <= 'Z') {
// old id, can be transfered to new form
vatId = pvatId.substring(0, 2) + "0" + pvatId.substring(4, 9) + pvatId.substring(2, 3)
+ pvatId.substring(9);
// depends on control dependency: [if], data = [none]
}
final int sum = (vatId.charAt(2) - '0') * 8 + (vatId.charAt(3) - '0') * 7
+ (vatId.charAt(4) - '0') * 6 + (vatId.charAt(5) - '0') * 5 + (vatId.charAt(6) - '0') * 4
+ (vatId.charAt(7) - '0') * 3 + (vatId.charAt(8) - '0') * 2;
final int calculatedCheckSum = sum % 23;
final char calculatedCheckSumCharIe;
if (calculatedCheckSum == 0) {
calculatedCheckSumCharIe = 'W';
// depends on control dependency: [if], data = [none]
} else {
calculatedCheckSumCharIe = (char) ('A' + calculatedCheckSum - 1);
// depends on control dependency: [if], data = [none]
}
return checkSum == calculatedCheckSumCharIe;
} } |
public class class_name {
public String buildDialogForm() {
StringBuffer result = new StringBuffer(16384);
Iterator<CmsResource> i = getImages().iterator();
result.append("<div style=\"height: 450px; padding: 4px; overflow: auto;\">");
while (i.hasNext()) {
CmsResource res = i.next();
String imageName = res.getName();
String propertySuffix = "" + imageName.hashCode();
result.append(dialogBlockStart(imageName));
result.append("<table border=\"0\">\n");
result.append("<tr>\n\t<td style=\"vertical-align: top;\">");
// create image tag
result.append("<img src=\"");
StringBuffer link = new StringBuffer(256);
link.append(getCms().getSitePath(res));
link.append(getImageScaler().toRequestParam());
result.append(getJsp().link(link.toString()));
result.append("\" border=\"0\" alt=\"\" width=\"");
result.append(getImageScaler().getWidth());
result.append("\" height=\"");
result.append(getImageScaler().getHeight());
result.append("\">");
result.append("</td>\n");
result.append("\t<td class=\"maxwidth\" style=\"vertical-align: top;\">\n");
result.append("\t\t<table border=\"0\">\n");
// build title property input row
String title = "";
try {
title = getCms().readPropertyObject(res, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue();
} catch (CmsException e) {
// log, should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(getLocale()));
}
}
result.append("\t\t<tr>\n\t\t\t<td style=\"white-space: nowrap;\" unselectable=\"on\">");
result.append(key(Messages.GUI_LABEL_TITLE_0));
result.append(":</td>\n\t\t\t<td class=\"maxwidth\">");
result.append("<input type=\"text\" class=\"maxwidth\" name=\"");
result.append(PREFIX_TITLE);
result.append(propertySuffix);
result.append("\" value=\"");
if (CmsStringUtil.isNotEmpty(title)) {
result.append(CmsEncoder.escapeXml(title));
}
result.append("\">");
result.append("</td>\n\t\t</tr>\n");
// build description property input row
String description = "";
try {
description = getCms().readPropertyObject(
res,
CmsPropertyDefinition.PROPERTY_DESCRIPTION,
false).getValue();
} catch (CmsException e) {
// log, should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(getLocale()));
}
}
result.append(
"\t\t<tr>\n\t\t\t<td style=\"white-space: nowrap; vertical-align: top;\" unselectable=\"on\">");
result.append(key(Messages.GUI_LABEL_DESCRIPTION_0));
result.append(":</td>\n\t\t\t<td style=\"vertical-align: top; height: 110px;\">");
result.append("<textarea rows=\"8\" class=\"maxwidth\" style=\"overflow: auto;\" name=\"");
result.append(PREFIX_DESCRIPTION);
result.append(propertySuffix);
result.append("\">");
if (CmsStringUtil.isNotEmpty(description)) {
result.append(CmsEncoder.escapeXml(description));
}
result.append("</textarea>");
result.append("</td>\n\t\t</tr>\n");
result.append("\t\t</table>\n");
result.append("</td>\n</tr>\n");
result.append("</table>\n");
result.append(dialogBlockEnd());
if (i.hasNext()) {
// append spacer if another entry follows
result.append(dialogSpacer());
}
}
result.append("</div>");
return result.toString();
} } | public class class_name {
public String buildDialogForm() {
StringBuffer result = new StringBuffer(16384);
Iterator<CmsResource> i = getImages().iterator();
result.append("<div style=\"height: 450px; padding: 4px; overflow: auto;\">");
while (i.hasNext()) {
CmsResource res = i.next();
String imageName = res.getName();
String propertySuffix = "" + imageName.hashCode();
result.append(dialogBlockStart(imageName)); // depends on control dependency: [while], data = [none]
result.append("<table border=\"0\">\n"); // depends on control dependency: [while], data = [none]
result.append("<tr>\n\t<td style=\"vertical-align: top;\">"); // depends on control dependency: [while], data = [none]
// create image tag
result.append("<img src=\""); // depends on control dependency: [while], data = [none]
StringBuffer link = new StringBuffer(256);
link.append(getCms().getSitePath(res)); // depends on control dependency: [while], data = [none]
link.append(getImageScaler().toRequestParam()); // depends on control dependency: [while], data = [none]
result.append(getJsp().link(link.toString())); // depends on control dependency: [while], data = [none]
result.append("\" border=\"0\" alt=\"\" width=\""); // depends on control dependency: [while], data = [none]
result.append(getImageScaler().getWidth()); // depends on control dependency: [while], data = [none]
result.append("\" height=\""); // depends on control dependency: [while], data = [none]
result.append(getImageScaler().getHeight()); // depends on control dependency: [while], data = [none]
result.append("\">"); // depends on control dependency: [while], data = [none]
result.append("</td>\n"); // depends on control dependency: [while], data = [none]
result.append("\t<td class=\"maxwidth\" style=\"vertical-align: top;\">\n"); // depends on control dependency: [while], data = [none]
result.append("\t\t<table border=\"0\">\n"); // depends on control dependency: [while], data = [none]
// build title property input row
String title = "";
try {
title = getCms().readPropertyObject(res, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue(); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
// log, should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(getLocale())); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
result.append("\t\t<tr>\n\t\t\t<td style=\"white-space: nowrap;\" unselectable=\"on\">"); // depends on control dependency: [while], data = [none]
result.append(key(Messages.GUI_LABEL_TITLE_0)); // depends on control dependency: [while], data = [none]
result.append(":</td>\n\t\t\t<td class=\"maxwidth\">"); // depends on control dependency: [while], data = [none]
result.append("<input type=\"text\" class=\"maxwidth\" name=\""); // depends on control dependency: [while], data = [none]
result.append(PREFIX_TITLE); // depends on control dependency: [while], data = [none]
result.append(propertySuffix); // depends on control dependency: [while], data = [none]
result.append("\" value=\""); // depends on control dependency: [while], data = [none]
if (CmsStringUtil.isNotEmpty(title)) {
result.append(CmsEncoder.escapeXml(title)); // depends on control dependency: [if], data = [none]
}
result.append("\">"); // depends on control dependency: [while], data = [none]
result.append("</td>\n\t\t</tr>\n"); // depends on control dependency: [while], data = [none]
// build description property input row
String description = "";
try {
description = getCms().readPropertyObject(
res,
CmsPropertyDefinition.PROPERTY_DESCRIPTION,
false).getValue(); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
// log, should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(getLocale())); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
result.append(
"\t\t<tr>\n\t\t\t<td style=\"white-space: nowrap; vertical-align: top;\" unselectable=\"on\">"); // depends on control dependency: [while], data = [none]
result.append(key(Messages.GUI_LABEL_DESCRIPTION_0)); // depends on control dependency: [while], data = [none]
result.append(":</td>\n\t\t\t<td style=\"vertical-align: top; height: 110px;\">"); // depends on control dependency: [while], data = [none]
result.append("<textarea rows=\"8\" class=\"maxwidth\" style=\"overflow: auto;\" name=\""); // depends on control dependency: [while], data = [none]
result.append(PREFIX_DESCRIPTION); // depends on control dependency: [while], data = [none]
result.append(propertySuffix); // depends on control dependency: [while], data = [none]
result.append("\">"); // depends on control dependency: [while], data = [none]
if (CmsStringUtil.isNotEmpty(description)) {
result.append(CmsEncoder.escapeXml(description)); // depends on control dependency: [if], data = [none]
}
result.append("</textarea>"); // depends on control dependency: [while], data = [none]
result.append("</td>\n\t\t</tr>\n"); // depends on control dependency: [while], data = [none]
result.append("\t\t</table>\n"); // depends on control dependency: [while], data = [none]
result.append("</td>\n</tr>\n"); // depends on control dependency: [while], data = [none]
result.append("</table>\n"); // depends on control dependency: [while], data = [none]
result.append(dialogBlockEnd()); // depends on control dependency: [while], data = [none]
if (i.hasNext()) {
// append spacer if another entry follows
result.append(dialogSpacer()); // depends on control dependency: [if], data = [none]
}
}
result.append("</div>");
return result.toString();
} } |
public class class_name {
public void setDefinition_12_063(SpatialReferenceSystem srs) {
if (srs != null) {
String definition = getDefinition_12_063(srs.getSrsId());
if (definition != null) {
srs.setDefinition_12_063(definition);
}
}
} } | public class class_name {
public void setDefinition_12_063(SpatialReferenceSystem srs) {
if (srs != null) {
String definition = getDefinition_12_063(srs.getSrsId());
if (definition != null) {
srs.setDefinition_12_063(definition); // depends on control dependency: [if], data = [(definition]
}
}
} } |
public class class_name {
public static String getParamTypesString(Class<?>... paramTypes) {
StringBuilder paramTypesList = new StringBuilder("(");
for (int i = 0; i < paramTypes.length; i++) {
paramTypesList.append(paramTypes[i].getSimpleName());
if (i + 1 < paramTypes.length) {
paramTypesList.append(", ");
}
}
return paramTypesList.append(")").toString();
} } | public class class_name {
public static String getParamTypesString(Class<?>... paramTypes) {
StringBuilder paramTypesList = new StringBuilder("(");
for (int i = 0; i < paramTypes.length; i++) {
paramTypesList.append(paramTypes[i].getSimpleName()); // depends on control dependency: [for], data = [i]
if (i + 1 < paramTypes.length) {
paramTypesList.append(", "); // depends on control dependency: [if], data = [none]
}
}
return paramTypesList.append(")").toString();
} } |
public class class_name {
public static CharSequence removePrefix(CharSequence fieldName, List<String> prefixes) {
if (prefixes == null || prefixes.isEmpty()) return fieldName;
fieldName = fieldName.toString();
outer:
for (String prefix : prefixes) {
if (prefix.length() == 0) return fieldName;
if (fieldName.length() <= prefix.length()) continue outer;
for (int i = 0; i < prefix.length(); i++) {
if (fieldName.charAt(i) != prefix.charAt(i)) continue outer;
}
char followupChar = fieldName.charAt(prefix.length());
// if prefix is a letter then follow up letter needs to not be lowercase, i.e. 'foo' is not a match
// as field named 'oo' with prefix 'f', but 'fOo' would be.
if (Character.isLetter(prefix.charAt(prefix.length() - 1)) &&
Character.isLowerCase(followupChar)) continue outer;
return "" + Character.toLowerCase(followupChar) + fieldName.subSequence(prefix.length() + 1, fieldName.length());
}
return null;
} } | public class class_name {
public static CharSequence removePrefix(CharSequence fieldName, List<String> prefixes) {
if (prefixes == null || prefixes.isEmpty()) return fieldName;
fieldName = fieldName.toString();
outer:
for (String prefix : prefixes) {
if (prefix.length() == 0) return fieldName;
if (fieldName.length() <= prefix.length()) continue outer;
for (int i = 0; i < prefix.length(); i++) {
if (fieldName.charAt(i) != prefix.charAt(i)) continue outer;
}
char followupChar = fieldName.charAt(prefix.length());
// if prefix is a letter then follow up letter needs to not be lowercase, i.e. 'foo' is not a match
// as field named 'oo' with prefix 'f', but 'fOo' would be.
if (Character.isLetter(prefix.charAt(prefix.length() - 1)) &&
Character.isLowerCase(followupChar)) continue outer;
return "" + Character.toLowerCase(followupChar) + fieldName.subSequence(prefix.length() + 1, fieldName.length()); // depends on control dependency: [for], data = [prefix]
}
return null;
} } |
public class class_name {
public double clustering(double[][] centroids, double[][] sums, int[] counts, int[] membership) {
int k = centroids.length;
Arrays.fill(counts, 0);
int[] candidates = new int[k];
for (int i = 0; i < k; i++) {
candidates[i] = i;
Arrays.fill(sums[i], 0.0);
}
return filter(root, centroids, candidates, k, sums, counts, membership);
} } | public class class_name {
public double clustering(double[][] centroids, double[][] sums, int[] counts, int[] membership) {
int k = centroids.length;
Arrays.fill(counts, 0);
int[] candidates = new int[k];
for (int i = 0; i < k; i++) {
candidates[i] = i; // depends on control dependency: [for], data = [i]
Arrays.fill(sums[i], 0.0); // depends on control dependency: [for], data = [i]
}
return filter(root, centroids, candidates, k, sums, counts, membership);
} } |
public class class_name {
@Override
public void moveDownTextNodes(ITextNode[] textNodes) {
for (int i = textNodes.length - 1; i >= 0; i--) {
int index = textNodeList.indexOf(textNodes[i]);
if (index < textNodeList.size() - 1) {
ITextNode nextTextNode = textNodeList.get(index + 1);
textNodeList.set(index, nextTextNode);
textNodeList.set(index + 1, textNodes[i]);
}
}
fireTextNodesMoved(textNodes);
} } | public class class_name {
@Override
public void moveDownTextNodes(ITextNode[] textNodes) {
for (int i = textNodes.length - 1; i >= 0; i--) {
int index = textNodeList.indexOf(textNodes[i]);
if (index < textNodeList.size() - 1) {
ITextNode nextTextNode = textNodeList.get(index + 1);
textNodeList.set(index, nextTextNode); // depends on control dependency: [if], data = [(index]
textNodeList.set(index + 1, textNodes[i]); // depends on control dependency: [if], data = [(index]
}
}
fireTextNodesMoved(textNodes);
} } |
public class class_name {
public void toggleTabNames(boolean showTabNames) {
if (this.showTabNames == showTabNames) {
return;
}
this.showTabNames = showTabNames;
responseTabbedPanel.setShowTabNames(showTabNames);
if (layout != Layout.FULL) {
getTabbedStatus().setShowTabNames(showTabNames);
getTabbedSelect().setShowTabNames(showTabNames);
getTabbedWork().setShowTabNames(showTabNames);
} else {
getTabbedFull().setShowTabNames(showTabNames);
}
} } | public class class_name {
public void toggleTabNames(boolean showTabNames) {
if (this.showTabNames == showTabNames) {
return;
// depends on control dependency: [if], data = [none]
}
this.showTabNames = showTabNames;
responseTabbedPanel.setShowTabNames(showTabNames);
if (layout != Layout.FULL) {
getTabbedStatus().setShowTabNames(showTabNames);
// depends on control dependency: [if], data = [none]
getTabbedSelect().setShowTabNames(showTabNames);
// depends on control dependency: [if], data = [none]
getTabbedWork().setShowTabNames(showTabNames);
// depends on control dependency: [if], data = [none]
} else {
getTabbedFull().setShowTabNames(showTabNames);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public ScriptableObject.Slot query(Object key, int index)
{
if (slots == null) {
return null;
}
final int indexOrHash = (key != null ? key.hashCode() : index);
final int slotIndex = getSlotIndex(slots.length, indexOrHash);
for (ScriptableObject.Slot slot = slots[slotIndex];
slot != null;
slot = slot.next) {
Object skey = slot.name;
if (indexOrHash == slot.indexOrHash &&
(skey == key ||
(key != null && key.equals(skey)))) {
return slot;
}
}
return null;
} } | public class class_name {
@Override
public ScriptableObject.Slot query(Object key, int index)
{
if (slots == null) {
return null; // depends on control dependency: [if], data = [none]
}
final int indexOrHash = (key != null ? key.hashCode() : index);
final int slotIndex = getSlotIndex(slots.length, indexOrHash);
for (ScriptableObject.Slot slot = slots[slotIndex];
slot != null;
slot = slot.next) {
Object skey = slot.name;
if (indexOrHash == slot.indexOrHash &&
(skey == key ||
(key != null && key.equals(skey)))) {
return slot; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public void marshall(Policy policy, ProtocolMarshaller protocolMarshaller) {
if (policy == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(policy.getPolicyId(), POLICYID_BINDING);
protocolMarshaller.marshall(policy.getPolicyName(), POLICYNAME_BINDING);
protocolMarshaller.marshall(policy.getPolicyUpdateToken(), POLICYUPDATETOKEN_BINDING);
protocolMarshaller.marshall(policy.getSecurityServicePolicyData(), SECURITYSERVICEPOLICYDATA_BINDING);
protocolMarshaller.marshall(policy.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(policy.getResourceTypeList(), RESOURCETYPELIST_BINDING);
protocolMarshaller.marshall(policy.getResourceTags(), RESOURCETAGS_BINDING);
protocolMarshaller.marshall(policy.getExcludeResourceTags(), EXCLUDERESOURCETAGS_BINDING);
protocolMarshaller.marshall(policy.getRemediationEnabled(), REMEDIATIONENABLED_BINDING);
protocolMarshaller.marshall(policy.getIncludeMap(), INCLUDEMAP_BINDING);
protocolMarshaller.marshall(policy.getExcludeMap(), EXCLUDEMAP_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Policy policy, ProtocolMarshaller protocolMarshaller) {
if (policy == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(policy.getPolicyId(), POLICYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policy.getPolicyName(), POLICYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policy.getPolicyUpdateToken(), POLICYUPDATETOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policy.getSecurityServicePolicyData(), SECURITYSERVICEPOLICYDATA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policy.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policy.getResourceTypeList(), RESOURCETYPELIST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policy.getResourceTags(), RESOURCETAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policy.getExcludeResourceTags(), EXCLUDERESOURCETAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policy.getRemediationEnabled(), REMEDIATIONENABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policy.getIncludeMap(), INCLUDEMAP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(policy.getExcludeMap(), EXCLUDEMAP_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void processFunctions(String name, String text, String type,
List<MtasCRMParserFunctionOutput> functionOutputList) {
if (functions.containsKey(type) && functions.get(type).containsKey(name)
&& text != null) {
MtasCRMParserFunction function = functions.get(type).get(name);
String[] value;
if (function.split != null) {
value = text.split(Pattern.quote(function.split));
} else {
value = new String[] { text };
}
for (int c = 0; c < value.length; c++) {
boolean checkedEmpty = false;
if (value[c].equals("")) {
checkedEmpty = true;
}
if (function.output.containsKey(value[c])) {
ArrayList<MtasCRMParserFunctionOutput> list = function.output
.get(value[c]);
for (MtasCRMParserFunctionOutput listItem : list) {
functionOutputList.add(listItem.create(value[c]));
}
}
if (!checkedEmpty && function.output.containsKey("")) {
ArrayList<MtasCRMParserFunctionOutput> list = function.output.get("");
for (MtasCRMParserFunctionOutput listItem : list) {
functionOutputList.add(listItem.create(value[c]));
}
}
}
}
} } | public class class_name {
private void processFunctions(String name, String text, String type,
List<MtasCRMParserFunctionOutput> functionOutputList) {
if (functions.containsKey(type) && functions.get(type).containsKey(name)
&& text != null) {
MtasCRMParserFunction function = functions.get(type).get(name);
String[] value;
if (function.split != null) {
value = text.split(Pattern.quote(function.split)); // depends on control dependency: [if], data = [(function.split]
} else {
value = new String[] { text }; // depends on control dependency: [if], data = [none]
}
for (int c = 0; c < value.length; c++) {
boolean checkedEmpty = false;
if (value[c].equals("")) {
checkedEmpty = true; // depends on control dependency: [if], data = [none]
}
if (function.output.containsKey(value[c])) {
ArrayList<MtasCRMParserFunctionOutput> list = function.output
.get(value[c]);
for (MtasCRMParserFunctionOutput listItem : list) {
functionOutputList.add(listItem.create(value[c])); // depends on control dependency: [for], data = [listItem]
}
}
if (!checkedEmpty && function.output.containsKey("")) {
ArrayList<MtasCRMParserFunctionOutput> list = function.output.get("");
for (MtasCRMParserFunctionOutput listItem : list) {
functionOutputList.add(listItem.create(value[c])); // depends on control dependency: [for], data = [listItem]
}
}
}
}
} } |
public class class_name {
public ClientRequestContext build() {
final Endpoint endpoint;
if (this.endpoint != null) {
endpoint = this.endpoint;
} else {
endpoint = Endpoint.parse(authority());
}
final DefaultClientRequestContext ctx = new DefaultClientRequestContext(
eventLoop(), meterRegistry(), sessionProtocol(), endpoint,
method(), path(), query(), fragment, options, request());
if (isRequestStartTimeSet()) {
ctx.logBuilder().startRequest(fakeChannel(), sessionProtocol(), sslSession(),
requestStartTimeNanos(), requestStartTimeMicros());
} else {
ctx.logBuilder().startRequest(fakeChannel(), sessionProtocol(), sslSession());
}
if (request() instanceof HttpRequest) {
ctx.logBuilder().requestHeaders(((HttpRequest) request()).headers());
} else {
ctx.logBuilder().requestContent(request(), null);
}
return ctx;
} } | public class class_name {
public ClientRequestContext build() {
final Endpoint endpoint;
if (this.endpoint != null) {
endpoint = this.endpoint; // depends on control dependency: [if], data = [none]
} else {
endpoint = Endpoint.parse(authority()); // depends on control dependency: [if], data = [none]
}
final DefaultClientRequestContext ctx = new DefaultClientRequestContext(
eventLoop(), meterRegistry(), sessionProtocol(), endpoint,
method(), path(), query(), fragment, options, request());
if (isRequestStartTimeSet()) {
ctx.logBuilder().startRequest(fakeChannel(), sessionProtocol(), sslSession(),
requestStartTimeNanos(), requestStartTimeMicros()); // depends on control dependency: [if], data = [none]
} else {
ctx.logBuilder().startRequest(fakeChannel(), sessionProtocol(), sslSession()); // depends on control dependency: [if], data = [none]
}
if (request() instanceof HttpRequest) {
ctx.logBuilder().requestHeaders(((HttpRequest) request()).headers()); // depends on control dependency: [if], data = [none]
} else {
ctx.logBuilder().requestContent(request(), null); // depends on control dependency: [if], data = [none]
}
return ctx;
} } |
public class class_name {
public PrivateKey getPrivateKey_PKCS8Encoded(byte[] keyBytes){
try {
PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
return keyFactory.generatePrivate(spec);
} catch (Exception e) {
log.error(e.getMessage(),e);
}
return null;
} } | public class class_name {
public PrivateKey getPrivateKey_PKCS8Encoded(byte[] keyBytes){
try {
PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
return keyFactory.generatePrivate(spec); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error(e.getMessage(),e);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
private static void dfVisit(DMNResource node, List<DMNResource> allNodes, Collection<DMNResource> visited, List<DMNResource> dfv) {
if (visited.contains(node)) {
throw new RuntimeException("Circular dependency detected: " + visited + " , and again to: " + node);
}
visited.add(node);
List<DMNResource> neighbours = node.getDependencies().stream()
.flatMap(dep -> allNodes.stream().filter(r -> r.getModelID().equals(dep)))
.collect(Collectors.toList());
for (DMNResource n : neighbours) {
if (!visited.contains(n)) {
dfVisit(n, allNodes, visited, dfv);
}
}
dfv.add(node);
} } | public class class_name {
private static void dfVisit(DMNResource node, List<DMNResource> allNodes, Collection<DMNResource> visited, List<DMNResource> dfv) {
if (visited.contains(node)) {
throw new RuntimeException("Circular dependency detected: " + visited + " , and again to: " + node);
}
visited.add(node);
List<DMNResource> neighbours = node.getDependencies().stream()
.flatMap(dep -> allNodes.stream().filter(r -> r.getModelID().equals(dep)))
.collect(Collectors.toList());
for (DMNResource n : neighbours) {
if (!visited.contains(n)) {
dfVisit(n, allNodes, visited, dfv); // depends on control dependency: [if], data = [none]
}
}
dfv.add(node);
} } |
public class class_name {
public static ValidationStatus getInfoMsgLevel(final String msg) {
if (msg.startsWith("ERROR")) {
return ValidationStatus.ERROR;
}
if (msg.startsWith("WARN")) {
return ValidationStatus.WARN;
}
return ValidationStatus.PASS;
} } | public class class_name {
public static ValidationStatus getInfoMsgLevel(final String msg) {
if (msg.startsWith("ERROR")) {
return ValidationStatus.ERROR; // depends on control dependency: [if], data = [none]
}
if (msg.startsWith("WARN")) {
return ValidationStatus.WARN; // depends on control dependency: [if], data = [none]
}
return ValidationStatus.PASS;
} } |
public class class_name {
public static String getClassName(String tableName) {
String[] elements = tableName.toLowerCase().split(DATABASE_NAMING_SEPARATOR);
String result = "";
for (int i = 0; i < elements.length; i++) {
elements[i] = elements[i].substring(0, 1).toUpperCase() + elements[i].substring(1, elements[i].length());
result = result + elements[i];
}
return result;
} } | public class class_name {
public static String getClassName(String tableName) {
String[] elements = tableName.toLowerCase().split(DATABASE_NAMING_SEPARATOR);
String result = "";
for (int i = 0; i < elements.length; i++) {
elements[i] = elements[i].substring(0, 1).toUpperCase() + elements[i].substring(1, elements[i].length());
// depends on control dependency: [for], data = [i]
result = result + elements[i];
// depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
public EClass getIfcSpaceHeaterType() {
if (ifcSpaceHeaterTypeEClass == null) {
ifcSpaceHeaterTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(523);
}
return ifcSpaceHeaterTypeEClass;
} } | public class class_name {
public EClass getIfcSpaceHeaterType() {
if (ifcSpaceHeaterTypeEClass == null) {
ifcSpaceHeaterTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(523);
// depends on control dependency: [if], data = [none]
}
return ifcSpaceHeaterTypeEClass;
} } |
public class class_name {
protected void setTargetClass(Class targetClass) {
this.targetClass = targetClass;
this.readAccessors.clear();
this.writeAccessors.clear();
introspectMethods(targetClass, new HashSet());
if (isFieldAccessEnabled()) {
introspectFields(targetClass, new HashSet());
}
} } | public class class_name {
protected void setTargetClass(Class targetClass) {
this.targetClass = targetClass;
this.readAccessors.clear();
this.writeAccessors.clear();
introspectMethods(targetClass, new HashSet());
if (isFieldAccessEnabled()) {
introspectFields(targetClass, new HashSet()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
Point2D getAlignmentCenter() {
if (alignment == SymbolAlignment.Left) {
return element.getFirstGlyphCenter();
} else if (alignment == SymbolAlignment.Right) {
return element.getLastGlyphCenter();
} else {
return element.getCenter();
}
} } | public class class_name {
Point2D getAlignmentCenter() {
if (alignment == SymbolAlignment.Left) {
return element.getFirstGlyphCenter(); // depends on control dependency: [if], data = [none]
} else if (alignment == SymbolAlignment.Right) {
return element.getLastGlyphCenter(); // depends on control dependency: [if], data = [none]
} else {
return element.getCenter(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void buildModulesPackage(List<String> modulesNames) {
System.out.println(System.getProperty("user.dir"));
try {
String baseDir = System.getProperty("user.dir");
List<File> filesArray = new ArrayList<>();
for (String module : modulesNames) {
module = "/"+module.replace(".", "/")+".class";
filesArray.add(new File(baseDir+module));
}
String output = System.getProperty("user.home") + "/modules.jar";
Manifest manifest = new Manifest();
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,
"1.0");
manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_URL,
"http://samoa.yahoo.com");
manifest.getMainAttributes().put(
Attributes.Name.IMPLEMENTATION_VERSION, "0.1");
manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_VENDOR,
"Yahoo");
manifest.getMainAttributes().put(
Attributes.Name.IMPLEMENTATION_VENDOR_ID, "SAMOA");
BufferedOutputStream bo;
bo = new BufferedOutputStream(new FileOutputStream(output));
JarOutputStream jo = new JarOutputStream(bo, manifest);
File[] files = filesArray.toArray(new File[filesArray.size()]);
addEntries(jo,files, baseDir, "");
jo.close();
bo.close();
} catch (IOException e) {
e.printStackTrace();
}
} } | public class class_name {
public static void buildModulesPackage(List<String> modulesNames) {
System.out.println(System.getProperty("user.dir"));
try {
String baseDir = System.getProperty("user.dir");
List<File> filesArray = new ArrayList<>();
for (String module : modulesNames) {
module = "/"+module.replace(".", "/")+".class"; // depends on control dependency: [for], data = [module]
filesArray.add(new File(baseDir+module)); // depends on control dependency: [for], data = [module]
}
String output = System.getProperty("user.home") + "/modules.jar";
Manifest manifest = new Manifest();
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,
"1.0"); // depends on control dependency: [try], data = [none]
manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_URL,
"http://samoa.yahoo.com");
manifest.getMainAttributes().put(
Attributes.Name.IMPLEMENTATION_VERSION, "0.1"); // depends on control dependency: [try], data = [none]
manifest.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_VENDOR,
"Yahoo"); // depends on control dependency: [try], data = [none]
manifest.getMainAttributes().put(
Attributes.Name.IMPLEMENTATION_VENDOR_ID, "SAMOA"); // depends on control dependency: [try], data = [none]
BufferedOutputStream bo;
bo = new BufferedOutputStream(new FileOutputStream(output)); // depends on control dependency: [try], data = [none]
JarOutputStream jo = new JarOutputStream(bo, manifest);
File[] files = filesArray.toArray(new File[filesArray.size()]);
addEntries(jo,files, baseDir, ""); // depends on control dependency: [try], data = [none]
jo.close(); // depends on control dependency: [try], data = [none]
bo.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static RandomVariableInterface blackScholesOptionGamma(
RandomVariableInterface initialStockValue,
RandomVariableInterface riskFreeRate,
RandomVariableInterface volatility,
double optionMaturity,
double optionStrike)
{
if(optionStrike <= 0.0 || optionMaturity <= 0.0)
{
// The Black-Scholes model does not consider it being an option
return initialStockValue.mult(0.0);
}
else
{
// Calculate gamma
RandomVariableInterface dPlus = initialStockValue.div(optionStrike).log().add(volatility.squared().mult(0.5).add(riskFreeRate).mult(optionMaturity)).div(volatility).div(Math.sqrt(optionMaturity));
RandomVariableInterface gamma = dPlus.squared().mult(-0.5).exp().div(initialStockValue.mult(volatility).mult(Math.sqrt(2.0 * Math.PI * optionMaturity)));
return gamma;
}
} } | public class class_name {
public static RandomVariableInterface blackScholesOptionGamma(
RandomVariableInterface initialStockValue,
RandomVariableInterface riskFreeRate,
RandomVariableInterface volatility,
double optionMaturity,
double optionStrike)
{
if(optionStrike <= 0.0 || optionMaturity <= 0.0)
{
// The Black-Scholes model does not consider it being an option
return initialStockValue.mult(0.0); // depends on control dependency: [if], data = [none]
}
else
{
// Calculate gamma
RandomVariableInterface dPlus = initialStockValue.div(optionStrike).log().add(volatility.squared().mult(0.5).add(riskFreeRate).mult(optionMaturity)).div(volatility).div(Math.sqrt(optionMaturity));
RandomVariableInterface gamma = dPlus.squared().mult(-0.5).exp().div(initialStockValue.mult(volatility).mult(Math.sqrt(2.0 * Math.PI * optionMaturity)));
return gamma; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List sendValueMessages(
List msgList,
long completedPrefix,
boolean requestedOnly,
int priority,
Reliability reliability,
SIBUuid12 stream) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendValueMessages",
new Object[] { msgList,
new Long(completedPrefix),
new Boolean(requestedOnly)});
// We will send the messages using MPIO
// Work out the cellule pair needed by the
// messageTransmitter
SIBUuid8[] fromTo = new SIBUuid8[1];
fromTo[0] = _targetMEUuid;
JsMessage jsMsg = null;
TickRange tickRange = null;
MessageItem msgItem = null;
long msgId = -1;
List<TickRange> expiredMsgs = null;
for (int i = 0; i < msgList.size(); i++)
{
tickRange = (TickRange)msgList.get(i);
// Get the messageStore Id from the stream
msgId = tickRange.itemStreamIndex;
// Retrieve the message from the non-persistent ItemStream
msgItem =
_destinationHandler.
getPubSubRealization().
retrieveMessageFromItemStream(msgId);
// If the item wasn't found it has expired
if ( msgItem == null )
{
if ( expiredMsgs == null )
expiredMsgs = new ArrayList<TickRange>();
expiredMsgs.add(tickRange);
// In this case send Silence instead
ControlMessage cMsg = createSilenceMessage(tickRange.valuestamp,
completedPrefix,
priority,
reliability,
stream);
((ControlSilence)cMsg).setRequestedOnly(requestedOnly);
// If the destination in a Link add Link specific properties to message
if( _isLink )
{
cMsg = addLinkProps(cMsg);
cMsg.setRoutingDestination( _routingDestination );
}
// Send the message to the MessageTransmitter
// Send at priority+1 if this is a response to a Nack
if( requestedOnly )
_mpio.sendDownTree(fromTo, priority+1, cMsg);
else
_mpio.sendDownTree(fromTo, priority, cMsg);
}
else
{
try
{
// PM34074
// Retrieve a copy of the message from MessageItem
jsMsg = msgItem.getMessage().getReceived();
}
catch(MessageCopyFailedException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler.sendValueMessages",
"1:960:1.164.1.5",
this);
if (tc.isEntryEnabled())
SibTr.exit(tc, "sendValueMessages", "SIErrorException: "+e);
throw new SIErrorException(e);
}
// Modify the streamId if necessary
if( jsMsg.getGuaranteedStreamUUID() != stream)
{
jsMsg.setGuaranteedStreamUUID(stream);
}
// Are there Completed ticks after this Value
// If so we need to adjust the message to reflect this
if (tickRange.endstamp > tickRange.valuestamp)
{
jsMsg.setGuaranteedValueEndTick(tickRange.endstamp);
}
// Update the completedPrefix to current value
jsMsg.setGuaranteedValueCompletedPrefix(completedPrefix);
// Set the requestedOnly flag
jsMsg.setGuaranteedValueRequestedOnly(requestedOnly);
// If the destination in a Link add Link specific properties to message
if( _isLink )
{
jsMsg = addLinkProps(jsMsg);
jsMsg.setRoutingDestination( _routingDestination );
}
if (TraceComponent.isAnyTracingEnabled() && UserTrace.tc_mt.isDebugEnabled())
{
DestinationHandler dest =
_messageProcessor.getDestinationManager().getDestinationInternal(_destinationHandler.getUuid(), false);
if (dest != null)
UserTrace.traceOutboundSend(jsMsg,
_neighbour.getUUID(),
dest.getName(),
dest.isForeignBus() || dest.isLink(),
dest.isMQLink(),
dest.isTemporary());
else
UserTrace.traceOutboundSend(jsMsg,
_neighbour.getUUID(),
_destinationHandler.getUuid().toString().toString(),
false,
false,
false);
}
// Send the message to the MessageTransmitter
// Send at priority+1 if this is a response to a Nack
if( requestedOnly )
_mpio.sendDownTree(fromTo, priority+1, jsMsg);
else
_mpio.sendDownTree(fromTo, priority, jsMsg);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendValueMessages", expiredMsgs);
return expiredMsgs;
} } | public class class_name {
public List sendValueMessages(
List msgList,
long completedPrefix,
boolean requestedOnly,
int priority,
Reliability reliability,
SIBUuid12 stream) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendValueMessages",
new Object[] { msgList,
new Long(completedPrefix),
new Boolean(requestedOnly)});
// We will send the messages using MPIO
// Work out the cellule pair needed by the
// messageTransmitter
SIBUuid8[] fromTo = new SIBUuid8[1];
fromTo[0] = _targetMEUuid;
JsMessage jsMsg = null;
TickRange tickRange = null;
MessageItem msgItem = null;
long msgId = -1;
List<TickRange> expiredMsgs = null;
for (int i = 0; i < msgList.size(); i++)
{
tickRange = (TickRange)msgList.get(i); // depends on control dependency: [for], data = [i]
// Get the messageStore Id from the stream
msgId = tickRange.itemStreamIndex; // depends on control dependency: [for], data = [none]
// Retrieve the message from the non-persistent ItemStream
msgItem =
_destinationHandler.
getPubSubRealization().
retrieveMessageFromItemStream(msgId); // depends on control dependency: [for], data = [none]
// If the item wasn't found it has expired
if ( msgItem == null )
{
if ( expiredMsgs == null )
expiredMsgs = new ArrayList<TickRange>();
expiredMsgs.add(tickRange); // depends on control dependency: [if], data = [none]
// In this case send Silence instead
ControlMessage cMsg = createSilenceMessage(tickRange.valuestamp,
completedPrefix,
priority,
reliability,
stream);
((ControlSilence)cMsg).setRequestedOnly(requestedOnly); // depends on control dependency: [if], data = [none]
// If the destination in a Link add Link specific properties to message
if( _isLink )
{
cMsg = addLinkProps(cMsg); // depends on control dependency: [if], data = [none]
cMsg.setRoutingDestination( _routingDestination ); // depends on control dependency: [if], data = [none]
}
// Send the message to the MessageTransmitter
// Send at priority+1 if this is a response to a Nack
if( requestedOnly )
_mpio.sendDownTree(fromTo, priority+1, cMsg);
else
_mpio.sendDownTree(fromTo, priority, cMsg);
}
else
{
try
{
// PM34074
// Retrieve a copy of the message from MessageItem
jsMsg = msgItem.getMessage().getReceived(); // depends on control dependency: [try], data = [none]
}
catch(MessageCopyFailedException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.PubSubOutputHandler.sendValueMessages",
"1:960:1.164.1.5",
this);
if (tc.isEntryEnabled())
SibTr.exit(tc, "sendValueMessages", "SIErrorException: "+e);
throw new SIErrorException(e);
} // depends on control dependency: [catch], data = [none]
// Modify the streamId if necessary
if( jsMsg.getGuaranteedStreamUUID() != stream)
{
jsMsg.setGuaranteedStreamUUID(stream); // depends on control dependency: [if], data = [stream)]
}
// Are there Completed ticks after this Value
// If so we need to adjust the message to reflect this
if (tickRange.endstamp > tickRange.valuestamp)
{
jsMsg.setGuaranteedValueEndTick(tickRange.endstamp); // depends on control dependency: [if], data = [(tickRange.endstamp]
}
// Update the completedPrefix to current value
jsMsg.setGuaranteedValueCompletedPrefix(completedPrefix); // depends on control dependency: [if], data = [none]
// Set the requestedOnly flag
jsMsg.setGuaranteedValueRequestedOnly(requestedOnly); // depends on control dependency: [if], data = [none]
// If the destination in a Link add Link specific properties to message
if( _isLink )
{
jsMsg = addLinkProps(jsMsg); // depends on control dependency: [if], data = [none]
jsMsg.setRoutingDestination( _routingDestination ); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && UserTrace.tc_mt.isDebugEnabled())
{
DestinationHandler dest =
_messageProcessor.getDestinationManager().getDestinationInternal(_destinationHandler.getUuid(), false);
if (dest != null)
UserTrace.traceOutboundSend(jsMsg,
_neighbour.getUUID(),
dest.getName(),
dest.isForeignBus() || dest.isLink(),
dest.isMQLink(),
dest.isTemporary());
else
UserTrace.traceOutboundSend(jsMsg,
_neighbour.getUUID(),
_destinationHandler.getUuid().toString().toString(),
false,
false,
false);
}
// Send the message to the MessageTransmitter
// Send at priority+1 if this is a response to a Nack
if( requestedOnly )
_mpio.sendDownTree(fromTo, priority+1, jsMsg);
else
_mpio.sendDownTree(fromTo, priority, jsMsg);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendValueMessages", expiredMsgs);
return expiredMsgs;
} } |
public class class_name {
private static String valueString(Object value, Schema schema) {
if (value == null || schema.getType() == Schema.Type.NULL) {
return null;
}
switch (schema.getType()) {
case BOOLEAN:
case FLOAT:
case DOUBLE:
case INT:
case LONG:
case STRING:
return value.toString();
case ENUM:
// serialize as the ordinal from the schema
return String.valueOf(schema.getEnumOrdinal(value.toString()));
case UNION:
int index = ReflectData.get().resolveUnion(schema, value);
return valueString(value, schema.getTypes().get(index));
default:
// FIXED, BYTES, MAP, ARRAY, RECORD are not supported
throw new DatasetOperationException(
"Unsupported field type:" + schema.getType());
}
} } | public class class_name {
private static String valueString(Object value, Schema schema) {
if (value == null || schema.getType() == Schema.Type.NULL) {
return null; // depends on control dependency: [if], data = [none]
}
switch (schema.getType()) {
case BOOLEAN:
case FLOAT:
case DOUBLE:
case INT:
case LONG:
case STRING:
return value.toString();
case ENUM:
// serialize as the ordinal from the schema
return String.valueOf(schema.getEnumOrdinal(value.toString()));
case UNION:
int index = ReflectData.get().resolveUnion(schema, value);
return valueString(value, schema.getTypes().get(index));
default:
// FIXED, BYTES, MAP, ARRAY, RECORD are not supported
throw new DatasetOperationException(
"Unsupported field type:" + schema.getType());
}
} } |
public class class_name {
public static Object decode(final String attributeName,
final byte[] encodedBytes) {
@SuppressWarnings("rawtypes")
TypeConverter converter = DataConverter.attributeConverters
.get(attributeName);
if (converter == null) {
log.warn(
"Unable to find a suitable data converter for attribute {}.",
attributeName);
throw new IllegalArgumentException(
"Unable to find a suitable data converter for attribute \""
+ attributeName + "\".");
}
return converter.decode(encodedBytes);
} } | public class class_name {
public static Object decode(final String attributeName,
final byte[] encodedBytes) {
@SuppressWarnings("rawtypes")
TypeConverter converter = DataConverter.attributeConverters
.get(attributeName);
if (converter == null) {
log.warn(
"Unable to find a suitable data converter for attribute {}.",
attributeName); // depends on control dependency: [if], data = [none]
throw new IllegalArgumentException(
"Unable to find a suitable data converter for attribute \""
+ attributeName + "\".");
}
return converter.decode(encodedBytes);
} } |
public class class_name {
private void registerSessionListener() {
ISessionLifecycle sessionTracker = new ISessionLifecycle() {
@Override
public void onSessionCreate(Session session) {
try {
AppContextFinder.createAppContext(session.getPage());
} catch (Exception e) {
throw new SessionInitException(e);
}
}
@Override
public void onSessionDestroy(Session session) {
AppContextFinder.destroyAppContext(session.getPage());
}
};
Sessions.getInstance().addLifecycleListener(sessionTracker);
} } | public class class_name {
private void registerSessionListener() {
ISessionLifecycle sessionTracker = new ISessionLifecycle() {
@Override
public void onSessionCreate(Session session) {
try {
AppContextFinder.createAppContext(session.getPage()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SessionInitException(e);
} // depends on control dependency: [catch], data = [none]
}
@Override
public void onSessionDestroy(Session session) {
AppContextFinder.destroyAppContext(session.getPage());
}
};
Sessions.getInstance().addLifecycleListener(sessionTracker);
} } |
public class class_name {
private void initDelegate() {
boolean powerSaveMode = Utils.isPowerSaveModeEnabled(mPowerManager);
if (powerSaveMode) {
if (mPBDelegate == null || !(mPBDelegate instanceof PowerSaveModeDelegate)) {
if (mPBDelegate != null) mPBDelegate.stop();
mPBDelegate = new PowerSaveModeDelegate(this);
}
} else {
if (mPBDelegate == null || (mPBDelegate instanceof PowerSaveModeDelegate)) {
if (mPBDelegate != null) mPBDelegate.stop();
mPBDelegate = new DefaultDelegate(this, mOptions);
}
}
} } | public class class_name {
private void initDelegate() {
boolean powerSaveMode = Utils.isPowerSaveModeEnabled(mPowerManager);
if (powerSaveMode) {
if (mPBDelegate == null || !(mPBDelegate instanceof PowerSaveModeDelegate)) {
if (mPBDelegate != null) mPBDelegate.stop();
mPBDelegate = new PowerSaveModeDelegate(this); // depends on control dependency: [if], data = [none]
}
} else {
if (mPBDelegate == null || (mPBDelegate instanceof PowerSaveModeDelegate)) {
if (mPBDelegate != null) mPBDelegate.stop();
mPBDelegate = new DefaultDelegate(this, mOptions); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private static void destroy(boolean active) {
// TODO 检查是否有其它需要释放的资源
RpcRunningState.setShuttingDown(true);
for (Destroyable.DestroyHook destroyHook : DESTROY_HOOKS) {
destroyHook.preDestroy();
}
List<ProviderConfig> providerConfigs = new ArrayList<ProviderConfig>();
for (ProviderBootstrap bootstrap : EXPORTED_PROVIDER_CONFIGS) {
providerConfigs.add(bootstrap.getProviderConfig());
}
// 先反注册服务端
List<Registry> registries = RegistryFactory.getRegistries();
if (CommonUtils.isNotEmpty(registries) && CommonUtils.isNotEmpty(providerConfigs)) {
for (Registry registry : registries) {
registry.batchUnRegister(providerConfigs);
}
}
// 关闭启动的端口
ServerFactory.destroyAll();
// 关闭发布的服务
for (ProviderBootstrap bootstrap : EXPORTED_PROVIDER_CONFIGS) {
bootstrap.unExport();
}
// 关闭调用的服务
for (ConsumerBootstrap bootstrap : REFERRED_CONSUMER_CONFIGS) {
ConsumerConfig config = bootstrap.getConsumerConfig();
if (!CommonUtils.isFalse(config.getParameter(RpcConstants.HIDDEN_KEY_DESTROY))) { // 除非不让主动unrefer
bootstrap.unRefer();
}
}
// 关闭注册中心
RegistryFactory.destroyAll();
// 关闭客户端的一些公共资源
ClientTransportFactory.closeAll();
// 卸载模块
if (!RpcRunningState.isUnitTestMode()) {
ModuleFactory.uninstallModules();
}
// 卸载钩子
for (Destroyable.DestroyHook destroyHook : DESTROY_HOOKS) {
destroyHook.postDestroy();
}
// 清理缓存
RpcCacheManager.clearAll();
RpcRunningState.setShuttingDown(false);
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("SOFA RPC Framework has been release all resources {}...",
active ? "actively " : "");
}
} } | public class class_name {
private static void destroy(boolean active) {
// TODO 检查是否有其它需要释放的资源
RpcRunningState.setShuttingDown(true);
for (Destroyable.DestroyHook destroyHook : DESTROY_HOOKS) {
destroyHook.preDestroy(); // depends on control dependency: [for], data = [destroyHook]
}
List<ProviderConfig> providerConfigs = new ArrayList<ProviderConfig>();
for (ProviderBootstrap bootstrap : EXPORTED_PROVIDER_CONFIGS) {
providerConfigs.add(bootstrap.getProviderConfig()); // depends on control dependency: [for], data = [bootstrap]
}
// 先反注册服务端
List<Registry> registries = RegistryFactory.getRegistries();
if (CommonUtils.isNotEmpty(registries) && CommonUtils.isNotEmpty(providerConfigs)) {
for (Registry registry : registries) {
registry.batchUnRegister(providerConfigs); // depends on control dependency: [for], data = [registry]
}
}
// 关闭启动的端口
ServerFactory.destroyAll();
// 关闭发布的服务
for (ProviderBootstrap bootstrap : EXPORTED_PROVIDER_CONFIGS) {
bootstrap.unExport(); // depends on control dependency: [for], data = [bootstrap]
}
// 关闭调用的服务
for (ConsumerBootstrap bootstrap : REFERRED_CONSUMER_CONFIGS) {
ConsumerConfig config = bootstrap.getConsumerConfig();
if (!CommonUtils.isFalse(config.getParameter(RpcConstants.HIDDEN_KEY_DESTROY))) { // 除非不让主动unrefer
bootstrap.unRefer(); // depends on control dependency: [if], data = [none]
}
}
// 关闭注册中心
RegistryFactory.destroyAll();
// 关闭客户端的一些公共资源
ClientTransportFactory.closeAll();
// 卸载模块
if (!RpcRunningState.isUnitTestMode()) {
ModuleFactory.uninstallModules(); // depends on control dependency: [if], data = [none]
}
// 卸载钩子
for (Destroyable.DestroyHook destroyHook : DESTROY_HOOKS) {
destroyHook.postDestroy(); // depends on control dependency: [for], data = [destroyHook]
}
// 清理缓存
RpcCacheManager.clearAll();
RpcRunningState.setShuttingDown(false);
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("SOFA RPC Framework has been release all resources {}...",
active ? "actively " : ""); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final void setHeaderColorStyle(HeaderColorStyle headerColorStyle) {
this.headerColorStyle = headerColorStyle;
if (!headerColorStyle.getColorStyle().isEmpty()) {
this.getHeaderLabel().setStyle(headerColorStyle.getColorStyle());
// It's either DEFAULT or CUSTOM value (all empty values)
// If it is DEFAULT, it sets the default style color
// Otherwise if it is CUSTOM, by default no style is applied
// (default css "generic" color is in play), user has
// to manually set it via setCustomHeaderColorStyle(String colorStyle)
} else {
if (headerColorStyle == HeaderColorStyle.DEFAULT) {
switch (this.dialogType) {
case INFORMATION:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_INFO);
break;
case ERROR:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_ERROR);
break;
case WARNING:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_WARNING);
break;
case CONFIRMATION:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_CONFIRM);
break;
case CONFIRMATION_ALT1:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_CONFIRM);
break;
case CONFIRMATION_ALT2:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_CONFIRM);
break;
case EXCEPTION:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_EXCEPTION);
break;
case INPUT_TEXT:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_INPUT);
break;
default:
this.updateHeaderColorStyle(HeaderColorStyle.GENERIC);
break;
}
}
}
} } | public class class_name {
public final void setHeaderColorStyle(HeaderColorStyle headerColorStyle) {
this.headerColorStyle = headerColorStyle;
if (!headerColorStyle.getColorStyle().isEmpty()) {
this.getHeaderLabel().setStyle(headerColorStyle.getColorStyle()); // depends on control dependency: [if], data = [none]
// It's either DEFAULT or CUSTOM value (all empty values)
// If it is DEFAULT, it sets the default style color
// Otherwise if it is CUSTOM, by default no style is applied
// (default css "generic" color is in play), user has
// to manually set it via setCustomHeaderColorStyle(String colorStyle)
} else {
if (headerColorStyle == HeaderColorStyle.DEFAULT) {
switch (this.dialogType) {
case INFORMATION:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_INFO);
break;
case ERROR:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_ERROR);
break;
case WARNING:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_WARNING);
break;
case CONFIRMATION:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_CONFIRM);
break;
case CONFIRMATION_ALT1:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_CONFIRM);
break;
case CONFIRMATION_ALT2:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_CONFIRM);
break;
case EXCEPTION:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_EXCEPTION);
break;
case INPUT_TEXT:
this.updateHeaderColorStyle(HeaderColorStyle.GLOSS_INPUT);
break;
default:
this.updateHeaderColorStyle(HeaderColorStyle.GENERIC);
break;
}
}
}
} } |
public class class_name {
@Deprecated
public static byte[] getContentFromUrl(String url, Map inCookies, Map outCookies, Proxy proxy, boolean allowAllCerts)
{
try
{
return getContentFromUrl(getActualUrl(url), inCookies, outCookies, proxy, allowAllCerts);
} catch (MalformedURLException e) {
LOG.warn("Exception occurred fetching content from url: " + url, e);
return null;
}
} } | public class class_name {
@Deprecated
public static byte[] getContentFromUrl(String url, Map inCookies, Map outCookies, Proxy proxy, boolean allowAllCerts)
{
try
{
return getContentFromUrl(getActualUrl(url), inCookies, outCookies, proxy, allowAllCerts); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
LOG.warn("Exception occurred fetching content from url: " + url, e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <T> String join(T[] array, CharSequence conjunction, String prefix, String suffix) {
if (null == array) {
return null;
}
final StringBuilder sb = new StringBuilder();
boolean isFirst = true;
for (T item : array) {
if (isFirst) {
isFirst = false;
} else {
sb.append(conjunction);
}
if (ArrayUtil.isArray(item)) {
sb.append(join(ArrayUtil.wrap(item), conjunction, prefix, suffix));
} else if (item instanceof Iterable<?>) {
sb.append(IterUtil.join((Iterable<?>) item, conjunction, prefix, suffix));
} else if (item instanceof Iterator<?>) {
sb.append(IterUtil.join((Iterator<?>) item, conjunction, prefix, suffix));
} else {
sb.append(StrUtil.wrap(StrUtil.toString(item), prefix, suffix));
}
}
return sb.toString();
} } | public class class_name {
public static <T> String join(T[] array, CharSequence conjunction, String prefix, String suffix) {
if (null == array) {
return null;
// depends on control dependency: [if], data = [none]
}
final StringBuilder sb = new StringBuilder();
boolean isFirst = true;
for (T item : array) {
if (isFirst) {
isFirst = false;
// depends on control dependency: [if], data = [none]
} else {
sb.append(conjunction);
// depends on control dependency: [if], data = [none]
}
if (ArrayUtil.isArray(item)) {
sb.append(join(ArrayUtil.wrap(item), conjunction, prefix, suffix));
// depends on control dependency: [if], data = [none]
} else if (item instanceof Iterable<?>) {
sb.append(IterUtil.join((Iterable<?>) item, conjunction, prefix, suffix));
// depends on control dependency: [if], data = [)]
} else if (item instanceof Iterator<?>) {
sb.append(IterUtil.join((Iterator<?>) item, conjunction, prefix, suffix));
// depends on control dependency: [if], data = [)]
} else {
sb.append(StrUtil.wrap(StrUtil.toString(item), prefix, suffix));
// depends on control dependency: [if], data = [)]
}
}
return sb.toString();
} } |
public class class_name {
@Override
public Page createPage()
{
Page ret = null;
try {
final String instKey = this.uiObject.getInstance() == null ? null : this.uiObject.getInstance().getKey();
if (this.uiObject.getCommand().getTargetTable() == null) {
final UIForm uiform = new UIForm(this.uiObject.getCommand().getUUID(), instKey)
.setPagePosition(this.pagePosition);
uiform.setPicker(this.uiObject);
if (!uiform.isInitialized()) {
uiform.execute();
}
if (uiform.getElements().isEmpty()) {
ret = new DialogPage(this.modalWindow.getPage().getPageReference(),
uiform.getCommand().getName() + ".InvalidInstance", false, false);
} else {
if (this.uiObject.getCommand().isSubmit()) {
final IRequestParameters parameters = RequestCycle.get().getRequest().getRequestParameters();
uiform.setSelected(parameters.getParameterValues("selectedRow"));
}
ret = new FormPage(Model.of(uiform), this.modalWindow, this.modalWindow.getPage()
.getPageReference());
}
} else {
if (this.uiObject.getCommand().getTargetStructurBrowserField() == null) {
final UITable uitable = new UITable(this.uiObject.getCommand().getUUID(), instKey)
.setPagePosition(this.pagePosition);
uitable.setPicker(this.uiObject);
ret = new TablePage(Model.of(uitable), this.modalWindow, this.modalWindow.getPage()
.getPageReference());
} else {
final UIStructurBrowser uiPageObject = new UIStructurBrowser(this.uiObject.getCommand().getUUID(),
instKey);
uiPageObject.setPicker(this.uiObject);
ret = new StructurBrowserPage(Model.of(uiPageObject), this.modalWindow,
this.modalWindow.getPage().getPageReference());
}
}
} catch (final EFapsException e) {
ret = new ErrorPage(e);
}
return ret;
} } | public class class_name {
@Override
public Page createPage()
{
Page ret = null;
try {
final String instKey = this.uiObject.getInstance() == null ? null : this.uiObject.getInstance().getKey();
if (this.uiObject.getCommand().getTargetTable() == null) {
final UIForm uiform = new UIForm(this.uiObject.getCommand().getUUID(), instKey)
.setPagePosition(this.pagePosition);
uiform.setPicker(this.uiObject); // depends on control dependency: [if], data = [none]
if (!uiform.isInitialized()) {
uiform.execute(); // depends on control dependency: [if], data = [none]
}
if (uiform.getElements().isEmpty()) {
ret = new DialogPage(this.modalWindow.getPage().getPageReference(),
uiform.getCommand().getName() + ".InvalidInstance", false, false); // depends on control dependency: [if], data = [none]
} else {
if (this.uiObject.getCommand().isSubmit()) {
final IRequestParameters parameters = RequestCycle.get().getRequest().getRequestParameters();
uiform.setSelected(parameters.getParameterValues("selectedRow")); // depends on control dependency: [if], data = [none]
}
ret = new FormPage(Model.of(uiform), this.modalWindow, this.modalWindow.getPage()
.getPageReference()); // depends on control dependency: [if], data = [none]
}
} else {
if (this.uiObject.getCommand().getTargetStructurBrowserField() == null) {
final UITable uitable = new UITable(this.uiObject.getCommand().getUUID(), instKey)
.setPagePosition(this.pagePosition);
uitable.setPicker(this.uiObject); // depends on control dependency: [if], data = [none]
ret = new TablePage(Model.of(uitable), this.modalWindow, this.modalWindow.getPage()
.getPageReference()); // depends on control dependency: [if], data = [none]
} else {
final UIStructurBrowser uiPageObject = new UIStructurBrowser(this.uiObject.getCommand().getUUID(),
instKey);
uiPageObject.setPicker(this.uiObject); // depends on control dependency: [if], data = [none]
ret = new StructurBrowserPage(Model.of(uiPageObject), this.modalWindow,
this.modalWindow.getPage().getPageReference()); // depends on control dependency: [if], data = [none]
}
}
} catch (final EFapsException e) {
ret = new ErrorPage(e);
} // depends on control dependency: [catch], data = [none]
return ret;
} } |
public class class_name {
protected String sendRequestToDF(String df_service, Object msgContent) {
IDFComponentDescription[] receivers = getReceivers(df_service);
if (receivers.length > 0) {
IMessageEvent mevent = createMessageEvent("send_request");
mevent.getParameter(SFipa.CONTENT).setValue(msgContent);
for (int i = 0; i < receivers.length; i++) {
mevent.getParameterSet(SFipa.RECEIVERS).addValue(
receivers[i].getName());
logger.info("The receiver is " + receivers[i].getName());
}
sendMessage(mevent);
}
logger.info("Message sended to " + df_service + " to "
+ receivers.length + " receivers");
return ("Message sended to " + df_service);
} } | public class class_name {
protected String sendRequestToDF(String df_service, Object msgContent) {
IDFComponentDescription[] receivers = getReceivers(df_service);
if (receivers.length > 0) {
IMessageEvent mevent = createMessageEvent("send_request");
mevent.getParameter(SFipa.CONTENT).setValue(msgContent); // depends on control dependency: [if], data = [none]
for (int i = 0; i < receivers.length; i++) {
mevent.getParameterSet(SFipa.RECEIVERS).addValue(
receivers[i].getName()); // depends on control dependency: [for], data = [none]
logger.info("The receiver is " + receivers[i].getName()); // depends on control dependency: [for], data = [i]
}
sendMessage(mevent); // depends on control dependency: [if], data = [none]
}
logger.info("Message sended to " + df_service + " to "
+ receivers.length + " receivers");
return ("Message sended to " + df_service);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.