Java Code Examples for org.eclipse.xtext.common.types.JvmDoubleAnnotationValue#getValues()

The following examples show how to use org.eclipse.xtext.common.types.JvmDoubleAnnotationValue#getValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdtBasedTypeFactory.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private JvmAnnotationValue createDoubleAnnotationValue(Object value) {
	JvmDoubleAnnotationValue annotationValue = TypesFactory.eINSTANCE.createJvmDoubleAnnotationValue();
	if (value != null) {
		@SuppressWarnings("unchecked")
		InternalEList<Object> values = (InternalEList<Object>)(InternalEList<?>)annotationValue.getValues();
		if (value instanceof Object[]) {
			for (Object element : (Object[])value) {
				if (element instanceof Double) {
					values.addUnique(element);
				} else if (element != null) {
					values.addUnique(((Number)element).doubleValue());
				}
			}
		} else if (value instanceof Double) {
			values.addUnique(value);
		} else if (value instanceof Number) {
			values.addUnique(((Number)value).doubleValue());
		}
	}
	return annotationValue;
}
 
Example 2
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _setValue(final JvmDoubleAnnotationValue it, final float[] value, final String componentType, final boolean mustBeArray) {
  final Consumer<Float> _function = (Float v) -> {
    EList<Double> _values = it.getValues();
    _values.add(Double.valueOf(((double) (v).floatValue())));
  };
  ((List<Float>)Conversions.doWrapArray(value)).forEach(_function);
}
 
Example 3
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _setValue(final JvmDoubleAnnotationValue it, final long[] value, final String componentType, final boolean mustBeArray) {
  final Consumer<Long> _function = (Long v) -> {
    EList<Double> _values = it.getValues();
    _values.add(Double.valueOf(((double) (v).longValue())));
  };
  ((List<Long>)Conversions.doWrapArray(value)).forEach(_function);
}
 
Example 4
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _setValue(final JvmDoubleAnnotationValue it, final int[] value, final String componentType, final boolean mustBeArray) {
  final Consumer<Integer> _function = (Integer v) -> {
    EList<Double> _values = it.getValues();
    _values.add(Double.valueOf(((double) (v).intValue())));
  };
  ((List<Integer>)Conversions.doWrapArray(value)).forEach(_function);
}
 
Example 5
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _setValue(final JvmDoubleAnnotationValue it, final short[] value, final String componentType, final boolean mustBeArray) {
  final Consumer<Short> _function = (Short v) -> {
    EList<Double> _values = it.getValues();
    _values.add(Double.valueOf(((double) (v).shortValue())));
  };
  ((List<Short>)Conversions.doWrapArray(value)).forEach(_function);
}
 
Example 6
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _setValue(final JvmDoubleAnnotationValue it, final byte[] value, final String componentType, final boolean mustBeArray) {
  final Consumer<Byte> _function = (Byte v) -> {
    EList<Double> _values = it.getValues();
    _values.add(Double.valueOf(((double) (v).byteValue())));
  };
  ((List<Byte>)Conversions.doWrapArray(value)).forEach(_function);
}
 
Example 7
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
protected void _setValue(final JvmDoubleAnnotationValue it, final char[] value, final String componentType, final boolean mustBeArray) {
  final Consumer<Character> _function = (Character v) -> {
    EList<Double> _values = it.getValues();
    _values.add(Double.valueOf(((double) (v).charValue())));
  };
  ((List<Character>)Conversions.doWrapArray(value)).forEach(_function);
}
 
Example 8
Source File: AnnotationReferenceBuildContextImpl.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
protected void _setValue(final JvmDoubleAnnotationValue it, final double[] value, final String componentType, final boolean mustBeArray) {
  EList<Double> _values = it.getValues();
  Iterables.<Double>addAll(_values, ((Iterable<? extends Double>)Conversions.doWrapArray(value)));
}