本文整理汇总了Java中com.jakewharton.fliptables.FlipTable类的典型用法代码示例。如果您正苦于以下问题:Java FlipTable类的具体用法?Java FlipTable怎么用?Java FlipTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FlipTable类属于com.jakewharton.fliptables包,在下文中一共展示了FlipTable类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeRooms
import com.jakewharton.fliptables.FlipTable; //导入依赖的package包/类
private void writeRooms(List<Room> rooms, PrintWriter writer) {
String [][] data = new String[rooms.size()][HEADERS.length];
for (int i = 0; i < rooms.size(); i++) {
Room room = rooms.get(i);
data[i][0] = String.valueOf(room.getId());
data[i][1] = room.getName();
data[i][2] = String.valueOf(df.format(room.getCurrentTemperature()));
data[i][3] = String.valueOf(room.isWindowOpen());
data[i][4] = String.valueOf(room.getValvePositionInPercent());
data[i][5] = String.valueOf(room.isLowBattery());
data[i][6] = "-";
try {
Parser.Mode mode = room.findThermostat().getMode();
if (mode == Parser.Mode.VACATION) {
data[i][6] = "VACATION " + room.findThermostat().getEndTime();
} else {
data[i][6] = mode.toString();
}
} catch (IllegalArgumentException e) {}
}
writer.println(FlipTable.of(HEADERS, data));
}
开发者ID:spinscale,项目名称:maxcube-java,代码行数:25,代码来源:CliRenderer.java
示例2: toDetailed
import com.jakewharton.fliptables.FlipTable; //导入依赖的package包/类
private StringBuilder toDetailed(
final Iterable<Violation> violations, final String summarySubject) {
final StringBuilder sb = new StringBuilder();
final List<String[]> rows = new ArrayList<>();
for (final Violation violation : violations) {
final String message = addNewlines(violation.getMessage(), maxMessageColumnWidth);
final String line = addNewlines(violation.getStartLine().toString(), maxLineColumnWidth);
final String severity = addNewlines(violation.getSeverity().name(), maxSeverityColumnWidth);
final String rule = addNewlines(violation.getRule().or(""), maxRuleColumnWidth);
final String reporter = addNewlines(violation.getReporter(), maxReporterColumnWidth);
final String[] row = {reporter, rule, severity, line, message};
rows.add(row);
}
final String[] headers = {"Reporter", "Rule", "Severity", "Line", "Message"};
final String[][] data = rows.toArray(new String[][] {});
sb.append(FlipTable.of(headers, data));
sb.append("\n");
sb.append(toCompact(violations, summarySubject));
sb.append("\n");
return sb;
}
开发者ID:tomasbjerre,项目名称:violations-lib,代码行数:24,代码来源:ViolationsReporterApi.java
示例3: apply
import com.jakewharton.fliptables.FlipTable; //导入依赖的package包/类
@Override
public Object apply(List<Object> args) {
if(args.size() < 1) {
return null;
}
Map<Object, Object> map = (Map<Object, Object>) args.get(0);
if(map == null) {
map = new HashMap<>();
}
String[] headers = {"KEY", "VALUE"};
String[][] data = new String[map.size()][2];
int i = 0;
for(Map.Entry<Object, Object> kv : map.entrySet()) {
data[i++] = new String[] {kv.getKey().toString(), kv.getValue().toString()};
}
return FlipTable.of(headers, data);
}
开发者ID:apache,项目名称:metron,代码行数:18,代码来源:ShellFunctions.java
示例4: apply
import com.jakewharton.fliptables.FlipTable; //导入依赖的package包/类
@Override
public Object apply(List<Object> args, Context context) throws ParseException {
String config = (String) args.get(0);
if(config == null) {
return null;
}
SensorParserConfig configObj = (SensorParserConfig) PARSER.deserialize(config);
FieldTransformer stellarTransformer = getStellarTransformer(configObj);
String[] headers = new String[] { "Field", "Transformation"};
String[][] data = new String[stellarTransformer.getConfig().size()][2];
int i = 0;
for(Map.Entry<String, Object> kv : stellarTransformer.getConfig().entrySet()) {
data[i++] = new String[] {kv.getKey(), kv.getValue().toString()};
}
return FlipTable.of(headers, data);
}
开发者ID:apache,项目名称:metron,代码行数:17,代码来源:ParserConfigFunctions.java
示例5: writeCubeInfo
import com.jakewharton.fliptables.FlipTable; //导入依赖的package包/类
private void writeCubeInfo(Cube cube, PrintWriter writer) {
String [][] data = new String[1][3];
data[0][0] = cube.getSerial();
data[0][1] = cube.getDate().toString();
data[0][2] = cube.getFirmwareVersion();
writer.println(FlipTable.of(new String[]{ "id", "date", "firmware" }, data));
}
开发者ID:spinscale,项目名称:maxcube-java,代码行数:8,代码来源:CliRenderer.java
示例6: getConsoleText
import com.jakewharton.fliptables.FlipTable; //导入依赖的package包/类
public String getConsoleText(NumberFormat nf) {
if(getRange().isPresent()) {
return FlipTable.of(headerToText(), seriesToText(nf));
} else {
return getHeaders(true).stream().collect(Collectors.joining("\\t"));
}
}
开发者ID:punkbrwstr,项目名称:pinto,代码行数:8,代码来源:Table.java
示例7: apply
import com.jakewharton.fliptables.FlipTable; //导入依赖的package包/类
@Override
public Object apply(List<Object> args, Context context) throws ParseException {
SensorEnrichmentConfig config = getSensorEnrichmentConfig(args, 0);
ThreatIntelConfig tiConfig = (ThreatIntelConfig) getConfig(config, EnrichmentConfigFunctions.Type.THREAT_INTEL);
if(tiConfig == null) {
return "";
}
org.apache.metron.common.configuration.enrichment.threatintel.ThreatTriageConfig triageConfig = tiConfig.getTriageConfig();
if(triageConfig == null) {
return "";
}
// print each rule
List<RiskLevelRule> triageRules = ListUtils.emptyIfNull(triageConfig.getRiskLevelRules());
String[] headers = new String[] {"Name", "Comment", "Triage Rule", "Score", "Reason"};
String[][] data = new String[triageRules.size()][5];
int i = 0;
for(RiskLevelRule rule : triageRules) {
double d = rule.getScore().doubleValue();
String score = d == (long)d ? String.format("%d", (long)d) : String.format("%s", d);
String name = Optional.ofNullable(rule.getName()).orElse("");
String comment = Optional.ofNullable(rule.getComment()).orElse("");
String reason = Optional.ofNullable(rule.getReason()).orElse("");
data[i++] = new String[] {name, comment, rule.getRule(), score, reason};
}
String ret = FlipTable.of(headers, data);
// print the aggregation
if(!triageRules.isEmpty()) {
ret += "Aggregation: " + triageConfig.getAggregator().name();
}
return ret;
}
开发者ID:apache,项目名称:metron,代码行数:35,代码来源:ThreatTriageFunctions.java
示例8: apply
import com.jakewharton.fliptables.FlipTable; //导入依赖的package包/类
@Override
public Object apply(List<Object> args, Context context) throws ParseException {
String config = (String) args.get(0);
SensorEnrichmentConfig configObj;
String[] headers = new String[] { "Group", "Field", "Transformation"};
if(config == null || config.isEmpty()) {
return FlipTable.of(headers, new String[0][3]);
}
else {
configObj = (SensorEnrichmentConfig) ENRICHMENT.deserialize(config);
}
Type type = Type.valueOf((String) args.get(1));
EnrichmentConfig enrichmentConfig = getConfig(configObj, type);
Map<String, Object> stellarHandler = getStellarHandler(enrichmentConfig);
Map<String, Object> transforms = (Map<String, Object>) stellarHandler.get("config");
List<String[]> objs = new ArrayList<>();
for(Map.Entry<String, Object> kv : transforms.entrySet()) {
if(kv.getValue() instanceof Map) {
Map<String, String> groupMap = (Map<String, String>) kv.getValue();
for(Map.Entry<String, String> groupKv : groupMap.entrySet()) {
objs.add(new String[]{kv.getKey(), groupKv.getKey(), groupKv.getValue().toString()});
}
}
else {
objs.add(new String[]{"(default)", kv.getKey(), kv.getValue().toString()});
}
}
String[][] data = new String[objs.size()][3];
for(int i = 0;i < objs.size();++i) {
data[i] = objs.get(i);
}
return FlipTable.of(headers, data);
}
开发者ID:apache,项目名称:metron,代码行数:35,代码来源:EnrichmentConfigFunctions.java
示例9: toString
import com.jakewharton.fliptables.FlipTable; //导入依赖的package包/类
@Override
public String toString() {
return String.format("\n\n name: %s\n path: %s\n%s\n",
name,
path,
FlipTable.of(HEADER, toArray()));
}
开发者ID:rejasupotaro,项目名称:kvs-schema,代码行数:8,代码来源:SharedPreferencesTable.java
示例10: printTable
import com.jakewharton.fliptables.FlipTable; //导入依赖的package包/类
private static void printTable(TablePresenter table) {
System.out.println(FlipTable.of(table.headers(), table.rows()));
}
开发者ID:joesteele,项目名称:tissue,代码行数:4,代码来源:Tissue.java
示例11: comments
import com.jakewharton.fliptables.FlipTable; //导入依赖的package包/类
public String comments() {
CommentsPresenter table = new CommentsPresenter(issue.issueComments);
return FlipTable.of(table.headers(), table.rows());
}
开发者ID:joesteele,项目名称:tissue,代码行数:5,代码来源:IssuePresenter.java
注:本文中的com.jakewharton.fliptables.FlipTable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论