idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
20,000 | public static Object extract ( final DeviceAttribute deviceAttributeRead ) throws DevFailed { Object argout = null ; if ( deviceAttributeRead . getDimX ( ) != 1 || deviceAttributeRead . getDimY ( ) != 0 ) { argout = extractArray ( deviceAttributeRead ) ; } else { switch ( deviceAttributeRead . getType ( ) ) { case TangoConst . Tango_DEV_SHORT : argout = Short . valueOf ( deviceAttributeRead . extractShort ( ) ) ; break ; case TangoConst . Tango_DEV_USHORT : argout = Integer . valueOf ( deviceAttributeRead . extractUShort ( ) ) . shortValue ( ) ; break ; case TangoConst . Tango_DEV_CHAR : // VH : a char correspond to a Byte in java // but deviceAttribute doesn't have a extractchar method !!! Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "out type Tango_DEV_CHAR not supported" , "AttributeHelper.extract(deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_UCHAR : argout = Short . valueOf ( deviceAttributeRead . extractUChar ( ) ) . shortValue ( ) ; break ; case TangoConst . Tango_DEV_LONG : argout = Integer . valueOf ( deviceAttributeRead . extractLong ( ) ) ; break ; case TangoConst . Tango_DEV_ULONG : argout = Long . valueOf ( deviceAttributeRead . extractULong ( ) ) ; break ; case TangoConst . Tango_DEV_LONG64 : argout = Long . valueOf ( deviceAttributeRead . extractLong64 ( ) ) ; break ; case TangoConst . Tango_DEV_ULONG64 : argout = Long . valueOf ( deviceAttributeRead . extractULong64 ( ) ) ; break ; case TangoConst . Tango_DEV_INT : argout = Integer . valueOf ( deviceAttributeRead . extractLong ( ) ) ; break ; case TangoConst . Tango_DEV_FLOAT : argout = Float . valueOf ( deviceAttributeRead . extractFloat ( ) ) ; break ; case TangoConst . Tango_DEV_DOUBLE : argout = Double . valueOf ( deviceAttributeRead . extractDouble ( ) ) ; break ; case TangoConst . Tango_DEV_STRING : argout = deviceAttributeRead . extractString ( ) ; break ; case TangoConst . Tango_DEV_BOOLEAN : argout = Boolean . valueOf ( deviceAttributeRead . extractBoolean ( ) ) ; break ; case TangoConst . Tango_DEV_STATE : argout = deviceAttributeRead . extractDevState ( ) ; break ; default : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + deviceAttributeRead . getType ( ) + " not supported" , "AttributeHelper.extract(Short value,deviceAttributeWritten)" ) ; break ; } } return argout ; } | Extract data from DeviceAttribute to an Object | 666 | 9 |
20,001 | public static Short extractToShort ( final DeviceAttribute deviceAttributeRead ) throws DevFailed { final Object value = AttributeHelper . extract ( deviceAttributeRead ) ; Short argout = null ; if ( value instanceof Short ) { argout = ( Short ) value ; } else if ( value instanceof String ) { try { argout = Short . valueOf ( ( String ) value ) ; } catch ( final Exception e ) { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value + " is not a numerical" , "AttributeHelper.extractToShort(deviceAttributeWritten)" ) ; } } else if ( value instanceof Integer ) { argout = Short . valueOf ( ( ( Integer ) value ) . shortValue ( ) ) ; } else if ( value instanceof Long ) { argout = Short . valueOf ( ( ( Long ) value ) . shortValue ( ) ) ; } else if ( value instanceof Float ) { argout = Short . valueOf ( ( ( Float ) value ) . shortValue ( ) ) ; } else if ( value instanceof Boolean ) { if ( ( ( Boolean ) value ) . booleanValue ( ) ) { argout = Short . valueOf ( ( short ) 1 ) ; } else { argout = Short . valueOf ( ( short ) 0 ) ; } } else if ( value instanceof Double ) { argout = Short . valueOf ( ( ( Double ) value ) . shortValue ( ) ) ; } else if ( value instanceof DevState ) { argout = Short . valueOf ( Integer . valueOf ( ( ( DevState ) value ) . value ( ) ) . shortValue ( ) ) ; } else { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value . getClass ( ) + " not supported" , "AttributeHelper.extractToShort(Object value,deviceAttributeWritten)" ) ; } return argout ; } | Extract data from DeviceAttribute to a Short | 428 | 9 |
20,002 | public static String extractToString ( final DeviceAttribute deviceAttributeRead ) throws DevFailed { final Object value = AttributeHelper . extract ( deviceAttributeRead ) ; String argout = null ; if ( value instanceof Short ) { argout = ( ( Short ) value ) . toString ( ) ; } else if ( value instanceof String ) { argout = ( String ) value ; } else if ( value instanceof Integer ) { argout = ( ( Integer ) value ) . toString ( ) ; } else if ( value instanceof Long ) { argout = ( ( Long ) value ) . toString ( ) ; } else if ( value instanceof Float ) { argout = ( ( Float ) value ) . toString ( ) ; } else if ( value instanceof Boolean ) { argout = ( ( Boolean ) value ) . toString ( ) ; } else if ( value instanceof Double ) { argout = ( ( Double ) value ) . toString ( ) ; } else if ( value instanceof DevState ) { argout = StateUtilities . getNameForState ( ( DevState ) value ) ; } else { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value . getClass ( ) + " not supported" , "AttributeHelper.extractToString(Object value,deviceAttributeWritten)" ) ; } return argout ; } | Extract data from DeviceAttribute to a String | 300 | 9 |
20,003 | public static Integer extractToInteger ( final DeviceAttribute deviceAttributeRead ) throws DevFailed { final Object value = AttributeHelper . extract ( deviceAttributeRead ) ; Integer argout = null ; if ( value instanceof Short ) { argout = Integer . valueOf ( ( ( Short ) value ) . intValue ( ) ) ; } else if ( value instanceof String ) { try { argout = Integer . valueOf ( ( String ) value ) ; } catch ( final Exception e ) { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value + " is not a numerical" , "AttributeHelper.extractToInteger(deviceAttributeWritten)" ) ; } } else if ( value instanceof Integer ) { argout = ( Integer ) value ; } else if ( value instanceof Long ) { argout = Integer . valueOf ( ( ( Long ) value ) . intValue ( ) ) ; } else if ( value instanceof Float ) { argout = Integer . valueOf ( ( ( Float ) value ) . intValue ( ) ) ; } else if ( value instanceof Boolean ) { if ( ( ( Boolean ) value ) . booleanValue ( ) ) { argout = Integer . valueOf ( 1 ) ; } else { argout = Integer . valueOf ( 0 ) ; } } else if ( value instanceof Double ) { argout = Integer . valueOf ( ( ( Double ) value ) . intValue ( ) ) ; } else if ( value instanceof DevState ) { argout = Integer . valueOf ( ( ( DevState ) value ) . value ( ) ) ; } else { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value . getClass ( ) + " not supported" , "AttributeHelper.extractToInteger(Object value,deviceAttributeWritten)" ) ; } return argout ; } | Extract data from DeviceAttribute to an Integer | 411 | 9 |
20,004 | public static Long extractToLong ( final DeviceAttribute deviceAttributeRead ) throws DevFailed { final Object value = AttributeHelper . extract ( deviceAttributeRead ) ; Long argout = null ; if ( value instanceof Short ) { argout = Long . valueOf ( ( ( Short ) value ) . longValue ( ) ) ; } else if ( value instanceof String ) { try { argout = Long . valueOf ( ( String ) value ) ; } catch ( final Exception e ) { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value + " is not a numerical" , "AttributeHelper.extractToLong(deviceAttributeWritten)" ) ; } } else if ( value instanceof Integer ) { argout = Long . valueOf ( ( ( Integer ) value ) . longValue ( ) ) ; } else if ( value instanceof Long ) { argout = Long . valueOf ( ( ( Long ) value ) . longValue ( ) ) ; } else if ( value instanceof Float ) { argout = Long . valueOf ( ( ( Float ) value ) . longValue ( ) ) ; } else if ( value instanceof Boolean ) { if ( ( ( Boolean ) value ) . booleanValue ( ) ) { argout = Long . valueOf ( 1 ) ; } else { argout = Long . valueOf ( 0 ) ; } } else if ( value instanceof Double ) { argout = Long . valueOf ( ( ( Double ) value ) . longValue ( ) ) ; } else if ( value instanceof DevState ) { argout = Long . valueOf ( Integer . valueOf ( ( ( DevState ) value ) . value ( ) ) . longValue ( ) ) ; } else { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value . getClass ( ) + " not supported" , "AttributeHelper.extractToLong(Object value,deviceAttributeWritten)" ) ; } return argout ; } | Extract data from DeviceAttribute to a Long | 435 | 9 |
20,005 | public static Float extractToFloat ( final DeviceAttribute deviceAttributeRead ) throws DevFailed { final Object value = AttributeHelper . extract ( deviceAttributeRead ) ; Float argout = null ; if ( value instanceof Short ) { argout = Float . valueOf ( ( ( Short ) value ) . floatValue ( ) ) ; } else if ( value instanceof String ) { try { argout = Float . valueOf ( ( String ) value ) ; } catch ( final Exception e ) { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value + " is not a numerical" , "AttributeHelper.extractToFloat(deviceAttributeWritten)" ) ; } } else if ( value instanceof Integer ) { argout = Float . valueOf ( ( ( Integer ) value ) . floatValue ( ) ) ; } else if ( value instanceof Long ) { argout = Float . valueOf ( ( ( Long ) value ) . floatValue ( ) ) ; } else if ( value instanceof Float ) { argout = Float . valueOf ( ( ( Float ) value ) . floatValue ( ) ) ; } else if ( value instanceof Boolean ) { if ( ( ( Boolean ) value ) . booleanValue ( ) ) { argout = Float . valueOf ( 1 ) ; } else { argout = Float . valueOf ( 0 ) ; } } else if ( value instanceof Double ) { argout = Float . valueOf ( ( ( Double ) value ) . floatValue ( ) ) ; } else if ( value instanceof DevState ) { argout = Float . valueOf ( Integer . valueOf ( ( ( DevState ) value ) . value ( ) ) . floatValue ( ) ) ; } else { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value . getClass ( ) + " not supported" , "AttributeHelper.extractToFloat(Object value,deviceAttributeWritten)" ) ; } return argout ; } | Extract data from DeviceAttribute to a Float | 435 | 9 |
20,006 | public static Boolean extractToBoolean ( final DeviceAttribute deviceAttributeRead ) throws DevFailed { final Object value = AttributeHelper . extract ( deviceAttributeRead ) ; int boolValue = 0 ; Boolean argout = Boolean . FALSE ; ; if ( value instanceof Short ) { boolValue = ( ( Short ) value ) . intValue ( ) ; } else if ( value instanceof String ) { try { if ( Boolean . getBoolean ( ( String ) value ) ) { boolValue = 1 ; } } catch ( final Exception e ) { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value + " is not a boolean" , "AttributeHelper.extractToBoolean(deviceAttributeWritten)" ) ; } } else if ( value instanceof Integer ) { boolValue = ( ( Integer ) value ) . intValue ( ) ; } else if ( value instanceof Long ) { boolValue = ( ( Long ) value ) . intValue ( ) ; } else if ( value instanceof Float ) { boolValue = ( ( Float ) value ) . intValue ( ) ; } else if ( value instanceof Boolean ) { if ( ( ( Boolean ) value ) . booleanValue ( ) ) { boolValue = 1 ; } } else if ( value instanceof Double ) { boolValue = ( ( Double ) value ) . intValue ( ) ; } else if ( value instanceof DevState ) { boolValue = ( ( DevState ) value ) . value ( ) ; } else { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value . getClass ( ) + " not supported" , "AttributeHelper.extractToBoolean(Object value,deviceAttributeWritten)" ) ; } if ( boolValue == 1 ) { argout = Boolean . TRUE ; } return argout ; } | Extract data from DeviceAttribute to a Boolean . | 403 | 10 |
20,007 | public static Double extractToDouble ( final DeviceAttribute deviceAttributeRead ) throws DevFailed { final Object value = AttributeHelper . extract ( deviceAttributeRead ) ; Double argout = null ; if ( value instanceof Short ) { argout = Double . valueOf ( ( ( Short ) value ) . doubleValue ( ) ) ; } else if ( value instanceof String ) { try { argout = Double . valueOf ( ( String ) value ) ; } catch ( final Exception e ) { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value + " is not a numerical" , "AttributeHelper.extractToFloat(deviceAttributeWritten)" ) ; } } else if ( value instanceof Integer ) { argout = Double . valueOf ( ( ( Integer ) value ) . doubleValue ( ) ) ; } else if ( value instanceof Long ) { argout = Double . valueOf ( ( ( Long ) value ) . doubleValue ( ) ) ; } else if ( value instanceof Float ) { argout = Double . valueOf ( ( ( Float ) value ) . doubleValue ( ) ) ; } else if ( value instanceof Boolean ) { if ( ( ( Boolean ) value ) . booleanValue ( ) ) { argout = Double . valueOf ( 1 ) ; } else { argout = Double . valueOf ( 0 ) ; } } else if ( value instanceof Double ) { argout = ( Double ) value ; } else if ( value instanceof DevState ) { argout = Double . valueOf ( Integer . valueOf ( ( ( DevState ) value ) . value ( ) ) . doubleValue ( ) ) ; } else { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "output type " + value . getClass ( ) + " not supported" , "AttributeHelper.extractToFloat(Object value,deviceAttributeWritten)" ) ; } return argout ; } | Extract data from DeviceAttribute to a Double . | 422 | 10 |
20,008 | public static void insertFromInteger ( final Integer integerValue , final DeviceAttribute deviceAttributeWritten ) throws DevFailed { switch ( deviceAttributeWritten . getType ( ) ) { case TangoConst . Tango_DEV_SHORT : deviceAttributeWritten . insert ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_USHORT : deviceAttributeWritten . insert_us ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_CHAR : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_CHAR not supported" , "AttributeHelper.insertFromInteger(Integer value,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_UCHAR : deviceAttributeWritten . insert_uc ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_LONG : deviceAttributeWritten . insert ( integerValue . intValue ( ) ) ; break ; case TangoConst . Tango_DEV_ULONG : deviceAttributeWritten . insert_ul ( integerValue . longValue ( ) ) ; break ; case TangoConst . Tango_DEV_LONG64 : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_LONG64 not supported" , "AttributeHelper.insertFromInteger(Integer value,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_ULONG64 : deviceAttributeWritten . insert_u64 ( integerValue . longValue ( ) ) ; break ; case TangoConst . Tango_DEV_INT : deviceAttributeWritten . insert ( integerValue . intValue ( ) ) ; break ; case TangoConst . Tango_DEV_FLOAT : deviceAttributeWritten . insert ( integerValue . floatValue ( ) ) ; break ; case TangoConst . Tango_DEV_DOUBLE : deviceAttributeWritten . insert ( integerValue . doubleValue ( ) ) ; break ; case TangoConst . Tango_DEV_STRING : deviceAttributeWritten . insert ( integerValue . toString ( ) ) ; break ; case TangoConst . Tango_DEV_BOOLEAN : if ( integerValue . doubleValue ( ) == 1 ) { deviceAttributeWritten . insert ( true ) ; } else { deviceAttributeWritten . insert ( false ) ; } break ; case TangoConst . Tango_DEV_STATE : try { deviceAttributeWritten . insert ( DevState . from_int ( integerValue . intValue ( ) ) ) ; } catch ( final org . omg . CORBA . BAD_PARAM badParam ) { Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "Cannot sent" + integerValue . intValue ( ) + "for input Tango_DEV_STATE type" , "AttributeHelper.insertFromInteger(Integer value,deviceAttributeWritten)" ) ; } break ; default : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type " + deviceAttributeWritten . getType ( ) + " not supported" , "AttributeHelper.insertFromInteger(Integer value,deviceAttributeWritten)" ) ; break ; } } | Insert data in DeviceAttribute from a Integer . | 716 | 9 |
20,009 | public static void insertFromBoolean ( final Boolean booleanValue , final DeviceAttribute deviceAttributeWritten ) throws DevFailed { Integer integerValue = 0 ; if ( booleanValue . booleanValue ( ) ) { integerValue = 1 ; } switch ( deviceAttributeWritten . getType ( ) ) { case TangoConst . Tango_DEV_SHORT : deviceAttributeWritten . insert ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_USHORT : deviceAttributeWritten . insert_us ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_CHAR : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_CHAR not supported" , "AttributeHelper.insertFromBoolean(Boolean value,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_UCHAR : deviceAttributeWritten . insert_uc ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_LONG : deviceAttributeWritten . insert ( integerValue . intValue ( ) ) ; break ; case TangoConst . Tango_DEV_ULONG : deviceAttributeWritten . insert_ul ( integerValue . longValue ( ) ) ; break ; case TangoConst . Tango_DEV_LONG64 : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_LONG64 not supported" , "AttributeHelper.insertFromBoolean(Boolean value,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_ULONG64 : deviceAttributeWritten . insert_u64 ( integerValue . longValue ( ) ) ; break ; case TangoConst . Tango_DEV_INT : deviceAttributeWritten . insert ( integerValue . intValue ( ) ) ; break ; case TangoConst . Tango_DEV_FLOAT : deviceAttributeWritten . insert ( integerValue . floatValue ( ) ) ; break ; case TangoConst . Tango_DEV_DOUBLE : deviceAttributeWritten . insert ( integerValue . doubleValue ( ) ) ; break ; case TangoConst . Tango_DEV_STRING : deviceAttributeWritten . insert ( Boolean . toString ( booleanValue . booleanValue ( ) ) ) ; break ; case TangoConst . Tango_DEV_BOOLEAN : deviceAttributeWritten . insert ( booleanValue . booleanValue ( ) ) ; break ; case TangoConst . Tango_DEV_STATE : deviceAttributeWritten . insert ( DevState . from_int ( integerValue . intValue ( ) ) ) ; break ; default : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type " + deviceAttributeWritten . getType ( ) + " not supported" , "AttributeHelper.insertFromBoolean(Boolean value,deviceAttributeWritten)" ) ; break ; } } | Insert data in DeviceAttribute from a Boolean . | 646 | 9 |
20,010 | public static void insertFromWAttribute ( final WAttribute wAttributeValue , final DeviceAttribute deviceAttributeWritten ) throws DevFailed { Object value = null ; switch ( wAttributeValue . get_data_type ( ) ) { case TangoConst . Tango_DEV_SHORT : value = Short . valueOf ( wAttributeValue . getShortWriteValue ( ) ) ; break ; case TangoConst . Tango_DEV_USHORT : value = Integer . valueOf ( wAttributeValue . getUShortWriteValue ( ) ) ; break ; case TangoConst . Tango_DEV_CHAR : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_CHAR not supported" , "AttributeHelper.insertFromWAttribute(WAttribute wAttributeValue,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_UCHAR : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_UCHAR not supported" , "AttributeHelper.insertFromWAttribute(WAttribute wAttributeValue,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_LONG : value = Integer . valueOf ( wAttributeValue . getLongWriteValue ( ) ) ; break ; case TangoConst . Tango_DEV_ULONG : value = Long . valueOf ( wAttributeValue . getULongWriteValue ( ) ) ; break ; case TangoConst . Tango_DEV_LONG64 : value = Long . valueOf ( wAttributeValue . getLong64WriteValue ( ) ) ; break ; case TangoConst . Tango_DEV_ULONG64 : value = Long . valueOf ( wAttributeValue . getULong64WriteValue ( ) ) ; break ; case TangoConst . Tango_DEV_INT : value = Integer . valueOf ( wAttributeValue . getLongWriteValue ( ) ) ; break ; case TangoConst . Tango_DEV_FLOAT : value = Float . valueOf ( Double . valueOf ( wAttributeValue . getDoubleWriteValue ( ) ) . floatValue ( ) ) ; break ; case TangoConst . Tango_DEV_DOUBLE : value = Double . valueOf ( wAttributeValue . getDoubleWriteValue ( ) ) ; break ; case TangoConst . Tango_DEV_STRING : value = wAttributeValue . getStringWriteValue ( ) ; break ; case TangoConst . Tango_DEV_BOOLEAN : value = Boolean . valueOf ( wAttributeValue . getBooleanWriteValue ( ) ) ; break ; case TangoConst . Tango_DEV_STATE : value = wAttributeValue . getStateWriteValue ( ) ; break ; default : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type " + deviceAttributeWritten . getType ( ) + " not supported" , "AttributeHelper.insertFromDouble(Double value,deviceAttributeWritten)" ) ; break ; } insert ( value , deviceAttributeWritten ) ; } | Insert data in DeviceAttribute from a WAttribute . | 673 | 10 |
20,011 | public static void insertFromDevState ( final DevState devStateValue , final DeviceAttribute deviceAttributeWritten ) throws DevFailed { final Integer integerValue = Integer . valueOf ( devStateValue . value ( ) ) ; switch ( deviceAttributeWritten . getType ( ) ) { case TangoConst . Tango_DEV_SHORT : deviceAttributeWritten . insert ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_USHORT : deviceAttributeWritten . insert_us ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_CHAR : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_CHAR not supported" , "AttributeHelper.insertFromDevState(DevState value,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_UCHAR : deviceAttributeWritten . insert_uc ( integerValue . shortValue ( ) ) ; break ; case TangoConst . Tango_DEV_LONG : deviceAttributeWritten . insert ( integerValue . intValue ( ) ) ; break ; case TangoConst . Tango_DEV_ULONG : deviceAttributeWritten . insert_ul ( integerValue . longValue ( ) ) ; break ; case TangoConst . Tango_DEV_LONG64 : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type Tango_DEV_LONG64 not supported" , "AttributeHelper.insertFromDevState(DevState value,deviceAttributeWritten)" ) ; break ; case TangoConst . Tango_DEV_ULONG64 : deviceAttributeWritten . insert_u64 ( integerValue . longValue ( ) ) ; break ; case TangoConst . Tango_DEV_INT : deviceAttributeWritten . insert ( integerValue . intValue ( ) ) ; break ; case TangoConst . Tango_DEV_FLOAT : deviceAttributeWritten . insert ( integerValue . floatValue ( ) ) ; break ; case TangoConst . Tango_DEV_DOUBLE : deviceAttributeWritten . insert ( integerValue . doubleValue ( ) ) ; break ; case TangoConst . Tango_DEV_STRING : deviceAttributeWritten . insert ( integerValue . toString ( ) ) ; break ; case TangoConst . Tango_DEV_BOOLEAN : if ( integerValue . doubleValue ( ) == 1 ) { deviceAttributeWritten . insert ( true ) ; } else { deviceAttributeWritten . insert ( false ) ; } break ; case TangoConst . Tango_DEV_STATE : deviceAttributeWritten . insert ( devStateValue ) ; break ; default : Except . throw_exception ( "TANGO_WRONG_DATA_ERROR" , "input type " + deviceAttributeWritten . getType ( ) + " not supported" , "AttributeHelper.insertFromDevState(DevState value,deviceAttributeWritten)" ) ; break ; } } | Insert data in DeviceAttribute from a DevState . | 646 | 10 |
20,012 | public final static void fillDbDatumFromDeviceAttribute ( final DbDatum dbDatum , final DeviceAttribute deviceAttribute ) throws DevFailed { switch ( deviceAttribute . getType ( ) ) { case TangoConst . Tango_DEV_VOID : // nothing to do break ; case TangoConst . Tango_DEV_BOOLEAN : dbDatum . insert ( deviceAttribute . extractBoolean ( ) ) ; break ; case TangoConst . Tango_DEV_SHORT : dbDatum . insert ( deviceAttribute . extractShort ( ) ) ; break ; case TangoConst . Tango_DEV_USHORT : dbDatum . insert ( deviceAttribute . extractUShort ( ) ) ; break ; // Loading isn t supported // case TangoConst.Tango_DEV_LONG: // datum.insert(dbattr.extractLong()); // break; // Loading isn t supported // case TangoConst.Tango_DEV_ULONG: // datum.insert(dbattr.extractULong()); // break; case TangoConst . Tango_DEV_FLOAT : dbDatum . insert ( deviceAttribute . extractFloat ( ) ) ; break ; case TangoConst . Tango_DEV_DOUBLE : dbDatum . insert ( deviceAttribute . extractDouble ( ) ) ; break ; case TangoConst . Tango_DEV_STRING : dbDatum . insert ( deviceAttribute . extractString ( ) ) ; break ; // Loading isn t supported // case TangoConst.Tango_DEVVAR_CHARARRAY: // datum.insert(dbattr.extractCharArray()); // break; case TangoConst . Tango_DEVVAR_SHORTARRAY : dbDatum . insert ( deviceAttribute . extractShortArray ( ) ) ; break ; case TangoConst . Tango_DEVVAR_USHORTARRAY : dbDatum . insert ( deviceAttribute . extractUShortArray ( ) ) ; break ; case TangoConst . Tango_DEVVAR_LONGARRAY : dbDatum . insert ( deviceAttribute . extractLongArray ( ) ) ; break ; case TangoConst . Tango_DEVVAR_FLOATARRAY : dbDatum . insert ( deviceAttribute . extractFloatArray ( ) ) ; break ; case TangoConst . Tango_DEVVAR_DOUBLEARRAY : dbDatum . insert ( deviceAttribute . extractDoubleArray ( ) ) ; break ; case TangoConst . Tango_DEVVAR_STRINGARRAY : dbDatum . insert ( deviceAttribute . extractStringArray ( ) ) ; break ; case TangoConst . Tango_DEVVAR_LONGSTRINGARRAY : dbDatum . insert ( deviceAttribute . extractLongArray ( ) ) ; dbDatum . insert ( deviceAttribute . extractStringArray ( ) ) ; break ; case TangoConst . Tango_DEVVAR_DOUBLESTRINGARRAY : dbDatum . insert ( deviceAttribute . extractDoubleArray ( ) ) ; dbDatum . insert ( deviceAttribute . extractStringArray ( ) ) ; break ; case TangoConst . Tango_DEVVAR_CHARARRAY : case TangoConst . Tango_DEVVAR_ULONGARRAY : case TangoConst . Tango_DEV_LONG : case TangoConst . Tango_DEV_ULONG : default : throw new UnsupportedOperationException ( "Tango_DEVVAR_CHARARRAY, Tango_DEVVAR_ULONGARRAY, Tango_DEV_LONG, Tango_DEV_ULONG are not supported by DbDatum or DeviceAttribute" ) ; } } | Fill DbDatum from value of deviceAttribute | 802 | 10 |
20,013 | public void aroundInvoke ( final InvocationContext ctx ) throws DevFailed { xlogger . entry ( ) ; if ( aroundInvokeMethod != null ) { try { aroundInvokeMethod . invoke ( businessObject , ctx ) ; } catch ( final IllegalArgumentException e ) { throw DevFailedUtils . newDevFailed ( e ) ; } catch ( final IllegalAccessException e ) { throw DevFailedUtils . newDevFailed ( e ) ; } catch ( final InvocationTargetException e ) { if ( e . getCause ( ) instanceof DevFailed ) { throw ( DevFailed ) e . getCause ( ) ; } else { throw DevFailedUtils . newDevFailed ( e . getCause ( ) ) ; } } } xlogger . exit ( ) ; } | Call aroundInvoke implementation | 177 | 5 |
20,014 | static void checkStatic ( final Field field ) throws DevFailed { if ( Modifier . isStatic ( field . getModifiers ( ) ) ) { throw DevFailedUtils . newDevFailed ( DevFailedUtils . TANGO_BUILD_FAILED , field + MUST_NOT_BE_STATIC ) ; } } | Check if a field is static | 75 | 6 |
20,015 | static AttributePropertiesImpl setEnumLabelProperty ( final Class < ? > type , final AttributePropertiesImpl props ) throws DevFailed { // if is is an enum set enum values in properties if ( AttributeTangoType . getTypeFromClass ( type ) . equals ( AttributeTangoType . DEVENUM ) ) { // final Class<Enum<?>> enumType = (Class<Enum<?>>) field.getType(); final Object [ ] enumValues = type . getEnumConstants ( ) ; final String [ ] enumLabels = new String [ enumValues . length ] ; for ( int i = 0 ; i < enumLabels . length ; i ++ ) { enumLabels [ i ] = enumValues [ i ] . toString ( ) ; } props . setEnumLabels ( enumLabels , false ) ; } return props ; } | Set enum label for Enum types | 189 | 7 |
20,016 | public DevState updateState ( ) throws DevFailed { xlogger . entry ( ) ; Object getState ; if ( getStateMethod != null ) { try { getState = getStateMethod . invoke ( businessObject ) ; if ( getState != null ) { if ( getState instanceof DeviceState ) { state = ( ( DeviceState ) getState ) . getDevState ( ) ; } else { state = ( DevState ) getState ; } } } catch ( final IllegalArgumentException e ) { throw DevFailedUtils . newDevFailed ( e ) ; } catch ( final IllegalAccessException e ) { throw DevFailedUtils . newDevFailed ( e ) ; } catch ( final InvocationTargetException e ) { if ( e . getCause ( ) instanceof DevFailed ) { throw ( DevFailed ) e . getCause ( ) ; } else { throw DevFailedUtils . newDevFailed ( e . getCause ( ) ) ; } } } // if (!attributeAlarm.isEmpty()) { // state = DevState.ALARM; // } xlogger . exit ( ) ; return state ; } | get the state from the device | 247 | 6 |
20,017 | public synchronized void stateMachine ( final DeviceState state ) throws DevFailed { if ( state != null ) { this . state = state . getDevState ( ) ; if ( setStateMethod != null ) { logger . debug ( "Changing state to {}" , state ) ; try { if ( setStateMethod . getParameterTypes ( ) [ 0 ] . equals ( DeviceState . class ) ) { setStateMethod . invoke ( businessObject , state ) ; } else { setStateMethod . invoke ( businessObject , this . state ) ; } } catch ( final IllegalArgumentException e ) { throw DevFailedUtils . newDevFailed ( e ) ; } catch ( final IllegalAccessException e ) { throw DevFailedUtils . newDevFailed ( e ) ; } catch ( final InvocationTargetException e ) { if ( e . getCause ( ) instanceof DevFailed ) { throw ( DevFailed ) e . getCause ( ) ; } else { throw DevFailedUtils . newDevFailed ( e . getCause ( ) ) ; } } } } } | change state of the device | 232 | 5 |
20,018 | public synchronized void connect_db ( ) { // // Try to connect to the database // if ( _daemon == true ) { boolean connected = false ; while ( connected == false ) { try { db = ApiUtil . get_db_obj ( ) ; if ( db == null ) { Util . out4 . println ( "Can't contact db server, will try later" ) ; try { wait ( _sleep_between_connect * 1000 ) ; } catch ( final InterruptedException ex ) { } } else { connected = true ; } } catch ( final Exception e ) { Util . out4 . println ( "Can't contact db server, will try later" ) ; try { wait ( _sleep_between_connect * 1000 ) ; } catch ( final InterruptedException ex ) { } } } } else { try { db = ApiUtil . get_db_obj ( ) ; if ( db == null ) { System . err . println ( "Can't build connection to TANGO database server, exiting" ) ; System . err . println ( "DB server host = " + db_host ) ; System . exit ( - 1 ) ; } } catch ( final Exception ex ) { System . err . println ( "Can't build connection to TANGO database server, exiting" ) ; System . err . println ( "DB server host = " + db_host ) ; System . exit ( - 1 ) ; } } Util . out4 . println ( "Connected to database" ) ; } | Connect the process to the TANGO database . | 324 | 10 |
20,019 | public Vector get_device_list ( String pattern ) { // - The returned list final Vector dl = new Vector ( ) ; // ------------------------------------------------------------------ // CASE I: pattern does not contain any '*' char - it's a device name if ( pattern . indexOf ( ' ' ) == - 1 ) { DeviceImpl dev = null ; try { dev = get_device_by_name ( pattern ) ; } catch ( final DevFailed df ) { // - Ignore exception } if ( dev != null ) { dl . add ( dev ) ; return dl ; } } // - For the two remaining cases, we need the list of all DeviceClasses. final Vector dcl = get_class_list ( ) ; // - A temp vector to store a given class' devices Vector temp_dl ; // ------------------------------------------------------------------ // CASE II: pattern == "*" - return a list containing all devices if ( pattern . equals ( "*" ) ) { for ( int i = 0 ; i < dcl . size ( ) ; i ++ ) { temp_dl = ( ( DeviceClass ) dcl . elementAt ( i ) ) . get_device_list ( ) ; for ( final Object aTemp_dl : temp_dl ) { final DeviceImpl dev = ( DeviceImpl ) aTemp_dl ; dl . add ( dev ) ; } } return dl ; } // ------------------------------------------------------------------ // CASE III: pattern contains at least one '*' char Iterator dl_it ; String dev_name ; DeviceImpl dev ; final Iterator dcl_it = dcl . iterator ( ) ; // - Compile the pattern pattern = pattern . replace ( ' ' , ' ' ) ; final Pattern p = Pattern . compile ( pattern ) ; // - For each DeviceClass... while ( dcl_it . hasNext ( ) ) { // ...get device list temp_dl = ( ( DeviceClass ) dcl_it . next ( ) ) . get_device_list ( ) ; // for each device in in list... dl_it = temp_dl . iterator ( ) ; while ( dl_it . hasNext ( ) ) { // ...get device ... dev = ( DeviceImpl ) dl_it . next ( ) ; // ...and device name dev_name = dev . get_name ( ) . toLowerCase ( ) ; // then look for token(s) in device name if ( p . matcher ( dev_name ) . matches ( ) ) { dl . add ( dev ) ; } } } return dl ; } | Get the list of device references which name name match the specified pattern Returns a null vector in case there is no device matching the pattern | 540 | 26 |
20,020 | public Vector get_device_list_by_class ( final String class_name ) throws DevFailed { // // Retrieve class list. Don't use the get_dserver_device() method // followed by // the get_class_list(). In case of several classes embedded within // the same server and the use of this method in the object creation, it // will fail because the end of the dserver object creation is after the // end of the last server device creation. // final Vector cl_list = class_list ; // // Check if the wanted class really exists // final int nb_class = cl_list . size ( ) ; int i ; for ( i = 0 ; i < nb_class ; i ++ ) { if ( ( ( DeviceClass ) cl_list . elementAt ( i ) ) . get_name ( ) . equals ( class_name ) == true ) { break ; } } // // Throw exception if the class is not found // if ( i == nb_class ) { final StringBuffer o = new StringBuffer ( "Class " ) ; o . append ( class_name ) ; o . append ( " not found" ) ; Except . throw_exception ( "API_ClassNotFound" , o . toString ( ) , "Util::get_device_list_by_class()" ) ; } return ( ( DeviceClass ) cl_list . elementAt ( i ) ) . get_device_list ( ) ; } | Get the list of device references for a given TANGO class . | 314 | 14 |
20,021 | public DeviceImpl get_device_by_name ( String dev_name ) throws DevFailed { // // Retrieve class list. Don't use the get_dserver_device() method // followed by // the get_class_list(). In case of several classes embedded within // the same server and the use of this method in the object creation, it // will fail because the end of the dserver object creation is after the // end of the last server device creation. // final Vector cl_list = class_list ; // // Check if the wanted device exists in each class // dev_name = dev_name . toLowerCase ( ) ; Vector dev_list = get_device_list_by_class ( ( ( DeviceClass ) cl_list . elementAt ( 0 ) ) . get_name ( ) ) ; final int nb_class = cl_list . size ( ) ; int i , j , nb_dev ; j = nb_dev = 0 ; boolean found = false ; for ( i = 0 ; i < nb_class ; i ++ ) { dev_list = get_device_list_by_class ( ( ( DeviceClass ) cl_list . elementAt ( i ) ) . get_name ( ) ) ; nb_dev = dev_list . size ( ) ; for ( j = 0 ; j < nb_dev ; j ++ ) { if ( ( ( DeviceImpl ) dev_list . elementAt ( j ) ) . get_name ( ) . toLowerCase ( ) . equals ( dev_name ) == true ) { found = true ; break ; } } if ( found == true ) { break ; } } // // Check also the dserver device // if ( found == false ) { final DServerClass ds_class = DServerClass . instance ( ) ; dev_list = ds_class . get_device_list ( ) ; final String name = ( ( DeviceImpl ) dev_list . elementAt ( 0 ) ) . get_name ( ) ; if ( name . compareToIgnoreCase ( dev_name ) == 0 ) { j = 0 ; } } // // Throw exception if the class is not found // if ( i == nb_class && j == nb_dev ) { final StringBuffer o = new StringBuffer ( "Device " ) ; o . append ( dev_name ) ; o . append ( " not found" ) ; Except . throw_exception ( "API_DeviceNotFound" , o . toString ( ) , "Util::get_device_by_name()" ) ; } return ( DeviceImpl ) dev_list . elementAt ( j ) ; } | Get a device reference from its name | 570 | 7 |
20,022 | public void unregister_server ( ) { Util . out4 . println ( "Entering Tango::unregister_server method" ) ; if ( Util . _UseDb == true ) { // // Mark all the devices belonging to this server as unexported // try { db . unexport_server ( ds_name . toString ( ) ) ; } catch ( final SystemException e ) { Except . print_exception ( e ) ; System . exit ( - 1 ) ; } catch ( final DevFailed e ) { Except . print_exception ( e ) ; System . exit ( - 1 ) ; } catch ( final UserException e ) { Except . print_exception ( e ) ; System . exit ( - 1 ) ; } } Util . out4 . println ( "Leaving Tango::unregister_server method" ) ; } | Unregister a device server process from the TANGO database . | 184 | 13 |
20,023 | public synchronized void execute ( final StateImpl stateImpl , final StatusImpl statusImpl ) { if ( isLazy && ! isInitInProgress ( ) ) { final Callable < Void > initRunnable = new Callable < Void > ( ) { @ Override public Void call ( ) throws DevFailed { logger . debug ( "Lazy init in" ) ; MDC . setContextMap ( contextMap ) ; doInit ( stateImpl , statusImpl ) ; logger . debug ( "Lazy init out" ) ; return null ; } } ; future = executor . submit ( initRunnable ) ; } else { doInit ( stateImpl , statusImpl ) ; } } | Execute the init | 145 | 4 |
20,024 | public PipeBlobBuilder add ( String name , Object value ) { elements . add ( PipeDataElement . newInstance ( name , value ) ) ; return this ; } | Adds a generic array to this PipeBlob | 35 | 9 |
20,025 | public static final Entry < String , String > splitDeviceEntity ( final String entityName ) throws DevFailed { Entry < String , String > result = null ; final Matcher matcher = ENTITY_SPLIT_PATTERN . matcher ( entityName . trim ( ) ) ; if ( matcher . matches ( ) ) { String device = null ; String entity = null ; final String prefixGroup = matcher . group ( PREFIX_INDEX ) ; final boolean noDb = matcher . group ( NO_DB_INDEX ) != null ; if ( noDb ) { // TODO cas device alias qui marche soleil if ( matcher . group ( DEVICE_NAME_INDEX ) != null && matcher . group ( ENTITY_INDEX ) != null ) { final String deviceNameGroup = matcher . group ( DEVICE_NAME_INDEX ) ; final String entityGroup = matcher . group ( ENTITY_INDEX ) ; device = prefixGroup + deviceNameGroup ; entity = entityGroup ; } } else { if ( matcher . group ( ATTRIBUTE_ALIAS_INDEX ) != null ) { final String attributeAliasGroup = matcher . group ( ATTRIBUTE_ALIAS_INDEX ) ; final String fullAttributeName = ApiUtil . get_db_obj ( ) . get_attribute_from_alias ( attributeAliasGroup ) ; final int lastIndexOf = fullAttributeName . lastIndexOf ( DEVICE_SEPARATOR ) ; device = prefixGroup + fullAttributeName . substring ( 0 , lastIndexOf ) ; // TODO exception ? entity = fullAttributeName . substring ( lastIndexOf + 1 ) ; } else if ( matcher . group ( DEVICE_ALIAS_INDEX ) != null ) { final String deviceAliasGroup = matcher . group ( DEVICE_ALIAS_INDEX ) ; final String entityGroup = matcher . group ( ENTITY_INDEX ) ; final String fullDeviceName = ApiUtil . get_db_obj ( ) . get_device_from_alias ( deviceAliasGroup ) ; device = prefixGroup + fullDeviceName ; entity = entityGroup ; } else { final String deviceNameGroup = matcher . group ( DEVICE_NAME_INDEX ) ; final String entityGroup = matcher . group ( ENTITY_INDEX ) ; device = prefixGroup + deviceNameGroup ; entity = entityGroup ; } } if ( device != null && entity != null ) { result = new SimpleEntry < String , String > ( device , entity ) ; } } return result ; } | Splits an entity name into full device name and attribute name . Aliases will be resolved against tango db first . | 557 | 24 |
20,026 | public static Map < String , Collection < String > > splitDeviceEntities ( final Collection < String > entityNames ) { final Map < String , Collection < String > > result = new HashMap < String , Collection < String > > ( ) ; String device ; String entity ; for ( final String entityName : entityNames ) { try { final Entry < String , String > deviceEntity = splitDeviceEntity ( entityName ) ; if ( deviceEntity != null ) { device = deviceEntity . getKey ( ) ; entity = deviceEntity . getValue ( ) ; if ( device != null && entity != null ) { Collection < String > attributes = result . get ( device ) ; if ( attributes == null ) { attributes = new HashSet < String > ( ) ; result . put ( device , attributes ) ; } attributes . add ( entity ) ; } } } catch ( final DevFailed e ) { // nop } } return result ; } | Splits a collection of entity names and group attributes by device . | 196 | 13 |
20,027 | public static GoogleCredential getApplicationDefaultCredential ( ) { try { GoogleCredential credential = GoogleCredential . getApplicationDefault ( ) ; if ( credential . createScopedRequired ( ) ) { credential = credential . createScoped ( Arrays . asList ( "https://www.googleapis.com/auth/genomics" ) ) ; } return credential ; } catch ( IOException e ) { throw new RuntimeException ( MISSING_ADC_EXCEPTION_MESSAGE , e ) ; } } | Obtain the Application Default com . google . api . client . auth . oauth2 . Credential | 116 | 22 |
20,028 | public static Credential getCredentialFromClientSecrets ( String clientSecretsFile , String credentialId ) { Preconditions . checkArgument ( clientSecretsFile != null ) ; Preconditions . checkArgument ( credentialId != null ) ; HttpTransport httpTransport ; try { httpTransport = GoogleNetHttpTransport . newTrustedTransport ( ) ; } catch ( IOException | GeneralSecurityException e ) { throw new RuntimeException ( "Could not create HTTPS transport for use in credential creation" , e ) ; } JsonFactory jsonFactory = JacksonFactory . getDefaultInstance ( ) ; GoogleClientSecrets clientSecrets ; try { clientSecrets = GoogleClientSecrets . load ( jsonFactory , new FileReader ( clientSecretsFile ) ) ; } catch ( IOException e ) { throw new RuntimeException ( "Could not read the client secrets from file: " + clientSecretsFile , e ) ; } FileDataStoreFactory dataStoreFactory ; try { dataStoreFactory = new FileDataStoreFactory ( CREDENTIAL_STORE ) ; } catch ( IOException e ) { throw new RuntimeException ( "Could not create persisten credential store " + CREDENTIAL_STORE , e ) ; } GoogleAuthorizationCodeFlow flow ; try { flow = new GoogleAuthorizationCodeFlow . Builder ( httpTransport , jsonFactory , clientSecrets , SCOPES ) . setDataStoreFactory ( dataStoreFactory ) . build ( ) ; } catch ( IOException e ) { throw new RuntimeException ( "Could not build credential authorization flow" , e ) ; } // The credentialId identifies the credential in the persistent credential store. Credential credential ; try { credential = new AuthorizationCodeInstalledApp ( flow , new PromptReceiver ( ) ) . authorize ( credentialId ) ; } catch ( IOException e ) { throw new RuntimeException ( "Could not perform credential authorization flow" , e ) ; } return credential ; } | Creates an OAuth2 credential from client secrets which may require an interactive authorization prompt . | 416 | 18 |
20,029 | public static boolean isOverlapping ( Variant blockRecord , Variant . Builder variant ) { return blockRecord . getStart ( ) <= variant . getStart ( ) && blockRecord . getEnd ( ) >= variant . getStart ( ) + 1 ; } | Determine whether the first variant overlaps the second variant . | 52 | 13 |
20,030 | public static final boolean isSameVariantSite ( Variant . Builder variant1 , Variant variant2 ) { return variant1 . getReferenceName ( ) . equals ( variant2 . getReferenceName ( ) ) && variant1 . getReferenceBases ( ) . equals ( variant2 . getReferenceBases ( ) ) && variant1 . getStart ( ) == variant2 . getStart ( ) ; } | Determine whether two variants occur at the same site in the genome where site is defined by reference name start position and reference bases . | 83 | 27 |
20,031 | public static ManagedChannel fromCreds ( GoogleCredentials creds , String fields ) throws SSLException { List < ClientInterceptor > interceptors = new ArrayList ( ) ; interceptors . add ( new ClientAuthInterceptor ( creds . createScoped ( Arrays . asList ( GENOMICS_SCOPE ) ) , Executors . newSingleThreadExecutor ( ) ) ) ; if ( ! Strings . isNullOrEmpty ( fields ) ) { Metadata headers = new Metadata ( ) ; Metadata . Key < String > partialResponseHeader = Metadata . Key . of ( PARTIAL_RESPONSE_HEADER , Metadata . ASCII_STRING_MARSHALLER ) ; headers . put ( partialResponseHeader , fields ) ; interceptors . add ( MetadataUtils . newAttachHeadersInterceptor ( headers ) ) ; } return getGenomicsManagedChannel ( interceptors ) ; } | Create a new gRPC channel to the Google Genomics API using the provided credentials for auth . | 202 | 20 |
20,032 | public static ManagedChannel fromDefaultCreds ( String fields ) throws SSLException , IOException { return fromCreds ( CredentialFactory . getApplicationDefaultCredentials ( ) , fields ) ; } | Create a new gRPC channel to the Google Genomics API using the application default credentials for auth . | 47 | 21 |
20,033 | public static ManagedChannel fromOfflineAuth ( OfflineAuth auth , String fields ) throws IOException , GeneralSecurityException { return fromCreds ( auth . getCredentials ( ) , fields ) ; } | Create a new gRPC channel to the Google Genomics API using either OfflineAuth or the application default credentials . | 43 | 23 |
20,034 | public static List < String > getReadGroupSetIds ( String datasetId , OfflineAuth auth ) throws IOException { List < String > output = Lists . newArrayList ( ) ; Genomics genomics = GenomicsFactory . builder ( ) . build ( ) . fromOfflineAuth ( auth ) ; Iterable < ReadGroupSet > rgs = Paginator . ReadGroupSets . create ( genomics ) . search ( new SearchReadGroupSetsRequest ( ) . setDatasetIds ( Lists . newArrayList ( datasetId ) ) , "readGroupSets(id),nextPageToken" ) ; for ( ReadGroupSet r : rgs ) { output . add ( r . getId ( ) ) ; } if ( output . isEmpty ( ) ) { throw new IOException ( "Dataset " + datasetId + " does not contain any ReadGroupSets" ) ; } return output ; } | Gets ReadGroupSetIds from a given datasetId using the Genomics API . | 196 | 18 |
20,035 | public static String getReferenceSetId ( String readGroupSetId , OfflineAuth auth ) throws IOException { Genomics genomics = GenomicsFactory . builder ( ) . build ( ) . fromOfflineAuth ( auth ) ; ReadGroupSet readGroupSet = genomics . readgroupsets ( ) . get ( readGroupSetId ) . setFields ( "referenceSetId" ) . execute ( ) ; return readGroupSet . getReferenceSetId ( ) ; } | Gets the ReferenceSetId for a given readGroupSetId using the Genomics API . | 98 | 19 |
20,036 | public static List < CoverageBucket > getCoverageBuckets ( String readGroupSetId , OfflineAuth auth ) throws IOException { Genomics genomics = GenomicsFactory . builder ( ) . build ( ) . fromOfflineAuth ( auth ) ; ListCoverageBucketsResponse response = genomics . readgroupsets ( ) . coveragebuckets ( ) . list ( readGroupSetId ) . execute ( ) ; // Requests of this form return one result per reference name, so therefore many fewer than // the default page size, but verify that the assumption holds true. if ( ! Strings . isNullOrEmpty ( response . getNextPageToken ( ) ) ) { throw new IllegalArgumentException ( "Read group set " + readGroupSetId + " has more Coverage Buckets than the default page size for the CoverageBuckets list operation." ) ; } return response . getCoverageBuckets ( ) ; } | Gets the CoverageBuckets for a given readGroupSetId using the Genomics API . | 197 | 20 |
20,037 | public static Iterable < Reference > getReferences ( String referenceSetId , OfflineAuth auth ) throws IOException { Genomics genomics = GenomicsFactory . builder ( ) . build ( ) . fromOfflineAuth ( auth ) ; return Paginator . References . create ( genomics ) . search ( new SearchReferencesRequest ( ) . setReferenceSetId ( referenceSetId ) ) ; } | Gets the references for a given referenceSetId using the Genomics API . | 80 | 16 |
20,038 | public static List < String > getVariantSetIds ( String datasetId , OfflineAuth auth ) throws IOException { List < String > output = Lists . newArrayList ( ) ; Genomics genomics = GenomicsFactory . builder ( ) . build ( ) . fromOfflineAuth ( auth ) ; Iterable < VariantSet > vs = Paginator . Variantsets . create ( genomics ) . search ( new SearchVariantSetsRequest ( ) . setDatasetIds ( Lists . newArrayList ( datasetId ) ) , "variantSets(id),nextPageToken" ) ; for ( VariantSet v : vs ) { output . add ( v . getId ( ) ) ; } if ( output . isEmpty ( ) ) { throw new IOException ( "Dataset " + datasetId + " does not contain any VariantSets" ) ; } return output ; } | Gets VariantSetIds from a given datasetId using the Genomics API . | 190 | 17 |
20,039 | public static Iterable < CallSet > getCallSets ( String variantSetId , OfflineAuth auth ) throws IOException { Genomics genomics = GenomicsFactory . builder ( ) . build ( ) . fromOfflineAuth ( auth ) ; return Paginator . Callsets . create ( genomics ) . search ( new SearchCallSetsRequest ( ) . setVariantSetIds ( Lists . newArrayList ( variantSetId ) ) , "callSets,nextPageToken" ) ; } | Gets CallSets for a given variantSetId using the Genomics API . | 105 | 17 |
20,040 | public static List < String > getCallSetsNames ( String variantSetId , OfflineAuth auth ) throws IOException { List < String > output = Lists . newArrayList ( ) ; Genomics genomics = GenomicsFactory . builder ( ) . build ( ) . fromOfflineAuth ( auth ) ; Iterable < CallSet > cs = Paginator . Callsets . create ( genomics ) . search ( new SearchCallSetsRequest ( ) . setVariantSetIds ( Lists . newArrayList ( variantSetId ) ) , "callSets(name),nextPageToken" ) ; for ( CallSet c : cs ) { output . add ( c . getName ( ) ) ; } if ( output . isEmpty ( ) ) { throw new IOException ( "VariantSet " + variantSetId + " does not contain any CallSets" ) ; } return output ; } | Gets CallSets Names for a given variantSetId using the Genomics API . | 189 | 18 |
20,041 | public static List < ReferenceBound > getReferenceBounds ( String variantSetId , OfflineAuth auth ) throws IOException { Genomics genomics = GenomicsFactory . builder ( ) . build ( ) . fromOfflineAuth ( auth ) ; VariantSet variantSet = genomics . variantsets ( ) . get ( variantSetId ) . execute ( ) ; return variantSet . getReferenceBounds ( ) ; } | Gets the ReferenceBounds for a given variantSetId using the Genomics API . | 85 | 18 |
20,042 | public static Iterable < Contig > parseContigsFromCommandLine ( String contigsArgument ) { return Iterables . transform ( Splitter . on ( "," ) . split ( contigsArgument ) , new Function < String , Contig > ( ) { @ Override public Contig apply ( String contigString ) { ArrayList < String > contigInfo = newArrayList ( Splitter . on ( ":" ) . split ( contigString ) ) ; Long start = Long . valueOf ( contigInfo . get ( 1 ) ) ; Long end = Long . valueOf ( contigInfo . get ( 2 ) ) ; Preconditions . checkArgument ( start <= end , "Contig coordinates are incorrectly specified: start " + start + " is greater than end " + end ) ; return new Contig ( contigInfo . get ( 0 ) , start , end ) ; } } ) ; } | Parse the list of Contigs expressed in the string argument . | 195 | 13 |
20,043 | List < Contig > getShards ( long numberOfBasesPerShard ) { double shardCount = ( end - start ) / ( double ) numberOfBasesPerShard ; List < Contig > shards = Lists . newArrayList ( ) ; for ( int i = 0 ; i < shardCount ; i ++ ) { long shardStart = start + ( i * numberOfBasesPerShard ) ; long shardEnd = Math . min ( end , shardStart + numberOfBasesPerShard ) ; shards . add ( new Contig ( referenceName , shardStart , shardEnd ) ) ; } return shards ; } | being returned to clients . | 142 | 5 |
20,044 | @ Deprecated public StreamVariantsRequest getStreamVariantsRequest ( String variantSetId ) { return StreamVariantsRequest . newBuilder ( ) . setVariantSetId ( variantSetId ) . setReferenceName ( referenceName ) . setStart ( start ) . setEnd ( end ) . build ( ) ; } | Construct a StreamVariantsRequest for the Contig . | 67 | 11 |
20,045 | @ Deprecated public StreamReadsRequest getStreamReadsRequest ( String readGroupSetId ) { return StreamReadsRequest . newBuilder ( ) . setReadGroupSetId ( readGroupSetId ) . setReferenceName ( referenceName ) . setStart ( start ) . setEnd ( end ) . build ( ) ; } | Construct a StreamReadsRequest for the Contig . | 69 | 11 |
20,046 | public StreamVariantsRequest getStreamVariantsRequest ( StreamVariantsRequest prototype ) { return StreamVariantsRequest . newBuilder ( prototype ) . setReferenceName ( referenceName ) . setStart ( start ) . setEnd ( end ) . build ( ) ; } | Construct a StreamVariantsRequest for the Contig using a prototype using a prototype request . | 55 | 18 |
20,047 | public StreamReadsRequest getStreamReadsRequest ( StreamReadsRequest prototype ) { return StreamReadsRequest . newBuilder ( prototype ) . setReferenceName ( referenceName ) . setStart ( start ) . setEnd ( end ) . build ( ) ; } | Construct a StreamReadsRequest for the Contig using a prototype request . | 55 | 15 |
20,048 | public Credential getCredential ( ) { if ( hasStoredCredential ( ) ) { HttpTransport httpTransport ; try { httpTransport = GoogleNetHttpTransport . newTrustedTransport ( ) ; } catch ( IOException | GeneralSecurityException e ) { throw new RuntimeException ( "Could not create HTTPS transport for use in credential creation" , e ) ; } return new GoogleCredential . Builder ( ) . setJsonFactory ( JacksonFactory . getDefaultInstance ( ) ) . setTransport ( httpTransport ) . setClientSecrets ( getClientId ( ) , getClientSecret ( ) ) . build ( ) . setRefreshToken ( getRefreshToken ( ) ) ; } return CredentialFactory . getApplicationDefaultCredential ( ) ; } | Return the stored user credential if applicable or fall back to the Application Default Credential . | 172 | 18 |
20,049 | public < T extends AbstractGoogleJsonClient . Builder > T fromApiKey ( T builder , String apiKey ) { Preconditions . checkNotNull ( builder ) ; Preconditions . checkNotNull ( apiKey ) ; return prepareBuilder ( builder , null , new CommonGoogleClientRequestInitializer ( apiKey ) ) ; } | Prepare an AbstractGoogleJsonClient . Builder using an API key . | 71 | 15 |
20,050 | public < T extends AbstractGoogleJsonClient . Builder > T fromCredential ( T builder , Credential credential ) { Preconditions . checkNotNull ( builder ) ; Preconditions . checkNotNull ( credential ) ; return prepareBuilder ( builder , credential , null ) ; } | Prepare an AbstractGoogleJsonClient . Builder using a credential . | 61 | 14 |
20,051 | public < T extends AbstractGoogleJsonClient . Builder > T fromApplicationDefaultCredential ( T builder ) { Preconditions . checkNotNull ( builder ) ; return fromCredential ( builder , CredentialFactory . getApplicationDefaultCredential ( ) ) ; } | Prepare an AbstractGoogleJsonClient . Builder using the Application Default Credential . | 59 | 18 |
20,052 | public Genomics fromOfflineAuth ( OfflineAuth auth ) { Preconditions . checkNotNull ( auth ) ; return fromOfflineAuth ( getGenomicsBuilder ( ) , auth ) . build ( ) ; } | Create a new genomics stub from the given OfflineAuth object . | 43 | 13 |
20,053 | public < T extends AbstractGoogleJsonClient . Builder > T fromOfflineAuth ( T builder , OfflineAuth auth ) { Preconditions . checkNotNull ( builder ) ; Preconditions . checkNotNull ( auth ) ; if ( auth . hasApiKey ( ) ) { return fromApiKey ( builder , auth . getApiKey ( ) ) ; } return fromCredential ( builder , auth . getCredential ( ) ) ; } | Prepare an AbstractGoogleJsonClient . Builder with the given OfflineAuth object . | 97 | 17 |
20,054 | public static final BiMap < String , String > getCallSetNameMapping ( Iterable < CallSet > callSets ) { BiMap < String , String > idToName = HashBiMap . create ( ) ; for ( CallSet callSet : callSets ) { // Dev Note: Be sure to keep this map loading as id -> name since it ensures that // the values are unique. idToName . put ( callSet . getId ( ) , callSet . getName ( ) ) ; } return idToName . inverse ( ) ; } | Create a bi - directional map of names to ids for a collection of callsets . | 118 | 18 |
20,055 | public final Iterable < ItemT > search ( final RequestT request ) { return search ( request , DEFAULT_INITIALIZER , RetryPolicy . defaultPolicy ( ) ) ; } | Search for objects . | 41 | 4 |
20,056 | public final < F > F search ( RequestT request , GenomicsRequestInitializer < ? super RequestSubT > initializer , Callback < ItemT , ? extends F > callback , RetryPolicy retryPolicy ) throws IOException { try { return callback . consumeResponses ( search ( request , initializer , retryPolicy ) ) ; } catch ( SearchException e ) { throw e . getCause ( ) ; } } | An exception safe way of consuming search results . Client code supplies a callback which is used to consume the result stream and accumulate a value which becomes the value returned from this method . | 91 | 35 |
20,057 | public final Iterable < ItemT > search ( final RequestT request , final String fields ) { return search ( request , setFieldsInitializer ( fields ) , RetryPolicy . defaultPolicy ( ) ) ; } | Search for objects with a partial response . | 45 | 8 |
20,058 | public static ImmutableList < StreamReadsRequest > getReadRequests ( final StreamReadsRequest prototype , SexChromosomeFilter sexChromosomeFilter , long numberOfBasesPerShard , OfflineAuth auth ) throws IOException { Iterable < Contig > shards = getAllShardsInReadGroupSet ( prototype . getReadGroupSetId ( ) , sexChromosomeFilter , numberOfBasesPerShard , auth ) ; return FluentIterable . from ( shards ) . transform ( new Function < Contig , StreamReadsRequest > ( ) { @ Override public StreamReadsRequest apply ( Contig shard ) { return shard . getStreamReadsRequest ( prototype ) ; } } ) . toList ( ) ; } | Constructs sharded StreamReadsRequest for the all references in the readGroupSet . | 164 | 18 |
20,059 | @ Deprecated public static ImmutableList < StreamVariantsRequest > getVariantRequests ( final String variantSetId , SexChromosomeFilter sexChromosomeFilter , long numberOfBasesPerShard , OfflineAuth auth ) throws IOException { Iterable < Contig > shards = getAllShardsInVariantSet ( variantSetId , sexChromosomeFilter , numberOfBasesPerShard , auth ) ; return FluentIterable . from ( shards ) . transform ( new Function < Contig , StreamVariantsRequest > ( ) { @ Override public StreamVariantsRequest apply ( Contig shard ) { return shard . getStreamVariantsRequest ( variantSetId ) ; } } ) . toList ( ) ; } | Constructs sharded StreamVariantsRequests for the all references in the variantSet . | 163 | 18 |
20,060 | public static Predicate < Variant > getStrictVariantPredicate ( final long start , String fields ) { Preconditions . checkArgument ( Strings . isNullOrEmpty ( fields ) || VARIANT_FIELD_PATTERN . matcher ( fields ) . matches ( ) , "Insufficient fields requested in partial response. At a minimum " + "include 'variants(start)' to enforce a strict shard boundary." ) ; return new Predicate < Variant > ( ) { @ Override public boolean apply ( Variant variant ) { return variant . getStart ( ) >= start ; } } ; } | Predicate expressing the logic for which variants should and should not be included in the shard . | 129 | 19 |
20,061 | public static Predicate < Read > getStrictReadPredicate ( final long start , final String fields ) { Preconditions . checkArgument ( Strings . isNullOrEmpty ( fields ) || READ_FIELD_PATTERN . matcher ( fields ) . matches ( ) , "Insufficient fields requested in partial response. At a minimum " + "include 'alignments(alignment)' to enforce a strict shard boundary." ) ; return new Predicate < Read > ( ) { @ Override public boolean apply ( Read read ) { return read . getAlignment ( ) . getPosition ( ) . getPosition ( ) >= start ; } } ; } | Predicate expressing the logic for which reads should and should not be included in the shard . | 139 | 19 |
20,062 | private static AmazonWebServiceRequest generateRequest ( ActionContext context , Class < ? > type , RequestModel model , AmazonWebServiceRequest request , Object token ) throws InstantiationException , IllegalAccessException { if ( request == null ) { request = ( AmazonWebServiceRequest ) type . newInstance ( ) ; } request . getRequestClientOptions ( ) . appendUserAgent ( USER_AGENT ) ; for ( PathTargetMapping mapping : model . getIdentifierMappings ( ) ) { Object value = context . getIdentifier ( mapping . getSource ( ) ) ; if ( value == null ) { throw new IllegalStateException ( "Action has a mapping for identifier " + mapping . getSource ( ) + ", but the target has no " + "identifier of that name!" ) ; } ReflectionUtils . setByPath ( request , value , mapping . getTarget ( ) ) ; } for ( PathTargetMapping mapping : model . getAttributeMappings ( ) ) { Object value = context . getAttribute ( mapping . getSource ( ) ) ; if ( value == null ) { // TODO: Is this ever valid? throw new IllegalStateException ( "Action has a mapping for attribute " + mapping . getSource ( ) + ", but the target has no " + "attribute of that name!" ) ; } ReflectionUtils . setByPath ( request , value , mapping . getTarget ( ) ) ; } for ( PathTargetMapping mapping : model . getConstantMappings ( ) ) { // TODO: This only works for strings; can we do better? ReflectionUtils . setByPath ( request , mapping . getSource ( ) , mapping . getTarget ( ) ) ; } if ( token != null ) { List < String > tokenPath = model . getTokenPath ( ) ; if ( tokenPath == null ) { throw new IllegalArgumentException ( "Cannot pass a token with a null token path" ) ; } ReflectionUtils . setByPath ( request , token , tokenPath ) ; } return request ; } | Generates a client - level request by extracting the user parameters ( if | 435 | 14 |
20,063 | public static Object getByPath ( Object target , List < String > path ) { Object obj = target ; for ( String field : path ) { if ( obj == null ) { return null ; } obj = evaluate ( obj , trimType ( field ) ) ; } return obj ; } | Evaluates the given path expression on the given object and returns the object found . | 59 | 17 |
20,064 | public static List < Object > getAllByPath ( Object target , List < String > path ) { List < Object > results = new LinkedList <> ( ) ; // TODO: Can we unroll this and do it iteratively? getAllByPath ( target , path , 0 , results ) ; return results ; } | Evaluates the given path expression and returns the list of all matching objects . If the path expression does not contain any wildcards this will return a list of at most one item . If the path contains one or more wildcards the returned list will include the full set of values obtained by evaluating the expression with all legal value for the given wildcard . | 69 | 71 |
20,065 | private static Object digIn ( Object target , String field ) { if ( target instanceof List ) { // The 'field' will tell us what type of objects belong in the list. @ SuppressWarnings ( "unchecked" ) List < Object > list = ( List < Object > ) target ; return digInList ( list , field ) ; } else if ( target instanceof Map ) { // The 'field' will tell us what type of objects belong in the map. @ SuppressWarnings ( "unchecked" ) Map < String , Object > map = ( Map < String , Object > ) target ; return digInMap ( map , field ) ; } else { return digInObject ( target , field ) ; } } | Uses reflection to dig into a chain of objects in preparation for setting a value somewhere within the tree . Gets the value of the given property of the target object and if it is null creates a new instance of the appropriate type and sets it on the target object . Returns the gotten or created value . | 156 | 60 |
20,066 | private static void setValue ( Object target , String field , Object value ) { // TODO: Should we do this for all numbers, not just '0'? if ( "0" . equals ( field ) ) { if ( ! ( target instanceof Collection ) ) { throw new IllegalArgumentException ( "Cannot evaluate '0' on object " + target ) ; } @ SuppressWarnings ( "unchecked" ) Collection < Object > collection = ( Collection < Object > ) target ; collection . add ( value ) ; } else { Method setter = findMethod ( target , "set" + field , value . getClass ( ) ) ; try { setter . invoke ( target , value ) ; } catch ( IllegalAccessException exception ) { throw new IllegalStateException ( "Unable to access setter method" , exception ) ; } catch ( InvocationTargetException exception ) { if ( exception . getCause ( ) instanceof RuntimeException ) { throw ( RuntimeException ) exception . getCause ( ) ; } throw new IllegalStateException ( "Checked exception thrown from setter method" , exception ) ; } } } | Uses reflection to set the value of the given property on the target object . | 237 | 16 |
20,067 | private static Method findMethod ( Object target , String name , Class < ? > parameterType ) { for ( Method method : target . getClass ( ) . getMethods ( ) ) { if ( ! method . getName ( ) . equals ( name ) ) { continue ; } Class < ? > [ ] parameters = method . getParameterTypes ( ) ; if ( parameters . length != 1 ) { continue ; } if ( parameters [ 0 ] . isAssignableFrom ( parameterType ) ) { return method ; } } throw new IllegalStateException ( "No method '" + name + "(" + parameterType + ") on type " + target . getClass ( ) ) ; } | Finds a method of the given name that will accept a parameter of the given type . If more than one method matches returns the first such method found . | 143 | 31 |
20,068 | public static boolean isMultiValuedPath ( List < String > expression ) { for ( String element : expression ) { if ( "*" . equals ( element ) || element . startsWith ( "*:" ) ) { return true ; } } return false ; } | Returns true if the given path expression contains wildcards and could be expanded to match multiple values . | 55 | 19 |
20,069 | public synchronized boolean load ( AmazonWebServiceRequest request , ResultCapture < ? > extractor ) { if ( attributes != null ) { return false ; } ActionModel action = resourceModel . getLoadAction ( ) ; if ( action == null ) { throw new UnsupportedOperationException ( "This resource does not support being loaded." ) ; } // The facade generator ensures it's only ever possible to pass an // instance of the appropriate type. @ SuppressWarnings ( "unchecked" ) ResultCapture < Object > erasedExtractor = ( ResultCapture < Object > ) extractor ; ActionResult result = ActionUtils . perform ( this , action , request , erasedExtractor ) ; this . attributes = parseAttributes ( resourceModel , result . getData ( ) ) ; return true ; } | Explicitly loads a representation of this resource by calling the service to retrieve a new set of attributes . | 164 | 21 |
20,070 | public ActionResult performAction ( String name , AmazonWebServiceRequest request , ResultCapture < ? > extractor ) { ActionModel action = resourceModel . getAction ( name ) ; if ( action == null ) { throw new UnsupportedOperationException ( "Resource does not support the action " + name ) ; } // The facade generator will ensure we only ever pass in an // appropriately-typed extractor object. @ SuppressWarnings ( "unchecked" ) ResultCapture < Object > erasedExtractor = ( ResultCapture < Object > ) extractor ; return ActionUtils . perform ( this , action , request , erasedExtractor ) ; } | Performs the given action on this resource . This always involves a request to the service . It may mark the cached attributes of this resource object dirty . | 135 | 30 |
20,071 | public T build ( ) { C clientObject = client ; if ( clientObject == null ) { clientObject = createClient ( ) ; } return factory . create ( clientObject ) ; } | Builds a new service object with the given parameters . | 39 | 11 |
20,072 | public ResourcePageImpl nextPage ( ResultCapture < Object > extractor ) { if ( getNextToken ( ) == null ) { throw new NoSuchElementException ( "There is no next page" ) ; } ActionResult result = ActionUtils . perform ( context , listActionModel , request , extractor , getNextToken ( ) ) ; return new ResourcePageImpl ( context , listActionModel , request , result ) ; } | Makes a request to the service to retrieve the next page of resources in the collection . | 90 | 18 |
20,073 | public Lemma getLemma ( ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_lemma == null ) jcasType . jcas . throwFeatMissing ( "lemma" , "de.julielab.jules.types.Token" ) ; return ( Lemma ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_lemma ) ) ) ; } | getter for lemma - gets the lemma information O | 135 | 12 |
20,074 | public void setLemma ( Lemma v ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_lemma == null ) jcasType . jcas . throwFeatMissing ( "lemma" , "de.julielab.jules.types.Token" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_lemma , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for lemma - sets the lemma information O | 131 | 12 |
20,075 | public String getOrthogr ( ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_orthogr == null ) jcasType . jcas . throwFeatMissing ( "orthogr" , "de.julielab.jules.types.Token" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_orthogr ) ; } | getter for orthogr - gets see de . julielab . jules . types . Orthogrpahy | 116 | 27 |
20,076 | public void setOrthogr ( String v ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_orthogr == null ) jcasType . jcas . throwFeatMissing ( "orthogr" , "de.julielab.jules.types.Token" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_orthogr , v ) ; } | setter for orthogr - sets see de . julielab . jules . types . Orthogrpahy | 119 | 27 |
20,077 | public FSArray getDepRel ( ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_depRel == null ) jcasType . jcas . throwFeatMissing ( "depRel" , "de.julielab.jules.types.Token" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_depRel ) ) ) ; } | getter for depRel - gets Contains a list of syntactical dependencies see DependencyRelation O | 134 | 21 |
20,078 | public void setDepRel ( FSArray v ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_depRel == null ) jcasType . jcas . throwFeatMissing ( "depRel" , "de.julielab.jules.types.Token" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_depRel , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for depRel - sets Contains a list of syntactical dependencies see DependencyRelation O | 130 | 21 |
20,079 | public DependencyRelation getDepRel ( int i ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_depRel == null ) jcasType . jcas . throwFeatMissing ( "depRel" , "de.julielab.jules.types.Token" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_depRel ) , i ) ; return ( DependencyRelation ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_depRel ) , i ) ) ) ; } | indexed getter for depRel - gets an indexed value - Contains a list of syntactical dependencies see DependencyRelation O | 209 | 27 |
20,080 | public void setDepRel ( int i , DependencyRelation v ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_depRel == null ) jcasType . jcas . throwFeatMissing ( "depRel" , "de.julielab.jules.types.Token" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_depRel ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_depRel ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | indexed setter for depRel - sets an indexed value - Contains a list of syntactical dependencies see DependencyRelation O | 204 | 27 |
20,081 | public String getLemmaStr ( ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_lemmaStr == null ) jcasType . jcas . throwFeatMissing ( "lemmaStr" , "de.julielab.jules.types.Token" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_lemmaStr ) ; } | getter for lemmaStr - gets | 116 | 8 |
20,082 | public void setLemmaStr ( String v ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_lemmaStr == null ) jcasType . jcas . throwFeatMissing ( "lemmaStr" , "de.julielab.jules.types.Token" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_lemmaStr , v ) ; } | setter for lemmaStr - sets | 119 | 8 |
20,083 | public String getTopicIds ( ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_topicIds == null ) jcasType . jcas . throwFeatMissing ( "topicIds" , "de.julielab.jules.types.Token" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_topicIds ) ; } | getter for topicIds - gets topic model ids separated by spaces | 115 | 15 |
20,084 | public void setTopicIds ( String v ) { if ( Token_Type . featOkTst && ( ( Token_Type ) jcasType ) . casFeat_topicIds == null ) jcasType . jcas . throwFeatMissing ( "topicIds" , "de.julielab.jules.types.Token" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Token_Type ) jcasType ) . casFeatCode_topicIds , v ) ; } | setter for topicIds - sets topic model ids separated by spaces | 118 | 15 |
20,085 | public void setArguments ( FSArray v ) { if ( RelationMention_Type . featOkTst && ( ( RelationMention_Type ) jcasType ) . casFeat_arguments == null ) jcasType . jcas . throwFeatMissing ( "arguments" , "de.julielab.jules.types.RelationMention" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( RelationMention_Type ) jcasType ) . casFeatCode_arguments , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for arguments - sets | 142 | 6 |
20,086 | public void setArguments ( int i , ArgumentMention v ) { if ( RelationMention_Type . featOkTst && ( ( RelationMention_Type ) jcasType ) . casFeat_arguments == null ) jcasType . jcas . throwFeatMissing ( "arguments" , "de.julielab.jules.types.RelationMention" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( RelationMention_Type ) jcasType ) . casFeatCode_arguments ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( RelationMention_Type ) jcasType ) . casFeatCode_arguments ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | indexed setter for arguments - sets an indexed value - | 218 | 12 |
20,087 | public Set < String > editMention ( String mention ) { Set < String > result = new HashSet < String > ( ) ; // tokenize StringTokenizer tokens = new StringTokenizer ( mention , delims , false ) ; List < String > tokenList = new LinkedList < String > ( ) ; if ( tokens . countTokens ( ) < 3 ) return result ; while ( tokens . hasMoreTokens ( ) ) { tokenList . add ( tokens . nextToken ( ) ) ; } String first = tokenList . get ( 0 ) ; String second = tokenList . get ( 1 ) ; String third = tokenList . get ( 2 ) ; if ( second . equals ( "and" ) || second . equals ( "or" ) || second . equals ( "to" ) ) { if ( directions . contains ( first ) && directions . contains ( third ) ) { // log.info( first + " " + second + " " + third + " Full:" + s // ); int spot = mention . indexOf ( third ) + third . length ( ) ; result . add ( first + mention . substring ( spot ) ) ; result . add ( third + mention . substring ( spot ) ) ; } } return result ; } | split the mention using the directions | 262 | 6 |
20,088 | public String getResolved ( ) { if ( Coordination_Type . featOkTst && ( ( Coordination_Type ) jcasType ) . casFeat_resolved == null ) jcasType . jcas . throwFeatMissing ( "resolved" , "de.julielab.jules.types.Coordination" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Coordination_Type ) jcasType ) . casFeatCode_resolved ) ; } | getter for resolved - gets | 116 | 6 |
20,089 | public void setResolved ( String v ) { if ( Coordination_Type . featOkTst && ( ( Coordination_Type ) jcasType ) . casFeat_resolved == null ) jcasType . jcas . throwFeatMissing ( "resolved" , "de.julielab.jules.types.Coordination" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Coordination_Type ) jcasType ) . casFeatCode_resolved , v ) ; } | setter for resolved - sets | 119 | 6 |
20,090 | public boolean getElliptical ( ) { if ( Coordination_Type . featOkTst && ( ( Coordination_Type ) jcasType ) . casFeat_elliptical == null ) jcasType . jcas . throwFeatMissing ( "elliptical" , "de.julielab.jules.types.Coordination" ) ; return jcasType . ll_cas . ll_getBooleanValue ( addr , ( ( Coordination_Type ) jcasType ) . casFeatCode_elliptical ) ; } | getter for elliptical - gets | 121 | 7 |
20,091 | public void setElliptical ( boolean v ) { if ( Coordination_Type . featOkTst && ( ( Coordination_Type ) jcasType ) . casFeat_elliptical == null ) jcasType . jcas . throwFeatMissing ( "elliptical" , "de.julielab.jules.types.Coordination" ) ; jcasType . ll_cas . ll_setBooleanValue ( addr , ( ( Coordination_Type ) jcasType ) . casFeatCode_elliptical , v ) ; } | setter for elliptical - sets | 124 | 7 |
20,092 | public void log ( ) { System . out . println ( "Lemmatiser: " + ( lemmatiser == null ? null : lemmatiser . getClass ( ) . getName ( ) ) ) ; System . out . println ( "POSTagger: " + ( posTagger == null ? null : posTagger . getClass ( ) . getName ( ) ) ) ; System . out . println ( "Tokenizer: " + tokenizer . getClass ( ) . getName ( ) ) ; System . out . println ( "Tag format: " + tagFormat . name ( ) ) ; System . out . println ( "PostProcessor: " + ( postProcessor == null ? null : postProcessor . getClass ( ) . getName ( ) ) ) ; System . out . println ( "Using numeric normalization: " + useNumericNormalization ) ; System . out . println ( "CRF order is " + order ) ; System . out . println ( "Using feature induction: " + useFeatureInduction ) ; System . out . println ( "Text textDirection: " + textDirection ) ; } | Outputs the settings for this configuration to the console very useful for ensuring the configuration is set as desired prior to a training run | 244 | 25 |
20,093 | protected double scoreCombination ( double [ ] multiScore ) { double sum = 0.0 ; for ( int i = 0 ; i < multiScore . length ; i ++ ) { sum += multiScore [ i ] ; } return sum / multiScore . length ; } | Combine the scores for each primitive distance function on each field . | 56 | 13 |
20,094 | protected String explainScoreCombination ( double [ ] multiScore ) { StringBuffer buf = new StringBuffer ( "" ) ; PrintfFormat fmt = new PrintfFormat ( " %.3f" ) ; buf . append ( "field-level scores [" ) ; for ( int i = 0 ; i < multiScore . length ; i ++ ) { buf . append ( fmt . sprintf ( multiScore [ i ] ) ) ; } buf . append ( "] Average score:" ) ; buf . append ( fmt . sprintf ( scoreCombination ( multiScore ) ) ) ; return buf . toString ( ) ; } | Explain how to combine the scores for each primitive distance function on each field . | 130 | 16 |
20,095 | public boolean accept ( File f ) { if ( f . isDirectory ( ) ) { return false ; } String name = f . getName ( ) . toLowerCase ( ) ; return name . endsWith ( ".pdf" ) ; } | Judges whether a file is a PDF document or not | 50 | 11 |
20,096 | public Annotation getFirstEntity ( ) { if ( Cooccurrence_Type . featOkTst && ( ( Cooccurrence_Type ) jcasType ) . casFeat_firstEntity == null ) jcasType . jcas . throwFeatMissing ( "firstEntity" , "ch.epfl.bbp.uima.types.Cooccurrence" ) ; return ( Annotation ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Cooccurrence_Type ) jcasType ) . casFeatCode_firstEntity ) ) ) ; } | getter for firstEntity - gets | 143 | 7 |
20,097 | public void setFirstEntity ( Annotation v ) { if ( Cooccurrence_Type . featOkTst && ( ( Cooccurrence_Type ) jcasType ) . casFeat_firstEntity == null ) jcasType . jcas . throwFeatMissing ( "firstEntity" , "ch.epfl.bbp.uima.types.Cooccurrence" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Cooccurrence_Type ) jcasType ) . casFeatCode_firstEntity , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for firstEntity - sets | 139 | 7 |
20,098 | public Annotation getSecondEntity ( ) { if ( Cooccurrence_Type . featOkTst && ( ( Cooccurrence_Type ) jcasType ) . casFeat_secondEntity == null ) jcasType . jcas . throwFeatMissing ( "secondEntity" , "ch.epfl.bbp.uima.types.Cooccurrence" ) ; return ( Annotation ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Cooccurrence_Type ) jcasType ) . casFeatCode_secondEntity ) ) ) ; } | getter for secondEntity - gets | 143 | 7 |
20,099 | public void setSecondEntity ( Annotation v ) { if ( Cooccurrence_Type . featOkTst && ( ( Cooccurrence_Type ) jcasType ) . casFeat_secondEntity == null ) jcasType . jcas . throwFeatMissing ( "secondEntity" , "ch.epfl.bbp.uima.types.Cooccurrence" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Cooccurrence_Type ) jcasType ) . casFeatCode_secondEntity , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for secondEntity - sets | 139 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.