| 35 | return this->next; |
| 36 | } |
| 37 | PNode* PNode::insert(poly p) { |
| 38 | poly q = pOne(); |
| 39 | q = pCopy(p); |
| 40 | PNode* temp = this; |
| 41 | if(NULL == temp) { |
| 42 | PNode* pn = new PNode(q,temp); |
| 43 | return pn; |
| 44 | } |
| 45 | if(1 == pLmCmp(q,temp->getPoly())) { |
| 46 | PNode* pn = new PNode(q,temp); |
| 47 | return pn; |
| 48 | } |
| 49 | if(0 == pLmCmp(q,temp->getPoly())) { |
| 50 | return this; |
| 51 | } |
| 52 | if(-1 == pLmCmp(q,temp->getPoly())) { |
| 53 | while(NULL != temp->getNext() && -1 == pLmCmp(q,temp->getNext()->getPoly())) { |
| 54 | temp = temp->getNext(); |
| 55 | } |
| 56 | if(NULL == temp->getNext() || 1 == pLmCmp(q,temp->getNext()->getPoly())) { |
| 57 | PNode* pn = new PNode(q,temp->getNext()); |
| 58 | temp->next = pn; |
| 59 | return this; |
| 60 | } |
| 61 | if(0 == pLmCmp(q,temp->getNext()->getPoly())) { |
| 62 | return this; |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | /* |
| 67 | PNode* PNode::insert(poly p) { |
| 68 | PNode* pn = new PNode(p,this); |
no test coverage detected