_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3 values | text stringlengths 73 34.1k | language stringclasses 1 value | meta_information dict |
|---|---|---|---|---|---|
q1200 | GanttProjectReader.readResources | train | private void readResources(Project ganttProject)
{
Resources resources = ganttProject.getResources();
readResourceCustomPropertyDefinitions(resources);
readRoleDefinitions(ganttProject);
for (net.sf.mpxj.ganttproject.schema.Resource gpResource : resources.getResource())
{
readResource(gpResource);
}
} | java | {
"resource": ""
} |
q1201 | GanttProjectReader.readResourceCustomPropertyDefinitions | train | private void readResourceCustomPropertyDefinitions(Resources gpResources)
{
CustomField field = m_projectFile.getCustomFields().getCustomField(ResourceField.TEXT1);
field.setAlias("Phone");
for (CustomPropertyDefinition definition : gpResources.getCustomPropertyDefinition())
{
//
// Find the next available field of the correct type.
//
String type = definition.getType();
FieldType fieldType = RESOURCE_PROPERTY_TYPES.get(type).getField();
//
// If we have run out of fields of the right type, try using a text field.
//
if (fieldType == null)
{
fieldType = RESOURCE_PROPERTY_TYPES.get("text").getField();
}
//
// If we actually have a field available, set the alias to match
// the name used in GanttProject.
//
if (fieldType != null)
{
field = m_projectFile.getCustomFields().getCustomField(fieldType);
field.setAlias(definition.getName());
String defaultValue = definition.getDefaultValue();
if (defaultValue != null && defaultValue.isEmpty())
{
defaultValue = null;
}
m_resourcePropertyDefinitions.put(definition.getId(), new Pair<FieldType, String>(fieldType, defaultValue));
}
}
} | java | {
"resource": ""
} |
q1202 | GanttProjectReader.readTaskCustomPropertyDefinitions | train | private void readTaskCustomPropertyDefinitions(Tasks gpTasks)
{
for (Taskproperty definition : gpTasks.getTaskproperties().getTaskproperty())
{
//
// Ignore everything but custom values
//
if (!"custom".equals(definition.getType()))
{
continue;
}
//
// Find the next available field of the correct type.
//
String type = definition.getValuetype();
FieldType fieldType = TASK_PROPERTY_TYPES.get(type).getField();
//
// If we have run out of fields of the right type, try using a text field.
//
if (fieldType == null)
{
fieldType = TASK_PROPERTY_TYPES.get("text").getField();
}
//
// If we actually have a field available, set the alias to match
// the name used in GanttProject.
//
if (fieldType != null)
{
CustomField field = m_projectFile.getCustomFields().getCustomField(fieldType);
field.setAlias(definition.getName());
String defaultValue = definition.getDefaultvalue();
if (defaultValue != null && defaultValue.isEmpty())
{
defaultValue = null;
}
m_taskPropertyDefinitions.put(definition.getId(), new Pair<FieldType, String>(fieldType, defaultValue));
}
}
} | java | {
"resource": ""
} |
q1203 | GanttProjectReader.readRoleDefinitions | train | private void readRoleDefinitions(Project gpProject)
{
m_roleDefinitions.put("Default:1", "project manager");
for (Roles roles : gpProject.getRoles())
{
if ("Default".equals(roles.getRolesetName()))
{
continue;
}
for (Role role : roles.getRole())
{
m_roleDefinitions.put(role.getId(), role.getName());
}
}
} | java | {
"resource": ""
} |
q1204 | GanttProjectReader.readResource | train | private void readResource(net.sf.mpxj.ganttproject.schema.Resource gpResource)
{
Resource mpxjResource = m_projectFile.addResource();
mpxjResource.setUniqueID(Integer.valueOf(NumberHelper.getInt(gpResource.getId()) + 1));
mpxjResource.setName(gpResource.getName());
mpxjResource.setEmailAddress(gpResource.getContacts());
mpxjResource.setText(1, gpResource.getPhone());
mpxjResource.setGroup(m_roleDefinitions.get(gpResource.getFunction()));
net.sf.mpxj.ganttproject.schema.Rate gpRate = gpResource.getRate();
if (gpRate != null)
{
mpxjResource.setStandardRate(new Rate(gpRate.getValueAttribute(), TimeUnit.DAYS));
}
readResourceCustomFields(gpResource, mpxjResource);
m_eventManager.fireResourceReadEvent(mpxjResource);
} | java | {
"resource": ""
} |
q1205 | GanttProjectReader.readResourceCustomFields | train | private void readResourceCustomFields(net.sf.mpxj.ganttproject.schema.Resource gpResource, Resource mpxjResource)
{
//
// Populate custom field default values
//
Map<FieldType, Object> customFields = new HashMap<FieldType, Object>();
for (Pair<FieldType, String> definition : m_resourcePropertyDefinitions.values())
{
customFields.put(definition.getFirst(), definition.getSecond());
}
//
// Update with custom field actual values
//
for (CustomResourceProperty property : gpResource.getCustomProperty())
{
Pair<FieldType, String> definition = m_resourcePropertyDefinitions.get(property.getDefinitionId());
if (definition != null)
{
//
// Retrieve the value. If it is empty, use the default.
//
String value = property.getValueAttribute();
if (value.isEmpty())
{
value = null;
}
//
// If we have a value,convert it to the correct type
//
if (value != null)
{
Object result;
switch (definition.getFirst().getDataType())
{
case NUMERIC:
{
if (value.indexOf('.') == -1)
{
result = Integer.valueOf(value);
}
else
{
result = Double.valueOf(value);
}
break;
}
case DATE:
{
try
{
result = m_localeDateFormat.parse(value);
}
catch (ParseException ex)
{
result = null;
}
break;
}
case BOOLEAN:
{
result = Boolean.valueOf(value.equals("true"));
break;
}
default:
{
result = value;
break;
}
}
if (result != null)
{
customFields.put(definition.getFirst(), result);
}
}
}
}
for (Map.Entry<FieldType, Object> item : customFields.entrySet())
{
if (item.getValue() != null)
{
mpxjResource.set(item.getKey(), item.getValue());
}
}
} | java | {
"resource": ""
} |
q1206 | GanttProjectReader.readTaskCustomFields | train | private void readTaskCustomFields(net.sf.mpxj.ganttproject.schema.Task gpTask, Task mpxjTask)
{
//
// Populate custom field default values
//
Map<FieldType, Object> customFields = new HashMap<FieldType, Object>();
for (Pair<FieldType, String> definition : m_taskPropertyDefinitions.values())
{
customFields.put(definition.getFirst(), definition.getSecond());
}
//
// Update with custom field actual values
//
for (CustomTaskProperty property : gpTask.getCustomproperty())
{
Pair<FieldType, String> definition = m_taskPropertyDefinitions.get(property.getTaskpropertyId());
if (definition != null)
{
//
// Retrieve the value. If it is empty, use the default.
//
String value = property.getValueAttribute();
if (value.isEmpty())
{
value = null;
}
//
// If we have a value,convert it to the correct type
//
if (value != null)
{
Object result;
switch (definition.getFirst().getDataType())
{
case NUMERIC:
{
if (value.indexOf('.') == -1)
{
result = Integer.valueOf(value);
}
else
{
result = Double.valueOf(value);
}
break;
}
case DATE:
{
try
{
result = m_dateFormat.parse(value);
}
catch (ParseException ex)
{
result = null;
}
break;
}
case BOOLEAN:
{
result = Boolean.valueOf(value.equals("true"));
break;
}
default:
{
result = value;
break;
}
}
if (result != null)
{
customFields.put(definition.getFirst(), result);
}
}
}
}
for (Map.Entry<FieldType, Object> item : customFields.entrySet())
{
if (item.getValue() != null)
{
mpxjTask.set(item.getKey(), item.getValue());
}
}
} | java | {
"resource": ""
} |
q1207 | GanttProjectReader.readTasks | train | private void readTasks(Project gpProject)
{
Tasks tasks = gpProject.getTasks();
readTaskCustomPropertyDefinitions(tasks);
for (net.sf.mpxj.ganttproject.schema.Task task : tasks.getTask())
{
readTask(m_projectFile, task);
}
} | java | {
"resource": ""
} |
q1208 | GanttProjectReader.readTask | train | private void readTask(ChildTaskContainer mpxjParent, net.sf.mpxj.ganttproject.schema.Task gpTask)
{
Task mpxjTask = mpxjParent.addTask();
mpxjTask.setUniqueID(Integer.valueOf(NumberHelper.getInt(gpTask.getId()) + 1));
mpxjTask.setName(gpTask.getName());
mpxjTask.setPercentageComplete(gpTask.getComplete());
mpxjTask.setPriority(getPriority(gpTask.getPriority()));
mpxjTask.setHyperlink(gpTask.getWebLink());
Duration duration = Duration.getInstance(NumberHelper.getDouble(gpTask.getDuration()), TimeUnit.DAYS);
mpxjTask.setDuration(duration);
if (duration.getDuration() == 0)
{
mpxjTask.setMilestone(true);
}
else
{
mpxjTask.setStart(gpTask.getStart());
mpxjTask.setFinish(m_mpxjCalendar.getDate(gpTask.getStart(), mpxjTask.getDuration(), false));
}
mpxjTask.setConstraintDate(gpTask.getThirdDate());
if (mpxjTask.getConstraintDate() != null)
{
// TODO: you don't appear to be able to change this setting in GanttProject
// task.getThirdDateConstraint()
mpxjTask.setConstraintType(ConstraintType.START_NO_EARLIER_THAN);
}
readTaskCustomFields(gpTask, mpxjTask);
m_eventManager.fireTaskReadEvent(mpxjTask);
// TODO: read custom values
//
// Process child tasks
//
for (net.sf.mpxj.ganttproject.schema.Task childTask : gpTask.getTask())
{
readTask(mpxjTask, childTask);
}
} | java | {
"resource": ""
} |
q1209 | GanttProjectReader.getPriority | train | private Priority getPriority(Integer gpPriority)
{
int result;
if (gpPriority == null)
{
result = Priority.MEDIUM;
}
else
{
int index = gpPriority.intValue();
if (index < 0 || index >= PRIORITY.length)
{
result = Priority.MEDIUM;
}
else
{
result = PRIORITY[index];
}
}
return Priority.getInstance(result);
} | java | {
"resource": ""
} |
q1210 | GanttProjectReader.readRelationships | train | private void readRelationships(Project gpProject)
{
for (net.sf.mpxj.ganttproject.schema.Task gpTask : gpProject.getTasks().getTask())
{
readRelationships(gpTask);
}
} | java | {
"resource": ""
} |
q1211 | GanttProjectReader.readRelationships | train | private void readRelationships(net.sf.mpxj.ganttproject.schema.Task gpTask)
{
for (Depend depend : gpTask.getDepend())
{
Task task1 = m_projectFile.getTaskByUniqueID(Integer.valueOf(NumberHelper.getInt(gpTask.getId()) + 1));
Task task2 = m_projectFile.getTaskByUniqueID(Integer.valueOf(NumberHelper.getInt(depend.getId()) + 1));
if (task1 != null && task2 != null)
{
Duration lag = Duration.getInstance(NumberHelper.getInt(depend.getDifference()), TimeUnit.DAYS);
Relation relation = task2.addPredecessor(task1, getRelationType(depend.getType()), lag);
m_eventManager.fireRelationReadEvent(relation);
}
}
} | java | {
"resource": ""
} |
q1212 | GanttProjectReader.getRelationType | train | private RelationType getRelationType(Integer gpType)
{
RelationType result = null;
if (gpType != null)
{
int index = NumberHelper.getInt(gpType);
if (index > 0 && index < RELATION.length)
{
result = RELATION[index];
}
}
if (result == null)
{
result = RelationType.FINISH_START;
}
return result;
} | java | {
"resource": ""
} |
q1213 | GanttProjectReader.readResourceAssignments | train | private void readResourceAssignments(Project gpProject)
{
Allocations allocations = gpProject.getAllocations();
if (allocations != null)
{
for (Allocation allocation : allocations.getAllocation())
{
readResourceAssignment(allocation);
}
}
} | java | {
"resource": ""
} |
q1214 | GanttProjectReader.readResourceAssignment | train | private void readResourceAssignment(Allocation gpAllocation)
{
Integer taskID = Integer.valueOf(NumberHelper.getInt(gpAllocation.getTaskId()) + 1);
Integer resourceID = Integer.valueOf(NumberHelper.getInt(gpAllocation.getResourceId()) + 1);
Task task = m_projectFile.getTaskByUniqueID(taskID);
Resource resource = m_projectFile.getResourceByUniqueID(resourceID);
if (task != null && resource != null)
{
ResourceAssignment mpxjAssignment = task.addResourceAssignment(resource);
mpxjAssignment.setUnits(gpAllocation.getLoad());
m_eventManager.fireAssignmentReadEvent(mpxjAssignment);
}
} | java | {
"resource": ""
} |
q1215 | JsonWriter.writeCustomFields | train | private void writeCustomFields() throws IOException
{
m_writer.writeStartList("custom_fields");
for (CustomField field : m_projectFile.getCustomFields())
{
writeCustomField(field);
}
m_writer.writeEndList();
} | java | {
"resource": ""
} |
q1216 | JsonWriter.writeCustomField | train | private void writeCustomField(CustomField field) throws IOException
{
if (field.getAlias() != null)
{
m_writer.writeStartObject(null);
m_writer.writeNameValuePair("field_type_class", field.getFieldType().getFieldTypeClass().name().toLowerCase());
m_writer.writeNameValuePair("field_type", field.getFieldType().name().toLowerCase());
m_writer.writeNameValuePair("field_alias", field.getAlias());
m_writer.writeEndObject();
}
} | java | {
"resource": ""
} |
q1217 | JsonWriter.writeProperties | train | private void writeProperties() throws IOException
{
writeAttributeTypes("property_types", ProjectField.values());
writeFields("property_values", m_projectFile.getProjectProperties(), ProjectField.values());
} | java | {
"resource": ""
} |
q1218 | JsonWriter.writeResources | train | private void writeResources() throws IOException
{
writeAttributeTypes("resource_types", ResourceField.values());
m_writer.writeStartList("resources");
for (Resource resource : m_projectFile.getResources())
{
writeFields(null, resource, ResourceField.values());
}
m_writer.writeEndList();
} | java | {
"resource": ""
} |
q1219 | JsonWriter.writeTasks | train | private void writeTasks() throws IOException
{
writeAttributeTypes("task_types", TaskField.values());
m_writer.writeStartList("tasks");
for (Task task : m_projectFile.getChildTasks())
{
writeTask(task);
}
m_writer.writeEndList();
} | java | {
"resource": ""
} |
q1220 | JsonWriter.writeTask | train | private void writeTask(Task task) throws IOException
{
writeFields(null, task, TaskField.values());
for (Task child : task.getChildTasks())
{
writeTask(child);
}
} | java | {
"resource": ""
} |
q1221 | JsonWriter.writeAssignments | train | private void writeAssignments() throws IOException
{
writeAttributeTypes("assignment_types", AssignmentField.values());
m_writer.writeStartList("assignments");
for (ResourceAssignment assignment : m_projectFile.getResourceAssignments())
{
writeFields(null, assignment, AssignmentField.values());
}
m_writer.writeEndList();
} | java | {
"resource": ""
} |
q1222 | JsonWriter.writeAttributeTypes | train | private void writeAttributeTypes(String name, FieldType[] types) throws IOException
{
m_writer.writeStartObject(name);
for (FieldType field : types)
{
m_writer.writeNameValuePair(field.name().toLowerCase(), field.getDataType().getValue());
}
m_writer.writeEndObject();
} | java | {
"resource": ""
} |
q1223 | JsonWriter.writeFields | train | private void writeFields(String objectName, FieldContainer container, FieldType[] fields) throws IOException
{
m_writer.writeStartObject(objectName);
for (FieldType field : fields)
{
Object value = container.getCurrentValue(field);
if (value != null)
{
writeField(field, value);
}
}
m_writer.writeEndObject();
} | java | {
"resource": ""
} |
q1224 | JsonWriter.writeIntegerField | train | private void writeIntegerField(String fieldName, Object value) throws IOException
{
int val = ((Number) value).intValue();
if (val != 0)
{
m_writer.writeNameValuePair(fieldName, val);
}
} | java | {
"resource": ""
} |
q1225 | JsonWriter.writeDoubleField | train | private void writeDoubleField(String fieldName, Object value) throws IOException
{
double val = ((Number) value).doubleValue();
if (val != 0)
{
m_writer.writeNameValuePair(fieldName, val);
}
} | java | {
"resource": ""
} |
q1226 | JsonWriter.writeBooleanField | train | private void writeBooleanField(String fieldName, Object value) throws IOException
{
boolean val = ((Boolean) value).booleanValue();
if (val)
{
m_writer.writeNameValuePair(fieldName, val);
}
} | java | {
"resource": ""
} |
q1227 | JsonWriter.writeDurationField | train | private void writeDurationField(String fieldName, Object value) throws IOException
{
if (value instanceof String)
{
m_writer.writeNameValuePair(fieldName + "_text", (String) value);
}
else
{
Duration val = (Duration) value;
if (val.getDuration() != 0)
{
Duration minutes = val.convertUnits(TimeUnit.MINUTES, m_projectFile.getProjectProperties());
long seconds = (long) (minutes.getDuration() * 60.0);
m_writer.writeNameValuePair(fieldName, seconds);
}
}
} | java | {
"resource": ""
} |
q1228 | JsonWriter.writeDateField | train | private void writeDateField(String fieldName, Object value) throws IOException
{
if (value instanceof String)
{
m_writer.writeNameValuePair(fieldName + "_text", (String) value);
}
else
{
Date val = (Date) value;
m_writer.writeNameValuePair(fieldName, val);
}
} | java | {
"resource": ""
} |
q1229 | JsonWriter.writeTimeUnitsField | train | private void writeTimeUnitsField(String fieldName, Object value) throws IOException
{
TimeUnit val = (TimeUnit) value;
if (val != m_projectFile.getProjectProperties().getDefaultDurationUnits())
{
m_writer.writeNameValuePair(fieldName, val.toString());
}
} | java | {
"resource": ""
} |
q1230 | JsonWriter.writePriorityField | train | private void writePriorityField(String fieldName, Object value) throws IOException
{
m_writer.writeNameValuePair(fieldName, ((Priority) value).getValue());
} | java | {
"resource": ""
} |
q1231 | JsonWriter.writeMap | train | private void writeMap(String fieldName, Object value) throws IOException
{
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) value;
m_writer.writeStartObject(fieldName);
for (Map.Entry<String, Object> entry : map.entrySet())
{
Object entryValue = entry.getValue();
if (entryValue != null)
{
DataType type = TYPE_MAP.get(entryValue.getClass().getName());
if (type == null)
{
type = DataType.STRING;
entryValue = entryValue.toString();
}
writeField(entry.getKey(), type, entryValue);
}
}
m_writer.writeEndObject();
} | java | {
"resource": ""
} |
q1232 | JsonWriter.writeStringField | train | private void writeStringField(String fieldName, Object value) throws IOException
{
String val = value.toString();
if (!val.isEmpty())
{
m_writer.writeNameValuePair(fieldName, val);
}
} | java | {
"resource": ""
} |
q1233 | JsonWriter.writeRelationList | train | private void writeRelationList(String fieldName, Object value) throws IOException
{
@SuppressWarnings("unchecked")
List<Relation> list = (List<Relation>) value;
if (!list.isEmpty())
{
m_writer.writeStartList(fieldName);
for (Relation relation : list)
{
m_writer.writeStartObject(null);
writeIntegerField("task_unique_id", relation.getTargetTask().getUniqueID());
writeDurationField("lag", relation.getLag());
writeStringField("type", relation.getType());
m_writer.writeEndObject();
}
m_writer.writeEndList();
}
} | java | {
"resource": ""
} |
q1234 | MPXResourceField.getMpxjField | train | public static ResourceField getMpxjField(int value)
{
ResourceField result = null;
if (value >= 0 && value < MPX_MPXJ_ARRAY.length)
{
result = MPX_MPXJ_ARRAY[value];
}
return (result);
} | java | {
"resource": ""
} |
q1235 | Filter.evaluate | train | public boolean evaluate(FieldContainer container, Map<GenericCriteriaPrompt, Object> promptValues)
{
boolean result = true;
if (m_criteria != null)
{
result = m_criteria.evaluate(container, promptValues);
//
// If this row has failed, but it is a summary row, and we are
// including related summary rows, then we need to recursively test
// its children
//
if (!result && m_showRelatedSummaryRows && container instanceof Task)
{
for (Task task : ((Task) container).getChildTasks())
{
if (evaluate(task, promptValues))
{
result = true;
break;
}
}
}
}
return (result);
} | java | {
"resource": ""
} |
q1236 | AbstractWbsFormat.parseRawValue | train | public void parseRawValue(String value)
{
int valueIndex = 0;
int elementIndex = 0;
m_elements.clear();
while (valueIndex < value.length() && elementIndex < m_elements.size())
{
int elementLength = m_lengths.get(elementIndex).intValue();
if (elementIndex > 0)
{
m_elements.add(m_separators.get(elementIndex - 1));
}
int endIndex = valueIndex + elementLength;
if (endIndex > value.length())
{
endIndex = value.length();
}
String element = value.substring(valueIndex, endIndex);
m_elements.add(element);
valueIndex += elementLength;
elementIndex++;
}
} | java | {
"resource": ""
} |
q1237 | AbstractWbsFormat.getFormattedParentValue | train | public String getFormattedParentValue()
{
String result = null;
if (m_elements.size() > 2)
{
result = joinElements(m_elements.size() - 2);
}
return result;
} | java | {
"resource": ""
} |
q1238 | AbstractWbsFormat.joinElements | train | private String joinElements(int length)
{
StringBuilder sb = new StringBuilder();
for (int index = 0; index < length; index++)
{
sb.append(m_elements.get(index));
}
return sb.toString();
} | java | {
"resource": ""
} |
q1239 | ProjectTreeController.addTasks | train | private void addTasks(MpxjTreeNode parentNode, ChildTaskContainer parent)
{
for (Task task : parent.getChildTasks())
{
final Task t = task;
MpxjTreeNode childNode = new MpxjTreeNode(task, TASK_EXCLUDED_METHODS)
{
@Override public String toString()
{
return t.getName();
}
};
parentNode.add(childNode);
addTasks(childNode, task);
}
} | java | {
"resource": ""
} |
q1240 | ProjectTreeController.addResources | train | private void addResources(MpxjTreeNode parentNode, ProjectFile file)
{
for (Resource resource : file.getResources())
{
final Resource r = resource;
MpxjTreeNode childNode = new MpxjTreeNode(resource)
{
@Override public String toString()
{
return r.getName();
}
};
parentNode.add(childNode);
}
} | java | {
"resource": ""
} |
q1241 | ProjectTreeController.addCalendars | train | private void addCalendars(MpxjTreeNode parentNode, ProjectFile file)
{
for (ProjectCalendar calendar : file.getCalendars())
{
addCalendar(parentNode, calendar);
}
} | java | {
"resource": ""
} |
q1242 | ProjectTreeController.addCalendar | train | private void addCalendar(MpxjTreeNode parentNode, final ProjectCalendar calendar)
{
MpxjTreeNode calendarNode = new MpxjTreeNode(calendar, CALENDAR_EXCLUDED_METHODS)
{
@Override public String toString()
{
return calendar.getName();
}
};
parentNode.add(calendarNode);
MpxjTreeNode daysFolder = new MpxjTreeNode("Days");
calendarNode.add(daysFolder);
for (Day day : Day.values())
{
addCalendarDay(daysFolder, calendar, day);
}
MpxjTreeNode exceptionsFolder = new MpxjTreeNode("Exceptions");
calendarNode.add(exceptionsFolder);
for (ProjectCalendarException exception : calendar.getCalendarExceptions())
{
addCalendarException(exceptionsFolder, exception);
}
} | java | {
"resource": ""
} |
q1243 | ProjectTreeController.addCalendarDay | train | private void addCalendarDay(MpxjTreeNode parentNode, ProjectCalendar calendar, final Day day)
{
MpxjTreeNode dayNode = new MpxjTreeNode(day)
{
@Override public String toString()
{
return day.name();
}
};
parentNode.add(dayNode);
addHours(dayNode, calendar.getHours(day));
} | java | {
"resource": ""
} |
q1244 | ProjectTreeController.addHours | train | private void addHours(MpxjTreeNode parentNode, ProjectCalendarDateRanges hours)
{
for (DateRange range : hours)
{
final DateRange r = range;
MpxjTreeNode rangeNode = new MpxjTreeNode(range)
{
@Override public String toString()
{
return m_timeFormat.format(r.getStart()) + " - " + m_timeFormat.format(r.getEnd());
}
};
parentNode.add(rangeNode);
}
} | java | {
"resource": ""
} |
q1245 | ProjectTreeController.addCalendarException | train | private void addCalendarException(MpxjTreeNode parentNode, final ProjectCalendarException exception)
{
MpxjTreeNode exceptionNode = new MpxjTreeNode(exception, CALENDAR_EXCEPTION_EXCLUDED_METHODS)
{
@Override public String toString()
{
return m_dateFormat.format(exception.getFromDate());
}
};
parentNode.add(exceptionNode);
addHours(exceptionNode, exception);
} | java | {
"resource": ""
} |
q1246 | ProjectTreeController.addGroups | train | private void addGroups(MpxjTreeNode parentNode, ProjectFile file)
{
for (Group group : file.getGroups())
{
final Group g = group;
MpxjTreeNode childNode = new MpxjTreeNode(group)
{
@Override public String toString()
{
return g.getName();
}
};
parentNode.add(childNode);
}
} | java | {
"resource": ""
} |
q1247 | ProjectTreeController.addCustomFields | train | private void addCustomFields(MpxjTreeNode parentNode, ProjectFile file)
{
for (CustomField field : file.getCustomFields())
{
final CustomField c = field;
MpxjTreeNode childNode = new MpxjTreeNode(field)
{
@Override public String toString()
{
FieldType type = c.getFieldType();
return type == null ? "(unknown)" : type.getFieldTypeClass() + "." + type.toString();
}
};
parentNode.add(childNode);
}
} | java | {
"resource": ""
} |
q1248 | ProjectTreeController.addViews | train | private void addViews(MpxjTreeNode parentNode, ProjectFile file)
{
for (View view : file.getViews())
{
final View v = view;
MpxjTreeNode childNode = new MpxjTreeNode(view)
{
@Override public String toString()
{
return v.getName();
}
};
parentNode.add(childNode);
}
} | java | {
"resource": ""
} |
q1249 | ProjectTreeController.addTables | train | private void addTables(MpxjTreeNode parentNode, ProjectFile file)
{
for (Table table : file.getTables())
{
final Table t = table;
MpxjTreeNode childNode = new MpxjTreeNode(table, TABLE_EXCLUDED_METHODS)
{
@Override public String toString()
{
return t.getName();
}
};
parentNode.add(childNode);
addColumns(childNode, table);
}
} | java | {
"resource": ""
} |
q1250 | ProjectTreeController.addColumns | train | private void addColumns(MpxjTreeNode parentNode, Table table)
{
for (Column column : table.getColumns())
{
final Column c = column;
MpxjTreeNode childNode = new MpxjTreeNode(column)
{
@Override public String toString()
{
return c.getTitle();
}
};
parentNode.add(childNode);
}
} | java | {
"resource": ""
} |
q1251 | ProjectTreeController.addFilters | train | private void addFilters(MpxjTreeNode parentNode, List<Filter> filters)
{
for (Filter field : filters)
{
final Filter f = field;
MpxjTreeNode childNode = new MpxjTreeNode(field)
{
@Override public String toString()
{
return f.getName();
}
};
parentNode.add(childNode);
}
} | java | {
"resource": ""
} |
q1252 | ProjectTreeController.addAssignments | train | private void addAssignments(MpxjTreeNode parentNode, ProjectFile file)
{
for (ResourceAssignment assignment : file.getResourceAssignments())
{
final ResourceAssignment a = assignment;
MpxjTreeNode childNode = new MpxjTreeNode(a)
{
@Override public String toString()
{
Resource resource = a.getResource();
String resourceName = resource == null ? "(unknown resource)" : resource.getName();
Task task = a.getTask();
String taskName = task == null ? "(unknown task)" : task.getName();
return resourceName + "->" + taskName;
}
};
parentNode.add(childNode);
}
} | java | {
"resource": ""
} |
q1253 | ProjectTreeController.saveFile | train | public void saveFile(File file, String type)
{
try
{
Class<? extends ProjectWriter> fileClass = WRITER_MAP.get(type);
if (fileClass == null)
{
throw new IllegalArgumentException("Cannot write files of type: " + type);
}
ProjectWriter writer = fileClass.newInstance();
writer.write(m_projectFile, file);
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
} | java | {
"resource": ""
} |
q1254 | ProjectTreeController.excludedMethods | train | private static Set<String> excludedMethods(String... methodNames)
{
Set<String> set = new HashSet<String>(MpxjTreeNode.DEFAULT_EXCLUDED_METHODS);
set.addAll(Arrays.asList(methodNames));
return set;
} | java | {
"resource": ""
} |
q1255 | FixedLengthInputStream.close | train | @Override public void close() throws IOException
{
long skippedLast = 0;
if (m_remaining > 0)
{
skippedLast = skip(m_remaining);
while (m_remaining > 0 && skippedLast > 0)
{
skippedLast = skip(m_remaining);
}
}
} | java | {
"resource": ""
} |
q1256 | LocaleUtility.setLocale | train | public static void setLocale(ProjectProperties properties, Locale locale)
{
properties.setMpxDelimiter(LocaleData.getChar(locale, LocaleData.FILE_DELIMITER));
properties.setMpxProgramName(LocaleData.getString(locale, LocaleData.PROGRAM_NAME));
properties.setMpxCodePage((CodePage) LocaleData.getObject(locale, LocaleData.CODE_PAGE));
properties.setCurrencySymbol(LocaleData.getString(locale, LocaleData.CURRENCY_SYMBOL));
properties.setSymbolPosition((CurrencySymbolPosition) LocaleData.getObject(locale, LocaleData.CURRENCY_SYMBOL_POSITION));
properties.setCurrencyDigits(LocaleData.getInteger(locale, LocaleData.CURRENCY_DIGITS));
properties.setThousandsSeparator(LocaleData.getChar(locale, LocaleData.CURRENCY_THOUSANDS_SEPARATOR));
properties.setDecimalSeparator(LocaleData.getChar(locale, LocaleData.CURRENCY_DECIMAL_SEPARATOR));
properties.setDateOrder((DateOrder) LocaleData.getObject(locale, LocaleData.DATE_ORDER));
properties.setTimeFormat((ProjectTimeFormat) LocaleData.getObject(locale, LocaleData.TIME_FORMAT));
properties.setDefaultStartTime(DateHelper.getTimeFromMinutesPastMidnight(LocaleData.getInteger(locale, LocaleData.DEFAULT_START_TIME)));
properties.setDateSeparator(LocaleData.getChar(locale, LocaleData.DATE_SEPARATOR));
properties.setTimeSeparator(LocaleData.getChar(locale, LocaleData.TIME_SEPARATOR));
properties.setAMText(LocaleData.getString(locale, LocaleData.AM_TEXT));
properties.setPMText(LocaleData.getString(locale, LocaleData.PM_TEXT));
properties.setDateFormat((ProjectDateFormat) LocaleData.getObject(locale, LocaleData.DATE_FORMAT));
properties.setBarTextDateFormat((ProjectDateFormat) LocaleData.getObject(locale, LocaleData.DATE_FORMAT));
} | java | {
"resource": ""
} |
q1257 | Column.getTitle | train | public String getTitle(Locale locale)
{
String result = null;
if (m_title != null)
{
result = m_title;
}
else
{
if (m_fieldType != null)
{
result = m_project.getCustomFields().getCustomField(m_fieldType).getAlias();
if (result == null)
{
result = m_fieldType.getName(locale);
}
}
}
return (result);
} | java | {
"resource": ""
} |
q1258 | AccrueTypeUtility.getInstance | train | public static AccrueType getInstance(String type, Locale locale)
{
AccrueType result = null;
String[] typeNames = LocaleData.getStringArray(locale, LocaleData.ACCRUE_TYPES);
for (int loop = 0; loop < typeNames.length; loop++)
{
if (typeNames[loop].equalsIgnoreCase(type) == true)
{
result = AccrueType.getInstance(loop + 1);
break;
}
}
if (result == null)
{
result = AccrueType.PRORATED;
}
return (result);
} | java | {
"resource": ""
} |
q1259 | DataExportUtility.process | train | public void process(Connection connection, String directory) throws Exception
{
connection.setAutoCommit(true);
//
// Retrieve meta data about the connection
//
DatabaseMetaData dmd = connection.getMetaData();
String[] types =
{
"TABLE"
};
FileWriter fw = new FileWriter(directory);
PrintWriter pw = new PrintWriter(fw);
pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
pw.println();
pw.println("<database>");
ResultSet tables = dmd.getTables(null, null, null, types);
while (tables.next() == true)
{
processTable(pw, connection, tables.getString("TABLE_NAME"));
}
pw.println("</database>");
pw.close();
tables.close();
} | java | {
"resource": ""
} |
q1260 | DataExportUtility.escapeText | train | private String escapeText(StringBuilder sb, String text)
{
int length = text.length();
char c;
sb.setLength(0);
for (int loop = 0; loop < length; loop++)
{
c = text.charAt(loop);
switch (c)
{
case '<':
{
sb.append("<");
break;
}
case '>':
{
sb.append(">");
break;
}
case '&':
{
sb.append("&");
break;
}
default:
{
if (validXMLCharacter(c))
{
if (c > 127)
{
sb.append("&#" + (int) c + ";");
}
else
{
sb.append(c);
}
}
break;
}
}
}
return (sb.toString());
} | java | {
"resource": ""
} |
q1261 | SDEFmethods.rset | train | public static String rset(String input, int width)
{
String result; // result to return
StringBuilder pad = new StringBuilder();
if (input == null)
{
for (int i = 0; i < width - 1; i++)
{
pad.append(' '); // put blanks into buffer
}
result = " " + pad; // one short to use + overload
}
else
{
if (input.length() >= width)
{
result = input.substring(0, width); // when input is too long, truncate
}
else
{
int padLength = width - input.length(); // number of blanks to add
for (int i = 0; i < padLength; i++)
{
pad.append(' '); // actually put blanks into buffer
}
result = pad + input; // concatenate
}
}
return result;
} | java | {
"resource": ""
} |
q1262 | SDEFmethods.workDays | train | public static String workDays(ProjectCalendar input)
{
StringBuilder result = new StringBuilder();
DayType[] test = input.getDays(); // get the array from MPXJ ProjectCalendar
for (DayType i : test)
{ // go through every day in the given array
if (i == DayType.NON_WORKING)
{
result.append("N"); // only put N for non-working day of the week
}
else
{
result.append("Y"); // Assume WORKING day unless NON_WORKING
}
}
return result.toString(); // According to USACE specs., exceptions will be specified in HOLI records
} | java | {
"resource": ""
} |
q1263 | InputStreamHelper.writeStreamToTempFile | train | public static File writeStreamToTempFile(InputStream inputStream, String tempFileSuffix) throws IOException
{
FileOutputStream outputStream = null;
try
{
File file = File.createTempFile("mpxj", tempFileSuffix);
outputStream = new FileOutputStream(file);
byte[] buffer = new byte[1024];
while (true)
{
int bytesRead = inputStream.read(buffer);
if (bytesRead == -1)
{
break;
}
outputStream.write(buffer, 0, bytesRead);
}
return file;
}
finally
{
if (outputStream != null)
{
outputStream.close();
}
}
} | java | {
"resource": ""
} |
q1264 | Record.getRecord | train | public static Record getRecord(String text)
{
Record root;
try
{
root = new Record(text);
}
//
// I've come across invalid calendar data in an otherwise fine Primavera
// database belonging to a customer. We deal with this gracefully here
// rather than propagating an exception.
//
catch (Exception ex)
{
root = null;
}
return root;
} | java | {
"resource": ""
} |
q1265 | Record.getChild | train | public Record getChild(String key)
{
Record result = null;
if (key != null)
{
for (Record record : m_records)
{
if (key.equals(record.getField()))
{
result = record;
break;
}
}
}
return result;
} | java | {
"resource": ""
} |
q1266 | Record.getClosingParenthesisPosition | train | private int getClosingParenthesisPosition(String text, int opening)
{
if (text.charAt(opening) != '(')
{
return -1;
}
int count = 0;
for (int i = opening; i < text.length(); i++)
{
char c = text.charAt(i);
switch (c)
{
case '(':
{
++count;
break;
}
case ')':
{
--count;
if (count == 0)
{
return i;
}
break;
}
}
}
return -1;
} | java | {
"resource": ""
} |
q1267 | FastTrackUtility.getLong | train | public static final long getLong(byte[] data, int offset)
{
if (data.length != 8)
{
throw new UnexpectedStructureException();
}
long result = 0;
int i = offset;
for (int shiftBy = 0; shiftBy < 64; shiftBy += 8)
{
result |= ((long) (data[i] & 0xff)) << shiftBy;
++i;
}
return result;
} | java | {
"resource": ""
} |
q1268 | FastTrackUtility.getTimeUnit | train | public static final TimeUnit getTimeUnit(int value)
{
TimeUnit result = null;
switch (value)
{
case 1:
{
// Appears to mean "use the document format"
result = TimeUnit.ELAPSED_DAYS;
break;
}
case 2:
{
result = TimeUnit.HOURS;
break;
}
case 4:
{
result = TimeUnit.DAYS;
break;
}
case 6:
{
result = TimeUnit.WEEKS;
break;
}
case 8:
case 10:
{
result = TimeUnit.MONTHS;
break;
}
case 12:
{
result = TimeUnit.YEARS;
break;
}
default:
{
break;
}
}
return result;
} | java | {
"resource": ""
} |
q1269 | FastTrackUtility.skipToNextMatchingShort | train | public static int skipToNextMatchingShort(byte[] buffer, int offset, int value)
{
int nextOffset = offset;
while (getShort(buffer, nextOffset) != value)
{
++nextOffset;
}
nextOffset += 2;
return nextOffset;
} | java | {
"resource": ""
} |
q1270 | FastTrackUtility.hexdump | train | public static final String hexdump(byte[] buffer, int offset, int length, boolean ascii, int columns, String prefix)
{
StringBuilder sb = new StringBuilder();
if (buffer != null)
{
int index = offset;
DecimalFormat df = new DecimalFormat("00000");
while (index < (offset + length))
{
if (index + columns > (offset + length))
{
columns = (offset + length) - index;
}
sb.append(prefix);
sb.append(df.format(index - offset));
sb.append(":");
sb.append(hexdump(buffer, index, columns, ascii));
sb.append('\n');
index += columns;
}
}
return (sb.toString());
} | java | {
"resource": ""
} |
q1271 | Task.generateWBS | train | public void generateWBS(Task parent)
{
String wbs;
if (parent == null)
{
if (NumberHelper.getInt(getUniqueID()) == 0)
{
wbs = "0";
}
else
{
wbs = Integer.toString(getParentFile().getChildTasks().size() + 1);
}
}
else
{
wbs = parent.getWBS();
//
// Apparently I added the next lines to support MPX files generated by Artemis, back in 2005
// Unfortunately I have no test data which exercises this code, and it now breaks
// otherwise valid WBS values read (in this case) from XER files. So it's commented out
// until someone complains about their 2005-era Artemis MPX files not working!
//
// int index = wbs.lastIndexOf(".0");
// if (index != -1)
// {
// wbs = wbs.substring(0, index);
// }
int childTaskCount = parent.getChildTasks().size() + 1;
if (wbs.equals("0"))
{
wbs = Integer.toString(childTaskCount);
}
else
{
wbs += ("." + childTaskCount);
}
}
setWBS(wbs);
} | java | {
"resource": ""
} |
q1272 | Task.generateOutlineNumber | train | public void generateOutlineNumber(Task parent)
{
String outline;
if (parent == null)
{
if (NumberHelper.getInt(getUniqueID()) == 0)
{
outline = "0";
}
else
{
outline = Integer.toString(getParentFile().getChildTasks().size() + 1);
}
}
else
{
outline = parent.getOutlineNumber();
int index = outline.lastIndexOf(".0");
if (index != -1)
{
outline = outline.substring(0, index);
}
int childTaskCount = parent.getChildTasks().size() + 1;
if (outline.equals("0"))
{
outline = Integer.toString(childTaskCount);
}
else
{
outline += ("." + childTaskCount);
}
}
setOutlineNumber(outline);
} | java | {
"resource": ""
} |
q1273 | Task.addTask | train | @Override public Task addTask()
{
ProjectFile parent = getParentFile();
Task task = new Task(parent, this);
m_children.add(task);
parent.getTasks().add(task);
setSummary(true);
return (task);
} | java | {
"resource": ""
} |
q1274 | Task.addChildTask | train | public void addChildTask(Task child, int childOutlineLevel)
{
int outlineLevel = NumberHelper.getInt(getOutlineLevel());
if ((outlineLevel + 1) == childOutlineLevel)
{
m_children.add(child);
setSummary(true);
}
else
{
if (m_children.isEmpty() == false)
{
(m_children.get(m_children.size() - 1)).addChildTask(child, childOutlineLevel);
}
}
} | java | {
"resource": ""
} |
q1275 | Task.addChildTask | train | public void addChildTask(Task child)
{
child.m_parent = this;
m_children.add(child);
setSummary(true);
if (getParentFile().getProjectConfig().getAutoOutlineLevel() == true)
{
child.setOutlineLevel(Integer.valueOf(NumberHelper.getInt(getOutlineLevel()) + 1));
}
} | java | {
"resource": ""
} |
q1276 | Task.addChildTaskBefore | train | public void addChildTaskBefore(Task child, Task previousSibling)
{
int index = m_children.indexOf(previousSibling);
if (index == -1)
{
m_children.add(child);
}
else
{
m_children.add(index, child);
}
child.m_parent = this;
setSummary(true);
if (getParentFile().getProjectConfig().getAutoOutlineLevel() == true)
{
child.setOutlineLevel(Integer.valueOf(NumberHelper.getInt(getOutlineLevel()) + 1));
}
} | java | {
"resource": ""
} |
q1277 | Task.removeChildTask | train | public void removeChildTask(Task child)
{
if (m_children.remove(child))
{
child.m_parent = null;
}
setSummary(!m_children.isEmpty());
} | java | {
"resource": ""
} |
q1278 | Task.addResourceAssignment | train | public ResourceAssignment addResourceAssignment(Resource resource)
{
ResourceAssignment assignment = getExistingResourceAssignment(resource);
if (assignment == null)
{
assignment = new ResourceAssignment(getParentFile(), this);
m_assignments.add(assignment);
getParentFile().getResourceAssignments().add(assignment);
assignment.setTaskUniqueID(getUniqueID());
assignment.setWork(getDuration());
assignment.setUnits(ResourceAssignment.DEFAULT_UNITS);
if (resource != null)
{
assignment.setResourceUniqueID(resource.getUniqueID());
resource.addResourceAssignment(assignment);
}
}
return (assignment);
} | java | {
"resource": ""
} |
q1279 | Task.addResourceAssignment | train | public void addResourceAssignment(ResourceAssignment assignment)
{
if (getExistingResourceAssignment(assignment.getResource()) == null)
{
m_assignments.add(assignment);
getParentFile().getResourceAssignments().add(assignment);
Resource resource = assignment.getResource();
if (resource != null)
{
resource.addResourceAssignment(assignment);
}
}
} | java | {
"resource": ""
} |
q1280 | Task.getExistingResourceAssignment | train | private ResourceAssignment getExistingResourceAssignment(Resource resource)
{
ResourceAssignment assignment = null;
Integer resourceUniqueID = null;
if (resource != null)
{
Iterator<ResourceAssignment> iter = m_assignments.iterator();
resourceUniqueID = resource.getUniqueID();
while (iter.hasNext() == true)
{
assignment = iter.next();
Integer uniqueID = assignment.getResourceUniqueID();
if (uniqueID != null && uniqueID.equals(resourceUniqueID) == true)
{
break;
}
assignment = null;
}
}
return assignment;
} | java | {
"resource": ""
} |
q1281 | Task.addPredecessor | train | @SuppressWarnings("unchecked") public Relation addPredecessor(Task targetTask, RelationType type, Duration lag)
{
//
// Ensure that we have a valid lag duration
//
if (lag == null)
{
lag = Duration.getInstance(0, TimeUnit.DAYS);
}
//
// Retrieve the list of predecessors
//
List<Relation> predecessorList = (List<Relation>) getCachedValue(TaskField.PREDECESSORS);
//
// Ensure that there is only one predecessor relationship between
// these two tasks.
//
Relation predecessorRelation = null;
Iterator<Relation> iter = predecessorList.iterator();
while (iter.hasNext() == true)
{
predecessorRelation = iter.next();
if (predecessorRelation.getTargetTask() == targetTask)
{
if (predecessorRelation.getType() != type || predecessorRelation.getLag().compareTo(lag) != 0)
{
predecessorRelation = null;
}
break;
}
predecessorRelation = null;
}
//
// If necessary, create a new predecessor relationship
//
if (predecessorRelation == null)
{
predecessorRelation = new Relation(this, targetTask, type, lag);
predecessorList.add(predecessorRelation);
}
//
// Retrieve the list of successors
//
List<Relation> successorList = (List<Relation>) targetTask.getCachedValue(TaskField.SUCCESSORS);
//
// Ensure that there is only one successor relationship between
// these two tasks.
//
Relation successorRelation = null;
iter = successorList.iterator();
while (iter.hasNext() == true)
{
successorRelation = iter.next();
if (successorRelation.getTargetTask() == this)
{
if (successorRelation.getType() != type || successorRelation.getLag().compareTo(lag) != 0)
{
successorRelation = null;
}
break;
}
successorRelation = null;
}
//
// If necessary, create a new successor relationship
//
if (successorRelation == null)
{
successorRelation = new Relation(targetTask, this, type, lag);
successorList.add(successorRelation);
}
return (predecessorRelation);
} | java | {
"resource": ""
} |
q1282 | Task.setID | train | @Override public void setID(Integer val)
{
ProjectFile parent = getParentFile();
Integer previous = getID();
if (previous != null)
{
parent.getTasks().unmapID(previous);
}
parent.getTasks().mapID(val, this);
set(TaskField.ID, val);
} | java | {
"resource": ""
} |
q1283 | Task.getBaselineDuration | train | public Duration getBaselineDuration()
{
Object result = getCachedValue(TaskField.BASELINE_DURATION);
if (result == null)
{
result = getCachedValue(TaskField.BASELINE_ESTIMATED_DURATION);
}
if (!(result instanceof Duration))
{
result = null;
}
return (Duration) result;
} | java | {
"resource": ""
} |
q1284 | Task.getBaselineDurationText | train | public String getBaselineDurationText()
{
Object result = getCachedValue(TaskField.BASELINE_DURATION);
if (result == null)
{
result = getCachedValue(TaskField.BASELINE_ESTIMATED_DURATION);
}
if (!(result instanceof String))
{
result = null;
}
return (String) result;
} | java | {
"resource": ""
} |
q1285 | Task.getBaselineFinish | train | public Date getBaselineFinish()
{
Object result = getCachedValue(TaskField.BASELINE_FINISH);
if (result == null)
{
result = getCachedValue(TaskField.BASELINE_ESTIMATED_FINISH);
}
if (!(result instanceof Date))
{
result = null;
}
return (Date) result;
} | java | {
"resource": ""
} |
q1286 | Task.getBaselineStart | train | public Date getBaselineStart()
{
Object result = getCachedValue(TaskField.BASELINE_START);
if (result == null)
{
result = getCachedValue(TaskField.BASELINE_ESTIMATED_START);
}
if (!(result instanceof Date))
{
result = null;
}
return (Date) result;
} | java | {
"resource": ""
} |
q1287 | Task.getCostVariance | train | public Number getCostVariance()
{
Number variance = (Number) getCachedValue(TaskField.COST_VARIANCE);
if (variance == null)
{
Number cost = getCost();
Number baselineCost = getBaselineCost();
if (cost != null && baselineCost != null)
{
variance = NumberHelper.getDouble(cost.doubleValue() - baselineCost.doubleValue());
set(TaskField.COST_VARIANCE, variance);
}
}
return (variance);
} | java | {
"resource": ""
} |
q1288 | Task.getCritical | train | public boolean getCritical()
{
Boolean critical = (Boolean) getCachedValue(TaskField.CRITICAL);
if (critical == null)
{
Duration totalSlack = getTotalSlack();
ProjectProperties props = getParentFile().getProjectProperties();
int criticalSlackLimit = NumberHelper.getInt(props.getCriticalSlackLimit());
if (criticalSlackLimit != 0 && totalSlack.getDuration() != 0 && totalSlack.getUnits() != TimeUnit.DAYS)
{
totalSlack = totalSlack.convertUnits(TimeUnit.DAYS, props);
}
critical = Boolean.valueOf(totalSlack.getDuration() <= criticalSlackLimit && NumberHelper.getInt(getPercentageComplete()) != 100 && ((getTaskMode() == TaskMode.AUTO_SCHEDULED) || (getDurationText() == null && getStartText() == null && getFinishText() == null)));
set(TaskField.CRITICAL, critical);
}
return (BooleanHelper.getBoolean(critical));
} | java | {
"resource": ""
} |
q1289 | Task.setOutlineCode | train | public void setOutlineCode(int index, String value)
{
set(selectField(TaskFieldLists.CUSTOM_OUTLINE_CODE, index), value);
} | java | {
"resource": ""
} |
q1290 | Task.getTotalSlack | train | public Duration getTotalSlack()
{
Duration totalSlack = (Duration) getCachedValue(TaskField.TOTAL_SLACK);
if (totalSlack == null)
{
Duration duration = getDuration();
if (duration == null)
{
duration = Duration.getInstance(0, TimeUnit.DAYS);
}
TimeUnit units = duration.getUnits();
Duration startSlack = getStartSlack();
if (startSlack == null)
{
startSlack = Duration.getInstance(0, units);
}
else
{
if (startSlack.getUnits() != units)
{
startSlack = startSlack.convertUnits(units, getParentFile().getProjectProperties());
}
}
Duration finishSlack = getFinishSlack();
if (finishSlack == null)
{
finishSlack = Duration.getInstance(0, units);
}
else
{
if (finishSlack.getUnits() != units)
{
finishSlack = finishSlack.convertUnits(units, getParentFile().getProjectProperties());
}
}
double startSlackDuration = startSlack.getDuration();
double finishSlackDuration = finishSlack.getDuration();
if (startSlackDuration == 0 || finishSlackDuration == 0)
{
if (startSlackDuration != 0)
{
totalSlack = startSlack;
}
else
{
totalSlack = finishSlack;
}
}
else
{
if (startSlackDuration < finishSlackDuration)
{
totalSlack = startSlack;
}
else
{
totalSlack = finishSlack;
}
}
set(TaskField.TOTAL_SLACK, totalSlack);
}
return (totalSlack);
} | java | {
"resource": ""
} |
q1291 | Task.setCalendar | train | public void setCalendar(ProjectCalendar calendar)
{
set(TaskField.CALENDAR, calendar);
setCalendarUniqueID(calendar == null ? null : calendar.getUniqueID());
} | java | {
"resource": ""
} |
q1292 | Task.getStartSlack | train | public Duration getStartSlack()
{
Duration startSlack = (Duration) getCachedValue(TaskField.START_SLACK);
if (startSlack == null)
{
Duration duration = getDuration();
if (duration != null)
{
startSlack = DateHelper.getVariance(this, getEarlyStart(), getLateStart(), duration.getUnits());
set(TaskField.START_SLACK, startSlack);
}
}
return (startSlack);
} | java | {
"resource": ""
} |
q1293 | Task.getFinishSlack | train | public Duration getFinishSlack()
{
Duration finishSlack = (Duration) getCachedValue(TaskField.FINISH_SLACK);
if (finishSlack == null)
{
Duration duration = getDuration();
if (duration != null)
{
finishSlack = DateHelper.getVariance(this, getEarlyFinish(), getLateFinish(), duration.getUnits());
set(TaskField.FINISH_SLACK, finishSlack);
}
}
return (finishSlack);
} | java | {
"resource": ""
} |
q1294 | Task.getFieldByAlias | train | public Object getFieldByAlias(String alias)
{
return getCachedValue(getParentFile().getCustomFields().getFieldByAlias(FieldTypeClass.TASK, alias));
} | java | {
"resource": ""
} |
q1295 | Task.setFieldByAlias | train | public void setFieldByAlias(String alias, Object value)
{
set(getParentFile().getCustomFields().getFieldByAlias(FieldTypeClass.TASK, alias), value);
} | java | {
"resource": ""
} |
q1296 | Task.getEnterpriseFlag | train | public boolean getEnterpriseFlag(int index)
{
return (BooleanHelper.getBoolean((Boolean) getCachedValue(selectField(TaskFieldLists.ENTERPRISE_FLAG, index))));
} | java | {
"resource": ""
} |
q1297 | Task.getBaselineDurationText | train | public String getBaselineDurationText(int baselineNumber)
{
Object result = getCachedValue(selectField(TaskFieldLists.BASELINE_DURATIONS, baselineNumber));
if (result == null)
{
result = getCachedValue(selectField(TaskFieldLists.BASELINE_ESTIMATED_DURATIONS, baselineNumber));
}
if (!(result instanceof String))
{
result = null;
}
return (String) result;
} | java | {
"resource": ""
} |
q1298 | Task.setBaselineDurationText | train | public void setBaselineDurationText(int baselineNumber, String value)
{
set(selectField(TaskFieldLists.BASELINE_DURATIONS, baselineNumber), value);
} | java | {
"resource": ""
} |
q1299 | Task.setBaselineFinishText | train | public void setBaselineFinishText(int baselineNumber, String value)
{
set(selectField(TaskFieldLists.BASELINE_FINISHES, baselineNumber), value);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.