📄 sorter.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: Sorter.java
package org.apache.struts2.util;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
import java.util.Comparator;
public class Sorter
{
public Sorter()
{
}
public Comparator getAscending()
{
return new Comparator() {
final Sorter this$0;
public int compare(Object o1, Object o2)
{
if (o1 instanceof Comparable)
{
return ((Comparable)o1).compareTo(o2);
} else
{
String s1 = o1.toString();
String s2 = o2.toString();
return s1.compareTo(s2);
}
}
{
this$0 = Sorter.this;
super();
}
};
}
public Comparator getAscending(final String anExpression)
{
return new Comparator() {
private ValueStack stack;
final String val$anExpression;
final Sorter this$0;
public int compare(Object o1, Object o2)
{
stack.push(o1);
Object v1 = stack.findValue(anExpression);
stack.pop();
stack.push(o2);
Object v2 = stack.findValue(anExpression);
stack.pop();
if (v1 == null)
v1 = "";
if (v2 == null)
v2 = "";
if ((v1 instanceof Comparable) && v1.getClass().equals(v2.getClass()))
{
return ((Comparable)v1).compareTo(v2);
} else
{
String s1 = v1.toString();
String s2 = v2.toString();
return s1.compareTo(s2);
}
}
{
this$0 = Sorter.this;
anExpression = s;
super();
stack = ValueStackFactory.getFactory().createValueStack();
}
};
}
public Comparator getComparator(String anExpression, boolean ascending)
{
if (ascending)
return getAscending(anExpression);
else
return getDescending(anExpression);
}
public Comparator getDescending()
{
return new Comparator() {
final Sorter this$0;
public int compare(Object o1, Object o2)
{
if (o2 instanceof Comparable)
{
return ((Comparable)o2).compareTo(o1);
} else
{
String s1 = o1.toString();
String s2 = o2.toString();
return s2.compareTo(s1);
}
}
{
this$0 = Sorter.this;
super();
}
};
}
public Comparator getDescending(final String anExpression)
{
return new Comparator() {
private ValueStack stack;
final String val$anExpression;
final Sorter this$0;
public int compare(Object o1, Object o2)
{
stack.push(o1);
Object v1 = stack.findValue(anExpression);
stack.pop();
stack.push(o2);
Object v2 = stack.findValue(anExpression);
stack.pop();
if (v1 == null)
v1 = "";
if (v2 == null)
v2 = "";
if ((v2 instanceof Comparable) && v1.getClass().equals(v2.getClass()))
{
return ((Comparable)v2).compareTo(v1);
} else
{
String s1 = v1.toString();
String s2 = v2.toString();
return s2.compareTo(s1);
}
}
{
this$0 = Sorter.this;
anExpression = s;
super();
stack = ValueStackFactory.getFactory().createValueStack();
}
};
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -