org.jpedal.fonts.CCSV Maven / Gradle / Ivy
/*
* ===========================================
* Java Pdf Extraction Decoding Access Library
* ===========================================
*
* Project Info: http://www.idrsolutions.com
* Help section for developers at http://www.idrsolutions.com/support/
*
* (C) Copyright 1997-2017 IDRsolutions and Contributors.
*
* This file is part of JPedal/JPDF2HTML5
*
@LICENSE@
*
* ---------------
* ccsv.java
* ---------------
*/
package org.jpedal.fonts;
/**
* CID CHAR STRING VALIDATION
*/
public class CCSV {
String id;
int min;
boolean stackClearing;
boolean resetStack;
boolean undefStack;
boolean stem;
Integer stackDelta;
boolean hasFunction;
public CCSV(final String id, final int min, final boolean stackClearing, final boolean resetStack, final boolean undefStack, final boolean stem, final Integer stackDelta, final boolean hasFunction) {
this.id = id;
this.min = min;
this.stackClearing = stackClearing;
this.resetStack = resetStack;
this.undefStack = undefStack;
this.stem = stem;
this.stackDelta = stackDelta;
this.hasFunction = hasFunction;
}
@Override
public String toString() {
return "CCSV{" + "id=" + id + ", min=" + min + ", stackClearing="
+ stackClearing + ", resetStack=" + resetStack + ", undefStack="
+ undefStack + ", stem=" + stem + ", stackDelta=" + stackDelta
+ ", hasFunction=" + hasFunction + '}';
}
public void performFunction(final String id, final double[] stack, final int si) {
if (id.equals("add")) {
stack[si - 2] += stack[si - 1];
} else if (id.equals("sub")) {
stack[si - 2] -= stack[si - 1];
} else if (id.equals("div")) {
stack[si - 2] /= stack[si - 1];
} else if (id.equals("neg")) {
stack[si - 1] = -stack[si - 1];
} else if (id.equals("mul")) {
stack[si - 2] *= stack[si - 1];
}
}
}