public class test_2
{
public static Map PutData(String _id, int _level, String _requisite) throws Exception
{
Map<String, Object> items = new HashMap<String, Object>();
items.put("id", _id);
items.put("level", _level);
items.put("requisite", _requisite);
return items;
}
public static List<Map> Input(List<Map> data) throws Exception
{
data.add(PutData("10001", 1, "0"));
data.add(PutData("10002", 1, "10001"));
data.add(PutData("10003", 2, "10002"));
data.add(PutData("10004", 3, "0"));
data.add(PutData("10005", 3, "10003"));
data.add(PutData("10006", 4, "10005"));
return data;
}
public static void main(String[] args) throws Exception
{
List<Map> data = new ArrayList<Map>();
List<String> quest = new ArrayList<String>();
Input(data);
// 입력은 구현하지 않았습니다.
String input ="3, 10001:y, 10002:y, 10003:y";
String[] list = input.replace(" ","").split(","); // 공백 제거
int level = Integer.parseInt(list[0]); // 레벨 저장
for(int i =1, size = list.length; i < size; i++) // 수행중이거나 완료한 퀘스트를 quest List에 저장
quest.add(list[i]);
List<String> output = new ArrayList<String>(); // 출력
Map temp_data; // 임시데이터
for(int i = 0, size = data.size() -1; i <= size; i++)
{
temp_data = data.get(i); // 임시값 입력
if((Integer)temp_data.get("level") <= level) // 본인 레벨보다 높은 레벨의 퀘스트를 받을 수 없음
{
// 수행중이거나 완료한 퀘스트 ID값을 검색
if(!quest.contains(temp_data.get("id")+":y") && !quest.contains(temp_data.get("id")+":n"))
{
// 선행퀘스트가 없거나 완료된경우 true
if("0".equals(temp_data.get("requisite")) || quest.contains(temp_data.get("requisite")+":y"))
{
output.add((String)temp_data.get("id"));
}
}
}
}
System.out.print(output.get(0));
for(int i =1, size = output.size(); i < size; i++)
{
System.out.print(", " + output.get(i));
}
}
}
카테고리 없음2011. 10. 4. 17:38
Oracle2011. 9. 27. 09:19
Oracle에서 쿼리를 사용하여 insert, select 등을 할때 &의 대체문자를 사용하게 되면
sqlplus 등에선 대체문자를 입력받기 위해 대기를 하게 된다.
이 & 문자를 말그대로 '&' 사용하려면 다음과 같이 설정을 하여주면 된다.
set define off;
sqlplus 등에선 대체문자를 입력받기 위해 대기를 하게 된다.
이 & 문자를 말그대로 '&' 사용하려면 다음과 같이 설정을 하여주면 된다.
set define off;
'Oracle' 카테고리의 다른 글
| rownum의 동작 원리와 활용 방법 (0) | 2010.11.04 |
|---|---|
| Oracle 함수 (0) | 2010.10.25 |
| 아카이브 로그 모드(Archive Log Mode) (0) | 2010.10.11 |
| 자주 사용되는 제어 함수 (0) | 2010.10.04 |
| DECODE (0) | 2010.10.04 |
MSSQL2011. 9. 23. 18:41
