1 /*
   2  * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.graalvm.compiler.nodeinfo;
  24 
  25 import java.lang.annotation.ElementType;
  26 import java.lang.annotation.Inherited;
  27 import java.lang.annotation.Retention;
  28 import java.lang.annotation.RetentionPolicy;
  29 import java.lang.annotation.Target;
  30 
  31 /**
  32  * Marker type for describing node inputs in snippets that are not of type {@link InputType#Value}.
  33  */
  34 public abstract class StructuralInput {
  35 
  36     private StructuralInput() {
  37         throw new Error("Illegal instance of StructuralInput. This class should be used in snippets only.");
  38     }
  39 
  40     @Retention(RetentionPolicy.RUNTIME)
  41     @Target(ElementType.TYPE)
  42     @Inherited
  43     public @interface MarkerType {
  44         InputType value();
  45     }
  46 
  47     /**
  48      * Marker type for {@link InputType#Memory} edges in snippets.
  49      */
  50     @MarkerType(InputType.Memory)
  51     public abstract static class Memory extends StructuralInput {
  52     }
  53 
  54     /**
  55      * Marker type for {@link InputType#Condition} edges in snippets.
  56      */
  57     @MarkerType(InputType.Condition)
  58     public abstract static class Condition extends StructuralInput {
  59     }
  60 
  61     /**
  62      * Marker type for {@link InputType#State} edges in snippets.
  63      */
  64     @MarkerType(InputType.State)
  65     public abstract static class State extends StructuralInput {
  66     }
  67 
  68     /**
  69      * Marker type for {@link InputType#Guard} edges in snippets.
  70      */
  71     @MarkerType(InputType.Guard)
  72     public abstract static class Guard extends StructuralInput {
  73     }
  74 
  75     /**
  76      * Marker type for {@link InputType#Anchor} edges in snippets.
  77      */
  78     @MarkerType(InputType.Anchor)
  79     public abstract static class Anchor extends StructuralInput {
  80     }
  81 
  82     /**
  83      * Marker type for {@link InputType#Association} edges in snippets.
  84      */
  85     @MarkerType(InputType.Association)
  86     public abstract static class Association extends StructuralInput {
  87     }
  88 
  89     /**
  90      * Marker type for {@link InputType#Extension} edges in snippets.
  91      */
  92     @MarkerType(InputType.Extension)
  93     public abstract static class Extension extends StructuralInput {
  94     }
  95 }