private NameDescriptor createDescriptor(final String sname, final StructureOfIndices[] structuresOfIndices, int id) {
if (structuresOfIndices.length != 1)
return new NameDescriptorForTensorFieldImpl(sname, structuresOfIndices, id, sname.equals(diracDeltaName) && structuresOfIndices.length == 3);
final StructureOfIndices its = structuresOfIndices[0];
if (its.size() != 2)
return new NameDescriptorForSimpleTensor(sname, structuresOfIndices, id);
for (byte b = 0; b < IndexType.TYPES_COUNT; ++b)
if (its.typeCount(b) == 2) {
if (CC.isMetric(b)) {
if (sname.equals(kroneckerAndMetricNames[0]) || sname.equals(kroneckerAndMetricNames[1])) {
NameDescriptor descriptor = new NameDescriptorForMetricAndKronecker(kroneckerAndMetricNames, b, id);
descriptor.getSymmetries().add(b, false, 1, 0);
return descriptor;
}
} else {
if (sname.equals(kroneckerAndMetricNames[1]))
throw new ParserException("Metric is not specified for non metric index type.");
if (sname.equals(kroneckerAndMetricNames[0])) {
if (its.getTypeData(b).states.get(0) != true || its.getTypeData(b).states.get(1) != false)
throw new ParserException("Illegal Kroneckers indices states.");
NameDescriptor descriptor = new NameDescriptorForMetricAndKronecker(kroneckerAndMetricNames, b, id);
return descriptor;
}
}
}
return new NameDescriptorForSimpleTensor(sname, structuresOfIndices, id);
}