Examples of LinkedListNode


Examples of CtCILibrary.LinkedListNode

    int k = 10;
   
    // Create linked list
    LinkedListNode[] nodes = new LinkedListNode[list_length];
    for (int i = 0; i < list_length; i++) {
      nodes[i] = new LinkedListNode(i, null, i > 0 ? nodes[i - 1] : null);
    }
   
    // Create loop;
    nodes[list_length - 1].next = nodes[list_length - k];
   
    LinkedListNode loop = FindBeginning(nodes[0]);
    if (loop == null) {
      System.out.println("No Cycle.");
    } else {
      System.out.println(loop.data);
    }

Examples of CtCILibrary.LinkedListNode

  public static boolean deleteNode(LinkedListNode n) {
    if (n == null || n.next == null) {
      return false; // Failure
    }
    LinkedListNode next = n.next;
    n.data = next.data;
    n.next = next.next;
    return true;
  }

Examples of CtCILibrary.LinkedListNode

    n.next = next.next;
    return true;
  }
 
  public static void main(String[] args) {
    LinkedListNode head = AssortedMethods.randomLinkedList(10, 0, 10);
    System.out.println(head.printForward());
    deleteNode(head.next.next.next.next); // delete node 4
    System.out.println(head.printForward());
  }

Examples of CtCILibrary.LinkedListNode

    }
  }
 
  public boolean isPalindrome(LinkedListNode head) {
    int size = 0;
    LinkedListNode n = head;
    while (n != null) {
      size++;
      n = n.next;
    }
    Result p = isPalindromeRecurse(head, size);

Examples of CtCILibrary.LinkedListNode

 
  public static void main(String[] args) {
    int length = 10;
    LinkedListNode[] nodes = new LinkedListNode[length];
    for (int i = 0; i < length; i++) {
      nodes[i] = new LinkedListNode(i >= length / 2 ? length - i - 1 : i, null, null);
    }
   
    for (int i = 0; i < length; i++) {
      if (i < length - 1) {
        nodes[i].setNext(nodes[i + 1]);
      }
      if (i > 0) {
        nodes[i].setPrevious(nodes[i - 1]);
      }
    }
    // nodes[length - 2].data = 9; // Uncomment to ruin palindrome
   
    LinkedListNode head = nodes[0];
    System.out.println(head.printForward());
    Question q = new Question();
    System.out.println(q.isPalindrome(head));
  }

Examples of org.drools.core.util.LinkedListNode

        return beliefSystem;
    }

    @Override
    public InternalFactHandle getFactHandle() {
        LinkedListNode node = getFirst();
        SimpleLogicalDependency ld = (SimpleLogicalDependency) ((LinkedListEntry) node).getObject();
        return rootHandle;
    }

Examples of org.jivesoftware.util.LinkedListNode

        }
        cacheSize += objectSize;
        DefaultCache.CacheObject<V> cacheObject = new DefaultCache.CacheObject<V>(value, objectSize);
        map.put(key, cacheObject);
        // Make an entry into the cache order list.
        LinkedListNode lastAccessedNode = lastAccessedList.addFirst(key);
        // Store the cache order list entry so that we can get back to it
        // during later lookups.
        cacheObject.lastAccessedListNode = lastAccessedNode;
        // Add the object to the age list
        LinkedListNode ageNode = ageList.addFirst(key);
        // We make an explicit call to currentTimeMillis() so that total accuracy
        // of lifetime calculations is better than one second.
        ageNode.timestamp = System.currentTimeMillis();
        cacheObject.ageListNode = ageNode;

Examples of org.jivesoftware.util.LinkedListNode

        // Remove all old entries. To do this, we remove objects from the end
        // of the linked list until they are no longer too old. We get to avoid
        // any hash lookups or looking at any more objects than is strictly
        // neccessary.
        LinkedListNode node = ageList.getLast();
        // If there are no entries in the age list, return.
        if (node == null) {
            return;
        }

Examples of org.nemesis.forum.util.LinkedListNode

    }
    size += objectSize;
    CacheObject cacheObject = new CacheObject(object, objectSize);
    cachedObjectsHash.put(key, cacheObject);
    //Make an entry into the cache order list.
    LinkedListNode lastAccessedNode = lastAccessedList.addFirst(key);
    //Store the cache order list entry so that we can get back to it
    //during later lookups.
    cacheObject.lastAccessedListNode = lastAccessedNode;
    //Add the object to the age list
    LinkedListNode ageNode = ageList.addFirst(key);
    //We make an explicit call to currentTimeMillis() so that total accuracy
    //of lifetime calculations is better than one second.
    ageNode.timestamp = System.currentTimeMillis();
    cacheObject.ageListNode = ageNode;

Examples of org.nemesis.forum.util.LinkedListNode

    //Remove all old entries. To do this, we remove objects from the end
    //of the linked list until they are no longer too old. We get to avoid
    //any hash lookups or looking at any more objects than is strictly
    //neccessary.
    LinkedListNode node = ageList.getLast();
    //If there are no entries in the age list, return.
    if (node == null) {
      return;
    }
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.