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
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/config/OneProperties.java
OneProperties.loadConfigs
protected void loadConfigs() { configs = new Properties(); // If run as a jar, find in file system classpath first, if not found, then get resource in jar. if (ClassPathUtil.testRunMainInJar()) { String[] classPathsInFileSystem = ClassPathUtil.getAllClassPathNotInJar(); String workDir = System.getProperty("user.dir"); String mainJarRelativePath = ClassPathUtil.getClassPathsInSystemProperty()[0]; File mainJar = new File(workDir, mainJarRelativePath); File mainJarDir = mainJar.getParentFile(); for (String classPath : classPathsInFileSystem) { File classPathFile = new File(classPath); File configFile; if (classPathFile.isAbsolute()) { configFile = new File(classPathFile, propertiesAbsoluteClassPath); } else { configFile = new File(new File(mainJarDir, classPath), propertiesAbsoluteClassPath); } if (configFile.exists() && configFile.isFile()) { InputStream is = null; try { is = new FileInputStream(configFile); loadConfigsFromStream(is); } catch (FileNotFoundException e) { LOGGER.warn("Load config file " + configFile.getPath() + " error!", e); } return; } } } if (propertiesFilePath == null) { if (propertiesAbsoluteClassPath == null) { return; } InputStream is = OneProperties.class.getResourceAsStream(propertiesAbsoluteClassPath); loadConfigsFromStream(is); } else { configs = PropertiesIO.load(propertiesFilePath); } }
java
protected void loadConfigs() { configs = new Properties(); // If run as a jar, find in file system classpath first, if not found, then get resource in jar. if (ClassPathUtil.testRunMainInJar()) { String[] classPathsInFileSystem = ClassPathUtil.getAllClassPathNotInJar(); String workDir = System.getProperty("user.dir"); String mainJarRelativePath = ClassPathUtil.getClassPathsInSystemProperty()[0]; File mainJar = new File(workDir, mainJarRelativePath); File mainJarDir = mainJar.getParentFile(); for (String classPath : classPathsInFileSystem) { File classPathFile = new File(classPath); File configFile; if (classPathFile.isAbsolute()) { configFile = new File(classPathFile, propertiesAbsoluteClassPath); } else { configFile = new File(new File(mainJarDir, classPath), propertiesAbsoluteClassPath); } if (configFile.exists() && configFile.isFile()) { InputStream is = null; try { is = new FileInputStream(configFile); loadConfigsFromStream(is); } catch (FileNotFoundException e) { LOGGER.warn("Load config file " + configFile.getPath() + " error!", e); } return; } } } if (propertiesFilePath == null) { if (propertiesAbsoluteClassPath == null) { return; } InputStream is = OneProperties.class.getResourceAsStream(propertiesAbsoluteClassPath); loadConfigsFromStream(is); } else { configs = PropertiesIO.load(propertiesFilePath); } }
[ "protected", "void", "loadConfigs", "(", ")", "{", "configs", "=", "new", "Properties", "(", ")", ";", "// If run as a jar, find in file system classpath first, if not found, then get resource in jar.\r", "if", "(", "ClassPathUtil", ".", "testRunMainInJar", "(", ")", ")", ...
Load properties. Will refresh configs every time.
[ "Load", "properties", ".", "Will", "refresh", "configs", "every", "time", "." ]
4f2bf3f36df10195a978f122ed682ba1eb0462b5
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/OneProperties.java#L63-L101
train
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/config/OneProperties.java
OneProperties.modifyConfig
protected void modifyConfig(IConfigKey key, String value) throws IOException { if (propertiesFilePath == null) { LOGGER.warn("Config " + propertiesAbsoluteClassPath + " is not a file, maybe just a resource in library."); } if (configs == null) { loadConfigs(); } configs.setProperty(key.getKeyString(), value); PropertiesIO.store(propertiesFilePath, configs); }
java
protected void modifyConfig(IConfigKey key, String value) throws IOException { if (propertiesFilePath == null) { LOGGER.warn("Config " + propertiesAbsoluteClassPath + " is not a file, maybe just a resource in library."); } if (configs == null) { loadConfigs(); } configs.setProperty(key.getKeyString(), value); PropertiesIO.store(propertiesFilePath, configs); }
[ "protected", "void", "modifyConfig", "(", "IConfigKey", "key", ",", "String", "value", ")", "throws", "IOException", "{", "if", "(", "propertiesFilePath", "==", "null", ")", "{", "LOGGER", ".", "warn", "(", "\"Config \"", "+", "propertiesAbsoluteClassPath", "+",...
Modify one config and write new config into properties file. @param key need update config key @param value new value
[ "Modify", "one", "config", "and", "write", "new", "config", "into", "properties", "file", "." ]
4f2bf3f36df10195a978f122ed682ba1eb0462b5
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/OneProperties.java#L227-L236
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/MongodbQueue.java
MongodbQueue.insertToCollection
protected boolean insertToCollection(IQueueMessage<ID, DATA> msg) { getCollection().insertOne(toDocument(msg)); return true; }
java
protected boolean insertToCollection(IQueueMessage<ID, DATA> msg) { getCollection().insertOne(toDocument(msg)); return true; }
[ "protected", "boolean", "insertToCollection", "(", "IQueueMessage", "<", "ID", ",", "DATA", ">", "msg", ")", "{", "getCollection", "(", ")", ".", "insertOne", "(", "toDocument", "(", "msg", ")", ")", ";", "return", "true", ";", "}" ]
Insert a new message to collection. @param msg @return
[ "Insert", "a", "new", "message", "to", "collection", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/MongodbQueue.java#L315-L318
train
mgormley/prim
src/main/java/edu/jhu/prim/map/IntObjectHashMap.java
IntObjectHashMap.get
public T get(final int key) { final int hash = hashOf(key); int index = hash & mask; if (containsKey(key, index)) { return (T)values[index]; } if (states[index] == FREE) { return missingEntries; } int j = index; for (int perturb = perturb(hash); states[index] != FREE; perturb >>= PERTURB_SHIFT) { j = probe(perturb, j); index = j & mask; if (containsKey(key, index)) { return (T)values[index]; } } return missingEntries; }
java
public T get(final int key) { final int hash = hashOf(key); int index = hash & mask; if (containsKey(key, index)) { return (T)values[index]; } if (states[index] == FREE) { return missingEntries; } int j = index; for (int perturb = perturb(hash); states[index] != FREE; perturb >>= PERTURB_SHIFT) { j = probe(perturb, j); index = j & mask; if (containsKey(key, index)) { return (T)values[index]; } } return missingEntries; }
[ "public", "T", "get", "(", "final", "int", "key", ")", "{", "final", "int", "hash", "=", "hashOf", "(", "key", ")", ";", "int", "index", "=", "hash", "&", "mask", ";", "if", "(", "containsKey", "(", "key", ",", "index", ")", ")", "{", "return", ...
Get the stored value associated with the given key @param key key associated with the data @return data associated with the key
[ "Get", "the", "stored", "value", "associated", "with", "the", "given", "key" ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/map/IntObjectHashMap.java#L185-L208
train
mgormley/prim
src/main/java/edu/jhu/prim/map/IntObjectHashMap.java
IntObjectHashMap.doRemove
private T doRemove(int index) { keys[index] = 0; states[index] = REMOVED; final Object previous = values[index]; values[index] = missingEntries; --size; ++count; return (T)previous; }
java
private T doRemove(int index) { keys[index] = 0; states[index] = REMOVED; final Object previous = values[index]; values[index] = missingEntries; --size; ++count; return (T)previous; }
[ "private", "T", "doRemove", "(", "int", "index", ")", "{", "keys", "[", "index", "]", "=", "0", ";", "states", "[", "index", "]", "=", "REMOVED", ";", "final", "Object", "previous", "=", "values", "[", "index", "]", ";", "values", "[", "index", "]"...
Remove an element at specified index. @param index index of the element to remove @return removed value
[ "Remove", "an", "element", "at", "specified", "index", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/map/IntObjectHashMap.java#L411-L419
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/AbstractQueue.java
AbstractQueue.serialize
protected byte[] serialize(IQueueMessage<ID, DATA> queueMsg) { return queueMsg != null ? SerializationUtils.toByteArray(queueMsg) : null; }
java
protected byte[] serialize(IQueueMessage<ID, DATA> queueMsg) { return queueMsg != null ? SerializationUtils.toByteArray(queueMsg) : null; }
[ "protected", "byte", "[", "]", "serialize", "(", "IQueueMessage", "<", "ID", ",", "DATA", ">", "queueMsg", ")", "{", "return", "queueMsg", "!=", "null", "?", "SerializationUtils", ".", "toByteArray", "(", "queueMsg", ")", ":", "null", ";", "}" ]
Serialize a queue message to bytes. @param queueMsg @return @since 0.7.0
[ "Serialize", "a", "queue", "message", "to", "bytes", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/AbstractQueue.java#L161-L163
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java
RRBudget10V1_1Generator.getRRBudget10
private RRBudget10Document getRRBudget10() { deleteAutoGenNarratives(); RRBudget10Document rrBudgetDocument = RRBudget10Document.Factory .newInstance(); RRBudget10 rrBudget = RRBudget10.Factory.newInstance(); rrBudget.setFormVersion(FormVersion.v1_1.getVersion()); if (pdDoc.getDevelopmentProposal().getApplicantOrganization() != null) { rrBudget.setDUNSID(pdDoc.getDevelopmentProposal() .getApplicantOrganization().getOrganization() .getDunsNumber()); rrBudget.setOrganizationName(pdDoc.getDevelopmentProposal() .getApplicantOrganization().getOrganization() .getOrganizationName()); } rrBudget.setBudgetType(BudgetTypeDataType.PROJECT); List<BudgetPeriodDto> budgetperiodList; BudgetSummaryDto budgetSummary = null; try { validateBudgetForForm(pdDoc); budgetperiodList = s2sBudgetCalculatorService.getBudgetPeriods(pdDoc); budgetSummary = s2sBudgetCalculatorService.getBudgetInfo(pdDoc,budgetperiodList); } catch (S2SException e) { LOG.error(e.getMessage(), e); return rrBudgetDocument; } rrBudget.setBudgetSummary(getBudgetSummary(budgetSummary)); for (BudgetPeriodDto budgetPeriodData : budgetperiodList) { setBudgetYearDataType(rrBudget,budgetPeriodData); } AttachedFileDataType attachedFileDataType = AttachedFileDataType.Factory.newInstance(); for (NarrativeContract narrative : pdDoc.getDevelopmentProposal().getNarratives()) { if (narrative.getNarrativeType().getCode() != null && Integer.parseInt(narrative.getNarrativeType().getCode()) == 132) { attachedFileDataType = getAttachedFileType(narrative); if (attachedFileDataType != null) { break; } } } rrBudget.setBudgetJustificationAttachment(attachedFileDataType); rrBudgetDocument.setRRBudget10(rrBudget); return rrBudgetDocument; }
java
private RRBudget10Document getRRBudget10() { deleteAutoGenNarratives(); RRBudget10Document rrBudgetDocument = RRBudget10Document.Factory .newInstance(); RRBudget10 rrBudget = RRBudget10.Factory.newInstance(); rrBudget.setFormVersion(FormVersion.v1_1.getVersion()); if (pdDoc.getDevelopmentProposal().getApplicantOrganization() != null) { rrBudget.setDUNSID(pdDoc.getDevelopmentProposal() .getApplicantOrganization().getOrganization() .getDunsNumber()); rrBudget.setOrganizationName(pdDoc.getDevelopmentProposal() .getApplicantOrganization().getOrganization() .getOrganizationName()); } rrBudget.setBudgetType(BudgetTypeDataType.PROJECT); List<BudgetPeriodDto> budgetperiodList; BudgetSummaryDto budgetSummary = null; try { validateBudgetForForm(pdDoc); budgetperiodList = s2sBudgetCalculatorService.getBudgetPeriods(pdDoc); budgetSummary = s2sBudgetCalculatorService.getBudgetInfo(pdDoc,budgetperiodList); } catch (S2SException e) { LOG.error(e.getMessage(), e); return rrBudgetDocument; } rrBudget.setBudgetSummary(getBudgetSummary(budgetSummary)); for (BudgetPeriodDto budgetPeriodData : budgetperiodList) { setBudgetYearDataType(rrBudget,budgetPeriodData); } AttachedFileDataType attachedFileDataType = AttachedFileDataType.Factory.newInstance(); for (NarrativeContract narrative : pdDoc.getDevelopmentProposal().getNarratives()) { if (narrative.getNarrativeType().getCode() != null && Integer.parseInt(narrative.getNarrativeType().getCode()) == 132) { attachedFileDataType = getAttachedFileType(narrative); if (attachedFileDataType != null) { break; } } } rrBudget.setBudgetJustificationAttachment(attachedFileDataType); rrBudgetDocument.setRRBudget10(rrBudget); return rrBudgetDocument; }
[ "private", "RRBudget10Document", "getRRBudget10", "(", ")", "{", "deleteAutoGenNarratives", "(", ")", ";", "RRBudget10Document", "rrBudgetDocument", "=", "RRBudget10Document", ".", "Factory", ".", "newInstance", "(", ")", ";", "RRBudget10", "rrBudget", "=", "RRBudget1...
This method returns RRBudget10Document object based on proposal development document which contains the informations such as DUNSID,OrganizationName,BudgetType,BudgetYear and BudgetSummary. @return rrBudgetDocument {@link XmlObject} of type RRBudget10Document.
[ "This", "method", "returns", "RRBudget10Document", "object", "based", "on", "proposal", "development", "document", "which", "contains", "the", "informations", "such", "as", "DUNSID", "OrganizationName", "BudgetType", "BudgetYear", "and", "BudgetSummary", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java#L90-L136
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java
RRBudget10V1_1Generator.getIndirectCosts
private IndirectCosts getIndirectCosts(BudgetPeriodDto periodInfo) { IndirectCosts indirectCosts = null; if (periodInfo != null && periodInfo.getIndirectCosts() != null && periodInfo.getIndirectCosts().getIndirectCostDetails() != null) { List<IndirectCosts.IndirectCost> indirectCostList = new ArrayList<>(); int IndirectCostCount = 0; for (IndirectCostDetailsDto indirectCostDetails : periodInfo .getIndirectCosts().getIndirectCostDetails()) { IndirectCosts.IndirectCost indirectCost = IndirectCosts.IndirectCost.Factory .newInstance(); if (indirectCostDetails.getBase() != null) { indirectCost.setBase(indirectCostDetails.getBase() .bigDecimalValue()); } indirectCost.setCostType(indirectCostDetails.getCostType()); if (indirectCostDetails.getFunds() != null) { indirectCost.setFundRequested(indirectCostDetails .getFunds().bigDecimalValue()); } if (indirectCostDetails.getRate() != null) { indirectCost.setRate(indirectCostDetails.getRate() .bigDecimalValue()); } indirectCostList.add(indirectCost); IndirectCostCount++; if (IndirectCostCount == ARRAY_LIMIT_IN_SCHEMA) { LOG .warn("Stopping iteration over indirect cost details because array limit in schema is only 4"); break; } } if (IndirectCostCount > 0) { indirectCosts = IndirectCosts.Factory.newInstance(); IndirectCosts.IndirectCost indirectCostArray[] = new IndirectCosts.IndirectCost[0]; indirectCosts.setIndirectCostArray(indirectCostList .toArray(indirectCostArray)); if (periodInfo.getIndirectCosts().getTotalIndirectCosts() != null) { indirectCosts.setTotalIndirectCosts(periodInfo .getIndirectCosts().getTotalIndirectCosts() .bigDecimalValue()); } } } return indirectCosts; }
java
private IndirectCosts getIndirectCosts(BudgetPeriodDto periodInfo) { IndirectCosts indirectCosts = null; if (periodInfo != null && periodInfo.getIndirectCosts() != null && periodInfo.getIndirectCosts().getIndirectCostDetails() != null) { List<IndirectCosts.IndirectCost> indirectCostList = new ArrayList<>(); int IndirectCostCount = 0; for (IndirectCostDetailsDto indirectCostDetails : periodInfo .getIndirectCosts().getIndirectCostDetails()) { IndirectCosts.IndirectCost indirectCost = IndirectCosts.IndirectCost.Factory .newInstance(); if (indirectCostDetails.getBase() != null) { indirectCost.setBase(indirectCostDetails.getBase() .bigDecimalValue()); } indirectCost.setCostType(indirectCostDetails.getCostType()); if (indirectCostDetails.getFunds() != null) { indirectCost.setFundRequested(indirectCostDetails .getFunds().bigDecimalValue()); } if (indirectCostDetails.getRate() != null) { indirectCost.setRate(indirectCostDetails.getRate() .bigDecimalValue()); } indirectCostList.add(indirectCost); IndirectCostCount++; if (IndirectCostCount == ARRAY_LIMIT_IN_SCHEMA) { LOG .warn("Stopping iteration over indirect cost details because array limit in schema is only 4"); break; } } if (IndirectCostCount > 0) { indirectCosts = IndirectCosts.Factory.newInstance(); IndirectCosts.IndirectCost indirectCostArray[] = new IndirectCosts.IndirectCost[0]; indirectCosts.setIndirectCostArray(indirectCostList .toArray(indirectCostArray)); if (periodInfo.getIndirectCosts().getTotalIndirectCosts() != null) { indirectCosts.setTotalIndirectCosts(periodInfo .getIndirectCosts().getTotalIndirectCosts() .bigDecimalValue()); } } } return indirectCosts; }
[ "private", "IndirectCosts", "getIndirectCosts", "(", "BudgetPeriodDto", "periodInfo", ")", "{", "IndirectCosts", "indirectCosts", "=", "null", ";", "if", "(", "periodInfo", "!=", "null", "&&", "periodInfo", ".", "getIndirectCosts", "(", ")", "!=", "null", "&&", ...
This method returns IndirectCosts details such as Base,CostType,FundRequested,Rate and TotalIndirectCosts in BudgetYearDataType based on BudgetPeriodInfo for the RRBudget10. @param periodInfo (BudgetPeriodInfo) budget period entry. @return IndirectCosts corresponding to the BudgetPeriodInfo object.
[ "This", "method", "returns", "IndirectCosts", "details", "such", "as", "Base", "CostType", "FundRequested", "Rate", "and", "TotalIndirectCosts", "in", "BudgetYearDataType", "based", "on", "BudgetPeriodInfo", "for", "the", "RRBudget10", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java#L404-L452
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java
RRBudget10V1_1Generator.setOthersForOtherDirectCosts
private void setOthersForOtherDirectCosts(OtherDirectCosts otherDirectCosts, BudgetPeriodDto periodInfo) { if (periodInfo != null && periodInfo.getOtherDirectCosts() != null) { for (OtherDirectCostInfoDto otherDirectCostInfo : periodInfo.getOtherDirectCosts()) { gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherDirectCosts.Other other = otherDirectCosts.addNewOther(); if (otherDirectCostInfo.getOtherCosts() != null && otherDirectCostInfo.getOtherCosts().size() > 0) { other .setCost(new BigDecimal(otherDirectCostInfo .getOtherCosts().get(0).get( CostConstants.KEY_COST))); } other.setDescription(OTHERCOST_DESCRIPTION); } } }
java
private void setOthersForOtherDirectCosts(OtherDirectCosts otherDirectCosts, BudgetPeriodDto periodInfo) { if (periodInfo != null && periodInfo.getOtherDirectCosts() != null) { for (OtherDirectCostInfoDto otherDirectCostInfo : periodInfo.getOtherDirectCosts()) { gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherDirectCosts.Other other = otherDirectCosts.addNewOther(); if (otherDirectCostInfo.getOtherCosts() != null && otherDirectCostInfo.getOtherCosts().size() > 0) { other .setCost(new BigDecimal(otherDirectCostInfo .getOtherCosts().get(0).get( CostConstants.KEY_COST))); } other.setDescription(OTHERCOST_DESCRIPTION); } } }
[ "private", "void", "setOthersForOtherDirectCosts", "(", "OtherDirectCosts", "otherDirectCosts", ",", "BudgetPeriodDto", "periodInfo", ")", "{", "if", "(", "periodInfo", "!=", "null", "&&", "periodInfo", ".", "getOtherDirectCosts", "(", ")", "!=", "null", ")", "{", ...
This method is to set Other type description and total cost OtherDirectCosts details in BudgetYearDataType based on BudgetPeriodInfo for the RRBudget10. @param otherDirectCosts otherDirectCosts xmlObject @param periodInfo (BudgetPeriodInfo) budget period entry.
[ "This", "method", "is", "to", "set", "Other", "type", "description", "and", "total", "cost", "OtherDirectCosts", "details", "in", "BudgetYearDataType", "based", "on", "BudgetPeriodInfo", "for", "the", "RRBudget10", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java#L463-L477
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java
RRBudget10V1_1Generator.getPostDocAssociates
private PostDocAssociates getPostDocAssociates( OtherPersonnelDto otherPersonnel) { PostDocAssociates postDocAssociates = PostDocAssociates.Factory .newInstance(); if (otherPersonnel != null) { postDocAssociates.setNumberOfPersonnel(otherPersonnel .getNumberPersonnel()); postDocAssociates.setProjectRole(otherPersonnel.getRole()); CompensationDto sectBCompType = otherPersonnel.getCompensation(); postDocAssociates.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue()); postDocAssociates.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue()); postDocAssociates.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue()); postDocAssociates.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue()); postDocAssociates.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue()); postDocAssociates.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue()); } return postDocAssociates; }
java
private PostDocAssociates getPostDocAssociates( OtherPersonnelDto otherPersonnel) { PostDocAssociates postDocAssociates = PostDocAssociates.Factory .newInstance(); if (otherPersonnel != null) { postDocAssociates.setNumberOfPersonnel(otherPersonnel .getNumberPersonnel()); postDocAssociates.setProjectRole(otherPersonnel.getRole()); CompensationDto sectBCompType = otherPersonnel.getCompensation(); postDocAssociates.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue()); postDocAssociates.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue()); postDocAssociates.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue()); postDocAssociates.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue()); postDocAssociates.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue()); postDocAssociates.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue()); } return postDocAssociates; }
[ "private", "PostDocAssociates", "getPostDocAssociates", "(", "OtherPersonnelDto", "otherPersonnel", ")", "{", "PostDocAssociates", "postDocAssociates", "=", "PostDocAssociates", ".", "Factory", ".", "newInstance", "(", ")", ";", "if", "(", "otherPersonnel", "!=", "null"...
This method gets the PostDocAssociates details,ProjectRole, NumberOfPersonnel,Compensation based on OtherPersonnelInfo for the RRBudget10,if it is a PostDocAssociates type. @param otherPersonnel (OtherPersonnelInfo)other personnel info entry. @return PostDocAssociates details corresponding to the OtherPersonnelInfo object.
[ "This", "method", "gets", "the", "PostDocAssociates", "details", "ProjectRole", "NumberOfPersonnel", "Compensation", "based", "on", "OtherPersonnelInfo", "for", "the", "RRBudget10", "if", "it", "is", "a", "PostDocAssociates", "type", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java#L654-L675
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java
RRBudget10V1_1Generator.getGraduateStudents
private GraduateStudents getGraduateStudents( OtherPersonnelDto otherPersonnel) { GraduateStudents graduate = GraduateStudents.Factory.newInstance(); if (otherPersonnel != null) { graduate.setNumberOfPersonnel(otherPersonnel.getNumberPersonnel()); graduate.setProjectRole(otherPersonnel.getRole()); CompensationDto sectBCompType = otherPersonnel.getCompensation(); graduate.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue()); graduate.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue()); graduate.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue()); graduate.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue()); graduate.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue()); graduate.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue()); } return graduate; }
java
private GraduateStudents getGraduateStudents( OtherPersonnelDto otherPersonnel) { GraduateStudents graduate = GraduateStudents.Factory.newInstance(); if (otherPersonnel != null) { graduate.setNumberOfPersonnel(otherPersonnel.getNumberPersonnel()); graduate.setProjectRole(otherPersonnel.getRole()); CompensationDto sectBCompType = otherPersonnel.getCompensation(); graduate.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue()); graduate.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue()); graduate.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue()); graduate.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue()); graduate.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue()); graduate.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue()); } return graduate; }
[ "private", "GraduateStudents", "getGraduateStudents", "(", "OtherPersonnelDto", "otherPersonnel", ")", "{", "GraduateStudents", "graduate", "=", "GraduateStudents", ".", "Factory", ".", "newInstance", "(", ")", ";", "if", "(", "otherPersonnel", "!=", "null", ")", "{...
This method gets the GraduateStudents details,ProjectRole, NumberOfPersonnel,Compensation based on OtherPersonnelInfo for the RRBudget10, if it is a GraduateStudents type. @param otherPersonnel (OtherPersonnelInfo) other personnel info entry. @return GraduateStudents details corresponding to the OtherPersonnelInfo object.
[ "This", "method", "gets", "the", "GraduateStudents", "details", "ProjectRole", "NumberOfPersonnel", "Compensation", "based", "on", "OtherPersonnelInfo", "for", "the", "RRBudget10", "if", "it", "is", "a", "GraduateStudents", "type", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java#L687-L705
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java
RRBudget10V1_1Generator.getUndergraduateStudents
private UndergraduateStudents getUndergraduateStudents( OtherPersonnelDto otherPersonnel) { UndergraduateStudents undergraduate = UndergraduateStudents.Factory .newInstance(); if (otherPersonnel != null) { undergraduate.setNumberOfPersonnel(otherPersonnel .getNumberPersonnel()); undergraduate.setProjectRole(otherPersonnel.getRole()); CompensationDto sectBCompType = otherPersonnel.getCompensation(); undergraduate.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue()); undergraduate.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue()); undergraduate.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue()); undergraduate.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue()); undergraduate.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue()); undergraduate.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue()); } return undergraduate; }
java
private UndergraduateStudents getUndergraduateStudents( OtherPersonnelDto otherPersonnel) { UndergraduateStudents undergraduate = UndergraduateStudents.Factory .newInstance(); if (otherPersonnel != null) { undergraduate.setNumberOfPersonnel(otherPersonnel .getNumberPersonnel()); undergraduate.setProjectRole(otherPersonnel.getRole()); CompensationDto sectBCompType = otherPersonnel.getCompensation(); undergraduate.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue()); undergraduate.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue()); undergraduate.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue()); undergraduate.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue()); undergraduate.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue()); undergraduate.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue()); } return undergraduate; }
[ "private", "UndergraduateStudents", "getUndergraduateStudents", "(", "OtherPersonnelDto", "otherPersonnel", ")", "{", "UndergraduateStudents", "undergraduate", "=", "UndergraduateStudents", ".", "Factory", ".", "newInstance", "(", ")", ";", "if", "(", "otherPersonnel", "!...
This method is to get the UndergraduateStudents details,ProjectRole, NumberOfPersonnel,Compensation based on OtherPersonnelInfo for the RRBudget10,if it is a UndergraduateStudents type. @param otherPersonnel (OtherPersonnelInfo) other personnel info entry. @return UndergraduateStudents details corresponding to the OtherPersonnelInfo object.
[ "This", "method", "is", "to", "get", "the", "UndergraduateStudents", "details", "ProjectRole", "NumberOfPersonnel", "Compensation", "based", "on", "OtherPersonnelInfo", "for", "the", "RRBudget10", "if", "it", "is", "a", "UndergraduateStudents", "type", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java#L717-L738
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java
RRBudget10V1_1Generator.getSecretarialClerical
private SecretarialClerical getSecretarialClerical( OtherPersonnelDto otherPersonnel) { SecretarialClerical secretarialClerical = SecretarialClerical.Factory .newInstance(); if (otherPersonnel != null) { secretarialClerical.setNumberOfPersonnel(otherPersonnel .getNumberPersonnel()); secretarialClerical.setProjectRole(otherPersonnel.getRole()); CompensationDto sectBCompType = otherPersonnel.getCompensation(); secretarialClerical.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue()); secretarialClerical.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue()); secretarialClerical.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue()); secretarialClerical.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue()); secretarialClerical.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue()); secretarialClerical.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue()); } return secretarialClerical; }
java
private SecretarialClerical getSecretarialClerical( OtherPersonnelDto otherPersonnel) { SecretarialClerical secretarialClerical = SecretarialClerical.Factory .newInstance(); if (otherPersonnel != null) { secretarialClerical.setNumberOfPersonnel(otherPersonnel .getNumberPersonnel()); secretarialClerical.setProjectRole(otherPersonnel.getRole()); CompensationDto sectBCompType = otherPersonnel.getCompensation(); secretarialClerical.setRequestedSalary(sectBCompType.getRequestedSalary().bigDecimalValue()); secretarialClerical.setFringeBenefits(sectBCompType.getFringe().bigDecimalValue()); secretarialClerical.setAcademicMonths(sectBCompType.getAcademicMonths().bigDecimalValue()); secretarialClerical.setCalendarMonths(sectBCompType.getCalendarMonths().bigDecimalValue()); secretarialClerical.setFundsRequested(sectBCompType.getFundsRequested().bigDecimalValue()); secretarialClerical.setSummerMonths(sectBCompType.getSummerMonths().bigDecimalValue()); } return secretarialClerical; }
[ "private", "SecretarialClerical", "getSecretarialClerical", "(", "OtherPersonnelDto", "otherPersonnel", ")", "{", "SecretarialClerical", "secretarialClerical", "=", "SecretarialClerical", ".", "Factory", ".", "newInstance", "(", ")", ";", "if", "(", "otherPersonnel", "!="...
This method is to get the SecretarialClerical details,ProjectRole, NumberOfPersonnel,Compensation based on OtherPersonnelInfo for the RRBudget10,if it is a SecretarialClerical type. @param otherPersonnel (OtherPersonnelInfo) other personnel info entry. @return SecretarialClerical corresponding to the OtherPersonnelInfo object.
[ "This", "method", "is", "to", "get", "the", "SecretarialClerical", "details", "ProjectRole", "NumberOfPersonnel", "Compensation", "based", "on", "OtherPersonnelInfo", "for", "the", "RRBudget10", "if", "it", "is", "a", "SecretarialClerical", "type", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java#L750-L770
train
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/iterator/DirectoryIterator.java
DirectoryIterator.listFiles
private List<File> listFiles(File file, List<File> files) { File[] children = file.listFiles(); if (children != null) { for (File child : children) { files.add(child); listFiles(child, files); } } return files; }
java
private List<File> listFiles(File file, List<File> files) { File[] children = file.listFiles(); if (children != null) { for (File child : children) { files.add(child); listFiles(child, files); } } return files; }
[ "private", "List", "<", "File", ">", "listFiles", "(", "File", "file", ",", "List", "<", "File", ">", "files", ")", "{", "File", "[", "]", "children", "=", "file", ".", "listFiles", "(", ")", ";", "if", "(", "children", "!=", "null", ")", "{", "f...
Recurse over entire directory subtree, adding entries to the file list. @param file Parent file. @param files List to receive files. @return The updated file list.
[ "Recurse", "over", "entire", "directory", "subtree", "adding", "entries", "to", "the", "file", "list", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/iterator/DirectoryIterator.java#L57-L68
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java
CommandUtil.associateCommand
public static void associateCommand(String commandName, BaseUIComponent component, IAction action) { getCommand(commandName, true).bind(component, action); }
java
public static void associateCommand(String commandName, BaseUIComponent component, IAction action) { getCommand(commandName, true).bind(component, action); }
[ "public", "static", "void", "associateCommand", "(", "String", "commandName", ",", "BaseUIComponent", "component", ",", "IAction", "action", ")", "{", "getCommand", "(", "commandName", ",", "true", ")", ".", "bind", "(", "component", ",", "action", ")", ";", ...
Associates a UI component with a command and action. @param commandName Name of the command. @param component Component to be associated. @param action Action to be executed when the command is invoked.
[ "Associates", "a", "UI", "component", "with", "a", "command", "and", "action", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java#L199-L201
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java
CommandUtil.dissociateCommand
public static void dissociateCommand(String commandName, BaseUIComponent component) { Command command = getCommand(commandName, false); if (command != null) { command.unbind(component); } }
java
public static void dissociateCommand(String commandName, BaseUIComponent component) { Command command = getCommand(commandName, false); if (command != null) { command.unbind(component); } }
[ "public", "static", "void", "dissociateCommand", "(", "String", "commandName", ",", "BaseUIComponent", "component", ")", "{", "Command", "command", "=", "getCommand", "(", "commandName", ",", "false", ")", ";", "if", "(", "command", "!=", "null", ")", "{", "...
Dissociate a UI component with a command. @param commandName Name of the command. @param component Component to be associated.
[ "Dissociate", "a", "UI", "component", "with", "a", "command", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java#L209-L215
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java
CommandUtil.dissociateAll
public static void dissociateAll(BaseUIComponent component) { for (Command command : CommandRegistry.getInstance()) { command.unbind(component); } }
java
public static void dissociateAll(BaseUIComponent component) { for (Command command : CommandRegistry.getInstance()) { command.unbind(component); } }
[ "public", "static", "void", "dissociateAll", "(", "BaseUIComponent", "component", ")", "{", "for", "(", "Command", "command", ":", "CommandRegistry", ".", "getInstance", "(", ")", ")", "{", "command", ".", "unbind", "(", "component", ")", ";", "}", "}" ]
Removes all command bindings for a component. @param component The component.
[ "Removes", "all", "command", "bindings", "for", "a", "component", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java#L222-L226
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java
CommandUtil.getCommand
public static Command getCommand(String commandName, boolean forceCreate) { return CommandRegistry.getInstance().get(commandName, forceCreate); }
java
public static Command getCommand(String commandName, boolean forceCreate) { return CommandRegistry.getInstance().get(commandName, forceCreate); }
[ "public", "static", "Command", "getCommand", "(", "String", "commandName", ",", "boolean", "forceCreate", ")", "{", "return", "CommandRegistry", ".", "getInstance", "(", ")", ".", "get", "(", "commandName", ",", "forceCreate", ")", ";", "}" ]
Returns a command from the command registry. @param commandName Name of the command. @param forceCreate If true and the named command does not exist, one will be created and added to the command registry. @return The command object corresponding to the specified command name.
[ "Returns", "a", "command", "from", "the", "command", "registry", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java#L236-L238
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java
CommandUtil.addShortcut
private static void addShortcut(StringBuilder sb, Set<String> shortcuts) { if (sb.length() > 0) { String shortcut = validateShortcut(sb.toString()); if (shortcut != null) { shortcuts.add(shortcut); } sb.delete(0, sb.length()); } }
java
private static void addShortcut(StringBuilder sb, Set<String> shortcuts) { if (sb.length() > 0) { String shortcut = validateShortcut(sb.toString()); if (shortcut != null) { shortcuts.add(shortcut); } sb.delete(0, sb.length()); } }
[ "private", "static", "void", "addShortcut", "(", "StringBuilder", "sb", ",", "Set", "<", "String", ">", "shortcuts", ")", "{", "if", "(", "sb", ".", "length", "(", ")", ">", "0", ")", "{", "String", "shortcut", "=", "validateShortcut", "(", "sb", ".", ...
Adds a parsed shortcut to the set of shortcuts. Only valid shortcuts are added. @param sb String builder containing a parsed shortcut. @param shortcuts Set to receive parsed shortcut.
[ "Adds", "a", "parsed", "shortcut", "to", "the", "set", "of", "shortcuts", ".", "Only", "valid", "shortcuts", "are", "added", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java#L246-L256
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java
HelpSearchService.resolveIndexDirectoryPath
private File resolveIndexDirectoryPath() throws IOException { if (StringUtils.isEmpty(indexDirectoryPath)) { indexDirectoryPath = System.getProperty("java.io.tmpdir") + appContext.getApplicationName(); } File dir = new File(indexDirectoryPath, getClass().getPackage().getName()); if (!dir.exists() && !dir.mkdirs()) { throw new IOException("Failed to create help search index directory."); } log.info("Help search index located at " + dir); return dir; }
java
private File resolveIndexDirectoryPath() throws IOException { if (StringUtils.isEmpty(indexDirectoryPath)) { indexDirectoryPath = System.getProperty("java.io.tmpdir") + appContext.getApplicationName(); } File dir = new File(indexDirectoryPath, getClass().getPackage().getName()); if (!dir.exists() && !dir.mkdirs()) { throw new IOException("Failed to create help search index directory."); } log.info("Help search index located at " + dir); return dir; }
[ "private", "File", "resolveIndexDirectoryPath", "(", ")", "throws", "IOException", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "indexDirectoryPath", ")", ")", "{", "indexDirectoryPath", "=", "System", ".", "getProperty", "(", "\"java.io.tmpdir\"", ")", "+"...
Resolves the index directory path. If a path is not specified, one is created within temporary storage. @return The resolved index directory path. @throws IOException Unspecified IO exception.
[ "Resolves", "the", "index", "directory", "path", ".", "If", "a", "path", "is", "not", "specified", "one", "is", "created", "within", "temporary", "storage", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java#L237-L250
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java
HelpSearchService.indexHelpModule
@Override public void indexHelpModule(HelpModule helpModule) { try { if (indexTracker.isSame(helpModule)) { return; } unindexHelpModule(helpModule); log.info("Indexing help module " + helpModule.getLocalizedId()); int i = helpModule.getUrl().lastIndexOf('/'); String pattern = "classpath:" + helpModule.getUrl().substring(0, i + 1) + "*.htm*"; for (Resource resource : appContext.getResources(pattern)) { indexDocument(helpModule, resource); } writer.commit(); indexTracker.add(helpModule); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
java
@Override public void indexHelpModule(HelpModule helpModule) { try { if (indexTracker.isSame(helpModule)) { return; } unindexHelpModule(helpModule); log.info("Indexing help module " + helpModule.getLocalizedId()); int i = helpModule.getUrl().lastIndexOf('/'); String pattern = "classpath:" + helpModule.getUrl().substring(0, i + 1) + "*.htm*"; for (Resource resource : appContext.getResources(pattern)) { indexDocument(helpModule, resource); } writer.commit(); indexTracker.add(helpModule); } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
[ "@", "Override", "public", "void", "indexHelpModule", "(", "HelpModule", "helpModule", ")", "{", "try", "{", "if", "(", "indexTracker", ".", "isSame", "(", "helpModule", ")", ")", "{", "return", ";", "}", "unindexHelpModule", "(", "helpModule", ")", ";", "...
Index all HTML files within the content of the help module. @param helpModule Help module to be indexed.
[ "Index", "all", "HTML", "files", "within", "the", "content", "of", "the", "help", "module", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java#L257-L278
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java
HelpSearchService.unindexHelpModule
@Override public void unindexHelpModule(HelpModule helpModule) { try { log.info("Removing index for help module " + helpModule.getLocalizedId()); Term term = new Term("module", helpModule.getLocalizedId()); writer.deleteDocuments(term); writer.commit(); indexTracker.remove(helpModule); } catch (IOException e) { MiscUtil.toUnchecked(e); } }
java
@Override public void unindexHelpModule(HelpModule helpModule) { try { log.info("Removing index for help module " + helpModule.getLocalizedId()); Term term = new Term("module", helpModule.getLocalizedId()); writer.deleteDocuments(term); writer.commit(); indexTracker.remove(helpModule); } catch (IOException e) { MiscUtil.toUnchecked(e); } }
[ "@", "Override", "public", "void", "unindexHelpModule", "(", "HelpModule", "helpModule", ")", "{", "try", "{", "log", ".", "info", "(", "\"Removing index for help module \"", "+", "helpModule", ".", "getLocalizedId", "(", ")", ")", ";", "Term", "term", "=", "n...
Removes the index for a help module. @param helpModule Help module whose index is to be removed.
[ "Removes", "the", "index", "for", "a", "help", "module", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java#L285-L296
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java
HelpSearchService.indexDocument
private void indexDocument(HelpModule helpModule, Resource resource) throws Exception { String title = getTitle(resource); try (InputStream is = resource.getInputStream()) { Document document = new Document(); document.add(new TextField("module", helpModule.getLocalizedId(), Store.YES)); document.add(new TextField("source", helpModule.getTitle(), Store.YES)); document.add(new TextField("title", title, Store.YES)); document.add(new TextField("url", resource.getURL().toString(), Store.YES)); document.add(new TextField("content", tika.parseToString(is), Store.NO)); writer.addDocument(document); } }
java
private void indexDocument(HelpModule helpModule, Resource resource) throws Exception { String title = getTitle(resource); try (InputStream is = resource.getInputStream()) { Document document = new Document(); document.add(new TextField("module", helpModule.getLocalizedId(), Store.YES)); document.add(new TextField("source", helpModule.getTitle(), Store.YES)); document.add(new TextField("title", title, Store.YES)); document.add(new TextField("url", resource.getURL().toString(), Store.YES)); document.add(new TextField("content", tika.parseToString(is), Store.NO)); writer.addDocument(document); } }
[ "private", "void", "indexDocument", "(", "HelpModule", "helpModule", ",", "Resource", "resource", ")", "throws", "Exception", "{", "String", "title", "=", "getTitle", "(", "resource", ")", ";", "try", "(", "InputStream", "is", "=", "resource", ".", "getInputSt...
Index an HTML text file resource. @param helpModule The help module owning the resource. @param resource The HTML text file resource. @throws Exception Unspecified exception.
[ "Index", "an", "HTML", "text", "file", "resource", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java#L305-L317
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java
HelpSearchService.getTitle
private String getTitle(Resource resource) { String title = null; try (InputStream is = resource.getInputStream()) { Iterator<String> iter = IOUtils.lineIterator(is, "UTF-8"); while (iter.hasNext()) { String line = iter.next().trim(); String lower = line.toLowerCase(); int i = lower.indexOf("<title>"); if (i > -1) { i += 7; int j = lower.indexOf("</title>", i); title = line.substring(i, j == -1 ? line.length() : j).trim(); title = title.replace("_no", "").replace('_', ' '); break; } } } catch (Exception e) { throw MiscUtil.toUnchecked(e); } return title; }
java
private String getTitle(Resource resource) { String title = null; try (InputStream is = resource.getInputStream()) { Iterator<String> iter = IOUtils.lineIterator(is, "UTF-8"); while (iter.hasNext()) { String line = iter.next().trim(); String lower = line.toLowerCase(); int i = lower.indexOf("<title>"); if (i > -1) { i += 7; int j = lower.indexOf("</title>", i); title = line.substring(i, j == -1 ? line.length() : j).trim(); title = title.replace("_no", "").replace('_', ' '); break; } } } catch (Exception e) { throw MiscUtil.toUnchecked(e); } return title; }
[ "private", "String", "getTitle", "(", "Resource", "resource", ")", "{", "String", "title", "=", "null", ";", "try", "(", "InputStream", "is", "=", "resource", ".", "getInputStream", "(", ")", ")", "{", "Iterator", "<", "String", ">", "iter", "=", "IOUtil...
Extract the title of the document, if any. @param resource The document resource. @return The document title, or null if not found.
[ "Extract", "the", "title", "of", "the", "document", "if", "any", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java#L325-L349
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java
HelpSearchService.search
@Override public void search(String words, Collection<IHelpSet> helpSets, IHelpSearchListener listener) { try { if (queryBuilder == null) { initQueryBuilder(); } Query searchForWords = queryBuilder.createBooleanQuery("content", words, Occur.MUST); Query searchForModules = queryBuilder.createBooleanQuery("module", StrUtil.fromList(helpSets, " ")); BooleanQuery query = new BooleanQuery(); query.add(searchForModules, Occur.MUST); query.add(searchForWords, Occur.MUST); TopDocs docs = indexSearcher.search(query, 9999); List<HelpSearchHit> hits = new ArrayList<>(docs.totalHits); for (ScoreDoc sdoc : docs.scoreDocs) { Document doc = indexSearcher.doc(sdoc.doc); String source = doc.get("source"); String title = doc.get("title"); String url = doc.get("url"); HelpTopic topic = new HelpTopic(new URL(url), title, source); HelpSearchHit hit = new HelpSearchHit(topic, sdoc.score); hits.add(hit); } listener.onSearchComplete(hits); } catch (Exception e) { MiscUtil.toUnchecked(e); } }
java
@Override public void search(String words, Collection<IHelpSet> helpSets, IHelpSearchListener listener) { try { if (queryBuilder == null) { initQueryBuilder(); } Query searchForWords = queryBuilder.createBooleanQuery("content", words, Occur.MUST); Query searchForModules = queryBuilder.createBooleanQuery("module", StrUtil.fromList(helpSets, " ")); BooleanQuery query = new BooleanQuery(); query.add(searchForModules, Occur.MUST); query.add(searchForWords, Occur.MUST); TopDocs docs = indexSearcher.search(query, 9999); List<HelpSearchHit> hits = new ArrayList<>(docs.totalHits); for (ScoreDoc sdoc : docs.scoreDocs) { Document doc = indexSearcher.doc(sdoc.doc); String source = doc.get("source"); String title = doc.get("title"); String url = doc.get("url"); HelpTopic topic = new HelpTopic(new URL(url), title, source); HelpSearchHit hit = new HelpSearchHit(topic, sdoc.score); hits.add(hit); } listener.onSearchComplete(hits); } catch (Exception e) { MiscUtil.toUnchecked(e); } }
[ "@", "Override", "public", "void", "search", "(", "String", "words", ",", "Collection", "<", "IHelpSet", ">", "helpSets", ",", "IHelpSearchListener", "listener", ")", "{", "try", "{", "if", "(", "queryBuilder", "==", "null", ")", "{", "initQueryBuilder", "("...
Performs a search query using the specified string on each registered query handler, calling the listener for each set of results. @param words List of words to be located. @param helpSets Help sets to be searched @param listener Listener for search results.
[ "Performs", "a", "search", "query", "using", "the", "specified", "string", "on", "each", "registered", "query", "handler", "calling", "the", "listener", "for", "each", "set", "of", "results", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java#L359-L388
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java
HelpSearchService.init
public void init() throws IOException { File path = resolveIndexDirectoryPath(); indexTracker = new IndexTracker(path); indexDirectory = FSDirectory.open(path); tika = new Tika(null, new HtmlParser()); Analyzer analyzer = new StandardAnalyzer(); IndexWriterConfig config = new IndexWriterConfig(Version.LATEST, analyzer); writer = new IndexWriter(indexDirectory, config); }
java
public void init() throws IOException { File path = resolveIndexDirectoryPath(); indexTracker = new IndexTracker(path); indexDirectory = FSDirectory.open(path); tika = new Tika(null, new HtmlParser()); Analyzer analyzer = new StandardAnalyzer(); IndexWriterConfig config = new IndexWriterConfig(Version.LATEST, analyzer); writer = new IndexWriter(indexDirectory, config); }
[ "public", "void", "init", "(", ")", "throws", "IOException", "{", "File", "path", "=", "resolveIndexDirectoryPath", "(", ")", ";", "indexTracker", "=", "new", "IndexTracker", "(", "path", ")", ";", "indexDirectory", "=", "FSDirectory", ".", "open", "(", "pat...
Initialize the index writer. @throws IOException Unspecified IO exception.
[ "Initialize", "the", "index", "writer", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java#L395-L403
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java
HelpSearchService.initQueryBuilder
private synchronized void initQueryBuilder() throws IOException { if (queryBuilder == null) { indexReader = DirectoryReader.open(indexDirectory); indexSearcher = new IndexSearcher(indexReader); queryBuilder = new QueryBuilder(writer.getAnalyzer()); } }
java
private synchronized void initQueryBuilder() throws IOException { if (queryBuilder == null) { indexReader = DirectoryReader.open(indexDirectory); indexSearcher = new IndexSearcher(indexReader); queryBuilder = new QueryBuilder(writer.getAnalyzer()); } }
[ "private", "synchronized", "void", "initQueryBuilder", "(", ")", "throws", "IOException", "{", "if", "(", "queryBuilder", "==", "null", ")", "{", "indexReader", "=", "DirectoryReader", ".", "open", "(", "indexDirectory", ")", ";", "indexSearcher", "=", "new", ...
Performs a delayed initialization of the query builder to ensure that the index has been fully created. @throws IOException Unspecified IO exception.
[ "Performs", "a", "delayed", "initialization", "of", "the", "query", "builder", "to", "ensure", "that", "the", "index", "has", "been", "fully", "created", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.lucene/src/main/java/org/carewebframework/help/lucene/HelpSearchService.java#L411-L417
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/AlertContainer.java
AlertContainer.render
public static AlertContainer render(BaseComponent parent, BaseComponent child) { AlertContainer container = new AlertContainer(child); parent.addChild(container, 0); return container; }
java
public static AlertContainer render(BaseComponent parent, BaseComponent child) { AlertContainer container = new AlertContainer(child); parent.addChild(container, 0); return container; }
[ "public", "static", "AlertContainer", "render", "(", "BaseComponent", "parent", ",", "BaseComponent", "child", ")", "{", "AlertContainer", "container", "=", "new", "AlertContainer", "(", "child", ")", ";", "parent", ".", "addChild", "(", "container", ",", "0", ...
Renders an alert in its container. @param parent Parent component that will host the container. @param child Child component that is the root component of the alert. @return The created container.
[ "Renders", "an", "alert", "in", "its", "container", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/AlertContainer.java#L52-L56
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/AlertContainer.java
AlertContainer.doAction
@Override public void doAction(Action action) { BaseComponent parent = getParent(); switch (action) { case REMOVE: ActionListener.unbindActionListeners(this, actionListeners); detach(); break; case HIDE: case COLLAPSE: setVisible(false); break; case SHOW: case EXPAND: setVisible(true); break; case TOP: parent.addChild(this, 0); break; } if (parent != null) { EventUtil.post(MainController.ALERT_ACTION_EVENT, parent, action); } }
java
@Override public void doAction(Action action) { BaseComponent parent = getParent(); switch (action) { case REMOVE: ActionListener.unbindActionListeners(this, actionListeners); detach(); break; case HIDE: case COLLAPSE: setVisible(false); break; case SHOW: case EXPAND: setVisible(true); break; case TOP: parent.addChild(this, 0); break; } if (parent != null) { EventUtil.post(MainController.ALERT_ACTION_EVENT, parent, action); } }
[ "@", "Override", "public", "void", "doAction", "(", "Action", "action", ")", "{", "BaseComponent", "parent", "=", "getParent", "(", ")", ";", "switch", "(", "action", ")", "{", "case", "REMOVE", ":", "ActionListener", ".", "unbindActionListeners", "(", "this...
Perform the specified action on the drop container. Also, notifies the container's parent that an action has occurred. @param action An action.
[ "Perform", "the", "specified", "action", "on", "the", "drop", "container", ".", "Also", "notifies", "the", "container", "s", "parent", "that", "an", "action", "has", "occurred", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/AlertContainer.java#L76-L104
train
carewebframework/carewebframework-core
org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/MessageConsumer.java
MessageConsumer.assertSubscriptions
public void assertSubscriptions() { for (String channel : subscribers.keySet()) { try { subscribers.put(channel, null); subscribe(channel); } catch (Throwable e) { break; } } }
java
public void assertSubscriptions() { for (String channel : subscribers.keySet()) { try { subscribers.put(channel, null); subscribe(channel); } catch (Throwable e) { break; } } }
[ "public", "void", "assertSubscriptions", "(", ")", "{", "for", "(", "String", "channel", ":", "subscribers", ".", "keySet", "(", ")", ")", "{", "try", "{", "subscribers", ".", "put", "(", "channel", ",", "null", ")", ";", "subscribe", "(", "channel", "...
Reassert subscriptions.
[ "Reassert", "subscriptions", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/MessageConsumer.java#L151-L160
train
carewebframework/carewebframework-core
org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/MessageConsumer.java
MessageConsumer.removeSubscriptions
public void removeSubscriptions() { for (TopicSubscriber subscriber : subscribers.values()) { try { subscriber.close(); } catch (Throwable e) { log.debug("Error closing subscriber", e);//is level appropriate - previously hidden exception -afranken } } subscribers.clear(); }
java
public void removeSubscriptions() { for (TopicSubscriber subscriber : subscribers.values()) { try { subscriber.close(); } catch (Throwable e) { log.debug("Error closing subscriber", e);//is level appropriate - previously hidden exception -afranken } } subscribers.clear(); }
[ "public", "void", "removeSubscriptions", "(", ")", "{", "for", "(", "TopicSubscriber", "subscriber", ":", "subscribers", ".", "values", "(", ")", ")", "{", "try", "{", "subscriber", ".", "close", "(", ")", ";", "}", "catch", "(", "Throwable", "e", ")", ...
Remove all remote subscriptions.
[ "Remove", "all", "remote", "subscriptions", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/MessageConsumer.java#L165-L175
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginResourceButton.java
PluginResourceButton.getCaption
public String getCaption() { return caption != null && caption.toLowerCase().startsWith("label:") ? StrUtil.getLabel(caption.substring(6)) : caption; }
java
public String getCaption() { return caption != null && caption.toLowerCase().startsWith("label:") ? StrUtil.getLabel(caption.substring(6)) : caption; }
[ "public", "String", "getCaption", "(", ")", "{", "return", "caption", "!=", "null", "&&", "caption", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "\"label:\"", ")", "?", "StrUtil", ".", "getLabel", "(", "caption", ".", "substring", "(", "6", ")"...
Returns the value of the button's caption text. @return The button's caption text.
[ "Returns", "the", "value", "of", "the", "button", "s", "caption", "text", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginResourceButton.java#L60-L63
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutNode.java
LayoutNode.createDOMNode
public Element createDOMNode(Element parent) { Element domNode = parent.getOwnerDocument().createElement(tagName); LayoutUtil.copyAttributes(attributes, domNode); parent.appendChild(domNode); return domNode; }
java
public Element createDOMNode(Element parent) { Element domNode = parent.getOwnerDocument().createElement(tagName); LayoutUtil.copyAttributes(attributes, domNode); parent.appendChild(domNode); return domNode; }
[ "public", "Element", "createDOMNode", "(", "Element", "parent", ")", "{", "Element", "domNode", "=", "parent", ".", "getOwnerDocument", "(", ")", ".", "createElement", "(", "tagName", ")", ";", "LayoutUtil", ".", "copyAttributes", "(", "attributes", ",", "domN...
Creates a DOM node from this layout node. @param parent Parent DOM node. @return The newly created DOM node.
[ "Creates", "a", "DOM", "node", "from", "this", "layout", "node", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutNode.java#L129-L134
train
ologolo/streamline-engine
src/org/daisy/streamline/engine/TempFolderHandler.java
TempFolderHandler.reset
public void reset() throws IOException { if (t1==null || t2==null) { throw new IllegalStateException("Cannot reset after close."); } if (!isEmpty(getOutput())) { toggle = !toggle; // reset the new output PathTools.deleteRecursive(getOutput(), false); } else { throw new IOException("Cannot swap to an empty folder."); } }
java
public void reset() throws IOException { if (t1==null || t2==null) { throw new IllegalStateException("Cannot reset after close."); } if (!isEmpty(getOutput())) { toggle = !toggle; // reset the new output PathTools.deleteRecursive(getOutput(), false); } else { throw new IOException("Cannot swap to an empty folder."); } }
[ "public", "void", "reset", "(", ")", "throws", "IOException", "{", "if", "(", "t1", "==", "null", "||", "t2", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot reset after close.\"", ")", ";", "}", "if", "(", "!", "isEmpty", ...
Resets the input and output folder before writing to the output again @throws IOException An IOException is thrown if TempFolderHandler has been closed or if the output folder is empty.
[ "Resets", "the", "input", "and", "output", "folder", "before", "writing", "to", "the", "output", "again" ]
04b7adc85d84d91dc5f0eaaa401d2738f9401b17
https://github.com/ologolo/streamline-engine/blob/04b7adc85d84d91dc5f0eaaa401d2738f9401b17/src/org/daisy/streamline/engine/TempFolderHandler.java#L69-L80
train
ologolo/streamline-engine
src/org/daisy/streamline/engine/TempFolderHandler.java
TempFolderHandler.close
public void close() throws IOException { if (t1==null || t2==null) { return; } try { if (!isEmpty(getOutput())) { Optional<? extends IOException> ex = output.apply(getOutput()); if (ex.isPresent()) { throw ex.get(); } } else if (!isEmpty(getInput())) { Optional<? extends IOException> ex = output.apply(getInput()); if (ex.isPresent()) { throw ex.get(); } } else { throw new IOException("Corrupted state."); } } finally { PathTools.deleteRecursive(t1); PathTools.deleteRecursive(t2); t1 = null; t2 = null; } }
java
public void close() throws IOException { if (t1==null || t2==null) { return; } try { if (!isEmpty(getOutput())) { Optional<? extends IOException> ex = output.apply(getOutput()); if (ex.isPresent()) { throw ex.get(); } } else if (!isEmpty(getInput())) { Optional<? extends IOException> ex = output.apply(getInput()); if (ex.isPresent()) { throw ex.get(); } } else { throw new IOException("Corrupted state."); } } finally { PathTools.deleteRecursive(t1); PathTools.deleteRecursive(t2); t1 = null; t2 = null; } }
[ "public", "void", "close", "(", ")", "throws", "IOException", "{", "if", "(", "t1", "==", "null", "||", "t2", "==", "null", ")", "{", "return", ";", "}", "try", "{", "if", "(", "!", "isEmpty", "(", "getOutput", "(", ")", ")", ")", "{", "Optional"...
Process the result with the output function and then closes the temporary folders. Closing the TempFolderHandler is a mandatory last step after which no other calls to the object should be made. @throws IOException An IOException is thrown if the temporary folders have been deleted, or are empty.
[ "Process", "the", "result", "with", "the", "output", "function", "and", "then", "closes", "the", "temporary", "folders", ".", "Closing", "the", "TempFolderHandler", "is", "a", "mandatory", "last", "step", "after", "which", "no", "other", "calls", "to", "the", ...
04b7adc85d84d91dc5f0eaaa401d2738f9401b17
https://github.com/ologolo/streamline-engine/blob/04b7adc85d84d91dc5f0eaaa401d2738f9401b17/src/org/daisy/streamline/engine/TempFolderHandler.java#L97-L121
train
carewebframework/carewebframework-core
org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/CWFAuthenticationDetails.java
CWFAuthenticationDetails.setDetail
public void setDetail(String name, Object value) { if (value == null) { details.remove(name); } else { details.put(name, value); } if (log.isDebugEnabled()) { if (value == null) { log.debug("Detail removed: " + name); } else { log.debug("Detail added: " + name + " = " + value); } } }
java
public void setDetail(String name, Object value) { if (value == null) { details.remove(name); } else { details.put(name, value); } if (log.isDebugEnabled()) { if (value == null) { log.debug("Detail removed: " + name); } else { log.debug("Detail added: " + name + " = " + value); } } }
[ "public", "void", "setDetail", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "details", ".", "remove", "(", "name", ")", ";", "}", "else", "{", "details", ".", "put", "(", "name", ",", "value",...
Sets the specified detail element to the specified value. @param name Name of the detail element. @param value Value for the detail element. A null value removes any existing detail element.
[ "Sets", "the", "specified", "detail", "element", "to", "the", "specified", "value", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/CWFAuthenticationDetails.java#L62-L76
train
carewebframework/carewebframework-core
org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/CWFAuthenticationDetails.java
CWFAuthenticationDetails.getDetail
public Object getDetail(String name) { return name == null ? null : details.get(name); }
java
public Object getDetail(String name) { return name == null ? null : details.get(name); }
[ "public", "Object", "getDetail", "(", "String", "name", ")", "{", "return", "name", "==", "null", "?", "null", ":", "details", ".", "get", "(", "name", ")", ";", "}" ]
Returns the specified detail element. @param name Name of the detail element. @return Value of the detail element, or null if not found.
[ "Returns", "the", "specified", "detail", "element", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/CWFAuthenticationDetails.java#L84-L86
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/GlobalEventDispatcher.java
GlobalEventDispatcher.init
public void init() { IUser user = SecurityUtil.getAuthenticatedUser(); publisherInfo.setUserId(user == null ? null : user.getLogicalId()); publisherInfo.setUserName(user == null ? "" : user.getFullName()); publisherInfo.setAppName(getAppName()); publisherInfo.setConsumerId(consumer.getNodeId()); publisherInfo.setProducerId(producer.getNodeId()); publisherInfo.setSessionId(sessionId); localEventDispatcher.setGlobalEventDispatcher(this); pingEventHandler = new PingEventHandler((IEventManager) localEventDispatcher, publisherInfo); pingEventHandler.init(); }
java
public void init() { IUser user = SecurityUtil.getAuthenticatedUser(); publisherInfo.setUserId(user == null ? null : user.getLogicalId()); publisherInfo.setUserName(user == null ? "" : user.getFullName()); publisherInfo.setAppName(getAppName()); publisherInfo.setConsumerId(consumer.getNodeId()); publisherInfo.setProducerId(producer.getNodeId()); publisherInfo.setSessionId(sessionId); localEventDispatcher.setGlobalEventDispatcher(this); pingEventHandler = new PingEventHandler((IEventManager) localEventDispatcher, publisherInfo); pingEventHandler.init(); }
[ "public", "void", "init", "(", ")", "{", "IUser", "user", "=", "SecurityUtil", ".", "getAuthenticatedUser", "(", ")", ";", "publisherInfo", ".", "setUserId", "(", "user", "==", "null", "?", "null", ":", "user", ".", "getLogicalId", "(", ")", ")", ";", ...
Initialize after setting all requisite properties.
[ "Initialize", "after", "setting", "all", "requisite", "properties", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/GlobalEventDispatcher.java#L83-L94
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/GlobalEventDispatcher.java
GlobalEventDispatcher.fireRemoteEvent
@Override public void fireRemoteEvent(String eventName, Serializable eventData, Recipient... recipients) { Message message = new EventMessage(eventName, eventData); producer.publish(EventUtil.getChannelName(eventName), message, recipients); }
java
@Override public void fireRemoteEvent(String eventName, Serializable eventData, Recipient... recipients) { Message message = new EventMessage(eventName, eventData); producer.publish(EventUtil.getChannelName(eventName), message, recipients); }
[ "@", "Override", "public", "void", "fireRemoteEvent", "(", "String", "eventName", ",", "Serializable", "eventData", ",", "Recipient", "...", "recipients", ")", "{", "Message", "message", "=", "new", "EventMessage", "(", "eventName", ",", "eventData", ")", ";", ...
Queues the specified event for delivery via the messaging service. @param eventName Name of the event. @param eventData Data object associated with the event. @param recipients Optional list of recipients for the event.
[ "Queues", "the", "specified", "event", "for", "delivery", "via", "the", "messaging", "service", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/GlobalEventDispatcher.java#L126-L130
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/GlobalEventDispatcher.java
GlobalEventDispatcher.getAppName
protected String getAppName() { if (appName == null && FrameworkUtil.isInitialized()) { setAppName(FrameworkUtil.getAppName()); } return appName; }
java
protected String getAppName() { if (appName == null && FrameworkUtil.isInitialized()) { setAppName(FrameworkUtil.getAppName()); } return appName; }
[ "protected", "String", "getAppName", "(", ")", "{", "if", "(", "appName", "==", "null", "&&", "FrameworkUtil", ".", "isInitialized", "(", ")", ")", "{", "setAppName", "(", "FrameworkUtil", ".", "getAppName", "(", ")", ")", ";", "}", "return", "appName", ...
Returns the application name. @return Application name.
[ "Returns", "the", "application", "name", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/GlobalEventDispatcher.java#L145-L151
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.getViewerMode
public static HelpViewerMode getViewerMode(Page page) { return page == null || !page.hasAttribute(EMBEDDED_ATTRIB) ? defaultMode : (HelpViewerMode) page.getAttribute(EMBEDDED_ATTRIB); }
java
public static HelpViewerMode getViewerMode(Page page) { return page == null || !page.hasAttribute(EMBEDDED_ATTRIB) ? defaultMode : (HelpViewerMode) page.getAttribute(EMBEDDED_ATTRIB); }
[ "public", "static", "HelpViewerMode", "getViewerMode", "(", "Page", "page", ")", "{", "return", "page", "==", "null", "||", "!", "page", ".", "hasAttribute", "(", "EMBEDDED_ATTRIB", ")", "?", "defaultMode", ":", "(", "HelpViewerMode", ")", "page", ".", "getA...
Returns the help viewer mode for the specified page. @param page The page to check. If null, the global setting is returned. @return The help viewer mode.
[ "Returns", "the", "help", "viewer", "mode", "for", "the", "specified", "page", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L94-L97
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.setViewerMode
public static void setViewerMode(Page page, HelpViewerMode mode) { if (getViewerMode(page) != mode) { removeViewer(page, true); } page.setAttribute(EMBEDDED_ATTRIB, mode); }
java
public static void setViewerMode(Page page, HelpViewerMode mode) { if (getViewerMode(page) != mode) { removeViewer(page, true); } page.setAttribute(EMBEDDED_ATTRIB, mode); }
[ "public", "static", "void", "setViewerMode", "(", "Page", "page", ",", "HelpViewerMode", "mode", ")", "{", "if", "(", "getViewerMode", "(", "page", ")", "!=", "mode", ")", "{", "removeViewer", "(", "page", ",", "true", ")", ";", "}", "page", ".", "setA...
Sets the help viewer mode for the specified page. If different from the previous mode and a viewer for this page exists, the viewer will be removed and recreated on the next request. @param page The target page. @param mode The help viewer mode.
[ "Sets", "the", "help", "viewer", "mode", "for", "the", "specified", "page", ".", "If", "different", "from", "the", "previous", "mode", "and", "a", "viewer", "for", "this", "page", "exists", "the", "viewer", "will", "be", "removed", "and", "recreated", "on"...
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L106-L112
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.getViewer
public static IHelpViewer getViewer(boolean forceCreate) { Page page = getPage(); IHelpViewer viewer = (IHelpViewer) page.getAttribute(VIEWER_ATTRIB); return viewer != null ? viewer : forceCreate ? createViewer(page) : null; }
java
public static IHelpViewer getViewer(boolean forceCreate) { Page page = getPage(); IHelpViewer viewer = (IHelpViewer) page.getAttribute(VIEWER_ATTRIB); return viewer != null ? viewer : forceCreate ? createViewer(page) : null; }
[ "public", "static", "IHelpViewer", "getViewer", "(", "boolean", "forceCreate", ")", "{", "Page", "page", "=", "getPage", "(", ")", ";", "IHelpViewer", "viewer", "=", "(", "IHelpViewer", ")", "page", ".", "getAttribute", "(", "VIEWER_ATTRIB", ")", ";", "retur...
Returns an instance of the viewer for the current page. If no instance yet exists and forceCreate is true, one is created. @param forceCreate If true, a viewer instance will be created if it does not exist. @return The help viewer (may be null).
[ "Returns", "an", "instance", "of", "the", "viewer", "for", "the", "current", "page", ".", "If", "no", "instance", "yet", "exists", "and", "forceCreate", "is", "true", "one", "is", "created", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L121-L125
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.createViewer
private static IHelpViewer createViewer(Page page) { IHelpViewer viewer; if (getViewerMode(page) == HelpViewerMode.POPUP) { viewer = new HelpViewerProxy(page); } else { BaseComponent root = PageUtil.createPage(VIEWER_URL, page).get(0); viewer = (IHelpViewer) root.getAttribute("controller"); } page.setAttribute(VIEWER_ATTRIB, viewer); return viewer; }
java
private static IHelpViewer createViewer(Page page) { IHelpViewer viewer; if (getViewerMode(page) == HelpViewerMode.POPUP) { viewer = new HelpViewerProxy(page); } else { BaseComponent root = PageUtil.createPage(VIEWER_URL, page).get(0); viewer = (IHelpViewer) root.getAttribute("controller"); } page.setAttribute(VIEWER_ATTRIB, viewer); return viewer; }
[ "private", "static", "IHelpViewer", "createViewer", "(", "Page", "page", ")", "{", "IHelpViewer", "viewer", ";", "if", "(", "getViewerMode", "(", "page", ")", "==", "HelpViewerMode", ".", "POPUP", ")", "{", "viewer", "=", "new", "HelpViewerProxy", "(", "page...
Creates an instance of the help viewer, associating it with the specified page. @param page Page owning the help viewer instance. @return The newly created help viewer.
[ "Creates", "an", "instance", "of", "the", "help", "viewer", "associating", "it", "with", "the", "specified", "page", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L133-L145
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.removeViewer
protected static void removeViewer(Page page, boolean close) { IHelpViewer viewer = (IHelpViewer) page.removeAttribute(VIEWER_ATTRIB); if (viewer != null && close) { viewer.close(); } }
java
protected static void removeViewer(Page page, boolean close) { IHelpViewer viewer = (IHelpViewer) page.removeAttribute(VIEWER_ATTRIB); if (viewer != null && close) { viewer.close(); } }
[ "protected", "static", "void", "removeViewer", "(", "Page", "page", ",", "boolean", "close", ")", "{", "IHelpViewer", "viewer", "=", "(", "IHelpViewer", ")", "page", ".", "removeAttribute", "(", "VIEWER_ATTRIB", ")", ";", "if", "(", "viewer", "!=", "null", ...
Remove and optionally close the help viewer associated with the specified page. @param page The page owning the help viewer. @param close If true, close the help viewer after removing it.
[ "Remove", "and", "optionally", "close", "the", "help", "viewer", "associated", "with", "the", "specified", "page", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L160-L166
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.removeViewer
protected static void removeViewer(Page page, IHelpViewer viewer, boolean close) { if (viewer != null && viewer == page.getAttribute(VIEWER_ATTRIB)) { removeViewer(page, close); } }
java
protected static void removeViewer(Page page, IHelpViewer viewer, boolean close) { if (viewer != null && viewer == page.getAttribute(VIEWER_ATTRIB)) { removeViewer(page, close); } }
[ "protected", "static", "void", "removeViewer", "(", "Page", "page", ",", "IHelpViewer", "viewer", ",", "boolean", "close", ")", "{", "if", "(", "viewer", "!=", "null", "&&", "viewer", "==", "page", ".", "getAttribute", "(", "VIEWER_ATTRIB", ")", ")", "{", ...
Remove and optionally close the specified help viewer if is the active viewer for the specified page. @param page The page owner the help viewer. @param viewer The viewer to remove. @param close If true, close the help viewer after removing it.
[ "Remove", "and", "optionally", "close", "the", "specified", "help", "viewer", "if", "is", "the", "active", "viewer", "for", "the", "specified", "page", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L176-L180
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.getUrl
public static String getUrl(String path) { if (path == null) { return path; } ServletContext sc = ExecutionContext.getSession().getServletContext(); if (path.startsWith("jar:")) { int i = path.indexOf("!"); path = i < 0 ? path : path.substring(++i); } path = sc.getContextPath() + path; return path; }
java
public static String getUrl(String path) { if (path == null) { return path; } ServletContext sc = ExecutionContext.getSession().getServletContext(); if (path.startsWith("jar:")) { int i = path.indexOf("!"); path = i < 0 ? path : path.substring(++i); } path = sc.getContextPath() + path; return path; }
[ "public", "static", "String", "getUrl", "(", "String", "path", ")", "{", "if", "(", "path", "==", "null", ")", "{", "return", "path", ";", "}", "ServletContext", "sc", "=", "ExecutionContext", ".", "getSession", "(", ")", ".", "getServletContext", "(", "...
Returns a URL string representing the root path and context path. @param path Relative path to expand. @return The fully expanded URL.
[ "Returns", "a", "URL", "string", "representing", "the", "root", "path", "and", "context", "path", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L198-L212
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.show
public static void show(String module, String topic, String label) { getViewer(true).show(module, topic, label); }
java
public static void show(String module, String topic, String label) { getViewer(true).show(module, topic, label); }
[ "public", "static", "void", "show", "(", "String", "module", ",", "String", "topic", ",", "String", "label", ")", "{", "getViewer", "(", "true", ")", ".", "show", "(", "module", ",", "topic", ",", "label", ")", ";", "}" ]
Show help for the given module and optional topic. @param module The id of the help module. @param topic The id of the desired topic. If null, the home topic is shown. @param label The label to display for the topic. If null, the topic id is displayed as the label.
[ "Show", "help", "for", "the", "given", "module", "and", "optional", "topic", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L232-L234
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.showCSH
public static void showCSH(BaseComponent component) { while (component != null) { HelpContext target = (HelpContext) component.getAttribute(CSH_TARGET); if (target != null) { HelpUtil.show(target); break; } component = component.getParent(); } }
java
public static void showCSH(BaseComponent component) { while (component != null) { HelpContext target = (HelpContext) component.getAttribute(CSH_TARGET); if (target != null) { HelpUtil.show(target); break; } component = component.getParent(); } }
[ "public", "static", "void", "showCSH", "(", "BaseComponent", "component", ")", "{", "while", "(", "component", "!=", "null", ")", "{", "HelpContext", "target", "=", "(", "HelpContext", ")", "component", ".", "getAttribute", "(", "CSH_TARGET", ")", ";", "if",...
Display context-sensitive help associated with the specified component. If none is associated with the component, its parent is examined, and so on. If no help association is found, no action is taken. @param component Component whose CSH is to be displayed.
[ "Display", "context", "-", "sensitive", "help", "associated", "with", "the", "specified", "component", ".", "If", "none", "is", "associated", "with", "the", "component", "its", "parent", "is", "examined", "and", "so", "on", ".", "If", "no", "help", "associat...
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L259-L269
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.associateCSH
public static void associateCSH(BaseUIComponent component, HelpContext helpContext, BaseUIComponent commandTarget) { if (component != null) { component.setAttribute(CSH_TARGET, helpContext); CommandUtil.associateCommand("help", component, commandTarget); } }
java
public static void associateCSH(BaseUIComponent component, HelpContext helpContext, BaseUIComponent commandTarget) { if (component != null) { component.setAttribute(CSH_TARGET, helpContext); CommandUtil.associateCommand("help", component, commandTarget); } }
[ "public", "static", "void", "associateCSH", "(", "BaseUIComponent", "component", ",", "HelpContext", "helpContext", ",", "BaseUIComponent", "commandTarget", ")", "{", "if", "(", "component", "!=", "null", ")", "{", "component", ".", "setAttribute", "(", "CSH_TARGE...
Associates context-sensitive help topic with a component. Any existing association is replaced. @param component Component to be associated. @param helpContext The help target. @param commandTarget The command target.
[ "Associates", "context", "-", "sensitive", "help", "topic", "with", "a", "component", ".", "Any", "existing", "association", "is", "replaced", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L279-L284
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java
HelpUtil.dissociateCSH
public static void dissociateCSH(BaseUIComponent component) { if (component != null && component.hasAttribute(CSH_TARGET)) { CommandUtil.dissociateCommand("help", component); component.removeAttribute(CSH_TARGET); } }
java
public static void dissociateCSH(BaseUIComponent component) { if (component != null && component.hasAttribute(CSH_TARGET)) { CommandUtil.dissociateCommand("help", component); component.removeAttribute(CSH_TARGET); } }
[ "public", "static", "void", "dissociateCSH", "(", "BaseUIComponent", "component", ")", "{", "if", "(", "component", "!=", "null", "&&", "component", ".", "hasAttribute", "(", "CSH_TARGET", ")", ")", "{", "CommandUtil", ".", "dissociateCommand", "(", "\"help\"", ...
Dissociates context-sensitive help from a component. @param component Component to dissociate.
[ "Dissociates", "context", "-", "sensitive", "help", "from", "a", "component", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L291-L296
train
mgormley/prim
src/main/java/edu/jhu/prim/arrays/DoubleArrays.java
DoubleArrays.subtract
public static void subtract(double[] array1, double[] array2) { assert (array1.length == array2.length); for (int i=0; i<array1.length; i++) { array1[i] -= array2[i]; } }
java
public static void subtract(double[] array1, double[] array2) { assert (array1.length == array2.length); for (int i=0; i<array1.length; i++) { array1[i] -= array2[i]; } }
[ "public", "static", "void", "subtract", "(", "double", "[", "]", "array1", ",", "double", "[", "]", "array2", ")", "{", "assert", "(", "array1", ".", "length", "==", "array2", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "...
Each element of the second array is subtracted from each element of the first.
[ "Each", "element", "of", "the", "second", "array", "is", "subtracted", "from", "each", "element", "of", "the", "first", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/DoubleArrays.java#L390-L395
train
mgormley/prim
src/main/java/edu/jhu/prim/arrays/DoubleArrays.java
DoubleArrays.multiply
public static void multiply(double[] array1, double[] array2) { assert (array1.length == array2.length); for (int i=0; i<array1.length; i++) { array1[i] *= array2[i]; } }
java
public static void multiply(double[] array1, double[] array2) { assert (array1.length == array2.length); for (int i=0; i<array1.length; i++) { array1[i] *= array2[i]; } }
[ "public", "static", "void", "multiply", "(", "double", "[", "]", "array1", ",", "double", "[", "]", "array2", ")", "{", "assert", "(", "array1", ".", "length", "==", "array2", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "...
Each element of the second array is multiplied with each element of the first.
[ "Each", "element", "of", "the", "second", "array", "is", "multiplied", "with", "each", "element", "of", "the", "first", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/DoubleArrays.java#L398-L403
train
mgormley/prim
src/main/java/edu/jhu/prim/arrays/DoubleArrays.java
DoubleArrays.divide
public static void divide(double[] array1, double[] array2) { assert (array1.length == array2.length); for (int i=0; i<array1.length; i++) { array1[i] /= array2[i]; } }
java
public static void divide(double[] array1, double[] array2) { assert (array1.length == array2.length); for (int i=0; i<array1.length; i++) { array1[i] /= array2[i]; } }
[ "public", "static", "void", "divide", "(", "double", "[", "]", "array1", ",", "double", "[", "]", "array2", ")", "{", "assert", "(", "array1", ".", "length", "==", "array2", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<"...
Each element of the first array is divided by each element of the second.
[ "Each", "element", "of", "the", "first", "array", "is", "divided", "by", "each", "element", "of", "the", "second", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/DoubleArrays.java#L406-L411
train
mgormley/prim
src/main/java/edu/jhu/prim/arrays/DoubleArrays.java
DoubleArrays.indexOf
public static int indexOf(double[] array, double val) { for (int i=0; i<array.length; i++) { if (array[i] == val) { return i; } } return -1; }
java
public static int indexOf(double[] array, double val) { for (int i=0; i<array.length; i++) { if (array[i] == val) { return i; } } return -1; }
[ "public", "static", "int", "indexOf", "(", "double", "[", "]", "array", ",", "double", "val", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "if", "(", "array", "[", "i", "]", "=="...
Gets the first index of a given value in an array or -1 if not present.
[ "Gets", "the", "first", "index", "of", "a", "given", "value", "in", "an", "array", "or", "-", "1", "if", "not", "present", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/DoubleArrays.java#L514-L521
train
mgormley/prim
src/main/java/edu/jhu/prim/arrays/DoubleArrays.java
DoubleArrays.lastIndexOf
public static int lastIndexOf(double[] array, double val) { for (int i=array.length-1; i >= 0; i--) { if (array[i] == val) { return i; } } return -1; }
java
public static int lastIndexOf(double[] array, double val) { for (int i=array.length-1; i >= 0; i--) { if (array[i] == val) { return i; } } return -1; }
[ "public", "static", "int", "lastIndexOf", "(", "double", "[", "]", "array", ",", "double", "val", ")", "{", "for", "(", "int", "i", "=", "array", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "array", "[", ...
Gets the last index of a given value in an array or -1 if not present.
[ "Gets", "the", "last", "index", "of", "a", "given", "value", "in", "an", "array", "or", "-", "1", "if", "not", "present", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/DoubleArrays.java#L524-L531
train
avarabyeu/jashing
jashing/src/main/java/com/github/avarabyeu/jashing/utils/GuiceUtils.java
GuiceUtils.getPropertyProvider
public static Provider<String> getPropertyProvider(Binder binder, String propertyName) { return binder.getProvider(getPropertyKey(propertyName)); }
java
public static Provider<String> getPropertyProvider(Binder binder, String propertyName) { return binder.getProvider(getPropertyKey(propertyName)); }
[ "public", "static", "Provider", "<", "String", ">", "getPropertyProvider", "(", "Binder", "binder", ",", "String", "propertyName", ")", "{", "return", "binder", ".", "getProvider", "(", "getPropertyKey", "(", "propertyName", ")", ")", ";", "}" ]
Obtains property provider @param binder Guice's binder @param propertyName Name of Property @return Property Provider
[ "Obtains", "property", "provider" ]
fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8
https://github.com/avarabyeu/jashing/blob/fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8/jashing/src/main/java/com/github/avarabyeu/jashing/utils/GuiceUtils.java#L36-L38
train
avarabyeu/jashing
jashing/src/main/java/com/github/avarabyeu/jashing/utils/GuiceUtils.java
GuiceUtils.bindDefault
public static Provider<String> bindDefault(Binder binder, String propertyName, String defaultValue) { Key<String> propertyKey = getPropertyKey(propertyName); OptionalBinder<String> optionalBinder = OptionalBinder. newOptionalBinder(binder, propertyKey); optionalBinder.setDefault().toInstance(defaultValue); return binder.getProvider(propertyKey); }
java
public static Provider<String> bindDefault(Binder binder, String propertyName, String defaultValue) { Key<String> propertyKey = getPropertyKey(propertyName); OptionalBinder<String> optionalBinder = OptionalBinder. newOptionalBinder(binder, propertyKey); optionalBinder.setDefault().toInstance(defaultValue); return binder.getProvider(propertyKey); }
[ "public", "static", "Provider", "<", "String", ">", "bindDefault", "(", "Binder", "binder", ",", "String", "propertyName", ",", "String", "defaultValue", ")", "{", "Key", "<", "String", ">", "propertyKey", "=", "getPropertyKey", "(", "propertyName", ")", ";", ...
Binds default value to specified property @param binder Guice's Binder @param propertyName Name of property @param defaultValue Default value @return Provider to new bound value
[ "Binds", "default", "value", "to", "specified", "property" ]
fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8
https://github.com/avarabyeu/jashing/blob/fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8/jashing/src/main/java/com/github/avarabyeu/jashing/utils/GuiceUtils.java#L48-L54
train
wcm-io-caravan/caravan-commons
stream/src/main/java/io/wcm/caravan/commons/stream/Collectors.java
Collectors.toList
public static <T> Collector<T, List<T>> toList() { return new Collector<T, List<T>>() { @Override public List<T> collect(Stream<? extends T> stream) { return Lists.newArrayList(stream.iterator()); } }; }
java
public static <T> Collector<T, List<T>> toList() { return new Collector<T, List<T>>() { @Override public List<T> collect(Stream<? extends T> stream) { return Lists.newArrayList(stream.iterator()); } }; }
[ "public", "static", "<", "T", ">", "Collector", "<", "T", ",", "List", "<", "T", ">", ">", "toList", "(", ")", "{", "return", "new", "Collector", "<", "T", ",", "List", "<", "T", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", ...
Collect to array list. @param <T> Streaming type @return Array list
[ "Collect", "to", "array", "list", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/stream/src/main/java/io/wcm/caravan/commons/stream/Collectors.java#L47-L54
train
wcm-io-caravan/caravan-commons
stream/src/main/java/io/wcm/caravan/commons/stream/Collectors.java
Collectors.toSet
public static <T> Collector<T, Set<T>> toSet() { return new Collector<T, Set<T>>() { @Override public Set<T> collect(Stream<? extends T> stream) { return Sets.newHashSet(stream.iterator()); } }; }
java
public static <T> Collector<T, Set<T>> toSet() { return new Collector<T, Set<T>>() { @Override public Set<T> collect(Stream<? extends T> stream) { return Sets.newHashSet(stream.iterator()); } }; }
[ "public", "static", "<", "T", ">", "Collector", "<", "T", ",", "Set", "<", "T", ">", ">", "toSet", "(", ")", "{", "return", "new", "Collector", "<", "T", ",", "Set", "<", "T", ">", ">", "(", ")", "{", "@", "Override", "public", "Set", "<", "T...
Collect to hash set @param <T> Streaming type @return Hash set
[ "Collect", "to", "hash", "set" ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/stream/src/main/java/io/wcm/caravan/commons/stream/Collectors.java#L61-L68
train
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/ViewTransform.java
ViewTransform.transform
@Override public void transform(InputStream inputStream, OutputStream outputStream) throws Exception { try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, CS_WIN1252))) { String line; String closingTag = null; Stack<String> stack = new Stack<>(); String id = null; String url = null; String label = null; while ((line = reader.readLine()) != null) { line = line.trim(); int i = line.indexOf('>', 1); int j = line.indexOf(' ', 1); int end = i == -1 ? j : j == -1 ? i : i < j ? i : j; int token = ArrayUtils.indexOf(TOKENS, end < 1 ? "" : line.substring(1, end).toLowerCase()); if (stack.isEmpty() && token != 0) { continue; } switch (token) { case 0: // <ul> if (closingTag != null) { write(outputStream, ">", true, 0); closingTag = "</topic>"; } stack.push(closingTag); closingTag = null; break; case 1: // </ul> write(outputStream, closingTag, true, 0); closingTag = stack.pop(); writeClosingTag(outputStream, closingTag, stack.size()); closingTag = null; break; case 2: // <li> writeClosingTag(outputStream, closingTag, 0); write(outputStream, "<topic", false, stack.size()); closingTag = " />"; break; case 3: // <param> String name = extractAttribute("name", line); String value = extractAttribute("value", line); if ("name".equalsIgnoreCase(name)) { if (label == null) { label = value; } else { id = value; } } else if ("local".equalsIgnoreCase(name)) { url = value; } break; case 4: // </object> writeAttribute(outputStream, "id", id); writeAttribute(outputStream, "label", label); writeAttribute(outputStream, "url", url); id = label = url = null; break; } } } }
java
@Override public void transform(InputStream inputStream, OutputStream outputStream) throws Exception { try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, CS_WIN1252))) { String line; String closingTag = null; Stack<String> stack = new Stack<>(); String id = null; String url = null; String label = null; while ((line = reader.readLine()) != null) { line = line.trim(); int i = line.indexOf('>', 1); int j = line.indexOf(' ', 1); int end = i == -1 ? j : j == -1 ? i : i < j ? i : j; int token = ArrayUtils.indexOf(TOKENS, end < 1 ? "" : line.substring(1, end).toLowerCase()); if (stack.isEmpty() && token != 0) { continue; } switch (token) { case 0: // <ul> if (closingTag != null) { write(outputStream, ">", true, 0); closingTag = "</topic>"; } stack.push(closingTag); closingTag = null; break; case 1: // </ul> write(outputStream, closingTag, true, 0); closingTag = stack.pop(); writeClosingTag(outputStream, closingTag, stack.size()); closingTag = null; break; case 2: // <li> writeClosingTag(outputStream, closingTag, 0); write(outputStream, "<topic", false, stack.size()); closingTag = " />"; break; case 3: // <param> String name = extractAttribute("name", line); String value = extractAttribute("value", line); if ("name".equalsIgnoreCase(name)) { if (label == null) { label = value; } else { id = value; } } else if ("local".equalsIgnoreCase(name)) { url = value; } break; case 4: // </object> writeAttribute(outputStream, "id", id); writeAttribute(outputStream, "label", label); writeAttribute(outputStream, "url", url); id = label = url = null; break; } } } }
[ "@", "Override", "public", "void", "transform", "(", "InputStream", "inputStream", ",", "OutputStream", "outputStream", ")", "throws", "Exception", "{", "try", "(", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "in...
Transforms the input to well-formed XML.
[ "Transforms", "the", "input", "to", "well", "-", "formed", "XML", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/ViewTransform.java#L53-L122
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/ScopeContainer.java
ScopeContainer.registerDestructionCallback
@Override public void registerDestructionCallback(String name, Runnable callback) { synchronized (this) { destructionCallbacks.put(name, callback); } }
java
@Override public void registerDestructionCallback(String name, Runnable callback) { synchronized (this) { destructionCallbacks.put(name, callback); } }
[ "@", "Override", "public", "void", "registerDestructionCallback", "(", "String", "name", ",", "Runnable", "callback", ")", "{", "synchronized", "(", "this", ")", "{", "destructionCallbacks", ".", "put", "(", "name", ",", "callback", ")", ";", "}", "}" ]
Register a bean destruction callback. @param name Bean name. @param callback Callback.
[ "Register", "a", "bean", "destruction", "callback", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/ScopeContainer.java#L79-L84
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/ScopeContainer.java
ScopeContainer.destroy
public void destroy() { for (Entry<String, Runnable> entry : destructionCallbacks.entrySet()) { try { entry.getValue().run(); } catch (Throwable t) { log.error("Error during destruction callback for bean " + entry.getKey(), t); } } beans.clear(); destructionCallbacks.clear(); }
java
public void destroy() { for (Entry<String, Runnable> entry : destructionCallbacks.entrySet()) { try { entry.getValue().run(); } catch (Throwable t) { log.error("Error during destruction callback for bean " + entry.getKey(), t); } } beans.clear(); destructionCallbacks.clear(); }
[ "public", "void", "destroy", "(", ")", "{", "for", "(", "Entry", "<", "String", ",", "Runnable", ">", "entry", ":", "destructionCallbacks", ".", "entrySet", "(", ")", ")", "{", "try", "{", "entry", ".", "getValue", "(", ")", ".", "run", "(", ")", "...
Calls all registered destruction callbacks and removes all bean references from the container.
[ "Calls", "all", "registered", "destruction", "callbacks", "and", "removes", "all", "bean", "references", "from", "the", "container", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/ScopeContainer.java#L99-L110
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/LabelPropertySource.java
LabelPropertySource.getProperty
@Override public String getProperty(String name) { return name.startsWith(LABEL_PREFIX) ? StrUtil.getLabel(name.substring(LABEL_PREFIX.length())) : null; }
java
@Override public String getProperty(String name) { return name.startsWith(LABEL_PREFIX) ? StrUtil.getLabel(name.substring(LABEL_PREFIX.length())) : null; }
[ "@", "Override", "public", "String", "getProperty", "(", "String", "name", ")", "{", "return", "name", ".", "startsWith", "(", "LABEL_PREFIX", ")", "?", "StrUtil", ".", "getLabel", "(", "name", ".", "substring", "(", "LABEL_PREFIX", ".", "length", "(", ")"...
Label names must be prefixed with "@msg." to be recognized as such.
[ "Label", "names", "must", "be", "prefixed", "with" ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/LabelPropertySource.java#L45-L48
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRPerformanceSiteV1_0Generator.java
RRPerformanceSiteV1_0Generator.setAddress
private void setAddress(Address address, RolodexContract rolodex) { if (rolodex != null) { address.setStreet1(rolodex.getAddressLine1()); address.setStreet2(rolodex.getAddressLine2()); address.setCity(checkNull(rolodex.getCity())); address.setCounty(rolodex.getCounty()); address.setState(rolodex.getState()); address.setZipCode(rolodex.getPostalCode()); if (rolodex.getCountryCode() != null) { CountryCodeType.Enum country = CountryCodeType.Enum.forString(rolodex.getCountryCode()); address.setCountry(country); } }else { address.setStreet1(""); address.setCity(""); } }
java
private void setAddress(Address address, RolodexContract rolodex) { if (rolodex != null) { address.setStreet1(rolodex.getAddressLine1()); address.setStreet2(rolodex.getAddressLine2()); address.setCity(checkNull(rolodex.getCity())); address.setCounty(rolodex.getCounty()); address.setState(rolodex.getState()); address.setZipCode(rolodex.getPostalCode()); if (rolodex.getCountryCode() != null) { CountryCodeType.Enum country = CountryCodeType.Enum.forString(rolodex.getCountryCode()); address.setCountry(country); } }else { address.setStreet1(""); address.setCity(""); } }
[ "private", "void", "setAddress", "(", "Address", "address", ",", "RolodexContract", "rolodex", ")", "{", "if", "(", "rolodex", "!=", "null", ")", "{", "address", ".", "setStreet1", "(", "rolodex", ".", "getAddressLine1", "(", ")", ")", ";", "address", ".",...
This method is to set the rolodex details to AddressType
[ "This", "method", "is", "to", "set", "the", "rolodex", "details", "to", "AddressType" ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRPerformanceSiteV1_0Generator.java#L121-L137
train
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/ChmSource.java
ChmSource.buildEntryList
private Set<ChmEntry> buildEntryList() throws TikaException { Set<ChmEntry> entries = new TreeSet<>(); for (DirectoryListingEntry entry : chmExtractor.getChmDirList().getDirectoryListingEntryList()) { String name = entry.getName(); if (name.startsWith("/") && !name.equals("/") && !name.startsWith("/$")) { entries.add(new ChmEntry(entry)); } } return entries; }
java
private Set<ChmEntry> buildEntryList() throws TikaException { Set<ChmEntry> entries = new TreeSet<>(); for (DirectoryListingEntry entry : chmExtractor.getChmDirList().getDirectoryListingEntryList()) { String name = entry.getName(); if (name.startsWith("/") && !name.equals("/") && !name.startsWith("/$")) { entries.add(new ChmEntry(entry)); } } return entries; }
[ "private", "Set", "<", "ChmEntry", ">", "buildEntryList", "(", ")", "throws", "TikaException", "{", "Set", "<", "ChmEntry", ">", "entries", "=", "new", "TreeSet", "<>", "(", ")", ";", "for", "(", "DirectoryListingEntry", "entry", ":", "chmExtractor", ".", ...
Builds the list of archive file entries. @return The list of all archive file entries. @throws TikaException Unspecified exception.
[ "Builds", "the", "list", "of", "archive", "file", "entries", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/ChmSource.java#L158-L170
train
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/ChmSource.java
ChmSource.findEntry
private ChmEntry findEntry(String file) { for (ChmEntry entry : entries) { if (file.equals(entry.getSourcePath())) { return entry; } } return null; }
java
private ChmEntry findEntry(String file) { for (ChmEntry entry : entries) { if (file.equals(entry.getSourcePath())) { return entry; } } return null; }
[ "private", "ChmEntry", "findEntry", "(", "String", "file", ")", "{", "for", "(", "ChmEntry", "entry", ":", "entries", ")", "{", "if", "(", "file", ".", "equals", "(", "entry", ".", "getSourcePath", "(", ")", ")", ")", "{", "return", "entry", ";", "}"...
Returns the chm entry that references the specified file name. @param file A file name. @return The CHMEntry referencing the specified file, or null if not found.
[ "Returns", "the", "chm", "entry", "that", "references", "the", "specified", "file", "name", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/ChmSource.java#L178-L186
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorBase.java
PropertyEditorBase.hasChanged
public boolean hasChanged() { Object currentValue = getValue(); return value == null || currentValue == null ? value != currentValue : !value.equals(currentValue); }
java
public boolean hasChanged() { Object currentValue = getValue(); return value == null || currentValue == null ? value != currentValue : !value.equals(currentValue); }
[ "public", "boolean", "hasChanged", "(", ")", "{", "Object", "currentValue", "=", "getValue", "(", ")", ";", "return", "value", "==", "null", "||", "currentValue", "==", "null", "?", "value", "!=", "currentValue", ":", "!", "value", ".", "equals", "(", "c...
Returns true if the property value has been changed since the last commit. @return True if pending changes exist.
[ "Returns", "true", "if", "the", "property", "value", "has", "been", "changed", "since", "the", "last", "commit", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorBase.java#L107-L110
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorBase.java
PropertyEditorBase.init
protected void init(Object target, PropertyInfo propInfo, PropertyGrid propGrid) { this.target = target; this.propInfo = propInfo; this.propGrid = propGrid; this.index = propGrid.getEditorCount(); wireController(); }
java
protected void init(Object target, PropertyInfo propInfo, PropertyGrid propGrid) { this.target = target; this.propInfo = propInfo; this.propGrid = propGrid; this.index = propGrid.getEditorCount(); wireController(); }
[ "protected", "void", "init", "(", "Object", "target", ",", "PropertyInfo", "propInfo", ",", "PropertyGrid", "propGrid", ")", "{", "this", ".", "target", "=", "target", ";", "this", ".", "propInfo", "=", "propInfo", ";", "this", ".", "propGrid", "=", "propG...
Initializes the property editor. @param target The target object. @param propInfo The PropertyInfo instance reflecting the property being edited on the target. @param propGrid The property grid owning this property editor.
[ "Initializes", "the", "property", "editor", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorBase.java#L151-L157
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorBase.java
PropertyEditorBase.commit
public boolean commit() { try { setWrongValueMessage(null); propInfo.setPropertyValue(target, getValue()); updateValue(); return true; } catch (Exception e) { setWrongValueException(e); return false; } }
java
public boolean commit() { try { setWrongValueMessage(null); propInfo.setPropertyValue(target, getValue()); updateValue(); return true; } catch (Exception e) { setWrongValueException(e); return false; } }
[ "public", "boolean", "commit", "(", ")", "{", "try", "{", "setWrongValueMessage", "(", "null", ")", ";", "propInfo", ".", "setPropertyValue", "(", "target", ",", "getValue", "(", ")", ")", ";", "updateValue", "(", ")", ";", "return", "true", ";", "}", ...
Commit the changed value. @return True if the operation was successful.
[ "Commit", "the", "changed", "value", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorBase.java#L164-L174
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorBase.java
PropertyEditorBase.revert
public boolean revert() { try { setWrongValueMessage(null); setValue(propInfo.getPropertyValue(target)); updateValue(); return true; } catch (Exception e) { setWrongValueException(e); return false; } }
java
public boolean revert() { try { setWrongValueMessage(null); setValue(propInfo.getPropertyValue(target)); updateValue(); return true; } catch (Exception e) { setWrongValueException(e); return false; } }
[ "public", "boolean", "revert", "(", ")", "{", "try", "{", "setWrongValueMessage", "(", "null", ")", ";", "setValue", "(", "propInfo", ".", "getPropertyValue", "(", "target", ")", ")", ";", "updateValue", "(", ")", ";", "return", "true", ";", "}", "catch"...
Revert changes to the property value. @return True if the operation was successful.
[ "Revert", "changes", "to", "the", "property", "value", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/PropertyEditorBase.java#L181-L191
train
tomdcc/sham
sham-core/src/main/java/org/shamdata/text/MarkovGenerator.java
MarkovGenerator.nextParagraphs
public List<String> nextParagraphs() { return nextParagraphs(Math.min(Math.max(4 + (int) (random.nextGaussian() * 3d), 1), 8)); }
java
public List<String> nextParagraphs() { return nextParagraphs(Math.min(Math.max(4 + (int) (random.nextGaussian() * 3d), 1), 8)); }
[ "public", "List", "<", "String", ">", "nextParagraphs", "(", ")", "{", "return", "nextParagraphs", "(", "Math", ".", "min", "(", "Math", ".", "max", "(", "4", "+", "(", "int", ")", "(", "random", ".", "nextGaussian", "(", ")", "*", "3d", ")", ",", ...
Returns a random list of paragraphs. The number of paragraphs will be between 1 and 8. @return a random list of paragraphs
[ "Returns", "a", "random", "list", "of", "paragraphs", ".", "The", "number", "of", "paragraphs", "will", "be", "between", "1", "and", "8", "." ]
33ede5e7130888736d6c84368e16a56e9e31e033
https://github.com/tomdcc/sham/blob/33ede5e7130888736d6c84368e16a56e9e31e033/sham-core/src/main/java/org/shamdata/text/MarkovGenerator.java#L86-L88
train
tomdcc/sham
sham-core/src/main/java/org/shamdata/text/MarkovGenerator.java
MarkovGenerator.nextParagraphs
public List<String> nextParagraphs(int num) { List<String> paragraphs = new ArrayList<String>(num); for(int i = 0; i < num; i++) { paragraphs.add(nextParagraph()); } return paragraphs; }
java
public List<String> nextParagraphs(int num) { List<String> paragraphs = new ArrayList<String>(num); for(int i = 0; i < num; i++) { paragraphs.add(nextParagraph()); } return paragraphs; }
[ "public", "List", "<", "String", ">", "nextParagraphs", "(", "int", "num", ")", "{", "List", "<", "String", ">", "paragraphs", "=", "new", "ArrayList", "<", "String", ">", "(", "num", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nu...
Returns the given number of randomly generated paragraphs. @param num the number of paragraphs to generate @return a list of randomly generated paragraphs, of the requested size
[ "Returns", "the", "given", "number", "of", "randomly", "generated", "paragraphs", "." ]
33ede5e7130888736d6c84368e16a56e9e31e033
https://github.com/tomdcc/sham/blob/33ede5e7130888736d6c84368e16a56e9e31e033/sham-core/src/main/java/org/shamdata/text/MarkovGenerator.java#L96-L102
train
tomdcc/sham
sham-core/src/main/java/org/shamdata/text/MarkovGenerator.java
MarkovGenerator.nextParagraph
public String nextParagraph(int totalSentences) { StringBuilder out = new StringBuilder(); List<String> lastWords = new ArrayList<String>(); lastWords.add(null); lastWords.add(null); int numSentences = 0; boolean inSentence = false; boolean inQuote = false; while(numSentences < totalSentences) { List<String> words = pairTable.get(lastWords); if(words == null) { // no hit for the digram, try just the last word words = singleWordTable.get(lastWords.get(1)); } if(words == null) { // hit end of paragraph pair, nothing directly following. start again words = pairTable.get(Arrays.<String>asList(null, null)); } String nextWord = words.get(random.nextInt(words.size())); if(nextWord.length() == 1 && sentenceEndChars.indexOf(nextWord.charAt(0)) != -1) { out.append(nextWord); if(inQuote) { out.append('"'); } numSentences++; inSentence = false; inQuote = false; lastWords.remove(0); lastWords.add(null); // look up } else { if(!inSentence) { // start a new sentence if(out.length() > 0) { out.append(" "); } inSentence = true; } else { // need a word separator out.append(" "); } out.append(nextWord); if(nextWord.indexOf('"') != -1) { inQuote = true; } } lastWords.remove(0); lastWords.add(nextWord); } return out.toString(); }
java
public String nextParagraph(int totalSentences) { StringBuilder out = new StringBuilder(); List<String> lastWords = new ArrayList<String>(); lastWords.add(null); lastWords.add(null); int numSentences = 0; boolean inSentence = false; boolean inQuote = false; while(numSentences < totalSentences) { List<String> words = pairTable.get(lastWords); if(words == null) { // no hit for the digram, try just the last word words = singleWordTable.get(lastWords.get(1)); } if(words == null) { // hit end of paragraph pair, nothing directly following. start again words = pairTable.get(Arrays.<String>asList(null, null)); } String nextWord = words.get(random.nextInt(words.size())); if(nextWord.length() == 1 && sentenceEndChars.indexOf(nextWord.charAt(0)) != -1) { out.append(nextWord); if(inQuote) { out.append('"'); } numSentences++; inSentence = false; inQuote = false; lastWords.remove(0); lastWords.add(null); // look up } else { if(!inSentence) { // start a new sentence if(out.length() > 0) { out.append(" "); } inSentence = true; } else { // need a word separator out.append(" "); } out.append(nextWord); if(nextWord.indexOf('"') != -1) { inQuote = true; } } lastWords.remove(0); lastWords.add(nextWord); } return out.toString(); }
[ "public", "String", "nextParagraph", "(", "int", "totalSentences", ")", "{", "StringBuilder", "out", "=", "new", "StringBuilder", "(", ")", ";", "List", "<", "String", ">", "lastWords", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "lastWords...
Returns a paragraph of text with the given number of sentences. @param totalSentences the number of sentences to generate @return a paragraph with the requested number of sentences
[ "Returns", "a", "paragraph", "of", "text", "with", "the", "given", "number", "of", "sentences", "." ]
33ede5e7130888736d6c84368e16a56e9e31e033
https://github.com/tomdcc/sham/blob/33ede5e7130888736d6c84368e16a56e9e31e033/sham-core/src/main/java/org/shamdata/text/MarkovGenerator.java#L110-L161
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/CommonSF424BaseGenerator.java
CommonSF424BaseGenerator.getEOStateReview
public Map<String, String> getEOStateReview(ProposalDevelopmentDocumentContract pdDoc) { Map<String, String> stateReview = new HashMap<>(); List<? extends AnswerHeaderContract> answerHeaders = propDevQuestionAnswerService.getQuestionnaireAnswerHeaders(pdDoc.getDevelopmentProposal().getProposalNumber()); if (!answerHeaders.isEmpty()) { for (AnswerContract answers : answerHeaders.get(0).getAnswers()) { Integer questionSeqId = getQuestionAnswerService().findQuestionById(answers.getQuestionId()).getQuestionSeqId(); if (questionSeqId != null && questionSeqId.equals(PROPOSAL_YNQ_QUESTION_129)) { stateReview.putIfAbsent(YNQ_ANSWER, answers.getAnswer()); } if (questionSeqId != null && questionSeqId.equals(PROPOSAL_YNQ_QUESTION_130)) { stateReview.putIfAbsent(YNQ_REVIEW_DATE, answers.getAnswer()); } if (questionSeqId != null && questionSeqId.equals(PROPOSAL_YNQ_QUESTION_131)) { stateReview.putIfAbsent(YNQ_STATE_REVIEW_DATA, answers.getAnswer()); } } } // If question is not answered or question is inactive if (stateReview.size() == 0) { stateReview.put(YNQ_ANSWER, YNQ_NOT_REVIEWED); stateReview.put(YNQ_REVIEW_DATE, null); } return stateReview; }
java
public Map<String, String> getEOStateReview(ProposalDevelopmentDocumentContract pdDoc) { Map<String, String> stateReview = new HashMap<>(); List<? extends AnswerHeaderContract> answerHeaders = propDevQuestionAnswerService.getQuestionnaireAnswerHeaders(pdDoc.getDevelopmentProposal().getProposalNumber()); if (!answerHeaders.isEmpty()) { for (AnswerContract answers : answerHeaders.get(0).getAnswers()) { Integer questionSeqId = getQuestionAnswerService().findQuestionById(answers.getQuestionId()).getQuestionSeqId(); if (questionSeqId != null && questionSeqId.equals(PROPOSAL_YNQ_QUESTION_129)) { stateReview.putIfAbsent(YNQ_ANSWER, answers.getAnswer()); } if (questionSeqId != null && questionSeqId.equals(PROPOSAL_YNQ_QUESTION_130)) { stateReview.putIfAbsent(YNQ_REVIEW_DATE, answers.getAnswer()); } if (questionSeqId != null && questionSeqId.equals(PROPOSAL_YNQ_QUESTION_131)) { stateReview.putIfAbsent(YNQ_STATE_REVIEW_DATA, answers.getAnswer()); } } } // If question is not answered or question is inactive if (stateReview.size() == 0) { stateReview.put(YNQ_ANSWER, YNQ_NOT_REVIEWED); stateReview.put(YNQ_REVIEW_DATE, null); } return stateReview; }
[ "public", "Map", "<", "String", ",", "String", ">", "getEOStateReview", "(", "ProposalDevelopmentDocumentContract", "pdDoc", ")", "{", "Map", "<", "String", ",", "String", ">", "stateReview", "=", "new", "HashMap", "<>", "(", ")", ";", "List", "<", "?", "e...
This method returns a map containing the answers related to EOState REview for a given proposal @param pdDoc Proposal Development Document. @return Map&lt;String, String&gt; map containing the answers related to EOState Review for a given proposal.
[ "This", "method", "returns", "a", "map", "containing", "the", "answers", "related", "to", "EOState", "REview", "for", "a", "given", "proposal" ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/CommonSF424BaseGenerator.java#L81-L104
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/CommonSF424BaseGenerator.java
CommonSF424BaseGenerator.getDivisionName
public String getDivisionName(ProposalDevelopmentDocumentContract pdDoc) { String divisionName = null; if (pdDoc != null && pdDoc.getDevelopmentProposal().getOwnedByUnit() != null) { UnitContract ownedByUnit = pdDoc.getDevelopmentProposal().getOwnedByUnit(); // traverse through the parent units till the top level unit while (ownedByUnit.getParentUnit() != null) { ownedByUnit = ownedByUnit.getParentUnit(); } divisionName = ownedByUnit.getUnitName(); if (divisionName.length() > DIVISION_NAME_MAX_LENGTH) { divisionName = divisionName.substring(0, DIVISION_NAME_MAX_LENGTH); } } return divisionName; }
java
public String getDivisionName(ProposalDevelopmentDocumentContract pdDoc) { String divisionName = null; if (pdDoc != null && pdDoc.getDevelopmentProposal().getOwnedByUnit() != null) { UnitContract ownedByUnit = pdDoc.getDevelopmentProposal().getOwnedByUnit(); // traverse through the parent units till the top level unit while (ownedByUnit.getParentUnit() != null) { ownedByUnit = ownedByUnit.getParentUnit(); } divisionName = ownedByUnit.getUnitName(); if (divisionName.length() > DIVISION_NAME_MAX_LENGTH) { divisionName = divisionName.substring(0, DIVISION_NAME_MAX_LENGTH); } } return divisionName; }
[ "public", "String", "getDivisionName", "(", "ProposalDevelopmentDocumentContract", "pdDoc", ")", "{", "String", "divisionName", "=", "null", ";", "if", "(", "pdDoc", "!=", "null", "&&", "pdDoc", ".", "getDevelopmentProposal", "(", ")", ".", "getOwnedByUnit", "(", ...
This method is to get division name using the OwnedByUnit and traversing through the parent units till the top level @param pdDoc Proposal development document. @return divisionName based on the OwnedByUnit.
[ "This", "method", "is", "to", "get", "division", "name", "using", "the", "OwnedByUnit", "and", "traversing", "through", "the", "parent", "units", "till", "the", "top", "level" ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/CommonSF424BaseGenerator.java#L112-L126
train
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/processor/AbstractProcessor.java
AbstractProcessor.registerTransform
public void registerTransform(String pattern, AbstractTransform transform) { transforms.add(new Transform(new WildcardFileFilter(pattern.split("\\,")), transform)); }
java
public void registerTransform(String pattern, AbstractTransform transform) { transforms.add(new Transform(new WildcardFileFilter(pattern.split("\\,")), transform)); }
[ "public", "void", "registerTransform", "(", "String", "pattern", ",", "AbstractTransform", "transform", ")", "{", "transforms", ".", "add", "(", "new", "Transform", "(", "new", "WildcardFileFilter", "(", "pattern", ".", "split", "(", "\"\\\\,\"", ")", ")", ","...
Registers a file transform. @param pattern One or more file patterns separated by commas. @param transform The transform.
[ "Registers", "a", "file", "transform", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/processor/AbstractProcessor.java#L107-L109
train
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/processor/AbstractProcessor.java
AbstractProcessor.replaceURLs
public String replaceURLs(String line) { StringBuffer sb = new StringBuffer(); Matcher matcher = URL_PATTERN.matcher(line); String newPath = "web/" + getResourceBase() + "/"; while (matcher.find()) { char dlm = line.charAt(matcher.start() - 1); int i = line.indexOf(dlm, matcher.end()); String url = i > 0 ? line.substring(matcher.start(), i) : null; if (url == null || (!mojo.isExcluded(url) && getTransform(url) != null)) { matcher.appendReplacement(sb, newPath); } } matcher.appendTail(sb); return sb.toString(); }
java
public String replaceURLs(String line) { StringBuffer sb = new StringBuffer(); Matcher matcher = URL_PATTERN.matcher(line); String newPath = "web/" + getResourceBase() + "/"; while (matcher.find()) { char dlm = line.charAt(matcher.start() - 1); int i = line.indexOf(dlm, matcher.end()); String url = i > 0 ? line.substring(matcher.start(), i) : null; if (url == null || (!mojo.isExcluded(url) && getTransform(url) != null)) { matcher.appendReplacement(sb, newPath); } } matcher.appendTail(sb); return sb.toString(); }
[ "public", "String", "replaceURLs", "(", "String", "line", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "Matcher", "matcher", "=", "URL_PATTERN", ".", "matcher", "(", "line", ")", ";", "String", "newPath", "=", "\"web/\"", "+",...
Adjust any url references in the line to use new root path. @param line String to modify @return the modified string
[ "Adjust", "any", "url", "references", "in", "the", "line", "to", "use", "new", "root", "path", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/processor/AbstractProcessor.java#L117-L134
train
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/processor/AbstractProcessor.java
AbstractProcessor.transform
protected boolean transform(IResource resource) throws Exception { String name = StringUtils.trimToEmpty(resource.getSourcePath()); if (resource.isDirectory() || mojo.isExcluded(name)) { return false; } AbstractTransform transform = getTransform(name); String targetPath = transform == null ? null : transform.getTargetPath(resource); if (targetPath != null) { File out = mojo.newStagingFile(relocateResource(targetPath), resource.getTime()); try (OutputStream outputStream = new FileOutputStream(out);) { transform.transform(resource, outputStream); return true; } } return false; }
java
protected boolean transform(IResource resource) throws Exception { String name = StringUtils.trimToEmpty(resource.getSourcePath()); if (resource.isDirectory() || mojo.isExcluded(name)) { return false; } AbstractTransform transform = getTransform(name); String targetPath = transform == null ? null : transform.getTargetPath(resource); if (targetPath != null) { File out = mojo.newStagingFile(relocateResource(targetPath), resource.getTime()); try (OutputStream outputStream = new FileOutputStream(out);) { transform.transform(resource, outputStream); return true; } } return false; }
[ "protected", "boolean", "transform", "(", "IResource", "resource", ")", "throws", "Exception", "{", "String", "name", "=", "StringUtils", ".", "trimToEmpty", "(", "resource", ".", "getSourcePath", "(", ")", ")", ";", "if", "(", "resource", ".", "isDirectory", ...
Finds and executes the transform appropriate for the file resource. @param resource The file resource. @return True if a processor was found for the jar entry. @throws Exception Unspecified exception.
[ "Finds", "and", "executes", "the", "transform", "appropriate", "for", "the", "file", "resource", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/processor/AbstractProcessor.java#L143-L162
train
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/processor/AbstractProcessor.java
AbstractProcessor.getTransform
private AbstractTransform getTransform(String fileName) { File file = new File(fileName); for (Transform transform : transforms) { if (transform.filter.accept(file)) { return transform.transform; } } return null; }
java
private AbstractTransform getTransform(String fileName) { File file = new File(fileName); for (Transform transform : transforms) { if (transform.filter.accept(file)) { return transform.transform; } } return null; }
[ "private", "AbstractTransform", "getTransform", "(", "String", "fileName", ")", "{", "File", "file", "=", "new", "File", "(", "fileName", ")", ";", "for", "(", "Transform", "transform", ":", "transforms", ")", "{", "if", "(", "transform", ".", "filter", "....
Returns the transform for the file, or null if none registered. @param fileName The file name. @return The associated transform, or null if not found.
[ "Returns", "the", "transform", "for", "the", "file", "or", "null", "if", "none", "registered", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/processor/AbstractProcessor.java#L170-L180
train
avarabyeu/jashing
jashing/src/main/java/com/github/avarabyeu/jashing/utils/StringUtils.java
StringUtils.substringBefore
public static String substringBefore(final String str, final String separator) { if (Strings.isNullOrEmpty(str)) { return str; } final int pos = str.indexOf(separator); if (pos == -1) { return str; } return str.substring(0, pos); }
java
public static String substringBefore(final String str, final String separator) { if (Strings.isNullOrEmpty(str)) { return str; } final int pos = str.indexOf(separator); if (pos == -1) { return str; } return str.substring(0, pos); }
[ "public", "static", "String", "substringBefore", "(", "final", "String", "str", ",", "final", "String", "separator", ")", "{", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "str", ")", ")", "{", "return", "str", ";", "}", "final", "int", "pos", "=", ...
Returns substring before provided string @param str String to be truncated @param separator Separator @return Null of initial string is Null, empty if provided string is empty, otherwise substring before
[ "Returns", "substring", "before", "provided", "string" ]
fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8
https://github.com/avarabyeu/jashing/blob/fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8/jashing/src/main/java/com/github/avarabyeu/jashing/utils/StringUtils.java#L22-L31
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionRegistry.java
ActionRegistry.getRegisteredAction
public static IAction getRegisteredAction(String id) { IAction action = getRegistry(false).get(id); return action == null ? getRegistry(true).get(id) : action; }
java
public static IAction getRegisteredAction(String id) { IAction action = getRegistry(false).get(id); return action == null ? getRegistry(true).get(id) : action; }
[ "public", "static", "IAction", "getRegisteredAction", "(", "String", "id", ")", "{", "IAction", "action", "=", "getRegistry", "(", "false", ")", ".", "get", "(", "id", ")", ";", "return", "action", "==", "null", "?", "getRegistry", "(", "true", ")", ".",...
Attempt to locate in local registry first, then global. @param id The action id. @return The action entry (possibly null).
[ "Attempt", "to", "locate", "in", "local", "registry", "first", "then", "global", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionRegistry.java#L91-L94
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionRegistry.java
ActionRegistry.getRegisteredActions
public static Collection<IAction> getRegisteredActions(ActionScope scope) { Map<String, IAction> actions = new HashMap<>(); if (scope == ActionScope.BOTH || scope == ActionScope.GLOBAL) { actions.putAll(getRegistry(true).map); } if (scope == ActionScope.BOTH || scope == ActionScope.LOCAL) { actions.putAll(getRegistry(false).map); } return actions.values(); }
java
public static Collection<IAction> getRegisteredActions(ActionScope scope) { Map<String, IAction> actions = new HashMap<>(); if (scope == ActionScope.BOTH || scope == ActionScope.GLOBAL) { actions.putAll(getRegistry(true).map); } if (scope == ActionScope.BOTH || scope == ActionScope.LOCAL) { actions.putAll(getRegistry(false).map); } return actions.values(); }
[ "public", "static", "Collection", "<", "IAction", ">", "getRegisteredActions", "(", "ActionScope", "scope", ")", "{", "Map", "<", "String", ",", "IAction", ">", "actions", "=", "new", "HashMap", "<>", "(", ")", ";", "if", "(", "scope", "==", "ActionScope",...
Returns a collection of actions registered to the specified scope. @param scope Action scope from which to retrieve. @return Actions associated with specified scope.
[ "Returns", "a", "collection", "of", "actions", "registered", "to", "the", "specified", "scope", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionRegistry.java#L102-L114
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionRegistry.java
ActionRegistry.getRegistry
private static ActionRegistry getRegistry(boolean global) { if (global) { return instance; } Page page = ExecutionContext.getPage(); ActionRegistry registry = (ActionRegistry) page.getAttribute(ATTR_LOCAL_REGISTRY); if (registry == null) { page.setAttribute(ATTR_LOCAL_REGISTRY, registry = new ActionRegistry()); } return registry; }
java
private static ActionRegistry getRegistry(boolean global) { if (global) { return instance; } Page page = ExecutionContext.getPage(); ActionRegistry registry = (ActionRegistry) page.getAttribute(ATTR_LOCAL_REGISTRY); if (registry == null) { page.setAttribute(ATTR_LOCAL_REGISTRY, registry = new ActionRegistry()); } return registry; }
[ "private", "static", "ActionRegistry", "getRegistry", "(", "boolean", "global", ")", "{", "if", "(", "global", ")", "{", "return", "instance", ";", "}", "Page", "page", "=", "ExecutionContext", ".", "getPage", "(", ")", ";", "ActionRegistry", "registry", "="...
Returns a reference to the registry for global or local actions. @param global If true, return the global registry; if false, the local registry. @return An action registry.
[ "Returns", "a", "reference", "to", "the", "registry", "for", "global", "or", "local", "actions", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionRegistry.java#L122-L135
train
ologolo/streamline-engine
src/org/daisy/streamline/engine/Progress.java
Progress.updateProgress
ProgressEvent updateProgress(double val, long now) { if (val<0 || val>1) { throw new IllegalArgumentException("Value out of range [0, 1]: " + val); } if (val<=progress.getProgress()) { reset(start); } double pD = val - progress.getProgress(); long tD = now - tstamp; if (step > 0) { step = step * 0.3 + (tD / pD) * 0.7; } else { step = (tD / pD); } double etcMs = step * (1 - val); progress = new ProgressEvent(val, new Date(now + (long)Math.round(etcMs))); tstamp = now; return progress; }
java
ProgressEvent updateProgress(double val, long now) { if (val<0 || val>1) { throw new IllegalArgumentException("Value out of range [0, 1]: " + val); } if (val<=progress.getProgress()) { reset(start); } double pD = val - progress.getProgress(); long tD = now - tstamp; if (step > 0) { step = step * 0.3 + (tD / pD) * 0.7; } else { step = (tD / pD); } double etcMs = step * (1 - val); progress = new ProgressEvent(val, new Date(now + (long)Math.round(etcMs))); tstamp = now; return progress; }
[ "ProgressEvent", "updateProgress", "(", "double", "val", ",", "long", "now", ")", "{", "if", "(", "val", "<", "0", "||", "val", ">", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Value out of range [0, 1]: \"", "+", "val", ")", ";", "}...
allows setting the current time, for testing
[ "allows", "setting", "the", "current", "time", "for", "testing" ]
04b7adc85d84d91dc5f0eaaa401d2738f9401b17
https://github.com/ologolo/streamline-engine/blob/04b7adc85d84d91dc5f0eaaa401d2738f9401b17/src/org/daisy/streamline/engine/Progress.java#L66-L84
train
carewebframework/carewebframework-core
org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSService.java
JMSService.connect
private boolean connect() { if (this.factory == null) { return false; } if (isConnected()) { return true; } try { this.connection = this.factory.createConnection(); this.session = (TopicSession) this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE); this.connection.start(); return true; } catch (Exception e) { log.error("Error communicating with JMS server: " + e.getMessage()); disconnect(); return false; } }
java
private boolean connect() { if (this.factory == null) { return false; } if (isConnected()) { return true; } try { this.connection = this.factory.createConnection(); this.session = (TopicSession) this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE); this.connection.start(); return true; } catch (Exception e) { log.error("Error communicating with JMS server: " + e.getMessage()); disconnect(); return false; } }
[ "private", "boolean", "connect", "(", ")", "{", "if", "(", "this", ".", "factory", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "isConnected", "(", ")", ")", "{", "return", "true", ";", "}", "try", "{", "this", ".", "connection",...
Connect to the JMS server. @return True if successful.
[ "Connect", "to", "the", "JMS", "server", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSService.java#L91-L110
train
carewebframework/carewebframework-core
org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSService.java
JMSService.disconnect
private void disconnect() { if (this.session != null) { try { this.session.close(); } catch (Exception e) { log.error("Error closing JMS topic session.", e); } } if (this.connection != null) { try { this.connection.stop(); this.connection.close(); } catch (Exception e) { log.error("Error closing JMS topic connection.", e); } } this.session = null; this.connection = null; }
java
private void disconnect() { if (this.session != null) { try { this.session.close(); } catch (Exception e) { log.error("Error closing JMS topic session.", e); } } if (this.connection != null) { try { this.connection.stop(); this.connection.close(); } catch (Exception e) { log.error("Error closing JMS topic connection.", e); } } this.session = null; this.connection = null; }
[ "private", "void", "disconnect", "(", ")", "{", "if", "(", "this", ".", "session", "!=", "null", ")", "{", "try", "{", "this", ".", "session", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", ...
Disconnect from the JMS server.
[ "Disconnect", "from", "the", "JMS", "server", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSService.java#L115-L135
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java
ElementUI.getAssociatedElement
public static ElementUI getAssociatedElement(BaseComponent component) { return component == null ? null : (ElementUI) component.getAttribute(ASSOC_ELEMENT); }
java
public static ElementUI getAssociatedElement(BaseComponent component) { return component == null ? null : (ElementUI) component.getAttribute(ASSOC_ELEMENT); }
[ "public", "static", "ElementUI", "getAssociatedElement", "(", "BaseComponent", "component", ")", "{", "return", "component", "==", "null", "?", "null", ":", "(", "ElementUI", ")", "component", ".", "getAttribute", "(", "ASSOC_ELEMENT", ")", ";", "}" ]
Returns the UI element that registered the CWF component. @param component The CWF component of interest. @return The associated UI element.
[ "Returns", "the", "UI", "element", "that", "registered", "the", "CWF", "component", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java#L97-L99
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java
ElementUI.getDesignContextMenu
public static Menupopup getDesignContextMenu(BaseComponent component) { return component == null ? null : (Menupopup) component.getAttribute(CONTEXT_MENU); }
java
public static Menupopup getDesignContextMenu(BaseComponent component) { return component == null ? null : (Menupopup) component.getAttribute(CONTEXT_MENU); }
[ "public", "static", "Menupopup", "getDesignContextMenu", "(", "BaseComponent", "component", ")", "{", "return", "component", "==", "null", "?", "null", ":", "(", "Menupopup", ")", "component", ".", "getAttribute", "(", "CONTEXT_MENU", ")", ";", "}" ]
Returns the design context menu currently bound to the component. @param component The CWF component of interest. @return The associated design context menu, or null if none.
[ "Returns", "the", "design", "context", "menu", "currently", "bound", "to", "the", "component", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java#L107-L109
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java
ElementUI.getTemplateUrl
protected String getTemplateUrl() { return "web/" + getClass().getPackage().getName().replace(".", "/") + "/" + StringUtils.uncapitalize(getClass().getSimpleName()) + ".fsp"; }
java
protected String getTemplateUrl() { return "web/" + getClass().getPackage().getName().replace(".", "/") + "/" + StringUtils.uncapitalize(getClass().getSimpleName()) + ".fsp"; }
[ "protected", "String", "getTemplateUrl", "(", ")", "{", "return", "\"web/\"", "+", "getClass", "(", ")", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ".", "replace", "(", "\".\"", ",", "\"/\"", ")", "+", "\"/\"", "+", "StringUtils", ".", "unc...
Returns the URL of the default template to use in createFromTemplate. Override this method to provide an alternate default URL. @return The template URL.
[ "Returns", "the", "URL", "of", "the", "default", "template", "to", "use", "in", "createFromTemplate", ".", "Override", "this", "method", "to", "provide", "an", "alternate", "default", "URL", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java#L121-L124
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java
ElementUI.setDesignMode
@Override public void setDesignMode(boolean designMode) { super.setDesignMode(designMode); for (ElementTrigger trigger : triggers) { trigger.setDesignMode(designMode); } setDesignContextMenu(designMode ? DesignContextMenu.getInstance().getMenupopup() : null); mask.update(); }
java
@Override public void setDesignMode(boolean designMode) { super.setDesignMode(designMode); for (ElementTrigger trigger : triggers) { trigger.setDesignMode(designMode); } setDesignContextMenu(designMode ? DesignContextMenu.getInstance().getMenupopup() : null); mask.update(); }
[ "@", "Override", "public", "void", "setDesignMode", "(", "boolean", "designMode", ")", "{", "super", ".", "setDesignMode", "(", "designMode", ")", ";", "for", "(", "ElementTrigger", "trigger", ":", "triggers", ")", "{", "trigger", ".", "setDesignMode", "(", ...
Sets design mode status for this component and all its children and triggers. @param designMode The design mode flag.
[ "Sets", "design", "mode", "status", "for", "this", "component", "and", "all", "its", "children", "and", "triggers", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java#L195-L205
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java
ElementUI.afterParentChanged
@Override protected void afterParentChanged(ElementBase oldParent) { if (getParent() != null) { if (!getDefinition().isInternal()) { bind(); } setDesignMode(getParent().isDesignMode()); } }
java
@Override protected void afterParentChanged(ElementBase oldParent) { if (getParent() != null) { if (!getDefinition().isInternal()) { bind(); } setDesignMode(getParent().isDesignMode()); } }
[ "@", "Override", "protected", "void", "afterParentChanged", "(", "ElementBase", "oldParent", ")", "{", "if", "(", "getParent", "(", ")", "!=", "null", ")", "{", "if", "(", "!", "getDefinition", "(", ")", ".", "isInternal", "(", ")", ")", "{", "bind", "...
Called after the parent has been changed. @param oldParent The value of the parent property prior to the change.
[ "Called", "after", "the", "parent", "has", "been", "changed", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java#L284-L293
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java
ElementUI.getVisibleChild
private ElementUI getVisibleChild(boolean first) { int count = getChildCount(); int start = first ? 0 : count - 1; int inc = first ? 1 : -1; for (int i = start; i >= 0 && i < count; i += inc) { ElementUI child = (ElementUI) getChild(i); if (child.isVisible()) { return child; } } return null; }
java
private ElementUI getVisibleChild(boolean first) { int count = getChildCount(); int start = first ? 0 : count - 1; int inc = first ? 1 : -1; for (int i = start; i >= 0 && i < count; i += inc) { ElementUI child = (ElementUI) getChild(i); if (child.isVisible()) { return child; } } return null; }
[ "private", "ElementUI", "getVisibleChild", "(", "boolean", "first", ")", "{", "int", "count", "=", "getChildCount", "(", ")", ";", "int", "start", "=", "first", "?", "0", ":", "count", "-", "1", ";", "int", "inc", "=", "first", "?", "1", ":", "-", ...
Returns first or last visible child. @param first If true, find first visible child; if false, last visible child. @return Visible child, or null if none found.
[ "Returns", "first", "or", "last", "visible", "child", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java#L459-L473
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java
ElementUI.getNextSibling
public ElementUI getNextSibling(boolean visibleOnly) { ElementUI parent = getParent(); if (parent != null) { int count = parent.getChildCount(); for (int i = getIndex() + 1; i < count; i++) { ElementUI child = (ElementUI) parent.getChild(i); if (!visibleOnly || child.isVisible()) { return child; } } } return null; }
java
public ElementUI getNextSibling(boolean visibleOnly) { ElementUI parent = getParent(); if (parent != null) { int count = parent.getChildCount(); for (int i = getIndex() + 1; i < count; i++) { ElementUI child = (ElementUI) parent.getChild(i); if (!visibleOnly || child.isVisible()) { return child; } } } return null; }
[ "public", "ElementUI", "getNextSibling", "(", "boolean", "visibleOnly", ")", "{", "ElementUI", "parent", "=", "getParent", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "int", "count", "=", "parent", ".", "getChildCount", "(", ")", ";", "fo...
Returns this element's next sibling. @param visibleOnly If true, skip any non-visible siblings. @return The next sibling, or null if none.
[ "Returns", "this", "element", "s", "next", "sibling", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java#L481-L497
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java
ElementUI.afterMoveChild
@Override protected void afterMoveChild(ElementBase child, ElementBase before) { moveChild(((ElementUI) child).getOuterComponent(), ((ElementUI) before).getOuterComponent()); updateMasks(); }
java
@Override protected void afterMoveChild(ElementBase child, ElementBase before) { moveChild(((ElementUI) child).getOuterComponent(), ((ElementUI) before).getOuterComponent()); updateMasks(); }
[ "@", "Override", "protected", "void", "afterMoveChild", "(", "ElementBase", "child", ",", "ElementBase", "before", ")", "{", "moveChild", "(", "(", "(", "ElementUI", ")", "child", ")", ".", "getOuterComponent", "(", ")", ",", "(", "(", "ElementUI", ")", "b...
Element has been moved to a different position under this parent. Adjust wrapped components accordingly. @param child Child element that was moved. @param before Child element was moved before this one.
[ "Element", "has", "been", "moved", "to", "a", "different", "position", "under", "this", "parent", ".", "Adjust", "wrapped", "components", "accordingly", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java#L506-L510
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java
ElementUI.applyColor
protected void applyColor(BaseUIComponent comp) { if (comp instanceof BaseLabeledComponent) { comp.invoke(comp.sub("lbl"), "css", "color", getColor()); } else if (comp != null) { comp.addStyle("background-color", getColor()); } }
java
protected void applyColor(BaseUIComponent comp) { if (comp instanceof BaseLabeledComponent) { comp.invoke(comp.sub("lbl"), "css", "color", getColor()); } else if (comp != null) { comp.addStyle("background-color", getColor()); } }
[ "protected", "void", "applyColor", "(", "BaseUIComponent", "comp", ")", "{", "if", "(", "comp", "instanceof", "BaseLabeledComponent", ")", "{", "comp", ".", "invoke", "(", "comp", ".", "sub", "(", "\"lbl\"", ")", ",", "\"css\"", ",", "\"color\"", ",", "get...
Applies the current color setting to the target component. If the target implements a custom method for performing this operation, that method will be invoked. Otherwise, the background color of the target is set. Override this method to provide alternate implementations. @param comp Component to receive the color setting.
[ "Applies", "the", "current", "color", "setting", "to", "the", "target", "component", ".", "If", "the", "target", "implements", "a", "custom", "method", "for", "performing", "this", "operation", "that", "method", "will", "be", "invoked", ".", "Otherwise", "the"...
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java#L628-L634
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java
ElementUI.hasVisibleElements
protected boolean hasVisibleElements(BaseUIComponent component) { for (BaseUIComponent child : component.getChildren(BaseUIComponent.class)) { ElementUI ele = getAssociatedElement(child); if (ele != null && ele.isVisible()) { return true; } if (hasVisibleElements(child)) { return true; } } return false; }
java
protected boolean hasVisibleElements(BaseUIComponent component) { for (BaseUIComponent child : component.getChildren(BaseUIComponent.class)) { ElementUI ele = getAssociatedElement(child); if (ele != null && ele.isVisible()) { return true; } if (hasVisibleElements(child)) { return true; } } return false; }
[ "protected", "boolean", "hasVisibleElements", "(", "BaseUIComponent", "component", ")", "{", "for", "(", "BaseUIComponent", "child", ":", "component", ".", "getChildren", "(", "BaseUIComponent", ".", "class", ")", ")", "{", "ElementUI", "ele", "=", "getAssociatedE...
Returns true if any associated UI elements in the component subtree are visible. @param component Component subtree to examine. @return True if any associated UI element in the subtree is visible.
[ "Returns", "true", "if", "any", "associated", "UI", "elements", "in", "the", "component", "subtree", "are", "visible", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementUI.java#L737-L751
train
mgormley/prim
src/main/java_generated/edu/jhu/prim/list/ByteArrayList.java
ByteArrayList.set
public void set(int i, byte value) { if (i < 0 || i >= size) { throw new IndexOutOfBoundsException(); } elements[i] = value; }
java
public void set(int i, byte value) { if (i < 0 || i >= size) { throw new IndexOutOfBoundsException(); } elements[i] = value; }
[ "public", "void", "set", "(", "int", "i", ",", "byte", "value", ")", "{", "if", "(", "i", "<", "0", "||", "i", ">=", "size", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "elements", "[", "i", "]", "=", "value", ";", ...
Sets the i'th element of the array list to the given value. @param i The index to set. @param value The value to set.
[ "Sets", "the", "i", "th", "element", "of", "the", "array", "list", "to", "the", "given", "value", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/list/ByteArrayList.java#L69-L74
train
mgormley/prim
src/main/java_generated/edu/jhu/prim/list/ByteArrayList.java
ByteArrayList.add
public void add(byte[] values) { ensureCapacity(size + values.length); for (byte element : values) { this.add(element); } }
java
public void add(byte[] values) { ensureCapacity(size + values.length); for (byte element : values) { this.add(element); } }
[ "public", "void", "add", "(", "byte", "[", "]", "values", ")", "{", "ensureCapacity", "(", "size", "+", "values", ".", "length", ")", ";", "for", "(", "byte", "element", ":", "values", ")", "{", "this", ".", "add", "(", "element", ")", ";", "}", ...
Adds all the elements in the given array to the array list. @param values The values to add to the array list.
[ "Adds", "all", "the", "elements", "in", "the", "given", "array", "to", "the", "array", "list", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/list/ByteArrayList.java#L80-L85
train
mgormley/prim
src/main/java/edu/jhu/prim/arrays/Multinomials.java
Multinomials.normalizeProps
public static double normalizeProps(double[] props) { double propSum = DoubleArrays.sum(props); if (propSum == 0) { for (int d = 0; d < props.length; d++) { props[d] = 1.0 / (double)props.length; } } else if (propSum == Double.POSITIVE_INFINITY) { int count = DoubleArrays.count(props, Double.POSITIVE_INFINITY); if (count == 0) { throw new RuntimeException("Unable to normalize since sum is infinite but contains no infinities: " + Arrays.toString(props)); } double constant = 1.0 / (double) count; for (int d=0; d<props.length; d++) { if (props[d] == Double.POSITIVE_INFINITY) { props[d] = constant; } else { props[d] = 0.0; } } } else { for (int d = 0; d < props.length; d++) { props[d] /= propSum; assert(!Double.isNaN(props[d])); } } return propSum; }
java
public static double normalizeProps(double[] props) { double propSum = DoubleArrays.sum(props); if (propSum == 0) { for (int d = 0; d < props.length; d++) { props[d] = 1.0 / (double)props.length; } } else if (propSum == Double.POSITIVE_INFINITY) { int count = DoubleArrays.count(props, Double.POSITIVE_INFINITY); if (count == 0) { throw new RuntimeException("Unable to normalize since sum is infinite but contains no infinities: " + Arrays.toString(props)); } double constant = 1.0 / (double) count; for (int d=0; d<props.length; d++) { if (props[d] == Double.POSITIVE_INFINITY) { props[d] = constant; } else { props[d] = 0.0; } } } else { for (int d = 0; d < props.length; d++) { props[d] /= propSum; assert(!Double.isNaN(props[d])); } } return propSum; }
[ "public", "static", "double", "normalizeProps", "(", "double", "[", "]", "props", ")", "{", "double", "propSum", "=", "DoubleArrays", ".", "sum", "(", "props", ")", ";", "if", "(", "propSum", "==", "0", ")", "{", "for", "(", "int", "d", "=", "0", "...
Normalize the proportions and return their sum.
[ "Normalize", "the", "proportions", "and", "return", "their", "sum", "." ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/Multinomials.java#L30-L56
train