if(remaining < endIndex) endIndex = (indexInTerm + remaining);
if((indexInTerm + remaining) < endIndex) endIndex = (indexInTerm + remaining);
	public void voidVisitAppl(ATermAppl arg) throws VisitFailure{		if(indexInTerm == 0){			byte header = getHeader(arg);			AFun fun = arg.getAFun();			String name = fun.getName();			int arity = arg.getArity();			boolean isQuoted = arg.isQuoted();			ApplSignature as = new ApplSignature();			as.name = name;			as.arity = arity;			as.isQuoted = isQuoted;			Integer key = applSignatures.get(as);			if(key == null){				if(isQuoted) header = (byte) (header | APPLQUOTED);				currentBuffer.put(header);				writeInt(arity);				int length = name.length();				writeInt(length);				int endIndex = length;				int remaining = currentBuffer.remaining();				if(remaining < endIndex) endIndex = remaining;				byte[] nameBytes = name.substring(0, endIndex).getBytes();				currentBuffer.put(nameBytes);				if(endIndex != length) indexInTerm = endIndex;				applSignatures.put(as, new Integer(sigKey++));			}else{				header = (byte) (header | APPLSIGNATURESHARED);				currentBuffer.put(header);				writeInt(key.intValue());			}		}else{			AFun fun = arg.getAFun();			String name = fun.getName();			int length = name.length();			int endIndex = length;			int remaining = currentBuffer.remaining();			if(remaining < endIndex) endIndex = (indexInTerm + remaining);			byte[] nameBytes = name.substring(indexInTerm, endIndex).getBytes();			currentBuffer.put(nameBytes);			indexInTerm = endIndex;			if(indexInTerm == length) indexInTerm = 0;		}	}