当前位置: 首页>>代码示例>>Java>>正文


Java CSVLine类代码示例

本文整理汇总了Java中org.cpsolver.ifs.util.CSVFile.CSVLine的典型用法代码示例。如果您正苦于以下问题:Java CSVLine类的具体用法?Java CSVLine怎么用?Java CSVLine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CSVLine类属于org.cpsolver.ifs.util.CSVFile包,在下文中一共展示了CSVLine类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: save

import org.cpsolver.ifs.util.CSVFile.CSVLine; //导入依赖的package包/类
protected void save(PrintWriter out) {
      if (iFile.getHeader() != null)
          out.println(iFile.getHeader().toString());
      if (iFile.getLines() != null) {
          for (CSVLine line : iFile.getLines()) {
              out.println(line.toString());
          }
      }
out.flush();
  }
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:CsvInstructionalOfferingTableBuilder.java

示例2: main

import org.cpsolver.ifs.util.CSVFile.CSVLine; //导入依赖的package包/类
public static void main(String[] args) {
	try {
		PrintStream out = new PrintStream(System.out, true, "UTF-8");
		
		out.println("# Licensed to The Apereo Foundation under one or more contributor license");
		out.println("# agreements. See the NOTICE file distributed with this work for");
		out.println("# additional information regarding copyright ownership.");
		out.println("#");
		out.println("# The Apereo Foundation licenses this file to you under the Apache License,");
		out.println("# Version 2.0 (the \"License\"); you may not use this file except in");
		out.println("# compliance with the License. You may obtain a copy of the License at:");
		out.println("#");
		out.println("# http://www.apache.org/licenses/LICENSE-2.0");
		out.println("#");
		out.println("# Unless required by applicable law or agreed to in writing, software");
		out.println("# distributed under the License is distributed on an \"AS IS\" BASIS,");
		out.println("# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
		out.println("#");
		out.println("# See the License for the specific language governing permissions and");
		out.println("# limitations under the License.");
		out.println("#");
		
		CSVFile csv = new CSVFile(new File(System.getProperty("file", System.getProperty("user.home") + "/Downloads/UniTime Localization Czech.csv")));
		for (CSVLine line: csv.getLines()) {
			if (line.getFields().size() >= 2) {
				out.println();
				if (line.getFields().size() >= 3 && (!line.getField(2).isEmpty() || line.getField(1).isEmpty())) {
					out.println("# Default: " + unicodeEscape(line.getField(1).toString()));
					out.println(line.getField(0).toString() + "=" + unicodeEscape(line.getField(2).toString()).replace(":", "\\:"));
				} else {
					out.println("# Default: " + unicodeEscape(line.getField(1).toString()));
					out.println("# FIXME: Translate \"" + unicodeEscape(line.getField(1).toString()) + "\"");
					out.println("# " + line.getField(0).toString() + "=");
				}
			}
		}
		
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:42,代码来源:ImportMessages.java

示例3: execute

import org.cpsolver.ifs.util.CSVFile.CSVLine; //导入依赖的package包/类
@Override
public SectioningReportRpcResponse execute(SectioningReportRpcRequest request, SessionContext context) {
	DataProperties parameters = new DataProperties(request.getParameters());
	CSVFile csv =  null;
	boolean online = parameters.getPropertyBoolean("online", false);
	parameters.setProperty("useAmPm", CONSTANTS.useAmPm() ? "true" : "false");

	if (online) {
		context.checkPermission(Right.SchedulingReports);
		OnlineSectioningServer server = solverServerService.getOnlineStudentSchedulingContainer().getSolver(context.getUser().getCurrentAcademicSessionId().toString());
		if (server == null)
			throw new GwtRpcException("Online student scheduling is not enabled for " + context.getUser().getCurrentAuthority().getQualifiers("Session").get(0).getQualifierLabel() + ".");
		
		OnlineSectioningLog.Entity user = OnlineSectioningLog.Entity.newBuilder()
				.setExternalId(context.getUser().getExternalUserId())
				.setName(context.getUser().getName() == null ? context.getUser().getUsername() : context.getUser().getName())
				.setType(context.hasPermission(Right.StudentSchedulingAdvisor) ? OnlineSectioningLog.Entity.EntityType.MANAGER : OnlineSectioningLog.Entity.EntityType.STUDENT).build();
		
		csv = server.execute(server.createAction(GenerateSectioningReport.class).withParameters(parameters), user);
	} else {
		context.checkPermission(Right.StudentSectioningSolver);
		
		StudentSolverProxy solver = studentSectioningSolverService.getSolver();
		if (solver == null)
			throw new GwtRpcException("No student solver is running.");
		
		csv = solver.getReport(parameters);
	}
	
	if (csv == null)
		throw new GwtRpcException("No report was created.");
	
	SectioningReportRpcResponse response = new SectioningReportRpcResponse();
	String[] header = new String[csv.getHeader().getFields().size()];
	for (int i = 0; i < csv.getHeader().getFields().size(); i++)
		header[i] = csv.getHeader().getField(i).toString();
	response.addLine(header);
	if (csv.getLines() != null)
		for (CSVLine line: csv.getLines()) {
			String[] row = new String[line.getFields().size()];
			for (int i = 0; i < line.getFields().size(); i++)
				row[i] = line.getField(i).toString();
			response.addLine(row);
		}

	return response;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:48,代码来源:SectioningReportsBackend.java

示例4: Row

import org.cpsolver.ifs.util.CSVFile.CSVLine; //导入依赖的package包/类
public Row(CSVLine line) {
	iLine = line;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:4,代码来源:SectioningReportsExporter.java

示例5: main

import org.cpsolver.ifs.util.CSVFile.CSVLine; //导入依赖的package包/类
public static void main(String args[]) {
    try {
        for (int i = 0; i < args.length; i++) {
            File file = new File(args[i]);
            
            String name = file.getName();
            if (name.contains(".")) name = name.substring(0, name.indexOf('.'));
            
            CSVFile csv = new CSVFile(file);
            
            PrintWriter pw = new PrintWriter(new File(file.getParentFile(), name + ".html"));

            pw.println("<table>");

            pw.println("\t<tr>");
            for (int j = 0; j < csv.getHeader().size(); j++) {
                pw.println("\t\t<th style='border-bottom: 1px #8000AD dashed;' align='" + (j == 0 ? "left" : "center") + "'>" + csv.getHeader().getField(j).toString() + "</th>");
            }
            pw.println("\t</tr>");
            
            boolean header = false;
            for (CSVLine line: csv.getLines()) {
                if (line.getField(0).isEmpty()) {
                    pw.println("\t<tr><td colspan='" + line.size() + "'>&nbsp;</td></tr>");
                    header = true;
                    continue;
                }
                pw.println("\t<tr>");
                for (int j = 0; j < line.size(); j++) {
                    if (header) {
                        pw.println("\t\t<th style='border-bottom: 1px #8000AD dashed;' align='" + (j == 0 ? "left" : "center") + "'>" + line.getField(j).toString() + "</th>");
                    } else {
                        pw.println("\t\t<td align='" + (j == 0 ? "left" : "center") + "' nowrap>" + (line.getField(j) == null || line.getField(j).isEmpty() ? "-" : line.getField(j).toString().replace("+/-", "&plusmn;")) + "</td>");
                    }
                }
                pw.println("\t</tr>");
                header = false;
            }
            
            pw.println("</table>");
            
            pw.flush(); pw.close();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:48,代码来源:Csv2Html.java

示例6: main

import org.cpsolver.ifs.util.CSVFile.CSVLine; //导入依赖的package包/类
public static void main(String args[]) {
    try {
        for (int i = 0; i < args.length; i++) {
            File file = new File(args[i]);
            
            String name = file.getName();
            if (name.contains(".")) name = name.substring(0, name.indexOf('.'));
            
            CSVFile csv = new CSVFile(file);
            
            PrintWriter pw = new PrintWriter(new File(file.getParentFile(), name + ".txt"));

            pw.println("\\begin{table}[htb]");
            pw.println("\\renewcommand{\\arraystretch}{1.2}");
            String t = "l|"; for (int j = 1; j < csv.getHeader().size(); j++) t += "c";
            pw.println("\\begin{tabular}{" + t + "} \\hline \\hline");
            
            for (int j = 0; j < csv.getHeader().size(); j++) {
                if (j > 0) pw.print(" \\ & \\ ");
                pw.print(csv.getHeader().getField(j).toString());
            }
            pw.println(" \\ \\\\ \\hline");
            
            for (CSVLine line: csv.getLines()) {
                for (int j = 0; j < line.size(); j++) {
                    if (j == 0)
                        pw.print(line.getField(j));
                    else
                        pw.print(" & " + (line.getField(j) == null || line.getField(j).isEmpty() ? "-" : "$" + line.getField(j).toString().replace("%", "\\%") + "$"));
                }
                pw.println(" \\\\");
            }

            pw.println("\\hline \\hline");
            pw.println("\\end{tabular}");
            pw.println("\\caption{FIXME: Add caption here.}");
            pw.println("\\label{tab:" + name.toLowerCase() + "}");
            pw.println("\\end{table}");
            
            pw.flush(); pw.close();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:UniTime,项目名称:cpsolver,代码行数:46,代码来源:Csv2Tex.java


注:本文中的org.cpsolver.ifs.util.CSVFile.CSVLine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。