public static ProblemPart CreateProblemPart(Senseix.Message.Atom.Atom newAtom) { ProblemPart newProblemPart = new TextProblemPart(newAtom); bool actuallyConstructed = false; if (newAtom.type == Senseix.Message.Atom.Atom.Type.IMAGE) { newProblemPart = new ImageProblemPart(newAtom); actuallyConstructed = true; } if (newAtom.type == Senseix.Message.Atom.Atom.Type.TEXT) { newProblemPart = new TextProblemPart(newAtom); actuallyConstructed = true; } if (newAtom.type == Senseix.Message.Atom.Atom.Type.NUMBER) { newProblemPart = new NumberProblemPart(newAtom); actuallyConstructed = true; } if (!actuallyConstructed) { throw new Exception("I encountered an atom of an unimplemented type."); } return newProblemPart; }
public static ProblemPart CreateProblemPart(Senseix.Message.Atom.Atom newAtom) { ProblemPart newProblemPart = new TextProblemPart(newAtom); bool actuallyConstructed = false; if (newAtom.type == Senseix.Message.Atom.Atom.Type.IMAGE) { newProblemPart = new ImageProblemPart(newAtom); actuallyConstructed = true; } if (newAtom.type == Senseix.Message.Atom.Atom.Type.TEXT) { newProblemPart = new TextProblemPart(newAtom); actuallyConstructed = true; } if (newAtom.type == Senseix.Message.Atom.Atom.Type.NUMBER) { newProblemPart = new NumberProblemPart(newAtom); actuallyConstructed = true; } if (!actuallyConstructed) { throw new Exception("I encountered an atom of an unimplemented type."); } return(newProblemPart); }