class InstructionSequence {

	public static List<InstructionSequence> getInstSeqs(FileBitPatternInfoReader fsReader,
			PatternType type, ContextRegisterFilter regFilter) {
		List<InstructionSequence> instSeqs = new ArrayList<InstructionSequence>();
		for (FunctionBitPatternInfo fInfo : fsReader.getFInfoList()) {
			if (regFilter != null && !regFilter.allows(fInfo.getContextRegisters())) {
				continue;
			}
			switch (type) {
				case FIRST:
					InstructionSequence currentSeq = fInfo.getFirstInst();
					if (currentSeq.getInstructions()[0] != null &&
						(fInfo.getFirstBytes() != null)) {
						instSeqs.add(currentSeq);
					}
					break;
				case PRE:
					currentSeq = fInfo.getPreInst();
					//In some cases, bytes can be null while instructions are not
					//happens when you asked for more bytes than were available
					//TODO: verify that this is still an issue
					if (currentSeq.getInstructions()[0] != null && (fInfo.getPreBytes() != null)) {
						instSeqs.add(currentSeq);
					}
					break;
				case RETURN:
					List<InstructionSequence> currentSeqs = fInfo.getReturnInst();
					List<String> currentBytes = fInfo.getReturnBytes();
					if (currentSeqs.size() != currentBytes.size()) {
						continue;
					}
					for (int i = 0, numSeqs = currentSeqs.size(); i < numSeqs; ++i) {
						if (currentSeqs.get(i)
							.getInstructions()[0] != null && currentBytes.get(i)
								.getBytes() != null) {
							instSeqs.add(currentSeqs.get(i));
						}
					}
					break;
				default:
					throw new IllegalArgumentException(
						"unsupported instruction type: " + type.name());
			}
		}
		return instSeqs;
	}

	public  InstructionSequence();
	public  InstructionSequence(int length);

}