1 / 18

ロギング

オブジェクト 1. オブジェクト 2. ロギング. ロギング. 機能コード. 例外処理. 例外処理. オブジェクト 1. オブジェクト 2. アスペクトウィーバー. 実行可能コード. 機能コード. アスペクト. 例外処理. ロギング. オブジェクト指向プログラミングによるコード ( Java ). アスペクト指向プログラミングによるコード ( AspectJ ). public class Sample { String name; public void message ( ){

Télécharger la présentation

ロギング

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. オブジェクト1 オブジェクト2 ロギング ロギング 機能コード 例外処理 例外処理

  2. オブジェクト1 オブジェクト2 アスペクトウィーバー 実行可能コード 機能コード アスペクト 例外処理 ロギング

  3. オブジェクト指向プログラミングによるコードオブジェクト指向プログラミングによるコード ( Java ) アスペクト指向プログラミングによるコード ( AspectJ ) public class Sample { String name; public void message ( ){ System.out.println ( name ); } public Sample ( ) {    コンストラクタの本文 } public static void main ( ){ Sample s = new Sample(); s.message(); } } aspect Messege { public void Sampe.message ( ){ System.out.println ( name ); } } public class Sample { String name; public Sample ( ) {    コンストラクタの本文 } public static void main ( ){ Sample s = new Sample(); s.message(); } }

  4. class Sample { void method1 ( ) { int i; A a = new A(); method2(); i = a.meth1(); if( i == 0 ) { a.meth2(); } } void method2 ( ) { //method2の本文 } } Sample.method2() A.meth1() if A.meth2() } 特徴シーケンス ソースコードの特徴

  5. a b c a a d c b a b a c 要素aによる射影 b c a b c b c c d c

  6. ab,ac,を パターンとして出力 a,b,c,を パターンとして出力 a:1 b:2 c:2 d:1 1. c d 2. b c 4. a b 2. c c:1 1. d d:1 1. a c d 2. a b c 3. c b a 4. a a b a:4 b:3 c:3 d:1 射影 2. c 3. a a:1 c:1 結果 a :4 ab:2 ac:2 b :3 c :3 a:1 b:1 d:1 1. d 1. b a 各要素のサポート値

  7. 特徴 シーケンス コード情報 コード情報 抽出部 特徴シーケンス 生成部 コーディング パターン抽出部 クラス 階層情報 コーディング パターン情報 アスペクト マイニング実行部 ソース コード コード情報 クラス階層 ビューワー パターンの あるクラス マイニング 結果 パターン情報 ファイルアドレス パターン ビューワー パターン テーブル アスペクト テーブル 閲覧する パターン 閲覧 閲覧 閲覧 ユーザー

  8. クラス1 クラス2 クラス3 パターン B パターン B パターン A パターン C

  9. メソッド1 メソッド2 パターンA メソッド3 メソッド4 パターンB

  10. if ( method( ) ) { 制御文の本文; } boolean b = method( ); if ( b ) { 制御文の本文; } o.foo( p.bar( ) ); i = p.bar(); o.foo( i ); int x = o.foo() + p.bar(); int x = p.bar() + o.foo();

  11. Super.method( ) オーバーライド オーバーライド Sub1.method( ) Sub2.method( )

  12. org.jhotdraw.standard.SendToBackCommand public void execute() { super.execute(); setUndoActivity(createUndoActivity()); getUndoActivity().setAffectedFigures(view().selectionZOrdered()); FigureEnumeration fe = getUndoActivity().getAffectedFigures(); while (fe.hasNextFigure()) { view().drawing().sendToBack(fe.nextFigure()); } view().checkDamage(); } メソッド呼び出しパターン AbstractCommand.execute() AbstractCommand.setUndoActivity() AbstractCommand.getUndoActivity() Undoable.setAffectedFigures() AbstractCommand.getUndoActivity() Undoable.getAffectedFigures() FigureEnumeration.hasNextFigure() AbstractCommand.view() DrawingView.checkDamage(); org.jhotdraw.standard.PasteCommand public void execute() { super.execute(); Point lastClick = view().lastClick(); FigureSelection selection = (FigureSelection)Clipboard.getClipboard().getConten; if (selection != null) { setUndoActivity(createUndoActivity()); getUndoActivity().setAffectedFigures( (FigureEnumerator)selection.getData(StandardFigureSelection.TYPE)); if (!getUndoActivity().getAffectedFigures().hasNextFigure()) { setUndoActivity(null); return; } Rectangle r = getBounds(getUndoActivity().getAffectedFigures()); view().clearSelection(); // get an enumeration of inserted figures FigureEnumeration fe = insertFigures(getUndoActivity().getAffectedFigures() getUndoActivity().setAffectedFigures(fe); view().checkDamage(); } }

  13. オブジェクト指向プログラム クラスA クラスB クラスC excute( ) excute( ) excute( ) a1( ) b1( ) c1( ) a2( ) b2( ) c2( ) a3( ) b3( ) c3( ) アスペクト指向プログラム クラスA クラスB クラスC a1( ) b1( ) c1( ) b2( ) c2( ) a2( ) a3( ) b3( ) c3( ) アスペクト Excute A.excute( ) B.excute( ) C.excute( )

  14. org.jhotdraw.standard.CompositeFigure public FigureEnumeration figures(Rectangle viewRectangle) { if (_theQuadTree != null) { FigureEnumeration fe = _theQuadTree.getAllWithin(new Bounds(viewRectangle( List l2 = CollectionsFactory.current().createList(); while (fe.hasNextFigure()) { Figure f = fe.nextFigure(); //int z = fFigures.indexOf(f); l2.add(new OrderedFigureElement(f, f.getZValue())); } Collections.sort(l2); List l3 = CollectionsFactory.current().createList(); for (Iterator iter = l2.iterator(); iter.hasNext(); ) { OrderedFigureElement ofe = (OrderedFigureElement)iter. l3.add(ofe.getFigure()); } return new FigureEnumerator(l3); } return figures(); } org.jhotdraw.standard.StandardDrawingView public void addAll(Collection figures) { FigureEnumeration fe = new FigureEnumerator(figures); while (fe.hasNextFigure()) { add(fe.nextFigure()); } } メソッド呼び出しパターン FigureEnumeration.hasNextFigure() while FigureEnumeration.nextFigure() }

  15. 同一のメソッド呼び出しパターンを持つコード同一のメソッド呼び出しパターンを持つコード org.jhotdraw.standard.CutCommand public void execute() { super.execute(); setUndoActivity(createUndoActivity()); FigureEnumeration fe = view().selection(); List affected = CollectionsFactory.current().createList(); Figure f; FigureEnumeration dfe; while (fe.hasNextFigure()) { f = fe.nextFigure(); affected.add(0, f); dfe = f.getDependendFigures(); if (dfe != null) { while (dfe.hasNextFigure()) { affected.add(0, dfe.nextFigure()); } } } fe = new FigureEnumerator(affected); getUndoActivity().setAffectedFigures(fe); UndoActivity ua = (UndoActivity) getUndoActivity(); ua.setSelectedFigures(view().selection()); copyFigures(ua.getSelectedFigures(), ua.getSelectedFiguresCo deleteFigures(getUndoActivity().getAffectedFigures()); view().checkDamage(); } コードクローンベースの手法で抽出できるコード org.jhotdraw.fiures.GroupCommand public void execute() { super.execute(); setUndoActivity(createUndoActivity()); getUndoActivity().setAffectedFigures(view().selection()); ((GroupCommand.UndoActivity)getUndoActivity()).groupFigures view().checkDamage(); } org.jhotdraw.standard.AlignCommand public void execute() { super.execute(); setUndoActivity(createUndoActivity()); getUndoActivity().setAffectedFigures(view().selection()); ((AlignCommand.UndoActivity)getUndoActivity()).alignAffectedFi view().checkDamage(); }

  16. org.jhotdraw.standard. DuplicateCommand public void execute() { super.execute(); setUndoActivity(createUndoActivity()); FigureSelection selection = view().getFigureSelection(); // create duplicate figure(s) FigureEnumeration figures = (FigureEnumeration)sele ・・ getUndoActivity().setAffectedFigures(figures); view().clearSelection(); getUndoActivity().setAffectedFigures( insertFigures(getUndoActivity().getAffectedFigures(), ・・ view().checkDamage(); } org.jhotdraw.figures.BorderTool public void action(Figure figure) { // Figure replaceFigure = drawing().replace(figure, new ・・ setUndoActivity(createUndoActivity()); List l = CollectionsFactory.current().createList(); l.add(figure); l.add(new BorderDecorator(figure)); getUndoActivity().setAffectedFigures(new FigureEnume ・・ ((BorderTool.UndoActivity)getUndoActivity()).replaceAff ・・ } メソッド呼び出しパターン setUndoActivity() createUndoActivity() getUndoActivityI() setAffectedFigures() org.jhotdraw. standard.ResizeHandle public void invokeStart(int x, int y, DrawingView view) { setUndoActivity(createUndoActivity(view)); getUndoActivity().setAffectedFigures(new SingleFigure ・・・ ((ResizeHandle.UndoActivity)getUndoActivity()).setOld ・・・ }

  17. org.jhotdraw.standard.StandardDrawingView public void addAll(Collection figures) { FigureEnumeration fe = new FigureEnumerator(figures); while (fe.hasNextFigure()) { add(fe.nextFigure()); } } メソッド呼び出しパターン FigureEnumeration.hasNextFigure() while FigureEnumeration.nextFigure() }

More Related