QueryTranslatorImpl.java

Index Score
org.hibernate.hql.classic
Hibernate

View: Reasons, Metrics, Source Code

These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.

MetricDescription
JAVA0126JAVA0126 Method declares unchecked exception in throws
INTERFACE_COMPLEXITYInterface complexity
RETURNSNumber of return points from functions
CYCLOMATICCyclomatic complexity
FUNCTIONSNumber of function declarations
PARAMSNumber of formal parameter declarations
BLOCKSNumber of blocks
EXITSProcedure exits
LOOPSNumber of loops
JAVA0034JAVA0034 Missing braces in if statement
LOGICAL_LINESNumber of statements
PROGRAM_LENGTHHalstead program length
OPERANDSNumber of operands
OPERATORSNumber of operators
UNIQUE_OPERANDSNumber of unique operands
LOCLines of code
ELOCEffective lines of code
PROGRAM_VOCABHalstead program vocabulary
SIZESize of the file in bytes
LINESNumber of lines in the source file
COMPARISONSNumber of comparison operators
EXEC_COMMENTSComments in executable code
JAVA0254JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0259JAVA0259 Return of collection/array field
JAVA0115JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0145JAVA0145 Tab character used in source file
WHITESPACENumber of whitespace lines
JAVA0166JAVA0166 Generic exception caught
JAVA0049JAVA0049 Nested block at depth N (maximum: M)
LINE_COMMENTNumber of line comments
JAVA0143JAVA0143 Synchronized method
JAVA0177JAVA0177 Variable declaration missing initializer
JAVA0144JAVA0144 Line exceeds maximum M characters
NEST_DEPTHMaximum nesting depth
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
UNIQUE_OPERATORSNumber of unique operators
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0174JAVA0174 Assigned local variable never used
JAVA0035JAVA0035 Missing braces in for statement
JAVA0265JAVA0265 Use of Throwable.printStackTrace()
JAVA0100JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0270JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
/* * Hibernate, Relational Persistence for Idiomatic Java * * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. All third-party contributions are * distributed under license by Red Hat Middleware LLC. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU * Lesser General Public License, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this distribution; if not, write to: * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA * */ package org.hibernate.hql.classic; import java.io.Serializable; import java.lang.reflect.Constructor; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.LockMode; import org.hibernate.MappingException; import org.hibernate.QueryException; import org.hibernate.ScrollableResults; import org.hibernate.dialect.Dialect; import org.hibernate.engine.JoinSequence; import org.hibernate.engine.QueryParameters; import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionImplementor; import org.hibernate.event.EventSource; import org.hibernate.exception.JDBCExceptionHelper; import org.hibernate.hql.FilterTranslator; import org.hibernate.hql.HolderInstantiator; import org.hibernate.hql.NameGenerator; import org.hibernate.hql.ParameterTranslations; import org.hibernate.impl.IteratorImpl; import org.hibernate.loader.BasicLoader; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.QueryableCollection; import org.hibernate.persister.entity.Loadable; import org.hibernate.persister.entity.PropertyMapping; import org.hibernate.persister.entity.Queryable; import org.hibernate.sql.JoinFragment; import org.hibernate.sql.QuerySelect; import org.hibernate.transform.ResultTransformer; import org.hibernate.type.AssociationType; import org.hibernate.type.EntityType; import org.hibernate.type.Type; import org.hibernate.type.TypeFactory; import org.hibernate.util.ArrayHelper; import org.hibernate.util.ReflectHelper; import org.hibernate.util.StringHelper; /** * An instance of <tt>QueryTranslator</tt> translates a Hibernate * query string to SQL. */ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator { private static final String[] NO_RETURN_ALIASES = new String[] {}; private final String queryIdentifier; private final String queryString; private final Map typeMap = new LinkedHashMap(); private final Map collections = new LinkedHashMap(); private List returnedTypes = new ArrayList(); private final List fromTypes = new ArrayList(); private final List scalarTypes = new ArrayList(); private final Map namedParameters = new HashMap(); private final Map aliasNames = new HashMap(); private final Map oneToOneOwnerNames = new HashMap(); private final Map uniqueKeyOwnerReferences = new HashMap(); private final Map decoratedPropertyMappings = new HashMap(); private final List scalarSelectTokens = new ArrayList(); private final List whereTokens = new ArrayList(); private final List havingTokens = new ArrayList(); private final Map joins = new LinkedHashMap(); private final List orderByTokens = new ArrayList(); private final List groupByTokens = new ArrayList(); private final Set querySpaces = new HashSet(); private final Set entitiesToFetch = new HashSet(); private final Map pathAliases = new HashMap(); private final Map pathJoins = new HashMap(); private Queryable[] persisters; private int[] owners; private EntityType[] ownerAssociationTypes; private String[] names; private boolean[] includeInSelect; private int selectLength; private Type[] returnTypes; private Type[] actualReturnTypes; private String[][] scalarColumnNames; private Map tokenReplacements; private int nameCount = 0; private int parameterCount = 0; private boolean distinct = false; private boolean compiled; private String sqlString; private Class holderClass; private Constructor holderConstructor; private boolean hasScalars; private boolean shallowQuery; private QueryTranslatorImpl superQuery; private QueryableCollection collectionPersister; private int collectionOwnerColumn = -1; private String collectionOwnerName; private String fetchName; private String[] suffixes; private Map enabledFilters; private static final Logger log = LoggerFactory.getLogger( QueryTranslatorImpl.class ); /** * Construct a query translator * * @param queryIdentifier A unique identifier for the query of which this * translation is part; typically this is the original, user-supplied query string. * @param queryString The "preprocessed" query string; at the very least * already processed by {@link org.hibernate.hql.QuerySplitter}. * @param enabledFilters Any enabled filters. * @param factory The session factory. */ public QueryTranslatorImpl( String queryIdentifier, String queryString, Map enabledFilters, SessionFactoryImplementor factory) { super( factory ); this.queryIdentifier = queryIdentifier; this.queryString = queryString; this.enabledFilters = enabledFilters; } /** * Construct a query translator; this form used internally. * * @param queryString The query string to process. * @param enabledFilters Any enabled filters. * @param factory The session factory. */ public QueryTranslatorImpl( String queryString, Map enabledFilters, SessionFactoryImplementor factory) { this( queryString, queryString, enabledFilters, factory ); } /** * Compile a subquery. * * @param superquery The containing query of the query to be compiled. * * @throws org.hibernate.MappingException Indicates problems resolving * things referenced in the query. * @throws org.hibernate.QueryException Generally some form of syntatic * failure. */ void compile(QueryTranslatorImpl superquery) throws QueryException, MappingException { this.tokenReplacements = superquery.tokenReplacements; this.superQuery = superquery; this.shallowQuery = true; this.enabledFilters = superquery.getEnabledFilters(); compile(); } /** * Compile a "normal" query. This method may be called multiple * times. Subsequent invocations are no-ops. */ public synchronized void compile( Map replacements, boolean scalar) throws QueryException, MappingException { if ( !compiled ) { this.tokenReplacements = replacements; this.shallowQuery = scalar; compile(); } } /** * Compile a filter. This method may be called multiple * times. Subsequent invocations are no-ops. */ public synchronized void compile( String collectionRole, Map replacements, boolean scalar) throws QueryException, MappingException { if ( !isCompiled() ) { addFromAssociation( "this", collectionRole ); compile( replacements, scalar ); } } /** * Compile the query (generate the SQL). * * @throws org.hibernate.MappingException Indicates problems resolving * things referenced in the query. * @throws org.hibernate.QueryException Generally some form of syntatic * failure. */ private void compile() throws QueryException, MappingException { log.trace( "compiling query" ); try { ParserHelper.parse( new PreprocessingParser( tokenReplacements ), queryString, ParserHelper.HQL_SEPARATORS, this ); renderSQL(); } catch ( QueryException qe ) { qe.setQueryString( queryString ); throw qe; } catch ( MappingException me ) { throw me; } catch ( Exception e ) { log.debug( "unexpected query compilation problem", e ); e.printStackTrace(); QueryException qe = new QueryException( "Incorrect query syntax", e ); qe.setQueryString( queryString ); throw qe; } postInstantiate(); compiled = true; } public String getSQLString() { return sqlString; } public List collectSqlStrings() { return ArrayHelper.toList( new String[] { sqlString } ); } public String getQueryString() { return queryString; } /** * Persisters for the return values of a <tt>find()</tt> style query. * * @return an array of <tt>EntityPersister</tt>s. */ protected Loadable[] getEntityPersisters() { return persisters; } /** * Types of the return values of an <tt>iterate()</tt> style query. * * @return an array of <tt>Type</tt>s. */ public Type[] getReturnTypes() { return actualReturnTypes; } public String[] getReturnAliases() { // return aliases not supported in classic translator! return NO_RETURN_ALIASES; } public String[][] getColumnNames() { return scalarColumnNames; } private static void logQuery(String hql, String sql) { if ( log.isDebugEnabled() ) { log.debug( "HQL: " + hql ); log.debug( "SQL: " + sql ); } } void setAliasName(String alias, String name) { aliasNames.put( alias, name ); } public String getAliasName(String alias) { String name = ( String ) aliasNames.get( alias ); if ( name == null ) { if ( superQuery != null ) { name = superQuery.getAliasName( alias ); } else { name = alias; } } return name; } String unalias(String path) { String alias = StringHelper.root( path ); String name = getAliasName( alias ); if ( name != null ) { return name + path.substring( alias.length() ); } else { return path; } } void addEntityToFetch(String name, String oneToOneOwnerName, AssociationType ownerAssociationType) { addEntityToFetch( name ); if ( oneToOneOwnerName != null ) oneToOneOwnerNames.put( name, oneToOneOwnerName ); if ( ownerAssociationType != null ) uniqueKeyOwnerReferences.put( name, ownerAssociationType ); } private void addEntityToFetch(String name) { entitiesToFetch.add( name ); } private int nextCount() { return ( superQuery == null ) ? nameCount++ : superQuery.nameCount++; } String createNameFor(String type) { return StringHelper.generateAlias( type, nextCount() ); } String createNameForCollection(String role) { return StringHelper.generateAlias( role, nextCount() ); } private String getType(String name) { String type = ( String ) typeMap.get( name ); if ( type == null && superQuery != null ) { type = superQuery.getType( name ); } return type; } private String getRole(String name) { String role = ( String ) collections.get( name ); if ( role == null && superQuery != null ) { role = superQuery.getRole( name ); } return role; } boolean isName(String name) { return aliasNames.containsKey( name ) || typeMap.containsKey( name ) || collections.containsKey( name ) || ( superQuery != null && superQuery.isName( name ) ); } PropertyMapping getPropertyMapping(String name) throws QueryException { PropertyMapping decorator = getDecoratedPropertyMapping( name ); if ( decorator != null ) return decorator; String type = getType( name ); if ( type == null ) { String role = getRole( name ); if ( role == null ) { throw new QueryException( "alias not found: " + name ); } return getCollectionPersister( role ); //.getElementPropertyMapping(); } else { Queryable persister = getEntityPersister( type ); if ( persister == null ) throw new QueryException( "persistent class not found: " + type ); return persister; } } private PropertyMapping getDecoratedPropertyMapping(String name) { return ( PropertyMapping ) decoratedPropertyMappings.get( name ); } void decoratePropertyMapping(String name, PropertyMapping mapping) { decoratedPropertyMappings.put( name, mapping ); } private Queryable getEntityPersisterForName(String name) throws QueryException { String type = getType( name ); Queryable persister = getEntityPersister( type ); if ( persister == null ) throw new QueryException( "persistent class not found: " + type ); return persister; } Queryable getEntityPersisterUsingImports(String className) { final String importedClassName = getFactory().getImportedClassName( className ); if ( importedClassName == null ) { return null; } try { return ( Queryable ) getFactory().getEntityPersister( importedClassName ); } catch ( MappingException me ) { return null; } } Queryable getEntityPersister(String entityName) throws QueryException { try { return ( Queryable ) getFactory().getEntityPersister( entityName ); } catch ( Exception e ) { throw new QueryException( "persistent class not found: " + entityName ); } } QueryableCollection getCollectionPersister(String role) throws QueryException { try { return ( QueryableCollection ) getFactory().getCollectionPersister( role ); } catch ( ClassCastException cce ) { throw new QueryException( "collection role is not queryable: " + role ); } catch ( Exception e ) { throw new QueryException( "collection role not found: " + role ); } } void addType(String name, String type) { typeMap.put( name, type ); } void addCollection(String name, String role) { collections.put( name, role ); } void addFrom(String name, String type, JoinSequence joinSequence) throws QueryException { addType( name, type ); addFrom( name, joinSequence ); } void addFromCollection(String name, String collectionRole, JoinSequence joinSequence) throws QueryException { //register collection role addCollection( name, collectionRole ); addJoin( name, joinSequence ); } void addFrom(String name, JoinSequence joinSequence) throws QueryException { fromTypes.add( name ); addJoin( name, joinSequence ); } void addFromClass(String name, Queryable classPersister) throws QueryException { JoinSequence joinSequence = new JoinSequence( getFactory() ) .setRoot( classPersister, name ); //crossJoins.add(name); addFrom( name, classPersister.getEntityName(), joinSequence ); } void addSelectClass(String name) { returnedTypes.add( name ); } void addSelectScalar(Type type) { scalarTypes.add( type ); } void appendWhereToken(String token) { whereTokens.add( token ); } void appendHavingToken(String token) { havingTokens.add( token ); } void appendOrderByToken(String token) { orderByTokens.add( token ); } void appendGroupByToken(String token) { groupByTokens.add( token ); } void appendScalarSelectToken(String token) { scalarSelectTokens.add( token ); } void appendScalarSelectTokens(String[] tokens) { scalarSelectTokens.add( tokens ); } void addFromJoinOnly(String name, JoinSequence joinSequence) throws QueryException { addJoin( name, joinSequence.getFromPart() ); } void addJoin(String name, JoinSequence joinSequence) throws QueryException { if ( !joins.containsKey( name ) ) joins.put( name, joinSequence ); } void addNamedParameter(String name) { if ( superQuery != null ) superQuery.addNamedParameter( name ); Integer loc = new Integer( parameterCount++ ); Object o = namedParameters.get( name ); if ( o == null ) { namedParameters.put( name, loc ); } else if ( o instanceof Integer ) { ArrayList list = new ArrayList( 4 ); list.add( o ); list.add( loc ); namedParameters.put( name, list ); } else { ( ( ArrayList ) o ).add( loc ); } } public int[] getNamedParameterLocs(String name) throws QueryException { Object o = namedParameters.get( name ); if ( o == null ) { QueryException qe = new QueryException( ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR + name ); qe.setQueryString( queryString ); throw qe; } if ( o instanceof Integer ) { return new int[]{ ( ( Integer ) o ).intValue() }; } else { return ArrayHelper.toIntArray( ( ArrayList ) o ); } } private void renderSQL() throws QueryException, MappingException { final int rtsize; if ( returnedTypes.size() == 0 && scalarTypes.size() == 0 ) { //ie no select clause in HQL returnedTypes = fromTypes; rtsize = returnedTypes.size(); } else { rtsize = returnedTypes.size(); Iterator iter = entitiesToFetch.iterator(); while ( iter.hasNext() ) { returnedTypes.add( iter.next() ); } } int size = returnedTypes.size(); persisters = new Queryable[size]; names = new String[size]; owners = new int[size]; ownerAssociationTypes = new EntityType[size]; suffixes = new String[size]; includeInSelect = new boolean[size]; for ( int i = 0; i < size; i++ ) { String name = ( String ) returnedTypes.get( i ); //if ( !isName(name) ) throw new QueryException("unknown type: " + name); persisters[i] = getEntityPersisterForName( name ); // TODO: cannot use generateSuffixes() - it handles the initial suffix differently. suffixes[i] = ( size == 1 ) ? "" : Integer.toString( i ) + '_'; names[i] = name; includeInSelect[i] = !entitiesToFetch.contains( name ); if ( includeInSelect[i] ) selectLength++; if ( name.equals( collectionOwnerName ) ) collectionOwnerColumn = i; String oneToOneOwner = ( String ) oneToOneOwnerNames.get( name ); owners[i] = ( oneToOneOwner == null ) ? -1 : returnedTypes.indexOf( oneToOneOwner ); ownerAssociationTypes[i] = (EntityType) uniqueKeyOwnerReferences.get( name ); } if ( ArrayHelper.isAllNegative( owners ) ) owners = null; String scalarSelect = renderScalarSelect(); //Must be done here because of side-effect! yuck... int scalarSize = scalarTypes.size(); hasScalars = scalarTypes.size() != rtsize; returnTypes = new Type[scalarSize]; for ( int i = 0; i < scalarSize; i++ ) { returnTypes[i] = ( Type ) scalarTypes.get( i ); } QuerySelect sql = new QuerySelect( getFactory().getDialect() ); sql.setDistinct( distinct ); if ( !shallowQuery ) { renderIdentifierSelect( sql ); renderPropertiesSelect( sql ); } if ( collectionPersister != null ) { sql.addSelectFragmentString( collectionPersister.selectFragment( fetchName, "__" ) ); } if ( hasScalars || shallowQuery ) sql.addSelectFragmentString( scalarSelect ); //TODO: for some dialects it would be appropriate to add the renderOrderByPropertiesSelect() to other select strings mergeJoins( sql.getJoinFragment() ); sql.setWhereTokens( whereTokens.iterator() ); sql.setGroupByTokens( groupByTokens.iterator() ); sql.setHavingTokens( havingTokens.iterator() ); sql.setOrderByTokens( orderByTokens.iterator() ); if ( collectionPersister != null && collectionPersister.hasOrdering() ) { sql.addOrderBy( collectionPersister.getSQLOrderByString( fetchName ) ); } scalarColumnNames = NameGenerator.generateColumnNames( returnTypes, getFactory() ); // initialize the Set of queried identifier spaces (ie. tables) Iterator iter = collections.values().iterator(); while ( iter.hasNext() ) { CollectionPersister p = getCollectionPersister( ( String ) iter.next() ); addQuerySpaces( p.getCollectionSpaces() ); } iter = typeMap.keySet().iterator(); while ( iter.hasNext() ) { Queryable p = getEntityPersisterForName( ( String ) iter.next() ); addQuerySpaces( p.getQuerySpaces() ); } sqlString = sql.toQueryString(); if ( holderClass != null ) holderConstructor = ReflectHelper.getConstructor( holderClass, returnTypes ); if ( hasScalars ) { actualReturnTypes = returnTypes; } else { actualReturnTypes = new Type[selectLength]; int j = 0; for ( int i = 0; i < persisters.length; i++ ) { if ( includeInSelect[i] ) { actualReturnTypes[j++] = TypeFactory.manyToOne( persisters[i].getEntityName(), shallowQuery ); } } } } private void renderIdentifierSelect(QuerySelect sql) { int size = returnedTypes.size(); for ( int k = 0; k < size; k++ ) { String name = ( String ) returnedTypes.get( k ); String suffix = size == 1 ? "" : Integer.toString( k ) + '_'; sql.addSelectFragmentString( persisters[k].identifierSelectFragment( name, suffix ) ); } } /*private String renderOrderByPropertiesSelect() { StringBuffer buf = new StringBuffer(10); //add the columns we are ordering by to the select ID select clause Iterator iter = orderByTokens.iterator(); while ( iter.hasNext() ) { String token = (String) iter.next(); if ( token.lastIndexOf(".") > 0 ) { //ie. it is of form "foo.bar", not of form "asc" or "desc" buf.append(StringHelper.COMMA_SPACE).append(token); } } return buf.toString(); }*/ private void renderPropertiesSelect(QuerySelect sql) { int size = returnedTypes.size(); for ( int k = 0; k < size; k++ ) { String suffix = size == 1 ? "" : Integer.toString( k ) + '_'; String name = ( String ) returnedTypes.get( k ); sql.addSelectFragmentString( persisters[k].propertySelectFragment( name, suffix, false ) ); } } /** * WARNING: side-effecty */ private String renderScalarSelect() { boolean isSubselect = superQuery != null; StringBuffer buf = new StringBuffer( 20 ); if ( scalarTypes.size() == 0 ) { //ie. no select clause int size = returnedTypes.size(); for ( int k = 0; k < size; k++ ) { scalarTypes.add( TypeFactory.manyToOne( persisters[k].getEntityName(), shallowQuery ) ); String[] idColumnNames = persisters[k].getIdentifierColumnNames(); for ( int i = 0; i < idColumnNames.length; i++ ) { buf.append( returnedTypes.get( k ) ).append( '.' ).append( idColumnNames[i] ); if ( !isSubselect ) buf.append( " as " ).append( NameGenerator.scalarName( k, i ) ); if ( i != idColumnNames.length - 1 || k != size - 1 ) buf.append( ", " ); } } } else { //there _was_ a select clause Iterator iter = scalarSelectTokens.iterator(); int c = 0; boolean nolast = false; //real hacky... int parenCount = 0; // used to count the nesting of parentheses while ( iter.hasNext() ) { Object next = iter.next(); if ( next instanceof String ) { String token = ( String ) next; if ( "(".equals( token ) ) { parenCount++; } else if ( ")".equals( token ) ) { parenCount--; } String lc = token.toLowerCase(); if ( lc.equals( ", " ) ) { if ( nolast ) { nolast = false; } else { if ( !isSubselect && parenCount == 0 ) { int x = c++; buf.append( " as " ) .append( NameGenerator.scalarName( x, 0 ) ); } } } buf.append( token ); if ( lc.equals( "distinct" ) || lc.equals( "all" ) ) { buf.append( ' ' ); } } else { nolast = true; String[] tokens = ( String[] ) next; for ( int i = 0; i < tokens.length; i++ ) { buf.append( tokens[i] ); if ( !isSubselect ) { buf.append( " as " ) .append( NameGenerator.scalarName( c, i ) ); } if ( i != tokens.length - 1 ) buf.append( ", " ); } c++; } } if ( !isSubselect && !nolast ) { int x = c++; buf.append( " as " ) .append( NameGenerator.scalarName( x, 0 ) ); } } return buf.toString(); } private void mergeJoins(JoinFragment ojf) throws MappingException, QueryException { Iterator iter = joins.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry me = ( Map.Entry ) iter.next(); String name = ( String ) me.getKey(); JoinSequence join = ( JoinSequence ) me.getValue(); join.setSelector( new JoinSequence.Selector() { public boolean includeSubclasses(String alias) { boolean include = returnedTypes.contains( alias ) && !isShallowQuery(); return include; } } ); if ( typeMap.containsKey( name ) ) { ojf.addFragment( join.toJoinFragment( enabledFilters, true ) ); } else if ( collections.containsKey( name ) ) { ojf.addFragment( join.toJoinFragment( enabledFilters, true ) ); } else { //name from a super query (a bit inelegant that it shows up here) } } } public final Set getQuerySpaces() { return querySpaces; } /** * Is this query called by scroll() or iterate()? * * @return true if it is, false if it is called by find() or list() */ boolean isShallowQuery() { return shallowQuery; } void addQuerySpaces(Serializable[] spaces) { for ( int i = 0; i < spaces.length; i++ ) { querySpaces.add( spaces[i] ); } if ( superQuery != null ) superQuery.addQuerySpaces( spaces ); } void setDistinct(boolean distinct) { this.distinct = distinct; } boolean isSubquery() { return superQuery != null; } /** * Overrides method from Loader */ public CollectionPersister[] getCollectionPersisters() { return collectionPersister == null ? null : new CollectionPersister[] { collectionPersister }; } protected String[] getCollectionSuffixes() { return collectionPersister == null ? null : new String[] { "__" }; } void setCollectionToFetch(String role, String name, String ownerName, String entityName) throws QueryException { fetchName = name; collectionPersister = getCollectionPersister( role ); collectionOwnerName = ownerName; if ( collectionPersister.getElementType().isEntityType() ) { addEntityToFetch( entityName ); } } protected String[] getSuffixes() { return suffixes; } protected String[] getAliases() { return names; } /** * Used for collection filters */ private void addFromAssociation(final String elementName, final String collectionRole) throws QueryException { //q.addCollection(collectionName, collectionRole); QueryableCollection persister = getCollectionPersister( collectionRole ); Type collectionElementType = persister.getElementType(); if ( !collectionElementType.isEntityType() ) { throw new QueryException( "collection of values in filter: " + elementName ); } String[] keyColumnNames = persister.getKeyColumnNames(); //if (keyColumnNames.length!=1) throw new QueryException("composite-key collection in filter: " + collectionRole); String collectionName; JoinSequence join = new JoinSequence( getFactory() ); collectionName = persister.isOneToMany() ? elementName : createNameForCollection( collectionRole ); join.setRoot( persister, collectionName ); if ( !persister.isOneToMany() ) { //many-to-many addCollection( collectionName, collectionRole ); try { join.addJoin( ( AssociationType ) persister.getElementType(), elementName, JoinFragment.INNER_JOIN, persister.getElementColumnNames(collectionName) ); } catch ( MappingException me ) { throw new QueryException( me ); } } join.addCondition( collectionName, keyColumnNames, " = ?" ); //if ( persister.hasWhere() ) join.addCondition( persister.getSQLWhereString(collectionName) ); EntityType elemType = ( EntityType ) collectionElementType; addFrom( elementName, elemType.getAssociatedEntityName(), join ); } String getPathAlias(String path) { return ( String ) pathAliases.get( path ); } JoinSequence getPathJoin(String path) { return ( JoinSequence ) pathJoins.get( path ); } void addPathAliasAndJoin(String path, String alias, JoinSequence joinSequence) { pathAliases.put( path, alias ); pathJoins.put( path, joinSequence ); } public List list(SessionImplementor session, QueryParameters queryParameters) throws HibernateException { return list( session, queryParameters, getQuerySpaces(), actualReturnTypes ); } /** * Return the query results as an iterator */ public Iterator iterate(QueryParameters queryParameters, EventSource session) throws HibernateException { boolean stats = session.getFactory().getStatistics().isStatisticsEnabled(); long startTime = 0; if ( stats ) startTime = System.currentTimeMillis(); try { PreparedStatement st = prepareQueryStatement( queryParameters, false, session ); ResultSet rs = getResultSet( st, queryParameters.hasAutoDiscoverScalarTypes(), false, queryParameters.getRowSelection(), session ); HolderInstantiator hi = HolderInstantiator.createClassicHolderInstantiator(holderConstructor, queryParameters.getResultTransformer()); Iterator result = new IteratorImpl( rs, st, session, returnTypes, getColumnNames(), hi ); if ( stats ) { session.getFactory().getStatisticsImplementor().queryExecuted( "HQL: " + queryString, 0, System.currentTimeMillis() - startTime ); } return result; } catch ( SQLException sqle ) { throw JDBCExceptionHelper.convert( getFactory().getSQLExceptionConverter(), sqle, "could not execute query using iterate", getSQLString() ); } } public int executeUpdate(QueryParameters queryParameters, SessionImplementor session) throws HibernateException { throw new UnsupportedOperationException( "Not supported! Use the AST translator..."); } protected Object getResultColumnOrRow(Object[] row, ResultTransformer transformer, ResultSet rs, SessionImplementor session) throws SQLException, HibernateException { row = toResultRow( row ); if ( hasScalars ) { String[][] scalarColumns = getColumnNames(); int queryCols = returnTypes.length; if ( holderClass == null && queryCols == 1 ) { return returnTypes[0].nullSafeGet( rs, scalarColumns[0], session, null ); } else { row = new Object[queryCols]; for ( int i = 0; i < queryCols; i++ ) row[i] = returnTypes[i].nullSafeGet( rs, scalarColumns[i], session, null ); return row; } } else if ( holderClass == null ) { return row.length == 1 ? row[0] : row; } else { return row; } } protected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException { if ( holderClass != null ) { for ( int i = 0; i < results.size(); i++ ) { Object[] row = ( Object[] ) results.get( i ); try { results.set( i, holderConstructor.newInstance( row ) ); } catch ( Exception e ) { throw new QueryException( "could not instantiate: " + holderClass, e ); } } } return results; } private Object[] toResultRow(Object[] row) { if ( selectLength == row.length ) { return row; } else { Object[] result = new Object[selectLength]; int j = 0; for ( int i = 0; i < row.length; i++ ) { if ( includeInSelect[i] ) result[j++] = row[i]; } return result; } } void setHolderClass(Class clazz) { holderClass = clazz; } protected LockMode[] getLockModes(Map lockModes) { // unfortunately this stuff can't be cached because // it is per-invocation, not constant for the // QueryTranslator instance HashMap nameLockModes = new HashMap(); if ( lockModes != null ) { Iterator iter = lockModes.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry me = ( Map.Entry ) iter.next(); nameLockModes.put( getAliasName( ( String ) me.getKey() ), me.getValue() ); } } LockMode[] lockModeArray = new LockMode[names.length]; for ( int i = 0; i < names.length; i++ ) { LockMode lm = ( LockMode ) nameLockModes.get( names[i] ); if ( lm == null ) lm = LockMode.NONE; lockModeArray[i] = lm; } return lockModeArray; } protected String applyLocks(String sql, Map lockModes, Dialect dialect) throws QueryException { // can't cache this stuff either (per-invocation) final String result; if ( lockModes == null || lockModes.size() == 0 ) { result = sql; } else { Map aliasedLockModes = new HashMap(); Iterator iter = lockModes.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry me = ( Map.Entry ) iter.next(); aliasedLockModes.put( getAliasName( ( String ) me.getKey() ), me.getValue() ); } Map keyColumnNames = null; if ( dialect.forUpdateOfColumns() ) { keyColumnNames = new HashMap(); for ( int i = 0; i < names.length; i++ ) { keyColumnNames.put( names[i], persisters[i].getIdentifierColumnNames() ); } } result = dialect.applyLocksToSql( sql, aliasedLockModes, keyColumnNames ); } logQuery( queryString, result ); return result; } protected boolean upgradeLocks() { return true; } protected int[] getCollectionOwners() { return new int[] { collectionOwnerColumn }; } protected boolean isCompiled() { return compiled; } public String toString() { return queryString; } protected int[] getOwners() { return owners; } protected EntityType[] getOwnerAssociationTypes() { return ownerAssociationTypes; } public Class getHolderClass() { return holderClass; } public Map getEnabledFilters() { return enabledFilters; } public ScrollableResults scroll(final QueryParameters queryParameters, final SessionImplementor session) throws HibernateException { HolderInstantiator hi = HolderInstantiator.createClassicHolderInstantiator(holderConstructor, queryParameters.getResultTransformer()); return scroll( queryParameters, returnTypes, hi, session ); } public String getQueryIdentifier() { return queryIdentifier; } protected boolean isSubselectLoadingEnabled() { return hasSubselectLoadableCollections(); } public void validateScrollability() throws HibernateException { // This is the legacy behaviour for HQL queries... if ( getCollectionPersisters() != null ) { throw new HibernateException( "Cannot scroll queries which initialize collections" ); } } public boolean containsCollectionFetches() { return false; } public boolean isManipulationStatement() { // classic parser does not support bulk manipulation statements return false; } public ParameterTranslations getParameterTranslations() { return new ParameterTranslations() { public boolean supportsOrdinalParameterMetadata() { // classic translator does not support collection of ordinal // param metadata return false; } public int getOrdinalParameterCount() { return 0; // not known! } public int getOrdinalParameterSqlLocation(int ordinalPosition) { return 0; // not known! } public Type getOrdinalParameterExpectedType(int ordinalPosition) { return null; // not known! } public Set getNamedParameterNames() { return namedParameters.keySet(); } public int[] getNamedParameterSqlLocations(String name) { return getNamedParameterLocs( name ); } public Type getNamedParameterExpectedType(String name) { return null; // not known! } }; } }

The table below shows all metrics for QueryTranslatorImpl.java.

MetricValueDescription
BLOCKS199.00Number of blocks
BLOCK_COMMENT39.00Number of block comment lines
COMMENTS136.00Comment lines
COMMENT_DENSITY 0.20Comment density
COMPARISONS103.00Number of comparison operators
CYCLOMATIC220.00Cyclomatic complexity
DECL_COMMENTS16.00Comments in declarations
DOC_COMMENT74.00Number of javadoc comment lines
ELOC679.00Effective lines of code
EXEC_COMMENTS20.00Comments in executable code
EXITS146.00Procedure exits
FUNCTIONS101.00Number of function declarations
HALSTEAD_DIFFICULTY91.12Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY260.00Interface complexity
JAVA0001 0.00JAVA0001 Package name does not contain only lower case letters
JAVA0002 0.00JAVA0002 Package name does not begin with a top level domain name or country code
JAVA0003 0.00JAVA0003 Minimize use of on-demand (.*) imports
JAVA0004 0.00JAVA0004 Unnecessary import from java.lang
JAVA0005 1.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 0.00JAVA0007 Should not declare public field
JAVA0008 0.00JAVA0008 Empty catch block
JAVA0009 0.00JAVA0009 Protected member in final class
JAVA0010 0.00JAVA0010 Non-instantiable class does not contain a non-private static member
JAVA0011 0.00JAVA0011 Abstract class does not contain an abstract method
JAVA0012 0.00JAVA0012 Non-constructor method with same name as declaring class
JAVA0013 0.00JAVA0013 Non-blank final field is not static
JAVA0014 0.00JAVA0014 Class with only static members has non-private constructor
JAVA0015 0.00JAVA0015 Package class contains public nested type
JAVA0016 0.00JAVA0016 Abstract class contains public constructor
JAVA0017 0.00JAVA0017 Class name does not have required form
JAVA0018 0.00JAVA0018 Method name does not have required form
JAVA0019 0.00JAVA0019 Interface name does not have required form
JAVA0020 0.00JAVA0020 Field name does not have required form
JAVA0021 0.00JAVA0021 Interface method name does not have required form
JAVA0022 0.00JAVA0022 Static final field name does not have required form
JAVA0023 0.00JAVA0023 Empty finalize method
JAVA0024 0.00JAVA0024 Empty class
JAVA0025 0.00JAVA0025 Method override is empty
JAVA0026 0.00JAVA0026 Finalize method with parameters
JAVA0029 0.00JAVA0029 Private method not used
JAVA0030 0.00JAVA0030 Private field not used
JAVA0031 0.00JAVA0031 Case statement not properly closed
JAVA0032 0.00JAVA0032 Switch statement missing default
JAVA0033 0.00JAVA0033 default: not last case in switch statement
JAVA003419.00JAVA0034 Missing braces in if statement
JAVA0035 1.00JAVA0035 Missing braces in for statement
JAVA0036 0.00JAVA0036 Missing braces in while statement
JAVA0038 0.00JAVA0038 Non-case label in switch statement
JAVA0039 0.00JAVA0039 Break statement with label
JAVA0040 0.00JAVA0040 Switch statement contains N cases (maximum: M)
JAVA0041 0.00JAVA0041 Nested synchronized block
JAVA0042 0.00JAVA0042 Empty synchronized statement
JAVA0043 0.00JAVA0043 Inner class does not use outer class
JAVA0044 0.00JAVA0044 Serializable class with no instance variables
JAVA0045 0.00JAVA0045 Serializable class with only transient fields
JAVA0046 0.00JAVA0046 Name of class not derived from Exception ends with 'Exception'
JAVA0047 0.00JAVA0047 Serializable class derives from invalid base class
JAVA0048 0.00JAVA0048 Name of class derived from Exception does not end with 'Exception'
JAVA0049 3.00JAVA0049 Nested block at depth N (maximum: M)
JAVA0050 0.00JAVA0050 Class derives from java.lang.Error
JAVA0051 0.00JAVA0051 Class derives from java.lang.RuntimeException
JAVA0052 0.00JAVA0052 Class derives from java.lang.Throwable
JAVA0053 0.00JAVA0053 Unused label
JAVA0054 0.00JAVA0054 Inheritance depth N exceeds maximum M
JAVA0055 0.00JAVA0055 Class should be interface
JAVA0056 0.00JAVA0056 Unnecessary abstract modifier for interface or annotation
JAVA0057 0.00JAVA0057 Unnecessary default constructor
JAVA0058 0.00JAVA0058 Constructor calls super()
JAVA0059 0.00JAVA0059 Method override only calls super()
JAVA0061 0.00JAVA0061 Inaccessible member in anonymous class
JAVA0062 0.00JAVA0062 Public class missing public member or protected constructor
JAVA0063 0.00JAVA0063 Identifier name should not contain '$'
JAVA0064 1.00JAVA0064 N variations of identifier name (maximum: M)
JAVA0065 0.00JAVA0065 Unnecessary final modifier for method in final class
JAVA0066 0.00JAVA0066 Unnecessary modifier for interface nested type
JAVA0067 0.00JAVA0067 Array descriptor on identifier name
JAVA0068 0.00JAVA0068 Modifiers not declared in recommended order
JAVA0071 0.00JAVA0071 Strings compared with ==
JAVA0073 0.00JAVA0073 Integer division in floating-point context
JAVA0074 0.00JAVA0074 Use of Object.notify()
JAVA0075 0.00JAVA0075 Method parameter hides field
JAVA0076 0.00JAVA0076 Use of magic number
JAVA0077 0.00JAVA0077 Private field not used in declaring class
JAVA0078 0.00JAVA0078 Floating point values compared with ==
JAVA0079 0.00JAVA0079 Use of instance to reference static member
JAVA0080 0.00JAVA0080 Import declaration not used
JAVA0081 0.00JAVA0081 Boolean literal in comparison
JAVA0082 0.00JAVA0082 Unnecessary widening cast
JAVA0083 0.00JAVA0083 Unnecessary instanceof test
JAVA0084 0.00JAVA0084 Should use compound assignment operator
JAVA0085 0.00JAVA0085 Use of sun.* class
JAVA0087 0.00JAVA0087 Use of Thread.sleep()
JAVA0089 0.00JAVA0089 Use of restricted package
JAVA0092 0.00JAVA0092 Use of restricted type
JAVA0093 0.00JAVA0093 Redundant assignment
JAVA0094 0.00JAVA0094 Field hides a superclass field
JAVA0095 0.00JAVA0095 Uninitialized private field
JAVA0096 0.00JAVA0096 Field in nested class hides outer field
JAVA0098 0.00JAVA0098 Minimize use of implicit field initializers
JAVA0100 1.00JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0101 0.00JAVA0101 Unnecessary modifier for field in interface
JAVA0102 0.00JAVA0102 Last statement in finalize() not super.finalize()
JAVA0103 0.00JAVA0103 Explicit call to finalize()
JAVA0104 0.00JAVA0104 finalize() only calls super.finalize()
JAVA0105 0.00JAVA0105 Duplicate import declaration
JAVA0106 0.00JAVA0106 Unnecessary import from current package
JAVA0108 2.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 3.00JAVA0110 Incorrect javadoc: no @return tag
JAVA0111 0.00JAVA0111 Incorrect javadoc: @return tag for void method
JAVA0112 0.00JAVA0112 Incorrect javadoc: no exception 'exception' in throws
JAVA0113 1.00JAVA0113 Incorrect javadoc: no @author tag
JAVA0114 1.00JAVA0114 Incorrect javadoc: no @version tag
JAVA0115 6.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 0.00JAVA0116 Missing javadoc: field 'field'
JAVA0117 3.00JAVA0117 Missing javadoc: method 'method'
JAVA0118 0.00JAVA0118 Missing javadoc: type 'type'
JAVA0119 0.00JAVA0119 Control variable changed within body of for loop
JAVA0123 0.00JAVA0123 Use all three components of for loop
JAVA0125 0.00JAVA0125 Continue statement with label
JAVA012633.00JAVA0126 Method declares unchecked exception in throws
JAVA0128 0.00JAVA0128 Public constructor in non-public class
JAVA0130 0.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 0.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 0.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 1.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 0.00JAVA0137 Non-abstract class missing constructor
JAVA0138 0.00JAVA0138 N parameters defined for method (maximum: M)
JAVA0139 0.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA0141 0.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 2.00JAVA0143 Synchronized method
JAVA0144 3.00JAVA0144 Line exceeds maximum M characters
JAVA01452105.00JAVA0145 Tab character used in source file
JAVA0150 0.00JAVA0150 java.lang.Error (or subclass) thrown
JAVA0153 0.00JAVA0153 Inefficient conversion of integer to string
JAVA0159 0.00JAVA0159 Inefficient conversion of string to integer
JAVA0160 0.00JAVA0160 Method does not throw specified exception
JAVA0161 0.00JAVA0161 Conditional wait() not in loop
JAVA0163 0.00JAVA0163 Empty statement
JAVA0165 0.00JAVA0165 Conflicting return statement in finally block
JAVA0166 4.00JAVA0166 Generic exception caught
JAVA0167 0.00JAVA0167 ThreadDeath not rethrown
JAVA0169 0.00JAVA0169 Unnecessary catch block: exception 'exception'
JAVA0170 0.00JAVA0170 Caught exception not derived from java.lang.Exception
JAVA0171 0.00JAVA0171 Unused local variable
JAVA0173 0.00JAVA0173 Unused method parameter
JAVA0174 1.00JAVA0174 Assigned local variable never used
JAVA0175 0.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA0177 3.00JAVA0177 Variable declaration missing initializer
JAVA0179 0.00JAVA0179 Local variable hides visible field
JAVA0233 0.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 0.00JAVA0234 Class is Serializable but does not define serialVersionUID
JAVA0235 0.00JAVA0235 Class defines serialVersionUID but does not implement Serializable
JAVA0236 0.00JAVA0236 Attempt to clone an object which does not implement Cloneable
JAVA0237 0.00JAVA0237 Class implements Cloneable but does not have public clone method
JAVA0238 0.00JAVA0238 Clone method does not call super.clone()
JAVA0239 0.00JAVA0239 Class declares 'readObject' or 'writeObject' but does not implement Serializable
JAVA0240 0.00JAVA0240 Serializable class which declares readObject or writeObject but not both
JAVA0241 0.00JAVA0241 'readObject' or 'writeObject' should be declared private in Serializable class
JAVA0242 0.00JAVA0242 Transient field in non-Serializable class
JAVA0243 0.00JAVA0243 'readResolve' or 'writeReplace' should be declared private or protected
JAVA0244 0.00JAVA0244 Field or method name in subclass differs only by case from inherited field or method
JAVA0245 0.00JAVA0245 JUnit TestCase with non-trivial constructor
JAVA0246 0.00JAVA0246 JUnit assertXXX statement missing message parameter
JAVA0247 0.00JAVA0247 JUnit 'setUp()' and 'tearDown()' should call super method
JAVA0248 0.00JAVA0248 JUnit method 'setUp' or 'tearDown' with incorrect signature
JAVA0249 0.00JAVA0249 JUnit TestCase 'suite()' should be declared static
JAVA0250 0.00JAVA0250 JUnit TestCase declares testXXX method with incorrect signature
JAVA0251 0.00JAVA0251 Use '%n' for line breaks in printf/format for platform independence
JAVA0252 0.00JAVA0252 'enum' is a Java 1.5 reserved word
JAVA0253 0.00JAVA0253 Not all enum constants consumed in switch statement
JAVA0254 5.00JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0255 0.00JAVA0255 Result of method invocation not used
JAVA0256 0.00JAVA0256 Assignment of external collection/array to field
JAVA0257 0.00JAVA0257 Use of 'Constant Interface' anti-pattern
JAVA0258 1.00JAVA0258 Implement Iterable for foreach compatibility
JAVA0259 9.00JAVA0259 Return of collection/array field
JAVA0260 0.00JAVA0260 Use 'enum' instead of Enumerated Type pattern
JAVA0261 0.00JAVA0261 Use specialized Enum collection types
JAVA0262 0.00JAVA0262 Use of char in integer context
JAVA0263 0.00JAVA0263 Long literal ends with 'l' instead of 'L'
JAVA0264 0.00JAVA0264 Integer math in long context - check for overflow
JAVA0265 1.00JAVA0265 Use of Throwable.printStackTrace()
JAVA0266 0.00JAVA0266 Use of System.out
JAVA0267 0.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 1.00JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0271 0.00JAVA0271 Minimize use of on-demand (.*) static imports
JAVA0272 0.00JAVA0272 Thread.run() called
JAVA0273 0.00JAVA0273 Non-final derivative of Thread calls start() in constructor
JAVA0274 0.00JAVA0274 Serializable class has a synchronized readObject()
JAVA0275 0.00JAVA0275 Serializable class has a synchronized writeObject() and no other synchronized methods
JAVA0276 0.00JAVA0276 Unnecessary use of String constructor
JAVA0277 0.00JAVA0277 Iterator.next() implementation does not throw NoSuchElementException
JAVA0278 0.00JAVA0278 Unnecessary use of Boolean constructor
JAVA0279 0.00JAVA0279 Serialization method readObject or readObjectNoData calls an overridable method
JAVA0280 0.00JAVA0280 IllegalMonitorStateException caught
JAVA0281 0.00JAVA0281 Iterator.next() not called in loop
JAVA0282 0.00JAVA0282 Call to Iterator.next() in loop which does not test Iterator.hasNext()
JAVA0283 0.00JAVA0283 Control variable not updated in loop body
JAVA0284 0.00JAVA0284 Explicit garbage collection
JAVA0285 0.00JAVA0285 Dereference of potentially null variable
JAVA0286 0.00JAVA0286 Dereference of null variable
JAVA0287 0.00JAVA0287 Unnecessary null check
JAVA0288 0.00JAVA0288 Inconsistent null check
LINES1184.00Number of lines in the source file
LINE_COMMENT23.00Number of line comments
LOC879.00Lines of code
LOGICAL_LINES455.00Number of statements
LOOPS21.00Number of loops
NEST_DEPTH 7.00Maximum nesting depth
OPERANDS2070.00Number of operands
OPERATORS3796.00Number of operators
PARAMS105.00Number of formal parameter declarations
PROGRAM_LENGTH5866.00Halstead program length
PROGRAM_VOCAB655.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS155.00Number of return points from functions
SIZE34923.00Size of the file in bytes
UNIQUE_OPERANDS602.00Number of unique operands
UNIQUE_OPERATORS53.00Number of unique operators
WHITESPACE169.00Number of whitespace lines