BrightSide Workbench Full Report + Source Code
org.turro.elephant.context.History Class Reference

Public Member Functions

void add (String path)
 
String get ()
 
String peek ()
 
String back ()
 

Static Public Member Functions

static void add (IConstructor constructor, String path)
 
static String get (IConstructor constructor)
 
static String peek (IConstructor constructor)
 
static String back (IConstructor constructor)
 
static String peekBack (IConstructor constructor)
 
static History getInstance (IConstructor constructor)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 30 of file History.java.

Member Function Documentation

◆ add() [1/2]

static void org.turro.elephant.context.History.add ( IConstructor  constructor,
String  path 
)
static

Definition at line 34 of file History.java.

34  {
35  getInstance(constructor).add(path);
36  }
static History getInstance(IConstructor constructor)
Definition: History.java:91
static void add(IConstructor constructor, String path)
Definition: History.java:34
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add() [2/2]

void org.turro.elephant.context.History.add ( String  path)

Definition at line 58 of file History.java.

58  {
59  String last = HISTORY.peekLast();
60  if(!Objects.equals(last, path)) {
61  if(!HISTORY.offerLast(path)) {
62  HISTORY.pollFirst();
63  HISTORY.offerLast(path);
64  }
65  }
66  }

◆ back() [1/2]

String org.turro.elephant.context.History.back ( )

Definition at line 76 of file History.java.

76  {
77  if(HISTORY.size() > 1) {
78  Iterator<String> it = HISTORY.descendingIterator();
79  it.next();
80  return it.next();
81  }
82  return HISTORY.peekLast();
83  }

◆ back() [2/2]

static String org.turro.elephant.context.History.back ( IConstructor  constructor)
static

Definition at line 46 of file History.java.

46  {
47  History history = getInstance(constructor);
48  history.get(); // remove current
49  return history.get();
50  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get() [1/2]

String org.turro.elephant.context.History.get ( )

Definition at line 68 of file History.java.

68  {
69  return HISTORY.pollLast();
70  }

◆ get() [2/2]

static String org.turro.elephant.context.History.get ( IConstructor  constructor)
static

Definition at line 38 of file History.java.

38  {
39  return getInstance(constructor).get();
40  }
static String get(IConstructor constructor)
Definition: History.java:38
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInstance()

static History org.turro.elephant.context.History.getInstance ( IConstructor  constructor)
static

Definition at line 91 of file History.java.

91  {
92  History history = (History) constructor.getSessionAttribute(HISTORY_CONTEXT);
93  if(history == null) {
94  history = new History();
95  constructor.setSessionAttribute(HISTORY_CONTEXT, history);
96  }
97  return history;
98  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peek() [1/2]

String org.turro.elephant.context.History.peek ( )

Definition at line 72 of file History.java.

72  {
73  return HISTORY.peekLast();
74  }

◆ peek() [2/2]

static String org.turro.elephant.context.History.peek ( IConstructor  constructor)
static

Definition at line 42 of file History.java.

42  {
43  return getInstance(constructor).peek();
44  }
static String peek(IConstructor constructor)
Definition: History.java:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peekBack()

static String org.turro.elephant.context.History.peekBack ( IConstructor  constructor)
static

Definition at line 52 of file History.java.

52  {
53  History history = getInstance(constructor);
54  return history.back();
55  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: