class ReaderTGFF {

	protected void importMappings(String name, Iterator<String> it, ResourceTypes<Resource> resourceTypes,
			Mappings<Task, Resource> mappings) {

		// create resource (type)
		String id = "r" + name.split(SEPARATOR)[1];
		Resource res = resourceTypes.get(id);

		// skip resource type information (already imported in
		// toResourceTypes())
		while (skip(it.next())) {
		}

		// create mappings
		String line;
		List<String> attributes = new LinkedList<String>();

		while (!isClosing((line = it.next()))) {

			// extract attributes of resource type
			if (line.contains(TYPE)) {
				attributes = new LinkedList<String>(Arrays.asList(line.replace(COMMENT, "").trim().split(SEPARATOR)));
			}
			// extract values for each attribute
			else if (!isComment(line) && line.length() > 0) {

				String[] values = line.trim().split(SEPARATOR);

				assert values.length == attributes.size() : "tgff-file \"" + CORE + "\": number of values is not "
						+ "equal to required number of attributes";

				String tgffType = values[0];

				// only add mappings to valid resource type
				boolean validMapping = false;

				if (attributes.contains(VALID)) {
					validMapping = values[attributes.indexOf(VALID)].equals("1") ? true : false;
				}

				// if tasks exist that can be mapped to current resource type
				if (validMapping && tgffTypeMap.containsKey(tgffType)) {

					for (Task task : tgffTypeMap.get(tgffType)) {
						String mappingID = "m" + CONNECTOR + task.getId() + CONNECTOR + res.getId();
						Mapping<Task, Resource> mapping = new Mapping<Task, Resource>(mappingID, task, res);

						// annotate extracted attributes and values
						for (int i = 0; i < values.length; i++) {
							mapping.setAttribute(attributes.get(i), Double.valueOf(values[i]));
						}
						mappings.add(mapping);
					}
				}
			}
		}
	}

}