com.shapesecurity.shift.path.disabled.IndexedBranch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shift Show documentation
Show all versions of shift Show documentation
Shift format ECMAScript 6 AST tooling
///*
// * Copyright 2014 Shape Security, Inc.
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//
//package com.shapesecurity.shift.path.disabled;
//
//import com.shapesecurity.functional.data.ImmutableList;
//import com.shapesecurity.functional.data.NonEmptyImmutableList;
//import com.shapesecurity.shift.ast.ListNode;
//import com.shapesecurity.shift.ast.Node;
//import com.shapesecurity.shift.ast.NonEmptyListNode;
//
//import org.jetbrains.annotations.NotNull;
//import org.jetbrains.annotations.Nullable;
//
//public final class IndexedBranch implements Branch {
// public final int index;
// private final static IndexedBranch[] cache = new IndexedBranch[1024];
//
// private IndexedBranch(int index) {
// this.index = index;
// }
//
// @NotNull
// public static IndexedBranch from(int i) {
// if (i < 1024) {
// if (cache[i] == null) {
// synchronized (cache) {
// if (cache[i] == null) {
// cache[i] = new IndexedBranch(i);
// }
// }
// } else {
// return cache[i];
// }
// }
// return new IndexedBranch(i);
// }
//
// @Override
// public int hashCode() {
// return index;
// }
//
// @Override
// public boolean equals(Object obj) {
// return obj == this || obj instanceof IndexedBranch && ((IndexedBranch) obj).index == this.index;
// }
//
// @SuppressWarnings("unchecked")
// @Nullable
// @Override
// public Node view(@NotNull Node parent) {
// if (parent instanceof ListNode) {
// ListNode