All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openpdf.renderer.function.postscript.operation.Eq Maven / Gradle / Ivy

The newest version!
package org.openpdf.renderer.function.postscript.operation;

import java.util.Stack;


final class Eq implements PostScriptOperation {
	@Override
	/**
	 * any1 any2 eq bool 

* * pops two objects from the operand stack and pushes\ * true if they are equal, or false if not. * The definition of equality depends on the types of * the objects being compared. * Simple objects are equal if their types and values * are the same. Strings are equal if their lengths and * individual elements are equal. * Other composite objects * (arrays and dictionaries) are equal only if they share * the same value. Separate values are considered unequal, * even if all the components of those values are the * same. * This operator performs some type conversions. * Integers and real numbers can be compared freely: * an integer and a real number representing the same * mathematical value are considered equal by eq. * Strings and names can likewise be compared freely: * a name defined by some sequence of characters is equal * to a string whose elements are the same sequence of * characters. * The literal/executable and access attributes of * objects are not considered in comparisons * between objects.

* * errors: invalidaccess, stackunderflow */ public void eval(Stack environment) { Object b = environment.pop(); Object a = environment.pop(); environment.push(a.equals(b)); } }