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
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java
AbstractAuditEventMessageImpl.addActiveParticipant
protected ActiveParticipantType addActiveParticipant(String userID, String altUserID, String userName, Boolean userIsRequestor, List<CodedValueType> roleIdCodes, String networkAccessPointID) { // Does lookup to see if using IP Address or hostname in Network Access Point ID return addActiveParticipant( userID, altUserID, userName, userIsRequestor, roleIdCodes, networkAccessPointID, getNetworkAccessPointCodeFromAddress(networkAccessPointID)); }
java
protected ActiveParticipantType addActiveParticipant(String userID, String altUserID, String userName, Boolean userIsRequestor, List<CodedValueType> roleIdCodes, String networkAccessPointID) { // Does lookup to see if using IP Address or hostname in Network Access Point ID return addActiveParticipant( userID, altUserID, userName, userIsRequestor, roleIdCodes, networkAccessPointID, getNetworkAccessPointCodeFromAddress(networkAccessPointID)); }
[ "protected", "ActiveParticipantType", "addActiveParticipant", "(", "String", "userID", ",", "String", "altUserID", ",", "String", "userName", ",", "Boolean", "userIsRequestor", ",", "List", "<", "CodedValueType", ">", "roleIdCodes", ",", "String", "networkAccessPointID"...
Create and add an Active Participant block to this audit event message but automatically determine the Network Access Point ID Type Code @param userID The Active Participant's UserID @param altUserID The Active Participant's Alternate UserID @param userName The Active Participant's UserName @param userIsRequestor Whether this Active Participant is a requestor @param roleIdCodes The Active Participant's Role Codes @param networkAccessPointID The Active Participant's Network Access Point ID (IP / Hostname) @return The Active Participant block created
[ "Create", "and", "add", "an", "Active", "Participant", "block", "to", "this", "audit", "event", "message", "but", "automatically", "determine", "the", "Network", "Access", "Point", "ID", "Type", "Code" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java#L388-L394
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java
AbstractAuditEventMessageImpl.getNetworkAccessPointCodeFromAddress
protected RFC3881NetworkAccessPointTypeCodes getNetworkAccessPointCodeFromAddress(String address) { if (EventUtils.isEmptyOrNull(address)) { return null; } if (address.matches("^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$")) { return RFC3881NetworkAccessPointTypeCodes.IP_ADDRESS; } return RFC3881NetworkAccessPointTypeCodes.MACHINE_NAME; }
java
protected RFC3881NetworkAccessPointTypeCodes getNetworkAccessPointCodeFromAddress(String address) { if (EventUtils.isEmptyOrNull(address)) { return null; } if (address.matches("^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$")) { return RFC3881NetworkAccessPointTypeCodes.IP_ADDRESS; } return RFC3881NetworkAccessPointTypeCodes.MACHINE_NAME; }
[ "protected", "RFC3881NetworkAccessPointTypeCodes", "getNetworkAccessPointCodeFromAddress", "(", "String", "address", ")", "{", "if", "(", "EventUtils", ".", "isEmptyOrNull", "(", "address", ")", ")", "{", "return", "null", ";", "}", "if", "(", "address", ".", "mat...
Attempt to determine the proper Active Participant Network Access Point Type Code from a given string. @param address Access point type code to look at @return An RFC 3881 Network Access Point Type Code
[ "Attempt", "to", "determine", "the", "proper", "Active", "Participant", "Network", "Access", "Point", "Type", "Code", "from", "a", "given", "string", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/AbstractAuditEventMessageImpl.java#L404-L414
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCPDInitiatingGatewayAuditor.java
XCPDInitiatingGatewayAuditor.getAuditor
public static XCPDInitiatingGatewayAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (XCPDInitiatingGatewayAuditor)ctx.getAuditor(XCPDInitiatingGatewayAuditor.class); }
java
public static XCPDInitiatingGatewayAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (XCPDInitiatingGatewayAuditor)ctx.getAuditor(XCPDInitiatingGatewayAuditor.class); }
[ "public", "static", "XCPDInitiatingGatewayAuditor", "getAuditor", "(", ")", "{", "AuditorModuleContext", "ctx", "=", "AuditorModuleContext", ".", "getContext", "(", ")", ";", "return", "(", "XCPDInitiatingGatewayAuditor", ")", "ctx", ".", "getAuditor", "(", "XCPDIniti...
Get an instance of the XCPD Initiating Gateway Auditor from the global context @return XCPD Initiating Gateway Auditor instance
[ "Get", "an", "instance", "of", "the", "XCPD", "Initiating", "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/XCPDInitiatingGatewayAuditor.java#L51-L55
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCPDInitiatingGatewayAuditor.java
XCPDInitiatingGatewayAuditor.auditXCPDQueryEvent
public void auditXCPDQueryEvent(RFC3881EventOutcomeCodes eventOutcome, String sourceUserId, String humanRequestorUserId, CodedValueType humanRequestorRoleIdCode, String XCPDRGUri, String homeCommunityId, String queryByParameter, List<CodedValueType> purposesOfUse) { if (!isAuditorEnabled()) { return; } QueryEvent queryEvent = new QueryEvent(true, eventOutcome, new IHETransactionEventTypeCodes.CrossGatewayPatientDiscovery(), purposesOfUse); // Add the source active participant queryEvent.addSourceActiveParticipant(sourceUserId, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); // if human requestor is not specified, try getting it from configuration if (EventUtils.isEmptyOrNull(humanRequestorUserId)){ humanRequestorUserId = getHumanRequestor(); } if (!EventUtils.isEmptyOrNull(humanRequestorUserId)){ queryEvent.addHumanRequestorActiveParticipant(humanRequestorUserId, null, null, humanRequestorRoleIdCode); } // Set the destination active participant queryEvent.addDestinationActiveParticipant(XCPDRGUri, null, null, EventUtils.getAddressForUrl(XCPDRGUri, false), false); // set the audit source queryEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); // add query parameters participant object byte[] queryByParameterBytes = null; if (queryByParameter != null) { try { queryByParameterBytes = queryByParameter.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { LOGGER.error("could not use UTF-8 encoding due to it being unsupported on this system, using system default which may cause problems downstream", e); queryByParameterBytes = queryByParameter.getBytes(); } } queryEvent.addQueryParticipantObject(null, homeCommunityId, queryByParameterBytes, null, new IHETransactionEventTypeCodes.CrossGatewayQuery()); audit(queryEvent); }
java
public void auditXCPDQueryEvent(RFC3881EventOutcomeCodes eventOutcome, String sourceUserId, String humanRequestorUserId, CodedValueType humanRequestorRoleIdCode, String XCPDRGUri, String homeCommunityId, String queryByParameter, List<CodedValueType> purposesOfUse) { if (!isAuditorEnabled()) { return; } QueryEvent queryEvent = new QueryEvent(true, eventOutcome, new IHETransactionEventTypeCodes.CrossGatewayPatientDiscovery(), purposesOfUse); // Add the source active participant queryEvent.addSourceActiveParticipant(sourceUserId, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); // if human requestor is not specified, try getting it from configuration if (EventUtils.isEmptyOrNull(humanRequestorUserId)){ humanRequestorUserId = getHumanRequestor(); } if (!EventUtils.isEmptyOrNull(humanRequestorUserId)){ queryEvent.addHumanRequestorActiveParticipant(humanRequestorUserId, null, null, humanRequestorRoleIdCode); } // Set the destination active participant queryEvent.addDestinationActiveParticipant(XCPDRGUri, null, null, EventUtils.getAddressForUrl(XCPDRGUri, false), false); // set the audit source queryEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); // add query parameters participant object byte[] queryByParameterBytes = null; if (queryByParameter != null) { try { queryByParameterBytes = queryByParameter.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { LOGGER.error("could not use UTF-8 encoding due to it being unsupported on this system, using system default which may cause problems downstream", e); queryByParameterBytes = queryByParameter.getBytes(); } } queryEvent.addQueryParticipantObject(null, homeCommunityId, queryByParameterBytes, null, new IHETransactionEventTypeCodes.CrossGatewayQuery()); audit(queryEvent); }
[ "public", "void", "auditXCPDQueryEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "sourceUserId", ",", "String", "humanRequestorUserId", ",", "CodedValueType", "humanRequestorRoleIdCode", ",", "String", "XCPDRGUri", ",", "String", "homeCommunityId", "...
Audits an ITI-55 Cross Gateway Patient Discovery event for XCPD Initiating Gateway actors. @param eventOutcome The event outcome indicator @param sourceUserId The user id of the source system calling the XCPD IG @param humanRequestorUserId Human requestor if known, null is ok here @param humanRequestorRoleIdCode CVT type to define the roll that gives this user access @param XCPDRGUri The URI of the XCPD Responding Gateway being accessed @param homeCommunityId the home community id of the source system (the caller, not the callee) @param queryByParameter a String containing the XML of the queryByParameter portion of the call
[ "Audits", "an", "ITI", "-", "55", "Cross", "Gateway", "Patient", "Discovery", "event", "for", "XCPD", "Initiating", "Gateway", "actors", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XCPDInitiatingGatewayAuditor.java#L70-L112
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/SVSConsumerAuditor.java
SVSConsumerAuditor.getAuditor
public static SVSConsumerAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (SVSConsumerAuditor)ctx.getAuditor(SVSConsumerAuditor.class); }
java
public static SVSConsumerAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (SVSConsumerAuditor)ctx.getAuditor(SVSConsumerAuditor.class); }
[ "public", "static", "SVSConsumerAuditor", "getAuditor", "(", ")", "{", "AuditorModuleContext", "ctx", "=", "AuditorModuleContext", ".", "getContext", "(", ")", ";", "return", "(", "SVSConsumerAuditor", ")", "ctx", ".", "getAuditor", "(", "SVSConsumerAuditor", ".", ...
Get an instance of the SVS Consumer Auditor from the global context @return SVS Consumer Auditor instance
[ "Get", "an", "instance", "of", "the", "SVS", "Consumer", "Auditor", "from", "the", "global", "context" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/SVSConsumerAuditor.java#L42-L46
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/SVSConsumerAuditor.java
SVSConsumerAuditor.auditRetrieveValueSetEvent
public void auditRetrieveValueSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String valueSetUniqueId, String valueSetName, String valueSetVersion, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveValueSet(), purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(EventUtils.getAddressForUrl(repositoryEndpointUri, false), null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); importEvent.addDestinationActiveParticipant(getSystemUserId(), getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(getHumanRequestor())) { importEvent.addHumanRequestorActiveParticipant(getHumanRequestor(), null, null, userRoles); } importEvent.addValueSetParticipantObject(valueSetUniqueId, valueSetName, valueSetVersion); audit(importEvent); }
java
public void auditRetrieveValueSetEvent(RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String valueSetUniqueId, String valueSetName, String valueSetVersion, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { if (!isAuditorEnabled()) { return; } ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveValueSet(), purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(EventUtils.getAddressForUrl(repositoryEndpointUri, false), null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); importEvent.addDestinationActiveParticipant(getSystemUserId(), getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(getHumanRequestor())) { importEvent.addHumanRequestorActiveParticipant(getHumanRequestor(), null, null, userRoles); } importEvent.addValueSetParticipantObject(valueSetUniqueId, valueSetName, valueSetVersion); audit(importEvent); }
[ "public", "void", "auditRetrieveValueSetEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "repositoryEndpointUri", ",", "String", "valueSetUniqueId", ",", "String", "valueSetName", ",", "String", "valueSetVersion", ",", "List", "<", "CodedValueType", ...
Audits an ITI-48 Retrieve Value Set event for SVS Consumer actors. @param eventOutcome The event outcome indicator @param repositoryEndpointUri The Web service endpoint URI for the SVS repository @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 @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", "-", "48", "Retrieve", "Value", "Set", "event", "for", "SVS", "Consumer", "actors", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/SVSConsumerAuditor.java#L59-L78
train
jingwei/krati
krati-main/src/examples/java/krati/examples/KratiDataStore.java
KratiDataStore.main
public static void main(String[] args) { try { // Parse arguments: homeDir keyCount File homeDir = new File(args[0]); int initialCapacity = Integer.parseInt(args[1]); // Create an instance of Krati DataStore KratiDataStore store = new KratiDataStore(homeDir, initialCapacity); // Populate data store store.populate(); // Perform some random reads from data store. store.doRandomReads(10); // Close data store store.close(); } catch (Exception e) { e.printStackTrace(); } }
java
public static void main(String[] args) { try { // Parse arguments: homeDir keyCount File homeDir = new File(args[0]); int initialCapacity = Integer.parseInt(args[1]); // Create an instance of Krati DataStore KratiDataStore store = new KratiDataStore(homeDir, initialCapacity); // Populate data store store.populate(); // Perform some random reads from data store. store.doRandomReads(10); // Close data store store.close(); } catch (Exception e) { e.printStackTrace(); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "try", "{", "// Parse arguments: homeDir keyCount", "File", "homeDir", "=", "new", "File", "(", "args", "[", "0", "]", ")", ";", "int", "initialCapacity", "=", "Integer", ".", ...
java -Xmx4G krati.examples.KratiDataStore homeDir initialCapacity
[ "java", "-", "Xmx4G", "krati", ".", "examples", ".", "KratiDataStore", "homeDir", "initialCapacity" ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/examples/java/krati/examples/KratiDataStore.java#L142-L162
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/RFC5424SyslogSenderImpl.java
RFC5424SyslogSenderImpl.getTransportPayload
protected byte[] getTransportPayload(AuditEventMessage msg) throws UnsupportedEncodingException { if (msg == null) { return null; } byte[] msgBytes = msg.getSerializedMessage(false); if (EventUtils.isEmptyOrNull(msgBytes)) { return null; } // Format message with transport-specific headers StringBuilder sb = new StringBuilder(); // The breakdown of the ABNF definition of the message are included as comments //PRI sb.append("<"); sb.append(TRANSPORT_DEFAULT_PRIORITY); sb.append(">"); //VERSION SP ; the two together since this is a defined value for this header sb.append("1 "); //TIMESTAMP SP sb.append(TimestampUtils.getRFC3881Timestamp(msg.getDateTime())); sb.append(" "); //HOSTNAME SP sb.append(getSystemHostName()); sb.append(" "); //APP-NAME SP; SHOULD identify the device or application that originated the message sb.append(TRANSPORT_DEFAULT_APP); sb.append(" "); //PROCID SP; a change in this value indicates a discontinuity in the syslog stream // ; often the process name or process ID associated with a syslog system is used sb.append(getPROCID()); sb.append(" "); //MSGID SP; SHOULD identify the type of message sb.append(TRANSPORT_DEFAULT_MSGID); //sb.append(" "); // added to next string //STRUCTURED-DATA sb.append(" - "); // this is the nil value, since IHE ATNA does not use it //SP MSG //sb.append(" "); // added to previous string //sb.append("<?xml version=\"1.0\" encoding=\"ASCII\"?>"); // If just ASCII alternative /* UTF 8 alternate from Dmytro Rud */ // BOM for UTF-8 //sb.append("\u00EF\u00BB\u00BF"); sb.append("\uFEFF"); // recommended by Jeremy Huiskamp, over the wire result is EF BB EF as I think it should be sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); /* end UTF 8 alternative*/ // remainder of XML payload sb.append(new String(msgBytes, "UTF-8")); return sb.toString().trim().getBytes("UTF-8"); }
java
protected byte[] getTransportPayload(AuditEventMessage msg) throws UnsupportedEncodingException { if (msg == null) { return null; } byte[] msgBytes = msg.getSerializedMessage(false); if (EventUtils.isEmptyOrNull(msgBytes)) { return null; } // Format message with transport-specific headers StringBuilder sb = new StringBuilder(); // The breakdown of the ABNF definition of the message are included as comments //PRI sb.append("<"); sb.append(TRANSPORT_DEFAULT_PRIORITY); sb.append(">"); //VERSION SP ; the two together since this is a defined value for this header sb.append("1 "); //TIMESTAMP SP sb.append(TimestampUtils.getRFC3881Timestamp(msg.getDateTime())); sb.append(" "); //HOSTNAME SP sb.append(getSystemHostName()); sb.append(" "); //APP-NAME SP; SHOULD identify the device or application that originated the message sb.append(TRANSPORT_DEFAULT_APP); sb.append(" "); //PROCID SP; a change in this value indicates a discontinuity in the syslog stream // ; often the process name or process ID associated with a syslog system is used sb.append(getPROCID()); sb.append(" "); //MSGID SP; SHOULD identify the type of message sb.append(TRANSPORT_DEFAULT_MSGID); //sb.append(" "); // added to next string //STRUCTURED-DATA sb.append(" - "); // this is the nil value, since IHE ATNA does not use it //SP MSG //sb.append(" "); // added to previous string //sb.append("<?xml version=\"1.0\" encoding=\"ASCII\"?>"); // If just ASCII alternative /* UTF 8 alternate from Dmytro Rud */ // BOM for UTF-8 //sb.append("\u00EF\u00BB\u00BF"); sb.append("\uFEFF"); // recommended by Jeremy Huiskamp, over the wire result is EF BB EF as I think it should be sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); /* end UTF 8 alternative*/ // remainder of XML payload sb.append(new String(msgBytes, "UTF-8")); return sb.toString().trim().getBytes("UTF-8"); }
[ "protected", "byte", "[", "]", "getTransportPayload", "(", "AuditEventMessage", "msg", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "msg", "==", "null", ")", "{", "return", "null", ";", "}", "byte", "[", "]", "msgBytes", "=", "msg", ".", ...
Serialize, format, and prepare the message payload body for sending by this transport. This includes adding the syslog message header, which is transport independent. @param msg Message to prepare @return Buffer to send
[ "Serialize", "format", "and", "prepare", "the", "message", "payload", "body", "for", "sending", "by", "this", "transport", ".", "This", "includes", "adding", "the", "syslog", "message", "header", "which", "is", "transport", "independent", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/RFC5424SyslogSenderImpl.java#L88-L142
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/RFC5424SyslogSenderImpl.java
RFC5424SyslogSenderImpl.getSystemHostName
private String getSystemHostName() { if (EventUtils.isEmptyOrNull(systemHostName)) { try { systemHostName = InetAddress.getLocalHost().getHostName(); } catch (Throwable t) { systemHostName = "localhost"; } } return systemHostName; }
java
private String getSystemHostName() { if (EventUtils.isEmptyOrNull(systemHostName)) { try { systemHostName = InetAddress.getLocalHost().getHostName(); } catch (Throwable t) { systemHostName = "localhost"; } } return systemHostName; }
[ "private", "String", "getSystemHostName", "(", ")", "{", "if", "(", "EventUtils", ".", "isEmptyOrNull", "(", "systemHostName", ")", ")", "{", "try", "{", "systemHostName", "=", "InetAddress", ".", "getLocalHost", "(", ")", ".", "getHostName", "(", ")", ";", ...
Gets the hostname of the system managing this transport @return The system's hostname
[ "Gets", "the", "hostname", "of", "the", "system", "managing", "this", "transport" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/RFC5424SyslogSenderImpl.java#L148-L158
train
jingwei/krati
krati-main/src/main/java/krati/util/JenkinsHashFunction.java
JenkinsHashFunction.fourByteToLong
private long fourByteToLong(byte[] bytes, int offset) { return (byteToLong(bytes[offset + 0]) + (byteToLong(bytes[offset + 1]) << 8) + (byteToLong(bytes[offset + 2]) << 16) + (byteToLong(bytes[offset + 3]) << 24)); }
java
private long fourByteToLong(byte[] bytes, int offset) { return (byteToLong(bytes[offset + 0]) + (byteToLong(bytes[offset + 1]) << 8) + (byteToLong(bytes[offset + 2]) << 16) + (byteToLong(bytes[offset + 3]) << 24)); }
[ "private", "long", "fourByteToLong", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ")", "{", "return", "(", "byteToLong", "(", "bytes", "[", "offset", "+", "0", "]", ")", "+", "(", "byteToLong", "(", "bytes", "[", "offset", "+", "1", "]", "...
Convert 4 bytes from the buffer at offset into a long value.
[ "Convert", "4", "bytes", "from", "the", "buffer", "at", "offset", "into", "a", "long", "value", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/JenkinsHashFunction.java#L82-L87
train
jingwei/krati
krati-main/src/main/java/krati/util/JenkinsHashFunction.java
JenkinsHashFunction.hashMix
private void hashMix() { a = subtract(a, b); a = subtract(a, c); a = xor(a, c >> 13); b = subtract(b, c); b = subtract(b, a); b = xor(b, leftShift(a, 8)); c = subtract(c, a); c = subtract(c, b); c = xor(c, (b >> 13)); a = subtract(a, b); a = subtract(a, c); a = xor(a, (c >> 12)); b = subtract(b, c); b = subtract(b, a); b = xor(b, leftShift(a, 16)); c = subtract(c, a); c = subtract(c, b); c = xor(c, (b >> 5)); a = subtract(a, b); a = subtract(a, c); a = xor(a, (c >> 3)); b = subtract(b, c); b = subtract(b, a); b = xor(b, leftShift(a, 10)); c = subtract(c, a); c = subtract(c, b); c = xor(c, (b >> 15)); }
java
private void hashMix() { a = subtract(a, b); a = subtract(a, c); a = xor(a, c >> 13); b = subtract(b, c); b = subtract(b, a); b = xor(b, leftShift(a, 8)); c = subtract(c, a); c = subtract(c, b); c = xor(c, (b >> 13)); a = subtract(a, b); a = subtract(a, c); a = xor(a, (c >> 12)); b = subtract(b, c); b = subtract(b, a); b = xor(b, leftShift(a, 16)); c = subtract(c, a); c = subtract(c, b); c = xor(c, (b >> 5)); a = subtract(a, b); a = subtract(a, c); a = xor(a, (c >> 3)); b = subtract(b, c); b = subtract(b, a); b = xor(b, leftShift(a, 10)); c = subtract(c, a); c = subtract(c, b); c = xor(c, (b >> 15)); }
[ "private", "void", "hashMix", "(", ")", "{", "a", "=", "subtract", "(", "a", ",", "b", ")", ";", "a", "=", "subtract", "(", "a", ",", "c", ")", ";", "a", "=", "xor", "(", "a", ",", "c", ">>", "13", ")", ";", "b", "=", "subtract", "(", "b"...
Mix up the values in the hash function.
[ "Mix", "up", "the", "values", "in", "the", "hash", "function", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/JenkinsHashFunction.java#L92-L102
train
jingwei/krati
krati-main/src/main/java/krati/util/JenkinsHashFunction.java
JenkinsHashFunction.hash
public long hash(byte[] buffer, long initialValue) { int len, pos; // set up the internal state // the golden ratio; an arbitrary value a = 0x09e3779b9L; // the golden ratio; an arbitrary value b = 0x09e3779b9L; // the previous hash value c = initialValue; // handle most of the key pos = 0; for (len = buffer.length; len >=12; len -= 12) { a = add(a, fourByteToLong(buffer, pos)); b = add(b, fourByteToLong(buffer, pos + 4)); c = add(c, fourByteToLong(buffer, pos + 8)); hashMix(); pos += 12; } c += buffer.length; // all the case statements fall through to the next on purpose switch(len) { case 11: c = add(c, leftShift(byteToLong(buffer[pos + 10]), 24)); case 10: c = add(c, leftShift(byteToLong(buffer[pos + 9]), 16)); case 9: c = add(c, leftShift(byteToLong(buffer[pos + 8]), 8)); // the first byte of c is reserved for the length case 8: b = add(b, leftShift(byteToLong(buffer[pos + 7]), 24)); case 7: b = add(b, leftShift(byteToLong(buffer[pos + 6]), 16)); case 6: b = add(b, leftShift(byteToLong(buffer[pos + 5]), 8)); case 5: b = add(b, byteToLong(buffer[pos + 4])); case 4: a = add(a, leftShift(byteToLong(buffer[pos + 3]), 24)); case 3: a = add(a, leftShift(byteToLong(buffer[pos + 2]), 16)); case 2: a = add(a, leftShift(byteToLong(buffer[pos + 1]), 8)); case 1: a = add(a, byteToLong(buffer[pos + 0])); // case 0: nothing left to add } hashMix(); return c; }
java
public long hash(byte[] buffer, long initialValue) { int len, pos; // set up the internal state // the golden ratio; an arbitrary value a = 0x09e3779b9L; // the golden ratio; an arbitrary value b = 0x09e3779b9L; // the previous hash value c = initialValue; // handle most of the key pos = 0; for (len = buffer.length; len >=12; len -= 12) { a = add(a, fourByteToLong(buffer, pos)); b = add(b, fourByteToLong(buffer, pos + 4)); c = add(c, fourByteToLong(buffer, pos + 8)); hashMix(); pos += 12; } c += buffer.length; // all the case statements fall through to the next on purpose switch(len) { case 11: c = add(c, leftShift(byteToLong(buffer[pos + 10]), 24)); case 10: c = add(c, leftShift(byteToLong(buffer[pos + 9]), 16)); case 9: c = add(c, leftShift(byteToLong(buffer[pos + 8]), 8)); // the first byte of c is reserved for the length case 8: b = add(b, leftShift(byteToLong(buffer[pos + 7]), 24)); case 7: b = add(b, leftShift(byteToLong(buffer[pos + 6]), 16)); case 6: b = add(b, leftShift(byteToLong(buffer[pos + 5]), 8)); case 5: b = add(b, byteToLong(buffer[pos + 4])); case 4: a = add(a, leftShift(byteToLong(buffer[pos + 3]), 24)); case 3: a = add(a, leftShift(byteToLong(buffer[pos + 2]), 16)); case 2: a = add(a, leftShift(byteToLong(buffer[pos + 1]), 8)); case 1: a = add(a, byteToLong(buffer[pos + 0])); // case 0: nothing left to add } hashMix(); return c; }
[ "public", "long", "hash", "(", "byte", "[", "]", "buffer", ",", "long", "initialValue", ")", "{", "int", "len", ",", "pos", ";", "// set up the internal state", "// the golden ratio; an arbitrary value", "a", "=", "0x09e3779b9", "", "L", ";", "// the golden ratio;...
Hash a variable-length key into a 32-bit value. Every bit of the key affects every bit of the return value. Every 1-bit and 2-bit delta achieves avalanche. The best hash table sizes are powers of 2. @param buffer Byte array that we are hashing on. @param initialValue Initial value of the hash if we are continuing from a previous run. 0 if none. @return Hash value for the buffer.
[ "Hash", "a", "variable", "-", "length", "key", "into", "a", "32", "-", "bit", "value", ".", "Every", "bit", "of", "the", "key", "affects", "every", "bit", "of", "the", "return", "value", ".", "Every", "1", "-", "bit", "and", "2", "-", "bit", "delta...
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/JenkinsHashFunction.java#L114-L167
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.createXmlSchemaComplexType
public XmlSchemaComplexType createXmlSchemaComplexType( final XsdDataItem xsdDataItem) { // All complex types are root complex types XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType( getXsd(), true); XmlSchemaChoice xmlSchemaChoice = null; XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence(); for (XsdDataItem child : xsdDataItem.getChildren()) { XmlSchemaElement xmlSchemaElement = createXmlSchemaElement(child); if (xmlSchemaElement != null) { if (child.isRedefined()) { xmlSchemaChoice = new XmlSchemaChoice(); xmlSchemaSequence.getItems().add(xmlSchemaChoice); xmlSchemaChoice.getItems().add(xmlSchemaElement); } else if (child.getRedefines() != null) { if (xmlSchemaChoice == null) { _log.warn("Item " + child.getCobolName() + " REDEFINES " + child.getRedefines() + " but redefined item is not a sibling"); xmlSchemaSequence.getItems().add(xmlSchemaElement); } else { xmlSchemaChoice.getItems().add(xmlSchemaElement); } } else { xmlSchemaSequence.getItems().add(xmlSchemaElement); } } } xmlSchemaComplexType.setParticle(xmlSchemaSequence); xmlSchemaComplexType.setName(xsdDataItem.getXsdTypeName()); return xmlSchemaComplexType; }
java
public XmlSchemaComplexType createXmlSchemaComplexType( final XsdDataItem xsdDataItem) { // All complex types are root complex types XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType( getXsd(), true); XmlSchemaChoice xmlSchemaChoice = null; XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence(); for (XsdDataItem child : xsdDataItem.getChildren()) { XmlSchemaElement xmlSchemaElement = createXmlSchemaElement(child); if (xmlSchemaElement != null) { if (child.isRedefined()) { xmlSchemaChoice = new XmlSchemaChoice(); xmlSchemaSequence.getItems().add(xmlSchemaChoice); xmlSchemaChoice.getItems().add(xmlSchemaElement); } else if (child.getRedefines() != null) { if (xmlSchemaChoice == null) { _log.warn("Item " + child.getCobolName() + " REDEFINES " + child.getRedefines() + " but redefined item is not a sibling"); xmlSchemaSequence.getItems().add(xmlSchemaElement); } else { xmlSchemaChoice.getItems().add(xmlSchemaElement); } } else { xmlSchemaSequence.getItems().add(xmlSchemaElement); } } } xmlSchemaComplexType.setParticle(xmlSchemaSequence); xmlSchemaComplexType.setName(xsdDataItem.getXsdTypeName()); return xmlSchemaComplexType; }
[ "public", "XmlSchemaComplexType", "createXmlSchemaComplexType", "(", "final", "XsdDataItem", "xsdDataItem", ")", "{", "// All complex types are root complex types", "XmlSchemaComplexType", "xmlSchemaComplexType", "=", "new", "XmlSchemaComplexType", "(", "getXsd", "(", ")", ",",...
Create an XML schema complex type. We want to use Named complex types so we add them to the XSD directly. We add complex types before their children because its nicer for the XSD layout to list roots before leafs. Redefined and redefining elements are grouped into an XML Schema choice. A choice is created when an element marked as isRedefined is encountered and it groups all subsequent elements marked as redefines until a non redefining element is found. @param xsdDataItem COBOL data item decorated with XSD attributes @return a new complex type
[ "Create", "an", "XML", "schema", "complex", "type", ".", "We", "want", "to", "use", "Named", "complex", "types", "so", "we", "add", "them", "to", "the", "XSD", "directly", ".", "We", "add", "complex", "types", "before", "their", "children", "because", "i...
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L141-L177
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.createXmlSchemaElement
public XmlSchemaElement createXmlSchemaElement(final XsdDataItem xsdDataItem) { // Let call add root elements if he needs to so for now pretend this is // not a root element XmlSchemaElement element = new XmlSchemaElement(getXsd(), false); element.setName(xsdDataItem.getXsdElementName()); if (xsdDataItem.getMaxOccurs() != 1) { element.setMaxOccurs(xsdDataItem.getMaxOccurs()); } if (xsdDataItem.getMinOccurs() != 1) { element.setMinOccurs(xsdDataItem.getMinOccurs()); } /* * Create this element schema type, then if its a simple type set it as * an anonymous type. Otherwise, it is a named complex type, so * reference it by name. */ XmlSchemaType xmlSchemaType = createXmlSchemaType(xsdDataItem); if (xmlSchemaType == null) { return null; } if (xmlSchemaType instanceof XmlSchemaSimpleType) { element.setSchemaType(xmlSchemaType); } else { element.setSchemaTypeName(xmlSchemaType.getQName()); } if (getConfig().addLegStarAnnotations()) { element.setAnnotation(_annotationEmitter .createLegStarAnnotation(xsdDataItem)); } return element; }
java
public XmlSchemaElement createXmlSchemaElement(final XsdDataItem xsdDataItem) { // Let call add root elements if he needs to so for now pretend this is // not a root element XmlSchemaElement element = new XmlSchemaElement(getXsd(), false); element.setName(xsdDataItem.getXsdElementName()); if (xsdDataItem.getMaxOccurs() != 1) { element.setMaxOccurs(xsdDataItem.getMaxOccurs()); } if (xsdDataItem.getMinOccurs() != 1) { element.setMinOccurs(xsdDataItem.getMinOccurs()); } /* * Create this element schema type, then if its a simple type set it as * an anonymous type. Otherwise, it is a named complex type, so * reference it by name. */ XmlSchemaType xmlSchemaType = createXmlSchemaType(xsdDataItem); if (xmlSchemaType == null) { return null; } if (xmlSchemaType instanceof XmlSchemaSimpleType) { element.setSchemaType(xmlSchemaType); } else { element.setSchemaTypeName(xmlSchemaType.getQName()); } if (getConfig().addLegStarAnnotations()) { element.setAnnotation(_annotationEmitter .createLegStarAnnotation(xsdDataItem)); } return element; }
[ "public", "XmlSchemaElement", "createXmlSchemaElement", "(", "final", "XsdDataItem", "xsdDataItem", ")", "{", "// Let call add root elements if he needs to so for now pretend this is", "// not a root element", "XmlSchemaElement", "element", "=", "new", "XmlSchemaElement", "(", "get...
Create an XML Schema element from a COBOL data item. @param xsdDataItem COBOL data item decorated with XSD attributes @return the XML schema element
[ "Create", "an", "XML", "Schema", "element", "from", "a", "COBOL", "data", "item", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L185-L217
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.addEnumerationFacets
protected void addEnumerationFacets(final XsdDataItem xsdDataItem, final XmlSchemaSimpleTypeRestriction restriction) { if (getConfig().mapConditionsToFacets()) { boolean hasValueThru = false; for (XsdDataItem child : xsdDataItem.getChildren()) { if (child.getDataEntryType() == DataEntryType.CONDITION) { for (String conditionValue : child.getConditionLiterals()) { restriction.getFacets().add( createEnumerationFacet(ValueUtil .resolveFigurative(conditionValue, xsdDataItem .getMaxStorageLength(), getConfig().quoteIsQuote()))); } for (Range conditionRange : child.getConditionRanges()) { if (hasValueThru) { _log.warn(xsdDataItem.getCobolName() + " has several VALUE THRU statements." + " Cannot translate to XSD." + " Only the first one will be converted." + " Ignoring: " + conditionRange.toString()); break; } restriction.getFacets().add( createMinInclusiveFacet(ValueUtil .resolveFigurative(conditionRange .getFrom(), xsdDataItem .getMaxStorageLength(), getConfig().quoteIsQuote()))); restriction.getFacets().add( createMaxInclusiveFacet(ValueUtil .resolveFigurative(conditionRange .getTo(), xsdDataItem .getMaxStorageLength(), getConfig().quoteIsQuote()))); hasValueThru = true; } } } } }
java
protected void addEnumerationFacets(final XsdDataItem xsdDataItem, final XmlSchemaSimpleTypeRestriction restriction) { if (getConfig().mapConditionsToFacets()) { boolean hasValueThru = false; for (XsdDataItem child : xsdDataItem.getChildren()) { if (child.getDataEntryType() == DataEntryType.CONDITION) { for (String conditionValue : child.getConditionLiterals()) { restriction.getFacets().add( createEnumerationFacet(ValueUtil .resolveFigurative(conditionValue, xsdDataItem .getMaxStorageLength(), getConfig().quoteIsQuote()))); } for (Range conditionRange : child.getConditionRanges()) { if (hasValueThru) { _log.warn(xsdDataItem.getCobolName() + " has several VALUE THRU statements." + " Cannot translate to XSD." + " Only the first one will be converted." + " Ignoring: " + conditionRange.toString()); break; } restriction.getFacets().add( createMinInclusiveFacet(ValueUtil .resolveFigurative(conditionRange .getFrom(), xsdDataItem .getMaxStorageLength(), getConfig().quoteIsQuote()))); restriction.getFacets().add( createMaxInclusiveFacet(ValueUtil .resolveFigurative(conditionRange .getTo(), xsdDataItem .getMaxStorageLength(), getConfig().quoteIsQuote()))); hasValueThru = true; } } } } }
[ "protected", "void", "addEnumerationFacets", "(", "final", "XsdDataItem", "xsdDataItem", ",", "final", "XmlSchemaSimpleTypeRestriction", "restriction", ")", "{", "if", "(", "getConfig", "(", ")", ".", "mapConditionsToFacets", "(", ")", ")", "{", "boolean", "hasValue...
If simple type has conditions attached to it, emit enumeration facets. @param xsdDataItem COBOL data item decorated with XSD attributes @param restriction the current set of constraints
[ "If", "simple", "type", "has", "conditions", "attached", "to", "it", "emit", "enumeration", "facets", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L313-L354
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.createXmlSchemaSimpleType
protected XmlSchemaSimpleType createXmlSchemaSimpleType( final XmlSchemaSimpleTypeRestriction restriction) { XmlSchemaSimpleType xmlSchemaSimpleType = new XmlSchemaSimpleType( getXsd(), false); xmlSchemaSimpleType.setContent(restriction); return xmlSchemaSimpleType; }
java
protected XmlSchemaSimpleType createXmlSchemaSimpleType( final XmlSchemaSimpleTypeRestriction restriction) { XmlSchemaSimpleType xmlSchemaSimpleType = new XmlSchemaSimpleType( getXsd(), false); xmlSchemaSimpleType.setContent(restriction); return xmlSchemaSimpleType; }
[ "protected", "XmlSchemaSimpleType", "createXmlSchemaSimpleType", "(", "final", "XmlSchemaSimpleTypeRestriction", "restriction", ")", "{", "XmlSchemaSimpleType", "xmlSchemaSimpleType", "=", "new", "XmlSchemaSimpleType", "(", "getXsd", "(", ")", ",", "false", ")", ";", "xml...
Create an XML schema simple type from a restriction. @param restriction the XML schema restriction @return the XML schema simple type
[ "Create", "an", "XML", "schema", "simple", "type", "from", "a", "restriction", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L362-L368
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.createRestriction
protected XmlSchemaSimpleTypeRestriction createRestriction( final String xsdTypeName) { XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(new QName( XMLConstants.W3C_XML_SCHEMA_NS_URI, xsdTypeName)); return restriction; }
java
protected XmlSchemaSimpleTypeRestriction createRestriction( final String xsdTypeName) { XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(new QName( XMLConstants.W3C_XML_SCHEMA_NS_URI, xsdTypeName)); return restriction; }
[ "protected", "XmlSchemaSimpleTypeRestriction", "createRestriction", "(", "final", "String", "xsdTypeName", ")", "{", "XmlSchemaSimpleTypeRestriction", "restriction", "=", "new", "XmlSchemaSimpleTypeRestriction", "(", ")", ";", "restriction", ".", "setBaseTypeName", "(", "ne...
Create an XML schema restriction. @param xsdTypeName the XML schema built-in type name to use as a restriction @return an XML schema restriction
[ "Create", "an", "XML", "schema", "restriction", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L377-L383
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.createMaxLengthFacet
protected XmlSchemaMaxLengthFacet createMaxLengthFacet(final int length) { XmlSchemaMaxLengthFacet xmlSchemaMaxLengthFacet = new XmlSchemaMaxLengthFacet(); xmlSchemaMaxLengthFacet.setValue(length); return xmlSchemaMaxLengthFacet; }
java
protected XmlSchemaMaxLengthFacet createMaxLengthFacet(final int length) { XmlSchemaMaxLengthFacet xmlSchemaMaxLengthFacet = new XmlSchemaMaxLengthFacet(); xmlSchemaMaxLengthFacet.setValue(length); return xmlSchemaMaxLengthFacet; }
[ "protected", "XmlSchemaMaxLengthFacet", "createMaxLengthFacet", "(", "final", "int", "length", ")", "{", "XmlSchemaMaxLengthFacet", "xmlSchemaMaxLengthFacet", "=", "new", "XmlSchemaMaxLengthFacet", "(", ")", ";", "xmlSchemaMaxLengthFacet", ".", "setValue", "(", "length", ...
Create an XML schema maxLength facet. @param length the value to set @return an XML schema length facet
[ "Create", "an", "XML", "schema", "maxLength", "facet", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L391-L395
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.createPatternFacet
protected XmlSchemaPatternFacet createPatternFacet(final String pattern) { XmlSchemaPatternFacet xmlSchemaPatternFacet = new XmlSchemaPatternFacet(); xmlSchemaPatternFacet.setValue(pattern); return xmlSchemaPatternFacet; }
java
protected XmlSchemaPatternFacet createPatternFacet(final String pattern) { XmlSchemaPatternFacet xmlSchemaPatternFacet = new XmlSchemaPatternFacet(); xmlSchemaPatternFacet.setValue(pattern); return xmlSchemaPatternFacet; }
[ "protected", "XmlSchemaPatternFacet", "createPatternFacet", "(", "final", "String", "pattern", ")", "{", "XmlSchemaPatternFacet", "xmlSchemaPatternFacet", "=", "new", "XmlSchemaPatternFacet", "(", ")", ";", "xmlSchemaPatternFacet", ".", "setValue", "(", "pattern", ")", ...
Create an XML schema pattern facet. @param pattern the value to set @return an XML schema pattern facet
[ "Create", "an", "XML", "schema", "pattern", "facet", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L403-L407
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.createEnumerationFacet
protected XmlSchemaEnumerationFacet createEnumerationFacet( final String conditionValue) { XmlSchemaEnumerationFacet xmlSchemaEnumerationFacet = new XmlSchemaEnumerationFacet(); xmlSchemaEnumerationFacet.setValue(conditionValue); return xmlSchemaEnumerationFacet; }
java
protected XmlSchemaEnumerationFacet createEnumerationFacet( final String conditionValue) { XmlSchemaEnumerationFacet xmlSchemaEnumerationFacet = new XmlSchemaEnumerationFacet(); xmlSchemaEnumerationFacet.setValue(conditionValue); return xmlSchemaEnumerationFacet; }
[ "protected", "XmlSchemaEnumerationFacet", "createEnumerationFacet", "(", "final", "String", "conditionValue", ")", "{", "XmlSchemaEnumerationFacet", "xmlSchemaEnumerationFacet", "=", "new", "XmlSchemaEnumerationFacet", "(", ")", ";", "xmlSchemaEnumerationFacet", ".", "setValue"...
Create an XML schema enumeration facet. @param conditionValue the value to set @return an XML schema enumeration facet
[ "Create", "an", "XML", "schema", "enumeration", "facet", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L415-L420
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.createTotalDigitsFacet
protected XmlSchemaTotalDigitsFacet createTotalDigitsFacet( final int totalDigits) { XmlSchemaTotalDigitsFacet xmlSchemaTotalDigitsFacet = new XmlSchemaTotalDigitsFacet(); xmlSchemaTotalDigitsFacet.setValue(totalDigits); return xmlSchemaTotalDigitsFacet; }
java
protected XmlSchemaTotalDigitsFacet createTotalDigitsFacet( final int totalDigits) { XmlSchemaTotalDigitsFacet xmlSchemaTotalDigitsFacet = new XmlSchemaTotalDigitsFacet(); xmlSchemaTotalDigitsFacet.setValue(totalDigits); return xmlSchemaTotalDigitsFacet; }
[ "protected", "XmlSchemaTotalDigitsFacet", "createTotalDigitsFacet", "(", "final", "int", "totalDigits", ")", "{", "XmlSchemaTotalDigitsFacet", "xmlSchemaTotalDigitsFacet", "=", "new", "XmlSchemaTotalDigitsFacet", "(", ")", ";", "xmlSchemaTotalDigitsFacet", ".", "setValue", "(...
Create an XML schema totalDigits facet. @param totalDigits the value to set @return an XML schema totalDigits facet
[ "Create", "an", "XML", "schema", "totalDigits", "facet", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L428-L433
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.createFractionDigitsFacet
protected XmlSchemaFractionDigitsFacet createFractionDigitsFacet( final int fractionDigits) { XmlSchemaFractionDigitsFacet xmlSchemaFractionDigitsFacet = new XmlSchemaFractionDigitsFacet(); xmlSchemaFractionDigitsFacet.setValue(fractionDigits); return xmlSchemaFractionDigitsFacet; }
java
protected XmlSchemaFractionDigitsFacet createFractionDigitsFacet( final int fractionDigits) { XmlSchemaFractionDigitsFacet xmlSchemaFractionDigitsFacet = new XmlSchemaFractionDigitsFacet(); xmlSchemaFractionDigitsFacet.setValue(fractionDigits); return xmlSchemaFractionDigitsFacet; }
[ "protected", "XmlSchemaFractionDigitsFacet", "createFractionDigitsFacet", "(", "final", "int", "fractionDigits", ")", "{", "XmlSchemaFractionDigitsFacet", "xmlSchemaFractionDigitsFacet", "=", "new", "XmlSchemaFractionDigitsFacet", "(", ")", ";", "xmlSchemaFractionDigitsFacet", "....
Create an XML schema fractionDigits facet. @param fractionDigits the value to set @return an XML schema fractionDigits facet
[ "Create", "an", "XML", "schema", "fractionDigits", "facet", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L441-L446
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.createMinInclusiveFacet
protected XmlSchemaMinInclusiveFacet createMinInclusiveFacet( final String minInclusive) { XmlSchemaMinInclusiveFacet xmlSchemaMinInclusiveFacet = new XmlSchemaMinInclusiveFacet(); xmlSchemaMinInclusiveFacet.setValue(minInclusive); return xmlSchemaMinInclusiveFacet; }
java
protected XmlSchemaMinInclusiveFacet createMinInclusiveFacet( final String minInclusive) { XmlSchemaMinInclusiveFacet xmlSchemaMinInclusiveFacet = new XmlSchemaMinInclusiveFacet(); xmlSchemaMinInclusiveFacet.setValue(minInclusive); return xmlSchemaMinInclusiveFacet; }
[ "protected", "XmlSchemaMinInclusiveFacet", "createMinInclusiveFacet", "(", "final", "String", "minInclusive", ")", "{", "XmlSchemaMinInclusiveFacet", "xmlSchemaMinInclusiveFacet", "=", "new", "XmlSchemaMinInclusiveFacet", "(", ")", ";", "xmlSchemaMinInclusiveFacet", ".", "setVa...
Create an XML schema minInclusive facet. @param minInclusive the value to set @return an XML schema minInclusive facet
[ "Create", "an", "XML", "schema", "minInclusive", "facet", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L454-L459
train
legsem/legstar-core2
legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java
XsdEmitter.createMaxInclusiveFacet
protected XmlSchemaMaxInclusiveFacet createMaxInclusiveFacet( final String maxInclusive) { XmlSchemaMaxInclusiveFacet xmlSchemaMaxInclusiveFacet = new XmlSchemaMaxInclusiveFacet(); xmlSchemaMaxInclusiveFacet.setValue(maxInclusive); return xmlSchemaMaxInclusiveFacet; }
java
protected XmlSchemaMaxInclusiveFacet createMaxInclusiveFacet( final String maxInclusive) { XmlSchemaMaxInclusiveFacet xmlSchemaMaxInclusiveFacet = new XmlSchemaMaxInclusiveFacet(); xmlSchemaMaxInclusiveFacet.setValue(maxInclusive); return xmlSchemaMaxInclusiveFacet; }
[ "protected", "XmlSchemaMaxInclusiveFacet", "createMaxInclusiveFacet", "(", "final", "String", "maxInclusive", ")", "{", "XmlSchemaMaxInclusiveFacet", "xmlSchemaMaxInclusiveFacet", "=", "new", "XmlSchemaMaxInclusiveFacet", "(", ")", ";", "xmlSchemaMaxInclusiveFacet", ".", "setVa...
Create an XML schema maxInclusive facet. @param maxInclusive the value to set @return an XML schema maxInclusive facet
[ "Create", "an", "XML", "schema", "maxInclusive", "facet", "." ]
f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6
https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/XsdEmitter.java#L467-L472
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java
SegmentIndexBufferFileIO.read
@Override public int read(SegmentIndexBuffer sib, File sibFile) throws IOException { check(sibFile); RandomAccessFile raf = new RandomAccessFile(sibFile, "r"); FileChannel channel = raf.getChannel(); readVersion(channel); int length = sib.read(channel); length += STORAGE_VERSION_LENGTH; channel.close(); raf.close(); if(_logger.isTraceEnabled()) { _logger.trace("read " + sibFile.getAbsolutePath()); } return length; }
java
@Override public int read(SegmentIndexBuffer sib, File sibFile) throws IOException { check(sibFile); RandomAccessFile raf = new RandomAccessFile(sibFile, "r"); FileChannel channel = raf.getChannel(); readVersion(channel); int length = sib.read(channel); length += STORAGE_VERSION_LENGTH; channel.close(); raf.close(); if(_logger.isTraceEnabled()) { _logger.trace("read " + sibFile.getAbsolutePath()); } return length; }
[ "@", "Override", "public", "int", "read", "(", "SegmentIndexBuffer", "sib", ",", "File", "sibFile", ")", "throws", "IOException", "{", "check", "(", "sibFile", ")", ";", "RandomAccessFile", "raf", "=", "new", "RandomAccessFile", "(", "sibFile", ",", "\"r\"", ...
Reads from the specified segment index buffer file. @param sib - the segment index buffer @param sibFile - the segment index buffer file to read from @throws IOException
[ "Reads", "from", "the", "specified", "segment", "index", "buffer", "file", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java#L61-L80
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java
SegmentIndexBufferFileIO.write
@Override public int write(SegmentIndexBuffer sib, File sibFile) throws IOException { create(sibFile); RandomAccessFile raf = new RandomAccessFile(sibFile, "rw"); FileChannel channel = raf.getChannel(); writeVersion(channel); int length = sib.write(channel); length += STORAGE_VERSION_LENGTH; raf.setLength(length); channel.force(true); channel.close(); raf.close(); if(_logger.isTraceEnabled()) { _logger.trace("write " + sibFile.getAbsolutePath()); } return length; }
java
@Override public int write(SegmentIndexBuffer sib, File sibFile) throws IOException { create(sibFile); RandomAccessFile raf = new RandomAccessFile(sibFile, "rw"); FileChannel channel = raf.getChannel(); writeVersion(channel); int length = sib.write(channel); length += STORAGE_VERSION_LENGTH; raf.setLength(length); channel.force(true); channel.close(); raf.close(); if(_logger.isTraceEnabled()) { _logger.trace("write " + sibFile.getAbsolutePath()); } return length; }
[ "@", "Override", "public", "int", "write", "(", "SegmentIndexBuffer", "sib", ",", "File", "sibFile", ")", "throws", "IOException", "{", "create", "(", "sibFile", ")", ";", "RandomAccessFile", "raf", "=", "new", "RandomAccessFile", "(", "sibFile", ",", "\"rw\""...
Writes to the specified segment index buffer file. @param sib - the segment index buffer @param sibFile - the segment index buffer file to write to @throws IOException
[ "Writes", "to", "the", "specified", "segment", "index", "buffer", "file", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java#L122-L143
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java
SegmentIndexBufferFileIO.readVersion
protected int readVersion(ReadableByteChannel channel) throws IOException { ByteBuffer version = ByteBuffer.allocate(STORAGE_VERSION_LENGTH); int len = channel.read(version); if (len < STORAGE_VERSION_LENGTH) { throw new IOException("Invalid Version"); } return version.getInt(0); }
java
protected int readVersion(ReadableByteChannel channel) throws IOException { ByteBuffer version = ByteBuffer.allocate(STORAGE_VERSION_LENGTH); int len = channel.read(version); if (len < STORAGE_VERSION_LENGTH) { throw new IOException("Invalid Version"); } return version.getInt(0); }
[ "protected", "int", "readVersion", "(", "ReadableByteChannel", "channel", ")", "throws", "IOException", "{", "ByteBuffer", "version", "=", "ByteBuffer", ".", "allocate", "(", "STORAGE_VERSION_LENGTH", ")", ";", "int", "len", "=", "channel", ".", "read", "(", "ve...
Reads version from readable channel. @throws IOException
[ "Reads", "version", "from", "readable", "channel", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java#L150-L157
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java
SegmentIndexBufferFileIO.writeVersion
protected void writeVersion(WritableByteChannel channel) throws IOException { ByteBuffer version = ByteBuffer.allocate(STORAGE_VERSION_LENGTH); version.putInt(STORAGE_VERSION); version.flip(); channel.write(version); }
java
protected void writeVersion(WritableByteChannel channel) throws IOException { ByteBuffer version = ByteBuffer.allocate(STORAGE_VERSION_LENGTH); version.putInt(STORAGE_VERSION); version.flip(); channel.write(version); }
[ "protected", "void", "writeVersion", "(", "WritableByteChannel", "channel", ")", "throws", "IOException", "{", "ByteBuffer", "version", "=", "ByteBuffer", ".", "allocate", "(", "STORAGE_VERSION_LENGTH", ")", ";", "version", ".", "putInt", "(", "STORAGE_VERSION", ")"...
Writes the version to writable channel. @throws IOException
[ "Writes", "the", "version", "to", "writable", "channel", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java#L164-L169
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java
SegmentIndexBufferFileIO.create
protected void create(File file) throws IOException { if(!file.exists()) { File dir = file.getParentFile(); if(dir.exists()) file.createNewFile(); else if(dir.mkdirs()) file.createNewFile(); else throw new IOException("Failed to create " + file.getAbsolutePath()); } if(file.isDirectory()) { throw new IOException("Cannot open directory " + file.getAbsolutePath()); } }
java
protected void create(File file) throws IOException { if(!file.exists()) { File dir = file.getParentFile(); if(dir.exists()) file.createNewFile(); else if(dir.mkdirs()) file.createNewFile(); else throw new IOException("Failed to create " + file.getAbsolutePath()); } if(file.isDirectory()) { throw new IOException("Cannot open directory " + file.getAbsolutePath()); } }
[ "protected", "void", "create", "(", "File", "file", ")", "throws", "IOException", "{", "if", "(", "!", "file", ".", "exists", "(", ")", ")", "{", "File", "dir", "=", "file", ".", "getParentFile", "(", ")", ";", "if", "(", "dir", ".", "exists", "(",...
Creates the specified file if needed. @throws IOException
[ "Creates", "the", "specified", "file", "if", "needed", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java#L176-L187
train
jingwei/krati
krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java
SegmentIndexBufferFileIO.check
protected void check(File file) throws IOException { if(!file.exists()) { throw new FileNotFoundException(file.getAbsolutePath()); } if(file.isDirectory()) { throw new IOException("Cannot open directory " + file.getAbsolutePath()); } }
java
protected void check(File file) throws IOException { if(!file.exists()) { throw new FileNotFoundException(file.getAbsolutePath()); } if(file.isDirectory()) { throw new IOException("Cannot open directory " + file.getAbsolutePath()); } }
[ "protected", "void", "check", "(", "File", "file", ")", "throws", "IOException", "{", "if", "(", "!", "file", ".", "exists", "(", ")", ")", "{", "throw", "new", "FileNotFoundException", "(", "file", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "if"...
Checks the existence of the specified file. @throws IOException
[ "Checks", "the", "existence", "of", "the", "specified", "file", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/segment/SegmentIndexBufferFileIO.java#L194-L202
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PAMSourceAuditor.java
PAMSourceAuditor.getAuditor
public static PAMSourceAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (PAMSourceAuditor)ctx.getAuditor(PAMSourceAuditor.class); }
java
public static PAMSourceAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (PAMSourceAuditor)ctx.getAuditor(PAMSourceAuditor.class); }
[ "public", "static", "PAMSourceAuditor", "getAuditor", "(", ")", "{", "AuditorModuleContext", "ctx", "=", "AuditorModuleContext", ".", "getContext", "(", ")", ";", "return", "(", "PAMSourceAuditor", ")", "ctx", ".", "getAuditor", "(", "PAMSourceAuditor", ".", "clas...
Get an instance of the PAM Source Auditor from the global context @return PAM Source Auditor instance
[ "Get", "an", "instance", "of", "the", "PAM", "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/PAMSourceAuditor.java#L39-L43
train
jingwei/krati
krati-main/src/main/java/krati/core/array/entry/PreFillEntryLong.java
PreFillEntryLong.add
public void add(int pos, long val, long scn) { if (_index < _entryCapacity) { _valArray.get(_index++).reinit(pos, val, scn); maintainScn(scn); } else { throw new EntryOverflowException(); } }
java
public void add(int pos, long val, long scn) { if (_index < _entryCapacity) { _valArray.get(_index++).reinit(pos, val, scn); maintainScn(scn); } else { throw new EntryOverflowException(); } }
[ "public", "void", "add", "(", "int", "pos", ",", "long", "val", ",", "long", "scn", ")", "{", "if", "(", "_index", "<", "_entryCapacity", ")", "{", "_valArray", ".", "get", "(", "_index", "++", ")", ".", "reinit", "(", "pos", ",", "val", ",", "sc...
Adds data to this Entry. @param pos @param val @param scn
[ "Adds", "data", "to", "this", "Entry", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/entry/PreFillEntryLong.java#L43-L50
train
jingwei/krati
krati-main/src/main/java/krati/core/array/entry/AbstractEntry.java
AbstractEntry.save
public final void save(File file) throws IOException { _entryFile = file; Chronos c = new Chronos(); DataWriter out = new FastDataWriter(file); try { out.open(); // Save entry head out.writeLong(STORAGE_VERSION); // write the entry file version out.writeLong(_minScn); out.writeLong(_maxScn); out.writeInt(size()); // Save entry body saveDataSection(out); // Save entry tail. out.writeLong(_minScn); out.writeLong(_maxScn); } finally { out.close(); } if(_log.isInfoEnabled()) { _log.info("Saved entry: minScn=" + _minScn + " maxScn=" + _maxScn + " size=" + size() + " file=" + file.getName() + " in " + c.getElapsedTime()); } }
java
public final void save(File file) throws IOException { _entryFile = file; Chronos c = new Chronos(); DataWriter out = new FastDataWriter(file); try { out.open(); // Save entry head out.writeLong(STORAGE_VERSION); // write the entry file version out.writeLong(_minScn); out.writeLong(_maxScn); out.writeInt(size()); // Save entry body saveDataSection(out); // Save entry tail. out.writeLong(_minScn); out.writeLong(_maxScn); } finally { out.close(); } if(_log.isInfoEnabled()) { _log.info("Saved entry: minScn=" + _minScn + " maxScn=" + _maxScn + " size=" + size() + " file=" + file.getName() + " in " + c.getElapsedTime()); } }
[ "public", "final", "void", "save", "(", "File", "file", ")", "throws", "IOException", "{", "_entryFile", "=", "file", ";", "Chronos", "c", "=", "new", "Chronos", "(", ")", ";", "DataWriter", "out", "=", "new", "FastDataWriter", "(", "file", ")", ";", "...
Saves to a file. @param file @throws IOException
[ "Saves", "to", "a", "file", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/entry/AbstractEntry.java#L124-L151
train
jingwei/krati
krati-main/src/main/java/krati/core/array/entry/AbstractEntry.java
AbstractEntry.load
public void load(File file) throws IOException { _entryFile = file; Chronos c = new Chronos(); ChannelReader in = new ChannelReader(file); try { in.open(); // Read entry head long fileVersion = in.readLong(); if (fileVersion != STORAGE_VERSION) { throw new RuntimeException("Wrong storage version " + fileVersion + " encounted in " + file.getAbsolutePath() + ". Version " + STORAGE_VERSION + " expected."); } long minScnHead = in.readLong(); long maxScnHead = in.readLong(); int length = in.readInt(); // Read entry body loadDataSection(in, length); // Read entry tail long minScnTail = in.readLong(); long maxScnTail = in.readLong(); if (minScnHead != minScnTail) { throw new IOException("min scns don't match: " + minScnHead + " vs " + minScnTail); } if (maxScnHead != maxScnTail) { throw new IOException("max scns don't match:" + maxScnHead + " vs " + maxScnTail); } _minScn = minScnHead; _maxScn = maxScnHead; if(_log.isInfoEnabled()) { _log.info("loaded entry: minScn=" + _minScn + " maxScn=" + _maxScn + " size=" + size() + " file=" + file.getName() + " in " + c.getElapsedTime()); } } finally { in.close(); } }
java
public void load(File file) throws IOException { _entryFile = file; Chronos c = new Chronos(); ChannelReader in = new ChannelReader(file); try { in.open(); // Read entry head long fileVersion = in.readLong(); if (fileVersion != STORAGE_VERSION) { throw new RuntimeException("Wrong storage version " + fileVersion + " encounted in " + file.getAbsolutePath() + ". Version " + STORAGE_VERSION + " expected."); } long minScnHead = in.readLong(); long maxScnHead = in.readLong(); int length = in.readInt(); // Read entry body loadDataSection(in, length); // Read entry tail long minScnTail = in.readLong(); long maxScnTail = in.readLong(); if (minScnHead != minScnTail) { throw new IOException("min scns don't match: " + minScnHead + " vs " + minScnTail); } if (maxScnHead != maxScnTail) { throw new IOException("max scns don't match:" + maxScnHead + " vs " + maxScnTail); } _minScn = minScnHead; _maxScn = maxScnHead; if(_log.isInfoEnabled()) { _log.info("loaded entry: minScn=" + _minScn + " maxScn=" + _maxScn + " size=" + size() + " file=" + file.getName() + " in " + c.getElapsedTime()); } } finally { in.close(); } }
[ "public", "void", "load", "(", "File", "file", ")", "throws", "IOException", "{", "_entryFile", "=", "file", ";", "Chronos", "c", "=", "new", "Chronos", "(", ")", ";", "ChannelReader", "in", "=", "new", "ChannelReader", "(", "file", ")", ";", "try", "{...
Loads an entry from a given file. @param file @throws IOException
[ "Loads", "an", "entry", "from", "a", "given", "file", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/entry/AbstractEntry.java#L159-L201
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceIdentificationType.java
AuditSourceIdentificationType.getAuditSourceTypeCode
public CodedValueType getAuditSourceTypeCode() { if (EventUtils.isEmptyOrNull(auditSourceTypeCode)) { return null; } AuditSourceType auditSourceType = auditSourceTypeCode.get(0); CodedValueType codedValueType = new CodedValueType(); codedValueType.setCode(auditSourceType.getCode()); codedValueType.setCodeSystem(auditSourceType.getCodeSystem()); codedValueType.setCodeSystemName(auditSourceType.getCodeSystemName()); codedValueType.setOriginalText(auditSourceType.getOriginalText()); return codedValueType; }
java
public CodedValueType getAuditSourceTypeCode() { if (EventUtils.isEmptyOrNull(auditSourceTypeCode)) { return null; } AuditSourceType auditSourceType = auditSourceTypeCode.get(0); CodedValueType codedValueType = new CodedValueType(); codedValueType.setCode(auditSourceType.getCode()); codedValueType.setCodeSystem(auditSourceType.getCodeSystem()); codedValueType.setCodeSystemName(auditSourceType.getCodeSystemName()); codedValueType.setOriginalText(auditSourceType.getOriginalText()); return codedValueType; }
[ "public", "CodedValueType", "getAuditSourceTypeCode", "(", ")", "{", "if", "(", "EventUtils", ".", "isEmptyOrNull", "(", "auditSourceTypeCode", ")", ")", "{", "return", "null", ";", "}", "AuditSourceType", "auditSourceType", "=", "auditSourceTypeCode", ".", "get", ...
Gets the value of the auditSourceTypeCode property. @deprecated use {@link #getAuditSourceType()}
[ "Gets", "the", "value", "of", "the", "auditSourceTypeCode", "property", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceIdentificationType.java#L141-L152
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceIdentificationType.java
AuditSourceIdentificationType.setAuditSourceTypeCode
public void setAuditSourceTypeCode(CodedValueType auditSourceTypeCode) { AuditSourceType auditSourceType = new AuditSourceType(); auditSourceType.setCode(auditSourceTypeCode.getCode()); auditSourceType.setCodeSystem(auditSourceTypeCode.getCodeSystem()); auditSourceType.setCodeSystemName(auditSourceTypeCode.getCodeSystemName()); auditSourceType.setOriginalText(auditSourceTypeCode.getOriginalText()); }
java
public void setAuditSourceTypeCode(CodedValueType auditSourceTypeCode) { AuditSourceType auditSourceType = new AuditSourceType(); auditSourceType.setCode(auditSourceTypeCode.getCode()); auditSourceType.setCodeSystem(auditSourceTypeCode.getCodeSystem()); auditSourceType.setCodeSystemName(auditSourceTypeCode.getCodeSystemName()); auditSourceType.setOriginalText(auditSourceTypeCode.getOriginalText()); }
[ "public", "void", "setAuditSourceTypeCode", "(", "CodedValueType", "auditSourceTypeCode", ")", "{", "AuditSourceType", "auditSourceType", "=", "new", "AuditSourceType", "(", ")", ";", "auditSourceType", ".", "setCode", "(", "auditSourceTypeCode", ".", "getCode", "(", ...
Sets the value of the auditSourceTypeCode property. @deprecated use {@link #getAuditSourceType() and add to the list}
[ "Sets", "the", "value", "of", "the", "auditSourceTypeCode", "property", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/models/rfc3881/AuditSourceIdentificationType.java#L165-L171
train
apptik/jus
examples-android-volley-migration/src/main/java/io/apptik/comm/jus/examples/volley/LruBitmapCache.java
LruBitmapCache.getCacheSize
public static int getCacheSize(Context ctx) { final DisplayMetrics displayMetrics = ctx.getResources(). getDisplayMetrics(); final int screenWidth = displayMetrics.widthPixels; final int screenHeight = displayMetrics.heightPixels; // 4 bytes per pixel final int screenBytes = screenWidth * screenHeight * 4; return screenBytes * 3; }
java
public static int getCacheSize(Context ctx) { final DisplayMetrics displayMetrics = ctx.getResources(). getDisplayMetrics(); final int screenWidth = displayMetrics.widthPixels; final int screenHeight = displayMetrics.heightPixels; // 4 bytes per pixel final int screenBytes = screenWidth * screenHeight * 4; return screenBytes * 3; }
[ "public", "static", "int", "getCacheSize", "(", "Context", "ctx", ")", "{", "final", "DisplayMetrics", "displayMetrics", "=", "ctx", ".", "getResources", "(", ")", ".", "getDisplayMetrics", "(", ")", ";", "final", "int", "screenWidth", "=", "displayMetrics", "...
Returns a cache size equal to approximately three screens worth of images.
[ "Returns", "a", "cache", "size", "equal", "to", "approximately", "three", "screens", "worth", "of", "images", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/examples-android-volley-migration/src/main/java/io/apptik/comm/jus/examples/volley/LruBitmapCache.java#L49-L58
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditRecordRepositoryAuditor.java
AuditRecordRepositoryAuditor.getAuditor
public static AuditRecordRepositoryAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (AuditRecordRepositoryAuditor)ctx.getAuditor(AuditRecordRepositoryAuditor.class); }
java
public static AuditRecordRepositoryAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (AuditRecordRepositoryAuditor)ctx.getAuditor(AuditRecordRepositoryAuditor.class); }
[ "public", "static", "AuditRecordRepositoryAuditor", "getAuditor", "(", ")", "{", "AuditorModuleContext", "ctx", "=", "AuditorModuleContext", ".", "getContext", "(", ")", ";", "return", "(", "AuditRecordRepositoryAuditor", ")", "ctx", ".", "getAuditor", "(", "AuditReco...
Get an instance of the Audit Record Repository auditor from the global context @return Audit Record Repository auditor instance
[ "Get", "an", "instance", "of", "the", "Audit", "Record", "Repository", "auditor", "from", "the", "global", "context" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditRecordRepositoryAuditor.java#L33-L37
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditRecordRepositoryAuditor.java
AuditRecordRepositoryAuditor.auditAuditLogUsed
public void auditAuditLogUsed(RFC3881EventOutcomeCodes eventOutcome, String accessingUser, String accessingProcess, String auditLogUri) { if (!isAuditorEnabled()) { return; } AuditLogUsedEvent auditLogUsedEvent = new AuditLogUsedEvent(eventOutcome); auditLogUsedEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); if (!EventUtils.isEmptyOrNull(accessingUser)) { auditLogUsedEvent.addAccessingParticipant(accessingUser, null, null, getSystemNetworkId()); } if (!EventUtils.isEmptyOrNull(accessingProcess)) { auditLogUsedEvent.addAccessingParticipant(accessingProcess, null, null, getSystemNetworkId()); } auditLogUsedEvent.addAuditLogIdentity(auditLogUri); audit(auditLogUsedEvent); }
java
public void auditAuditLogUsed(RFC3881EventOutcomeCodes eventOutcome, String accessingUser, String accessingProcess, String auditLogUri) { if (!isAuditorEnabled()) { return; } AuditLogUsedEvent auditLogUsedEvent = new AuditLogUsedEvent(eventOutcome); auditLogUsedEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); if (!EventUtils.isEmptyOrNull(accessingUser)) { auditLogUsedEvent.addAccessingParticipant(accessingUser, null, null, getSystemNetworkId()); } if (!EventUtils.isEmptyOrNull(accessingProcess)) { auditLogUsedEvent.addAccessingParticipant(accessingProcess, null, null, getSystemNetworkId()); } auditLogUsedEvent.addAuditLogIdentity(auditLogUri); audit(auditLogUsedEvent); }
[ "public", "void", "auditAuditLogUsed", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "accessingUser", ",", "String", "accessingProcess", ",", "String", "auditLogUri", ")", "{", "if", "(", "!", "isAuditorEnabled", "(", ")", ")", "{", "return", ";"...
Audits a DICOM "Audit Log Used" event, for a given User and Process. @param eventOutcome The event outcome indicator @param accessingUser Identity of the user accessing the audit log @param accessingProcess Identity of the process accessing the audit log @param auditLogUri The URI of the audit log being accessed
[ "Audits", "a", "DICOM", "Audit", "Log", "Used", "event", "for", "a", "given", "User", "and", "Process", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditRecordRepositoryAuditor.java#L47-L64
train
jingwei/krati
krati-main/src/main/java/krati/core/array/entry/EntryUtility.java
EntryUtility.sortEntriesById
public static <T extends EntryValue> void sortEntriesById(List<Entry<T>> entryList) { if (entryList.size() > 0) { Collections.sort(entryList, new Comparator<Entry<?>>() { @Override public int compare(Entry<?> e1, Entry<?> e2) { long v1 = getEntryId(e1.getFile().getName()); long v2 = getEntryId(e2.getFile().getName()); return (v1 < v2) ? -1 : ((v1 == v2) ? 0 : 1); } }); } }
java
public static <T extends EntryValue> void sortEntriesById(List<Entry<T>> entryList) { if (entryList.size() > 0) { Collections.sort(entryList, new Comparator<Entry<?>>() { @Override public int compare(Entry<?> e1, Entry<?> e2) { long v1 = getEntryId(e1.getFile().getName()); long v2 = getEntryId(e2.getFile().getName()); return (v1 < v2) ? -1 : ((v1 == v2) ? 0 : 1); } }); } }
[ "public", "static", "<", "T", "extends", "EntryValue", ">", "void", "sortEntriesById", "(", "List", "<", "Entry", "<", "T", ">", ">", "entryList", ")", "{", "if", "(", "entryList", ".", "size", "(", ")", ">", "0", ")", "{", "Collections", ".", "sort"...
Sort entries in the ascending order of entry log IDs.
[ "Sort", "entries", "in", "the", "ascending", "order", "of", "entry", "log", "IDs", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/entry/EntryUtility.java#L130-L141
train
jingwei/krati
krati-main/src/main/java/krati/core/array/entry/EntryUtility.java
EntryUtility.getEntryId
public static long getEntryId(String entryFileName) { int ind1 = entryFileName.indexOf("_") + 1; if (ind1 > 0) { int ind2 = entryFileName.indexOf("_", ind1); if (ind2 > ind1) { String str = entryFileName.substring(ind1, ind2); try { return Long.parseLong(str); } catch (Exception e) { } } } return 0; }
java
public static long getEntryId(String entryFileName) { int ind1 = entryFileName.indexOf("_") + 1; if (ind1 > 0) { int ind2 = entryFileName.indexOf("_", ind1); if (ind2 > ind1) { String str = entryFileName.substring(ind1, ind2); try { return Long.parseLong(str); } catch (Exception e) { } } } return 0; }
[ "public", "static", "long", "getEntryId", "(", "String", "entryFileName", ")", "{", "int", "ind1", "=", "entryFileName", ".", "indexOf", "(", "\"_\"", ")", "+", "1", ";", "if", "(", "ind1", ">", "0", ")", "{", "int", "ind2", "=", "entryFileName", ".", ...
Gets the entry ID based on the specified entry file name.
[ "Gets", "the", "entry", "ID", "based", "on", "the", "specified", "entry", "file", "name", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/entry/EntryUtility.java#L146-L160
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/BSDSyslogSenderImpl.java
BSDSyslogSenderImpl.send
private void send(byte[] msg, DatagramSocket socket, InetAddress destination, int port) throws Exception { if (EventUtils.isEmptyOrNull(msg)) { return; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Auditing to " + destination.getHostAddress() + ":" + port); } if (LOGGER.isDebugEnabled()) { LOGGER.debug(new String(msg)); } DatagramPacket packet = new DatagramPacket(msg,getBufferLength(msg),destination,port); socket.send(packet); }
java
private void send(byte[] msg, DatagramSocket socket, InetAddress destination, int port) throws Exception { if (EventUtils.isEmptyOrNull(msg)) { return; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Auditing to " + destination.getHostAddress() + ":" + port); } if (LOGGER.isDebugEnabled()) { LOGGER.debug(new String(msg)); } DatagramPacket packet = new DatagramPacket(msg,getBufferLength(msg),destination,port); socket.send(packet); }
[ "private", "void", "send", "(", "byte", "[", "]", "msg", ",", "DatagramSocket", "socket", ",", "InetAddress", "destination", ",", "int", "port", ")", "throws", "Exception", "{", "if", "(", "EventUtils", ".", "isEmptyOrNull", "(", "msg", ")", ")", "{", "r...
Send a byte buffer to a designated destination address and port using the datagram socket specified. @param msg Message buffer to send @param socket UDP socket to use @param destination Destination address to send to @param port Destination port to send to @throws Exception
[ "Send", "a", "byte", "buffer", "to", "a", "designated", "destination", "address", "and", "port", "using", "the", "datagram", "socket", "specified", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/BSDSyslogSenderImpl.java#L83-L99
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/BSDSyslogSenderImpl.java
BSDSyslogSenderImpl.send
private void send(AuditEventMessage msg, DatagramSocket socket, InetAddress destination, int port) throws Exception { if (EventUtils.isEmptyOrNull(msg)) { return; } // Check to validate port int portToUse = getTransportPort(port); // Serialize and format event message for syslog byte[] msgBytes = getTransportPayload(msg); // Send packet send(msgBytes,socket,destination,portToUse); }
java
private void send(AuditEventMessage msg, DatagramSocket socket, InetAddress destination, int port) throws Exception { if (EventUtils.isEmptyOrNull(msg)) { return; } // Check to validate port int portToUse = getTransportPort(port); // Serialize and format event message for syslog byte[] msgBytes = getTransportPayload(msg); // Send packet send(msgBytes,socket,destination,portToUse); }
[ "private", "void", "send", "(", "AuditEventMessage", "msg", ",", "DatagramSocket", "socket", ",", "InetAddress", "destination", ",", "int", "port", ")", "throws", "Exception", "{", "if", "(", "EventUtils", ".", "isEmptyOrNull", "(", "msg", ")", ")", "{", "re...
Send an audit message to a designated destination address and port using the datagram socket specified. @param msg Message to send @param socket UDP socket to use @param destination Destination address to send to @param port Destination port to send to @throws Exception
[ "Send", "an", "audit", "message", "to", "a", "designated", "destination", "address", "and", "port", "using", "the", "datagram", "socket", "specified", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/BSDSyslogSenderImpl.java#L111-L123
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/BSDSyslogSenderImpl.java
BSDSyslogSenderImpl.getTransportPayload
protected byte[] getTransportPayload(AuditEventMessage msg) { if (msg == null) { return null; } byte[] msgBytes = msg.getSerializedMessage(false); if (EventUtils.isEmptyOrNull(msgBytes)) { return null; } // Format message with transport-specific headers StringBuilder sb = new StringBuilder(); sb.append("<"); sb.append(TRANSPORT_DEFAULT_PRIORITY); sb.append(">"); sb.append(TimestampUtils.getBSDSyslogDate(msg.getDateTime())); sb.append(" "); sb.append(getSystemHostName()); sb.append(" "); sb.append("<?xml version=\"1.0\" encoding=\"ASCII\"?>"); sb.append(new String(msgBytes)); return sb.toString().trim().getBytes(); }
java
protected byte[] getTransportPayload(AuditEventMessage msg) { if (msg == null) { return null; } byte[] msgBytes = msg.getSerializedMessage(false); if (EventUtils.isEmptyOrNull(msgBytes)) { return null; } // Format message with transport-specific headers StringBuilder sb = new StringBuilder(); sb.append("<"); sb.append(TRANSPORT_DEFAULT_PRIORITY); sb.append(">"); sb.append(TimestampUtils.getBSDSyslogDate(msg.getDateTime())); sb.append(" "); sb.append(getSystemHostName()); sb.append(" "); sb.append("<?xml version=\"1.0\" encoding=\"ASCII\"?>"); sb.append(new String(msgBytes)); return sb.toString().trim().getBytes(); }
[ "protected", "byte", "[", "]", "getTransportPayload", "(", "AuditEventMessage", "msg", ")", "{", "if", "(", "msg", "==", "null", ")", "{", "return", "null", ";", "}", "byte", "[", "]", "msgBytes", "=", "msg", ".", "getSerializedMessage", "(", "false", ")...
Serialize, format, and prepare the message payload body for sending by this transport. This includes adding the syslog message header. @param msg Message to prepare @return Buffer to send
[ "Serialize", "format", "and", "prepare", "the", "message", "payload", "body", "for", "sending", "by", "this", "transport", ".", "This", "includes", "adding", "the", "syslog", "message", "header", "." ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/sender/BSDSyslogSenderImpl.java#L196-L221
train
jingwei/krati
krati-main/src/main/java/krati/util/SourceWaterMarks.java
SourceWaterMarks.loadWaterMarks
protected void loadWaterMarks() throws IOException { // Load source water marks from file if (file != null && file.exists()) { try { loadWaterMarks(file); } catch (IOException e) { if (fileOriginal != null && fileOriginal.exists()) { loadWaterMarks(fileOriginal); } } } }
java
protected void loadWaterMarks() throws IOException { // Load source water marks from file if (file != null && file.exists()) { try { loadWaterMarks(file); } catch (IOException e) { if (fileOriginal != null && fileOriginal.exists()) { loadWaterMarks(fileOriginal); } } } }
[ "protected", "void", "loadWaterMarks", "(", ")", "throws", "IOException", "{", "// Load source water marks from file", "if", "(", "file", "!=", "null", "&&", "file", ".", "exists", "(", ")", ")", "{", "try", "{", "loadWaterMarks", "(", "file", ")", ";", "}",...
Load water marks from underlying files. @throws IOException
[ "Load", "water", "marks", "from", "underlying", "files", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L91-L102
train
jingwei/krati
krati-main/src/main/java/krati/util/SourceWaterMarks.java
SourceWaterMarks.loadWaterMarks
protected void loadWaterMarks(File waterMarksFile) throws IOException { Properties p = new Properties(); FileInputStream fis = new FileInputStream(waterMarksFile); logger.info("Loading " + waterMarksFile); try { p.load(fis); Enumeration<?> enm = p.propertyNames(); while (enm.hasMoreElements()) { String source = (String) enm.nextElement(); String waterMarks = p.getProperty(source); String[] parts = waterMarks.split(","); if (parts.length == 2) { long lwmScn = Long.parseLong(parts[0].trim()); long hwmScn = Long.parseLong(parts[1].trim()); // Make sure that hwmScn and lwmScn are always equal when loaded if (hwmScn < lwmScn) { lwmScn = hwmScn; } else { hwmScn = lwmScn; } WaterMarkEntry wmEntry = sourceWaterMarkMap.get(source); if (wmEntry == null) { wmEntry = new WaterMarkEntry(source); sourceWaterMarkMap.put(source, wmEntry); } wmEntry.setLWMScn(lwmScn); wmEntry.setHWMScn(hwmScn); } } } catch (IOException e) { logger.error("Failed to load source water marks from " + waterMarksFile.getName(), e); throw e; } finally { fis.close(); fis = null; } }
java
protected void loadWaterMarks(File waterMarksFile) throws IOException { Properties p = new Properties(); FileInputStream fis = new FileInputStream(waterMarksFile); logger.info("Loading " + waterMarksFile); try { p.load(fis); Enumeration<?> enm = p.propertyNames(); while (enm.hasMoreElements()) { String source = (String) enm.nextElement(); String waterMarks = p.getProperty(source); String[] parts = waterMarks.split(","); if (parts.length == 2) { long lwmScn = Long.parseLong(parts[0].trim()); long hwmScn = Long.parseLong(parts[1].trim()); // Make sure that hwmScn and lwmScn are always equal when loaded if (hwmScn < lwmScn) { lwmScn = hwmScn; } else { hwmScn = lwmScn; } WaterMarkEntry wmEntry = sourceWaterMarkMap.get(source); if (wmEntry == null) { wmEntry = new WaterMarkEntry(source); sourceWaterMarkMap.put(source, wmEntry); } wmEntry.setLWMScn(lwmScn); wmEntry.setHWMScn(hwmScn); } } } catch (IOException e) { logger.error("Failed to load source water marks from " + waterMarksFile.getName(), e); throw e; } finally { fis.close(); fis = null; } }
[ "protected", "void", "loadWaterMarks", "(", "File", "waterMarksFile", ")", "throws", "IOException", "{", "Properties", "p", "=", "new", "Properties", "(", ")", ";", "FileInputStream", "fis", "=", "new", "FileInputStream", "(", "waterMarksFile", ")", ";", "logger...
Load water marks from an underlying file. @param waterMarksFile @throws IOException
[ "Load", "water", "marks", "from", "an", "underlying", "file", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L110-L152
train
jingwei/krati
krati-main/src/main/java/krati/util/SourceWaterMarks.java
SourceWaterMarks.getHWMScn
public long getHWMScn(String source) { WaterMarkEntry e = sourceWaterMarkMap.get(source); return (e == null) ? 0 : e.getHWMScn(); }
java
public long getHWMScn(String source) { WaterMarkEntry e = sourceWaterMarkMap.get(source); return (e == null) ? 0 : e.getHWMScn(); }
[ "public", "long", "getHWMScn", "(", "String", "source", ")", "{", "WaterMarkEntry", "e", "=", "sourceWaterMarkMap", ".", "get", "(", "source", ")", ";", "return", "(", "e", "==", "null", ")", "?", "0", ":", "e", ".", "getHWMScn", "(", ")", ";", "}" ]
Gets the high water mark of a source. @param source - the source
[ "Gets", "the", "high", "water", "mark", "of", "a", "source", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L176-L179
train
jingwei/krati
krati-main/src/main/java/krati/util/SourceWaterMarks.java
SourceWaterMarks.getLWMScn
public long getLWMScn(String source) { WaterMarkEntry e = sourceWaterMarkMap.get(source); return (e == null) ? 0 : e.getLWMScn(); }
java
public long getLWMScn(String source) { WaterMarkEntry e = sourceWaterMarkMap.get(source); return (e == null) ? 0 : e.getLWMScn(); }
[ "public", "long", "getLWMScn", "(", "String", "source", ")", "{", "WaterMarkEntry", "e", "=", "sourceWaterMarkMap", ".", "get", "(", "source", ")", ";", "return", "(", "e", "==", "null", ")", "?", "0", ":", "e", ".", "getLWMScn", "(", ")", ";", "}" ]
Gets the low water mark of a source. @param source - the source
[ "Gets", "the", "low", "water", "mark", "of", "a", "source", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L202-L205
train
jingwei/krati
krati-main/src/main/java/krati/util/SourceWaterMarks.java
SourceWaterMarks.setLWMScn
public void setLWMScn(String source, long scn) { WaterMarkEntry e = sourceWaterMarkMap.get(source); if (e == null) { e = new WaterMarkEntry(source); sourceWaterMarkMap.put(source, e); } e.setLWMScn(scn); }
java
public void setLWMScn(String source, long scn) { WaterMarkEntry e = sourceWaterMarkMap.get(source); if (e == null) { e = new WaterMarkEntry(source); sourceWaterMarkMap.put(source, e); } e.setLWMScn(scn); }
[ "public", "void", "setLWMScn", "(", "String", "source", ",", "long", "scn", ")", "{", "WaterMarkEntry", "e", "=", "sourceWaterMarkMap", ".", "get", "(", "source", ")", ";", "if", "(", "e", "==", "null", ")", "{", "e", "=", "new", "WaterMarkEntry", "(",...
Sets the low water mark of a source @param source - the source @param scn - the water mark value
[ "Sets", "the", "low", "water", "mark", "of", "a", "source" ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L213-L220
train
jingwei/krati
krati-main/src/main/java/krati/util/SourceWaterMarks.java
SourceWaterMarks.setWaterMarks
public void setWaterMarks(String source, long lwmScn, long hwmScn) { WaterMarkEntry e = sourceWaterMarkMap.get(source); if (e == null) { e = new WaterMarkEntry(source); sourceWaterMarkMap.put(source, e); } e.setLWMScn(lwmScn); e.setHWMScn(hwmScn); }
java
public void setWaterMarks(String source, long lwmScn, long hwmScn) { WaterMarkEntry e = sourceWaterMarkMap.get(source); if (e == null) { e = new WaterMarkEntry(source); sourceWaterMarkMap.put(source, e); } e.setLWMScn(lwmScn); e.setHWMScn(hwmScn); }
[ "public", "void", "setWaterMarks", "(", "String", "source", ",", "long", "lwmScn", ",", "long", "hwmScn", ")", "{", "WaterMarkEntry", "e", "=", "sourceWaterMarkMap", ".", "get", "(", "source", ")", ";", "if", "(", "e", "==", "null", ")", "{", "e", "=",...
Sets the water marks of a source. @param source - the source @param lwmScn - the low water mark SCN @param hwmScn - the high water mark SCN
[ "Sets", "the", "water", "marks", "of", "a", "source", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L248-L256
train
jingwei/krati
krati-main/src/main/java/krati/util/SourceWaterMarks.java
SourceWaterMarks.syncWaterMarks
public boolean syncWaterMarks(String source, long lwmScn, long hwmScn) { setWaterMarks(source, lwmScn, hwmScn); return flush(); }
java
public boolean syncWaterMarks(String source, long lwmScn, long hwmScn) { setWaterMarks(source, lwmScn, hwmScn); return flush(); }
[ "public", "boolean", "syncWaterMarks", "(", "String", "source", ",", "long", "lwmScn", ",", "long", "hwmScn", ")", "{", "setWaterMarks", "(", "source", ",", "lwmScn", ",", "hwmScn", ")", ";", "return", "flush", "(", ")", ";", "}" ]
Sets and flushes the water marks of a source. @param source - the source @param lwmScn - the low water mark SCN @param hwmScn - the high water mark SCN @return <tt>true</tt> if flush is successful.
[ "Sets", "and", "flushes", "the", "water", "marks", "of", "a", "source", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L266-L269
train
jingwei/krati
krati-main/src/main/java/krati/util/SourceWaterMarks.java
SourceWaterMarks.syncWaterMarks
public boolean syncWaterMarks() { // Sync up low water marks for (String source : sourceWaterMarkMap.keySet()) { WaterMarkEntry wmEntry = sourceWaterMarkMap.get(source); wmEntry.setLWMScn(wmEntry.getHWMScn()); } return flush(); }
java
public boolean syncWaterMarks() { // Sync up low water marks for (String source : sourceWaterMarkMap.keySet()) { WaterMarkEntry wmEntry = sourceWaterMarkMap.get(source); wmEntry.setLWMScn(wmEntry.getHWMScn()); } return flush(); }
[ "public", "boolean", "syncWaterMarks", "(", ")", "{", "// Sync up low water marks", "for", "(", "String", "source", ":", "sourceWaterMarkMap", ".", "keySet", "(", ")", ")", "{", "WaterMarkEntry", "wmEntry", "=", "sourceWaterMarkMap", ".", "get", "(", "source", "...
Sync up low water marks to high water marks for all the sources. @return <tt>true</tt> if flush is successful.
[ "Sync", "up", "low", "water", "marks", "to", "high", "water", "marks", "for", "all", "the", "sources", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L287-L295
train
jingwei/krati
krati-main/src/main/java/krati/util/SourceWaterMarks.java
SourceWaterMarks.flush
public boolean flush() { boolean ret = true; PrintWriter out = null; // Save source water marks try { // Backup the original file if (file.exists()) { if (fileOriginal.exists()) { fileOriginal.delete(); } file.renameTo(fileOriginal); } // Overwrite the existing file out = new PrintWriter(new FileOutputStream(file)); for (String source : sourceWaterMarkMap.keySet()) { WaterMarkEntry wmEntry = sourceWaterMarkMap.get(source); out.println(wmEntry); } out.flush(); } catch (IOException ioe) { logger.error("Failed to flush water marks", ioe); ret = false; } finally { if (out != null) { out.close(); out = null; } } return ret; }
java
public boolean flush() { boolean ret = true; PrintWriter out = null; // Save source water marks try { // Backup the original file if (file.exists()) { if (fileOriginal.exists()) { fileOriginal.delete(); } file.renameTo(fileOriginal); } // Overwrite the existing file out = new PrintWriter(new FileOutputStream(file)); for (String source : sourceWaterMarkMap.keySet()) { WaterMarkEntry wmEntry = sourceWaterMarkMap.get(source); out.println(wmEntry); } out.flush(); } catch (IOException ioe) { logger.error("Failed to flush water marks", ioe); ret = false; } finally { if (out != null) { out.close(); out = null; } } return ret; }
[ "public", "boolean", "flush", "(", ")", "{", "boolean", "ret", "=", "true", ";", "PrintWriter", "out", "=", "null", ";", "// Save source water marks", "try", "{", "// Backup the original file", "if", "(", "file", ".", "exists", "(", ")", ")", "{", "if", "(...
Flushes low water marks and high water marks for all the sources. @return <tt>true</tt> if flush is successful.
[ "Flushes", "low", "water", "marks", "and", "high", "water", "marks", "for", "all", "the", "sources", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L302-L335
train
jingwei/krati
krati-main/src/main/java/krati/util/SourceWaterMarks.java
SourceWaterMarks.clear
public void clear() { sourceWaterMarkMap.clear(); flush(); if (fileOriginal != null && fileOriginal.exists()) { fileOriginal.delete(); } }
java
public void clear() { sourceWaterMarkMap.clear(); flush(); if (fileOriginal != null && fileOriginal.exists()) { fileOriginal.delete(); } }
[ "public", "void", "clear", "(", ")", "{", "sourceWaterMarkMap", ".", "clear", "(", ")", ";", "flush", "(", ")", ";", "if", "(", "fileOriginal", "!=", "null", "&&", "fileOriginal", ".", "exists", "(", ")", ")", "{", "fileOriginal", ".", "delete", "(", ...
Clears SourceWaterMark.
[ "Clears", "SourceWaterMark", "." ]
1ca0f994a7b0c8215b827eac9aaf95789ec08d21
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L340-L346
train
apptik/jus
android/jus-android/src/main/java/io/apptik/comm/jus/ui/NetworkImageView.java
NetworkImageView.loadImageIfNecessary
synchronized void loadImageIfNecessary(final boolean isInLayoutPass) { int width = getWidth(); int height = getHeight(); boolean wrapWidth = false, wrapHeight = false; if (getLayoutParams() != null) { wrapWidth = getLayoutParams().width == LayoutParams.WRAP_CONTENT; wrapHeight = getLayoutParams().height == LayoutParams.WRAP_CONTENT; } // if the view's bounds aren't known yet, and this is not a wrap-content/wrap-content // view, hold off on loading the image. boolean isFullyWrapContent = wrapWidth && wrapHeight; if (width == 0 && height == 0 && !isFullyWrapContent) { return; } // if the URL to be loaded in this view is empty, cancel any old requests and clear the // currently loaded image. if (TextUtils.isEmpty(url)) { if (imageContainer != null) { imageContainer.cancelRequest(); imageContainer = null; } setDefaultImageOrNull(); return; } // if there was an old request in this view, check if it needs to be canceled. if (imageContainer != null && imageContainer.getRequestUrl() != null) { if (imageContainer.getRequestUrl().equals(url)) { // if the request is from the same URL, return. return; } else { // if there is a pre-existing request, cancel it if it's fetching a different URL. imageContainer.cancelRequest(); setDefaultImageOrNull(); } } // Calculate the max image width / height to use while ignoring WRAP_CONTENT dimens. int maxWidth = wrapWidth ? 0 : width; int maxHeight = wrapHeight ? 0 : height; // The pre-existing content of this view didn't match the current URL. Load the new image // from the network. ImageContainer newContainer = imageLoader.get(url, new ImageListener() { @Override public void onError(JusError error) { if (errorImageId != 0) { setImageResource(errorImageId); } } @Override public void onResponse(final ImageContainer response, boolean isImmediate) { //verify if we expect the same url if (NetworkImageView.this.url == null || !NetworkImageView.this.url.equals(response.getRequestUrl())) { JusLog.error("NetworkImageView received: " + response.getRequestUrl() + ", expected: " + NetworkImageView.this.url); return; } // If this was an immediate response that was delivered inside of a layout // pass do not set the image immediately as it will trigger a requestLayout // inside of a layout. Instead, defer setting the image by posting back to // the main threadId. if (isImmediate && isInLayoutPass) { post(new Runnable() { @Override public void run() { onResponse(response, false); } }); return; } if (response.getBitmap() != null && isOk2Draw(response.getBitmap())) { setImageBitmap(response.getBitmap()); } else if (defaultImageId != 0) { if (!isImmediate) { JusLog.error("NetworkImageView received null for: " + response .getRequestUrl()); } setImageResource(defaultImageId); } } }, maxWidth, maxHeight, tag); // update the ImageContainer to be the new bitmap container. imageContainer = newContainer; }
java
synchronized void loadImageIfNecessary(final boolean isInLayoutPass) { int width = getWidth(); int height = getHeight(); boolean wrapWidth = false, wrapHeight = false; if (getLayoutParams() != null) { wrapWidth = getLayoutParams().width == LayoutParams.WRAP_CONTENT; wrapHeight = getLayoutParams().height == LayoutParams.WRAP_CONTENT; } // if the view's bounds aren't known yet, and this is not a wrap-content/wrap-content // view, hold off on loading the image. boolean isFullyWrapContent = wrapWidth && wrapHeight; if (width == 0 && height == 0 && !isFullyWrapContent) { return; } // if the URL to be loaded in this view is empty, cancel any old requests and clear the // currently loaded image. if (TextUtils.isEmpty(url)) { if (imageContainer != null) { imageContainer.cancelRequest(); imageContainer = null; } setDefaultImageOrNull(); return; } // if there was an old request in this view, check if it needs to be canceled. if (imageContainer != null && imageContainer.getRequestUrl() != null) { if (imageContainer.getRequestUrl().equals(url)) { // if the request is from the same URL, return. return; } else { // if there is a pre-existing request, cancel it if it's fetching a different URL. imageContainer.cancelRequest(); setDefaultImageOrNull(); } } // Calculate the max image width / height to use while ignoring WRAP_CONTENT dimens. int maxWidth = wrapWidth ? 0 : width; int maxHeight = wrapHeight ? 0 : height; // The pre-existing content of this view didn't match the current URL. Load the new image // from the network. ImageContainer newContainer = imageLoader.get(url, new ImageListener() { @Override public void onError(JusError error) { if (errorImageId != 0) { setImageResource(errorImageId); } } @Override public void onResponse(final ImageContainer response, boolean isImmediate) { //verify if we expect the same url if (NetworkImageView.this.url == null || !NetworkImageView.this.url.equals(response.getRequestUrl())) { JusLog.error("NetworkImageView received: " + response.getRequestUrl() + ", expected: " + NetworkImageView.this.url); return; } // If this was an immediate response that was delivered inside of a layout // pass do not set the image immediately as it will trigger a requestLayout // inside of a layout. Instead, defer setting the image by posting back to // the main threadId. if (isImmediate && isInLayoutPass) { post(new Runnable() { @Override public void run() { onResponse(response, false); } }); return; } if (response.getBitmap() != null && isOk2Draw(response.getBitmap())) { setImageBitmap(response.getBitmap()); } else if (defaultImageId != 0) { if (!isImmediate) { JusLog.error("NetworkImageView received null for: " + response .getRequestUrl()); } setImageResource(defaultImageId); } } }, maxWidth, maxHeight, tag); // update the ImageContainer to be the new bitmap container. imageContainer = newContainer; }
[ "synchronized", "void", "loadImageIfNecessary", "(", "final", "boolean", "isInLayoutPass", ")", "{", "int", "width", "=", "getWidth", "(", ")", ";", "int", "height", "=", "getHeight", "(", ")", ";", "boolean", "wrapWidth", "=", "false", ",", "wrapHeight", "=...
Loads the image for the view if it isn't already loaded. @param isInLayoutPass True if this was invoked from a layout pass, false otherwise.
[ "Loads", "the", "image", "for", "the", "view", "if", "it", "isn", "t", "already", "loaded", "." ]
8a37a21b41f897d68eaeaab07368ec22a1e5a60e
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/android/jus-android/src/main/java/io/apptik/comm/jus/ui/NetworkImageView.java#L162-L255
train
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXManagerAuditor.java
PIXManagerAuditor.getAuditor
public static PIXManagerAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (PIXManagerAuditor)ctx.getAuditor(PIXManagerAuditor.class); }
java
public static PIXManagerAuditor getAuditor() { AuditorModuleContext ctx = AuditorModuleContext.getContext(); return (PIXManagerAuditor)ctx.getAuditor(PIXManagerAuditor.class); }
[ "public", "static", "PIXManagerAuditor", "getAuditor", "(", ")", "{", "AuditorModuleContext", "ctx", "=", "AuditorModuleContext", ".", "getContext", "(", ")", ";", "return", "(", "PIXManagerAuditor", ")", "ctx", ".", "getAuditor", "(", "PIXManagerAuditor", ".", "c...
Get an instance of the PIX Manager Auditor from the global context @return PIX Manager Auditor instance
[ "Get", "an", "instance", "of", "the", "PIX", "Manager", "Auditor", "from", "the", "global", "context" ]
25ed1e926825169c94923a2c89a4618f60478ae8
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXManagerAuditor.java#L43-L47
train
ixa-ehu/ixa-pipe-tok
src/main/java/eus/ixa/ixa/pipe/tok/RuleBasedTokenizerServer.java
RuleBasedTokenizerServer.getAnnotations
private String getAnnotations(final Properties properties, final String stringFromClient) throws IOException, JDOMException { BufferedReader breader; KAFDocument kaf; String kafString = null; String lang = properties.getProperty("language"); String outputFormat = properties.getProperty("outputFormat"); Boolean inputKafRaw = Boolean.valueOf(properties.getProperty("inputkaf")); Boolean noTok = Boolean.valueOf(properties.getProperty("notok")); String kafVersion = properties.getProperty("kafversion"); Boolean offsets = Boolean.valueOf(properties.getProperty("offsets")); if (noTok) { final BufferedReader noTokReader = new BufferedReader( new StringReader(stringFromClient)); kaf = new KAFDocument(lang, kafVersion); final KAFDocument.LinguisticProcessor newLp = kaf.addLinguisticProcessor( "text", "ixa-pipe-tok-notok-" + lang, version + "-" + commit); newLp.setBeginTimestamp(); Annotate.tokensToKAF(noTokReader, kaf); newLp.setEndTimestamp(); kafString = kaf.toString(); noTokReader.close(); } else { if (inputKafRaw) { final BufferedReader kafReader = new BufferedReader( new StringReader(stringFromClient)); kaf = KAFDocument.createFromStream(kafReader); final String text = kaf.getRawText(); final StringReader stringReader = new StringReader(text); breader = new BufferedReader(stringReader); } else { kaf = new KAFDocument(lang, kafVersion); breader = new BufferedReader(new StringReader(stringFromClient)); } final Annotate annotator = new Annotate(breader, properties); if (outputFormat.equalsIgnoreCase("conll")) { if (offsets) { kafString = annotator.tokenizeToCoNLL(); } else { kafString = annotator.tokenizeToCoNLLOffsets(); } } else if (outputFormat.equalsIgnoreCase("oneline")) { kafString = annotator.tokenizeToText(); } else { final KAFDocument.LinguisticProcessor newLp = kaf .addLinguisticProcessor("text", "ixa-pipe-tok-" + lang, version + "-" + commit); newLp.setBeginTimestamp(); annotator.tokenizeToKAF(kaf); newLp.setEndTimestamp(); kafString = kaf.toString(); } breader.close(); } return kafString; }
java
private String getAnnotations(final Properties properties, final String stringFromClient) throws IOException, JDOMException { BufferedReader breader; KAFDocument kaf; String kafString = null; String lang = properties.getProperty("language"); String outputFormat = properties.getProperty("outputFormat"); Boolean inputKafRaw = Boolean.valueOf(properties.getProperty("inputkaf")); Boolean noTok = Boolean.valueOf(properties.getProperty("notok")); String kafVersion = properties.getProperty("kafversion"); Boolean offsets = Boolean.valueOf(properties.getProperty("offsets")); if (noTok) { final BufferedReader noTokReader = new BufferedReader( new StringReader(stringFromClient)); kaf = new KAFDocument(lang, kafVersion); final KAFDocument.LinguisticProcessor newLp = kaf.addLinguisticProcessor( "text", "ixa-pipe-tok-notok-" + lang, version + "-" + commit); newLp.setBeginTimestamp(); Annotate.tokensToKAF(noTokReader, kaf); newLp.setEndTimestamp(); kafString = kaf.toString(); noTokReader.close(); } else { if (inputKafRaw) { final BufferedReader kafReader = new BufferedReader( new StringReader(stringFromClient)); kaf = KAFDocument.createFromStream(kafReader); final String text = kaf.getRawText(); final StringReader stringReader = new StringReader(text); breader = new BufferedReader(stringReader); } else { kaf = new KAFDocument(lang, kafVersion); breader = new BufferedReader(new StringReader(stringFromClient)); } final Annotate annotator = new Annotate(breader, properties); if (outputFormat.equalsIgnoreCase("conll")) { if (offsets) { kafString = annotator.tokenizeToCoNLL(); } else { kafString = annotator.tokenizeToCoNLLOffsets(); } } else if (outputFormat.equalsIgnoreCase("oneline")) { kafString = annotator.tokenizeToText(); } else { final KAFDocument.LinguisticProcessor newLp = kaf .addLinguisticProcessor("text", "ixa-pipe-tok-" + lang, version + "-" + commit); newLp.setBeginTimestamp(); annotator.tokenizeToKAF(kaf); newLp.setEndTimestamp(); kafString = kaf.toString(); } breader.close(); } return kafString; }
[ "private", "String", "getAnnotations", "(", "final", "Properties", "properties", ",", "final", "String", "stringFromClient", ")", "throws", "IOException", ",", "JDOMException", "{", "BufferedReader", "breader", ";", "KAFDocument", "kaf", ";", "String", "kafString", ...
Get tokens. @param properties the options @param stringFromClient the original string @return the tokenized string @throws IOException if io problems @throws JDOMException if NAF problems
[ "Get", "tokens", "." ]
be38651a1267be37764b08acce9ee12a87fb61e7
https://github.com/ixa-ehu/ixa-pipe-tok/blob/be38651a1267be37764b08acce9ee12a87fb61e7/src/main/java/eus/ixa/ixa/pipe/tok/RuleBasedTokenizerServer.java#L175-L231
train
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java
BusinessUtils.resolveGenerics
public static <T> Class<?>[] resolveGenerics(Class<T> superType, Class<? extends T> subType) { checkNotNull(superType, "superType should not be null"); checkNotNull(subType, "subType should not be null"); Class<?> subTypeWithoutProxy = ProxyUtils.cleanProxy(subType); return TypeResolver.resolveRawArguments(TypeResolver.resolveGenericType(superType, subTypeWithoutProxy), subTypeWithoutProxy); }
java
public static <T> Class<?>[] resolveGenerics(Class<T> superType, Class<? extends T> subType) { checkNotNull(superType, "superType should not be null"); checkNotNull(subType, "subType should not be null"); Class<?> subTypeWithoutProxy = ProxyUtils.cleanProxy(subType); return TypeResolver.resolveRawArguments(TypeResolver.resolveGenericType(superType, subTypeWithoutProxy), subTypeWithoutProxy); }
[ "public", "static", "<", "T", ">", "Class", "<", "?", ">", "[", "]", "resolveGenerics", "(", "Class", "<", "T", ">", "superType", ",", "Class", "<", "?", "extends", "T", ">", "subType", ")", "{", "checkNotNull", "(", "superType", ",", "\"superType shou...
Resolve generics of a class relatively to a superclass. @param superType the superclass. @param subType the subclass. @param <T> the type of the superclass. @return the resolved types.
[ "Resolve", "generics", "of", "a", "class", "relatively", "to", "a", "superclass", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java#L50-L56
train
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java
BusinessUtils.resolveAggregateIdClass
@SuppressWarnings("unchecked") public static <A extends AggregateRoot<I>, I> Class<I> resolveAggregateIdClass(Class<A> aggregateRootClass) { checkNotNull(aggregateRootClass, "aggregateRootClass should not be null"); return (Class<I>) resolveGenerics(AggregateRoot.class, aggregateRootClass)[0]; }
java
@SuppressWarnings("unchecked") public static <A extends AggregateRoot<I>, I> Class<I> resolveAggregateIdClass(Class<A> aggregateRootClass) { checkNotNull(aggregateRootClass, "aggregateRootClass should not be null"); return (Class<I>) resolveGenerics(AggregateRoot.class, aggregateRootClass)[0]; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "A", "extends", "AggregateRoot", "<", "I", ">", ",", "I", ">", "Class", "<", "I", ">", "resolveAggregateIdClass", "(", "Class", "<", "A", ">", "aggregateRootClass", ")", "{", "che...
Returns the identifier class for an aggregate root class.
[ "Returns", "the", "identifier", "class", "for", "an", "aggregate", "root", "class", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java#L61-L65
train
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java
BusinessUtils.getAggregateIdClasses
public static Class<?>[] getAggregateIdClasses(Class<? extends AggregateRoot<?>>[] aggregateRootClasses) { checkNotNull(aggregateRootClasses, "aggregateRootClasses should not be null"); Class<?>[] result = new Class<?>[aggregateRootClasses.length]; for (int i = 0; i < aggregateRootClasses.length; i++) { result[i] = resolveGenerics(AggregateRoot.class, aggregateRootClasses[i])[0]; } return result; }
java
public static Class<?>[] getAggregateIdClasses(Class<? extends AggregateRoot<?>>[] aggregateRootClasses) { checkNotNull(aggregateRootClasses, "aggregateRootClasses should not be null"); Class<?>[] result = new Class<?>[aggregateRootClasses.length]; for (int i = 0; i < aggregateRootClasses.length; i++) { result[i] = resolveGenerics(AggregateRoot.class, aggregateRootClasses[i])[0]; } return result; }
[ "public", "static", "Class", "<", "?", ">", "[", "]", "getAggregateIdClasses", "(", "Class", "<", "?", "extends", "AggregateRoot", "<", "?", ">", ">", "[", "]", "aggregateRootClasses", ")", "{", "checkNotNull", "(", "aggregateRootClasses", ",", "\"aggregateRoo...
Returns an arrays of all identifier class corresponding the the given array of aggregate root classes.
[ "Returns", "an", "arrays", "of", "all", "identifier", "class", "corresponding", "the", "the", "given", "array", "of", "aggregate", "root", "classes", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java#L71-L78
train
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java
BusinessUtils.streamClasses
@SuppressWarnings("unchecked") public static <T> Stream<Class<? extends T>> streamClasses(Collection<Class<?>> classes, Class<? extends T> baseClass) { return classes .stream() .filter(ClassPredicates.classIsDescendantOf(baseClass)) .map(c -> (Class<T>) c); }
java
@SuppressWarnings("unchecked") public static <T> Stream<Class<? extends T>> streamClasses(Collection<Class<?>> classes, Class<? extends T> baseClass) { return classes .stream() .filter(ClassPredicates.classIsDescendantOf(baseClass)) .map(c -> (Class<T>) c); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "Stream", "<", "Class", "<", "?", "extends", "T", ">", ">", "streamClasses", "(", "Collection", "<", "Class", "<", "?", ">", ">", "classes", ",", "Class", "<", "?", ...
Checks that classes satisfying a specification are assignable to a base class and return a typed stream of it.
[ "Checks", "that", "classes", "satisfying", "a", "specification", "are", "assignable", "to", "a", "base", "class", "and", "return", "a", "typed", "stream", "of", "it", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java#L84-L91
train
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java
BusinessUtils.getQualifier
public static Optional<Annotation> getQualifier(AnnotatedElement annotatedElement) { AnnotatedElement cleanedAnnotatedElement; if (annotatedElement instanceof Class<?>) { cleanedAnnotatedElement = ProxyUtils.cleanProxy((Class<?>) annotatedElement); } else { cleanedAnnotatedElement = annotatedElement; } return Annotations.on(cleanedAnnotatedElement) .findAll() .filter(AnnotationPredicates.annotationAnnotatedWith(Qualifier.class, false)) .findFirst(); }
java
public static Optional<Annotation> getQualifier(AnnotatedElement annotatedElement) { AnnotatedElement cleanedAnnotatedElement; if (annotatedElement instanceof Class<?>) { cleanedAnnotatedElement = ProxyUtils.cleanProxy((Class<?>) annotatedElement); } else { cleanedAnnotatedElement = annotatedElement; } return Annotations.on(cleanedAnnotatedElement) .findAll() .filter(AnnotationPredicates.annotationAnnotatedWith(Qualifier.class, false)) .findFirst(); }
[ "public", "static", "Optional", "<", "Annotation", ">", "getQualifier", "(", "AnnotatedElement", "annotatedElement", ")", "{", "AnnotatedElement", "cleanedAnnotatedElement", ";", "if", "(", "annotatedElement", "instanceof", "Class", "<", "?", ">", ")", "{", "cleaned...
Optionally returns the qualifier annotation of a class.
[ "Optionally", "returns", "the", "qualifier", "annotation", "of", "a", "class", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java#L96-L107
train
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java
BusinessUtils.resolveDefaultQualifier
@SuppressWarnings("unchecked") public static <T> Optional<Key<T>> resolveDefaultQualifier(Map<Key<?>, Class<?>> bindings, ClassConfiguration<?> classConfiguration, String property, Class<?> qualifiedClass, TypeLiteral<T> genericInterface) { Key<T> key = null; if (classConfiguration != null && !classConfiguration.isEmpty()) { String qualifierName = classConfiguration.get(property); if (qualifierName != null && !"".equals(qualifierName)) { try { ClassLoader classLoader = ClassLoaders.findMostCompleteClassLoader(BusinessUtils.class); Class<?> qualifierClass = classLoader.loadClass(qualifierName); if (Annotation.class.isAssignableFrom(qualifierClass)) { key = Key.get(genericInterface, (Class<? extends Annotation>) qualifierClass); } else { throw BusinessException.createNew(BusinessErrorCode.CLASS_IS_NOT_AN_ANNOTATION) .put("class", qualifiedClass) .put("qualifier", qualifierName); } } catch (ClassNotFoundException e) { key = Key.get(genericInterface, Names.named(qualifierName)); } } } if (key == null || bindings.containsKey(Key.get(key.getTypeLiteral()))) { return Optional.empty(); } else { return Optional.of(key); } }
java
@SuppressWarnings("unchecked") public static <T> Optional<Key<T>> resolveDefaultQualifier(Map<Key<?>, Class<?>> bindings, ClassConfiguration<?> classConfiguration, String property, Class<?> qualifiedClass, TypeLiteral<T> genericInterface) { Key<T> key = null; if (classConfiguration != null && !classConfiguration.isEmpty()) { String qualifierName = classConfiguration.get(property); if (qualifierName != null && !"".equals(qualifierName)) { try { ClassLoader classLoader = ClassLoaders.findMostCompleteClassLoader(BusinessUtils.class); Class<?> qualifierClass = classLoader.loadClass(qualifierName); if (Annotation.class.isAssignableFrom(qualifierClass)) { key = Key.get(genericInterface, (Class<? extends Annotation>) qualifierClass); } else { throw BusinessException.createNew(BusinessErrorCode.CLASS_IS_NOT_AN_ANNOTATION) .put("class", qualifiedClass) .put("qualifier", qualifierName); } } catch (ClassNotFoundException e) { key = Key.get(genericInterface, Names.named(qualifierName)); } } } if (key == null || bindings.containsKey(Key.get(key.getTypeLiteral()))) { return Optional.empty(); } else { return Optional.of(key); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "Optional", "<", "Key", "<", "T", ">", ">", "resolveDefaultQualifier", "(", "Map", "<", "Key", "<", "?", ">", ",", "Class", "<", "?", ">", ">", "bindings", ",", "C...
Returns the Guice key qualified with the default qualifier configured for the specified class.
[ "Returns", "the", "Guice", "key", "qualified", "with", "the", "default", "qualifier", "configured", "for", "the", "specified", "class", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java#L112-L142
train
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java
BusinessUtils.includeSuperClasses
@SuppressWarnings("unchecked") public static Set<Class<? extends AggregateRoot<?>>> includeSuperClasses( Collection<Class<? extends AggregateRoot>> aggregateClasses) { Set<Class<? extends AggregateRoot<?>>> results = new HashSet<>(); for (Class<?> aggregateClass : aggregateClasses) { Class<?> classToAdd = aggregateClass; while (classToAdd != null) { if (AggregateRoot.class.isAssignableFrom(classToAdd) && !classToAdd.equals( BaseAggregateRoot.class) && !classToAdd.equals(AggregateRoot.class)) { results.add((Class<? extends AggregateRoot<?>>) classToAdd); classToAdd = classToAdd.getSuperclass(); } else { break; } } } return results; }
java
@SuppressWarnings("unchecked") public static Set<Class<? extends AggregateRoot<?>>> includeSuperClasses( Collection<Class<? extends AggregateRoot>> aggregateClasses) { Set<Class<? extends AggregateRoot<?>>> results = new HashSet<>(); for (Class<?> aggregateClass : aggregateClasses) { Class<?> classToAdd = aggregateClass; while (classToAdd != null) { if (AggregateRoot.class.isAssignableFrom(classToAdd) && !classToAdd.equals( BaseAggregateRoot.class) && !classToAdd.equals(AggregateRoot.class)) { results.add((Class<? extends AggregateRoot<?>>) classToAdd); classToAdd = classToAdd.getSuperclass(); } else { break; } } } return results; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Set", "<", "Class", "<", "?", "extends", "AggregateRoot", "<", "?", ">", ">", ">", "includeSuperClasses", "(", "Collection", "<", "Class", "<", "?", "extends", "AggregateRoot", ">", ">"...
Walks the class hierarchy of each class in the given collection and adds its superclasses to the mix.
[ "Walks", "the", "class", "hierarchy", "of", "each", "class", "in", "the", "given", "collection", "and", "adds", "its", "superclasses", "to", "the", "mix", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/BusinessUtils.java#L148-L165
train
ixa-ehu/ixa-pipe-tok
src/main/java/eus/ixa/ixa/pipe/tok/Annotate.java
Annotate.tokenizeToKAF
public void tokenizeToKAF(final KAFDocument kaf) throws IOException { int noSents = 0; int noParas = 1; List<List<Token>> tokens; if (isNoSeg) { String[] sentences = text.toArray(new String[text.size()]); tokens = tokenizer.tokenize(sentences); } else { final String[] sentences = segmenter.segmentSentence(); tokens = tokenizer.tokenize(sentences); } for (final List<Token> tokenizedSentence : tokens) { noSents = noSents + 1; for (final Token token : tokenizedSentence) { if (token.getTokenValue().equals(RuleBasedSegmenter.PARAGRAPH)) { ++noParas; // TODO debug this if (noSents < noParas) { ++noSents; } } else { final WF wf = kaf.newWF(token.startOffset(), token.getTokenValue(), noSents); wf.setLength(token.tokenLength()); wf.setPara(noParas); } } } }
java
public void tokenizeToKAF(final KAFDocument kaf) throws IOException { int noSents = 0; int noParas = 1; List<List<Token>> tokens; if (isNoSeg) { String[] sentences = text.toArray(new String[text.size()]); tokens = tokenizer.tokenize(sentences); } else { final String[] sentences = segmenter.segmentSentence(); tokens = tokenizer.tokenize(sentences); } for (final List<Token> tokenizedSentence : tokens) { noSents = noSents + 1; for (final Token token : tokenizedSentence) { if (token.getTokenValue().equals(RuleBasedSegmenter.PARAGRAPH)) { ++noParas; // TODO debug this if (noSents < noParas) { ++noSents; } } else { final WF wf = kaf.newWF(token.startOffset(), token.getTokenValue(), noSents); wf.setLength(token.tokenLength()); wf.setPara(noParas); } } } }
[ "public", "void", "tokenizeToKAF", "(", "final", "KAFDocument", "kaf", ")", "throws", "IOException", "{", "int", "noSents", "=", "0", ";", "int", "noParas", "=", "1", ";", "List", "<", "List", "<", "Token", ">", ">", "tokens", ";", "if", "(", "isNoSeg"...
Tokenize document to NAF. @param kaf the incoming naf document @throws IOException if io problems
[ "Tokenize", "document", "to", "NAF", "." ]
be38651a1267be37764b08acce9ee12a87fb61e7
https://github.com/ixa-ehu/ixa-pipe-tok/blob/be38651a1267be37764b08acce9ee12a87fb61e7/src/main/java/eus/ixa/ixa/pipe/tok/Annotate.java#L118-L149
train
ixa-ehu/ixa-pipe-tok
src/main/java/eus/ixa/ixa/pipe/tok/Annotate.java
Annotate.tokenizeToText
public String tokenizeToText() { final StringBuilder sb = new StringBuilder(); if (isNoSeg) { String[] sentences = text.toArray(new String[text.size()]); final List<List<Token>> tokens = tokenizer.tokenize(sentences); for (final List<Token> tokSentence : tokens) { for (final Token tok : tokSentence) { String tokenValue = tok.getTokenValue(); sb.append(tokenValue.trim()).append(DELIMITER); } sb.append(LINE_BREAK); } } else { final String[] sentences = segmenter.segmentSentence(); final List<List<Token>> tokens = tokenizer.tokenize(sentences); for (final List<Token> tokSentence : tokens) { for (final Token token : tokSentence) { String tokenValue = token.getTokenValue(); if (tokenValue.equals(RuleBasedSegmenter.PARAGRAPH)) { sb.append(DEFAULT_TOKEN_VALUE).append(LINE_BREAK); } else { sb.append(tokenValue.trim()).append(DELIMITER); } } sb.append(LINE_BREAK); } } return sb.toString().trim(); }
java
public String tokenizeToText() { final StringBuilder sb = new StringBuilder(); if (isNoSeg) { String[] sentences = text.toArray(new String[text.size()]); final List<List<Token>> tokens = tokenizer.tokenize(sentences); for (final List<Token> tokSentence : tokens) { for (final Token tok : tokSentence) { String tokenValue = tok.getTokenValue(); sb.append(tokenValue.trim()).append(DELIMITER); } sb.append(LINE_BREAK); } } else { final String[] sentences = segmenter.segmentSentence(); final List<List<Token>> tokens = tokenizer.tokenize(sentences); for (final List<Token> tokSentence : tokens) { for (final Token token : tokSentence) { String tokenValue = token.getTokenValue(); if (tokenValue.equals(RuleBasedSegmenter.PARAGRAPH)) { sb.append(DEFAULT_TOKEN_VALUE).append(LINE_BREAK); } else { sb.append(tokenValue.trim()).append(DELIMITER); } } sb.append(LINE_BREAK); } } return sb.toString().trim(); }
[ "public", "String", "tokenizeToText", "(", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "isNoSeg", ")", "{", "String", "[", "]", "sentences", "=", "text", ".", "toArray", "(", "new", "String", "[", "t...
Tokenize and Segment input text. Outputs tokens in running text format one sentence per line. @return String tokenized text
[ "Tokenize", "and", "Segment", "input", "text", ".", "Outputs", "tokens", "in", "running", "text", "format", "one", "sentence", "per", "line", "." ]
be38651a1267be37764b08acce9ee12a87fb61e7
https://github.com/ixa-ehu/ixa-pipe-tok/blob/be38651a1267be37764b08acce9ee12a87fb61e7/src/main/java/eus/ixa/ixa/pipe/tok/Annotate.java#L207-L236
train
sap-production/xcode-maven-plugin
modules/xcode-maven-plugin/src/main/java/com/sap/prd/mobile/ios/mios/XCodePackageManager.java
XCodePackageManager.packageArtifacts
void packageArtifacts(final File compileDir, final MavenProject project, final Set<String> bundles) throws IOException, XCodeException { File mainArtifact = createMainArtifactFile(project); attachBundle(compileDir, project, bundles, mainArtifact); final File mainArtifactFile = archiveMainArtifact(project, mainArtifact); setMainArtifact(project, mainArtifactFile); }
java
void packageArtifacts(final File compileDir, final MavenProject project, final Set<String> bundles) throws IOException, XCodeException { File mainArtifact = createMainArtifactFile(project); attachBundle(compileDir, project, bundles, mainArtifact); final File mainArtifactFile = archiveMainArtifact(project, mainArtifact); setMainArtifact(project, mainArtifactFile); }
[ "void", "packageArtifacts", "(", "final", "File", "compileDir", ",", "final", "MavenProject", "project", ",", "final", "Set", "<", "String", ">", "bundles", ")", "throws", "IOException", ",", "XCodeException", "{", "File", "mainArtifact", "=", "createMainArtifactF...
Packages all the artifacts. The main artifact is set and all side artifacts are attached for deployment. @param bundles @param buildDir
[ "Packages", "all", "the", "artifacts", ".", "The", "main", "artifact", "is", "set", "and", "all", "side", "artifacts", "are", "attached", "for", "deployment", "." ]
3f8aa380f501a1d7602f33fef2f6348354e7eb7c
https://github.com/sap-production/xcode-maven-plugin/blob/3f8aa380f501a1d7602f33fef2f6348354e7eb7c/modules/xcode-maven-plugin/src/main/java/com/sap/prd/mobile/ios/mios/XCodePackageManager.java#L65-L76
train
seedstack/business
core/src/main/java/org/seedstack/business/internal/domain/DefaultRepositoryCollector.java
DefaultRepositoryCollector.collectFromAggregates
Collection<BindingStrategy> collectFromAggregates(Collection<Class<? extends AggregateRoot>> aggregateClasses) { Collection<BindingStrategy> bindingStrategies = new ArrayList<>(); Map<Type[], Key<?>> allGenerics = new HashMap<>(); for (Class<? extends AggregateRoot<?>> aggregateClass : BusinessUtils.includeSuperClasses(aggregateClasses)) { Type[] generics = getTypes(aggregateClass); TypeLiteral<?> genericInterface = TypeLiteral.get(newParameterizedType(Repository.class, generics)); allGenerics.put(generics, resolveDefaultQualifier( bindings, application.getConfiguration(aggregateClass), DEFAULT_REPOSITORY_KEY, aggregateClass, genericInterface ).orElse(null) ); } // Create a binding strategy for each default repository implementation for (Class<? extends Repository> defaultRepoImpl : defaultRepositoryImplementations) { bindingStrategies.add(new GenericBindingStrategy<>( Repository.class, defaultRepoImpl, allGenerics) ); } return bindingStrategies; }
java
Collection<BindingStrategy> collectFromAggregates(Collection<Class<? extends AggregateRoot>> aggregateClasses) { Collection<BindingStrategy> bindingStrategies = new ArrayList<>(); Map<Type[], Key<?>> allGenerics = new HashMap<>(); for (Class<? extends AggregateRoot<?>> aggregateClass : BusinessUtils.includeSuperClasses(aggregateClasses)) { Type[] generics = getTypes(aggregateClass); TypeLiteral<?> genericInterface = TypeLiteral.get(newParameterizedType(Repository.class, generics)); allGenerics.put(generics, resolveDefaultQualifier( bindings, application.getConfiguration(aggregateClass), DEFAULT_REPOSITORY_KEY, aggregateClass, genericInterface ).orElse(null) ); } // Create a binding strategy for each default repository implementation for (Class<? extends Repository> defaultRepoImpl : defaultRepositoryImplementations) { bindingStrategies.add(new GenericBindingStrategy<>( Repository.class, defaultRepoImpl, allGenerics) ); } return bindingStrategies; }
[ "Collection", "<", "BindingStrategy", ">", "collectFromAggregates", "(", "Collection", "<", "Class", "<", "?", "extends", "AggregateRoot", ">", ">", "aggregateClasses", ")", "{", "Collection", "<", "BindingStrategy", ">", "bindingStrategies", "=", "new", "ArrayList"...
Prepares the binding strategies which bind default repositories. The specificity here is that it could have multiple implementations of default repository, i.e. one per persistence. @param aggregateClasses the aggregates classes to collect repositories from. @return a binding strategy
[ "Prepares", "the", "binding", "strategies", "which", "bind", "default", "repositories", ".", "The", "specificity", "here", "is", "that", "it", "could", "have", "multiple", "implementations", "of", "default", "repository", "i", ".", "e", ".", "one", "per", "per...
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/domain/DefaultRepositoryCollector.java#L52-L79
train
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/PluginUtils.java
PluginUtils.classpathRequestForDescendantTypesOf
@SuppressWarnings("unchecked") public static <T extends Class<?>> Map<T, Specification<? extends T>> classpathRequestForDescendantTypesOf( ClasspathScanRequestBuilder classpathScanRequestBuilder, Collection<T> interfaces) { Map<T, Specification<? extends T>> specsByInterface = new HashMap<>(); for (T anInterface : interfaces) { LOGGER.trace("Request implementations of: {}", anInterface.getName()); Specification<Class<?>> spec = new SpecificationBuilder<>( classIsDescendantOf(anInterface).and(classIsInterface().negate()) .and(classModifierIs(Modifier.ABSTRACT).negate())).build(); classpathScanRequestBuilder.specification(spec); specsByInterface.put(anInterface, (Specification<? extends T>) spec); } return specsByInterface; }
java
@SuppressWarnings("unchecked") public static <T extends Class<?>> Map<T, Specification<? extends T>> classpathRequestForDescendantTypesOf( ClasspathScanRequestBuilder classpathScanRequestBuilder, Collection<T> interfaces) { Map<T, Specification<? extends T>> specsByInterface = new HashMap<>(); for (T anInterface : interfaces) { LOGGER.trace("Request implementations of: {}", anInterface.getName()); Specification<Class<?>> spec = new SpecificationBuilder<>( classIsDescendantOf(anInterface).and(classIsInterface().negate()) .and(classModifierIs(Modifier.ABSTRACT).negate())).build(); classpathScanRequestBuilder.specification(spec); specsByInterface.put(anInterface, (Specification<? extends T>) spec); } return specsByInterface; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Class", "<", "?", ">", ">", "Map", "<", "T", ",", "Specification", "<", "?", "extends", "T", ">", ">", "classpathRequestForDescendantTypesOf", "(", "ClasspathScanRequ...
Builds a ClasspathScanRequest to find all the descendant of the given interfaces. @param <T> the class of the interface. @param classpathScanRequestBuilder the Nuun classpath scan request builder. @param interfaces the interfaces. @return a map where the key is an interface and the value is a specification matching descendants of this interface.
[ "Builds", "a", "ClasspathScanRequest", "to", "find", "all", "the", "descendant", "of", "the", "given", "interfaces", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/PluginUtils.java#L48-L61
train
ixa-ehu/ixa-pipe-tok
src/main/java/eus/ixa/ixa/pipe/tok/CLI.java
CLI.run
public final void run(final String[] args) throws IOException, JDOMException { try { Parameters parameters = cliArgumentsParser.parse(args); if (parameters.getStrategy() == Strategy.TOKENIZE) { annotate(parameters); } else if (parameters.getStrategy() == Strategy.SERVER) { server(parameters); } else if (parameters.getStrategy() == Strategy.CLIENT) { client(parameters); } else { System.out.println(String.format( "Invalid sub-command [%s]. Sub-commands accepted are: (tok|server|client)", parameters.getStrategyString())); } } catch (final ArgumentParserException e) { cliArgumentsParser.handleError(e); System.out.println("Run java -jar target/ixa-pipe-tok-" + VERSION + ".jar (tok|server|client) -help for details"); System.exit(1); } }
java
public final void run(final String[] args) throws IOException, JDOMException { try { Parameters parameters = cliArgumentsParser.parse(args); if (parameters.getStrategy() == Strategy.TOKENIZE) { annotate(parameters); } else if (parameters.getStrategy() == Strategy.SERVER) { server(parameters); } else if (parameters.getStrategy() == Strategy.CLIENT) { client(parameters); } else { System.out.println(String.format( "Invalid sub-command [%s]. Sub-commands accepted are: (tok|server|client)", parameters.getStrategyString())); } } catch (final ArgumentParserException e) { cliArgumentsParser.handleError(e); System.out.println("Run java -jar target/ixa-pipe-tok-" + VERSION + ".jar (tok|server|client) -help for details"); System.exit(1); } }
[ "public", "final", "void", "run", "(", "final", "String", "[", "]", "args", ")", "throws", "IOException", ",", "JDOMException", "{", "try", "{", "Parameters", "parameters", "=", "cliArgumentsParser", ".", "parse", "(", "args", ")", ";", "if", "(", "paramet...
Run the appropriate command based on the command line parameters. @param args the arguments passed through the CLI @throws IOException exception if problems with the incoming data @throws JDOMException a xml exception
[ "Run", "the", "appropriate", "command", "based", "on", "the", "command", "line", "parameters", "." ]
be38651a1267be37764b08acce9ee12a87fb61e7
https://github.com/ixa-ehu/ixa-pipe-tok/blob/be38651a1267be37764b08acce9ee12a87fb61e7/src/main/java/eus/ixa/ixa/pipe/tok/CLI.java#L96-L116
train
seedstack/business
core/src/main/java/org/seedstack/business/domain/SortOption.java
SortOption.add
public SortOption add(String attribute, Direction direction) { sortedAttributes.add(new SortedAttribute(attribute, direction)); return this; }
java
public SortOption add(String attribute, Direction direction) { sortedAttributes.add(new SortedAttribute(attribute, direction)); return this; }
[ "public", "SortOption", "add", "(", "String", "attribute", ",", "Direction", "direction", ")", "{", "sortedAttributes", ".", "add", "(", "new", "SortedAttribute", "(", "attribute", ",", "direction", ")", ")", ";", "return", "this", ";", "}" ]
Adds the specified attribute to the list of sorted attributes with the specified direction. @param attribute the attribute to sort. @param direction the direction this attribute will be sorted with. @return the sort option itself.
[ "Adds", "the", "specified", "attribute", "to", "the", "list", "of", "sorted", "attributes", "with", "the", "specified", "direction", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/domain/SortOption.java#L63-L66
train
seedstack/business
core/src/main/java/org/seedstack/business/domain/SortOption.java
SortOption.buildComparator
public <T> Comparator<T> buildComparator() { if (sortedAttributes.isEmpty()) { return (o1, o2) -> 0; } else { Comparator<T> comparator = null; for (SortedAttribute sortedAttribute : sortedAttributes) { if (comparator == null) { comparator = buildComparator(sortedAttribute); } else { comparator = comparator.thenComparing(buildComparator(sortedAttribute)); } } return comparator; } }
java
public <T> Comparator<T> buildComparator() { if (sortedAttributes.isEmpty()) { return (o1, o2) -> 0; } else { Comparator<T> comparator = null; for (SortedAttribute sortedAttribute : sortedAttributes) { if (comparator == null) { comparator = buildComparator(sortedAttribute); } else { comparator = comparator.thenComparing(buildComparator(sortedAttribute)); } } return comparator; } }
[ "public", "<", "T", ">", "Comparator", "<", "T", ">", "buildComparator", "(", ")", "{", "if", "(", "sortedAttributes", ".", "isEmpty", "(", ")", ")", "{", "return", "(", "o1", ",", "o2", ")", "->", "0", ";", "}", "else", "{", "Comparator", "<", "...
Builds a comparator allowing the sorting of objects according to the sort criteria. @param <T> the type of the object to compare. @return the comparator.
[ "Builds", "a", "comparator", "allowing", "the", "sorting", "of", "objects", "according", "to", "the", "sort", "criteria", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/domain/SortOption.java#L83-L97
train
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/NodeBuilder.java
NodeBuilder.findPartnerNodeId
private int findPartnerNodeId( Tree<Row> current, Type type ){ switch( type ) { case JOIN_FIRST: case JOIN_ALL: case WHILE_DO_END: // The partner is the previous sibling which is the SPLIT or WHILE_DO_BEGIN return current.getPrevious().getContent().getId(); case DO_WHILE_BEGIN: // The partner is the next sibling which is the DO_WHILE_END return current.getNext().getContent().getMainElement().getId(); case END_IF: // The partner is the first previous IF (there may be ELSE_IF and ELSE siblings between IF and this END_IF) Tree<Row> if_ = current; while( !Type.IF.equals( if_.getContent().getType() ) ){ if_ = if_.getPrevious(); } return if_.getContent().getId(); default : throw new IllegalStateException(); } }
java
private int findPartnerNodeId( Tree<Row> current, Type type ){ switch( type ) { case JOIN_FIRST: case JOIN_ALL: case WHILE_DO_END: // The partner is the previous sibling which is the SPLIT or WHILE_DO_BEGIN return current.getPrevious().getContent().getId(); case DO_WHILE_BEGIN: // The partner is the next sibling which is the DO_WHILE_END return current.getNext().getContent().getMainElement().getId(); case END_IF: // The partner is the first previous IF (there may be ELSE_IF and ELSE siblings between IF and this END_IF) Tree<Row> if_ = current; while( !Type.IF.equals( if_.getContent().getType() ) ){ if_ = if_.getPrevious(); } return if_.getContent().getId(); default : throw new IllegalStateException(); } }
[ "private", "int", "findPartnerNodeId", "(", "Tree", "<", "Row", ">", "current", ",", "Type", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "JOIN_FIRST", ":", "case", "JOIN_ALL", ":", "case", "WHILE_DO_END", ":", "// The partner is the previous sib...
Some node producing elements do not define an id themselves but deduce their id based on their block-opening or block-closing partner. E.g. a WHILE_DO_END deduces its id based on its WHILE_DO_BEGIN partner.
[ "Some", "node", "producing", "elements", "do", "not", "define", "an", "id", "themselves", "but", "deduce", "their", "id", "based", "on", "their", "block", "-", "opening", "or", "block", "-", "closing", "partner", ".", "E", ".", "g", ".", "a", "WHILE_DO_E...
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/NodeBuilder.java#L176-L196
train
sap-production/xcode-maven-plugin
modules/xcode-maven-plugin/src/main/java/com/sap/prd/mobile/ios/mios/AbstractXCodeMojo.java
AbstractXCodeMojo.zipSubfolder
protected File zipSubfolder(File rootDir, String zipSubFolder, String zipFileName, String archiveFolder) throws MojoExecutionException { int resultCode = 0; try { File scriptDirectory = new File(project.getBuild().getDirectory(), "scripts").getCanonicalFile(); scriptDirectory.deleteOnExit(); if (archiveFolder != null) { resultCode = ScriptRunner.copyAndExecuteScript(System.out, "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh", scriptDirectory, rootDir.getCanonicalPath(), zipSubFolder, zipFileName, archiveFolder); } else { resultCode = ScriptRunner.copyAndExecuteScript(System.out, "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh", scriptDirectory, rootDir.getCanonicalPath(), zipSubFolder, zipFileName); } } catch (Exception ex) { throw new MojoExecutionException("Cannot create zip file " + zipFileName + ". Check log for details.", ex); } if (resultCode != 0) { throw new MojoExecutionException("Cannot create zip file " + zipFileName + ". Check log for details."); } getLog().info("Zip file '" + zipFileName + "' created."); return new File(rootDir, zipFileName); }
java
protected File zipSubfolder(File rootDir, String zipSubFolder, String zipFileName, String archiveFolder) throws MojoExecutionException { int resultCode = 0; try { File scriptDirectory = new File(project.getBuild().getDirectory(), "scripts").getCanonicalFile(); scriptDirectory.deleteOnExit(); if (archiveFolder != null) { resultCode = ScriptRunner.copyAndExecuteScript(System.out, "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh", scriptDirectory, rootDir.getCanonicalPath(), zipSubFolder, zipFileName, archiveFolder); } else { resultCode = ScriptRunner.copyAndExecuteScript(System.out, "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh", scriptDirectory, rootDir.getCanonicalPath(), zipSubFolder, zipFileName); } } catch (Exception ex) { throw new MojoExecutionException("Cannot create zip file " + zipFileName + ". Check log for details.", ex); } if (resultCode != 0) { throw new MojoExecutionException("Cannot create zip file " + zipFileName + ". Check log for details."); } getLog().info("Zip file '" + zipFileName + "' created."); return new File(rootDir, zipFileName); }
[ "protected", "File", "zipSubfolder", "(", "File", "rootDir", ",", "String", "zipSubFolder", ",", "String", "zipFileName", ",", "String", "archiveFolder", ")", "throws", "MojoExecutionException", "{", "int", "resultCode", "=", "0", ";", "try", "{", "File", "scrip...
Calls a shell script in order to zip a folder. We have to call a shell script as Java cannot zip symbolic links. @param rootDir the directory where the zip command shall be executed @param zipSubFolder the subfolder to be zipped @param zipFileName the name of the zipFile (will be located in the rootDir) @param archiveFolder an optional folder name if the zipSubFolder folder shall be placed inside the zip into a parent folder @return the zip file @throws MojoExecutionException
[ "Calls", "a", "shell", "script", "in", "order", "to", "zip", "a", "folder", ".", "We", "have", "to", "call", "a", "shell", "script", "as", "Java", "cannot", "zip", "symbolic", "links", "." ]
3f8aa380f501a1d7602f33fef2f6348354e7eb7c
https://github.com/sap-production/xcode-maven-plugin/blob/3f8aa380f501a1d7602f33fef2f6348354e7eb7c/modules/xcode-maven-plugin/src/main/java/com/sap/prd/mobile/ios/mios/AbstractXCodeMojo.java#L274-L303
train
zutnop/telekom-workflow-engine
telekom-workflow-web/src/main/java/ee/telekom/workflow/web/rest/RestController.java
RestController.findInstances
@RequestMapping(method = RequestMethod.GET, value = "/workflowInstance/search", produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE}) public ResponseEntity<List<WorkflowInstanceRestModel>> findInstances( @RequestParam(required = false) String label1, @RequestParam(required = false) String label2, @RequestParam(required = false) Boolean activeOnly ){ if( activeOnly == null ){ activeOnly = true; } label1 = StringUtils.trimToNull( label1 ); label2 = StringUtils.trimToNull( label2 ); List<WorkflowInstanceState> woins = facade.findWorkflowInstancesByLabels( label1, label2, activeOnly ); return new ResponseEntity<>( createInstancesModel( woins ), HttpStatus.OK ); }
java
@RequestMapping(method = RequestMethod.GET, value = "/workflowInstance/search", produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE}) public ResponseEntity<List<WorkflowInstanceRestModel>> findInstances( @RequestParam(required = false) String label1, @RequestParam(required = false) String label2, @RequestParam(required = false) Boolean activeOnly ){ if( activeOnly == null ){ activeOnly = true; } label1 = StringUtils.trimToNull( label1 ); label2 = StringUtils.trimToNull( label2 ); List<WorkflowInstanceState> woins = facade.findWorkflowInstancesByLabels( label1, label2, activeOnly ); return new ResponseEntity<>( createInstancesModel( woins ), HttpStatus.OK ); }
[ "@", "RequestMapping", "(", "method", "=", "RequestMethod", ".", "GET", ",", "value", "=", "\"/workflowInstance/search\"", ",", "produces", "=", "{", "MediaType", ".", "APPLICATION_JSON_VALUE", ",", "MediaType", ".", "TEXT_XML_VALUE", "}", ")", "public", "Response...
Searches workflow instance's that match the given criteria. <pre> Request: GET /workflowInstance/search?label1=aClientId Response: OK, [{refNum: 1, workflowName: "credit.step1", workflowVersion: null, label1: "aClientId", label2: null, status: NEW}, {refNum: 2, workflowName: "credit.client.step1", workflowVersion: null, label1: "aClientId", label2: "anotherIdentificator", status: NEW}] </pre>
[ "Searches", "workflow", "instance", "s", "that", "match", "the", "given", "criteria", "." ]
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-web/src/main/java/ee/telekom/workflow/web/rest/RestController.java#L236-L248
train
dverstap/jsmiparser
jsmiparser-api/src/main/java/org/jsmiparser/smi/SmiModule.java
SmiModule.resolveReference
public SmiSymbol resolveReference(IdToken idToken, XRefProblemReporter reporter) { // doesn't work anymore with hardcoded missing symbols // if (!idToken.getLocation().getSource().equals(getIdToken().getLocation().getSource())) { // // note this check is not entirely fool-proof in case multiple modules are located in one file // throw new IllegalArgumentException("Resolving references is only allowed from inside the same module"); // } SmiSymbol result = findSymbol(idToken.getId()); if (result == null) { result = findImportedSymbol(idToken.getId()); } if (result == null) { List<SmiSymbol> symbols = getMib().getSymbols().findAll(idToken.getId()); if (symbols.size() == 1) { result = symbols.get(0); } else if (symbols.size() > 0) { result = determineBestMatch(idToken, symbols); } } if (result == null && reporter != null) { reporter.reportCannotFindSymbol(idToken); } return result; }
java
public SmiSymbol resolveReference(IdToken idToken, XRefProblemReporter reporter) { // doesn't work anymore with hardcoded missing symbols // if (!idToken.getLocation().getSource().equals(getIdToken().getLocation().getSource())) { // // note this check is not entirely fool-proof in case multiple modules are located in one file // throw new IllegalArgumentException("Resolving references is only allowed from inside the same module"); // } SmiSymbol result = findSymbol(idToken.getId()); if (result == null) { result = findImportedSymbol(idToken.getId()); } if (result == null) { List<SmiSymbol> symbols = getMib().getSymbols().findAll(idToken.getId()); if (symbols.size() == 1) { result = symbols.get(0); } else if (symbols.size() > 0) { result = determineBestMatch(idToken, symbols); } } if (result == null && reporter != null) { reporter.reportCannotFindSymbol(idToken); } return result; }
[ "public", "SmiSymbol", "resolveReference", "(", "IdToken", "idToken", ",", "XRefProblemReporter", "reporter", ")", "{", "// doesn't work anymore with hardcoded missing symbols", "// if (!idToken.getLocation().getSource().equals(getIdToken().getLocation().getSource())) {", "// ...
Resolves a reference from within this module to a symbol in the same module, an imported module or in the whole mib @param idToken Token of the identifier that has to be resolved. @param reporter If not null, the reporter will be used to reporter the not found error message. @return The symbol that was found, or null.
[ "Resolves", "a", "reference", "from", "within", "this", "module", "to", "a", "symbol", "in", "the", "same", "module", "an", "imported", "module", "or", "in", "the", "whole", "mib" ]
1ba26599e573682d17e34363a85cf3a42cc06383
https://github.com/dverstap/jsmiparser/blob/1ba26599e573682d17e34363a85cf3a42cc06383/jsmiparser-api/src/main/java/org/jsmiparser/smi/SmiModule.java#L340-L364
train
dverstap/jsmiparser
jsmiparser-api/src/main/java/org/jsmiparser/smi/SmiMib.java
SmiMib.findByOidPrefix
public SmiOidNode findByOidPrefix(int... oid) { SmiOidNode parent = getRootNode(); for (int subId : oid) { SmiOidNode result = parent.findChild(subId); if (result == null) { return parent; } parent = result; } return null; }
java
public SmiOidNode findByOidPrefix(int... oid) { SmiOidNode parent = getRootNode(); for (int subId : oid) { SmiOidNode result = parent.findChild(subId); if (result == null) { return parent; } parent = result; } return null; }
[ "public", "SmiOidNode", "findByOidPrefix", "(", "int", "...", "oid", ")", "{", "SmiOidNode", "parent", "=", "getRootNode", "(", ")", ";", "for", "(", "int", "subId", ":", "oid", ")", "{", "SmiOidNode", "result", "=", "parent", ".", "findChild", "(", "sub...
This method can be used to find the best match for an OID. By comparing the length of the OID of the result and the input OID you can determine how many and which subIds where not matched. @param oid For which the best match is searched. @return Best matching SmiOidValue, or null if none is found.
[ "This", "method", "can", "be", "used", "to", "find", "the", "best", "match", "for", "an", "OID", ".", "By", "comparing", "the", "length", "of", "the", "OID", "of", "the", "result", "and", "the", "input", "OID", "you", "can", "determine", "how", "many",...
1ba26599e573682d17e34363a85cf3a42cc06383
https://github.com/dverstap/jsmiparser/blob/1ba26599e573682d17e34363a85cf3a42cc06383/jsmiparser-api/src/main/java/org/jsmiparser/smi/SmiMib.java#L239-L249
train
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/graph/core/GraphValidatorImpl.java
GraphValidatorImpl.validateReservedVariableNames
private static void validateReservedVariableNames( Graph graph, List<String> errors ){ for( Node node : graph.getNodes() ){ if( node instanceof BeanAsyncCallActivity ){ validateReservedVariablesFromMapping( ((BeanAsyncCallActivity)node).getResultMapping(), graph, node, errors ); } else if( node instanceof BeanCallActivity ){ validateReservedVariablesFromMapping( ((BeanCallActivity)node).getResultMapping(), graph, node, errors ); } else if( node instanceof CreateNewInstanceActivity ){ MapMapping mapMapping = ((CreateNewInstanceActivity)node).getArgumentsMapping(); if( mapMapping != null && mapMapping.getEntryMappings() != null ){ for( String key : mapMapping.getEntryMappings().keySet() ){ validateReservedVariable( key, graph, node, errors ); } } } else if( node instanceof HumanTaskActivity ){ validateReservedVariablesFromMapping( ((HumanTaskActivity)node).getResultMapping(), graph, node, errors ); } else if( node instanceof ObjectCallActivity ){ validateReservedVariablesFromMapping( ((ObjectCallActivity)node).getResultMapping(), graph, node, errors ); } else if( node instanceof SetAttributeActivity ){ validateReservedVariable( ((SetAttributeActivity)node).getAttribute(), graph, node, errors ); } else if( node instanceof CatchSignal ){ validateReservedVariablesFromMapping( ((CatchSignal)node).getResultMapping(), graph, node, errors ); } } }
java
private static void validateReservedVariableNames( Graph graph, List<String> errors ){ for( Node node : graph.getNodes() ){ if( node instanceof BeanAsyncCallActivity ){ validateReservedVariablesFromMapping( ((BeanAsyncCallActivity)node).getResultMapping(), graph, node, errors ); } else if( node instanceof BeanCallActivity ){ validateReservedVariablesFromMapping( ((BeanCallActivity)node).getResultMapping(), graph, node, errors ); } else if( node instanceof CreateNewInstanceActivity ){ MapMapping mapMapping = ((CreateNewInstanceActivity)node).getArgumentsMapping(); if( mapMapping != null && mapMapping.getEntryMappings() != null ){ for( String key : mapMapping.getEntryMappings().keySet() ){ validateReservedVariable( key, graph, node, errors ); } } } else if( node instanceof HumanTaskActivity ){ validateReservedVariablesFromMapping( ((HumanTaskActivity)node).getResultMapping(), graph, node, errors ); } else if( node instanceof ObjectCallActivity ){ validateReservedVariablesFromMapping( ((ObjectCallActivity)node).getResultMapping(), graph, node, errors ); } else if( node instanceof SetAttributeActivity ){ validateReservedVariable( ((SetAttributeActivity)node).getAttribute(), graph, node, errors ); } else if( node instanceof CatchSignal ){ validateReservedVariablesFromMapping( ((CatchSignal)node).getResultMapping(), graph, node, errors ); } } }
[ "private", "static", "void", "validateReservedVariableNames", "(", "Graph", "graph", ",", "List", "<", "String", ">", "errors", ")", "{", "for", "(", "Node", "node", ":", "graph", ".", "getNodes", "(", ")", ")", "{", "if", "(", "node", "instanceof", "Bea...
check through all the node types which use mappings which set Environment attributes
[ "check", "through", "all", "the", "node", "types", "which", "use", "mappings", "which", "set", "Environment", "attributes" ]
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/graph/core/GraphValidatorImpl.java#L108-L137
train
dverstap/jsmiparser
jsmiparser-api/src/main/java/org/jsmiparser/phase/file/ModuleParser.java
ModuleParser.createIntegerType
public SmiType createIntegerType(IdToken idToken, IntKeywordToken intToken, Token applicationTagToken, List<SmiNamedNumber> namedNumbers, List<SmiRange> rangeConstraints) { if (idToken == null && intToken.getPrimitiveType() == INTEGER && namedNumbers == null && rangeConstraints == null) { return SmiConstants.INTEGER_TYPE; } else if (idToken != null || namedNumbers != null || rangeConstraints != null) { SmiType type = createPotentiallyTaggedType(idToken, applicationTagToken); if (intToken.getPrimitiveType() == INTEGER) { type.setBaseType(SmiConstants.INTEGER_TYPE); } else { type.setBaseType(new SmiReferencedType(intToken, m_module)); } type.setEnumValues(namedNumbers); type.setRangeConstraints(rangeConstraints); return type; } return new SmiReferencedType(intToken, m_module); }
java
public SmiType createIntegerType(IdToken idToken, IntKeywordToken intToken, Token applicationTagToken, List<SmiNamedNumber> namedNumbers, List<SmiRange> rangeConstraints) { if (idToken == null && intToken.getPrimitiveType() == INTEGER && namedNumbers == null && rangeConstraints == null) { return SmiConstants.INTEGER_TYPE; } else if (idToken != null || namedNumbers != null || rangeConstraints != null) { SmiType type = createPotentiallyTaggedType(idToken, applicationTagToken); if (intToken.getPrimitiveType() == INTEGER) { type.setBaseType(SmiConstants.INTEGER_TYPE); } else { type.setBaseType(new SmiReferencedType(intToken, m_module)); } type.setEnumValues(namedNumbers); type.setRangeConstraints(rangeConstraints); return type; } return new SmiReferencedType(intToken, m_module); }
[ "public", "SmiType", "createIntegerType", "(", "IdToken", "idToken", ",", "IntKeywordToken", "intToken", ",", "Token", "applicationTagToken", ",", "List", "<", "SmiNamedNumber", ">", "namedNumbers", ",", "List", "<", "SmiRange", ">", "rangeConstraints", ")", "{", ...
and resolve references to INTEGER, BITS, ... during the XRef phase
[ "and", "resolve", "references", "to", "INTEGER", "BITS", "...", "during", "the", "XRef", "phase" ]
1ba26599e573682d17e34363a85cf3a42cc06383
https://github.com/dverstap/jsmiparser/blob/1ba26599e573682d17e34363a85cf3a42cc06383/jsmiparser-api/src/main/java/org/jsmiparser/phase/file/ModuleParser.java#L246-L261
train
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/util/YesNoUtil.java
YesNoUtil.asString
public static String asString(Boolean flag) { return flag == null ? null : (flag ? YES_AS_STRING : NO_AS_STRING); }
java
public static String asString(Boolean flag) { return flag == null ? null : (flag ? YES_AS_STRING : NO_AS_STRING); }
[ "public", "static", "String", "asString", "(", "Boolean", "flag", ")", "{", "return", "flag", "==", "null", "?", "null", ":", "(", "flag", "?", "YES_AS_STRING", ":", "NO_AS_STRING", ")", ";", "}" ]
Converts the given flag into a string of either "Y", "N" or null.
[ "Converts", "the", "given", "flag", "into", "a", "string", "of", "either", "Y", "N", "or", "null", "." ]
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/util/YesNoUtil.java#L14-L16
train
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/util/YesNoUtil.java
YesNoUtil.asBoolean
public static Boolean asBoolean(String flag) { return flag == null ? null : flag.equals(YES_AS_STRING); }
java
public static Boolean asBoolean(String flag) { return flag == null ? null : flag.equals(YES_AS_STRING); }
[ "public", "static", "Boolean", "asBoolean", "(", "String", "flag", ")", "{", "return", "flag", "==", "null", "?", "null", ":", "flag", ".", "equals", "(", "YES_AS_STRING", ")", ";", "}" ]
Converts the given string into a Boolean flag of either true, false or null.
[ "Converts", "the", "given", "string", "into", "a", "Boolean", "flag", "of", "either", "true", "false", "or", "null", "." ]
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/util/YesNoUtil.java#L22-L24
train
sap-production/xcode-maven-plugin
modules/xcode-maven-plugin/src/main/java/com/sap/prd/mobile/ios/mios/BuildContextAwareMojo.java
BuildContextAwareMojo.getInfoPListAccessor
protected PListAccessor getInfoPListAccessor(XCodeContext.SourceCodeLocation location, String configuration, String sdk) throws MojoExecutionException, XCodeException { File plistFile = getPListFile(location, configuration, sdk); if (!plistFile.isFile()) { throw new MojoExecutionException("The Xcode project refers to the Info.plist file '" + plistFile + "' that does not exist."); } return new PListAccessor(plistFile); }
java
protected PListAccessor getInfoPListAccessor(XCodeContext.SourceCodeLocation location, String configuration, String sdk) throws MojoExecutionException, XCodeException { File plistFile = getPListFile(location, configuration, sdk); if (!plistFile.isFile()) { throw new MojoExecutionException("The Xcode project refers to the Info.plist file '" + plistFile + "' that does not exist."); } return new PListAccessor(plistFile); }
[ "protected", "PListAccessor", "getInfoPListAccessor", "(", "XCodeContext", ".", "SourceCodeLocation", "location", ",", "String", "configuration", ",", "String", "sdk", ")", "throws", "MojoExecutionException", ",", "XCodeException", "{", "File", "plistFile", "=", "getPLi...
Retrieves the Info Plist out of the effective Xcode project settings and returns the accessor to it.
[ "Retrieves", "the", "Info", "Plist", "out", "of", "the", "effective", "Xcode", "project", "settings", "and", "returns", "the", "accessor", "to", "it", "." ]
3f8aa380f501a1d7602f33fef2f6348354e7eb7c
https://github.com/sap-production/xcode-maven-plugin/blob/3f8aa380f501a1d7602f33fef2f6348354e7eb7c/modules/xcode-maven-plugin/src/main/java/com/sap/prd/mobile/ios/mios/BuildContextAwareMojo.java#L376-L386
train
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/core/workunit/WorkUnitDao.java
WorkUnitDao.findNewWorkUnits
public List<WorkUnit> findNewWorkUnits( Date now, String clusterName ){ if( sqlCache == null || !ObjectUtils.equals( cachedSqlClusterName, clusterName ) ){ sqlCache = getSql( clusterName ); cachedSqlClusterName = clusterName; } Object[] args = {now}; return getJdbcTemplate().query( sqlCache, args, WorkUnitRowMapper.INSTANCE ); }
java
public List<WorkUnit> findNewWorkUnits( Date now, String clusterName ){ if( sqlCache == null || !ObjectUtils.equals( cachedSqlClusterName, clusterName ) ){ sqlCache = getSql( clusterName ); cachedSqlClusterName = clusterName; } Object[] args = {now}; return getJdbcTemplate().query( sqlCache, args, WorkUnitRowMapper.INSTANCE ); }
[ "public", "List", "<", "WorkUnit", ">", "findNewWorkUnits", "(", "Date", "now", ",", "String", "clusterName", ")", "{", "if", "(", "sqlCache", "==", "null", "||", "!", "ObjectUtils", ".", "equals", "(", "cachedSqlClusterName", ",", "clusterName", ")", ")", ...
Retrieves the list of work units that can be performed at the given date.
[ "Retrieves", "the", "list", "of", "work", "units", "that", "can", "be", "performed", "at", "the", "given", "date", "." ]
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/core/workunit/WorkUnitDao.java#L29-L36
train
seedstack/business
core/src/main/java/org/seedstack/business/util/Tuples.java
Tuples.create
@SuppressWarnings("unchecked") public static <T extends Tuple> T create(Object... objects) { Class<? extends Tuple> tupleClass = classOfTuple(objects.length); try { return (T) tupleClass.getMethod("fromArray", Object[].class) .invoke(null, new Object[]{objects}); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw BusinessException.wrap(e, BusinessErrorCode.UNABLE_TO_CREATE_TUPLE); } }
java
@SuppressWarnings("unchecked") public static <T extends Tuple> T create(Object... objects) { Class<? extends Tuple> tupleClass = classOfTuple(objects.length); try { return (T) tupleClass.getMethod("fromArray", Object[].class) .invoke(null, new Object[]{objects}); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw BusinessException.wrap(e, BusinessErrorCode.UNABLE_TO_CREATE_TUPLE); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Tuple", ">", "T", "create", "(", "Object", "...", "objects", ")", "{", "Class", "<", "?", "extends", "Tuple", ">", "tupleClass", "=", "classOfTuple", "(", "object...
Builds a tuple from an array of objects. @param objects the collection of objects (size must be less or equal than 10). @param <T> the tuple type. @return the constructed tuple.
[ "Builds", "a", "tuple", "from", "an", "array", "of", "objects", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/util/Tuples.java#L64-L73
train
seedstack/business
core/src/main/java/org/seedstack/business/util/Tuples.java
Tuples.classOfTuple
public static Class<? extends Tuple> classOfTuple(int cardinality) { switch (cardinality) { case 1: return Unit.class; case 2: return Pair.class; case 3: return Triplet.class; case 4: return Quartet.class; case 5: return Quintet.class; case 6: return Sextet.class; case 7: return Septet.class; case 8: return Octet.class; case 9: return Ennead.class; case 10: return Decade.class; default: throw new IllegalArgumentException("Cannot create a tuple with " + cardinality + " element(s)"); } }
java
public static Class<? extends Tuple> classOfTuple(int cardinality) { switch (cardinality) { case 1: return Unit.class; case 2: return Pair.class; case 3: return Triplet.class; case 4: return Quartet.class; case 5: return Quintet.class; case 6: return Sextet.class; case 7: return Septet.class; case 8: return Octet.class; case 9: return Ennead.class; case 10: return Decade.class; default: throw new IllegalArgumentException("Cannot create a tuple with " + cardinality + " element(s)"); } }
[ "public", "static", "Class", "<", "?", "extends", "Tuple", ">", "classOfTuple", "(", "int", "cardinality", ")", "{", "switch", "(", "cardinality", ")", "{", "case", "1", ":", "return", "Unit", ".", "class", ";", "case", "2", ":", "return", "Pair", ".",...
Returns the tuple class corresponding to the specified cardinality. @param cardinality the cardinality (must be less or equal than 10). @return the corresponding tuple class.
[ "Returns", "the", "tuple", "class", "corresponding", "to", "the", "specified", "cardinality", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/util/Tuples.java#L133-L158
train
seedstack/business
core/src/main/java/org/seedstack/business/util/Tuples.java
Tuples.itemClasses
@SuppressWarnings("unchecked") public static <T> Class<T>[] itemClasses(Tuple tuple) { Class<?>[] itemClasses = new Class[tuple.getSize()]; int index = 0; for (Object o : tuple) { itemClasses[index++] = o.getClass(); } return (Class<T>[]) itemClasses; }
java
@SuppressWarnings("unchecked") public static <T> Class<T>[] itemClasses(Tuple tuple) { Class<?>[] itemClasses = new Class[tuple.getSize()]; int index = 0; for (Object o : tuple) { itemClasses[index++] = o.getClass(); } return (Class<T>[]) itemClasses; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "Class", "<", "T", ">", "[", "]", "itemClasses", "(", "Tuple", "tuple", ")", "{", "Class", "<", "?", ">", "[", "]", "itemClasses", "=", "new", "Class", "[", "tuple...
Returns a list containing the classes of the elements of the tuple. @param <T> the common of the classes contained by the tuple. @param tuple the tuple to convert. @return the list of classes.
[ "Returns", "a", "list", "containing", "the", "classes", "of", "the", "elements", "of", "the", "tuple", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/util/Tuples.java#L179-L187
train
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/liquibase/ext/logging/Slf4jLogger.java
Slf4jLogger.buildMessage
private String buildMessage( String rawMessage ){ StringBuilder msg = new StringBuilder(); if( changeLogName != null ){ msg.append( changeLogName ).append( ": " ); } if( changeSetName != null ){ msg.append( changeSetName.replace( changeLogName + "::", "" ) ).append( ": " ); } msg.append( rawMessage ); return msg.toString(); }
java
private String buildMessage( String rawMessage ){ StringBuilder msg = new StringBuilder(); if( changeLogName != null ){ msg.append( changeLogName ).append( ": " ); } if( changeSetName != null ){ msg.append( changeSetName.replace( changeLogName + "::", "" ) ).append( ": " ); } msg.append( rawMessage ); return msg.toString(); }
[ "private", "String", "buildMessage", "(", "String", "rawMessage", ")", "{", "StringBuilder", "msg", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "changeLogName", "!=", "null", ")", "{", "msg", ".", "append", "(", "changeLogName", ")", ".", "appen...
Build a log message with optional data if it exists.
[ "Build", "a", "log", "message", "with", "optional", "data", "if", "it", "exists", "." ]
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/liquibase/ext/logging/Slf4jLogger.java#L108-L118
train
tobykurien/Xtendroid
Xtendroid/src/asia/sonix/android/orm/AbatisService.java
AbatisService.toSqlString
public String toSqlString(Object value) { if (value == null) { return "null"; } String val = String.valueOf(value); if (value instanceof Integer || value instanceof Float || value instanceof Double || value instanceof Long) { return val; } else if (value instanceof Boolean) { return "'" + ((Boolean) value ? "true" : "false") + "'"; } else if (value instanceof Date) { return String.valueOf(((Date) value).getTime()); } else { return "'" + val + "'"; // TODO escape special characters in val here } }
java
public String toSqlString(Object value) { if (value == null) { return "null"; } String val = String.valueOf(value); if (value instanceof Integer || value instanceof Float || value instanceof Double || value instanceof Long) { return val; } else if (value instanceof Boolean) { return "'" + ((Boolean) value ? "true" : "false") + "'"; } else if (value instanceof Date) { return String.valueOf(((Date) value).getTime()); } else { return "'" + val + "'"; // TODO escape special characters in val here } }
[ "public", "String", "toSqlString", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "\"null\"", ";", "}", "String", "val", "=", "String", ".", "valueOf", "(", "value", ")", ";", "if", "(", "value", "instanceof", ...
Convert value object to sanitized SQL string @param value - the value object @return a string for use in an SQL statement @author Toby Kurien
[ "Convert", "value", "object", "to", "sanitized", "SQL", "string" ]
758bf1d06f4cf3b64f9c10632fe9c6fb30bcebd4
https://github.com/tobykurien/Xtendroid/blob/758bf1d06f4cf3b64f9c10632fe9c6fb30bcebd4/Xtendroid/src/asia/sonix/android/orm/AbatisService.java#L713-L732
train
sap-production/xcode-maven-plugin
modules/xcode-maven-plugin/src/main/java/com/sap/prd/mobile/ios/mios/XCodePrepareBuildManager.java
XCodePrepareBuildManager.createDirectory
private static void createDirectory(final File directory) throws MojoExecutionException { try { com.sap.prd.mobile.ios.mios.FileUtils.deleteDirectory(directory); } catch (IOException ex) { throw new MojoExecutionException("", ex); } if (!directory.mkdirs()) throw new MojoExecutionException("Cannot create directory (" + directory + ")"); }
java
private static void createDirectory(final File directory) throws MojoExecutionException { try { com.sap.prd.mobile.ios.mios.FileUtils.deleteDirectory(directory); } catch (IOException ex) { throw new MojoExecutionException("", ex); } if (!directory.mkdirs()) throw new MojoExecutionException("Cannot create directory (" + directory + ")"); }
[ "private", "static", "void", "createDirectory", "(", "final", "File", "directory", ")", "throws", "MojoExecutionException", "{", "try", "{", "com", ".", "sap", ".", "prd", ".", "mobile", ".", "ios", ".", "mios", ".", "FileUtils", ".", "deleteDirectory", "(",...
Creates a directory. If the directory already exists the directory is deleted beforehand. @param directory @throws MojoExecutionException
[ "Creates", "a", "directory", ".", "If", "the", "directory", "already", "exists", "the", "directory", "is", "deleted", "beforehand", "." ]
3f8aa380f501a1d7602f33fef2f6348354e7eb7c
https://github.com/sap-production/xcode-maven-plugin/blob/3f8aa380f501a1d7602f33fef2f6348354e7eb7c/modules/xcode-maven-plugin/src/main/java/com/sap/prd/mobile/ios/mios/XCodePrepareBuildManager.java#L446-L458
train
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/WorkflowFactoryImpl.java
WorkflowFactoryImpl.downRight
private Tree<Row> downRight( Element token ){ return current = current.addChild( Tree.of( new Row( token ) ) ); }
java
private Tree<Row> downRight( Element token ){ return current = current.addChild( Tree.of( new Row( token ) ) ); }
[ "private", "Tree", "<", "Row", ">", "downRight", "(", "Element", "token", ")", "{", "return", "current", "=", "current", ".", "addChild", "(", "Tree", ".", "of", "(", "new", "Row", "(", "token", ")", ")", ")", ";", "}" ]
Starts a new row one indentation level to the right.
[ "Starts", "a", "new", "row", "one", "indentation", "level", "to", "the", "right", "." ]
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/WorkflowFactoryImpl.java#L361-L363
train
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/WorkflowFactoryImpl.java
WorkflowFactoryImpl.downLeft
private Tree<Row> downLeft( Element token ){ return current = current.getParent().addSibling( Tree.of( new Row( token ) ) ); }
java
private Tree<Row> downLeft( Element token ){ return current = current.getParent().addSibling( Tree.of( new Row( token ) ) ); }
[ "private", "Tree", "<", "Row", ">", "downLeft", "(", "Element", "token", ")", "{", "return", "current", "=", "current", ".", "getParent", "(", ")", ".", "addSibling", "(", "Tree", ".", "of", "(", "new", "Row", "(", "token", ")", ")", ")", ";", "}" ...
Starts a new row one indentation level to the left.
[ "Starts", "a", "new", "row", "one", "indentation", "level", "to", "the", "left", "." ]
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/WorkflowFactoryImpl.java#L369-L371
train
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/WorkflowFactoryImpl.java
WorkflowFactoryImpl.down
private Tree<Row> down( Element token ){ return current = current.addSibling( Tree.of( new Row( token ) ) ); }
java
private Tree<Row> down( Element token ){ return current = current.addSibling( Tree.of( new Row( token ) ) ); }
[ "private", "Tree", "<", "Row", ">", "down", "(", "Element", "token", ")", "{", "return", "current", "=", "current", ".", "addSibling", "(", "Tree", ".", "of", "(", "new", "Row", "(", "token", ")", ")", ")", ";", "}" ]
Starts a new row at the same level of indentation.
[ "Starts", "a", "new", "row", "at", "the", "same", "level", "of", "indentation", "." ]
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/WorkflowFactoryImpl.java#L383-L385
train
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/WorkflowFactoryImpl.java
WorkflowFactoryImpl.here
private Tree<Row> here( Element token ){ current.getContent().addToken( token ); return current; }
java
private Tree<Row> here( Element token ){ current.getContent().addToken( token ); return current; }
[ "private", "Tree", "<", "Row", ">", "here", "(", "Element", "token", ")", "{", "current", ".", "getContent", "(", ")", ".", "addToken", "(", "token", ")", ";", "return", "current", ";", "}" ]
Adds element to the same row.
[ "Adds", "element", "to", "the", "same", "row", "." ]
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/WorkflowFactoryImpl.java#L390-L393
train
seedstack/business
migrate/src/main/java/org/seedstack/business/finder/Result.java
Result.rangeResult
public static <I> Result<I> rangeResult(List<I> result, long offset, long fullRequestSize) { return new Result<>(result, offset, fullRequestSize); }
java
public static <I> Result<I> rangeResult(List<I> result, long offset, long fullRequestSize) { return new Result<>(result, offset, fullRequestSize); }
[ "public", "static", "<", "I", ">", "Result", "<", "I", ">", "rangeResult", "(", "List", "<", "I", ">", "result", ",", "long", "offset", ",", "long", "fullRequestSize", ")", "{", "return", "new", "Result", "<>", "(", "result", ",", "offset", ",", "ful...
Creates a new Result. @param result the list of item @param offset the offset @param fullRequestSize the number of item available @param <I> the item type @return the result range
[ "Creates", "a", "new", "Result", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/migrate/src/main/java/org/seedstack/business/finder/Result.java#L50-L52
train
seedstack/business
migrate/src/main/java/org/seedstack/business/view/VirtualList.java
VirtualList.get
T get(long index) { checkRange(index); if (checkSubRange(index)) { // cannot exceed Integer.MAX_VALUE (checked by checkSubRange) return subList.get((int) (index - subListOffset)); } return null; }
java
T get(long index) { checkRange(index); if (checkSubRange(index)) { // cannot exceed Integer.MAX_VALUE (checked by checkSubRange) return subList.get((int) (index - subListOffset)); } return null; }
[ "T", "get", "(", "long", "index", ")", "{", "checkRange", "(", "index", ")", ";", "if", "(", "checkSubRange", "(", "index", ")", ")", "{", "// cannot exceed Integer.MAX_VALUE (checked by checkSubRange)", "return", "subList", ".", "get", "(", "(", "int", ")", ...
Gets the item at the index. @param index the request index @return the item
[ "Gets", "the", "item", "at", "the", "index", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/migrate/src/main/java/org/seedstack/business/view/VirtualList.java#L44-L52
train
seedstack/business
migrate/src/main/java/org/seedstack/business/view/VirtualList.java
VirtualList.subList
List<T> subList(long from, long to) { if (fullListSize > 0 && to - from > 0) { checkRange(from); // subList takes a [from;to[ range checkRange(to - 1); // check if the data of the required sub list are available assertSubRange(from, to - 1); // cannot exceed Integer.MAX_VALUE (checked by checkSubRange) return subList.subList((int) (from - subListOffset), (int) (to - subListOffset)); } return new ArrayList<>(); }
java
List<T> subList(long from, long to) { if (fullListSize > 0 && to - from > 0) { checkRange(from); // subList takes a [from;to[ range checkRange(to - 1); // check if the data of the required sub list are available assertSubRange(from, to - 1); // cannot exceed Integer.MAX_VALUE (checked by checkSubRange) return subList.subList((int) (from - subListOffset), (int) (to - subListOffset)); } return new ArrayList<>(); }
[ "List", "<", "T", ">", "subList", "(", "long", "from", ",", "long", "to", ")", "{", "if", "(", "fullListSize", ">", "0", "&&", "to", "-", "from", ">", "0", ")", "{", "checkRange", "(", "from", ")", ";", "// subList takes a [from;to[ range", "checkRange...
Returns a portion of this list between the specified from, inclusive, and to, exclusive. @param from low endpoint (inclusive) of the subList @param to high endpoint (exclusive) of the subList @return the sub list of item
[ "Returns", "a", "portion", "of", "this", "list", "between", "the", "specified", "from", "inclusive", "and", "to", "exclusive", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/migrate/src/main/java/org/seedstack/business/view/VirtualList.java#L61-L75
train
seedstack/business
migrate/src/main/java/org/seedstack/business/view/VirtualList.java
VirtualList.assertSubRange
private void assertSubRange(long from, long to) { if (!checkSubRange(from) || !checkSubRange(to)) { throw new IndexOutOfBoundsException("Required data for the sub list [" + from + "," + (to + 1) + "[ have " + "not been loaded in the virtual list."); } }
java
private void assertSubRange(long from, long to) { if (!checkSubRange(from) || !checkSubRange(to)) { throw new IndexOutOfBoundsException("Required data for the sub list [" + from + "," + (to + 1) + "[ have " + "not been loaded in the virtual list."); } }
[ "private", "void", "assertSubRange", "(", "long", "from", ",", "long", "to", ")", "{", "if", "(", "!", "checkSubRange", "(", "from", ")", "||", "!", "checkSubRange", "(", "to", ")", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Required da...
Asserts that the requested sub list is available in the virtual list. Otherwise it throws an IndexOutOfBoundsException. @param from the from index (inclusive) @param to the to index (inclusive)
[ "Asserts", "that", "the", "requested", "sub", "list", "is", "available", "in", "the", "virtual", "list", ".", "Otherwise", "it", "throws", "an", "IndexOutOfBoundsException", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/migrate/src/main/java/org/seedstack/business/view/VirtualList.java#L116-L121
train
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/FieldUtils.java
FieldUtils.getFieldValue
public static Object getFieldValue(Object candidate, Field field) { try { return ReflectUtils.getValue(ReflectUtils.makeAccessible(field), candidate); } catch (Exception e) { throw BusinessException.wrap(e, BusinessErrorCode.ERROR_ACCESSING_FIELD) .put("className", candidate.getClass()) .put("fieldName", field.getName()); } }
java
public static Object getFieldValue(Object candidate, Field field) { try { return ReflectUtils.getValue(ReflectUtils.makeAccessible(field), candidate); } catch (Exception e) { throw BusinessException.wrap(e, BusinessErrorCode.ERROR_ACCESSING_FIELD) .put("className", candidate.getClass()) .put("fieldName", field.getName()); } }
[ "public", "static", "Object", "getFieldValue", "(", "Object", "candidate", ",", "Field", "field", ")", "{", "try", "{", "return", "ReflectUtils", ".", "getValue", "(", "ReflectUtils", ".", "makeAccessible", "(", "field", ")", ",", "candidate", ")", ";", "}",...
Return the value contained in the specified field of the candidate object. @param candidate the object to retrieve the value of. @param field the field. @return the value contained in the field of the candidate.
[ "Return", "the", "value", "contained", "in", "the", "specified", "field", "of", "the", "candidate", "object", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/FieldUtils.java#L43-L51
train
seedstack/business
core/src/main/java/org/seedstack/business/internal/utils/FieldUtils.java
FieldUtils.resolveField
public static Optional<Field> resolveField(Class<?> someClass, String fieldName) { return fieldCache.get(new FieldReference(someClass, fieldName)); }
java
public static Optional<Field> resolveField(Class<?> someClass, String fieldName) { return fieldCache.get(new FieldReference(someClass, fieldName)); }
[ "public", "static", "Optional", "<", "Field", ">", "resolveField", "(", "Class", "<", "?", ">", "someClass", ",", "String", "fieldName", ")", "{", "return", "fieldCache", ".", "get", "(", "new", "FieldReference", "(", "someClass", ",", "fieldName", ")", ")...
Returns the specified field found on the specified class and its ancestors. @param someClass the class to search the field on. @param fieldName the field name. @return the corresponding field object wrapped in an optional.
[ "Returns", "the", "specified", "field", "found", "on", "the", "specified", "class", "and", "its", "ancestors", "." ]
55b3e861fe152e9b125ebc69daa91a682deeae8a
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/FieldUtils.java#L60-L62
train
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/graph/el/ElUtil.java
ElUtil.removeBrackets
public static String removeBrackets( String condition ){ String value = StringUtils.strip( condition ); if( value != null && value.length() >= 3 ){ return value.substring( 2, value.length() - 1 ); } return value; }
java
public static String removeBrackets( String condition ){ String value = StringUtils.strip( condition ); if( value != null && value.length() >= 3 ){ return value.substring( 2, value.length() - 1 ); } return value; }
[ "public", "static", "String", "removeBrackets", "(", "String", "condition", ")", "{", "String", "value", "=", "StringUtils", ".", "strip", "(", "condition", ")", ";", "if", "(", "value", "!=", "null", "&&", "value", ".", "length", "(", ")", ">=", "3", ...
After trimming the input, removes two characters from the start and one from the end and returns the result.
[ "After", "trimming", "the", "input", "removes", "two", "characters", "from", "the", "start", "and", "one", "from", "the", "end", "and", "returns", "the", "result", "." ]
f471f1f94013b3e2d56b4c9380e86e3a92c2ee29
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/graph/el/ElUtil.java#L29-L35
train