/*
(non-Javadoc)

@see mtas.codec.util.collector.MtasDataItem#getCompareValueType()
969739
public final int getCompareValueType() throws IOException {
    switch (sortType) {
    case CodecUtil.STATS_TYPE_N:
      return 0;
    case CodecUtil.STATS_TYPE_SUM:
      return 1;
    case CodecUtil.STATS_TYPE_MEAN:
      return 2;
    default:
      throw new IOException("sortType " + sortType + " not supported");
    }
  }
1219593
public Object getAdapterInstance() {
        if (mAdapterInstance == null) {
            try {
                mAdapterInstance = mConstructor.newInstance
                    (mEnclosingType, mPropertyName, mAnnotation.getAnnotation());
            } catch (Exception e) {
                ThrowUnchecked.fireFirstDeclaredCause(e);
            }
        }
        return mAdapterInstance;
    }
681519
public String getAccuracy() {
    if (Measure_Type.featOkTst && ((Measure_Type)jcasType).casFeat_accuracy == null)
      jcasType.jcas.throwFeatMissing("accuracy", "ch.epfl.bbp.uima.types.Measure");
    return jcasType.ll_cas.ll_getStringValue(addr, ((Measure_Type)jcasType).casFeatCode_accuracy);}
1373918
public String getType() {
		if (this.type == null)
			this.type = this.resultHandler.getRelationType(getId(), this.rowIndex);
		return this.type;
	}
404759
@Override
    public int compareTo(Object o) {
        if (o instanceof ICpe) {
            ICpe otherObject = (ICpe) o;

            final int before = -1;
            final int equal = 0;
            final int after = 1;

            if (this == otherObject) {
                return equal;
            }
            int r = getPart().getAbbreviation().compareTo(otherObject.getPart().getAbbreviation());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getVendor().compareTo(otherObject.getVendor());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getProduct().compareTo(otherObject.getProduct());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = compareVersions(getVersion(), otherObject.getVersion());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getUpdate().compareTo(otherObject.getUpdate());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getEdition().compareTo(otherObject.getEdition());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getLanguage().compareTo(otherObject.getLanguage());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getSwEdition().compareTo(otherObject.getSwEdition());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getTargetSw().compareTo(otherObject.getTargetSw());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getTargetHw().compareTo(otherObject.getTargetHw());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getOther().compareTo(otherObject.getOther());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            return equal;
        }
        throw new RuntimeException("Unable to compare " + o.getClass().getCanonicalName());
    }
1236324
@Override
    public int compareTo(ComparableMethod rhs) {
        if (rhs instanceof MethodDescriptor) {
            return FieldOrMethodDescriptor.compareTo(this, (MethodDescriptor) rhs);
        }

        if (rhs instanceof XMethod) {
            return XFactory.compare((XMethod) this, (XMethod) rhs);
        }

        throw new ClassCastException("Can't compare a " + this.getClass().getName() + " to a " + rhs.getClass().getName());
    }
138556
private Comparator<VarBindingDef> byUsage( final VarTupleSet varTupleSet)
    {
    return
      new Comparator<VarBindingDef>()
        {
        public int compare( VarBindingDef binding1, VarBindingDef binding2)
          {
          // Compare by usage score: higher score is preferred.
          int resultScore = getScore( binding2).compareTo( getScore( binding1));
          return
            // If equal usage score...
            resultScore == 0
            // ...then compare lexigraphically
            ? varBindingDefSorter_.compare( binding1, binding2)
            : resultScore;
          }

        private Integer getScore( VarBindingDef binding)
          {
          Integer score = bindingScores_.get( binding);
          if( score == null)
            {
            // Preferred higher "unused-ness" and lower "used-ness" (especially among once-only tuples)
            int maxScore = 1000;
            int unusedScore = (int) (varTupleSet.getUnusedScore( binding) * maxScore);
            int usedScore = (int) ((1.0 - varTupleSet.getUsedScore( binding)) * (maxScore - 1));
            int usedOnceScore = (int) ((1.0 - varTupleSet.getUsedOnceScore( binding)) * (maxScore - 1));
            score = ((unusedScore * maxScore) + usedOnceScore) * maxScore + usedScore;
            bindingScores_.put( binding, score);
            }
          
          return score;
          }
        private Map<VarBindingDef,Integer> bindingScores_ = new HashMap<VarBindingDef,Integer>();
      };
    }
1291607
public static String getTypeQualifiedName(TypeMirror type) throws CodeGenerationIncompleteException
	{
		if(type.toString().equals("<any>")) {
			throw new CodeGenerationIncompleteException("Type reported as <any> is likely a not-yet " +
				"generated parameterized type.");
		}

		switch( type.getKind() )
		{
			case ARRAY:
				return getTypeQualifiedName( ((ArrayType) type).getComponentType() ) + "[]";
			case BOOLEAN:
				return "boolean";
			case BYTE:
				return "byte";
			case CHAR:
				return "char";
			case DOUBLE:
				return "double";
			case FLOAT:
				return "float";
			case INT:
				return "int";
			case LONG:
				return "long";
			case SHORT:
				return "short";
			case DECLARED:
				StringBuilder b = new StringBuilder();
				b.append( ((TypeElement) ((DeclaredType) type).asElement()).getQualifiedName().toString() );
				if( !((DeclaredType) type).getTypeArguments().isEmpty() )
				{
					b.append( "<" );
					boolean addComa = false;
					for( TypeMirror pType : ((DeclaredType) type).getTypeArguments() )
					{
						if( addComa )
							b.append( ", " );
						else
							addComa = true;
						b.append( getTypeQualifiedName( pType ) );
					}
					b.append( ">" );
				}
				return b.toString();
			default:
				return type.toString();
		}
	}
627764
public MtasDataItemNumberComparator<Double> getCompareValue2() {
    switch (sortType) {
    case CodecUtil.STATS_TYPE_MEAN:
      return new MtasDataItemNumberComparator<Double>(getValue(sortType),
          sortDirection);
    default:
      return null;
    }
  }
616923
public static Comparator<CmsAliasTableRow> getComparator() {

        return new Comparator<CmsAliasTableRow>() {

            public int compare(CmsAliasTableRow o1, CmsAliasTableRow o2) {

                String err1 = getValueInternal(o1);
                String err2 = getValueInternal(o2);
                if ((err1 == null) && (err2 == null)) {
                    return 0;
                }
                if (err1 == null) {
                    return -1;
                }
                if (err2 == null) {
                    return 1;
                }
                return 0;
            }
        };
    }
648711
@Override
    public int compareTo(final MethodInfo other) {
        final int diff0 = declaringClassName.compareTo(other.declaringClassName);
        if (diff0 != 0) {
            return diff0;
        }
        final int diff1 = name.compareTo(other.name);
        if (diff1 != 0) {
            return diff1;
        }
        return typeDescriptorStr.compareTo(other.typeDescriptorStr);
    }
436634
@Override
    public final Reliability getReplyReliability() {
        Byte rType = (Byte) getApi().getField(JsApiAccess.REPLYRELIABILITY_VALUE);
        /* If set, return the corresponding Reliability instance */
        return (rType == null) ? null : Reliability.getReliability(rType);
    }
673622
public int compareTo(Version v) {
        if (this == v)
            return 0;
        int diff = major - v.major;
        if (diff != 0)
            return diff;
        diff = minor - v.minor;
        if (diff != 0)
            return diff;
        diff = micro - v.micro;
        if (diff != 0)
            return diff;
        return qualifier.compareTo(v.qualifier);
    }
1055810
public JvmTypeReference inferredType() {
		XComputedTypeReference result = xtypesFactory.createXComputedTypeReference();
		result.setTypeProvider(new InferredTypeIndicator(null));
		return result;
	}
581353
@Override
    public Object getParameterType(String name) {
        if (name.equals("checkAromaticity")) return Boolean.TRUE;
        return null;
    }
1146868
@Override
    public int compareTo(MimeType other) {
        int comp = getType().compareToIgnoreCase(other.getType());
        if (comp != 0) {
            return comp;
        }
        comp = getSubtype().compareToIgnoreCase(other.getSubtype());
        if (comp != 0) {
            return comp;
        }
        comp = getParameters().size() - other.getParameters().size();
        if (comp != 0) {
            return comp;
        }
        TreeSet<String> thisAttributes = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
        thisAttributes.addAll(getParameters().keySet());
        TreeSet<String> otherAttributes = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
        otherAttributes.addAll(other.getParameters().keySet());
        Iterator<String> thisAttributesIterator = thisAttributes.iterator();
        Iterator<String> otherAttributesIterator = otherAttributes.iterator();
        while (thisAttributesIterator.hasNext()) {
            String thisAttribute = thisAttributesIterator.next();
            String otherAttribute = otherAttributesIterator.next();
            comp = thisAttribute.compareToIgnoreCase(otherAttribute);
            if (comp != 0) {
                return comp;
            }
            String thisValue = getParameters().get(thisAttribute);
            String otherValue = other.getParameters().get(otherAttribute);
            if (otherValue == null) {
                otherValue = "";
            }
            comp = thisValue.compareTo(otherValue);
            if (comp != 0) {
                return comp;
            }
        }
        return 0;
    }
980147
public static CellNameType getIndexComparator(CFMetaData baseMetadata, ColumnDefinition cfDef)
    {
        if (cfDef.type.isCollection() && cfDef.type.isMultiCell())
        {
            switch (((CollectionType)cfDef.type).kind)
            {
                case LIST:
                    return CompositesIndexOnCollectionValue.buildIndexComparator(baseMetadata, cfDef);
                case SET:
                    return CompositesIndexOnCollectionKey.buildIndexComparator(baseMetadata, cfDef);
                case MAP:
                    return cfDef.hasIndexOption(SecondaryIndex.INDEX_KEYS_OPTION_NAME)
                         ? CompositesIndexOnCollectionKey.buildIndexComparator(baseMetadata, cfDef)
                         : CompositesIndexOnCollectionValue.buildIndexComparator(baseMetadata, cfDef);
            }
        }

        switch (cfDef.kind)
        {
            case CLUSTERING_COLUMN:
                return CompositesIndexOnClusteringKey.buildIndexComparator(baseMetadata, cfDef);
            case REGULAR:
                return CompositesIndexOnRegular.buildIndexComparator(baseMetadata, cfDef);
            case PARTITION_KEY:
                return CompositesIndexOnPartitionKey.buildIndexComparator(baseMetadata, cfDef);
            //case COMPACT_VALUE:
            //    return CompositesIndexOnCompactValue.buildIndexComparator(baseMetadata, cfDef);
        }
        throw new AssertionError();
    }