Redian新闻
>
为什么FPD detector比SCD响应灵敏? (转载)
avatar
为什么FPD detector比SCD响应灵敏? (转载)# ChemEng - 化学工程
s*y
1
这就是笑傲江湖队。
avatar
q*q
2
careercup上有这样一道题:implement a singleton design pattern as a template
such that for any given class Foo, you can call Singleton::instance() and
get a pointer to an instance of a singleton of type Foo
答案是用c++给出的。我用java写出下面的代码,但显然不对,请问上面的问题应该怎
么用java实现呢?
另外对下面不对的代码我也有一些疑问:
public class SingleTon {
private static T t; //报语法错误“annot make a static reference to the
non-static type T”,请问这是什么缘故?
public synchronized static T instance() {
if( t == null ) {
t = new T();//即使t非static,此处也无法instantiate,我想是因为很多
class没有default constructor的原因,这样理解是否对?
}
return t;
}
}
谢谢!
avatar
d*e
3
Citizenship Requirement: U.S. or Valid Green Card Holder
Job Duties:
Planning:
• Develop a market-centric strategy for the product or product line,
that includes an analysis of market demand (supported by the Strategic
Marketing Manager and others as needed), customer behavior, competitors,
StandardAero's capabilities and a strategic and market orientation for the
product or product line. Such a plan shall present the evolution of the
product and product portfolio over an appropriate calen
avatar
e*e
4
【 以下文字转载自 Chemistry 讨论区 】
发信人: evence (硬猫), 信区: Chemistry
标 题: 为什么FPD detector比SCD响应灵敏?
发信站: BBS 未名空间站 (Mon Apr 23 20:46:21 2012, 美东)
都是photometric 啊
求分析大佬解释
avatar
h*n
5
呵呵,猴子说得好。大家和为贵!

【在 s**********y 的大作中提到】
: 这就是笑傲江湖队。
avatar
g*g
6
Since Java uses type erasure, generics is a compile time trick.
If it can't decide the type in compile time, it can't do instantiation.

template
the

【在 q**q 的大作中提到】
: careercup上有这样一道题:implement a singleton design pattern as a template
: such that for any given class Foo, you can call Singleton::instance() and
: get a pointer to an instance of a singleton of type Foo
: 答案是用c++给出的。我用java写出下面的代码,但显然不对,请问上面的问题应该怎
: 么用java实现呢?
: 另外对下面不对的代码我也有一些疑问:
: public class SingleTon {
: private static T t; //报语法错误“annot make a static reference to the
: non-static type T”,请问这是什么缘故?
: public synchronized static T instance() {

avatar
s*y
7
大家还要打牌,第一个是要招安小毛驴:)不然没法玩了。
avatar
q*q
8
明白。那么对于上面描述的问题,能用java实现吗?

【在 g*****g 的大作中提到】
: Since Java uses type erasure, generics is a compile time trick.
: If it can't decide the type in compile time, it can't do instantiation.
:
: template
: the

avatar
F*r
9
招安?!
猴哥真善良

【在 s**********y 的大作中提到】
: 大家还要打牌,第一个是要招安小毛驴:)不然没法玩了。
avatar
m*r
10
since you need to return any class, what you need is a map from Class to
Object.
private static Map, or Map, i am not sure.
and use reflection to instantiate the object.

template
the

【在 q**q 的大作中提到】
: careercup上有这样一道题:implement a singleton design pattern as a template
: such that for any given class Foo, you can call Singleton::instance() and
: get a pointer to an instance of a singleton of type Foo
: 答案是用c++给出的。我用java写出下面的代码,但显然不对,请问上面的问题应该怎
: 么用java实现呢?
: 另外对下面不对的代码我也有一些疑问:
: public class SingleTon {
: private static T t; //报语法错误“annot make a static reference to the
: non-static type T”,请问这是什么缘故?
: public synchronized static T instance() {

avatar
F*r
11
从小毛驴对俺及很多人的的套路
套近乎——》反目——》威胁——》辱骂
猴哥你有这心就是自残

【在 F*********r 的大作中提到】
: 招安?!
: 猴哥真善良

avatar
r*l
12
public class Singleton {
private static final Map, Object> map = new HashMap,
Object>();
public synchronized static T instance(Class c)
throws InstantiationException, IllegalAccessException {
if (!map.containsKey(c)) {
T o = c.newInstance();
map.put(c, o);
}
return (T) map.get(c);
}
}

template
the

【在 q**q 的大作中提到】
: careercup上有这样一道题:implement a singleton design pattern as a template
: such that for any given class Foo, you can call Singleton::instance() and
: get a pointer to an instance of a singleton of type Foo
: 答案是用c++给出的。我用java写出下面的代码,但显然不对,请问上面的问题应该怎
: 么用java实现呢?
: 另外对下面不对的代码我也有一些疑问:
: public class SingleTon {
: private static T t; //报语法错误“annot make a static reference to the
: non-static type T”,请问这是什么缘故?
: public synchronized static T instance() {

avatar
s*y
13
我肯定不胜任,不过大家要玩,还是得招安小毛驴吧。

【在 F*********r 的大作中提到】
: 从小毛驴对俺及很多人的的套路
: 套近乎——》反目——》威胁——》辱骂
: 猴哥你有这心就是自残

avatar
q*q
14
Thank you! I got it.

【在 r*****l 的大作中提到】
: public class Singleton {
: private static final Map, Object> map = new HashMap,
: Object>();
: public synchronized static T instance(Class c)
: throws InstantiationException, IllegalAccessException {
: if (!map.containsKey(c)) {
: T o = c.newInstance();
: map.put(c, o);
: }
: return (T) map.get(c);

avatar
D*l
15
有待探讨

【在 s**********y 的大作中提到】
: 我肯定不胜任,不过大家要玩,还是得招安小毛驴吧。
avatar
q*q
16
Thank you!

【在 m****r 的大作中提到】
: since you need to return any class, what you need is a map from Class to
: Object.
: private static Map, or Map, i am not sure.
: and use reflection to instantiate the object.
:
: template
: the

avatar
B*e
17
那我们更牛了, 我们排名还比你们高啊, 哈哈

【在 s**********y 的大作中提到】
: 这就是笑傲江湖队。
avatar
r*l
18
懒惰,只给说明,不写code。

【在 m****r 的大作中提到】
: since you need to return any class, what you need is a map from Class to
: Object.
: private static Map, or Map, i am not sure.
: and use reflection to instantiate the object.
:
: template
: the

avatar
s*y
19
那你们比我们牛。

【在 B*****e 的大作中提到】
: 那我们更牛了, 我们排名还比你们高啊, 哈哈
avatar
m*r
20
我刚起床. 还不在状态.

【在 r*****l 的大作中提到】
: 懒惰,只给说明,不写code。
avatar
S*h
21
赞~

【在 r*****l 的大作中提到】
: public class Singleton {
: private static final Map, Object> map = new HashMap,
: Object>();
: public synchronized static T instance(Class c)
: throws InstantiationException, IllegalAccessException {
: if (!map.containsKey(c)) {
: T o = c.newInstance();
: map.put(c, o);
: }
: return (T) map.get(c);

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。