code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public boolean deleteIndex() { boolean deleted = false; ExtensionsDao extensionsDao = geoPackage.getExtensionsDao(); TableIndexDao tableIndexDao = geoPackage.getTableIndexDao(); try { // Delete geometry indices and table index if (tableIndexDao.isTableExists()) { deleted = tableIndexDao.deleteByIdCascade(tableName) > 0; } // Delete the extensions entry if (extensionsDao.isTableExists()) { deleted = extensionsDao.deleteByExtension(EXTENSION_NAME, tableName) > 0 || deleted; } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete Table Index. GeoPackage: " + geoPackage.getName() + ", Table: " + tableName, e); } return deleted; } }
public class class_name { public boolean deleteIndex() { boolean deleted = false; ExtensionsDao extensionsDao = geoPackage.getExtensionsDao(); TableIndexDao tableIndexDao = geoPackage.getTableIndexDao(); try { // Delete geometry indices and table index if (tableIndexDao.isTableExists()) { deleted = tableIndexDao.deleteByIdCascade(tableName) > 0; // depends on control dependency: [if], data = [none] } // Delete the extensions entry if (extensionsDao.isTableExists()) { deleted = extensionsDao.deleteByExtension(EXTENSION_NAME, tableName) > 0 || deleted; // depends on control dependency: [if], data = [none] } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete Table Index. GeoPackage: " + geoPackage.getName() + ", Table: " + tableName, e); } // depends on control dependency: [catch], data = [none] return deleted; } }
public class class_name { public void marshall(DynamoDBv2Action dynamoDBv2Action, ProtocolMarshaller protocolMarshaller) { if (dynamoDBv2Action == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(dynamoDBv2Action.getRoleArn(), ROLEARN_BINDING); protocolMarshaller.marshall(dynamoDBv2Action.getPutItem(), PUTITEM_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DynamoDBv2Action dynamoDBv2Action, ProtocolMarshaller protocolMarshaller) { if (dynamoDBv2Action == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(dynamoDBv2Action.getRoleArn(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(dynamoDBv2Action.getPutItem(), PUTITEM_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean isAllAssignableFrom(Class<?>[] types1, Class<?>[] types2) { if (ArrayUtil.isEmpty(types1) && ArrayUtil.isEmpty(types2)) { return true; } if (null == types1 || null == types2) { // 任何一个为null不相等(之前已判断两个都为null的情况) return false; } if (types1.length != types2.length) { return false; } Class<?> type1; Class<?> type2; for (int i = 0; i < types1.length; i++) { type1 = types1[i]; type2 = types2[i]; if (isBasicType(type1) && isBasicType(type2)) { // 原始类型和包装类型存在不一致情况 if (BasicType.unWrap(type1) != BasicType.unWrap(type2)) { return false; } } else if (false == type1.isAssignableFrom(type2)) { return false; } } return true; } }
public class class_name { public static boolean isAllAssignableFrom(Class<?>[] types1, Class<?>[] types2) { if (ArrayUtil.isEmpty(types1) && ArrayUtil.isEmpty(types2)) { return true; // depends on control dependency: [if], data = [none] } if (null == types1 || null == types2) { // 任何一个为null不相等(之前已判断两个都为null的情况) return false; // depends on control dependency: [if], data = [none] } if (types1.length != types2.length) { return false; // depends on control dependency: [if], data = [none] } Class<?> type1; Class<?> type2; for (int i = 0; i < types1.length; i++) { type1 = types1[i]; // depends on control dependency: [for], data = [i] type2 = types2[i]; // depends on control dependency: [for], data = [i] if (isBasicType(type1) && isBasicType(type2)) { // 原始类型和包装类型存在不一致情况 if (BasicType.unWrap(type1) != BasicType.unWrap(type2)) { return false; // depends on control dependency: [if], data = [none] } } else if (false == type1.isAssignableFrom(type2)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public static synchronized void registerUserThread(String service, UserThreadPool userThreadPool) { if (userThreadMap == null) { userThreadMap = new ConcurrentHashMap<String, UserThreadPool>(); } userThreadMap.put(service, userThreadPool); } }
public class class_name { public static synchronized void registerUserThread(String service, UserThreadPool userThreadPool) { if (userThreadMap == null) { userThreadMap = new ConcurrentHashMap<String, UserThreadPool>(); // depends on control dependency: [if], data = [none] } userThreadMap.put(service, userThreadPool); } }
public class class_name { public static NameSpace getThisNS(Class<?> type) { if (!isGeneratedClass(type)) return null; try { return getClassStaticThis(type, type.getSimpleName()).namespace; } catch (Exception e) { if (e.getCause() instanceof UtilTargetError) throw new InterpreterError(e.getCause().getCause().getMessage(), e.getCause().getCause()); return null; } } }
public class class_name { public static NameSpace getThisNS(Class<?> type) { if (!isGeneratedClass(type)) return null; try { return getClassStaticThis(type, type.getSimpleName()).namespace; // depends on control dependency: [try], data = [none] } catch (Exception e) { if (e.getCause() instanceof UtilTargetError) throw new InterpreterError(e.getCause().getCause().getMessage(), e.getCause().getCause()); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static BigInteger decodeBigInteger(String value) { int radix = 10; int index = 0; boolean negative = false; // Handle minus sign, if present. if (value.startsWith("-")) { negative = true; index++; } // Handle radix specifier, if present. if (value.startsWith("0x", index) || value.startsWith("0X", index)) { index += 2; radix = 16; } else if (value.startsWith("#", index)) { index++; radix = 16; } else if (value.startsWith("0", index) && value.length() > 1 + index) { index++; radix = 8; } BigInteger result = new BigInteger(value.substring(index), radix); return (negative ? result.negate() : result); } }
public class class_name { private static BigInteger decodeBigInteger(String value) { int radix = 10; int index = 0; boolean negative = false; // Handle minus sign, if present. if (value.startsWith("-")) { negative = true; // depends on control dependency: [if], data = [none] index++; // depends on control dependency: [if], data = [none] } // Handle radix specifier, if present. if (value.startsWith("0x", index) || value.startsWith("0X", index)) { index += 2; // depends on control dependency: [if], data = [none] radix = 16; // depends on control dependency: [if], data = [none] } else if (value.startsWith("#", index)) { index++; // depends on control dependency: [if], data = [none] radix = 16; // depends on control dependency: [if], data = [none] } else if (value.startsWith("0", index) && value.length() > 1 + index) { index++; // depends on control dependency: [if], data = [none] radix = 8; // depends on control dependency: [if], data = [none] } BigInteger result = new BigInteger(value.substring(index), radix); return (negative ? result.negate() : result); } }
public class class_name { public static void main(final String[] args) { if (args.length == 0) { printHelp(); System.exit(0); } List<String> zipNames = new ArrayList<String>(); List<String> jarNames = new ArrayList<String>(); String destDir = null; boolean jarActive = false, zipActive = false, destDirActive = false; boolean verbose = false; // process arguments for (int i = 0; i < args.length; i++) { String arg = args[i]; if (arg.charAt(0) == '-') { // switch arg = arg.substring(1); if (arg.equalsIgnoreCase("jar")) { jarActive = true; zipActive = false; destDirActive = false; } else if (arg.equalsIgnoreCase("zip")) { zipActive = true; jarActive = false; destDirActive = false; } else if (arg.equalsIgnoreCase("dir")) { jarActive = false; zipActive = false; destDirActive = true; } else if (arg.equalsIgnoreCase("verbose")) { verbose = true; } else { reportError("Invalid switch - " + arg); } } else { if (jarActive) { jarNames.add(arg); } else if (zipActive) { zipNames.add(arg); } else if (destDirActive) { if (destDir != null) { reportError("duplicate argument - " + "-destDir"); } destDir = arg; } else { reportError("Too many parameters - " + arg); } } } if (destDir == null || (zipNames.size() + jarNames.size()) == 0) { reportError("Missing parameters"); } if (verbose) { System.out.println("Effective command: " + ZipExploder.class.getName() + " " + (jarNames.size() > 0 ? "-jars " + jarNames + " " : "") + (zipNames.size() > 0 ? "-zips " + zipNames + " " : "") + "-dir " + destDir); } try { ZipExploder ze = new ZipExploder(verbose); ze.process(FileUtils.pathNamesToFiles(zipNames.toArray(new String[zipNames.size()])), FileUtils.pathNamesToFiles(jarNames.toArray(new String[jarNames.size()])), new File(destDir)); } catch (IOException ioe) { System.err.println("Exception - " + ioe.getMessage()); ioe.printStackTrace(); // *** debug *** System.exit(2); } } }
public class class_name { public static void main(final String[] args) { if (args.length == 0) { printHelp(); // depends on control dependency: [if], data = [none] System.exit(0); // depends on control dependency: [if], data = [0)] } List<String> zipNames = new ArrayList<String>(); List<String> jarNames = new ArrayList<String>(); String destDir = null; boolean jarActive = false, zipActive = false, destDirActive = false; boolean verbose = false; // process arguments for (int i = 0; i < args.length; i++) { String arg = args[i]; if (arg.charAt(0) == '-') { // switch arg = arg.substring(1); // depends on control dependency: [if], data = [none] if (arg.equalsIgnoreCase("jar")) { jarActive = true; // depends on control dependency: [if], data = [none] zipActive = false; // depends on control dependency: [if], data = [none] destDirActive = false; // depends on control dependency: [if], data = [none] } else if (arg.equalsIgnoreCase("zip")) { zipActive = true; // depends on control dependency: [if], data = [none] jarActive = false; // depends on control dependency: [if], data = [none] destDirActive = false; // depends on control dependency: [if], data = [none] } else if (arg.equalsIgnoreCase("dir")) { jarActive = false; // depends on control dependency: [if], data = [none] zipActive = false; // depends on control dependency: [if], data = [none] destDirActive = true; // depends on control dependency: [if], data = [none] } else if (arg.equalsIgnoreCase("verbose")) { verbose = true; // depends on control dependency: [if], data = [none] } else { reportError("Invalid switch - " + arg); // depends on control dependency: [if], data = [none] } } else { if (jarActive) { jarNames.add(arg); // depends on control dependency: [if], data = [none] } else if (zipActive) { zipNames.add(arg); // depends on control dependency: [if], data = [none] } else if (destDirActive) { if (destDir != null) { reportError("duplicate argument - " + "-destDir"); // depends on control dependency: [if], data = [none] } destDir = arg; // depends on control dependency: [if], data = [none] } else { reportError("Too many parameters - " + arg); // depends on control dependency: [if], data = [none] } } } if (destDir == null || (zipNames.size() + jarNames.size()) == 0) { reportError("Missing parameters"); // depends on control dependency: [if], data = [none] } if (verbose) { System.out.println("Effective command: " + ZipExploder.class.getName() + " " + (jarNames.size() > 0 ? "-jars " + jarNames + " " : "") + (zipNames.size() > 0 ? "-zips " + zipNames + " " : "") + "-dir " + destDir); // depends on control dependency: [if], data = [none] } try { ZipExploder ze = new ZipExploder(verbose); ze.process(FileUtils.pathNamesToFiles(zipNames.toArray(new String[zipNames.size()])), FileUtils.pathNamesToFiles(jarNames.toArray(new String[jarNames.size()])), new File(destDir)); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { System.err.println("Exception - " + ioe.getMessage()); ioe.printStackTrace(); // *** debug *** System.exit(2); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Element getChild( Element root, String name ) { if( null == root ) { return null; } NodeList list = root.getElementsByTagName( name ); int n = list.getLength(); if( n < 1 ) { return null; } return (Element) list.item( 0 ); } }
public class class_name { public static Element getChild( Element root, String name ) { if( null == root ) { return null; // depends on control dependency: [if], data = [none] } NodeList list = root.getElementsByTagName( name ); int n = list.getLength(); if( n < 1 ) { return null; // depends on control dependency: [if], data = [none] } return (Element) list.item( 0 ); } }
public class class_name { public void onCoordinateSnapAttempt(CoordinateSnapEvent event) { if (editingService.getEditingState() == GeometryEditState.INSERTING) { String identifier = baseName + "." + editingService.getIndexService().format(editingService.getInsertIndex()); Object parentGroup = groups.get(identifier.substring(0, identifier.lastIndexOf('.')) + ".vertices"); Coordinate temp = event.getTo(); Coordinate coordinate = mapWidget.getMapModel().getMapView().getWorldViewTransformer().worldToPan(temp); addShapeToGraphicsContext(mapWidget.getVectorContext(), parentGroup, identifier, coordinate, event.hasSnapped() ? styleService.getVertexSnappedStyle() : new ShapeStyle()); } } }
public class class_name { public void onCoordinateSnapAttempt(CoordinateSnapEvent event) { if (editingService.getEditingState() == GeometryEditState.INSERTING) { String identifier = baseName + "." + editingService.getIndexService().format(editingService.getInsertIndex()); Object parentGroup = groups.get(identifier.substring(0, identifier.lastIndexOf('.')) + ".vertices"); Coordinate temp = event.getTo(); Coordinate coordinate = mapWidget.getMapModel().getMapView().getWorldViewTransformer().worldToPan(temp); addShapeToGraphicsContext(mapWidget.getVectorContext(), parentGroup, identifier, coordinate, event.hasSnapped() ? styleService.getVertexSnappedStyle() : new ShapeStyle()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String getAlgName(int ch, int choice) { /* Only the normative character name can be algorithmic. */ if (choice == UCharacterNameChoice.UNICODE_CHAR_NAME || choice == UCharacterNameChoice.EXTENDED_CHAR_NAME ) { // index in terms integer index synchronized (m_utilStringBuffer_) { m_utilStringBuffer_.setLength(0); for (int index = m_algorithm_.length - 1; index >= 0; index --) { if (m_algorithm_[index].contains(ch)) { m_algorithm_[index].appendName(ch, m_utilStringBuffer_); return m_utilStringBuffer_.toString(); } } } } return null; } }
public class class_name { private String getAlgName(int ch, int choice) { /* Only the normative character name can be algorithmic. */ if (choice == UCharacterNameChoice.UNICODE_CHAR_NAME || choice == UCharacterNameChoice.EXTENDED_CHAR_NAME ) { // index in terms integer index synchronized (m_utilStringBuffer_) { // depends on control dependency: [if], data = [] m_utilStringBuffer_.setLength(0); for (int index = m_algorithm_.length - 1; index >= 0; index --) { if (m_algorithm_[index].contains(ch)) { m_algorithm_[index].appendName(ch, m_utilStringBuffer_); // depends on control dependency: [if], data = [none] return m_utilStringBuffer_.toString(); // depends on control dependency: [if], data = [none] } } } } return null; } }
public class class_name { void removeAndShift(int firstPara, int lastPara, int shift) { for(int i = 0; i < entries.size(); i++) { if(entries.get(i).numberOfParagraph >= firstPara && entries.get(i).numberOfParagraph <= lastPara) { entries.remove(i); i--; } } for (CacheEntry anEntry : entries) { if (anEntry.numberOfParagraph > lastPara) { anEntry.numberOfParagraph += shift; } } } }
public class class_name { void removeAndShift(int firstPara, int lastPara, int shift) { for(int i = 0; i < entries.size(); i++) { if(entries.get(i).numberOfParagraph >= firstPara && entries.get(i).numberOfParagraph <= lastPara) { entries.remove(i); // depends on control dependency: [if], data = [none] i--; // depends on control dependency: [if], data = [none] } } for (CacheEntry anEntry : entries) { if (anEntry.numberOfParagraph > lastPara) { anEntry.numberOfParagraph += shift; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public boolean ensurePipelineVisible(CaseInsensitiveString pipelineToAdd) { boolean modified = false; for (DashboardFilter f : viewFilters.filters()) { modified = modified || f.allowPipeline(pipelineToAdd); } return modified; } }
public class class_name { public boolean ensurePipelineVisible(CaseInsensitiveString pipelineToAdd) { boolean modified = false; for (DashboardFilter f : viewFilters.filters()) { modified = modified || f.allowPipeline(pipelineToAdd); // depends on control dependency: [for], data = [f] } return modified; } }
public class class_name { protected int handleGetLimit(int field, int limitType) { if (field == ERA) { if (limitType == MINIMUM || limitType == GREATEST_MINIMUM) { return BEFORE_MINGUO; } else { return MINGUO; } } return super.handleGetLimit(field, limitType); } }
public class class_name { protected int handleGetLimit(int field, int limitType) { if (field == ERA) { if (limitType == MINIMUM || limitType == GREATEST_MINIMUM) { return BEFORE_MINGUO; // depends on control dependency: [if], data = [none] } else { return MINGUO; // depends on control dependency: [if], data = [none] } } return super.handleGetLimit(field, limitType); } }
public class class_name { private String getOwnerId() { APITrace.begin(this, "AWSCloud.getOwnerId"); try { ProviderContext ctx = getContext(); if( ctx == null ) { return null; } Map<String, String> parameters = getStandardParameters(getContext(), EC2Method.DESCRIBE_SECURITY_GROUPS); EC2Method method; NodeList blocks; Document doc; method = new EC2Method(EC2Method.SERVICE_ID, this, parameters); try { doc = method.invoke(); } catch( EC2Exception e ) { logger.error(e.getSummary()); throw new CloudException(e); } blocks = doc.getElementsByTagName("securityGroupInfo"); for( int i = 0; i < blocks.getLength(); i++ ) { NodeList items = blocks.item(i).getChildNodes(); for( int j = 0; j < items.getLength(); j++ ) { Node item = items.item(j); if( item.getNodeName().equals("item") ) { NodeList attrs = item.getChildNodes(); for( int k = 0; k < attrs.getLength(); k++ ) { Node attr = attrs.item(k); if( attr.getNodeName().equals("ownerId") ) { return attr.getFirstChild().getNodeValue().trim(); } } } } } return null; } catch( InternalException e ) { } catch( CloudException e ) { } finally { APITrace.end(); } // Couldn't get the number for some reason return null; } }
public class class_name { private String getOwnerId() { APITrace.begin(this, "AWSCloud.getOwnerId"); try { ProviderContext ctx = getContext(); if( ctx == null ) { return null; // depends on control dependency: [if], data = [none] } Map<String, String> parameters = getStandardParameters(getContext(), EC2Method.DESCRIBE_SECURITY_GROUPS); EC2Method method; NodeList blocks; Document doc; method = new EC2Method(EC2Method.SERVICE_ID, this, parameters); // depends on control dependency: [try], data = [none] try { doc = method.invoke(); // depends on control dependency: [try], data = [none] } catch( EC2Exception e ) { logger.error(e.getSummary()); throw new CloudException(e); } // depends on control dependency: [catch], data = [none] blocks = doc.getElementsByTagName("securityGroupInfo"); // depends on control dependency: [try], data = [none] for( int i = 0; i < blocks.getLength(); i++ ) { NodeList items = blocks.item(i).getChildNodes(); for( int j = 0; j < items.getLength(); j++ ) { Node item = items.item(j); if( item.getNodeName().equals("item") ) { NodeList attrs = item.getChildNodes(); for( int k = 0; k < attrs.getLength(); k++ ) { Node attr = attrs.item(k); if( attr.getNodeName().equals("ownerId") ) { return attr.getFirstChild().getNodeValue().trim(); // depends on control dependency: [if], data = [none] } } } } } return null; // depends on control dependency: [try], data = [none] } catch( InternalException e ) { } catch( CloudException e ) { // depends on control dependency: [catch], data = [none] } finally { // depends on control dependency: [catch], data = [none] APITrace.end(); } // Couldn't get the number for some reason return null; } }
public class class_name { public static double euclidean(EuclideanCoordinate coord1, EuclideanCoordinate coord2) { int size = Math.min(coord1.dimensions(), coord2.dimensions()); double distance = 0; for(int i = 0; i < size; i++) { double diff = coord1.get(i) - coord2.get(i); distance += diff * diff; } distance = Math.sqrt(distance); return distance; } }
public class class_name { public static double euclidean(EuclideanCoordinate coord1, EuclideanCoordinate coord2) { int size = Math.min(coord1.dimensions(), coord2.dimensions()); double distance = 0; for(int i = 0; i < size; i++) { double diff = coord1.get(i) - coord2.get(i); distance += diff * diff; // depends on control dependency: [for], data = [none] } distance = Math.sqrt(distance); return distance; } }
public class class_name { public TimerImpl getTimer(TimerHandle handle) { TimerHandleImpl timerHandle = (TimerHandleImpl) handle; TimerImpl timer = timers.get(timerHandle.getId()); if (timer != null) { return timer; } return getWaitingOnTxCompletionTimers().get(timerHandle.getId()); } }
public class class_name { public TimerImpl getTimer(TimerHandle handle) { TimerHandleImpl timerHandle = (TimerHandleImpl) handle; TimerImpl timer = timers.get(timerHandle.getId()); if (timer != null) { return timer; // depends on control dependency: [if], data = [none] } return getWaitingOnTxCompletionTimers().get(timerHandle.getId()); } }
public class class_name { public Optional<Job> getOptionalJob(Object projectIdOrPath, int jobId) { try { return (Optional.ofNullable(getJob(projectIdOrPath, jobId))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } } }
public class class_name { public Optional<Job> getOptionalJob(Object projectIdOrPath, int jobId) { try { return (Optional.ofNullable(getJob(projectIdOrPath, jobId))); // depends on control dependency: [try], data = [none] } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static void mergeField(final Tokenizer tokenizer, final ExtensionRegistry extensionRegistry, final Message.Builder builder) throws ParseException { FieldDescriptor field; final Descriptor type = builder.getDescriptorForType(); ExtensionRegistry.ExtensionInfo extension = null; if (tokenizer.tryConsume("[")) { // An extension. final StringBuilder name = new StringBuilder(tokenizer.consumeIdentifier()); while (tokenizer.tryConsume(".")) { name.append('.'); name.append(tokenizer.consumeIdentifier()); } extension = extensionRegistry.findExtensionByName(name.toString()); if (extension == null) { throw tokenizer.parseExceptionPreviousToken( "Extension \"" + name + "\" not found in the ExtensionRegistry."); } else if (extension.descriptor.getContainingType() != type) { throw tokenizer.parseExceptionPreviousToken( "Extension \"" + name + "\" does not extend message type \"" + type.getFullName() + "\"."); } tokenizer.consume("]"); field = extension.descriptor; } else { final String name = tokenizer.consumeIdentifier(); field = type.findFieldByName(name); // Group names are expected to be capitalized as they appear in the // .proto file, which actually matches their type names, not their field // names. if (field == null) { // Explicitly specify US locale so that this code does not break when // executing in Turkey. final String lowerName = name.toLowerCase(Locale.US); field = type.findFieldByName(lowerName); // If the case-insensitive match worked but the field is NOT a group, if (field != null && field.getType() != FieldDescriptor.Type.GROUP) { field = null; } } // Again, special-case group names as described above. if (field != null && field.getType() == FieldDescriptor.Type.GROUP && !field.getMessageType().getName().equals(name)) { field = null; } if (field == null) { throw tokenizer.parseExceptionPreviousToken( "Message type \"" + type.getFullName() + "\" has no field named \"" + name + "\"."); } } Object value = null; if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) { tokenizer.tryConsume(":"); // optional final String endToken; if (tokenizer.tryConsume("<")) { endToken = ">"; } else { tokenizer.consume("{"); endToken = "}"; } final Message.Builder subBuilder; if (extension == null) { subBuilder = builder.newBuilderForField(field); } else { subBuilder = extension.defaultInstance.newBuilderForType(); } while (!tokenizer.tryConsume(endToken)) { if (tokenizer.atEnd()) { throw tokenizer.parseException( "Expected \"" + endToken + "\"."); } mergeField(tokenizer, extensionRegistry, subBuilder); } value = subBuilder.buildPartial(); } else { tokenizer.consume(":"); switch (field.getType()) { case INT32: case SINT32: case SFIXED32: value = tokenizer.consumeInt32(); break; case INT64: case SINT64: case SFIXED64: value = tokenizer.consumeInt64(); break; case UINT32: case FIXED32: value = tokenizer.consumeUInt32(); break; case UINT64: case FIXED64: value = tokenizer.consumeUInt64(); break; case FLOAT: value = tokenizer.consumeFloat(); break; case DOUBLE: value = tokenizer.consumeDouble(); break; case BOOL: value = tokenizer.consumeBoolean(); break; case STRING: value = tokenizer.consumeString(); break; case BYTES: value = tokenizer.consumeByteString(); break; case ENUM: final EnumDescriptor enumType = field.getEnumType(); if (tokenizer.lookingAtInteger()) { final int number = tokenizer.consumeInt32(); value = enumType.findValueByNumber(number); if (value == null) { throw tokenizer.parseExceptionPreviousToken( "Enum type \"" + enumType.getFullName() + "\" has no value with number " + number + '.'); } } else { final String id = tokenizer.consumeIdentifier(); value = enumType.findValueByName(id); if (value == null) { throw tokenizer.parseExceptionPreviousToken( "Enum type \"" + enumType.getFullName() + "\" has no value named \"" + id + "\"."); } } break; case MESSAGE: case GROUP: throw new RuntimeException("Can't get here."); } } if (field.isRepeated()) { builder.addRepeatedField(field, value); } else { builder.setField(field, value); } } }
public class class_name { private static void mergeField(final Tokenizer tokenizer, final ExtensionRegistry extensionRegistry, final Message.Builder builder) throws ParseException { FieldDescriptor field; final Descriptor type = builder.getDescriptorForType(); ExtensionRegistry.ExtensionInfo extension = null; if (tokenizer.tryConsume("[")) { // An extension. final StringBuilder name = new StringBuilder(tokenizer.consumeIdentifier()); while (tokenizer.tryConsume(".")) { name.append('.'); // depends on control dependency: [while], data = [none] name.append(tokenizer.consumeIdentifier()); // depends on control dependency: [while], data = [none] } extension = extensionRegistry.findExtensionByName(name.toString()); if (extension == null) { throw tokenizer.parseExceptionPreviousToken( "Extension \"" + name + "\" not found in the ExtensionRegistry."); } else if (extension.descriptor.getContainingType() != type) { throw tokenizer.parseExceptionPreviousToken( "Extension \"" + name + "\" does not extend message type \"" + type.getFullName() + "\"."); } tokenizer.consume("]"); field = extension.descriptor; } else { final String name = tokenizer.consumeIdentifier(); field = type.findFieldByName(name); // Group names are expected to be capitalized as they appear in the // .proto file, which actually matches their type names, not their field // names. if (field == null) { // Explicitly specify US locale so that this code does not break when // executing in Turkey. final String lowerName = name.toLowerCase(Locale.US); field = type.findFieldByName(lowerName); // depends on control dependency: [if], data = [none] // If the case-insensitive match worked but the field is NOT a group, if (field != null && field.getType() != FieldDescriptor.Type.GROUP) { field = null; // depends on control dependency: [if], data = [none] } } // Again, special-case group names as described above. if (field != null && field.getType() == FieldDescriptor.Type.GROUP && !field.getMessageType().getName().equals(name)) { field = null; // depends on control dependency: [if], data = [none] } if (field == null) { throw tokenizer.parseExceptionPreviousToken( "Message type \"" + type.getFullName() + "\" has no field named \"" + name + "\"."); } } Object value = null; if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) { tokenizer.tryConsume(":"); // optional final String endToken; if (tokenizer.tryConsume("<")) { endToken = ">"; // depends on control dependency: [if], data = [none] } else { tokenizer.consume("{"); // depends on control dependency: [if], data = [none] endToken = "}"; // depends on control dependency: [if], data = [none] } final Message.Builder subBuilder; if (extension == null) { subBuilder = builder.newBuilderForField(field); // depends on control dependency: [if], data = [none] } else { subBuilder = extension.defaultInstance.newBuilderForType(); // depends on control dependency: [if], data = [none] } while (!tokenizer.tryConsume(endToken)) { if (tokenizer.atEnd()) { throw tokenizer.parseException( "Expected \"" + endToken + "\"."); } mergeField(tokenizer, extensionRegistry, subBuilder); // depends on control dependency: [while], data = [none] } value = subBuilder.buildPartial(); } else { tokenizer.consume(":"); switch (field.getType()) { case INT32: case SINT32: case SFIXED32: value = tokenizer.consumeInt32(); break; case INT64: case SINT64: case SFIXED64: value = tokenizer.consumeInt64(); break; case UINT32: case FIXED32: value = tokenizer.consumeUInt32(); break; case UINT64: case FIXED64: value = tokenizer.consumeUInt64(); break; case FLOAT: value = tokenizer.consumeFloat(); break; case DOUBLE: value = tokenizer.consumeDouble(); break; case BOOL: value = tokenizer.consumeBoolean(); break; case STRING: value = tokenizer.consumeString(); break; case BYTES: value = tokenizer.consumeByteString(); break; case ENUM: final EnumDescriptor enumType = field.getEnumType(); if (tokenizer.lookingAtInteger()) { final int number = tokenizer.consumeInt32(); value = enumType.findValueByNumber(number); // depends on control dependency: [if], data = [none] if (value == null) { throw tokenizer.parseExceptionPreviousToken( "Enum type \"" + enumType.getFullName() + "\" has no value with number " + number + '.'); } } else { final String id = tokenizer.consumeIdentifier(); value = enumType.findValueByName(id); // depends on control dependency: [if], data = [none] if (value == null) { throw tokenizer.parseExceptionPreviousToken( "Enum type \"" + enumType.getFullName() + "\" has no value named \"" + id + "\"."); } } break; case MESSAGE: case GROUP: throw new RuntimeException("Can't get here."); } } if (field.isRepeated()) { builder.addRepeatedField(field, value); } else { builder.setField(field, value); } } }
public class class_name { public static int findFirstEqual(final CharSequence source, final int index, final CharSequence match) { for (int i = index; i < source.length(); i++) { if (equalsOne(source.charAt(i), match)) { return i; } } return -1; } }
public class class_name { public static int findFirstEqual(final CharSequence source, final int index, final CharSequence match) { for (int i = index; i < source.length(); i++) { if (equalsOne(source.charAt(i), match)) { return i; // depends on control dependency: [if], data = [none] } } return -1; } }
public class class_name { protected void buildMap( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params, Builder<K, V> builder ) { reader.beginObject(); while ( JsonToken.END_OBJECT != reader.peek() ) { String name = reader.nextName(); K key = keyDeserializer.deserialize( name, ctx ); V value = valueDeserializer.deserialize( reader, ctx, params ); builder.put( key, value ); } reader.endObject(); } }
public class class_name { protected void buildMap( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params, Builder<K, V> builder ) { reader.beginObject(); while ( JsonToken.END_OBJECT != reader.peek() ) { String name = reader.nextName(); K key = keyDeserializer.deserialize( name, ctx ); V value = valueDeserializer.deserialize( reader, ctx, params ); builder.put( key, value ); // depends on control dependency: [while], data = [none] } reader.endObject(); } }
public class class_name { public static boolean is_kavarganta(String str) { // System.out.print("Entered is_kavarganta, returning: "); String s1 = VarnaUtil.getAntyaVarna(str); // System.out.print("s1 == " + s1); if (is_kavarga(s1)) { // Log.logInfo("true"); return true; } // Log.logInfo("false"); return false; } }
public class class_name { public static boolean is_kavarganta(String str) { // System.out.print("Entered is_kavarganta, returning: "); String s1 = VarnaUtil.getAntyaVarna(str); // System.out.print("s1 == " + s1); if (is_kavarga(s1)) { // Log.logInfo("true"); return true; // depends on control dependency: [if], data = [none] } // Log.logInfo("false"); return false; } }
public class class_name { public static ChunksManifest createManifestFrom(InputStream xml) { try { ChunksManifestDocument doc = ChunksManifestDocument.Factory.parse( xml); return ManifestElementReader.createManifestFrom(doc); } catch (XmlException e) { throw new DuraCloudRuntimeException(e); } catch (IOException e) { throw new DuraCloudRuntimeException(e); } } }
public class class_name { public static ChunksManifest createManifestFrom(InputStream xml) { try { ChunksManifestDocument doc = ChunksManifestDocument.Factory.parse( xml); return ManifestElementReader.createManifestFrom(doc); // depends on control dependency: [try], data = [none] } catch (XmlException e) { throw new DuraCloudRuntimeException(e); } catch (IOException e) { // depends on control dependency: [catch], data = [none] throw new DuraCloudRuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public int get(int i) { if (i > Math.min(k, n) - 1) { throw new IllegalArgumentException("HeapSelect i is greater than the number of data received so far."); } if (i == k-1) { return heap[0]; } if (!sorted) { sort(heap, Math.min(k,n)); sorted = true; } return heap[k-1-i]; } }
public class class_name { public int get(int i) { if (i > Math.min(k, n) - 1) { throw new IllegalArgumentException("HeapSelect i is greater than the number of data received so far."); } if (i == k-1) { return heap[0]; // depends on control dependency: [if], data = [none] } if (!sorted) { sort(heap, Math.min(k,n)); // depends on control dependency: [if], data = [none] sorted = true; // depends on control dependency: [if], data = [none] } return heap[k-1-i]; } }
public class class_name { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String name = method.getName(); if (method.getDeclaringClass() == GroovyObject.class) { if (name.equals("getMetaClass")) { return getMetaClass(); } else if (name.equals("setMetaClass")) { return setMetaClass((MetaClass) args[0]); } } return InvokerHelper.invokeMethod(extension, method.getName(), args); } }
public class class_name { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String name = method.getName(); if (method.getDeclaringClass() == GroovyObject.class) { if (name.equals("getMetaClass")) { return getMetaClass(); // depends on control dependency: [if], data = [none] } else if (name.equals("setMetaClass")) { return setMetaClass((MetaClass) args[0]); // depends on control dependency: [if], data = [none] } } return InvokerHelper.invokeMethod(extension, method.getName(), args); } }
public class class_name { protected String toFilename(QualifiedName name, String separator) { final List<String> segments = name.getSegments(); if (segments.isEmpty()) { return ""; //$NON-NLS-1$ } final StringBuilder builder = new StringBuilder(); builder.append(name.toString(separator)); builder.append(getFilenameExtension()); return builder.toString(); } }
public class class_name { protected String toFilename(QualifiedName name, String separator) { final List<String> segments = name.getSegments(); if (segments.isEmpty()) { return ""; //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } final StringBuilder builder = new StringBuilder(); builder.append(name.toString(separator)); builder.append(getFilenameExtension()); return builder.toString(); } }
public class class_name { public InputStream getResourceAsStream(String name) { Source path; path = getPath(name); if (path != null && path.canRead()) { try { return path.inputStream(); } catch (Exception e) { } } return null; } }
public class class_name { public InputStream getResourceAsStream(String name) { Source path; path = getPath(name); if (path != null && path.canRead()) { try { return path.inputStream(); // depends on control dependency: [try], data = [none] } catch (Exception e) { } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { @SuppressWarnings("serial") private IOFileFilter createWildcardCollectorFileFilter(final WildcardContext wildcardContext, final Collection<File> allFiles) { notNull(wildcardContext); notNull(allFiles); return new WildcardFileFilter(wildcardContext.getWildcard()) { @Override public boolean accept(final File file) { final boolean accept = super.accept(file); if (accept) { LOG.debug("\tfound resource: {}", file.getPath()); allFiles.add(file); } return accept; } }; } }
public class class_name { @SuppressWarnings("serial") private IOFileFilter createWildcardCollectorFileFilter(final WildcardContext wildcardContext, final Collection<File> allFiles) { notNull(wildcardContext); notNull(allFiles); return new WildcardFileFilter(wildcardContext.getWildcard()) { @Override public boolean accept(final File file) { final boolean accept = super.accept(file); if (accept) { LOG.debug("\tfound resource: {}", file.getPath()); // depends on control dependency: [if], data = [none] allFiles.add(file); // depends on control dependency: [if], data = [none] } return accept; } }; } }
public class class_name { protected Object invoke(Method method, Object[] arguments) throws InvocationTargetException, IllegalAccessException { logger.trace("Lookup for call {}", method); Object bean = spring.getBean(beanType); try { return method.invoke(bean, arguments); } catch (IllegalArgumentException e) { StringBuilder msg = new StringBuilder(method.toGenericString()); msg.append(" invoked with incompatible arguments:"); for (Object a : arguments) { msg.append(' '); if (a == null) msg.append("null"); else msg.append(a.getClass().getName()); } logger.error(msg.toString()); throw e; } } }
public class class_name { protected Object invoke(Method method, Object[] arguments) throws InvocationTargetException, IllegalAccessException { logger.trace("Lookup for call {}", method); Object bean = spring.getBean(beanType); try { return method.invoke(bean, arguments); } catch (IllegalArgumentException e) { StringBuilder msg = new StringBuilder(method.toGenericString()); msg.append(" invoked with incompatible arguments:"); for (Object a : arguments) { msg.append(' '); // depends on control dependency: [for], data = [a] if (a == null) msg.append("null"); else msg.append(a.getClass().getName()); } logger.error(msg.toString()); throw e; } } }
public class class_name { public void resetUserTempDisable(String username) { Set<CmsUserData> data = TEMP_DISABLED_USER.get(username); if (data == null) { return; } for (CmsUserData userData : data) { userData.reset(); } TEMP_DISABLED_USER.remove(username); } }
public class class_name { public void resetUserTempDisable(String username) { Set<CmsUserData> data = TEMP_DISABLED_USER.get(username); if (data == null) { return; // depends on control dependency: [if], data = [none] } for (CmsUserData userData : data) { userData.reset(); // depends on control dependency: [for], data = [userData] } TEMP_DISABLED_USER.remove(username); } }
public class class_name { public DescribeRulesPackagesResult withRulesPackages(RulesPackage... rulesPackages) { if (this.rulesPackages == null) { setRulesPackages(new java.util.ArrayList<RulesPackage>(rulesPackages.length)); } for (RulesPackage ele : rulesPackages) { this.rulesPackages.add(ele); } return this; } }
public class class_name { public DescribeRulesPackagesResult withRulesPackages(RulesPackage... rulesPackages) { if (this.rulesPackages == null) { setRulesPackages(new java.util.ArrayList<RulesPackage>(rulesPackages.length)); // depends on control dependency: [if], data = [none] } for (RulesPackage ele : rulesPackages) { this.rulesPackages.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private Interactable findNextUpOrDown(Interactable interactable, boolean isDown) { int directionTerm = isDown ? 1 : -1; TerminalPosition startPosition = interactable.getCursorLocation(); if (startPosition == null) { // If the currently active interactable component is not showing the cursor, use the top-left position // instead if we're going up, or the bottom-left position if we're going down if(isDown) { startPosition = new TerminalPosition(0, interactable.getSize().getRows() - 1); } else { startPosition = TerminalPosition.TOP_LEFT_CORNER; } } else { //Adjust position so that it's at the bottom of the component if we're going down or at the top of the //component if we're going right. Otherwise the lookup might product odd results in certain cases. if(isDown) { startPosition = startPosition.withRow(interactable.getSize().getRows() - 1); } else { startPosition = startPosition.withRow(0); } } startPosition = interactable.toBasePane(startPosition); if(startPosition == null) { // The structure has changed, our interactable is no longer inside the base pane! return null; } Set<Interactable> disqualified = getDisqualifiedInteractables(startPosition, true); TerminalSize size = getSize(); int maxShiftLeft = interactable.toBasePane(TerminalPosition.TOP_LEFT_CORNER).getColumn(); maxShiftLeft = Math.max(maxShiftLeft, 0); int maxShiftRight = interactable.toBasePane(new TerminalPosition(interactable.getSize().getColumns() - 1, 0)).getColumn(); maxShiftRight = Math.min(maxShiftRight, size.getColumns() - 1); int maxShift = Math.max(startPosition.getColumn() - maxShiftLeft, maxShiftRight - startPosition.getRow()); for (int searchRow = startPosition.getRow() + directionTerm; searchRow >= 0 && searchRow < size.getRows(); searchRow += directionTerm) { for (int xShift = 0; xShift <= maxShift; xShift++) { for (int modifier : new int[]{1, -1}) { if (xShift == 0 && modifier == -1) { break; } int searchColumn = startPosition.getColumn() + (xShift * modifier); if (searchColumn < maxShiftLeft || searchColumn > maxShiftRight) { continue; } int index = lookupMap[searchRow][searchColumn]; if (index != -1 && !disqualified.contains(interactables.get(index))) { return interactables.get(index); } } } } return null; } }
public class class_name { private Interactable findNextUpOrDown(Interactable interactable, boolean isDown) { int directionTerm = isDown ? 1 : -1; TerminalPosition startPosition = interactable.getCursorLocation(); if (startPosition == null) { // If the currently active interactable component is not showing the cursor, use the top-left position // instead if we're going up, or the bottom-left position if we're going down if(isDown) { startPosition = new TerminalPosition(0, interactable.getSize().getRows() - 1); // depends on control dependency: [if], data = [none] } else { startPosition = TerminalPosition.TOP_LEFT_CORNER; // depends on control dependency: [if], data = [none] } } else { //Adjust position so that it's at the bottom of the component if we're going down or at the top of the //component if we're going right. Otherwise the lookup might product odd results in certain cases. if(isDown) { startPosition = startPosition.withRow(interactable.getSize().getRows() - 1); // depends on control dependency: [if], data = [none] } else { startPosition = startPosition.withRow(0); // depends on control dependency: [if], data = [none] } } startPosition = interactable.toBasePane(startPosition); if(startPosition == null) { // The structure has changed, our interactable is no longer inside the base pane! return null; // depends on control dependency: [if], data = [none] } Set<Interactable> disqualified = getDisqualifiedInteractables(startPosition, true); TerminalSize size = getSize(); int maxShiftLeft = interactable.toBasePane(TerminalPosition.TOP_LEFT_CORNER).getColumn(); maxShiftLeft = Math.max(maxShiftLeft, 0); int maxShiftRight = interactable.toBasePane(new TerminalPosition(interactable.getSize().getColumns() - 1, 0)).getColumn(); maxShiftRight = Math.min(maxShiftRight, size.getColumns() - 1); int maxShift = Math.max(startPosition.getColumn() - maxShiftLeft, maxShiftRight - startPosition.getRow()); for (int searchRow = startPosition.getRow() + directionTerm; searchRow >= 0 && searchRow < size.getRows(); searchRow += directionTerm) { for (int xShift = 0; xShift <= maxShift; xShift++) { for (int modifier : new int[]{1, -1}) { if (xShift == 0 && modifier == -1) { break; } int searchColumn = startPosition.getColumn() + (xShift * modifier); if (searchColumn < maxShiftLeft || searchColumn > maxShiftRight) { continue; } int index = lookupMap[searchRow][searchColumn]; if (index != -1 && !disqualified.contains(interactables.get(index))) { return interactables.get(index); // depends on control dependency: [if], data = [(index] } } } } return null; } }
public class class_name { public static FastStr of(Collection<Character> col) { int sz = col.size(); if (0 == sz) return EMPTY_STR; char[] buf = new char[sz]; Iterator<Character> itr = col.iterator(); int i = 0; while (itr.hasNext()) { buf[i++] = itr.next(); } return new FastStr(buf, 0, sz); } }
public class class_name { public static FastStr of(Collection<Character> col) { int sz = col.size(); if (0 == sz) return EMPTY_STR; char[] buf = new char[sz]; Iterator<Character> itr = col.iterator(); int i = 0; while (itr.hasNext()) { buf[i++] = itr.next(); // depends on control dependency: [while], data = [none] } return new FastStr(buf, 0, sz); } }
public class class_name { public void handleEvent(Event event) { String topic = event.getTopic(); LOGGER.debug("Got Event {} {} ", event, handlers); Collection<IndexingHandler> contentIndexHandler = handlers.get(topic); if (contentIndexHandler != null && contentIndexHandler.size() > 0) { try { int ttl = Utils.toInt(event.getProperty(TopicIndexer.TTL), Integer.MAX_VALUE); for ( IndexingHandler indexingHandler : contentIndexHandler ) { if ( indexingHandler instanceof QoSIndexHandler ) { ttl = Math.min(ttl, Utils.defaultMax(((QoSIndexHandler)indexingHandler).getTtl(event))); } } QueueManager q = null; // queues is ordered by ascending ttl, so the fastest queue is queues[0], // if the ttl is less that that, we can't satisfy it, so we will put it // in the fastest queue if ( ttl < queues[0].batchDelay ) { LOGGER.warn("Unable to satisfy TTL of {} on event {}, posting to the highest priority queue. " + "If this message is logged a lot please adjust the queues or change the event ttl to something that can be satisfied. " + "Filling the highest priority queue is counter productive. ", ttl, event); queues[0].saveEvent(event); } else { for (QueueManager qm : queues) { if (ttl < qm.batchDelay) { q.saveEvent(event); q = null; break; } q = qm; } if (q != null) { q.saveEvent(event); } } } catch (IOException e) { LOGGER.warn(e.getMessage(), e); } } } }
public class class_name { public void handleEvent(Event event) { String topic = event.getTopic(); LOGGER.debug("Got Event {} {} ", event, handlers); Collection<IndexingHandler> contentIndexHandler = handlers.get(topic); if (contentIndexHandler != null && contentIndexHandler.size() > 0) { try { int ttl = Utils.toInt(event.getProperty(TopicIndexer.TTL), Integer.MAX_VALUE); for ( IndexingHandler indexingHandler : contentIndexHandler ) { if ( indexingHandler instanceof QoSIndexHandler ) { ttl = Math.min(ttl, Utils.defaultMax(((QoSIndexHandler)indexingHandler).getTtl(event))); // depends on control dependency: [if], data = [none] } } QueueManager q = null; // queues is ordered by ascending ttl, so the fastest queue is queues[0], // if the ttl is less that that, we can't satisfy it, so we will put it // in the fastest queue if ( ttl < queues[0].batchDelay ) { LOGGER.warn("Unable to satisfy TTL of {} on event {}, posting to the highest priority queue. " + "If this message is logged a lot please adjust the queues or change the event ttl to something that can be satisfied. " + "Filling the highest priority queue is counter productive. ", ttl, event); // depends on control dependency: [if], data = [none] queues[0].saveEvent(event); // depends on control dependency: [if], data = [none] } else { for (QueueManager qm : queues) { if (ttl < qm.batchDelay) { q.saveEvent(event); // depends on control dependency: [if], data = [none] q = null; // depends on control dependency: [if], data = [none] break; } q = qm; // depends on control dependency: [for], data = [qm] } if (q != null) { q.saveEvent(event); // depends on control dependency: [if], data = [none] } } } catch (IOException e) { LOGGER.warn(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static SpecificErrorCondition getSpecificErrorCondition(StanzaError error) { // This method is implemented to provide an easy way of getting a packet // extension of the XMPPError. for (SpecificErrorCondition condition : SpecificErrorCondition.values()) { if (error.getExtension(condition.toString(), AdHocCommandData.SpecificError.namespace) != null) { return condition; } } return null; } }
public class class_name { public static SpecificErrorCondition getSpecificErrorCondition(StanzaError error) { // This method is implemented to provide an easy way of getting a packet // extension of the XMPPError. for (SpecificErrorCondition condition : SpecificErrorCondition.values()) { if (error.getExtension(condition.toString(), AdHocCommandData.SpecificError.namespace) != null) { return condition; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private String typeToPackageName(String contentType) { // make sure we canonicalize the class name: all lower case contentType = contentType.toLowerCase(); int len = contentType.length(); char nm[] = new char[len]; contentType.getChars(0, len, nm, 0); for (int i = 0; i < len; i++) { char c = nm[i]; if (c == '/') { nm[i] = '.'; } else if (!('A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9')) { nm[i] = '_'; } } return new String(nm); } }
public class class_name { private String typeToPackageName(String contentType) { // make sure we canonicalize the class name: all lower case contentType = contentType.toLowerCase(); int len = contentType.length(); char nm[] = new char[len]; contentType.getChars(0, len, nm, 0); for (int i = 0; i < len; i++) { char c = nm[i]; if (c == '/') { nm[i] = '.'; // depends on control dependency: [if], data = [none] } else if (!('A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9')) { nm[i] = '_'; // depends on control dependency: [if], data = [none] } } return new String(nm); } }
public class class_name { @Override public void setSeed(final int[] seed) { if (seed == null) { setSeed(System.currentTimeMillis() + System.identityHashCode(this)); return; } System.arraycopy(seed, 0, v, 0, Math.min(seed.length, v.length)); if (seed.length < v.length) { for (int i = seed.length; i < v.length; ++i) { final long l = v[i - seed.length]; v[i] = (int) ((1812433253l * (l ^ (l >> 30)) + i) & 0xffffffffL); } } index = 0; clear(); // Clear normal deviate cache } }
public class class_name { @Override public void setSeed(final int[] seed) { if (seed == null) { setSeed(System.currentTimeMillis() + System.identityHashCode(this)); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } System.arraycopy(seed, 0, v, 0, Math.min(seed.length, v.length)); if (seed.length < v.length) { for (int i = seed.length; i < v.length; ++i) { final long l = v[i - seed.length]; v[i] = (int) ((1812433253l * (l ^ (l >> 30)) + i) & 0xffffffffL); // depends on control dependency: [for], data = [i] } } index = 0; clear(); // Clear normal deviate cache } }
public class class_name { public static Object getObject(final Map<String, Object> source, final String key, final Object defaultValue) { try { return source.get(key); } catch (Exception _exception) { return defaultValue; } } }
public class class_name { public static Object getObject(final Map<String, Object> source, final String key, final Object defaultValue) { try { return source.get(key); // depends on control dependency: [try], data = [none] } catch (Exception _exception) { return defaultValue; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public <T> List<T> convertEDBObjectsToModelObjects(Class<T> model, List<EDBObject> objects) { List<T> models = new ArrayList<>(); for (EDBObject object : objects) { T instance = convertEDBObjectToModel(model, object); if (instance != null) { models.add(instance); } } return models; } }
public class class_name { public <T> List<T> convertEDBObjectsToModelObjects(Class<T> model, List<EDBObject> objects) { List<T> models = new ArrayList<>(); for (EDBObject object : objects) { T instance = convertEDBObjectToModel(model, object); if (instance != null) { models.add(instance); // depends on control dependency: [if], data = [(instance] } } return models; } }
public class class_name { private static String buildCacheID(ApiRequest request) { StringBuilder req = new StringBuilder(); if (request.getContract() != null) { req.append(request.getApiKey()); } else { req.append(request.getApiOrgId()).append(KEY_SEPARATOR).append(request.getApiId()) .append(KEY_SEPARATOR).append(request.getApiVersion()); } req.append(KEY_SEPARATOR).append(request.getType()).append(KEY_SEPARATOR) .append(request.getDestination()); return req.toString(); } }
public class class_name { private static String buildCacheID(ApiRequest request) { StringBuilder req = new StringBuilder(); if (request.getContract() != null) { req.append(request.getApiKey()); // depends on control dependency: [if], data = [none] } else { req.append(request.getApiOrgId()).append(KEY_SEPARATOR).append(request.getApiId()) .append(KEY_SEPARATOR).append(request.getApiVersion()); // depends on control dependency: [if], data = [none] } req.append(KEY_SEPARATOR).append(request.getType()).append(KEY_SEPARATOR) .append(request.getDestination()); return req.toString(); } }
public class class_name { public void clear() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Clearing this header handler: " + this); } this.num_items = 0; this.values.clear(); this.genericValues.clear(); } }
public class class_name { public void clear() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Clearing this header handler: " + this); // depends on control dependency: [if], data = [none] } this.num_items = 0; this.values.clear(); this.genericValues.clear(); } }
public class class_name { private void setStatementParameters( ObjectNode jsonObject, Table table, PreparedStatement preparedStatement, Connection connection ) throws SQLException { // JDBC SQL statements use a one-based index for setting fields/parameters List<String> missingFieldNames = new ArrayList<>(); int index = 1; for (Field field : table.editorFields()) { if (!jsonObject.has(field.name)) { // If there is a field missing from the JSON string and it is required to write to an editor table, // throw an exception (handled after the fields iteration. In an effort to keep the database integrity // intact, every update/create operation should have all fields defined by the spec table. // FIXME: What if someone wants to make updates to non-editor feeds? In this case, the table may not // have all of the required fields, yet this would prohibit such an update. Further, an update on such // a table that DID have all of the spec table fields would fail because they might be missing from // the actual database table. missingFieldNames.add(field.name); continue; } JsonNode value = jsonObject.get(field.name); LOG.debug("{}={}", field.name, value); try { if (value == null || value.isNull()) { if (field.isRequired() && !field.isEmptyValuePermitted()) { // Only register the field as missing if the value is null, the field is required, and empty // values are not permitted. For example, a null value for fare_attributes#transfers should not // trigger a missing field exception. missingFieldNames.add(field.name); continue; } // Handle setting null value on statement field.setNull(preparedStatement, index); } else { List<String> values = new ArrayList<>(); if (value.isArray()) { for (JsonNode node : value) { values.add(node.asText()); } field.setParameter(preparedStatement, index, String.join(",", values)); } else { field.setParameter(preparedStatement, index, value.asText()); } } } catch (StorageException e) { LOG.warn("Could not set field {} to value {}. Attempting to parse integer seconds.", field.name, value); if (field.name.contains("_time")) { // FIXME: This is a hack to get arrival and departure time into the right format. Because the UI // currently returns them as seconds since midnight rather than the Field-defined format HH:MM:SS. try { if (value == null || value.isNull()) { if (field.isRequired()) { missingFieldNames.add(field.name); continue; } field.setNull(preparedStatement, index); } else { // Try to parse integer seconds value preparedStatement.setInt(index, Integer.parseInt(value.asText())); LOG.info("Parsing value {} for field {} successful!", value, field.name); } } catch (NumberFormatException ex) { // Attempt to set arrival or departure time via integer seconds failed. Rollback. connection.rollback(); LOG.error("Bad column: {}={}", field.name, value); ex.printStackTrace(); throw ex; } } else { // Rollback transaction and throw exception connection.rollback(); throw e; } } index += 1; } if (missingFieldNames.size() > 0) { // String joinedFieldNames = missingFieldNames.stream().collect(Collectors.joining(", ")); throw new SQLException( String.format( "The following field(s) are missing from JSON %s object: %s", table.name, missingFieldNames.toString() ) ); } } }
public class class_name { private void setStatementParameters( ObjectNode jsonObject, Table table, PreparedStatement preparedStatement, Connection connection ) throws SQLException { // JDBC SQL statements use a one-based index for setting fields/parameters List<String> missingFieldNames = new ArrayList<>(); int index = 1; for (Field field : table.editorFields()) { if (!jsonObject.has(field.name)) { // If there is a field missing from the JSON string and it is required to write to an editor table, // throw an exception (handled after the fields iteration. In an effort to keep the database integrity // intact, every update/create operation should have all fields defined by the spec table. // FIXME: What if someone wants to make updates to non-editor feeds? In this case, the table may not // have all of the required fields, yet this would prohibit such an update. Further, an update on such // a table that DID have all of the spec table fields would fail because they might be missing from // the actual database table. missingFieldNames.add(field.name); continue; } JsonNode value = jsonObject.get(field.name); LOG.debug("{}={}", field.name, value); try { if (value == null || value.isNull()) { if (field.isRequired() && !field.isEmptyValuePermitted()) { // Only register the field as missing if the value is null, the field is required, and empty // values are not permitted. For example, a null value for fare_attributes#transfers should not // trigger a missing field exception. missingFieldNames.add(field.name); // depends on control dependency: [if], data = [none] continue; } // Handle setting null value on statement field.setNull(preparedStatement, index); // depends on control dependency: [if], data = [none] } else { List<String> values = new ArrayList<>(); if (value.isArray()) { for (JsonNode node : value) { values.add(node.asText()); // depends on control dependency: [for], data = [node] } field.setParameter(preparedStatement, index, String.join(",", values)); // depends on control dependency: [if], data = [none] } else { field.setParameter(preparedStatement, index, value.asText()); // depends on control dependency: [if], data = [none] } } } catch (StorageException e) { LOG.warn("Could not set field {} to value {}. Attempting to parse integer seconds.", field.name, value); if (field.name.contains("_time")) { // FIXME: This is a hack to get arrival and departure time into the right format. Because the UI // currently returns them as seconds since midnight rather than the Field-defined format HH:MM:SS. try { if (value == null || value.isNull()) { if (field.isRequired()) { missingFieldNames.add(field.name); // depends on control dependency: [if], data = [none] continue; } field.setNull(preparedStatement, index); // depends on control dependency: [if], data = [none] } else { // Try to parse integer seconds value preparedStatement.setInt(index, Integer.parseInt(value.asText())); // depends on control dependency: [if], data = [(value] LOG.info("Parsing value {} for field {} successful!", value, field.name); // depends on control dependency: [if], data = [none] } } catch (NumberFormatException ex) { // Attempt to set arrival or departure time via integer seconds failed. Rollback. connection.rollback(); LOG.error("Bad column: {}={}", field.name, value); ex.printStackTrace(); throw ex; } // depends on control dependency: [catch], data = [none] } else { // Rollback transaction and throw exception connection.rollback(); // depends on control dependency: [if], data = [none] throw e; } } index += 1; } if (missingFieldNames.size() > 0) { // String joinedFieldNames = missingFieldNames.stream().collect(Collectors.joining(", ")); throw new SQLException( String.format( "The following field(s) are missing from JSON %s object: %s", table.name, missingFieldNames.toString() ) ); } } }
public class class_name { public boolean isValid(CmsRequestContext context, CmsResource resource) { if (this == ALL) { // shortcut for "ALL" filter where nothing is filtered return true; } // check for required resource state switch (m_filterState) { case EXCLUDED: if (resource.getState().equals(m_state)) { return false; } break; case REQUIRED: if (!resource.getState().equals(m_state)) { return false; } break; default: // ignored } // check for required resource state switch (m_filterFlags) { case EXCLUDED: if ((resource.getFlags() & m_flags) != 0) { return false; } break; case REQUIRED: if ((resource.getFlags() & m_flags) != m_flags) { return false; } break; default: // ignored } // check for required resource type switch (m_filterType) { case EXCLUDED: if (resource.getTypeId() == m_type) { return false; } break; case REQUIRED: if (resource.getTypeId() != m_type) { return false; } break; default: // ignored } if (m_onlyFolders != null) { if (m_onlyFolders.booleanValue()) { if (!resource.isFolder()) { // only folder resource are allowed return false; } } else { if (resource.isFolder()) { // no folder resources are allowed return false; } } } // check if the resource was last modified within the given time range if (m_filterLastModified) { if ((m_modifiedAfter > 0L) && (resource.getDateLastModified() < m_modifiedAfter)) { return false; } if ((m_modifiedBefore > 0L) && (resource.getDateLastModified() > m_modifiedBefore)) { return false; } } // check if the resource expires within the given time range if (m_filterExpire) { if ((m_expireAfter > 0L) && (resource.getDateExpired() < m_expireAfter)) { return false; } if ((m_expireBefore > 0L) && (resource.getDateExpired() > m_expireBefore)) { return false; } } // check if the resource is released within the given time range if (m_filterRelease) { if ((m_releaseAfter > 0L) && (resource.getDateReleased() < m_releaseAfter)) { return false; } if ((m_releaseBefore > 0L) && (resource.getDateReleased() > m_releaseBefore)) { return false; } } // check if the resource is currently released and not expired if (m_filterTimerange && !resource.isReleasedAndNotExpired(context.getRequestTime())) { return false; } // everything is ok, so return true return true; } }
public class class_name { public boolean isValid(CmsRequestContext context, CmsResource resource) { if (this == ALL) { // shortcut for "ALL" filter where nothing is filtered return true; // depends on control dependency: [if], data = [none] } // check for required resource state switch (m_filterState) { case EXCLUDED: if (resource.getState().equals(m_state)) { return false; // depends on control dependency: [if], data = [none] } break; case REQUIRED: if (!resource.getState().equals(m_state)) { return false; // depends on control dependency: [if], data = [none] } break; default: // ignored } // check for required resource state switch (m_filterFlags) { case EXCLUDED: if ((resource.getFlags() & m_flags) != 0) { return false; // depends on control dependency: [if], data = [none] } break; case REQUIRED: if ((resource.getFlags() & m_flags) != m_flags) { return false; // depends on control dependency: [if], data = [none] } break; default: // ignored } // check for required resource type switch (m_filterType) { case EXCLUDED: if (resource.getTypeId() == m_type) { return false; // depends on control dependency: [if], data = [none] } break; case REQUIRED: if (resource.getTypeId() != m_type) { return false; // depends on control dependency: [if], data = [none] } break; default: // ignored } if (m_onlyFolders != null) { if (m_onlyFolders.booleanValue()) { if (!resource.isFolder()) { // only folder resource are allowed return false; // depends on control dependency: [if], data = [none] } } else { if (resource.isFolder()) { // no folder resources are allowed return false; // depends on control dependency: [if], data = [none] } } } // check if the resource was last modified within the given time range if (m_filterLastModified) { if ((m_modifiedAfter > 0L) && (resource.getDateLastModified() < m_modifiedAfter)) { return false; // depends on control dependency: [if], data = [none] } if ((m_modifiedBefore > 0L) && (resource.getDateLastModified() > m_modifiedBefore)) { return false; // depends on control dependency: [if], data = [none] } } // check if the resource expires within the given time range if (m_filterExpire) { if ((m_expireAfter > 0L) && (resource.getDateExpired() < m_expireAfter)) { return false; // depends on control dependency: [if], data = [none] } if ((m_expireBefore > 0L) && (resource.getDateExpired() > m_expireBefore)) { return false; // depends on control dependency: [if], data = [none] } } // check if the resource is released within the given time range if (m_filterRelease) { if ((m_releaseAfter > 0L) && (resource.getDateReleased() < m_releaseAfter)) { return false; // depends on control dependency: [if], data = [none] } if ((m_releaseBefore > 0L) && (resource.getDateReleased() > m_releaseBefore)) { return false; // depends on control dependency: [if], data = [none] } } // check if the resource is currently released and not expired if (m_filterTimerange && !resource.isReleasedAndNotExpired(context.getRequestTime())) { return false; // depends on control dependency: [if], data = [none] } // everything is ok, so return true return true; } }
public class class_name { static BindTransform getLanguageTransform(TypeName type) { String typeName = type.toString(); if (Integer.class.getCanonicalName().equals(typeName)) { return new IntegerBindTransform(true); } if (Boolean.class.getCanonicalName().equals(typeName)) { return new BooleanBindTransform(true); } if (Long.class.getCanonicalName().equals(typeName)) { return new LongBindTransform(true); } if (Double.class.getCanonicalName().equals(typeName)) { return new DoubleBindTransform(true); } if (Float.class.getCanonicalName().equals(typeName)) { return new FloatBindTransform(true); } if (Short.class.getCanonicalName().equals(typeName)) { return new ShortBindTransform(true); } if (Byte.class.getCanonicalName().equals(typeName)) { return new ByteBindTransform(true); } if (Character.class.getCanonicalName().equals(typeName)) { return new CharacterBindTransform(true); } if (String.class.getCanonicalName().equals(typeName)) { return new StringBindTransform(); } return null; } }
public class class_name { static BindTransform getLanguageTransform(TypeName type) { String typeName = type.toString(); if (Integer.class.getCanonicalName().equals(typeName)) { return new IntegerBindTransform(true); // depends on control dependency: [if], data = [none] } if (Boolean.class.getCanonicalName().equals(typeName)) { return new BooleanBindTransform(true); // depends on control dependency: [if], data = [none] } if (Long.class.getCanonicalName().equals(typeName)) { return new LongBindTransform(true); // depends on control dependency: [if], data = [none] } if (Double.class.getCanonicalName().equals(typeName)) { return new DoubleBindTransform(true); // depends on control dependency: [if], data = [none] } if (Float.class.getCanonicalName().equals(typeName)) { return new FloatBindTransform(true); // depends on control dependency: [if], data = [none] } if (Short.class.getCanonicalName().equals(typeName)) { return new ShortBindTransform(true); // depends on control dependency: [if], data = [none] } if (Byte.class.getCanonicalName().equals(typeName)) { return new ByteBindTransform(true); // depends on control dependency: [if], data = [none] } if (Character.class.getCanonicalName().equals(typeName)) { return new CharacterBindTransform(true); // depends on control dependency: [if], data = [none] } if (String.class.getCanonicalName().equals(typeName)) { return new StringBindTransform(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected void setScrollPosition(final int pos) { getList().setVerticalScrollPosition(pos); Scheduler.get().scheduleDeferred(new ScheduledCommand() { /** * @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute() */ public void execute() { if (getList().getVerticalScrollPosition() != pos) { getList().setVerticalScrollPosition(pos); } } }); } }
public class class_name { protected void setScrollPosition(final int pos) { getList().setVerticalScrollPosition(pos); Scheduler.get().scheduleDeferred(new ScheduledCommand() { /** * @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute() */ public void execute() { if (getList().getVerticalScrollPosition() != pos) { getList().setVerticalScrollPosition(pos); // depends on control dependency: [if], data = [pos)] } } }); } }
public class class_name { byte type() { if( _naCnt == -1 ) { // No rollups yet? int nas=0, es=0, nzs=0, ss=0; if( _ds != null && _ms != null ) { // UUID? for(int i = 0; i< _sparseLen; i++ ) if( _xs != null && _xs.get(i)==Integer.MIN_VALUE ) nas++; else if( _ds[i] !=0 || _ms.get(i) != 0 ) nzs++; _uuidCnt = _len -nas; } else if( _ds != null ) { // Doubles? assert _xs==null; for(int i = 0; i < _sparseLen; ++i) { if( Double.isNaN(_ds[i]) ) nas++; else if( _ds[i]!=0 ) nzs++; } } else { if( _ms != null && _sparseLen > 0) // Longs and categoricals? for(int i = 0; i< _sparseLen; i++ ) if( isNA2(i) ) nas++; else { if( isCategorical2(i) ) es++; if( _ms.get(i) != 0 ) nzs++; } if( _is != null ) // Strings for(int i = 0; i< _sparseLen; i++ ) if( isNA2(i) ) nas++; else ss++; } if (_sparseNA) nas += (_len - _sparseLen); _nzCnt=nzs; _catCnt =es; _naCnt=nas; _strCnt = ss; } // Now run heuristic for type if(_naCnt == _len) // All NAs ==> NA Chunk return Vec.T_BAD; if(_strCnt > 0) return Vec.T_STR; if(_catCnt > 0 && _catCnt + _naCnt + (isSparseZero()? _len-_sparseLen : 0) == _len) return Vec.T_CAT; // All are Strings+NAs ==> Categorical Chunk // UUIDs? if( _uuidCnt > 0 ) return Vec.T_UUID; // Larger of time & numbers int nums = _len -_naCnt-_timCnt; return _timCnt >= nums ? Vec.T_TIME : Vec.T_NUM; } }
public class class_name { byte type() { if( _naCnt == -1 ) { // No rollups yet? int nas=0, es=0, nzs=0, ss=0; if( _ds != null && _ms != null ) { // UUID? for(int i = 0; i< _sparseLen; i++ ) if( _xs != null && _xs.get(i)==Integer.MIN_VALUE ) nas++; else if( _ds[i] !=0 || _ms.get(i) != 0 ) nzs++; _uuidCnt = _len -nas; // depends on control dependency: [if], data = [none] } else if( _ds != null ) { // Doubles? assert _xs==null; for(int i = 0; i < _sparseLen; ++i) { if( Double.isNaN(_ds[i]) ) nas++; else if( _ds[i]!=0 ) nzs++; } } else { if( _ms != null && _sparseLen > 0) // Longs and categoricals? for(int i = 0; i< _sparseLen; i++ ) if( isNA2(i) ) nas++; else { if( isCategorical2(i) ) es++; if( _ms.get(i) != 0 ) nzs++; } if( _is != null ) // Strings for(int i = 0; i< _sparseLen; i++ ) if( isNA2(i) ) nas++; else ss++; } if (_sparseNA) nas += (_len - _sparseLen); _nzCnt=nzs; _catCnt =es; _naCnt=nas; _strCnt = ss; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } // Now run heuristic for type if(_naCnt == _len) // All NAs ==> NA Chunk return Vec.T_BAD; if(_strCnt > 0) return Vec.T_STR; if(_catCnt > 0 && _catCnt + _naCnt + (isSparseZero()? _len-_sparseLen : 0) == _len) return Vec.T_CAT; // All are Strings+NAs ==> Categorical Chunk // UUIDs? if( _uuidCnt > 0 ) return Vec.T_UUID; // Larger of time & numbers int nums = _len -_naCnt-_timCnt; return _timCnt >= nums ? Vec.T_TIME : Vec.T_NUM; } }
public class class_name { public final void deepCopyArrayAtOffset(Object source, Object copy, Class<?> fieldClass, long offset, IdentityHashMap<Object, Object> referencesToReuse) { Object origFieldValue = THE_UNSAFE.getObject(source, offset); if (origFieldValue == null) { putNullObject(copy, offset); } else { final Object copyFieldValue = deepCopyArray(origFieldValue, referencesToReuse); UnsafeOperations.THE_UNSAFE.putObject(copy, offset, copyFieldValue); } } }
public class class_name { public final void deepCopyArrayAtOffset(Object source, Object copy, Class<?> fieldClass, long offset, IdentityHashMap<Object, Object> referencesToReuse) { Object origFieldValue = THE_UNSAFE.getObject(source, offset); if (origFieldValue == null) { putNullObject(copy, offset); // depends on control dependency: [if], data = [none] } else { final Object copyFieldValue = deepCopyArray(origFieldValue, referencesToReuse); UnsafeOperations.THE_UNSAFE.putObject(copy, offset, copyFieldValue); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String getProperty(String name) { try { return System.getProperty(name); } catch (AccessControlException ex) { if (log.isDebugEnabled()) { log.debug(String.format( "Caught AccessControlException when accessing system property [%s]; " + "its value will be returned [null]. Reason: %s", name, ex.getMessage())); } } return null; } }
public class class_name { public static String getProperty(String name) { try { return System.getProperty(name); // depends on control dependency: [try], data = [none] } catch (AccessControlException ex) { if (log.isDebugEnabled()) { log.debug(String.format( "Caught AccessControlException when accessing system property [%s]; " + "its value will be returned [null]. Reason: %s", name, ex.getMessage())); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { @SuppressWarnings("unused") private void setDraggingToRow(int row, boolean isDragging) { Collection<ViewHolder> holders = mViewHolders.getRowItems(row); for (ViewHolder holder : holders) { holder.setIsDragging(isDragging); } ViewHolder holder = mHeaderRowViewHolders.get(row); if (holder != null) { holder.setIsDragging(isDragging); } } }
public class class_name { @SuppressWarnings("unused") private void setDraggingToRow(int row, boolean isDragging) { Collection<ViewHolder> holders = mViewHolders.getRowItems(row); for (ViewHolder holder : holders) { holder.setIsDragging(isDragging); // depends on control dependency: [for], data = [holder] } ViewHolder holder = mHeaderRowViewHolders.get(row); if (holder != null) { holder.setIsDragging(isDragging); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void binding(String varName, Object o, boolean dynamic) { ctx.set(varName, o, dynamic); // ctx.globalVar.put(varName, o); if (dynamic) { ctx.objectKeys.add(varName); } } }
public class class_name { public void binding(String varName, Object o, boolean dynamic) { ctx.set(varName, o, dynamic); // ctx.globalVar.put(varName, o); if (dynamic) { ctx.objectKeys.add(varName); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String md5(String data) { try { return DigestUtils.md5Hex(data.toString().getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { return DigestUtils.md5Hex(data.toString()); } } }
public class class_name { public static String md5(String data) { try { return DigestUtils.md5Hex(data.toString().getBytes("UTF-8")); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { return DigestUtils.md5Hex(data.toString()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static int maximumDistance(List<Point2D_I32> contour , int indexA , int indexB ) { Point2D_I32 a = contour.get(indexA); Point2D_I32 b = contour.get(indexB); int best = -1; double bestDistance = -Double.MAX_VALUE; for (int i = 0; i < contour.size(); i++) { Point2D_I32 c = contour.get(i); // can't sum sq distance because some skinny shapes it maximizes one and not the other // double d = Math.sqrt(distanceSq(a,c)) + Math.sqrt(distanceSq(b,c)); double d = distanceAbs(a,c) + distanceAbs(b,c); if( d > bestDistance ) { bestDistance = d; best = i; } } return best; } }
public class class_name { static int maximumDistance(List<Point2D_I32> contour , int indexA , int indexB ) { Point2D_I32 a = contour.get(indexA); Point2D_I32 b = contour.get(indexB); int best = -1; double bestDistance = -Double.MAX_VALUE; for (int i = 0; i < contour.size(); i++) { Point2D_I32 c = contour.get(i); // can't sum sq distance because some skinny shapes it maximizes one and not the other // double d = Math.sqrt(distanceSq(a,c)) + Math.sqrt(distanceSq(b,c)); double d = distanceAbs(a,c) + distanceAbs(b,c); if( d > bestDistance ) { bestDistance = d; // depends on control dependency: [if], data = [none] best = i; // depends on control dependency: [if], data = [none] } } return best; } }
public class class_name { void setDayOfMonth(String day) { final int i = CmsSerialDateUtil.toIntWithDefault(day, -1); if (m_model.getDayOfMonth() != i) { removeExceptionsOnChange(new Command() { public void execute() { m_model.setDayOfMonth(i); onValueChange(); } }); } } }
public class class_name { void setDayOfMonth(String day) { final int i = CmsSerialDateUtil.toIntWithDefault(day, -1); if (m_model.getDayOfMonth() != i) { removeExceptionsOnChange(new Command() { public void execute() { m_model.setDayOfMonth(i); onValueChange(); } }); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addItemToActivationGroup(final AgendaItem item) { if ( item.isRuleAgendaItem() ) { throw new UnsupportedOperationException("defensive programming, making sure this isn't called, before removing"); } String group = item.getRule().getActivationGroup(); if ( group != null && group.length() > 0 ) { InternalActivationGroup actgroup = getActivationGroup( group ); // Don't allow lazy activations to activate, from before it's last trigger point if ( actgroup.getTriggeredForRecency() != 0 && actgroup.getTriggeredForRecency() >= item.getPropagationContext().getFactHandle().getRecency() ) { return; } actgroup.addActivation( item ); } } }
public class class_name { public void addItemToActivationGroup(final AgendaItem item) { if ( item.isRuleAgendaItem() ) { throw new UnsupportedOperationException("defensive programming, making sure this isn't called, before removing"); } String group = item.getRule().getActivationGroup(); if ( group != null && group.length() > 0 ) { InternalActivationGroup actgroup = getActivationGroup( group ); // Don't allow lazy activations to activate, from before it's last trigger point if ( actgroup.getTriggeredForRecency() != 0 && actgroup.getTriggeredForRecency() >= item.getPropagationContext().getFactHandle().getRecency() ) { return; // depends on control dependency: [if], data = [none] } actgroup.addActivation( item ); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setPredicate(RuleElement newPredicate) { if (newPredicate != predicate) { NotificationChain msgs = null; if (predicate != null) msgs = ((InternalEObject)predicate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimpleAntlrPackage.PREDICATED__PREDICATE, null, msgs); if (newPredicate != null) msgs = ((InternalEObject)newPredicate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimpleAntlrPackage.PREDICATED__PREDICATE, null, msgs); msgs = basicSetPredicate(newPredicate, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SimpleAntlrPackage.PREDICATED__PREDICATE, newPredicate, newPredicate)); } }
public class class_name { public void setPredicate(RuleElement newPredicate) { if (newPredicate != predicate) { NotificationChain msgs = null; if (predicate != null) msgs = ((InternalEObject)predicate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimpleAntlrPackage.PREDICATED__PREDICATE, null, msgs); if (newPredicate != null) msgs = ((InternalEObject)newPredicate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimpleAntlrPackage.PREDICATED__PREDICATE, null, msgs); msgs = basicSetPredicate(newPredicate, msgs); // depends on control dependency: [if], data = [(newPredicate] if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SimpleAntlrPackage.PREDICATED__PREDICATE, newPredicate, newPredicate)); } }
public class class_name { public PrimaryBackupSession getOrCreateSession(long sessionId, MemberId memberId) { PrimaryBackupSession session = sessions.get(sessionId); if (session == null) { session = createSession(sessionId, memberId); } return session; } }
public class class_name { public PrimaryBackupSession getOrCreateSession(long sessionId, MemberId memberId) { PrimaryBackupSession session = sessions.get(sessionId); if (session == null) { session = createSession(sessionId, memberId); // depends on control dependency: [if], data = [(session] } return session; } }
public class class_name { @Override public String getSchema(FileSystem fs, Path path) { String schema = null; try { Reader orcReader = OrcFile.createReader(fs, path); schema = orcReader.getObjectInspector().getTypeName(); } catch (IOException e) { logger .warn("Cannot get schema for file: " + path.toUri().getPath()); return null; } return schema; } }
public class class_name { @Override public String getSchema(FileSystem fs, Path path) { String schema = null; try { Reader orcReader = OrcFile.createReader(fs, path); schema = orcReader.getObjectInspector().getTypeName(); // depends on control dependency: [try], data = [none] } catch (IOException e) { logger .warn("Cannot get schema for file: " + path.toUri().getPath()); return null; } // depends on control dependency: [catch], data = [none] return schema; } }
public class class_name { public ListAssociationsResult withAssociations(Association... associations) { if (this.associations == null) { setAssociations(new com.amazonaws.internal.SdkInternalList<Association>(associations.length)); } for (Association ele : associations) { this.associations.add(ele); } return this; } }
public class class_name { public ListAssociationsResult withAssociations(Association... associations) { if (this.associations == null) { setAssociations(new com.amazonaws.internal.SdkInternalList<Association>(associations.length)); // depends on control dependency: [if], data = [none] } for (Association ele : associations) { this.associations.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static CreateFollowRequest checkRequest( final FormItemList formItemList, final CreateRequest createRequest, final CreateFollowResponse createFollowResponse) { final Node user = checkUserIdentifier(formItemList, createFollowResponse); if (user != null) { final Node followed = checkFollowedIdentifier(formItemList, createFollowResponse); if (followed != null) { return new CreateFollowRequest(createRequest.getType(), user, followed); } } return null; } }
public class class_name { public static CreateFollowRequest checkRequest( final FormItemList formItemList, final CreateRequest createRequest, final CreateFollowResponse createFollowResponse) { final Node user = checkUserIdentifier(formItemList, createFollowResponse); if (user != null) { final Node followed = checkFollowedIdentifier(formItemList, createFollowResponse); if (followed != null) { return new CreateFollowRequest(createRequest.getType(), user, followed); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @Override public MatchType match(int level, Node node) { if(! (node instanceof Element)) { return MatchType.NOT_A_MATCH; } Element element = (Element) node; if(this.level != level) { return MatchType.NOT_A_MATCH; } else if(element.getName().equals(elementName) && element.hasAttribute(attributeName) && element.attributeValue(attributeName).equals(attributeValue)) { return MatchType.NODE_MATCH; } return MatchType.NOT_A_MATCH; } }
public class class_name { @Override public MatchType match(int level, Node node) { if(! (node instanceof Element)) { return MatchType.NOT_A_MATCH; // depends on control dependency: [if], data = [none] } Element element = (Element) node; if(this.level != level) { return MatchType.NOT_A_MATCH; // depends on control dependency: [if], data = [none] } else if(element.getName().equals(elementName) && element.hasAttribute(attributeName) && element.attributeValue(attributeName).equals(attributeValue)) { return MatchType.NODE_MATCH; // depends on control dependency: [if], data = [none] } return MatchType.NOT_A_MATCH; } }
public class class_name { public Device registerDeviceForPush(UUID deviceId, String notifier, String token, Map<String, Object> properties) { if (properties == null) { properties = new HashMap<String, Object>(); } String notifierKey = notifier + ".notifier.id"; properties.put(notifierKey, token); return registerDevice(deviceId, properties); } }
public class class_name { public Device registerDeviceForPush(UUID deviceId, String notifier, String token, Map<String, Object> properties) { if (properties == null) { properties = new HashMap<String, Object>(); // depends on control dependency: [if], data = [none] } String notifierKey = notifier + ".notifier.id"; properties.put(notifierKey, token); return registerDevice(deviceId, properties); } }
public class class_name { public void popListener(Class<? extends ChainingListener> listenerClass) { if (StackableChainingListener.class.isAssignableFrom(listenerClass)) { this.listeners.get(listenerClass).pop(); } } }
public class class_name { public void popListener(Class<? extends ChainingListener> listenerClass) { if (StackableChainingListener.class.isAssignableFrom(listenerClass)) { this.listeners.get(listenerClass).pop(); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void queueSendToWebsocketNB(String msg) { if (this.sendProcess.getPendingStepCount() < MAX_MSG_BACKLOG) { MySendStep sendStep = new MySendStep(msg); this.sendProcess.addStep(sendStep); } else { log.info("websocket backlog is full; aborting connection: sessionId={}", this.socketSessionId); this.safeClose(); } } }
public class class_name { protected void queueSendToWebsocketNB(String msg) { if (this.sendProcess.getPendingStepCount() < MAX_MSG_BACKLOG) { MySendStep sendStep = new MySendStep(msg); this.sendProcess.addStep(sendStep); // depends on control dependency: [if], data = [none] } else { log.info("websocket backlog is full; aborting connection: sessionId={}", this.socketSessionId); // depends on control dependency: [if], data = [none] this.safeClose(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void forSpecialValue(Map<String, Object> conditionMap) { conditionMap.keySet().forEach(key -> { Object value = conditionMap.get(key); if (value instanceof String) { conditionMap.put(key, "'".concat(value.toString()).concat("'")); } if (value instanceof Date) { String dateString = DateConverterFactory.getDateConverter().toStandardString((Date) value); conditionMap.put(key, "'".concat(dateString).concat("'")); } if (value instanceof Calendar) { String dateString = DateConverterFactory.getDateConverter().toStandardString((Calendar) value); conditionMap.put(key, "'".concat(dateString).concat("'")); } if (value instanceof Number) { conditionMap.put(key, value.toString()); } }); } }
public class class_name { private static void forSpecialValue(Map<String, Object> conditionMap) { conditionMap.keySet().forEach(key -> { Object value = conditionMap.get(key); if (value instanceof String) { conditionMap.put(key, "'".concat(value.toString()).concat("'")); // depends on control dependency: [if], data = [none] } if (value instanceof Date) { String dateString = DateConverterFactory.getDateConverter().toStandardString((Date) value); conditionMap.put(key, "'".concat(dateString).concat("'")); // depends on control dependency: [if], data = [none] } if (value instanceof Calendar) { String dateString = DateConverterFactory.getDateConverter().toStandardString((Calendar) value); conditionMap.put(key, "'".concat(dateString).concat("'")); // depends on control dependency: [if], data = [none] } if (value instanceof Number) { conditionMap.put(key, value.toString()); // depends on control dependency: [if], data = [none] } }); } }
public class class_name { void appendSubRules( String[] parentSelector, CssFormatter formatter ) { try { if( important ) { formatter.incImportant(); } for( MixinMatch match : getRules( formatter ) ) { Rule rule = match.getRule(); formatter.addMixin( rule, match.getMixinParameters(), rule.getVariables() ); rule.appendMixinsTo( parentSelector, formatter ); for( Rule subMixin : rule.getSubrules() ) { if( !subMixin.isMixin() && (parentSelector == null || !subMixin.isInlineRule( formatter ) ) ) { subMixin.appendTo( parentSelector, formatter ); } } formatter.removeMixin(); } } catch( LessException ex ) { ex.addPosition( filename, line, column ); throw ex; } finally { if( important ) { formatter.decImportant(); } } } }
public class class_name { void appendSubRules( String[] parentSelector, CssFormatter formatter ) { try { if( important ) { formatter.incImportant(); // depends on control dependency: [if], data = [none] } for( MixinMatch match : getRules( formatter ) ) { Rule rule = match.getRule(); formatter.addMixin( rule, match.getMixinParameters(), rule.getVariables() ); // depends on control dependency: [for], data = [match] rule.appendMixinsTo( parentSelector, formatter ); // depends on control dependency: [for], data = [none] for( Rule subMixin : rule.getSubrules() ) { if( !subMixin.isMixin() && (parentSelector == null || !subMixin.isInlineRule( formatter ) ) ) { subMixin.appendTo( parentSelector, formatter ); // depends on control dependency: [if], data = [none] } } formatter.removeMixin(); // depends on control dependency: [for], data = [none] } } catch( LessException ex ) { ex.addPosition( filename, line, column ); throw ex; } finally { // depends on control dependency: [catch], data = [none] if( important ) { formatter.decImportant(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public EClass getIfcNullStyle() { if (ifcNullStyleEClass == null) { ifcNullStyleEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(1114); } return ifcNullStyleEClass; } }
public class class_name { @Override public EClass getIfcNullStyle() { if (ifcNullStyleEClass == null) { ifcNullStyleEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(1114); // depends on control dependency: [if], data = [none] } return ifcNullStyleEClass; } }
public class class_name { public String getObject() { if (triple.getObject() instanceof Literal) { return ((Literal) triple.getObject()).getLexicalForm(); } else if (triple.getObject() instanceof IRI) { return ((IRI) triple.getObject()).getIRIString(); } return triple.getObject().ntriplesString(); } }
public class class_name { public String getObject() { if (triple.getObject() instanceof Literal) { return ((Literal) triple.getObject()).getLexicalForm(); // depends on control dependency: [if], data = [none] } else if (triple.getObject() instanceof IRI) { return ((IRI) triple.getObject()).getIRIString(); // depends on control dependency: [if], data = [none] } return triple.getObject().ntriplesString(); } }
public class class_name { public static void rcvResetBrowse(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvResetBrowse", new Object[] { request, conversation, ""+requestNumber, ""+allocatedFromBufferPool }); // Strip information from reset request. short connectionObjectId = request.getShort(); // Connection Id short browserSessionId = request.getShort(); // Id of browser session. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "rcvResetBrowse> connectionObjectId = "+connectionObjectId+ "\nrcvResetBrowse> browserSessionId = "+browserSessionId); BrowserSession browserSession = null; ConversationState convState = null; try { // Locate browser session from conversation state. convState = (ConversationState)conversation.getAttachment(); CATMainConsumer mainConsumer = (CATMainConsumer)convState.getObject(browserSessionId); browserSession = mainConsumer.getBrowserSession(); if (browserSession == null) { // The browser session from the main consumer should not be null here SIErrorException e = new SIErrorException( nls.getFormattedMessage("BROWSER_SESSION_NULL_SICO20", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".rcvResetBrowse", CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_04); throw e; } } catch(NullPointerException npe) { FFDCFilter.processException(npe, CLASS_NAME + ".rcvResetBrowse", CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_01); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Browser session was null!", npe); // This is an internal error, so inform the client StaticCATHelper.sendExceptionToClient(npe, CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_01, // d186970 conversation, requestNumber); } if (browserSession != null) { try { browserSession.reset(); } catch (SIException e) { //No FFDC code needed //Only FFDC if we haven't received a meTerminated event. if(!convState.hasMETerminated()) { FFDCFilter.processException(e, CLASS_NAME + ".rcvResetBrowse", CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_02); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); // Send error to client. StaticCATHelper.sendExceptionToClient(e, CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_02, // d186970 conversation, requestNumber); } } // Send response. CommsByteBuffer reply = poolManager.allocate(); try { conversation.send(reply, JFapChannelConstants.SEG_RESET_BROWSE_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvResetBrowse", CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_03); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2020", e); // Can't really do much as a communications exception implies that // we have lost contact with the client anyway. } request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvResetBrowse"); } }
public class class_name { public static void rcvResetBrowse(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvResetBrowse", new Object[] { request, conversation, ""+requestNumber, ""+allocatedFromBufferPool }); // Strip information from reset request. short connectionObjectId = request.getShort(); // Connection Id short browserSessionId = request.getShort(); // Id of browser session. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "rcvResetBrowse> connectionObjectId = "+connectionObjectId+ "\nrcvResetBrowse> browserSessionId = "+browserSessionId); BrowserSession browserSession = null; ConversationState convState = null; try { // Locate browser session from conversation state. convState = (ConversationState)conversation.getAttachment(); // depends on control dependency: [try], data = [none] CATMainConsumer mainConsumer = (CATMainConsumer)convState.getObject(browserSessionId); browserSession = mainConsumer.getBrowserSession(); // depends on control dependency: [try], data = [none] if (browserSession == null) { // The browser session from the main consumer should not be null here SIErrorException e = new SIErrorException( nls.getFormattedMessage("BROWSER_SESSION_NULL_SICO20", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".rcvResetBrowse", CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_04); // depends on control dependency: [if], data = [none] throw e; } } catch(NullPointerException npe) { FFDCFilter.processException(npe, CLASS_NAME + ".rcvResetBrowse", CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_01); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Browser session was null!", npe); // This is an internal error, so inform the client StaticCATHelper.sendExceptionToClient(npe, CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_01, // d186970 conversation, requestNumber); } // depends on control dependency: [catch], data = [none] if (browserSession != null) { try { browserSession.reset(); // depends on control dependency: [try], data = [none] } catch (SIException e) { //No FFDC code needed //Only FFDC if we haven't received a meTerminated event. if(!convState.hasMETerminated()) { FFDCFilter.processException(e, CLASS_NAME + ".rcvResetBrowse", CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_02); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); // Send error to client. StaticCATHelper.sendExceptionToClient(e, CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_02, // d186970 conversation, requestNumber); } // depends on control dependency: [catch], data = [none] } // Send response. CommsByteBuffer reply = poolManager.allocate(); try { conversation.send(reply, JFapChannelConstants.SEG_RESET_BROWSE_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); // depends on control dependency: [try], data = [none] } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvResetBrowse", CommsConstants.STATICCATBROWSER_RCVRESETBROWSERSESS_03); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2020", e); // Can't really do much as a communications exception implies that // we have lost contact with the client anyway. } // depends on control dependency: [catch], data = [none] request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvResetBrowse"); } }
public class class_name { public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { if (mv != null) { return mv.visitAnnotation(descriptor, visible); } return null; } }
public class class_name { public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { if (mv != null) { return mv.visitAnnotation(descriptor, visible); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static Character toCharacterObject(String str) { if (StringUtils.isEmpty(str)) { return null; } return toCharacterObject(str.charAt(0)); } }
public class class_name { public static Character toCharacterObject(String str) { if (StringUtils.isEmpty(str)) { return null; // depends on control dependency: [if], data = [none] } return toCharacterObject(str.charAt(0)); } }
public class class_name { private int getHydrogenCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int hcounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("H")) { hcounter += 1; } } return hcounter; } }
public class class_name { private int getHydrogenCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int hcounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("H")) { hcounter += 1; // depends on control dependency: [if], data = [none] } } return hcounter; } }
public class class_name { public static List<CPDefinitionOptionRel> toModels( CPDefinitionOptionRelSoap[] soapModels) { if (soapModels == null) { return null; } List<CPDefinitionOptionRel> models = new ArrayList<CPDefinitionOptionRel>(soapModels.length); for (CPDefinitionOptionRelSoap soapModel : soapModels) { models.add(toModel(soapModel)); } return models; } }
public class class_name { public static List<CPDefinitionOptionRel> toModels( CPDefinitionOptionRelSoap[] soapModels) { if (soapModels == null) { return null; // depends on control dependency: [if], data = [none] } List<CPDefinitionOptionRel> models = new ArrayList<CPDefinitionOptionRel>(soapModels.length); for (CPDefinitionOptionRelSoap soapModel : soapModels) { models.add(toModel(soapModel)); // depends on control dependency: [for], data = [soapModel] } return models; } }
public class class_name { public static List<TaskEntity> getTaskEntities(TopologyInfo topologyInfo) { Map<Integer, TaskEntity> tasks = new HashMap<>(); for (TaskSummary ts : topologyInfo.get_tasks()) { tasks.put(ts.get_taskId(), new TaskEntity(ts)); } for (ComponentSummary cs : topologyInfo.get_components()) { String compName = cs.get_name(); String type = cs.get_type(); for (int id : cs.get_taskIds()) { if (tasks.containsKey(id)) { tasks.get(id).setComponent(compName); tasks.get(id).setType(type); } else { LOG.debug("missing task id:{}", id); } } } return new ArrayList<>(tasks.values()); } }
public class class_name { public static List<TaskEntity> getTaskEntities(TopologyInfo topologyInfo) { Map<Integer, TaskEntity> tasks = new HashMap<>(); for (TaskSummary ts : topologyInfo.get_tasks()) { tasks.put(ts.get_taskId(), new TaskEntity(ts)); // depends on control dependency: [for], data = [ts] } for (ComponentSummary cs : topologyInfo.get_components()) { String compName = cs.get_name(); String type = cs.get_type(); for (int id : cs.get_taskIds()) { if (tasks.containsKey(id)) { tasks.get(id).setComponent(compName); // depends on control dependency: [if], data = [none] tasks.get(id).setType(type); // depends on control dependency: [if], data = [none] } else { LOG.debug("missing task id:{}", id); // depends on control dependency: [if], data = [none] } } } return new ArrayList<>(tasks.values()); } }
public class class_name { public static Sprite circle(int diameter, int color, int lineWidth) { int[] pix = new int[diameter * diameter]; for (int i = 0; i < lineWidth; i++) { drawCircle(pix, diameter - i, diameter, color); } return new Sprite(diameter, diameter, pix); } }
public class class_name { public static Sprite circle(int diameter, int color, int lineWidth) { int[] pix = new int[diameter * diameter]; for (int i = 0; i < lineWidth; i++) { drawCircle(pix, diameter - i, diameter, color); // depends on control dependency: [for], data = [i] } return new Sprite(diameter, diameter, pix); } }
public class class_name { public final void addClass(final SgClass clasz) { if (clasz == null) { throw new IllegalArgumentException("The argument 'clasz' cannot be null!"); } if (!classes.contains(clasz)) { classes.add(clasz); } } }
public class class_name { public final void addClass(final SgClass clasz) { if (clasz == null) { throw new IllegalArgumentException("The argument 'clasz' cannot be null!"); } if (!classes.contains(clasz)) { classes.add(clasz); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void computeComparableValue() { recomputeComparableSortValue = false; try { int type = getCompareValueType(); switch (type) { case 0: comparableSortValue = getCompareValue0(); break; case 1: comparableSortValue = getCompareValue1(); break; case 2: comparableSortValue = getCompareValue2(); break; default: comparableSortValue = null; break; } } catch (IOException e) { log.debug(e); comparableSortValue = null; } } }
public class class_name { private void computeComparableValue() { recomputeComparableSortValue = false; try { int type = getCompareValueType(); switch (type) { case 0: comparableSortValue = getCompareValue0(); break; case 1: comparableSortValue = getCompareValue1(); break; case 2: comparableSortValue = getCompareValue2(); break; default: comparableSortValue = null; break; } } catch (IOException e) { log.debug(e); comparableSortValue = null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static KeySnapshot localSnapshot(boolean homeOnly){ Object [] kvs = H2O.STORE.raw_array(); ArrayList<KeyInfo> res = new ArrayList<>(); for(int i = 2; i < kvs.length; i+= 2){ Object ok = kvs[i]; if( !(ok instanceof Key ) ) continue; // Ignore tombstones and Primes and null's Key key = (Key )ok; if(!key.user_allowed())continue; if(homeOnly && !key.home())continue; // Raw array can contain regular and also wrapped values into Prime marker class: // - if we see Value object, create instance of KeyInfo // - if we do not see Value object directly (it can be wrapped in Prime marker class), // try to unwrap it via calling STORE.get (~H2O.get) and then // look at wrapped value again. Value val = Value.STORE_get(key); if( val == null ) continue; res.add(new KeyInfo(key,val)); } final KeyInfo [] arr = res.toArray(new KeyInfo[res.size()]); Arrays.sort(arr); return new KeySnapshot(arr); } }
public class class_name { public static KeySnapshot localSnapshot(boolean homeOnly){ Object [] kvs = H2O.STORE.raw_array(); ArrayList<KeyInfo> res = new ArrayList<>(); for(int i = 2; i < kvs.length; i+= 2){ Object ok = kvs[i]; if( !(ok instanceof Key ) ) continue; // Ignore tombstones and Primes and null's Key key = (Key )ok; if(!key.user_allowed())continue; if(homeOnly && !key.home())continue; // Raw array can contain regular and also wrapped values into Prime marker class: // - if we see Value object, create instance of KeyInfo // - if we do not see Value object directly (it can be wrapped in Prime marker class), // try to unwrap it via calling STORE.get (~H2O.get) and then // look at wrapped value again. Value val = Value.STORE_get(key); if( val == null ) continue; res.add(new KeyInfo(key,val)); // depends on control dependency: [for], data = [none] } final KeyInfo [] arr = res.toArray(new KeyInfo[res.size()]); Arrays.sort(arr); return new KeySnapshot(arr); } }
public class class_name { public TreeSet<HtmlParameter> getFormParams() { final String contentType = mReqHeader.getHeader(HttpRequestHeader.CONTENT_TYPE); if (contentType == null || !StringUtils.startsWithIgnoreCase(contentType.trim(), HttpHeader.FORM_URLENCODED_CONTENT_TYPE)) { return new TreeSet<>(); } return this.getParamsSet(HtmlParameter.Type.form); } }
public class class_name { public TreeSet<HtmlParameter> getFormParams() { final String contentType = mReqHeader.getHeader(HttpRequestHeader.CONTENT_TYPE); if (contentType == null || !StringUtils.startsWithIgnoreCase(contentType.trim(), HttpHeader.FORM_URLENCODED_CONTENT_TYPE)) { return new TreeSet<>(); // depends on control dependency: [if], data = [none] } return this.getParamsSet(HtmlParameter.Type.form); } }
public class class_name { public Revision oldestRevision(Modifications modifications) { if (modifications.size() > 1) { LOGGER.warn("Dependency material {} has multiple modifications", this.getDisplayName()); } Modification oldestModification = modifications.get(modifications.size() - 1); String revision = oldestModification.getRevision(); return DependencyMaterialRevision.create(revision, oldestModification.getPipelineLabel()); } }
public class class_name { public Revision oldestRevision(Modifications modifications) { if (modifications.size() > 1) { LOGGER.warn("Dependency material {} has multiple modifications", this.getDisplayName()); // depends on control dependency: [if], data = [none] } Modification oldestModification = modifications.get(modifications.size() - 1); String revision = oldestModification.getRevision(); return DependencyMaterialRevision.create(revision, oldestModification.getPipelineLabel()); } }
public class class_name { private void addSecureMethod(RegisteredMethod method, List<ConfigAttribute> attr) { Assert.notNull(method, "RegisteredMethod required"); Assert.notNull(attr, "Configuration attribute required"); if (logger.isInfoEnabled()) { logger.info("Adding secure method [" + method + "] with attributes [" + attr + "]"); } this.methodMap.put(method, attr); } }
public class class_name { private void addSecureMethod(RegisteredMethod method, List<ConfigAttribute> attr) { Assert.notNull(method, "RegisteredMethod required"); Assert.notNull(attr, "Configuration attribute required"); if (logger.isInfoEnabled()) { logger.info("Adding secure method [" + method + "] with attributes [" + attr + "]"); // depends on control dependency: [if], data = [none] } this.methodMap.put(method, attr); } }
public class class_name { private ColumnInfo getColumn(TableInfo tableInfo, Attribute column, PropertyIndex indexedColumn, String[] orderByColumns) { ColumnInfo columnInfo = new ColumnInfo(); if (column.getJavaType().isAnnotationPresent(OrderBy.class)) { OrderBy order = (OrderBy) column.getJavaType().getAnnotation(OrderBy.class); orderByColumns = order.value().split("\\s*,\\s*"); } columnInfo.setOrderBy(getOrderByColumn(orderByColumns, column)); if (column.getJavaType().isEnum()) { columnInfo.setType(String.class); } else { columnInfo.setType(column.getJavaType()); } columnInfo.setColumnName(((AbstractAttribute) column).getJPAColumnName()); if (indexedColumn != null && indexedColumn.getName() != null) { columnInfo.setIndexable(true); IndexInfo indexInfo = new IndexInfo(((AbstractAttribute) column).getJPAColumnName(), indexedColumn.getMax(), indexedColumn.getMin(), indexedColumn.getIndexType(), indexedColumn.getName()); tableInfo.addToIndexedColumnList(indexInfo); // Add more if required } return columnInfo; } }
public class class_name { private ColumnInfo getColumn(TableInfo tableInfo, Attribute column, PropertyIndex indexedColumn, String[] orderByColumns) { ColumnInfo columnInfo = new ColumnInfo(); if (column.getJavaType().isAnnotationPresent(OrderBy.class)) { OrderBy order = (OrderBy) column.getJavaType().getAnnotation(OrderBy.class); orderByColumns = order.value().split("\\s*,\\s*"); // depends on control dependency: [if], data = [none] } columnInfo.setOrderBy(getOrderByColumn(orderByColumns, column)); if (column.getJavaType().isEnum()) { columnInfo.setType(String.class); // depends on control dependency: [if], data = [none] } else { columnInfo.setType(column.getJavaType()); // depends on control dependency: [if], data = [none] } columnInfo.setColumnName(((AbstractAttribute) column).getJPAColumnName()); if (indexedColumn != null && indexedColumn.getName() != null) { columnInfo.setIndexable(true); // depends on control dependency: [if], data = [none] IndexInfo indexInfo = new IndexInfo(((AbstractAttribute) column).getJPAColumnName(), indexedColumn.getMax(), indexedColumn.getMin(), indexedColumn.getIndexType(), indexedColumn.getName()); tableInfo.addToIndexedColumnList(indexInfo); // depends on control dependency: [if], data = [none] // Add more if required } return columnInfo; } }
public class class_name { public static long getFreeSpace(final File pPath) { // NOTE: Allow null, to get space in current/system volume File path = pPath != null ? pPath : new File("."); Long space = getSpace16("getFreeSpace", path); if (space != null) { return space; } return FS.getFreeSpace(path); } }
public class class_name { public static long getFreeSpace(final File pPath) { // NOTE: Allow null, to get space in current/system volume File path = pPath != null ? pPath : new File("."); Long space = getSpace16("getFreeSpace", path); if (space != null) { return space; // depends on control dependency: [if], data = [none] } return FS.getFreeSpace(path); } }
public class class_name { @Override public boolean isMatchFeasible(Match match) { if (map.containsKey(match.getQueryNode()) || map.containsValue(match.getTargetAtom())) { return false; } if (!matchAtoms(match)) { return false; } if (!matchBonds(match)) { return false; } return true; } }
public class class_name { @Override public boolean isMatchFeasible(Match match) { if (map.containsKey(match.getQueryNode()) || map.containsValue(match.getTargetAtom())) { return false; // depends on control dependency: [if], data = [none] } if (!matchAtoms(match)) { return false; // depends on control dependency: [if], data = [none] } if (!matchBonds(match)) { return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public Object getValue(Object instance) { try { return getMethod.invoke(instance); } catch (Exception e) { throw new PropertyNotFoundException(klass, getType(), fieldName); } } }
public class class_name { public Object getValue(Object instance) { try { return getMethod.invoke(instance); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new PropertyNotFoundException(klass, getType(), fieldName); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static LocationType getLocationType(URI location) { String scheme = location.getScheme(); if (EMODB_SCHEME.equals(scheme)) { // If the host matches the locator pattern then assume host discovery, otherwise it's a // direct URL to an EmoDB server if (LOCATOR_PATTERN.matcher(location.getHost()).matches()) { return LocationType.EMO_HOST_DISCOVERY; } else { return LocationType.EMO_URL; } } else if (STASH_SCHEME.equals(scheme)) { return LocationType.STASH; } throw new IllegalArgumentException("Invalid location: " + location); } }
public class class_name { public static LocationType getLocationType(URI location) { String scheme = location.getScheme(); if (EMODB_SCHEME.equals(scheme)) { // If the host matches the locator pattern then assume host discovery, otherwise it's a // direct URL to an EmoDB server if (LOCATOR_PATTERN.matcher(location.getHost()).matches()) { return LocationType.EMO_HOST_DISCOVERY; // depends on control dependency: [if], data = [none] } else { return LocationType.EMO_URL; // depends on control dependency: [if], data = [none] } } else if (STASH_SCHEME.equals(scheme)) { return LocationType.STASH; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException("Invalid location: " + location); } }
public class class_name { public static Iterator<Byte> iterator(final DataInputStream self) { return new Iterator<Byte>() { Byte nextVal; boolean nextMustRead = true; boolean hasNext = true; public boolean hasNext() { if (nextMustRead && hasNext) { try { nextVal = self.readByte(); nextMustRead = false; } catch (IOException e) { hasNext = false; } } return hasNext; } public Byte next() { Byte retval = null; if (nextMustRead) { try { retval = self.readByte(); } catch (IOException e) { hasNext = false; } } else retval = nextVal; nextMustRead = true; return retval; } public void remove() { throw new UnsupportedOperationException("Cannot remove() from a DataInputStream Iterator"); } }; } }
public class class_name { public static Iterator<Byte> iterator(final DataInputStream self) { return new Iterator<Byte>() { Byte nextVal; boolean nextMustRead = true; boolean hasNext = true; public boolean hasNext() { if (nextMustRead && hasNext) { try { nextVal = self.readByte(); // depends on control dependency: [try], data = [none] nextMustRead = false; // depends on control dependency: [try], data = [none] } catch (IOException e) { hasNext = false; } // depends on control dependency: [catch], data = [none] } return hasNext; } public Byte next() { Byte retval = null; if (nextMustRead) { try { retval = self.readByte(); // depends on control dependency: [try], data = [none] } catch (IOException e) { hasNext = false; } // depends on control dependency: [catch], data = [none] } else retval = nextVal; nextMustRead = true; return retval; } public void remove() { throw new UnsupportedOperationException("Cannot remove() from a DataInputStream Iterator"); } }; } }
public class class_name { public int read() throws IOException { // decode character int c = fSurrogate; if (fSurrogate == -1) { // NOTE: We use the index into the buffer if there are remaining // bytes from the last block read. -Ac int index = 0; // get first byte int b0 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b0 == -1) { return -1; } // UTF-8: [0xxx xxxx] // Unicode: [0000 0000] [0xxx xxxx] if (b0 < 0x80) { c = (char)b0; } // UTF-8: [110y yyyy] [10xx xxxx] // Unicode: [0000 0yyy] [yyxx xxxx] else if ((b0 & 0xE0) == 0xC0) { int b1 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b1 == -1) { expectedByte(2, 2); } if ((b1 & 0xC0) != 0x80) { invalidByte(2, 2, b1); } c = ((b0 << 6) & 0x07C0) | (b1 & 0x003F); } // UTF-8: [1110 zzzz] [10yy yyyy] [10xx xxxx] // Unicode: [zzzz yyyy] [yyxx xxxx] else if ((b0 & 0xF0) == 0xE0) { int b1 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b1 == -1) { expectedByte(2, 3); } if ((b1 & 0xC0) != 0x80) { invalidByte(2, 3, b1); } int b2 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b2 == -1) { expectedByte(3, 3); } if ((b2 & 0xC0) != 0x80) { invalidByte(3, 3, b2); } c = ((b0 << 12) & 0xF000) | ((b1 << 6) & 0x0FC0) | (b2 & 0x003F); } // UTF-8: [1111 0uuu] [10uu zzzz] [10yy yyyy] [10xx xxxx]* // Unicode: [1101 10ww] [wwzz zzyy] (high surrogate) // [1101 11yy] [yyxx xxxx] (low surrogate) // * uuuuu = wwww + 1 else if ((b0 & 0xF8) == 0xF0) { int b1 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b1 == -1) { expectedByte(2, 4); } if ((b1 & 0xC0) != 0x80) { invalidByte(2, 3, b1); } int b2 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b2 == -1) { expectedByte(3, 4); } if ((b2 & 0xC0) != 0x80) { invalidByte(3, 3, b2); } int b3 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b3 == -1) { expectedByte(4, 4); } if ((b3 & 0xC0) != 0x80) { invalidByte(4, 4, b3); } int uuuuu = ((b0 << 2) & 0x001C) | ((b1 >> 4) & 0x0003); if (uuuuu > 0x10) { invalidSurrogate(uuuuu); } int wwww = uuuuu - 1; int hs = 0xD800 | ((wwww << 6) & 0x03C0) | ((b1 << 2) & 0x003C) | ((b2 >> 4) & 0x0003); int ls = 0xDC00 | ((b2 << 6) & 0x03C0) | (b3 & 0x003F); c = hs; fSurrogate = ls; } // error else { invalidByte(1, 1, b0); } } // use surrogate else { fSurrogate = -1; } // return character return c; } }
public class class_name { public int read() throws IOException { // decode character int c = fSurrogate; if (fSurrogate == -1) { // NOTE: We use the index into the buffer if there are remaining // bytes from the last block read. -Ac int index = 0; // get first byte int b0 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b0 == -1) { return -1; } // UTF-8: [0xxx xxxx] // Unicode: [0000 0000] [0xxx xxxx] if (b0 < 0x80) { c = (char)b0; } // UTF-8: [110y yyyy] [10xx xxxx] // Unicode: [0000 0yyy] [yyxx xxxx] else if ((b0 & 0xE0) == 0xC0) { int b1 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b1 == -1) { expectedByte(2, 2); // depends on control dependency: [if], data = [none] } if ((b1 & 0xC0) != 0x80) { invalidByte(2, 2, b1); // depends on control dependency: [if], data = [none] } c = ((b0 << 6) & 0x07C0) | (b1 & 0x003F); } // UTF-8: [1110 zzzz] [10yy yyyy] [10xx xxxx] // Unicode: [zzzz yyyy] [yyxx xxxx] else if ((b0 & 0xF0) == 0xE0) { int b1 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b1 == -1) { expectedByte(2, 3); // depends on control dependency: [if], data = [none] } if ((b1 & 0xC0) != 0x80) { invalidByte(2, 3, b1); // depends on control dependency: [if], data = [none] } int b2 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b2 == -1) { expectedByte(3, 3); // depends on control dependency: [if], data = [none] } if ((b2 & 0xC0) != 0x80) { invalidByte(3, 3, b2); // depends on control dependency: [if], data = [none] } c = ((b0 << 12) & 0xF000) | ((b1 << 6) & 0x0FC0) | (b2 & 0x003F); } // UTF-8: [1111 0uuu] [10uu zzzz] [10yy yyyy] [10xx xxxx]* // Unicode: [1101 10ww] [wwzz zzyy] (high surrogate) // [1101 11yy] [yyxx xxxx] (low surrogate) // * uuuuu = wwww + 1 else if ((b0 & 0xF8) == 0xF0) { int b1 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b1 == -1) { expectedByte(2, 4); // depends on control dependency: [if], data = [none] } if ((b1 & 0xC0) != 0x80) { invalidByte(2, 3, b1); // depends on control dependency: [if], data = [none] } int b2 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b2 == -1) { expectedByte(3, 4); // depends on control dependency: [if], data = [none] } if ((b2 & 0xC0) != 0x80) { invalidByte(3, 3, b2); // depends on control dependency: [if], data = [none] } int b3 = index == fOffset ? fInputStream.read() : fBuffer[index++] & 0x00FF; if (b3 == -1) { expectedByte(4, 4); // depends on control dependency: [if], data = [none] } if ((b3 & 0xC0) != 0x80) { invalidByte(4, 4, b3); // depends on control dependency: [if], data = [none] } int uuuuu = ((b0 << 2) & 0x001C) | ((b1 >> 4) & 0x0003); if (uuuuu > 0x10) { invalidSurrogate(uuuuu); // depends on control dependency: [if], data = [(uuuuu] } int wwww = uuuuu - 1; int hs = 0xD800 | ((wwww << 6) & 0x03C0) | ((b1 << 2) & 0x003C) | ((b2 >> 4) & 0x0003); int ls = 0xDC00 | ((b2 << 6) & 0x03C0) | (b3 & 0x003F); c = hs; fSurrogate = ls; } // error else { invalidByte(1, 1, b0); } } // use surrogate else { fSurrogate = -1; } // return character return c; } }
public class class_name { @Override public EClass getIfcFaceBound() { if (ifcFaceBoundEClass == null) { ifcFaceBoundEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(255); } return ifcFaceBoundEClass; } }
public class class_name { @Override public EClass getIfcFaceBound() { if (ifcFaceBoundEClass == null) { ifcFaceBoundEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(255); // depends on control dependency: [if], data = [none] } return ifcFaceBoundEClass; } }
public class class_name { private void removeAttributesNetUI(ServletContext servletContext) { try { LinkedList list = new LinkedList(); Enumeration enumeration = servletContext.getAttributeNames(); while(enumeration.hasMoreElements()) { String string = (String)enumeration.nextElement(); if(string.startsWith(InternalConstants.ATTR_PREFIX)) list.add(string); } for(int i = 0; i < list.size(); i++) { Object key = list.get(i); assert key != null; assert key instanceof String; LOG.trace("Removing ServletContext attribute named \"" + key + "\""); servletContext.removeAttribute((String)key); } } catch(Exception e) { LOG.error("Caught error removing NetUI attribute from ServletContext. Cause: " + e, e); } } }
public class class_name { private void removeAttributesNetUI(ServletContext servletContext) { try { LinkedList list = new LinkedList(); Enumeration enumeration = servletContext.getAttributeNames(); while(enumeration.hasMoreElements()) { String string = (String)enumeration.nextElement(); if(string.startsWith(InternalConstants.ATTR_PREFIX)) list.add(string); } for(int i = 0; i < list.size(); i++) { Object key = list.get(i); assert key != null; assert key instanceof String; LOG.trace("Removing ServletContext attribute named \"" + key + "\""); // depends on control dependency: [for], data = [none] servletContext.removeAttribute((String)key); // depends on control dependency: [for], data = [none] } } catch(Exception e) { LOG.error("Caught error removing NetUI attribute from ServletContext. Cause: " + e, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void logStackTrace() { if (enabled) { Throwable t = new Throwable(); t.fillInStackTrace(); StackTraceElement[] ste_arr = t.getStackTrace(); for (int ii = 2; ii < ste_arr.length; ii++) { StackTraceElement ste = ste_arr[ii]; System.out.printf("%s %s%n", getIndentString(), ste); } } } }
public class class_name { public void logStackTrace() { if (enabled) { Throwable t = new Throwable(); t.fillInStackTrace(); // depends on control dependency: [if], data = [none] StackTraceElement[] ste_arr = t.getStackTrace(); for (int ii = 2; ii < ste_arr.length; ii++) { StackTraceElement ste = ste_arr[ii]; System.out.printf("%s %s%n", getIndentString(), ste); // depends on control dependency: [for], data = [none] } } } }
public class class_name { @Override public final void writeTo(IonWriter writer) { if (writer.getSymbolTable().isSystemTable()) { // If the writer was configured with a non-default symbol table, writing an IVM here will // reset that symbol table. If the datagram contains any symbols with unknown text that // refer to slots in shared symbol table imports declared by the discarded table, an // error will be raised unnecessarily. To avoid that, only write an IVM when the writer's // symbol table is already the system symbol table. // TODO evaluate whether an IVM should ever be written here. amzn/ion-java#200 try { writer.writeSymbol(SystemSymbols.ION_1_0); } catch (IOException ioe) { throw new IonException(ioe); } } for (IonValue iv : this) { iv.writeTo(writer); } } }
public class class_name { @Override public final void writeTo(IonWriter writer) { if (writer.getSymbolTable().isSystemTable()) { // If the writer was configured with a non-default symbol table, writing an IVM here will // reset that symbol table. If the datagram contains any symbols with unknown text that // refer to slots in shared symbol table imports declared by the discarded table, an // error will be raised unnecessarily. To avoid that, only write an IVM when the writer's // symbol table is already the system symbol table. // TODO evaluate whether an IVM should ever be written here. amzn/ion-java#200 try { writer.writeSymbol(SystemSymbols.ION_1_0); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { throw new IonException(ioe); } // depends on control dependency: [catch], data = [none] } for (IonValue iv : this) { iv.writeTo(writer); // depends on control dependency: [for], data = [iv] } } }
public class class_name { private void groupAndMatch(List<FitRow> expected, List<Object> computed, int col) { Map<Object, List<FitRow>> expectedMap = groupExpectedByColumn(expected, col); Map<Object, List<Object>> computedMap = groupComputedByColumn(computed, col); Set keys = union(expectedMap.keySet(), computedMap.keySet()); for (Object key : keys) { List<FitRow> expectedList = expectedMap.get(key); List<Object> computedList = computedMap.get(key); boolean isAmbiguous = hasMultipleEntries(expectedList) && hasMultipleEntries(computedList); if (isAmbiguous) { multiLevelMatch(expectedList, computedList, col + 1); } else { check(expectedList, computedList); } } } }
public class class_name { private void groupAndMatch(List<FitRow> expected, List<Object> computed, int col) { Map<Object, List<FitRow>> expectedMap = groupExpectedByColumn(expected, col); Map<Object, List<Object>> computedMap = groupComputedByColumn(computed, col); Set keys = union(expectedMap.keySet(), computedMap.keySet()); for (Object key : keys) { List<FitRow> expectedList = expectedMap.get(key); List<Object> computedList = computedMap.get(key); boolean isAmbiguous = hasMultipleEntries(expectedList) && hasMultipleEntries(computedList); if (isAmbiguous) { multiLevelMatch(expectedList, computedList, col + 1); // depends on control dependency: [if], data = [none] } else { check(expectedList, computedList); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(PatchRule patchRule, ProtocolMarshaller protocolMarshaller) { if (patchRule == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(patchRule.getPatchFilterGroup(), PATCHFILTERGROUP_BINDING); protocolMarshaller.marshall(patchRule.getComplianceLevel(), COMPLIANCELEVEL_BINDING); protocolMarshaller.marshall(patchRule.getApproveAfterDays(), APPROVEAFTERDAYS_BINDING); protocolMarshaller.marshall(patchRule.getEnableNonSecurity(), ENABLENONSECURITY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PatchRule patchRule, ProtocolMarshaller protocolMarshaller) { if (patchRule == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(patchRule.getPatchFilterGroup(), PATCHFILTERGROUP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(patchRule.getComplianceLevel(), COMPLIANCELEVEL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(patchRule.getApproveAfterDays(), APPROVEAFTERDAYS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(patchRule.getEnableNonSecurity(), ENABLENONSECURITY_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String format( JsonSerializerParameters params, Date date ) { DateTimeFormat format; if ( null == params.getPattern() ) { format = DateFormat.DATE_FORMAT_STR_ISO8601; } else { format = DateTimeFormat.getFormat( params.getPattern() ); } TimeZone timeZone; if ( null == params.getTimezone() ) { timeZone = DateFormat.UTC_TIMEZONE; } else { timeZone = params.getTimezone(); } return format( format, timeZone, date ); } }
public class class_name { public static String format( JsonSerializerParameters params, Date date ) { DateTimeFormat format; if ( null == params.getPattern() ) { format = DateFormat.DATE_FORMAT_STR_ISO8601; // depends on control dependency: [if], data = [none] } else { format = DateTimeFormat.getFormat( params.getPattern() ); // depends on control dependency: [if], data = [params.getPattern() )] } TimeZone timeZone; if ( null == params.getTimezone() ) { timeZone = DateFormat.UTC_TIMEZONE; // depends on control dependency: [if], data = [none] } else { timeZone = params.getTimezone(); // depends on control dependency: [if], data = [none] } return format( format, timeZone, date ); } }
public class class_name { public void lockSession(HttpServletRequest req, HttpSession sess) { String isNested = (String) req.getAttribute("com.ibm.servlet.engine.webapp.dispatch_nested"); if (isNested == null || (isNested.equalsIgnoreCase("false"))) { try { long syncSessionTimeOut = (long)_smc.getSerializedSessionAccessMaxWaitTime() * 1000L; //convert to millisecond long syncSessionTimeOutNanos = syncSessionTimeOut * 1000000L; //convert to nanosecond // if session exits, start locking procedures if (sess != null) { Object lock = new Object(); //create a new lock object for this request; LinkedList ll = ((SessionData)sess).getLockList(); //gets the linked lists of lock objects for this session; int llsize; // PK09786 BEGIN -- Always synchronize on linklist before lock to avoid deadlock synchronized (ll) { ((SessionData)sess).setSessionLock(Thread.currentThread(), lock); //adds thread to WsSession locks hashtable so we know who to notify in PostInvoke ll.addLast(lock); llsize = ll.size(); } //PK19389 when another thread is in sessionPostInvoke, trying to lock linkedlist in order to notify the thread in lock.wait() if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[LOCK_SESSION], "size = " + llsize + " thread = " + Thread.currentThread().getId() + " lock = " + lock.hashCode()); } if (llsize > 1) { long before = System.nanoTime(); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[LOCK_SESSION], "waiting..."); } synchronized (lock) { lock.wait(syncSessionTimeOut); } if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[LOCK_SESSION], "Done waiting."); } long after = System.nanoTime(); synchronized (ll) { // if timed out if ((after - syncSessionTimeOutNanos) >= before) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[LOCK_SESSION], "notified after wait timed out"); } // 118672 - we want to fail if we aren't supposed to get the access session if (!_smc.getAccessSessionOnTimeout()) { ll.remove(lock); LoggingUtil.SESSION_LOGGER_CORE.logp(Level.SEVERE, methodClassName, methodNames[LOCK_SESSION], "WsSessionContext.timeOut"); throw new RuntimeException("Session Lock time outException"); } } } } // PK09786 END } if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[LOCK_SESSION], sess); } //return sess; } catch (InterruptedException e) { com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.session.impl.HttpSessionContextImpl.lockSession", "133", this); LoggingUtil.SESSION_LOGGER_CORE.logp(Level.SEVERE, methodClassName, methodNames[LOCK_SESSION], "CommonMessage.exception", e); } } //close if(isNested...) } }
public class class_name { public void lockSession(HttpServletRequest req, HttpSession sess) { String isNested = (String) req.getAttribute("com.ibm.servlet.engine.webapp.dispatch_nested"); if (isNested == null || (isNested.equalsIgnoreCase("false"))) { try { long syncSessionTimeOut = (long)_smc.getSerializedSessionAccessMaxWaitTime() * 1000L; //convert to millisecond long syncSessionTimeOutNanos = syncSessionTimeOut * 1000000L; //convert to nanosecond // if session exits, start locking procedures if (sess != null) { Object lock = new Object(); //create a new lock object for this request; LinkedList ll = ((SessionData)sess).getLockList(); //gets the linked lists of lock objects for this session; int llsize; // PK09786 BEGIN -- Always synchronize on linklist before lock to avoid deadlock synchronized (ll) { // depends on control dependency: [if], data = [none] ((SessionData)sess).setSessionLock(Thread.currentThread(), lock); //adds thread to WsSession locks hashtable so we know who to notify in PostInvoke ll.addLast(lock); llsize = ll.size(); } //PK19389 when another thread is in sessionPostInvoke, trying to lock linkedlist in order to notify the thread in lock.wait() if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[LOCK_SESSION], "size = " + llsize + " thread = " + Thread.currentThread().getId() + " lock = " + lock.hashCode()); // depends on control dependency: [if], data = [none] } if (llsize > 1) { long before = System.nanoTime(); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[LOCK_SESSION], "waiting..."); // depends on control dependency: [if], data = [none] } synchronized (lock) { // depends on control dependency: [if], data = [none] lock.wait(syncSessionTimeOut); } if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[LOCK_SESSION], "Done waiting."); // depends on control dependency: [if], data = [none] } long after = System.nanoTime(); synchronized (ll) { // depends on control dependency: [if], data = [none] // if timed out if ((after - syncSessionTimeOutNanos) >= before) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[LOCK_SESSION], "notified after wait timed out"); // depends on control dependency: [if], data = [none] } // 118672 - we want to fail if we aren't supposed to get the access session if (!_smc.getAccessSessionOnTimeout()) { ll.remove(lock); // depends on control dependency: [if], data = [none] LoggingUtil.SESSION_LOGGER_CORE.logp(Level.SEVERE, methodClassName, methodNames[LOCK_SESSION], "WsSessionContext.timeOut"); throw new RuntimeException("Session Lock time outException"); // depends on control dependency: [if], data = [none] } } } } // PK09786 END } if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[LOCK_SESSION], sess); // depends on control dependency: [if], data = [none] } //return sess; } catch (InterruptedException e) { com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.session.impl.HttpSessionContextImpl.lockSession", "133", this); LoggingUtil.SESSION_LOGGER_CORE.logp(Level.SEVERE, methodClassName, methodNames[LOCK_SESSION], "CommonMessage.exception", e); } // depends on control dependency: [catch], data = [none] } //close if(isNested...) } }
public class class_name { public static String sqlCipherKeyForKeyProvider(KeyProvider provider) { // We get a byte[] from the EncryptionKey object passed by the provider. // This needs to be made into a hex string and wrapped in `x'keyhex'` // before passing to SQLCipher's open method. if (provider == null) { return null; } EncryptionKey key = provider.getEncryptionKey(); if (key == null) { return null; } byte[] keyBytes = key.getKey(); String hexKey = new String(Hex.encodeHex(keyBytes)); return String.format("x'%1$s'", hexKey); } }
public class class_name { public static String sqlCipherKeyForKeyProvider(KeyProvider provider) { // We get a byte[] from the EncryptionKey object passed by the provider. // This needs to be made into a hex string and wrapped in `x'keyhex'` // before passing to SQLCipher's open method. if (provider == null) { return null; // depends on control dependency: [if], data = [none] } EncryptionKey key = provider.getEncryptionKey(); if (key == null) { return null; // depends on control dependency: [if], data = [none] } byte[] keyBytes = key.getKey(); String hexKey = new String(Hex.encodeHex(keyBytes)); return String.format("x'%1$s'", hexKey); } }
public class class_name { private void writeResource(XhtmlWriter writer, Object object) { if (object == null) { return; } try { if (object instanceof Resource) { Resource<?> resource = (Resource<?>) object; writer.beginListItem(); writeResource(writer, resource.getContent()); writer.writeLinks(resource.getLinks()); writer.endListItem(); } else if (object instanceof Resources) { Resources<?> resources = (Resources<?>) object; // TODO set name using EVO see HypermediaSupportBeanDefinitionRegistrar writer.beginListItem(); writer.beginUnorderedList(); Collection<?> content = resources.getContent(); writeResource(writer, content); writer.endUnorderedList(); writer.writeLinks(resources.getLinks()); writer.endListItem(); } else if (object instanceof ResourceSupport) { ResourceSupport resource = (ResourceSupport) object; writer.beginListItem(); writeObject(writer, resource); writer.writeLinks(resource.getLinks()); writer.endListItem(); } else if (object instanceof Collection) { Collection<?> collection = (Collection<?>) object; for (Object item : collection) { writeResource(writer, item); } } else { // TODO: write li for simple objects in Resources Collection writeObject(writer, object); } } catch (Exception ex) { throw new RuntimeException("failed to transform object " + object, ex); } } }
public class class_name { private void writeResource(XhtmlWriter writer, Object object) { if (object == null) { return; // depends on control dependency: [if], data = [none] } try { if (object instanceof Resource) { Resource<?> resource = (Resource<?>) object; writer.beginListItem(); // depends on control dependency: [if], data = [none] writeResource(writer, resource.getContent()); // depends on control dependency: [if], data = [none] writer.writeLinks(resource.getLinks()); // depends on control dependency: [if], data = [none] writer.endListItem(); // depends on control dependency: [if], data = [none] } else if (object instanceof Resources) { Resources<?> resources = (Resources<?>) object; // TODO set name using EVO see HypermediaSupportBeanDefinitionRegistrar writer.beginListItem(); // depends on control dependency: [if], data = [none] writer.beginUnorderedList(); // depends on control dependency: [if], data = [none] Collection<?> content = resources.getContent(); writeResource(writer, content); // depends on control dependency: [if], data = [none] writer.endUnorderedList(); // depends on control dependency: [if], data = [none] writer.writeLinks(resources.getLinks()); // depends on control dependency: [if], data = [none] writer.endListItem(); // depends on control dependency: [if], data = [none] } else if (object instanceof ResourceSupport) { ResourceSupport resource = (ResourceSupport) object; writer.beginListItem(); // depends on control dependency: [if], data = [none] writeObject(writer, resource); // depends on control dependency: [if], data = [none] writer.writeLinks(resource.getLinks()); // depends on control dependency: [if], data = [none] writer.endListItem(); // depends on control dependency: [if], data = [none] } else if (object instanceof Collection) { Collection<?> collection = (Collection<?>) object; for (Object item : collection) { writeResource(writer, item); // depends on control dependency: [for], data = [item] } } else { // TODO: write li for simple objects in Resources Collection writeObject(writer, object); // depends on control dependency: [if], data = [none] } } catch (Exception ex) { throw new RuntimeException("failed to transform object " + object, ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String authorityFromHostAndPort(String host, int port) { try { return new URI(null, null, host, port, null, null, null).getAuthority(); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid host or port: " + host + " " + port, ex); } } }
public class class_name { public static String authorityFromHostAndPort(String host, int port) { try { return new URI(null, null, host, port, null, null, null).getAuthority(); // depends on control dependency: [try], data = [none] } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid host or port: " + host + " " + port, ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(ClusterTimeline clusterTimeline, ProtocolMarshaller protocolMarshaller) { if (clusterTimeline == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(clusterTimeline.getCreationDateTime(), CREATIONDATETIME_BINDING); protocolMarshaller.marshall(clusterTimeline.getReadyDateTime(), READYDATETIME_BINDING); protocolMarshaller.marshall(clusterTimeline.getEndDateTime(), ENDDATETIME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ClusterTimeline clusterTimeline, ProtocolMarshaller protocolMarshaller) { if (clusterTimeline == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(clusterTimeline.getCreationDateTime(), CREATIONDATETIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(clusterTimeline.getReadyDateTime(), READYDATETIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(clusterTimeline.getEndDateTime(), ENDDATETIME_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 computeMap( String[] from, String[] to, boolean fromIsBad ) { // Identity? Build the cheapo non-map if( from==to || Arrays.equals(from,to) ) { _map = ArrayUtils.seq(0,to.length); setDomain(to); return; } // The source Vec does not have a domain, hence is an integer column. The // to[] mapping has the set of unique numbers, we need to map from those // numbers to the index to the numbers. if( from==null) { setDomain(to); if( fromIsBad ) { _map = new int[0]; return; } int min = Integer.valueOf(to[0]); int max = Integer.valueOf(to[to.length-1]); Vec mvec = masterVec(); if( !(mvec.isInt() && mvec.min() >= min && mvec.max() <= max) ) throw new NumberFormatException(); // Unable to figure out a valid mapping // FIXME this is a bit of a hack to allow adapTo calls to play nice with negative ints in the domain... if( Integer.valueOf(to[0]) < 0 ) { _p=Math.max(0,max); _map = new int[(_p /*positive array of values*/) + (-1*min /*negative array of values*/) + 1 /*one more to store "max" value*/]; for(int i=0;i<to.length;++i) { int v = Integer.valueOf(to[i]); if( v < 0 ) v = -1*v+_p; _map[v] = i; } return; } _map = new int[max+1]; for( int i=0; i<to.length; i++ ) _map[Integer.valueOf(to[i])] = i; return; } // The desired result Vec does not have a domain, hence is a numeric // column. For classification of numbers, we did an original toCategoricalVec // wrapping the numeric values up as Strings for the classes. Unwind that, // converting numeric strings back to their original numbers. _map = new int[from.length]; if( to == null ) { for( int i=0; i<from.length; i++ ) _map[i] = Integer.valueOf(from[i]); return; } // Full string-to-string mapping HashMap<String,Integer> h = new HashMap<>(); for( int i=0; i<to.length; i++ ) h.put(to[i],i); String[] ss = to; int extra = to.length; int actualLen = extra; for( int j=0; j<from.length; j++ ) { Integer x = h.get(from[j]); if( x!=null ) _map[j] = x; else { _map[j] = extra++; if (extra > ss.length) { ss = Arrays.copyOf(ss, 2*ss.length); } ss[extra-1] = from[j]; actualLen = extra; } } setDomain(Arrays.copyOf(ss, actualLen)); } }
public class class_name { private void computeMap( String[] from, String[] to, boolean fromIsBad ) { // Identity? Build the cheapo non-map if( from==to || Arrays.equals(from,to) ) { _map = ArrayUtils.seq(0,to.length); // depends on control dependency: [if], data = [none] setDomain(to); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // The source Vec does not have a domain, hence is an integer column. The // to[] mapping has the set of unique numbers, we need to map from those // numbers to the index to the numbers. if( from==null) { setDomain(to); // depends on control dependency: [if], data = [none] if( fromIsBad ) { _map = new int[0]; return; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] int min = Integer.valueOf(to[0]); int max = Integer.valueOf(to[to.length-1]); Vec mvec = masterVec(); if( !(mvec.isInt() && mvec.min() >= min && mvec.max() <= max) ) throw new NumberFormatException(); // Unable to figure out a valid mapping // FIXME this is a bit of a hack to allow adapTo calls to play nice with negative ints in the domain... if( Integer.valueOf(to[0]) < 0 ) { _p=Math.max(0,max); // depends on control dependency: [if], data = [none] _map = new int[(_p /*positive array of values*/) + (-1*min /*negative array of values*/) + 1 /*one more to store "max" value*/]; // depends on control dependency: [if], data = [none] for(int i=0;i<to.length;++i) { int v = Integer.valueOf(to[i]); if( v < 0 ) v = -1*v+_p; _map[v] = i; // depends on control dependency: [for], data = [i] } return; // depends on control dependency: [if], data = [none] } _map = new int[max+1]; // depends on control dependency: [if], data = [none] for( int i=0; i<to.length; i++ ) _map[Integer.valueOf(to[i])] = i; return; // depends on control dependency: [if], data = [none] } // The desired result Vec does not have a domain, hence is a numeric // column. For classification of numbers, we did an original toCategoricalVec // wrapping the numeric values up as Strings for the classes. Unwind that, // converting numeric strings back to their original numbers. _map = new int[from.length]; if( to == null ) { for( int i=0; i<from.length; i++ ) _map[i] = Integer.valueOf(from[i]); return; // depends on control dependency: [if], data = [none] } // Full string-to-string mapping HashMap<String,Integer> h = new HashMap<>(); for( int i=0; i<to.length; i++ ) h.put(to[i],i); String[] ss = to; int extra = to.length; int actualLen = extra; for( int j=0; j<from.length; j++ ) { Integer x = h.get(from[j]); if( x!=null ) _map[j] = x; else { _map[j] = extra++; // depends on control dependency: [if], data = [none] if (extra > ss.length) { ss = Arrays.copyOf(ss, 2*ss.length); // depends on control dependency: [if], data = [ss.length)] } ss[extra-1] = from[j]; // depends on control dependency: [if], data = [none] actualLen = extra; // depends on control dependency: [if], data = [none] } } setDomain(Arrays.copyOf(ss, actualLen)); } }
public class class_name { public static long convertAlldayUtcToLocal(Time recycle, long utcTime, String tz) { if (recycle == null) { recycle = new Time(); } recycle.timezone = Time.TIMEZONE_UTC; recycle.set(utcTime); recycle.timezone = tz; return recycle.normalize(true); } }
public class class_name { public static long convertAlldayUtcToLocal(Time recycle, long utcTime, String tz) { if (recycle == null) { recycle = new Time(); // depends on control dependency: [if], data = [none] } recycle.timezone = Time.TIMEZONE_UTC; recycle.set(utcTime); recycle.timezone = tz; return recycle.normalize(true); } }