_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q300
DatatypeConverter.printCurrencySymbolPosition
train
public static final String printCurrencySymbolPosition(CurrencySymbolPosition value) { String result; switch (value) { default: case BEFORE: { result = "0"; break; } case AFTER: { result = "1"; b...
java
{ "resource": "" }
q301
DatatypeConverter.parseCurrencySymbolPosition
train
public static final CurrencySymbolPosition parseCurrencySymbolPosition(String value) { CurrencySymbolPosition result = CurrencySymbolPosition.BEFORE; switch (NumberHelper.getInt(value)) { case 0: { result = CurrencySymbolPosition.BEFORE; break; } ...
java
{ "resource": "" }
q302
DatatypeConverter.printAccrueType
train
public static final String printAccrueType(AccrueType value) { return (Integer.toString(value == null ? AccrueType.PRORATED.getValue() : value.getValue())); }
java
{ "resource": "" }
q303
DatatypeConverter.printResourceType
train
public static final String printResourceType(ResourceType value) { return (Integer.toString(value == null ? ResourceType.WORK.getValue() : value.getValue())); }
java
{ "resource": "" }
q304
DatatypeConverter.printWorkGroup
train
public static final String printWorkGroup(WorkGroup value) { return (Integer.toString(value == null ? WorkGroup.DEFAULT.getValue() : value.getValue())); }
java
{ "resource": "" }
q305
DatatypeConverter.printWorkContour
train
public static final String printWorkContour(WorkContour value) { return (Integer.toString(value == null ? WorkContour.FLAT.getValue() : value.getValue())); }
java
{ "resource": "" }
q306
DatatypeConverter.printBookingType
train
public static final String printBookingType(BookingType value) { return (Integer.toString(value == null ? BookingType.COMMITTED.getValue() : value.getValue())); }
java
{ "resource": "" }
q307
DatatypeConverter.printTaskType
train
public static final String printTaskType(TaskType value) { return (Integer.toString(value == null ? TaskType.FIXED_UNITS.getValue() : value.getValue())); }
java
{ "resource": "" }
q308
DatatypeConverter.printEarnedValueMethod
train
public static final BigInteger printEarnedValueMethod(EarnedValueMethod value) { return (value == null ? BigInteger.valueOf(EarnedValueMethod.PERCENT_COMPLETE.getValue()) : BigInteger.valueOf(value.getValue())); }
java
{ "resource": "" }
q309
DatatypeConverter.printUnits
train
public static final BigDecimal printUnits(Number value) { return (value == null ? BIGDECIMAL_ONE : new BigDecimal(value.doubleValue() / 100)); }
java
{ "resource": "" }
q310
DatatypeConverter.parseUnits
train
public static final Number parseUnits(Number value) { return (value == null ? null : NumberHelper.getDouble(value.doubleValue() * 100)); }
java
{ "resource": "" }
q311
DatatypeConverter.printTimeUnit
train
public static final BigInteger printTimeUnit(TimeUnit value) { return (BigInteger.valueOf(value == null ? TimeUnit.DAYS.getValue() + 1 : value.getValue() + 1)); }
java
{ "resource": "" }
q312
DatatypeConverter.parseWorkUnits
train
public static final TimeUnit parseWorkUnits(BigInteger value) { TimeUnit result = TimeUnit.HOURS; if (value != null) { switch (value.intValue()) { case 1: { result = TimeUnit.MINUTES; break; } case 3: ...
java
{ "resource": "" }
q313
DatatypeConverter.printWorkUnits
train
public static final BigInteger printWorkUnits(TimeUnit value) { int result; if (value == null) { value = TimeUnit.HOURS; } switch (value) { case MINUTES: { result = 1; break; } case DAYS: { ...
java
{ "resource": "" }
q314
DatatypeConverter.parseCurrency
train
public static final Double parseCurrency(Number value) { return (value == null ? null : NumberHelper.getDouble(value.doubleValue() / 100)); }
java
{ "resource": "" }
q315
DatatypeConverter.printCurrency
train
public static final BigDecimal printCurrency(Number value) { return (value == null || value.doubleValue() == 0 ? null : new BigDecimal(value.doubleValue() * 100)); }
java
{ "resource": "" }
q316
DatatypeConverter.parseDurationTimeUnits
train
public static final TimeUnit parseDurationTimeUnits(BigInteger value, TimeUnit defaultValue) { TimeUnit result = defaultValue; if (value != null) { switch (value.intValue()) { case 3: case 35: { result = TimeUnit.MINUTES; ...
java
{ "resource": "" }
q317
DatatypeConverter.parsePriority
train
public static final Priority parsePriority(BigInteger priority) { return (priority == null ? null : Priority.getInstance(priority.intValue())); }
java
{ "resource": "" }
q318
DatatypeConverter.printPriority
train
public static final BigInteger printPriority(Priority priority) { int result = Priority.MEDIUM; if (priority != null) { result = priority.getValue(); } return (BigInteger.valueOf(result)); }
java
{ "resource": "" }
q319
DatatypeConverter.parseDurationInThousanthsOfMinutes
train
public static final Duration parseDurationInThousanthsOfMinutes(ProjectProperties properties, Number value, TimeUnit targetTimeUnit) { return parseDurationInFractionsOfMinutes(properties, value, targetTimeUnit, 1000); }
java
{ "resource": "" }
q320
DatatypeConverter.printDurationInDecimalThousandthsOfMinutes
train
public static final BigDecimal printDurationInDecimalThousandthsOfMinutes(Duration duration) { BigDecimal result = null; if (duration != null && duration.getDuration() != 0) { result = BigDecimal.valueOf(printDurationFractionsOfMinutes(duration, 1000)); } return result; }
java
{ "resource": "" }
q321
DatatypeConverter.printDurationInIntegerTenthsOfMinutes
train
public static final BigInteger printDurationInIntegerTenthsOfMinutes(Duration duration) { BigInteger result = null; if (duration != null && duration.getDuration() != 0) { result = BigInteger.valueOf((long) printDurationFractionsOfMinutes(duration, 10)); } return result; }
java
{ "resource": "" }
q322
DatatypeConverter.parseUUID
train
public static final UUID parseUUID(String value) { return value == null || value.isEmpty() ? null : UUID.fromString(value); }
java
{ "resource": "" }
q323
DatatypeConverter.parseDurationInFractionsOfMinutes
train
private static final Duration parseDurationInFractionsOfMinutes(ProjectProperties properties, Number value, TimeUnit targetTimeUnit, int factor) { Duration result = null; if (value != null) { result = Duration.getInstance(value.intValue() / factor, TimeUnit.MINUTES); if (targetTi...
java
{ "resource": "" }
q324
DatatypeConverter.printDurationFractionsOfMinutes
train
private static final double printDurationFractionsOfMinutes(Duration duration, int factor) { double result = 0; if (duration != null) { result = duration.getDuration(); switch (duration.getUnits()) { case HOURS: case ELAPSED_HOURS: { ...
java
{ "resource": "" }
q325
DatatypeConverter.printRate
train
public static final BigDecimal printRate(Rate rate) { BigDecimal result = null; if (rate != null && rate.getAmount() != 0) { result = new BigDecimal(rate.getAmount()); } return result; }
java
{ "resource": "" }
q326
DatatypeConverter.parseRate
train
public static final Rate parseRate(BigDecimal value) { Rate result = null; if (value != null) { result = new Rate(value, TimeUnit.HOURS); } return (result); }
java
{ "resource": "" }
q327
DatatypeConverter.printDay
train
public static final BigInteger printDay(Day day) { return (day == null ? null : BigInteger.valueOf(day.getValue() - 1)); }
java
{ "resource": "" }
q328
DatatypeConverter.printConstraintType
train
public static final BigInteger printConstraintType(ConstraintType value) { return (value == null ? null : BigInteger.valueOf(value.getValue())); }
java
{ "resource": "" }
q329
DatatypeConverter.printTaskUID
train
public static final String printTaskUID(Integer value) { ProjectFile file = PARENT_FILE.get(); if (file != null) { file.getEventManager().fireTaskWrittenEvent(file.getTaskByUniqueID(value)); } return (value.toString()); }
java
{ "resource": "" }
q330
DatatypeConverter.printResourceUID
train
public static final String printResourceUID(Integer value) { ProjectFile file = PARENT_FILE.get(); if (file != null) { file.getEventManager().fireResourceWrittenEvent(file.getResourceByUniqueID(value)); } return (value.toString()); }
java
{ "resource": "" }
q331
DatatypeConverter.parseBoolean
train
public static final Boolean parseBoolean(String value) { return (value == null || value.charAt(0) != '1' ? Boolean.FALSE : Boolean.TRUE); }
java
{ "resource": "" }
q332
DatatypeConverter.printDateTime
train
public static final String printDateTime(Date value) { return (value == null ? null : DATE_FORMAT.get().format(value)); }
java
{ "resource": "" }
q333
DatatypeConverter.correctNumberFormat
train
private static final String correctNumberFormat(String value) { String result; int index = value.indexOf(','); if (index == -1) { result = value; } else { char[] chars = value.toCharArray(); chars[index] = '.'; result = new String(chars); ...
java
{ "resource": "" }
q334
P3DatabaseReader.setProjectNameAndRead
train
public static final ProjectFile setProjectNameAndRead(File directory) throws MPXJException { List<String> projects = listProjectNames(directory); if (!projects.isEmpty()) { P3DatabaseReader reader = new P3DatabaseReader(); reader.setProjectName(projects.get(0)); return r...
java
{ "resource": "" }
q335
P3DatabaseReader.listProjectNames
train
public static final List<String> listProjectNames(File directory) { List<String> result = new ArrayList<String>(); File[] files = directory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toUpperCase().endsWith("ST...
java
{ "resource": "" }
q336
P3DatabaseReader.readProjectHeader
train
private void readProjectHeader() { Table table = m_tables.get("DIR"); MapRow row = table.find(""); if (row != null) { setFields(PROJECT_FIELDS, row, m_projectFile.getProjectProperties()); m_wbsFormat = new P3WbsFormat(row); } }
java
{ "resource": "" }
q337
P3DatabaseReader.readWBS
train
private void readWBS() { Map<Integer, List<MapRow>> levelMap = new HashMap<Integer, List<MapRow>>(); for (MapRow row : m_tables.get("STR")) { Integer level = row.getInteger("LEVEL_NUMBER"); List<MapRow> items = levelMap.get(level); if (items == null) { ...
java
{ "resource": "" }
q338
P3DatabaseReader.readRelationships
train
private void readRelationships() { for (MapRow row : m_tables.get("REL")) { Task predecessor = m_activityMap.get(row.getString("PREDECESSOR_ACTIVITY_ID")); Task successor = m_activityMap.get(row.getString("SUCCESSOR_ACTIVITY_ID")); if (predecessor != null && successor != null) ...
java
{ "resource": "" }
q339
P3DatabaseReader.setFields
train
private void setFields(Map<String, FieldType> map, MapRow row, FieldContainer container) { if (row != null) { for (Map.Entry<String, FieldType> entry : map.entrySet()) { container.set(entry.getValue(), row.getObject(entry.getKey())); } } }
java
{ "resource": "" }
q340
P3DatabaseReader.defineField
train
private static void defineField(Map<String, FieldType> container, String name, FieldType type) { defineField(container, name, type, null); }
java
{ "resource": "" }
q341
MppDump.dumpTree
train
private static void dumpTree(PrintWriter pw, DirectoryEntry dir, String prefix, boolean showData, boolean hex, String indent) throws Exception { long byteCount; for (Iterator<Entry> iter = dir.getEntries(); iter.hasNext();) { Entry entry = iter.next(); if (entry instanceof Direct...
java
{ "resource": "" }
q342
MppDump.hexdump
train
private static long hexdump(InputStream is, PrintWriter pw) throws Exception { byte[] buffer = new byte[BUFFER_SIZE]; long byteCount = 0; char c; int loop; int count; StringBuilder sb = new StringBuilder(); while (true) { count = is.read(buffer); if...
java
{ "resource": "" }
q343
MppDump.asciidump
train
private static long asciidump(InputStream is, PrintWriter pw) throws Exception { byte[] buffer = new byte[BUFFER_SIZE]; long byteCount = 0; char c; int loop; int count; StringBuilder sb = new StringBuilder(); while (true) { count = is.read(buffer); ...
java
{ "resource": "" }
q344
MPPTimephasedBaselineCostNormaliser.mergeSameCost
train
protected void mergeSameCost(LinkedList<TimephasedCost> list) { LinkedList<TimephasedCost> result = new LinkedList<TimephasedCost>(); TimephasedCost previousAssignment = null; for (TimephasedCost assignment : list) { if (previousAssignment == null) { assignment....
java
{ "resource": "" }
q345
SDEFWriter.write
train
@Override public void write(ProjectFile projectFile, OutputStream out) throws IOException { m_projectFile = projectFile; m_eventManager = projectFile.getEventManager(); m_writer = new PrintStream(out); // the print stream class is the easiest way to create a text file m_buffer = new StringBu...
java
{ "resource": "" }
q346
SDEFWriter.writeProjectProperties
train
private void writeProjectProperties(ProjectProperties record) throws IOException { // the ProjectProperties class from MPXJ has the details of how many days per week etc.... // so I've assigned these variables in here, but actually use them in other methods // see the write task method, that's wher...
java
{ "resource": "" }
q347
SDEFWriter.writeCalendars
train
private void writeCalendars(List<ProjectCalendar> records) { // // Write project calendars // for (ProjectCalendar record : records) { m_buffer.setLength(0); m_buffer.append("CLDR "); m_buffer.append(SDEFmethods.lset(record.getUniqueID().toString(), 2)); // 2...
java
{ "resource": "" }
q348
SDEFWriter.writeExceptions
train
private void writeExceptions(List<ProjectCalendar> records) throws IOException { for (ProjectCalendar record : records) { if (!record.getCalendarExceptions().isEmpty()) { // Need to move HOLI up here and get 15 exceptions per line as per USACE spec. // for now, w...
java
{ "resource": "" }
q349
SDEFWriter.writeTaskPredecessors
train
private void writeTaskPredecessors(Task record) { m_buffer.setLength(0); // // Write the task predecessor // if (!record.getSummary() && !record.getPredecessors().isEmpty()) { // I don't use summary tasks for SDEF m_buffer.append("PRED "); List<Relation> predeces...
java
{ "resource": "" }
q350
MPPAbstractTimephasedWorkNormaliser.getAssignmentWork
train
private Duration getAssignmentWork(ProjectCalendar calendar, TimephasedWork assignment) { Date assignmentStart = assignment.getStart(); Date splitStart = assignmentStart; Date splitFinishTime = calendar.getFinishTime(splitStart); Date splitFinish = DateHelper.setTime(splitStart, splitFinishT...
java
{ "resource": "" }
q351
AstaDatabaseFileReader.createWorkPatternAssignmentMap
train
private Map<Integer, List<Row>> createWorkPatternAssignmentMap(List<Row> rows) throws ParseException { Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>(); for (Row row : rows) { Integer calendarID = row.getInteger("ID"); String workPatterns = row.getString("WORK_PATTE...
java
{ "resource": "" }
q352
AstaDatabaseFileReader.createWorkPatternAssignmentRowList
train
private List<Row> createWorkPatternAssignmentRowList(String workPatterns) throws ParseException { List<Row> list = new ArrayList<Row>(); String[] patterns = workPatterns.split(",|:"); int index = 1; while (index < patterns.length) { Integer workPattern = Integer.valueOf(pattern...
java
{ "resource": "" }
q353
AstaDatabaseFileReader.createExceptionAssignmentMap
train
private Map<Integer, List<Row>> createExceptionAssignmentMap(List<Row> rows) { Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>(); for (Row row : rows) { Integer calendarID = row.getInteger("ID"); String exceptions = row.getString("EXCEPTIONS"); map.put(calen...
java
{ "resource": "" }
q354
AstaDatabaseFileReader.createExceptionAssignmentRowList
train
private List<Row> createExceptionAssignmentRowList(String exceptionData) { List<Row> list = new ArrayList<Row>(); String[] exceptions = exceptionData.split(",|:"); int index = 1; while (index < exceptions.length) { Date startDate = DatatypeConverter.parseEpochTimestamp(exceptio...
java
{ "resource": "" }
q355
AstaDatabaseFileReader.createTimeEntryMap
train
private Map<Integer, List<Row>> createTimeEntryMap(List<Row> rows) throws ParseException { Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>(); for (Row row : rows) { Integer workPatternID = row.getInteger("ID"); String shifts = row.getString("SHIFTS"); map.pu...
java
{ "resource": "" }
q356
AstaDatabaseFileReader.createTimeEntryRowList
train
private List<Row> createTimeEntryRowList(String shiftData) throws ParseException { List<Row> list = new ArrayList<Row>(); String[] shifts = shiftData.split(",|:"); int index = 1; while (index < shifts.length) { index += 2; int entryCount = Integer.parseInt(shifts[index...
java
{ "resource": "" }
q357
AbstractFileFormat.tableDefinitions
train
public Map<Integer, TableDefinition> tableDefinitions() { Map<Integer, TableDefinition> result = new HashMap<Integer, TableDefinition>(); result.put(Integer.valueOf(2), new TableDefinition("PROJECT_SUMMARY", columnDefinitions(PROJECT_SUMMARY_COLUMNS, projectSummaryColumnsOrder()))); result.put(Int...
java
{ "resource": "" }
q358
AbstractFileFormat.columnDefinitions
train
private ColumnDefinition[] columnDefinitions(ColumnDefinition[] columns, String[] order) { Map<String, ColumnDefinition> map = makeColumnMap(columns); ColumnDefinition[] result = new ColumnDefinition[order.length]; for (int index = 0; index < order.length; index++) { result[index] = ...
java
{ "resource": "" }
q359
AbstractFileFormat.makeColumnMap
train
private Map<String, ColumnDefinition> makeColumnMap(ColumnDefinition[] columns) { Map<String, ColumnDefinition> map = new HashMap<String, ColumnDefinition>(); for (ColumnDefinition def : columns) { map.put(def.getName(), def); } return map; }
java
{ "resource": "" }
q360
MSPDIWriter.writeProjectExtendedAttributes
train
private void writeProjectExtendedAttributes(Project project) { Project.ExtendedAttributes attributes = m_factory.createProjectExtendedAttributes(); project.setExtendedAttributes(attributes); List<Project.ExtendedAttributes.ExtendedAttribute> list = attributes.getExtendedAttribute(); Set<Fiel...
java
{ "resource": "" }
q361
MSPDIWriter.writeCalendars
train
private void writeCalendars(Project project) { // // Create the new MSPDI calendar list // Project.Calendars calendars = m_factory.createProjectCalendars(); project.setCalendars(calendars); List<Project.Calendars.Calendar> calendar = calendars.getCalendar(); // // Pro...
java
{ "resource": "" }
q362
MSPDIWriter.writeCalendar
train
private Project.Calendars.Calendar writeCalendar(ProjectCalendar bc) { // // Create a calendar // Project.Calendars.Calendar calendar = m_factory.createProjectCalendarsCalendar(); calendar.setUID(NumberHelper.getBigInteger(bc.getUniqueID())); calendar.setIsBaseCalendar(Boolean.val...
java
{ "resource": "" }
q363
MSPDIWriter.writeExceptions
train
private void writeExceptions(Project.Calendars.Calendar calendar, List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions) { // Always write legacy exception data: // Powerproject appears not to recognise new format data at all, // and legacy data is ign...
java
{ "resource": "" }
q364
MSPDIWriter.writeExceptions9
train
private void writeExceptions9(List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList, List<ProjectCalendarException> exceptions) { for (ProjectCalendarException exception : exceptions) { boolean working = exception.getWorking(); Project.Calendars.Calendar.WeekDays.WeekDay day = m_fa...
java
{ "resource": "" }
q365
MSPDIWriter.writeExceptions12
train
private void writeExceptions12(Project.Calendars.Calendar calendar, List<ProjectCalendarException> exceptions) { Exceptions ce = m_factory.createProjectCalendarsCalendarExceptions(); calendar.setExceptions(ce); List<Exceptions.Exception> el = ce.getException(); for (ProjectCalendarException ...
java
{ "resource": "" }
q366
MSPDIWriter.populateRecurringException
train
private void populateRecurringException(ProjectCalendarException mpxjException, Exceptions.Exception xmlException) { RecurringData data = mpxjException.getRecurring(); xmlException.setEnteredByOccurrences(Boolean.TRUE); xmlException.setOccurrences(NumberHelper.getBigInteger(data.getOccurrences()));...
java
{ "resource": "" }
q367
MSPDIWriter.getDaysOfTheWeek
train
private BigInteger getDaysOfTheWeek(RecurringData data) { int value = 0; for (Day day : Day.values()) { if (data.getWeeklyDay(day)) { value = value | DAY_MASKS[day.getValue()]; } } return BigInteger.valueOf(value); }
java
{ "resource": "" }
q368
MSPDIWriter.writeWorkWeeks
train
private void writeWorkWeeks(Project.Calendars.Calendar xmlCalendar, ProjectCalendar mpxjCalendar) { List<ProjectCalendarWeek> weeks = mpxjCalendar.getWorkWeeks(); if (!weeks.isEmpty()) { WorkWeeks xmlWorkWeeks = m_factory.createProjectCalendarsCalendarWorkWeeks(); xmlCalendar.setW...
java
{ "resource": "" }
q369
MSPDIWriter.writeResources
train
private void writeResources(Project project) { Project.Resources resources = m_factory.createProjectResources(); project.setResources(resources); List<Project.Resources.Resource> list = resources.getResource(); for (Resource resource : m_projectFile.getResources()) { list.add(...
java
{ "resource": "" }
q370
MSPDIWriter.writeResourceBaselines
train
private void writeResourceBaselines(Project.Resources.Resource xmlResource, Resource mpxjResource) { Project.Resources.Resource.Baseline baseline = m_factory.createProjectResourcesResourceBaseline(); boolean populated = false; Number cost = mpxjResource.getBaselineCost(); if (cost != null &&...
java
{ "resource": "" }
q371
MSPDIWriter.writeResourceExtendedAttributes
train
private void writeResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx) { Project.Resources.Resource.ExtendedAttribute attrib; List<Project.Resources.Resource.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute(); for (ResourceField mpxFieldID : getAllResourceExtend...
java
{ "resource": "" }
q372
MSPDIWriter.writeCostRateTables
train
private void writeCostRateTables(Project.Resources.Resource xml, Resource mpx) { //Rates rates = m_factory.createProjectResourcesResourceRates(); //xml.setRates(rates); //List<Project.Resources.Resource.Rates.Rate> ratesList = rates.getRate(); List<Project.Resources.Resource.Rates.Rate> rate...
java
{ "resource": "" }
q373
MSPDIWriter.costRateTableWriteRequired
train
private boolean costRateTableWriteRequired(CostRateTableEntry entry, Date from) { boolean fromDate = (DateHelper.compare(from, DateHelper.FIRST_DATE) > 0); boolean toDate = (DateHelper.compare(entry.getEndDate(), DateHelper.LAST_DATE) > 0); boolean costPerUse = (NumberHelper.getDouble(entry.getCost...
java
{ "resource": "" }
q374
MSPDIWriter.writeAvailability
train
private void writeAvailability(Project.Resources.Resource xml, Resource mpx) { AvailabilityPeriods periods = m_factory.createProjectResourcesResourceAvailabilityPeriods(); xml.setAvailabilityPeriods(periods); List<AvailabilityPeriod> list = periods.getAvailabilityPeriod(); for (Availability a...
java
{ "resource": "" }
q375
MSPDIWriter.writeTasks
train
private void writeTasks(Project project) { Project.Tasks tasks = m_factory.createProjectTasks(); project.setTasks(tasks); List<Project.Tasks.Task> list = tasks.getTask(); for (Task task : m_projectFile.getTasks()) { list.add(writeTask(task)); } }
java
{ "resource": "" }
q376
MSPDIWriter.writeTaskBaselines
train
private void writeTaskBaselines(Project.Tasks.Task xmlTask, Task mpxjTask) { Project.Tasks.Task.Baseline baseline = m_factory.createProjectTasksTaskBaseline(); boolean populated = false; Number cost = mpxjTask.getBaselineCost(); if (cost != null && cost.intValue() != 0) { popu...
java
{ "resource": "" }
q377
MSPDIWriter.writeTaskExtendedAttributes
train
private void writeTaskExtendedAttributes(Project.Tasks.Task xml, Task mpx) { Project.Tasks.Task.ExtendedAttribute attrib; List<Project.Tasks.Task.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute(); for (TaskField mpxFieldID : getAllTaskExtendedAttributes()) { Object ...
java
{ "resource": "" }
q378
MSPDIWriter.printExtendedAttributeDurationFormat
train
private BigInteger printExtendedAttributeDurationFormat(Object value) { BigInteger result = null; if (value instanceof Duration) { result = DatatypeConverter.printDurationTimeUnits(((Duration) value).getUnits(), false); } return (result); }
java
{ "resource": "" }
q379
MSPDIWriter.getTaskCalendarID
train
private BigInteger getTaskCalendarID(Task mpx) { BigInteger result = null; ProjectCalendar cal = mpx.getCalendar(); if (cal != null) { result = NumberHelper.getBigInteger(cal.getUniqueID()); } else { result = NULL_CALENDAR_ID; } return (result);...
java
{ "resource": "" }
q380
MSPDIWriter.writePredecessors
train
private void writePredecessors(Project.Tasks.Task xml, Task mpx) { List<Project.Tasks.Task.PredecessorLink> list = xml.getPredecessorLink(); List<Relation> predecessors = mpx.getPredecessors(); for (Relation rel : predecessors) { Integer taskUniqueID = rel.getTargetTask().getUniqueI...
java
{ "resource": "" }
q381
MSPDIWriter.writePredecessor
train
private Project.Tasks.Task.PredecessorLink writePredecessor(Integer taskID, RelationType type, Duration lag) { Project.Tasks.Task.PredecessorLink link = m_factory.createProjectTasksTaskPredecessorLink(); link.setPredecessorUID(NumberHelper.getBigInteger(taskID)); link.setType(BigInteger.valueOf(ty...
java
{ "resource": "" }
q382
MSPDIWriter.writeAssignments
train
private void writeAssignments(Project project) { Project.Assignments assignments = m_factory.createProjectAssignments(); project.setAssignments(assignments); List<Project.Assignments.Assignment> list = assignments.getAssignment(); for (ResourceAssignment assignment : m_projectFile.getResourc...
java
{ "resource": "" }
q383
MSPDIWriter.writeAssignmentBaselines
train
private void writeAssignmentBaselines(Project.Assignments.Assignment xml, ResourceAssignment mpxj) { Project.Assignments.Assignment.Baseline baseline = m_factory.createProjectAssignmentsAssignmentBaseline(); boolean populated = false; Number cost = mpxj.getBaselineCost(); if (cost != null &&...
java
{ "resource": "" }
q384
MSPDIWriter.writeAssignmentExtendedAttributes
train
private void writeAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx) { Project.Assignments.Assignment.ExtendedAttribute attrib; List<Project.Assignments.Assignment.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute(); for (AssignmentField mpxFiel...
java
{ "resource": "" }
q385
MSPDIWriter.writeAssignmentTimephasedData
train
private void writeAssignmentTimephasedData(ResourceAssignment mpx, Project.Assignments.Assignment xml) { if (m_writeTimphasedData && mpx.getHasTimephasedData()) { List<TimephasedDataType> list = xml.getTimephasedData(); ProjectCalendar calendar = mpx.getCalendar(); BigInteger a...
java
{ "resource": "" }
q386
MSPDIWriter.writeAssignmentTimephasedData
train
private void writeAssignmentTimephasedData(BigInteger assignmentID, List<TimephasedDataType> list, List<TimephasedWork> data, int type) { for (TimephasedWork mpx : data) { TimephasedDataType xml = m_factory.createTimephasedDataType(); list.add(xml); xml.setStart(mpx.getStart()...
java
{ "resource": "" }
q387
MSPDIWriter.getAllAssignmentExtendedAttributes
train
private List<AssignmentField> getAllAssignmentExtendedAttributes() { ArrayList<AssignmentField> result = new ArrayList<AssignmentField>(); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_COST)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_DATE)); result.addAll(Arrays.asLis...
java
{ "resource": "" }
q388
MSPDIWriter.getAllTaskExtendedAttributes
train
private List<TaskField> getAllTaskExtendedAttributes() { ArrayList<TaskField> result = new ArrayList<TaskField>(); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_TEXT)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_START)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_FINISH)); ...
java
{ "resource": "" }
q389
MSPDIWriter.getAllResourceExtendedAttributes
train
private List<ResourceField> getAllResourceExtendedAttributes() { ArrayList<ResourceField> result = new ArrayList<ResourceField>(); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_TEXT)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_START)); result.addAll(Arrays.asList(ResourceF...
java
{ "resource": "" }
q390
PrimaveraPMFileReader.processUDF
train
private void processUDF(UDFTypeType udf) { FieldTypeClass fieldType = FIELD_TYPE_MAP.get(udf.getSubjectArea()); if (fieldType != null) { UserFieldDataType dataType = UserFieldDataType.getInstanceFromXmlName(udf.getDataType()); String name = udf.getTitle(); FieldType field...
java
{ "resource": "" }
q391
PrimaveraPMFileReader.addUserDefinedField
train
private FieldType addUserDefinedField(FieldTypeClass fieldType, UserFieldDataType dataType, String name) { FieldType field = null; try { switch (fieldType) { case TASK: { do { field = m_taskUdfCounters....
java
{ "resource": "" }
q392
PrimaveraPMFileReader.zeroIsNull
train
private Double zeroIsNull(Double value) { if (value != null && value.doubleValue() == 0) { value = null; } return value; }
java
{ "resource": "" }
q393
PrimaveraPMFileReader.getDuration
train
private Duration getDuration(Double duration) { Duration result = null; if (duration != null) { result = Duration.getInstance(NumberHelper.getDouble(duration), TimeUnit.HOURS); } return result; }
java
{ "resource": "" }
q394
PrimaveraPMFileReader.readUDFTypes
train
private void readUDFTypes(FieldContainer mpxj, List<UDFAssignmentType> udfs) { for (UDFAssignmentType udf : udfs) { FieldType fieldType = m_fieldTypeMap.get(Integer.valueOf(udf.getTypeObjectId())); if (fieldType != null) { mpxj.set(fieldType, getUdfValue(udf)); ...
java
{ "resource": "" }
q395
PrimaveraPMFileReader.getUdfValue
train
private Object getUdfValue(UDFAssignmentType udf) { if (udf.getCostValue() != null) { return udf.getCostValue(); } if (udf.getDoubleValue() != null) { return udf.getDoubleValue(); } if (udf.getFinishDateValue() != null) { return...
java
{ "resource": "" }
q396
PrimaveraPMFileReader.mapTaskID
train
private Integer mapTaskID(Integer id) { Integer mappedID = m_clashMap.get(id); if (mappedID == null) { mappedID = id; } return (mappedID); }
java
{ "resource": "" }
q397
GraphicalIndicator.evaluate
train
public int evaluate(FieldContainer container) { // // First step - determine the list of criteria we are should use // List<GraphicalIndicatorCriteria> criteria; if (container instanceof Task) { Task task = (Task) container; if (NumberHelper.getInt(task.getUnique...
java
{ "resource": "" }
q398
MPXWriter.writeFileCreationRecord
train
private void writeFileCreationRecord() throws IOException { ProjectProperties properties = m_projectFile.getProjectProperties(); m_buffer.setLength(0); m_buffer.append("MPX"); m_buffer.append(m_delimiter); m_buffer.append(properties.getMpxProgramName()); m_buffer.append(m_delimit...
java
{ "resource": "" }
q399
MPXWriter.writeCalendar
train
private void writeCalendar(ProjectCalendar record) throws IOException { // // Test used to ensure that we don't write the default calendar used for the "Unassigned" resource // if (record.getParent() == null || record.getResource() != null) { m_buffer.setLength(0); if...
java
{ "resource": "" }