repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.load
@SuppressWarnings("unchecked") public void load(File propertiesFile) throws IOException { String paramName; String paramValue; Reader reader = new FileReader(propertiesFile); _properties.load(reader); reader.close(); paramName = StoreParams.PARAM_INDEXES_CACHED; paramValue = _properties.getProperty(paramName); setIndexesCached(parseBoolean(paramName, paramValue, StoreParams.INDEXES_CACHED_DEFAULT)); paramName = StoreParams.PARAM_BATCH_SIZE; paramValue = _properties.getProperty(paramName); setBatchSize(parseInt(paramName, paramValue, StoreParams.BATCH_SIZE_DEFAULT)); paramName = StoreParams.PARAM_NUM_SYNC_BATCHES; paramValue = _properties.getProperty(paramName); setNumSyncBatches(parseInt(paramName, paramValue, StoreParams.NUM_SYNC_BATCHES_DEFAULT)); paramName = StoreParams.PARAM_SEGMENT_FILE_SIZE_MB; paramValue = _properties.getProperty(paramName); setSegmentFileSizeMB(parseInt(paramName, paramValue, StoreParams.SEGMENT_FILE_SIZE_MB_DEFAULT)); paramName = StoreParams.PARAM_SEGMENT_COMPACT_FACTOR; paramValue = _properties.getProperty(paramName); setSegmentCompactFactor(parseDouble(paramName, paramValue, StoreParams.SEGMENT_COMPACT_FACTOR_DEFAULT)); paramName = StoreParams.PARAM_HASH_LOAD_FACTOR; paramValue = _properties.getProperty(paramName); setHashLoadFactor(parseDouble(paramName, paramValue, StoreParams.HASH_LOAD_FACTOR_DEFAULT)); // Create _segmentFactory paramName = StoreParams.PARAM_SEGMENT_FACTORY_CLASS; paramValue = _properties.getProperty(paramName); SegmentFactory segmentFactory = null; if(paramValue != null) { try { segmentFactory = Class.forName(paramValue).asSubclass(SegmentFactory.class).newInstance(); } catch(Exception e) { _logger.warn("Invalid SegmentFactory class: " + paramValue); } } if(segmentFactory == null) { segmentFactory = new MappedSegmentFactory(); } setSegmentFactory(segmentFactory); // Create _hashFunction paramName = StoreParams.PARAM_HASH_FUNCTION_CLASS; paramValue = _properties.getProperty(paramName); HashFunction<byte[]> hashFunction = null; if(paramValue != null) { try { hashFunction = (HashFunction<byte[]>)Class.forName(paramValue).newInstance(); } catch(Exception e) { _logger.warn("Invalid HashFunction<byte[]> class: " + paramValue); } } if(hashFunction == null) { hashFunction = new FnvHashFunction(); } setHashFunction(hashFunction); // Create _dataHandler paramName = StoreParams.PARAM_DATA_HANDLER_CLASS; paramValue = _properties.getProperty(paramName); DataHandler dataHandler = null; if(paramValue != null) { try { dataHandler = (DataHandler)Class.forName(paramValue).newInstance(); } catch(Exception e) { _logger.warn("Invalid DataHandler class: " + paramValue); } } if(dataHandler != null) { setDataHandler(dataHandler); } }
java
@SuppressWarnings("unchecked") public void load(File propertiesFile) throws IOException { String paramName; String paramValue; Reader reader = new FileReader(propertiesFile); _properties.load(reader); reader.close(); paramName = StoreParams.PARAM_INDEXES_CACHED; paramValue = _properties.getProperty(paramName); setIndexesCached(parseBoolean(paramName, paramValue, StoreParams.INDEXES_CACHED_DEFAULT)); paramName = StoreParams.PARAM_BATCH_SIZE; paramValue = _properties.getProperty(paramName); setBatchSize(parseInt(paramName, paramValue, StoreParams.BATCH_SIZE_DEFAULT)); paramName = StoreParams.PARAM_NUM_SYNC_BATCHES; paramValue = _properties.getProperty(paramName); setNumSyncBatches(parseInt(paramName, paramValue, StoreParams.NUM_SYNC_BATCHES_DEFAULT)); paramName = StoreParams.PARAM_SEGMENT_FILE_SIZE_MB; paramValue = _properties.getProperty(paramName); setSegmentFileSizeMB(parseInt(paramName, paramValue, StoreParams.SEGMENT_FILE_SIZE_MB_DEFAULT)); paramName = StoreParams.PARAM_SEGMENT_COMPACT_FACTOR; paramValue = _properties.getProperty(paramName); setSegmentCompactFactor(parseDouble(paramName, paramValue, StoreParams.SEGMENT_COMPACT_FACTOR_DEFAULT)); paramName = StoreParams.PARAM_HASH_LOAD_FACTOR; paramValue = _properties.getProperty(paramName); setHashLoadFactor(parseDouble(paramName, paramValue, StoreParams.HASH_LOAD_FACTOR_DEFAULT)); // Create _segmentFactory paramName = StoreParams.PARAM_SEGMENT_FACTORY_CLASS; paramValue = _properties.getProperty(paramName); SegmentFactory segmentFactory = null; if(paramValue != null) { try { segmentFactory = Class.forName(paramValue).asSubclass(SegmentFactory.class).newInstance(); } catch(Exception e) { _logger.warn("Invalid SegmentFactory class: " + paramValue); } } if(segmentFactory == null) { segmentFactory = new MappedSegmentFactory(); } setSegmentFactory(segmentFactory); // Create _hashFunction paramName = StoreParams.PARAM_HASH_FUNCTION_CLASS; paramValue = _properties.getProperty(paramName); HashFunction<byte[]> hashFunction = null; if(paramValue != null) { try { hashFunction = (HashFunction<byte[]>)Class.forName(paramValue).newInstance(); } catch(Exception e) { _logger.warn("Invalid HashFunction<byte[]> class: " + paramValue); } } if(hashFunction == null) { hashFunction = new FnvHashFunction(); } setHashFunction(hashFunction); // Create _dataHandler paramName = StoreParams.PARAM_DATA_HANDLER_CLASS; paramValue = _properties.getProperty(paramName); DataHandler dataHandler = null; if(paramValue != null) { try { dataHandler = (DataHandler)Class.forName(paramValue).newInstance(); } catch(Exception e) { _logger.warn("Invalid DataHandler class: " + paramValue); } } if(dataHandler != null) { setDataHandler(dataHandler); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "load", "(", "File", "propertiesFile", ")", "throws", "IOException", "{", "String", "paramName", ";", "String", "paramValue", ";", "Reader", "reader", "=", "new", "FileReader", "(", "propertie...
Loads configuration from a properties file. @param propertiesFile - a configuration properties file @throws IOException
[ "Loads", "configuration", "from", "a", "properties", "file", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L203-L282
train
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.validate
public void validate() throws InvalidStoreConfigException { if(getSegmentFactory() == null) { throw new InvalidStoreConfigException("Segment factory not found"); } if(getHashFunction() == null) { throw new InvalidStoreConfigException("Store hash function not found"); } if(getBatchSize() < StoreParams.BATCH_SIZE_MIN) { throw new InvalidStoreConfigException(StoreParams.PARAM_BATCH_SIZE + "=" + getBatchSize()); } if(getNumSyncBatches() < StoreParams.NUM_SYNC_BATCHES_MIN) { throw new InvalidStoreConfigException(StoreParams.PARAM_NUM_SYNC_BATCHES + "=" + getNumSyncBatches()); } if(getHashLoadFactor() < StoreParams.HASH_LOAD_FACTOR_MIN || getHashLoadFactor() > StoreParams.HASH_LOAD_FACTOR_MAX) { throw new InvalidStoreConfigException(StoreParams.PARAM_HASH_LOAD_FACTOR + "=" + getHashLoadFactor()); } if(getSegmentFileSizeMB() < StoreParams.SEGMENT_FILE_SIZE_MB_MIN || getSegmentFileSizeMB() > StoreParams.SEGMENT_FILE_SIZE_MB_MAX) { throw new InvalidStoreConfigException(StoreParams.PARAM_SEGMENT_FILE_SIZE_MB + "=" + getSegmentFileSizeMB()); } if(getSegmentCompactFactor() < StoreParams.SEGMENT_COMPACT_FACTOR_MIN || getSegmentCompactFactor() > StoreParams.SEGMENT_COMPACT_FACTOR_MAX) { throw new InvalidStoreConfigException(StoreParams.PARAM_SEGMENT_COMPACT_FACTOR + "=" + getSegmentCompactFactor()); } }
java
public void validate() throws InvalidStoreConfigException { if(getSegmentFactory() == null) { throw new InvalidStoreConfigException("Segment factory not found"); } if(getHashFunction() == null) { throw new InvalidStoreConfigException("Store hash function not found"); } if(getBatchSize() < StoreParams.BATCH_SIZE_MIN) { throw new InvalidStoreConfigException(StoreParams.PARAM_BATCH_SIZE + "=" + getBatchSize()); } if(getNumSyncBatches() < StoreParams.NUM_SYNC_BATCHES_MIN) { throw new InvalidStoreConfigException(StoreParams.PARAM_NUM_SYNC_BATCHES + "=" + getNumSyncBatches()); } if(getHashLoadFactor() < StoreParams.HASH_LOAD_FACTOR_MIN || getHashLoadFactor() > StoreParams.HASH_LOAD_FACTOR_MAX) { throw new InvalidStoreConfigException(StoreParams.PARAM_HASH_LOAD_FACTOR + "=" + getHashLoadFactor()); } if(getSegmentFileSizeMB() < StoreParams.SEGMENT_FILE_SIZE_MB_MIN || getSegmentFileSizeMB() > StoreParams.SEGMENT_FILE_SIZE_MB_MAX) { throw new InvalidStoreConfigException(StoreParams.PARAM_SEGMENT_FILE_SIZE_MB + "=" + getSegmentFileSizeMB()); } if(getSegmentCompactFactor() < StoreParams.SEGMENT_COMPACT_FACTOR_MIN || getSegmentCompactFactor() > StoreParams.SEGMENT_COMPACT_FACTOR_MAX) { throw new InvalidStoreConfigException(StoreParams.PARAM_SEGMENT_COMPACT_FACTOR + "=" + getSegmentCompactFactor()); } }
[ "public", "void", "validate", "(", ")", "throws", "InvalidStoreConfigException", "{", "if", "(", "getSegmentFactory", "(", ")", "==", "null", ")", "{", "throw", "new", "InvalidStoreConfigException", "(", "\"Segment factory not found\"", ")", ";", "}", "if", "(", ...
Checks the validity of this StoreConfig. @throws InvalidStoreConfigException if any store parameter is found invalid.
[ "Checks", "the", "validity", "of", "this", "StoreConfig", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L311-L339
train
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.setProperty
public boolean setProperty(String pName, String pValue) { if(pName == null) return false; _properties.setProperty(pName, pValue); return true; }
java
public boolean setProperty(String pName, String pValue) { if(pName == null) return false; _properties.setProperty(pName, pValue); return true; }
[ "public", "boolean", "setProperty", "(", "String", "pName", ",", "String", "pValue", ")", "{", "if", "(", "pName", "==", "null", ")", "return", "false", ";", "_properties", ".", "setProperty", "(", "pName", ",", "pValue", ")", ";", "return", "true", ";",...
Sets a store configuration property via its name and value. @param pName - the property name @param pValue - the property value @return <code>true</code> if the property is set successfully.
[ "Sets", "a", "store", "configuration", "property", "via", "its", "name", "and", "value", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L365-L369
train
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.setClass
public boolean setClass(String pName, Class<?> pValue) { if(pName == null) return false; _properties.setProperty(pName, pValue.getName() + ""); return true; }
java
public boolean setClass(String pName, Class<?> pValue) { if(pName == null) return false; _properties.setProperty(pName, pValue.getName() + ""); return true; }
[ "public", "boolean", "setClass", "(", "String", "pName", ",", "Class", "<", "?", ">", "pValue", ")", "{", "if", "(", "pName", "==", "null", ")", "return", "false", ";", "_properties", ".", "setProperty", "(", "pName", ",", "pValue", ".", "getName", "("...
Sets a class property via a string property name.
[ "Sets", "a", "class", "property", "via", "a", "string", "property", "name", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L410-L414
train
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.getInt
public int getInt(String pName, int defaultValue) { String pValue = _properties.getProperty(pName); return parseInt(pName, pValue, defaultValue); }
java
public int getInt(String pName, int defaultValue) { String pValue = _properties.getProperty(pName); return parseInt(pName, pValue, defaultValue); }
[ "public", "int", "getInt", "(", "String", "pName", ",", "int", "defaultValue", ")", "{", "String", "pValue", "=", "_properties", ".", "getProperty", "(", "pName", ")", ";", "return", "parseInt", "(", "pName", ",", "pValue", ",", "defaultValue", ")", ";", ...
Gets an integer property via a string property name. @param pName - the property name @param defaultValue - the default property value @return an integer property
[ "Gets", "an", "integer", "property", "via", "a", "string", "property", "name", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L423-L426
train
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.getFloat
public float getFloat(String pName, float defaultValue) { String pValue = _properties.getProperty(pName); return parseFloat(pName, pValue, defaultValue); }
java
public float getFloat(String pName, float defaultValue) { String pValue = _properties.getProperty(pName); return parseFloat(pName, pValue, defaultValue); }
[ "public", "float", "getFloat", "(", "String", "pName", ",", "float", "defaultValue", ")", "{", "String", "pValue", "=", "_properties", ".", "getProperty", "(", "pName", ")", ";", "return", "parseFloat", "(", "pName", ",", "pValue", ",", "defaultValue", ")", ...
Gets a float property via a string property name. @param pName - the property name @param defaultValue - the default property value @return a float property
[ "Gets", "a", "float", "property", "via", "a", "string", "property", "name", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L435-L438
train
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.getDouble
public double getDouble(String pName, double defaultValue) { String pValue = _properties.getProperty(pName); return parseDouble(pName, pValue, defaultValue); }
java
public double getDouble(String pName, double defaultValue) { String pValue = _properties.getProperty(pName); return parseDouble(pName, pValue, defaultValue); }
[ "public", "double", "getDouble", "(", "String", "pName", ",", "double", "defaultValue", ")", "{", "String", "pValue", "=", "_properties", ".", "getProperty", "(", "pName", ")", ";", "return", "parseDouble", "(", "pName", ",", "pValue", ",", "defaultValue", "...
Gets a double property via a string property name. @param pName - the property name @param defaultValue - the default property value @return a double property
[ "Gets", "a", "double", "property", "via", "a", "string", "property", "name", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L447-L450
train
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.getBoolean
public boolean getBoolean(String pName, boolean defaultValue) { String pValue = _properties.getProperty(pName); return parseBoolean(pName, pValue, defaultValue); }
java
public boolean getBoolean(String pName, boolean defaultValue) { String pValue = _properties.getProperty(pName); return parseBoolean(pName, pValue, defaultValue); }
[ "public", "boolean", "getBoolean", "(", "String", "pName", ",", "boolean", "defaultValue", ")", "{", "String", "pValue", "=", "_properties", ".", "getProperty", "(", "pName", ")", ";", "return", "parseBoolean", "(", "pName", ",", "pValue", ",", "defaultValue",...
Gets a boolean property via a string property name. @param pName - the property name @param defaultValue - the default property value @return a boolean property
[ "Gets", "a", "boolean", "property", "via", "a", "string", "property", "name", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L459-L462
train
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.getClass
public Class<?> getClass(String pName, Class<?> defaultValue) { String pValue = _properties.getProperty(pName); return parseClass(pName, pValue, defaultValue); }
java
public Class<?> getClass(String pName, Class<?> defaultValue) { String pValue = _properties.getProperty(pName); return parseClass(pName, pValue, defaultValue); }
[ "public", "Class", "<", "?", ">", "getClass", "(", "String", "pName", ",", "Class", "<", "?", ">", "defaultValue", ")", "{", "String", "pValue", "=", "_properties", ".", "getProperty", "(", "pName", ")", ";", "return", "parseClass", "(", "pName", ",", ...
Gets a class property via a string property name. @param pName - the property name @param defaultValue - the default property value @return a {@link Class} property
[ "Gets", "a", "class", "property", "via", "a", "string", "property", "name", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L471-L474
train
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.setSegmentFactory
public void setSegmentFactory(SegmentFactory segmentFactory) { if(segmentFactory == null) { throw new IllegalArgumentException("Invalid segmentFactory: " + segmentFactory); } this._segmentFactory = segmentFactory; this._properties.setProperty(PARAM_SEGMENT_FACTORY_CLASS, segmentFactory.getClass().getName()); }
java
public void setSegmentFactory(SegmentFactory segmentFactory) { if(segmentFactory == null) { throw new IllegalArgumentException("Invalid segmentFactory: " + segmentFactory); } this._segmentFactory = segmentFactory; this._properties.setProperty(PARAM_SEGMENT_FACTORY_CLASS, segmentFactory.getClass().getName()); }
[ "public", "void", "setSegmentFactory", "(", "SegmentFactory", "segmentFactory", ")", "{", "if", "(", "segmentFactory", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid segmentFactory: \"", "+", "segmentFactory", ")", ";", "}", "thi...
Sets the segment factory of the target store. @param segmentFactory
[ "Sets", "the", "segment", "factory", "of", "the", "target", "store", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L538-L545
train
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.newInstance
public static StoreConfig newInstance(File filePath) throws IOException { File homeDir; Properties p = new Properties(); if(filePath.exists()) { if(filePath.isDirectory()) { homeDir = filePath; File propertiesFile = new File(filePath, CONFIG_PROPERTIES_FILE); if(propertiesFile.exists()) { FileReader reader = new FileReader(propertiesFile); p.load(reader); reader.close(); } else { throw new FileNotFoundException(propertiesFile.toString()); } } else { homeDir = filePath.getParentFile(); FileReader reader = new FileReader(filePath); p.load(reader); reader.close(); } } else { throw new FileNotFoundException(filePath.toString()); } int initialCapacity = -1; String initialCapacityStr = p.getProperty(StoreParams.PARAM_INITIAL_CAPACITY); if(initialCapacityStr == null) { throw new InvalidStoreConfigException(StoreParams.PARAM_INITIAL_CAPACITY + " not found"); } else if((initialCapacity = parseInt(StoreParams.PARAM_INITIAL_CAPACITY, initialCapacityStr, -1)) < 1) { throw new InvalidStoreConfigException(StoreParams.PARAM_INITIAL_CAPACITY + "=" + initialCapacityStr); } int partitionStart = -1; int partitionCount = -1; String partitionStartStr = p.getProperty(StoreParams.PARAM_PARTITION_START); String partitionCountStr = p.getProperty(StoreParams.PARAM_PARTITION_COUNT); if(partitionStartStr != null && partitionCountStr != null) { if((partitionStart = parseInt(StoreParams.PARAM_PARTITION_START, partitionStartStr, -1)) < 0) { throw new InvalidStoreConfigException(StoreParams.PARAM_PARTITION_START + "=" + partitionStartStr); } if((partitionCount = parseInt(StoreParams.PARAM_PARTITION_COUNT, partitionCountStr, -1)) < 1) { throw new InvalidStoreConfigException(StoreParams.PARAM_PARTITION_COUNT + "=" + partitionCountStr); } } else { return new StoreConfig(homeDir, initialCapacity); } return new StorePartitionConfig(homeDir, partitionStart, partitionCount); }
java
public static StoreConfig newInstance(File filePath) throws IOException { File homeDir; Properties p = new Properties(); if(filePath.exists()) { if(filePath.isDirectory()) { homeDir = filePath; File propertiesFile = new File(filePath, CONFIG_PROPERTIES_FILE); if(propertiesFile.exists()) { FileReader reader = new FileReader(propertiesFile); p.load(reader); reader.close(); } else { throw new FileNotFoundException(propertiesFile.toString()); } } else { homeDir = filePath.getParentFile(); FileReader reader = new FileReader(filePath); p.load(reader); reader.close(); } } else { throw new FileNotFoundException(filePath.toString()); } int initialCapacity = -1; String initialCapacityStr = p.getProperty(StoreParams.PARAM_INITIAL_CAPACITY); if(initialCapacityStr == null) { throw new InvalidStoreConfigException(StoreParams.PARAM_INITIAL_CAPACITY + " not found"); } else if((initialCapacity = parseInt(StoreParams.PARAM_INITIAL_CAPACITY, initialCapacityStr, -1)) < 1) { throw new InvalidStoreConfigException(StoreParams.PARAM_INITIAL_CAPACITY + "=" + initialCapacityStr); } int partitionStart = -1; int partitionCount = -1; String partitionStartStr = p.getProperty(StoreParams.PARAM_PARTITION_START); String partitionCountStr = p.getProperty(StoreParams.PARAM_PARTITION_COUNT); if(partitionStartStr != null && partitionCountStr != null) { if((partitionStart = parseInt(StoreParams.PARAM_PARTITION_START, partitionStartStr, -1)) < 0) { throw new InvalidStoreConfigException(StoreParams.PARAM_PARTITION_START + "=" + partitionStartStr); } if((partitionCount = parseInt(StoreParams.PARAM_PARTITION_COUNT, partitionCountStr, -1)) < 1) { throw new InvalidStoreConfigException(StoreParams.PARAM_PARTITION_COUNT + "=" + partitionCountStr); } } else { return new StoreConfig(homeDir, initialCapacity); } return new StorePartitionConfig(homeDir, partitionStart, partitionCount); }
[ "public", "static", "StoreConfig", "newInstance", "(", "File", "filePath", ")", "throws", "IOException", "{", "File", "homeDir", ";", "Properties", "p", "=", "new", "Properties", "(", ")", ";", "if", "(", "filePath", ".", "exists", "(", ")", ")", "{", "i...
Creates a new instance of StoreConfig. @param filePath - the <code>config.properties</code> file or the directory containing <code>config.properties</code> @return a new instance of StoreConfig @throws IOException @throws InvalidStoreConfigException
[ "Creates", "a", "new", "instance", "of", "StoreConfig", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L607-L656
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdDataItem.java
XsdDataItem.setAttributesFromUsage
private void setAttributesFromUsage(final Usage usage) { switch (usage) { case BINARY: _cobolType = CobolTypes.BINARY_ITEM; _xsdType = XsdType.INTEGER; break; case NATIVEBINARY: _cobolType = CobolTypes.NATIVE_BINARY_ITEM; _xsdType = XsdType.INTEGER; break; case SINGLEFLOAT: _cobolType = CobolTypes.SINGLE_FLOAT_ITEM; _xsdType = XsdType.FLOAT; _minStorageLength = 4; break; case DOUBLEFLOAT: _cobolType = CobolTypes.DOUBLE_FLOAT_ITEM; _xsdType = XsdType.DOUBLE; _minStorageLength = 8; break; case PACKEDDECIMAL: _cobolType = CobolTypes.PACKED_DECIMAL_ITEM; _xsdType = XsdType.DECIMAL; break; case INDEX: _cobolType = CobolTypes.INDEX_ITEM; _xsdType = XsdType.HEXBINARY; _minStorageLength = 4; break; case POINTER: _cobolType = CobolTypes.POINTER_ITEM; _xsdType = XsdType.HEXBINARY; _minStorageLength = 4; break; case PROCEDUREPOINTER: _cobolType = CobolTypes.PROC_POINTER_ITEM; _xsdType = XsdType.HEXBINARY; _minStorageLength = 8; break; case FUNCTIONPOINTER: _cobolType = CobolTypes.FUNC_POINTER_ITEM; _xsdType = XsdType.HEXBINARY; _minStorageLength = 4; break; case DISPLAY: _cobolType = CobolTypes.ALPHANUMERIC_ITEM; _xsdType = XsdType.STRING; break; case DISPLAY1: _cobolType = CobolTypes.DBCS_ITEM; _xsdType = XsdType.STRING; break; case NATIONAL: _cobolType = CobolTypes.NATIONAL_ITEM; _xsdType = XsdType.STRING; break; default: _log.error("Unrecognized usage clause " + toString()); } }
java
private void setAttributesFromUsage(final Usage usage) { switch (usage) { case BINARY: _cobolType = CobolTypes.BINARY_ITEM; _xsdType = XsdType.INTEGER; break; case NATIVEBINARY: _cobolType = CobolTypes.NATIVE_BINARY_ITEM; _xsdType = XsdType.INTEGER; break; case SINGLEFLOAT: _cobolType = CobolTypes.SINGLE_FLOAT_ITEM; _xsdType = XsdType.FLOAT; _minStorageLength = 4; break; case DOUBLEFLOAT: _cobolType = CobolTypes.DOUBLE_FLOAT_ITEM; _xsdType = XsdType.DOUBLE; _minStorageLength = 8; break; case PACKEDDECIMAL: _cobolType = CobolTypes.PACKED_DECIMAL_ITEM; _xsdType = XsdType.DECIMAL; break; case INDEX: _cobolType = CobolTypes.INDEX_ITEM; _xsdType = XsdType.HEXBINARY; _minStorageLength = 4; break; case POINTER: _cobolType = CobolTypes.POINTER_ITEM; _xsdType = XsdType.HEXBINARY; _minStorageLength = 4; break; case PROCEDUREPOINTER: _cobolType = CobolTypes.PROC_POINTER_ITEM; _xsdType = XsdType.HEXBINARY; _minStorageLength = 8; break; case FUNCTIONPOINTER: _cobolType = CobolTypes.FUNC_POINTER_ITEM; _xsdType = XsdType.HEXBINARY; _minStorageLength = 4; break; case DISPLAY: _cobolType = CobolTypes.ALPHANUMERIC_ITEM; _xsdType = XsdType.STRING; break; case DISPLAY1: _cobolType = CobolTypes.DBCS_ITEM; _xsdType = XsdType.STRING; break; case NATIONAL: _cobolType = CobolTypes.NATIONAL_ITEM; _xsdType = XsdType.STRING; break; default: _log.error("Unrecognized usage clause " + toString()); } }
[ "private", "void", "setAttributesFromUsage", "(", "final", "Usage", "usage", ")", "{", "switch", "(", "usage", ")", "{", "case", "BINARY", ":", "_cobolType", "=", "CobolTypes", ".", "BINARY_ITEM", ";", "_xsdType", "=", "XsdType", ".", "INTEGER", ";", "break"...
Derive XML schema attributes from a COBOL usage clause. This gives a rough approximation of the XSD type because the picture clause usually carries info that needs to be further analyzed to determine a more precise type. If no usage clause, we assume there will be a picture clause. @param usage COBOL usage clause
[ "Derive", "XML", "schema", "attributes", "from", "a", "COBOL", "usage", "clause", ".", "This", "gives", "a", "rough", "approximation", "of", "the", "XSD", "type", "because", "the", "picture", "clause", "usually", "carries", "info", "that", "needs", "to", "be...
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdDataItem.java#L430-L489
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdDataItem.java
XsdDataItem.getXmlCompatibleCobolName
public static String getXmlCompatibleCobolName(final String cobolName) { if (cobolName != null && cobolName.length() > 0 && Character.isDigit(cobolName.charAt(0))) { return SAFE_NAME_PREFIX + cobolName; } else { return cobolName; } }
java
public static String getXmlCompatibleCobolName(final String cobolName) { if (cobolName != null && cobolName.length() > 0 && Character.isDigit(cobolName.charAt(0))) { return SAFE_NAME_PREFIX + cobolName; } else { return cobolName; } }
[ "public", "static", "String", "getXmlCompatibleCobolName", "(", "final", "String", "cobolName", ")", "{", "if", "(", "cobolName", "!=", "null", "&&", "cobolName", ".", "length", "(", ")", ">", "0", "&&", "Character", ".", "isDigit", "(", "cobolName", ".", ...
Transform the COBOL name to a valid XML Name. Does not do any beautification other than strictly complying with XML specifications. @param cobolName the original COBOL data item name @return a valid XML Name
[ "Transform", "the", "COBOL", "name", "to", "a", "valid", "XML", "Name", ".", "Does", "not", "do", "any", "beautification", "other", "than", "strictly", "complying", "with", "XML", "specifications", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdDataItem.java#L868-L875
train
apptik/jus
android/jus-android/src/main/java/io/apptik/comm/jus/util/DefaultBitmapLruCache.java
DefaultBitmapLruCache.entryRemoved
@Override protected void entryRemoved(boolean evicted, String key, Bitmap oldValue, Bitmap newValue) { if (Utils.hasHoneycomb()) { // We're running on Honeycomb or later, so add the bitmap // to the pool set for possible use with inBitmap later addToPool(oldValue); } else { } }
java
@Override protected void entryRemoved(boolean evicted, String key, Bitmap oldValue, Bitmap newValue) { if (Utils.hasHoneycomb()) { // We're running on Honeycomb or later, so add the bitmap // to the pool set for possible use with inBitmap later addToPool(oldValue); } else { } }
[ "@", "Override", "protected", "void", "entryRemoved", "(", "boolean", "evicted", ",", "String", "key", ",", "Bitmap", "oldValue", ",", "Bitmap", "newValue", ")", "{", "if", "(", "Utils", ".", "hasHoneycomb", "(", ")", ")", "{", "// We're running on Honeycomb o...
Notify the removed entry that is no longer being cached
[ "Notify", "the", "removed", "entry", "that", "is", "no", "longer", "being", "cached" ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/android/jus-android/src/main/java/io/apptik/comm/jus/util/DefaultBitmapLruCache.java#L64-L74
train
apptik/jus
android/jus-android/src/main/java/io/apptik/comm/jus/util/DefaultBitmapLruCache.java
DefaultBitmapLruCache.sizeOf
@Override protected int sizeOf(String key, Bitmap value) { final int bitmapSize = BitmapLruPool.getBitmapSize(value); return bitmapSize == 0 ? 1 : bitmapSize; }
java
@Override protected int sizeOf(String key, Bitmap value) { final int bitmapSize = BitmapLruPool.getBitmapSize(value); return bitmapSize == 0 ? 1 : bitmapSize; }
[ "@", "Override", "protected", "int", "sizeOf", "(", "String", "key", ",", "Bitmap", "value", ")", "{", "final", "int", "bitmapSize", "=", "BitmapLruPool", ".", "getBitmapSize", "(", "value", ")", ";", "return", "bitmapSize", "==", "0", "?", "1", ":", "bi...
Measure item size in kilobytes rather than units which is more practical for a bitmap cache
[ "Measure", "item", "size", "in", "kilobytes", "rather", "than", "units", "which", "is", "more", "practical", "for", "a", "bitmap", "cache" ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/android/jus-android/src/main/java/io/apptik/comm/jus/util/DefaultBitmapLruCache.java#L80-L84
train
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/IOTypeLongArray.java
IOTypeLongArray.saveHWMark
@Override public void saveHWMark(long endOfPeriod) { if(getHWMark() < endOfPeriod) { try { set(0, get(0), endOfPeriod); } catch(Exception e) { _logger.error("Failed to saveHWMark " + endOfPeriod, e); } } else if(0 < endOfPeriod && endOfPeriod < getLWMark()) { try { _entryManager.sync(); } catch(Exception e) { _logger.error("Failed to saveHWMark" + endOfPeriod, e); } _entryManager.setWaterMarks(endOfPeriod, endOfPeriod); } }
java
@Override public void saveHWMark(long endOfPeriod) { if(getHWMark() < endOfPeriod) { try { set(0, get(0), endOfPeriod); } catch(Exception e) { _logger.error("Failed to saveHWMark " + endOfPeriod, e); } } else if(0 < endOfPeriod && endOfPeriod < getLWMark()) { try { _entryManager.sync(); } catch(Exception e) { _logger.error("Failed to saveHWMark" + endOfPeriod, e); } _entryManager.setWaterMarks(endOfPeriod, endOfPeriod); } }
[ "@", "Override", "public", "void", "saveHWMark", "(", "long", "endOfPeriod", ")", "{", "if", "(", "getHWMark", "(", ")", "<", "endOfPeriod", ")", "{", "try", "{", "set", "(", "0", ",", "get", "(", "0", ")", ",", "endOfPeriod", ")", ";", "}", "catch...
Sync-up the high water mark to a given value. @param endOfPeriod
[ "Sync", "-", "up", "the", "high", "water", "mark", "to", "a", "given", "value", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/IOTypeLongArray.java#L77-L93
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/NetworkEntryEvent.java
NetworkEntryEvent.addNodeActiveParticipant
public void addNodeActiveParticipant(String userId, String altUserId, String userName, String networkId) { addActiveParticipant( userId, altUserId, userName, false, null, networkId); }
java
public void addNodeActiveParticipant(String userId, String altUserId, String userName, String networkId) { addActiveParticipant( userId, altUserId, userName, false, null, networkId); }
[ "public", "void", "addNodeActiveParticipant", "(", "String", "userId", ",", "String", "altUserId", ",", "String", "userName", ",", "String", "networkId", ")", "{", "addActiveParticipant", "(", "userId", ",", "altUserId", ",", "userName", ",", "false", ",", "null...
Add an Active Participant to this message representing the node doing the network entry @param userId The Active Participant's User ID @param altUserId The Active Participant's Alternate UserID @param userName The Active Participant's UserName @param networkId The Active Participant's Network Access Point ID
[ "Add", "an", "Active", "Participant", "to", "this", "message", "representing", "the", "node", "doing", "the", "network", "entry" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/NetworkEntryEvent.java#L52-L61
train
keshrath/Giphy4J
src/main/java/at/mukprojects/giphy4j/Giphy.java
Giphy.search
public SearchFeed search(String query, int limit, int offset) throws GiphyException { SearchFeed feed = null; HashMap<String, String> params = new HashMap<String, String>(); params.put("api_key", apiKey); params.put("q", query); if (limit > 100) { params.put("limit", "100"); } else { params.put("limit", limit + ""); } params.put("offset", offset + ""); Request request = new Request(UrlUtil.buildUrlQuery(SearchEndpoint, params)); try { Response response = sender.sendRequest(request); feed = gson.fromJson(response.getBody(), SearchFeed.class); } catch (JsonSyntaxException | IOException e) { log.error(e.getMessage(), e); throw new GiphyException(e); } return feed; }
java
public SearchFeed search(String query, int limit, int offset) throws GiphyException { SearchFeed feed = null; HashMap<String, String> params = new HashMap<String, String>(); params.put("api_key", apiKey); params.put("q", query); if (limit > 100) { params.put("limit", "100"); } else { params.put("limit", limit + ""); } params.put("offset", offset + ""); Request request = new Request(UrlUtil.buildUrlQuery(SearchEndpoint, params)); try { Response response = sender.sendRequest(request); feed = gson.fromJson(response.getBody(), SearchFeed.class); } catch (JsonSyntaxException | IOException e) { log.error(e.getMessage(), e); throw new GiphyException(e); } return feed; }
[ "public", "SearchFeed", "search", "(", "String", "query", ",", "int", "limit", ",", "int", "offset", ")", "throws", "GiphyException", "{", "SearchFeed", "feed", "=", "null", ";", "HashMap", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap"...
Search all Giphy GIFs for a word or phrase and returns a SearchFeed object. <p> Be aware that not every response has all information available. In that case the value will be returned as null. @param query the query parameters. Multiple parameters are separated by a space @param limit the result limit. The maximum is 100. @param offset the offset @return the SearchFeed object @throws GiphyException if an error occurs during the search
[ "Search", "all", "Giphy", "GIFs", "for", "a", "word", "or", "phrase", "and", "returns", "a", "SearchFeed", "object", "." ]
e56b67f161e2184ccff9b9e8f95a70ef89cec897
https://github.com/keshrath/Giphy4J/blob/e56b67f161e2184ccff9b9e8f95a70ef89cec897/src/main/java/at/mukprojects/giphy4j/Giphy.java#L138-L163
train
keshrath/Giphy4J
src/main/java/at/mukprojects/giphy4j/Giphy.java
Giphy.searchByID
public SearchGiphy searchByID(String id) throws GiphyException { SearchGiphy giphy = null; HashMap<String, String> params = new HashMap<String, String>(); params.put("api_key", apiKey); Request request = new Request(UrlUtil.buildUrlQuery(IDEndpoint + id, params)); try { Response response = sender.sendRequest(request); giphy = gson.fromJson(response.getBody(), SearchGiphy.class); } catch (JsonSyntaxException | IOException e) { log.error(e.getMessage(), e); throw new GiphyException(e); } return giphy; }
java
public SearchGiphy searchByID(String id) throws GiphyException { SearchGiphy giphy = null; HashMap<String, String> params = new HashMap<String, String>(); params.put("api_key", apiKey); Request request = new Request(UrlUtil.buildUrlQuery(IDEndpoint + id, params)); try { Response response = sender.sendRequest(request); giphy = gson.fromJson(response.getBody(), SearchGiphy.class); } catch (JsonSyntaxException | IOException e) { log.error(e.getMessage(), e); throw new GiphyException(e); } return giphy; }
[ "public", "SearchGiphy", "searchByID", "(", "String", "id", ")", "throws", "GiphyException", "{", "SearchGiphy", "giphy", "=", "null", ";", "HashMap", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(...
Returns a SerachGiphy object. <p> Be aware that not every response has all information available. In that case the value will be returned as null. @param id the Giphy id @return the SerachGiphy object @throws GiphyException if an error occurs during the search
[ "Returns", "a", "SerachGiphy", "object", "." ]
e56b67f161e2184ccff9b9e8f95a70ef89cec897
https://github.com/keshrath/Giphy4J/blob/e56b67f161e2184ccff9b9e8f95a70ef89cec897/src/main/java/at/mukprojects/giphy4j/Giphy.java#L178-L196
train
keshrath/Giphy4J
src/main/java/at/mukprojects/giphy4j/Giphy.java
Giphy.trendSticker
public SearchFeed trendSticker() throws GiphyException { SearchFeed feed = null; HashMap<String, String> params = new HashMap<String, String>(); params.put("api_key", apiKey); Request request = new Request(UrlUtil.buildUrlQuery(TrendingStickerEndpoint, params)); try { Response response = sender.sendRequest(request); feed = gson.fromJson(response.getBody(), SearchFeed.class); } catch (JsonSyntaxException | IOException e) { log.error(e.getMessage(), e); throw new GiphyException(e); } return feed; }
java
public SearchFeed trendSticker() throws GiphyException { SearchFeed feed = null; HashMap<String, String> params = new HashMap<String, String>(); params.put("api_key", apiKey); Request request = new Request(UrlUtil.buildUrlQuery(TrendingStickerEndpoint, params)); try { Response response = sender.sendRequest(request); feed = gson.fromJson(response.getBody(), SearchFeed.class); } catch (JsonSyntaxException | IOException e) { log.error(e.getMessage(), e); throw new GiphyException(e); } return feed; }
[ "public", "SearchFeed", "trendSticker", "(", ")", "throws", "GiphyException", "{", "SearchFeed", "feed", "=", "null", ";", "HashMap", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "p...
Fetch GIFs currently trending online. Hand curated by the Giphy editorial team. The data returned mirrors the GIFs showcased on the Giphy homepage. Returns 25 results by default. <p> Be aware that not every response has all information available. In that case the value will be returned as null. @return the SearchFeed object @throws GiphyException if an error occurs during the search
[ "Fetch", "GIFs", "currently", "trending", "online", ".", "Hand", "curated", "by", "the", "Giphy", "editorial", "team", ".", "The", "data", "returned", "mirrors", "the", "GIFs", "showcased", "on", "the", "Giphy", "homepage", ".", "Returns", "25", "results", "...
e56b67f161e2184ccff9b9e8f95a70ef89cec897
https://github.com/keshrath/Giphy4J/blob/e56b67f161e2184ccff9b9e8f95a70ef89cec897/src/main/java/at/mukprojects/giphy4j/Giphy.java#L415-L433
train
keshrath/Giphy4J
src/main/java/at/mukprojects/giphy4j/Giphy.java
Giphy.searchRandomSticker
public SearchRandom searchRandomSticker(String tag) throws GiphyException { SearchRandom random = null; HashMap<String, String> params = new HashMap<String, String>(); params.put("api_key", apiKey); params.put("tag", tag); Request request = new Request(UrlUtil.buildUrlQuery(RandomEndpointSticker, params)); try { Response response = sender.sendRequest(request); random = gson.fromJson(response.getBody(), SearchRandom.class); } catch (JsonSyntaxException | IOException e) { log.error(e.getMessage(), e); throw new GiphyException(e); } return random; }
java
public SearchRandom searchRandomSticker(String tag) throws GiphyException { SearchRandom random = null; HashMap<String, String> params = new HashMap<String, String>(); params.put("api_key", apiKey); params.put("tag", tag); Request request = new Request(UrlUtil.buildUrlQuery(RandomEndpointSticker, params)); try { Response response = sender.sendRequest(request); random = gson.fromJson(response.getBody(), SearchRandom.class); } catch (JsonSyntaxException | IOException e) { log.error(e.getMessage(), e); throw new GiphyException(e); } return random; }
[ "public", "SearchRandom", "searchRandomSticker", "(", "String", "tag", ")", "throws", "GiphyException", "{", "SearchRandom", "random", "=", "null", ";", "HashMap", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap", "<", "String", ",", "String"...
Returns a random GIF, limited by tag. <p> Be aware that not every response has all information available. In that case the value will be returned as null. @param tag the GIF tag to limit randomness @return the SerachGiphy object @throws GiphyException if an error occurs during the search
[ "Returns", "a", "random", "GIF", "limited", "by", "tag", "." ]
e56b67f161e2184ccff9b9e8f95a70ef89cec897
https://github.com/keshrath/Giphy4J/blob/e56b67f161e2184ccff9b9e8f95a70ef89cec897/src/main/java/at/mukprojects/giphy4j/Giphy.java#L448-L467
train
apptik/jus
examples-android/src/main/java/io/apptik/comm/jus/examples/request/ImageRequest.java
ImageRequest.getResizedDimension
private static int getResizedDimension(int maxPrimary, int maxSecondary, int actualPrimary, int actualSecondary, ScaleType scaleType) { // If no dominant value at all, just return the actual. if ((maxPrimary == 0) && (maxSecondary == 0)) { return actualPrimary; } // If ScaleType.FIT_XY fill the whole rectangle, ignore ratio. if (scaleType == ScaleType.FIT_XY) { if (maxPrimary == 0) { return actualPrimary; } return maxPrimary; } // If primary is unspecified, scale primary to match secondary's scaling ratio. if (maxPrimary == 0) { double ratio = (double) maxSecondary / (double) actualSecondary; return (int) (actualPrimary * ratio); } if (maxSecondary == 0) { return maxPrimary; } double ratio = (double) actualSecondary / (double) actualPrimary; int resized = maxPrimary; // If ScaleType.CENTER_CROP fill the whole rectangle, preserve aspect ratio. if (scaleType == ScaleType.CENTER_CROP) { if ((resized * ratio) < maxSecondary) { resized = (int) (maxSecondary / ratio); } return resized; } if ((resized * ratio) > maxSecondary) { resized = (int) (maxSecondary / ratio); } return resized; }
java
private static int getResizedDimension(int maxPrimary, int maxSecondary, int actualPrimary, int actualSecondary, ScaleType scaleType) { // If no dominant value at all, just return the actual. if ((maxPrimary == 0) && (maxSecondary == 0)) { return actualPrimary; } // If ScaleType.FIT_XY fill the whole rectangle, ignore ratio. if (scaleType == ScaleType.FIT_XY) { if (maxPrimary == 0) { return actualPrimary; } return maxPrimary; } // If primary is unspecified, scale primary to match secondary's scaling ratio. if (maxPrimary == 0) { double ratio = (double) maxSecondary / (double) actualSecondary; return (int) (actualPrimary * ratio); } if (maxSecondary == 0) { return maxPrimary; } double ratio = (double) actualSecondary / (double) actualPrimary; int resized = maxPrimary; // If ScaleType.CENTER_CROP fill the whole rectangle, preserve aspect ratio. if (scaleType == ScaleType.CENTER_CROP) { if ((resized * ratio) < maxSecondary) { resized = (int) (maxSecondary / ratio); } return resized; } if ((resized * ratio) > maxSecondary) { resized = (int) (maxSecondary / ratio); } return resized; }
[ "private", "static", "int", "getResizedDimension", "(", "int", "maxPrimary", ",", "int", "maxSecondary", ",", "int", "actualPrimary", ",", "int", "actualSecondary", ",", "ScaleType", "scaleType", ")", "{", "// If no dominant value at all, just return the actual.", "if", ...
Scales one side of a rectangle to fit aspect ratio. @param maxPrimary Maximum size of the primary dimension (i.e. width for max width), or zero to maintain aspect ratio with secondary dimension @param maxSecondary Maximum size of the secondary dimension, or zero to maintain aspect ratio with primary dimension @param actualPrimary Actual size of the primary dimension @param actualSecondary Actual size of the secondary dimension @param scaleType The ScaleType used to calculate the needed image size.
[ "Scales", "one", "side", "of", "a", "rectangle", "to", "fit", "aspect", "ratio", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/examples-android/src/main/java/io/apptik/comm/jus/examples/request/ImageRequest.java#L114-L155
train
legsem/legstar-core2
legstar-base/src/main/java/com/legstar/base/type/primitive/CobolStringType.java
CobolStringType.isValidString
protected boolean isValidString(CobolContext cobolContext, byte[] hostData, int start) { int length = start + getBytesLen(); for (int i = start; i < length; i++) { int code = hostData[i] & 0xFF; if (code != 0 && code < cobolContext.getHostSpaceCharCode()) { return false; } } return true; }
java
protected boolean isValidString(CobolContext cobolContext, byte[] hostData, int start) { int length = start + getBytesLen(); for (int i = start; i < length; i++) { int code = hostData[i] & 0xFF; if (code != 0 && code < cobolContext.getHostSpaceCharCode()) { return false; } } return true; }
[ "protected", "boolean", "isValidString", "(", "CobolContext", "cobolContext", ",", "byte", "[", "]", "hostData", ",", "int", "start", ")", "{", "int", "length", "=", "start", "+", "getBytesLen", "(", ")", ";", "for", "(", "int", "i", "=", "start", ";", ...
Relatively naive implementation that assumes content is either low-value or a code point greater or equal to the space character. @param cobolContext host COBOL configuration parameters @param hostData the byte array containing mainframe data @param start the start position for the expected type in the byte array @return true if the byte array contains a valid string
[ "Relatively", "naive", "implementation", "that", "assumes", "content", "is", "either", "low", "-", "value", "or", "a", "code", "point", "greater", "or", "equal", "to", "the", "space", "character", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/type/primitive/CobolStringType.java#L53-L66
train
legsem/legstar-core2
legstar-base/src/main/java/com/legstar/base/type/primitive/CobolStringType.java
CobolStringType.fromHostString
private FromHostPrimitiveResult < String > fromHostString( CobolContext cobolContext, byte[] hostData, int start, int bytesLen) { // Trim trailing low-values and, optionally, trailing spaces int spaceCode = cobolContext.getHostSpaceCharCode(); boolean checkSpace = cobolContext.isTruncateHostStringsTrailingSpaces(); int end = start + bytesLen; while (end > start) { int code = hostData[end - 1] & 0xFF; if (code != 0 && ((checkSpace && code != spaceCode) || !checkSpace)) { break; } end--; } // Return early if this is an empty string if (start == end) { return new FromHostPrimitiveResult < String >(""); } // Host strings are sometimes dirty boolean isDirty = false; for (int i = start; i < end; i++) { if (hostData[i] == 0) { isDirty = true; break; } } // Cleanup if needed then ask java to convert using the proper host // character set String result = null; try { if (isDirty) { byte[] work = new byte[end - start]; for (int i = start; i < end; i++) { work[i - start] = hostData[i] == 0 ? (byte) cobolContext .getHostSpaceCharCode() : hostData[i]; } result = new String(work, cobolContext.getHostCharsetName()); } else { result = new String(hostData, start, end - start, cobolContext.getHostCharsetName()); } } catch (UnsupportedEncodingException e) { return new FromHostPrimitiveResult < String >( "Failed to use host character set " + cobolContext.getHostCharsetName(), hostData, start, bytesLen); } return new FromHostPrimitiveResult < String >(result); }
java
private FromHostPrimitiveResult < String > fromHostString( CobolContext cobolContext, byte[] hostData, int start, int bytesLen) { // Trim trailing low-values and, optionally, trailing spaces int spaceCode = cobolContext.getHostSpaceCharCode(); boolean checkSpace = cobolContext.isTruncateHostStringsTrailingSpaces(); int end = start + bytesLen; while (end > start) { int code = hostData[end - 1] & 0xFF; if (code != 0 && ((checkSpace && code != spaceCode) || !checkSpace)) { break; } end--; } // Return early if this is an empty string if (start == end) { return new FromHostPrimitiveResult < String >(""); } // Host strings are sometimes dirty boolean isDirty = false; for (int i = start; i < end; i++) { if (hostData[i] == 0) { isDirty = true; break; } } // Cleanup if needed then ask java to convert using the proper host // character set String result = null; try { if (isDirty) { byte[] work = new byte[end - start]; for (int i = start; i < end; i++) { work[i - start] = hostData[i] == 0 ? (byte) cobolContext .getHostSpaceCharCode() : hostData[i]; } result = new String(work, cobolContext.getHostCharsetName()); } else { result = new String(hostData, start, end - start, cobolContext.getHostCharsetName()); } } catch (UnsupportedEncodingException e) { return new FromHostPrimitiveResult < String >( "Failed to use host character set " + cobolContext.getHostCharsetName(), hostData, start, bytesLen); } return new FromHostPrimitiveResult < String >(result); }
[ "private", "FromHostPrimitiveResult", "<", "String", ">", "fromHostString", "(", "CobolContext", "cobolContext", ",", "byte", "[", "]", "hostData", ",", "int", "start", ",", "int", "bytesLen", ")", "{", "// Trim trailing low-values and, optionally, trailing spaces", "in...
Convert host data to a java String. @param cobolContext the COBOL config parameters @param hostData the host data @param start where to start in the host data @param bytesLen how many bytes from the host data to process @return the result of the conversion
[ "Convert", "host", "data", "to", "a", "java", "String", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/type/primitive/CobolStringType.java#L111-L164
train
jingwei/krati
krati-main/src/main/java/krati/io/IOFactory.java
IOFactory.createDataReader
public final static DataReader createDataReader(File file, IOType type) { if(type == IOType.MAPPED) { if(file.length() <= Integer.MAX_VALUE) { return new MappedReader(file); } else { return new MultiMappedReader(file); } } else { return new ChannelReader(file); } }
java
public final static DataReader createDataReader(File file, IOType type) { if(type == IOType.MAPPED) { if(file.length() <= Integer.MAX_VALUE) { return new MappedReader(file); } else { return new MultiMappedReader(file); } } else { return new ChannelReader(file); } }
[ "public", "final", "static", "DataReader", "createDataReader", "(", "File", "file", ",", "IOType", "type", ")", "{", "if", "(", "type", "==", "IOType", ".", "MAPPED", ")", "{", "if", "(", "file", ".", "length", "(", ")", "<=", "Integer", ".", "MAX_VALU...
Creates a new DataReader to read from a file. @param file - file to read. @param type - I/O type. @return a new DataReader instance.
[ "Creates", "a", "new", "DataReader", "to", "read", "from", "a", "file", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/io/IOFactory.java#L37-L47
train
jingwei/krati
krati-main/src/main/java/krati/io/IOFactory.java
IOFactory.createDataWriter
public final static DataWriter createDataWriter(File file, IOType type) { if(type == IOType.MAPPED) { if(file.length() <= Integer.MAX_VALUE) { return new MappedWriter(file); } else { return new MultiMappedWriter(file); } } else { return new ChannelWriter(file); } }
java
public final static DataWriter createDataWriter(File file, IOType type) { if(type == IOType.MAPPED) { if(file.length() <= Integer.MAX_VALUE) { return new MappedWriter(file); } else { return new MultiMappedWriter(file); } } else { return new ChannelWriter(file); } }
[ "public", "final", "static", "DataWriter", "createDataWriter", "(", "File", "file", ",", "IOType", "type", ")", "{", "if", "(", "type", "==", "IOType", ".", "MAPPED", ")", "{", "if", "(", "file", ".", "length", "(", ")", "<=", "Integer", ".", "MAX_VALU...
Creates a new DataWriter to write to a file. @param file - file to write. @param type - I/O type. @return a new DataWriter instance of type {@link BasicIO}.
[ "Creates", "a", "new", "DataWriter", "to", "write", "to", "a", "file", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/io/IOFactory.java#L56-L66
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java
XDSConsumerAuditor.getAuditor
public static XDSConsumerAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (XDSConsumerAuditor)ctx.getAuditor(XDSConsumerAuditor.class); }
java
public static XDSConsumerAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (XDSConsumerAuditor)ctx.getAuditor(XDSConsumerAuditor.class); }
[ "public", "static", "XDSConsumerAuditor", "getAuditor", "(", ")", "{", "AuditorModuleContext", "ctx", "=", "AuditorModuleContext", ".", "getContext", "(", ")", ";", "return", "(", "XDSConsumerAuditor", ")", "ctx", ".", "getAuditor", "(", "XDSConsumerAuditor", ".", ...
Get an instance of the XDS Document Consumer Auditor from the global context @return XDS Document Consumer Auditor instance
[ "Get", "an", "instance", "of", "the", "XDS", "Document", "Consumer", "Auditor", "from", "the", "global", "context" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java#L46-L50
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java
XDSConsumerAuditor.auditRegistryQueryEvent
public void auditRegistryQueryEvent( RFC3881EventOutcomeCodes eventOutcome, String registryEndpointUri, String consumerUserName, String adhocQueryRequestPayload, String patientId) { if (!isAuditorEnabled()) { return; } auditQueryEvent(true, new IHETransactionEventTypeCodes.RegistrySQLQuery(), eventOutcome, getAuditSourceId(), getAuditEnterpriseSiteId(), getSystemUserId(), getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), consumerUserName, consumerUserName, true, registryEndpointUri, null, "", adhocQueryRequestPayload, "", patientId, null, null); }
java
public void auditRegistryQueryEvent( RFC3881EventOutcomeCodes eventOutcome, String registryEndpointUri, String consumerUserName, String adhocQueryRequestPayload, String patientId) { if (!isAuditorEnabled()) { return; } auditQueryEvent(true, new IHETransactionEventTypeCodes.RegistrySQLQuery(), eventOutcome, getAuditSourceId(), getAuditEnterpriseSiteId(), getSystemUserId(), getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), consumerUserName, consumerUserName, true, registryEndpointUri, null, "", adhocQueryRequestPayload, "", patientId, null, null); }
[ "public", "void", "auditRegistryQueryEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "registryEndpointUri", ",", "String", "consumerUserName", ",", "String", "adhocQueryRequestPayload", ",", "String", "patientId", ")", "{", "if", "(", "!", "isAud...
Audits an ITI-16 Registry Query event for XDS.a Document Consumer actors. @param eventOutcome The event outcome indicator @param registryEndpointUri The endpoint of the registry in this transaction @param adhocQueryRequestPayload The payload of the adhoc query request element @param patientId The patient ID queried (if query pertained to a patient id)
[ "Audits", "an", "ITI", "-", "16", "Registry", "Query", "event", "for", "XDS", ".", "a", "Document", "Consumer", "actors", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java#L60-L79
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java
XDSConsumerAuditor.auditRegistryStoredQueryEvent
public void auditRegistryStoredQueryEvent( RFC3881EventOutcomeCodes eventOutcome, String registryEndpointUri, String consumerUserName, String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } /* * FIXME: Overriding endpoint URI with "anonymous", for now */ String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous"; //String replyToUri = getSystemUserId(); auditQueryEvent(true, new IHETransactionEventTypeCodes.RegistryStoredQuery(), eventOutcome, getAuditSourceId(), getAuditEnterpriseSiteId(), replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), consumerUserName, consumerUserName, false, registryEndpointUri, null, storedQueryUUID, adhocQueryRequestPayload, homeCommunityId, patientId, purposesOfUse, userRoles); }
java
public void auditRegistryStoredQueryEvent( RFC3881EventOutcomeCodes eventOutcome, String registryEndpointUri, String consumerUserName, String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } /* * FIXME: Overriding endpoint URI with "anonymous", for now */ String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous"; //String replyToUri = getSystemUserId(); auditQueryEvent(true, new IHETransactionEventTypeCodes.RegistryStoredQuery(), eventOutcome, getAuditSourceId(), getAuditEnterpriseSiteId(), replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), consumerUserName, consumerUserName, false, registryEndpointUri, null, storedQueryUUID, adhocQueryRequestPayload, homeCommunityId, patientId, purposesOfUse, userRoles); }
[ "public", "void", "auditRegistryStoredQueryEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "registryEndpointUri", ",", "String", "consumerUserName", ",", "String", "storedQueryUUID", ",", "String", "adhocQueryRequestPayload", ",", "String", "homeCommun...
Audits an ITI-18 Registry Stored Query event for XDS.a and XDS.b Document Consumer actors. @param eventOutcome The event outcome indicator @param registryEndpointUri The endpoint of the registry in this transaction @param consumerUserName The Active Participant UserName for the consumer (if using WS-Security / XUA) @param storedQueryUUID The UUID of the stored query @param adhocQueryRequestPayload The payload of the adhoc query request element @param homeCommunityId The home community id of the transaction (if present) @param patientId The patient ID queried (if query pertained to a patient id) @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Audits", "an", "ITI", "-", "18", "Registry", "Stored", "Query", "event", "for", "XDS", ".", "a", "and", "XDS", ".", "b", "Document", "Consumer", "actors", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java#L94-L121
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java
XDSConsumerAuditor.auditRetrieveDocumentEvent
public void auditRetrieveDocumentEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryRetrieveUri, String userName, String documentUniqueId, String patientId) { if (!isAuditorEnabled()) { return; } ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocument(), null); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(repositoryRetrieveUri, null, null, EventUtils.getAddressForUrl(repositoryRetrieveUri, false), false); importEvent.addDestinationActiveParticipant(getSystemUserId(), getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(userName)) { importEvent.addHumanRequestorActiveParticipant(userName, null, userName, (List<CodedValueType>) null); } if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); } importEvent.addDocumentUriParticipantObject(repositoryRetrieveUri, documentUniqueId); audit(importEvent); }
java
public void auditRetrieveDocumentEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryRetrieveUri, String userName, String documentUniqueId, String patientId) { if (!isAuditorEnabled()) { return; } ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocument(), null); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(repositoryRetrieveUri, null, null, EventUtils.getAddressForUrl(repositoryRetrieveUri, false), false); importEvent.addDestinationActiveParticipant(getSystemUserId(), getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(userName)) { importEvent.addHumanRequestorActiveParticipant(userName, null, userName, (List<CodedValueType>) null); } if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); } importEvent.addDocumentUriParticipantObject(repositoryRetrieveUri, documentUniqueId); audit(importEvent); }
[ "public", "void", "auditRetrieveDocumentEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "repositoryRetrieveUri", ",", "String", "userName", ",", "String", "documentUniqueId", ",", "String", "patientId", ")", "{", "if", "(", "!", "isAuditorEnabled...
Audits an ITI-17 Retrieve Document event for XDS.a Document Consumer actors. @param eventOutcome The event outcome indicator @param repositoryRetrieveUri The URI of the document being retrieved @param documentUniqueId The Document Entry Unique ID of the document being retrieved (if known) @param patientId The patient ID the document relates to (if known)
[ "Audits", "an", "ITI", "-", "17", "Retrieve", "Document", "event", "for", "XDS", ".", "a", "Document", "Consumer", "actors", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java#L132-L154
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java
XDSConsumerAuditor.auditRetrieveDocumentSetEvent
public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String[] documentUniqueIds, String repositoryUniqueId, String homeCommunityId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } String[] repositoryUniqueIds = null; String[] homeCommunityIds = null; if (!EventUtils.isEmptyOrNull(documentUniqueIds)) { repositoryUniqueIds = new String[documentUniqueIds.length]; Arrays.fill(repositoryUniqueIds, repositoryUniqueId); homeCommunityIds = new String[documentUniqueIds.length]; Arrays.fill(homeCommunityIds, homeCommunityId); } auditRetrieveDocumentSetEvent(eventOutcome, repositoryEndpointUri, userName, documentUniqueIds, repositoryUniqueIds, homeCommunityIds, patientId, purposesOfUse, userRoles); }
java
public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String[] documentUniqueIds, String repositoryUniqueId, String homeCommunityId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } String[] repositoryUniqueIds = null; String[] homeCommunityIds = null; if (!EventUtils.isEmptyOrNull(documentUniqueIds)) { repositoryUniqueIds = new String[documentUniqueIds.length]; Arrays.fill(repositoryUniqueIds, repositoryUniqueId); homeCommunityIds = new String[documentUniqueIds.length]; Arrays.fill(homeCommunityIds, homeCommunityId); } auditRetrieveDocumentSetEvent(eventOutcome, repositoryEndpointUri, userName, documentUniqueIds, repositoryUniqueIds, homeCommunityIds, patientId, purposesOfUse, userRoles); }
[ "public", "void", "auditRetrieveDocumentSetEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "repositoryEndpointUri", ",", "String", "userName", ",", "String", "[", "]", "documentUniqueIds", ",", "String", "repositoryUniqueId", ",", "String", "homeCo...
Audits an ITI-43 Retrieve Document Set event for XDS.b Document Consumer actors. Sends audit messages for situations when exactly one repository and zero or one community are specified in the transaction. @param eventOutcome The event outcome indicator @param repositoryEndpointUri The Web service endpoint URI for the document repository @param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved @param repositoryUniqueId The XDS.b RepositoryUniqueId value for the repository @param homeCommunityId The XCA Home Community Id used in the transaction @param patientId The patient ID the document(s) relate to (if known) @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Audits", "an", "ITI", "-", "43", "Retrieve", "Document", "Set", "event", "for", "XDS", ".", "b", "Document", "Consumer", "actors", ".", "Sends", "audit", "messages", "for", "situations", "when", "exactly", "one", "repository", "and", "zero", "or", "one", ...
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java#L169-L193
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java
XDSConsumerAuditor.auditRetrieveDocumentSetEvent
public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocumentSet(), purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(repositoryEndpointUri, null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); /* * FIXME: Overriding endpoint URI with "anonymous", for now */ String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous"; importEvent.addDestinationActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(userName)) { importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); } if (!EventUtils.isEmptyOrNull(documentUniqueIds)) { for (int i=0; i<documentUniqueIds.length; i++) { importEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]); } } audit(importEvent); }
java
public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocumentSet(), purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(repositoryEndpointUri, null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); /* * FIXME: Overriding endpoint URI with "anonymous", for now */ String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous"; importEvent.addDestinationActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(userName)) { importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); } if (!EventUtils.isEmptyOrNull(documentUniqueIds)) { for (int i=0; i<documentUniqueIds.length; i++) { importEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]); } } audit(importEvent); }
[ "public", "void", "auditRetrieveDocumentSetEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "repositoryEndpointUri", ",", "String", "userName", ",", "String", "[", "]", "documentUniqueIds", ",", "String", "[", "]", "repositoryUniqueIds", ",", "Str...
Audits an ITI-43 Retrieve Document Set event for XDS.b Document Consumer actors. Sends audit messages for situations when more than one repository and more than one community are specified in the transaction. @param eventOutcome The event outcome indicator @param repositoryEndpointUri The Web service endpoint URI for the document repository @param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved @param repositoryUniqueIds The list of XDS.b Repository Unique Ids involved in this transaction (aligned with Document Unique Ids array) @param homeCommunityIds The list of XCA Home Community Ids involved in this transaction (aligned with Document Unique Ids array) @param patientId The patient ID the document(s) relate to (if known) @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Audits", "an", "ITI", "-", "43", "Retrieve", "Document", "Set", "event", "for", "XDS", ".", "b", "Document", "Consumer", "actors", ".", "Sends", "audit", "messages", "for", "situations", "when", "more", "than", "one", "repository", "and", "more", "than", ...
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java#L209-L240
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/AuditLogUsedEvent.java
AuditLogUsedEvent.addAccessingParticipant
public void addAccessingParticipant(String userId, String altUserId, String userName, String networkId) { addActiveParticipant( userId, altUserId, userName, true, null, networkId); }
java
public void addAccessingParticipant(String userId, String altUserId, String userName, String networkId) { addActiveParticipant( userId, altUserId, userName, true, null, networkId); }
[ "public", "void", "addAccessingParticipant", "(", "String", "userId", ",", "String", "altUserId", ",", "String", "userName", ",", "String", "networkId", ")", "{", "addActiveParticipant", "(", "userId", ",", "altUserId", ",", "userName", ",", "true", ",", "null",...
Adds the Active Participant of the User or System that accessed the log @param userId The Active Participant's User ID @param altUserId The Active Participant's Alternate UserID @param userName The Active Participant's UserName @param networkId The Active Participant's Network Access Point ID
[ "Adds", "the", "Active", "Participant", "of", "the", "User", "or", "System", "that", "accessed", "the", "log" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/AuditLogUsedEvent.java#L51-L60
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/AuditLogUsedEvent.java
AuditLogUsedEvent.addAuditLogIdentity
public void addAuditLogIdentity(String auditLogUri) { addParticipantObjectIdentification( new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.URI(), "Security Audit Log", null, null, auditLogUri, RFC3881ParticipantObjectTypeCodes.SYSTEM, RFC3881ParticipantObjectTypeRoleCodes.SECURITY_RESOURCE, null, null); }
java
public void addAuditLogIdentity(String auditLogUri) { addParticipantObjectIdentification( new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.URI(), "Security Audit Log", null, null, auditLogUri, RFC3881ParticipantObjectTypeCodes.SYSTEM, RFC3881ParticipantObjectTypeRoleCodes.SECURITY_RESOURCE, null, null); }
[ "public", "void", "addAuditLogIdentity", "(", "String", "auditLogUri", ")", "{", "addParticipantObjectIdentification", "(", "new", "RFC3881ParticipantObjectCodes", ".", "RFC3881ParticipantObjectIDTypeCodes", ".", "URI", "(", ")", ",", "\"Security Audit Log\"", ",", "null", ...
Adds the Participant Object block representing the audit log accessed @param auditLogUri The URI of the audit log that was accessed
[ "Adds", "the", "Participant", "Object", "block", "representing", "the", "audit", "log", "accessed" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/AuditLogUsedEvent.java#L67-L79
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java
XDSRepositoryAuditor.getAuditor
public static XDSRepositoryAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (XDSRepositoryAuditor)ctx.getAuditor(XDSRepositoryAuditor.class); }
java
public static XDSRepositoryAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (XDSRepositoryAuditor)ctx.getAuditor(XDSRepositoryAuditor.class); }
[ "public", "static", "XDSRepositoryAuditor", "getAuditor", "(", ")", "{", "AuditorModuleContext", "ctx", "=", "AuditorModuleContext", ".", "getContext", "(", ")", ";", "return", "(", "XDSRepositoryAuditor", ")", "ctx", ".", "getAuditor", "(", "XDSRepositoryAuditor", ...
Get an instance of the XDS Document Repository Auditor from the global context @return XDS Document Repository Auditor instance
[ "Get", "an", "instance", "of", "the", "XDS", "Document", "Repository", "Auditor", "from", "the", "global", "context" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java#L49-L53
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java
XDSRepositoryAuditor.auditRegisterDocumentSetEvent
public void auditRegisterDocumentSetEvent( RFC3881EventOutcomeCodes eventOutcome, String repositoryUserId, String userName, String registryEndpointUri, String submissionSetUniqueId, String patientId) { if (!isAuditorEnabled()) { return; } auditRegisterEvent(new IHETransactionEventTypeCodes.RegisterDocumentSet(), eventOutcome, repositoryUserId, userName, registryEndpointUri, submissionSetUniqueId, patientId, null, null); }
java
public void auditRegisterDocumentSetEvent( RFC3881EventOutcomeCodes eventOutcome, String repositoryUserId, String userName, String registryEndpointUri, String submissionSetUniqueId, String patientId) { if (!isAuditorEnabled()) { return; } auditRegisterEvent(new IHETransactionEventTypeCodes.RegisterDocumentSet(), eventOutcome, repositoryUserId, userName, registryEndpointUri, submissionSetUniqueId, patientId, null, null); }
[ "public", "void", "auditRegisterDocumentSetEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "repositoryUserId", ",", "String", "userName", ",", "String", "registryEndpointUri", ",", "String", "submissionSetUniqueId", ",", "String", "patientId", ")", ...
Audits an ITI-14 Register Document Set event for XDS.a Document Repository actors. @param eventOutcome The event outcome indicator @param registryEndpointUri The endpoint of the registry in this transaction @param submissionSetUniqueId The UniqueID of the Submission Set registered @param patientId The Patient Id that this submission pertains to
[ "Audits", "an", "ITI", "-", "14", "Register", "Document", "Set", "event", "for", "XDS", ".", "a", "Document", "Repository", "actors", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java#L134-L147
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java
XDSRepositoryAuditor.auditRegisterDocumentSetBEvent
public void auditRegisterDocumentSetBEvent( RFC3881EventOutcomeCodes eventOutcome, String repositoryUserId, String userName, String registryEndpointUri, String submissionSetUniqueId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } auditRegisterEvent(new IHETransactionEventTypeCodes.RegisterDocumentSetB(), eventOutcome, repositoryUserId, userName, registryEndpointUri, submissionSetUniqueId, patientId, purposesOfUse, userRoles); }
java
public void auditRegisterDocumentSetBEvent( RFC3881EventOutcomeCodes eventOutcome, String repositoryUserId, String userName, String registryEndpointUri, String submissionSetUniqueId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } auditRegisterEvent(new IHETransactionEventTypeCodes.RegisterDocumentSetB(), eventOutcome, repositoryUserId, userName, registryEndpointUri, submissionSetUniqueId, patientId, purposesOfUse, userRoles); }
[ "public", "void", "auditRegisterDocumentSetBEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "repositoryUserId", ",", "String", "userName", ",", "String", "registryEndpointUri", ",", "String", "submissionSetUniqueId", ",", "String", "patientId", ",", ...
Audits an ITI-42 Register Document Set-b event for XDS.b Document Repository actors. @param eventOutcome The event outcome indicator @param registryEndpointUri The endpoint of the registry in this transaction @param submissionSetUniqueId The UniqueID of the Submission Set registered @param patientId The Patient Id that this submission pertains to @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Audits", "an", "ITI", "-", "42", "Register", "Document", "Set", "-", "b", "event", "for", "XDS", ".", "b", "Document", "Repository", "actors", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java#L159-L174
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java
XDSRepositoryAuditor.auditRetrieveDocumentEvent
public void auditRetrieveDocumentEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerIpAddress, String userName, String repositoryRetrieveUri, String documentUniqueId) { if (!isAuditorEnabled()) { return; } ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocument(), null); exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); exportEvent.addSourceActiveParticipant(repositoryRetrieveUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryRetrieveUri, false), false); if (!EventUtils.isEmptyOrNull(userName)) { exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, (List<CodedValueType>) null); } exportEvent.addDestinationActiveParticipant(consumerIpAddress, null, null, consumerIpAddress, true); //exportEvent.addPatientParticipantObject(patientId); exportEvent.addDocumentUriParticipantObject(repositoryRetrieveUri, documentUniqueId); audit(exportEvent); }
java
public void auditRetrieveDocumentEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerIpAddress, String userName, String repositoryRetrieveUri, String documentUniqueId) { if (!isAuditorEnabled()) { return; } ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocument(), null); exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); exportEvent.addSourceActiveParticipant(repositoryRetrieveUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryRetrieveUri, false), false); if (!EventUtils.isEmptyOrNull(userName)) { exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, (List<CodedValueType>) null); } exportEvent.addDestinationActiveParticipant(consumerIpAddress, null, null, consumerIpAddress, true); //exportEvent.addPatientParticipantObject(patientId); exportEvent.addDocumentUriParticipantObject(repositoryRetrieveUri, documentUniqueId); audit(exportEvent); }
[ "public", "void", "auditRetrieveDocumentEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "consumerIpAddress", ",", "String", "userName", ",", "String", "repositoryRetrieveUri", ",", "String", "documentUniqueId", ")", "{", "if", "(", "!", "isAudito...
Audits an ITI-17 Retrieve Document event for XDS.a Document Repository actors. @param eventOutcome The event outcome indicator @param consumerIpAddress The IP address of the document consumer that initiated the transaction @param repositoryRetrieveUri The URI that was used to retrieve the document @param documentUniqueId The Document Entry Unique ID of the document being retrieved (if known)
[ "Audits", "an", "ITI", "-", "17", "Retrieve", "Document", "event", "for", "XDS", ".", "a", "Document", "Repository", "actors", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java#L196-L215
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java
XDSRepositoryAuditor.auditRetrieveDocumentSetEvent
public void auditRetrieveDocumentSetEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerUserId, String consumerUserName, String consumerIpAddress, String repositoryEndpointUri, String[] documentUniqueIds, String repositoryUniqueId, String homeCommunityId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } String[] repositoryUniqueIds = null; if (!EventUtils.isEmptyOrNull(documentUniqueIds)) { repositoryUniqueIds = new String[documentUniqueIds.length]; Arrays.fill(repositoryUniqueIds, repositoryUniqueId); } auditRetrieveDocumentSetEvent(eventOutcome, consumerUserId, consumerUserName, consumerIpAddress, repositoryEndpointUri, documentUniqueIds, repositoryUniqueIds, homeCommunityId, purposesOfUse, userRoles); }
java
public void auditRetrieveDocumentSetEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerUserId, String consumerUserName, String consumerIpAddress, String repositoryEndpointUri, String[] documentUniqueIds, String repositoryUniqueId, String homeCommunityId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } String[] repositoryUniqueIds = null; if (!EventUtils.isEmptyOrNull(documentUniqueIds)) { repositoryUniqueIds = new String[documentUniqueIds.length]; Arrays.fill(repositoryUniqueIds, repositoryUniqueId); } auditRetrieveDocumentSetEvent(eventOutcome, consumerUserId, consumerUserName, consumerIpAddress, repositoryEndpointUri, documentUniqueIds, repositoryUniqueIds, homeCommunityId, purposesOfUse, userRoles); }
[ "public", "void", "auditRetrieveDocumentSetEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "consumerUserId", ",", "String", "consumerUserName", ",", "String", "consumerIpAddress", ",", "String", "repositoryEndpointUri", ",", "String", "[", "]", "do...
Audits an ITI-43 Retrieve Document Set-b event for XDS.b Document Repository actors. Sends audit messages for situations when exactly one repository and zero or one community are specified in the transaction. @param eventOutcome The event outcome indicator @param consumerUserId The Active Participant UserID for the document consumer (if using WS-Addressing) @param consumerUserName The Active Participant UserName for the document consumer (if using WS-Security / XUA) @param consumerIpAddress The IP address of the document consumer that initiated the transaction @param repositoryEndpointUri The Web service endpoint URI for this document repository @param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved @param repositoryUniqueId The XDS.b Repository Unique Id value for this repository @param homeCommunityId The XCA Home Community Id used in the transaction @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Audits", "an", "ITI", "-", "43", "Retrieve", "Document", "Set", "-", "b", "event", "for", "XDS", ".", "b", "Document", "Repository", "actors", ".", "Sends", "audit", "messages", "for", "situations", "when", "exactly", "one", "repository", "and", "zero", "...
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java#L232-L251
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java
XDSRepositoryAuditor.auditRetrieveDocumentSetEvent
public void auditRetrieveDocumentSetEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerUserId, String consumerUserName, String consumerIpAddress, String repositoryEndpointUri, String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocumentSet(), purposesOfUse); exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); exportEvent.addSourceActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); exportEvent.addDestinationActiveParticipant(consumerUserId, null, consumerUserName, consumerIpAddress, true); if (! EventUtils.isEmptyOrNull(consumerUserName)) { exportEvent.addHumanRequestorActiveParticipant(consumerUserName, null, consumerUserName, userRoles); } //exportEvent.addPatientParticipantObject(patientId); if (!EventUtils.isEmptyOrNull(documentUniqueIds)) { for (int i=0; i<documentUniqueIds.length; i++) { exportEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]); } } audit(exportEvent); }
java
public void auditRetrieveDocumentSetEvent( RFC3881EventOutcomeCodes eventOutcome, String consumerUserId, String consumerUserName, String consumerIpAddress, String repositoryEndpointUri, String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocumentSet(), purposesOfUse); exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); exportEvent.addSourceActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); exportEvent.addDestinationActiveParticipant(consumerUserId, null, consumerUserName, consumerIpAddress, true); if (! EventUtils.isEmptyOrNull(consumerUserName)) { exportEvent.addHumanRequestorActiveParticipant(consumerUserName, null, consumerUserName, userRoles); } //exportEvent.addPatientParticipantObject(patientId); if (!EventUtils.isEmptyOrNull(documentUniqueIds)) { for (int i=0; i<documentUniqueIds.length; i++) { exportEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]); } } audit(exportEvent); }
[ "public", "void", "auditRetrieveDocumentSetEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "consumerUserId", ",", "String", "consumerUserName", ",", "String", "consumerIpAddress", ",", "String", "repositoryEndpointUri", ",", "String", "[", "]", "do...
Audits an ITI-43 Retrieve Document Set-b event for XDS.b Document Repository actors. Sends audit messages for situations when more than one repository and more than one community are specified in the transaction. @param eventOutcome The event outcome indicator @param consumerUserId The Active Participant UserID for the document consumer (if using WS-Addressing) @param consumerUserName The Active Participant UserName for the document consumer (if using WS-Security / XUA) @param consumerIpAddress The IP address of the document consumer that initiated the transaction @param repositoryEndpointUri The Web service endpoint URI for this document repository @param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved @param repositoryUniqueIds The list of XDS.b Repository Unique Ids involved in this transaction (aligned with Document Unique Ids array) @param homeCommunityIds The list of XCA Home Community Ids involved in this transaction (aligned with Document Unique Ids array) @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Audits", "an", "ITI", "-", "43", "Retrieve", "Document", "Set", "-", "b", "event", "for", "XDS", ".", "b", "Document", "Repository", "actors", ".", "Sends", "audit", "messages", "for", "situations", "when", "more", "than", "one", "repository", "and", "mor...
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java#L326-L352
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java
XDSRepositoryAuditor.auditProvideAndRegisterEvent
protected void auditProvideAndRegisterEvent ( IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, String sourceUserId, String sourceIpAddress, String userName, String repositoryEndpointUri, String submissionSetUniqueId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { ImportEvent importEvent = new ImportEvent(false, eventOutcome, transaction, purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(sourceUserId, null, null, sourceIpAddress, true); if (!EventUtils.isEmptyOrNull(userName)) { importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } importEvent.addDestinationActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); } importEvent.addSubmissionSetParticipantObject(submissionSetUniqueId); audit(importEvent); }
java
protected void auditProvideAndRegisterEvent ( IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, String sourceUserId, String sourceIpAddress, String userName, String repositoryEndpointUri, String submissionSetUniqueId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { ImportEvent importEvent = new ImportEvent(false, eventOutcome, transaction, purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(sourceUserId, null, null, sourceIpAddress, true); if (!EventUtils.isEmptyOrNull(userName)) { importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } importEvent.addDestinationActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); } importEvent.addSubmissionSetParticipantObject(submissionSetUniqueId); audit(importEvent); }
[ "protected", "void", "auditProvideAndRegisterEvent", "(", "IHETransactionEventTypeCodes", "transaction", ",", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "sourceUserId", ",", "String", "sourceIpAddress", ",", "String", "userName", ",", "String", "repositoryEndp...
Generically sends audit messages for XDS Document Repository Provide And Register Document Set events @param transaction The specific IHE Transaction (ITI-15 or ITI-41) @param eventOutcome The event outcome indicator @param sourceUserId The Active Participant UserID for the document consumer (if using WS-Addressing) @param sourceIpAddress The IP address of the document source that initiated the transaction @param repositoryEndpointUri The Web service endpoint URI for this document repository @param submissionSetUniqueId The UniqueID of the Submission Set registered @param patientId The Patient Id that this submission pertains to @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Generically", "sends", "audit", "messages", "for", "XDS", "Document", "Repository", "Provide", "And", "Register", "Document", "Set", "events" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java#L378-L402
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentManager.java
SegmentManager.getLiveSegmentCount
public final int getLiveSegmentCount() { int num = 0; for (int i = 0; i < _segList.size(); i++) { if (_segList.get(i) != null) num++; } return num; }
java
public final int getLiveSegmentCount() { int num = 0; for (int i = 0; i < _segList.size(); i++) { if (_segList.get(i) != null) num++; } return num; }
[ "public", "final", "int", "getLiveSegmentCount", "(", ")", "{", "int", "num", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "_segList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "_segList", ".", "get", "(", ...
Gets the count of live segments managed by this SegmentManager.
[ "Gets", "the", "count", "of", "live", "segments", "managed", "by", "this", "SegmentManager", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentManager.java#L180-L189
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentManager.java
SegmentManager.freeSegment
public synchronized boolean freeSegment(Segment seg) throws IOException { if (seg == null) return false; int segId = seg.getSegmentId(); if (segId < _segList.size() && _segList.get(segId) == seg) { _segList.set(segId, null); seg.close(false); if(segId == (_segList.size() - 1)) { try { // Delete last segment. _segList.remove(segId); File segFile = seg.getSegmentFile(); if(segFile.exists()) segFile.delete(); File sibFile = getSegmentIndexBufferFile(segId); if(sibFile.exists()) sibFile.delete(); _log.info("Segment " + seg.getSegmentId() + " deleted"); } catch(Exception e) { _log.warn("Segment " + seg.getSegmentId() + " not deleted", e); } } else { if (seg.isRecyclable() && recycle(seg)) { _log.info("Segment " + seg.getSegmentId() + " recycled"); } else { _log.info("Segment " + seg.getSegmentId() + " freed"); } } return true; } return false; }
java
public synchronized boolean freeSegment(Segment seg) throws IOException { if (seg == null) return false; int segId = seg.getSegmentId(); if (segId < _segList.size() && _segList.get(segId) == seg) { _segList.set(segId, null); seg.close(false); if(segId == (_segList.size() - 1)) { try { // Delete last segment. _segList.remove(segId); File segFile = seg.getSegmentFile(); if(segFile.exists()) segFile.delete(); File sibFile = getSegmentIndexBufferFile(segId); if(sibFile.exists()) sibFile.delete(); _log.info("Segment " + seg.getSegmentId() + " deleted"); } catch(Exception e) { _log.warn("Segment " + seg.getSegmentId() + " not deleted", e); } } else { if (seg.isRecyclable() && recycle(seg)) { _log.info("Segment " + seg.getSegmentId() + " recycled"); } else { _log.info("Segment " + seg.getSegmentId() + " freed"); } } return true; } return false; }
[ "public", "synchronized", "boolean", "freeSegment", "(", "Segment", "seg", ")", "throws", "IOException", "{", "if", "(", "seg", "==", "null", ")", "return", "false", ";", "int", "segId", "=", "seg", ".", "getSegmentId", "(", ")", ";", "if", "(", "segId",...
Frees the specified segment.
[ "Frees", "the", "specified", "segment", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentManager.java#L201-L237
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentManager.java
SegmentManager.nextSegment
public synchronized Segment nextSegment() throws IOException { Segment seg = nextSegment(false); // Remove the writer segment index buffer file. File sibFile = getSegmentIndexBufferFile(seg.getSegmentId()); if(sibFile.exists()) { sibFile.delete(); } return seg; }
java
public synchronized Segment nextSegment() throws IOException { Segment seg = nextSegment(false); // Remove the writer segment index buffer file. File sibFile = getSegmentIndexBufferFile(seg.getSegmentId()); if(sibFile.exists()) { sibFile.delete(); } return seg; }
[ "public", "synchronized", "Segment", "nextSegment", "(", ")", "throws", "IOException", "{", "Segment", "seg", "=", "nextSegment", "(", "false", ")", ";", "// Remove the writer segment index buffer file.", "File", "sibFile", "=", "getSegmentIndexBufferFile", "(", "seg", ...
Opens the next segment available for read and write.
[ "Opens", "the", "next", "segment", "available", "for", "read", "and", "write", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentManager.java#L242-L252
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentManager.java
SegmentManager.flushSegmentIndexBuffers
public void flushSegmentIndexBuffers() { SegmentIndexBuffer sib = null; while((sib = _sibManager.poll()) != null) { File sibFile = getSegmentIndexBufferFile(sib.getSegmentId()); try { _sibManager.getSegmentIndexBufferIO().write(sib, sibFile); } catch (Exception e) { _log.warn("failed to write " + sibFile.getAbsolutePath()); sibFile.delete(); } } }
java
public void flushSegmentIndexBuffers() { SegmentIndexBuffer sib = null; while((sib = _sibManager.poll()) != null) { File sibFile = getSegmentIndexBufferFile(sib.getSegmentId()); try { _sibManager.getSegmentIndexBufferIO().write(sib, sibFile); } catch (Exception e) { _log.warn("failed to write " + sibFile.getAbsolutePath()); sibFile.delete(); } } }
[ "public", "void", "flushSegmentIndexBuffers", "(", ")", "{", "SegmentIndexBuffer", "sib", "=", "null", ";", "while", "(", "(", "sib", "=", "_sibManager", ".", "poll", "(", ")", ")", "!=", "null", ")", "{", "File", "sibFile", "=", "getSegmentIndexBufferFile",...
Flushes accumulated segment index buffers to disk.
[ "Flushes", "accumulated", "segment", "index", "buffers", "to", "disk", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentManager.java#L314-L326
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentManager.java
SegmentManager.nextSegment
private Segment nextSegment(boolean newOnly) throws IOException { int index; Segment seg; if (newOnly) { index = _segList.size(); } else { if (_recycleList.size() > 0) { seg = _recycleList.remove(); seg.reinit(); _segList.set(seg.getSegmentId(), seg); _log.info("reinit Segment " + seg.getSegmentId()); return seg; } for (index = 0; index < _segList.size(); index++) { if (_segList.get(index) == null) break; } } // Always create next segment as READ_WRITE File segFile = getSegmentFile(index); seg = getSegmentFactory().createSegment(index, segFile, _segFileSizeMB, Segment.Mode.READ_WRITE); if (index < _segList.size()) _segList.set(index, seg); else _segList.add(seg); return seg; }
java
private Segment nextSegment(boolean newOnly) throws IOException { int index; Segment seg; if (newOnly) { index = _segList.size(); } else { if (_recycleList.size() > 0) { seg = _recycleList.remove(); seg.reinit(); _segList.set(seg.getSegmentId(), seg); _log.info("reinit Segment " + seg.getSegmentId()); return seg; } for (index = 0; index < _segList.size(); index++) { if (_segList.get(index) == null) break; } } // Always create next segment as READ_WRITE File segFile = getSegmentFile(index); seg = getSegmentFactory().createSegment(index, segFile, _segFileSizeMB, Segment.Mode.READ_WRITE); if (index < _segList.size()) _segList.set(index, seg); else _segList.add(seg); return seg; }
[ "private", "Segment", "nextSegment", "(", "boolean", "newOnly", ")", "throws", "IOException", "{", "int", "index", ";", "Segment", "seg", ";", "if", "(", "newOnly", ")", "{", "index", "=", "_segList", ".", "size", "(", ")", ";", "}", "else", "{", "if",...
Gets the next segment available for read and write. @param newOnly If true, create a new segment from scratch. Otherwise, reuse the first free segment. @return @throws IOException
[ "Gets", "the", "next", "segment", "available", "for", "read", "and", "write", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentManager.java#L369-L401
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentManager.java
SegmentManager.initSegs
private void initSegs() throws IOException { int loaded = 0; File[] segFiles = listSegmentFiles(); if (segFiles.length == 0) { return; } try { for (int i = 0; i < segFiles.length; i++) { File segFile = segFiles[i]; int segId = Integer.parseInt(segFile.getName().substring(0, segFile.getName().indexOf('.'))); if (segId != i) { throw new IOException("Segment file " + i + ".seg missing"); } if (getMeta().hasSegmentInService(segId)) { // Always load a live segment as READ_ONLY Segment s = getSegmentFactory().createSegment(segId, segFile, _segFileSizeMB, Segment.Mode.READ_ONLY); s.incrLoadSize(getMeta().getSegmentLoadSize(segId)); _segList.add(s); loaded++; } else { // Segment is not live and is free for reuse _segList.add(null); } } } catch (IOException e) { _log.error(e.getMessage()); clearInternal(false /* DO NOT CLEAR META */); throw e; } _log.info("loaded: " + loaded + "/" + segFiles.length); }
java
private void initSegs() throws IOException { int loaded = 0; File[] segFiles = listSegmentFiles(); if (segFiles.length == 0) { return; } try { for (int i = 0; i < segFiles.length; i++) { File segFile = segFiles[i]; int segId = Integer.parseInt(segFile.getName().substring(0, segFile.getName().indexOf('.'))); if (segId != i) { throw new IOException("Segment file " + i + ".seg missing"); } if (getMeta().hasSegmentInService(segId)) { // Always load a live segment as READ_ONLY Segment s = getSegmentFactory().createSegment(segId, segFile, _segFileSizeMB, Segment.Mode.READ_ONLY); s.incrLoadSize(getMeta().getSegmentLoadSize(segId)); _segList.add(s); loaded++; } else { // Segment is not live and is free for reuse _segList.add(null); } } } catch (IOException e) { _log.error(e.getMessage()); clearInternal(false /* DO NOT CLEAR META */); throw e; } _log.info("loaded: " + loaded + "/" + segFiles.length); }
[ "private", "void", "initSegs", "(", ")", "throws", "IOException", "{", "int", "loaded", "=", "0", ";", "File", "[", "]", "segFiles", "=", "listSegmentFiles", "(", ")", ";", "if", "(", "segFiles", ".", "length", "==", "0", ")", "{", "return", ";", "}"...
Initializes the segments managed by this SegmentManager @throws IOException
[ "Initializes", "the", "segments", "managed", "by", "this", "SegmentManager" ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentManager.java#L417-L451
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentManager.java
SegmentManager.clearInternal
private void clearInternal(boolean clearMeta) { // Close all known segments for(int segId = 0, cnt = _segList.size(); segId < cnt; segId++) { Segment seg = _segList.get(segId); if(seg != null) { try { if(seg.getMode() == Segment.Mode.READ_WRITE) { seg.force(); } seg.close(false); } catch (IOException e) { _log.warn("failed to close segment " + seg.getSegmentId()); } finally { _segList.set(segId, null); } } } if(clearMeta) { try { updateMeta(); } catch (IOException e) { _log.warn("failed to clear segment meta"); } } _segList.clear(); _recycleList.clear(); }
java
private void clearInternal(boolean clearMeta) { // Close all known segments for(int segId = 0, cnt = _segList.size(); segId < cnt; segId++) { Segment seg = _segList.get(segId); if(seg != null) { try { if(seg.getMode() == Segment.Mode.READ_WRITE) { seg.force(); } seg.close(false); } catch (IOException e) { _log.warn("failed to close segment " + seg.getSegmentId()); } finally { _segList.set(segId, null); } } } if(clearMeta) { try { updateMeta(); } catch (IOException e) { _log.warn("failed to clear segment meta"); } } _segList.clear(); _recycleList.clear(); }
[ "private", "void", "clearInternal", "(", "boolean", "clearMeta", ")", "{", "// Close all known segments", "for", "(", "int", "segId", "=", "0", ",", "cnt", "=", "_segList", ".", "size", "(", ")", ";", "segId", "<", "cnt", ";", "segId", "++", ")", "{", ...
Clears this SegmentManager. @param clearMeta - whether to clear the segment meta file
[ "Clears", "this", "SegmentManager", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentManager.java#L458-L486
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentManager.java
SegmentManager.listSegmentFiles
protected File[] listSegmentFiles() { File segDir = new File(_segHomePath); File[] segFiles = segDir.listFiles(new FileFilter() { @Override public boolean accept(File filePath) { String fileName = filePath.getName(); if (fileName.matches("^[0-9]+\\.seg$")) { return true; } return false; } }); if (segFiles == null) { segFiles = new File[0]; } else if (segFiles.length > 0) { Arrays.sort(segFiles, new Comparator<File>() { @Override public int compare(File f1, File f2) { int segId1 = Integer.parseInt(f1.getName().substring(0, f1.getName().indexOf('.'))); int segId2 = Integer.parseInt(f2.getName().substring(0, f2.getName().indexOf('.'))); return (segId1 < segId2) ? -1 : ((segId1 == segId2) ? 0 : 1); } }); } return segFiles; }
java
protected File[] listSegmentFiles() { File segDir = new File(_segHomePath); File[] segFiles = segDir.listFiles(new FileFilter() { @Override public boolean accept(File filePath) { String fileName = filePath.getName(); if (fileName.matches("^[0-9]+\\.seg$")) { return true; } return false; } }); if (segFiles == null) { segFiles = new File[0]; } else if (segFiles.length > 0) { Arrays.sort(segFiles, new Comparator<File>() { @Override public int compare(File f1, File f2) { int segId1 = Integer.parseInt(f1.getName().substring(0, f1.getName().indexOf('.'))); int segId2 = Integer.parseInt(f2.getName().substring(0, f2.getName().indexOf('.'))); return (segId1 < segId2) ? -1 : ((segId1 == segId2) ? 0 : 1); } }); } return segFiles; }
[ "protected", "File", "[", "]", "listSegmentFiles", "(", ")", "{", "File", "segDir", "=", "new", "File", "(", "_segHomePath", ")", ";", "File", "[", "]", "segFiles", "=", "segDir", ".", "listFiles", "(", "new", "FileFilter", "(", ")", "{", "@", "Overrid...
Lists all the segment files managed by this SegmentManager.
[ "Lists", "all", "the", "segment", "files", "managed", "by", "this", "SegmentManager", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentManager.java#L505-L532
train
legsem/legstar-core2
legstar-jaxb-generator/src/main/java/com/legstar/jaxb/generator/EachHelper.java
EachHelper.hashContext
private CharSequence hashContext(final Object context, final Options options) throws IOException { Set < Entry < String, Object >> propertySet = options .propertySet(context); StringBuilder buffer = new StringBuilder(); Context parent = options.context; boolean first = true; for (Entry < String, Object > entry : propertySet) { Context current = Context.newBuilder(parent, entry.getValue()) .combine("@key", entry.getKey()) .combine("@first", first ? "first" : "").build(); buffer.append(options.fn(current)); current.destroy(); first = false; } return buffer.toString(); }
java
private CharSequence hashContext(final Object context, final Options options) throws IOException { Set < Entry < String, Object >> propertySet = options .propertySet(context); StringBuilder buffer = new StringBuilder(); Context parent = options.context; boolean first = true; for (Entry < String, Object > entry : propertySet) { Context current = Context.newBuilder(parent, entry.getValue()) .combine("@key", entry.getKey()) .combine("@first", first ? "first" : "").build(); buffer.append(options.fn(current)); current.destroy(); first = false; } return buffer.toString(); }
[ "private", "CharSequence", "hashContext", "(", "final", "Object", "context", ",", "final", "Options", "options", ")", "throws", "IOException", "{", "Set", "<", "Entry", "<", "String", ",", "Object", ">", ">", "propertySet", "=", "options", ".", "propertySet", ...
Iterate over a hash like object. @param context The context object. @param options The helper options. @return The string output. @throws IOException If something goes wrong.
[ "Iterate", "over", "a", "hash", "like", "object", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-jaxb-generator/src/main/java/com/legstar/jaxb/generator/EachHelper.java#L54-L70
train
legsem/legstar-core2
legstar-jaxb-generator/src/main/java/com/legstar/jaxb/generator/EachHelper.java
EachHelper.iterableContext
private CharSequence iterableContext(final Iterable<Object> context, final Options options) throws IOException { StringBuilder buffer = new StringBuilder(); if (options.isFalsy(context)) { buffer.append(options.inverse()); } else { Iterator<Object> iterator = context.iterator(); int index = -1; Context parent = options.context; while (iterator.hasNext()) { index += 1; Object element = iterator.next(); boolean first = index == 0; boolean even = index % 2 == 0; boolean last = !iterator.hasNext(); Context current = Context.newBuilder(parent, element) .combine("@index", index) .combine("@first", first ? "first" : "") .combine("@last", last ? "last" : "") .combine("@odd", even ? "" : "odd") .combine("@even", even ? "even" : "") .build(); buffer.append(options.fn(current)); current.destroy(); } } return buffer.toString(); }
java
private CharSequence iterableContext(final Iterable<Object> context, final Options options) throws IOException { StringBuilder buffer = new StringBuilder(); if (options.isFalsy(context)) { buffer.append(options.inverse()); } else { Iterator<Object> iterator = context.iterator(); int index = -1; Context parent = options.context; while (iterator.hasNext()) { index += 1; Object element = iterator.next(); boolean first = index == 0; boolean even = index % 2 == 0; boolean last = !iterator.hasNext(); Context current = Context.newBuilder(parent, element) .combine("@index", index) .combine("@first", first ? "first" : "") .combine("@last", last ? "last" : "") .combine("@odd", even ? "" : "odd") .combine("@even", even ? "even" : "") .build(); buffer.append(options.fn(current)); current.destroy(); } } return buffer.toString(); }
[ "private", "CharSequence", "iterableContext", "(", "final", "Iterable", "<", "Object", ">", "context", ",", "final", "Options", "options", ")", "throws", "IOException", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "opt...
Iterate over an iterable object. @param context The context object. @param options The helper options. @return The string output. @throws IOException If something goes wrong.
[ "Iterate", "over", "an", "iterable", "object", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-jaxb-generator/src/main/java/com/legstar/jaxb/generator/EachHelper.java#L80-L107
train
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java
ArrayEntryManager.switchEntry
protected synchronized void switchEntry(boolean blocking) throws IOException { /** * Must create compaction redo before update redo to prevent data loss. * * The "applyEntries" method will internally sort compaction redo and update redo * entries using stable Arrays.sort. The following order of creating redo entries * will ensure that compaction redo does NOT overwrite update redo. */ if (!_entryCompaction.isEmpty()) { // Create entry log and persist in-memory data File file = new File(getDirectory(), getEntryLogName(_entryCompaction)); _entryCompaction.save(file); _entryPool.addToServiceQueue(_entryCompaction); _entryCompaction = _entryPool.next(); } if (!_entry.isEmpty()) { if(_persistListener != null) { _persistListener.beforePersist(_entry); } // Create entry log and persist in-memory data File file = new File(getDirectory(), getEntryLogName(_entry)); _entry.save(file); if(_persistListener != null) { _persistListener.afterPersist(_entry); } // Advance low water mark to maintain progress record _lwmScn = Math.max(_lwmScn, _entry.getMaxScn()); _entryPool.addToServiceQueue(_entry); _entry = _entryPool.next(); } // Apply entry logs to array file if (_autoApplyEntries) { if (_entryPool.getServiceQueueSize() >= _maxEntries) { applyEntries(blocking); } } }
java
protected synchronized void switchEntry(boolean blocking) throws IOException { /** * Must create compaction redo before update redo to prevent data loss. * * The "applyEntries" method will internally sort compaction redo and update redo * entries using stable Arrays.sort. The following order of creating redo entries * will ensure that compaction redo does NOT overwrite update redo. */ if (!_entryCompaction.isEmpty()) { // Create entry log and persist in-memory data File file = new File(getDirectory(), getEntryLogName(_entryCompaction)); _entryCompaction.save(file); _entryPool.addToServiceQueue(_entryCompaction); _entryCompaction = _entryPool.next(); } if (!_entry.isEmpty()) { if(_persistListener != null) { _persistListener.beforePersist(_entry); } // Create entry log and persist in-memory data File file = new File(getDirectory(), getEntryLogName(_entry)); _entry.save(file); if(_persistListener != null) { _persistListener.afterPersist(_entry); } // Advance low water mark to maintain progress record _lwmScn = Math.max(_lwmScn, _entry.getMaxScn()); _entryPool.addToServiceQueue(_entry); _entry = _entryPool.next(); } // Apply entry logs to array file if (_autoApplyEntries) { if (_entryPool.getServiceQueueSize() >= _maxEntries) { applyEntries(blocking); } } }
[ "protected", "synchronized", "void", "switchEntry", "(", "boolean", "blocking", ")", "throws", "IOException", "{", "/**\n * Must create compaction redo before update redo to prevent data loss.\n * \n * The \"applyEntries\" method will internally sort compaction redo and update redo...
Switches to a new entry if the current _entry is not empty. @throws IOException
[ "Switches", "to", "a", "new", "entry", "if", "the", "current", "_entry", "is", "not", "empty", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java#L295-L336
train
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java
ArrayEntryManager.applyEntries
protected synchronized void applyEntries(boolean blocking) throws IOException { if (blocking) { /* Blocking Mode */ synchronized(_entryApply) { List<Entry<V>> entryList = new ArrayList<Entry<V>>(); while(_entryPool.getServiceQueueSize() > 0) { Entry<V> entry = _entryPool.pollFromService(); if(entry != null) entryList.add(entry); } applyEntries(entryList); } } else { /* Non-Blocking Mode */ synchronized(_entryApply) { for(int i = 0; i < _maxEntries; i++) { Entry<V> entry = _entryPool.pollFromService(); if(entry != null) _entryApply.add(entry); } } // Start a separate thread to update the underlying array file new Thread(_entryApply).start(); } }
java
protected synchronized void applyEntries(boolean blocking) throws IOException { if (blocking) { /* Blocking Mode */ synchronized(_entryApply) { List<Entry<V>> entryList = new ArrayList<Entry<V>>(); while(_entryPool.getServiceQueueSize() > 0) { Entry<V> entry = _entryPool.pollFromService(); if(entry != null) entryList.add(entry); } applyEntries(entryList); } } else { /* Non-Blocking Mode */ synchronized(_entryApply) { for(int i = 0; i < _maxEntries; i++) { Entry<V> entry = _entryPool.pollFromService(); if(entry != null) _entryApply.add(entry); } } // Start a separate thread to update the underlying array file new Thread(_entryApply).start(); } }
[ "protected", "synchronized", "void", "applyEntries", "(", "boolean", "blocking", ")", "throws", "IOException", "{", "if", "(", "blocking", ")", "{", "/* Blocking Mode */", "synchronized", "(", "_entryApply", ")", "{", "List", "<", "Entry", "<", "V", ">>", "ent...
Apply accumulated entries to the array file. @throws IOException
[ "Apply", "accumulated", "entries", "to", "the", "array", "file", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java#L359-L381
train
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java
ArrayEntryManager.loadEntryFiles
protected List<Entry<V>> loadEntryFiles() { File[] files = getDirectory().listFiles(); String prefix = getEntryLogPrefix(); String suffix = getEntryLogSuffix(); List<Entry<V>> entryList = new ArrayList<Entry<V>>(); if(files == null) return entryList; for (File file : files) { String fileName = file.getName(); if (fileName.startsWith(prefix) && fileName.endsWith(suffix)) { try { Entry<V> entry = _entryPool.next(); entry.load(file); entryList.add(entry); } catch(Exception e) { String filePath = file.getAbsolutePath(); _log.warn(filePath + " corrupted: length=" + file.length(), e); if(file.delete()) { _log.warn(filePath + " deleted"); } } } } return entryList; }
java
protected List<Entry<V>> loadEntryFiles() { File[] files = getDirectory().listFiles(); String prefix = getEntryLogPrefix(); String suffix = getEntryLogSuffix(); List<Entry<V>> entryList = new ArrayList<Entry<V>>(); if(files == null) return entryList; for (File file : files) { String fileName = file.getName(); if (fileName.startsWith(prefix) && fileName.endsWith(suffix)) { try { Entry<V> entry = _entryPool.next(); entry.load(file); entryList.add(entry); } catch(Exception e) { String filePath = file.getAbsolutePath(); _log.warn(filePath + " corrupted: length=" + file.length(), e); if(file.delete()) { _log.warn(filePath + " deleted"); } } } } return entryList; }
[ "protected", "List", "<", "Entry", "<", "V", ">", ">", "loadEntryFiles", "(", ")", "{", "File", "[", "]", "files", "=", "getDirectory", "(", ")", ".", "listFiles", "(", ")", ";", "String", "prefix", "=", "getEntryLogPrefix", "(", ")", ";", "String", ...
Load entry log files from disk into _entryList. @throws IOException
[ "Load", "entry", "log", "files", "from", "disk", "into", "_entryList", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java#L411-L437
train
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java
ArrayEntryManager.filterEntryList
private List<Entry<V>> filterEntryList(List<Entry<V>> entryList, long minScn, long maxScn) { List<Entry<V>> result = new ArrayList<Entry<V>>(entryList.size()); for (Entry<V> e : entryList) { if (minScn <= e.getMinScn() && e.getMaxScn() <= maxScn) { result.add(e); } } return result; }
java
private List<Entry<V>> filterEntryList(List<Entry<V>> entryList, long minScn, long maxScn) { List<Entry<V>> result = new ArrayList<Entry<V>>(entryList.size()); for (Entry<V> e : entryList) { if (minScn <= e.getMinScn() && e.getMaxScn() <= maxScn) { result.add(e); } } return result; }
[ "private", "List", "<", "Entry", "<", "V", ">", ">", "filterEntryList", "(", "List", "<", "Entry", "<", "V", ">", ">", "entryList", ",", "long", "minScn", ",", "long", "maxScn", ")", "{", "List", "<", "Entry", "<", "V", ">>", "result", "=", "new", ...
Filter and select entries from an entry list that only have SCNs no less than the specified lower bound minScn and that only have SCNs no greater than the specified upper bound maxScn. @param minScn Inclusive lower bound SCN. @param maxScn Inclusive upper bound SCN.
[ "Filter", "and", "select", "entries", "from", "an", "entry", "list", "that", "only", "have", "SCNs", "no", "less", "than", "the", "specified", "lower", "bound", "minScn", "and", "that", "only", "have", "SCNs", "no", "greater", "than", "the", "specified", "...
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java#L489-L498
train
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java
ArrayEntryManager.filterEntryListLowerBound
private List<Entry<V>> filterEntryListLowerBound(List<Entry<V>> entryList, long scn) { List<Entry<V>> result = new ArrayList<Entry<V>>(entryList.size()); for (Entry<V> e : entryList) { if (scn <= e.getMinScn()) { result.add(e); } } return result; }
java
private List<Entry<V>> filterEntryListLowerBound(List<Entry<V>> entryList, long scn) { List<Entry<V>> result = new ArrayList<Entry<V>>(entryList.size()); for (Entry<V> e : entryList) { if (scn <= e.getMinScn()) { result.add(e); } } return result; }
[ "private", "List", "<", "Entry", "<", "V", ">", ">", "filterEntryListLowerBound", "(", "List", "<", "Entry", "<", "V", ">", ">", "entryList", ",", "long", "scn", ")", "{", "List", "<", "Entry", "<", "V", ">>", "result", "=", "new", "ArrayList", "<", ...
Filter and select entries from an entry list that only have SCNs no less than the specified lower bound. @param scn Inclusive lower bound SCN
[ "Filter", "and", "select", "entries", "from", "an", "entry", "list", "that", "only", "have", "SCNs", "no", "less", "than", "the", "specified", "lower", "bound", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java#L505-L514
train
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java
ArrayEntryManager.filterEntryListUpperBound
@SuppressWarnings("unused") private List<Entry<V>> filterEntryListUpperBound(List<Entry<V>> entryList, long scn) { List<Entry<V>> result = new ArrayList<Entry<V>>(entryList.size()); for (Entry<V> e : entryList) { if (e.getMaxScn() <= scn) { result.add(e); } } return result; }
java
@SuppressWarnings("unused") private List<Entry<V>> filterEntryListUpperBound(List<Entry<V>> entryList, long scn) { List<Entry<V>> result = new ArrayList<Entry<V>>(entryList.size()); for (Entry<V> e : entryList) { if (e.getMaxScn() <= scn) { result.add(e); } } return result; }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "private", "List", "<", "Entry", "<", "V", ">", ">", "filterEntryListUpperBound", "(", "List", "<", "Entry", "<", "V", ">", ">", "entryList", ",", "long", "scn", ")", "{", "List", "<", "Entry", "<", "V",...
Filter and select entries from an entry list that only have SCNs no greater than the specified upper bound. @param scn Inclusive upper bound SCN
[ "Filter", "and", "select", "entries", "from", "an", "entry", "list", "that", "only", "have", "SCNs", "no", "greater", "than", "the", "specified", "upper", "bound", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayEntryManager.java#L521-L531
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/Cob2XsdMain.java
Cob2XsdMain.execute
protected void execute(final File input, final String cobolFileEncoding, final File target, final String targetNamespacePrefix, final String xsltFileName) throws XsdGenerationException { try { _log.info("Started translation from COBOL to XML Schema"); _log.info("Taking COBOL from : " + input); _log.info("COBOL encoding : " + cobolFileEncoding == null ? "default" : cobolFileEncoding); _log.info("Output XML Schema to : " + target); _log.info("XML Schema namespace prefix : " + targetNamespacePrefix); _log.info("XSLT transform to apply : " + xsltFileName); _log.info("Options in effect : " + getConfig().toString()); if (input.isFile()) { if (FilenameUtils.getExtension(target.getPath()).length() == 0) { FileUtils.forceMkdir(target); } translate(input, cobolFileEncoding, target, targetNamespacePrefix, xsltFileName); } else { FileUtils.forceMkdir(target); for (File cobolFile : input.listFiles()) { if (cobolFile.isFile()) { translate(cobolFile, cobolFileEncoding, target, targetNamespacePrefix, xsltFileName); } } } _log.info("Finished translation"); } catch (IOException e) { throw new XsdGenerationException(e); } }
java
protected void execute(final File input, final String cobolFileEncoding, final File target, final String targetNamespacePrefix, final String xsltFileName) throws XsdGenerationException { try { _log.info("Started translation from COBOL to XML Schema"); _log.info("Taking COBOL from : " + input); _log.info("COBOL encoding : " + cobolFileEncoding == null ? "default" : cobolFileEncoding); _log.info("Output XML Schema to : " + target); _log.info("XML Schema namespace prefix : " + targetNamespacePrefix); _log.info("XSLT transform to apply : " + xsltFileName); _log.info("Options in effect : " + getConfig().toString()); if (input.isFile()) { if (FilenameUtils.getExtension(target.getPath()).length() == 0) { FileUtils.forceMkdir(target); } translate(input, cobolFileEncoding, target, targetNamespacePrefix, xsltFileName); } else { FileUtils.forceMkdir(target); for (File cobolFile : input.listFiles()) { if (cobolFile.isFile()) { translate(cobolFile, cobolFileEncoding, target, targetNamespacePrefix, xsltFileName); } } } _log.info("Finished translation"); } catch (IOException e) { throw new XsdGenerationException(e); } }
[ "protected", "void", "execute", "(", "final", "File", "input", ",", "final", "String", "cobolFileEncoding", ",", "final", "File", "target", ",", "final", "String", "targetNamespacePrefix", ",", "final", "String", "xsltFileName", ")", "throws", "XsdGenerationExceptio...
Translate a single file or all files from an input folder. Place results in the output folder. @param input the input COBOL file or folder @param cobolFileEncoding the COBOL file character encoding @param target the output folder or file where XML schema file must go @param targetNamespacePrefix the output XML schemas target namespace prefix @param xsltFileName an optional xslt to apply on the XML Schema @throws XsdGenerationException if XML schema cannot be generated
[ "Translate", "a", "single", "file", "or", "all", "files", "from", "an", "input", "folder", ".", "Place", "results", "in", "the", "output", "folder", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/Cob2XsdMain.java#L270-L305
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/Cob2XsdMain.java
Cob2XsdMain.getVersion
protected String getVersion() throws IOException { InputStream stream = null; try { Properties version = new Properties(); stream = Cob2XsdMain.class.getResourceAsStream(VERSION_FILE_NAME); version.load(stream); return version.getProperty("version"); } finally { if (stream != null) { stream.close(); } } }
java
protected String getVersion() throws IOException { InputStream stream = null; try { Properties version = new Properties(); stream = Cob2XsdMain.class.getResourceAsStream(VERSION_FILE_NAME); version.load(stream); return version.getProperty("version"); } finally { if (stream != null) { stream.close(); } } }
[ "protected", "String", "getVersion", "(", ")", "throws", "IOException", "{", "InputStream", "stream", "=", "null", ";", "try", "{", "Properties", "version", "=", "new", "Properties", "(", ")", ";", "stream", "=", "Cob2XsdMain", ".", "class", ".", "getResourc...
Pick up the version from the properties file. @return the product version @throws IOException if version cannot be identified
[ "Pick", "up", "the", "version", "from", "the", "properties", "file", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/Cob2XsdMain.java#L337-L349
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/Cob2XsdMain.java
Cob2XsdMain.setConfigFile
public void setConfigFile(final String config) { if (config == null) { throw (new IllegalArgumentException( "Configuration file parameter is null")); } File file = new File(config); if (file.exists()) { if (file.isDirectory()) { throw new IllegalArgumentException("Folder " + config + " is not a configuration file"); } } else { throw new IllegalArgumentException("Configuration file " + config + " not found"); } setConfigFile(file); }
java
public void setConfigFile(final String config) { if (config == null) { throw (new IllegalArgumentException( "Configuration file parameter is null")); } File file = new File(config); if (file.exists()) { if (file.isDirectory()) { throw new IllegalArgumentException("Folder " + config + " is not a configuration file"); } } else { throw new IllegalArgumentException("Configuration file " + config + " not found"); } setConfigFile(file); }
[ "public", "void", "setConfigFile", "(", "final", "String", "config", ")", "{", "if", "(", "config", "==", "null", ")", "{", "throw", "(", "new", "IllegalArgumentException", "(", "\"Configuration file parameter is null\"", ")", ")", ";", "}", "File", "file", "=...
Check the config parameter and keep it only if it is valid. @param config a file name (relative or absolute)
[ "Check", "the", "config", "parameter", "and", "keep", "it", "only", "if", "it", "is", "valid", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/Cob2XsdMain.java#L363-L379
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXConsumerAuditor.java
PIXConsumerAuditor.getAuditor
public static PIXConsumerAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (PIXConsumerAuditor)ctx.getAuditor(PIXConsumerAuditor.class); }
java
public static PIXConsumerAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (PIXConsumerAuditor)ctx.getAuditor(PIXConsumerAuditor.class); }
[ "public", "static", "PIXConsumerAuditor", "getAuditor", "(", ")", "{", "AuditorModuleContext", "ctx", "=", "AuditorModuleContext", ".", "getContext", "(", ")", ";", "return", "(", "PIXConsumerAuditor", ")", "ctx", ".", "getAuditor", "(", "PIXConsumerAuditor", ".", ...
Get an instance of the PIX Consumer Auditor from the global context @return PIX Consumer Auditor instance
[ "Get", "an", "instance", "of", "the", "PIX", "Consumer", "Auditor", "from", "the", "global", "context" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXConsumerAuditor.java#L45-L49
train
apptik/jus
benchmark/src/perf/java/com/android/volley/VolleyLog.java
VolleyLog.buildMessage
private static String buildMessage(String format, Object... args) { String msg = (args == null) ? format : String.format(Locale.US, format, args); StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace(); String caller = "<unknown>"; // Walk up the stack looking for the first caller outside of VolleyLog. // It will be at least two frames up, so start there. for (int i = 2; i < trace.length; i++) { Class<?> clazz = trace[i].getClass(); if (!clazz.equals(VolleyLog.class)) { String callingClass = trace[i].getClassName(); callingClass = callingClass.substring(callingClass.lastIndexOf('.') + 1); callingClass = callingClass.substring(callingClass.lastIndexOf('$') + 1); caller = callingClass + "." + trace[i].getMethodName(); break; } } return String.format(Locale.US, "[%d] %s: %s", Thread.currentThread().getId(), caller, msg); }
java
private static String buildMessage(String format, Object... args) { String msg = (args == null) ? format : String.format(Locale.US, format, args); StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace(); String caller = "<unknown>"; // Walk up the stack looking for the first caller outside of VolleyLog. // It will be at least two frames up, so start there. for (int i = 2; i < trace.length; i++) { Class<?> clazz = trace[i].getClass(); if (!clazz.equals(VolleyLog.class)) { String callingClass = trace[i].getClassName(); callingClass = callingClass.substring(callingClass.lastIndexOf('.') + 1); callingClass = callingClass.substring(callingClass.lastIndexOf('$') + 1); caller = callingClass + "." + trace[i].getMethodName(); break; } } return String.format(Locale.US, "[%d] %s: %s", Thread.currentThread().getId(), caller, msg); }
[ "private", "static", "String", "buildMessage", "(", "String", "format", ",", "Object", "...", "args", ")", "{", "String", "msg", "=", "(", "args", "==", "null", ")", "?", "format", ":", "String", ".", "format", "(", "Locale", ".", "US", ",", "format", ...
Formats the caller's provided message and prepends useful info like calling thread ID and method name.
[ "Formats", "the", "caller", "s", "provided", "message", "and", "prepends", "useful", "info", "like", "calling", "thread", "ID", "and", "method", "name", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/benchmark/src/perf/java/com/android/volley/VolleyLog.java#L80-L100
train
jingwei/krati
krati-main/src/main/java/krati/store/SerializableObjectStore.java
SerializableObjectStore.get
@Override public V get(K key) { if(key == null) { return null; } byte[] bytes = _store.get(_keySerializer.serialize(key)); return bytes == null ? null : _valSerializer.deserialize(bytes); }
java
@Override public V get(K key) { if(key == null) { return null; } byte[] bytes = _store.get(_keySerializer.serialize(key)); return bytes == null ? null : _valSerializer.deserialize(bytes); }
[ "@", "Override", "public", "V", "get", "(", "K", "key", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", "null", ";", "}", "byte", "[", "]", "bytes", "=", "_store", ".", "get", "(", "_keySerializer", ".", "serialize", "(", "key", ")"...
Gets an object based on its key from the store. @param key the retrieving key for a serializable object in the store. @return the retrieved object.
[ "Gets", "an", "object", "based", "on", "its", "key", "from", "the", "store", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/store/SerializableObjectStore.java#L106-L114
train
jingwei/krati
krati-main/src/main/java/krati/store/SerializableObjectStore.java
SerializableObjectStore.getBytes
@Override public byte[] getBytes(K key) { if(key == null) { return null; } return _store.get(_keySerializer.serialize(key)); }
java
@Override public byte[] getBytes(K key) { if(key == null) { return null; } return _store.get(_keySerializer.serialize(key)); }
[ "@", "Override", "public", "byte", "[", "]", "getBytes", "(", "K", "key", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", "null", ";", "}", "return", "_store", ".", "get", "(", "_keySerializer", ".", "serialize", "(", "key", ")", ")",...
Gets an object in the form of byte array from the store. @param key the retrieving key. @return the retrieved object in raw bytes.
[ "Gets", "an", "object", "in", "the", "form", "of", "byte", "array", "from", "the", "store", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/store/SerializableObjectStore.java#L133-L140
train
jingwei/krati
krati-main/src/main/java/krati/store/SerializableObjectStore.java
SerializableObjectStore.put
@Override public boolean put(K key, V value) throws Exception { if(key == null) { throw new NullPointerException("key"); } if(value == null) { return _store.delete(_keySerializer.serialize(key)); } else { return _store.put(_keySerializer.serialize(key), _valSerializer.serialize(value)); } }
java
@Override public boolean put(K key, V value) throws Exception { if(key == null) { throw new NullPointerException("key"); } if(value == null) { return _store.delete(_keySerializer.serialize(key)); } else { return _store.put(_keySerializer.serialize(key), _valSerializer.serialize(value)); } }
[ "@", "Override", "public", "boolean", "put", "(", "K", "key", ",", "V", "value", ")", "throws", "Exception", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"key\"", ")", ";", "}", "if", "(", "value", "==...
Puts an serializable object into the store. @param key the object key. @param value the serializable object. @return true if the put operation is succeeds. @throws NullPointerException if <code>key</code> is null. @throws Exception if this operation cannot be completed successfully.
[ "Puts", "an", "serializable", "object", "into", "the", "store", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/store/SerializableObjectStore.java#L165-L176
train
jingwei/krati
krati-main/src/main/java/krati/store/SerializableObjectStore.java
SerializableObjectStore.delete
@Override public boolean delete(K key) throws Exception { if(key == null) { throw new NullPointerException("key"); } return _store.delete(_keySerializer.serialize(key)); }
java
@Override public boolean delete(K key) throws Exception { if(key == null) { throw new NullPointerException("key"); } return _store.delete(_keySerializer.serialize(key)); }
[ "@", "Override", "public", "boolean", "delete", "(", "K", "key", ")", "throws", "Exception", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"key\"", ")", ";", "}", "return", "_store", ".", "delete", "(", "...
Deletes an object from the store based on its key. @param key the object key. @return true if the delete operation succeeds. @throws NullPointerException if <code>key</code> is null. @throws Exception if this operation cannot be completed successfully.
[ "Deletes", "an", "object", "from", "the", "store", "based", "on", "its", "key", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/store/SerializableObjectStore.java#L187-L194
train
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/Request.java
Request.setRetryPolicy
public <R extends Request<T>> R setRetryPolicy(RetryPolicy retryPolicy) { checkIfActive(); this.retryPolicy = retryPolicy; return (R) this; }
java
public <R extends Request<T>> R setRetryPolicy(RetryPolicy retryPolicy) { checkIfActive(); this.retryPolicy = retryPolicy; return (R) this; }
[ "public", "<", "R", "extends", "Request", "<", "T", ">", ">", "R", "setRetryPolicy", "(", "RetryPolicy", "retryPolicy", ")", "{", "checkIfActive", "(", ")", ";", "this", ".", "retryPolicy", "=", "retryPolicy", ";", "return", "(", "R", ")", "this", ";", ...
Sets the retry policy for this request. @return This Request object to allow for chaining.
[ "Sets", "the", "retry", "policy", "for", "this", "request", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/Request.java#L758-L762
train
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/Request.java
Request.setRedirectPolicy
public <R extends Request<T>> R setRedirectPolicy(RedirectPolicy redirectPolicy) { checkIfActive(); this.redirectPolicy = redirectPolicy; return (R) this; }
java
public <R extends Request<T>> R setRedirectPolicy(RedirectPolicy redirectPolicy) { checkIfActive(); this.redirectPolicy = redirectPolicy; return (R) this; }
[ "public", "<", "R", "extends", "Request", "<", "T", ">", ">", "R", "setRedirectPolicy", "(", "RedirectPolicy", "redirectPolicy", ")", "{", "checkIfActive", "(", ")", ";", "this", ".", "redirectPolicy", "=", "redirectPolicy", ";", "return", "(", "R", ")", "...
Sets the redirect policy for this request. @return This Request object to allow for chaining.
[ "Sets", "the", "redirect", "policy", "for", "this", "request", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/Request.java#L776-L780
train
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/Request.java
Request.setRequestQueue
<R extends Request<T>> R setRequestQueue(RequestQueue requestQueue) { checkIfActive(); java.lang.reflect.Method m = null; if (!(this.getClass().equals(Request.class))) { try { m = this.getClass().getDeclaredMethod("parseNetworkResponse", NetworkResponse .class); } catch (NoSuchMethodException e) { //e.printStackTrace(); } } if (converterFromResponse == null) { Type t; if (responseType != null) { t = responseType; } else { t = tryIdentifyResultType(this); } if (t == null) { throw new IllegalArgumentException("Cannot resolve Response type in order to " + "identify Response Converter for Request : " + this); } try { this.converterFromResponse = (Converter<NetworkResponse, T>) requestQueue .getResponseConverter(t, new Annotation[0]); } catch (IllegalArgumentException ex) { //check if parseNetworkResponse is overridden if (m == null) { //it is not so it is for sure that we cannot parse response thus throw throw ex; } //else keep quiet as conversion can probably be handled by the overridden method. // if it fails parse exception will be thrown. } } if (retryPolicy == null) { setRetryPolicy(new DefaultRetryPolicy(this)); } this.requestQueue = requestQueue; return (R) this; }
java
<R extends Request<T>> R setRequestQueue(RequestQueue requestQueue) { checkIfActive(); java.lang.reflect.Method m = null; if (!(this.getClass().equals(Request.class))) { try { m = this.getClass().getDeclaredMethod("parseNetworkResponse", NetworkResponse .class); } catch (NoSuchMethodException e) { //e.printStackTrace(); } } if (converterFromResponse == null) { Type t; if (responseType != null) { t = responseType; } else { t = tryIdentifyResultType(this); } if (t == null) { throw new IllegalArgumentException("Cannot resolve Response type in order to " + "identify Response Converter for Request : " + this); } try { this.converterFromResponse = (Converter<NetworkResponse, T>) requestQueue .getResponseConverter(t, new Annotation[0]); } catch (IllegalArgumentException ex) { //check if parseNetworkResponse is overridden if (m == null) { //it is not so it is for sure that we cannot parse response thus throw throw ex; } //else keep quiet as conversion can probably be handled by the overridden method. // if it fails parse exception will be thrown. } } if (retryPolicy == null) { setRetryPolicy(new DefaultRetryPolicy(this)); } this.requestQueue = requestQueue; return (R) this; }
[ "<", "R", "extends", "Request", "<", "T", ">", ">", "R", "setRequestQueue", "(", "RequestQueue", "requestQueue", ")", "{", "checkIfActive", "(", ")", ";", "java", ".", "lang", ".", "reflect", ".", "Method", "m", "=", "null", ";", "if", "(", "!", "(",...
Associates this request with the given queue. The request queue will be notified when this request has finished. @return This Request object to allow for chaining.
[ "Associates", "this", "request", "with", "the", "given", "queue", ".", "The", "request", "queue", "will", "be", "notified", "when", "this", "request", "has", "finished", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/Request.java#L843-L887
train
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/Request.java
Request.setCacheEntry
public <R extends Request<T>> R setCacheEntry(Cache.Entry entry) { cacheEntry = entry; return (R) this; }
java
public <R extends Request<T>> R setCacheEntry(Cache.Entry entry) { cacheEntry = entry; return (R) this; }
[ "public", "<", "R", "extends", "Request", "<", "T", ">", ">", "R", "setCacheEntry", "(", "Cache", ".", "Entry", "entry", ")", "{", "cacheEntry", "=", "entry", ";", "return", "(", "R", ")", "this", ";", "}" ]
Annotates this request with an entry retrieved for it from cache. Used for cache coherency support. @return This Request object to allow for chaining.
[ "Annotates", "this", "request", "with", "an", "entry", "retrieved", "for", "it", "from", "cache", ".", "Used", "for", "cache", "coherency", "support", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/Request.java#L940-L943
train
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/Request.java
Request.getHeadersMap
public final Map<String, String> getHeadersMap() { if (networkRequest != null && networkRequest.headers != null) { return networkRequest.headers.toMap(); } return Collections.emptyMap(); }
java
public final Map<String, String> getHeadersMap() { if (networkRequest != null && networkRequest.headers != null) { return networkRequest.headers.toMap(); } return Collections.emptyMap(); }
[ "public", "final", "Map", "<", "String", ",", "String", ">", "getHeadersMap", "(", ")", "{", "if", "(", "networkRequest", "!=", "null", "&&", "networkRequest", ".", "headers", "!=", "null", ")", "{", "return", "networkRequest", ".", "headers", ".", "toMap"...
Returns a list of extra HTTP headers to go along with this request
[ "Returns", "a", "list", "of", "extra", "HTTP", "headers", "to", "go", "along", "with", "this", "request" ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/Request.java#L969-L974
train
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/Request.java
Request.getBodyContentType
public String getBodyContentType() { if (networkRequest != null && networkRequest.contentType != null) { return networkRequest.contentType.toString(); } return null; }
java
public String getBodyContentType() { if (networkRequest != null && networkRequest.contentType != null) { return networkRequest.contentType.toString(); } return null; }
[ "public", "String", "getBodyContentType", "(", ")", "{", "if", "(", "networkRequest", "!=", "null", "&&", "networkRequest", ".", "contentType", "!=", "null", ")", "{", "return", "networkRequest", ".", "contentType", ".", "toString", "(", ")", ";", "}", "retu...
Returns the content type of the POST or PUT body.
[ "Returns", "the", "content", "type", "of", "the", "POST", "or", "PUT", "body", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/Request.java#L986-L991
train
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/Request.java
Request.setShouldCache
public final <R extends Request<T>> R setShouldCache(boolean shouldCache) { checkIfActive(); this.shouldCache = shouldCache; return (R) this; }
java
public final <R extends Request<T>> R setShouldCache(boolean shouldCache) { checkIfActive(); this.shouldCache = shouldCache; return (R) this; }
[ "public", "final", "<", "R", "extends", "Request", "<", "T", ">", ">", "R", "setShouldCache", "(", "boolean", "shouldCache", ")", "{", "checkIfActive", "(", ")", ";", "this", ".", "shouldCache", "=", "shouldCache", ";", "return", "(", "R", ")", "this", ...
Set whether or not responses to this request should be cached. @return This Request object to allow for chaining.
[ "Set", "whether", "or", "not", "responses", "to", "this", "request", "should", "be", "cached", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/Request.java#L1008-L1012
train
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/Request.java
Request.parseNetworkResponse
protected Response<T> parseNetworkResponse(NetworkResponse response) { T parsed = null; try { parsed = converterFromResponse.convert(response); } catch (Exception e) { return Response.error(new ParseError(e)); } return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response)); }
java
protected Response<T> parseNetworkResponse(NetworkResponse response) { T parsed = null; try { parsed = converterFromResponse.convert(response); } catch (Exception e) { return Response.error(new ParseError(e)); } return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response)); }
[ "protected", "Response", "<", "T", ">", "parseNetworkResponse", "(", "NetworkResponse", "response", ")", "{", "T", "parsed", "=", "null", ";", "try", "{", "parsed", "=", "converterFromResponse", ".", "convert", "(", "response", ")", ";", "}", "catch", "(", ...
Subclasses can implement this to parse the raw network response and return an appropriate response type. This method will be called from a worker threadId. The response will not be delivered if you return null. @param response Response from the network @return The parsed response, or null in the case of an error
[ "Subclasses", "can", "implement", "this", "to", "parse", "the", "raw", "network", "response", "and", "return", "an", "appropriate", "response", "type", ".", "This", "method", "will", "be", "called", "from", "a", "worker", "threadId", ".", "The", "response", ...
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/Request.java#L1046-L1054
train
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/Request.java
Request.deliverResponse
protected void deliverResponse(T response) { synchronized (responseListeners) { for (RequestListener.ResponseListener responseListener : responseListeners) { responseListener.onResponse(response); } if (!this.response.intermediate) { responseListeners.clear(); } } if (!this.response.intermediate) { synchronized (errorListeners) { errorListeners.clear(); } } }
java
protected void deliverResponse(T response) { synchronized (responseListeners) { for (RequestListener.ResponseListener responseListener : responseListeners) { responseListener.onResponse(response); } if (!this.response.intermediate) { responseListeners.clear(); } } if (!this.response.intermediate) { synchronized (errorListeners) { errorListeners.clear(); } } }
[ "protected", "void", "deliverResponse", "(", "T", "response", ")", "{", "synchronized", "(", "responseListeners", ")", "{", "for", "(", "RequestListener", ".", "ResponseListener", "responseListener", ":", "responseListeners", ")", "{", "responseListener", ".", "onRe...
Subclasses must implement this to perform delivery of the parsed response to their listeners. The given response is guaranteed to be non-null; responses that fail to parse are not delivered. @param response The parsed response returned by {@link #parseNetworkResponse(NetworkResponse)}
[ "Subclasses", "must", "implement", "this", "to", "perform", "delivery", "of", "the", "parsed", "response", "to", "their", "listeners", ".", "The", "given", "response", "is", "guaranteed", "to", "be", "non", "-", "null", ";", "responses", "that", "fail", "to"...
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/Request.java#L1076-L1090
train
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/Request.java
Request.deliverError
public void deliverError(JusError error) { synchronized (errorListeners) { for (RequestListener.ErrorListener errorListener : errorListeners) { errorListener.onError(error); } errorListeners.clear(); } synchronized (responseListeners) { responseListeners.clear(); } }
java
public void deliverError(JusError error) { synchronized (errorListeners) { for (RequestListener.ErrorListener errorListener : errorListeners) { errorListener.onError(error); } errorListeners.clear(); } synchronized (responseListeners) { responseListeners.clear(); } }
[ "public", "void", "deliverError", "(", "JusError", "error", ")", "{", "synchronized", "(", "errorListeners", ")", "{", "for", "(", "RequestListener", ".", "ErrorListener", "errorListener", ":", "errorListeners", ")", "{", "errorListener", ".", "onError", "(", "e...
Delivers error message to the ErrorListener that the Request was initialized with. @param error Error details
[ "Delivers", "error", "message", "to", "the", "ErrorListener", "that", "the", "Request", "was", "initialized", "with", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/Request.java#L1098-L1108
train
apptik/jus
jus-java/src/main/java/io/apptik/comm/jus/Request.java
Request.compareTo
@Override public int compareTo(Request<T> other) { Priority left = this.getPriority(); Priority right = other.getPriority(); // High-priority requests are "lesser" so they are sorted to the front. // Equal priorities are sorted by sequence number to provide FIFO ordering. return left == right ? this.sequence - other.sequence : right.ordinal() - left.ordinal(); }
java
@Override public int compareTo(Request<T> other) { Priority left = this.getPriority(); Priority right = other.getPriority(); // High-priority requests are "lesser" so they are sorted to the front. // Equal priorities are sorted by sequence number to provide FIFO ordering. return left == right ? this.sequence - other.sequence : right.ordinal() - left.ordinal(); }
[ "@", "Override", "public", "int", "compareTo", "(", "Request", "<", "T", ">", "other", ")", "{", "Priority", "left", "=", "this", ".", "getPriority", "(", ")", ";", "Priority", "right", "=", "other", ".", "getPriority", "(", ")", ";", "// High-priority r...
Our comparator sorts from high to low priority, and secondarily by sequence number to provide FIFO ordering.
[ "Our", "comparator", "sorts", "from", "high", "to", "low", "priority", "and", "secondarily", "by", "sequence", "number", "to", "provide", "FIFO", "ordering", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/Request.java#L1119-L1129
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java
IHEAuditor.getSystemAltUserId
public String getSystemAltUserId() { // If a localized value is set, use it if (!EventUtils.isEmptyOrNull(systemAltUserId)) { return systemAltUserId; } // Check if a configuration parameter is set systemAltUserId = getConfig().getSystemAltUserId(); if (!EventUtils.isEmptyOrNull(systemAltUserId)) { return systemAltUserId; } // If both are empty, attempt to determine the alternate user id // per IHE specifications (e.g. owner JVM's process id) String processId = null; try { // JVM specification says the runtime bean name may contain // the process and context information about the JVM, including // process ID. Attempt to get this information RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean(); processId = mx.getName(); int pointer; if (( pointer = processId.indexOf('@')) != -1) { processId = processId.substring(0,pointer); } } catch (Throwable t) { // Ignore errors and exceptions, we'll just fake it } // If we can't get the process ID or if it's not set, fake it if (EventUtils.isEmptyOrNull(processId)) { processId = String.valueOf((int)(Math.random()*1000)); } systemAltUserId = processId; return systemAltUserId; }
java
public String getSystemAltUserId() { // If a localized value is set, use it if (!EventUtils.isEmptyOrNull(systemAltUserId)) { return systemAltUserId; } // Check if a configuration parameter is set systemAltUserId = getConfig().getSystemAltUserId(); if (!EventUtils.isEmptyOrNull(systemAltUserId)) { return systemAltUserId; } // If both are empty, attempt to determine the alternate user id // per IHE specifications (e.g. owner JVM's process id) String processId = null; try { // JVM specification says the runtime bean name may contain // the process and context information about the JVM, including // process ID. Attempt to get this information RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean(); processId = mx.getName(); int pointer; if (( pointer = processId.indexOf('@')) != -1) { processId = processId.substring(0,pointer); } } catch (Throwable t) { // Ignore errors and exceptions, we'll just fake it } // If we can't get the process ID or if it's not set, fake it if (EventUtils.isEmptyOrNull(processId)) { processId = String.valueOf((int)(Math.random()*1000)); } systemAltUserId = processId; return systemAltUserId; }
[ "public", "String", "getSystemAltUserId", "(", ")", "{", "// If a localized value is set, use it", "if", "(", "!", "EventUtils", ".", "isEmptyOrNull", "(", "systemAltUserId", ")", ")", "{", "return", "systemAltUserId", ";", "}", "// Check if a configuration parameter is s...
Get alternate user id for the system's ActiveParticipant in audit messages. This is either set in configuration or the the auditor will attempt to determine it from the JVM's process id. @see org.openhealthtools.ihe.atna.auditor.context.AuditorModuleConfig#setSystemAltUserId(String) @return The alternate user id
[ "Get", "alternate", "user", "id", "for", "the", "system", "s", "ActiveParticipant", "in", "audit", "messages", ".", "This", "is", "either", "set", "in", "configuration", "or", "the", "the", "auditor", "will", "attempt", "to", "determine", "it", "from", "the"...
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java#L333-L372
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java
IHEAuditor.getSystemNetworkId
public String getSystemNetworkId() { String ipAddress = getConfig().getSystemIpAddress(); if (!EventUtils.isEmptyOrNull(ipAddress)) { return ipAddress; } if (EventUtils.isEmptyOrNull(systemNetworkAccessPointId)) { // No set System Address, will attempt to look it up try { InetAddress localAddress = InetAddress.getLocalHost(); systemNetworkAccessPointId = localAddress.getHostAddress(); } catch (Exception e) { LOGGER.error("Unable to get system IP address, defaulting to localhost"); systemNetworkAccessPointId = "localhost"; } } return systemNetworkAccessPointId; }
java
public String getSystemNetworkId() { String ipAddress = getConfig().getSystemIpAddress(); if (!EventUtils.isEmptyOrNull(ipAddress)) { return ipAddress; } if (EventUtils.isEmptyOrNull(systemNetworkAccessPointId)) { // No set System Address, will attempt to look it up try { InetAddress localAddress = InetAddress.getLocalHost(); systemNetworkAccessPointId = localAddress.getHostAddress(); } catch (Exception e) { LOGGER.error("Unable to get system IP address, defaulting to localhost"); systemNetworkAccessPointId = "localhost"; } } return systemNetworkAccessPointId; }
[ "public", "String", "getSystemNetworkId", "(", ")", "{", "String", "ipAddress", "=", "getConfig", "(", ")", ".", "getSystemIpAddress", "(", ")", ";", "if", "(", "!", "EventUtils", ".", "isEmptyOrNull", "(", "ipAddress", ")", ")", "{", "return", "ipAddress", ...
Get the system's ActiveParticipant Network ID for use in audit messages. Configuration is the default value used. If no value is set in configuration, then Java will attempt to determine your system's IP address. If Java cannot determine your system's IP address, then localhost is used. @see org.openhealthtools.ihe.atna.auditor.context.AuditorModuleConfig#setSystemIpAddress(String) @return The system's ActiveParticipant NetworkID
[ "Get", "the", "system", "s", "ActiveParticipant", "Network", "ID", "for", "use", "in", "audit", "messages", ".", "Configuration", "is", "the", "default", "value", "used", ".", "If", "no", "value", "is", "set", "in", "configuration", "then", "Java", "will", ...
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java#L453-L470
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java
IHEAuditor.isAuditorEnabled
public boolean isAuditorEnabled() { if (!getConfig().isAuditorEnabled()) { return false; } if (getConfig().getDisabledAuditors().contains(this.getClass())) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Auditor "+ this.getClass().getName() + " is disabled by configuration"); } return false; } return true; }
java
public boolean isAuditorEnabled() { if (!getConfig().isAuditorEnabled()) { return false; } if (getConfig().getDisabledAuditors().contains(this.getClass())) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Auditor "+ this.getClass().getName() + " is disabled by configuration"); } return false; } return true; }
[ "public", "boolean", "isAuditorEnabled", "(", ")", "{", "if", "(", "!", "getConfig", "(", ")", ".", "isAuditorEnabled", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "getConfig", "(", ")", ".", "getDisabledAuditors", "(", ")", ".", "conta...
Determines whether this auditor instance is enabled. Checks if global auditing is enabled in configuration and if the auditor instance's class is in the list of auditors specifically disabled by configuration @see org.openhealthtools.ihe.atna.auditor.context.AuditorModuleConfig#isAuditorEnabled() @see org.openhealthtools.ihe.atna.auditor.context.AuditorModuleConfig#getDisabledAuditors() @return Whether this auditor instance is enabled
[ "Determines", "whether", "this", "auditor", "instance", "is", "enabled", ".", "Checks", "if", "global", "auditing", "is", "enabled", "in", "configuration", "and", "if", "the", "auditor", "instance", "s", "class", "is", "in", "the", "list", "of", "auditors", ...
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java#L486-L498
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java
IHEAuditor.isAuditorEnabledForEventId
public boolean isAuditorEnabledForEventId(AuditEventMessage msg) { CodedValueType eventIdCode = msg.getAuditMessage().getEventIdentification().getEventID(); if (EventUtils.containsCode(eventIdCode, getConfig().getDisabledEvents())) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Auditor is disabled by configuration for event " + eventIdCode.getOriginalText() + " (" + eventIdCode.getCode() + ")"); } return false; } return true; }
java
public boolean isAuditorEnabledForEventId(AuditEventMessage msg) { CodedValueType eventIdCode = msg.getAuditMessage().getEventIdentification().getEventID(); if (EventUtils.containsCode(eventIdCode, getConfig().getDisabledEvents())) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Auditor is disabled by configuration for event " + eventIdCode.getOriginalText() + " (" + eventIdCode.getCode() + ")"); } return false; } return true; }
[ "public", "boolean", "isAuditorEnabledForEventId", "(", "AuditEventMessage", "msg", ")", "{", "CodedValueType", "eventIdCode", "=", "msg", ".", "getAuditMessage", "(", ")", ".", "getEventIdentification", "(", ")", ".", "getEventID", "(", ")", ";", "if", "(", "Ev...
Determines if the event that this audit message represents should be audited or if the auditor is disabled by configuration. Examples of events that may be disabled include "Export", "Import", "Patient Record", "Security Alert", etc. This method is useful for disabling event-specific messages (such as those relating to actor and stopping embedded inside of actors) because they need to be controlled at a higher level. Also can be useful for testing scenarios where only specific events need to be set at any given time. @see org.openhealthtools.ihe.atna.auditor.context.AuditorModuleConfig#getDisabledEvents() @see org.openhealthtools.ihe.atna.auditor.codes.dicom.DICOMEventIdCodes @param msg The audit event message to check @return Whether the message should be sent
[ "Determines", "if", "the", "event", "that", "this", "audit", "message", "represents", "should", "be", "audited", "or", "if", "the", "auditor", "is", "disabled", "by", "configuration", ".", "Examples", "of", "events", "that", "may", "be", "disabled", "include",...
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java#L515-L525
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java
IHEAuditor.auditUserAuthenticationLoginEvent
public void auditUserAuthenticationLoginEvent(RFC3881EventOutcomeCodes outcome, boolean isAuthenticatedSystem, String remoteUserId, String remoteIpAddress, String remoteUserNodeIpAddress) { auditUserAuthenticationEvent(outcome, new DICOMEventTypeCodes.Login(), isAuthenticatedSystem, remoteUserId, remoteIpAddress, remoteUserNodeIpAddress); }
java
public void auditUserAuthenticationLoginEvent(RFC3881EventOutcomeCodes outcome, boolean isAuthenticatedSystem, String remoteUserId, String remoteIpAddress, String remoteUserNodeIpAddress) { auditUserAuthenticationEvent(outcome, new DICOMEventTypeCodes.Login(), isAuthenticatedSystem, remoteUserId, remoteIpAddress, remoteUserNodeIpAddress); }
[ "public", "void", "auditUserAuthenticationLoginEvent", "(", "RFC3881EventOutcomeCodes", "outcome", ",", "boolean", "isAuthenticatedSystem", ",", "String", "remoteUserId", ",", "String", "remoteIpAddress", ",", "String", "remoteUserNodeIpAddress", ")", "{", "auditUserAuthentic...
Audit a User Authentication - Login Event @param outcome Event outcome indicator @param isAuthenticatedSystem Whether the system auditing is the authenticated system (client) or authenticator (server, e.g. kerberos) @param remoteUserId User ID of the system that is not sending the audit message @param remoteIpAddress IP Address of the system that is not sending the audit message @param remoteUserNodeIpAddress IP Address of the user system requesting the login authentication
[ "Audit", "a", "User", "Authentication", "-", "Login", "Event" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java#L709-L714
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java
IHEAuditor.auditUserAuthenticationLogoutEvent
public void auditUserAuthenticationLogoutEvent(RFC3881EventOutcomeCodes outcome, boolean isAuthenticatedSystem, String remoteUserId, String remoteIpAddress, String remoteUserNodeIpAddress) { auditUserAuthenticationEvent(outcome, new DICOMEventTypeCodes.Logout(), isAuthenticatedSystem, remoteUserId, remoteIpAddress, remoteUserNodeIpAddress); }
java
public void auditUserAuthenticationLogoutEvent(RFC3881EventOutcomeCodes outcome, boolean isAuthenticatedSystem, String remoteUserId, String remoteIpAddress, String remoteUserNodeIpAddress) { auditUserAuthenticationEvent(outcome, new DICOMEventTypeCodes.Logout(), isAuthenticatedSystem, remoteUserId, remoteIpAddress, remoteUserNodeIpAddress); }
[ "public", "void", "auditUserAuthenticationLogoutEvent", "(", "RFC3881EventOutcomeCodes", "outcome", ",", "boolean", "isAuthenticatedSystem", ",", "String", "remoteUserId", ",", "String", "remoteIpAddress", ",", "String", "remoteUserNodeIpAddress", ")", "{", "auditUserAuthenti...
Audit a User Authentication - Logout Event @param outcome Event outcome indicator @param isAuthenticatedSystem Whether the system auditing is the authenticated system (client) or authenticator (server, e.g. kerberos) @param remoteUserId User ID of the system that is not sending the audit message @param remoteIpAddress IP Address of the system that is not sending the audit message @param remoteUserNodeIpAddress IP Address of the user system whose logout event triggered the audit
[ "Audit", "a", "User", "Authentication", "-", "Logout", "Event" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java#L725-L730
train
legsem/legstar-core2
legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java
Xsd2CobolTypesModelBuilder.addField
private void addField(int fieldIndex, XmlSchemaObjectBase xsdSchemaObject, Map < String, Object > fields, RootCompositeType compositeTypes) { if (xsdSchemaObject instanceof XmlSchemaElement) { XmlSchemaElement xsdElement = (XmlSchemaElement) xsdSchemaObject; fields.put(getFieldName(xsdElement), getProps(fieldIndex, xsdElement, compositeTypes)); } else if (xsdSchemaObject instanceof XmlSchemaChoice) { XmlSchemaChoice xsdChoice = (XmlSchemaChoice) xsdSchemaObject; fields.put(getFieldName(xsdChoice), getProps(fieldIndex, xsdChoice, compositeTypes)); } // TODO Add Groups }
java
private void addField(int fieldIndex, XmlSchemaObjectBase xsdSchemaObject, Map < String, Object > fields, RootCompositeType compositeTypes) { if (xsdSchemaObject instanceof XmlSchemaElement) { XmlSchemaElement xsdElement = (XmlSchemaElement) xsdSchemaObject; fields.put(getFieldName(xsdElement), getProps(fieldIndex, xsdElement, compositeTypes)); } else if (xsdSchemaObject instanceof XmlSchemaChoice) { XmlSchemaChoice xsdChoice = (XmlSchemaChoice) xsdSchemaObject; fields.put(getFieldName(xsdChoice), getProps(fieldIndex, xsdChoice, compositeTypes)); } // TODO Add Groups }
[ "private", "void", "addField", "(", "int", "fieldIndex", ",", "XmlSchemaObjectBase", "xsdSchemaObject", ",", "Map", "<", "String", ",", "Object", ">", "fields", ",", "RootCompositeType", "compositeTypes", ")", "{", "if", "(", "xsdSchemaObject", "instanceof", "XmlS...
Add a field with associated properties to a complex type. @param index the order of the field in the parent complex type @param xsdSchemaObject the potential field @param xsdSchemaObject the potential field @param fields the parent complex type's fields collection @param compositeTypes the lists of composite types being populated
[ "Add", "a", "field", "with", "associated", "properties", "to", "a", "complex", "type", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java#L253-L265
train
legsem/legstar-core2
legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java
Xsd2CobolTypesModelBuilder.addOptionalProps
private void addOptionalProps(XmlSchemaElement xsdElement, CobolAnnotations cobolAnnotations, Map < String, Object > props) { String dependingOn = cobolAnnotations.getDependingOn(); if (dependingOn != null) { props.put(IS_OPTIONAL_PROP_NAME, true); props.put(DEPENDING_ON_PROP_NAME, odoObjectNames.get(dependingOn)); } }
java
private void addOptionalProps(XmlSchemaElement xsdElement, CobolAnnotations cobolAnnotations, Map < String, Object > props) { String dependingOn = cobolAnnotations.getDependingOn(); if (dependingOn != null) { props.put(IS_OPTIONAL_PROP_NAME, true); props.put(DEPENDING_ON_PROP_NAME, odoObjectNames.get(dependingOn)); } }
[ "private", "void", "addOptionalProps", "(", "XmlSchemaElement", "xsdElement", ",", "CobolAnnotations", "cobolAnnotations", ",", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "String", "dependingOn", "=", "cobolAnnotations", ".", "getDependingOn", "(",...
Optional items are declared with a minOccurs of 0 and a maxOccurs of one. Usually, there is a depending on clause. @param xsdElement the xsd element marked as optional @param cobolAnnotations the xsd element COBOL annotations @param props the corresponding set of properties
[ "Optional", "items", "are", "declared", "with", "a", "minOccurs", "of", "0", "and", "a", "maxOccurs", "of", "one", ".", "Usually", "there", "is", "a", "depending", "on", "clause", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java#L439-L446
train
legsem/legstar-core2
legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java
Xsd2CobolTypesModelBuilder.getProps
private Map < String, Object > getProps(XmlSchemaSimpleType xsdSimpleType, final CobolAnnotations cobolAnnotations) { XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) xsdSimpleType .getContent(); if (restriction != null && restriction.getBaseTypeName() != null) { QName xsdTypeName = restriction.getBaseTypeName(); List < XmlSchemaFacet > facets = restriction.getFacets(); if (xsdTypeName.equals(Constants.XSD_STRING)) { return getCobolAlphanumType(facets); } else if (xsdTypeName.equals(Constants.XSD_HEXBIN)) { return getCobolOctetStreamType(facets); } else if (xsdTypeName.equals(Constants.XSD_INT)) { return getCobolDecimalType(cobolAnnotations, Integer.class); } else if (xsdTypeName.equals(Constants.XSD_LONG)) { return getCobolDecimalType(cobolAnnotations, Long.class); } else if (xsdTypeName.equals(Constants.XSD_SHORT)) { return getCobolDecimalType(cobolAnnotations, Short.class); } else if (xsdTypeName.equals(Constants.XSD_DECIMAL)) { return getCobolDecimalType(cobolAnnotations, BigDecimal.class); } else if (xsdTypeName.equals(Constants.XSD_FLOAT)) { return getCobolDecimalType(cobolAnnotations, Float.class); } else if (xsdTypeName.equals(Constants.XSD_DOUBLE)) { return getCobolDecimalType(cobolAnnotations, Double.class); } else if (xsdTypeName.equals(Constants.XSD_UNSIGNEDINT)) { return getCobolDecimalType(cobolAnnotations, Long.class); } else if (xsdTypeName.equals(Constants.XSD_UNSIGNEDSHORT)) { return getCobolDecimalType(cobolAnnotations, Integer.class); } else if (xsdTypeName.equals(Constants.XSD_UNSIGNEDLONG)) { return getCobolDecimalType(cobolAnnotations, BigInteger.class); } else if (xsdTypeName.equals(Constants.XSD_INTEGER)) { return getCobolDecimalType(cobolAnnotations, BigInteger.class); } else { throw new Xsd2ConverterException("Unsupported xsd type " + xsdTypeName); } } else { throw new Xsd2ConverterException("Simple type without restriction " + xsdSimpleType.getQName()); } }
java
private Map < String, Object > getProps(XmlSchemaSimpleType xsdSimpleType, final CobolAnnotations cobolAnnotations) { XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) xsdSimpleType .getContent(); if (restriction != null && restriction.getBaseTypeName() != null) { QName xsdTypeName = restriction.getBaseTypeName(); List < XmlSchemaFacet > facets = restriction.getFacets(); if (xsdTypeName.equals(Constants.XSD_STRING)) { return getCobolAlphanumType(facets); } else if (xsdTypeName.equals(Constants.XSD_HEXBIN)) { return getCobolOctetStreamType(facets); } else if (xsdTypeName.equals(Constants.XSD_INT)) { return getCobolDecimalType(cobolAnnotations, Integer.class); } else if (xsdTypeName.equals(Constants.XSD_LONG)) { return getCobolDecimalType(cobolAnnotations, Long.class); } else if (xsdTypeName.equals(Constants.XSD_SHORT)) { return getCobolDecimalType(cobolAnnotations, Short.class); } else if (xsdTypeName.equals(Constants.XSD_DECIMAL)) { return getCobolDecimalType(cobolAnnotations, BigDecimal.class); } else if (xsdTypeName.equals(Constants.XSD_FLOAT)) { return getCobolDecimalType(cobolAnnotations, Float.class); } else if (xsdTypeName.equals(Constants.XSD_DOUBLE)) { return getCobolDecimalType(cobolAnnotations, Double.class); } else if (xsdTypeName.equals(Constants.XSD_UNSIGNEDINT)) { return getCobolDecimalType(cobolAnnotations, Long.class); } else if (xsdTypeName.equals(Constants.XSD_UNSIGNEDSHORT)) { return getCobolDecimalType(cobolAnnotations, Integer.class); } else if (xsdTypeName.equals(Constants.XSD_UNSIGNEDLONG)) { return getCobolDecimalType(cobolAnnotations, BigInteger.class); } else if (xsdTypeName.equals(Constants.XSD_INTEGER)) { return getCobolDecimalType(cobolAnnotations, BigInteger.class); } else { throw new Xsd2ConverterException("Unsupported xsd type " + xsdTypeName); } } else { throw new Xsd2ConverterException("Simple type without restriction " + xsdSimpleType.getQName()); } }
[ "private", "Map", "<", "String", ",", "Object", ">", "getProps", "(", "XmlSchemaSimpleType", "xsdSimpleType", ",", "final", "CobolAnnotations", "cobolAnnotations", ")", "{", "XmlSchemaSimpleTypeRestriction", "restriction", "=", "(", "XmlSchemaSimpleTypeRestriction", ")", ...
Retrieve the properties of a primitive type. @param xsdSimpleType the XML schema primitive type @param cobolAnnotations the associated COBOL annotations @return a set of properties
[ "Retrieve", "the", "properties", "of", "a", "primitive", "type", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java#L455-L496
train
legsem/legstar-core2
legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java
Xsd2CobolTypesModelBuilder.getCobolAlphanumType
private <T extends Number> Map < String, Object > getCobolAlphanumType( List < XmlSchemaFacet > facets) { Map < String, Object > props = new LinkedHashMap < String, Object >(); props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolStringType"); props.put(CHAR_NUM_PROP_NAME, getMaxLength(facets)); props.put(JAVA_TYPE_NAME_PROP_NAME, getShortTypeName(String.class)); return props; }
java
private <T extends Number> Map < String, Object > getCobolAlphanumType( List < XmlSchemaFacet > facets) { Map < String, Object > props = new LinkedHashMap < String, Object >(); props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolStringType"); props.put(CHAR_NUM_PROP_NAME, getMaxLength(facets)); props.put(JAVA_TYPE_NAME_PROP_NAME, getShortTypeName(String.class)); return props; }
[ "private", "<", "T", "extends", "Number", ">", "Map", "<", "String", ",", "Object", ">", "getCobolAlphanumType", "(", "List", "<", "XmlSchemaFacet", ">", "facets", ")", "{", "Map", "<", "String", ",", "Object", ">", "props", "=", "new", "LinkedHashMap", ...
Retrieve the properties of an alphanumeric type. @param facets the XSD facets @return the properties of an alphanumeric type
[ "Retrieve", "the", "properties", "of", "an", "alphanumeric", "type", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java#L504-L511
train
legsem/legstar-core2
legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java
Xsd2CobolTypesModelBuilder.getMaxLength
private int getMaxLength(List < XmlSchemaFacet > facets) { for (XmlSchemaFacet facet : facets) { if (facet instanceof XmlSchemaMaxLengthFacet) { return Integer .parseInt((String) ((XmlSchemaMaxLengthFacet) facet) .getValue()); } } return -1; }
java
private int getMaxLength(List < XmlSchemaFacet > facets) { for (XmlSchemaFacet facet : facets) { if (facet instanceof XmlSchemaMaxLengthFacet) { return Integer .parseInt((String) ((XmlSchemaMaxLengthFacet) facet) .getValue()); } } return -1; }
[ "private", "int", "getMaxLength", "(", "List", "<", "XmlSchemaFacet", ">", "facets", ")", "{", "for", "(", "XmlSchemaFacet", "facet", ":", "facets", ")", "{", "if", "(", "facet", "instanceof", "XmlSchemaMaxLengthFacet", ")", "{", "return", "Integer", ".", "p...
Retrieve the maxLength facet if it exists. @param facets the list of facets @return the maxlength value or -1 if there are no maxLength facets
[ "Retrieve", "the", "maxLength", "facet", "if", "it", "exists", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java#L534-L543
train
legsem/legstar-core2
legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java
Xsd2CobolTypesModelBuilder.getCobolDecimalType
private <T extends Number> Map < String, Object > getCobolDecimalType( CobolAnnotations cobolAnnotations, Class < T > clazz) { String cobolType = cobolAnnotations.getCobolType(); Map < String, Object > props = new LinkedHashMap < String, Object >(); switch (CobolTypes.valueOf(cobolType)) { case ZONED_DECIMAL_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolZonedDecimalType"); props.put(SIGN_LEADING_PROP_NAME, cobolAnnotations.signLeading()); props.put(SIGN_SEPARATE_PROP_NAME, cobolAnnotations.signSeparate()); break; case PACKED_DECIMAL_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolPackedDecimalType"); break; case BINARY_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolBinaryType"); break; case NATIVE_BINARY_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolBinaryType"); // TODO create a CobolNativeBinaryType // props.put("minInclusive", ""); // props.put("maxInclusive", ""); break; case SINGLE_FLOAT_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolFloatType"); break; case DOUBLE_FLOAT_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolDoubleType"); break; default: throw new Xsd2ConverterException("Unsupported COBOL numeric type " + cobolType); } props.put(SIGNED_PROP_NAME, cobolAnnotations.signed()); props.put(TOTAL_DIGITS_PROP_NAME, cobolAnnotations.totalDigits()); props.put(FRACTION_DIGITS_PROP_NAME, cobolAnnotations.fractionDigits()); props.put(JAVA_TYPE_NAME_PROP_NAME, getShortTypeName(clazz)); if (cobolAnnotations.odoObject()) { props.put(ODO_OBJECT_PROP_NAME, true); odoObjects.put(cobolAnnotations.getCobolName(), props); } return props; }
java
private <T extends Number> Map < String, Object > getCobolDecimalType( CobolAnnotations cobolAnnotations, Class < T > clazz) { String cobolType = cobolAnnotations.getCobolType(); Map < String, Object > props = new LinkedHashMap < String, Object >(); switch (CobolTypes.valueOf(cobolType)) { case ZONED_DECIMAL_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolZonedDecimalType"); props.put(SIGN_LEADING_PROP_NAME, cobolAnnotations.signLeading()); props.put(SIGN_SEPARATE_PROP_NAME, cobolAnnotations.signSeparate()); break; case PACKED_DECIMAL_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolPackedDecimalType"); break; case BINARY_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolBinaryType"); break; case NATIVE_BINARY_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolBinaryType"); // TODO create a CobolNativeBinaryType // props.put("minInclusive", ""); // props.put("maxInclusive", ""); break; case SINGLE_FLOAT_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolFloatType"); break; case DOUBLE_FLOAT_ITEM: props.put(COBOL_TYPE_NAME_PROP_NAME, "CobolDoubleType"); break; default: throw new Xsd2ConverterException("Unsupported COBOL numeric type " + cobolType); } props.put(SIGNED_PROP_NAME, cobolAnnotations.signed()); props.put(TOTAL_DIGITS_PROP_NAME, cobolAnnotations.totalDigits()); props.put(FRACTION_DIGITS_PROP_NAME, cobolAnnotations.fractionDigits()); props.put(JAVA_TYPE_NAME_PROP_NAME, getShortTypeName(clazz)); if (cobolAnnotations.odoObject()) { props.put(ODO_OBJECT_PROP_NAME, true); odoObjects.put(cobolAnnotations.getCobolName(), props); } return props; }
[ "private", "<", "T", "extends", "Number", ">", "Map", "<", "String", ",", "Object", ">", "getCobolDecimalType", "(", "CobolAnnotations", "cobolAnnotations", ",", "Class", "<", "T", ">", "clazz", ")", "{", "String", "cobolType", "=", "cobolAnnotations", ".", ...
Retrieve the properties of a decimal type. @param cobolAnnotations the current set of COBOL annotations @param clazz the target java numeric type @return the properties of a decimal type
[ "Retrieve", "the", "properties", "of", "a", "decimal", "type", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java#L552-L597
train
legsem/legstar-core2
legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java
Xsd2CobolTypesModelBuilder.getShortTypeName
private static String getShortTypeName(Class < ? > javaType) { String javaTypeName = javaType.getName(); if (javaTypeName.startsWith("java.lang.")) { return javaTypeName.substring("java.lang.".length()); } else { return javaTypeName; } }
java
private static String getShortTypeName(Class < ? > javaType) { String javaTypeName = javaType.getName(); if (javaTypeName.startsWith("java.lang.")) { return javaTypeName.substring("java.lang.".length()); } else { return javaTypeName; } }
[ "private", "static", "String", "getShortTypeName", "(", "Class", "<", "?", ">", "javaType", ")", "{", "String", "javaTypeName", "=", "javaType", ".", "getName", "(", ")", ";", "if", "(", "javaTypeName", ".", "startsWith", "(", "\"java.lang.\"", ")", ")", "...
For java.lang types, strips the package which is not needed in generated java classes. @param javaType the proposed java class @return the java type name shortened if needed
[ "For", "java", ".", "lang", "types", "strips", "the", "package", "which", "is", "not", "needed", "in", "generated", "java", "classes", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base-generator/src/main/java/com/legstar/base/generator/Xsd2CobolTypesModelBuilder.java#L606-L613
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cobol/model/CobolAnnotations.java
CobolAnnotations.getCobolXsdAnnotations
private static Element getCobolXsdAnnotations(XmlSchemaElement xsdElement) { XmlSchemaAnnotation annotation = xsdElement.getAnnotation(); if (annotation == null || annotation.getItems().size() == 0) { throw new IllegalArgumentException("Xsd element of type " + xsdElement.getSchemaType().getQName() + " at line " + xsdElement.getLineNumber() + " does not have COBOL annotations"); } XmlSchemaAppInfo appinfo = (XmlSchemaAppInfo) annotation.getItems() .get(0); if (appinfo.getMarkup() == null) { throw new IllegalArgumentException("Xsd element of type " + xsdElement.getSchemaType().getQName() + " does not have any markup in its annotations"); } Node node = null; boolean found = false; for (int i = 0; i < appinfo.getMarkup().getLength(); i++) { node = appinfo.getMarkup().item(i); if (node instanceof Element && node.getLocalName().equals(CobolMarkup.ELEMENT) && node.getNamespaceURI().equals(CobolMarkup.NS)) { found = true; break; } } if (!found) { throw new IllegalArgumentException("Xsd element of type " + xsdElement.getSchemaType().getQName() + " at line " + xsdElement.getLineNumber() + " does not have any COBOL annotations"); } return (Element) node; }
java
private static Element getCobolXsdAnnotations(XmlSchemaElement xsdElement) { XmlSchemaAnnotation annotation = xsdElement.getAnnotation(); if (annotation == null || annotation.getItems().size() == 0) { throw new IllegalArgumentException("Xsd element of type " + xsdElement.getSchemaType().getQName() + " at line " + xsdElement.getLineNumber() + " does not have COBOL annotations"); } XmlSchemaAppInfo appinfo = (XmlSchemaAppInfo) annotation.getItems() .get(0); if (appinfo.getMarkup() == null) { throw new IllegalArgumentException("Xsd element of type " + xsdElement.getSchemaType().getQName() + " does not have any markup in its annotations"); } Node node = null; boolean found = false; for (int i = 0; i < appinfo.getMarkup().getLength(); i++) { node = appinfo.getMarkup().item(i); if (node instanceof Element && node.getLocalName().equals(CobolMarkup.ELEMENT) && node.getNamespaceURI().equals(CobolMarkup.NS)) { found = true; break; } } if (!found) { throw new IllegalArgumentException("Xsd element of type " + xsdElement.getSchemaType().getQName() + " at line " + xsdElement.getLineNumber() + " does not have any COBOL annotations"); } return (Element) node; }
[ "private", "static", "Element", "getCobolXsdAnnotations", "(", "XmlSchemaElement", "xsdElement", ")", "{", "XmlSchemaAnnotation", "annotation", "=", "xsdElement", ".", "getAnnotation", "(", ")", ";", "if", "(", "annotation", "==", "null", "||", "annotation", ".", ...
XSD elements are annotated with COBOL markup that we extract here. @param xsdElement the XSD element @return the COBOL markup
[ "XSD", "elements", "are", "annotated", "with", "COBOL", "markup", "that", "we", "extract", "here", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cobol/model/CobolAnnotations.java#L28-L62
train
jingwei/krati
krati-main/src/main/java/krati/core/array/entry/EntryValueShortFactory.java
EntryValueShortFactory.reinitValue
@Override public void reinitValue(DataReader in, EntryValueShort value) throws IOException { value.reinit(in.readInt(), /* array position */ in.readShort(), /* data value */ in.readLong() /* SCN value */); }
java
@Override public void reinitValue(DataReader in, EntryValueShort value) throws IOException { value.reinit(in.readInt(), /* array position */ in.readShort(), /* data value */ in.readLong() /* SCN value */); }
[ "@", "Override", "public", "void", "reinitValue", "(", "DataReader", "in", ",", "EntryValueShort", "value", ")", "throws", "IOException", "{", "value", ".", "reinit", "(", "in", ".", "readInt", "(", ")", ",", "/* array position */", "in", ".", "readShort", "...
Read data from stream to populate an EntryValueShort. @param in data reader for EntryValueShort. @param value an EntryValue to populate. @throws IOException
[ "Read", "data", "from", "stream", "to", "populate", "an", "EntryValueShort", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/entry/EntryValueShortFactory.java#L67-L72
train
legsem/legstar-core2
legstar-base/src/main/java/com/legstar/base/type/primitive/CobolDecimalType.java
CobolDecimalType.intPart
private static String intPart(String str) { return str.indexOf(JAVA_DECIMAL_POINT) > 0 ? str.substring(0, str.indexOf(JAVA_DECIMAL_POINT)) : str; }
java
private static String intPart(String str) { return str.indexOf(JAVA_DECIMAL_POINT) > 0 ? str.substring(0, str.indexOf(JAVA_DECIMAL_POINT)) : str; }
[ "private", "static", "String", "intPart", "(", "String", "str", ")", "{", "return", "str", ".", "indexOf", "(", "JAVA_DECIMAL_POINT", ")", ">", "0", "?", "str", ".", "substring", "(", "0", ",", "str", ".", "indexOf", "(", "JAVA_DECIMAL_POINT", ")", ")", ...
Removes the fractional part from a numeric's string representation. @param str the numeric string decimal representation @return the decimal representation without the factional part
[ "Removes", "the", "fractional", "part", "from", "a", "numeric", "s", "string", "representation", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/type/primitive/CobolDecimalType.java#L252-L255
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/SecurityAlertEvent.java
SecurityAlertEvent.addReportingUser
public void addReportingUser(String userId) { addActiveParticipant( userId, null, null, true, null, null); }
java
public void addReportingUser(String userId) { addActiveParticipant( userId, null, null, true, null, null); }
[ "public", "void", "addReportingUser", "(", "String", "userId", ")", "{", "addActiveParticipant", "(", "userId", ",", "null", ",", "null", ",", "true", ",", "null", ",", "null", ")", ";", "}" ]
Add an active participant for the user reporting the security alert @param userId The User ID of the user reporting the failure
[ "Add", "an", "active", "participant", "for", "the", "user", "reporting", "the", "security", "alert" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/SecurityAlertEvent.java#L57-L66
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/SecurityAlertEvent.java
SecurityAlertEvent.addActiveParticipant
public void addActiveParticipant(String userId) { addActiveParticipant( userId, null, null, false, null, null); }
java
public void addActiveParticipant(String userId) { addActiveParticipant( userId, null, null, false, null, null); }
[ "public", "void", "addActiveParticipant", "(", "String", "userId", ")", "{", "addActiveParticipant", "(", "userId", ",", "null", ",", "null", ",", "false", ",", "null", ",", "null", ")", ";", "}" ]
Add an active participant for any participant involved in the alert @param userId The User ID of the participant
[ "Add", "an", "active", "participant", "for", "any", "participant", "involved", "in", "the", "alert" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/SecurityAlertEvent.java#L72-L81
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/SecurityAlertEvent.java
SecurityAlertEvent.addURIParticipantObject
public void addURIParticipantObject(String failedUri, String failureDescription) { List<TypeValuePairType> failureDescriptionValue = new LinkedList<>(); if (!EventUtils.isEmptyOrNull(failureDescription)) { failureDescriptionValue.add(getTypeValuePair("Alert Description", failureDescription.getBytes())); } this.addParticipantObjectIdentification( new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.PatientNumber(), null, null, failureDescriptionValue, failedUri, RFC3881ParticipantObjectTypeCodes.SYSTEM, RFC3881ParticipantObjectTypeRoleCodes.MASTER_FILE, null, null); }
java
public void addURIParticipantObject(String failedUri, String failureDescription) { List<TypeValuePairType> failureDescriptionValue = new LinkedList<>(); if (!EventUtils.isEmptyOrNull(failureDescription)) { failureDescriptionValue.add(getTypeValuePair("Alert Description", failureDescription.getBytes())); } this.addParticipantObjectIdentification( new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.PatientNumber(), null, null, failureDescriptionValue, failedUri, RFC3881ParticipantObjectTypeCodes.SYSTEM, RFC3881ParticipantObjectTypeRoleCodes.MASTER_FILE, null, null); }
[ "public", "void", "addURIParticipantObject", "(", "String", "failedUri", ",", "String", "failureDescription", ")", "{", "List", "<", "TypeValuePairType", ">", "failureDescriptionValue", "=", "new", "LinkedList", "<>", "(", ")", ";", "if", "(", "!", "EventUtils", ...
Adds a Participant Object representing the URI resource that was accessed and generated the Security Alert @param failedUri The URI accessed @param failureDescription A description of why the alert was created
[ "Adds", "a", "Participant", "Object", "representing", "the", "URI", "resource", "that", "was", "accessed", "and", "generated", "the", "Security", "Alert" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/SecurityAlertEvent.java#L90-L106
train
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayFile.java
ArrayFile.initCheck
protected void initCheck() throws IOException { // Check storage version if (_version != STORAGE_VERSION) { throw new IOException("Invalid version in " + _file.getName() + ": " + _version + ", " + STORAGE_VERSION + " expected"); } // Check array file header if(!checkHeader()) { throw new IOException("Invalid header in " + _file.getName() + ": " + getHeader()); } }
java
protected void initCheck() throws IOException { // Check storage version if (_version != STORAGE_VERSION) { throw new IOException("Invalid version in " + _file.getName() + ": " + _version + ", " + STORAGE_VERSION + " expected"); } // Check array file header if(!checkHeader()) { throw new IOException("Invalid header in " + _file.getName() + ": " + getHeader()); } }
[ "protected", "void", "initCheck", "(", ")", "throws", "IOException", "{", "// Check storage version", "if", "(", "_version", "!=", "STORAGE_VERSION", ")", "{", "throw", "new", "IOException", "(", "\"Invalid version in \"", "+", "_file", ".", "getName", "(", ")", ...
Checks the header of this ArrayFile upon initial loading. @throws IOException the header is not valid.
[ "Checks", "the", "header", "of", "this", "ArrayFile", "upon", "initial", "loading", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayFile.java#L155-L166
train
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayFile.java
ArrayFile.load
public void load(MemoryIntArray intArray) throws IOException { if (!_file.exists() || _file.length() == 0) { return; } Chronos c = new Chronos(); DataReader r = IOFactory.createDataReader(_file, _type); try { r.open(); r.position(DATA_START_POSITION); for (int i = 0; i < _arrayLength; i++) { intArray.set(i, r.readInt()); } _log.info(_file.getName() + " loaded in " + c.getElapsedTime()); } finally { r.close(); } }
java
public void load(MemoryIntArray intArray) throws IOException { if (!_file.exists() || _file.length() == 0) { return; } Chronos c = new Chronos(); DataReader r = IOFactory.createDataReader(_file, _type); try { r.open(); r.position(DATA_START_POSITION); for (int i = 0; i < _arrayLength; i++) { intArray.set(i, r.readInt()); } _log.info(_file.getName() + " loaded in " + c.getElapsedTime()); } finally { r.close(); } }
[ "public", "void", "load", "(", "MemoryIntArray", "intArray", ")", "throws", "IOException", "{", "if", "(", "!", "_file", ".", "exists", "(", ")", "||", "_file", ".", "length", "(", ")", "==", "0", ")", "{", "return", ";", "}", "Chronos", "c", "=", ...
Loads this ArrayFile into a memory-based int array. @throws IOException
[ "Loads", "this", "ArrayFile", "into", "a", "memory", "-", "based", "int", "array", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayFile.java#L322-L342
train
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayFile.java
ArrayFile.load
public void load(MemoryLongArray longArray) throws IOException { if (!_file.exists() || _file.length() == 0) { return; } Chronos c = new Chronos(); DataReader r = IOFactory.createDataReader(_file, _type); try { r.open(); r.position(DATA_START_POSITION); for (int i = 0; i < _arrayLength; i++) { longArray.set(i, r.readLong()); } _log.info(_file.getName() + " loaded in " + c.getElapsedTime()); } finally { r.close(); } }
java
public void load(MemoryLongArray longArray) throws IOException { if (!_file.exists() || _file.length() == 0) { return; } Chronos c = new Chronos(); DataReader r = IOFactory.createDataReader(_file, _type); try { r.open(); r.position(DATA_START_POSITION); for (int i = 0; i < _arrayLength; i++) { longArray.set(i, r.readLong()); } _log.info(_file.getName() + " loaded in " + c.getElapsedTime()); } finally { r.close(); } }
[ "public", "void", "load", "(", "MemoryLongArray", "longArray", ")", "throws", "IOException", "{", "if", "(", "!", "_file", ".", "exists", "(", ")", "||", "_file", ".", "length", "(", ")", "==", "0", ")", "{", "return", ";", "}", "Chronos", "c", "=", ...
Loads this ArrayFile into a memory-based long array. @throws IOException
[ "Loads", "this", "ArrayFile", "into", "a", "memory", "-", "based", "long", "array", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayFile.java#L349-L369
train
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayFile.java
ArrayFile.load
public void load(MemoryShortArray shortArray) throws IOException { if (!_file.exists() || _file.length() == 0) { return; } Chronos c = new Chronos(); DataReader r = IOFactory.createDataReader(_file, _type); try { r.open(); r.position(DATA_START_POSITION); for (int i = 0; i < _arrayLength; i++) { shortArray.set(i, r.readShort()); } _log.info(_file.getName() + " loaded in " + c.getElapsedTime()); } finally { r.close(); } }
java
public void load(MemoryShortArray shortArray) throws IOException { if (!_file.exists() || _file.length() == 0) { return; } Chronos c = new Chronos(); DataReader r = IOFactory.createDataReader(_file, _type); try { r.open(); r.position(DATA_START_POSITION); for (int i = 0; i < _arrayLength; i++) { shortArray.set(i, r.readShort()); } _log.info(_file.getName() + " loaded in " + c.getElapsedTime()); } finally { r.close(); } }
[ "public", "void", "load", "(", "MemoryShortArray", "shortArray", ")", "throws", "IOException", "{", "if", "(", "!", "_file", ".", "exists", "(", ")", "||", "_file", ".", "length", "(", ")", "==", "0", ")", "{", "return", ";", "}", "Chronos", "c", "="...
Loads this ArrayFile into a memory-based short array. @throws IOException
[ "Loads", "this", "ArrayFile", "into", "a", "memory", "-", "based", "short", "array", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayFile.java#L376-L396
train