/* ---------------------------------------------------------------- // Function Name : removeAnnotation // Date Written : 03/04/2008 // Author : yogvinder // Input Parameters : // Output Parameters : None // Return Values : void // Description : // ---------------------------------------------------------------- */ public int removeAnnotation(String fileId) throws NGException { int counter = 0; Iterator itr = stampList.iterator(); while (itr.hasNext()) { Stamp stmp = (Stamp) itr.next(); if (fileId.equals(stmp.getFileName())) { itr.remove(); counter++; totalAnnotations--; noOfStamp--; } } return counter; }
/* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { if (stampList.size() > 0) { String input = "TotalAnnotations=" + totalAnnotations + "\n" + "NoOfStamp=" + noOfStamp + "\n"; for (int x = 0; x < stampList.size(); x++) { Stamp stmp = (Stamp) stampList.get(x); String tempInput = "[" + stmp.getStampName() + (x + 1) + "]" + "\n" + stmp.toStringPre() + (x + 1) + stmp.toStringPost(); input = input + tempInput + "\n\n"; } return input; } else { return ""; } }
/* ---------------------------------------------------------------- // Function Name : generateAnnotationBuffer // Date Written : 03/04/2008 // Author : yogvinder // Input Parameters : // Return Values : AnnotationBuffer // Description : generateAnnotationBuffer Implemented // ---------------------------------------------------------------- */ public static AnnotationBuffer generateAnnotationBuffer(String annotationBuffer) throws NGException { AnnotationBuffer aBuffer = new AnnotationBuffer(); String[] annotationBufferArray = annotationBuffer.split("[\\n\\r]+"); int length = annotationBufferArray.length; if (length > 0) { int counter = 0; aBuffer.setTotalAnnotations( Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++]))); aBuffer.setNoOfStamp(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++]))); int stamplength = length - 2; double d = stamplength / 14; int stampCounter = stamplength / 14; for (int x = 0; x < stampCounter; x++) { Stamp stamp = new Stamp(); stamp.setStampName(aBuffer.getVal1(annotationBufferArray[counter++])); stamp.setX1(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++]))); stamp.setY1(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++]))); stamp.setX2(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++]))); stamp.setY2(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++]))); stamp.setColor(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++]))); stamp.setTimeOrder(aBuffer.getVal(annotationBufferArray[counter++])); stamp.setMouseSensivity(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++]))); stamp.setAnnotationGroupID(aBuffer.getVal(annotationBufferArray[counter++])); stamp.setUserId(aBuffer.getVal(annotationBufferArray[counter++])); stamp.setRights(aBuffer.getVal(annotationBufferArray[counter++])); stamp.setType(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++]))); stamp.setFileName(aBuffer.getVal(annotationBufferArray[counter++])); stamp.setStampFileSource(aBuffer.getVal(annotationBufferArray[counter++])); aBuffer.add2StampList(stamp); } } return aBuffer; }