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

com.github.rapidark.framework.thirdparty.asm.tree.LookupSwitchInsnNode Maven / Gradle / Ivy

The newest version!
package com.github.rapidark.framework.thirdparty.asm.tree;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.github.rapidark.framework.thirdparty.asm.Label;
import com.github.rapidark.framework.thirdparty.asm.MethodVisitor;

public class LookupSwitchInsnNode extends AbstractInsnNode {
	public List labels;
	public LabelNode dflt;
	public List keys;

	public LookupSwitchInsnNode(LabelNode dflt, int[] keys, LabelNode[] labels) {
		super(171);
		this.dflt = dflt;
		this.keys = new ArrayList(keys == null ? 0 : keys.length);
		this.labels = new ArrayList(labels == null ? 0 : labels.length);
		if (keys != null) {
			for (int i = 0; i < keys.length; i++) {
				this.keys.add(new Integer(keys[i]));
			}
		}
		if (labels != null) {
			this.labels.addAll(Arrays.asList(labels));
		}
	}

	public int getType() {
		return 12;
	}

	public void accept(MethodVisitor mv) {
		int[] keys = new int[this.keys.size()];
		for (int i = 0; i < keys.length; i++) {
			keys[i] = ((Integer) this.keys.get(i)).intValue();
		}
		Label[] labels = new Label[this.labels.size()];
		for (int i = 0; i < labels.length; i++) {
			labels[i] = ((LabelNode) this.labels.get(i)).getLabel();
		}
		mv.visitLookupSwitchInsn(this.dflt.getLabel(), keys, labels);
	}

	public AbstractInsnNode clone(Map labels) {
		LookupSwitchInsnNode clone = new LookupSwitchInsnNode(clone(this.dflt, labels), null, clone(this.labels, labels));
		clone.keys.addAll(this.keys);
		return clone;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy