Skip to content

Commit a41a30f

Browse files
committed
시각화 예제추가
1 parent 3cad505 commit a41a30f

9 files changed

Lines changed: 1257 additions & 3 deletions

File tree

src/components/ide/AnimationFactory.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import GraphAnimation from './animations/GraphAnimation';
77
import HeapAnimation from './animations/HeapAnimation';
88
import LinkedListAnimation from './animations/LinkedListAnimation';
99
import RecursionAnimation from './animations/RecursionAnimation';
10+
import StackAnimation from './animations/StackAnimation';
11+
import QueueAnimation from './animations/QueueAnimation';
1012
import PlaceholderAnimation from './animations/PlaceholderAnimation';
1113

1214
/**
@@ -46,6 +48,16 @@ export class AnimationFactory {
4648
'fibonacci': RecursionAnimation,
4749
'factorial': RecursionAnimation,
4850

51+
// ✅ 스택
52+
'stack': StackAnimation,
53+
'stack-demo': StackAnimation,
54+
'stack-visualization': StackAnimation,
55+
56+
// ✅ 큐
57+
'queue': QueueAnimation,
58+
'queue-demo': QueueAnimation,
59+
'fifo-queue': QueueAnimation,
60+
4961
// 🚧 기타
5062
'variables': PlaceholderAnimation,
5163
'default': PlaceholderAnimation
@@ -102,9 +114,32 @@ export class AnimationFactory {
102114
if (vizType === 'graph') return 'graph';
103115
if (vizType === 'list' || vizType === 'linkedlist') return 'linked-list';
104116
if (vizType === 'recursion' || vizType === 'recursive') return 'recursion';
117+
if (vizType === 'stack') return 'stack';
118+
if (vizType === 'queue' || vizType === 'fifo') return 'queue';
105119
}
106120
}
107121

122+
const stackOp = events.find(e =>
123+
e.kind === 'ds_op' &&
124+
e.target &&
125+
e.target.toLowerCase().includes('stack')
126+
);
127+
if (stackOp) {
128+
console.log('✅ ds_op target으로 stack 감지');
129+
return 'stack';
130+
}
131+
132+
const queueOp = events.find(e => {
133+
if (e.kind !== 'ds_op' || !e.target) return false;
134+
const target = e.target.toLowerCase().trim();
135+
if (target.includes('queue')) return true;
136+
return target === 'q' || target === 'queue';
137+
});
138+
if (queueOp) {
139+
console.log('✅ ds_op target으로 queue 감지');
140+
return 'queue';
141+
}
142+
108143
// 2️⃣ ds_op의 target으로 자료구조 감지
109144
const heapOp = events.find(e =>
110145
e.kind === 'ds_op' &&

src/components/ide/VisualizationModal.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ const InfoPanel = ({ data, currentStep, totalSteps, animationType, theme }) => {
254254
'graph': '그래프',
255255
'linked-list': '연결 리스트',
256256
'recursion': '재귀',
257+
'stack': '스택',
258+
'queue': '큐',
257259
'variables': '변수'
258260
};
259261
return labels[type] || type;

0 commit comments

Comments
 (0)