Closed jokogr25 closed 1 year ago
To do:
add
-Methode verändern und prüfen, ob Vorschläge sich ändern
// original (2021/b8c5ce645ff7652e6e9c3941a687446e5be9003e/src/main/java/de/fuas/algorithms/SLList.java)
public void add(final int index, final T e) {
if (index < 0 || index > elementCount) {
throw new IndexOutOfBoundsException("not possible size");
}
if (index <= 0) {
this.first = new Node<T>(e, this.first);
} else {
Node<T> pred = nodeAt(index - 1);
pred.next = new Node<T>(e, pred.next);
}
elementCount++;
}
// Original name: add
// (0.682526) predicted: ['remove']
// (0.088342) predicted: ['remove', 'at']
// (0.075211) predicted: ['remove', 'first']
// (0.042080) predicted: ['add']
// (0.028736) predicted: ['insert']
// (0.022651) predicted: ['find']
// (0.017036) predicted: ['insert', 'element', 'at']
// (0.016437) predicted: ['redo']
// (0.013981) predicted: ['remove', 'element', 'at']
// (0.013001) predicted: ['set']
// variante 2
public void add(final int index, final T e) {
if (index < 0 || index > elementCount) {
throw new IndexOutOfBoundsException("not possible size");
}
else if (index <= 0) {
this.first = new Node<T>(e, this.first);
} else {
Node<T> pred = nodeAt(index - 1);
pred.next = new Node<T>(e, pred.next);
}
elementCount++;
}
// Original name: add
// (0.681419) predicted: ['remove']
// (0.077868) predicted: ['remove', 'first']
// (0.065580) predicted: ['add']
// (0.054125) predicted: ['insert']
// (0.045975) predicted: ['remove', 'at']
// (0.028971) predicted: ['find']
// (0.013128) predicted: ['redo']
// (0.011317) predicted: ['set']
// (0.011230) predicted: ['add', 'first']
// (0.010388) predicted: ['clear']
// variante 3
public void add(final int index, final T e) {
if (index < 0 || index > elementCount) {
throw new IndexOutOfBoundsException("not possible size");
}
else if (index == 0) {
this.first = new Node<T>(e, this.first);
} else {
Node<T> pred = nodeAt(index - 1);
pred.next = new Node<T>(e, pred.next);
}
elementCount++;
}
// Original name: add
// (0.228829) predicted: ['set', 'element', 'at']
// (0.165641) predicted: ['add', 'first']
// (0.161875) predicted: ['insert', 'element', 'at']
// (0.125152) predicted: ['remove']
// (0.094415) predicted: ['swap']
// (0.056208) predicted: ['sub', 'set']
// (0.054253) predicted: ['set', 'first']
// (0.048687) predicted: ['set']
// (0.035563) predicted: ['remove', 'node']
// (0.029377) predicted: ['at']
// variante 4
public void add(final int index, final T e) {
if (index < 0 || index > elementCount) {
throw new IndexOutOfBoundsException("not possible size");
}
else if (index > 0) {
Node<T> pred = nodeAt(index - 1);
pred.next = new Node<T>(e, pred.next);
}
else {
this.first = new Node<T>(e, this.first);
}
elementCount++;
}
// Original name: add
// (0.810546) predicted: ['insert']
// (0.126248) predicted: ['remove']
// (0.018616) predicted: ['find']
// (0.011836) predicted: ['next']
// (0.006930) predicted: ['next', 'node']
// (0.006831) predicted: ['add']
// (0.005899) predicted: ['index']
// (0.005117) predicted: ['remove', 'first']
// (0.004346) predicted: ['count']
// (0.003630) predicted: ['sort']
// variante 5
public void add(final int index, final T e) {
if (index < 0 || index > elementCount) {
throw new IndexOutOfBoundsException("not possible size");
}
else if (index > 0) {
Node<T> pred = nodeAt(index - 1);
pred.next = new Node<T>(e, pred.next);
}
else if (index == 0) {
this.first = new Node<T>(e, this.first);
}
elementCount++;
}
// Original name: add
// (0.526262) predicted: ['insert']
// (0.354953) predicted: ['remove']
// (0.021355) predicted: ['move']
// (0.019537) predicted: ['move', 'up']
// (0.017401) predicted: ['remove', 'at']
// (0.013794) predicted: ['next']
// (0.012549) predicted: ['advance']
// (0.012032) predicted: ['create', 'index']
// (0.011606) predicted: ['add']
// (0.010511) predicted: ['insert', 'element', 'at']
Link zum Repo für verändertes Code2Vec: https://github.com/Averodas/code2vec