code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private Document parseContents(Text node, Element domElement) throws UnmarshallingException {
String textContent = node.getWholeText() != null ? node.getWholeText().trim() : null;
if (textContent == null || textContent.isEmpty()) {
log.error("Expected Base64 encoded address elements");
return null;
}
// First Base64-decode the contents ...
//
byte[] bytes = Base64.decode(textContent);
String addressElements = new String(bytes);
// Then build a fake XML document holding the contents in element form.
//
// The elements represented in 'addressElements' may have a namespace prefix
// so we find out if we need to include that in the XML definition.
Map<String, String> bindings = getNamespaceBindings(domElement);
StringBuilder sb = new StringBuilder();
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
sb.append("<" + domElement.getNodeName());
for (Map.Entry<String, String> entry : bindings.entrySet()) {
sb.append(" " + entry.getKey() + "=\"" + entry.getValue() + "\"");
}
sb.append('>');
sb.append(addressElements);
sb.append("</" + domElement.getNodeName() + ">");
// Parse into an XML document.
//
try {
Document doc = Configuration.getParserPool().parse(new ByteArrayInputStream(sb.toString().getBytes("UTF-8")));
// Copy the input dom element and replace its child node with our new nodes.
//
Document newDoc = Configuration.getParserPool().newDocument();
Element newDom = (Element) domElement.cloneNode(true);
for (Map.Entry<String, String> entry : bindings.entrySet()) {
newDom.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, entry.getKey(), entry.getValue());
}
newDoc.adoptNode(newDom);
for (Node child; (child = newDom.getFirstChild()) != null; newDom.removeChild(child))
;
Node newChild = doc.getDocumentElement().getFirstChild();
while (newChild != null) {
Node importedChild = newDoc.importNode(newChild, true);
newDom.appendChild(importedChild);
newChild = newChild.getNextSibling();
}
newDoc.appendChild(newDom);
return newDoc;
}
catch (IOException | XMLParserException e) {
throw new UnmarshallingException(e);
}
} } | public class class_name {
private Document parseContents(Text node, Element domElement) throws UnmarshallingException {
String textContent = node.getWholeText() != null ? node.getWholeText().trim() : null;
if (textContent == null || textContent.isEmpty()) {
log.error("Expected Base64 encoded address elements");
return null;
}
// First Base64-decode the contents ...
//
byte[] bytes = Base64.decode(textContent);
String addressElements = new String(bytes);
// Then build a fake XML document holding the contents in element form.
//
// The elements represented in 'addressElements' may have a namespace prefix
// so we find out if we need to include that in the XML definition.
Map<String, String> bindings = getNamespaceBindings(domElement);
StringBuilder sb = new StringBuilder();
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
sb.append("<" + domElement.getNodeName());
for (Map.Entry<String, String> entry : bindings.entrySet()) {
sb.append(" " + entry.getKey() + "=\"" + entry.getValue() + "\"");
}
sb.append('>');
sb.append(addressElements);
sb.append("</" + domElement.getNodeName() + ">");
// Parse into an XML document.
//
try {
Document doc = Configuration.getParserPool().parse(new ByteArrayInputStream(sb.toString().getBytes("UTF-8")));
// Copy the input dom element and replace its child node with our new nodes.
//
Document newDoc = Configuration.getParserPool().newDocument();
Element newDom = (Element) domElement.cloneNode(true);
for (Map.Entry<String, String> entry : bindings.entrySet()) {
newDom.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
newDoc.adoptNode(newDom);
for (Node child; (child = newDom.getFirstChild()) != null; newDom.removeChild(child))
;
Node newChild = doc.getDocumentElement().getFirstChild();
while (newChild != null) {
Node importedChild = newDoc.importNode(newChild, true);
newDom.appendChild(importedChild); // depends on control dependency: [while], data = [none]
newChild = newChild.getNextSibling(); // depends on control dependency: [while], data = [none]
}
newDoc.appendChild(newDom);
return newDoc;
}
catch (IOException | XMLParserException e) {
throw new UnmarshallingException(e);
}
} } |
public class class_name {
protected DataType parseBitStringType( DdlTokenStream tokens ) throws ParsingException {
DataType dataType = null;
String typeName = null;
if (tokens.matches(DataTypes.DTYPE_BIT_VARYING)) {
typeName = getStatementTypeName(DataTypes.DTYPE_BIT_VARYING);
dataType = new DataType(typeName);
consume(tokens, dataType, false, DataTypes.DTYPE_BIT_VARYING);
long length = parseBracketedLong(tokens, dataType);
dataType.setLength(length);
} else if (tokens.matches(DataTypes.DTYPE_BIT)) {
typeName = getStatementTypeName(DataTypes.DTYPE_BIT);
dataType = new DataType(typeName);
consume(tokens, dataType, false, DataTypes.DTYPE_BIT);
long length = getDefaultLength();
if (tokens.matches(L_PAREN)) {
length = parseBracketedLong(tokens, dataType);
}
dataType.setLength(length);
}
return dataType;
} } | public class class_name {
protected DataType parseBitStringType( DdlTokenStream tokens ) throws ParsingException {
DataType dataType = null;
String typeName = null;
if (tokens.matches(DataTypes.DTYPE_BIT_VARYING)) {
typeName = getStatementTypeName(DataTypes.DTYPE_BIT_VARYING);
dataType = new DataType(typeName);
consume(tokens, dataType, false, DataTypes.DTYPE_BIT_VARYING);
long length = parseBracketedLong(tokens, dataType);
dataType.setLength(length);
} else if (tokens.matches(DataTypes.DTYPE_BIT)) {
typeName = getStatementTypeName(DataTypes.DTYPE_BIT);
dataType = new DataType(typeName);
consume(tokens, dataType, false, DataTypes.DTYPE_BIT);
long length = getDefaultLength();
if (tokens.matches(L_PAREN)) {
length = parseBracketedLong(tokens, dataType); // depends on control dependency: [if], data = [none]
}
dataType.setLength(length);
}
return dataType;
} } |
public class class_name {
public boolean isAssignableFrom( IType type )
{
if( type == this )
{
return true;
}
if( type instanceof ICompoundType )
{
for( IType t: ((ICompoundType)type).getTypes() )
{
if( isAssignableFrom( t ) )
{
return true;
}
}
return false;
}
if( !(type instanceof TypeVariableType) )
{
return false;
}
if( !getRelativeName().equals( type.getRelativeName() ) )
{
return false;
}
IType thatEncType = type.getEnclosingType();
IType thisEncType = getEnclosingType();
return thatEncType == thisEncType ||
functionTypesEqual( thisEncType, thatEncType ) ||
thatEncType instanceof IGosuClassInternal &&
((IGosuClassInternal)thatEncType).isProxy() &&
thisEncType == ((IGosuClassInternal)thatEncType).getJavaType();
} } | public class class_name {
public boolean isAssignableFrom( IType type )
{
if( type == this )
{
return true; // depends on control dependency: [if], data = [none]
}
if( type instanceof ICompoundType )
{
for( IType t: ((ICompoundType)type).getTypes() )
{
if( isAssignableFrom( t ) )
{
return true; // depends on control dependency: [if], data = [none]
}
}
return false; // depends on control dependency: [if], data = [none]
}
if( !(type instanceof TypeVariableType) )
{
return false; // depends on control dependency: [if], data = [none]
}
if( !getRelativeName().equals( type.getRelativeName() ) )
{
return false; // depends on control dependency: [if], data = [none]
}
IType thatEncType = type.getEnclosingType();
IType thisEncType = getEnclosingType();
return thatEncType == thisEncType ||
functionTypesEqual( thisEncType, thatEncType ) ||
thatEncType instanceof IGosuClassInternal &&
((IGosuClassInternal)thatEncType).isProxy() &&
thisEncType == ((IGosuClassInternal)thatEncType).getJavaType();
} } |
public class class_name {
public String[] getStringsWithDefault(String key, String[] defaultValue) {
String[] value = getStrings(key, null);
if (null == value) {
value = defaultValue;
}
return value;
} } | public class class_name {
public String[] getStringsWithDefault(String key, String[] defaultValue) {
String[] value = getStrings(key, null);
if (null == value) {
value = defaultValue;
// depends on control dependency: [if], data = [none]
}
return value;
} } |
public class class_name {
public AddResult<L> addResource(Resource<L> newResource) throws IllegalArgumentException {
AddResult<L> result;
graphLockWrite.lock();
try {
// Need to make sure we keep our resources consistent. If the newResource has a parent,
// and that parent is not the same instance we have in our graph, we need to recreate the
// newResource such that it refers to our instance of the parent.
// Do this BEFORE we attempt to add the new resource to the graph.
if (newResource.getParent() != null) {
Resource<L> parentInGraph = getResource(newResource.getParent().getID());
if (parentInGraph == null) {
throw new IllegalArgumentException(
String.format("The new resource [%s] has a parent [%s] that has not been added yet",
newResource, newResource.getParent()));
}
// if parents are not the same instance, create a new resource with the parent we have in the graph
if (parentInGraph != newResource.getParent()) {
newResource = Resource.<L> builder(newResource).parent(parentInGraph).build();
}
}
boolean added = this.resourcesGraph.addVertex(newResource);
if (!added) {
// Looks like this resource already exists.
// If the resource changed, we want to replace it but keep all edges intact.
// If the resource did not change, we don't do anything.
Resource<L> oldResource = getResource(newResource.getID());
if (new ResourceComparator().compare(oldResource, newResource) != 0) {
Set<Resource<L>> children = getChildren(oldResource);
this.resourcesGraph.removeVertex(oldResource); // removes all edges! remember to put parent back
this.resourcesGraph.addVertex(newResource);
for (Resource<L> child : children) {
ResourceManager.this.resourcesGraph.addEdge(newResource, child);
}
result = new AddResult<>(AddResult.Effect.MODIFIED, newResource);
} else {
result = new AddResult<>(AddResult.Effect.UNCHANGED, oldResource);
}
} else {
result = new AddResult<>(AddResult.Effect.ADDED, newResource);
}
if ((result.getEffect() != AddResult.Effect.UNCHANGED) && (newResource.getParent() != null)) {
this.resourcesGraph.addEdge(newResource.getParent(), newResource);
}
return result;
} finally {
graphLockWrite.unlock();
}
} } | public class class_name {
public AddResult<L> addResource(Resource<L> newResource) throws IllegalArgumentException {
AddResult<L> result;
graphLockWrite.lock();
try {
// Need to make sure we keep our resources consistent. If the newResource has a parent,
// and that parent is not the same instance we have in our graph, we need to recreate the
// newResource such that it refers to our instance of the parent.
// Do this BEFORE we attempt to add the new resource to the graph.
if (newResource.getParent() != null) {
Resource<L> parentInGraph = getResource(newResource.getParent().getID());
if (parentInGraph == null) {
throw new IllegalArgumentException(
String.format("The new resource [%s] has a parent [%s] that has not been added yet",
newResource, newResource.getParent()));
}
// if parents are not the same instance, create a new resource with the parent we have in the graph
if (parentInGraph != newResource.getParent()) {
newResource = Resource.<L> builder(newResource).parent(parentInGraph).build(); // depends on control dependency: [if], data = [(parentInGraph]
}
}
boolean added = this.resourcesGraph.addVertex(newResource);
if (!added) {
// Looks like this resource already exists.
// If the resource changed, we want to replace it but keep all edges intact.
// If the resource did not change, we don't do anything.
Resource<L> oldResource = getResource(newResource.getID());
if (new ResourceComparator().compare(oldResource, newResource) != 0) {
Set<Resource<L>> children = getChildren(oldResource);
this.resourcesGraph.removeVertex(oldResource); // removes all edges! remember to put parent back // depends on control dependency: [if], data = [none]
this.resourcesGraph.addVertex(newResource); // depends on control dependency: [if], data = [none]
for (Resource<L> child : children) {
ResourceManager.this.resourcesGraph.addEdge(newResource, child); // depends on control dependency: [for], data = [child]
}
result = new AddResult<>(AddResult.Effect.MODIFIED, newResource); // depends on control dependency: [if], data = [none]
} else {
result = new AddResult<>(AddResult.Effect.UNCHANGED, oldResource); // depends on control dependency: [if], data = [none]
}
} else {
result = new AddResult<>(AddResult.Effect.ADDED, newResource); // depends on control dependency: [if], data = [none]
}
if ((result.getEffect() != AddResult.Effect.UNCHANGED) && (newResource.getParent() != null)) {
this.resourcesGraph.addEdge(newResource.getParent(), newResource); // depends on control dependency: [if], data = [none]
}
return result;
} finally {
graphLockWrite.unlock();
}
} } |
public class class_name {
protected Processor getProcessor() {
if (isReference()) {
return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getProcessor();
}
//
// if a processor has not been explicitly set
// then may be set by an extended definition
if (this.processor == null) {
final ProcessorDef extendsDef = getExtends();
if (extendsDef != null) {
return extendsDef.getProcessor();
}
}
return this.processor;
} } | public class class_name {
protected Processor getProcessor() {
if (isReference()) {
return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getProcessor(); // depends on control dependency: [if], data = [none]
}
//
// if a processor has not been explicitly set
// then may be set by an extended definition
if (this.processor == null) {
final ProcessorDef extendsDef = getExtends();
if (extendsDef != null) {
return extendsDef.getProcessor(); // depends on control dependency: [if], data = [none]
}
}
return this.processor;
} } |
public class class_name {
public void marshall(DeregisterTaskFromMaintenanceWindowRequest deregisterTaskFromMaintenanceWindowRequest, ProtocolMarshaller protocolMarshaller) {
if (deregisterTaskFromMaintenanceWindowRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deregisterTaskFromMaintenanceWindowRequest.getWindowId(), WINDOWID_BINDING);
protocolMarshaller.marshall(deregisterTaskFromMaintenanceWindowRequest.getWindowTaskId(), WINDOWTASKID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeregisterTaskFromMaintenanceWindowRequest deregisterTaskFromMaintenanceWindowRequest, ProtocolMarshaller protocolMarshaller) {
if (deregisterTaskFromMaintenanceWindowRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deregisterTaskFromMaintenanceWindowRequest.getWindowId(), WINDOWID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deregisterTaskFromMaintenanceWindowRequest.getWindowTaskId(), WINDOWTASKID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public boolean has(int index, Scriptable start)
{
if (arg(index) != NOT_FOUND) {
return true;
}
return super.has(index, start);
} } | public class class_name {
@Override
public boolean has(int index, Scriptable start)
{
if (arg(index) != NOT_FOUND) {
return true; // depends on control dependency: [if], data = [none]
}
return super.has(index, start);
} } |
public class class_name {
public static void cursorIntToContentValuesIfPresent(Cursor cursor, ContentValues values,
String column) {
final int index = cursor.getColumnIndex(column);
if (index != -1 && !cursor.isNull(index)) {
values.put(column, cursor.getInt(index));
}
} } | public class class_name {
public static void cursorIntToContentValuesIfPresent(Cursor cursor, ContentValues values,
String column) {
final int index = cursor.getColumnIndex(column);
if (index != -1 && !cursor.isNull(index)) {
values.put(column, cursor.getInt(index)); // depends on control dependency: [if], data = [(index]
}
} } |
public class class_name {
public EEnum getIfcRampFlightTypeEnum() {
if (ifcRampFlightTypeEnumEEnum == null) {
ifcRampFlightTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(881);
}
return ifcRampFlightTypeEnumEEnum;
} } | public class class_name {
public EEnum getIfcRampFlightTypeEnum() {
if (ifcRampFlightTypeEnumEEnum == null) {
ifcRampFlightTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(881);
// depends on control dependency: [if], data = [none]
}
return ifcRampFlightTypeEnumEEnum;
} } |
public class class_name {
public TemporalAccessor parseBest(CharSequence text, TemporalQuery<?>... queries) {
Objects.requireNonNull(text, "text");
Objects.requireNonNull(queries, "queries");
if (queries.length < 2) {
throw new IllegalArgumentException("At least two queries must be specified");
}
try {
TemporalAccessor resolved = parseResolved0(text, null);
for (TemporalQuery<?> query : queries) {
try {
return (TemporalAccessor) resolved.query(query);
} catch (RuntimeException ex) {
// continue
}
}
throw new DateTimeException("Unable to convert parsed text using any of the specified queries");
} catch (DateTimeParseException ex) {
throw ex;
} catch (RuntimeException ex) {
throw createError(text, ex);
}
} } | public class class_name {
public TemporalAccessor parseBest(CharSequence text, TemporalQuery<?>... queries) {
Objects.requireNonNull(text, "text");
Objects.requireNonNull(queries, "queries");
if (queries.length < 2) {
throw new IllegalArgumentException("At least two queries must be specified");
}
try {
TemporalAccessor resolved = parseResolved0(text, null);
for (TemporalQuery<?> query : queries) {
try {
return (TemporalAccessor) resolved.query(query); // depends on control dependency: [try], data = [none]
} catch (RuntimeException ex) {
// continue
} // depends on control dependency: [catch], data = [none]
}
throw new DateTimeException("Unable to convert parsed text using any of the specified queries");
} catch (DateTimeParseException ex) {
throw ex;
} catch (RuntimeException ex) { // depends on control dependency: [catch], data = [none]
throw createError(text, ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static String addMmCifQuoting(String val) {
String newval;
if (val.contains("'")) {
// double quoting for strings containing single quotes (not strictly necessary but it's what the PDB usually does)
newval = "\""+val+"\"";
} else if (val.contains(" ")) {
// single quoting for stings containing spaces
newval = "'"+val+"'";
} else {
if (val.contains(" ") && val.contains("'")) {
// TODO deal with this case
logger.warn("Value contains both spaces and single quotes, won't format it: {}. CIF ouptut will likely be invalid.",val);
}
newval = val;
}
// TODO deal with all the other cases: e.g. multi-line quoting with ;;
return newval;
} } | public class class_name {
private static String addMmCifQuoting(String val) {
String newval;
if (val.contains("'")) {
// double quoting for strings containing single quotes (not strictly necessary but it's what the PDB usually does)
newval = "\""+val+"\""; // depends on control dependency: [if], data = [none]
} else if (val.contains(" ")) {
// single quoting for stings containing spaces
newval = "'"+val+"'"; // depends on control dependency: [if], data = [none]
} else {
if (val.contains(" ") && val.contains("'")) {
// TODO deal with this case
logger.warn("Value contains both spaces and single quotes, won't format it: {}. CIF ouptut will likely be invalid.",val); // depends on control dependency: [if], data = [none]
}
newval = val; // depends on control dependency: [if], data = [none]
}
// TODO deal with all the other cases: e.g. multi-line quoting with ;;
return newval;
} } |
public class class_name {
public NioClient read(ByteBuffer buffer) {
try {
this.channel.read(buffer);
} catch (IOException e) {
throw new IORuntimeException(e);
}
return this;
} } | public class class_name {
public NioClient read(ByteBuffer buffer) {
try {
this.channel.read(buffer);
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IORuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
return this;
} } |
public class class_name {
public static Set<? extends BioPAXElement> getObjectBiopaxPropertyValues(BioPAXElement bpe, String property) {
Set<BioPAXElement> values = new HashSet<BioPAXElement>();
// get the BioPAX L3 property editors map
EditorMap em = SimpleEditorMap.L3;
// get the 'organism' biopax property editor,
// if exists for this type of bpe
@SuppressWarnings("unchecked") PropertyEditor<BioPAXElement, BioPAXElement> editor
= (PropertyEditor<BioPAXElement, BioPAXElement>) em
.getEditorForProperty(property, bpe.getModelInterface());
// if the biopax object does have such property, get values
if (editor != null) {
return editor.getValueFromBean(bpe);
} else
return values;
} } | public class class_name {
public static Set<? extends BioPAXElement> getObjectBiopaxPropertyValues(BioPAXElement bpe, String property) {
Set<BioPAXElement> values = new HashSet<BioPAXElement>();
// get the BioPAX L3 property editors map
EditorMap em = SimpleEditorMap.L3;
// get the 'organism' biopax property editor,
// if exists for this type of bpe
@SuppressWarnings("unchecked") PropertyEditor<BioPAXElement, BioPAXElement> editor
= (PropertyEditor<BioPAXElement, BioPAXElement>) em
.getEditorForProperty(property, bpe.getModelInterface());
// if the biopax object does have such property, get values
if (editor != null) {
return editor.getValueFromBean(bpe); // depends on control dependency: [if], data = [none]
} else
return values;
} } |
public class class_name {
private <T> Set<ProjectStage> getProjectStagesForType(AnnotatedType<T> type) {
Set<ProjectStage> stages = new HashSet<ProjectStage>();
if (type.getAnnotation(Development.class) != null) {
stages.add(ProjectStage.Development);
}
if (type.getAnnotation(Production.class) != null) {
stages.add(ProjectStage.Production);
}
if (type.getAnnotation(SystemTest.class) != null) {
stages.add(ProjectStage.SystemTest);
}
if (type.getAnnotation(UnitTest.class) != null) {
stages.add(ProjectStage.UnitTest);
}
return stages;
} } | public class class_name {
private <T> Set<ProjectStage> getProjectStagesForType(AnnotatedType<T> type) {
Set<ProjectStage> stages = new HashSet<ProjectStage>();
if (type.getAnnotation(Development.class) != null) {
stages.add(ProjectStage.Development); // depends on control dependency: [if], data = [none]
}
if (type.getAnnotation(Production.class) != null) {
stages.add(ProjectStage.Production); // depends on control dependency: [if], data = [none]
}
if (type.getAnnotation(SystemTest.class) != null) {
stages.add(ProjectStage.SystemTest); // depends on control dependency: [if], data = [none]
}
if (type.getAnnotation(UnitTest.class) != null) {
stages.add(ProjectStage.UnitTest); // depends on control dependency: [if], data = [none]
}
return stages;
} } |
public class class_name {
private static boolean patchShadedLibraryId(byte[] bytes, String originalName, String name) {
// Our native libs always have the name as part of their id so we can search for it and replace it
// to make the ID unique if shading is used.
byte[] nameBytes = originalName.getBytes(CharsetUtil.UTF_8);
int idIdx = -1;
// Be aware this is a really raw way of patching a dylib but it does all we need without implementing
// a full mach-o parser and writer. Basically we just replace the the original bytes with some
// random bytes as part of the ID regeneration. The important thing here is that we need to use the same
// length to not corrupt the mach-o header.
outerLoop: for (int i = 0; i < bytes.length && bytes.length - i >= nameBytes.length; i++) {
int idx = i;
for (int j = 0; j < nameBytes.length;) {
if (bytes[idx++] != nameBytes[j++]) {
// Did not match the name, increase the index and try again.
break;
} else if (j == nameBytes.length) {
// We found the index within the id.
idIdx = i;
break outerLoop;
}
}
}
if (idIdx == -1) {
logger.debug("Was not able to find the ID of the shaded native library {}, can't adjust it.", name);
return false;
} else {
// We found our ID... now monkey-patch it!
for (int i = 0; i < nameBytes.length; i++) {
// We should only use bytes as replacement that are in our UNIQUE_ID_BYTES array.
bytes[idIdx + i] = UNIQUE_ID_BYTES[PlatformDependent.threadLocalRandom()
.nextInt(UNIQUE_ID_BYTES.length)];
}
if (logger.isDebugEnabled()) {
logger.debug(
"Found the ID of the shaded native library {}. Replacing ID part {} with {}",
name, originalName, new String(bytes, idIdx, nameBytes.length, CharsetUtil.UTF_8));
}
return true;
}
} } | public class class_name {
private static boolean patchShadedLibraryId(byte[] bytes, String originalName, String name) {
// Our native libs always have the name as part of their id so we can search for it and replace it
// to make the ID unique if shading is used.
byte[] nameBytes = originalName.getBytes(CharsetUtil.UTF_8);
int idIdx = -1;
// Be aware this is a really raw way of patching a dylib but it does all we need without implementing
// a full mach-o parser and writer. Basically we just replace the the original bytes with some
// random bytes as part of the ID regeneration. The important thing here is that we need to use the same
// length to not corrupt the mach-o header.
outerLoop: for (int i = 0; i < bytes.length && bytes.length - i >= nameBytes.length; i++) {
int idx = i;
for (int j = 0; j < nameBytes.length;) {
if (bytes[idx++] != nameBytes[j++]) {
// Did not match the name, increase the index and try again.
break;
} else if (j == nameBytes.length) {
// We found the index within the id.
idIdx = i; // depends on control dependency: [if], data = [none]
break outerLoop;
}
}
}
if (idIdx == -1) {
logger.debug("Was not able to find the ID of the shaded native library {}, can't adjust it.", name); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} else {
// We found our ID... now monkey-patch it!
for (int i = 0; i < nameBytes.length; i++) {
// We should only use bytes as replacement that are in our UNIQUE_ID_BYTES array.
bytes[idIdx + i] = UNIQUE_ID_BYTES[PlatformDependent.threadLocalRandom()
.nextInt(UNIQUE_ID_BYTES.length)]; // depends on control dependency: [for], data = [i]
}
if (logger.isDebugEnabled()) {
logger.debug(
"Found the ID of the shaded native library {}. Replacing ID part {} with {}",
name, originalName, new String(bytes, idIdx, nameBytes.length, CharsetUtil.UTF_8)); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Float loadPreferenceAsFloat(String key, Float defaultValue) {
Float value = defaultValue;
if (hasPreference(key)) {
value = getSharedPreferences().getFloat(key, 0);
}
logLoad(key, value);
return value;
} } | public class class_name {
public Float loadPreferenceAsFloat(String key, Float defaultValue) {
Float value = defaultValue;
if (hasPreference(key)) {
value = getSharedPreferences().getFloat(key, 0); // depends on control dependency: [if], data = [none]
}
logLoad(key, value);
return value;
} } |
public class class_name {
void afterHtmlUpdate() {
if (m_overlayTimer != null) {
m_overlayTimer.cancel();
m_overlayTimer = null;
}
m_runningUpdate = false;
List<Element> elements = CmsEntityBackend.getInstance().getAttributeElements(
m_parentEntity,
m_attributeHandler.getAttributeName(),
m_formParent.getElement());
if (m_popupClosed) {
// the form popup has already been closed, reinitialize the editing widgets for updated HTML
CmsInlineEditOverlay.updateCurrentOverlayPosition();
if (m_requireShowPopup) {
if (elements.size() > m_attributeIndex) {
m_referenceElement = elements.get(m_attributeIndex);
}
showEditPopup(null);
m_hasChanges = true;
} else {
CmsInlineEditOverlay.getRootOverlay().clearButtonPanel();
m_htmlUpdateHandler.reinitWidgets(m_formParent);
}
} else {
if (m_referenceElement != null) {
CmsInlineEditOverlay.removeLastOverlay();
}
if (elements.size() > m_attributeIndex) {
m_referenceElement = elements.get(m_attributeIndex);
CmsInlineEditOverlay.addOverlayForElement(m_referenceElement);
} else {
m_referenceElement = m_formParent.getElement();
CmsInlineEditOverlay.addOverlayForElement(m_referenceElement);
}
}
// schedule to update the ovelay position
m_overlayTimer = new Timer() {
/** Timer run counter. */
private int m_timerRuns;
/**
* @see com.google.gwt.user.client.Timer#run()
*/
@Override
public void run() {
CmsInlineEditOverlay.updateCurrentOverlayPosition();
if (m_timerRuns > 3) {
cancel();
}
m_timerRuns++;
}
};
m_overlayTimer.scheduleRepeating(100);
} } | public class class_name {
void afterHtmlUpdate() {
if (m_overlayTimer != null) {
m_overlayTimer.cancel(); // depends on control dependency: [if], data = [none]
m_overlayTimer = null; // depends on control dependency: [if], data = [none]
}
m_runningUpdate = false;
List<Element> elements = CmsEntityBackend.getInstance().getAttributeElements(
m_parentEntity,
m_attributeHandler.getAttributeName(),
m_formParent.getElement());
if (m_popupClosed) {
// the form popup has already been closed, reinitialize the editing widgets for updated HTML
CmsInlineEditOverlay.updateCurrentOverlayPosition(); // depends on control dependency: [if], data = [none]
if (m_requireShowPopup) {
if (elements.size() > m_attributeIndex) {
m_referenceElement = elements.get(m_attributeIndex); // depends on control dependency: [if], data = [m_attributeIndex)]
}
showEditPopup(null); // depends on control dependency: [if], data = [none]
m_hasChanges = true; // depends on control dependency: [if], data = [none]
} else {
CmsInlineEditOverlay.getRootOverlay().clearButtonPanel(); // depends on control dependency: [if], data = [none]
m_htmlUpdateHandler.reinitWidgets(m_formParent); // depends on control dependency: [if], data = [none]
}
} else {
if (m_referenceElement != null) {
CmsInlineEditOverlay.removeLastOverlay(); // depends on control dependency: [if], data = [none]
}
if (elements.size() > m_attributeIndex) {
m_referenceElement = elements.get(m_attributeIndex); // depends on control dependency: [if], data = [m_attributeIndex)]
CmsInlineEditOverlay.addOverlayForElement(m_referenceElement); // depends on control dependency: [if], data = [none]
} else {
m_referenceElement = m_formParent.getElement(); // depends on control dependency: [if], data = [none]
CmsInlineEditOverlay.addOverlayForElement(m_referenceElement); // depends on control dependency: [if], data = [none]
}
}
// schedule to update the ovelay position
m_overlayTimer = new Timer() {
/** Timer run counter. */
private int m_timerRuns;
/**
* @see com.google.gwt.user.client.Timer#run()
*/
@Override
public void run() {
CmsInlineEditOverlay.updateCurrentOverlayPosition();
if (m_timerRuns > 3) {
cancel(); // depends on control dependency: [if], data = [none]
}
m_timerRuns++;
}
};
m_overlayTimer.scheduleRepeating(100);
} } |
public class class_name {
public char getChar(String key, char defaultValue) {
Object value = get(key);
if (value instanceof Character) {
return (Character) value;
}
if (value != null && value instanceof String) {
if (((String) value).length() == 1) {
return ((String) value).charAt(0);
}
}
return defaultValue;
} } | public class class_name {
public char getChar(String key, char defaultValue) {
Object value = get(key);
if (value instanceof Character) {
return (Character) value; // depends on control dependency: [if], data = [none]
}
if (value != null && value instanceof String) {
if (((String) value).length() == 1) {
return ((String) value).charAt(0); // depends on control dependency: [if], data = [none]
}
}
return defaultValue;
} } |
public class class_name {
public void clean(String groupId, String unitId, String unitType, int state) throws TransactionClearException {
txLogger.txTrace(groupId, unitId, "clean transaction");
try {
cleanWithoutAspectLog(groupId, unitId, unitType, state);
aspectLogger.clearLog(groupId, unitId);
} catch (TransactionClearException e) {
if (!e.isNeedCompensation()) {
aspectLogger.clearLog(groupId, unitId);
}
} catch (Throwable throwable) {
aspectLogger.clearLog(groupId, unitId);
}
txLogger.txTrace(groupId, unitId, "clean transaction over");
} } | public class class_name {
public void clean(String groupId, String unitId, String unitType, int state) throws TransactionClearException {
txLogger.txTrace(groupId, unitId, "clean transaction");
try {
cleanWithoutAspectLog(groupId, unitId, unitType, state);
aspectLogger.clearLog(groupId, unitId);
} catch (TransactionClearException e) {
if (!e.isNeedCompensation()) {
aspectLogger.clearLog(groupId, unitId); // depends on control dependency: [if], data = [none]
}
} catch (Throwable throwable) {
aspectLogger.clearLog(groupId, unitId);
}
txLogger.txTrace(groupId, unitId, "clean transaction over");
} } |
public class class_name {
public static String formatISO8601Date(Date date) {
try {
return iso8601DateFormat.print(date.getTime());
} catch(RuntimeException ex) {
throw handleException(ex);
}
} } | public class class_name {
public static String formatISO8601Date(Date date) {
try {
return iso8601DateFormat.print(date.getTime()); // depends on control dependency: [try], data = [none]
} catch(RuntimeException ex) {
throw handleException(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public CreateIssueParams customFieldOtherValueMap(Map<Long, String> customFieldOtherValueMap) {
Set<Long> keySet = customFieldOtherValueMap.keySet();
for (Long key : keySet) {
parameters.add(new NameValuePair("customField_" + key.toString() + "_otherValue", customFieldOtherValueMap.get(key)));
}
return this;
} } | public class class_name {
public CreateIssueParams customFieldOtherValueMap(Map<Long, String> customFieldOtherValueMap) {
Set<Long> keySet = customFieldOtherValueMap.keySet();
for (Long key : keySet) {
parameters.add(new NameValuePair("customField_" + key.toString() + "_otherValue", customFieldOtherValueMap.get(key))); // depends on control dependency: [for], data = [key]
}
return this;
} } |
public class class_name {
private void build(Map<String, D6ModelClassFieldInfo> refFieldMap) {
refFieldMap.clear();
final Field[] fields = mModelClazz.getFields();
for (int i = 0; i < fields.length; i++) {
final Field field = fields[i];
final DBColumn annoColumn = field.getAnnotation(DBColumn.class);
if (annoColumn == null) {
// there is no column annotation.
continue;
}
final String columnName = annoColumn.columnName();
final String columnType = annoColumn.columnType();
if (columnName == null || columnType == null) {
continue;
}
final D6ModelClassFieldInfo fieldInfo = new D6ModelClassFieldInfo();
//
fieldInfo.field = field;
fieldInfo.columnName = columnName;
fieldInfo.columnType = columnType;
fieldInfo.value = null;
//
fieldInfo.isAutoIncrement = annoColumn.isAutoIncrement();
fieldInfo.isNullable = annoColumn.isNullable();
fieldInfo.isPrimaryKey = annoColumn.isPrimaryKey();
fieldInfo.isUnique = annoColumn.isUnique();
refFieldMap.put(columnName, fieldInfo);
}
} } | public class class_name {
private void build(Map<String, D6ModelClassFieldInfo> refFieldMap) {
refFieldMap.clear();
final Field[] fields = mModelClazz.getFields();
for (int i = 0; i < fields.length; i++) {
final Field field = fields[i];
final DBColumn annoColumn = field.getAnnotation(DBColumn.class);
if (annoColumn == null) {
// there is no column annotation.
continue;
}
final String columnName = annoColumn.columnName();
final String columnType = annoColumn.columnType();
if (columnName == null || columnType == null) {
continue;
}
final D6ModelClassFieldInfo fieldInfo = new D6ModelClassFieldInfo();
//
fieldInfo.field = field;
// depends on control dependency: [for], data = [none]
fieldInfo.columnName = columnName;
// depends on control dependency: [for], data = [none]
fieldInfo.columnType = columnType;
// depends on control dependency: [for], data = [none]
fieldInfo.value = null;
// depends on control dependency: [for], data = [none]
//
fieldInfo.isAutoIncrement = annoColumn.isAutoIncrement();
// depends on control dependency: [for], data = [none]
fieldInfo.isNullable = annoColumn.isNullable();
// depends on control dependency: [for], data = [none]
fieldInfo.isPrimaryKey = annoColumn.isPrimaryKey();
// depends on control dependency: [for], data = [none]
fieldInfo.isUnique = annoColumn.isUnique();
// depends on control dependency: [for], data = [none]
refFieldMap.put(columnName, fieldInfo);
// depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static URL getAuthorizationURL(String clientID, URI redirectUri, String state, List<String> scopes) {
URLTemplate template = new URLTemplate(AUTHORIZATION_URL);
QueryStringBuilder queryBuilder = new QueryStringBuilder().appendParam("client_id", clientID)
.appendParam("response_type", "code")
.appendParam("redirect_uri", redirectUri.toString())
.appendParam("state", state);
if (scopes != null && !scopes.isEmpty()) {
StringBuilder builder = new StringBuilder();
int size = scopes.size() - 1;
int i = 0;
while (i < size) {
builder.append(scopes.get(i));
builder.append(" ");
i++;
}
builder.append(scopes.get(i));
queryBuilder.appendParam("scope", builder.toString());
}
return template.buildWithQuery("", queryBuilder.toString());
} } | public class class_name {
public static URL getAuthorizationURL(String clientID, URI redirectUri, String state, List<String> scopes) {
URLTemplate template = new URLTemplate(AUTHORIZATION_URL);
QueryStringBuilder queryBuilder = new QueryStringBuilder().appendParam("client_id", clientID)
.appendParam("response_type", "code")
.appendParam("redirect_uri", redirectUri.toString())
.appendParam("state", state);
if (scopes != null && !scopes.isEmpty()) {
StringBuilder builder = new StringBuilder();
int size = scopes.size() - 1;
int i = 0;
while (i < size) {
builder.append(scopes.get(i)); // depends on control dependency: [while], data = [(i]
builder.append(" "); // depends on control dependency: [while], data = [none]
i++; // depends on control dependency: [while], data = [none]
}
builder.append(scopes.get(i)); // depends on control dependency: [if], data = [(scopes]
queryBuilder.appendParam("scope", builder.toString()); // depends on control dependency: [if], data = [none]
}
return template.buildWithQuery("", queryBuilder.toString());
} } |
public class class_name {
public static short[] longToShortArray(final long src, final int srcPos, final short[] dst, final int dstPos,
final int nShorts) {
if (0 == nShorts) {
return dst;
}
if ((nShorts - 1) * 16 + srcPos >= 64) {
throw new IllegalArgumentException("(nShorts-1)*16+srcPos is greater or equal to than 64");
}
for (int i = 0; i < nShorts; i++) {
final int shift = i * 16 + srcPos;
dst[dstPos + i] = (short) (0xffff & (src >> shift));
}
return dst;
} } | public class class_name {
public static short[] longToShortArray(final long src, final int srcPos, final short[] dst, final int dstPos,
final int nShorts) {
if (0 == nShorts) {
return dst; // depends on control dependency: [if], data = [none]
}
if ((nShorts - 1) * 16 + srcPos >= 64) {
throw new IllegalArgumentException("(nShorts-1)*16+srcPos is greater or equal to than 64");
}
for (int i = 0; i < nShorts; i++) {
final int shift = i * 16 + srcPos;
dst[dstPos + i] = (short) (0xffff & (src >> shift)); // depends on control dependency: [for], data = [i]
}
return dst;
} } |
public class class_name {
public Map<String, List<DataNode>> getDataNodeGroups() {
Map<String, List<DataNode>> result = new LinkedHashMap<>(actualDataNodes.size(), 1);
for (DataNode each : actualDataNodes) {
String dataSourceName = each.getDataSourceName();
if (!result.containsKey(dataSourceName)) {
result.put(dataSourceName, new LinkedList<DataNode>());
}
result.get(dataSourceName).add(each);
}
return result;
} } | public class class_name {
public Map<String, List<DataNode>> getDataNodeGroups() {
Map<String, List<DataNode>> result = new LinkedHashMap<>(actualDataNodes.size(), 1);
for (DataNode each : actualDataNodes) {
String dataSourceName = each.getDataSourceName();
if (!result.containsKey(dataSourceName)) {
result.put(dataSourceName, new LinkedList<DataNode>()); // depends on control dependency: [if], data = [none]
}
result.get(dataSourceName).add(each); // depends on control dependency: [for], data = [each]
}
return result;
} } |
public class class_name {
private void prepareGraph() throws IllegalStateException {
List<ResourceType<L>> disabledTypes = new ArrayList<>();
// flattened list of types, all sets are collapsed into one
Map<Name, ResourceType<L>> allResourceTypes = new HashMap<>();
// add all resource types as vertices in the graph
for (TypeSet<ResourceType<L>> rTypeSet : typeSetMap.values()) {
for (ResourceType<L> rType : rTypeSet.getTypeMap().values()) {
if (null != allResourceTypes.put(rType.getName(), rType)) {
throw new IllegalStateException("Multiple resource types have the same name: " + rType.getName());
}
resourceTypesGraph.addVertex(rType);
if (!rTypeSet.isEnabled()) {
disabledTypes.add(rType);
}
}
}
// now add the parent hierarchy to the graph
for (TypeSet<ResourceType<L>> rTypeSet : typeSetMap.values()) {
for (ResourceType<L> rType : rTypeSet.getTypeMap().values()) {
for (Name parent : rType.getParents()) {
ResourceType<L> parentResourceType = allResourceTypes.get(parent);
if (parentResourceType == null) {
log.debugf("Resource type [%s] will ignore unknown parent [%s]", rType.getName(), parent);
} else {
resourceTypesGraph.addEdge(parentResourceType, rType);
}
}
}
}
// now strip all disabled types - if a type has an ancestor that is disabled, it too will be disabled
List<ResourceType<L>> toBeDisabled = new ArrayList<>();
for (ResourceType<L> disabledType : disabledTypes) {
toBeDisabled.add(disabledType);
getDeepChildrenList(disabledType, toBeDisabled);
log.infoDisablingResourceTypes(disabledType, toBeDisabled);
}
resourceTypesGraph.removeAllVertices(toBeDisabled);
} } | public class class_name {
private void prepareGraph() throws IllegalStateException {
List<ResourceType<L>> disabledTypes = new ArrayList<>();
// flattened list of types, all sets are collapsed into one
Map<Name, ResourceType<L>> allResourceTypes = new HashMap<>();
// add all resource types as vertices in the graph
for (TypeSet<ResourceType<L>> rTypeSet : typeSetMap.values()) {
for (ResourceType<L> rType : rTypeSet.getTypeMap().values()) {
if (null != allResourceTypes.put(rType.getName(), rType)) {
throw new IllegalStateException("Multiple resource types have the same name: " + rType.getName());
}
resourceTypesGraph.addVertex(rType);
if (!rTypeSet.isEnabled()) {
disabledTypes.add(rType); // depends on control dependency: [if], data = [none]
}
}
}
// now add the parent hierarchy to the graph
for (TypeSet<ResourceType<L>> rTypeSet : typeSetMap.values()) {
for (ResourceType<L> rType : rTypeSet.getTypeMap().values()) {
for (Name parent : rType.getParents()) {
ResourceType<L> parentResourceType = allResourceTypes.get(parent);
if (parentResourceType == null) {
log.debugf("Resource type [%s] will ignore unknown parent [%s]", rType.getName(), parent);
} else {
resourceTypesGraph.addEdge(parentResourceType, rType);
}
}
}
}
// now strip all disabled types - if a type has an ancestor that is disabled, it too will be disabled
List<ResourceType<L>> toBeDisabled = new ArrayList<>();
for (ResourceType<L> disabledType : disabledTypes) {
toBeDisabled.add(disabledType);
getDeepChildrenList(disabledType, toBeDisabled);
log.infoDisablingResourceTypes(disabledType, toBeDisabled);
}
resourceTypesGraph.removeAllVertices(toBeDisabled);
} } |
public class class_name {
public void setDatapoints(java.util.Collection<Datapoint> datapoints) {
if (datapoints == null) {
this.datapoints = null;
return;
}
this.datapoints = new com.amazonaws.internal.SdkInternalList<Datapoint>(datapoints);
} } | public class class_name {
public void setDatapoints(java.util.Collection<Datapoint> datapoints) {
if (datapoints == null) {
this.datapoints = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.datapoints = new com.amazonaws.internal.SdkInternalList<Datapoint>(datapoints);
} } |
public class class_name {
public void printFeatures(String exportFile, Collection<List<IN>> documents) {
try {
PrintWriter pw = IOUtils.getPrintWriter(exportFile);
for (List<IN> doc:documents) {
String str = getFeatureString(doc);
pw.println(str);
}
pw.close();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} } | public class class_name {
public void printFeatures(String exportFile, Collection<List<IN>> documents) {
try {
PrintWriter pw = IOUtils.getPrintWriter(exportFile);
for (List<IN> doc:documents) {
String str = getFeatureString(doc);
pw.println(str);
// depends on control dependency: [for], data = [none]
}
pw.close();
// depends on control dependency: [try], data = [none]
} catch (IOException ex) {
throw new RuntimeException(ex);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void updateColors() {
if (blockUpdates) {
return;
}
emitter.colors.clear();
for (int i=0;i<grad.getControlPointCount();i++) {
float pos = grad.getPointPos(i);
java.awt.Color col = grad.getColor(i);
Color slick = new Color(col.getRed() / 255.0f, col.getGreen() / 255.0f, col.getBlue() / 255.0f, 1.0f);
emitter.addColorPoint(pos, slick);
}
} } | public class class_name {
private void updateColors() {
if (blockUpdates) {
return;
// depends on control dependency: [if], data = [none]
}
emitter.colors.clear();
for (int i=0;i<grad.getControlPointCount();i++) {
float pos = grad.getPointPos(i);
java.awt.Color col = grad.getColor(i);
Color slick = new Color(col.getRed() / 255.0f, col.getGreen() / 255.0f, col.getBlue() / 255.0f, 1.0f);
emitter.addColorPoint(pos, slick);
// depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static void addSaslMech(String mech) {
initialize();
if (!defaultMechs.contains(mech)) {
defaultMechs.add(mech);
}
} } | public class class_name {
public static void addSaslMech(String mech) {
initialize();
if (!defaultMechs.contains(mech)) {
defaultMechs.add(mech); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DeleteClusterRequest deleteClusterRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteClusterRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteClusterRequest.getClusterName(), CLUSTERNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteClusterRequest deleteClusterRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteClusterRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteClusterRequest.getClusterName(), CLUSTERNAME_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 HandlerRegistration previewMouseUpHandler() {
return Event.addNativePreviewHandler(new NativePreviewHandler() {
public void onPreviewNativeEvent(NativePreviewEvent preview) {
int typeInt = preview.getTypeInt();
if (typeInt == Event.ONMOUSEUP) {
Event event = Event.as(preview.getNativeEvent());
// Can not retrieve the clicked widget from the Event, so here goes...
int clientX = event.getClientX();
int clientY = event.getClientY();
// Was the button clicked?
int left = button.getPageLeft();
int right = button.getPageRight();
int top = button.getPageTop();
int bottom = button.getPageBottom();
boolean mouseIsOutside = true;
if (clientX > left && clientX < right && clientY > top && clientY < bottom) {
mouseIsOutside = false;
}
if (mouseIsOutside) {
// Was this panel clicked?
right = getPageRight();
top = getPageTop();
bottom = getPageBottom();
if (clientX > left && clientX < right && clientY > top && clientY < bottom) {
mouseIsOutside = false;
}
}
if (mouseIsOutside) {
hide();
}
}
}
});
} } | public class class_name {
private HandlerRegistration previewMouseUpHandler() {
return Event.addNativePreviewHandler(new NativePreviewHandler() {
public void onPreviewNativeEvent(NativePreviewEvent preview) {
int typeInt = preview.getTypeInt();
if (typeInt == Event.ONMOUSEUP) {
Event event = Event.as(preview.getNativeEvent());
// Can not retrieve the clicked widget from the Event, so here goes...
int clientX = event.getClientX();
int clientY = event.getClientY();
// Was the button clicked?
int left = button.getPageLeft();
int right = button.getPageRight();
int top = button.getPageTop();
int bottom = button.getPageBottom();
boolean mouseIsOutside = true;
if (clientX > left && clientX < right && clientY > top && clientY < bottom) {
mouseIsOutside = false; // depends on control dependency: [if], data = [none]
}
if (mouseIsOutside) {
// Was this panel clicked?
right = getPageRight(); // depends on control dependency: [if], data = [none]
top = getPageTop(); // depends on control dependency: [if], data = [none]
bottom = getPageBottom(); // depends on control dependency: [if], data = [none]
if (clientX > left && clientX < right && clientY > top && clientY < bottom) {
mouseIsOutside = false; // depends on control dependency: [if], data = [none]
}
}
if (mouseIsOutside) {
hide(); // depends on control dependency: [if], data = [none]
}
}
}
});
} } |
public class class_name {
public static <Type> Type newInstance(final Class<Type> ofClass, final Type defaultValue) {
try {
return ClassReflection.newInstance(ofClass);
} catch (final Throwable exception) {
Exceptions.ignore(exception);
return defaultValue;
}
} } | public class class_name {
public static <Type> Type newInstance(final Class<Type> ofClass, final Type defaultValue) {
try {
return ClassReflection.newInstance(ofClass); // depends on control dependency: [try], data = [none]
} catch (final Throwable exception) {
Exceptions.ignore(exception);
return defaultValue;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void putMethodInfo(final ByteVector output) {
boolean useSyntheticAttribute = symbolTable.getMajorVersion() < Opcodes.V1_5;
int mask = useSyntheticAttribute ? Opcodes.ACC_SYNTHETIC : 0;
output.putShort(accessFlags & ~mask).putShort(nameIndex).putShort(descriptorIndex);
// If this method_info must be copied from an existing one, copy it now and return early.
if (sourceOffset != 0) {
output.putByteArray(symbolTable.getSource().b, sourceOffset, sourceLength);
return;
}
// For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
int attributeCount = 0;
if (code.length > 0) {
++attributeCount;
}
if (numberOfExceptions > 0) {
++attributeCount;
}
if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0 && useSyntheticAttribute) {
++attributeCount;
}
if (signatureIndex != 0) {
++attributeCount;
}
if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
++attributeCount;
}
if (lastRuntimeVisibleAnnotation != null) {
++attributeCount;
}
if (lastRuntimeInvisibleAnnotation != null) {
++attributeCount;
}
if (lastRuntimeVisibleParameterAnnotations != null) {
++attributeCount;
}
if (lastRuntimeInvisibleParameterAnnotations != null) {
++attributeCount;
}
if (lastRuntimeVisibleTypeAnnotation != null) {
++attributeCount;
}
if (lastRuntimeInvisibleTypeAnnotation != null) {
++attributeCount;
}
if (defaultValue != null) {
++attributeCount;
}
if (parameters != null) {
++attributeCount;
}
if (firstAttribute != null) {
attributeCount += firstAttribute.getAttributeCount();
}
// For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
output.putShort(attributeCount);
if (code.length > 0) {
// 2, 2, 4 and 2 bytes respectively for max_stack, max_locals, code_length and
// attributes_count, plus the bytecode and the exception table.
int size = 10 + code.length + Handler.getExceptionTableSize(firstHandler);
int codeAttributeCount = 0;
if (stackMapTableEntries != null) {
// 6 header bytes and 2 bytes for number_of_entries.
size += 8 + stackMapTableEntries.length;
++codeAttributeCount;
}
if (lineNumberTable != null) {
// 6 header bytes and 2 bytes for line_number_table_length.
size += 8 + lineNumberTable.length;
++codeAttributeCount;
}
if (localVariableTable != null) {
// 6 header bytes and 2 bytes for local_variable_table_length.
size += 8 + localVariableTable.length;
++codeAttributeCount;
}
if (localVariableTypeTable != null) {
// 6 header bytes and 2 bytes for local_variable_type_table_length.
size += 8 + localVariableTypeTable.length;
++codeAttributeCount;
}
if (lastCodeRuntimeVisibleTypeAnnotation != null) {
size +=
lastCodeRuntimeVisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
++codeAttributeCount;
}
if (lastCodeRuntimeInvisibleTypeAnnotation != null) {
size +=
lastCodeRuntimeInvisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
++codeAttributeCount;
}
if (firstCodeAttribute != null) {
size +=
firstCodeAttribute.computeAttributesSize(
symbolTable, code.data, code.length, maxStack, maxLocals);
codeAttributeCount += firstCodeAttribute.getAttributeCount();
}
output
.putShort(symbolTable.addConstantUtf8(Constants.CODE))
.putInt(size)
.putShort(maxStack)
.putShort(maxLocals)
.putInt(code.length)
.putByteArray(code.data, 0, code.length);
Handler.putExceptionTable(firstHandler, output);
output.putShort(codeAttributeCount);
if (stackMapTableEntries != null) {
boolean useStackMapTable = symbolTable.getMajorVersion() >= Opcodes.V1_6;
output
.putShort(
symbolTable.addConstantUtf8(
useStackMapTable ? Constants.STACK_MAP_TABLE : "StackMap"))
.putInt(2 + stackMapTableEntries.length)
.putShort(stackMapTableNumberOfEntries)
.putByteArray(stackMapTableEntries.data, 0, stackMapTableEntries.length);
}
if (lineNumberTable != null) {
output
.putShort(symbolTable.addConstantUtf8(Constants.LINE_NUMBER_TABLE))
.putInt(2 + lineNumberTable.length)
.putShort(lineNumberTableLength)
.putByteArray(lineNumberTable.data, 0, lineNumberTable.length);
}
if (localVariableTable != null) {
output
.putShort(symbolTable.addConstantUtf8(Constants.LOCAL_VARIABLE_TABLE))
.putInt(2 + localVariableTable.length)
.putShort(localVariableTableLength)
.putByteArray(localVariableTable.data, 0, localVariableTable.length);
}
if (localVariableTypeTable != null) {
output
.putShort(symbolTable.addConstantUtf8(Constants.LOCAL_VARIABLE_TYPE_TABLE))
.putInt(2 + localVariableTypeTable.length)
.putShort(localVariableTypeTableLength)
.putByteArray(localVariableTypeTable.data, 0, localVariableTypeTable.length);
}
if (lastCodeRuntimeVisibleTypeAnnotation != null) {
lastCodeRuntimeVisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS), output);
}
if (lastCodeRuntimeInvisibleTypeAnnotation != null) {
lastCodeRuntimeInvisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS), output);
}
if (firstCodeAttribute != null) {
firstCodeAttribute.putAttributes(
symbolTable, code.data, code.length, maxStack, maxLocals, output);
}
}
if (numberOfExceptions > 0) {
output
.putShort(symbolTable.addConstantUtf8(Constants.EXCEPTIONS))
.putInt(2 + 2 * numberOfExceptions)
.putShort(numberOfExceptions);
for (int exceptionIndex : exceptionIndexTable) {
output.putShort(exceptionIndex);
}
}
if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0 && useSyntheticAttribute) {
output.putShort(symbolTable.addConstantUtf8(Constants.SYNTHETIC)).putInt(0);
}
if (signatureIndex != 0) {
output
.putShort(symbolTable.addConstantUtf8(Constants.SIGNATURE))
.putInt(2)
.putShort(signatureIndex);
}
if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
output.putShort(symbolTable.addConstantUtf8(Constants.DEPRECATED)).putInt(0);
}
if (lastRuntimeVisibleAnnotation != null) {
lastRuntimeVisibleAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_ANNOTATIONS), output);
}
if (lastRuntimeInvisibleAnnotation != null) {
lastRuntimeInvisibleAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_ANNOTATIONS), output);
}
if (lastRuntimeVisibleParameterAnnotations != null) {
AnnotationWriter.putParameterAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS),
lastRuntimeVisibleParameterAnnotations,
visibleAnnotableParameterCount == 0
? lastRuntimeVisibleParameterAnnotations.length
: visibleAnnotableParameterCount,
output);
}
if (lastRuntimeInvisibleParameterAnnotations != null) {
AnnotationWriter.putParameterAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS),
lastRuntimeInvisibleParameterAnnotations,
invisibleAnnotableParameterCount == 0
? lastRuntimeInvisibleParameterAnnotations.length
: invisibleAnnotableParameterCount,
output);
}
if (lastRuntimeVisibleTypeAnnotation != null) {
lastRuntimeVisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS), output);
}
if (lastRuntimeInvisibleTypeAnnotation != null) {
lastRuntimeInvisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS), output);
}
if (defaultValue != null) {
output
.putShort(symbolTable.addConstantUtf8(Constants.ANNOTATION_DEFAULT))
.putInt(defaultValue.length)
.putByteArray(defaultValue.data, 0, defaultValue.length);
}
if (parameters != null) {
output
.putShort(symbolTable.addConstantUtf8(Constants.METHOD_PARAMETERS))
.putInt(1 + parameters.length)
.putByte(parametersCount)
.putByteArray(parameters.data, 0, parameters.length);
}
if (firstAttribute != null) {
firstAttribute.putAttributes(symbolTable, output);
}
} } | public class class_name {
void putMethodInfo(final ByteVector output) {
boolean useSyntheticAttribute = symbolTable.getMajorVersion() < Opcodes.V1_5;
int mask = useSyntheticAttribute ? Opcodes.ACC_SYNTHETIC : 0;
output.putShort(accessFlags & ~mask).putShort(nameIndex).putShort(descriptorIndex);
// If this method_info must be copied from an existing one, copy it now and return early.
if (sourceOffset != 0) {
output.putByteArray(symbolTable.getSource().b, sourceOffset, sourceLength); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
int attributeCount = 0;
if (code.length > 0) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (numberOfExceptions > 0) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0 && useSyntheticAttribute) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (signatureIndex != 0) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (lastRuntimeVisibleAnnotation != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (lastRuntimeInvisibleAnnotation != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (lastRuntimeVisibleParameterAnnotations != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (lastRuntimeInvisibleParameterAnnotations != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (lastRuntimeVisibleTypeAnnotation != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (lastRuntimeInvisibleTypeAnnotation != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (defaultValue != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (parameters != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (firstAttribute != null) {
attributeCount += firstAttribute.getAttributeCount(); // depends on control dependency: [if], data = [none]
}
// For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
output.putShort(attributeCount);
if (code.length > 0) {
// 2, 2, 4 and 2 bytes respectively for max_stack, max_locals, code_length and
// attributes_count, plus the bytecode and the exception table.
int size = 10 + code.length + Handler.getExceptionTableSize(firstHandler);
int codeAttributeCount = 0;
if (stackMapTableEntries != null) {
// 6 header bytes and 2 bytes for number_of_entries.
size += 8 + stackMapTableEntries.length; // depends on control dependency: [if], data = [none]
++codeAttributeCount; // depends on control dependency: [if], data = [none]
}
if (lineNumberTable != null) {
// 6 header bytes and 2 bytes for line_number_table_length.
size += 8 + lineNumberTable.length; // depends on control dependency: [if], data = [none]
++codeAttributeCount; // depends on control dependency: [if], data = [none]
}
if (localVariableTable != null) {
// 6 header bytes and 2 bytes for local_variable_table_length.
size += 8 + localVariableTable.length; // depends on control dependency: [if], data = [none]
++codeAttributeCount; // depends on control dependency: [if], data = [none]
}
if (localVariableTypeTable != null) {
// 6 header bytes and 2 bytes for local_variable_type_table_length.
size += 8 + localVariableTypeTable.length; // depends on control dependency: [if], data = [none]
++codeAttributeCount; // depends on control dependency: [if], data = [none]
}
if (lastCodeRuntimeVisibleTypeAnnotation != null) {
size +=
lastCodeRuntimeVisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS); // depends on control dependency: [if], data = [none]
++codeAttributeCount; // depends on control dependency: [if], data = [none]
}
if (lastCodeRuntimeInvisibleTypeAnnotation != null) {
size +=
lastCodeRuntimeInvisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS); // depends on control dependency: [if], data = [none]
++codeAttributeCount; // depends on control dependency: [if], data = [none]
}
if (firstCodeAttribute != null) {
size +=
firstCodeAttribute.computeAttributesSize(
symbolTable, code.data, code.length, maxStack, maxLocals); // depends on control dependency: [if], data = [none]
codeAttributeCount += firstCodeAttribute.getAttributeCount(); // depends on control dependency: [if], data = [none]
}
output
.putShort(symbolTable.addConstantUtf8(Constants.CODE))
.putInt(size)
.putShort(maxStack)
.putShort(maxLocals)
.putInt(code.length)
.putByteArray(code.data, 0, code.length); // depends on control dependency: [if], data = [none]
Handler.putExceptionTable(firstHandler, output); // depends on control dependency: [if], data = [none]
output.putShort(codeAttributeCount); // depends on control dependency: [if], data = [none]
if (stackMapTableEntries != null) {
boolean useStackMapTable = symbolTable.getMajorVersion() >= Opcodes.V1_6;
output
.putShort(
symbolTable.addConstantUtf8(
useStackMapTable ? Constants.STACK_MAP_TABLE : "StackMap"))
.putInt(2 + stackMapTableEntries.length)
.putShort(stackMapTableNumberOfEntries)
.putByteArray(stackMapTableEntries.data, 0, stackMapTableEntries.length); // depends on control dependency: [if], data = [none]
}
if (lineNumberTable != null) {
output
.putShort(symbolTable.addConstantUtf8(Constants.LINE_NUMBER_TABLE))
.putInt(2 + lineNumberTable.length)
.putShort(lineNumberTableLength)
.putByteArray(lineNumberTable.data, 0, lineNumberTable.length); // depends on control dependency: [if], data = [none]
}
if (localVariableTable != null) {
output
.putShort(symbolTable.addConstantUtf8(Constants.LOCAL_VARIABLE_TABLE))
.putInt(2 + localVariableTable.length)
.putShort(localVariableTableLength)
.putByteArray(localVariableTable.data, 0, localVariableTable.length); // depends on control dependency: [if], data = [none]
}
if (localVariableTypeTable != null) {
output
.putShort(symbolTable.addConstantUtf8(Constants.LOCAL_VARIABLE_TYPE_TABLE))
.putInt(2 + localVariableTypeTable.length)
.putShort(localVariableTypeTableLength)
.putByteArray(localVariableTypeTable.data, 0, localVariableTypeTable.length); // depends on control dependency: [if], data = [none]
}
if (lastCodeRuntimeVisibleTypeAnnotation != null) {
lastCodeRuntimeVisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS), output); // depends on control dependency: [if], data = [none]
}
if (lastCodeRuntimeInvisibleTypeAnnotation != null) {
lastCodeRuntimeInvisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS), output); // depends on control dependency: [if], data = [none]
}
if (firstCodeAttribute != null) {
firstCodeAttribute.putAttributes(
symbolTable, code.data, code.length, maxStack, maxLocals, output); // depends on control dependency: [if], data = [none]
}
}
if (numberOfExceptions > 0) {
output
.putShort(symbolTable.addConstantUtf8(Constants.EXCEPTIONS))
.putInt(2 + 2 * numberOfExceptions)
.putShort(numberOfExceptions); // depends on control dependency: [if], data = [none]
for (int exceptionIndex : exceptionIndexTable) {
output.putShort(exceptionIndex); // depends on control dependency: [for], data = [exceptionIndex]
}
}
if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0 && useSyntheticAttribute) {
output.putShort(symbolTable.addConstantUtf8(Constants.SYNTHETIC)).putInt(0); // depends on control dependency: [if], data = [none]
}
if (signatureIndex != 0) {
output
.putShort(symbolTable.addConstantUtf8(Constants.SIGNATURE))
.putInt(2)
.putShort(signatureIndex); // depends on control dependency: [if], data = [none]
}
if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
output.putShort(symbolTable.addConstantUtf8(Constants.DEPRECATED)).putInt(0); // depends on control dependency: [if], data = [0)]
}
if (lastRuntimeVisibleAnnotation != null) {
lastRuntimeVisibleAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_ANNOTATIONS), output); // depends on control dependency: [if], data = [none]
}
if (lastRuntimeInvisibleAnnotation != null) {
lastRuntimeInvisibleAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_ANNOTATIONS), output); // depends on control dependency: [if], data = [none]
}
if (lastRuntimeVisibleParameterAnnotations != null) {
AnnotationWriter.putParameterAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS),
lastRuntimeVisibleParameterAnnotations,
visibleAnnotableParameterCount == 0
? lastRuntimeVisibleParameterAnnotations.length
: visibleAnnotableParameterCount,
output); // depends on control dependency: [if], data = [none]
}
if (lastRuntimeInvisibleParameterAnnotations != null) {
AnnotationWriter.putParameterAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS),
lastRuntimeInvisibleParameterAnnotations,
invisibleAnnotableParameterCount == 0
? lastRuntimeInvisibleParameterAnnotations.length
: invisibleAnnotableParameterCount,
output); // depends on control dependency: [if], data = [none]
}
if (lastRuntimeVisibleTypeAnnotation != null) {
lastRuntimeVisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS), output); // depends on control dependency: [if], data = [none]
}
if (lastRuntimeInvisibleTypeAnnotation != null) {
lastRuntimeInvisibleTypeAnnotation.putAnnotations(
symbolTable.addConstantUtf8(Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS), output); // depends on control dependency: [if], data = [none]
}
if (defaultValue != null) {
output
.putShort(symbolTable.addConstantUtf8(Constants.ANNOTATION_DEFAULT))
.putInt(defaultValue.length)
.putByteArray(defaultValue.data, 0, defaultValue.length); // depends on control dependency: [if], data = [none]
}
if (parameters != null) {
output
.putShort(symbolTable.addConstantUtf8(Constants.METHOD_PARAMETERS))
.putInt(1 + parameters.length)
.putByte(parametersCount)
.putByteArray(parameters.data, 0, parameters.length); // depends on control dependency: [if], data = [none]
}
if (firstAttribute != null) {
firstAttribute.putAttributes(symbolTable, output); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void saturate(IAtomContainer atomContainer) throws CDKException {
logger.info("Saturating atomContainer by adjusting lone pair electrons...");
boolean allSaturated = allSaturated(atomContainer);
if (!allSaturated) {
for (int i = 0; i < atomContainer.getAtomCount(); i++) {
saturate(atomContainer.getAtom(i), atomContainer);
}
}
} } | public class class_name {
public void saturate(IAtomContainer atomContainer) throws CDKException {
logger.info("Saturating atomContainer by adjusting lone pair electrons...");
boolean allSaturated = allSaturated(atomContainer);
if (!allSaturated) {
for (int i = 0; i < atomContainer.getAtomCount(); i++) {
saturate(atomContainer.getAtom(i), atomContainer); // depends on control dependency: [for], data = [i]
}
}
} } |
public class class_name {
public void println(Object x) {
if (ivSuppress == true)
return;
String writeData = null;
if (x instanceof java.lang.Throwable) { // D230373
writeData = HpelHelper.throwableToString((java.lang.Throwable) x);
} else {
writeData = String.valueOf(x);
}
doPrintLine(writeData);
} } | public class class_name {
public void println(Object x) {
if (ivSuppress == true)
return;
String writeData = null;
if (x instanceof java.lang.Throwable) { // D230373
writeData = HpelHelper.throwableToString((java.lang.Throwable) x); // depends on control dependency: [if], data = [none]
} else {
writeData = String.valueOf(x); // depends on control dependency: [if], data = [none]
}
doPrintLine(writeData);
} } |
public class class_name {
protected Object handleGetObject(String key) {
String value = (String) bundle.handleGetObject(key);
if (value == null) {
return null;
} else {
// This strange hack let us read UTF-8 characters.
return new String(value.getBytes(Charsets.ISO_8859_1), Charsets.UTF_8);
}
} } | public class class_name {
protected Object handleGetObject(String key) {
String value = (String) bundle.handleGetObject(key);
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
// This strange hack let us read UTF-8 characters.
return new String(value.getBytes(Charsets.ISO_8859_1), Charsets.UTF_8); // depends on control dependency: [if], data = [(value]
}
} } |
public class class_name {
public void skipToGranulePosition(int sid, long granulePosition) throws IOException {
OggPacket p = null;
while( (p = getNextPacket()) != null ) {
if(p.getSid() == sid && p.getGranulePosition() >= granulePosition) {
nextPacket = p;
break;
}
}
} } | public class class_name {
public void skipToGranulePosition(int sid, long granulePosition) throws IOException {
OggPacket p = null;
while( (p = getNextPacket()) != null ) {
if(p.getSid() == sid && p.getGranulePosition() >= granulePosition) {
nextPacket = p; // depends on control dependency: [if], data = [none]
break;
}
}
} } |
public class class_name {
public PluralRules forLocale(ULocale locale, PluralRules.PluralType type) {
String rulesId = getRulesIdForLocale(locale, type);
if (rulesId == null || rulesId.trim().length() == 0) {
return PluralRules.DEFAULT;
}
PluralRules rules = getRulesForRulesId(rulesId);
if (rules == null) {
rules = PluralRules.DEFAULT;
}
return rules;
} } | public class class_name {
public PluralRules forLocale(ULocale locale, PluralRules.PluralType type) {
String rulesId = getRulesIdForLocale(locale, type);
if (rulesId == null || rulesId.trim().length() == 0) {
return PluralRules.DEFAULT; // depends on control dependency: [if], data = [none]
}
PluralRules rules = getRulesForRulesId(rulesId);
if (rules == null) {
rules = PluralRules.DEFAULT; // depends on control dependency: [if], data = [none]
}
return rules;
} } |
public class class_name {
@Override
public ReadSupport.ReadContext init(InitContext context) {
final Configuration configuration = context.getConfiguration();
final MessageType fileMessageType = context.getFileSchema();
MessageType requestedProjection = fileMessageType;
String partialSchemaString = configuration.get(ReadSupport.PARQUET_READ_SCHEMA);
FieldProjectionFilter projectionFilter = getFieldProjectionFilter(configuration);
if (partialSchemaString != null && projectionFilter != null) {
throw new ThriftProjectionException(
String.format("You cannot provide both a partial schema and field projection filter."
+ "Only one of (%s, %s, %s) should be set.",
PARQUET_READ_SCHEMA, STRICT_THRIFT_COLUMN_FILTER_KEY, THRIFT_COLUMN_FILTER_KEY));
} else if (partialSchemaString != null) {
requestedProjection = getSchemaForRead(fileMessageType, partialSchemaString);
} else if (projectionFilter != null) {
try {
if (thriftClass == null) {
thriftClass = getThriftClassFromMultipleFiles(context.getKeyValueMetadata(), configuration);
}
requestedProjection = getProjectedSchema(projectionFilter);
} catch (ClassNotFoundException e) {
throw new ThriftProjectionException("can not find thriftClass from configuration", e);
}
}
MessageType schemaForRead = getSchemaForRead(fileMessageType, requestedProjection);
return new ReadContext(schemaForRead);
} } | public class class_name {
@Override
public ReadSupport.ReadContext init(InitContext context) {
final Configuration configuration = context.getConfiguration();
final MessageType fileMessageType = context.getFileSchema();
MessageType requestedProjection = fileMessageType;
String partialSchemaString = configuration.get(ReadSupport.PARQUET_READ_SCHEMA);
FieldProjectionFilter projectionFilter = getFieldProjectionFilter(configuration);
if (partialSchemaString != null && projectionFilter != null) {
throw new ThriftProjectionException(
String.format("You cannot provide both a partial schema and field projection filter."
+ "Only one of (%s, %s, %s) should be set.",
PARQUET_READ_SCHEMA, STRICT_THRIFT_COLUMN_FILTER_KEY, THRIFT_COLUMN_FILTER_KEY));
} else if (partialSchemaString != null) {
requestedProjection = getSchemaForRead(fileMessageType, partialSchemaString); // depends on control dependency: [if], data = [none]
} else if (projectionFilter != null) {
try {
if (thriftClass == null) {
thriftClass = getThriftClassFromMultipleFiles(context.getKeyValueMetadata(), configuration); // depends on control dependency: [if], data = [none]
}
requestedProjection = getProjectedSchema(projectionFilter); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
throw new ThriftProjectionException("can not find thriftClass from configuration", e);
} // depends on control dependency: [catch], data = [none]
}
MessageType schemaForRead = getSchemaForRead(fileMessageType, requestedProjection);
return new ReadContext(schemaForRead);
} } |
public class class_name {
public BsonBoolean getBoolean(final Object key, final BsonBoolean defaultValue) {
if (!containsKey(key)) {
return defaultValue;
}
return get(key).asBoolean();
} } | public class class_name {
public BsonBoolean getBoolean(final Object key, final BsonBoolean defaultValue) {
if (!containsKey(key)) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
return get(key).asBoolean();
} } |
public class class_name {
private POSModel loadModel(final String lang, final String modelName, final Boolean useModelCache) {
final long lStartTime = new Date().getTime();
POSModel model = null;
try {
if (useModelCache) {
synchronized (posModels) {
if (!posModels.containsKey(lang)) {
model = new POSModel(new FileInputStream(modelName));
posModels.put(lang, model);
}
}
} else {
model = new POSModel(new FileInputStream(modelName));
}
} catch (final IOException e) {
e.printStackTrace();
}
final long lEndTime = new Date().getTime();
final long difference = lEndTime - lStartTime;
System.err.println("ixa-pipe-pos model loaded in: " + difference
+ " miliseconds ... [DONE]");
return model;
} } | public class class_name {
private POSModel loadModel(final String lang, final String modelName, final Boolean useModelCache) {
final long lStartTime = new Date().getTime();
POSModel model = null;
try {
if (useModelCache) {
synchronized (posModels) { // depends on control dependency: [if], data = [none]
if (!posModels.containsKey(lang)) {
model = new POSModel(new FileInputStream(modelName)); // depends on control dependency: [if], data = [none]
posModels.put(lang, model); // depends on control dependency: [if], data = [none]
}
}
} else {
model = new POSModel(new FileInputStream(modelName)); // depends on control dependency: [if], data = [none]
}
} catch (final IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
final long lEndTime = new Date().getTime();
final long difference = lEndTime - lStartTime;
System.err.println("ixa-pipe-pos model loaded in: " + difference
+ " miliseconds ... [DONE]");
return model;
} } |
public class class_name {
public void run(IAction action) {
if (selectedNode == null) {
return;
}
IWorkbenchBrowserSupport browserSupport =
Activator.getDefault().getWorkbench().getBrowserSupport();
try {
URL consoleURL = new URL(
extractGuvnorConsoleUrl(selectedNode.getGuvnorRepository().getLocation()));
if (browserSupport.isInternalWebBrowserAvailable()) {
browserSupport.createBrowser(null).openURL(consoleURL);
} else {
browserSupport.getExternalBrowser().openURL(consoleURL);
}
} catch (Exception e) {
Activator.getDefault().displayError(IStatus.ERROR, e.getMessage(), e, true);
}
} } | public class class_name {
public void run(IAction action) {
if (selectedNode == null) {
return; // depends on control dependency: [if], data = [none]
}
IWorkbenchBrowserSupport browserSupport =
Activator.getDefault().getWorkbench().getBrowserSupport();
try {
URL consoleURL = new URL(
extractGuvnorConsoleUrl(selectedNode.getGuvnorRepository().getLocation()));
if (browserSupport.isInternalWebBrowserAvailable()) {
browserSupport.createBrowser(null).openURL(consoleURL); // depends on control dependency: [if], data = [none]
} else {
browserSupport.getExternalBrowser().openURL(consoleURL); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
Activator.getDefault().displayError(IStatus.ERROR, e.getMessage(), e, true);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private <I> void hear( Class<? super I> type, TypeEncounter<I> encounter )
{
if ( type == null || type.getPackage().getName().startsWith( JAVA_PACKAGE ) )
{
return;
}
for ( Method method : type.getDeclaredMethods() )
{
if ( method.isAnnotationPresent( annotationType ) )
{
if ( method.getParameterTypes().length != 0 )
{
encounter.addError( "Annotated methods with @%s must not accept any argument, found %s",
annotationType.getName(), method );
}
hear( method, encounter );
}
}
hear( type.getSuperclass(), encounter );
} } | public class class_name {
private <I> void hear( Class<? super I> type, TypeEncounter<I> encounter )
{
if ( type == null || type.getPackage().getName().startsWith( JAVA_PACKAGE ) )
{
return; // depends on control dependency: [if], data = [none]
}
for ( Method method : type.getDeclaredMethods() )
{
if ( method.isAnnotationPresent( annotationType ) )
{
if ( method.getParameterTypes().length != 0 )
{
encounter.addError( "Annotated methods with @%s must not accept any argument, found %s",
annotationType.getName(), method ); // depends on control dependency: [if], data = [none]
}
hear( method, encounter ); // depends on control dependency: [if], data = [none]
}
}
hear( type.getSuperclass(), encounter );
} } |
public class class_name {
private void configureAuthentication(String username, String password, String realm) {
// If the username is set, set up authentication:
if (StringUtils.isNotBlank(username)) {
this.username = username;
this.password = password;
this.realm = StringUtils.defaultIfBlank(realm, "restolino");
authenticationEnabled = true;
}
} } | public class class_name {
private void configureAuthentication(String username, String password, String realm) {
// If the username is set, set up authentication:
if (StringUtils.isNotBlank(username)) {
this.username = username; // depends on control dependency: [if], data = [none]
this.password = password; // depends on control dependency: [if], data = [none]
this.realm = StringUtils.defaultIfBlank(realm, "restolino"); // depends on control dependency: [if], data = [none]
authenticationEnabled = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean put(final Txn<T> txn, final T key, final T val,
final PutFlags... flags) {
if (SHOULD_CHECK) {
requireNonNull(txn);
requireNonNull(key);
requireNonNull(val);
txn.checkReady();
txn.checkWritesAllowed();
}
txn.kv().keyIn(key);
txn.kv().valIn(val);
final int mask = mask(flags);
final int rc = LIB.mdb_put(txn.pointer(), ptr, txn.kv().pointerKey(), txn
.kv().pointerVal(), mask);
if (rc == MDB_KEYEXIST) {
if (isSet(mask, MDB_NOOVERWRITE)) {
txn.kv().valOut(); // marked as in,out in LMDB C docs
} else if (!isSet(mask, MDB_NODUPDATA)) {
checkRc(rc);
}
return false;
}
checkRc(rc);
return true;
} } | public class class_name {
public boolean put(final Txn<T> txn, final T key, final T val,
final PutFlags... flags) {
if (SHOULD_CHECK) {
requireNonNull(txn); // depends on control dependency: [if], data = [none]
requireNonNull(key); // depends on control dependency: [if], data = [none]
requireNonNull(val); // depends on control dependency: [if], data = [none]
txn.checkReady(); // depends on control dependency: [if], data = [none]
txn.checkWritesAllowed(); // depends on control dependency: [if], data = [none]
}
txn.kv().keyIn(key);
txn.kv().valIn(val);
final int mask = mask(flags);
final int rc = LIB.mdb_put(txn.pointer(), ptr, txn.kv().pointerKey(), txn
.kv().pointerVal(), mask);
if (rc == MDB_KEYEXIST) {
if (isSet(mask, MDB_NOOVERWRITE)) {
txn.kv().valOut(); // marked as in,out in LMDB C docs // depends on control dependency: [if], data = [none]
} else if (!isSet(mask, MDB_NODUPDATA)) {
checkRc(rc); // depends on control dependency: [if], data = [none]
}
return false; // depends on control dependency: [if], data = [none]
}
checkRc(rc);
return true;
} } |
public class class_name {
private <T extends Annotation> T getAnnotation(JavaClass javaClazz, JavaField javaField, ClassLoader compileClassLoader, Class<T> annotationType) {
try {
Class<?> clazz = compileClassLoader.loadClass(javaClazz.getFullyQualifiedName());
Field field = clazz.getField(javaField.getName());
return field.getAnnotation(annotationType);
}
catch (ClassNotFoundException | NoSuchFieldException | SecurityException | IllegalArgumentException ex) {
throw new RuntimeException("Unable to get contanst value of field '" + javaClazz.getName() + "#" + javaField.getName() + ":\n" + ex.getMessage(), ex);
}
} } | public class class_name {
private <T extends Annotation> T getAnnotation(JavaClass javaClazz, JavaField javaField, ClassLoader compileClassLoader, Class<T> annotationType) {
try {
Class<?> clazz = compileClassLoader.loadClass(javaClazz.getFullyQualifiedName());
Field field = clazz.getField(javaField.getName());
return field.getAnnotation(annotationType); // depends on control dependency: [try], data = [none]
}
catch (ClassNotFoundException | NoSuchFieldException | SecurityException | IllegalArgumentException ex) {
throw new RuntimeException("Unable to get contanst value of field '" + javaClazz.getName() + "#" + javaField.getName() + ":\n" + ex.getMessage(), ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(CreateDirectoryRequest createDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (createDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDirectoryRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(createDirectoryRequest.getShortName(), SHORTNAME_BINDING);
protocolMarshaller.marshall(createDirectoryRequest.getPassword(), PASSWORD_BINDING);
protocolMarshaller.marshall(createDirectoryRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(createDirectoryRequest.getSize(), SIZE_BINDING);
protocolMarshaller.marshall(createDirectoryRequest.getVpcSettings(), VPCSETTINGS_BINDING);
protocolMarshaller.marshall(createDirectoryRequest.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateDirectoryRequest createDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (createDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDirectoryRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDirectoryRequest.getShortName(), SHORTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDirectoryRequest.getPassword(), PASSWORD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDirectoryRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDirectoryRequest.getSize(), SIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDirectoryRequest.getVpcSettings(), VPCSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDirectoryRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String getStaticResourceVersion() {
if (null == staticResourceVersion) {
staticResourceVersion = getLatkeProperty("staticResourceVersion");
if (null == staticResourceVersion) {
staticResourceVersion = String.valueOf(startupTimeMillis);
}
}
return staticResourceVersion;
} } | public class class_name {
public static String getStaticResourceVersion() {
if (null == staticResourceVersion) {
staticResourceVersion = getLatkeProperty("staticResourceVersion"); // depends on control dependency: [if], data = [none]
if (null == staticResourceVersion) {
staticResourceVersion = String.valueOf(startupTimeMillis); // depends on control dependency: [if], data = [none]
}
}
return staticResourceVersion;
} } |
public class class_name {
public static void generateSDedit(List<TraceEvent> events, FileWriter fw) throws Exception
{
String connectionListener = events.get(0).getConnectionListener();
long start = events.get(0).getTimestamp();
long end = events.get(events.size() - 1).getTimestamp();
boolean newCl = false;
boolean hasTx = false;
boolean newSync = false;
boolean delist = false;
Set<String> connections = new HashSet<String>();
for (TraceEvent te : events)
{
if (te.getType() == TraceEvent.GET_CONNECTION_LISTENER_NEW ||
te.getType() == TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER_NEW)
{
newCl = true;
}
else if (te.getType() == TraceEvent.ENLIST_CONNECTION_LISTENER ||
te.getType() == TraceEvent.ENLIST_CONNECTION_LISTENER_FAILED ||
te.getType() == TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER ||
te.getType() == TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER_FAILED)
{
hasTx = true;
}
}
writeString(fw, "#![ConnectionListener: " + connectionListener + "]");
writeEOL(fw);
writeString(fw, "#!>>");
writeEOL(fw);
writeString(fw, "#!Start: " + start);
writeEOL(fw);
writeString(fw, "#!End : " + end);
writeEOL(fw);
writeString(fw, "#!<<");
writeEOL(fw);
writeString(fw, "application:Application[a]");
writeEOL(fw);
writeString(fw, "cm:ConnectionManager[a]");
writeEOL(fw);
writeString(fw, "pool:Pool[a]");
writeEOL(fw);
writeString(fw, "mcp:MCP[a]");
writeEOL(fw);
if (!newCl)
{
writeString(fw, "cl:ConnectionListener[a]");
writeEOL(fw);
}
else
{
writeString(fw, "/cl:ConnectionListener[a]");
writeEOL(fw);
}
if (hasTx)
{
writeString(fw, "tx:Transaction[a]");
writeEOL(fw);
writeString(fw, "/sync:Synchronization[a,x]");
writeEOL(fw);
}
writeEOL(fw);
for (int i = 0; i < events.size(); i++)
{
TraceEvent te = events.get(i);
switch (te.getType())
{
case TraceEvent.GET_CONNECTION_LISTENER:
writeString(fw, "application:cm.allocateConnection()");
writeEOL(fw);
writeString(fw, "cm:pool.getConnection()");
writeEOL(fw);
writeString(fw, "pool:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.get()");
writeEOL(fw);
break;
case TraceEvent.GET_CONNECTION_LISTENER_NEW:
writeString(fw, "application:cm.allocateConnection()");
writeEOL(fw);
writeString(fw, "cm:pool.getConnection()");
writeEOL(fw);
writeString(fw, "pool:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.new()");
writeEOL(fw);
break;
case TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER:
writeString(fw, "application:cm.allocateConnection()");
writeEOL(fw);
writeString(fw, "cm:pool.getConnection()");
writeEOL(fw);
writeString(fw, "pool:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.get()");
writeEOL(fw);
break;
case TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER_NEW:
writeString(fw, "application:cm.allocateConnection()");
writeEOL(fw);
writeString(fw, "cm:pool.getConnection()");
writeEOL(fw);
writeString(fw, "pool:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.new()");
writeEOL(fw);
break;
case TraceEvent.RETURN_CONNECTION_LISTENER:
if (hasTx)
{
if (delist)
{
writeString(fw, "[c afterCompletion]");
writeEOL(fw);
writeString(fw, "sync:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "[/c]");
writeEOL(fw);
}
else
{
writeString(fw, "cl:mcp." + TraceEvent.asText(te));
writeEOL(fw);
}
}
else
{
writeString(fw, "cl:mcp." + TraceEvent.asText(te));
writeEOL(fw);
}
break;
case TraceEvent.RETURN_CONNECTION_LISTENER_WITH_KILL:
if (hasTx)
{
if (delist)
{
writeString(fw, "[c afterCompletion]");
writeEOL(fw);
writeString(fw, "sync:>mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.doDestroy()");
writeEOL(fw);
writeString(fw, "[/c]");
writeEOL(fw);
}
else
{
writeString(fw, "cl:>mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.doDestroy()");
writeEOL(fw);
}
}
else
{
writeString(fw, "cl:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.doDestroy()");
writeEOL(fw);
}
break;
case TraceEvent.RETURN_INTERLEAVING_CONNECTION_LISTENER:
writeString(fw, "cl:mcp." + TraceEvent.asText(te));
writeEOL(fw);
break;
case TraceEvent.RETURN_INTERLEAVING_CONNECTION_LISTENER_WITH_KILL:
writeString(fw, "cl:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.doDestroy()");
writeEOL(fw);
break;
case TraceEvent.CLEAR_CONNECTION_LISTENER:
break;
case TraceEvent.ENLIST_CONNECTION_LISTENER:
case TraceEvent.ENLIST_CONNECTION_LISTENER_FAILED:
writeString(fw, "cl:tx." + TraceEvent.asText(te));
writeEOL(fw);
if (!newSync)
{
writeString(fw, "cl:sync.new()");
writeEOL(fw);
newSync = true;
}
else
{
writeString(fw, "cl:sync.register()");
writeEOL(fw);
}
writeString(fw, "sync:tx.registerInterposed()");
writeEOL(fw);
break;
case TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER:
case TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER_FAILED:
writeString(fw, "cl:tx." + TraceEvent.asText(te));
writeEOL(fw);
break;
case TraceEvent.DELIST_CONNECTION_LISTENER:
case TraceEvent.DELIST_CONNECTION_LISTENER_FAILED:
if (connections.size() == 0)
delist = true;
writeString(fw, "[c beforeCompletion]");
writeEOL(fw);
writeString(fw, "cl:>sync.<free>");
writeEOL(fw);
writeString(fw, "sync:tx." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "[/c]");
writeEOL(fw);
if (!delist)
{
writeString(fw, "[c afterCompletion]");
writeEOL(fw);
writeString(fw, "sync:>cl.<noReturn>");
writeEOL(fw);
writeString(fw, "[/c]");
writeEOL(fw);
}
break;
case TraceEvent.DELIST_INTERLEAVING_CONNECTION_LISTENER:
case TraceEvent.DELIST_INTERLEAVING_CONNECTION_LISTENER_FAILED:
if (connections.size() == 0)
delist = true;
writeString(fw, "cl:tx." + TraceEvent.asText(te));
writeEOL(fw);
break;
case TraceEvent.DELIST_ROLLEDBACK_CONNECTION_LISTENER:
case TraceEvent.DELIST_ROLLEDBACK_CONNECTION_LISTENER_FAILED:
writeString(fw, "[c afterCompletion]");
writeEOL(fw);
writeString(fw, "cl:>sync.<rollback>");
writeEOL(fw);
writeString(fw, "sync:tx." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "[/c]");
writeEOL(fw);
break;
case TraceEvent.GET_CONNECTION:
connections.add(te.getPayload1());
writeString(fw, "application:cl." + TraceEvent.asText(te));
writeEOL(fw);
break;
case TraceEvent.RETURN_CONNECTION:
connections.remove(te.getPayload1());
if (TraceEventHelper.hasMoreApplicationEvents(events, i + 1))
{
writeString(fw, "application:cl." + TraceEvent.asText(te));
}
else
{
writeString(fw, "application:>cl." + TraceEvent.asText(te));
}
writeEOL(fw);
break;
case TraceEvent.CLEAR_CONNECTION:
break;
case TraceEvent.EXCEPTION:
break;
case TraceEvent.CREATE_CONNECTION_LISTENER_GET:
break;
case TraceEvent.CREATE_CONNECTION_LISTENER_PREFILL:
break;
case TraceEvent.CREATE_CONNECTION_LISTENER_INCREMENTER:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_RETURN:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_IDLE:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_INVALID:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_FLUSH:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_ERROR:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_PREFILL:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_INCREMENTER:
break;
case TraceEvent.MANAGED_CONNECTION_POOL_CREATE:
break;
case TraceEvent.MANAGED_CONNECTION_POOL_DESTROY:
break;
case TraceEvent.PUSH_CCM_CONTEXT:
break;
case TraceEvent.POP_CCM_CONTEXT:
break;
case TraceEvent.REGISTER_CCM_CONNECTION:
break;
case TraceEvent.UNREGISTER_CCM_CONNECTION:
break;
case TraceEvent.CCM_USER_TRANSACTION:
break;
case TraceEvent.UNKNOWN_CCM_CONNECTION:
break;
case TraceEvent.CLOSE_CCM_CONNECTION:
break;
case TraceEvent.VERSION:
break;
default:
System.err.println("SDeditGenerator: Unknown code: " + te);
}
}
} } | public class class_name {
public static void generateSDedit(List<TraceEvent> events, FileWriter fw) throws Exception
{
String connectionListener = events.get(0).getConnectionListener();
long start = events.get(0).getTimestamp();
long end = events.get(events.size() - 1).getTimestamp();
boolean newCl = false;
boolean hasTx = false;
boolean newSync = false;
boolean delist = false;
Set<String> connections = new HashSet<String>();
for (TraceEvent te : events)
{
if (te.getType() == TraceEvent.GET_CONNECTION_LISTENER_NEW ||
te.getType() == TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER_NEW)
{
newCl = true; // depends on control dependency: [if], data = [none]
}
else if (te.getType() == TraceEvent.ENLIST_CONNECTION_LISTENER ||
te.getType() == TraceEvent.ENLIST_CONNECTION_LISTENER_FAILED ||
te.getType() == TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER ||
te.getType() == TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER_FAILED)
{
hasTx = true; // depends on control dependency: [if], data = [none]
}
}
writeString(fw, "#![ConnectionListener: " + connectionListener + "]");
writeEOL(fw);
writeString(fw, "#!>>");
writeEOL(fw);
writeString(fw, "#!Start: " + start);
writeEOL(fw);
writeString(fw, "#!End : " + end);
writeEOL(fw);
writeString(fw, "#!<<");
writeEOL(fw);
writeString(fw, "application:Application[a]");
writeEOL(fw);
writeString(fw, "cm:ConnectionManager[a]");
writeEOL(fw);
writeString(fw, "pool:Pool[a]");
writeEOL(fw);
writeString(fw, "mcp:MCP[a]");
writeEOL(fw);
if (!newCl)
{
writeString(fw, "cl:ConnectionListener[a]");
writeEOL(fw);
}
else
{
writeString(fw, "/cl:ConnectionListener[a]");
writeEOL(fw);
}
if (hasTx)
{
writeString(fw, "tx:Transaction[a]");
writeEOL(fw);
writeString(fw, "/sync:Synchronization[a,x]");
writeEOL(fw);
}
writeEOL(fw);
for (int i = 0; i < events.size(); i++)
{
TraceEvent te = events.get(i);
switch (te.getType())
{
case TraceEvent.GET_CONNECTION_LISTENER:
writeString(fw, "application:cm.allocateConnection()");
writeEOL(fw);
writeString(fw, "cm:pool.getConnection()");
writeEOL(fw);
writeString(fw, "pool:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.get()");
writeEOL(fw);
break;
case TraceEvent.GET_CONNECTION_LISTENER_NEW:
writeString(fw, "application:cm.allocateConnection()");
writeEOL(fw);
writeString(fw, "cm:pool.getConnection()");
writeEOL(fw);
writeString(fw, "pool:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.new()");
writeEOL(fw);
break;
case TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER:
writeString(fw, "application:cm.allocateConnection()");
writeEOL(fw);
writeString(fw, "cm:pool.getConnection()");
writeEOL(fw);
writeString(fw, "pool:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.get()");
writeEOL(fw);
break;
case TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER_NEW:
writeString(fw, "application:cm.allocateConnection()");
writeEOL(fw);
writeString(fw, "cm:pool.getConnection()");
writeEOL(fw);
writeString(fw, "pool:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.new()");
writeEOL(fw);
break;
case TraceEvent.RETURN_CONNECTION_LISTENER:
if (hasTx)
{
if (delist)
{
writeString(fw, "[c afterCompletion]"); // depends on control dependency: [if], data = [none]
writeEOL(fw); // depends on control dependency: [if], data = [none]
writeString(fw, "sync:mcp." + TraceEvent.asText(te)); // depends on control dependency: [if], data = [none]
writeEOL(fw); // depends on control dependency: [if], data = [none]
writeString(fw, "[/c]"); // depends on control dependency: [if], data = [none]
writeEOL(fw); // depends on control dependency: [if], data = [none]
}
else
{
writeString(fw, "cl:mcp." + TraceEvent.asText(te)); // depends on control dependency: [if], data = [none]
writeEOL(fw); // depends on control dependency: [if], data = [none]
}
}
else
{
writeString(fw, "cl:mcp." + TraceEvent.asText(te));
writeEOL(fw);
}
break;
case TraceEvent.RETURN_CONNECTION_LISTENER_WITH_KILL:
if (hasTx)
{
if (delist)
{
writeString(fw, "[c afterCompletion]");
writeEOL(fw);
writeString(fw, "sync:>mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.doDestroy()");
writeEOL(fw);
writeString(fw, "[/c]");
writeEOL(fw);
}
else
{
writeString(fw, "cl:>mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.doDestroy()");
writeEOL(fw);
}
}
else
{
writeString(fw, "cl:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.doDestroy()");
writeEOL(fw);
}
break;
case TraceEvent.RETURN_INTERLEAVING_CONNECTION_LISTENER:
writeString(fw, "cl:mcp." + TraceEvent.asText(te));
writeEOL(fw);
break;
case TraceEvent.RETURN_INTERLEAVING_CONNECTION_LISTENER_WITH_KILL:
writeString(fw, "cl:mcp." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "mcp:cl.doDestroy()");
writeEOL(fw);
break;
case TraceEvent.CLEAR_CONNECTION_LISTENER:
break;
case TraceEvent.ENLIST_CONNECTION_LISTENER:
case TraceEvent.ENLIST_CONNECTION_LISTENER_FAILED:
writeString(fw, "cl:tx." + TraceEvent.asText(te));
writeEOL(fw);
if (!newSync)
{
writeString(fw, "cl:sync.new()");
writeEOL(fw);
newSync = true;
}
else
{
writeString(fw, "cl:sync.register()");
writeEOL(fw);
}
writeString(fw, "sync:tx.registerInterposed()");
writeEOL(fw);
break;
case TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER:
case TraceEvent.ENLIST_INTERLEAVING_CONNECTION_LISTENER_FAILED:
writeString(fw, "cl:tx." + TraceEvent.asText(te));
writeEOL(fw);
break;
case TraceEvent.DELIST_CONNECTION_LISTENER:
case TraceEvent.DELIST_CONNECTION_LISTENER_FAILED:
if (connections.size() == 0)
delist = true;
writeString(fw, "[c beforeCompletion]");
writeEOL(fw);
writeString(fw, "cl:>sync.<free>");
writeEOL(fw);
writeString(fw, "sync:tx." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "[/c]");
writeEOL(fw);
if (!delist)
{
writeString(fw, "[c afterCompletion]");
writeEOL(fw);
writeString(fw, "sync:>cl.<noReturn>");
writeEOL(fw);
writeString(fw, "[/c]");
writeEOL(fw);
}
break;
case TraceEvent.DELIST_INTERLEAVING_CONNECTION_LISTENER:
case TraceEvent.DELIST_INTERLEAVING_CONNECTION_LISTENER_FAILED:
if (connections.size() == 0)
delist = true;
writeString(fw, "cl:tx." + TraceEvent.asText(te));
writeEOL(fw);
break;
case TraceEvent.DELIST_ROLLEDBACK_CONNECTION_LISTENER:
case TraceEvent.DELIST_ROLLEDBACK_CONNECTION_LISTENER_FAILED:
writeString(fw, "[c afterCompletion]");
writeEOL(fw);
writeString(fw, "cl:>sync.<rollback>");
writeEOL(fw);
writeString(fw, "sync:tx." + TraceEvent.asText(te));
writeEOL(fw);
writeString(fw, "[/c]");
writeEOL(fw);
break;
case TraceEvent.GET_CONNECTION:
connections.add(te.getPayload1());
writeString(fw, "application:cl." + TraceEvent.asText(te));
writeEOL(fw);
break;
case TraceEvent.RETURN_CONNECTION:
connections.remove(te.getPayload1());
if (TraceEventHelper.hasMoreApplicationEvents(events, i + 1))
{
writeString(fw, "application:cl." + TraceEvent.asText(te));
}
else
{
writeString(fw, "application:>cl." + TraceEvent.asText(te));
}
writeEOL(fw);
break;
case TraceEvent.CLEAR_CONNECTION:
break;
case TraceEvent.EXCEPTION:
break;
case TraceEvent.CREATE_CONNECTION_LISTENER_GET:
break;
case TraceEvent.CREATE_CONNECTION_LISTENER_PREFILL:
break;
case TraceEvent.CREATE_CONNECTION_LISTENER_INCREMENTER:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_RETURN:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_IDLE:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_INVALID:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_FLUSH:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_ERROR:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_PREFILL:
break;
case TraceEvent.DESTROY_CONNECTION_LISTENER_INCREMENTER:
break;
case TraceEvent.MANAGED_CONNECTION_POOL_CREATE:
break;
case TraceEvent.MANAGED_CONNECTION_POOL_DESTROY:
break;
case TraceEvent.PUSH_CCM_CONTEXT:
break;
case TraceEvent.POP_CCM_CONTEXT:
break;
case TraceEvent.REGISTER_CCM_CONNECTION:
break;
case TraceEvent.UNREGISTER_CCM_CONNECTION:
break;
case TraceEvent.CCM_USER_TRANSACTION:
break;
case TraceEvent.UNKNOWN_CCM_CONNECTION:
break;
case TraceEvent.CLOSE_CCM_CONNECTION:
break;
case TraceEvent.VERSION:
break;
default:
System.err.println("SDeditGenerator: Unknown code: " + te);
}
}
} } |
public class class_name {
public void marshall(NumberAttributeConstraintsType numberAttributeConstraintsType, ProtocolMarshaller protocolMarshaller) {
if (numberAttributeConstraintsType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(numberAttributeConstraintsType.getMinValue(), MINVALUE_BINDING);
protocolMarshaller.marshall(numberAttributeConstraintsType.getMaxValue(), MAXVALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(NumberAttributeConstraintsType numberAttributeConstraintsType, ProtocolMarshaller protocolMarshaller) {
if (numberAttributeConstraintsType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(numberAttributeConstraintsType.getMinValue(), MINVALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(numberAttributeConstraintsType.getMaxValue(), MAXVALUE_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 JPanel getJPanel2() {
if (jPanel2 == null) {
jPanel2 = new JPanel();
jPanel2.add(getBtnAccept(), null);
jPanel2.add(getBtnDecline(), null);
}
return jPanel2;
} } | public class class_name {
private JPanel getJPanel2() {
if (jPanel2 == null) {
jPanel2 = new JPanel();
// depends on control dependency: [if], data = [none]
jPanel2.add(getBtnAccept(), null);
// depends on control dependency: [if], data = [null)]
jPanel2.add(getBtnDecline(), null);
// depends on control dependency: [if], data = [null)]
}
return jPanel2;
} } |
public class class_name {
public static void fractionalToCartesian(ICrystal crystal) {
Iterator<IAtom> atoms = crystal.atoms().iterator();
Vector3d aAxis = crystal.getA();
Vector3d bAxis = crystal.getB();
Vector3d cAxis = crystal.getC();
while (atoms.hasNext()) {
IAtom atom = atoms.next();
Point3d fracPoint = atom.getFractionalPoint3d();
if (fracPoint != null) {
atom.setPoint3d(fractionalToCartesian(aAxis, bAxis, cAxis, fracPoint));
}
}
} } | public class class_name {
public static void fractionalToCartesian(ICrystal crystal) {
Iterator<IAtom> atoms = crystal.atoms().iterator();
Vector3d aAxis = crystal.getA();
Vector3d bAxis = crystal.getB();
Vector3d cAxis = crystal.getC();
while (atoms.hasNext()) {
IAtom atom = atoms.next();
Point3d fracPoint = atom.getFractionalPoint3d();
if (fracPoint != null) {
atom.setPoint3d(fractionalToCartesian(aAxis, bAxis, cAxis, fracPoint)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static String newQualifiedClassName(final String packageName, final String className)
{
if (StringUtils.isBlank(packageName))
{
return className;
}
return new StringBuilder().append(packageName).append(SeparatorConstants.DOT)
.append(className).toString();
} } | public class class_name {
public static String newQualifiedClassName(final String packageName, final String className)
{
if (StringUtils.isBlank(packageName))
{
return className;
// depends on control dependency: [if], data = [none]
}
return new StringBuilder().append(packageName).append(SeparatorConstants.DOT)
.append(className).toString();
} } |
public class class_name {
public ObjectEnvelope get(Identity oid, Object pKey, boolean isNew)
{
ObjectEnvelope result = getByIdentity(oid);
if(result == null)
{
result = new ObjectEnvelope(this, oid, pKey, isNew);
mhtObjectEnvelopes.put(oid, result);
mvOrderOfIds.add(oid);
if(log.isDebugEnabled())
log.debug("register: " + result);
}
return result;
} } | public class class_name {
public ObjectEnvelope get(Identity oid, Object pKey, boolean isNew)
{
ObjectEnvelope result = getByIdentity(oid);
if(result == null)
{
result = new ObjectEnvelope(this, oid, pKey, isNew);
// depends on control dependency: [if], data = [none]
mhtObjectEnvelopes.put(oid, result);
// depends on control dependency: [if], data = [none]
mvOrderOfIds.add(oid);
// depends on control dependency: [if], data = [none]
if(log.isDebugEnabled())
log.debug("register: " + result);
}
return result;
} } |
public class class_name {
private void parsePattern(String pattern){
int currentIndex = 0;
int patternLength = pattern.length();
Vector<FormatCommandInterface> converterVector = new Vector<FormatCommandInterface>(20);
while (currentIndex < patternLength) {
char currentChar = pattern.charAt(currentIndex);
if (currentChar == '%') {
currentIndex++;
currentChar = pattern.charAt(currentIndex);
switch (currentChar) {
case CLIENT_ID_CONVERSION_CHAR:
converterVector.addElement(new ClientIdFormatCommand());
break;
case CATEGORY_CONVERSION_CHAR:
CategoryFormatCommand categoryFormatCommand = new CategoryFormatCommand();
String specifier = extraxtSpecifier(pattern, currentIndex);
int specifierLength = specifier.length();
if (specifierLength > 0) {
categoryFormatCommand.init(specifier);
currentIndex = currentIndex + specifierLength + 2;
}
converterVector.addElement(categoryFormatCommand);
break;
case DATE_CONVERSION_CHAR:
DateFormatCommand formatCommand = new DateFormatCommand();
specifier = extraxtSpecifier(pattern, currentIndex);
specifierLength = specifier.length();
if (specifierLength > 0) {
formatCommand.init(specifier);
currentIndex = currentIndex + specifierLength + 2;
}
converterVector.addElement(formatCommand);
break;
case MESSAGE_CONVERSION_CHAR:
converterVector.addElement(new MessageFormatCommand());
break;
case PRIORITY_CONVERSION_CHAR:
converterVector.addElement(new PriorityFormatCommand());
break;
case RELATIVE_TIME_CONVERSION_CHAR:
converterVector.addElement(new TimeFormatCommand());
break;
case THREAD_CONVERSION_CHAR:
converterVector.addElement(new ThreadFormatCommand());
break;
case THROWABLE_CONVERSION_CHAR:
converterVector.addElement(new ThrowableFormatCommand());
break;
case PERCENT_CONVERSION_CHAR:
NoFormatCommand noFormatCommand = new NoFormatCommand();
noFormatCommand.init("%");
converterVector.addElement(noFormatCommand);
break;
default:
Log.e(TAG, "Unrecognized conversion character " + currentChar);
break;
}
currentIndex++;
} else {
int percentIndex = pattern.indexOf("%", currentIndex);
String noFormatString = "";
if (percentIndex != -1) {
noFormatString = pattern.substring(currentIndex, percentIndex);
} else {
noFormatString = pattern.substring(currentIndex, patternLength);
}
NoFormatCommand noFormatCommand = new NoFormatCommand();
noFormatCommand.init(noFormatString);
converterVector.addElement(noFormatCommand);
currentIndex = currentIndex + noFormatString.length();
}
}
commandArray = new FormatCommandInterface[converterVector.size()];
converterVector.copyInto(commandArray);
patternParsed = true;
} } | public class class_name {
private void parsePattern(String pattern){
int currentIndex = 0;
int patternLength = pattern.length();
Vector<FormatCommandInterface> converterVector = new Vector<FormatCommandInterface>(20);
while (currentIndex < patternLength) {
char currentChar = pattern.charAt(currentIndex);
if (currentChar == '%') {
currentIndex++; // depends on control dependency: [if], data = [none]
currentChar = pattern.charAt(currentIndex); // depends on control dependency: [if], data = [none]
switch (currentChar) {
case CLIENT_ID_CONVERSION_CHAR:
converterVector.addElement(new ClientIdFormatCommand());
break;
case CATEGORY_CONVERSION_CHAR:
CategoryFormatCommand categoryFormatCommand = new CategoryFormatCommand();
String specifier = extraxtSpecifier(pattern, currentIndex);
int specifierLength = specifier.length();
if (specifierLength > 0) {
categoryFormatCommand.init(specifier); // depends on control dependency: [if], data = [none]
currentIndex = currentIndex + specifierLength + 2; // depends on control dependency: [if], data = [none]
}
converterVector.addElement(categoryFormatCommand);
break;
case DATE_CONVERSION_CHAR:
DateFormatCommand formatCommand = new DateFormatCommand();
specifier = extraxtSpecifier(pattern, currentIndex);
specifierLength = specifier.length();
if (specifierLength > 0) {
formatCommand.init(specifier); // depends on control dependency: [if], data = [none]
currentIndex = currentIndex + specifierLength + 2; // depends on control dependency: [if], data = [none]
}
converterVector.addElement(formatCommand);
break;
case MESSAGE_CONVERSION_CHAR:
converterVector.addElement(new MessageFormatCommand());
break;
case PRIORITY_CONVERSION_CHAR:
converterVector.addElement(new PriorityFormatCommand());
break;
case RELATIVE_TIME_CONVERSION_CHAR:
converterVector.addElement(new TimeFormatCommand());
break;
case THREAD_CONVERSION_CHAR:
converterVector.addElement(new ThreadFormatCommand());
break;
case THROWABLE_CONVERSION_CHAR:
converterVector.addElement(new ThrowableFormatCommand());
break;
case PERCENT_CONVERSION_CHAR:
NoFormatCommand noFormatCommand = new NoFormatCommand();
noFormatCommand.init("%");
converterVector.addElement(noFormatCommand);
break;
default:
Log.e(TAG, "Unrecognized conversion character " + currentChar);
break;
}
currentIndex++; // depends on control dependency: [if], data = [none]
} else {
int percentIndex = pattern.indexOf("%", currentIndex);
String noFormatString = "";
if (percentIndex != -1) {
noFormatString = pattern.substring(currentIndex, percentIndex); // depends on control dependency: [if], data = [none]
} else {
noFormatString = pattern.substring(currentIndex, patternLength); // depends on control dependency: [if], data = [none]
}
NoFormatCommand noFormatCommand = new NoFormatCommand();
noFormatCommand.init(noFormatString); // depends on control dependency: [if], data = [none]
converterVector.addElement(noFormatCommand); // depends on control dependency: [if], data = [none]
currentIndex = currentIndex + noFormatString.length(); // depends on control dependency: [if], data = [none]
}
}
commandArray = new FormatCommandInterface[converterVector.size()];
converterVector.copyInto(commandArray);
patternParsed = true;
} } |
public class class_name {
public boolean isAssignableTo(TypeDescriptor typeDescriptor) {
boolean typesAssignable = typeDescriptor.getObjectType().isAssignableFrom(getObjectType());
if (!typesAssignable) {
return false;
}
if (isArray() && typeDescriptor.isArray()) {
return getElementTypeDescriptor().isAssignableTo(typeDescriptor.getElementTypeDescriptor());
}
else if (isCollection() && typeDescriptor.isCollection()) {
return isNestedAssignable(getElementTypeDescriptor(), typeDescriptor.getElementTypeDescriptor());
}
else if (isMap() && typeDescriptor.isMap()) {
return isNestedAssignable(getMapKeyTypeDescriptor(), typeDescriptor.getMapKeyTypeDescriptor()) &&
isNestedAssignable(getMapValueTypeDescriptor(), typeDescriptor.getMapValueTypeDescriptor());
}
else {
return true;
}
} } | public class class_name {
public boolean isAssignableTo(TypeDescriptor typeDescriptor) {
boolean typesAssignable = typeDescriptor.getObjectType().isAssignableFrom(getObjectType());
if (!typesAssignable) {
return false; // depends on control dependency: [if], data = [none]
}
if (isArray() && typeDescriptor.isArray()) {
return getElementTypeDescriptor().isAssignableTo(typeDescriptor.getElementTypeDescriptor()); // depends on control dependency: [if], data = [none]
}
else if (isCollection() && typeDescriptor.isCollection()) {
return isNestedAssignable(getElementTypeDescriptor(), typeDescriptor.getElementTypeDescriptor()); // depends on control dependency: [if], data = [none]
}
else if (isMap() && typeDescriptor.isMap()) {
return isNestedAssignable(getMapKeyTypeDescriptor(), typeDescriptor.getMapKeyTypeDescriptor()) &&
isNestedAssignable(getMapValueTypeDescriptor(), typeDescriptor.getMapValueTypeDescriptor()); // depends on control dependency: [if], data = [none]
}
else {
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void addIntermediary(AbstractPlanNode node) {
// transfer this node's children to node
Iterator<AbstractPlanNode> it = m_children.iterator();
while (it.hasNext()) {
AbstractPlanNode child = it.next();
it.remove(); // remove this.child from m_children
assert child.getParentCount() == 1;
child.clearParents(); // and reset child's parents list
node.addAndLinkChild(child); // set node.child and child.parent
}
// and add node to this node's children
assert(m_children.size() == 0);
addAndLinkChild(node);
} } | public class class_name {
public void addIntermediary(AbstractPlanNode node) {
// transfer this node's children to node
Iterator<AbstractPlanNode> it = m_children.iterator();
while (it.hasNext()) {
AbstractPlanNode child = it.next();
it.remove(); // remove this.child from m_children // depends on control dependency: [while], data = [none]
assert child.getParentCount() == 1;
child.clearParents(); // and reset child's parents list // depends on control dependency: [while], data = [none]
node.addAndLinkChild(child); // set node.child and child.parent // depends on control dependency: [while], data = [none]
}
// and add node to this node's children
assert(m_children.size() == 0);
addAndLinkChild(node);
} } |
public class class_name {
public InitParamType<FilterType<T>> getOrCreateInitParam()
{
List<Node> nodeList = childNode.get("init-param");
if (nodeList != null && nodeList.size() > 0)
{
return new InitParamTypeImpl<FilterType<T>>(this, "init-param", childNode, nodeList.get(0));
}
return createInitParam();
} } | public class class_name {
public InitParamType<FilterType<T>> getOrCreateInitParam()
{
List<Node> nodeList = childNode.get("init-param");
if (nodeList != null && nodeList.size() > 0)
{
return new InitParamTypeImpl<FilterType<T>>(this, "init-param", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createInitParam();
} } |
public class class_name {
public static char[] values(Character[] array) {
char[] dest = new char[array.length];
for (int i = 0; i < array.length; i++) {
Character v = array[i];
if (v != null) {
dest[i] = v.charValue();
}
}
return dest;
} } | public class class_name {
public static char[] values(Character[] array) {
char[] dest = new char[array.length];
for (int i = 0; i < array.length; i++) {
Character v = array[i];
if (v != null) {
dest[i] = v.charValue(); // depends on control dependency: [if], data = [none]
}
}
return dest;
} } |
public class class_name {
public Years plus(int years) {
if (years == 0) {
return this;
}
return Years.years(FieldUtils.safeAdd(getValue(), years));
} } | public class class_name {
public Years plus(int years) {
if (years == 0) {
return this; // depends on control dependency: [if], data = [none]
}
return Years.years(FieldUtils.safeAdd(getValue(), years));
} } |
public class class_name {
private static int skipPatternWhiteSpace(String text, int pos) {
while (pos < text.length()) {
int c = UTF16.charAt(text, pos);
if (!PatternProps.isWhiteSpace(c)) {
break;
}
pos += UTF16.getCharCount(c);
}
return pos;
} } | public class class_name {
private static int skipPatternWhiteSpace(String text, int pos) {
while (pos < text.length()) {
int c = UTF16.charAt(text, pos);
if (!PatternProps.isWhiteSpace(c)) {
break;
}
pos += UTF16.getCharCount(c); // depends on control dependency: [while], data = [none]
}
return pos;
} } |
public class class_name {
public static Status loadBodyOfRevisionObject(RevisionInternal rev, Document doc) {
try {
rev.setSequence(doc.getSelectedSequence());
doc.selectRevID(rev.getRevID(), true);
rev.setJSON(doc.getSelectedBody());
return new Status(Status.OK);
} catch (ForestException ex) {
rev.setMissing(true);
return err2status(ex);
}
} } | public class class_name {
public static Status loadBodyOfRevisionObject(RevisionInternal rev, Document doc) {
try {
rev.setSequence(doc.getSelectedSequence()); // depends on control dependency: [try], data = [none]
doc.selectRevID(rev.getRevID(), true); // depends on control dependency: [try], data = [none]
rev.setJSON(doc.getSelectedBody()); // depends on control dependency: [try], data = [none]
return new Status(Status.OK); // depends on control dependency: [try], data = [none]
} catch (ForestException ex) {
rev.setMissing(true);
return err2status(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public Object convertRequest(ServiceRequestContext ctx, AggregatedHttpMessage request,
Class<?> expectedResultType) throws Exception {
final String ifNoneMatch = request.headers().get(HttpHeaderNames.IF_NONE_MATCH);
if (!isNullOrEmpty(ifNoneMatch)) {
final Revision lastKnownRevision = new Revision(ifNoneMatch);
final String prefer = request.headers().get(HttpHeaderNames.PREFER);
final long timeoutMillis;
if (!isNullOrEmpty(prefer)) {
timeoutMillis = getTimeoutMillis(prefer);
} else {
timeoutMillis = DEFAULT_TIMEOUT_MILLIS;
}
// Update timeout according to the watch API specifications.
ctx.setRequestTimeoutMillis(
WatchTimeout.makeReasonable(timeoutMillis, ctx.requestTimeoutMillis()));
return Optional.of(new WatchRequest(lastKnownRevision, timeoutMillis));
}
return Optional.empty();
} } | public class class_name {
@Override
public Object convertRequest(ServiceRequestContext ctx, AggregatedHttpMessage request,
Class<?> expectedResultType) throws Exception {
final String ifNoneMatch = request.headers().get(HttpHeaderNames.IF_NONE_MATCH);
if (!isNullOrEmpty(ifNoneMatch)) {
final Revision lastKnownRevision = new Revision(ifNoneMatch);
final String prefer = request.headers().get(HttpHeaderNames.PREFER);
final long timeoutMillis;
if (!isNullOrEmpty(prefer)) {
timeoutMillis = getTimeoutMillis(prefer); // depends on control dependency: [if], data = [none]
} else {
timeoutMillis = DEFAULT_TIMEOUT_MILLIS; // depends on control dependency: [if], data = [none]
}
// Update timeout according to the watch API specifications.
ctx.setRequestTimeoutMillis(
WatchTimeout.makeReasonable(timeoutMillis, ctx.requestTimeoutMillis()));
return Optional.of(new WatchRequest(lastKnownRevision, timeoutMillis));
}
return Optional.empty();
} } |
public class class_name {
static String unescape(final String text) {
if (text == null) {
return null;
}
StringBuilder strBuilder = null;
final int offset = 0;
final int max = text.length();
int readOffset = offset;
int referenceOffset = offset;
for (int i = offset; i < max; i++) {
final char c = text.charAt(i);
/*
* Check the need for an unescape operation at this point
*/
if (c != ESCAPE_PREFIX || (i + 1) >= max) {
continue;
}
int codepoint = -1;
if (c == ESCAPE_PREFIX) {
final char c1 = text.charAt(i + 1);
switch (c1) {
// line feed. When escaped, this is a line continuator
case '\n': codepoint = -2; referenceOffset = i + 1; break;
case ' ':
case '!':
case '"':
case '#':
case '$':
case '%':
case '&':
case '\'':
case '(':
case ')':
case '*':
case '+':
case ',':
// hyphen: will only be escaped when identifer starts with '--' or '-{digit}'
case '-':
case '.':
case '/':
// colon: will not be used for escaping: not recognized by IE < 8
case ':':
case ';':
case '<':
case '=':
case '>':
case '?':
case '@':
case '[':
case '\\':
case ']':
case '^':
// underscore: will only be escaped at the beginning of an identifier (in order to avoid issues in IE6)
case '_':
case '`':
case '{':
case '|':
case '}':
case '~': codepoint = (int)c1; referenceOffset = i + 1; break;
}
if (codepoint == -1) {
if ((c1 >= '0' && c1 <= '9') || (c1 >= 'A' && c1 <= 'F') || (c1 >= 'a' && c1 <= 'f')) {
// This is a hexa escape
int f = i + 2;
while (f < (i + 7) && f < max) {
final char cf = text.charAt(f);
if (!((cf >= '0' && cf <= '9') || (cf >= 'A' && cf <= 'F') || (cf >= 'a' && cf <= 'f'))) {
break;
}
f++;
}
codepoint = parseIntFromReference(text, i + 1, f, 16);
// Fast-forward to the first char after the parsed codepoint
referenceOffset = f - 1;
// If there is a whitespace after the escape, just ignore it.
if (f < max && text.charAt(f) == ' ') {
referenceOffset++;
}
// Don't continue here, just let the unescape code below do its job
} else if (c1 == '\r' || c1 == '\f') {
// The only characters that cannot be escaped by means of a backslash are
// carriage return and form feed (besides hexadecimal digits).
i++;
continue;
} else {
// We weren't able to consume any valid escape chars, just consider it a normal char,
// which is allowed by the CSS escape syntax.
codepoint = (int) c1;
referenceOffset = i + 1;
}
}
}
/*
* At this point we know for sure we will need some kind of unescape, so we
* can increase the offset and initialize the string builder if needed, along with
* copying to it all the contents pending up to this point.
*/
if (strBuilder == null) {
strBuilder = new StringBuilder(max + 5);
}
if (i - readOffset > 0) {
strBuilder.append(text, readOffset, i);
}
i = referenceOffset;
readOffset = i + 1;
/*
* --------------------------
*
* Perform the real unescape
*
* --------------------------
*/
if (codepoint > '\uFFFF') {
strBuilder.append(Character.toChars(codepoint));
} else if (codepoint != -2){ // We use -2 to signal the line continuator, which should be ignored in output
strBuilder.append((char)codepoint);
}
}
/*
* -----------------------------------------------------------------------------------------------
* Final cleaning: return the original String object if no unescape was actually needed. Otherwise
* append the remaining escaped text to the string builder and return.
* -----------------------------------------------------------------------------------------------
*/
if (strBuilder == null) {
return text;
}
if (max - readOffset > 0) {
strBuilder.append(text, readOffset, max);
}
return strBuilder.toString();
} } | public class class_name {
static String unescape(final String text) {
if (text == null) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuilder strBuilder = null;
final int offset = 0;
final int max = text.length();
int readOffset = offset;
int referenceOffset = offset;
for (int i = offset; i < max; i++) {
final char c = text.charAt(i);
/*
* Check the need for an unescape operation at this point
*/
if (c != ESCAPE_PREFIX || (i + 1) >= max) {
continue;
}
int codepoint = -1;
if (c == ESCAPE_PREFIX) {
final char c1 = text.charAt(i + 1);
switch (c1) {
// line feed. When escaped, this is a line continuator
case '\n': codepoint = -2; referenceOffset = i + 1; break;
case ' ':
case '!':
case '"':
case '#':
case '$':
case '%':
case '&':
case '\'':
case '(':
case ')':
case '*':
case '+':
case ',':
// hyphen: will only be escaped when identifer starts with '--' or '-{digit}'
case '-':
case '.':
case '/':
// colon: will not be used for escaping: not recognized by IE < 8
case ':':
case ';':
case '<':
case '=':
case '>':
case '?':
case '@':
case '[':
case '\\':
case ']':
case '^':
// underscore: will only be escaped at the beginning of an identifier (in order to avoid issues in IE6)
case '_':
case '`':
case '{':
case '|':
case '}':
case '~': codepoint = (int)c1; referenceOffset = i + 1; break;
}
if (codepoint == -1) {
if ((c1 >= '0' && c1 <= '9') || (c1 >= 'A' && c1 <= 'F') || (c1 >= 'a' && c1 <= 'f')) {
// This is a hexa escape
int f = i + 2;
while (f < (i + 7) && f < max) {
final char cf = text.charAt(f);
if (!((cf >= '0' && cf <= '9') || (cf >= 'A' && cf <= 'F') || (cf >= 'a' && cf <= 'f'))) {
break;
}
f++; // depends on control dependency: [while], data = [none]
}
codepoint = parseIntFromReference(text, i + 1, f, 16); // depends on control dependency: [if], data = [none]
// Fast-forward to the first char after the parsed codepoint
referenceOffset = f - 1; // depends on control dependency: [if], data = [none]
// If there is a whitespace after the escape, just ignore it.
if (f < max && text.charAt(f) == ' ') {
referenceOffset++; // depends on control dependency: [if], data = [none]
}
// Don't continue here, just let the unescape code below do its job
} else if (c1 == '\r' || c1 == '\f') {
// The only characters that cannot be escaped by means of a backslash are
// carriage return and form feed (besides hexadecimal digits).
i++; // depends on control dependency: [if], data = [none]
continue;
} else {
// We weren't able to consume any valid escape chars, just consider it a normal char,
// which is allowed by the CSS escape syntax.
codepoint = (int) c1; // depends on control dependency: [if], data = [none]
referenceOffset = i + 1; // depends on control dependency: [if], data = [none]
}
}
}
/*
* At this point we know for sure we will need some kind of unescape, so we
* can increase the offset and initialize the string builder if needed, along with
* copying to it all the contents pending up to this point.
*/
if (strBuilder == null) {
strBuilder = new StringBuilder(max + 5); // depends on control dependency: [if], data = [none]
}
if (i - readOffset > 0) {
strBuilder.append(text, readOffset, i); // depends on control dependency: [if], data = [none]
}
i = referenceOffset; // depends on control dependency: [for], data = [i]
readOffset = i + 1; // depends on control dependency: [for], data = [i]
/*
* --------------------------
*
* Perform the real unescape
*
* --------------------------
*/
if (codepoint > '\uFFFF') {
strBuilder.append(Character.toChars(codepoint)); // depends on control dependency: [if], data = [(codepoint]
} else if (codepoint != -2){ // We use -2 to signal the line continuator, which should be ignored in output
strBuilder.append((char)codepoint); // depends on control dependency: [if], data = [none]
}
}
/*
* -----------------------------------------------------------------------------------------------
* Final cleaning: return the original String object if no unescape was actually needed. Otherwise
* append the remaining escaped text to the string builder and return.
* -----------------------------------------------------------------------------------------------
*/
if (strBuilder == null) {
return text; // depends on control dependency: [if], data = [none]
}
if (max - readOffset > 0) {
strBuilder.append(text, readOffset, max); // depends on control dependency: [if], data = [none]
}
return strBuilder.toString();
} } |
public class class_name {
public void setAttributeKeys(java.util.Collection<String> attributeKeys) {
if (attributeKeys == null) {
this.attributeKeys = null;
return;
}
this.attributeKeys = new java.util.ArrayList<String>(attributeKeys);
} } | public class class_name {
public void setAttributeKeys(java.util.Collection<String> attributeKeys) {
if (attributeKeys == null) {
this.attributeKeys = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.attributeKeys = new java.util.ArrayList<String>(attributeKeys);
} } |
public class class_name {
protected String getMappedFieldName(String fieldName, @Nullable Class<?> domainType) {
if (domainType == null || mappingContext == null) {
return fieldName;
}
SolrPersistentEntity entity = mappingContext.getPersistentEntity(domainType);
if (entity == null) {
return fieldName;
}
SolrPersistentProperty property = entity.getPersistentProperty(fieldName);
return property != null ? property.getFieldName() : fieldName;
} } | public class class_name {
protected String getMappedFieldName(String fieldName, @Nullable Class<?> domainType) {
if (domainType == null || mappingContext == null) {
return fieldName; // depends on control dependency: [if], data = [none]
}
SolrPersistentEntity entity = mappingContext.getPersistentEntity(domainType);
if (entity == null) {
return fieldName; // depends on control dependency: [if], data = [none]
}
SolrPersistentProperty property = entity.getPersistentProperty(fieldName);
return property != null ? property.getFieldName() : fieldName;
} } |
public class class_name {
protected Object getValue(String name, Class<?> clz, Object v, ClassLoader cl) throws Exception
{
if (v instanceof String)
{
String substituredValue = getSubstitutionValue((String)v);
if (clz.equals(String.class))
{
v = substituredValue;
}
else if (clz.equals(byte.class) || clz.equals(Byte.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Byte.valueOf(substituredValue);
}
else if (clz.equals(short.class) || clz.equals(Short.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Short.valueOf(substituredValue);
}
else if (clz.equals(int.class) || clz.equals(Integer.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Integer.valueOf(substituredValue);
}
else if (clz.equals(long.class) || clz.equals(Long.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Long.valueOf(substituredValue);
}
else if (clz.equals(float.class) || clz.equals(Float.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Float.valueOf(substituredValue);
}
else if (clz.equals(double.class) || clz.equals(Double.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Double.valueOf(substituredValue);
}
else if (clz.equals(boolean.class) || clz.equals(Boolean.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Boolean.valueOf(substituredValue);
}
else if (clz.equals(char.class) || clz.equals(Character.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Character.valueOf(substituredValue.charAt(0));
}
else if (clz.equals(InetAddress.class))
{
v = InetAddress.getByName(substituredValue);
}
else if (clz.equals(Class.class))
{
v = Class.forName(substituredValue, true, cl);
}
else if (clz.equals(Properties.class))
{
Properties prop = new Properties();
StringTokenizer st = new StringTokenizer(substituredValue, " ,");
while (st.hasMoreTokens())
{
String token = st.nextToken();
String key = "";
String value = "";
int index = token.indexOf("=");
if (index != -1)
{
key = token.substring(0, index);
if (token.length() > index + 1)
value = token.substring(index + 1);
}
else
{
key = token;
}
if (!"".equals(key))
prop.setProperty(key, value);
}
v = prop;
}
else
{
try
{
Constructor<?> constructor = SecurityActions.getConstructor(clz, String.class);
v = constructor.newInstance(substituredValue);
}
catch (Throwable t)
{
// Try static String valueOf method
try
{
Method valueOf = SecurityActions.getMethod(clz, "valueOf", String.class);
v = valueOf.invoke((Object)null, substituredValue);
}
catch (Throwable inner)
{
throw new IllegalArgumentException("Unknown property resolution for property " + name);
}
}
}
}
return v;
} } | public class class_name {
protected Object getValue(String name, Class<?> clz, Object v, ClassLoader cl) throws Exception
{
if (v instanceof String)
{
String substituredValue = getSubstitutionValue((String)v);
if (clz.equals(String.class))
{
v = substituredValue; // depends on control dependency: [if], data = [none]
}
else if (clz.equals(byte.class) || clz.equals(Byte.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Byte.valueOf(substituredValue);
}
else if (clz.equals(short.class) || clz.equals(Short.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Short.valueOf(substituredValue);
}
else if (clz.equals(int.class) || clz.equals(Integer.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Integer.valueOf(substituredValue);
}
else if (clz.equals(long.class) || clz.equals(Long.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Long.valueOf(substituredValue);
}
else if (clz.equals(float.class) || clz.equals(Float.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Float.valueOf(substituredValue);
}
else if (clz.equals(double.class) || clz.equals(Double.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Double.valueOf(substituredValue);
}
else if (clz.equals(boolean.class) || clz.equals(Boolean.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Boolean.valueOf(substituredValue);
}
else if (clz.equals(char.class) || clz.equals(Character.class))
{
if (substituredValue != null && !substituredValue.trim().equals(""))
v = Character.valueOf(substituredValue.charAt(0));
}
else if (clz.equals(InetAddress.class))
{
v = InetAddress.getByName(substituredValue); // depends on control dependency: [if], data = [none]
}
else if (clz.equals(Class.class))
{
v = Class.forName(substituredValue, true, cl); // depends on control dependency: [if], data = [none]
}
else if (clz.equals(Properties.class))
{
Properties prop = new Properties();
StringTokenizer st = new StringTokenizer(substituredValue, " ,");
while (st.hasMoreTokens())
{
String token = st.nextToken();
String key = "";
String value = "";
int index = token.indexOf("=");
if (index != -1)
{
key = token.substring(0, index); // depends on control dependency: [if], data = [none]
if (token.length() > index + 1)
value = token.substring(index + 1);
}
else
{
key = token; // depends on control dependency: [if], data = [none]
}
if (!"".equals(key))
prop.setProperty(key, value);
}
v = prop; // depends on control dependency: [if], data = [none]
}
else
{
try
{
Constructor<?> constructor = SecurityActions.getConstructor(clz, String.class);
v = constructor.newInstance(substituredValue); // depends on control dependency: [try], data = [none]
}
catch (Throwable t)
{
// Try static String valueOf method
try
{
Method valueOf = SecurityActions.getMethod(clz, "valueOf", String.class);
v = valueOf.invoke((Object)null, substituredValue); // depends on control dependency: [try], data = [none]
}
catch (Throwable inner)
{
throw new IllegalArgumentException("Unknown property resolution for property " + name);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
}
}
return v;
} } |
public class class_name {
@Override
public boolean process(ContentEvent event) {
if (event instanceof InstanceContentEvent) {
InstanceContentEvent instanceEvent = (InstanceContentEvent) event;
this.processInstanceEvent(instanceEvent);
}
else if (event instanceof PredicateContentEvent) {
this.updateRuleSplitNode((PredicateContentEvent) event);
}
else if (event instanceof RuleContentEvent) {
RuleContentEvent rce = (RuleContentEvent) event;
if (rce.isRemoving()) {
this.removeRule(rce.getRuleNumberID());
}
}
return true;
} } | public class class_name {
@Override
public boolean process(ContentEvent event) {
if (event instanceof InstanceContentEvent) {
InstanceContentEvent instanceEvent = (InstanceContentEvent) event;
this.processInstanceEvent(instanceEvent); // depends on control dependency: [if], data = [none]
}
else if (event instanceof PredicateContentEvent) {
this.updateRuleSplitNode((PredicateContentEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof RuleContentEvent) {
RuleContentEvent rce = (RuleContentEvent) event;
if (rce.isRemoving()) {
this.removeRule(rce.getRuleNumberID()); // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
@Override
public final RootDocument findByFileAndString(
final String filename, final String string) {
final Query searchQuery = new Query(Criteria.where("string").is(string)
.and("filename").is(filename));
final RootDocument rootDocument = mongoTemplate.findOne(searchQuery,
RootDocumentMongo.class);
if (rootDocument == null) {
return null;
}
final Root root =
(Root) toObjConverter.createRoot(rootDocument, finder);
rootDocument.setGedObject(root);
return rootDocument;
} } | public class class_name {
@Override
public final RootDocument findByFileAndString(
final String filename, final String string) {
final Query searchQuery = new Query(Criteria.where("string").is(string)
.and("filename").is(filename));
final RootDocument rootDocument = mongoTemplate.findOne(searchQuery,
RootDocumentMongo.class);
if (rootDocument == null) {
return null; // depends on control dependency: [if], data = [none]
}
final Root root =
(Root) toObjConverter.createRoot(rootDocument, finder);
rootDocument.setGedObject(root);
return rootDocument;
} } |
public class class_name {
private void formatAll(final StringBuilder sb, final int depth) {
for (int i = 0; i < depth; i++) {
sb.append('\t');
}
format(sb);
sb.append('\n');
for (CodedMessage message : messages) {
message.formatAll(sb, depth + 1);
}
} } | public class class_name {
private void formatAll(final StringBuilder sb, final int depth) {
for (int i = 0; i < depth; i++) {
sb.append('\t');
// depends on control dependency: [for], data = [none]
}
format(sb);
sb.append('\n');
for (CodedMessage message : messages) {
message.formatAll(sb, depth + 1);
// depends on control dependency: [for], data = [message]
}
} } |
public class class_name {
protected double calculateLofWithUpdate(LofPoint recievedPoint, LofDataSet dataSet)
{
double result = 0.0d;
if (this.hasIntermediate)
{
result = LofCalculator.calculateLofWithUpdate(this.kn, this.maxDataCount,
recievedPoint, dataSet);
}
else
{
LofCalculator.addPointToDataSet(this.maxDataCount, recievedPoint, dataSet);
result = LofCalculator.calculateLofNoIntermediate(this.kn, recievedPoint, dataSet);
}
return result;
} } | public class class_name {
protected double calculateLofWithUpdate(LofPoint recievedPoint, LofDataSet dataSet)
{
double result = 0.0d;
if (this.hasIntermediate)
{
result = LofCalculator.calculateLofWithUpdate(this.kn, this.maxDataCount,
recievedPoint, dataSet); // depends on control dependency: [if], data = [none]
}
else
{
LofCalculator.addPointToDataSet(this.maxDataCount, recievedPoint, dataSet); // depends on control dependency: [if], data = [none]
result = LofCalculator.calculateLofNoIntermediate(this.kn, recievedPoint, dataSet); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static boolean isNonStaticInnerClass(Class<?> clazz) {
if (clazz.getEnclosingClass() == null) {
// no inner class
return false;
} else {
// inner class
if (clazz.getDeclaringClass() != null) {
// named inner class
return !Modifier.isStatic(clazz.getModifiers());
} else {
// anonymous inner class
return true;
}
}
} } | public class class_name {
public static boolean isNonStaticInnerClass(Class<?> clazz) {
if (clazz.getEnclosingClass() == null) {
// no inner class
return false; // depends on control dependency: [if], data = [none]
} else {
// inner class
if (clazz.getDeclaringClass() != null) {
// named inner class
return !Modifier.isStatic(clazz.getModifiers()); // depends on control dependency: [if], data = [none]
} else {
// anonymous inner class
return true; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public HandlerRegistration addChangeHandler(final ChangeHandler changeHandler) {
ValueChangeHandler valueChangeHandler = new ValueChangeHandler() {
@Override
public void onValueChange(ValueChangeEvent valueChangeEvent) {
changeHandler.onChange(null);
}
};
for(CheckBox checkBox : checkBoxes){
checkBox.addValueChangeHandler(valueChangeHandler);
}
return null;
} } | public class class_name {
@Override
public HandlerRegistration addChangeHandler(final ChangeHandler changeHandler) {
ValueChangeHandler valueChangeHandler = new ValueChangeHandler() {
@Override
public void onValueChange(ValueChangeEvent valueChangeEvent) {
changeHandler.onChange(null);
}
};
for(CheckBox checkBox : checkBoxes){
checkBox.addValueChangeHandler(valueChangeHandler); // depends on control dependency: [for], data = [checkBox]
}
return null;
} } |
public class class_name {
public void marshall(DescribeDomainRequest describeDomainRequest, ProtocolMarshaller protocolMarshaller) {
if (describeDomainRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeDomainRequest.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeDomainRequest describeDomainRequest, ProtocolMarshaller protocolMarshaller) {
if (describeDomainRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeDomainRequest.getName(), NAME_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 setExtendedProperty(String property, Object value) {
String dataType = extendedPropertiesDataType.get(property);
String valueClass = value.getClass().getSimpleName();
if (dataType.equals(valueClass) && !extendedMultiValuedProperties.contains(property)) {
extendedPropertiesValue.put(property, value);
} else if (dataType.equals(valueClass) && extendedMultiValuedProperties.contains(property)) {
if (value instanceof List) {
extendedPropertiesValue.put(property, value);
} else {
List<Object> values = (List<Object>) extendedPropertiesValue.get(property);
if (values == null) {
values = new ArrayList<Object>();
extendedPropertiesValue.put(property, values);
}
values.add(value);
}
} else {
String type = value == null ? "null" : value.getClass().getName();
String msg = "Could not set extended property for Group property '" + property + "'. " + type + " is incompatible with " + dataType;
throw new ClassCastException(msg);
}
} } | public class class_name {
private void setExtendedProperty(String property, Object value) {
String dataType = extendedPropertiesDataType.get(property);
String valueClass = value.getClass().getSimpleName();
if (dataType.equals(valueClass) && !extendedMultiValuedProperties.contains(property)) {
extendedPropertiesValue.put(property, value); // depends on control dependency: [if], data = [none]
} else if (dataType.equals(valueClass) && extendedMultiValuedProperties.contains(property)) {
if (value instanceof List) {
extendedPropertiesValue.put(property, value); // depends on control dependency: [if], data = [none]
} else {
List<Object> values = (List<Object>) extendedPropertiesValue.get(property);
if (values == null) {
values = new ArrayList<Object>(); // depends on control dependency: [if], data = [none]
extendedPropertiesValue.put(property, values); // depends on control dependency: [if], data = [none]
}
values.add(value); // depends on control dependency: [if], data = [none]
}
} else {
String type = value == null ? "null" : value.getClass().getName();
String msg = "Could not set extended property for Group property '" + property + "'. " + type + " is incompatible with " + dataType; // depends on control dependency: [if], data = [none]
throw new ClassCastException(msg);
}
} } |
public class class_name {
private boolean removeFromSplitterQueue(Block<S, L> block) {
ElementReference ref = block.getSplitterQueueReference();
if (ref == null) {
return false;
}
splitters.remove(ref);
block.setSplitterQueueReference(null);
return true;
} } | public class class_name {
private boolean removeFromSplitterQueue(Block<S, L> block) {
ElementReference ref = block.getSplitterQueueReference();
if (ref == null) {
return false; // depends on control dependency: [if], data = [none]
}
splitters.remove(ref);
block.setSplitterQueueReference(null);
return true;
} } |
public class class_name {
private static void usage(final String errorMsg) {
if (errorMsg != null && errorMsg.length() > 0) {
System.err.println("ERROR: " + errorMsg);
}
System.err.println("Usage: Import [options] <tablename> <inputdir>");
System.err.println(" Mandatory properties:");
System.err.println(" -D " + BigtableOptionsFactory.PROJECT_ID_KEY + "=<bigtable project id>");
System.err.println(" -D " + BigtableOptionsFactory.INSTANCE_ID_KEY + "=<bigtable instance id>");
System.err
.println(" To apply a generic org.apache.hadoop.hbase.filter.Filter to the input, use");
System.err.println(" -D" + FILTER_CLASS_CONF_KEY + "=<name of filter class>");
System.err.println(" -D" + FILTER_ARGS_CONF_KEY + "=<comma separated list of args for filter");
System.err.println(" NOTE: The filter will be applied BEFORE doing key renames via the "
+ CF_RENAME_PROP + " property. Futher, filters will only use the"
+ " Filter#filterRowKey(byte[] buffer, int offset, int length) method to identify "
+ " whether the current row needs to be ignored completely for processing and "
+ " Filter#filterKeyValue(KeyValue) method to determine if the KeyValue should be added;"
+ " Filter.ReturnCode#INCLUDE and #INCLUDE_AND_NEXT_COL will be considered as including"
+ " the KeyValue.");
System.err.println(" -D " + JOB_NAME_CONF_KEY
+ "=jobName - use the specified mapreduce job name for the import");
System.err.println("For performance consider the following options:\n"
+ " -Dmapreduce.map.speculative=false\n"
+ " -Dmapreduce.reduce.speculative=false\n");
} } | public class class_name {
private static void usage(final String errorMsg) {
if (errorMsg != null && errorMsg.length() > 0) {
System.err.println("ERROR: " + errorMsg); // depends on control dependency: [if], data = [none]
}
System.err.println("Usage: Import [options] <tablename> <inputdir>");
System.err.println(" Mandatory properties:");
System.err.println(" -D " + BigtableOptionsFactory.PROJECT_ID_KEY + "=<bigtable project id>");
System.err.println(" -D " + BigtableOptionsFactory.INSTANCE_ID_KEY + "=<bigtable instance id>");
System.err
.println(" To apply a generic org.apache.hadoop.hbase.filter.Filter to the input, use");
System.err.println(" -D" + FILTER_CLASS_CONF_KEY + "=<name of filter class>");
System.err.println(" -D" + FILTER_ARGS_CONF_KEY + "=<comma separated list of args for filter");
System.err.println(" NOTE: The filter will be applied BEFORE doing key renames via the "
+ CF_RENAME_PROP + " property. Futher, filters will only use the"
+ " Filter#filterRowKey(byte[] buffer, int offset, int length) method to identify "
+ " whether the current row needs to be ignored completely for processing and "
+ " Filter#filterKeyValue(KeyValue) method to determine if the KeyValue should be added;"
+ " Filter.ReturnCode#INCLUDE and #INCLUDE_AND_NEXT_COL will be considered as including"
+ " the KeyValue.");
System.err.println(" -D " + JOB_NAME_CONF_KEY
+ "=jobName - use the specified mapreduce job name for the import");
System.err.println("For performance consider the following options:\n"
+ " -Dmapreduce.map.speculative=false\n"
+ " -Dmapreduce.reduce.speculative=false\n");
} } |
public class class_name {
protected static void packIntByBits(int[] inputA, int[] inputBits, int inputIndex, int inputCount, int destPos, byte[] dest) {
int origInputIndex = inputIndex;
inputIndex = packIntByBitsToByteBoundary(inputA, inputBits, inputIndex, inputCount,
destPos, dest);
if(destPos%8 > 0) destPos = (destPos/8+1)*8;//put dest where we know it should be
if(inputIndex < 0)//done, no more to write.
return;
inputCount = inputCount - (inputIndex - origInputIndex);
inputCount = EncodedElement.compressIntArrayByBits(inputA, inputBits, inputCount, inputIndex);
assert(destPos%8 == 0);//sanity check.
if(inputCount >1) {
int stopIndex = inputCount-1;
EncodedElement.mergeFullOnByte(inputA, stopIndex, dest, destPos/8);
destPos += (stopIndex)*32;
}
if(inputCount >0) {
int index = inputCount-1;
EncodedElement.addInt_new(inputA[index], inputBits[index], destPos, dest);
destPos+=inputBits[index];
}
} } | public class class_name {
protected static void packIntByBits(int[] inputA, int[] inputBits, int inputIndex, int inputCount, int destPos, byte[] dest) {
int origInputIndex = inputIndex;
inputIndex = packIntByBitsToByteBoundary(inputA, inputBits, inputIndex, inputCount,
destPos, dest);
if(destPos%8 > 0) destPos = (destPos/8+1)*8;//put dest where we know it should be
if(inputIndex < 0)//done, no more to write.
return;
inputCount = inputCount - (inputIndex - origInputIndex);
inputCount = EncodedElement.compressIntArrayByBits(inputA, inputBits, inputCount, inputIndex);
assert(destPos%8 == 0);//sanity check.
if(inputCount >1) {
int stopIndex = inputCount-1;
EncodedElement.mergeFullOnByte(inputA, stopIndex, dest, destPos/8); // depends on control dependency: [if], data = [none]
destPos += (stopIndex)*32; // depends on control dependency: [if], data = [none]
}
if(inputCount >0) {
int index = inputCount-1;
EncodedElement.addInt_new(inputA[index], inputBits[index], destPos, dest); // depends on control dependency: [if], data = [none]
destPos+=inputBits[index]; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void main(String[] args) {
// Multithreaded map rendering
Parameters.NUMBER_OF_THREADS = 2;
// Square frame buffer
Parameters.SQUARE_FRAME_BUFFER = false;
HillsRenderConfig hillsCfg = null;
File demFolder = getDemFolder(args);
if (demFolder != null) {
MemoryCachingHgtReaderTileSource tileSource = new MemoryCachingHgtReaderTileSource(demFolder, new DiffuseLightShadingAlgorithm(), AwtGraphicFactory.INSTANCE);
tileSource.setEnableInterpolationOverlap(true);
hillsCfg = new HillsRenderConfig(tileSource);
hillsCfg.indexOnThread();
args = Arrays.copyOfRange(args, 1, args.length);
}
List<File> mapFiles = SHOW_RASTER_MAP ? null : getMapFiles(args);
final MapView mapView = createMapView();
final BoundingBox boundingBox = addLayers(mapView, mapFiles, hillsCfg);
final PreferencesFacade preferencesFacade = new JavaPreferences(Preferences.userNodeForPackage(Samples.class));
final JFrame frame = new JFrame();
frame.setTitle("Mapsforge Samples");
frame.add(mapView);
frame.pack();
frame.setSize(1024, 768);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
int result = JOptionPane.showConfirmDialog(frame, MESSAGE, TITLE, JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION) {
mapView.getModel().save(preferencesFacade);
mapView.destroyAll();
AwtGraphicFactory.clearResourceMemoryCache();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}
@Override
public void windowOpened(WindowEvent e) {
final Model model = mapView.getModel();
model.init(preferencesFacade);
if (model.mapViewPosition.getZoomLevel() == 0 || !boundingBox.contains(model.mapViewPosition.getCenter())) {
byte zoomLevel = LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(), boundingBox, model.displayModel.getTileSize());
model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(), zoomLevel));
}
}
});
frame.setVisible(true);
} } | public class class_name {
public static void main(String[] args) {
// Multithreaded map rendering
Parameters.NUMBER_OF_THREADS = 2;
// Square frame buffer
Parameters.SQUARE_FRAME_BUFFER = false;
HillsRenderConfig hillsCfg = null;
File demFolder = getDemFolder(args);
if (demFolder != null) {
MemoryCachingHgtReaderTileSource tileSource = new MemoryCachingHgtReaderTileSource(demFolder, new DiffuseLightShadingAlgorithm(), AwtGraphicFactory.INSTANCE);
tileSource.setEnableInterpolationOverlap(true); // depends on control dependency: [if], data = [none]
hillsCfg = new HillsRenderConfig(tileSource); // depends on control dependency: [if], data = [none]
hillsCfg.indexOnThread(); // depends on control dependency: [if], data = [none]
args = Arrays.copyOfRange(args, 1, args.length); // depends on control dependency: [if], data = [none]
}
List<File> mapFiles = SHOW_RASTER_MAP ? null : getMapFiles(args);
final MapView mapView = createMapView();
final BoundingBox boundingBox = addLayers(mapView, mapFiles, hillsCfg);
final PreferencesFacade preferencesFacade = new JavaPreferences(Preferences.userNodeForPackage(Samples.class));
final JFrame frame = new JFrame();
frame.setTitle("Mapsforge Samples");
frame.add(mapView);
frame.pack();
frame.setSize(1024, 768);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
int result = JOptionPane.showConfirmDialog(frame, MESSAGE, TITLE, JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION) {
mapView.getModel().save(preferencesFacade); // depends on control dependency: [if], data = [none]
mapView.destroyAll(); // depends on control dependency: [if], data = [none]
AwtGraphicFactory.clearResourceMemoryCache(); // depends on control dependency: [if], data = [none]
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); // depends on control dependency: [if], data = [none]
}
}
@Override
public void windowOpened(WindowEvent e) {
final Model model = mapView.getModel();
model.init(preferencesFacade);
if (model.mapViewPosition.getZoomLevel() == 0 || !boundingBox.contains(model.mapViewPosition.getCenter())) {
byte zoomLevel = LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(), boundingBox, model.displayModel.getTileSize());
model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(), zoomLevel)); // depends on control dependency: [if], data = [none]
}
}
});
frame.setVisible(true);
} } |
public class class_name {
public static String[] parse(String[] args)
throws IOException
{
ListBuffer<String> newArgs = new ListBuffer<String>();
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.length() > 1 && arg.charAt(0) == '@') {
arg = arg.substring(1);
if (arg.charAt(0) == '@') {
newArgs.append(arg);
} else {
loadCmdFile(arg, newArgs);
}
} else {
newArgs.append(arg);
}
}
return newArgs.toList().toArray(new String[newArgs.length()]);
} } | public class class_name {
public static String[] parse(String[] args)
throws IOException
{
ListBuffer<String> newArgs = new ListBuffer<String>();
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.length() > 1 && arg.charAt(0) == '@') {
arg = arg.substring(1);
if (arg.charAt(0) == '@') {
newArgs.append(arg); // depends on control dependency: [if], data = [none]
} else {
loadCmdFile(arg, newArgs); // depends on control dependency: [if], data = [none]
}
} else {
newArgs.append(arg);
}
}
return newArgs.toList().toArray(new String[newArgs.length()]);
} } |
public class class_name {
@Override
public void onBindViewHolder(ViewHolder viewHolder, final int position) {
final DeviceGuiElement device = ServicesGuiList.get().getServices().get(position);
if (device.getName() == null || device.getName().equals("")) {
viewHolder.nameTextView.setText("Name not found, please wait...");
} else {
viewHolder.nameTextView.setText(device.getName());
}
viewHolder.addressTextView.setText(device.getAddress());
viewHolder.identifierTextView.setText(device.getIdentifier());
viewHolder.logo.setImageDrawable(new IconicsDrawable(context)
.icon(FontAwesome.Icon.faw_android)
.color(context.getResources().getColor(R.color.red))
.sizeDp(30));
viewHolder.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
itemClickListener.serviceItemClicked(device);
}
});
} } | public class class_name {
@Override
public void onBindViewHolder(ViewHolder viewHolder, final int position) {
final DeviceGuiElement device = ServicesGuiList.get().getServices().get(position);
if (device.getName() == null || device.getName().equals("")) {
viewHolder.nameTextView.setText("Name not found, please wait..."); // depends on control dependency: [if], data = [none]
} else {
viewHolder.nameTextView.setText(device.getName()); // depends on control dependency: [if], data = [(device.getName()]
}
viewHolder.addressTextView.setText(device.getAddress());
viewHolder.identifierTextView.setText(device.getIdentifier());
viewHolder.logo.setImageDrawable(new IconicsDrawable(context)
.icon(FontAwesome.Icon.faw_android)
.color(context.getResources().getColor(R.color.red))
.sizeDp(30));
viewHolder.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
itemClickListener.serviceItemClicked(device);
}
});
} } |
public class class_name {
public static String decode(String value, Charset charset) {
try {
/* there is nothing special between uri and url decoding */
return URLDecoder.decode(value, charset.name());
} catch (UnsupportedEncodingException uee) {
/* since the encoding is not supported, return the original value */
return value;
}
} } | public class class_name {
public static String decode(String value, Charset charset) {
try {
/* there is nothing special between uri and url decoding */
return URLDecoder.decode(value, charset.name()); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException uee) {
/* since the encoding is not supported, return the original value */
return value;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static SquarePlanarShape getSquarePlanarShape(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD) {
Point3d pointA = atomA.getPoint3d();
Point3d pointB = atomB.getPoint3d();
Point3d pointC = atomC.getPoint3d();
Point3d pointD = atomD.getPoint3d();
// normalA normalB normalC are right-hand normals for the given
// triangles
// A-B-C, B-C-D, C-D-A
Vector3d normalA = new Vector3d();
Vector3d normalB = new Vector3d();
Vector3d normalC = new Vector3d();
// these are temporary vectors that are re-used in the calculations
Vector3d tmpX = new Vector3d();
Vector3d tmpY = new Vector3d();
// the normals (normalA, normalB, normalC) are calculated
StereoTool.getRawNormal(pointA, pointB, pointC, normalA, tmpX, tmpY);
StereoTool.getRawNormal(pointB, pointC, pointD, normalB, tmpX, tmpY);
StereoTool.getRawNormal(pointC, pointD, pointA, normalC, tmpX, tmpY);
// normalize the normals
normalA.normalize();
normalB.normalize();
normalC.normalize();
// sp1 up up up U-shaped
// sp2 up up DOWN 4-shaped
// sp3 up DOWN DOWN Z-shaped
double aDotB = normalA.dot(normalB);
double aDotC = normalA.dot(normalC);
double bDotC = normalB.dot(normalC);
if (aDotB > 0 && aDotC > 0 && bDotC > 0) { // UUU or DDD
return SquarePlanarShape.U_SHAPE;
} else if (aDotB > 0 && aDotC < 0 && bDotC < 0) { // UUD or DDU
return SquarePlanarShape.FOUR_SHAPE;
} else { // UDD or DUU
return SquarePlanarShape.Z_SHAPE;
}
} } | public class class_name {
public static SquarePlanarShape getSquarePlanarShape(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD) {
Point3d pointA = atomA.getPoint3d();
Point3d pointB = atomB.getPoint3d();
Point3d pointC = atomC.getPoint3d();
Point3d pointD = atomD.getPoint3d();
// normalA normalB normalC are right-hand normals for the given
// triangles
// A-B-C, B-C-D, C-D-A
Vector3d normalA = new Vector3d();
Vector3d normalB = new Vector3d();
Vector3d normalC = new Vector3d();
// these are temporary vectors that are re-used in the calculations
Vector3d tmpX = new Vector3d();
Vector3d tmpY = new Vector3d();
// the normals (normalA, normalB, normalC) are calculated
StereoTool.getRawNormal(pointA, pointB, pointC, normalA, tmpX, tmpY);
StereoTool.getRawNormal(pointB, pointC, pointD, normalB, tmpX, tmpY);
StereoTool.getRawNormal(pointC, pointD, pointA, normalC, tmpX, tmpY);
// normalize the normals
normalA.normalize();
normalB.normalize();
normalC.normalize();
// sp1 up up up U-shaped
// sp2 up up DOWN 4-shaped
// sp3 up DOWN DOWN Z-shaped
double aDotB = normalA.dot(normalB);
double aDotC = normalA.dot(normalC);
double bDotC = normalB.dot(normalC);
if (aDotB > 0 && aDotC > 0 && bDotC > 0) { // UUU or DDD
return SquarePlanarShape.U_SHAPE; // depends on control dependency: [if], data = [none]
} else if (aDotB > 0 && aDotC < 0 && bDotC < 0) { // UUD or DDU
return SquarePlanarShape.FOUR_SHAPE; // depends on control dependency: [if], data = [none]
} else { // UDD or DUU
return SquarePlanarShape.Z_SHAPE; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void startWatching() {
try {
final List<MonitorLine> lines = getSource().getLastLine(getInitialCount());
actual = null;
updateLines(lines);
} catch (Exception e) {
notifyObservers(e);
}
} } | public class class_name {
public void startWatching() {
try {
final List<MonitorLine> lines = getSource().getLastLine(getInitialCount());
actual = null; // depends on control dependency: [try], data = [none]
updateLines(lines); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
notifyObservers(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void validateSingleAliasRow(CmsObject cms, CmsAliasTableRow row) {
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
if (row.getStructureId() == null) {
String path = row.getResourcePath();
try {
CmsResource resource = cms.readResource(path, CmsResourceFilter.ALL);
row.setStructureId(resource.getStructureId());
if (row.getOriginalStructureId() == null) {
row.setOriginalStructureId(resource.getStructureId());
}
} catch (CmsException e) {
row.setPathError(messageResourceNotFound(locale));
m_hasErrors = true;
}
}
if (!CmsAlias.ALIAS_PATTERN.matcher(row.getAliasPath()).matches()) {
row.setAliasError(messageInvalidAliasPath(locale));
m_hasErrors = true;
}
} } | public class class_name {
private void validateSingleAliasRow(CmsObject cms, CmsAliasTableRow row) {
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
if (row.getStructureId() == null) {
String path = row.getResourcePath();
try {
CmsResource resource = cms.readResource(path, CmsResourceFilter.ALL);
row.setStructureId(resource.getStructureId());
// depends on control dependency: [try], data = [none]
if (row.getOriginalStructureId() == null) {
row.setOriginalStructureId(resource.getStructureId());
// depends on control dependency: [if], data = [none]
}
} catch (CmsException e) {
row.setPathError(messageResourceNotFound(locale));
m_hasErrors = true;
}
// depends on control dependency: [catch], data = [none]
}
if (!CmsAlias.ALIAS_PATTERN.matcher(row.getAliasPath()).matches()) {
row.setAliasError(messageInvalidAliasPath(locale));
// depends on control dependency: [if], data = [none]
m_hasErrors = true;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void startAuthorizationProcess(final Context context, ResponseListener listener) {
authorizationQueue.add(listener);
//start the authorization process only if this is the first time we ask for authorization
if (authorizationQueue.size() == 1) {
try {
if (preferences.clientId.get() == null) {
logger.info("starting registration process");
invokeInstanceRegistrationRequest(context);
} else {
logger.info("starting authorization process");
invokeAuthorizationRequest(context);
}
} catch (Throwable t) {
handleAuthorizationFailure(t);
}
}
else{
logger.info("authorization process already running, adding response listener to the queue");
logger.debug(String.format("authorization process currently handling %d requests", authorizationQueue.size()));
}
} } | public class class_name {
public void startAuthorizationProcess(final Context context, ResponseListener listener) {
authorizationQueue.add(listener);
//start the authorization process only if this is the first time we ask for authorization
if (authorizationQueue.size() == 1) {
try {
if (preferences.clientId.get() == null) {
logger.info("starting registration process"); // depends on control dependency: [if], data = [none]
invokeInstanceRegistrationRequest(context); // depends on control dependency: [if], data = [none]
} else {
logger.info("starting authorization process"); // depends on control dependency: [if], data = [none]
invokeAuthorizationRequest(context); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
handleAuthorizationFailure(t);
} // depends on control dependency: [catch], data = [none]
}
else{
logger.info("authorization process already running, adding response listener to the queue"); // depends on control dependency: [if], data = [none]
logger.debug(String.format("authorization process currently handling %d requests", authorizationQueue.size())); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static ZWaveCommandClass getInstance(int i, ZWaveNode node, ZWaveController controller, ZWaveEndpoint endpoint) {
logger.debug(String.format("Creating new instance of command class 0x%02X", i));
try {
CommandClass commandClass = CommandClass.getCommandClass(i);
if (commandClass == null) {
logger.warn(String.format("Unsupported command class 0x%02x", i));
return null;
}
Class<? extends ZWaveCommandClass> commandClassClass = commandClass.getCommandClassClass();
if (commandClassClass == null) {
logger.warn(String.format("Unsupported command class %s (0x%02x)", commandClass.getLabel(), i, endpoint));
return null;
}
Constructor<? extends ZWaveCommandClass> constructor = commandClassClass.getConstructor(ZWaveNode.class, ZWaveController.class, ZWaveEndpoint.class);
return constructor.newInstance(new Object[] {node, controller, endpoint});
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} catch (IllegalArgumentException e) {
} catch (InvocationTargetException e) {
} catch (NoSuchMethodException e) {
} catch (SecurityException e) {
}
logger.error(String.format("Error instantiating command class 0x%02x", i));
return null;
} } | public class class_name {
public static ZWaveCommandClass getInstance(int i, ZWaveNode node, ZWaveController controller, ZWaveEndpoint endpoint) {
logger.debug(String.format("Creating new instance of command class 0x%02X", i));
try {
CommandClass commandClass = CommandClass.getCommandClass(i);
if (commandClass == null) {
logger.warn(String.format("Unsupported command class 0x%02x", i));
// depends on control dependency: [if], data = [none]
return null;
// depends on control dependency: [if], data = [none]
}
Class<? extends ZWaveCommandClass> commandClassClass = commandClass.getCommandClassClass();
if (commandClassClass == null) {
logger.warn(String.format("Unsupported command class %s (0x%02x)", commandClass.getLabel(), i, endpoint));
// depends on control dependency: [if], data = [none]
return null;
// depends on control dependency: [if], data = [none]
}
Constructor<? extends ZWaveCommandClass> constructor = commandClassClass.getConstructor(ZWaveNode.class, ZWaveController.class, ZWaveEndpoint.class);
// depends on control dependency: [try], data = [none]
return constructor.newInstance(new Object[] {node, controller, endpoint});
// depends on control dependency: [try], data = [none]
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
// depends on control dependency: [catch], data = [none]
} catch (IllegalArgumentException e) {
// depends on control dependency: [catch], data = [none]
} catch (InvocationTargetException e) {
// depends on control dependency: [catch], data = [none]
} catch (NoSuchMethodException e) {
// depends on control dependency: [catch], data = [none]
} catch (SecurityException e) {
// depends on control dependency: [catch], data = [none]
}
// depends on control dependency: [catch], data = [none]
logger.error(String.format("Error instantiating command class 0x%02x", i));
return null;
} } |
public class class_name {
public List<FeatureTileLink> queryForTileTableName(String tileTableName) {
List<FeatureTileLink> results = null;
try {
results = queryForEq(FeatureTileLink.COLUMN_TILE_TABLE_NAME,
tileTableName);
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to query for Feature Tile Link objects by Tile Table Name: "
+ tileTableName);
}
return results;
} } | public class class_name {
public List<FeatureTileLink> queryForTileTableName(String tileTableName) {
List<FeatureTileLink> results = null;
try {
results = queryForEq(FeatureTileLink.COLUMN_TILE_TABLE_NAME,
tileTableName); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to query for Feature Tile Link objects by Tile Table Name: "
+ tileTableName);
} // depends on control dependency: [catch], data = [none]
return results;
} } |
public class class_name {
public String getCanonicalForm() {
StringBuilder buf = new StringBuilder();
for ( PathElement pe : elements ) {
buf.append( "." ).append( pe.getCanonicalForm() );
}
return buf.substring( 1 ); // strip the leading "."
} } | public class class_name {
public String getCanonicalForm() {
StringBuilder buf = new StringBuilder();
for ( PathElement pe : elements ) {
buf.append( "." ).append( pe.getCanonicalForm() ); // depends on control dependency: [for], data = [pe]
}
return buf.substring( 1 ); // strip the leading "."
} } |
public class class_name {
private static MultiMapConfig.ValueCollectionType findCollectionType(Collection collection) {
if (collection instanceof Set) {
return MultiMapConfig.ValueCollectionType.SET;
} else if (collection instanceof List) {
return MultiMapConfig.ValueCollectionType.LIST;
}
throw new IllegalArgumentException("[" + collection.getClass() + "] is not a known MultiMapConfig.ValueCollectionType!");
} } | public class class_name {
private static MultiMapConfig.ValueCollectionType findCollectionType(Collection collection) {
if (collection instanceof Set) {
return MultiMapConfig.ValueCollectionType.SET; // depends on control dependency: [if], data = [none]
} else if (collection instanceof List) {
return MultiMapConfig.ValueCollectionType.LIST; // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("[" + collection.getClass() + "] is not a known MultiMapConfig.ValueCollectionType!");
} } |
public class class_name {
private boolean logIfEnabled(String fqcn, Level level, Throwable t, String msgTemplate, Object... arguments) {
if(this.logger instanceof AbstractLogger){
((AbstractLogger)this.logger).logIfEnabled(fqcn, level, null, StrUtil.format(msgTemplate, arguments), t);
return true;
}else{
return false;
}
} } | public class class_name {
private boolean logIfEnabled(String fqcn, Level level, Throwable t, String msgTemplate, Object... arguments) {
if(this.logger instanceof AbstractLogger){
((AbstractLogger)this.logger).logIfEnabled(fqcn, level, null, StrUtil.format(msgTemplate, arguments), t);
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
}else{
return false;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void loadFirstPageCard() {
if (!mEnableLoadFirstPageCard) {
return;
}
final CardLoadSupport loadSupport = getService(CardLoadSupport.class);
if (loadSupport == null) {
return;
}
boolean loadedMore = false;
List<Card> cards = mGroupBasicAdapter.getGroups();
for (int i = 0; i < Math.min(mPreLoadNumber, cards.size()); i++) {
Card card = cards.get(i);
if (!TextUtils.isEmpty(card.load) && !card.loaded) {
// page load
if (card.loadMore && !loadedMore) {
// only load one load more card
loadSupport.loadMore(card);
loadSupport.reactiveDoLoadMore(card);
loadedMore = true;
} else {
loadSupport.doLoad(card);
loadSupport.reactiveDoLoad(card);
}
card.loaded = true;
}
}
} } | public class class_name {
public void loadFirstPageCard() {
if (!mEnableLoadFirstPageCard) {
return; // depends on control dependency: [if], data = [none]
}
final CardLoadSupport loadSupport = getService(CardLoadSupport.class);
if (loadSupport == null) {
return; // depends on control dependency: [if], data = [none]
}
boolean loadedMore = false;
List<Card> cards = mGroupBasicAdapter.getGroups();
for (int i = 0; i < Math.min(mPreLoadNumber, cards.size()); i++) {
Card card = cards.get(i);
if (!TextUtils.isEmpty(card.load) && !card.loaded) {
// page load
if (card.loadMore && !loadedMore) {
// only load one load more card
loadSupport.loadMore(card); // depends on control dependency: [if], data = [none]
loadSupport.reactiveDoLoadMore(card); // depends on control dependency: [if], data = [none]
loadedMore = true; // depends on control dependency: [if], data = [none]
} else {
loadSupport.doLoad(card); // depends on control dependency: [if], data = [none]
loadSupport.reactiveDoLoad(card); // depends on control dependency: [if], data = [none]
}
card.loaded = true; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@JRubyMethod
public static IRubyObject transform(IRubyObject self) {
// System.err.println("syck_node_transform()");
Ruby runtime = self.getRuntime();
ThreadContext ctx = runtime.getCurrentContext();
org.yecht.Node orig_n = (org.yecht.Node)self.dataGetStructChecked();
YAMLExtra x = ((Node)self).x;
IRubyObject t = new Node(runtime, self.getType(), null, x);
org.yecht.Node n = null;
switch(orig_n.kind) {
case Map:
n = org.yecht.Node.allocMap();
t.dataWrapStruct(n);
org.yecht.Data.Map dm = (org.yecht.Data.Map)orig_n.data;
for(int i=0; i < dm.idx; i++) {
IRubyObject k = ((IRubyObject)orig_n.mapRead(MapPart.Key, i)).callMethod(ctx, "transform");
IRubyObject v = ((IRubyObject)orig_n.mapRead(MapPart.Value, i)).callMethod(ctx, "transform");
n.mapAdd(k, v);
}
break;
case Seq:
n = org.yecht.Node.allocSeq();
t.dataWrapStruct(n);
org.yecht.Data.Seq ds = (org.yecht.Data.Seq)orig_n.data;
for(int i=0; i < ds.idx; i++) {
IRubyObject itm = ((IRubyObject)orig_n.seqRead(i)).callMethod(ctx, "transform");
n.seqAdd(itm);
}
break;
case Str:
org.yecht.Data.Str dss = (org.yecht.Data.Str)orig_n.data;
n = org.yecht.Node.newStr(dss.ptr, dss.len, dss.style);
t.dataWrapStruct(n);
break;
}
if(orig_n.type_id != null) {
n.type_id = orig_n.type_id;
}
if(orig_n.anchor != null) {
n.anchor = orig_n.anchor;
}
n.id = t;
// System.err.println("syck_node_transform(), setting id of object on: " + n);
IRubyObject result = x.DefaultResolver.callMethod(ctx, "node_import", t);
return result;
} } | public class class_name {
@JRubyMethod
public static IRubyObject transform(IRubyObject self) {
// System.err.println("syck_node_transform()");
Ruby runtime = self.getRuntime();
ThreadContext ctx = runtime.getCurrentContext();
org.yecht.Node orig_n = (org.yecht.Node)self.dataGetStructChecked();
YAMLExtra x = ((Node)self).x;
IRubyObject t = new Node(runtime, self.getType(), null, x);
org.yecht.Node n = null;
switch(orig_n.kind) {
case Map:
n = org.yecht.Node.allocMap();
t.dataWrapStruct(n);
org.yecht.Data.Map dm = (org.yecht.Data.Map)orig_n.data;
for(int i=0; i < dm.idx; i++) {
IRubyObject k = ((IRubyObject)orig_n.mapRead(MapPart.Key, i)).callMethod(ctx, "transform");
IRubyObject v = ((IRubyObject)orig_n.mapRead(MapPart.Value, i)).callMethod(ctx, "transform");
n.mapAdd(k, v); // depends on control dependency: [for], data = [none]
}
break;
case Seq:
n = org.yecht.Node.allocSeq();
t.dataWrapStruct(n);
org.yecht.Data.Seq ds = (org.yecht.Data.Seq)orig_n.data;
for(int i=0; i < ds.idx; i++) {
IRubyObject itm = ((IRubyObject)orig_n.seqRead(i)).callMethod(ctx, "transform");
n.seqAdd(itm); // depends on control dependency: [for], data = [none]
}
break;
case Str:
org.yecht.Data.Str dss = (org.yecht.Data.Str)orig_n.data;
n = org.yecht.Node.newStr(dss.ptr, dss.len, dss.style);
t.dataWrapStruct(n);
break;
}
if(orig_n.type_id != null) {
n.type_id = orig_n.type_id; // depends on control dependency: [if], data = [none]
}
if(orig_n.anchor != null) {
n.anchor = orig_n.anchor; // depends on control dependency: [if], data = [none]
}
n.id = t;
// System.err.println("syck_node_transform(), setting id of object on: " + n);
IRubyObject result = x.DefaultResolver.callMethod(ctx, "node_import", t);
return result;
} } |
public class class_name {
public boolean isValid() {
int totalNumberOfColumns = 0;
Set<Object> columns = new HashSet<>();
for(Map.Entry<Object, AssociativeArray> entry : internalData.entrySet()) {
AssociativeArray row = entry.getValue();
if(columns.isEmpty()) {
//this is executed only for the first row
for(Object column : row.internalData.keySet()) {
columns.add(column);
}
totalNumberOfColumns = columns.size();
}
else {
//validating the columns of next rows based on first column
if(totalNumberOfColumns!=row.size()) {
return false; //if the number of rows do not much then it is invalid
}
for(Object column : columns) {
if(row.containsKey(column)==false) {
return false; //if one of the detected columns do not exist, it is invalid
}
}
}
}
return true;
} } | public class class_name {
public boolean isValid() {
int totalNumberOfColumns = 0;
Set<Object> columns = new HashSet<>();
for(Map.Entry<Object, AssociativeArray> entry : internalData.entrySet()) {
AssociativeArray row = entry.getValue();
if(columns.isEmpty()) {
//this is executed only for the first row
for(Object column : row.internalData.keySet()) {
columns.add(column); // depends on control dependency: [for], data = [column]
}
totalNumberOfColumns = columns.size(); // depends on control dependency: [if], data = [none]
}
else {
//validating the columns of next rows based on first column
if(totalNumberOfColumns!=row.size()) {
return false; //if the number of rows do not much then it is invalid // depends on control dependency: [if], data = [none]
}
for(Object column : columns) {
if(row.containsKey(column)==false) {
return false; //if one of the detected columns do not exist, it is invalid // depends on control dependency: [if], data = [none]
}
}
}
}
return true;
} } |
public class class_name {
public void updateSender(String[] nameSender, ListeFilme listeFilme) {
// nur für den Mauskontext "Sender aktualisieren"
boolean starten = false;
initStart(listeFilme);
for (MediathekReader reader : mediathekListe) {
for (String s : nameSender) {
if (reader.checkNameSenderFilmliste(s)) {
starten = true;
new Thread(reader).start();
//reader.start();
}
}
}
allStarted = true;
if (!starten) {
// dann fertig
meldenFertig("");
}
} } | public class class_name {
public void updateSender(String[] nameSender, ListeFilme listeFilme) {
// nur für den Mauskontext "Sender aktualisieren"
boolean starten = false;
initStart(listeFilme);
for (MediathekReader reader : mediathekListe) {
for (String s : nameSender) {
if (reader.checkNameSenderFilmliste(s)) {
starten = true;
// depends on control dependency: [if], data = [none]
new Thread(reader).start();
// depends on control dependency: [if], data = [none]
//reader.start();
}
}
}
allStarted = true;
if (!starten) {
// dann fertig
meldenFertig("");
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void trimAll(final String... strings) {
for (int i = 0; i < strings.length; i++) {
String string = strings[i];
if (string != null) {
strings[i] = string.trim();
}
}
} } | public class class_name {
public static void trimAll(final String... strings) {
for (int i = 0; i < strings.length; i++) {
String string = strings[i];
if (string != null) {
strings[i] = string.trim(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void fetchTasks() {
synchronized (_userTasks) {
_userTasks.clear();
_userTickets.clear();
List<TaskSummary> tasks = _taskService.getTasksAssignedAsPotentialOwner(_userId, EN_UK);
for (TaskSummary task : tasks) {
_userTasks.add(task);
Map<String, Object> params = _taskService.getTaskContent(task.getId());
Ticket ticket = (Ticket) params.get(TICKET);
_userTickets.put(task.getProcessInstanceId(), ticket);
}
}
} } | public class class_name {
private void fetchTasks() {
synchronized (_userTasks) {
_userTasks.clear();
_userTickets.clear();
List<TaskSummary> tasks = _taskService.getTasksAssignedAsPotentialOwner(_userId, EN_UK);
for (TaskSummary task : tasks) {
_userTasks.add(task); // depends on control dependency: [for], data = [task]
Map<String, Object> params = _taskService.getTaskContent(task.getId());
Ticket ticket = (Ticket) params.get(TICKET);
_userTickets.put(task.getProcessInstanceId(), ticket); // depends on control dependency: [for], data = [task]
}
}
} } |
public class class_name {
private static void addRef(Map refs, String key, JSDynamic unres) {
List thisKey = (List) refs.get(key);
if (thisKey == null) {
thisKey = new ArrayList();
refs.put(key, thisKey);
}
thisKey.add(unres);
} } | public class class_name {
private static void addRef(Map refs, String key, JSDynamic unres) {
List thisKey = (List) refs.get(key);
if (thisKey == null) {
thisKey = new ArrayList(); // depends on control dependency: [if], data = [none]
refs.put(key, thisKey); // depends on control dependency: [if], data = [none]
}
thisKey.add(unres);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.