project

package
v0.0.0-...-d4285bb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2014 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package project provides data structures for storing information about projects, submissions and files.

Index

Constants

View Source
const (
	MODE         = "mode"
	TYPE         = "type"
	TIME         = "time"
	FILE_MODE    = "file_remote"
	ARCHIVE_MODE = "archive_remote"
	NAME         = "name"
	PKG          = "package"
	JSRC         = ".java"
	BIN_DIR      = "bin"
	SRC_DIR      = "src"
)

Constants used client and server-side to for submission data.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	User  string
	Data  string
	Start int
	End   int
}

type Commentor

type Commentor interface {
	LoadComments() []*Comment
}

type File

type File struct {
	Id       bson.ObjectId `bson:"_id"`
	SubId    bson.ObjectId `bson:"subid"`
	Name     string        `bson:"name"`
	Package  string        `bson:"package"`
	Type     Type          `bson:"type"`
	Time     int64         `bson:"time"`
	Data     []byte        `bson:"data"`
	Results  bson.M        `bson:"results"`
	Comments []*Comment    `bson:"comments"`
}

File stores a single file's data from a submission.

func NewArchive

func NewArchive(sid bson.ObjectId, d []byte) *File

NewArchive

func NewFile

func NewFile(sid bson.ObjectId, m map[string]interface{}, d []byte) (*File, error)

NewFile

func ParseName

func ParseName(n string) (*File, error)

ParseName retrieves file metadata encoded in a file name. These file names must have the format: [[<package descriptor>"_"]*<file name>"_"]<time in nanoseconds> "_"<file number in current submission>"_"<modification char> Where values between '[]' are optional, '*' indicates 0 to many, values inside '""' are literals and values inside '<>' describe the contents at that position.

func (*File) CanProcess

func (f *File) CanProcess() bool

CanProcess returns whether a file is meant to be processed.

func (*File) Equals

func (f *File) Equals(cf *File) bool

Equals

func (*File) LoadComments

func (f *File) LoadComments() []*Comment

func (*File) Rename

func (f *File) Rename(n string)

func (*File) Same

func (f *File) Same(cf *File) bool

Same

func (*File) String

func (f *File) String() string

String

type Files

type Files []*File

func (Files) Len

func (fs Files) Len() int

func (Files) Less

func (fs Files) Less(i, j int) bool

func (Files) Swap

func (fs Files) Swap(i, j int)

type Project

type Project struct {
	Id          bson.ObjectId `bson:"_id"`
	Name        string        `bson:"name"`
	User        string        `bson:"user"`
	Lang        string        `bson:"lang"`
	Time        int64         `bson:"time"`
	Description string        `bson:"description"`
}

Project represents a Impendulo project.

func New

func New(n, u, l, d string) *Project

New

func (*Project) String

func (p *Project) String() string

String

func (*Project) TypeName

func (p *Project) TypeName() string

TypeName

type Skeleton

type Skeleton struct {
	Id        bson.ObjectId `bson:"_id"`
	ProjectId bson.ObjectId `bson:"projectid"`
	Name      string        `bson:"name"`
	//	Files     map[string]*SkeletonFile `bson:"files"`
	Data []byte `bson:"data"`
}

func NewSkeleton

func NewSkeleton(pid bson.ObjectId, n string, d []byte) *Skeleton

NewSkeleton

type Submission

type Submission struct {
	Id        bson.ObjectId `bson:"_id"`
	ProjectId bson.ObjectId `bson:"projectid"`
	User      string        `bson:"user"`
	Mode      string        `bson:"mode"`
	Time      int64         `bson:"time"`
	Comments  []*Comment    `bson:"comments"`
}

Submission is used for individual project submissions

func NewSubmission

func NewSubmission(pid bson.ObjectId, u, m string, t int64) *Submission

NewSubmission

func (*Submission) Format

func (s *Submission) Format(p *Project) string

func (*Submission) LoadComments

func (s *Submission) LoadComments() []*Comment

func (*Submission) SetMode

func (s *Submission) SetMode(m string) error

SetMode

func (*Submission) String

func (s *Submission) String() string

String

type Type

type Type string
const (
	SRC     Type = "src"
	LAUNCH  Type = "launch"
	ARCHIVE Type = "archive"
	TEST    Type = "test"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL