本文整理汇总了C#中ISchedule.GetClassByRoomAndPosition方法的典型用法代码示例。如果您正苦于以下问题:C# ISchedule.GetClassByRoomAndPosition方法的具体用法?C# ISchedule.GetClassByRoomAndPosition怎么用?C# ISchedule.GetClassByRoomAndPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISchedule
的用法示例。
在下文中一共展示了ISchedule.GetClassByRoomAndPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFineOfAddedClass
public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
{
int fineResult = 0;
StudentsClass tempClass = schedule.GetTempClass();
int classTime = schedule.GetTimeOfTempClass();
int roomIndex = schedule.GetClassPosition(schedule.GetTempClass()).Value.ClassRoom;
int weekOfClass = Constants.GetWeekOfClass(classTime);
if (Array.Find(sClassesList.ToArray(), (c) => c == schedule.GetTempClass()) != null)
{
StudentsClass secondClass;
if (weekOfClass == 0)
secondClass = schedule.GetClassByRoomAndPosition(roomIndex, classTime + Constants.CLASSES_IN_DAY * Constants.DAYS_IN_WEEK);
else
secondClass = schedule.GetClassByRoomAndPosition(roomIndex, classTime - Constants.CLASSES_IN_DAY * Constants.DAYS_IN_WEEK);
if (secondClass != null)
{
int firstClassRow = ClassesInWeek.GetRow(sClasses, tempClass);
int secondClassRow = ClassesInWeek.GetRow(sClasses, secondClass);
if (secondClassRow == -1 || secondClassRow != firstClassRow)
{
if (isBlock)
return Constants.BLOCK_FINE;
else
fineResult += fine;
}
}
}
return fineResult;
}
示例2: GetFineOfFullSchedule
public int GetFineOfFullSchedule(ISchedule schedule, EntityStorage eStorage)
{
int fineResult = 0;
foreach (StudentSubGroup subGroup in eStorage.StudentSubGroups)
{
for (int dayIndex = 0; dayIndex < Constants.DAYS_IN_WEEK; dayIndex++)
{
StudentsClass[] subGroupDay = schedule.GetPartialSchedule(subGroup).GetClassesOfDay(dayIndex);
for (int classIndex = 0; classIndex < subGroupDay.Length; classIndex++)
{
if (Array.Find<StudentsClass>(sClassesList.ToArray(), (c) => c == subGroupDay[classIndex]) != null)
{
StudentsClassPosition? firstClassPosition = schedule.GetClassPosition(subGroupDay[classIndex]);
StudentsClass secondClass = schedule.GetClassByRoomAndPosition(firstClassPosition.Value.ClassRoom,
firstClassPosition.Value.Time + Constants.CLASSES_IN_DAY * Constants.DAYS_IN_WEEK);
if (secondClass != null)
{
int firstClassRow = ClassesInWeek.GetRow(sClasses, subGroupDay[classIndex]);
int secondClassRow = ClassesInWeek.GetRow(sClasses, secondClass);
if (secondClassRow == -1 || secondClassRow != firstClassRow)
{
if (isBlock)
return Constants.BLOCK_FINE;
else
fineResult += fine;
}
}
}
}
}
}
return fineResult;
}
示例3: PairClassesAtSameTimeInSameRoom
public static bool PairClassesAtSameTimeInSameRoom(ISchedule schedule, StudentsClass[,] sClasses, List<StudentsClass> sClassesList, StudentsClass firstClass)
{
StudentsClassPosition? firstClassPosition = schedule.GetClassPosition(firstClass);
int weekOfClass = Constants.GetWeekOfClass(firstClassPosition.Value.Time);
if (Array.Find(sClassesList.ToArray(), (c) => c == firstClass) != null)
{
int classRow = ClassesInWeek.GetRow(sClasses, firstClass);
int firstClassCol = ClassesInWeek.GetColumn(sClasses, firstClass);
int secondClassCol = -1;
switch (firstClassCol)
{
case 0:
secondClassCol = 1;
break;
case 1:
secondClassCol = 0;
break;
default:
break;
}
StudentsClass secondClass = sClasses[classRow, secondClassCol];
StudentsClassPosition? secondClassPosition = schedule.GetClassPosition(secondClass);
int probablySecondClassTime;
if (weekOfClass == 0)
probablySecondClassTime = firstClassPosition.Value.Time + Constants.CLASSES_IN_DAY * Constants.DAYS_IN_WEEK;
else
probablySecondClassTime = firstClassPosition.Value.Time - Constants.CLASSES_IN_DAY * Constants.DAYS_IN_WEEK;
if (secondClassPosition.HasValue)
{
if (probablySecondClassTime == secondClassPosition.Value.Time)
{
if (firstClassPosition.Value.ClassRoom != secondClassPosition.Value.ClassRoom)
{
return false;
}
}
}
else
{
secondClass = schedule.GetClassByRoomAndPosition(firstClassPosition.Value.ClassRoom, probablySecondClassTime);
if (secondClass != null)
{
return false;
}
}
}
return true;
}