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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ManfredTremmel/gwt-bean-validators | gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/resourceloader/CssResources.java | CssResources.addToHeader | public static void addToHeader(final String scriptname) {
if (!CssResources.isInHeader(scriptname)) {
final LinkElement styleLinkElement = Browser.getDocument().createLinkElement();
styleLinkElement.setRel(CssResources.REL_TYPE);
styleLinkElement.setType(CssResources.SCRIPT_TYPE);
styleLinkElement.setHref(scriptname);
Browser.getDocument().getHead().appendChild(styleLinkElement);
}
} | java | public static void addToHeader(final String scriptname) {
if (!CssResources.isInHeader(scriptname)) {
final LinkElement styleLinkElement = Browser.getDocument().createLinkElement();
styleLinkElement.setRel(CssResources.REL_TYPE);
styleLinkElement.setType(CssResources.SCRIPT_TYPE);
styleLinkElement.setHref(scriptname);
Browser.getDocument().getHead().appendChild(styleLinkElement);
}
} | [
"public",
"static",
"void",
"addToHeader",
"(",
"final",
"String",
"scriptname",
")",
"{",
"if",
"(",
"!",
"CssResources",
".",
"isInHeader",
"(",
"scriptname",
")",
")",
"{",
"final",
"LinkElement",
"styleLinkElement",
"=",
"Browser",
".",
"getDocument",
"(",... | add css script to header.
@param scriptname style sheet file to add to header | [
"add",
"css",
"script",
"to",
"header",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/resourceloader/CssResources.java#L20-L28 | train |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/constraintvalidators/hv/ModCheckBase.java | ModCheckBase.isValid | public boolean isValid(final CharSequence value, final ConstraintValidatorContext context) {
if (value == null) {
return true;
}
final String valueAsString = value.toString();
String digitsAsString;
char checkDigit;
try {
digitsAsString = this.extractVerificationString(valueAsString);
checkDigit = this.extractCheckDigit(valueAsString);
} catch (final IndexOutOfBoundsException e) {
return false;
}
digitsAsString = this.stripNonDigitsIfRequired(digitsAsString);
List<Integer> digits;
try {
digits = this.extractDigits(digitsAsString);
} catch (final NumberFormatException e) {
return false;
}
return this.isCheckDigitValid(digits, checkDigit);
} | java | public boolean isValid(final CharSequence value, final ConstraintValidatorContext context) {
if (value == null) {
return true;
}
final String valueAsString = value.toString();
String digitsAsString;
char checkDigit;
try {
digitsAsString = this.extractVerificationString(valueAsString);
checkDigit = this.extractCheckDigit(valueAsString);
} catch (final IndexOutOfBoundsException e) {
return false;
}
digitsAsString = this.stripNonDigitsIfRequired(digitsAsString);
List<Integer> digits;
try {
digits = this.extractDigits(digitsAsString);
} catch (final NumberFormatException e) {
return false;
}
return this.isCheckDigitValid(digits, checkDigit);
} | [
"public",
"boolean",
"isValid",
"(",
"final",
"CharSequence",
"value",
",",
"final",
"ConstraintValidatorContext",
"context",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"final",
"String",
"valueAsString",
"=",
"value",
... | valid check.
@param value value to check.
@param context constraint validator context
@return true if valid | [
"valid",
"check",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/constraintvalidators/hv/ModCheckBase.java#L63-L87 | train |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/decorators/AbstractDecorator.java | AbstractDecorator.clearErrors | public void clearErrors() {
errorLabel.setText(StringUtils.EMPTY);
errorLabel.getElement().getStyle().setDisplay(Display.NONE);
if (contents.getWidget() != null) {
contents.getWidget().removeStyleName(decoratorStyle.errorInputStyle());
contents.getWidget().removeStyleName(decoratorStyle.validInputStyle());
}
} | java | public void clearErrors() {
errorLabel.setText(StringUtils.EMPTY);
errorLabel.getElement().getStyle().setDisplay(Display.NONE);
if (contents.getWidget() != null) {
contents.getWidget().removeStyleName(decoratorStyle.errorInputStyle());
contents.getWidget().removeStyleName(decoratorStyle.validInputStyle());
}
} | [
"public",
"void",
"clearErrors",
"(",
")",
"{",
"errorLabel",
".",
"setText",
"(",
"StringUtils",
".",
"EMPTY",
")",
";",
"errorLabel",
".",
"getElement",
"(",
")",
".",
"getStyle",
"(",
")",
".",
"setDisplay",
"(",
"Display",
".",
"NONE",
")",
";",
"i... | clear errors. | [
"clear",
"errors",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/decorators/AbstractDecorator.java#L264-L271 | train |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/AbstractValidationMessageResolver.java | AbstractValidationMessageResolver.get | public final String get(final String pkey) {
try {
// Replace "." with "_" in the key to match what ConstantsImplCreator does.
return pkey == null ? null : messages.getString(pkey.replace(".", "_"));
} catch (final MissingResourceException e) {
return null;
}
} | java | public final String get(final String pkey) {
try {
// Replace "." with "_" in the key to match what ConstantsImplCreator does.
return pkey == null ? null : messages.getString(pkey.replace(".", "_"));
} catch (final MissingResourceException e) {
return null;
}
} | [
"public",
"final",
"String",
"get",
"(",
"final",
"String",
"pkey",
")",
"{",
"try",
"{",
"// Replace \".\" with \"_\" in the key to match what ConstantsImplCreator does.",
"return",
"pkey",
"==",
"null",
"?",
"null",
":",
"messages",
".",
"getString",
"(",
"pkey",
... | get localized message for key.
@param pkey key of message
@return localized text for the key | [
"get",
"localized",
"message",
"for",
"key",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/AbstractValidationMessageResolver.java#L37-L44 | train |
neoremind/navi | navi/src/main/java/com/baidu/beidou/navi/util/ExtensionLocator.java | ExtensionLocator.getInstanceList | @SuppressWarnings("unchecked")
public static <T> List<T> getInstanceList(Class<T> type) {
if (type == null) {
throw new IllegalArgumentException("Type should not be empty");
}
List<T> loader = (List<T>) EXTENSION_LOCATOR.get(type);
if (loader == null) {
try {
lock.lock();
List<T> instanceList = new ArrayList<T>();
ServiceLoader<T> serviceLoader = ServiceLoader.load(type);
for (T service : serviceLoader) {
instanceList.add(service);
}
loader = instanceList;
if (EXTENSION_LOCATOR.putIfAbsent(type, instanceList) != instanceList) {
loader = (List<T>) EXTENSION_LOCATOR.get(type);
}
} catch (Exception e) {
LOG.error("Error to load SPI instances from META-INF/services/" + type, e);
} finally {
lock.unlock();
}
}
return loader;
} | java | @SuppressWarnings("unchecked")
public static <T> List<T> getInstanceList(Class<T> type) {
if (type == null) {
throw new IllegalArgumentException("Type should not be empty");
}
List<T> loader = (List<T>) EXTENSION_LOCATOR.get(type);
if (loader == null) {
try {
lock.lock();
List<T> instanceList = new ArrayList<T>();
ServiceLoader<T> serviceLoader = ServiceLoader.load(type);
for (T service : serviceLoader) {
instanceList.add(service);
}
loader = instanceList;
if (EXTENSION_LOCATOR.putIfAbsent(type, instanceList) != instanceList) {
loader = (List<T>) EXTENSION_LOCATOR.get(type);
}
} catch (Exception e) {
LOG.error("Error to load SPI instances from META-INF/services/" + type, e);
} finally {
lock.unlock();
}
}
return loader;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"getInstanceList",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentE... | Get instances dynamically for a class type
@param type
@return | [
"Get",
"instances",
"dynamically",
"for",
"a",
"class",
"type"
] | d37e4b46ef07d124be2740ad3d85d87e939acc84 | https://github.com/neoremind/navi/blob/d37e4b46ef07d124be2740ad3d85d87e939acc84/navi/src/main/java/com/baidu/beidou/navi/util/ExtensionLocator.java#L35-L61 | train |
ddf-project/DDF | core/src/main/java/io/ddf/DDF.java | DDF.initialize | protected void initialize(DDFManager manager, Object data, Class<?>[] typeSpecs, String name, Schema schema)
throws DDFException {
this.validateSchema(schema);
this.setManager(manager); // this must be done first in case later stuff needs a manager
if (typeSpecs != null) {
this.getRepresentationHandler().set(data, typeSpecs);
}
this.getSchemaHandler().setSchema(schema);
if(schema!= null && schema.getTableName() == null) {
String tableName = this.getSchemaHandler().newTableName();
schema.setTableName(tableName);
}
manager.setDDFUUID(this, UUID.randomUUID());
if(!Strings.isNullOrEmpty(name)) manager.setDDFName(this, name);
// Facades
this.ML = new MLFacade(this, this.getMLSupporter());
this.VIEWS = new ViewsFacade(this, this.getViewHandler());
this.Transform = new TransformFacade(this, this.getTransformationHandler());
this.R = new RFacade(this, this.getAggregationHandler());
} | java | protected void initialize(DDFManager manager, Object data, Class<?>[] typeSpecs, String name, Schema schema)
throws DDFException {
this.validateSchema(schema);
this.setManager(manager); // this must be done first in case later stuff needs a manager
if (typeSpecs != null) {
this.getRepresentationHandler().set(data, typeSpecs);
}
this.getSchemaHandler().setSchema(schema);
if(schema!= null && schema.getTableName() == null) {
String tableName = this.getSchemaHandler().newTableName();
schema.setTableName(tableName);
}
manager.setDDFUUID(this, UUID.randomUUID());
if(!Strings.isNullOrEmpty(name)) manager.setDDFName(this, name);
// Facades
this.ML = new MLFacade(this, this.getMLSupporter());
this.VIEWS = new ViewsFacade(this, this.getViewHandler());
this.Transform = new TransformFacade(this, this.getTransformationHandler());
this.R = new RFacade(this, this.getAggregationHandler());
} | [
"protected",
"void",
"initialize",
"(",
"DDFManager",
"manager",
",",
"Object",
"data",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"typeSpecs",
",",
"String",
"name",
",",
"Schema",
"schema",
")",
"throws",
"DDFException",
"{",
"this",
".",
"validateSchema",
"... | Initialization to be done after constructor assignments, such as setting of the all-important DDFManager. | [
"Initialization",
"to",
"be",
"done",
"after",
"constructor",
"assignments",
"such",
"as",
"setting",
"of",
"the",
"all",
"-",
"important",
"DDFManager",
"."
] | e4e68315dcec1ed8b287bf1ee73baa88e7e41eba | https://github.com/ddf-project/DDF/blob/e4e68315dcec1ed8b287bf1ee73baa88e7e41eba/core/src/main/java/io/ddf/DDF.java#L161-L185 | train |
ddf-project/DDF | core/src/main/java/io/ddf/DDF.java | DDF.validateName | private void validateName(String name) throws DDFException {
Boolean isNameExisted;
try {
this.getManager().getDDFByName(name);
isNameExisted = true;
} catch (DDFException e) {
isNameExisted = false;
}
if(isNameExisted) {
throw new DDFException(String.format("DDF with name %s already exists", name));
}
Pattern p = Pattern.compile("^[a-zA-Z0-9_-]*$");
Matcher m = p.matcher(name);
if(!m.find()) {
throw new DDFException(String.format("Invalid name %s, only allow alphanumeric (uppercase and lowercase a-z, " +
"numbers 0-9) and dash (\"-\") and underscore (\"_\")", name));
}
} | java | private void validateName(String name) throws DDFException {
Boolean isNameExisted;
try {
this.getManager().getDDFByName(name);
isNameExisted = true;
} catch (DDFException e) {
isNameExisted = false;
}
if(isNameExisted) {
throw new DDFException(String.format("DDF with name %s already exists", name));
}
Pattern p = Pattern.compile("^[a-zA-Z0-9_-]*$");
Matcher m = p.matcher(name);
if(!m.find()) {
throw new DDFException(String.format("Invalid name %s, only allow alphanumeric (uppercase and lowercase a-z, " +
"numbers 0-9) and dash (\"-\") and underscore (\"_\")", name));
}
} | [
"private",
"void",
"validateName",
"(",
"String",
"name",
")",
"throws",
"DDFException",
"{",
"Boolean",
"isNameExisted",
";",
"try",
"{",
"this",
".",
"getManager",
"(",
")",
".",
"getDDFByName",
"(",
"name",
")",
";",
"isNameExisted",
"=",
"true",
";",
"... | Also only allow alphanumberic and dash "-" and underscore "_" | [
"Also",
"only",
"allow",
"alphanumberic",
"and",
"dash",
"-",
"and",
"underscore",
"_"
] | e4e68315dcec1ed8b287bf1ee73baa88e7e41eba | https://github.com/ddf-project/DDF/blob/e4e68315dcec1ed8b287bf1ee73baa88e7e41eba/core/src/main/java/io/ddf/DDF.java#L241-L259 | train |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/AbstractGwtValidatorFactory.java | AbstractGwtValidatorFactory.init | public final void init(final ConfigurationState configState) {
final ConstraintValidatorFactory configConstraintValidatorFactory =
configState.getConstraintValidatorFactory();
constraintValidatorFactory = configConstraintValidatorFactory == null
? GWT.<ConstraintValidatorFactory>create(ConstraintValidatorFactory.class)
: configConstraintValidatorFactory;
final TraversableResolver configTraversableResolver = configState.getTraversableResolver();
traversableResolver = configTraversableResolver == null ? new DefaultTraversableResolver()
: configTraversableResolver;
final MessageInterpolator configMessageInterpolator = configState.getMessageInterpolator();
messageInterpolator = configMessageInterpolator == null ? new GwtMessageInterpolator()
: configMessageInterpolator;
parameterNameProvider = configState.getParameterNameProvider();
} | java | public final void init(final ConfigurationState configState) {
final ConstraintValidatorFactory configConstraintValidatorFactory =
configState.getConstraintValidatorFactory();
constraintValidatorFactory = configConstraintValidatorFactory == null
? GWT.<ConstraintValidatorFactory>create(ConstraintValidatorFactory.class)
: configConstraintValidatorFactory;
final TraversableResolver configTraversableResolver = configState.getTraversableResolver();
traversableResolver = configTraversableResolver == null ? new DefaultTraversableResolver()
: configTraversableResolver;
final MessageInterpolator configMessageInterpolator = configState.getMessageInterpolator();
messageInterpolator = configMessageInterpolator == null ? new GwtMessageInterpolator()
: configMessageInterpolator;
parameterNameProvider = configState.getParameterNameProvider();
} | [
"public",
"final",
"void",
"init",
"(",
"final",
"ConfigurationState",
"configState",
")",
"{",
"final",
"ConstraintValidatorFactory",
"configConstraintValidatorFactory",
"=",
"configState",
".",
"getConstraintValidatorFactory",
"(",
")",
";",
"constraintValidatorFactory",
... | initialize factory.
@param configState ConfigurationState | [
"initialize",
"factory",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/AbstractGwtValidatorFactory.java#L115-L128 | train |
ManfredTremmel/gwt-bean-validators | gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/helper/ErrorMessageFormater.java | ErrorMessageFormater.messagesToList | public static SafeHtml messagesToList(final Set<String> messages) {
final SafeHtmlBuilder sbList = new SafeHtmlBuilder();
sbList.appendHtmlConstant("<ul>");
for (final String message : messages) {
sbList.appendHtmlConstant("<li>");
sbList.appendEscaped(message);
sbList.appendHtmlConstant("</li>");
}
sbList.appendHtmlConstant("</ul>");
return sbList.toSafeHtml();
} | java | public static SafeHtml messagesToList(final Set<String> messages) {
final SafeHtmlBuilder sbList = new SafeHtmlBuilder();
sbList.appendHtmlConstant("<ul>");
for (final String message : messages) {
sbList.appendHtmlConstant("<li>");
sbList.appendEscaped(message);
sbList.appendHtmlConstant("</li>");
}
sbList.appendHtmlConstant("</ul>");
return sbList.toSafeHtml();
} | [
"public",
"static",
"SafeHtml",
"messagesToList",
"(",
"final",
"Set",
"<",
"String",
">",
"messages",
")",
"{",
"final",
"SafeHtmlBuilder",
"sbList",
"=",
"new",
"SafeHtmlBuilder",
"(",
")",
";",
"sbList",
".",
"appendHtmlConstant",
"(",
"\"<ul>\"",
")",
";",... | build a html list out of given message set.
@param messages set of message strings
@return safe html with massages as list | [
"build",
"a",
"html",
"list",
"out",
"of",
"given",
"message",
"set",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/helper/ErrorMessageFormater.java#L41-L52 | train |
ManfredTremmel/gwt-bean-validators | gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/helper/ErrorMessageFormater.java | ErrorMessageFormater.messagesToString | public static String messagesToString(final Set<String> messages) {
final SafeHtmlBuilder sb = new SafeHtmlBuilder();
for (final String message : messages) {
sb.appendEscaped(message);
sb.appendEscaped("\n");
}
return sb.toSafeHtml().asString();
} | java | public static String messagesToString(final Set<String> messages) {
final SafeHtmlBuilder sb = new SafeHtmlBuilder();
for (final String message : messages) {
sb.appendEscaped(message);
sb.appendEscaped("\n");
}
return sb.toSafeHtml().asString();
} | [
"public",
"static",
"String",
"messagesToString",
"(",
"final",
"Set",
"<",
"String",
">",
"messages",
")",
"{",
"final",
"SafeHtmlBuilder",
"sb",
"=",
"new",
"SafeHtmlBuilder",
"(",
")",
";",
"for",
"(",
"final",
"String",
"message",
":",
"messages",
")",
... | build a linefeed separated String with all messages out of given set.
@param messages set of message strings
@return String with messages | [
"build",
"a",
"linefeed",
"separated",
"String",
"with",
"all",
"messages",
"out",
"of",
"given",
"set",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/helper/ErrorMessageFormater.java#L60-L67 | train |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/java/de/knightsoftnet/validators/rebind/BeanHelper.java | BeanHelper.getAssociationType | public JClassType getAssociationType(final PropertyDescriptor ppropertyDescriptor,
final boolean puseField) {
final JType type = getElementType(ppropertyDescriptor, puseField);
if (type == null) {
return null;
}
final JArrayType jarray = type.isArray();
if (jarray != null) {
return jarray.getComponentType().isClassOrInterface();
}
final JParameterizedType jptype = type.isParameterized();
JClassType[] typeArgs;
if (jptype == null) {
final JRawType jrtype = type.isRawType();
typeArgs = jrtype.getGenericType().getTypeParameters();
} else {
typeArgs = jptype.getTypeArgs();
}
// it is either a Iterable or a Map use the last type arg.
return typeArgs[typeArgs.length - 1].isClassOrInterface();
} | java | public JClassType getAssociationType(final PropertyDescriptor ppropertyDescriptor,
final boolean puseField) {
final JType type = getElementType(ppropertyDescriptor, puseField);
if (type == null) {
return null;
}
final JArrayType jarray = type.isArray();
if (jarray != null) {
return jarray.getComponentType().isClassOrInterface();
}
final JParameterizedType jptype = type.isParameterized();
JClassType[] typeArgs;
if (jptype == null) {
final JRawType jrtype = type.isRawType();
typeArgs = jrtype.getGenericType().getTypeParameters();
} else {
typeArgs = jptype.getTypeArgs();
}
// it is either a Iterable or a Map use the last type arg.
return typeArgs[typeArgs.length - 1].isClassOrInterface();
} | [
"public",
"JClassType",
"getAssociationType",
"(",
"final",
"PropertyDescriptor",
"ppropertyDescriptor",
",",
"final",
"boolean",
"puseField",
")",
"{",
"final",
"JType",
"type",
"=",
"getElementType",
"(",
"ppropertyDescriptor",
",",
"puseField",
")",
";",
"if",
"(... | get association type.
@param ppropertyDescriptor property description
@param puseField use field
@return JClassType | [
"get",
"association",
"type",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/java/de/knightsoftnet/validators/rebind/BeanHelper.java#L63-L83 | train |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/impl/GroupChain.java | GroupChain.checkDefaultGroupSequenceIsExpandable | public void checkDefaultGroupSequenceIsExpandable(final List<Class<?>> defaultGroupSequence)
throws GroupDefinitionException {
for (final Map.Entry<Class<?>, List<Group>> entry : sequenceMap.entrySet()) {
final Class<?> sequence = entry.getKey();
final List<Group> groups = entry.getValue();
final List<Group> defaultGroupList = buildTempGroupList(defaultGroupSequence, sequence);
final int defaultGroupIndex = containsDefaultGroupAtIndex(sequence, groups);
if (defaultGroupIndex != -1) {
ensureDefaultGroupSequenceIsExpandable(groups, defaultGroupList, defaultGroupIndex);
}
}
} | java | public void checkDefaultGroupSequenceIsExpandable(final List<Class<?>> defaultGroupSequence)
throws GroupDefinitionException {
for (final Map.Entry<Class<?>, List<Group>> entry : sequenceMap.entrySet()) {
final Class<?> sequence = entry.getKey();
final List<Group> groups = entry.getValue();
final List<Group> defaultGroupList = buildTempGroupList(defaultGroupSequence, sequence);
final int defaultGroupIndex = containsDefaultGroupAtIndex(sequence, groups);
if (defaultGroupIndex != -1) {
ensureDefaultGroupSequenceIsExpandable(groups, defaultGroupList, defaultGroupIndex);
}
}
} | [
"public",
"void",
"checkDefaultGroupSequenceIsExpandable",
"(",
"final",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"defaultGroupSequence",
")",
"throws",
"GroupDefinitionException",
"{",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"Class",
"<",
"?",
">",
",... | check if default group sequence is expandable.
@param defaultGroupSequence list of group classes
@throws GroupDefinitionException if it's no default group | [
"check",
"if",
"default",
"group",
"sequence",
"is",
"expandable",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/impl/GroupChain.java#L53-L64 | train |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/java/org/hibernate/validator/engine/ConstraintViolationImpl_CustomFieldSerializer.java | ConstraintViolationImpl_CustomFieldSerializer.instantiate | public static ConstraintViolationImpl<Object> instantiate(
final SerializationStreamReader streamReader) throws SerializationException {
final String messageTemplate = null;
final String interpolatedMessage = streamReader.readString();
final Class<Object> rootBeanClass = null;
final Object rootBean = null;
final Object leafBeanInstance = null;
final Object value = null;
final Path propertyPath = (Path) streamReader.readObject();
final ConstraintDescriptor<?> constraintDescriptor = null;
final ElementType elementType = null;
final Map<String, Object> messageParameters = new HashMap<>();
final Map<String, Object> expressionVariables = new HashMap<>();
return (ConstraintViolationImpl<Object>) ConstraintViolationImpl.forBeanValidation(
messageTemplate, messageParameters, expressionVariables, interpolatedMessage, rootBeanClass,
rootBean, leafBeanInstance, value, propertyPath, constraintDescriptor, elementType, null);
} | java | public static ConstraintViolationImpl<Object> instantiate(
final SerializationStreamReader streamReader) throws SerializationException {
final String messageTemplate = null;
final String interpolatedMessage = streamReader.readString();
final Class<Object> rootBeanClass = null;
final Object rootBean = null;
final Object leafBeanInstance = null;
final Object value = null;
final Path propertyPath = (Path) streamReader.readObject();
final ConstraintDescriptor<?> constraintDescriptor = null;
final ElementType elementType = null;
final Map<String, Object> messageParameters = new HashMap<>();
final Map<String, Object> expressionVariables = new HashMap<>();
return (ConstraintViolationImpl<Object>) ConstraintViolationImpl.forBeanValidation(
messageTemplate, messageParameters, expressionVariables, interpolatedMessage, rootBeanClass,
rootBean, leafBeanInstance, value, propertyPath, constraintDescriptor, elementType, null);
} | [
"public",
"static",
"ConstraintViolationImpl",
"<",
"Object",
">",
"instantiate",
"(",
"final",
"SerializationStreamReader",
"streamReader",
")",
"throws",
"SerializationException",
"{",
"final",
"String",
"messageTemplate",
"=",
"null",
";",
"final",
"String",
"interpo... | instantiate a ConstraintViolationImpl.
@param streamReader serialized stream reader to take data from
@return ConstraintViolationImpl
@throws SerializationException if deserialization fails | [
"instantiate",
"a",
"ConstraintViolationImpl",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/java/org/hibernate/validator/engine/ConstraintViolationImpl_CustomFieldSerializer.java#L50-L67 | train |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/java/io/IOUtils.java | IOUtils.checkOffsetAndCount | public static void checkOffsetAndCount(final byte[] buffer, final int byteOffset,
final int byteCount) {
// Ensure we throw a NullPointerException instead of a JavascriptException in case the
// given buffer is null.
if (buffer == null) {
throw new NullPointerException();
}
checkOffsetAndCount(buffer.length, byteOffset, byteCount);
} | java | public static void checkOffsetAndCount(final byte[] buffer, final int byteOffset,
final int byteCount) {
// Ensure we throw a NullPointerException instead of a JavascriptException in case the
// given buffer is null.
if (buffer == null) {
throw new NullPointerException();
}
checkOffsetAndCount(buffer.length, byteOffset, byteCount);
} | [
"public",
"static",
"void",
"checkOffsetAndCount",
"(",
"final",
"byte",
"[",
"]",
"buffer",
",",
"final",
"int",
"byteOffset",
",",
"final",
"int",
"byteCount",
")",
"{",
"// Ensure we throw a NullPointerException instead of a JavascriptException in case the",
"// given bu... | Validates the offset and the byte count for the given array of bytes.
@param buffer Array of bytes to be checked.
@param byteOffset Starting offset in the array.
@param byteCount Total number of bytes to be accessed.
@throws NullPointerException if the given reference to the buffer is null.
@throws IndexOutOfBoundsException if {@code byteOffset} is negative, {@code byteCount} is
negative or their sum exceeds the buffer length. | [
"Validates",
"the",
"offset",
"and",
"the",
"byte",
"count",
"for",
"the",
"given",
"array",
"of",
"bytes",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/java/io/IOUtils.java#L37-L45 | train |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/java/io/IOUtils.java | IOUtils.checkOffsetAndCount | public static void checkOffsetAndCount(final char[] buffer, final int charOffset,
final int charCount) {
// Ensure we throw a NullPointerException instead of a JavascriptException in case the
// given buffer is null.
if (buffer == null) {
throw new NullPointerException();
}
checkOffsetAndCount(buffer.length, charOffset, charCount);
} | java | public static void checkOffsetAndCount(final char[] buffer, final int charOffset,
final int charCount) {
// Ensure we throw a NullPointerException instead of a JavascriptException in case the
// given buffer is null.
if (buffer == null) {
throw new NullPointerException();
}
checkOffsetAndCount(buffer.length, charOffset, charCount);
} | [
"public",
"static",
"void",
"checkOffsetAndCount",
"(",
"final",
"char",
"[",
"]",
"buffer",
",",
"final",
"int",
"charOffset",
",",
"final",
"int",
"charCount",
")",
"{",
"// Ensure we throw a NullPointerException instead of a JavascriptException in case the",
"// given bu... | Validates the offset and the byte count for the given array of characters.
@param buffer Array of characters to be checked.
@param charOffset Starting offset in the array.
@param charCount Total number of characters to be accessed.
@throws NullPointerException if the given reference to the buffer is null.
@throws IndexOutOfBoundsException if {@code charOffset} is negative, {@code charCount} is
negative or their sum exceeds the buffer length. | [
"Validates",
"the",
"offset",
"and",
"the",
"byte",
"count",
"for",
"the",
"given",
"array",
"of",
"characters",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/java/io/IOUtils.java#L57-L65 | train |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/java/io/IOUtils.java | IOUtils.checkOffsetAndCount | private static void checkOffsetAndCount(final int length, final int offset, final int count) {
if (offset < 0 || count < 0 || offset + count > length) {
throw new IndexOutOfBoundsException();
}
} | java | private static void checkOffsetAndCount(final int length, final int offset, final int count) {
if (offset < 0 || count < 0 || offset + count > length) {
throw new IndexOutOfBoundsException();
}
} | [
"private",
"static",
"void",
"checkOffsetAndCount",
"(",
"final",
"int",
"length",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"count",
")",
"{",
"if",
"(",
"offset",
"<",
"0",
"||",
"count",
"<",
"0",
"||",
"offset",
"+",
"count",
">",
"length... | Validates the offset and the byte count for the given array length.
@param length Length of the array to be checked.
@param offset Starting offset in the array.
@param count Total number of elements to be accessed.
@throws IndexOutOfBoundsException if {@code offset} is negative, {@code count} is negative or
their sum exceeds the given {@code length}. | [
"Validates",
"the",
"offset",
"and",
"the",
"byte",
"count",
"for",
"the",
"given",
"array",
"length",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/java/io/IOUtils.java#L76-L80 | train |
ManfredTremmel/gwt-bean-validators | gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/Assert.java | Assert.doesNotContain | public static void doesNotContain(@Nullable final String textToSearch, final String substring,
final Supplier<String> messageSupplier) {
if (StringUtils.hasLength(textToSearch) && StringUtils.hasLength(substring)
&& textToSearch.contains(substring)) {
throw new IllegalArgumentException(Assert.nullSafeGet(messageSupplier));
}
} | java | public static void doesNotContain(@Nullable final String textToSearch, final String substring,
final Supplier<String> messageSupplier) {
if (StringUtils.hasLength(textToSearch) && StringUtils.hasLength(substring)
&& textToSearch.contains(substring)) {
throw new IllegalArgumentException(Assert.nullSafeGet(messageSupplier));
}
} | [
"public",
"static",
"void",
"doesNotContain",
"(",
"@",
"Nullable",
"final",
"String",
"textToSearch",
",",
"final",
"String",
"substring",
",",
"final",
"Supplier",
"<",
"String",
">",
"messageSupplier",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasLength",
"... | Assert that the given text does not contain the given substring.
<pre class="code">
Assert.doesNotContain(name, forbidden, () -> "Name must not contain '" + forbidden + "'");
</pre>
@param textToSearch the text to search
@param substring the substring to find within the text
@param messageSupplier a supplier for the exception message to use if the assertion fails
@throws IllegalArgumentException if the text contains the substring
@since 5.0 | [
"Assert",
"that",
"the",
"given",
"text",
"does",
"not",
"contain",
"the",
"given",
"substring",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwtp-spring-integration/src/main/super/de/knightsoftnet/gwtp/spring/supersource/org/springframework/util/Assert.java#L379-L385 | train |
ManfredTremmel/gwt-bean-validators | gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/SelectBoxWithIconInputWidget.java | SelectBoxWithIconInputWidget.getDefaultResources | protected static Resources getDefaultResources() { // NOPMD it's thread save!
if (SelectBoxWithIconInputWidget.defaultResource == null) {
synchronized (Resources.class) {
if (SelectBoxWithIconInputWidget.defaultResource == null) {
SelectBoxWithIconInputWidget.defaultResource = GWT.create(Resources.class);
}
}
}
return SelectBoxWithIconInputWidget.defaultResource;
} | java | protected static Resources getDefaultResources() { // NOPMD it's thread save!
if (SelectBoxWithIconInputWidget.defaultResource == null) {
synchronized (Resources.class) {
if (SelectBoxWithIconInputWidget.defaultResource == null) {
SelectBoxWithIconInputWidget.defaultResource = GWT.create(Resources.class);
}
}
}
return SelectBoxWithIconInputWidget.defaultResource;
} | [
"protected",
"static",
"Resources",
"getDefaultResources",
"(",
")",
"{",
"// NOPMD it's thread save!",
"if",
"(",
"SelectBoxWithIconInputWidget",
".",
"defaultResource",
"==",
"null",
")",
"{",
"synchronized",
"(",
"Resources",
".",
"class",
")",
"{",
"if",
"(",
... | get default resource, if not set, create one.
@return default resource. | [
"get",
"default",
"resource",
"if",
"not",
"set",
"create",
"one",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/SelectBoxWithIconInputWidget.java#L149-L158 | train |
ManfredTremmel/gwt-bean-validators | gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/SelectBoxWithIconInputWidget.java | SelectBoxWithIconInputWidget.fillEntries | public void fillEntries(final List<IdAndNamePlusIconBean<T>> pentries) {
this.entries.clear();
this.radioButtons.clear();
this.entries.addAll(pentries);
boolean selected = false;
for (final IdAndNamePlusIconBean<T> entry : this.entries) {
final FlowPanel option = new FlowPanel();
option.setStylePrimaryName(this.resource.selectBoxInputStyle().option());
final RadioButton radioButton = new RadioButton();
radioButton.getElement().setId(this.idBase + entry.getId());
radioButton.setFormValue(Objects.toString(entry.getId()));
radioButton.setName(this.idBase);
if (!selected) {
radioButton.setValue(Boolean.TRUE, false);
selected = true;
}
radioButton.addClickHandler(this.clickHandler);
option.add(radioButton);
this.radioButtons.add(radioButton);
final SafeHtmlBuilder labelShb = new SafeHtmlBuilder();
labelShb.appendHtmlConstant("<img src=\"" + SafeHtmlUtils.htmlEscape(entry.getIconUrl())
+ "\" alt=\"" + SafeHtmlUtils.htmlEscape(entry.getName()) + "\" />");
labelShb.appendEscaped(entry.getName());
final InputLabel label = new InputLabel();
label.setFor(radioButton);
label.setHtml(labelShb.toSafeHtml());
option.add(label);
this.options.add(option);
}
} | java | public void fillEntries(final List<IdAndNamePlusIconBean<T>> pentries) {
this.entries.clear();
this.radioButtons.clear();
this.entries.addAll(pentries);
boolean selected = false;
for (final IdAndNamePlusIconBean<T> entry : this.entries) {
final FlowPanel option = new FlowPanel();
option.setStylePrimaryName(this.resource.selectBoxInputStyle().option());
final RadioButton radioButton = new RadioButton();
radioButton.getElement().setId(this.idBase + entry.getId());
radioButton.setFormValue(Objects.toString(entry.getId()));
radioButton.setName(this.idBase);
if (!selected) {
radioButton.setValue(Boolean.TRUE, false);
selected = true;
}
radioButton.addClickHandler(this.clickHandler);
option.add(radioButton);
this.radioButtons.add(radioButton);
final SafeHtmlBuilder labelShb = new SafeHtmlBuilder();
labelShb.appendHtmlConstant("<img src=\"" + SafeHtmlUtils.htmlEscape(entry.getIconUrl())
+ "\" alt=\"" + SafeHtmlUtils.htmlEscape(entry.getName()) + "\" />");
labelShb.appendEscaped(entry.getName());
final InputLabel label = new InputLabel();
label.setFor(radioButton);
label.setHtml(labelShb.toSafeHtml());
option.add(label);
this.options.add(option);
}
} | [
"public",
"void",
"fillEntries",
"(",
"final",
"List",
"<",
"IdAndNamePlusIconBean",
"<",
"T",
">",
">",
"pentries",
")",
"{",
"this",
".",
"entries",
".",
"clear",
"(",
")",
";",
"this",
".",
"radioButtons",
".",
"clear",
"(",
")",
";",
"this",
".",
... | fill entries for the select box.
@param pentries list of entries | [
"fill",
"entries",
"for",
"the",
"select",
"box",
"."
] | cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/SelectBoxWithIconInputWidget.java#L175-L204 | train |
ddf-project/DDF | core/src/main/java/io/ddf/ml/RocMetric.java | RocMetric.addIn | public RocMetric addIn(RocMetric other) {
// Sum tpr, fpr for each threshold
int i = 0;
// start from 1, 0-index is for threshold value
int j = 1;
while (i < this.pred.length) {
if (this.pred[i] != null) {
if (other.pred[i] != null) {
j = 1;
// P = P + P
// N = N + N
while (j < this.pred[i].length) {
this.pred[i][j] = this.pred[i][j] + other.pred[i][j];
j++;
}
}
} else {
if (other.pred[i] != null) {
j = 0;
// P = P + P
// N = N + N
// this.pred[i] is currently null so need to cretae new instance
this.pred[i] = new double[3];
while (j < other.pred[i].length) {
this.pred[i][j] = other.pred[i][j];
j = j + 1;
}
}
}
i = i + 1;
}
return (this);
} | java | public RocMetric addIn(RocMetric other) {
// Sum tpr, fpr for each threshold
int i = 0;
// start from 1, 0-index is for threshold value
int j = 1;
while (i < this.pred.length) {
if (this.pred[i] != null) {
if (other.pred[i] != null) {
j = 1;
// P = P + P
// N = N + N
while (j < this.pred[i].length) {
this.pred[i][j] = this.pred[i][j] + other.pred[i][j];
j++;
}
}
} else {
if (other.pred[i] != null) {
j = 0;
// P = P + P
// N = N + N
// this.pred[i] is currently null so need to cretae new instance
this.pred[i] = new double[3];
while (j < other.pred[i].length) {
this.pred[i][j] = other.pred[i][j];
j = j + 1;
}
}
}
i = i + 1;
}
return (this);
} | [
"public",
"RocMetric",
"addIn",
"(",
"RocMetric",
"other",
")",
"{",
"// Sum tpr, fpr for each threshold",
"int",
"i",
"=",
"0",
";",
"// start from 1, 0-index is for threshold value",
"int",
"j",
"=",
"1",
";",
"while",
"(",
"i",
"<",
"this",
".",
"pred",
".",
... | Sum in-place to avoid new object alloc | [
"Sum",
"in",
"-",
"place",
"to",
"avoid",
"new",
"object",
"alloc"
] | e4e68315dcec1ed8b287bf1ee73baa88e7e41eba | https://github.com/ddf-project/DDF/blob/e4e68315dcec1ed8b287bf1ee73baa88e7e41eba/core/src/main/java/io/ddf/ml/RocMetric.java#L58-L90 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java | GenericIHEAuditEventMessage.addSourceActiveParticipant | public void addSourceActiveParticipant(String userId, String altUserId, String userName, String networkId, boolean isRequestor)
{
addActiveParticipant(
userId,
altUserId,
userName,
isRequestor,
Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Source()),
networkId);
} | java | public void addSourceActiveParticipant(String userId, String altUserId, String userName, String networkId, boolean isRequestor)
{
addActiveParticipant(
userId,
altUserId,
userName,
isRequestor,
Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Source()),
networkId);
} | [
"public",
"void",
"addSourceActiveParticipant",
"(",
"String",
"userId",
",",
"String",
"altUserId",
",",
"String",
"userName",
",",
"String",
"networkId",
",",
"boolean",
"isRequestor",
")",
"{",
"addActiveParticipant",
"(",
"userId",
",",
"altUserId",
",",
"user... | Adds an Active Participant block representing the source participant
@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
@param isRequestor Whether the participant represents the requestor | [
"Adds",
"an",
"Active",
"Participant",
"block",
"representing",
"the",
"source",
"participant"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java#L96-L105 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java | GenericIHEAuditEventMessage.addDestinationActiveParticipant | public void addDestinationActiveParticipant(String userId, String altUserId, String userName, String networkId, boolean isRequestor)
{
addActiveParticipant(
userId,
altUserId,
userName,
isRequestor,
Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Destination()),
networkId);
} | java | public void addDestinationActiveParticipant(String userId, String altUserId, String userName, String networkId, boolean isRequestor)
{
addActiveParticipant(
userId,
altUserId,
userName,
isRequestor,
Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Destination()),
networkId);
} | [
"public",
"void",
"addDestinationActiveParticipant",
"(",
"String",
"userId",
",",
"String",
"altUserId",
",",
"String",
"userName",
",",
"String",
"networkId",
",",
"boolean",
"isRequestor",
")",
"{",
"addActiveParticipant",
"(",
"userId",
",",
"altUserId",
",",
... | Adds an Active Participant block representing the destination participant
@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
@param isRequestor Whether the participant represents the requestor | [
"Adds",
"an",
"Active",
"Participant",
"block",
"representing",
"the",
"destination",
"participant"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java#L115-L124 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java | GenericIHEAuditEventMessage.addSubmissionSetParticipantObject | public void addSubmissionSetParticipantObject(String submissionSetUniqueId)
{
addParticipantObjectIdentification(
new IHETransactionParticipantObjectIDTypeCodes.SubmissionSet(),
null,
null,
null,
submissionSetUniqueId,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.JOB,
null,
null);
} | java | public void addSubmissionSetParticipantObject(String submissionSetUniqueId)
{
addParticipantObjectIdentification(
new IHETransactionParticipantObjectIDTypeCodes.SubmissionSet(),
null,
null,
null,
submissionSetUniqueId,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.JOB,
null,
null);
} | [
"public",
"void",
"addSubmissionSetParticipantObject",
"(",
"String",
"submissionSetUniqueId",
")",
"{",
"addParticipantObjectIdentification",
"(",
"new",
"IHETransactionParticipantObjectIDTypeCodes",
".",
"SubmissionSet",
"(",
")",
",",
"null",
",",
"null",
",",
"null",
... | Adds a Participant Object representing an XDS Submission Set
@param submissionSetUniqueId The Submission Set Unique ID of the Submission Set | [
"Adds",
"a",
"Participant",
"Object",
"representing",
"an",
"XDS",
"Submission",
"Set"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java#L188-L200 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java | GenericIHEAuditEventMessage.addDocumentUriParticipantObject | public void addDocumentUriParticipantObject(String documentRetrieveUri, String documentUniqueId)
{
List<TypeValuePairType> tvp = new LinkedList<>();
if (documentUniqueId != null) {
tvp.add(getTypeValuePair("XDSDocumentEntry.uniqueId", documentUniqueId.getBytes()));
}
addParticipantObjectIdentification(
new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.URI(),
null,
null,
tvp,
documentRetrieveUri,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.REPORT,
null,
null);
} | java | public void addDocumentUriParticipantObject(String documentRetrieveUri, String documentUniqueId)
{
List<TypeValuePairType> tvp = new LinkedList<>();
if (documentUniqueId != null) {
tvp.add(getTypeValuePair("XDSDocumentEntry.uniqueId", documentUniqueId.getBytes()));
}
addParticipantObjectIdentification(
new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.URI(),
null,
null,
tvp,
documentRetrieveUri,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.REPORT,
null,
null);
} | [
"public",
"void",
"addDocumentUriParticipantObject",
"(",
"String",
"documentRetrieveUri",
",",
"String",
"documentUniqueId",
")",
"{",
"List",
"<",
"TypeValuePairType",
">",
"tvp",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"if",
"(",
"documentUniqueId",
"!="... | Adds a Participant Object representing a URI
@param documentRetrieveUri The URI of the Participant Object
@param documentUniqueId The Document Entry Unique ID | [
"Adds",
"a",
"Participant",
"Object",
"representing",
"a",
"URI"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java#L208-L224 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java | GenericIHEAuditEventMessage.addDocumentParticipantObject | public void addDocumentParticipantObject(String documentUniqueId, String repositoryUniqueId, String homeCommunityId)
{
List<TypeValuePairType> tvp = new LinkedList<>();
//SEK - 10/19/2011 - added check for empty or null, RE: Issue Tracker artifact artf2295 (was Issue 135)
if (!EventUtils.isEmptyOrNull(repositoryUniqueId)) {
tvp.add(getTypeValuePair("Repository Unique Id", repositoryUniqueId.getBytes()));
}
if (!EventUtils.isEmptyOrNull(homeCommunityId)) {
tvp.add(getTypeValuePair("ihe:homeCommunityID", homeCommunityId.getBytes()));
}
addParticipantObjectIdentification(
new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(),
null,
null,
tvp,
documentUniqueId,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.REPORT,
null,
null);
} | java | public void addDocumentParticipantObject(String documentUniqueId, String repositoryUniqueId, String homeCommunityId)
{
List<TypeValuePairType> tvp = new LinkedList<>();
//SEK - 10/19/2011 - added check for empty or null, RE: Issue Tracker artifact artf2295 (was Issue 135)
if (!EventUtils.isEmptyOrNull(repositoryUniqueId)) {
tvp.add(getTypeValuePair("Repository Unique Id", repositoryUniqueId.getBytes()));
}
if (!EventUtils.isEmptyOrNull(homeCommunityId)) {
tvp.add(getTypeValuePair("ihe:homeCommunityID", homeCommunityId.getBytes()));
}
addParticipantObjectIdentification(
new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(),
null,
null,
tvp,
documentUniqueId,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.REPORT,
null,
null);
} | [
"public",
"void",
"addDocumentParticipantObject",
"(",
"String",
"documentUniqueId",
",",
"String",
"repositoryUniqueId",
",",
"String",
"homeCommunityId",
")",
"{",
"List",
"<",
"TypeValuePairType",
">",
"tvp",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"//SE... | Adds a Participant Object representing a document for XDS Exports
@param documentUniqueId The Document Entry Unique Id
@param repositoryUniqueId The Repository Unique Id of the Repository housing the document
@param homeCommunityId The Home Community Id | [
"Adds",
"a",
"Participant",
"Object",
"representing",
"a",
"document",
"for",
"XDS",
"Exports"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java#L233-L254 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java | GenericIHEAuditEventMessage.addValueSetParticipantObject | public void addValueSetParticipantObject(String valueSetUniqueId, String valueSetName, String valueSetVersion)
{
if (valueSetName == null){
valueSetName = "";
}
if (valueSetVersion == null){
valueSetVersion = "";
}
List<TypeValuePairType> tvp = new LinkedList<>();
tvp.add(getTypeValuePair("Value Set Version", valueSetVersion.getBytes()));
addParticipantObjectIdentification(
new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(),
valueSetName,
null,
tvp,
valueSetUniqueId,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.REPORT,
null,
null);
} | java | public void addValueSetParticipantObject(String valueSetUniqueId, String valueSetName, String valueSetVersion)
{
if (valueSetName == null){
valueSetName = "";
}
if (valueSetVersion == null){
valueSetVersion = "";
}
List<TypeValuePairType> tvp = new LinkedList<>();
tvp.add(getTypeValuePair("Value Set Version", valueSetVersion.getBytes()));
addParticipantObjectIdentification(
new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(),
valueSetName,
null,
tvp,
valueSetUniqueId,
RFC3881ParticipantObjectTypeCodes.SYSTEM,
RFC3881ParticipantObjectTypeRoleCodes.REPORT,
null,
null);
} | [
"public",
"void",
"addValueSetParticipantObject",
"(",
"String",
"valueSetUniqueId",
",",
"String",
"valueSetName",
",",
"String",
"valueSetVersion",
")",
"{",
"if",
"(",
"valueSetName",
"==",
"null",
")",
"{",
"valueSetName",
"=",
"\"\"",
";",
"}",
"if",
"(",
... | Adds a Participant Object representing a value set for SVS Exports
@param valueSetUniqueId unique id (OID) of the returned value set
@param valueSetName name associated with the unique id (OID) of the returned value set
@param valueSetVersion version of the returned value set | [
"Adds",
"a",
"Participant",
"Object",
"representing",
"a",
"value",
"set",
"for",
"SVS",
"Exports"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java#L262-L282 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java | XCARespondingGatewayAuditor.getAuditor | public static XCARespondingGatewayAuditor getAuditor()
{
AuditorModuleContext ctx = AuditorModuleContext.getContext();
return (XCARespondingGatewayAuditor)ctx.getAuditor(XCARespondingGatewayAuditor.class);
} | java | public static XCARespondingGatewayAuditor getAuditor()
{
AuditorModuleContext ctx = AuditorModuleContext.getContext();
return (XCARespondingGatewayAuditor)ctx.getAuditor(XCARespondingGatewayAuditor.class);
} | [
"public",
"static",
"XCARespondingGatewayAuditor",
"getAuditor",
"(",
")",
"{",
"AuditorModuleContext",
"ctx",
"=",
"AuditorModuleContext",
".",
"getContext",
"(",
")",
";",
"return",
"(",
"XCARespondingGatewayAuditor",
")",
"ctx",
".",
"getAuditor",
"(",
"XCARespondi... | Get an instance of the XCA Responding Gateway Auditor from the
global context
@return XCA Responding Gateway Auditor instance | [
"Get",
"an",
"instance",
"of",
"the",
"XCA",
"Responding",
"Gateway",
"Auditor",
"from",
"the",
"global",
"context"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java#L45-L49 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java | XCARespondingGatewayAuditor.auditCrossGatewayQueryEvent | public void auditCrossGatewayQueryEvent(
RFC3881EventOutcomeCodes eventOutcome,
String initiatingGatewayUserId, String initiatingGatewayUserName, String initiatingGatewayIpAddress,
String respondingGatewayEndpointUri,
String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
auditQueryEvent(false,
new IHETransactionEventTypeCodes.CrossGatewayQuery(), eventOutcome,
getAuditSourceId(), getAuditEnterpriseSiteId(),
initiatingGatewayUserId, null, initiatingGatewayUserName, initiatingGatewayIpAddress,
initiatingGatewayUserName, initiatingGatewayUserName, false,
respondingGatewayEndpointUri, getSystemAltUserId(),
storedQueryUUID, adhocQueryRequestPayload, homeCommunityId,
patientId, purposesOfUse, userRoles);
} | java | public void auditCrossGatewayQueryEvent(
RFC3881EventOutcomeCodes eventOutcome,
String initiatingGatewayUserId, String initiatingGatewayUserName, String initiatingGatewayIpAddress,
String respondingGatewayEndpointUri,
String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
auditQueryEvent(false,
new IHETransactionEventTypeCodes.CrossGatewayQuery(), eventOutcome,
getAuditSourceId(), getAuditEnterpriseSiteId(),
initiatingGatewayUserId, null, initiatingGatewayUserName, initiatingGatewayIpAddress,
initiatingGatewayUserName, initiatingGatewayUserName, false,
respondingGatewayEndpointUri, getSystemAltUserId(),
storedQueryUUID, adhocQueryRequestPayload, homeCommunityId,
patientId, purposesOfUse, userRoles);
} | [
"public",
"void",
"auditCrossGatewayQueryEvent",
"(",
"RFC3881EventOutcomeCodes",
"eventOutcome",
",",
"String",
"initiatingGatewayUserId",
",",
"String",
"initiatingGatewayUserName",
",",
"String",
"initiatingGatewayIpAddress",
",",
"String",
"respondingGatewayEndpointUri",
",",... | Audits an ITI-38 Cross Gateway Query event for XCA Responding Gateway actors.
@param eventOutcome The event outcome indicator
@param initiatingGatewayUserId The Active Participant UserID for the consumer (if using WS-Addressing)
@param initiatingGatewayUserName The Active Participant UserName for the consumer (if using WS-Security / XUA)
@param initiatingGatewayIpAddress The IP Address of the consumer that initiated the transaction
@param respondingGatewayEndpointUri The URI of this registry's endpoint that received the transaction
@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",
"-",
"38",
"Cross",
"Gateway",
"Query",
"event",
"for",
"XCA",
"Responding",
"Gateway",
"actors",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java#L67-L87 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java | XCARespondingGatewayAuditor.auditCrossGatewayRetrieveEvent | public void auditCrossGatewayRetrieveEvent(
RFC3881EventOutcomeCodes eventOutcome,
String initiatingGatewayUserId, String initiatingGatewayIpAddress,
String respondingGatewayEndpointUri,
String initiatingGatewayUserName,
String[] documentUniqueIds, String[] repositoryUniqueIds, String homeCommunityIds[],
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.CrossGatewayRetrieve(), purposesOfUse);
exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
exportEvent.addSourceActiveParticipant(respondingGatewayEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(respondingGatewayEndpointUri, false), false);
if(!EventUtils.isEmptyOrNull(initiatingGatewayUserName)) {
exportEvent.addHumanRequestorActiveParticipant(initiatingGatewayUserName, null, initiatingGatewayUserName, userRoles);
}
exportEvent.addDestinationActiveParticipant(initiatingGatewayUserId, null, null, initiatingGatewayIpAddress, true);
//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 auditCrossGatewayRetrieveEvent(
RFC3881EventOutcomeCodes eventOutcome,
String initiatingGatewayUserId, String initiatingGatewayIpAddress,
String respondingGatewayEndpointUri,
String initiatingGatewayUserName,
String[] documentUniqueIds, String[] repositoryUniqueIds, String homeCommunityIds[],
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.CrossGatewayRetrieve(), purposesOfUse);
exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
exportEvent.addSourceActiveParticipant(respondingGatewayEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(respondingGatewayEndpointUri, false), false);
if(!EventUtils.isEmptyOrNull(initiatingGatewayUserName)) {
exportEvent.addHumanRequestorActiveParticipant(initiatingGatewayUserName, null, initiatingGatewayUserName, userRoles);
}
exportEvent.addDestinationActiveParticipant(initiatingGatewayUserId, null, null, initiatingGatewayIpAddress, true);
//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",
"auditCrossGatewayRetrieveEvent",
"(",
"RFC3881EventOutcomeCodes",
"eventOutcome",
",",
"String",
"initiatingGatewayUserId",
",",
"String",
"initiatingGatewayIpAddress",
",",
"String",
"respondingGatewayEndpointUri",
",",
"String",
"initiatingGatewayUserName",
"... | Audits an ITI-39 Cross Gateway Retrieve event for XCA Responding Gateway actors.
@param eventOutcome The event outcome indicator
@param initiatingGatewayUserId The Active Participant UserID for the document consumer (if using WS-Addressing)
@param initiatingGatewayUserName The Active Participant UserName for the document consumer (if using WS-Security / XUA)
@param initiatingGatewayIpAddress The IP address of the document consumer that initiated the transaction
@param respondingGatewayEndpointUri 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 home community ids 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",
"-",
"39",
"Cross",
"Gateway",
"Retrieve",
"event",
"for",
"XCA",
"Responding",
"Gateway",
"actors",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java#L103-L131 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java | XCARespondingGatewayAuditor.auditRetrieveDocumentSetEvent | public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome,
String repositoryEndpointUri,
String userName,
String[] documentUniqueIds, String[] repositoryUniqueIds, String homeCommunityIds[],
List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
XDSConsumerAuditor.getAuditor().auditRetrieveDocumentSetEvent(eventOutcome, repositoryEndpointUri,
userName,
documentUniqueIds, repositoryUniqueIds, homeCommunityIds, null, purposesOfUse, userRoles);
} | java | public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome,
String repositoryEndpointUri,
String userName,
String[] documentUniqueIds, String[] repositoryUniqueIds, String homeCommunityIds[],
List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
XDSConsumerAuditor.getAuditor().auditRetrieveDocumentSetEvent(eventOutcome, repositoryEndpointUri,
userName,
documentUniqueIds, repositoryUniqueIds, homeCommunityIds, null, purposesOfUse, userRoles);
} | [
"public",
"void",
"auditRetrieveDocumentSetEvent",
"(",
"RFC3881EventOutcomeCodes",
"eventOutcome",
",",
"String",
"repositoryEndpointUri",
",",
"String",
"userName",
",",
"String",
"[",
"]",
"documentUniqueIds",
",",
"String",
"[",
"]",
"repositoryUniqueIds",
",",
"Str... | Audits an ITI-43 Retrieve Document Set event for XCA Responding Gateway actors.
@param eventOutcome The event outcome indicator
@param repositoryEndpointUri The Web service endpoint URI for the document repository
@param repositoryUniqueIds The XDS.b RepositoryUniqueId value for the repository
@param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved
@param homeCommunityIds The list of home community ids 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",
"event",
"for",
"XCA",
"Responding",
"Gateway",
"actors",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java#L144-L156 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java | XCARespondingGatewayAuditor.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;
}
XDSConsumerAuditor.getAuditor().auditRegistryStoredQueryEvent(eventOutcome, registryEndpointUri,
consumerUserName, 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;
}
XDSConsumerAuditor.getAuditor().auditRegistryStoredQueryEvent(eventOutcome, registryEndpointUri,
consumerUserName, 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 XCA Responding Gateway actors.
@param eventOutcome The event outcome indicator
@param registryEndpointUri The endpoint of the registry in this transaction
@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",
"XCA",
"Responding",
"Gateway",
"actors",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCARespondingGatewayAuditor.java#L170-L185 | train |
jingwei/krati | krati-main/src/main/java/krati/core/array/entry/EntryValueInt.java | EntryValueInt.write | @Override
public void write(DataWriter writer) throws IOException {
writer.writeInt(pos); /* array position */
writer.writeInt(val); /* data value */
writer.writeLong(scn); /* SCN value */
} | java | @Override
public void write(DataWriter writer) throws IOException {
writer.writeInt(pos); /* array position */
writer.writeInt(val); /* data value */
writer.writeLong(scn); /* SCN value */
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"DataWriter",
"writer",
")",
"throws",
"IOException",
"{",
"writer",
".",
"writeInt",
"(",
"pos",
")",
";",
"/* array position */",
"writer",
".",
"writeInt",
"(",
"val",
")",
";",
"/* data value */",
"writer",
... | Writes this EntryValue to entry log file via a data writer.
@param writer
@throws IOException | [
"Writes",
"this",
"EntryValue",
"to",
"entry",
"log",
"file",
"via",
"a",
"data",
"writer",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/entry/EntryValueInt.java#L80-L85 | train |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/toolbox/ByteArrayPool.java | ByteArrayPool.getBuf | public synchronized byte[] getBuf(int len) {
for (int i = 0; i < mBuffersBySize.size(); i++) {
byte[] buf = mBuffersBySize.get(i);
if (buf.length >= len) {
mCurrentSize -= buf.length;
mBuffersBySize.remove(i);
mBuffersByLastUse.remove(buf);
return buf;
}
}
return new byte[len];
} | java | public synchronized byte[] getBuf(int len) {
for (int i = 0; i < mBuffersBySize.size(); i++) {
byte[] buf = mBuffersBySize.get(i);
if (buf.length >= len) {
mCurrentSize -= buf.length;
mBuffersBySize.remove(i);
mBuffersByLastUse.remove(buf);
return buf;
}
}
return new byte[len];
} | [
"public",
"synchronized",
"byte",
"[",
"]",
"getBuf",
"(",
"int",
"len",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mBuffersBySize",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"byte",
"[",
"]",
"buf",
"=",
"mBuffersBySize",... | Returns a buffer from the pool if one is available in the requested size, or allocates a new
one if a pooled one is not available.
@param len the minimum size, in bytes, of the requested buffer. The returned buffer may be
larger.
@return a byte[] buffer is always returned. | [
"Returns",
"a",
"buffer",
"from",
"the",
"pool",
"if",
"one",
"is",
"available",
"in",
"the",
"requested",
"size",
"or",
"allocates",
"a",
"new",
"one",
"if",
"a",
"pooled",
"one",
"is",
"not",
"available",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/toolbox/ByteArrayPool.java#L91-L102 | train |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/toolbox/ByteArrayPool.java | ByteArrayPool.returnBuf | public synchronized void returnBuf(byte[] buf) {
if (buf == null || buf.length > mSizeLimit) {
return;
}
mBuffersByLastUse.add(buf);
int pos = Collections.binarySearch(mBuffersBySize, buf, BUF_COMPARATOR);
if (pos < 0) {
pos = -pos - 1;
}
mBuffersBySize.add(pos, buf);
mCurrentSize += buf.length;
trim();
} | java | public synchronized void returnBuf(byte[] buf) {
if (buf == null || buf.length > mSizeLimit) {
return;
}
mBuffersByLastUse.add(buf);
int pos = Collections.binarySearch(mBuffersBySize, buf, BUF_COMPARATOR);
if (pos < 0) {
pos = -pos - 1;
}
mBuffersBySize.add(pos, buf);
mCurrentSize += buf.length;
trim();
} | [
"public",
"synchronized",
"void",
"returnBuf",
"(",
"byte",
"[",
"]",
"buf",
")",
"{",
"if",
"(",
"buf",
"==",
"null",
"||",
"buf",
".",
"length",
">",
"mSizeLimit",
")",
"{",
"return",
";",
"}",
"mBuffersByLastUse",
".",
"add",
"(",
"buf",
")",
";",... | Returns a buffer to the pool, throwing away old buffers if the pool would exceed its allotted
size.
@param buf the buffer to return to the pool. | [
"Returns",
"a",
"buffer",
"to",
"the",
"pool",
"throwing",
"away",
"old",
"buffers",
"if",
"the",
"pool",
"would",
"exceed",
"its",
"allotted",
"size",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/toolbox/ByteArrayPool.java#L110-L122 | train |
jingwei/krati | krati-main/src/main/java/krati/core/segment/SegmentIndexBuffer.java | SegmentIndexBuffer.ensure128BitMD5 | protected byte[] ensure128BitMD5(byte[] digest) {
if(digest.length == MD5_LENGTH) {
return digest;
} else if(digest.length > MD5_LENGTH) {
byte[] b = new byte[MD5_LENGTH];
System.arraycopy(digest, 0, b, 0, MD5_LENGTH);
return b;
} else {
byte[] b = new byte[MD5_LENGTH];
System.arraycopy(digest, 0, b, 0, digest.length);
Arrays.fill(b, digest.length, b.length, (byte)0);
return b;
}
} | java | protected byte[] ensure128BitMD5(byte[] digest) {
if(digest.length == MD5_LENGTH) {
return digest;
} else if(digest.length > MD5_LENGTH) {
byte[] b = new byte[MD5_LENGTH];
System.arraycopy(digest, 0, b, 0, MD5_LENGTH);
return b;
} else {
byte[] b = new byte[MD5_LENGTH];
System.arraycopy(digest, 0, b, 0, digest.length);
Arrays.fill(b, digest.length, b.length, (byte)0);
return b;
}
} | [
"protected",
"byte",
"[",
"]",
"ensure128BitMD5",
"(",
"byte",
"[",
"]",
"digest",
")",
"{",
"if",
"(",
"digest",
".",
"length",
"==",
"MD5_LENGTH",
")",
"{",
"return",
"digest",
";",
"}",
"else",
"if",
"(",
"digest",
".",
"length",
">",
"MD5_LENGTH",
... | Ensure that the specified MD5 digest has 128 bits. | [
"Ensure",
"that",
"the",
"specified",
"MD5",
"digest",
"has",
"128",
"bits",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentIndexBuffer.java#L350-L363 | train |
jingwei/krati | krati-main/src/main/java/krati/core/segment/SegmentIndexBuffer.java | SegmentIndexBuffer.ensureCapacity | protected void ensureCapacity() {
if(_buffer.remaining() < 8) {
ByteBuffer b = ByteBuffer.allocate(_buffer.capacity() << 1);
_buffer.flip();
b.put(_buffer);
_buffer = b;
}
} | java | protected void ensureCapacity() {
if(_buffer.remaining() < 8) {
ByteBuffer b = ByteBuffer.allocate(_buffer.capacity() << 1);
_buffer.flip();
b.put(_buffer);
_buffer = b;
}
} | [
"protected",
"void",
"ensureCapacity",
"(",
")",
"{",
"if",
"(",
"_buffer",
".",
"remaining",
"(",
")",
"<",
"8",
")",
"{",
"ByteBuffer",
"b",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"_buffer",
".",
"capacity",
"(",
")",
"<<",
"1",
")",
";",
"_buffe... | Ensure that the internal backing buffer has enough capacity for a new pair of index and offset. | [
"Ensure",
"that",
"the",
"internal",
"backing",
"buffer",
"has",
"enough",
"capacity",
"for",
"a",
"new",
"pair",
"of",
"index",
"and",
"offset",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentIndexBuffer.java#L368-L375 | train |
jingwei/krati | krati-main/src/retention/java/krati/retention/SimpleRetention.java | SimpleRetention.get | @Override
public Position get(Position pos, List<Event<T>> list) {
EventBatch<T> b;
// Return null if the position is out of retention or in the indexed form.
if(pos.getOffset() < getOrigin() || pos.isIndexed()) {
return null;
}
// Get events from _batch
b = _batch;
if(b.getOrigin() <= pos.getOffset()) {
long newOffset = b.get(pos.getOffset(), list);
Clock clock = pos.getOffset() < newOffset ?
b.getClock(newOffset - 1) : pos.getClock();
return new SimplePosition(getId(), newOffset, clock);
}
// Get events from _lastBatch
b = _lastBatch;
if(b != null && b.getOrigin() <= pos.getOffset()) {
long newOffset = b.get(pos.getOffset(), list);
Clock clock = pos.getOffset() < newOffset ?
b.getClock(newOffset - 1) : pos.getClock();
return new SimplePosition(getId(), newOffset, clock);
}
// Get events from batches in retention
int cnt = 0;
Iterator<EventBatchCursor> iter = _retentionQueue.iterator();
while(iter.hasNext()) {
EventBatchCursor c = iter.next();
if(c.getHeader().getOrigin() <= pos.getOffset()) {
byte[] dat = _store.get(c.getLookup());
try {
b = _eventBatchSerializer.deserialize(dat);
long newOffset = b.get(pos.getOffset(), list);
if(pos.getOffset() < newOffset) {
Clock clock = b.getClock(newOffset - 1);
return new SimplePosition(getId(), newOffset, clock);
}
} catch(Exception e) {
_logger.warn("Ignored EventBatch: " + c.getHeader().getOrigin());
}
} else {
// early stop
if(cnt == 0) {
break;
}
}
cnt++;
}
return null;
} | java | @Override
public Position get(Position pos, List<Event<T>> list) {
EventBatch<T> b;
// Return null if the position is out of retention or in the indexed form.
if(pos.getOffset() < getOrigin() || pos.isIndexed()) {
return null;
}
// Get events from _batch
b = _batch;
if(b.getOrigin() <= pos.getOffset()) {
long newOffset = b.get(pos.getOffset(), list);
Clock clock = pos.getOffset() < newOffset ?
b.getClock(newOffset - 1) : pos.getClock();
return new SimplePosition(getId(), newOffset, clock);
}
// Get events from _lastBatch
b = _lastBatch;
if(b != null && b.getOrigin() <= pos.getOffset()) {
long newOffset = b.get(pos.getOffset(), list);
Clock clock = pos.getOffset() < newOffset ?
b.getClock(newOffset - 1) : pos.getClock();
return new SimplePosition(getId(), newOffset, clock);
}
// Get events from batches in retention
int cnt = 0;
Iterator<EventBatchCursor> iter = _retentionQueue.iterator();
while(iter.hasNext()) {
EventBatchCursor c = iter.next();
if(c.getHeader().getOrigin() <= pos.getOffset()) {
byte[] dat = _store.get(c.getLookup());
try {
b = _eventBatchSerializer.deserialize(dat);
long newOffset = b.get(pos.getOffset(), list);
if(pos.getOffset() < newOffset) {
Clock clock = b.getClock(newOffset - 1);
return new SimplePosition(getId(), newOffset, clock);
}
} catch(Exception e) {
_logger.warn("Ignored EventBatch: " + c.getHeader().getOrigin());
}
} else {
// early stop
if(cnt == 0) {
break;
}
}
cnt++;
}
return null;
} | [
"@",
"Override",
"public",
"Position",
"get",
"(",
"Position",
"pos",
",",
"List",
"<",
"Event",
"<",
"T",
">",
">",
"list",
")",
"{",
"EventBatch",
"<",
"T",
">",
"b",
";",
"// Return null if the position is out of retention or in the indexed form.",
"if",
"(",... | Gets a number of events starting from a given position in the Retention.
The number of events is determined internally by the Retention and it is
up to the batch size.
@param pos - the retention position from where events will be read
@param list - the event list to fill in
@return The next position from where new events will be read from the Retention.
If the <tt>pos</tt> occurs before the origin of the Retention or is in the
indexed form, the value <tt>null</tt> is returned. | [
"Gets",
"a",
"number",
"of",
"events",
"starting",
"from",
"a",
"given",
"position",
"in",
"the",
"Retention",
".",
"The",
"number",
"of",
"events",
"is",
"determined",
"internally",
"by",
"the",
"Retention",
"and",
"it",
"is",
"up",
"to",
"the",
"batch",
... | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/retention/java/krati/retention/SimpleRetention.java#L492-L546 | train |
jingwei/krati | krati-main/src/retention/java/krati/retention/SimpleRetention.java | SimpleRetention.mergeEventsToLastBatch | protected boolean mergeEventsToLastBatch() throws IOException {
// Checks if we can merge _batch into _lastBatch
if(_lastBatch != null && _eventBatchSize >= (_lastBatch.getSize() + _batch.getSize())) {
_batch.setCompletionTime(System.currentTimeMillis());
if(_flushListener != null) {
_flushListener.beforeFlush(_batch);
}
// Creates a copy of the _lastBatch
SimpleEventBatch<T> copy = ((SimpleEventBatch<T>)_lastBatch).clone();
try {
// Add events from _batch to the copy
Iterator<Event<T>> iter = _batch.iterator();
while(iter.hasNext()) {
copy.put(iter.next());
}
copy.setCompletionTime(_batch.getCompletionTime());
/* Flush starts automatically upon adding _batch to BytesDB
* because the constructor sets update batchSize to 1.
*/
byte[] bytes = _eventBatchSerializer.serialize(copy);
_store.set(_lastBatchCursor.getLookup(), bytes, getOffset());
} catch (Exception e) {
_logger.info("events merge aborted", e);
return false;
}
if(_flushListener != null) {
_flushListener.afterFlush(_batch);
}
_batchLock.lock();
try {
// Updated _lastBatch
_lastBatch = copy;
_lastBatchCursor.setHeader(copy.getHeader());
_logger.info(_batch.getSize() + " events merged to EventBatch " + _lastBatchCursor.getLookup());
// Create the next batch
_batch = nextEventBatch(_batch.getOrigin() + _batch.getSize(), _batch.getMaxClock());
} finally {
_batchLock.unlock();
}
return true;
}
return false;
} | java | protected boolean mergeEventsToLastBatch() throws IOException {
// Checks if we can merge _batch into _lastBatch
if(_lastBatch != null && _eventBatchSize >= (_lastBatch.getSize() + _batch.getSize())) {
_batch.setCompletionTime(System.currentTimeMillis());
if(_flushListener != null) {
_flushListener.beforeFlush(_batch);
}
// Creates a copy of the _lastBatch
SimpleEventBatch<T> copy = ((SimpleEventBatch<T>)_lastBatch).clone();
try {
// Add events from _batch to the copy
Iterator<Event<T>> iter = _batch.iterator();
while(iter.hasNext()) {
copy.put(iter.next());
}
copy.setCompletionTime(_batch.getCompletionTime());
/* Flush starts automatically upon adding _batch to BytesDB
* because the constructor sets update batchSize to 1.
*/
byte[] bytes = _eventBatchSerializer.serialize(copy);
_store.set(_lastBatchCursor.getLookup(), bytes, getOffset());
} catch (Exception e) {
_logger.info("events merge aborted", e);
return false;
}
if(_flushListener != null) {
_flushListener.afterFlush(_batch);
}
_batchLock.lock();
try {
// Updated _lastBatch
_lastBatch = copy;
_lastBatchCursor.setHeader(copy.getHeader());
_logger.info(_batch.getSize() + " events merged to EventBatch " + _lastBatchCursor.getLookup());
// Create the next batch
_batch = nextEventBatch(_batch.getOrigin() + _batch.getSize(), _batch.getMaxClock());
} finally {
_batchLock.unlock();
}
return true;
}
return false;
} | [
"protected",
"boolean",
"mergeEventsToLastBatch",
"(",
")",
"throws",
"IOException",
"{",
"// Checks if we can merge _batch into _lastBatch",
"if",
"(",
"_lastBatch",
"!=",
"null",
"&&",
"_eventBatchSize",
">=",
"(",
"_lastBatch",
".",
"getSize",
"(",
")",
"+",
"_batc... | Try to merge events from the current batch to the last persisted batch
in order to reduce the number of smaller batches in the retention.
@return <code>true</code> if the merge operation is performed successfully
@throws IOException | [
"Try",
"to",
"merge",
"events",
"from",
"the",
"current",
"batch",
"to",
"the",
"last",
"persisted",
"batch",
"in",
"order",
"to",
"reduce",
"the",
"number",
"of",
"smaller",
"batches",
"in",
"the",
"retention",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/retention/java/krati/retention/SimpleRetention.java#L700-L751 | train |
jingwei/krati | krati-avro/src/demo/java/krati/store/demo/bus2/AvroStoreBus2HttpServer.java | AvroStoreBus2HttpServer.createPersonSchema | static Schema createPersonSchema() {
List<Field> fields = new ArrayList<Field>();
fields.add(new Field("id", Schema.create(Type.INT), null, null));
fields.add(new Field("age", Schema.create(Type.INT), null, null));
fields.add(new Field("fname", Schema.create(Type.STRING), null, null));
fields.add(new Field("lname", Schema.create(Type.STRING), null, null));
Schema schema = Schema.createRecord("Person", null, "avro.test", false);
schema.setFields(fields);
return schema;
} | java | static Schema createPersonSchema() {
List<Field> fields = new ArrayList<Field>();
fields.add(new Field("id", Schema.create(Type.INT), null, null));
fields.add(new Field("age", Schema.create(Type.INT), null, null));
fields.add(new Field("fname", Schema.create(Type.STRING), null, null));
fields.add(new Field("lname", Schema.create(Type.STRING), null, null));
Schema schema = Schema.createRecord("Person", null, "avro.test", false);
schema.setFields(fields);
return schema;
} | [
"static",
"Schema",
"createPersonSchema",
"(",
")",
"{",
"List",
"<",
"Field",
">",
"fields",
"=",
"new",
"ArrayList",
"<",
"Field",
">",
"(",
")",
";",
"fields",
".",
"add",
"(",
"new",
"Field",
"(",
"\"id\"",
",",
"Schema",
".",
"create",
"(",
"Typ... | Creates the Avro schema for the Person store. | [
"Creates",
"the",
"Avro",
"schema",
"for",
"the",
"Person",
"store",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-avro/src/demo/java/krati/store/demo/bus2/AvroStoreBus2HttpServer.java#L74-L85 | train |
apptik/jus | benchmark/src/perf/java/io/apptik/comm/jus/perf/RoundTripPerf.java | RoundTripPerf.get | @org.openjdk.jmh.annotations.Benchmark
public CountDownLatch get(States.GenericState state) throws Exception {
//JusLog.ResponseLog.on();
//JusLog.MarkerLog.on();
CountDownLatch latch = new CountDownLatch(state.targetBacklog);
if(state.pipeline==Pipeline.JusDef) {
Request<NetworkResponse> request;
for (int i = 0; i < state.targetBacklog; i++) {
request = state.jusRequests.get(i);
request.addResponseListener(new LatchedJusCallback(latch));
state.requestPipeline.addRequest(request);
}
} else if(state.pipeline==Pipeline.VolleyDef){
MockVolleyRequest request;
for (int i = 0; i < state.targetBacklog; i++) {
request = state.volleyRequests.get(i);
request.setListener(new LatchedVolleyCallback(latch));
state.requestPipeline.addRequest(request);
}
}
latch.await();
return latch;
} | java | @org.openjdk.jmh.annotations.Benchmark
public CountDownLatch get(States.GenericState state) throws Exception {
//JusLog.ResponseLog.on();
//JusLog.MarkerLog.on();
CountDownLatch latch = new CountDownLatch(state.targetBacklog);
if(state.pipeline==Pipeline.JusDef) {
Request<NetworkResponse> request;
for (int i = 0; i < state.targetBacklog; i++) {
request = state.jusRequests.get(i);
request.addResponseListener(new LatchedJusCallback(latch));
state.requestPipeline.addRequest(request);
}
} else if(state.pipeline==Pipeline.VolleyDef){
MockVolleyRequest request;
for (int i = 0; i < state.targetBacklog; i++) {
request = state.volleyRequests.get(i);
request.setListener(new LatchedVolleyCallback(latch));
state.requestPipeline.addRequest(request);
}
}
latch.await();
return latch;
} | [
"@",
"org",
".",
"openjdk",
".",
"jmh",
".",
"annotations",
".",
"Benchmark",
"public",
"CountDownLatch",
"get",
"(",
"States",
".",
"GenericState",
"state",
")",
"throws",
"Exception",
"{",
"//JusLog.ResponseLog.on();",
"//JusLog.MarkerLog.on();",
"CountDownLatch",
... | This is a dummy benchmark showing the time it takes for a complete async request-response
round trip, considering no or negligible network latency
@param state
@return
@throws Exception | [
"This",
"is",
"a",
"dummy",
"benchmark",
"showing",
"the",
"time",
"it",
"takes",
"for",
"a",
"complete",
"async",
"request",
"-",
"response",
"round",
"trip",
"considering",
"no",
"or",
"negligible",
"network",
"latency"
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/benchmark/src/perf/java/io/apptik/comm/jus/perf/RoundTripPerf.java#L32-L54 | train |
jingwei/krati | krati-main/src/main/java/krati/io/MultiMappedReader.java | MultiMappedReader.remap | public void remap() throws IOException {
if (_mmapArray == null) {
open();
return;
}
long length = _raf.length();
long mappedLength = getMappedLength();
if (length != mappedLength) {
// Allocate mapped buffer array
int cnt = 0;
long position = 0;
cnt = (int) (length >> BUFFER_BITS);
cnt += (length & BUFFER_MASK) > 0 ? 1 : 0;
MappedByteBuffer[] mmapArray = new MappedByteBuffer[cnt];
int sharedCnt = Math.min(mmapArray.length, _mmapArray.length) - 1;
for (int i = 0; i < sharedCnt; i++) {
mmapArray[i] = _mmapArray[i];
position += BUFFER_SIZE;
}
// Create individual mapped buffers
for (int i = sharedCnt; i < cnt; i++) {
long size = Math.min(length - position, BUFFER_SIZE);
mmapArray[i] = _raf.getChannel().map(FileChannel.MapMode.READ_ONLY, position, size);
position += BUFFER_SIZE;
}
// Rest mapped buffer array
_mmapArray = mmapArray;
// Set current position to 0
_currentPosition = 0;
}
} | java | public void remap() throws IOException {
if (_mmapArray == null) {
open();
return;
}
long length = _raf.length();
long mappedLength = getMappedLength();
if (length != mappedLength) {
// Allocate mapped buffer array
int cnt = 0;
long position = 0;
cnt = (int) (length >> BUFFER_BITS);
cnt += (length & BUFFER_MASK) > 0 ? 1 : 0;
MappedByteBuffer[] mmapArray = new MappedByteBuffer[cnt];
int sharedCnt = Math.min(mmapArray.length, _mmapArray.length) - 1;
for (int i = 0; i < sharedCnt; i++) {
mmapArray[i] = _mmapArray[i];
position += BUFFER_SIZE;
}
// Create individual mapped buffers
for (int i = sharedCnt; i < cnt; i++) {
long size = Math.min(length - position, BUFFER_SIZE);
mmapArray[i] = _raf.getChannel().map(FileChannel.MapMode.READ_ONLY, position, size);
position += BUFFER_SIZE;
}
// Rest mapped buffer array
_mmapArray = mmapArray;
// Set current position to 0
_currentPosition = 0;
}
} | [
"public",
"void",
"remap",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_mmapArray",
"==",
"null",
")",
"{",
"open",
"(",
")",
";",
"return",
";",
"}",
"long",
"length",
"=",
"_raf",
".",
"length",
"(",
")",
";",
"long",
"mappedLength",
"=",
... | Performs re-mapping operation to synchronize with the underling file.
@throws IOException | [
"Performs",
"re",
"-",
"mapping",
"operation",
"to",
"synchronize",
"with",
"the",
"underling",
"file",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/io/MultiMappedReader.java#L185-L222 | train |
jingwei/krati | krati-main/src/main/java/krati/io/MultiMappedReader.java | MultiMappedReader.getMappedLength | public final long getMappedLength() {
MappedByteBuffer[] mmapArray = _mmapArray;
long length = 0;
if (mmapArray != null) {
for (MappedByteBuffer mmap : mmapArray) {
length += mmap.capacity();
}
}
return length;
} | java | public final long getMappedLength() {
MappedByteBuffer[] mmapArray = _mmapArray;
long length = 0;
if (mmapArray != null) {
for (MappedByteBuffer mmap : mmapArray) {
length += mmap.capacity();
}
}
return length;
} | [
"public",
"final",
"long",
"getMappedLength",
"(",
")",
"{",
"MappedByteBuffer",
"[",
"]",
"mmapArray",
"=",
"_mmapArray",
";",
"long",
"length",
"=",
"0",
";",
"if",
"(",
"mmapArray",
"!=",
"null",
")",
"{",
"for",
"(",
"MappedByteBuffer",
"mmap",
":",
... | Gets the total number of bytes of all mapped buffers. | [
"Gets",
"the",
"total",
"number",
"of",
"bytes",
"of",
"all",
"mapped",
"buffers",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/io/MultiMappedReader.java#L227-L238 | train |
apptik/jus | benchmark/src/perf/java/com/android/volley/Response.java | Response.success | public static <T> Response<T> success(T result, Cache.Entry cacheEntry) {
return new Response<T>(result, cacheEntry);
} | java | public static <T> Response<T> success(T result, Cache.Entry cacheEntry) {
return new Response<T>(result, cacheEntry);
} | [
"public",
"static",
"<",
"T",
">",
"Response",
"<",
"T",
">",
"success",
"(",
"T",
"result",
",",
"Cache",
".",
"Entry",
"cacheEntry",
")",
"{",
"return",
"new",
"Response",
"<",
"T",
">",
"(",
"result",
",",
"cacheEntry",
")",
";",
"}"
] | Returns a successful response containing the parsed result. | [
"Returns",
"a",
"successful",
"response",
"containing",
"the",
"parsed",
"result",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/benchmark/src/perf/java/com/android/volley/Response.java#L42-L44 | train |
oehf/ipf-oht-atna | context/src/main/java/org/openhealthtools/ihe/atna/context/AbstractModuleConfig.java | AbstractModuleConfig.setOption | public synchronized void setOption(String key, String value)
{
if (key == null || value == null) {
return;
}
config.put(key, value);
} | java | public synchronized void setOption(String key, String value)
{
if (key == null || value == null) {
return;
}
config.put(key, value);
} | [
"public",
"synchronized",
"void",
"setOption",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
"||",
"value",
"==",
"null",
")",
"{",
"return",
";",
"}",
"config",
".",
"put",
"(",
"key",
",",
"value",
")",
"... | Set a value to the backed properties in this
module config.
@param key The key of the property to set
@param value The value of the property to set | [
"Set",
"a",
"value",
"to",
"the",
"backed",
"properties",
"in",
"this",
"module",
"config",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/context/src/main/java/org/openhealthtools/ihe/atna/context/AbstractModuleConfig.java#L73-L79 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSAuditor.java | XDSAuditor.auditQueryEvent | protected void auditQueryEvent(
boolean systemIsSource, // System Type
IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, // Event
String auditSourceId, String auditSourceEnterpriseSiteId, // Audit Source
String sourceUserId, String sourceAltUserId, String sourceUserName, String sourceNetworkId, // Source Participant
String humanRequestor, // Human Participant
String humanRequestorName, // Human Participant name
boolean humanAfterDestination,
String registryEndpointUri, String registryAltUserId, // Destination Participant
String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, // Payload Object Participant
String patientId, // Patient Object Participant
List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles)
{
QueryEvent queryEvent = new QueryEvent(systemIsSource, eventOutcome, transaction, purposesOfUse);
queryEvent.setAuditSourceId(auditSourceId, auditSourceEnterpriseSiteId);
queryEvent.addSourceActiveParticipant(sourceUserId, sourceAltUserId, sourceUserName, sourceNetworkId, true);
if (humanAfterDestination) {
queryEvent.addDestinationActiveParticipant(registryEndpointUri, registryAltUserId, null, EventUtils.getAddressForUrl(registryEndpointUri, false), false);
}
if(!EventUtils.isEmptyOrNull(humanRequestorName)) {
queryEvent.addHumanRequestorActiveParticipant(humanRequestorName, null, humanRequestorName, userRoles);
}
if (! humanAfterDestination) {
queryEvent.addDestinationActiveParticipant(registryEndpointUri, registryAltUserId, null, EventUtils.getAddressForUrl(registryEndpointUri, false), false);
}
if (!EventUtils.isEmptyOrNull(patientId)) {
queryEvent.addPatientParticipantObject(patientId);
}
byte[] queryRequestPayloadBytes = null;
if (!EventUtils.isEmptyOrNull(adhocQueryRequestPayload)) {
queryRequestPayloadBytes = adhocQueryRequestPayload.getBytes();
}
queryEvent.addQueryParticipantObject(storedQueryUUID, homeCommunityId, queryRequestPayloadBytes, null, transaction);
audit(queryEvent);
} | java | protected void auditQueryEvent(
boolean systemIsSource, // System Type
IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, // Event
String auditSourceId, String auditSourceEnterpriseSiteId, // Audit Source
String sourceUserId, String sourceAltUserId, String sourceUserName, String sourceNetworkId, // Source Participant
String humanRequestor, // Human Participant
String humanRequestorName, // Human Participant name
boolean humanAfterDestination,
String registryEndpointUri, String registryAltUserId, // Destination Participant
String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, // Payload Object Participant
String patientId, // Patient Object Participant
List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles)
{
QueryEvent queryEvent = new QueryEvent(systemIsSource, eventOutcome, transaction, purposesOfUse);
queryEvent.setAuditSourceId(auditSourceId, auditSourceEnterpriseSiteId);
queryEvent.addSourceActiveParticipant(sourceUserId, sourceAltUserId, sourceUserName, sourceNetworkId, true);
if (humanAfterDestination) {
queryEvent.addDestinationActiveParticipant(registryEndpointUri, registryAltUserId, null, EventUtils.getAddressForUrl(registryEndpointUri, false), false);
}
if(!EventUtils.isEmptyOrNull(humanRequestorName)) {
queryEvent.addHumanRequestorActiveParticipant(humanRequestorName, null, humanRequestorName, userRoles);
}
if (! humanAfterDestination) {
queryEvent.addDestinationActiveParticipant(registryEndpointUri, registryAltUserId, null, EventUtils.getAddressForUrl(registryEndpointUri, false), false);
}
if (!EventUtils.isEmptyOrNull(patientId)) {
queryEvent.addPatientParticipantObject(patientId);
}
byte[] queryRequestPayloadBytes = null;
if (!EventUtils.isEmptyOrNull(adhocQueryRequestPayload)) {
queryRequestPayloadBytes = adhocQueryRequestPayload.getBytes();
}
queryEvent.addQueryParticipantObject(storedQueryUUID, homeCommunityId, queryRequestPayloadBytes, null, transaction);
audit(queryEvent);
} | [
"protected",
"void",
"auditQueryEvent",
"(",
"boolean",
"systemIsSource",
",",
"// System Type",
"IHETransactionEventTypeCodes",
"transaction",
",",
"RFC3881EventOutcomeCodes",
"eventOutcome",
",",
"// Event",
"String",
"auditSourceId",
",",
"String",
"auditSourceEnterpriseSite... | Audits a QUERY event for IHE XDS transactions, notably
XDS Registry Query and XDS Registry Stored Query transactions.
@param systemIsSource Whether the system sending the message is the source active participant
@param transaction IHE Transaction sending the message
@param eventOutcome The event outcome indicator
@param auditSourceId The Audit Source Identification
@param auditSourceEnterpriseSiteId The Audit Source Enterprise Site Identification
@param sourceUserId The Source Active Participant User ID (varies by transaction)
@param sourceAltUserId The Source Active Participant Alternate User ID
@param sourceUserName The Source Active Participant UserName
@param sourceNetworkId The Source Active Participant Network ID
@param humanRequestor The Human Requestor Active Participant User ID
@param humanRequestorName The Human Requestor Active Participant name
@param registryEndpointUri The endpoint of the registry actor in this transaction (sets destination active participant user id and network id)
@param registryAltUserId The registry alternate user id (for registry actors)
@param storedQueryUUID The UUID for the stored query (if transaction is Registry 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",
"a",
"QUERY",
"event",
"for",
"IHE",
"XDS",
"transactions",
"notably",
"XDS",
"Registry",
"Query",
"and",
"XDS",
"Registry",
"Stored",
"Query",
"transactions",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSAuditor.java#L55-L95 | train |
apptik/jus | retro-jus/src/main/java/io/apptik/comm/jus/retro/RequestFactoryParser.java | RequestFactoryParser.parsePathParameters | static Set<String> parsePathParameters(String path) {
Matcher m = PARAM_URL_REGEX.matcher(path);
Set<String> patterns = new LinkedHashSet<>();
while (m.find()) {
patterns.add(m.group(1));
}
return patterns;
} | java | static Set<String> parsePathParameters(String path) {
Matcher m = PARAM_URL_REGEX.matcher(path);
Set<String> patterns = new LinkedHashSet<>();
while (m.find()) {
patterns.add(m.group(1));
}
return patterns;
} | [
"static",
"Set",
"<",
"String",
">",
"parsePathParameters",
"(",
"String",
"path",
")",
"{",
"Matcher",
"m",
"=",
"PARAM_URL_REGEX",
".",
"matcher",
"(",
"path",
")",
";",
"Set",
"<",
"String",
">",
"patterns",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")"... | Gets the set of unique path parameters used in the given URI. If a parameter is used twice
in the URI, it will only show up once in the set. | [
"Gets",
"the",
"set",
"of",
"unique",
"path",
"parameters",
"used",
"in",
"the",
"given",
"URI",
".",
"If",
"a",
"parameter",
"is",
"used",
"twice",
"in",
"the",
"URI",
"it",
"will",
"only",
"show",
"up",
"once",
"in",
"the",
"set",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/retro-jus/src/main/java/io/apptik/comm/jus/retro/RequestFactoryParser.java#L441-L448 | train |
apptik/jus | benchmark/src/perf/java/com/android/volley/Request.java | Request.getPostBody | @Deprecated
public byte[] getPostBody() throws AuthFailureError {
// Note: For compatibility with legacy clients of volley, this implementation must remain
// here instead of simply calling the getBody() function because this function must
// call getPostParams() and getPostParamsEncoding() since legacy clients would have
// overridden these two member functions for POST requests.
Map<String, String> postParams = getPostParams();
if (postParams != null && postParams.size() > 0) {
return encodeParameters(postParams, getPostParamsEncoding());
}
return null;
} | java | @Deprecated
public byte[] getPostBody() throws AuthFailureError {
// Note: For compatibility with legacy clients of volley, this implementation must remain
// here instead of simply calling the getBody() function because this function must
// call getPostParams() and getPostParamsEncoding() since legacy clients would have
// overridden these two member functions for POST requests.
Map<String, String> postParams = getPostParams();
if (postParams != null && postParams.size() > 0) {
return encodeParameters(postParams, getPostParamsEncoding());
}
return null;
} | [
"@",
"Deprecated",
"public",
"byte",
"[",
"]",
"getPostBody",
"(",
")",
"throws",
"AuthFailureError",
"{",
"// Note: For compatibility with legacy clients of volley, this implementation must remain",
"// here instead of simply calling the getBody() function because this function must",
"... | Returns the raw POST body to be sent.
@throws AuthFailureError In the event of auth failure
@deprecated Use {@link #getBody()} instead. | [
"Returns",
"the",
"raw",
"POST",
"body",
"to",
"be",
"sent",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/benchmark/src/perf/java/com/android/volley/Request.java#L350-L361 | train |
apptik/jus | benchmark/src/perf/java/com/android/volley/Request.java | Request.getBody | public byte[] getBody() throws AuthFailureError {
Map<String, String> params = getParams();
if (params != null && params.size() > 0) {
return encodeParameters(params, getParamsEncoding());
}
return null;
} | java | public byte[] getBody() throws AuthFailureError {
Map<String, String> params = getParams();
if (params != null && params.size() > 0) {
return encodeParameters(params, getParamsEncoding());
}
return null;
} | [
"public",
"byte",
"[",
"]",
"getBody",
"(",
")",
"throws",
"AuthFailureError",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"getParams",
"(",
")",
";",
"if",
"(",
"params",
"!=",
"null",
"&&",
"params",
".",
"size",
"(",
")",
">",
... | Returns the raw POST or PUT body to be sent.
<p>By default, the body consists of the request parameters in
application/x-www-form-urlencoded format. When overriding this method, consider overriding
{@link #getBodyContentType()} as well to match the new body format.
@throws AuthFailureError in the event of auth failure | [
"Returns",
"the",
"raw",
"POST",
"or",
"PUT",
"body",
"to",
"be",
"sent",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/benchmark/src/perf/java/com/android/volley/Request.java#L407-L413 | train |
jingwei/krati | krati-main/src/examples/java/krati/examples/LargeStore.java | LargeStore.createDataStore | protected DataStore<byte[], byte[]> createDataStore(File homeDir, int initialCapacity) throws Exception {
StoreConfig config = new StoreConfig(homeDir, initialCapacity);
config.setBatchSize(10000);
config.setNumSyncBatches(100);
// Configure store segments
config.setSegmentFactory(new WriteBufferSegmentFactory());
config.setSegmentFileSizeMB(128);
config.setSegmentCompactFactor(0.67);
// Configure index segments
config.setInt(StoreParams.PARAM_INDEX_SEGMENT_FILE_SIZE_MB, 32);
config.setDouble(StoreParams.PARAM_INDEX_SEGMENT_COMPACT_FACTOR, 0.5);
// Configure index initial capacity
int indexInitialCapacity = initialCapacity / 8;
config.setInt(StoreParams.PARAM_INDEX_INITIAL_CAPACITY, indexInitialCapacity);
// Configure to reduce memory footprint
config.setDataHandler(new HashIndexDataHandler());
// Disable linear hashing
config.setHashLoadFactor(1.0);
return StoreFactory.createIndexedDataStore(config);
} | java | protected DataStore<byte[], byte[]> createDataStore(File homeDir, int initialCapacity) throws Exception {
StoreConfig config = new StoreConfig(homeDir, initialCapacity);
config.setBatchSize(10000);
config.setNumSyncBatches(100);
// Configure store segments
config.setSegmentFactory(new WriteBufferSegmentFactory());
config.setSegmentFileSizeMB(128);
config.setSegmentCompactFactor(0.67);
// Configure index segments
config.setInt(StoreParams.PARAM_INDEX_SEGMENT_FILE_SIZE_MB, 32);
config.setDouble(StoreParams.PARAM_INDEX_SEGMENT_COMPACT_FACTOR, 0.5);
// Configure index initial capacity
int indexInitialCapacity = initialCapacity / 8;
config.setInt(StoreParams.PARAM_INDEX_INITIAL_CAPACITY, indexInitialCapacity);
// Configure to reduce memory footprint
config.setDataHandler(new HashIndexDataHandler());
// Disable linear hashing
config.setHashLoadFactor(1.0);
return StoreFactory.createIndexedDataStore(config);
} | [
"protected",
"DataStore",
"<",
"byte",
"[",
"]",
",",
"byte",
"[",
"]",
">",
"createDataStore",
"(",
"File",
"homeDir",
",",
"int",
"initialCapacity",
")",
"throws",
"Exception",
"{",
"StoreConfig",
"config",
"=",
"new",
"StoreConfig",
"(",
"homeDir",
",",
... | Creates a DataStore instance. | [
"Creates",
"a",
"DataStore",
"instance",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/examples/java/krati/examples/LargeStore.java#L74-L100 | train |
jingwei/krati | krati-main/src/examples/java/krati/examples/LargeStore.java | LargeStore.populate | public void populate() throws Exception {
for (int i = 0; i < _initialCapacity; i++) {
String str = "key." + i;
byte[] key = str.getBytes();
byte[] value = createDataForKey(str);
_store.put(key, value);
}
_store.sync();
} | java | public void populate() throws Exception {
for (int i = 0; i < _initialCapacity; i++) {
String str = "key." + i;
byte[] key = str.getBytes();
byte[] value = createDataForKey(str);
_store.put(key, value);
}
_store.sync();
} | [
"public",
"void",
"populate",
"(",
")",
"throws",
"Exception",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_initialCapacity",
";",
"i",
"++",
")",
"{",
"String",
"str",
"=",
"\"key.\"",
"+",
"i",
";",
"byte",
"[",
"]",
"key",
"=",
"str... | Populates the underlying data store.
@throws Exception | [
"Populates",
"the",
"underlying",
"data",
"store",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/examples/java/krati/examples/LargeStore.java#L115-L123 | train |
jingwei/krati | krati-main/src/examples/java/krati/examples/LargeStore.java | LargeStore.doRandomReads | public void doRandomReads(int readCnt) {
Random rand = new Random();
for (int i = 0; i < readCnt; i++) {
int keyId = rand.nextInt(_initialCapacity);
String str = "key." + keyId;
byte[] key = str.getBytes();
byte[] value = _store.get(key);
System.out.printf("Key=%s\tValue=%s%n", str, new String(value));
}
} | java | public void doRandomReads(int readCnt) {
Random rand = new Random();
for (int i = 0; i < readCnt; i++) {
int keyId = rand.nextInt(_initialCapacity);
String str = "key." + keyId;
byte[] key = str.getBytes();
byte[] value = _store.get(key);
System.out.printf("Key=%s\tValue=%s%n", str, new String(value));
}
} | [
"public",
"void",
"doRandomReads",
"(",
"int",
"readCnt",
")",
"{",
"Random",
"rand",
"=",
"new",
"Random",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"readCnt",
";",
"i",
"++",
")",
"{",
"int",
"keyId",
"=",
"rand",
".",
"... | Perform a number of random reads from the underlying data store.
@param readCnt the number of reads | [
"Perform",
"a",
"number",
"of",
"random",
"reads",
"from",
"the",
"underlying",
"data",
"store",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/examples/java/krati/examples/LargeStore.java#L130-L139 | train |
rpatil26/webutilities | src/main/java/com/googlecode/webutilities/servlets/JSCSSMergeServlet.java | JSCSSMergeServlet.init | @Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
this.expiresMinutes = readLong(config.getInitParameter(INIT_PARAM_EXPIRES_MINUTES), this.expiresMinutes);
this.cacheControl = config.getInitParameter(INIT_PARAM_CACHE_CONTROL) != null ? config.getInitParameter(INIT_PARAM_CACHE_CONTROL) : this.cacheControl;
this.autoCorrectUrlsInCSS = readBoolean(config.getInitParameter(INIT_PARAM_AUTO_CORRECT_URLS_IN_CSS), this.autoCorrectUrlsInCSS);
this.turnOffETag = readBoolean(config.getInitParameter(INIT_PARAM_TURN_OFF_E_TAG), this.turnOffETag);
this.turnOffUrlFingerPrinting = readBoolean(config.getInitParameter(INIT_PARAM_TURN_OFF_URL_FINGERPRINTING), this.turnOffUrlFingerPrinting);
this.customContextPathForCSSUrls = config.getInitParameter(INIT_PARAM_CUSTOM_CONTEXT_PATH_FOR_CSS_URLS);
this.overrideExistingHeaders = readBoolean(config.getInitParameter(INIT_PARAM_OVERRIDE_EXISTING_HEADERS), this.overrideExistingHeaders);
LOGGER.debug("Servlet initialized: {\n\t{}:{},\n\t{}:{},\n\t{}:{},\n\t{}:{}\n\t{}:{}\n:{}\n}",
INIT_PARAM_EXPIRES_MINUTES, String.valueOf(this.expiresMinutes),
INIT_PARAM_CACHE_CONTROL, this.cacheControl,
INIT_PARAM_AUTO_CORRECT_URLS_IN_CSS, String.valueOf(this.autoCorrectUrlsInCSS),
INIT_PARAM_TURN_OFF_E_TAG, String.valueOf(this.turnOffETag),
INIT_PARAM_TURN_OFF_URL_FINGERPRINTING, String.valueOf(this.turnOffUrlFingerPrinting),
INIT_PARAM_OVERRIDE_EXISTING_HEADERS, String.valueOf(this.overrideExistingHeaders)
);
} | java | @Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
this.expiresMinutes = readLong(config.getInitParameter(INIT_PARAM_EXPIRES_MINUTES), this.expiresMinutes);
this.cacheControl = config.getInitParameter(INIT_PARAM_CACHE_CONTROL) != null ? config.getInitParameter(INIT_PARAM_CACHE_CONTROL) : this.cacheControl;
this.autoCorrectUrlsInCSS = readBoolean(config.getInitParameter(INIT_PARAM_AUTO_CORRECT_URLS_IN_CSS), this.autoCorrectUrlsInCSS);
this.turnOffETag = readBoolean(config.getInitParameter(INIT_PARAM_TURN_OFF_E_TAG), this.turnOffETag);
this.turnOffUrlFingerPrinting = readBoolean(config.getInitParameter(INIT_PARAM_TURN_OFF_URL_FINGERPRINTING), this.turnOffUrlFingerPrinting);
this.customContextPathForCSSUrls = config.getInitParameter(INIT_PARAM_CUSTOM_CONTEXT_PATH_FOR_CSS_URLS);
this.overrideExistingHeaders = readBoolean(config.getInitParameter(INIT_PARAM_OVERRIDE_EXISTING_HEADERS), this.overrideExistingHeaders);
LOGGER.debug("Servlet initialized: {\n\t{}:{},\n\t{}:{},\n\t{}:{},\n\t{}:{}\n\t{}:{}\n:{}\n}",
INIT_PARAM_EXPIRES_MINUTES, String.valueOf(this.expiresMinutes),
INIT_PARAM_CACHE_CONTROL, this.cacheControl,
INIT_PARAM_AUTO_CORRECT_URLS_IN_CSS, String.valueOf(this.autoCorrectUrlsInCSS),
INIT_PARAM_TURN_OFF_E_TAG, String.valueOf(this.turnOffETag),
INIT_PARAM_TURN_OFF_URL_FINGERPRINTING, String.valueOf(this.turnOffUrlFingerPrinting),
INIT_PARAM_OVERRIDE_EXISTING_HEADERS, String.valueOf(this.overrideExistingHeaders)
);
} | [
"@",
"Override",
"public",
"void",
"init",
"(",
"ServletConfig",
"config",
")",
"throws",
"ServletException",
"{",
"super",
".",
"init",
"(",
"config",
")",
";",
"this",
".",
"expiresMinutes",
"=",
"readLong",
"(",
"config",
".",
"getInitParameter",
"(",
"IN... | default enabled fingerprinting | [
"default",
"enabled",
"fingerprinting"
] | fdd04f59923cd0f2d80540b861aa0268da99f5c7 | https://github.com/rpatil26/webutilities/blob/fdd04f59923cd0f2d80540b861aa0268da99f5c7/src/main/java/com/googlecode/webutilities/servlets/JSCSSMergeServlet.java#L171-L189 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java | ApplicationActivityEvent.addApplicationParticipant | public void addApplicationParticipant(String userId, String altUserId, String userName, String networkId)
{
addActiveParticipant(
userId,
altUserId,
userName,
false,
Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Application()),
networkId);
} | java | public void addApplicationParticipant(String userId, String altUserId, String userName, String networkId)
{
addActiveParticipant(
userId,
altUserId,
userName,
false,
Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.Application()),
networkId);
} | [
"public",
"void",
"addApplicationParticipant",
"(",
"String",
"userId",
",",
"String",
"altUserId",
",",
"String",
"userName",
",",
"String",
"networkId",
")",
"{",
"addActiveParticipant",
"(",
"userId",
",",
"altUserId",
",",
"userName",
",",
"false",
",",
"Col... | Add an Application Active Participant to this message
@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",
"Application",
"Active",
"Participant",
"to",
"this",
"message"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java#L54-L63 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java | ApplicationActivityEvent.addApplicationStarterParticipant | public void addApplicationStarterParticipant(String userId, String altUserId, String userName, String networkId)
{
addActiveParticipant(
userId,
altUserId,
userName,
true,
Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.ApplicationLauncher()),
networkId);
} | java | public void addApplicationStarterParticipant(String userId, String altUserId, String userName, String networkId)
{
addActiveParticipant(
userId,
altUserId,
userName,
true,
Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.ApplicationLauncher()),
networkId);
} | [
"public",
"void",
"addApplicationStarterParticipant",
"(",
"String",
"userId",
",",
"String",
"altUserId",
",",
"String",
"userName",
",",
"String",
"networkId",
")",
"{",
"addActiveParticipant",
"(",
"userId",
",",
"altUserId",
",",
"userName",
",",
"true",
",",
... | Add an Application Starter Active Participant to this message
@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",
"Application",
"Starter",
"Active",
"Participant",
"to",
"this",
"message"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java#L73-L82 | train |
apptik/jus | benchmark/src/perf/java/com/android/volley/toolbox/DiskBasedCache.java | DiskBasedCache.invalidate | @Override
public synchronized void invalidate(String key, boolean fullExpire) {
Entry entry = get(key);
if (entry != null) {
entry.softTtl = 0;
if (fullExpire) {
entry.ttl = 0;
}
put(key, entry);
}
} | java | @Override
public synchronized void invalidate(String key, boolean fullExpire) {
Entry entry = get(key);
if (entry != null) {
entry.softTtl = 0;
if (fullExpire) {
entry.ttl = 0;
}
put(key, entry);
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"invalidate",
"(",
"String",
"key",
",",
"boolean",
"fullExpire",
")",
"{",
"Entry",
"entry",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"entry",
".",
"softTtl",
"=",... | Invalidates an entry in the cache.
@param key Cache key
@param fullExpire True to fully expire the entry, false to soft expire | [
"Invalidates",
"an",
"entry",
"in",
"the",
"cache",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/benchmark/src/perf/java/com/android/volley/toolbox/DiskBasedCache.java#L181-L192 | train |
apptik/jus | benchmark/src/perf/java/com/android/volley/toolbox/DiskBasedCache.java | DiskBasedCache.getFilenameForKey | private String getFilenameForKey(String key) {
int firstHalfLength = key.length() / 2;
String localFilename = String.valueOf(key.substring(0, firstHalfLength).hashCode());
localFilename += String.valueOf(key.substring(firstHalfLength).hashCode());
return localFilename;
} | java | private String getFilenameForKey(String key) {
int firstHalfLength = key.length() / 2;
String localFilename = String.valueOf(key.substring(0, firstHalfLength).hashCode());
localFilename += String.valueOf(key.substring(firstHalfLength).hashCode());
return localFilename;
} | [
"private",
"String",
"getFilenameForKey",
"(",
"String",
"key",
")",
"{",
"int",
"firstHalfLength",
"=",
"key",
".",
"length",
"(",
")",
"/",
"2",
";",
"String",
"localFilename",
"=",
"String",
".",
"valueOf",
"(",
"key",
".",
"substring",
"(",
"0",
",",... | Creates a pseudo-unique filename for the specified cache key.
@param key The key to generate a file name for.
@return A pseudo-unique filename. | [
"Creates",
"a",
"pseudo",
"-",
"unique",
"filename",
"for",
"the",
"specified",
"cache",
"key",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/benchmark/src/perf/java/com/android/volley/toolbox/DiskBasedCache.java#L240-L245 | train |
apptik/jus | benchmark/src/perf/java/com/android/volley/toolbox/DiskBasedCache.java | DiskBasedCache.removeEntry | private void removeEntry(String key) {
CacheHeader entry = mEntries.get(key);
if (entry != null) {
mTotalSize -= entry.size;
mEntries.remove(key);
}
} | java | private void removeEntry(String key) {
CacheHeader entry = mEntries.get(key);
if (entry != null) {
mTotalSize -= entry.size;
mEntries.remove(key);
}
} | [
"private",
"void",
"removeEntry",
"(",
"String",
"key",
")",
"{",
"CacheHeader",
"entry",
"=",
"mEntries",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"mTotalSize",
"-=",
"entry",
".",
"size",
";",
"mEntries",
".",
"... | Removes the entry identified by 'key' from the cache. | [
"Removes",
"the",
"entry",
"identified",
"by",
"key",
"from",
"the",
"cache",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/benchmark/src/perf/java/com/android/volley/toolbox/DiskBasedCache.java#L313-L319 | train |
jingwei/krati | krati-main/src/main/java/krati/core/segment/SegmentMeta.java | SegmentMeta.wrap | public synchronized void wrap(List<Segment> segments) throws IOException {
int newWorkingGeneration = (_workingGeneration + 1) % Integer.MAX_VALUE;
int newWorkingSectionOffset = (_workingSectionOffset + _bytesPerSection) % _bytesPerSegment;
int cnt = segments.size();
int pos = _segmentDataStart + newWorkingSectionOffset;
// Ensure buffer capacity
ensureCapacity(cnt);
int newLiveSegmentCount = 0;
for (int index = 0; index < cnt; index++) {
if (segments.get(index) != null)
newLiveSegmentCount++;
}
// Update compact-section
for (int index = 0; index < cnt; index++) {
Segment seg = segments.get(index);
if (seg != null) {
if (seg.getLoadSize() > 0) {
// Segment populated with data
writeInt(pos, LIVE_SEGMENT);
writeInt(pos + 4, seg.getLoadSize());
} else {
// Segment initialized without any data
writeInt(pos, FREE_SEGMENT);
writeInt(pos + 4, 0);
// Treat it as a non-live segment
newLiveSegmentCount--;
}
} else {
// Segment not alive
writeInt(pos, FREE_SEGMENT);
writeInt(pos + 4, 0);
}
pos += _bytesPerSegment;
}
_mmapBuffer.force();
writeInt(newWorkingSectionOffset, newWorkingGeneration);
writeInt(newWorkingSectionOffset + 4, newLiveSegmentCount);
_mmapBuffer.force();
// Switch working section to the new one
_liveSegmentCount = newLiveSegmentCount;
_workingGeneration = newWorkingGeneration;
_workingSectionOffset = newWorkingSectionOffset;
_log.info(_metaFile.getCanonicalPath() + " updated");
_log.info("workingGeneration=" + _workingGeneration + " liveSegmentCount=" + _liveSegmentCount);
} | java | public synchronized void wrap(List<Segment> segments) throws IOException {
int newWorkingGeneration = (_workingGeneration + 1) % Integer.MAX_VALUE;
int newWorkingSectionOffset = (_workingSectionOffset + _bytesPerSection) % _bytesPerSegment;
int cnt = segments.size();
int pos = _segmentDataStart + newWorkingSectionOffset;
// Ensure buffer capacity
ensureCapacity(cnt);
int newLiveSegmentCount = 0;
for (int index = 0; index < cnt; index++) {
if (segments.get(index) != null)
newLiveSegmentCount++;
}
// Update compact-section
for (int index = 0; index < cnt; index++) {
Segment seg = segments.get(index);
if (seg != null) {
if (seg.getLoadSize() > 0) {
// Segment populated with data
writeInt(pos, LIVE_SEGMENT);
writeInt(pos + 4, seg.getLoadSize());
} else {
// Segment initialized without any data
writeInt(pos, FREE_SEGMENT);
writeInt(pos + 4, 0);
// Treat it as a non-live segment
newLiveSegmentCount--;
}
} else {
// Segment not alive
writeInt(pos, FREE_SEGMENT);
writeInt(pos + 4, 0);
}
pos += _bytesPerSegment;
}
_mmapBuffer.force();
writeInt(newWorkingSectionOffset, newWorkingGeneration);
writeInt(newWorkingSectionOffset + 4, newLiveSegmentCount);
_mmapBuffer.force();
// Switch working section to the new one
_liveSegmentCount = newLiveSegmentCount;
_workingGeneration = newWorkingGeneration;
_workingSectionOffset = newWorkingSectionOffset;
_log.info(_metaFile.getCanonicalPath() + " updated");
_log.info("workingGeneration=" + _workingGeneration + " liveSegmentCount=" + _liveSegmentCount);
} | [
"public",
"synchronized",
"void",
"wrap",
"(",
"List",
"<",
"Segment",
">",
"segments",
")",
"throws",
"IOException",
"{",
"int",
"newWorkingGeneration",
"=",
"(",
"_workingGeneration",
"+",
"1",
")",
"%",
"Integer",
".",
"MAX_VALUE",
";",
"int",
"newWorkingSe... | Wrap a list of segments and persist meta data into the .meta file.
@param segments - the segments managed by a {@linkplain SegmentManager}
@throws IOException | [
"Wrap",
"a",
"list",
"of",
"segments",
"and",
"persist",
"meta",
"data",
"into",
"the",
".",
"meta",
"file",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentMeta.java#L190-L241 | train |
oehf/ipf-oht-atna | util/src/main/java/org/openhealthtools/ihe/utils/XMLUtils.java | XMLUtils.createDomDocument | public static Document createDomDocument() throws Exception
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.newDocument();
} | java | public static Document createDomDocument() throws Exception
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.newDocument();
} | [
"public",
"static",
"Document",
"createDomDocument",
"(",
")",
"throws",
"Exception",
"{",
"DocumentBuilderFactory",
"factory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"factory",
".",
"setNamespaceAware",
"(",
"true",
")",
";",
"DocumentBui... | Simple method to create an empty well-formed DOM Document
@return Empty, well-formed DOM Document
@throws Exception | [
"Simple",
"method",
"to",
"create",
"an",
"empty",
"well",
"-",
"formed",
"DOM",
"Document"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/util/src/main/java/org/openhealthtools/ihe/utils/XMLUtils.java#L37-L44 | train |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/http/FormEncodingBuilder.java | FormEncodingBuilder.add | public FormEncodingBuilder add(String name, String value) {
if (content.size() > 0) {
content.writeByte('&');
}
HttpUrl.canonicalize(content, name, 0, name.length(),
HttpUrl.FORM_ENCODE_SET, false, false, true, true);
content.writeByte('=');
HttpUrl.canonicalize(content, value, 0, value.length(),
HttpUrl.FORM_ENCODE_SET, false, false, true, true);
return this;
} | java | public FormEncodingBuilder add(String name, String value) {
if (content.size() > 0) {
content.writeByte('&');
}
HttpUrl.canonicalize(content, name, 0, name.length(),
HttpUrl.FORM_ENCODE_SET, false, false, true, true);
content.writeByte('=');
HttpUrl.canonicalize(content, value, 0, value.length(),
HttpUrl.FORM_ENCODE_SET, false, false, true, true);
return this;
} | [
"public",
"FormEncodingBuilder",
"add",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"content",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"content",
".",
"writeByte",
"(",
"'",
"'",
")",
";",
"}",
"HttpUrl",
".",
"canonicalize... | Add new key-value pair. | [
"Add",
"new",
"key",
"-",
"value",
"pair",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/http/FormEncodingBuilder.java#L62-L72 | train |
legsem/legstar-core2 | legstar-base/src/main/java/com/legstar/base/utils/NamespaceUtils.java | NamespaceUtils.toPackageName | public static String toPackageName(String nsUri) {
if (nsUri == null || nsUri.length() == 0) {
return null;
}
// remove scheme and :, if present
// spec only requires us to remove 'http' and 'urn'...
int idx = nsUri.indexOf(':');
String scheme = "";
if (idx >= 0) {
scheme = nsUri.substring(0, idx);
if (scheme.equalsIgnoreCase("http")
|| scheme.equalsIgnoreCase("urn"))
nsUri = nsUri.substring(idx + 1);
}
// tokenize string
List < String > tokens = tokenize(nsUri, "/: ");
if (tokens.size() == 0) {
return null;
}
// remove trailing file type, if necessary
if (tokens.size() > 1) {
// for uri's like "www.foo.com" and "foo.com", there is no trailing
// file, so there's no need to look at the last '.' and substring
// otherwise, we loose the "com" (which would be wrong)
String lastToken = tokens.get(tokens.size() - 1);
idx = lastToken.lastIndexOf('.');
if (idx > 0) {
lastToken = lastToken.substring(0, idx);
tokens.set(tokens.size() - 1, lastToken);
}
}
// tokenize domain name and reverse. Also remove :port if it exists
String domain = tokens.get(0);
idx = domain.indexOf(':');
if (idx >= 0)
domain = domain.substring(0, idx);
ArrayList < String > r = reverse(tokenize(domain,
scheme.equals("urn") ? ".-" : "."));
if (r.get(r.size() - 1).equalsIgnoreCase("www")) {
// remove leading www
r.remove(r.size() - 1);
}
// replace the domain name with tokenized items
tokens.addAll(1, r);
tokens.remove(0);
// iterate through the tokens and apply xml->java name algorithm
for (int i = 0; i < tokens.size(); i++) {
// get the token and remove illegal chars
String token = tokens.get(i);
token = removeIllegalIdentifierChars(token);
// this will check for reserved keywords
if (keywords.contains(token.toLowerCase())) {
token = '_' + token;
}
tokens.set(i, token.toLowerCase());
}
// concat all the pieces and return it
return combine(tokens, '.');
} | java | public static String toPackageName(String nsUri) {
if (nsUri == null || nsUri.length() == 0) {
return null;
}
// remove scheme and :, if present
// spec only requires us to remove 'http' and 'urn'...
int idx = nsUri.indexOf(':');
String scheme = "";
if (idx >= 0) {
scheme = nsUri.substring(0, idx);
if (scheme.equalsIgnoreCase("http")
|| scheme.equalsIgnoreCase("urn"))
nsUri = nsUri.substring(idx + 1);
}
// tokenize string
List < String > tokens = tokenize(nsUri, "/: ");
if (tokens.size() == 0) {
return null;
}
// remove trailing file type, if necessary
if (tokens.size() > 1) {
// for uri's like "www.foo.com" and "foo.com", there is no trailing
// file, so there's no need to look at the last '.' and substring
// otherwise, we loose the "com" (which would be wrong)
String lastToken = tokens.get(tokens.size() - 1);
idx = lastToken.lastIndexOf('.');
if (idx > 0) {
lastToken = lastToken.substring(0, idx);
tokens.set(tokens.size() - 1, lastToken);
}
}
// tokenize domain name and reverse. Also remove :port if it exists
String domain = tokens.get(0);
idx = domain.indexOf(':');
if (idx >= 0)
domain = domain.substring(0, idx);
ArrayList < String > r = reverse(tokenize(domain,
scheme.equals("urn") ? ".-" : "."));
if (r.get(r.size() - 1).equalsIgnoreCase("www")) {
// remove leading www
r.remove(r.size() - 1);
}
// replace the domain name with tokenized items
tokens.addAll(1, r);
tokens.remove(0);
// iterate through the tokens and apply xml->java name algorithm
for (int i = 0; i < tokens.size(); i++) {
// get the token and remove illegal chars
String token = tokens.get(i);
token = removeIllegalIdentifierChars(token);
// this will check for reserved keywords
if (keywords.contains(token.toLowerCase())) {
token = '_' + token;
}
tokens.set(i, token.toLowerCase());
}
// concat all the pieces and return it
return combine(tokens, '.');
} | [
"public",
"static",
"String",
"toPackageName",
"(",
"String",
"nsUri",
")",
"{",
"if",
"(",
"nsUri",
"==",
"null",
"||",
"nsUri",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"// remove scheme and :, if present",
"// spec only re... | Create a java package name out of an XML namespace.
@param nsUri the namespace URI
@return null if unable to derive a package name | [
"Create",
"a",
"java",
"package",
"name",
"out",
"of",
"an",
"XML",
"namespace",
"."
] | f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6 | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/utils/NamespaceUtils.java#L45-L114 | train |
legsem/legstar-core2 | legstar-base/src/main/java/com/legstar/base/utils/NamespaceUtils.java | NamespaceUtils.toNamespace | public static String toNamespace(String packageName) {
if (packageName == null || packageName.length() == 0) {
return null;
}
List < String > tokens = reverse(tokenize(packageName, "."));
StringBuilder buf = new StringBuilder("http://");
for (int i = 1; i < tokens.size(); i++) {
buf.append(tokens.get(i));
buf.append(".");
}
if (buf.charAt(buf.length() - 1) == '.') {
buf.deleteCharAt(buf.length() - 1);
buf.append("/");
}
buf.append(tokens.get(0));
return buf.toString();
} | java | public static String toNamespace(String packageName) {
if (packageName == null || packageName.length() == 0) {
return null;
}
List < String > tokens = reverse(tokenize(packageName, "."));
StringBuilder buf = new StringBuilder("http://");
for (int i = 1; i < tokens.size(); i++) {
buf.append(tokens.get(i));
buf.append(".");
}
if (buf.charAt(buf.length() - 1) == '.') {
buf.deleteCharAt(buf.length() - 1);
buf.append("/");
}
buf.append(tokens.get(0));
return buf.toString();
} | [
"public",
"static",
"String",
"toNamespace",
"(",
"String",
"packageName",
")",
"{",
"if",
"(",
"packageName",
"==",
"null",
"||",
"packageName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<",
"String",
">",
"tok... | Create an XML namespace out of a java package name.
@param packageName
@return null if unable to derive a namespace | [
"Create",
"an",
"XML",
"namespace",
"out",
"of",
"a",
"java",
"package",
"name",
"."
] | f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6 | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/utils/NamespaceUtils.java#L122-L141 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCAInitiatingGatewayAuditor.java | XCAInitiatingGatewayAuditor.getAuditor | public static XCAInitiatingGatewayAuditor getAuditor()
{
AuditorModuleContext ctx = AuditorModuleContext.getContext();
return (XCAInitiatingGatewayAuditor)ctx.getAuditor(XCAInitiatingGatewayAuditor.class);
} | java | public static XCAInitiatingGatewayAuditor getAuditor()
{
AuditorModuleContext ctx = AuditorModuleContext.getContext();
return (XCAInitiatingGatewayAuditor)ctx.getAuditor(XCAInitiatingGatewayAuditor.class);
} | [
"public",
"static",
"XCAInitiatingGatewayAuditor",
"getAuditor",
"(",
")",
"{",
"AuditorModuleContext",
"ctx",
"=",
"AuditorModuleContext",
".",
"getContext",
"(",
")",
";",
"return",
"(",
"XCAInitiatingGatewayAuditor",
")",
"ctx",
".",
"getAuditor",
"(",
"XCAInitiati... | Get an instance of the XCA Initiating Gateway from the
global context
@return XCA Initiating Gateway Auditor instance | [
"Get",
"an",
"instance",
"of",
"the",
"XCA",
"Initiating",
"Gateway",
"from",
"the",
"global",
"context"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCAInitiatingGatewayAuditor.java#L45-L49 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCAInitiatingGatewayAuditor.java | XCAInitiatingGatewayAuditor.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;
}
XDSRepositoryAuditor.getAuditor().auditRetrieveDocumentSetEvent(eventOutcome, consumerUserId,
consumerUserName, consumerIpAddress, repositoryEndpointUri,
documentUniqueIds, repositoryUniqueIds, homeCommunityIds, purposesOfUse, userRoles);
} | 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;
}
XDSRepositoryAuditor.getAuditor().auditRetrieveDocumentSetEvent(eventOutcome, consumerUserId,
consumerUserName, consumerIpAddress, repositoryEndpointUri,
documentUniqueIds, repositoryUniqueIds, homeCommunityIds, 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 XCA Initiating Gateway actors. Audits as a XDS Document Registry.
@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",
"XCA",
"Initiating",
"Gateway",
"actors",
".",
"Audits",
"as",
"a",
"XDS",
"Document",
"Registry",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCAInitiatingGatewayAuditor.java#L135-L148 | train |
jingwei/krati | krati-main/src/retention/java/krati/retention/AbstractRetentionStoreReader.java | AbstractRetentionStoreReader.get | public Position get(Position pos, Map<K, Event<V>> map) {
ArrayList<Event<K>> list = new ArrayList<Event<K>>(1000);
Position nextPos = get(pos, list);
for(Event<K> evt : list) {
K key = evt.getValue();
if(key != null) {
try {
V value = get(key);
map.put(key, new SimpleEvent<V>(value, evt.getClock()));
} catch(Exception e) {
logger.warn(e.getMessage());
}
}
}
return nextPos;
} | java | public Position get(Position pos, Map<K, Event<V>> map) {
ArrayList<Event<K>> list = new ArrayList<Event<K>>(1000);
Position nextPos = get(pos, list);
for(Event<K> evt : list) {
K key = evt.getValue();
if(key != null) {
try {
V value = get(key);
map.put(key, new SimpleEvent<V>(value, evt.getClock()));
} catch(Exception e) {
logger.warn(e.getMessage());
}
}
}
return nextPos;
} | [
"public",
"Position",
"get",
"(",
"Position",
"pos",
",",
"Map",
"<",
"K",
",",
"Event",
"<",
"V",
">",
">",
"map",
")",
"{",
"ArrayList",
"<",
"Event",
"<",
"K",
">>",
"list",
"=",
"new",
"ArrayList",
"<",
"Event",
"<",
"K",
">",
">",
"(",
"10... | Gets a number of value events starting from a give position in the Retention.
The number of events is determined internally by the Retention and it is
up to the batch size.
@param pos - the retention position from where events will be read
@param map - the result map (keys to value events) to fill in
@return the next position from where new events will be read. | [
"Gets",
"a",
"number",
"of",
"value",
"events",
"starting",
"from",
"a",
"give",
"position",
"in",
"the",
"Retention",
".",
"The",
"number",
"of",
"events",
"is",
"determined",
"internally",
"by",
"the",
"Retention",
"and",
"it",
"is",
"up",
"to",
"the",
... | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/retention/java/krati/retention/AbstractRetentionStoreReader.java#L44-L61 | train |
legsem/legstar-core2 | legstar-base/src/main/java/com/legstar/base/type/primitive/CobolPrimitiveType.java | CobolPrimitiveType.isValid | public boolean isValid(CobolContext cobolContext, byte[] hostData, int start) {
return isValid(javaClass, cobolContext, hostData, start);
} | java | public boolean isValid(CobolContext cobolContext, byte[] hostData, int start) {
return isValid(javaClass, cobolContext, hostData, start);
} | [
"public",
"boolean",
"isValid",
"(",
"CobolContext",
"cobolContext",
",",
"byte",
"[",
"]",
"hostData",
",",
"int",
"start",
")",
"{",
"return",
"isValid",
"(",
"javaClass",
",",
"cobolContext",
",",
"hostData",
",",
"start",
")",
";",
"}"
] | Check if a byte array contains valid mainframe data for this type
characteristics.
@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 type | [
"Check",
"if",
"a",
"byte",
"array",
"contains",
"valid",
"mainframe",
"data",
"for",
"this",
"type",
"characteristics",
"."
] | f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6 | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/type/primitive/CobolPrimitiveType.java#L54-L56 | train |
legsem/legstar-core2 | legstar-base/src/main/java/com/legstar/base/type/primitive/CobolPrimitiveType.java | CobolPrimitiveType.fromHost | public FromHostPrimitiveResult < T > fromHost(CobolContext cobolContext,
byte[] hostData, int start) {
return fromHost(javaClass, cobolContext, hostData, start);
} | java | public FromHostPrimitiveResult < T > fromHost(CobolContext cobolContext,
byte[] hostData, int start) {
return fromHost(javaClass, cobolContext, hostData, start);
} | [
"public",
"FromHostPrimitiveResult",
"<",
"T",
">",
"fromHost",
"(",
"CobolContext",
"cobolContext",
",",
"byte",
"[",
"]",
"hostData",
",",
"int",
"start",
")",
"{",
"return",
"fromHost",
"(",
"javaClass",
",",
"cobolContext",
",",
"hostData",
",",
"start",
... | Convert mainframe data into a Java object.
@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 the mainframe value as a java object | [
"Convert",
"mainframe",
"data",
"into",
"a",
"Java",
"object",
"."
] | f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6 | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/type/primitive/CobolPrimitiveType.java#L79-L82 | train |
legsem/legstar-core2 | legstar-base/src/main/java/com/legstar/base/type/primitive/FromHostPrimitiveResult.java | FromHostPrimitiveResult.formatMessage | protected static String formatMessage(String message, byte[] hostData,
int start, int curPos, int bytesLen) {
StringBuilder sb = new StringBuilder();
sb.append(message);
if (hostData != null && hostData.length > 0 && curPos < hostData.length
&& curPos >= start && bytesLen > 0
&& start + bytesLen <= hostData.length) {
sb.append(". Error at offset ");
sb.append(curPos);
sb.append(" : [0x");
int spyStart = Math.max(start - SPYBUF_MAX_LEN, 0);
appendData(sb, hostData, spyStart, start - spyStart);
sb.append(start > spyStart ? "->" : "");
if (curPos > start) {
appendData(sb, hostData, start, curPos - start);
sb.append("^");
appendData(sb, hostData, curPos, bytesLen + start - curPos);
} else {
appendData(sb, hostData, start, bytesLen);
}
int spyStop = Math.min(start + bytesLen + SPYBUF_MAX_LEN,
hostData.length);
sb.append(spyStop > start + bytesLen ? "<-" : "");
appendData(sb, hostData, start + bytesLen, spyStop - start
- bytesLen);
sb.append("]");
} else {
sb.append(". Position is ");
sb.append(curPos);
}
return sb.toString();
} | java | protected static String formatMessage(String message, byte[] hostData,
int start, int curPos, int bytesLen) {
StringBuilder sb = new StringBuilder();
sb.append(message);
if (hostData != null && hostData.length > 0 && curPos < hostData.length
&& curPos >= start && bytesLen > 0
&& start + bytesLen <= hostData.length) {
sb.append(". Error at offset ");
sb.append(curPos);
sb.append(" : [0x");
int spyStart = Math.max(start - SPYBUF_MAX_LEN, 0);
appendData(sb, hostData, spyStart, start - spyStart);
sb.append(start > spyStart ? "->" : "");
if (curPos > start) {
appendData(sb, hostData, start, curPos - start);
sb.append("^");
appendData(sb, hostData, curPos, bytesLen + start - curPos);
} else {
appendData(sb, hostData, start, bytesLen);
}
int spyStop = Math.min(start + bytesLen + SPYBUF_MAX_LEN,
hostData.length);
sb.append(spyStop > start + bytesLen ? "<-" : "");
appendData(sb, hostData, start + bytesLen, spyStop - start
- bytesLen);
sb.append("]");
} else {
sb.append(". Position is ");
sb.append(curPos);
}
return sb.toString();
} | [
"protected",
"static",
"String",
"formatMessage",
"(",
"String",
"message",
",",
"byte",
"[",
"]",
"hostData",
",",
"int",
"start",
",",
"int",
"curPos",
",",
"int",
"bytesLen",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
... | Format the data to make it easy to locate the error in the incoming byte
stream.
@param message the text part of the message (explains the error)
@param hostData the incoming host data stream
@param start the starting position of the primitive type value in the
byte stream
@param curPos the position of the error itself (might be within the type
value)
@param bytesLen the size of the primitive type
@return a formatted message | [
"Format",
"the",
"data",
"to",
"make",
"it",
"easy",
"to",
"locate",
"the",
"error",
"in",
"the",
"incoming",
"byte",
"stream",
"."
] | f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6 | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/type/primitive/FromHostPrimitiveResult.java#L66-L99 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java | AuditorFactory.getAuditor | public static IHEAuditor getAuditor(Class<? extends IHEAuditor> clazz, AuditorModuleConfig configToUse, AuditorModuleContext contextToUse)
{
IHEAuditor auditor = AuditorFactory.getAuditorForClass(clazz);
if (auditor != null) {
auditor.setConfig(configToUse);
auditor.setContext(contextToUse);
}
return auditor;
} | java | public static IHEAuditor getAuditor(Class<? extends IHEAuditor> clazz, AuditorModuleConfig configToUse, AuditorModuleContext contextToUse)
{
IHEAuditor auditor = AuditorFactory.getAuditorForClass(clazz);
if (auditor != null) {
auditor.setConfig(configToUse);
auditor.setContext(contextToUse);
}
return auditor;
} | [
"public",
"static",
"IHEAuditor",
"getAuditor",
"(",
"Class",
"<",
"?",
"extends",
"IHEAuditor",
">",
"clazz",
",",
"AuditorModuleConfig",
"configToUse",
",",
"AuditorModuleContext",
"contextToUse",
")",
"{",
"IHEAuditor",
"auditor",
"=",
"AuditorFactory",
".",
"get... | Get an auditor instance for the specified auditor class,
auditor configuration, and auditor context.
@param clazz Class to instantiate
@param configToUse Auditor configuration to use
@param contextToUse Auditor context to use
@return Instance of an IHE Auditor | [
"Get",
"an",
"auditor",
"instance",
"for",
"the",
"specified",
"auditor",
"class",
"auditor",
"configuration",
"and",
"auditor",
"context",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java#L42-L52 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java | AuditorFactory.getAuditor | public static IHEAuditor getAuditor(Class<? extends IHEAuditor> clazz, AuditorModuleConfig config, boolean useGlobalContext)
{
AuditorModuleContext context;
if (!useGlobalContext) {
context = (AuditorModuleContext)ContextInitializer.initialize(config);
} else {
context = AuditorModuleContext.getContext();
}
return getAuditor(clazz, config, context);
} | java | public static IHEAuditor getAuditor(Class<? extends IHEAuditor> clazz, AuditorModuleConfig config, boolean useGlobalContext)
{
AuditorModuleContext context;
if (!useGlobalContext) {
context = (AuditorModuleContext)ContextInitializer.initialize(config);
} else {
context = AuditorModuleContext.getContext();
}
return getAuditor(clazz, config, context);
} | [
"public",
"static",
"IHEAuditor",
"getAuditor",
"(",
"Class",
"<",
"?",
"extends",
"IHEAuditor",
">",
"clazz",
",",
"AuditorModuleConfig",
"config",
",",
"boolean",
"useGlobalContext",
")",
"{",
"AuditorModuleContext",
"context",
";",
"if",
"(",
"!",
"useGlobalCon... | Get an auditor instance for the specified auditor class, module configuration. Auditor
will use a standalone context if a non-global context is requested.
@param clazz Class to instantiate
@param config Auditor configuration to use
@param useGlobalContext Whether to use the global (true) or standalone (false) context
@return Instance of an IHE Auditor | [
"Get",
"an",
"auditor",
"instance",
"for",
"the",
"specified",
"auditor",
"class",
"module",
"configuration",
".",
"Auditor",
"will",
"use",
"a",
"standalone",
"context",
"if",
"a",
"non",
"-",
"global",
"context",
"is",
"requested",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java#L63-L73 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java | AuditorFactory.getAuditor | public static IHEAuditor getAuditor(String className, AuditorModuleConfig config, AuditorModuleContext context)
{
Class<? extends IHEAuditor> clazz = AuditorFactory.getAuditorClassForClassName(className);
return getAuditor(clazz, config, context);
} | java | public static IHEAuditor getAuditor(String className, AuditorModuleConfig config, AuditorModuleContext context)
{
Class<? extends IHEAuditor> clazz = AuditorFactory.getAuditorClassForClassName(className);
return getAuditor(clazz, config, context);
} | [
"public",
"static",
"IHEAuditor",
"getAuditor",
"(",
"String",
"className",
",",
"AuditorModuleConfig",
"config",
",",
"AuditorModuleContext",
"context",
")",
"{",
"Class",
"<",
"?",
"extends",
"IHEAuditor",
">",
"clazz",
"=",
"AuditorFactory",
".",
"getAuditorClass... | Get an auditor instance for the specified auditor class name,
auditor configuration, and auditor context.
@param className Class name of the auditor class to instantiate
@param config Auditor configuration to use
@param context Auditor context to use
@return Instance of an IHE Auditor | [
"Get",
"an",
"auditor",
"instance",
"for",
"the",
"specified",
"auditor",
"class",
"name",
"auditor",
"configuration",
"and",
"auditor",
"context",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java#L106-L110 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java | AuditorFactory.getAuditor | public static IHEAuditor getAuditor(String className, AuditorModuleConfig config, boolean useGlobalContext)
{
Class<? extends IHEAuditor> clazz = AuditorFactory.getAuditorClassForClassName(className);
return getAuditor(clazz, config, useGlobalContext);
} | java | public static IHEAuditor getAuditor(String className, AuditorModuleConfig config, boolean useGlobalContext)
{
Class<? extends IHEAuditor> clazz = AuditorFactory.getAuditorClassForClassName(className);
return getAuditor(clazz, config, useGlobalContext);
} | [
"public",
"static",
"IHEAuditor",
"getAuditor",
"(",
"String",
"className",
",",
"AuditorModuleConfig",
"config",
",",
"boolean",
"useGlobalContext",
")",
"{",
"Class",
"<",
"?",
"extends",
"IHEAuditor",
">",
"clazz",
"=",
"AuditorFactory",
".",
"getAuditorClassForC... | Get an auditor instance for the specified auditor class name, module configuration.
Auditor will use a standalone context if a non-global context is requested
@param className Class name of the auditor class to instantiate
@param config Auditor configuration to use
@param useGlobalContext Whether to use the global (true) or standalone (false) context
@return Instance of an IHE Auditor | [
"Get",
"an",
"auditor",
"instance",
"for",
"the",
"specified",
"auditor",
"class",
"name",
"module",
"configuration",
".",
"Auditor",
"will",
"use",
"a",
"standalone",
"context",
"if",
"a",
"non",
"-",
"global",
"context",
"is",
"requested"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java#L121-L125 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java | AuditorFactory.getAuditorClassForClassName | @SuppressWarnings("unchecked")
public static Class<? extends IHEAuditor> getAuditorClassForClassName(String className)
{
try {
Class<?> clazz = Class.forName(className);
return (Class<? extends IHEAuditor>)clazz;
} catch (ClassCastException e) {
LOGGER.error("The requested class "+ className +" is not a valid auditor", e);
} catch (ClassNotFoundException e) {
LOGGER.error("Could not find the requested auditor class "+ className, e);
} catch (Exception e) {
LOGGER.error("Error creating the auditor for "+ className, e);
}
return null;
} | java | @SuppressWarnings("unchecked")
public static Class<? extends IHEAuditor> getAuditorClassForClassName(String className)
{
try {
Class<?> clazz = Class.forName(className);
return (Class<? extends IHEAuditor>)clazz;
} catch (ClassCastException e) {
LOGGER.error("The requested class "+ className +" is not a valid auditor", e);
} catch (ClassNotFoundException e) {
LOGGER.error("Could not find the requested auditor class "+ className, e);
} catch (Exception e) {
LOGGER.error("Error creating the auditor for "+ className, e);
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Class",
"<",
"?",
"extends",
"IHEAuditor",
">",
"getAuditorClassForClassName",
"(",
"String",
"className",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"for... | Get a Class instance for the fully-qualified class name specified. The specified
class should have IHEAuditor as a superclass and implement the necessary
methods to be an IHE Auditor.
@param className Fully-qualified class name to get a class instance of
@return The requested class instance | [
"Get",
"a",
"Class",
"instance",
"for",
"the",
"fully",
"-",
"qualified",
"class",
"name",
"specified",
".",
"The",
"specified",
"class",
"should",
"have",
"IHEAuditor",
"as",
"a",
"superclass",
"and",
"implement",
"the",
"necessary",
"methods",
"to",
"be",
... | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java#L153-L167 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java | AuditorFactory.getAuditorForClass | private static IHEAuditor getAuditorForClass(Class<? extends IHEAuditor> clazz)
{
if (null == clazz) {
LOGGER.error("Error - Cannot specify a null auditor class");
} else {
try {
return clazz.newInstance();
} catch (ClassCastException e) {
LOGGER.error("The requested class "+ clazz.getName() +" is not a valid auditor", e);
} catch (Exception e) {
LOGGER.error("Error creating the auditor for class "+ clazz.getName(), e);
}
}
return null;
} | java | private static IHEAuditor getAuditorForClass(Class<? extends IHEAuditor> clazz)
{
if (null == clazz) {
LOGGER.error("Error - Cannot specify a null auditor class");
} else {
try {
return clazz.newInstance();
} catch (ClassCastException e) {
LOGGER.error("The requested class "+ clazz.getName() +" is not a valid auditor", e);
} catch (Exception e) {
LOGGER.error("Error creating the auditor for class "+ clazz.getName(), e);
}
}
return null;
} | [
"private",
"static",
"IHEAuditor",
"getAuditorForClass",
"(",
"Class",
"<",
"?",
"extends",
"IHEAuditor",
">",
"clazz",
")",
"{",
"if",
"(",
"null",
"==",
"clazz",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Error - Cannot specify a null auditor class\"",
")",
";"... | Create a new instance of the specified IHE Auditor non-abstract subclass that
implements the auditor API.
@param clazz Class instance to instantiate a new instance for
@return New IHE Auditor instance | [
"Create",
"a",
"new",
"instance",
"of",
"the",
"specified",
"IHE",
"Auditor",
"non",
"-",
"abstract",
"subclass",
"that",
"implements",
"the",
"auditor",
"API",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java#L176-L190 | train |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/http/HttpUrl.java | HttpUrl.encodedUsername | public String encodedUsername() {
if (username.isEmpty()) return "";
int usernameStart = scheme.length() + 3; // "://".length() == 3.
int usernameEnd = delimiterOffset(url, usernameStart, url.length(), ":@");
return url.substring(usernameStart, usernameEnd);
} | java | public String encodedUsername() {
if (username.isEmpty()) return "";
int usernameStart = scheme.length() + 3; // "://".length() == 3.
int usernameEnd = delimiterOffset(url, usernameStart, url.length(), ":@");
return url.substring(usernameStart, usernameEnd);
} | [
"public",
"String",
"encodedUsername",
"(",
")",
"{",
"if",
"(",
"username",
".",
"isEmpty",
"(",
")",
")",
"return",
"\"\"",
";",
"int",
"usernameStart",
"=",
"scheme",
".",
"length",
"(",
")",
"+",
"3",
";",
"// \"://\".length() == 3.",
"int",
"usernameE... | Returns the username, or an empty string if none is set.
<p><table summary="">
<tr><th>URL</th><th>{@code encodedUsername()}</th></tr>
<tr><td>{@code http://host/}</td><td>{@code ""}</td></tr>
<tr><td>{@code http://username@host/}</td><td>{@code "username"}</td></tr>
<tr><td>{@code http://username:password@host/}</td><td>{@code "username"}</td></tr>
<tr><td>{@code http://a%20b:c%20d@host/}</td><td>{@code "a%20b"}</td></tr>
</table> | [
"Returns",
"the",
"username",
"or",
"an",
"empty",
"string",
"if",
"none",
"is",
"set",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/http/HttpUrl.java#L408-L413 | train |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/http/HttpUrl.java | HttpUrl.encodedPassword | public String encodedPassword() {
if (password.isEmpty()) return "";
int passwordStart = url.indexOf(':', scheme.length() + 3) + 1;
int passwordEnd = url.indexOf('@');
return url.substring(passwordStart, passwordEnd);
} | java | public String encodedPassword() {
if (password.isEmpty()) return "";
int passwordStart = url.indexOf(':', scheme.length() + 3) + 1;
int passwordEnd = url.indexOf('@');
return url.substring(passwordStart, passwordEnd);
} | [
"public",
"String",
"encodedPassword",
"(",
")",
"{",
"if",
"(",
"password",
".",
"isEmpty",
"(",
")",
")",
"return",
"\"\"",
";",
"int",
"passwordStart",
"=",
"url",
".",
"indexOf",
"(",
"'",
"'",
",",
"scheme",
".",
"length",
"(",
")",
"+",
"3",
... | Returns the password, or an empty string if none is set.
<p><table summary="">
<tr><th>URL</th><th>{@code encodedPassword()}</th></tr>
<tr><td>{@code http://host/}</td><td>{@code ""}</td></tr>
<tr><td>{@code http://username@host/}</td><td>{@code ""}</td></tr>
<tr><td>{@code http://username:password@host/}</td><td>{@code "password"}</td></tr>
<tr><td>{@code http://a%20b:c%20d@host/}</td><td>{@code "c%20d"}</td></tr>
</table> | [
"Returns",
"the",
"password",
"or",
"an",
"empty",
"string",
"if",
"none",
"is",
"set",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/http/HttpUrl.java#L441-L446 | train |
apptik/jus | android/jus-android/src/main/java/io/apptik/comm/jus/util/BitmapLruPool.java | BitmapLruPool.getBitmap | public synchronized Bitmap getBitmap(BitmapFactory.Options options) {
Bitmap bitmap = null;
synchronized (bitmapsBySize) {
final Iterator<Bitmap> iterator = bitmapsBySize.iterator();
Bitmap item;
while (iterator.hasNext()) {
item = iterator.next();
if (null != item && canBePooled(item)) {
// Check to see it the item can be used for inBitmap
if (BitmapLruPool.canUseForInBitmap(item, options)) {
bitmap = item;
currentSize -= getBitmapSize(bitmap);
// Remove from reusable set so it can't be used again
iterator.remove();
bitmapsByLastUse.remove(bitmap);
break;
}
} else {
currentSize -= getBitmapSize(item);
// Remove from the set if the reference has been cleared.
iterator.remove();
bitmapsByLastUse.remove(item);
}
}
}
return bitmap;
} | java | public synchronized Bitmap getBitmap(BitmapFactory.Options options) {
Bitmap bitmap = null;
synchronized (bitmapsBySize) {
final Iterator<Bitmap> iterator = bitmapsBySize.iterator();
Bitmap item;
while (iterator.hasNext()) {
item = iterator.next();
if (null != item && canBePooled(item)) {
// Check to see it the item can be used for inBitmap
if (BitmapLruPool.canUseForInBitmap(item, options)) {
bitmap = item;
currentSize -= getBitmapSize(bitmap);
// Remove from reusable set so it can't be used again
iterator.remove();
bitmapsByLastUse.remove(bitmap);
break;
}
} else {
currentSize -= getBitmapSize(item);
// Remove from the set if the reference has been cleared.
iterator.remove();
bitmapsByLastUse.remove(item);
}
}
}
return bitmap;
} | [
"public",
"synchronized",
"Bitmap",
"getBitmap",
"(",
"BitmapFactory",
".",
"Options",
"options",
")",
"{",
"Bitmap",
"bitmap",
"=",
"null",
";",
"synchronized",
"(",
"bitmapsBySize",
")",
"{",
"final",
"Iterator",
"<",
"Bitmap",
">",
"iterator",
"=",
"bitmaps... | Returns a bitmap from the pool if one is available in the requested size, or allocates a new
one if a pooled one is not available.
@param options the options required to reuse the bitmap. The returned bitmap
may be larger.
@return Bitmap or null if not found. | [
"Returns",
"a",
"bitmap",
"from",
"the",
"pool",
"if",
"one",
"is",
"available",
"in",
"the",
"requested",
"size",
"or",
"allocates",
"a",
"new",
"one",
"if",
"a",
"pooled",
"one",
"is",
"not",
"available",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/android/jus-android/src/main/java/io/apptik/comm/jus/util/BitmapLruPool.java#L100-L130 | train |
apptik/jus | android/jus-android/src/main/java/io/apptik/comm/jus/util/BitmapLruPool.java | BitmapLruPool.returnBitmap | public synchronized void returnBitmap(Bitmap bitmap) {
if (bitmap == null || bitmapsBySize.contains(bitmap) ) {
return;
} else if(getBitmapSize(bitmap) > sizeLimit || !canBePooled(bitmap)) {
return;
}
bitmapsByLastUse.add(bitmap);
int pos = Collections.binarySearch(bitmapsBySize, bitmap, BITMAP_COMPARATOR);
if (pos < 0) {
pos = -pos - 1;
}
bitmapsBySize.add(pos, bitmap);
currentSize += getBitmapSize(bitmap);
trim();
} | java | public synchronized void returnBitmap(Bitmap bitmap) {
if (bitmap == null || bitmapsBySize.contains(bitmap) ) {
return;
} else if(getBitmapSize(bitmap) > sizeLimit || !canBePooled(bitmap)) {
return;
}
bitmapsByLastUse.add(bitmap);
int pos = Collections.binarySearch(bitmapsBySize, bitmap, BITMAP_COMPARATOR);
if (pos < 0) {
pos = -pos - 1;
}
bitmapsBySize.add(pos, bitmap);
currentSize += getBitmapSize(bitmap);
trim();
} | [
"public",
"synchronized",
"void",
"returnBitmap",
"(",
"Bitmap",
"bitmap",
")",
"{",
"if",
"(",
"bitmap",
"==",
"null",
"||",
"bitmapsBySize",
".",
"contains",
"(",
"bitmap",
")",
")",
"{",
"return",
";",
"}",
"else",
"if",
"(",
"getBitmapSize",
"(",
"bi... | Returns a bitmap to the pool, throwing away old bitmaps if the pool would exceed its allotted
size.
@param bitmap the buffer to return to the pool. | [
"Returns",
"a",
"bitmap",
"to",
"the",
"pool",
"throwing",
"away",
"old",
"bitmaps",
"if",
"the",
"pool",
"would",
"exceed",
"its",
"allotted",
"size",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/android/jus-android/src/main/java/io/apptik/comm/jus/util/BitmapLruPool.java#L138-L152 | train |
apptik/jus | android/jus-android/src/main/java/io/apptik/comm/jus/util/BitmapLruPool.java | BitmapLruPool.getBytesPerPixel | protected static int getBytesPerPixel(Bitmap.Config config) {
if (config == Bitmap.Config.ARGB_8888) {
return 4;
} else if (config == Bitmap.Config.RGB_565) {
return 2;
} else if (config == Bitmap.Config.ARGB_4444) {
return 2;
} else if (config == Bitmap.Config.ALPHA_8) {
return 1;
}
return 1;
} | java | protected static int getBytesPerPixel(Bitmap.Config config) {
if (config == Bitmap.Config.ARGB_8888) {
return 4;
} else if (config == Bitmap.Config.RGB_565) {
return 2;
} else if (config == Bitmap.Config.ARGB_4444) {
return 2;
} else if (config == Bitmap.Config.ALPHA_8) {
return 1;
}
return 1;
} | [
"protected",
"static",
"int",
"getBytesPerPixel",
"(",
"Bitmap",
".",
"Config",
"config",
")",
"{",
"if",
"(",
"config",
"==",
"Bitmap",
".",
"Config",
".",
"ARGB_8888",
")",
"{",
"return",
"4",
";",
"}",
"else",
"if",
"(",
"config",
"==",
"Bitmap",
".... | Return the byte usage per pixel of a bitmap based on its configuration.
@param config The bitmap configuration.
@return The byte usage per pixel. | [
"Return",
"the",
"byte",
"usage",
"per",
"pixel",
"of",
"a",
"bitmap",
"based",
"on",
"its",
"configuration",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/android/jus-android/src/main/java/io/apptik/comm/jus/util/BitmapLruPool.java#L206-L217 | train |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/toolbox/HttpHeaderParser.java | HttpHeaderParser.parseCharset | public static String parseCharset(Map<String, String> headers, String defaultCharset) {
String contentType = headers.get(HTTP.CONTENT_TYPE);
if (contentType != null) {
String[] params = contentType.split(";");
for (int i = 1; i < params.length; i++) {
String[] pair = params[i].trim().split("=");
if (pair.length == 2) {
if (pair[0].equals("charset")) {
return pair[1];
}
}
}
}
return defaultCharset;
} | java | public static String parseCharset(Map<String, String> headers, String defaultCharset) {
String contentType = headers.get(HTTP.CONTENT_TYPE);
if (contentType != null) {
String[] params = contentType.split(";");
for (int i = 1; i < params.length; i++) {
String[] pair = params[i].trim().split("=");
if (pair.length == 2) {
if (pair[0].equals("charset")) {
return pair[1];
}
}
}
}
return defaultCharset;
} | [
"public",
"static",
"String",
"parseCharset",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
",",
"String",
"defaultCharset",
")",
"{",
"String",
"contentType",
"=",
"headers",
".",
"get",
"(",
"HTTP",
".",
"CONTENT_TYPE",
")",
";",
"if",
"(",
... | Retrieve a charset from headers
@param headers An {@link java.util.Map} of headers
@param defaultCharset Charset to return if none can be found
@return Returns the charset specified in the Content-Type of this header,
or the defaultCharset if none can be found. | [
"Retrieve",
"a",
"charset",
"from",
"headers"
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/toolbox/HttpHeaderParser.java#L152-L167 | train |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/RequestQueue.java | RequestQueue.stopWhenDone | public void stopWhenDone() {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
while (getCurrentRequests() > 0) {
try {
Thread.sleep(33);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
t.start();
try {
t.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
stop();
} | java | public void stopWhenDone() {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
while (getCurrentRequests() > 0) {
try {
Thread.sleep(33);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
t.start();
try {
t.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
stop();
} | [
"public",
"void",
"stopWhenDone",
"(",
")",
"{",
"Thread",
"t",
"=",
"new",
"Thread",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"while",
"(",
"getCurrentRequests",
"(",
")",
">",
"0",
")",
"{",
... | Stops the queue when all requests are finished | [
"Stops",
"the",
"queue",
"when",
"all",
"requests",
"are",
"finished"
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/RequestQueue.java#L251-L272 | train |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/RequestQueue.java | RequestQueue.addQueueMarkerListener | public <R extends RequestQueue> R addQueueMarkerListener(
RequestListener.MarkerListener markerListener) {
if (markerListener != null) {
synchronized (markerListeners) {
this.markerListeners.add(markerListener);
}
}
return (R) this;
} | java | public <R extends RequestQueue> R addQueueMarkerListener(
RequestListener.MarkerListener markerListener) {
if (markerListener != null) {
synchronized (markerListeners) {
this.markerListeners.add(markerListener);
}
}
return (R) this;
} | [
"public",
"<",
"R",
"extends",
"RequestQueue",
">",
"R",
"addQueueMarkerListener",
"(",
"RequestListener",
".",
"MarkerListener",
"markerListener",
")",
"{",
"if",
"(",
"markerListener",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"markerListeners",
")",
"{",
"... | Add marker listener for RequestQueue related events | [
"Add",
"marker",
"listener",
"for",
"RequestQueue",
"related",
"events"
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/RequestQueue.java#L277-L285 | train |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/RequestQueue.java | RequestQueue.removeQueueMarkerListener | public <R extends RequestQueue> R removeQueueMarkerListener(RequestListener.MarkerListener
markerListener) {
synchronized (markerListeners) {
this.markerListeners.remove(markerListener);
}
return (R) this;
} | java | public <R extends RequestQueue> R removeQueueMarkerListener(RequestListener.MarkerListener
markerListener) {
synchronized (markerListeners) {
this.markerListeners.remove(markerListener);
}
return (R) this;
} | [
"public",
"<",
"R",
"extends",
"RequestQueue",
">",
"R",
"removeQueueMarkerListener",
"(",
"RequestListener",
".",
"MarkerListener",
"markerListener",
")",
"{",
"synchronized",
"(",
"markerListeners",
")",
"{",
"this",
".",
"markerListeners",
".",
"remove",
"(",
"... | Remove marker listener for RequestQueue related events | [
"Remove",
"marker",
"listener",
"for",
"RequestQueue",
"related",
"events"
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/RequestQueue.java#L290-L296 | train |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/RequestQueue.java | RequestQueue.cancelAll | public void cancelAll(final Object tag) {
if (tag == null) {
throw new IllegalArgumentException("Cannot cancelAll with a null tag");
}
cancelAll(new RequestFilter() {
@Override
public boolean apply(Request<?> request) {
return request.getTag() == tag;
}
});
} | java | public void cancelAll(final Object tag) {
if (tag == null) {
throw new IllegalArgumentException("Cannot cancelAll with a null tag");
}
cancelAll(new RequestFilter() {
@Override
public boolean apply(Request<?> request) {
return request.getTag() == tag;
}
});
} | [
"public",
"void",
"cancelAll",
"(",
"final",
"Object",
"tag",
")",
"{",
"if",
"(",
"tag",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot cancelAll with a null tag\"",
")",
";",
"}",
"cancelAll",
"(",
"new",
"RequestFilter",
... | Cancels all requests in this queue with the given tag. Tag must be non-null
and equality is by identity. | [
"Cancels",
"all",
"requests",
"in",
"this",
"queue",
"with",
"the",
"given",
"tag",
".",
"Tag",
"must",
"be",
"non",
"-",
"null",
"and",
"equality",
"is",
"by",
"identity",
"."
] | 8a37a21b41f897d68eaeaab07368ec22a1e5a60e | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/RequestQueue.java#L367-L377 | train |
jingwei/krati | krati-main/src/retention/java/krati/retention/clock/Clock.java | Clock.parseClock | public static Clock parseClock(String str) {
if(str == null || str.length() == 0) {
return Clock.ZERO;
}
String[] parts = str.split(":");
long[] values = new long[parts.length];
for(int i = 0; i < values.length; i++) {
values[i] = Long.parseLong(parts[i]);
}
return new Clock(values);
} | java | public static Clock parseClock(String str) {
if(str == null || str.length() == 0) {
return Clock.ZERO;
}
String[] parts = str.split(":");
long[] values = new long[parts.length];
for(int i = 0; i < values.length; i++) {
values[i] = Long.parseLong(parts[i]);
}
return new Clock(values);
} | [
"public",
"static",
"Clock",
"parseClock",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"str",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"Clock",
".",
"ZERO",
";",
"}",
"String",
"[",
"]",
"parts",
"=",
"str... | Parses a Clock value from its string representation.
@param str - the string representation of Clock
@return A Clock object.
<code>Clock.ZERO</code> is returned <code>upon</code> null or zero-length string. | [
"Parses",
"a",
"Clock",
"value",
"from",
"its",
"string",
"representation",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/retention/java/krati/retention/clock/Clock.java#L65-L76 | train |
jingwei/krati | krati-main/src/retention/java/krati/retention/clock/Clock.java | Clock.parseClock | public static Clock parseClock(byte[] raw) {
if(raw == null || raw.length < 8) {
return Clock.ZERO;
}
int cnt = raw.length >> 3;
long[] values = new long[cnt];
ByteBuffer bb = ByteBuffer.wrap(raw);
for(int i = 0; i < values.length; i++) {
values[i] = bb.getLong();
}
return new Clock(values);
} | java | public static Clock parseClock(byte[] raw) {
if(raw == null || raw.length < 8) {
return Clock.ZERO;
}
int cnt = raw.length >> 3;
long[] values = new long[cnt];
ByteBuffer bb = ByteBuffer.wrap(raw);
for(int i = 0; i < values.length; i++) {
values[i] = bb.getLong();
}
return new Clock(values);
} | [
"public",
"static",
"Clock",
"parseClock",
"(",
"byte",
"[",
"]",
"raw",
")",
"{",
"if",
"(",
"raw",
"==",
"null",
"||",
"raw",
".",
"length",
"<",
"8",
")",
"{",
"return",
"Clock",
".",
"ZERO",
";",
"}",
"int",
"cnt",
"=",
"raw",
".",
"length",
... | Parses a Clock value from its raw bytes.
@param raw - the raw bytes of Clock
@return a Clock object.
<code>Clock.ZERO</code> is returned upon <code>null</code> or a byte array with the length less than 8. | [
"Parses",
"a",
"Clock",
"value",
"from",
"its",
"raw",
"bytes",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/retention/java/krati/retention/clock/Clock.java#L85-L97 | train |
jingwei/krati | krati-main/src/retention/java/krati/retention/clock/Clock.java | Clock.compareTo | public Occurred compareTo(Clock c) {
if(this == c) return Occurred.EQUICONCURRENTLY;
if(ZERO == c) return Occurred.AFTER;
if(this == ZERO) return Occurred.BEFORE;
int neg = 0, pos = 0, eq = 0;
try {
final long[] dst = c.values();
final int len = dst.length;
if(_values.length == len) {
for(int i = 0; i < len; i++) {
long cmp = _values[i] - dst[i];
if(cmp < 0) {
neg++;
} else if(cmp > 0) {
pos++;
} else {
eq++;
}
}
if(eq == len) {
return Occurred.EQUICONCURRENTLY;
} else if(neg == len) {
return Occurred.BEFORE;
} else if(pos == len) {
return Occurred.AFTER;
} else {
neg += eq;
if(neg == len) {
return Occurred.BEFORE;
}
pos += eq;
if(pos == len) {
return Occurred.AFTER;
}
return Occurred.CONCURRENTLY;
}
}
} catch(Exception e) {}
throw new IncomparableClocksException(this, c);
} | java | public Occurred compareTo(Clock c) {
if(this == c) return Occurred.EQUICONCURRENTLY;
if(ZERO == c) return Occurred.AFTER;
if(this == ZERO) return Occurred.BEFORE;
int neg = 0, pos = 0, eq = 0;
try {
final long[] dst = c.values();
final int len = dst.length;
if(_values.length == len) {
for(int i = 0; i < len; i++) {
long cmp = _values[i] - dst[i];
if(cmp < 0) {
neg++;
} else if(cmp > 0) {
pos++;
} else {
eq++;
}
}
if(eq == len) {
return Occurred.EQUICONCURRENTLY;
} else if(neg == len) {
return Occurred.BEFORE;
} else if(pos == len) {
return Occurred.AFTER;
} else {
neg += eq;
if(neg == len) {
return Occurred.BEFORE;
}
pos += eq;
if(pos == len) {
return Occurred.AFTER;
}
return Occurred.CONCURRENTLY;
}
}
} catch(Exception e) {}
throw new IncomparableClocksException(this, c);
} | [
"public",
"Occurred",
"compareTo",
"(",
"Clock",
"c",
")",
"{",
"if",
"(",
"this",
"==",
"c",
")",
"return",
"Occurred",
".",
"EQUICONCURRENTLY",
";",
"if",
"(",
"ZERO",
"==",
"c",
")",
"return",
"Occurred",
".",
"AFTER",
";",
"if",
"(",
"this",
"=="... | Compares this clock with the specified clock for ordering.
@param c - a clock to compare. | [
"Compares",
"this",
"clock",
"with",
"the",
"specified",
"clock",
"for",
"ordering",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/retention/java/krati/retention/clock/Clock.java#L137-L181 | train |
legsem/legstar-core2 | legstar-cob2xsd/src/main/java/com/legstar/cobol/utils/ValueUtil.java | ValueUtil.resolveFigurative | public static String resolveFigurative(
final String value,
final int length,
final boolean quoteIsQuote) {
if (value == null || value.length() == 0) {
return value;
}
String ucValue = value.toUpperCase(Locale.getDefault());
if (ucValue.matches("^ZERO(S|ES)?$")) {
return "0";
}
/* We avoid filling with spaces because this is the most common
* initial value for large strings*/
if (ucValue.matches("^SPACES?$")) {
return " ";
}
if (ucValue.matches("^QUOTES?$")) {
return quoteIsQuote ? "\"" : "\'";
}
if (ucValue.matches("^APOST$")) {
return "\'";
}
/* For binary content, we use pseudo hexadecimal representation
* This is understood downstream by the COBOL binder. */
if (ucValue.matches("^HIGH-VALUES?$")) {
return fill("0x", "FF", length);
}
if (ucValue.matches("^LOW-VALUES?$")) {
return fill("0x", "00", length);
}
/* Nulls are treated like low-value. */
if (ucValue.matches("^NULLS?$")) {
return fill("0x", "00", length);
}
/* All is followed by a literal which can be a figurative constant.
* If that figurative constant is binary, then the filling already
* took place. Otherwise, if the total length is not a multiple
* of the repeated character sequence, then we need to fill the
* the remainder with a substring of the literal. */
if (ucValue.startsWith("ALL ")) {
String literal = value.substring("ALL ".length());
String resolvedLiteral = ValueUtil.resolveFigurative(
literal, length, quoteIsQuote);
if (resolvedLiteral.length() > 0 && resolvedLiteral.length() < length) {
String filled = fill(null, resolvedLiteral, length / resolvedLiteral.length());
if (filled.length() < length) {
return filled + resolvedLiteral.substring(0, length - filled.length());
} else {
return filled;
}
} else {
return resolvedLiteral;
}
}
/* This is not a figurative constant just strip delimiters */
return stripDelimiters(value);
} | java | public static String resolveFigurative(
final String value,
final int length,
final boolean quoteIsQuote) {
if (value == null || value.length() == 0) {
return value;
}
String ucValue = value.toUpperCase(Locale.getDefault());
if (ucValue.matches("^ZERO(S|ES)?$")) {
return "0";
}
/* We avoid filling with spaces because this is the most common
* initial value for large strings*/
if (ucValue.matches("^SPACES?$")) {
return " ";
}
if (ucValue.matches("^QUOTES?$")) {
return quoteIsQuote ? "\"" : "\'";
}
if (ucValue.matches("^APOST$")) {
return "\'";
}
/* For binary content, we use pseudo hexadecimal representation
* This is understood downstream by the COBOL binder. */
if (ucValue.matches("^HIGH-VALUES?$")) {
return fill("0x", "FF", length);
}
if (ucValue.matches("^LOW-VALUES?$")) {
return fill("0x", "00", length);
}
/* Nulls are treated like low-value. */
if (ucValue.matches("^NULLS?$")) {
return fill("0x", "00", length);
}
/* All is followed by a literal which can be a figurative constant.
* If that figurative constant is binary, then the filling already
* took place. Otherwise, if the total length is not a multiple
* of the repeated character sequence, then we need to fill the
* the remainder with a substring of the literal. */
if (ucValue.startsWith("ALL ")) {
String literal = value.substring("ALL ".length());
String resolvedLiteral = ValueUtil.resolveFigurative(
literal, length, quoteIsQuote);
if (resolvedLiteral.length() > 0 && resolvedLiteral.length() < length) {
String filled = fill(null, resolvedLiteral, length / resolvedLiteral.length());
if (filled.length() < length) {
return filled + resolvedLiteral.substring(0, length - filled.length());
} else {
return filled;
}
} else {
return resolvedLiteral;
}
}
/* This is not a figurative constant just strip delimiters */
return stripDelimiters(value);
} | [
"public",
"static",
"String",
"resolveFigurative",
"(",
"final",
"String",
"value",
",",
"final",
"int",
"length",
",",
"final",
"boolean",
"quoteIsQuote",
")",
"{",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"length",
"(",
")",
"==",
"0",
")"... | Translate individual figurative constants.
@param value a potential figurative constant value
@param length the target data item length
@param quoteIsQuote true if quote is quote, false if quote is apost
@return a translated value or the value stripped from delimiters if it is not a figurative constant | [
"Translate",
"individual",
"figurative",
"constants",
"."
] | f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6 | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cobol/utils/ValueUtil.java#L35-L98 | train |
legsem/legstar-core2 | legstar-cob2xsd/src/main/java/com/legstar/cobol/utils/ValueUtil.java | ValueUtil.fill | public static String fill(
final String prefix,
final String charSequence,
final int times) {
if (times < 1) {
return "";
}
StringBuilder sb = new StringBuilder();
if (prefix != null) {
sb.append(prefix);
}
for (int i = 0; i < times; i++) {
sb.append(charSequence);
}
return sb.toString();
} | java | public static String fill(
final String prefix,
final String charSequence,
final int times) {
if (times < 1) {
return "";
}
StringBuilder sb = new StringBuilder();
if (prefix != null) {
sb.append(prefix);
}
for (int i = 0; i < times; i++) {
sb.append(charSequence);
}
return sb.toString();
} | [
"public",
"static",
"String",
"fill",
"(",
"final",
"String",
"prefix",
",",
"final",
"String",
"charSequence",
",",
"final",
"int",
"times",
")",
"{",
"if",
"(",
"times",
"<",
"1",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"sb",
"=",
"new... | Create a string representation repeating a character
sequence the requested number of times.
@param prefix an optional prefix to prepend
@param charSequence the character sequence to repeat
@param times how many times the character sequence should be repeated
@return a string filled with character sequence or empty string | [
"Create",
"a",
"string",
"representation",
"repeating",
"a",
"character",
"sequence",
"the",
"requested",
"number",
"of",
"times",
"."
] | f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6 | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cobol/utils/ValueUtil.java#L109-L124 | train |
legsem/legstar-core2 | legstar-cob2xsd/src/main/java/com/legstar/cobol/utils/ValueUtil.java | ValueUtil.stripDelimiters | public static String stripDelimiters(final String value) {
if (value != null && value.length() > 1) {
if (value.charAt(0) == value.charAt(value.length() - 1)
&& (value.charAt(0) == '\'')) {
return value.substring(1, value.length() - 1);
}
if (value.charAt(0) == value.charAt(value.length() - 1)
&& (value.charAt(0) == '\"')) {
return value.substring(1, value.length() - 1);
}
}
return value;
} | java | public static String stripDelimiters(final String value) {
if (value != null && value.length() > 1) {
if (value.charAt(0) == value.charAt(value.length() - 1)
&& (value.charAt(0) == '\'')) {
return value.substring(1, value.length() - 1);
}
if (value.charAt(0) == value.charAt(value.length() - 1)
&& (value.charAt(0) == '\"')) {
return value.substring(1, value.length() - 1);
}
}
return value;
} | [
"public",
"static",
"String",
"stripDelimiters",
"(",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"value",
".",
"length",
"(",
")",
">",
"1",
")",
"{",
"if",
"(",
"value",
".",
"charAt",
"(",
"0",
")",
"==",
"value... | The parser does not strip delimiters from literal strings so we
do it here if necessary.
@param value a potential literal string
@return the literal without delimiters | [
"The",
"parser",
"does",
"not",
"strip",
"delimiters",
"from",
"literal",
"strings",
"so",
"we",
"do",
"it",
"here",
"if",
"necessary",
"."
] | f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6 | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cobol/utils/ValueUtil.java#L132-L144 | train |
legsem/legstar-core2 | legstar-base/src/main/java/com/legstar/base/visitor/FromCobolVisitor.java | FromCobolVisitor.isPresent | private boolean isPresent(CobolOptionalType optionalType) {
if (optionalType.getDependingOn() != null) {
return getOdoValue(optionalType.getDependingOn()) > 0;
}
return true;
} | java | private boolean isPresent(CobolOptionalType optionalType) {
if (optionalType.getDependingOn() != null) {
return getOdoValue(optionalType.getDependingOn()) > 0;
}
return true;
} | [
"private",
"boolean",
"isPresent",
"(",
"CobolOptionalType",
"optionalType",
")",
"{",
"if",
"(",
"optionalType",
".",
"getDependingOn",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"getOdoValue",
"(",
"optionalType",
".",
"getDependingOn",
"(",
")",
")",
">",
... | Check if an optional type is present.
@param optionalType the optional type
@return true if the optional type is present | [
"Check",
"if",
"an",
"optional",
"type",
"is",
"present",
"."
] | f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6 | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/visitor/FromCobolVisitor.java#L477-L482 | train |
legsem/legstar-core2 | legstar-base/src/main/java/com/legstar/base/visitor/FromCobolVisitor.java | FromCobolVisitor.isCustomVariable | public boolean isCustomVariable(CobolPrimitiveType < ? > type, String name) {
if (type.isCustomVariable()) {
return true;
}
if (customVariables != null && customVariables.contains(name)) {
return true;
}
if (customChoiceStrategy != null
&& customChoiceStrategy.getVariableNames() != null
&& customChoiceStrategy.getVariableNames().contains(name)) {
return true;
}
return false;
} | java | public boolean isCustomVariable(CobolPrimitiveType < ? > type, String name) {
if (type.isCustomVariable()) {
return true;
}
if (customVariables != null && customVariables.contains(name)) {
return true;
}
if (customChoiceStrategy != null
&& customChoiceStrategy.getVariableNames() != null
&& customChoiceStrategy.getVariableNames().contains(name)) {
return true;
}
return false;
} | [
"public",
"boolean",
"isCustomVariable",
"(",
"CobolPrimitiveType",
"<",
"?",
">",
"type",
",",
"String",
"name",
")",
"{",
"if",
"(",
"type",
".",
"isCustomVariable",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"customVariables",
"!=",
"n... | A primitive type is a custom variable if it has been marked as so via one
of the available mechanisms or is needed to make choice decisions.
@param type the primitive type
@param name the variable name
@return true if this is a custom variable | [
"A",
"primitive",
"type",
"is",
"a",
"custom",
"variable",
"if",
"it",
"has",
"been",
"marked",
"as",
"so",
"via",
"one",
"of",
"the",
"available",
"mechanisms",
"or",
"is",
"needed",
"to",
"make",
"choice",
"decisions",
"."
] | f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6 | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-base/src/main/java/com/legstar/base/visitor/FromCobolVisitor.java#L588-L601 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/context/AuditorModuleConfig.java | AuditorModuleConfig.getAuditRepositoryTransport | public String getAuditRepositoryTransport()
{
String transport = getOption(AUDITOR_AUDIT_REPOSITORY_TRANSPORT_KEY);
return (transport != null) ? transport : AUDITOR_AUDIT_REPOSITORY_DEFAULT_TRANSPORT;
} | java | public String getAuditRepositoryTransport()
{
String transport = getOption(AUDITOR_AUDIT_REPOSITORY_TRANSPORT_KEY);
return (transport != null) ? transport : AUDITOR_AUDIT_REPOSITORY_DEFAULT_TRANSPORT;
} | [
"public",
"String",
"getAuditRepositoryTransport",
"(",
")",
"{",
"String",
"transport",
"=",
"getOption",
"(",
"AUDITOR_AUDIT_REPOSITORY_TRANSPORT_KEY",
")",
";",
"return",
"(",
"transport",
"!=",
"null",
")",
"?",
"transport",
":",
"AUDITOR_AUDIT_REPOSITORY_DEFAULT_TR... | Get the port of the target audit repository
@return The transport to access the target audit repository | [
"Get",
"the",
"port",
"of",
"the",
"target",
"audit",
"repository"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/context/AuditorModuleConfig.java#L206-L210 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/context/AuditorModuleConfig.java | AuditorModuleConfig.setAuditRepositoryUri | public void setAuditRepositoryUri(URI uri)
{
setAuditRepositoryHost(uri.getHost());
setAuditRepositoryPort(uri.getPort());
setAuditRepositoryTransport(uri.getScheme());
} | java | public void setAuditRepositoryUri(URI uri)
{
setAuditRepositoryHost(uri.getHost());
setAuditRepositoryPort(uri.getPort());
setAuditRepositoryTransport(uri.getScheme());
} | [
"public",
"void",
"setAuditRepositoryUri",
"(",
"URI",
"uri",
")",
"{",
"setAuditRepositoryHost",
"(",
"uri",
".",
"getHost",
"(",
")",
")",
";",
"setAuditRepositoryPort",
"(",
"uri",
".",
"getPort",
"(",
")",
")",
";",
"setAuditRepositoryTransport",
"(",
"uri... | Set the hostname and port of the target audit repository from
a well-formed URI
@param uri URI containing the hostname and port to set | [
"Set",
"the",
"hostname",
"and",
"port",
"of",
"the",
"target",
"audit",
"repository",
"from",
"a",
"well",
"-",
"formed",
"URI"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/context/AuditorModuleConfig.java#L229-L234 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXSourceAuditor.java | PIXSourceAuditor.getAuditor | public static PIXSourceAuditor getAuditor()
{
AuditorModuleContext ctx = AuditorModuleContext.getContext();
return (PIXSourceAuditor)ctx.getAuditor(PIXSourceAuditor.class);
} | java | public static PIXSourceAuditor getAuditor()
{
AuditorModuleContext ctx = AuditorModuleContext.getContext();
return (PIXSourceAuditor)ctx.getAuditor(PIXSourceAuditor.class);
} | [
"public",
"static",
"PIXSourceAuditor",
"getAuditor",
"(",
")",
"{",
"AuditorModuleContext",
"ctx",
"=",
"AuditorModuleContext",
".",
"getContext",
"(",
")",
";",
"return",
"(",
"PIXSourceAuditor",
")",
"ctx",
".",
"getAuditor",
"(",
"PIXSourceAuditor",
".",
"clas... | Get an instance of the PIX Source Auditor from the
global context
@return PIX Source Auditor instance | [
"Get",
"an",
"instance",
"of",
"the",
"PIX",
"Source",
"Auditor",
"from",
"the",
"global",
"context"
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXSourceAuditor.java#L43-L47 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXSourceAuditor.java | PIXSourceAuditor.auditCreatePatientRecordV3Event | public void auditCreatePatientRecordV3Event(RFC3881EventOutcomeCodes eventOutcome,
String pixManagerUri, String receivingFacility, String receivingApp,
String sendingFacility, String sendingApp,
String hl7MessageId,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
auditPatientRecordEvent(true,
new IHETransactionEventTypeCodes.PatientIdentityFeedV3(), eventOutcome, RFC3881EventCodes.RFC3881EventActionCodes.CREATE,
sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(),
receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false),
getHumanRequestor(),
hl7MessageId,
new String[] {patientId}, purposesOfUse, userRoles);
} | java | public void auditCreatePatientRecordV3Event(RFC3881EventOutcomeCodes eventOutcome,
String pixManagerUri, String receivingFacility, String receivingApp,
String sendingFacility, String sendingApp,
String hl7MessageId,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
auditPatientRecordEvent(true,
new IHETransactionEventTypeCodes.PatientIdentityFeedV3(), eventOutcome, RFC3881EventCodes.RFC3881EventActionCodes.CREATE,
sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(),
receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false),
getHumanRequestor(),
hl7MessageId,
new String[] {patientId}, purposesOfUse, userRoles);
} | [
"public",
"void",
"auditCreatePatientRecordV3Event",
"(",
"RFC3881EventOutcomeCodes",
"eventOutcome",
",",
"String",
"pixManagerUri",
",",
"String",
"receivingFacility",
",",
"String",
"receivingApp",
",",
"String",
"sendingFacility",
",",
"String",
"sendingApp",
",",
"St... | Audits an ITI-44 Patient Identity Feed CREATE PATIENT RECORD
event for Patient Identity Source actors.
@param eventOutcome The event outcome indicator
@param pixManagerUri The URI of the PIX Manager being accessed
@param receivingFacility The HL7 receiving facility
@param receivingApp The HL7 receiving application
@param sendingFacility The HL7 sending facility
@param sendingApp The HL7 sending application
@param hl7MessageId The HL7 message.id
@param patientId The patient ID that was affected by this event
@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",
"-",
"44",
"Patient",
"Identity",
"Feed",
"CREATE",
"PATIENT",
"RECORD",
"event",
"for",
"Patient",
"Identity",
"Source",
"actors",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXSourceAuditor.java#L95-L113 | train |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXSourceAuditor.java | PIXSourceAuditor.auditDeletePatientRecordEvent | public void auditDeletePatientRecordEvent(RFC3881EventOutcomeCodes eventOutcome,
String pixManagerUri, String receivingFacility, String receivingApp,
String sendingFacility, String sendingApp,
String hl7MessageControlId,
String patientId)
{
if (!isAuditorEnabled()) {
return;
}
auditPatientRecordEvent(true,
new IHETransactionEventTypeCodes.PatientIdentityFeed(), eventOutcome, RFC3881EventCodes.RFC3881EventActionCodes.DELETE,
sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(),
receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false),
getHumanRequestor(),
hl7MessageControlId,
new String[] {patientId}, null, null);
} | java | public void auditDeletePatientRecordEvent(RFC3881EventOutcomeCodes eventOutcome,
String pixManagerUri, String receivingFacility, String receivingApp,
String sendingFacility, String sendingApp,
String hl7MessageControlId,
String patientId)
{
if (!isAuditorEnabled()) {
return;
}
auditPatientRecordEvent(true,
new IHETransactionEventTypeCodes.PatientIdentityFeed(), eventOutcome, RFC3881EventCodes.RFC3881EventActionCodes.DELETE,
sendingFacility, sendingApp, getSystemAltUserId(), getSystemNetworkId(),
receivingFacility, receivingApp, null, EventUtils.getAddressForUrl(pixManagerUri, false),
getHumanRequestor(),
hl7MessageControlId,
new String[] {patientId}, null, null);
} | [
"public",
"void",
"auditDeletePatientRecordEvent",
"(",
"RFC3881EventOutcomeCodes",
"eventOutcome",
",",
"String",
"pixManagerUri",
",",
"String",
"receivingFacility",
",",
"String",
"receivingApp",
",",
"String",
"sendingFacility",
",",
"String",
"sendingApp",
",",
"Stri... | Audits an ITI-8 Patient Identity Feed DELETE PATIENT RECORD
event for Patient Identity Source actors.
@param eventOutcome The event outcome indicator
@param pixManagerUri The URI of the PIX Manager being accessed
@param receivingFacility The HL7 receiving facility
@param receivingApp The HL7 receiving application
@param sendingFacility The HL7 sending facility
@param sendingApp The HL7 sending application
@param hl7MessageControlId The HL7 message control id from the MSH segment
@param patientId The patient ID that was affected by this event | [
"Audits",
"an",
"ITI",
"-",
"8",
"Patient",
"Identity",
"Feed",
"DELETE",
"PATIENT",
"RECORD",
"event",
"for",
"Patient",
"Identity",
"Source",
"actors",
"."
] | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXSourceAuditor.java#L128-L144 | train |
oehf/ipf-oht-atna | nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/context/NodeAuthModuleContext.java | NodeAuthModuleContext.getContext | public static NodeAuthModuleContext getContext()
{
SecurityContext securityContext = SecurityContextFactory.getSecurityContext();
if (!securityContext.isInitialized()) {
securityContext.initialize();
}
AbstractModuleContext moduleContext = securityContext.getModuleContext(CONTEXT_ID);
if (!(moduleContext instanceof NodeAuthModuleContext)) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Initializing the NodeAuthModuleContext");
}
moduleContext = ContextInitializer.defaultInitialize();
securityContext.registerModuleContext(CONTEXT_ID, moduleContext);
}
return (NodeAuthModuleContext)moduleContext;
} | java | public static NodeAuthModuleContext getContext()
{
SecurityContext securityContext = SecurityContextFactory.getSecurityContext();
if (!securityContext.isInitialized()) {
securityContext.initialize();
}
AbstractModuleContext moduleContext = securityContext.getModuleContext(CONTEXT_ID);
if (!(moduleContext instanceof NodeAuthModuleContext)) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Initializing the NodeAuthModuleContext");
}
moduleContext = ContextInitializer.defaultInitialize();
securityContext.registerModuleContext(CONTEXT_ID, moduleContext);
}
return (NodeAuthModuleContext)moduleContext;
} | [
"public",
"static",
"NodeAuthModuleContext",
"getContext",
"(",
")",
"{",
"SecurityContext",
"securityContext",
"=",
"SecurityContextFactory",
".",
"getSecurityContext",
"(",
")",
";",
"if",
"(",
"!",
"securityContext",
".",
"isInitialized",
"(",
")",
")",
"{",
"s... | Returns the current singleton instance of the Node Authentication Module Context from the
ThreadLocal cache. If the ThreadLocal cache has not been initialized or does not contain
this context, then create and initialize module context, register in the ThreadLocal
and return the new instance.
@return Context singleton | [
"Returns",
"the",
"current",
"singleton",
"instance",
"of",
"the",
"Node",
"Authentication",
"Module",
"Context",
"from",
"the",
"ThreadLocal",
"cache",
".",
"If",
"the",
"ThreadLocal",
"cache",
"has",
"not",
"been",
"initialized",
"or",
"does",
"not",
"contain"... | 25ed1e926825169c94923a2c89a4618f60478ae8 | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/context/NodeAuthModuleContext.java#L93-L111 | train |
jingwei/krati | krati-main/src/main/java/krati/store/DynamicDataSet.java | DynamicDataSet.createAddressArray | protected AddressArray createAddressArray(File homeDir,
int batchSize,
int numSyncBatches,
boolean indexesCached) throws Exception {
AddressArrayFactory factory = new AddressArrayFactory(indexesCached);
AddressArray addrArray = factory.createDynamicAddressArray(homeDir, batchSize, numSyncBatches);
return addrArray;
} | java | protected AddressArray createAddressArray(File homeDir,
int batchSize,
int numSyncBatches,
boolean indexesCached) throws Exception {
AddressArrayFactory factory = new AddressArrayFactory(indexesCached);
AddressArray addrArray = factory.createDynamicAddressArray(homeDir, batchSize, numSyncBatches);
return addrArray;
} | [
"protected",
"AddressArray",
"createAddressArray",
"(",
"File",
"homeDir",
",",
"int",
"batchSize",
",",
"int",
"numSyncBatches",
",",
"boolean",
"indexesCached",
")",
"throws",
"Exception",
"{",
"AddressArrayFactory",
"factory",
"=",
"new",
"AddressArrayFactory",
"("... | Creates an address array file under the specified home directory.
@param homeDir - the home directory
@param batchSize - the update batch size
@param numSyncBatches - the number of batches need to sync address array file
@param indexesCached - whether the indexes.dat is cached in memory.
@return the created address array
@throws Exception | [
"Creates",
"an",
"address",
"array",
"file",
"under",
"the",
"specified",
"home",
"directory",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/store/DynamicDataSet.java#L461-L468 | train |
jingwei/krati | krati-main/src/main/java/krati/store/DynamicDataSet.java | DynamicDataSet.canSplitOnCapacity | protected boolean canSplitOnCapacity() {
if(0 < _split) {
// The splitTo must NOT overflow the current capacity
int splitTo = _levelCapacity + _split;
if (capacity() > splitTo && splitTo >= _levelCapacity) {
return true;
}
}
return false;
} | java | protected boolean canSplitOnCapacity() {
if(0 < _split) {
// The splitTo must NOT overflow the current capacity
int splitTo = _levelCapacity + _split;
if (capacity() > splitTo && splitTo >= _levelCapacity) {
return true;
}
}
return false;
} | [
"protected",
"boolean",
"canSplitOnCapacity",
"(",
")",
"{",
"if",
"(",
"0",
"<",
"_split",
")",
"{",
"// The splitTo must NOT overflow the current capacity",
"int",
"splitTo",
"=",
"_levelCapacity",
"+",
"_split",
";",
"if",
"(",
"capacity",
"(",
")",
">",
"spl... | Perform split on the current capacity. | [
"Perform",
"split",
"on",
"the",
"current",
"capacity",
"."
] | 1ca0f994a7b0c8215b827eac9aaf95789ec08d21 | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/store/DynamicDataSet.java#L732-L742 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.