분류 전체 보기 1324

디자인 패턴 위임에 의한 Adapter 패턴(인스턴스를 이용한)

2번째 위임을 사용한 어댑터 패턴(인스턴스를 사용한) 소스를 보면 어떻게 인스턴스를 사용한 것인지 이해가 될 것입니다. public class Banner { private String string; Banner(String string){ this.string = string; } public void showWithParen(){ System.out.println("(" + string + ")"); } public void showWithAster(){ System.out.println("*" + string + "*"); } } public abstract class Print { public abstract void printWeak(); public abstract void printStron..

디자인 패턴 Adapter패턴 상속을 사용한 Adapter패턴

Adapter 패턴 노트북에 사용하는 어댑터처럼 이미 제공된것(ac220볼트) 과 필요한것 (dc 19v)의 차이를 없애주는 패턴방법 1. 클래스에 의한 Adapter 패턴(상속을 사용한 것) 2. 인스턴스에 의한 Adapter패턴(위임을 사용한 것) 첫번째 방법을 사용해 봅시다. 나오는 클래스를 설명하면 제공되고있는 것(ac220) Banner클래스(showWithParen, showWithAster) 어댑터 PrintBanner 클래스 필요한것(dc 19v) Print인터페이스(printWeak, printStrong) public class Banner { private String string; Banner(String string){ this.string = string; } public voi..

안드로이드 스마트폰 진동을 내맘대로 다뤄보자

Object Activity.getSystemService(String name) 으로 서비스를 받아온뒤 void vibrate(long milliseconds) void vibrate(long[] pattern, int repeat) void cancel() 을 이용합니다. 메니페스트파일에 퍼미션 추가에 유의합시다. 메니페스트 파일 접근 방법은 아래에 있습니다. package com.android.ex26; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.Vibrator; import android.view.View; import android.view.View.O..

디자인패턴 Chain of Responsibility 패턴

책임의 사슬 패턴 핸드폰이 고장나면 일단 구매처에 물어보고 구매처는 as센터로 가라고 하고 as센터에서는 이건 못고친다고 하면서 용산 전문 수리점으로 가라고 한다. 이렇게 책임 떠넘기기를 디자인패턴으로 표현했다. Trouble 클래스 package kch; public class Trouble { //발생한 트러블을 표현하는 클래스 /** * @uml.property name="number" */ private int number;//트러블 번호 public Trouble(int number){ this.number = number;//트러블의 생성 } /** * @return * @uml.property name="number" */ public int getNumber(){ return number;..

Chapter3 Preparing Design Files for Synthesis.

Organizing the Design Data. Establishing and adhering to a method of organizing data are more important than the method you choose. Partitioning for Design Reuse Design reuse decreases time to market by reducing the design, integration and testing effort. Thoroughly define and document the design interface. Standardize interfaces whenever possible. Parameterize the HDL code. Keeping Related Comb..

Chapter2. Design Compiler Basics

다음은 SoC 합성 툴인 Synopsys의 Design Compiler User 가이드의 요약입니다. Basic High-Level Design Flow Design exploration : 구체적인 디자인 목표를 위해 실제 implement Default option으로 합성 시작 ∙ Functional simulation : 원하는 기능을 수행하는지 확인 ∙ Design implementation : 실제 option을 적용시켜서 합성 시작 결과는 gate level netlist ∙ Physical design : semeconductor vendor에서 실제 칩 디자인 DC Setup Files Setup files은 DC가 실행될 때 자동적으로 읽는 파일 .synopsys_dc.setup Pos..

디자인 패턴 Visitor 패턴

Visitor 클래스 package kch; public abstract class Visitor { public abstract void visit(File file); public abstract void visit(Directory directory); } Element 인터페이스 package kch; public interface Element {//방문자를 받아들임. public abstract void accept(Visitor v); } Entry 클래스 package kch; import java.util.Iterator; public abstract class Entry implementsElement{ public abstract String getName(); public abstr..

디자인 패턴 Decorator 패턴

처음에는 아래 링크에 들어가셔서 한번 읽어보시면 이 패턴을 이해하는데 아주 도움이 될 것 입니다. http://blog.naver.com/newsdu/80115957298 Display 클래스 package kch; public abstract class Display { public abstract int getColumns();//가로 문자수를 얻는다. public abstract int getRows();//세로 행수를 얻는다. public abstract String getRowText(introw);//row번째의 문자열을 얻는다. public final void show(){//전부 표시한다. for(int i=0 ; i < getRows() ; i++){ System.out.println(g..