code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public DescribeBrokerResult withBrokerInstances(BrokerInstance... brokerInstances) { if (this.brokerInstances == null) { setBrokerInstances(new java.util.ArrayList<BrokerInstance>(brokerInstances.length)); } for (BrokerInstance ele : brokerInstances) { this.brokerInstances.add(ele); } return this; } }
public class class_name { public DescribeBrokerResult withBrokerInstances(BrokerInstance... brokerInstances) { if (this.brokerInstances == null) { setBrokerInstances(new java.util.ArrayList<BrokerInstance>(brokerInstances.length)); // depends on control dependency: [if], data = [none] } for (BrokerInstance ele : brokerInstances) { this.brokerInstances.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static <T> Constructor<T> findConstructor(Class<T> clazz, Class<?>... params) { try { return clazz.getConstructor(params); } catch (NoSuchMethodException e) { @SuppressWarnings("unchecked") Constructor<T>[] ctors = (Constructor<T>[]) clazz.getConstructors(); for (Constructor<T> candidate : ctors) { if (w2pEquals(candidate.getParameterTypes(), params)) { return candidate; } } return null; } } }
public class class_name { public static <T> Constructor<T> findConstructor(Class<T> clazz, Class<?>... params) { try { return clazz.getConstructor(params); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { @SuppressWarnings("unchecked") Constructor<T>[] ctors = (Constructor<T>[]) clazz.getConstructors(); for (Constructor<T> candidate : ctors) { if (w2pEquals(candidate.getParameterTypes(), params)) { return candidate; // depends on control dependency: [if], data = [none] } } return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void parameters( ParameterSupportBuilder< ? > statement, boolean requiresType ) throws RecognitionException { match( input, DRL5Lexer.LEFT_PAREN, null, null, DroolsEditorType.SYMBOL ); if ( state.failed ) return; if ( input.LA( 1 ) != DRL5Lexer.RIGHT_PAREN ) { parameter( statement, requiresType ); if ( state.failed ) return; while ( input.LA( 1 ) == DRL5Lexer.COMMA ) { match( input, DRL5Lexer.COMMA, null, null, DroolsEditorType.SYMBOL ); if ( state.failed ) return; parameter( statement, requiresType ); if ( state.failed ) return; } } match( input, DRL5Lexer.RIGHT_PAREN, null, null, DroolsEditorType.SYMBOL ); if ( state.failed ) return; } }
public class class_name { private void parameters( ParameterSupportBuilder< ? > statement, boolean requiresType ) throws RecognitionException { match( input, DRL5Lexer.LEFT_PAREN, null, null, DroolsEditorType.SYMBOL ); if ( state.failed ) return; if ( input.LA( 1 ) != DRL5Lexer.RIGHT_PAREN ) { parameter( statement, requiresType ); if ( state.failed ) return; while ( input.LA( 1 ) == DRL5Lexer.COMMA ) { match( input, DRL5Lexer.COMMA, null, null, DroolsEditorType.SYMBOL ); // depends on control dependency: [while], data = [none] if ( state.failed ) return; parameter( statement, requiresType ); // depends on control dependency: [while], data = [none] if ( state.failed ) return; } } match( input, DRL5Lexer.RIGHT_PAREN, null, null, DroolsEditorType.SYMBOL ); if ( state.failed ) return; } }
public class class_name { public void setIconBrand(boolean _iconBrand) { if (_iconBrand) { AddResourcesListener.setFontAwesomeVersion(5, this); } getStateHelper().put(PropertyKeys.iconBrand, _iconBrand); } }
public class class_name { public void setIconBrand(boolean _iconBrand) { if (_iconBrand) { AddResourcesListener.setFontAwesomeVersion(5, this); // depends on control dependency: [if], data = [none] } getStateHelper().put(PropertyKeys.iconBrand, _iconBrand); } }
public class class_name { @SuppressWarnings("resource") @Pure public Collection<String> getAllAttributeNames(int recordNumber) { try { final DBaseFileReader dbReader = getReader(); synchronized (dbReader) { final List<DBaseFileField> fields = dbReader.getDBFFields(); if (fields == null) { return Collections.emptyList(); } final ArrayList<String> titles = new ArrayList<>(fields.size()); for (int i = 0; i < fields.size(); ++i) { titles.add(fields.get(i).getName()); } return titles; } } catch (IOException exception) { return Collections.emptyList(); } } }
public class class_name { @SuppressWarnings("resource") @Pure public Collection<String> getAllAttributeNames(int recordNumber) { try { final DBaseFileReader dbReader = getReader(); synchronized (dbReader) { // depends on control dependency: [try], data = [none] final List<DBaseFileField> fields = dbReader.getDBFFields(); if (fields == null) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } final ArrayList<String> titles = new ArrayList<>(fields.size()); for (int i = 0; i < fields.size(); ++i) { titles.add(fields.get(i).getName()); // depends on control dependency: [for], data = [i] } return titles; } } catch (IOException exception) { return Collections.emptyList(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean isUnixTimeStamp(String timeStamp) { if (timeStamp.length() != ComplianceConfigurationKeys.TIME_STAMP_LENGTH) { return false; } try { Long.parseLong(timeStamp); return true; } catch (NumberFormatException e) { return false; } } }
public class class_name { public static boolean isUnixTimeStamp(String timeStamp) { if (timeStamp.length() != ComplianceConfigurationKeys.TIME_STAMP_LENGTH) { return false; // depends on control dependency: [if], data = [none] } try { Long.parseLong(timeStamp); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public EEnum getIfcInventoryTypeEnum() { if (ifcInventoryTypeEnumEEnum == null) { ifcInventoryTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(849); } return ifcInventoryTypeEnumEEnum; } }
public class class_name { public EEnum getIfcInventoryTypeEnum() { if (ifcInventoryTypeEnumEEnum == null) { ifcInventoryTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(849); // depends on control dependency: [if], data = [none] } return ifcInventoryTypeEnumEEnum; } }
public class class_name { public String buildWhere(String field, ColumnValue value) { String where; if (value != null) { if (value.getValue() != null && value.getTolerance() != null) { if (!(value.getValue() instanceof Number)) { throw new GeoPackageException( "Field value is not a number and can not use a tolerance, Field: " + field + ", Value: " + value); } String quotedField = CoreSQLUtils.quoteWrap(field); where = quotedField + " >= ? AND " + quotedField + " <= ?"; } else { where = buildWhere(field, value.getValue()); } } else { where = buildWhere(field, null, null); } return where; } }
public class class_name { public String buildWhere(String field, ColumnValue value) { String where; if (value != null) { if (value.getValue() != null && value.getTolerance() != null) { if (!(value.getValue() instanceof Number)) { throw new GeoPackageException( "Field value is not a number and can not use a tolerance, Field: " + field + ", Value: " + value); } String quotedField = CoreSQLUtils.quoteWrap(field); where = quotedField + " >= ? AND " + quotedField + " <= ?"; // depends on control dependency: [if], data = [none] } else { where = buildWhere(field, value.getValue()); // depends on control dependency: [if], data = [none] } } else { where = buildWhere(field, null, null); // depends on control dependency: [if], data = [null)] } return where; } }
public class class_name { private static String getRoleWithDefaultPrefix(String defaultRolePrefix, String role) { if (role == null) { return role; } if (defaultRolePrefix == null || defaultRolePrefix.length() == 0) { return role; } if (role.startsWith(defaultRolePrefix)) { return role; } return defaultRolePrefix + role; } }
public class class_name { private static String getRoleWithDefaultPrefix(String defaultRolePrefix, String role) { if (role == null) { return role; // depends on control dependency: [if], data = [none] } if (defaultRolePrefix == null || defaultRolePrefix.length() == 0) { return role; // depends on control dependency: [if], data = [none] } if (role.startsWith(defaultRolePrefix)) { return role; // depends on control dependency: [if], data = [none] } return defaultRolePrefix + role; } }
public class class_name { public static void applyToOrTransparent(ColorHolder colorHolder, Context ctx, GradientDrawable gradientDrawable) { if (colorHolder != null && gradientDrawable != null) { colorHolder.applyTo(ctx, gradientDrawable); } else if (gradientDrawable != null) { gradientDrawable.setColor(Color.TRANSPARENT); } } }
public class class_name { public static void applyToOrTransparent(ColorHolder colorHolder, Context ctx, GradientDrawable gradientDrawable) { if (colorHolder != null && gradientDrawable != null) { colorHolder.applyTo(ctx, gradientDrawable); // depends on control dependency: [if], data = [none] } else if (gradientDrawable != null) { gradientDrawable.setColor(Color.TRANSPARENT); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public synchronized void relocate(int oldPosition, int newPosition, ByteBuffer oldBuffer, ByteBuffer newBuffer) { DoublesUnion union = unions.get(oldBuffer).get(oldPosition); final WritableMemory oldMem = getMemory(oldBuffer).writableRegion(oldPosition, maxIntermediateSize); if (union.isSameResource(oldMem)) { // union was not relocated on heap final WritableMemory newMem = getMemory(newBuffer).writableRegion(newPosition, maxIntermediateSize); union = DoublesUnion.wrap(newMem); } putUnion(newBuffer, newPosition, union); Int2ObjectMap<DoublesUnion> map = unions.get(oldBuffer); map.remove(oldPosition); if (map.isEmpty()) { unions.remove(oldBuffer); memCache.remove(oldBuffer); } } }
public class class_name { @Override public synchronized void relocate(int oldPosition, int newPosition, ByteBuffer oldBuffer, ByteBuffer newBuffer) { DoublesUnion union = unions.get(oldBuffer).get(oldPosition); final WritableMemory oldMem = getMemory(oldBuffer).writableRegion(oldPosition, maxIntermediateSize); if (union.isSameResource(oldMem)) { // union was not relocated on heap final WritableMemory newMem = getMemory(newBuffer).writableRegion(newPosition, maxIntermediateSize); union = DoublesUnion.wrap(newMem); // depends on control dependency: [if], data = [none] } putUnion(newBuffer, newPosition, union); Int2ObjectMap<DoublesUnion> map = unions.get(oldBuffer); map.remove(oldPosition); if (map.isEmpty()) { unions.remove(oldBuffer); // depends on control dependency: [if], data = [none] memCache.remove(oldBuffer); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void addPuService(final DeploymentPhaseContext phaseContext, final ArrayList<PersistenceUnitMetadataHolder> puList, final boolean startEarly, final Platform platform) throws DeploymentUnitProcessingException { if (puList.size() > 0) { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); final ModuleClassLoader classLoader = module.getClassLoader(); for (PersistenceUnitMetadataHolder holder : puList) { setAnnotationIndexes(holder, deploymentUnit); for (PersistenceUnitMetadata pu : holder.getPersistenceUnits()) { // only start the persistence unit if JPA_CONTAINER_MANAGED is true String jpaContainerManaged = pu.getProperties().getProperty(Configuration.JPA_CONTAINER_MANAGED); boolean deployPU = (jpaContainerManaged == null? true : Boolean.parseBoolean(jpaContainerManaged)); if (deployPU) { final PersistenceProviderDeploymentHolder persistenceProviderDeploymentHolder = getPersistenceProviderDeploymentHolder(deploymentUnit); final PersistenceProvider provider = lookupProvider(pu, persistenceProviderDeploymentHolder, deploymentUnit); final PersistenceProviderAdaptor adaptor = getPersistenceProviderAdaptor(pu, persistenceProviderDeploymentHolder, deploymentUnit, provider, platform); final boolean twoPhaseBootStrapCapable = (adaptor instanceof TwoPhaseBootstrapCapable) && Configuration.allowTwoPhaseBootstrap(pu); if (startEarly) { if (twoPhaseBootStrapCapable) { deployPersistenceUnitPhaseOne(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, adaptor); } else if (false == Configuration.needClassFileTransformer(pu)) { // will start later when startEarly == false ROOT_LOGGER.tracef("persistence unit %s in deployment %s is configured to not need class transformer to be set, no class rewriting will be allowed", pu.getPersistenceUnitName(), deploymentUnit.getName()); } else { // we need class file transformer to work, don't allow cdi bean manager to be access since that // could cause application classes to be loaded (workaround by setting jboss.as.jpa.classtransformer to false). WFLY-1463 final boolean allowCdiBeanManagerAccess = false; deployPersistenceUnit(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, provider, adaptor, allowCdiBeanManagerAccess); } } else { // !startEarly if (twoPhaseBootStrapCapable) { deployPersistenceUnitPhaseTwo(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, provider, adaptor); } else if (false == Configuration.needClassFileTransformer(pu)) { final boolean allowCdiBeanManagerAccess = true; // PUs that have Configuration.JPA_CONTAINER_CLASS_TRANSFORMER = false will start during INSTALL phase deployPersistenceUnit(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, provider, adaptor, allowCdiBeanManagerAccess); } } } else { ROOT_LOGGER.tracef("persistence unit %s in deployment %s is not container managed (%s is set to false)", pu.getPersistenceUnitName(), deploymentUnit.getName(), Configuration.JPA_CONTAINER_MANAGED); } } } } } }
public class class_name { private static void addPuService(final DeploymentPhaseContext phaseContext, final ArrayList<PersistenceUnitMetadataHolder> puList, final boolean startEarly, final Platform platform) throws DeploymentUnitProcessingException { if (puList.size() > 0) { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); final ServiceTarget serviceTarget = phaseContext.getServiceTarget(); final ModuleClassLoader classLoader = module.getClassLoader(); for (PersistenceUnitMetadataHolder holder : puList) { setAnnotationIndexes(holder, deploymentUnit); for (PersistenceUnitMetadata pu : holder.getPersistenceUnits()) { // only start the persistence unit if JPA_CONTAINER_MANAGED is true String jpaContainerManaged = pu.getProperties().getProperty(Configuration.JPA_CONTAINER_MANAGED); boolean deployPU = (jpaContainerManaged == null? true : Boolean.parseBoolean(jpaContainerManaged)); if (deployPU) { final PersistenceProviderDeploymentHolder persistenceProviderDeploymentHolder = getPersistenceProviderDeploymentHolder(deploymentUnit); final PersistenceProvider provider = lookupProvider(pu, persistenceProviderDeploymentHolder, deploymentUnit); final PersistenceProviderAdaptor adaptor = getPersistenceProviderAdaptor(pu, persistenceProviderDeploymentHolder, deploymentUnit, provider, platform); final boolean twoPhaseBootStrapCapable = (adaptor instanceof TwoPhaseBootstrapCapable) && Configuration.allowTwoPhaseBootstrap(pu); if (startEarly) { if (twoPhaseBootStrapCapable) { deployPersistenceUnitPhaseOne(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, adaptor); // depends on control dependency: [if], data = [none] } else if (false == Configuration.needClassFileTransformer(pu)) { // will start later when startEarly == false ROOT_LOGGER.tracef("persistence unit %s in deployment %s is configured to not need class transformer to be set, no class rewriting will be allowed", pu.getPersistenceUnitName(), deploymentUnit.getName()); } else { // we need class file transformer to work, don't allow cdi bean manager to be access since that // could cause application classes to be loaded (workaround by setting jboss.as.jpa.classtransformer to false). WFLY-1463 final boolean allowCdiBeanManagerAccess = false; deployPersistenceUnit(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, provider, adaptor, allowCdiBeanManagerAccess); // depends on control dependency: [if], data = [none] } } else { // !startEarly if (twoPhaseBootStrapCapable) { deployPersistenceUnitPhaseTwo(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, provider, adaptor); // depends on control dependency: [if], data = [none] } else if (false == Configuration.needClassFileTransformer(pu)) { final boolean allowCdiBeanManagerAccess = true; // PUs that have Configuration.JPA_CONTAINER_CLASS_TRANSFORMER = false will start during INSTALL phase deployPersistenceUnit(deploymentUnit, eeModuleDescription, serviceTarget, classLoader, pu, provider, adaptor, allowCdiBeanManagerAccess); // depends on control dependency: [if], data = [none] } } } else { ROOT_LOGGER.tracef("persistence unit %s in deployment %s is not container managed (%s is set to false)", pu.getPersistenceUnitName(), deploymentUnit.getName(), Configuration.JPA_CONTAINER_MANAGED); } } } } } }
public class class_name { private Class<?> resolveResultJavaType(Class<?> resultType, String property, Class<?> javaType) { if (javaType == null && property != null) { try { MetaClass metaResultType = MetaClass.forClass(resultType, REFLECTOR_FACTORY); javaType = metaResultType.getSetterType(property); } catch (Exception ignored) { // ignore, following null check statement will deal with the // situation } } if (javaType == null) { javaType = Object.class; } return javaType; } }
public class class_name { private Class<?> resolveResultJavaType(Class<?> resultType, String property, Class<?> javaType) { if (javaType == null && property != null) { try { MetaClass metaResultType = MetaClass.forClass(resultType, REFLECTOR_FACTORY); javaType = metaResultType.getSetterType(property); // depends on control dependency: [try], data = [none] } catch (Exception ignored) { // ignore, following null check statement will deal with the // situation } // depends on control dependency: [catch], data = [none] } if (javaType == null) { javaType = Object.class; } return javaType; } }
public class class_name { public final SettingsMap getSettings (final String targetName, final int connectionID) { final SettingsMap sm = new SettingsMap(); // set all default settings synchronized (globalConfig) { for (Map.Entry<OperationalTextKey , SettingEntry> e : globalConfig.entrySet()) { sm.add(e.getKey(), e.getValue().getValue()); } } // set all further settings final SessionConfiguration sc; synchronized (sessionConfigs) { sc = sessionConfigs.get(targetName); synchronized (sc) { if (sc != null) { final SettingsMap furtherSettings = sc.getSettings(connectionID); for (Map.Entry<OperationalTextKey , String> e : furtherSettings.entrySet()) { sm.add(e.getKey(), e.getValue()); } } } } return sm; } }
public class class_name { public final SettingsMap getSettings (final String targetName, final int connectionID) { final SettingsMap sm = new SettingsMap(); // set all default settings synchronized (globalConfig) { for (Map.Entry<OperationalTextKey , SettingEntry> e : globalConfig.entrySet()) { sm.add(e.getKey(), e.getValue().getValue()); // depends on control dependency: [for], data = [e] } } // set all further settings final SessionConfiguration sc; synchronized (sessionConfigs) { sc = sessionConfigs.get(targetName); synchronized (sc) { if (sc != null) { final SettingsMap furtherSettings = sc.getSettings(connectionID); for (Map.Entry<OperationalTextKey , String> e : furtherSettings.entrySet()) { sm.add(e.getKey(), e.getValue()); // depends on control dependency: [for], data = [e] } } } } return sm; } }
public class class_name { public void remove(BeanId beanId) { final String fileName = getPortableFilename(beanId); final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "remove: key=" + beanId + ", file=" + fileName); //d248470 try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() // 126586 { public Void run() throws Exception { File theFile = getStatefulBeanFile(fileName, true); if (isTraceOn && tc.isDebugEnabled()) //d152600 Tr.debug(tc, "deleting file: " + theFile.getName() + ", path: " + theFile.getPath()); boolean deleted = theFile.delete(); //d152600 if (isTraceOn && tc.isDebugEnabled()) //d152600 Tr.debug(tc, "File.delete returned: " + deleted); return null; } }); } catch (PrivilegedActionException ex) { FFDCFilter.processException(ex.getException(), CLASS_NAME + ".remove", "150", this); if (isTraceOn && tc.isEventEnabled()) Tr.event(tc, "Failed to remove session bean state", new Object[] { beanId, ex }); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "remove"); } }
public class class_name { public void remove(BeanId beanId) { final String fileName = getPortableFilename(beanId); final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "remove: key=" + beanId + ", file=" + fileName); //d248470 try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() // 126586 { public Void run() throws Exception { File theFile = getStatefulBeanFile(fileName, true); if (isTraceOn && tc.isDebugEnabled()) //d152600 Tr.debug(tc, "deleting file: " + theFile.getName() + ", path: " + theFile.getPath()); boolean deleted = theFile.delete(); //d152600 if (isTraceOn && tc.isDebugEnabled()) //d152600 Tr.debug(tc, "File.delete returned: " + deleted); return null; } }); // depends on control dependency: [try], data = [none] } catch (PrivilegedActionException ex) { FFDCFilter.processException(ex.getException(), CLASS_NAME + ".remove", "150", this); if (isTraceOn && tc.isEventEnabled()) Tr.event(tc, "Failed to remove session bean state", new Object[] { beanId, ex }); } // depends on control dependency: [catch], data = [none] if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "remove"); } }
public class class_name { @Override public void onBindViewHolder(@NonNull DirViewHolder vh, int position, @NonNull File file) { // Let the super method do its thing with checkboxes and text super.onBindViewHolder(vh, position, file); // Here we load the preview image if it is an image file final int viewType = getItemViewType(position, file); if (viewType == VIEWTYPE_IMAGE_CHECKABLE || viewType == VIEWTYPE_IMAGE) { // Need to set it to visible because the base code will set it to invisible by default vh.icon.setVisibility(View.VISIBLE); // Just load the image Glide.with(this).load(file).into((ImageView) vh.icon); } } }
public class class_name { @Override public void onBindViewHolder(@NonNull DirViewHolder vh, int position, @NonNull File file) { // Let the super method do its thing with checkboxes and text super.onBindViewHolder(vh, position, file); // Here we load the preview image if it is an image file final int viewType = getItemViewType(position, file); if (viewType == VIEWTYPE_IMAGE_CHECKABLE || viewType == VIEWTYPE_IMAGE) { // Need to set it to visible because the base code will set it to invisible by default vh.icon.setVisibility(View.VISIBLE); // depends on control dependency: [if], data = [none] // Just load the image Glide.with(this).load(file).into((ImageView) vh.icon); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean writeXML(QueryCapability dqc, String filename) { try { BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(filename)); writeXML(dqc, os); os.close(); } catch (IOException e) { e.printStackTrace(); return false; } return true; } }
public class class_name { public boolean writeXML(QueryCapability dqc, String filename) { try { BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(filename)); writeXML(dqc, os); // depends on control dependency: [try], data = [none] os.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { e.printStackTrace(); return false; } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { public void marshall(UploadLayerPartRequest uploadLayerPartRequest, ProtocolMarshaller protocolMarshaller) { if (uploadLayerPartRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(uploadLayerPartRequest.getRegistryId(), REGISTRYID_BINDING); protocolMarshaller.marshall(uploadLayerPartRequest.getRepositoryName(), REPOSITORYNAME_BINDING); protocolMarshaller.marshall(uploadLayerPartRequest.getUploadId(), UPLOADID_BINDING); protocolMarshaller.marshall(uploadLayerPartRequest.getPartFirstByte(), PARTFIRSTBYTE_BINDING); protocolMarshaller.marshall(uploadLayerPartRequest.getPartLastByte(), PARTLASTBYTE_BINDING); protocolMarshaller.marshall(uploadLayerPartRequest.getLayerPartBlob(), LAYERPARTBLOB_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UploadLayerPartRequest uploadLayerPartRequest, ProtocolMarshaller protocolMarshaller) { if (uploadLayerPartRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(uploadLayerPartRequest.getRegistryId(), REGISTRYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(uploadLayerPartRequest.getRepositoryName(), REPOSITORYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(uploadLayerPartRequest.getUploadId(), UPLOADID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(uploadLayerPartRequest.getPartFirstByte(), PARTFIRSTBYTE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(uploadLayerPartRequest.getPartLastByte(), PARTLASTBYTE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(uploadLayerPartRequest.getLayerPartBlob(), LAYERPARTBLOB_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 protected void initPrototypeId(int id) { String s; int arity; switch (id) { case Id_constructor: { IdFunctionObject ctor; if (this instanceof XML) { ctor = new XMLCtor((XML)this, XMLOBJECT_TAG, id, 1); } else { ctor = new IdFunctionObject(this, XMLOBJECT_TAG, id, 1); } initPrototypeConstructor(ctor); return; } case Id_addNamespace: arity=1; s="addNamespace"; break; case Id_appendChild: arity=1; s="appendChild"; break; case Id_attribute: arity=1; s="attribute"; break; case Id_attributes: arity=0; s="attributes"; break; case Id_child: arity=1; s="child"; break; case Id_childIndex: arity=0; s="childIndex"; break; case Id_children: arity=0; s="children"; break; case Id_comments: arity=0; s="comments"; break; case Id_contains: arity=1; s="contains"; break; case Id_copy: arity=0; s="copy"; break; case Id_descendants: arity=1; s="descendants"; break; case Id_elements: arity=1; s="elements"; break; case Id_hasComplexContent: arity=0; s="hasComplexContent"; break; case Id_hasOwnProperty: arity=1; s="hasOwnProperty"; break; case Id_hasSimpleContent: arity=0; s="hasSimpleContent"; break; case Id_inScopeNamespaces: arity=0; s="inScopeNamespaces"; break; case Id_insertChildAfter: arity=2; s="insertChildAfter"; break; case Id_insertChildBefore: arity=2; s="insertChildBefore"; break; case Id_length: arity=0; s="length"; break; case Id_localName: arity=0; s="localName"; break; case Id_name: arity=0; s="name"; break; case Id_namespace: arity=1; s="namespace"; break; case Id_namespaceDeclarations: arity=0; s="namespaceDeclarations"; break; case Id_nodeKind: arity=0; s="nodeKind"; break; case Id_normalize: arity=0; s="normalize"; break; case Id_parent: arity=0; s="parent"; break; case Id_prependChild: arity=1; s="prependChild"; break; case Id_processingInstructions: arity=1; s="processingInstructions"; break; case Id_propertyIsEnumerable: arity=1; s="propertyIsEnumerable"; break; case Id_removeNamespace: arity=1; s="removeNamespace"; break; case Id_replace: arity=2; s="replace"; break; case Id_setChildren: arity=1; s="setChildren"; break; case Id_setLocalName: arity=1; s="setLocalName"; break; case Id_setName: arity=1; s="setName"; break; case Id_setNamespace: arity=1; s="setNamespace"; break; case Id_text: arity=0; s="text"; break; case Id_toString: arity=0; s="toString"; break; case Id_toSource: arity=1; s="toSource"; break; case Id_toXMLString: arity=1; s="toXMLString"; break; case Id_valueOf: arity=0; s="valueOf"; break; default: throw new IllegalArgumentException(String.valueOf(id)); } initPrototypeMethod(XMLOBJECT_TAG, id, s, arity); } }
public class class_name { @Override protected void initPrototypeId(int id) { String s; int arity; switch (id) { case Id_constructor: { IdFunctionObject ctor; if (this instanceof XML) { ctor = new XMLCtor((XML)this, XMLOBJECT_TAG, id, 1); // depends on control dependency: [if], data = [none] } else { ctor = new IdFunctionObject(this, XMLOBJECT_TAG, id, 1); // depends on control dependency: [if], data = [none] } initPrototypeConstructor(ctor); return; } case Id_addNamespace: arity=1; s="addNamespace"; break; case Id_appendChild: arity=1; s="appendChild"; break; case Id_attribute: arity=1; s="attribute"; break; case Id_attributes: arity=0; s="attributes"; break; case Id_child: arity=1; s="child"; break; case Id_childIndex: arity=0; s="childIndex"; break; case Id_children: arity=0; s="children"; break; case Id_comments: arity=0; s="comments"; break; case Id_contains: arity=1; s="contains"; break; case Id_copy: arity=0; s="copy"; break; case Id_descendants: arity=1; s="descendants"; break; case Id_elements: arity=1; s="elements"; break; case Id_hasComplexContent: arity=0; s="hasComplexContent"; break; case Id_hasOwnProperty: arity=1; s="hasOwnProperty"; break; case Id_hasSimpleContent: arity=0; s="hasSimpleContent"; break; case Id_inScopeNamespaces: arity=0; s="inScopeNamespaces"; break; case Id_insertChildAfter: arity=2; s="insertChildAfter"; break; case Id_insertChildBefore: arity=2; s="insertChildBefore"; break; case Id_length: arity=0; s="length"; break; case Id_localName: arity=0; s="localName"; break; case Id_name: arity=0; s="name"; break; case Id_namespace: arity=1; s="namespace"; break; case Id_namespaceDeclarations: arity=0; s="namespaceDeclarations"; break; case Id_nodeKind: arity=0; s="nodeKind"; break; case Id_normalize: arity=0; s="normalize"; break; case Id_parent: arity=0; s="parent"; break; case Id_prependChild: arity=1; s="prependChild"; break; case Id_processingInstructions: arity=1; s="processingInstructions"; break; case Id_propertyIsEnumerable: arity=1; s="propertyIsEnumerable"; break; case Id_removeNamespace: arity=1; s="removeNamespace"; break; case Id_replace: arity=2; s="replace"; break; case Id_setChildren: arity=1; s="setChildren"; break; case Id_setLocalName: arity=1; s="setLocalName"; break; case Id_setName: arity=1; s="setName"; break; case Id_setNamespace: arity=1; s="setNamespace"; break; case Id_text: arity=0; s="text"; break; case Id_toString: arity=0; s="toString"; break; case Id_toSource: arity=1; s="toSource"; break; case Id_toXMLString: arity=1; s="toXMLString"; break; case Id_valueOf: arity=0; s="valueOf"; break; default: throw new IllegalArgumentException(String.valueOf(id)); } initPrototypeMethod(XMLOBJECT_TAG, id, s, arity); } }
public class class_name { @Override public NamespaceNotification getNamespaceNotification() throws IOException { FSEditLogOp op = null; NamespaceNotification notification = null; // Keep looping until we reach an operation that can be // considered a notification. while (true) { try { // if the stream is null, we need to setup next stream // if we cannot than this is a fatal failure refreshInputStream(); // get current position in the stream currentEditLogInputStreamPosition = currentEditLogInputStream .getPosition(); // try reading a transaction op = currentEditLogInputStream.readOp(); InjectionHandler.processEventIO(InjectionEvent.SERVERLOGREADER_READOP); if (LOG.isDebugEnabled()) { LOG.info("inputStream.readOP() returned " + op); } } catch (Exception e) { // possibly ChecksumException LOG.warn("inputStream.readOp() failed", e); // try reopening current log segment tryReloadingEditLog(); continue; } // for each successful read, we update state if (op == null) { // we can sleep to wait for new transactions sleep(500); // nothing in the edit log now core.getMetrics().reachedEditLogEnd.inc(); checkProgress(); continue; } if (ServerLogReaderUtil.shouldSkipOp(mostRecentlyReadTransactionTxId, op)){ updateState(op, false); continue; } // update internal state, and check for progress updateState(op, true); if (LOG.isDebugEnabled()) { LOG.debug("Read operation: " + op + " with txId=" + (op == null ? "null" : op.getTransactionId())); } // Test if it can be considered a notification notification = ServerLogReaderUtil.createNotification(op); if (notification != null) { if (LOG.isDebugEnabled()) { LOG.debug("Emitting " + NotifierUtils.asString(notification)); } core.getMetrics().readNotifications.inc(); return notification; } } } }
public class class_name { @Override public NamespaceNotification getNamespaceNotification() throws IOException { FSEditLogOp op = null; NamespaceNotification notification = null; // Keep looping until we reach an operation that can be // considered a notification. while (true) { try { // if the stream is null, we need to setup next stream // if we cannot than this is a fatal failure refreshInputStream(); // depends on control dependency: [try], data = [none] // get current position in the stream currentEditLogInputStreamPosition = currentEditLogInputStream .getPosition(); // depends on control dependency: [try], data = [none] // try reading a transaction op = currentEditLogInputStream.readOp(); // depends on control dependency: [try], data = [none] InjectionHandler.processEventIO(InjectionEvent.SERVERLOGREADER_READOP); // depends on control dependency: [try], data = [none] if (LOG.isDebugEnabled()) { LOG.info("inputStream.readOP() returned " + op); // depends on control dependency: [if], data = [none] } } catch (Exception e) { // possibly ChecksumException LOG.warn("inputStream.readOp() failed", e); // try reopening current log segment tryReloadingEditLog(); continue; } // depends on control dependency: [catch], data = [none] // for each successful read, we update state if (op == null) { // we can sleep to wait for new transactions sleep(500); // depends on control dependency: [if], data = [none] // nothing in the edit log now core.getMetrics().reachedEditLogEnd.inc(); // depends on control dependency: [if], data = [none] checkProgress(); // depends on control dependency: [if], data = [none] continue; } if (ServerLogReaderUtil.shouldSkipOp(mostRecentlyReadTransactionTxId, op)){ updateState(op, false); // depends on control dependency: [if], data = [none] continue; } // update internal state, and check for progress updateState(op, true); if (LOG.isDebugEnabled()) { LOG.debug("Read operation: " + op + " with txId=" + (op == null ? "null" : op.getTransactionId())); // depends on control dependency: [if], data = [none] } // Test if it can be considered a notification notification = ServerLogReaderUtil.createNotification(op); if (notification != null) { if (LOG.isDebugEnabled()) { LOG.debug("Emitting " + NotifierUtils.asString(notification)); // depends on control dependency: [if], data = [none] } core.getMetrics().readNotifications.inc(); // depends on control dependency: [if], data = [none] return notification; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setRecommendations(java.util.Collection<ReservationPurchaseRecommendation> recommendations) { if (recommendations == null) { this.recommendations = null; return; } this.recommendations = new java.util.ArrayList<ReservationPurchaseRecommendation>(recommendations); } }
public class class_name { public void setRecommendations(java.util.Collection<ReservationPurchaseRecommendation> recommendations) { if (recommendations == null) { this.recommendations = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.recommendations = new java.util.ArrayList<ReservationPurchaseRecommendation>(recommendations); } }
public class class_name { protected boolean doTypeMappingCheck(EObject source, JvmType type, Procedure3<? super EObject, ? super JvmType, ? super String> errorHandler) { if (source != null && type != null) { final ExtraLanguageTypeConverter converter = getTypeConverter(); final String qn = type.getQualifiedName(); if (converter != null && !converter.hasConversion(qn)) { if (errorHandler != null) { errorHandler.apply(source, type, qn); } return false; } } return true; } }
public class class_name { protected boolean doTypeMappingCheck(EObject source, JvmType type, Procedure3<? super EObject, ? super JvmType, ? super String> errorHandler) { if (source != null && type != null) { final ExtraLanguageTypeConverter converter = getTypeConverter(); final String qn = type.getQualifiedName(); if (converter != null && !converter.hasConversion(qn)) { if (errorHandler != null) { errorHandler.apply(source, type, qn); // depends on control dependency: [if], data = [none] } return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public void truncateAdditionalInfo(final String textMetricsPrefix, final int widgetWidth) { for (Widget addInfo : m_additionalInfo) { ((AdditionalInfoItem)addInfo).truncate(textMetricsPrefix, widgetWidth - 10); } } }
public class class_name { public void truncateAdditionalInfo(final String textMetricsPrefix, final int widgetWidth) { for (Widget addInfo : m_additionalInfo) { ((AdditionalInfoItem)addInfo).truncate(textMetricsPrefix, widgetWidth - 10); // depends on control dependency: [for], data = [addInfo] } } }
public class class_name { private PointSequence createPointSequence(double[][] coordinates, CrsId crsId) { if (coordinates == null) { return null; } else if (coordinates.length == 0) { return PointCollectionFactory.createEmpty(); } DimensionalFlag df = coordinates[0].length == 4 ? DimensionalFlag.d3DM : coordinates[0].length == 3 ? DimensionalFlag.d3D : DimensionalFlag.d2D; PointSequenceBuilder psb = PointSequenceBuilders.variableSized(df, crsId); for (double[] point : coordinates) { psb.add(point); } return psb.toPointSequence(); } }
public class class_name { private PointSequence createPointSequence(double[][] coordinates, CrsId crsId) { if (coordinates == null) { return null; // depends on control dependency: [if], data = [none] } else if (coordinates.length == 0) { return PointCollectionFactory.createEmpty(); // depends on control dependency: [if], data = [none] } DimensionalFlag df = coordinates[0].length == 4 ? DimensionalFlag.d3DM : coordinates[0].length == 3 ? DimensionalFlag.d3D : DimensionalFlag.d2D; PointSequenceBuilder psb = PointSequenceBuilders.variableSized(df, crsId); for (double[] point : coordinates) { psb.add(point); // depends on control dependency: [for], data = [point] } return psb.toPointSequence(); } }
public class class_name { public static String trimRight(final String src) { int len = src.length(); int count = len; while ((len > 0) && (CharUtil.isWhitespace(src.charAt(len - 1)))) { len--; } return (len < count) ? src.substring(0, len) : src; } }
public class class_name { public static String trimRight(final String src) { int len = src.length(); int count = len; while ((len > 0) && (CharUtil.isWhitespace(src.charAt(len - 1)))) { len--; // depends on control dependency: [while], data = [none] } return (len < count) ? src.substring(0, len) : src; } }
public class class_name { public static String appendPiecesForUri(String... pieces) { if (pieces==null || pieces.length==0) return ""; // join parts && strip double slashes StringBuilder builder = new StringBuilder(16 * pieces.length); char previous = 0; for (int i=0; i < pieces.length;i++) { String piece = pieces[i]; if (piece != null && piece.length() > 0) { for (int j=0, maxlen=piece.length();j < maxlen;j++) { char current=piece.charAt(j); if (!(previous=='/' && current=='/')) { builder.append(current); previous = current; } } if (i + 1 < pieces.length && previous != '/') { builder.append('/'); previous='/'; } } } return builder.toString(); } }
public class class_name { public static String appendPiecesForUri(String... pieces) { if (pieces==null || pieces.length==0) return ""; // join parts && strip double slashes StringBuilder builder = new StringBuilder(16 * pieces.length); char previous = 0; for (int i=0; i < pieces.length;i++) { String piece = pieces[i]; if (piece != null && piece.length() > 0) { for (int j=0, maxlen=piece.length();j < maxlen;j++) { char current=piece.charAt(j); if (!(previous=='/' && current=='/')) { builder.append(current); // depends on control dependency: [if], data = [none] previous = current; // depends on control dependency: [if], data = [none] } } if (i + 1 < pieces.length && previous != '/') { builder.append('/'); // depends on control dependency: [if], data = ['/')] previous='/'; // depends on control dependency: [if], data = [none] } } } return builder.toString(); } }
public class class_name { @Override public void removeByUuid(String uuid) { for (CPDAvailabilityEstimate cpdAvailabilityEstimate : findByUuid( uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpdAvailabilityEstimate); } } }
public class class_name { @Override public void removeByUuid(String uuid) { for (CPDAvailabilityEstimate cpdAvailabilityEstimate : findByUuid( uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpdAvailabilityEstimate); // depends on control dependency: [for], data = [cpdAvailabilityEstimate] } } }
public class class_name { public void updateProgress(long latestProgress, long expectedProgress) { lastProgress = progress; progress = latestProgress; expected = expectedProgress; if (connected() == false) state = State.CONNECTED; else state = State.UPDATE; // The threshold effectively divides the progress into // different set of ranges: // // Range 0: 0..threshold-1, // Range 1: threshold .. 2*threshold-1 // .... // Range n: n*threshold .. (n+1)*threshold-1 // // To determine which range the progress belongs to, it // would be calculated as follow: // // range number = progress / threshold // // Notification should only be triggered when the current // progress and the last progress are in different ranges, // i.e. they have different range numbers. // // Using this range scheme, notification will be generated // only once when the progress reaches each range. // if (lastProgress / threshold != progress / threshold) { progressMonitor.updateProgress(this); } // Detect read overrun if (expected != -1) { if (progress >= expected && progress != 0) close(); } } }
public class class_name { public void updateProgress(long latestProgress, long expectedProgress) { lastProgress = progress; progress = latestProgress; expected = expectedProgress; if (connected() == false) state = State.CONNECTED; else state = State.UPDATE; // The threshold effectively divides the progress into // different set of ranges: // // Range 0: 0..threshold-1, // Range 1: threshold .. 2*threshold-1 // .... // Range n: n*threshold .. (n+1)*threshold-1 // // To determine which range the progress belongs to, it // would be calculated as follow: // // range number = progress / threshold // // Notification should only be triggered when the current // progress and the last progress are in different ranges, // i.e. they have different range numbers. // // Using this range scheme, notification will be generated // only once when the progress reaches each range. // if (lastProgress / threshold != progress / threshold) { progressMonitor.updateProgress(this); // depends on control dependency: [if], data = [none] } // Detect read overrun if (expected != -1) { if (progress >= expected && progress != 0) close(); } } }
public class class_name { private static void weightAdjoint(final Hypergraph graph, final Hyperpotential w, final Algebra s, final Scores scores, final HyperedgeDoubleFn lambda, final boolean backOutside) { final double[] alpha = scores.alpha; final double[] beta = scores.beta; final double[] alphaAdj = scores.alphaAdj; final double[] betaAdj = scores.betaAdj; graph.applyTopoSort(new HyperedgeFn() { @Override public void apply(Hyperedge e) { // \adj{w_e} += \adj{\beta_{H(e)} * \prod_{j \in T(e)} \beta_j int i = e.getHeadNode().getId(); double prod = betaAdj[i]; for (Hypernode jNode : e.getTailNodes()) { int j = jNode.getId(); prod = s.times(prod, beta[j]); } double w_e = prod; if (backOutside) { // \adj{w_e} += \adj{\alpha_j} * \alpha_{H(e)} * \prod_{k \in T(e) : k \neq j} \beta_k for (Hypernode jNode : e.getTailNodes()) { int j = jNode.getId(); prod = s.times(alphaAdj[j], alpha[i]); for (Hypernode kNode : e.getTailNodes()) { int k = kNode.getId(); if (k == j) { continue; } prod = s.times(prod, beta[k]); } w_e = s.plus(w_e, prod); } } lambda.apply(e, w_e); } }); } }
public class class_name { private static void weightAdjoint(final Hypergraph graph, final Hyperpotential w, final Algebra s, final Scores scores, final HyperedgeDoubleFn lambda, final boolean backOutside) { final double[] alpha = scores.alpha; final double[] beta = scores.beta; final double[] alphaAdj = scores.alphaAdj; final double[] betaAdj = scores.betaAdj; graph.applyTopoSort(new HyperedgeFn() { @Override public void apply(Hyperedge e) { // \adj{w_e} += \adj{\beta_{H(e)} * \prod_{j \in T(e)} \beta_j int i = e.getHeadNode().getId(); double prod = betaAdj[i]; for (Hypernode jNode : e.getTailNodes()) { int j = jNode.getId(); prod = s.times(prod, beta[j]); // depends on control dependency: [for], data = [none] } double w_e = prod; if (backOutside) { // \adj{w_e} += \adj{\alpha_j} * \alpha_{H(e)} * \prod_{k \in T(e) : k \neq j} \beta_k for (Hypernode jNode : e.getTailNodes()) { int j = jNode.getId(); prod = s.times(alphaAdj[j], alpha[i]); // depends on control dependency: [for], data = [none] for (Hypernode kNode : e.getTailNodes()) { int k = kNode.getId(); if (k == j) { continue; } prod = s.times(prod, beta[k]); // depends on control dependency: [for], data = [none] } w_e = s.plus(w_e, prod); // depends on control dependency: [for], data = [none] } } lambda.apply(e, w_e); } }); } }
public class class_name { public EEnum getIfcSpaceTypeEnum() { if (ifcSpaceTypeEnumEEnum == null) { ifcSpaceTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(901); } return ifcSpaceTypeEnumEEnum; } }
public class class_name { public EEnum getIfcSpaceTypeEnum() { if (ifcSpaceTypeEnumEEnum == null) { ifcSpaceTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(901); // depends on control dependency: [if], data = [none] } return ifcSpaceTypeEnumEEnum; } }
public class class_name { public ListAppsResult withApps(AppSummary... apps) { if (this.apps == null) { setApps(new java.util.ArrayList<AppSummary>(apps.length)); } for (AppSummary ele : apps) { this.apps.add(ele); } return this; } }
public class class_name { public ListAppsResult withApps(AppSummary... apps) { if (this.apps == null) { setApps(new java.util.ArrayList<AppSummary>(apps.length)); // depends on control dependency: [if], data = [none] } for (AppSummary ele : apps) { this.apps.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private void resolveProxyKeyUsage() { boolean[] keyUsages = proxyCredential.getCertificate().getKeyUsage(); if (keyUsages != null) { int index = 0; for (boolean key : keyUsages) { if (key) proxyKeyUsageList.add(keyUsagesValues[index]); index++; } } } }
public class class_name { private void resolveProxyKeyUsage() { boolean[] keyUsages = proxyCredential.getCertificate().getKeyUsage(); if (keyUsages != null) { int index = 0; for (boolean key : keyUsages) { if (key) proxyKeyUsageList.add(keyUsagesValues[index]); index++; // depends on control dependency: [for], data = [none] } } } }
public class class_name { protected String generateProjectName(CmsObject userCms) { String projectName = generateProjectName(userCms, true); if (existsProject(projectName)) { projectName = generateProjectName(userCms, false); } return projectName; } }
public class class_name { protected String generateProjectName(CmsObject userCms) { String projectName = generateProjectName(userCms, true); if (existsProject(projectName)) { projectName = generateProjectName(userCms, false); // depends on control dependency: [if], data = [none] } return projectName; } }
public class class_name { private String trim(String line) { char[] chars = line.toCharArray(); int len = chars.length; while (len > 0) { if (!Character.isWhitespace(chars[len - 1])) { break; } len--; } return line.substring(0, len); } }
public class class_name { private String trim(String line) { char[] chars = line.toCharArray(); int len = chars.length; while (len > 0) { if (!Character.isWhitespace(chars[len - 1])) { break; } len--; // depends on control dependency: [while], data = [none] } return line.substring(0, len); } }
public class class_name { @Override public TitanVertex addVertex(Object... keyValues) { ElementHelper.legalPropertyKeyValueArray(keyValues); if (ElementHelper.getIdValue(keyValues).isPresent()) throw Vertex.Exceptions.userSuppliedIdsNotSupported(); Object labelValue = null; for (int i = 0; i < keyValues.length; i = i + 2) { if (keyValues[i].equals(T.label)) { labelValue = keyValues[i+1]; Preconditions.checkArgument(labelValue instanceof VertexLabel || labelValue instanceof String, "Expected a string or VertexLabel as the vertex label argument, but got: %s",labelValue); if (labelValue instanceof String) ElementHelper.validateLabel((String) labelValue); } } VertexLabel label = BaseVertexLabel.DEFAULT_VERTEXLABEL; if (labelValue!=null) { label = (labelValue instanceof VertexLabel)?(VertexLabel)labelValue:getOrCreateVertexLabel((String) labelValue); } final TitanVertex vertex = addVertex(null,label); // for (int i = 0; i < keyValues.length; i = i + 2) { // if (!keyValues[i].equals(T.id) && !keyValues[i].equals(T.label)) // ((StandardTitanTx)this).addPropertyInternal(vertex,getOrCreatePropertyKey((String) keyValues[i]),keyValues[i+1]); // } com.thinkaurelius.titan.graphdb.util.ElementHelper.attachProperties(vertex, keyValues); return vertex; } }
public class class_name { @Override public TitanVertex addVertex(Object... keyValues) { ElementHelper.legalPropertyKeyValueArray(keyValues); if (ElementHelper.getIdValue(keyValues).isPresent()) throw Vertex.Exceptions.userSuppliedIdsNotSupported(); Object labelValue = null; for (int i = 0; i < keyValues.length; i = i + 2) { if (keyValues[i].equals(T.label)) { labelValue = keyValues[i+1]; // depends on control dependency: [if], data = [none] Preconditions.checkArgument(labelValue instanceof VertexLabel || labelValue instanceof String, "Expected a string or VertexLabel as the vertex label argument, but got: %s",labelValue); // depends on control dependency: [if], data = [none] if (labelValue instanceof String) ElementHelper.validateLabel((String) labelValue); } } VertexLabel label = BaseVertexLabel.DEFAULT_VERTEXLABEL; if (labelValue!=null) { label = (labelValue instanceof VertexLabel)?(VertexLabel)labelValue:getOrCreateVertexLabel((String) labelValue); // depends on control dependency: [if], data = [(labelValue] } final TitanVertex vertex = addVertex(null,label); // for (int i = 0; i < keyValues.length; i = i + 2) { // if (!keyValues[i].equals(T.id) && !keyValues[i].equals(T.label)) // ((StandardTitanTx)this).addPropertyInternal(vertex,getOrCreatePropertyKey((String) keyValues[i]),keyValues[i+1]); // } com.thinkaurelius.titan.graphdb.util.ElementHelper.attachProperties(vertex, keyValues); return vertex; } }
public class class_name { public void stopAllTasks() { ICBTask task; stopSign = true; while ((task = queue.poll()) != null) { task.stopTask(); } } }
public class class_name { public void stopAllTasks() { ICBTask task; stopSign = true; while ((task = queue.poll()) != null) { task.stopTask(); // depends on control dependency: [while], data = [none] } } }
public class class_name { public Optional<ArrayLabelSetter> create(final Class<?> beanClass, final String fieldName) { ArgUtils.notNull(beanClass, "beanClass"); ArgUtils.notEmpty(fieldName, "fieldName"); // フィールド Map labelsの場合 Optional<ArrayLabelSetter> arrayLabelSetter = createMapField(beanClass, fieldName); if(arrayLabelSetter.isPresent()) { return arrayLabelSetter; } // setter メソッドの場合 arrayLabelSetter = createMethod(beanClass, fieldName); if(arrayLabelSetter.isPresent()) { return arrayLabelSetter; } // フィールド + labelの場合 arrayLabelSetter = createField(beanClass, fieldName); if(arrayLabelSetter.isPresent()) { return arrayLabelSetter; } return Optional.empty(); } }
public class class_name { public Optional<ArrayLabelSetter> create(final Class<?> beanClass, final String fieldName) { ArgUtils.notNull(beanClass, "beanClass"); ArgUtils.notEmpty(fieldName, "fieldName"); // フィールド Map labelsの場合 Optional<ArrayLabelSetter> arrayLabelSetter = createMapField(beanClass, fieldName); if(arrayLabelSetter.isPresent()) { return arrayLabelSetter; // depends on control dependency: [if], data = [none] } // setter メソッドの場合 arrayLabelSetter = createMethod(beanClass, fieldName); if(arrayLabelSetter.isPresent()) { return arrayLabelSetter; // depends on control dependency: [if], data = [none] } // フィールド + labelの場合 arrayLabelSetter = createField(beanClass, fieldName); if(arrayLabelSetter.isPresent()) { return arrayLabelSetter; // depends on control dependency: [if], data = [none] } return Optional.empty(); } }
public class class_name { public static <T, R> Publisher<R> map(Publisher<T> publisher, Function<T, R> mapper) { return actual -> publisher.subscribe(new CompletionAwareSubscriber<T>() { @Override protected void doOnSubscribe(Subscription subscription) { actual.onSubscribe(subscription); } @Override protected void doOnNext(T message) { try { R result = Objects.requireNonNull(mapper.apply(message), "The mapper returned a null value."); actual.onNext(result); } catch (Throwable e) { onError(e); } } @Override protected void doOnError(Throwable t) { actual.onError(t); } @Override protected void doOnComplete() { actual.onComplete(); } }); } }
public class class_name { public static <T, R> Publisher<R> map(Publisher<T> publisher, Function<T, R> mapper) { return actual -> publisher.subscribe(new CompletionAwareSubscriber<T>() { @Override protected void doOnSubscribe(Subscription subscription) { actual.onSubscribe(subscription); } @Override protected void doOnNext(T message) { try { R result = Objects.requireNonNull(mapper.apply(message), "The mapper returned a null value."); actual.onNext(result); // depends on control dependency: [try], data = [none] } catch (Throwable e) { onError(e); } // depends on control dependency: [catch], data = [none] } @Override protected void doOnError(Throwable t) { actual.onError(t); } @Override protected void doOnComplete() { actual.onComplete(); } }); } }
public class class_name { private boolean match(Path.ID id, int idIndex, int myIndex, boolean submatch) { int mySize = depth + 1; if (myIndex == mySize && idIndex == id.size()) { return true; } else if(idIndex == id.size()) { return submatch; } else if (myIndex == mySize) { return false; } String myComponent = get(myIndex); if (myComponent.equals("*")) { return match(id, idIndex + 1, myIndex + 1, submatch); } else if (myComponent.equals("**")) { myIndex++; for (int i = idIndex; i <= id.size(); ++i) { if (match(id, i, myIndex, submatch)) { return true; } } return false; } else { return myComponent.equals(id.get(idIndex)) && match(id, idIndex + 1, myIndex + 1, submatch); } } }
public class class_name { private boolean match(Path.ID id, int idIndex, int myIndex, boolean submatch) { int mySize = depth + 1; if (myIndex == mySize && idIndex == id.size()) { return true; // depends on control dependency: [if], data = [none] } else if(idIndex == id.size()) { return submatch; // depends on control dependency: [if], data = [none] } else if (myIndex == mySize) { return false; // depends on control dependency: [if], data = [none] } String myComponent = get(myIndex); if (myComponent.equals("*")) { return match(id, idIndex + 1, myIndex + 1, submatch); // depends on control dependency: [if], data = [none] } else if (myComponent.equals("**")) { myIndex++; // depends on control dependency: [if], data = [none] for (int i = idIndex; i <= id.size(); ++i) { if (match(id, i, myIndex, submatch)) { return true; // depends on control dependency: [if], data = [none] } } return false; // depends on control dependency: [if], data = [none] } else { return myComponent.equals(id.get(idIndex)) && match(id, idIndex + 1, myIndex + 1, submatch); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean hasJoinOperation(String selectQuery) { if (selectQuery == null || selectQuery.length() == 0) { return false; } SqlParser sqlParser = SqlParser.create(selectQuery); try { SqlNode all = sqlParser.parseQuery(); SqlSelect query; if (all instanceof SqlSelect) { query = (SqlSelect) all; } else if (all instanceof SqlOrderBy) { query = (SqlSelect) ((SqlOrderBy) all).query; } else { throw new UnsupportedOperationException("The select query is type of " + all.getClass() + " which is not supported here"); } return query.getFrom().getKind() == SqlKind.JOIN; } catch (SqlParseException e) { return false; } } }
public class class_name { public static boolean hasJoinOperation(String selectQuery) { if (selectQuery == null || selectQuery.length() == 0) { return false; // depends on control dependency: [if], data = [none] } SqlParser sqlParser = SqlParser.create(selectQuery); try { SqlNode all = sqlParser.parseQuery(); SqlSelect query; if (all instanceof SqlSelect) { query = (SqlSelect) all; // depends on control dependency: [if], data = [none] } else if (all instanceof SqlOrderBy) { query = (SqlSelect) ((SqlOrderBy) all).query; // depends on control dependency: [if], data = [none] } else { throw new UnsupportedOperationException("The select query is type of " + all.getClass() + " which is not supported here"); } return query.getFrom().getKind() == SqlKind.JOIN; // depends on control dependency: [try], data = [none] } catch (SqlParseException e) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public TemplateStore getTemplateStore() { if (fTemplateStore == null) { fTemplateStore = new ContributionTemplateStore(getTemplateContextRegistry(), getPreferenceStore(), "org.eclipse.wst.sse.ui.custom_templates"); try { fTemplateStore.load(); } catch (IOException e) { logError("",e); } } return fTemplateStore; } }
public class class_name { public TemplateStore getTemplateStore() { if (fTemplateStore == null) { fTemplateStore = new ContributionTemplateStore(getTemplateContextRegistry(), getPreferenceStore(), "org.eclipse.wst.sse.ui.custom_templates"); // depends on control dependency: [if], data = [none] try { fTemplateStore.load(); // depends on control dependency: [try], data = [none] } catch (IOException e) { logError("",e); } // depends on control dependency: [catch], data = [none] } return fTemplateStore; } }
public class class_name { @Override public Object visit(Object context, ForVarDeclStatement statement, boolean strict) { Scope scope = (Scope) context; List<VariableDeclaration> decls = statement.getDeclarationList(); for (VariableDeclaration each : decls) { each.accept(context, this, strict); } final Label startLabel = scope.getNewLabel(); final Label doneLabel = scope.getNewLabel(); scope.addInstruction(new LabelInstr(startLabel)); // TEST scope.addInstruction(new BEQ((Operand) statement.getTest().accept(context, this, strict), BooleanLiteral.FALSE, doneLabel)); // BODY statement.getBlock().accept(context, this, strict); // INCREMENT statement.getIncrement().accept(context, this, strict); scope.addInstruction(new Jump(startLabel)); // END scope.addInstruction(new LabelInstr(doneLabel)); return Undefined.UNDEFINED; } }
public class class_name { @Override public Object visit(Object context, ForVarDeclStatement statement, boolean strict) { Scope scope = (Scope) context; List<VariableDeclaration> decls = statement.getDeclarationList(); for (VariableDeclaration each : decls) { each.accept(context, this, strict); // depends on control dependency: [for], data = [each] } final Label startLabel = scope.getNewLabel(); final Label doneLabel = scope.getNewLabel(); scope.addInstruction(new LabelInstr(startLabel)); // TEST scope.addInstruction(new BEQ((Operand) statement.getTest().accept(context, this, strict), BooleanLiteral.FALSE, doneLabel)); // BODY statement.getBlock().accept(context, this, strict); // INCREMENT statement.getIncrement().accept(context, this, strict); scope.addInstruction(new Jump(startLabel)); // END scope.addInstruction(new LabelInstr(doneLabel)); return Undefined.UNDEFINED; } }
public class class_name { private Region find(Region x) { Region current = this.root; while (current != NULL_NODE) { long res = x.orderRelativeTo(current); if (res < 0) { current = current.left; } else if (res > 0) { current = current.right; } else { return current; } } return null; } }
public class class_name { private Region find(Region x) { Region current = this.root; while (current != NULL_NODE) { long res = x.orderRelativeTo(current); if (res < 0) { current = current.left; // depends on control dependency: [if], data = [none] } else if (res > 0) { current = current.right; // depends on control dependency: [if], data = [none] } else { return current; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void marshall(SetIdentityPoolConfigurationRequest setIdentityPoolConfigurationRequest, ProtocolMarshaller protocolMarshaller) { if (setIdentityPoolConfigurationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(setIdentityPoolConfigurationRequest.getIdentityPoolId(), IDENTITYPOOLID_BINDING); protocolMarshaller.marshall(setIdentityPoolConfigurationRequest.getPushSync(), PUSHSYNC_BINDING); protocolMarshaller.marshall(setIdentityPoolConfigurationRequest.getCognitoStreams(), COGNITOSTREAMS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SetIdentityPoolConfigurationRequest setIdentityPoolConfigurationRequest, ProtocolMarshaller protocolMarshaller) { if (setIdentityPoolConfigurationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(setIdentityPoolConfigurationRequest.getIdentityPoolId(), IDENTITYPOOLID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(setIdentityPoolConfigurationRequest.getPushSync(), PUSHSYNC_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(setIdentityPoolConfigurationRequest.getCognitoStreams(), COGNITOSTREAMS_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 toStringList(final StringBuilder sb, final List < ? > list, final String title) { sb.append(','); sb.append(title + ":["); boolean first = true; for (Object child : list) { if (!first) { sb.append(","); } else { first = false; } sb.append(child.toString()); } sb.append("]"); } }
public class class_name { private void toStringList(final StringBuilder sb, final List < ? > list, final String title) { sb.append(','); sb.append(title + ":["); boolean first = true; for (Object child : list) { if (!first) { sb.append(","); // depends on control dependency: [if], data = [none] } else { first = false; // depends on control dependency: [if], data = [none] } sb.append(child.toString()); // depends on control dependency: [for], data = [child] } sb.append("]"); } }
public class class_name { private static Response send(HttpRequestBase httpRequest, Credentials credentials, Header[] requestHeaders) throws URISyntaxException, HttpException { CloseableHttpClient httpClient = null; CloseableHttpResponse httpResponse = null; Response response = new Response(); HttpClientContext httpContext = HttpClientContext.create(); URI uri = httpRequest.getURI(); HttpHost systemProxy = null; AuthScope proxyAuthScope = null; UsernamePasswordCredentials proxyCredentials = null; try { String uriScheme = uri.getScheme(); String httpsProxyUser = System.getProperty("https.proxyUser"); String httpsProxyPassword = System.getProperty("https.proxyPassword"); String httpProxyUser = System.getProperty("http.proxyUser"); String httpProxyPassword = System.getProperty("http.proxyPassword"); systemProxy = getSystemProxy(uri); if (systemProxy != null) { String proxyHostName = systemProxy.getHostName(); int proxyPort = systemProxy.getPort(); LOG.debug("Using proxy hostname from system proxy: " + proxyHostName); LOG.debug("Using proxy port from system proxy: " + proxyPort); proxyAuthScope = new AuthScope(systemProxy.getHostName(), systemProxy.getPort()); if (StringUtils.equalsIgnoreCase(uriScheme, "http")) { LOG.debug("Using http proxy"); if (!StringUtils.isEmpty(httpProxyUser) && !StringUtils.isEmpty(httpProxyPassword)) { LOG.debug("Using proxy user and password for the http proxy " + proxyHostName); proxyCredentials = new UsernamePasswordCredentials(httpProxyUser, httpProxyPassword); } } else if (StringUtils.equalsIgnoreCase(uriScheme, "https")) { LOG.debug("Using https proxy"); if (!StringUtils.isEmpty(httpsProxyUser) && !StringUtils.isEmpty(httpsProxyPassword)) { LOG.debug("Using proxy user and password for the https proxy " + proxyHostName); proxyCredentials = new UsernamePasswordCredentials(httpsProxyUser, httpsProxyPassword); } } } } catch (UnknownHostException e) { LOG.error("Error while detecting system wide proxy: " + e.getMessage()); } // set the request configuration that will passed to the httpRequest RequestConfig requestConfig = RequestConfig.custom() .setConnectionRequestTimeout(httpTimeout) .setConnectTimeout(httpTimeout) .setSocketTimeout(httpTimeout) .setProxy(systemProxy) .build(); // set (preemptive) authentication if credentials are given if (credentials != null || (proxyAuthScope != null && proxyCredentials != null)) { CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); if (proxyAuthScope != null && proxyCredentials != null) { credentialsProvider.setCredentials( proxyAuthScope, proxyCredentials ); } if (credentials != null) { credentialsProvider.setCredentials( new AuthScope(uri.getHost(), uri.getPort()), credentials ); } HttpHost targetHost = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme()); AuthCache authCache = new BasicAuthCache(); authCache.put(targetHost, new BasicScheme()); httpContext.setCredentialsProvider(credentialsProvider); httpContext.setAuthCache(authCache); httpClient = HttpClients.custom() .setDefaultCredentialsProvider(credentialsProvider) .build(); } else { httpClient = HttpClients.createDefault(); } try { HttpHeaders headersMap = new HttpHeaders(); httpRequest.setConfig(requestConfig); // apply HTTP header if (requestHeaders != null) { httpRequest.setHeaders(requestHeaders); } httpResponse = httpClient.execute(httpRequest, httpContext); HttpStatus httpStatus = HttpStatus.valueOf( httpResponse.getStatusLine().getStatusCode()); Header[] headers = httpResponse.getAllHeaders(); HttpEntity httpResponseEntity = httpResponse.getEntity(); response.setStatusCode(httpStatus); for (Header header : headers) { if (header.getName().equalsIgnoreCase("Transfer-Encoding") && header.getValue().equalsIgnoreCase("chunked")) { LOG.trace("Removed the header 'Transfer-Encoding:chunked'" + " from a response, as its handled by the http-client"); } else { headersMap.set(header.getName(), header.getValue()); } } response.setHeaders(headersMap); if (httpResponseEntity != null) { response.setBody(EntityUtils.toByteArray(httpResponseEntity)); } } catch (IOException e) { throw new HttpException("Error while getting a response from " + uri + ": " + e.getMessage()); } finally { // cleanup httpRequest.reset(); IOUtils.closeQuietly(httpResponse); IOUtils.closeQuietly(httpClient); } return response; } }
public class class_name { private static Response send(HttpRequestBase httpRequest, Credentials credentials, Header[] requestHeaders) throws URISyntaxException, HttpException { CloseableHttpClient httpClient = null; CloseableHttpResponse httpResponse = null; Response response = new Response(); HttpClientContext httpContext = HttpClientContext.create(); URI uri = httpRequest.getURI(); HttpHost systemProxy = null; AuthScope proxyAuthScope = null; UsernamePasswordCredentials proxyCredentials = null; try { String uriScheme = uri.getScheme(); String httpsProxyUser = System.getProperty("https.proxyUser"); String httpsProxyPassword = System.getProperty("https.proxyPassword"); String httpProxyUser = System.getProperty("http.proxyUser"); String httpProxyPassword = System.getProperty("http.proxyPassword"); systemProxy = getSystemProxy(uri); if (systemProxy != null) { String proxyHostName = systemProxy.getHostName(); int proxyPort = systemProxy.getPort(); LOG.debug("Using proxy hostname from system proxy: " + proxyHostName); // depends on control dependency: [if], data = [none] LOG.debug("Using proxy port from system proxy: " + proxyPort); // depends on control dependency: [if], data = [none] proxyAuthScope = new AuthScope(systemProxy.getHostName(), systemProxy.getPort()); // depends on control dependency: [if], data = [(systemProxy] if (StringUtils.equalsIgnoreCase(uriScheme, "http")) { LOG.debug("Using http proxy"); // depends on control dependency: [if], data = [none] if (!StringUtils.isEmpty(httpProxyUser) && !StringUtils.isEmpty(httpProxyPassword)) { LOG.debug("Using proxy user and password for the http proxy " + proxyHostName); // depends on control dependency: [if], data = [none] proxyCredentials = new UsernamePasswordCredentials(httpProxyUser, httpProxyPassword); // depends on control dependency: [if], data = [none] } } else if (StringUtils.equalsIgnoreCase(uriScheme, "https")) { LOG.debug("Using https proxy"); // depends on control dependency: [if], data = [none] if (!StringUtils.isEmpty(httpsProxyUser) && !StringUtils.isEmpty(httpsProxyPassword)) { LOG.debug("Using proxy user and password for the https proxy " + proxyHostName); // depends on control dependency: [if], data = [none] proxyCredentials = new UsernamePasswordCredentials(httpsProxyUser, httpsProxyPassword); // depends on control dependency: [if], data = [none] } } } } catch (UnknownHostException e) { LOG.error("Error while detecting system wide proxy: " + e.getMessage()); } // set the request configuration that will passed to the httpRequest RequestConfig requestConfig = RequestConfig.custom() .setConnectionRequestTimeout(httpTimeout) .setConnectTimeout(httpTimeout) .setSocketTimeout(httpTimeout) .setProxy(systemProxy) .build(); // set (preemptive) authentication if credentials are given if (credentials != null || (proxyAuthScope != null && proxyCredentials != null)) { CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); if (proxyAuthScope != null && proxyCredentials != null) { credentialsProvider.setCredentials( proxyAuthScope, proxyCredentials ); // depends on control dependency: [if], data = [none] } if (credentials != null) { credentialsProvider.setCredentials( new AuthScope(uri.getHost(), uri.getPort()), credentials ); // depends on control dependency: [if], data = [none] } HttpHost targetHost = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme()); AuthCache authCache = new BasicAuthCache(); authCache.put(targetHost, new BasicScheme()); httpContext.setCredentialsProvider(credentialsProvider); httpContext.setAuthCache(authCache); httpClient = HttpClients.custom() .setDefaultCredentialsProvider(credentialsProvider) .build(); } else { httpClient = HttpClients.createDefault(); } try { HttpHeaders headersMap = new HttpHeaders(); httpRequest.setConfig(requestConfig); // apply HTTP header if (requestHeaders != null) { httpRequest.setHeaders(requestHeaders); // depends on control dependency: [if], data = [(requestHeaders] } httpResponse = httpClient.execute(httpRequest, httpContext); HttpStatus httpStatus = HttpStatus.valueOf( httpResponse.getStatusLine().getStatusCode()); Header[] headers = httpResponse.getAllHeaders(); HttpEntity httpResponseEntity = httpResponse.getEntity(); response.setStatusCode(httpStatus); for (Header header : headers) { if (header.getName().equalsIgnoreCase("Transfer-Encoding") && header.getValue().equalsIgnoreCase("chunked")) { LOG.trace("Removed the header 'Transfer-Encoding:chunked'" + " from a response, as its handled by the http-client"); // depends on control dependency: [if], data = [none] } else { headersMap.set(header.getName(), header.getValue()); // depends on control dependency: [if], data = [none] } } response.setHeaders(headersMap); if (httpResponseEntity != null) { response.setBody(EntityUtils.toByteArray(httpResponseEntity)); // depends on control dependency: [if], data = [(httpResponseEntity] } } catch (IOException e) { throw new HttpException("Error while getting a response from " + uri + ": " + e.getMessage()); } finally { // cleanup httpRequest.reset(); IOUtils.closeQuietly(httpResponse); IOUtils.closeQuietly(httpClient); } return response; } }
public class class_name { public boolean isRepeated(final String _plainPassword) { boolean ret = false; for (int i = 1; i < this.threshold + 1; i++) { ret = check(_plainPassword, i); if (ret) { break; } } return ret; } }
public class class_name { public boolean isRepeated(final String _plainPassword) { boolean ret = false; for (int i = 1; i < this.threshold + 1; i++) { ret = check(_plainPassword, i); // depends on control dependency: [for], data = [i] if (ret) { break; } } return ret; } }
public class class_name { public EClass getIfcParameterValue() { if (ifcParameterValueEClass == null) { ifcParameterValueEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(721); } return ifcParameterValueEClass; } }
public class class_name { public EClass getIfcParameterValue() { if (ifcParameterValueEClass == null) { ifcParameterValueEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(721); // depends on control dependency: [if], data = [none] } return ifcParameterValueEClass; } }
public class class_name { public String[] getBuildMetaDataParts() { if (this.buildMetaDataParts.length == 0) { return EMPTY_ARRAY; } return Arrays.copyOf(this.buildMetaDataParts, this.buildMetaDataParts.length); } }
public class class_name { public String[] getBuildMetaDataParts() { if (this.buildMetaDataParts.length == 0) { return EMPTY_ARRAY; // depends on control dependency: [if], data = [none] } return Arrays.copyOf(this.buildMetaDataParts, this.buildMetaDataParts.length); } }
public class class_name { public void marshall(Volume volume, ProtocolMarshaller protocolMarshaller) { if (volume == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(volume.getVolumeId(), VOLUMEID_BINDING); protocolMarshaller.marshall(volume.getEc2VolumeId(), EC2VOLUMEID_BINDING); protocolMarshaller.marshall(volume.getName(), NAME_BINDING); protocolMarshaller.marshall(volume.getRaidArrayId(), RAIDARRAYID_BINDING); protocolMarshaller.marshall(volume.getInstanceId(), INSTANCEID_BINDING); protocolMarshaller.marshall(volume.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(volume.getSize(), SIZE_BINDING); protocolMarshaller.marshall(volume.getDevice(), DEVICE_BINDING); protocolMarshaller.marshall(volume.getMountPoint(), MOUNTPOINT_BINDING); protocolMarshaller.marshall(volume.getRegion(), REGION_BINDING); protocolMarshaller.marshall(volume.getAvailabilityZone(), AVAILABILITYZONE_BINDING); protocolMarshaller.marshall(volume.getVolumeType(), VOLUMETYPE_BINDING); protocolMarshaller.marshall(volume.getIops(), IOPS_BINDING); protocolMarshaller.marshall(volume.getEncrypted(), ENCRYPTED_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Volume volume, ProtocolMarshaller protocolMarshaller) { if (volume == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(volume.getVolumeId(), VOLUMEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getEc2VolumeId(), EC2VOLUMEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getRaidArrayId(), RAIDARRAYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getInstanceId(), INSTANCEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getSize(), SIZE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getDevice(), DEVICE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getMountPoint(), MOUNTPOINT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getRegion(), REGION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getAvailabilityZone(), AVAILABILITYZONE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getVolumeType(), VOLUMETYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getIops(), IOPS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(volume.getEncrypted(), ENCRYPTED_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 List<String> getMatchingLongOptions(String token) { if (allowPartialMatching) { return options.getMatchingOptions(token); } else { List<String> matches = new ArrayList<>(1); if (options.hasLongOption(token)) { Option option = options.getOption(token); matches.add(option.getLongName()); } return matches; } } }
public class class_name { private List<String> getMatchingLongOptions(String token) { if (allowPartialMatching) { return options.getMatchingOptions(token); // depends on control dependency: [if], data = [none] } else { List<String> matches = new ArrayList<>(1); if (options.hasLongOption(token)) { Option option = options.getOption(token); matches.add(option.getLongName()); // depends on control dependency: [if], data = [none] } return matches; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String buildSpecializedPagedResultClass(TypeSpec.Builder classBuilder, SQLiteModelMethod method) { // TypeName entityTypeName = // TypeUtility.typeName(method.getParent().getEntityClassName()); TypeName entityTypeName = TypeUtility.typeName(method.getEntity().getName()); String pagedResultName = "PaginatedResult" + (pagedResultCounter++); TypeSpec.Builder typeBuilder = TypeSpec.classBuilder(pagedResultName).addModifiers(Modifier.PUBLIC) .superclass(TypeUtility.parameterizedTypeName(TypeUtility.className(PagedResultImpl.class), entityTypeName)); // add fields and define constructor MethodSpec.Builder setupBuilder = MethodSpec.constructorBuilder(); MethodSpec.Builder executeBuilder = MethodSpec.methodBuilder("execute").addModifiers(Modifier.PUBLIC) .returns(TypeUtility.parameterizedTypeName(TypeUtility.className(List.class), entityTypeName)); executeBuilder.addComment("Executor builder - BEGIN"); ClassName daoFactoryClassName = BindDaoFactoryBuilder.generateDaoFactoryClassName(method.getParent().getParent()); MethodSpec.Builder executeWithDaoFactortBuilder = MethodSpec.methodBuilder("execute").addParameter(daoFactoryClassName, "daoFactory").addModifiers(Modifier.PUBLIC) .returns(TypeUtility.parameterizedTypeName(TypeUtility.className(List.class), entityTypeName)); executeWithDaoFactortBuilder.addCode("return daoFactory.get$L().$L(", method.getParentName(), method.getName()); if (!method.isPagedLiveData()) { executeBuilder.addCode("list=$T.this.$L(", TypeUtility.typeName(method.getParent().getElement(), BindDaoBuilder.SUFFIX), method.getName()); } // we have always a first parameter String separator = ""; ParameterSpec parameterSpec; for (Pair<String, TypeName> item : method.getParameters()) { if (method.hasDynamicPageSizeConditions() && method.dynamicPageSizeName.equals(item.value0)) { setupBuilder.addStatement("this.pageSize=$L", item.value0); } else { // field typeBuilder.addField(item.value1, item.value0); setupBuilder.addStatement("this.$L=$L", item.value0, item.value0); } // construtor parameterSpec = ParameterSpec.builder(item.value1, item.value0).build(); setupBuilder.addParameter(parameterSpec); // execute if (method.dynamicPageSizeName != null && method.dynamicPageSizeName.equals(item.value0)) { if (!method.isPagedLiveData()) { executeBuilder.addCode(separator + "this.pageSize"); } executeWithDaoFactortBuilder.addCode(separator + "this.pageSize"); } else { if (!method.isPagedLiveData()) { executeBuilder.addCode(separator + item.value0); } executeWithDaoFactortBuilder.addCode(separator + item.value0); } separator = ", "; } if (method.isPagedLiveData()) { // if method is not paged live data, add complete execute method executeBuilder.addComment("paged result is used in live data, so this method must be empty"); executeBuilder.addStatement("return null"); } else { executeBuilder.addCode(separator + "this);\n"); executeBuilder.addStatement("return list"); } executeBuilder.addComment("Executor builder - END"); typeBuilder.addMethod(executeBuilder.build()); if (!method.hasDynamicPageSizeConditions()) { ModelAnnotation annotation = method.getAnnotation(BindSqlSelect.class); int pageSize = annotation.getAttributeAsInt(AnnotationAttributeType.PAGE_SIZE); // in case pageSize is not specified (only for liveData) if (pageSize == 0) { pageSize = 20; } setupBuilder.addStatement("this.pageSize=$L", pageSize); } typeBuilder.addMethod(setupBuilder.build()); executeWithDaoFactortBuilder.addCode(separator + "this);\n"); typeBuilder.addMethod(executeWithDaoFactortBuilder.build()); classBuilder.addType(typeBuilder.build()); return pagedResultName; } }
public class class_name { public static String buildSpecializedPagedResultClass(TypeSpec.Builder classBuilder, SQLiteModelMethod method) { // TypeName entityTypeName = // TypeUtility.typeName(method.getParent().getEntityClassName()); TypeName entityTypeName = TypeUtility.typeName(method.getEntity().getName()); String pagedResultName = "PaginatedResult" + (pagedResultCounter++); TypeSpec.Builder typeBuilder = TypeSpec.classBuilder(pagedResultName).addModifiers(Modifier.PUBLIC) .superclass(TypeUtility.parameterizedTypeName(TypeUtility.className(PagedResultImpl.class), entityTypeName)); // add fields and define constructor MethodSpec.Builder setupBuilder = MethodSpec.constructorBuilder(); MethodSpec.Builder executeBuilder = MethodSpec.methodBuilder("execute").addModifiers(Modifier.PUBLIC) .returns(TypeUtility.parameterizedTypeName(TypeUtility.className(List.class), entityTypeName)); executeBuilder.addComment("Executor builder - BEGIN"); ClassName daoFactoryClassName = BindDaoFactoryBuilder.generateDaoFactoryClassName(method.getParent().getParent()); MethodSpec.Builder executeWithDaoFactortBuilder = MethodSpec.methodBuilder("execute").addParameter(daoFactoryClassName, "daoFactory").addModifiers(Modifier.PUBLIC) .returns(TypeUtility.parameterizedTypeName(TypeUtility.className(List.class), entityTypeName)); executeWithDaoFactortBuilder.addCode("return daoFactory.get$L().$L(", method.getParentName(), method.getName()); if (!method.isPagedLiveData()) { executeBuilder.addCode("list=$T.this.$L(", TypeUtility.typeName(method.getParent().getElement(), BindDaoBuilder.SUFFIX), method.getName()); // depends on control dependency: [if], data = [none] } // we have always a first parameter String separator = ""; ParameterSpec parameterSpec; for (Pair<String, TypeName> item : method.getParameters()) { if (method.hasDynamicPageSizeConditions() && method.dynamicPageSizeName.equals(item.value0)) { setupBuilder.addStatement("this.pageSize=$L", item.value0); // depends on control dependency: [if], data = [none] } else { // field typeBuilder.addField(item.value1, item.value0); // depends on control dependency: [if], data = [none] setupBuilder.addStatement("this.$L=$L", item.value0, item.value0); // depends on control dependency: [if], data = [none] } // construtor parameterSpec = ParameterSpec.builder(item.value1, item.value0).build(); // depends on control dependency: [for], data = [item] setupBuilder.addParameter(parameterSpec); // depends on control dependency: [for], data = [none] // execute if (method.dynamicPageSizeName != null && method.dynamicPageSizeName.equals(item.value0)) { if (!method.isPagedLiveData()) { executeBuilder.addCode(separator + "this.pageSize"); // depends on control dependency: [if], data = [none] } executeWithDaoFactortBuilder.addCode(separator + "this.pageSize"); // depends on control dependency: [if], data = [none] } else { if (!method.isPagedLiveData()) { executeBuilder.addCode(separator + item.value0); // depends on control dependency: [if], data = [none] } executeWithDaoFactortBuilder.addCode(separator + item.value0); // depends on control dependency: [if], data = [none] } separator = ", "; // depends on control dependency: [for], data = [none] } if (method.isPagedLiveData()) { // if method is not paged live data, add complete execute method executeBuilder.addComment("paged result is used in live data, so this method must be empty"); // depends on control dependency: [if], data = [none] executeBuilder.addStatement("return null"); // depends on control dependency: [if], data = [none] } else { executeBuilder.addCode(separator + "this);\n"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] executeBuilder.addStatement("return list"); // depends on control dependency: [if], data = [none] } executeBuilder.addComment("Executor builder - END"); typeBuilder.addMethod(executeBuilder.build()); if (!method.hasDynamicPageSizeConditions()) { ModelAnnotation annotation = method.getAnnotation(BindSqlSelect.class); int pageSize = annotation.getAttributeAsInt(AnnotationAttributeType.PAGE_SIZE); // in case pageSize is not specified (only for liveData) if (pageSize == 0) { pageSize = 20; // depends on control dependency: [if], data = [none] } setupBuilder.addStatement("this.pageSize=$L", pageSize); // depends on control dependency: [if], data = [none] } typeBuilder.addMethod(setupBuilder.build()); executeWithDaoFactortBuilder.addCode(separator + "this);\n"); typeBuilder.addMethod(executeWithDaoFactortBuilder.build()); classBuilder.addType(typeBuilder.build()); return pagedResultName; } }
public class class_name { private String getActivityStatus(Task mpxj) { String result; if (mpxj.getActualStart() == null) { result = "Not Started"; } else { if (mpxj.getActualFinish() == null) { result = "In Progress"; } else { result = "Completed"; } } return result; } }
public class class_name { private String getActivityStatus(Task mpxj) { String result; if (mpxj.getActualStart() == null) { result = "Not Started"; // depends on control dependency: [if], data = [none] } else { if (mpxj.getActualFinish() == null) { result = "In Progress"; // depends on control dependency: [if], data = [none] } else { result = "Completed"; // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public boolean handleAction (Object source, String action, Object arg) { Method method = null; Object[] args = null; try { // look for the appropriate method Method[] methods = getClass().getMethods(); int mcount = methods.length; for (int i = 0; i < mcount; i++) { if (methods[i].getName().equals(action) || // handle our old style of prepending "handle" methods[i].getName().equals("handle" + action)) { // see if we can generate the appropriate arguments args = generateArguments(methods[i], source, arg); // if we were able to, go ahead and use this method if (args != null) { method = methods[i]; break; } } } } catch (Exception e) { log.warning("Error searching for action handler method", "controller", this, "action", action); return false; } try { if (method != null) { method.invoke(this, args); return true; } else { return false; } } catch (Exception e) { log.warning("Error invoking action handler", "controller", this, "action", action, e); // even though we choked, we still "handled" the action return true; } } }
public class class_name { public boolean handleAction (Object source, String action, Object arg) { Method method = null; Object[] args = null; try { // look for the appropriate method Method[] methods = getClass().getMethods(); int mcount = methods.length; for (int i = 0; i < mcount; i++) { if (methods[i].getName().equals(action) || // handle our old style of prepending "handle" methods[i].getName().equals("handle" + action)) { // see if we can generate the appropriate arguments args = generateArguments(methods[i], source, arg); // depends on control dependency: [if], data = [none] // if we were able to, go ahead and use this method if (args != null) { method = methods[i]; // depends on control dependency: [if], data = [none] break; } } } } catch (Exception e) { log.warning("Error searching for action handler method", "controller", this, "action", action); return false; } // depends on control dependency: [catch], data = [none] try { if (method != null) { method.invoke(this, args); // 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] } } catch (Exception e) { log.warning("Error invoking action handler", "controller", this, "action", action, e); // even though we choked, we still "handled" the action return true; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setEndpoints(java.util.Collection<EndpointSummary> endpoints) { if (endpoints == null) { this.endpoints = null; return; } this.endpoints = new java.util.ArrayList<EndpointSummary>(endpoints); } }
public class class_name { public void setEndpoints(java.util.Collection<EndpointSummary> endpoints) { if (endpoints == null) { this.endpoints = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.endpoints = new java.util.ArrayList<EndpointSummary>(endpoints); } }
public class class_name { private V linearSearch(final K iKey) { V value = null; int i = 0; tree.pageItemComparator = -1; for (int s = getSize(); i < s; ++i) { if (tree.comparator != null) tree.pageItemComparator = tree.comparator.compare(getKeyAt(i), iKey); else tree.pageItemComparator = ((Comparable<? super K>) getKeyAt(i)).compareTo(iKey); if (tree.pageItemComparator == 0) { // FOUND: SET THE INDEX AND RETURN THE NODE tree.pageItemFound = true; value = getValueAt(i); break; } else if (tree.pageItemComparator > 0) break; } tree.pageIndex = i; return value; } }
public class class_name { private V linearSearch(final K iKey) { V value = null; int i = 0; tree.pageItemComparator = -1; for (int s = getSize(); i < s; ++i) { if (tree.comparator != null) tree.pageItemComparator = tree.comparator.compare(getKeyAt(i), iKey); else tree.pageItemComparator = ((Comparable<? super K>) getKeyAt(i)).compareTo(iKey); if (tree.pageItemComparator == 0) { // FOUND: SET THE INDEX AND RETURN THE NODE tree.pageItemFound = true; // depends on control dependency: [if], data = [none] value = getValueAt(i); // depends on control dependency: [if], data = [none] break; } else if (tree.pageItemComparator > 0) break; } tree.pageIndex = i; return value; } }
public class class_name { public StringBuffer format(Object number, StringBuffer toAppendTo, FieldPosition pos) { if (number instanceof Long || number instanceof Integer || number instanceof Short || number instanceof Byte || number instanceof AtomicInteger || number instanceof AtomicLong || (number instanceof BigInteger && ((BigInteger)number).bitLength() < 64)) { return format(((Number)number).longValue(), toAppendTo, pos); } else if (number instanceof Number) { return format(((Number)number).doubleValue(), toAppendTo, pos); } else { throw new IllegalArgumentException("Cannot format given Object as a Number"); } } }
public class class_name { public StringBuffer format(Object number, StringBuffer toAppendTo, FieldPosition pos) { if (number instanceof Long || number instanceof Integer || number instanceof Short || number instanceof Byte || number instanceof AtomicInteger || number instanceof AtomicLong || (number instanceof BigInteger && ((BigInteger)number).bitLength() < 64)) { return format(((Number)number).longValue(), toAppendTo, pos); // depends on control dependency: [if], data = [none] } else if (number instanceof Number) { return format(((Number)number).doubleValue(), toAppendTo, pos); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Cannot format given Object as a Number"); } } }
public class class_name { private void mapMouseToPlane(Simple1DOFCamera camera, Point point2d, double[] vec) { // Far plane camera.unproject(point2d.x, point2d.y, -100., far); // Near plane camera.unproject(point2d.x, point2d.y, 1., near); // Delta vector: far -= near. VMath.minusEquals(far, near); // Intersection with z=0 plane: // far.z - a * near.z = 0 -> a = far.z / near.z if (near[2] < 0 || near[2] > 0) { double a = far[2] / near[2]; vec[0] = far[0] - a * near[0]; vec[1] = far[1] - a * near[1]; vec[2] = 0; } } }
public class class_name { private void mapMouseToPlane(Simple1DOFCamera camera, Point point2d, double[] vec) { // Far plane camera.unproject(point2d.x, point2d.y, -100., far); // Near plane camera.unproject(point2d.x, point2d.y, 1., near); // Delta vector: far -= near. VMath.minusEquals(far, near); // Intersection with z=0 plane: // far.z - a * near.z = 0 -> a = far.z / near.z if (near[2] < 0 || near[2] > 0) { double a = far[2] / near[2]; vec[0] = far[0] - a * near[0]; // depends on control dependency: [if], data = [none] vec[1] = far[1] - a * near[1]; // depends on control dependency: [if], data = [none] vec[2] = 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addImportName(ClassDesc classDesc, ClassConstants importedClass) { String packageName = importedClass.getPackageName(); if (isImportTargetPackage(classDesc, packageName)) { classDesc.addImportName(importedClass.getQualifiedName()); } } }
public class class_name { public void addImportName(ClassDesc classDesc, ClassConstants importedClass) { String packageName = importedClass.getPackageName(); if (isImportTargetPackage(classDesc, packageName)) { classDesc.addImportName(importedClass.getQualifiedName()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setMatrix(int[] r, int j0, int j1, Matrix X) { try { for (int i = 0; i < r.length; i++) { for (int j = j0; j <= j1; j++) { A[r[i]][j] = X.get(i, j - j0); } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } } }
public class class_name { public void setMatrix(int[] r, int j0, int j1, Matrix X) { try { for (int i = 0; i < r.length; i++) { for (int j = j0; j <= j1; j++) { A[r[i]][j] = X.get(i, j - j0); // depends on control dependency: [for], data = [j] } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String print(ResponseOptions responseOptions, ResponseBody responseBody, PrintStream stream, LogDetail logDetail, boolean shouldPrettyPrint) { final StringBuilder builder = new StringBuilder(); if (logDetail == ALL || logDetail == STATUS) { builder.append(responseOptions.statusLine()); } if (logDetail == ALL || logDetail == HEADERS) { final Headers headers = responseOptions.headers(); if (headers.exist()) { appendNewLineIfAll(logDetail, builder).append(toString(headers)); } } else if (logDetail == COOKIES) { final Cookies cookies = responseOptions.detailedCookies(); if (cookies.exist()) { appendNewLineIfAll(logDetail, builder).append(cookies.toString()); } } if (logDetail == ALL || logDetail == BODY) { String responseBodyToAppend; if (shouldPrettyPrint) { responseBodyToAppend = new Prettifier().getPrettifiedBodyIfPossible(responseOptions, responseBody); } else { responseBodyToAppend = responseBody.asString(); } if (logDetail == ALL && !isBlank(responseBodyToAppend)) { builder.append(SystemUtils.LINE_SEPARATOR).append(SystemUtils.LINE_SEPARATOR); } builder.append(responseBodyToAppend); } String response = builder.toString(); stream.println(response); return response; } }
public class class_name { public static String print(ResponseOptions responseOptions, ResponseBody responseBody, PrintStream stream, LogDetail logDetail, boolean shouldPrettyPrint) { final StringBuilder builder = new StringBuilder(); if (logDetail == ALL || logDetail == STATUS) { builder.append(responseOptions.statusLine()); // depends on control dependency: [if], data = [none] } if (logDetail == ALL || logDetail == HEADERS) { final Headers headers = responseOptions.headers(); if (headers.exist()) { appendNewLineIfAll(logDetail, builder).append(toString(headers)); // depends on control dependency: [if], data = [none] } } else if (logDetail == COOKIES) { final Cookies cookies = responseOptions.detailedCookies(); if (cookies.exist()) { appendNewLineIfAll(logDetail, builder).append(cookies.toString()); // depends on control dependency: [if], data = [none] } } if (logDetail == ALL || logDetail == BODY) { String responseBodyToAppend; if (shouldPrettyPrint) { responseBodyToAppend = new Prettifier().getPrettifiedBodyIfPossible(responseOptions, responseBody); // depends on control dependency: [if], data = [none] } else { responseBodyToAppend = responseBody.asString(); // depends on control dependency: [if], data = [none] } if (logDetail == ALL && !isBlank(responseBodyToAppend)) { builder.append(SystemUtils.LINE_SEPARATOR).append(SystemUtils.LINE_SEPARATOR); // depends on control dependency: [if], data = [none] } builder.append(responseBodyToAppend); // depends on control dependency: [if], data = [none] } String response = builder.toString(); stream.println(response); return response; } }
public class class_name { public void prepareClassOptions() { //TaskMonitor monitor, //ObjectRepository repository) { this.classOptionNamesToPreparedObjects = null; Option[] optionArray = getOptions().getOptionArray(); for (Option option : optionArray) { if (option instanceof ClassOption) { ClassOption classOption = (ClassOption) option; // monitor.setCurrentActivity("Materializing option " // + classOption.getName() + "...", -1.0); Object optionObj = classOption.materializeObject(); //monitor, //repository); //if (monitor.taskShouldAbort()) { // return; //} if (optionObj instanceof Configurable) { // monitor.setCurrentActivity("Preparing option " // + classOption.getName() + "...", -1.0); JavaCLIParser config = new JavaCLIParser(optionObj, ""); //((Configurable) optionObj).prepareForUse(); //monitor, //repository); // if (monitor.taskShouldAbort()) { // return; // } } if (this.classOptionNamesToPreparedObjects == null) { this.classOptionNamesToPreparedObjects = new HashMap<String, Object>(); } this.classOptionNamesToPreparedObjects.put(option.getName(), optionObj); } } } }
public class class_name { public void prepareClassOptions() { //TaskMonitor monitor, //ObjectRepository repository) { this.classOptionNamesToPreparedObjects = null; Option[] optionArray = getOptions().getOptionArray(); for (Option option : optionArray) { if (option instanceof ClassOption) { ClassOption classOption = (ClassOption) option; // monitor.setCurrentActivity("Materializing option " // + classOption.getName() + "...", -1.0); Object optionObj = classOption.materializeObject(); //monitor, //repository); //if (monitor.taskShouldAbort()) { // return; //} if (optionObj instanceof Configurable) { // monitor.setCurrentActivity("Preparing option " // + classOption.getName() + "...", -1.0); JavaCLIParser config = new JavaCLIParser(optionObj, ""); //((Configurable) optionObj).prepareForUse(); //monitor, //repository); // if (monitor.taskShouldAbort()) { // return; // } } if (this.classOptionNamesToPreparedObjects == null) { this.classOptionNamesToPreparedObjects = new HashMap<String, Object>(); // depends on control dependency: [if], data = [none] } this.classOptionNamesToPreparedObjects.put(option.getName(), optionObj); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public StrBuilder appendWithSeparators(final Object[] array, final String separator) { if (array != null && array.length > 0) { final String sep = Objects.toString(separator, ""); append(array[0]); for (int i = 1; i < array.length; i++) { append(sep); append(array[i]); } } return this; } }
public class class_name { public StrBuilder appendWithSeparators(final Object[] array, final String separator) { if (array != null && array.length > 0) { final String sep = Objects.toString(separator, ""); append(array[0]); // depends on control dependency: [if], data = [(array] for (int i = 1; i < array.length; i++) { append(sep); // depends on control dependency: [for], data = [none] append(array[i]); // depends on control dependency: [for], data = [i] } } return this; } }
public class class_name { public CollisionFormula getCollisionFormula(String name) { if (formulas.containsKey(name)) { return formulas.get(name); } throw new LionEngineException(ERROR_FORMULA + name); } }
public class class_name { public CollisionFormula getCollisionFormula(String name) { if (formulas.containsKey(name)) { return formulas.get(name); // depends on control dependency: [if], data = [none] } throw new LionEngineException(ERROR_FORMULA + name); } }
public class class_name { public void longForEach(final LongLongConsumer consumer) { final long[] entries = this.entries; for (int i = 0; i < entries.length; i += 2) { final long key = entries[i]; if (key != missingValue) { consumer.accept(entries[i], entries[i + 1]); } } } }
public class class_name { public void longForEach(final LongLongConsumer consumer) { final long[] entries = this.entries; for (int i = 0; i < entries.length; i += 2) { final long key = entries[i]; if (key != missingValue) { consumer.accept(entries[i], entries[i + 1]); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public boolean remove(final VisitState k) { // The starting point. int pos = (int)(MurmurHash3.hash(k.schemeAuthority) & mask); // There's always an unused entry. while (visitState[pos] != null) { if (visitState[pos] == k) { size--; shiftKeys(pos); // TODO: implement resize return true; } pos = (pos + 1) & mask; } return false; } }
public class class_name { public boolean remove(final VisitState k) { // The starting point. int pos = (int)(MurmurHash3.hash(k.schemeAuthority) & mask); // There's always an unused entry. while (visitState[pos] != null) { if (visitState[pos] == k) { size--; // depends on control dependency: [if], data = [none] shiftKeys(pos); // depends on control dependency: [if], data = [none] // TODO: implement resize return true; // depends on control dependency: [if], data = [none] } pos = (pos + 1) & mask; // depends on control dependency: [while], data = [none] } return false; } }
public class class_name { @Override public Collection<Block> getBySequenceHash(ByteArray sequenceHash) { ensureSorted(); // prepare hash for binary search int[] hash = sequenceHash.toIntArray(); if (hash.length != hashInts) { throw new IllegalArgumentException("Expected " + hashInts + " ints in hash, but got " + hash.length); } int offset = size * blockInts; for (int i = 0; i < hashInts; i++) { blockData[offset++] = hash[i]; } int index = DataUtils.binarySearch(byBlockHash); List<Block> result = new ArrayList<>(); while (index < size && !isLessByHash(size, index)) { // extract block (note that there is no need to extract hash) String resourceId = resourceIds[index]; result.add(createBlock(index, resourceId, sequenceHash)); index++; } return result; } }
public class class_name { @Override public Collection<Block> getBySequenceHash(ByteArray sequenceHash) { ensureSorted(); // prepare hash for binary search int[] hash = sequenceHash.toIntArray(); if (hash.length != hashInts) { throw new IllegalArgumentException("Expected " + hashInts + " ints in hash, but got " + hash.length); } int offset = size * blockInts; for (int i = 0; i < hashInts; i++) { blockData[offset++] = hash[i]; // depends on control dependency: [for], data = [i] } int index = DataUtils.binarySearch(byBlockHash); List<Block> result = new ArrayList<>(); while (index < size && !isLessByHash(size, index)) { // extract block (note that there is no need to extract hash) String resourceId = resourceIds[index]; result.add(createBlock(index, resourceId, sequenceHash)); // depends on control dependency: [while], data = [(index] index++; // depends on control dependency: [while], data = [none] } return result; } }
public class class_name { public void propertyChange(final java.beans.PropertyChangeEvent evt) { super.propertyChange(evt); if (this.getDateParam().equalsIgnoreCase(evt.getPropertyName())) if (evt.getNewValue() instanceof Date) { Container container = this.getParent(); if (container instanceof JCalendarDualField) container = container.getParent(); if (container instanceof JTable) { // Always JTable jtable = (JTable)container; int iRow = jtable.getSelectedRow(); jtable.setValueAt(evt.getNewValue(), iRow, m_iColumn); } } } }
public class class_name { public void propertyChange(final java.beans.PropertyChangeEvent evt) { super.propertyChange(evt); if (this.getDateParam().equalsIgnoreCase(evt.getPropertyName())) if (evt.getNewValue() instanceof Date) { Container container = this.getParent(); if (container instanceof JCalendarDualField) container = container.getParent(); if (container instanceof JTable) { // Always JTable jtable = (JTable)container; int iRow = jtable.getSelectedRow(); jtable.setValueAt(evt.getNewValue(), iRow, m_iColumn); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private ZapTextField getTxtHeadline() { if (txtHeadline == null) { txtHeadline = new ZapTextField(); txtHeadline.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); txtHeadline.setEditable(false); txtHeadline.setEnabled(false); txtHeadline.setBackground(java.awt.Color.white); txtHeadline.setFont(FontUtils.getFont(Font.BOLD)); } return txtHeadline; } }
public class class_name { private ZapTextField getTxtHeadline() { if (txtHeadline == null) { txtHeadline = new ZapTextField(); // depends on control dependency: [if], data = [none] txtHeadline.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); // depends on control dependency: [if], data = [none] txtHeadline.setEditable(false); // depends on control dependency: [if], data = [none] txtHeadline.setEnabled(false); // depends on control dependency: [if], data = [none] txtHeadline.setBackground(java.awt.Color.white); // depends on control dependency: [if], data = [none] txtHeadline.setFont(FontUtils.getFont(Font.BOLD)); // depends on control dependency: [if], data = [none] } return txtHeadline; } }
public class class_name { public AttributeValue withBS(java.nio.ByteBuffer... bS) { if (getBS() == null) setBS(new java.util.ArrayList<java.nio.ByteBuffer>(bS.length)); for (java.nio.ByteBuffer value : bS) { getBS().add(value); } return this; } }
public class class_name { public AttributeValue withBS(java.nio.ByteBuffer... bS) { if (getBS() == null) setBS(new java.util.ArrayList<java.nio.ByteBuffer>(bS.length)); for (java.nio.ByteBuffer value : bS) { getBS().add(value); // depends on control dependency: [for], data = [value] } return this; } }
public class class_name { public long getEncodedLength(final byte[] pArray) { // Calculate non-chunked size - rounded up to allow for padding // cast to long is needed to avoid possibility of overflow long len = ((pArray.length + unencodedBlockSize-1) / unencodedBlockSize) * (long) encodedBlockSize; if (lineLength > 0) { // We're using chunking // Round up to nearest multiple len += ((len + lineLength-1) / lineLength) * chunkSeparatorLength; } return len; } }
public class class_name { public long getEncodedLength(final byte[] pArray) { // Calculate non-chunked size - rounded up to allow for padding // cast to long is needed to avoid possibility of overflow long len = ((pArray.length + unencodedBlockSize-1) / unencodedBlockSize) * (long) encodedBlockSize; if (lineLength > 0) { // We're using chunking // Round up to nearest multiple len += ((len + lineLength-1) / lineLength) * chunkSeparatorLength; // depends on control dependency: [if], data = [none] } return len; } }
public class class_name { private String getPreprocessorDefinitions(final CommandLineCompilerConfiguration compilerConfig, final boolean isDebug) { final StringBuffer defines = new StringBuffer(); final String[] args = compilerConfig.getPreArguments(); for (final String arg : args) { if (arg.startsWith("/D")) { String macro = arg.substring(2); if (isDebug) { if (macro.equals("NDEBUG")) { macro = "_DEBUG"; } } else { if (macro.equals("_DEBUG")) { macro = "NDEBUG"; } } defines.append(macro); defines.append(";"); } } if (defines.length() > 0) { defines.setLength(defines.length() - 1); } return defines.toString(); } }
public class class_name { private String getPreprocessorDefinitions(final CommandLineCompilerConfiguration compilerConfig, final boolean isDebug) { final StringBuffer defines = new StringBuffer(); final String[] args = compilerConfig.getPreArguments(); for (final String arg : args) { if (arg.startsWith("/D")) { String macro = arg.substring(2); if (isDebug) { if (macro.equals("NDEBUG")) { macro = "_DEBUG"; // depends on control dependency: [if], data = [none] } } else { if (macro.equals("_DEBUG")) { macro = "NDEBUG"; // depends on control dependency: [if], data = [none] } } defines.append(macro); // depends on control dependency: [if], data = [none] defines.append(";"); // depends on control dependency: [if], data = [none] } } if (defines.length() > 0) { defines.setLength(defines.length() - 1); // depends on control dependency: [if], data = [(defines.length()] } return defines.toString(); } }
public class class_name { public void writeBodyFeed(List<?> entities) throws ODataRenderException { checkNotNull(entities); try { for (Object entity : entities) { writeEntry(entity, true); } } catch (XMLStreamException | IllegalAccessException | NoSuchFieldException | ODataEdmException e) { LOG.error("Not possible to marshall feed stream XML"); throw new ODataRenderException("Not possible to marshall feed stream XML: ", e); } } }
public class class_name { public void writeBodyFeed(List<?> entities) throws ODataRenderException { checkNotNull(entities); try { for (Object entity : entities) { writeEntry(entity, true); // depends on control dependency: [for], data = [entity] } } catch (XMLStreamException | IllegalAccessException | NoSuchFieldException | ODataEdmException e) { LOG.error("Not possible to marshall feed stream XML"); throw new ODataRenderException("Not possible to marshall feed stream XML: ", e); } } }
public class class_name { public static ProviderList getFullProviderList() { ProviderList list; synchronized (Providers.class) { list = getThreadProviderList(); if (list != null) { ProviderList newList = list.removeInvalid(); if (newList != list) { changeThreadProviderList(newList); list = newList; } return list; } } list = getSystemProviderList(); ProviderList newList = list.removeInvalid(); if (newList != list) { setSystemProviderList(newList); list = newList; } return list; } }
public class class_name { public static ProviderList getFullProviderList() { ProviderList list; synchronized (Providers.class) { list = getThreadProviderList(); if (list != null) { ProviderList newList = list.removeInvalid(); if (newList != list) { changeThreadProviderList(newList); // depends on control dependency: [if], data = [(newList] list = newList; // depends on control dependency: [if], data = [none] } return list; // depends on control dependency: [if], data = [none] } } list = getSystemProviderList(); ProviderList newList = list.removeInvalid(); if (newList != list) { setSystemProviderList(newList); // depends on control dependency: [if], data = [(newList] list = newList; // depends on control dependency: [if], data = [none] } return list; } }
public class class_name { @Override public boolean containsWithinBounds(Object value) { if (value instanceof Comparable) { final int result = compareTo(from, (Comparable) value); return result == 0 || result < 0 && compareTo(to, (Comparable) value) >= 0; } return contains(value); } }
public class class_name { @Override public boolean containsWithinBounds(Object value) { if (value instanceof Comparable) { final int result = compareTo(from, (Comparable) value); return result == 0 || result < 0 && compareTo(to, (Comparable) value) >= 0; // depends on control dependency: [if], data = [none] } return contains(value); } }
public class class_name { public static TokenResponseException from(JsonFactory jsonFactory, HttpResponse response) { HttpResponseException.Builder builder = new HttpResponseException.Builder( response.getStatusCode(), response.getStatusMessage(), response.getHeaders()); // details Preconditions.checkNotNull(jsonFactory); TokenErrorResponse details = null; String detailString = null; String contentType = response.getContentType(); try { if (!response.isSuccessStatusCode() && contentType != null && response.getContent() != null && HttpMediaType.equalsIgnoreParameters(Json.MEDIA_TYPE, contentType)) { details = new JsonObjectParser(jsonFactory).parseAndClose( response.getContent(), response.getContentCharset(), TokenErrorResponse.class); detailString = details.toPrettyString(); } else { detailString = response.parseAsString(); } } catch (IOException exception) { // it would be bad to throw an exception while throwing an exception exception.printStackTrace(); } // message StringBuilder message = HttpResponseException.computeMessageBuffer(response); if (!com.google.api.client.util.Strings.isNullOrEmpty(detailString)) { message.append(StringUtils.LINE_SEPARATOR).append(detailString); builder.setContent(detailString); } builder.setMessage(message.toString()); return new TokenResponseException(builder, details); } }
public class class_name { public static TokenResponseException from(JsonFactory jsonFactory, HttpResponse response) { HttpResponseException.Builder builder = new HttpResponseException.Builder( response.getStatusCode(), response.getStatusMessage(), response.getHeaders()); // details Preconditions.checkNotNull(jsonFactory); TokenErrorResponse details = null; String detailString = null; String contentType = response.getContentType(); try { if (!response.isSuccessStatusCode() && contentType != null && response.getContent() != null && HttpMediaType.equalsIgnoreParameters(Json.MEDIA_TYPE, contentType)) { details = new JsonObjectParser(jsonFactory).parseAndClose( response.getContent(), response.getContentCharset(), TokenErrorResponse.class); // depends on control dependency: [if], data = [none] detailString = details.toPrettyString(); // depends on control dependency: [if], data = [none] } else { detailString = response.parseAsString(); // depends on control dependency: [if], data = [none] } } catch (IOException exception) { // it would be bad to throw an exception while throwing an exception exception.printStackTrace(); } // depends on control dependency: [catch], data = [none] // message StringBuilder message = HttpResponseException.computeMessageBuffer(response); if (!com.google.api.client.util.Strings.isNullOrEmpty(detailString)) { message.append(StringUtils.LINE_SEPARATOR).append(detailString); // depends on control dependency: [if], data = [none] builder.setContent(detailString); // depends on control dependency: [if], data = [none] } builder.setMessage(message.toString()); return new TokenResponseException(builder, details); } }
public class class_name { private int decodeBlackCodeWord() { int current, entry, bits, isT, code = -1; int runLength = 0; boolean isWhite = false; while (!isWhite) { current = nextLesserThan8Bits(4); entry = initBlack[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (code == 100) { current = nextNBits(9); entry = black[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (entry >>> 1) & 0x000f; code = (entry >>> 5) & 0x07ff; if (bits == 12) { // Additional makeup codes updatePointer(5); current = nextLesserThan8Bits(4); entry = additionalMakeup[current]; bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111 code = (entry >>> 4) & 0x0fff; // 12 bits runLength += code; updatePointer(4 - bits); } else if (bits == 15) { // EOL code if ( runLength == 0 ) { isWhite = true; } else { throw new RuntimeException("EOL code word encountered in Black run."); } } else { runLength += code; updatePointer(9 - bits); if (isT == 0) { isWhite = true; } } } else if (code == 200) { // Is a Terminating code current = nextLesserThan8Bits(2); entry = twoBitBlack[current]; code = (entry >>> 5) & 0x07ff; runLength += code; bits = (entry >>> 1) & 0x0f; updatePointer(2 - bits); isWhite = true; } else { // Is a Terminating code runLength += code; updatePointer(4 - bits); isWhite = true; } } return runLength; } }
public class class_name { private int decodeBlackCodeWord() { int current, entry, bits, isT, code = -1; int runLength = 0; boolean isWhite = false; while (!isWhite) { current = nextLesserThan8Bits(4); // depends on control dependency: [while], data = [none] entry = initBlack[current]; // depends on control dependency: [while], data = [none] // Get the 3 fields from the entry isT = entry & 0x0001; // depends on control dependency: [while], data = [none] bits = (entry >>> 1) & 0x000f; // depends on control dependency: [while], data = [none] code = (entry >>> 5) & 0x07ff; // depends on control dependency: [while], data = [none] if (code == 100) { current = nextNBits(9); // depends on control dependency: [if], data = [none] entry = black[current]; // depends on control dependency: [if], data = [none] // Get the 3 fields from the entry isT = entry & 0x0001; // depends on control dependency: [if], data = [none] bits = (entry >>> 1) & 0x000f; // depends on control dependency: [if], data = [none] code = (entry >>> 5) & 0x07ff; // depends on control dependency: [if], data = [none] if (bits == 12) { // Additional makeup codes updatePointer(5); // depends on control dependency: [if], data = [none] current = nextLesserThan8Bits(4); // depends on control dependency: [if], data = [none] entry = additionalMakeup[current]; // depends on control dependency: [if], data = [none] bits = (entry >>> 1) & 0x07; // 3 bits 0000 0111 // depends on control dependency: [if], data = [none] code = (entry >>> 4) & 0x0fff; // 12 bits // depends on control dependency: [if], data = [none] runLength += code; // depends on control dependency: [if], data = [none] updatePointer(4 - bits); // depends on control dependency: [if], data = [none] } else if (bits == 15) { // EOL code if ( runLength == 0 ) { isWhite = true; // depends on control dependency: [if], data = [none] } else { throw new RuntimeException("EOL code word encountered in Black run."); } } else { runLength += code; // depends on control dependency: [if], data = [none] updatePointer(9 - bits); // depends on control dependency: [if], data = [none] if (isT == 0) { isWhite = true; // depends on control dependency: [if], data = [none] } } } else if (code == 200) { // Is a Terminating code current = nextLesserThan8Bits(2); // depends on control dependency: [if], data = [none] entry = twoBitBlack[current]; // depends on control dependency: [if], data = [none] code = (entry >>> 5) & 0x07ff; // depends on control dependency: [if], data = [none] runLength += code; // depends on control dependency: [if], data = [none] bits = (entry >>> 1) & 0x0f; // depends on control dependency: [if], data = [none] updatePointer(2 - bits); // depends on control dependency: [if], data = [none] isWhite = true; // depends on control dependency: [if], data = [none] } else { // Is a Terminating code runLength += code; // depends on control dependency: [if], data = [none] updatePointer(4 - bits); // depends on control dependency: [if], data = [none] isWhite = true; // depends on control dependency: [if], data = [none] } } return runLength; } }
public class class_name { @Override public void run() { do { // Scan for directories: try { log.info("Scanning for directories under {}", root); Files.walkFileTree(root, new Visitor()); } catch (IOException e) { log.info("Error in scanning for directories to monitor:"); e.printStackTrace(); } // Block until notified that a new scan is needed: synchronized (Scanner.class) { try { Scanner.class.wait(); } catch (InterruptedException e) { log.info("Scanner interrupted:"); e.printStackTrace(); } } } while (true); } }
public class class_name { @Override public void run() { do { // Scan for directories: try { log.info("Scanning for directories under {}", root); // depends on control dependency: [try], data = [none] Files.walkFileTree(root, new Visitor()); // depends on control dependency: [try], data = [none] } catch (IOException e) { log.info("Error in scanning for directories to monitor:"); e.printStackTrace(); } // depends on control dependency: [catch], data = [none] // Block until notified that a new scan is needed: synchronized (Scanner.class) { try { Scanner.class.wait(); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { log.info("Scanner interrupted:"); e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } while (true); } }
public class class_name { public MethodInfo getMethodInfo(final String methodName) { for(MethodInfo item : methodInfos) { if(item.getMethodName().equals(methodName)) { return item; } } return null; } }
public class class_name { public MethodInfo getMethodInfo(final String methodName) { for(MethodInfo item : methodInfos) { if(item.getMethodName().equals(methodName)) { return item; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @SuppressWarnings("unchecked") public static void set(Map<String, Object> target, String name, Object value) { if ( value instanceof Map ) { setMapValue( target, name, (Map<String, Object>) value ); } else { target.put( name, value ); } } }
public class class_name { @SuppressWarnings("unchecked") public static void set(Map<String, Object> target, String name, Object value) { if ( value instanceof Map ) { setMapValue( target, name, (Map<String, Object>) value ); // depends on control dependency: [if], data = [none] } else { target.put( name, value ); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void actionPerformed(ActionEvent e) { // Use a new JFileChooser. Inconsistent behaviour otherwise! final JFileChooser fc = new JFileChooser(new File(".")); if(param.isDefined()) { fc.setSelectedFile(param.getValue()); } if(e.getSource() == button) { int returnVal = fc.showOpenDialog(button); if(returnVal == JFileChooser.APPROVE_OPTION) { textfield.setText(fc.getSelectedFile().getPath()); fireValueChanged(); } // else: do nothing on cancel. } else if(e.getSource() == textfield) { fireValueChanged(); } else { LoggingUtil.warning("actionPerformed triggered by unknown source: " + e.getSource()); } } }
public class class_name { @Override public void actionPerformed(ActionEvent e) { // Use a new JFileChooser. Inconsistent behaviour otherwise! final JFileChooser fc = new JFileChooser(new File(".")); if(param.isDefined()) { fc.setSelectedFile(param.getValue()); // depends on control dependency: [if], data = [none] } if(e.getSource() == button) { int returnVal = fc.showOpenDialog(button); if(returnVal == JFileChooser.APPROVE_OPTION) { textfield.setText(fc.getSelectedFile().getPath()); // depends on control dependency: [if], data = [none] fireValueChanged(); // depends on control dependency: [if], data = [none] } // else: do nothing on cancel. } else if(e.getSource() == textfield) { fireValueChanged(); // depends on control dependency: [if], data = [none] } else { LoggingUtil.warning("actionPerformed triggered by unknown source: " + e.getSource()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void toLeftJoin() { assert((m_leftNode != null && m_rightNode != null) || (m_leftNode == null && m_rightNode == null)); if (m_leftNode == null && m_rightNode == null) { // End of recursion return; } // recursive calls if (m_leftNode instanceof BranchNode) { ((BranchNode)m_leftNode).toLeftJoin(); } if (m_rightNode instanceof BranchNode) { ((BranchNode)m_rightNode).toLeftJoin(); } // Swap own children if (m_joinType == JoinType.RIGHT) { JoinNode node = m_rightNode; m_rightNode = m_leftNode; m_leftNode = node; m_joinType = JoinType.LEFT; } } }
public class class_name { public void toLeftJoin() { assert((m_leftNode != null && m_rightNode != null) || (m_leftNode == null && m_rightNode == null)); if (m_leftNode == null && m_rightNode == null) { // End of recursion return; // depends on control dependency: [if], data = [none] } // recursive calls if (m_leftNode instanceof BranchNode) { ((BranchNode)m_leftNode).toLeftJoin(); // depends on control dependency: [if], data = [none] } if (m_rightNode instanceof BranchNode) { ((BranchNode)m_rightNode).toLeftJoin(); // depends on control dependency: [if], data = [none] } // Swap own children if (m_joinType == JoinType.RIGHT) { JoinNode node = m_rightNode; m_rightNode = m_leftNode; // depends on control dependency: [if], data = [none] m_leftNode = node; // depends on control dependency: [if], data = [none] m_joinType = JoinType.LEFT; // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<URI> listFileNames(FileInfo fileInfo, boolean recursive) throws IOException { Preconditions.checkNotNull(fileInfo); URI path = fileInfo.getPath(); logger.atFine().log("listFileNames(%s)", path); List<URI> paths = new ArrayList<>(); List<String> childNames; // If it is a directory, obtain info about its children. if (fileInfo.isDirectory()) { if (fileInfo.exists()) { if (fileInfo.isGlobalRoot()) { childNames = gcs.listBucketNames(); // Obtain path for each child. for (String childName : childNames) { URI childPath = pathCodec.getPath(childName, null, true); paths.add(childPath); logger.atFine().log("listFileNames: added: %s", childPath); } } else { // A null delimiter asks GCS to return all objects with a given prefix, // regardless of their 'directory depth' relative to the prefix; // that is what we want for a recursive list. On the other hand, // when a delimiter is specified, only items with relative depth // of 1 are returned. String delimiter = recursive ? null : PATH_DELIMITER; GoogleCloudStorageItemInfo itemInfo = fileInfo.getItemInfo(); // Obtain paths of children. childNames = gcs.listObjectNames(itemInfo.getBucketName(), itemInfo.getObjectName(), delimiter); // Obtain path for each child. for (String childName : childNames) { URI childPath = pathCodec.getPath(itemInfo.getBucketName(), childName, false); paths.add(childPath); logger.atFine().log("listFileNames: added: %s", childPath); } } } } else { paths.add(path); logger.atFine().log( "listFileNames: added single original path since !isDirectory(): %s", path); } return paths; } }
public class class_name { public List<URI> listFileNames(FileInfo fileInfo, boolean recursive) throws IOException { Preconditions.checkNotNull(fileInfo); URI path = fileInfo.getPath(); logger.atFine().log("listFileNames(%s)", path); List<URI> paths = new ArrayList<>(); List<String> childNames; // If it is a directory, obtain info about its children. if (fileInfo.isDirectory()) { if (fileInfo.exists()) { if (fileInfo.isGlobalRoot()) { childNames = gcs.listBucketNames(); // depends on control dependency: [if], data = [none] // Obtain path for each child. for (String childName : childNames) { URI childPath = pathCodec.getPath(childName, null, true); paths.add(childPath); // depends on control dependency: [for], data = [none] logger.atFine().log("listFileNames: added: %s", childPath); // depends on control dependency: [for], data = [none] } } else { // A null delimiter asks GCS to return all objects with a given prefix, // regardless of their 'directory depth' relative to the prefix; // that is what we want for a recursive list. On the other hand, // when a delimiter is specified, only items with relative depth // of 1 are returned. String delimiter = recursive ? null : PATH_DELIMITER; GoogleCloudStorageItemInfo itemInfo = fileInfo.getItemInfo(); // Obtain paths of children. childNames = gcs.listObjectNames(itemInfo.getBucketName(), itemInfo.getObjectName(), delimiter); // depends on control dependency: [if], data = [none] // Obtain path for each child. for (String childName : childNames) { URI childPath = pathCodec.getPath(itemInfo.getBucketName(), childName, false); paths.add(childPath); // depends on control dependency: [for], data = [none] logger.atFine().log("listFileNames: added: %s", childPath); // depends on control dependency: [for], data = [none] } } } } else { paths.add(path); logger.atFine().log( "listFileNames: added single original path since !isDirectory(): %s", path); } return paths; } }
public class class_name { public static void copyZipWithoutEmptyDirectories(final File inputFile, final File outputFile) throws IOException { final byte[] buf = new byte[0x2000]; final ZipFile inputZip = new ZipFile(inputFile); final ZipOutputStream outputStream = new ZipOutputStream(new FileOutputStream(outputFile)); try { // read a the entries of the input zip file and sort them final Enumeration<? extends ZipEntry> e = inputZip.entries(); final ArrayList<ZipEntry> sortedList = new ArrayList<ZipEntry>(); while (e.hasMoreElements()) { final ZipEntry entry = e.nextElement(); sortedList.add(entry); } Collections.sort(sortedList, new Comparator<ZipEntry>() { public int compare(ZipEntry o1, ZipEntry o2) { String n1 = o1.getName(), n2 = o2.getName(); if (metaOverride(n1, n2)) { return -1; } if (metaOverride(n2, n1)) { return 1; } return n1.compareTo(n2); } // make sure that META-INF/MANIFEST.MF is always the first entry after META-INF/ private boolean metaOverride(String n1, String n2) { return (n1.startsWith("META-INF/") && !n2.startsWith("META-INF/")) || (n1.equals("META-INF/MANIFEST.MF") && !n2.equals(n1) && !n2.equals("META-INF/")) || (n1.equals("META-INF/") && !n2.equals(n1)); } }); // treat them again and write them in output, wenn they not are empty directories for (int i = sortedList.size()-1; i>=0; i--) { final ZipEntry inputEntry = sortedList.get(i); final String name = inputEntry.getName(); final boolean isEmptyDirectory; if (inputEntry.isDirectory()) { if (i == sortedList.size()-1) { // no item afterwards; it was an empty directory isEmptyDirectory = true; } else { final String nextName = sortedList.get(i+1).getName(); isEmptyDirectory = !nextName.startsWith(name); } } else { isEmptyDirectory = false; } if (isEmptyDirectory) { sortedList.remove(i); } } // finally write entries in normal order for (int i = 0; i < sortedList.size(); i++) { final ZipEntry inputEntry = sortedList.get(i); final ZipEntry outputEntry = new ZipEntry(inputEntry); outputStream.putNextEntry(outputEntry); ByteArrayOutputStream baos = new ByteArrayOutputStream(); final InputStream is = inputZip.getInputStream(inputEntry); IoUtil.pipe(is, baos, buf); is.close(); outputStream.write(baos.toByteArray()); } } finally { outputStream.close(); inputZip.close(); } } }
public class class_name { public static void copyZipWithoutEmptyDirectories(final File inputFile, final File outputFile) throws IOException { final byte[] buf = new byte[0x2000]; final ZipFile inputZip = new ZipFile(inputFile); final ZipOutputStream outputStream = new ZipOutputStream(new FileOutputStream(outputFile)); try { // read a the entries of the input zip file and sort them final Enumeration<? extends ZipEntry> e = inputZip.entries(); final ArrayList<ZipEntry> sortedList = new ArrayList<ZipEntry>(); while (e.hasMoreElements()) { final ZipEntry entry = e.nextElement(); sortedList.add(entry); // depends on control dependency: [while], data = [none] } Collections.sort(sortedList, new Comparator<ZipEntry>() { public int compare(ZipEntry o1, ZipEntry o2) { String n1 = o1.getName(), n2 = o2.getName(); if (metaOverride(n1, n2)) { return -1; // depends on control dependency: [if], data = [none] } if (metaOverride(n2, n1)) { return 1; // depends on control dependency: [if], data = [none] } return n1.compareTo(n2); } // make sure that META-INF/MANIFEST.MF is always the first entry after META-INF/ private boolean metaOverride(String n1, String n2) { return (n1.startsWith("META-INF/") && !n2.startsWith("META-INF/")) || (n1.equals("META-INF/MANIFEST.MF") && !n2.equals(n1) && !n2.equals("META-INF/")) || (n1.equals("META-INF/") && !n2.equals(n1)); } }); // treat them again and write them in output, wenn they not are empty directories for (int i = sortedList.size()-1; i>=0; i--) { final ZipEntry inputEntry = sortedList.get(i); final String name = inputEntry.getName(); final boolean isEmptyDirectory; if (inputEntry.isDirectory()) { if (i == sortedList.size()-1) { // no item afterwards; it was an empty directory isEmptyDirectory = true; // depends on control dependency: [if], data = [none] } else { final String nextName = sortedList.get(i+1).getName(); isEmptyDirectory = !nextName.startsWith(name); // depends on control dependency: [if], data = [none] } } else { isEmptyDirectory = false; // depends on control dependency: [if], data = [none] } if (isEmptyDirectory) { sortedList.remove(i); // depends on control dependency: [if], data = [none] } } // finally write entries in normal order for (int i = 0; i < sortedList.size(); i++) { final ZipEntry inputEntry = sortedList.get(i); final ZipEntry outputEntry = new ZipEntry(inputEntry); outputStream.putNextEntry(outputEntry); // depends on control dependency: [for], data = [none] ByteArrayOutputStream baos = new ByteArrayOutputStream(); final InputStream is = inputZip.getInputStream(inputEntry); IoUtil.pipe(is, baos, buf); // depends on control dependency: [for], data = [none] is.close(); // depends on control dependency: [for], data = [none] outputStream.write(baos.toByteArray()); // depends on control dependency: [for], data = [none] } } finally { outputStream.close(); inputZip.close(); } } }
public class class_name { public static String removeEnd(final String s, final String remove) { if (isEmpty(s) || isEmpty(remove)) { return s; } if (s.endsWith(remove)) { return s.substring(0, s.length() - remove.length()); } return s; } }
public class class_name { public static String removeEnd(final String s, final String remove) { if (isEmpty(s) || isEmpty(remove)) { return s; // depends on control dependency: [if], data = [none] } if (s.endsWith(remove)) { return s.substring(0, s.length() - remove.length()); // depends on control dependency: [if], data = [none] } return s; } }
public class class_name { private static void printDescription(Class<?> descriptionClass) { if(descriptionClass == null) { return; } try { LoggingConfiguration.setVerbose(Level.VERBOSE); LOG.verbose(OptionUtil.describeParameterizable(new StringBuilder(), descriptionClass, FormatUtil.getConsoleWidth(), "").toString()); } catch(Exception e) { LOG.exception("Error instantiating class to describe.", e.getCause()); } } }
public class class_name { private static void printDescription(Class<?> descriptionClass) { if(descriptionClass == null) { return; // depends on control dependency: [if], data = [none] } try { LoggingConfiguration.setVerbose(Level.VERBOSE); // depends on control dependency: [try], data = [none] LOG.verbose(OptionUtil.describeParameterizable(new StringBuilder(), descriptionClass, FormatUtil.getConsoleWidth(), "").toString()); // depends on control dependency: [try], data = [none] } catch(Exception e) { LOG.exception("Error instantiating class to describe.", e.getCause()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static @NonNull Throwable unwrap(final @NonNull Throwable throwable) { if(throwable instanceof InvocationTargetException) { final /* @Nullable */ Throwable cause = throwable.getCause(); if(cause != null) { return cause; } } return throwable; } }
public class class_name { public static @NonNull Throwable unwrap(final @NonNull Throwable throwable) { if(throwable instanceof InvocationTargetException) { final /* @Nullable */ Throwable cause = throwable.getCause(); if(cause != null) { return cause; // depends on control dependency: [if], data = [none] } } return throwable; } }
public class class_name { public synchronized List<CmsAliasImportResult> getAndRemove(String key) { List<CmsAliasImportResult> result = m_entries.get(key); if (result != null) { m_entries.remove(key); } return result; } }
public class class_name { public synchronized List<CmsAliasImportResult> getAndRemove(String key) { List<CmsAliasImportResult> result = m_entries.get(key); if (result != null) { m_entries.remove(key); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public Map<String, Object> jsonToMap(String json) { /* * This if block treats the /v2/accounts/exists response. Currently the endpoint returns the status * code on its response body, breaking the JSON conversion. */ if ("200".equals(json)) { this.responseBody.put("code", 200); return this.responseBody; } if ("400".equals(json)) { this.responseBody.put("code", 400); return this.responseBody; } if ("404".equals(json)) { this.responseBody.put("code", 404); return this.responseBody; } if (!json.equals("")) { ObjectMapper mapper = new ObjectMapper(); try { this.responseBody = mapper.readValue(json, new TypeReference<Map<String, Object>>(){}); } catch (IOException e) { e.printStackTrace(); } } return this.responseBody; } }
public class class_name { public Map<String, Object> jsonToMap(String json) { /* * This if block treats the /v2/accounts/exists response. Currently the endpoint returns the status * code on its response body, breaking the JSON conversion. */ if ("200".equals(json)) { this.responseBody.put("code", 200); // depends on control dependency: [if], data = [none] return this.responseBody; // depends on control dependency: [if], data = [none] } if ("400".equals(json)) { this.responseBody.put("code", 400); // depends on control dependency: [if], data = [none] return this.responseBody; // depends on control dependency: [if], data = [none] } if ("404".equals(json)) { this.responseBody.put("code", 404); // depends on control dependency: [if], data = [none] return this.responseBody; // depends on control dependency: [if], data = [none] } if (!json.equals("")) { ObjectMapper mapper = new ObjectMapper(); try { this.responseBody = mapper.readValue(json, new TypeReference<Map<String, Object>>(){}); // depends on control dependency: [try], data = [none] } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } return this.responseBody; } }
public class class_name { public static MutableRoaringBitmap or(final ImmutableRoaringBitmap x1, final ImmutableRoaringBitmap x2) { final MutableRoaringBitmap answer = new MutableRoaringBitmap(); MappeableContainerPointer i1 = x1.highLowContainer.getContainerPointer(); MappeableContainerPointer i2 = x2.highLowContainer.getContainerPointer(); main: if (i1.hasContainer() && i2.hasContainer()) { while (true) { if (i1.key() == i2.key()) { answer.getMappeableRoaringArray().append(i1.key(), i1.getContainer().or(i2.getContainer())); i1.advance(); i2.advance(); if (!i1.hasContainer() || !i2.hasContainer()) { break main; } } else if (Util.compareUnsigned(i1.key(), i2.key()) < 0) { // i1.key() < i2.key() answer.getMappeableRoaringArray().appendCopy(i1.key(), i1.getContainer()); i1.advance(); if (!i1.hasContainer()) { break main; } } else { // i1.key() > i2.key() answer.getMappeableRoaringArray().appendCopy(i2.key(), i2.getContainer()); i2.advance(); if (!i2.hasContainer()) { break main; } } } } if (!i1.hasContainer()) { while (i2.hasContainer()) { answer.getMappeableRoaringArray().appendCopy(i2.key(), i2.getContainer()); i2.advance(); } } else if (!i2.hasContainer()) { while (i1.hasContainer()) { answer.getMappeableRoaringArray().appendCopy(i1.key(), i1.getContainer()); i1.advance(); } } return answer; } }
public class class_name { public static MutableRoaringBitmap or(final ImmutableRoaringBitmap x1, final ImmutableRoaringBitmap x2) { final MutableRoaringBitmap answer = new MutableRoaringBitmap(); MappeableContainerPointer i1 = x1.highLowContainer.getContainerPointer(); MappeableContainerPointer i2 = x2.highLowContainer.getContainerPointer(); main: if (i1.hasContainer() && i2.hasContainer()) { while (true) { if (i1.key() == i2.key()) { answer.getMappeableRoaringArray().append(i1.key(), i1.getContainer().or(i2.getContainer())); // depends on control dependency: [if], data = [none] i1.advance(); // depends on control dependency: [if], data = [none] i2.advance(); // depends on control dependency: [if], data = [none] if (!i1.hasContainer() || !i2.hasContainer()) { break main; } } else if (Util.compareUnsigned(i1.key(), i2.key()) < 0) { // i1.key() < i2.key() answer.getMappeableRoaringArray().appendCopy(i1.key(), i1.getContainer()); // depends on control dependency: [if], data = [none] i1.advance(); // depends on control dependency: [if], data = [none] if (!i1.hasContainer()) { break main; } } else { // i1.key() > i2.key() answer.getMappeableRoaringArray().appendCopy(i2.key(), i2.getContainer()); // depends on control dependency: [if], data = [none] i2.advance(); // depends on control dependency: [if], data = [none] if (!i2.hasContainer()) { break main; } } } } if (!i1.hasContainer()) { while (i2.hasContainer()) { answer.getMappeableRoaringArray().appendCopy(i2.key(), i2.getContainer()); // depends on control dependency: [while], data = [none] i2.advance(); // depends on control dependency: [while], data = [none] } } else if (!i2.hasContainer()) { while (i1.hasContainer()) { answer.getMappeableRoaringArray().appendCopy(i1.key(), i1.getContainer()); // depends on control dependency: [while], data = [none] i1.advance(); // depends on control dependency: [while], data = [none] } } return answer; } }
public class class_name { public void addCapabilityRequirements(OperationContext context, Resource resource, ModelNode attributeValue) { @SuppressWarnings("deprecation") CapabilityReferenceRecorder refRecorder = getReferenceRecorder(); if (refRecorder != null) { // We can't process expressions if (attributeValue.getType() != ModelType.EXPRESSION) { ModelNode value = attributeValue.isDefined() ? attributeValue : (defaultValue != null) ? defaultValue : new ModelNode(); refRecorder.addCapabilityRequirements(context, resource, name, value.isDefined() ? value.asString() : null); } } } }
public class class_name { public void addCapabilityRequirements(OperationContext context, Resource resource, ModelNode attributeValue) { @SuppressWarnings("deprecation") CapabilityReferenceRecorder refRecorder = getReferenceRecorder(); if (refRecorder != null) { // We can't process expressions if (attributeValue.getType() != ModelType.EXPRESSION) { ModelNode value = attributeValue.isDefined() ? attributeValue : (defaultValue != null) ? defaultValue : new ModelNode(); refRecorder.addCapabilityRequirements(context, resource, name, value.isDefined() ? value.asString() : null); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static MSICredentials getMSICredentials(String managementEndpoint) { //check if we are running in a web app String websiteName = System.getenv("WEBSITE_SITE_NAME"); if (websiteName != null && !websiteName.isEmpty()) { // We are in a web app... MSIConfigurationForAppService config = new MSIConfigurationForAppService(managementEndpoint); return forAppService(config); } else { //We are in a vm/container MSIConfigurationForVirtualMachine config = new MSIConfigurationForVirtualMachine(managementEndpoint); return forVirtualMachine(config); } } }
public class class_name { public static MSICredentials getMSICredentials(String managementEndpoint) { //check if we are running in a web app String websiteName = System.getenv("WEBSITE_SITE_NAME"); if (websiteName != null && !websiteName.isEmpty()) { // We are in a web app... MSIConfigurationForAppService config = new MSIConfigurationForAppService(managementEndpoint); return forAppService(config); // depends on control dependency: [if], data = [none] } else { //We are in a vm/container MSIConfigurationForVirtualMachine config = new MSIConfigurationForVirtualMachine(managementEndpoint); return forVirtualMachine(config); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void awaitTermination(ExecutorService executorService, long timeoutMillis) { if (executorService.isTerminated()) return; log.info("Start Terminating !!! - {}, timeoutMillis - {}", executorService, timeoutMillis); long startTimeMillis = System.currentTimeMillis(); try { executorService .awaitTermination(timeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { log.warn("Timeout Occur !!! - {}, timeoutMillis - {}", executorService, timeoutMillis); } log.info("Terminated !!! - {} took {} ms", executorService, startTimeMillis - System.currentTimeMillis()); } }
public class class_name { public static void awaitTermination(ExecutorService executorService, long timeoutMillis) { if (executorService.isTerminated()) return; log.info("Start Terminating !!! - {}, timeoutMillis - {}", executorService, timeoutMillis); long startTimeMillis = System.currentTimeMillis(); try { executorService .awaitTermination(timeoutMillis, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { log.warn("Timeout Occur !!! - {}, timeoutMillis - {}", executorService, timeoutMillis); } // depends on control dependency: [catch], data = [none] log.info("Terminated !!! - {} took {} ms", executorService, startTimeMillis - System.currentTimeMillis()); } }
public class class_name { public void setWarningLevel(int level) { if (level < WarningMessage.NONE || level > WarningMessage.PARANOIA) { this.warningLevel = WarningMessage.LIKELY_ERRORS; } else { this.warningLevel = level; } } }
public class class_name { public void setWarningLevel(int level) { if (level < WarningMessage.NONE || level > WarningMessage.PARANOIA) { this.warningLevel = WarningMessage.LIKELY_ERRORS; // depends on control dependency: [if], data = [none] } else { this.warningLevel = level; // depends on control dependency: [if], data = [none] } } }
public class class_name { public synchronized Properties getProperties(final File file) throws IOException { final Properties fileprops; if (needsReload(file)) { fileprops = new Properties(); final InputStream is = new FileInputStream(file); try { fileprops.load(is); } finally { if (null != is) { is.close(); } } mtimes.put(file, file.lastModified()); props.put(file, fileprops); return fileprops; } return props.get(file); } }
public class class_name { public synchronized Properties getProperties(final File file) throws IOException { final Properties fileprops; if (needsReload(file)) { fileprops = new Properties(); // depends on control dependency: [if], data = [none] final InputStream is = new FileInputStream(file); try { fileprops.load(is); // depends on control dependency: [try], data = [none] } finally { if (null != is) { is.close(); // depends on control dependency: [if], data = [none] } } mtimes.put(file, file.lastModified()); // depends on control dependency: [if], data = [none] props.put(file, fileprops); // depends on control dependency: [if], data = [none] return fileprops; // depends on control dependency: [if], data = [none] } return props.get(file); } }
public class class_name { public static void generate( Application app, File outputDirectory, Collection<TemplateEntry> templates, Logger logger ) throws IOException { // Create the context on the fly ApplicationContextBean appCtx = ContextUtils.toContext( app ); Context wrappingCtx = Context .newBuilder( appCtx ) .resolver( MapValueResolver.INSTANCE, JavaBeanValueResolver.INSTANCE, MethodValueResolver.INSTANCE, new ComponentPathResolver() ).build(); // Deal with the templates try { for( TemplateEntry template : templates ) { logger.fine( "Processing template " + template.getTemplateFile() + " to application " + app + "." ); File target; String targetFilePath = template.getTargetFilePath(); if( ! Utils.isEmptyOrWhitespaces( targetFilePath )) { target = new File( targetFilePath.replace( "${app}", app.getName())); } else { String filename = template.getTemplateFile().getName().replaceFirst( "\\.tpl$", "" ); target = new File( outputDirectory, app.getName() + "/" + filename ); } Utils.createDirectory( target.getParentFile()); String output = template.getTemplate().apply( wrappingCtx ); Utils.writeStringInto( output, target ); logger.fine( "Template " + template.getTemplateFile() + " was processed with application " + app + ". Output is in " + target ); } } finally { wrappingCtx.destroy(); } } }
public class class_name { public static void generate( Application app, File outputDirectory, Collection<TemplateEntry> templates, Logger logger ) throws IOException { // Create the context on the fly ApplicationContextBean appCtx = ContextUtils.toContext( app ); Context wrappingCtx = Context .newBuilder( appCtx ) .resolver( MapValueResolver.INSTANCE, JavaBeanValueResolver.INSTANCE, MethodValueResolver.INSTANCE, new ComponentPathResolver() ).build(); // Deal with the templates try { for( TemplateEntry template : templates ) { logger.fine( "Processing template " + template.getTemplateFile() + " to application " + app + "." ); // depends on control dependency: [for], data = [template] File target; String targetFilePath = template.getTargetFilePath(); if( ! Utils.isEmptyOrWhitespaces( targetFilePath )) { target = new File( targetFilePath.replace( "${app}", app.getName())); // depends on control dependency: [if], data = [none] } else { String filename = template.getTemplateFile().getName().replaceFirst( "\\.tpl$", "" ); target = new File( outputDirectory, app.getName() + "/" + filename ); // depends on control dependency: [if], data = [none] } Utils.createDirectory( target.getParentFile()); // depends on control dependency: [for], data = [none] String output = template.getTemplate().apply( wrappingCtx ); Utils.writeStringInto( output, target ); // depends on control dependency: [for], data = [none] logger.fine( "Template " + template.getTemplateFile() + " was processed with application " + app + ". Output is in " + target ); // depends on control dependency: [for], data = [template] } } finally { wrappingCtx.destroy(); } } }
public class class_name { private boolean symmetryBreakingForStayingVMs(ReconfigurationProblem rp) { for (VM vm : rp.getFutureRunningVMs()) { VMTransition a = rp.getVMAction(vm); Slice dSlice = a.getDSlice(); Slice cSlice = a.getCSlice(); if (dSlice != null && cSlice != null) { BoolVar stay = ((KeepRunningVM) a).isStaying(); Boolean ret = strictlyDecreasingOrUnchanged(vm); if (Boolean.TRUE.equals(ret) && !zeroDuration(rp, stay, cSlice)) { return false; //Else, the resource usage is decreasing, so // we set the cSlice duration to 0 to directly reduces the resource allocation } else if (Boolean.FALSE.equals(ret) && !zeroDuration(rp, stay, dSlice)) { //If the resource usage will be increasing //Then the duration of the dSlice can be set to 0 //(the allocation will be performed at the end of the reconfiguration process) return false; } } } return true; } }
public class class_name { private boolean symmetryBreakingForStayingVMs(ReconfigurationProblem rp) { for (VM vm : rp.getFutureRunningVMs()) { VMTransition a = rp.getVMAction(vm); Slice dSlice = a.getDSlice(); Slice cSlice = a.getCSlice(); if (dSlice != null && cSlice != null) { BoolVar stay = ((KeepRunningVM) a).isStaying(); Boolean ret = strictlyDecreasingOrUnchanged(vm); if (Boolean.TRUE.equals(ret) && !zeroDuration(rp, stay, cSlice)) { return false; // depends on control dependency: [if], data = [none] //Else, the resource usage is decreasing, so // we set the cSlice duration to 0 to directly reduces the resource allocation } else if (Boolean.FALSE.equals(ret) && !zeroDuration(rp, stay, dSlice)) { //If the resource usage will be increasing //Then the duration of the dSlice can be set to 0 //(the allocation will be performed at the end of the reconfiguration process) return false; // depends on control dependency: [if], data = [none] } } } return true; } }
public class class_name { @Override public Object getValue(ELContext context, Object base, Object property) { if (context == null) { throw new NullPointerException("context is null"); } Object result = null; if (isResolvable(base)) { if (property != null) { try { result = ((ResourceBundle) base).getObject(property.toString()); } catch (MissingResourceException e) { result = "???" + property + "???"; } } context.setPropertyResolved(true); } return result; } }
public class class_name { @Override public Object getValue(ELContext context, Object base, Object property) { if (context == null) { throw new NullPointerException("context is null"); } Object result = null; if (isResolvable(base)) { if (property != null) { try { result = ((ResourceBundle) base).getObject(property.toString()); // depends on control dependency: [try], data = [none] } catch (MissingResourceException e) { result = "???" + property + "???"; } // depends on control dependency: [catch], data = [none] } context.setPropertyResolved(true); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static int stringSize(long x) { if(x < 0) { // Avoid overflow on extreme negative return (x == Long.MIN_VALUE) ? 20 : stringSize(-x) + 1; } // This is almost a binary search - 10 cases is not a power of two, and we // assume that the smaller values are more frequent. return (x <= Integer.MAX_VALUE) ? stringSize((int) x) : // (x < 10000000000000L) // 10-13 vs. 14-19 ? (x < 100000000000L) // 10-11 vs. 12-13 ? ((x < 10000000000L) ? 10 : 11) // : ((x < 1000000000000L) ? 12 : 13) // : (x < 1000000000000000L) // 14-15 vs. 16-19 ? ((x < 100000000000000L) ? 14 : 15) // 14-15 : (x < 100000000000000000L) // 16-17 vs. 18-19 ? ((x < 10000000000000000L) ? 16 : 17) // 16-17 : ((x < 1000000000000000000L) ? 18 : 19); // 18-19 } }
public class class_name { public static int stringSize(long x) { if(x < 0) { // Avoid overflow on extreme negative return (x == Long.MIN_VALUE) ? 20 : stringSize(-x) + 1; // depends on control dependency: [if], data = [(x] } // This is almost a binary search - 10 cases is not a power of two, and we // assume that the smaller values are more frequent. return (x <= Integer.MAX_VALUE) ? stringSize((int) x) : // (x < 10000000000000L) // 10-13 vs. 14-19 ? (x < 100000000000L) // 10-11 vs. 12-13 ? ((x < 10000000000L) ? 10 : 11) // : ((x < 1000000000000L) ? 12 : 13) // : (x < 1000000000000000L) // 14-15 vs. 16-19 ? ((x < 100000000000000L) ? 14 : 15) // 14-15 : (x < 100000000000000000L) // 16-17 vs. 18-19 ? ((x < 10000000000000000L) ? 16 : 17) // 16-17 : ((x < 1000000000000000000L) ? 18 : 19); // 18-19 } }
public class class_name { public static SortedSet reduce(SortedSet locations) { SortedSet newSet = new TreeSet(); Iterator it = locations.iterator(); while (it.hasNext()) { LocationRange next = (LocationRange)it.next(); if (newSet.size() == 0) { newSet.add(next); continue; } if (next.getStartLocation().compareTo (next.getEndLocation()) >= 0) { continue; } // Try to reduce the set by joining adjacent ranges or eliminating // overlap. LocationRange last = (LocationRange)newSet.last(); if (next.getStartLocation().compareTo (last.getEndLocation()) <= 0) { if (last.getEndLocation().compareTo (next.getEndLocation()) <= 0) { newSet.remove(last); newSet.add(new LocationRangeImpl(last, next)); } continue; } newSet.add(next); } return newSet; } }
public class class_name { public static SortedSet reduce(SortedSet locations) { SortedSet newSet = new TreeSet(); Iterator it = locations.iterator(); while (it.hasNext()) { LocationRange next = (LocationRange)it.next(); if (newSet.size() == 0) { newSet.add(next); // depends on control dependency: [if], data = [none] continue; } if (next.getStartLocation().compareTo (next.getEndLocation()) >= 0) { continue; } // Try to reduce the set by joining adjacent ranges or eliminating // overlap. LocationRange last = (LocationRange)newSet.last(); if (next.getStartLocation().compareTo (last.getEndLocation()) <= 0) { if (last.getEndLocation().compareTo (next.getEndLocation()) <= 0) { newSet.remove(last); // depends on control dependency: [if], data = [none] newSet.add(new LocationRangeImpl(last, next)); // depends on control dependency: [if], data = [none] } continue; } newSet.add(next); // depends on control dependency: [while], data = [none] } return newSet; } }