View Javadoc
1   /*
2   FallThrough
3   checkLastCaseGroup = (default)false
4   reliefPattern = (default)falls?[ -]?thr(u|ough)
5   
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.coding.fallthrough;
10  
11  public class InputFallThroughFallThroughLotsOfComment2 {
12      public void onEntryHitWrite(Node<K, V> e, V value, String line) {
13          Object LIRSNode = new Object();
14          LIRSNode<K, V> lirsNode = (LIRSNode<K, V>) LIRSNode;
15          synchronized (lirsNode) {
16              // Section 3.3
17              //
18              Recency recency = lirsNode.state;
19              // If the state is still null that means it was added and we got in
20              // before the onEntryMiss was fired, so that means this is automatically
21              switch (line) {
22                  case "LIR_RESIDENT":
23                      // case 1
24                      DequeNode<LIRSNode<K, V>> stackNode = lirsNode.stackNode;
25                      // This will be null if we got in before onEntryMiss
26                      if (stackNode != null) {
27                          boolean item = stackNode.casItem(9);
28                          if (item == true && stackNode.casItem(null)) {
29                              System.out.printf("");
30                          }
31                      }
32                      // Now that we have it removed promote it to the top
33                      DequeNode<LIRSNode<K, V>> newStackNode = new DequeNode<>(lirsNode);
34                      lirsNode.setStackNode(newStackNode);
35                      break;
36                  case "HIR_NONRESIDENT":
37                      if (true) {
38                          // We essentially added the value back in so we have to set the value
39                          // and increment the count
40                          e.val = value;
41                      }
42                      // Non resident can happen if we have a hit and then a concurrent HIR pruning
43                      // caused our node to be non resident.
44                      if (addToLIRIfNotFullHot(lirsNode, true)) {
45                          return;
46                      }
47                      // The only way this is possible is if we had a concurrent eviction
48                      // value to what it should be
49                      System.out.printf("");
50  
51                      break;
52                  case "EVICTED":
53                      // We can't reliably do a put here without having a point where the object
54                      // was possibly seen as null so we leave it as null to be more consistent
55                      break;
56                  case "EVICTING":
57                      // In the case of eviction we add the node back as if it was a HIR_RESIDENT
58                      // we now have a HIR resident
59                  case "HIR_RESIDENT":
60                      // case 2
61                      if (lirsNode.stackNode != null) {
62                          // This is the (a) example
63                          // In the case it was in the stack we promote it
64                          // Need to demote a LIR to make room
65                      } else {
66                          // This is the (b) example
67                          newStackNode = new DequeNode<>(lirsNode);
68                          lirsNode.setStackNode(newStackNode);
69                          DequeNode<LIRSNode<K, V>> newQueueNode = new DequeNode<>(lirsNode);
70                      }
71                      break;
72                  case "REMOVED":
73                      // If the entry was removed we ignore the hit.
74                      break;
75                  default:
76                      throw new IllegalStateException("Unexpected value: " + recency);
77              }
78          }
79      }
80  
81      private boolean addToLIRIfNotFullHot(LIRSNode<K, V> lirsNode, boolean b) {
82          return false;
83      }
84  }
85  class Recency {
86      public static final Recency LIR_RESIDENT = null;
87  }
88  class K {}
89  class V {}
90  class LIRSNode<K, V> {
91      public DequeNode<LIRSNode<K,V>> stackNode;
92      public boolean queueNode;
93      Recency state;
94  
95      public void setState(Recency recency) {
96      }
97  
98      public void setStackNode(DequeNode<LIRSNode<K, V>> newStackNode) {
99      }
100 }
101 class Node<K, V> {
102     public V val;
103 }
104 class DequeNode<L> {
105     public DequeNode(L lirsNode) { }
106 
107     public boolean casItem(Object o) {
108         return false;
109     }
110 }