本文整理汇总了C#中Inside类的典型用法代码示例。如果您正苦于以下问题:C# Inside类的具体用法?C# Inside怎么用?C# Inside使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Inside类属于命名空间,在下文中一共展示了Inside类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Day
//constructor
public Day(int number)
{
for (int i = 0; i < 148; i++)
{
//to adapt with schedule
l_activity[i] = new Inside();
}
}
示例2: Day
//constructor
public Day(int _number, Place map_hq)
{
number = _number;
Activity defaultAct = new Inside(0, 147, map_hq);
for (int i = 0; i <= 147; i++) //24*6+4 -1 because no activity at 24:40
{
//create default activity
l_activity[i] = defaultAct;
}
}
示例3: modifyHoursActivity
public void modifyHoursActivity(Activity prevActivity, int newStart, int newEnd)
{
//we have to create a new activity and not only update the previous one not to have problems with sortActivity
Activity newActivity;
if (prevActivity is Inside) { newActivity = new Inside(newStart, newEnd, prevActivity.Place, prevActivity.Type); }
else { newActivity = new Outside(newStart, newEnd, prevActivity.Place, prevActivity.Type); }
newActivity.Description = prevActivity.Description;
newActivity.L_astronaut = prevActivity.L_astronaut;
rmActivity(prevActivity);
addActivity(newActivity);
}
示例4: Day
//constructor
public Day(int _number, Place _map_hq)
{
number = _number;
map_hq = _map_hq;
l_activity = new List<Activity>();
Activity defaultAct = new Inside(0, 147, map_hq);
for (int i = 0; i <= 147; i++) //24*6+4 -1 because no activity at 24:40
{
//create default activity
l_activity.Insert(i, defaultAct);
}
}
示例5: sortActivityList
public void sortActivityList()
{
//this function sorts a list and its activities in order them to be coherent
for (int i = 0; i < l_activity.Count -1 ; i++)//Stop at Count -1 because of i+1
{
//if two consecutive activities are different
if (!(l_activity[i].Equals(l_activity[i + 1])))
{
//but have the same type and place, it is considered as being the same activity
// So we merge the both activities
if ((l_activity[i].Type.Equals(l_activity[i + 1].Type))
&& (l_activity[i].Place.Equals(l_activity[i + 1].Place)))
{
//extend the end and merge descriptions before merging the entire activity
l_activity[i].End = l_activity[i + 1].End;
l_activity[i].Description = l_activity[i].Description + l_activity[i + 1].Description; //join the both description
l_activity[i + 1] = l_activity[i];
}
//elsewise, we reschedule the previous and forward activity activities
else
{
//We have to create a new activity instead of updating the previous one
//We check that the current ativity is not already rescheduled not to process twice
if (l_activity[i].End != i + 1)
{
if (l_activity[i] is Inside) { l_activity[i] = new Inside(l_activity[i].Start, i + 1, l_activity[i].Place, l_activity[i].Type); }
else { new Inside(l_activity[i].Start, i + 1, l_activity[i].Place, l_activity[i].Type); }
for (int j = l_activity[i].Start; j < l_activity[i].End; j++)
{
l_activity[j] = l_activity[i];
}
}
//We check that the next ativity is not already rescheduled not to process twice
if (l_activity[i + 1].Start != i + 1)
{
if (l_activity[i + 1] is Inside) { l_activity[i + 1] = new Inside(i + 1, l_activity[i + 1].End, l_activity[i + 1].Place, l_activity[i + 1].Type); }
else { new Inside(i + 1, l_activity[i + 1].End, l_activity[i + 1].Place, l_activity[i + 1].Type); }
for (int j = l_activity[i + 1].Start; j < l_activity[i + 1].End; j++)
{
l_activity[j] = l_activity[i + 1];
}
}
}
}
}
}
示例6: rmActivity
//remove an activity and replace it by an activity by default
//it is possible to remove only a part of the activity => when you make it shorter for instance
public void rmActivity(Activity prevActivity, int start, int end)
{
//has to check that the activity is on the list
//has to check that the part of the activity to remove is included in activity
if ((l_activity.Contains(prevActivity)))// && (prevActivity.Start <= start) && (prevActivity.End >= end))
{
//replace the remove activity by the default one which is private at the hq
Activity newActivity = new Inside(start, end, map_hq);
addActivity(newActivity);
}
else
{
//error message
}
}
示例7: modifyHoursActivityTest
public void modifyHoursActivityTest()
{
Day target = CreateDay(); // TODO: Initialize to an appropriate value
Activity prevActivity = new Inside(5,9,target.Map_hq, "coucou"); // TODO: Initialize to an appropriate value
int newStart = 6; // TODO: Initialize to an appropriate value
int newEnd = 9; // TODO: Initialize to an appropriate value
target.modifyHoursActivity(prevActivity, newStart, newEnd);
Day test = CreateDay();
List<Activity> expected = test.L_activity;
for (int i = 6; i <= 9; i++)
{
expected[i] = new Inside(6, 9, target.Map_hq, "coucou");
}
Assert.AreEqual(expected, target.L_activity);
Assert.Inconclusive("A method that does not return a value cannot be verified.");
}
示例8: PushOpenParen
void PushOpenParen (Inside inside)
{
int n = 1;
if ((inside & (Inside.PreProcessor | Inside.StringOrChar | Inside.Comment)) != 0)
return;
// push a new paren list onto the stack
if (firstNonLwsp != -1)
n += linebuf.Length - firstNonLwsp;
stack.Push (Inside.ParenList, keyword, curLineNr, n);
keyword = String.Empty;
}
示例9: PushSemicolon
void PushSemicolon (Inside inside)
{
if ((inside & (Inside.PreProcessor | Inside.StringOrChar | Inside.Comment)) != 0)
return;
if (inside == Inside.FoldedStatement) {
// chain-pop folded statements
while (stack.PeekInside (0) == Inside.FoldedStatement)
stack.Pop ();
}
keyword = String.Empty;
}
示例10: PushOpenSq
void PushOpenSq (Inside inside)
{
int n = 1;
if ((inside & (Inside.PreProcessor | Inside.StringOrChar | Inside.Comment)) != 0)
return;
// push a new attribute onto the stack
if (firstNonLwsp != -1)
n += linebuf.Length - firstNonLwsp;
stack.Push (Inside.Attribute, keyword, curLineNr, n);
}
示例11: PushSQuote
void PushSQuote (Inside inside)
{
if (inside == Inside.CharLiteral) {
// check that it's not escaped
if (isEscaped)
return;
keyword = stack.PeekKeyword (0);
stack.Pop ();
return;
}
if ((inside & (Inside.PreProcessor | Inside.String | Inside.Comment)) != 0) {
// won't be starting a CharLiteral, so ignore it
return;
}
// push a new char literal onto the stack
stack.Push (Inside.CharLiteral, keyword, curLineNr, 0);
}
示例12: PushColon
void PushColon (Inside inside)
{
if (inside != Inside.Block && inside != Inside.Case)
return;
// can't be a case/label if there's no preceeding text
if (wordStart == -1)
return;
// goto-label or case statement
if (keyword == "case" || keyword == "default") {
// case (or default) statement
if (stack.PeekKeyword (0) != "switch")
return;
if (inside == Inside.Case) {
stack.Pop ();
string newIndent = stack.PeekIndent (0);
if (curIndent != newIndent) {
curIndent = newIndent;
needsReindent = true;
}
}
if (!policy.IndentSwitchBody) {
needsReindent = true;
TrimIndent ();
}
stack.Push (Inside.Case, "switch", curLineNr, 0);
} else if (canBeLabel) {
//GotoLabelIndentStyle style = FormattingProperties.GotoLabelIndentStyle;
GotoLabelIndentStyle style = GotoLabelIndentStyle.OneLess;
// indent goto labels as specified
switch (style) {
case GotoLabelIndentStyle.LeftJustify:
needsReindent = true;
// curIndent = " ";
break;
case GotoLabelIndentStyle.OneLess:
needsReindent = true;
TrimIndent ();
// curIndent += " ";
break;
default:
break;
}
canBeLabel = false;
} else if (pc == ':') {
// :: operator, need to undo the "unindent label" operation we did for the previous ':'
curIndent = stack.PeekIndent (0);
needsReindent = true;
}
}
示例13: PushStar
void PushStar(Inside inside)
{
if (pc != '/')
return;
// got a "/*" - might start a MultiLineComment
if ((inside & (Inside.String | Inside.Comment)) != 0)
return;
// push a new multiline comment onto the stack
int n = linebuf.Length - firstNonLwsp;
stack.Push (Inside.MultiLineComment, keyword, currLineNumber, n);
// drop the previous '/': it belongs to this comment block
rc = prc;
}
示例14: PushQuote
void PushQuote (Inside inside)
{
Inside type;
// ignore if in these
if ((inside & (Inside.PreProcessor | Inside.Comment | Inside.CharLiteral)) != 0)
return;
if (inside == Inside.VerbatimString) {
if (popVerbatim) {
// back in the verbatim-string-literal token
popVerbatim = false;
} else {
/* need to see the next char before we pop the
* verbatim-string-literal */
popVerbatim = true;
}
} else if (inside == Inside.StringLiteral) {
// check that it isn't escaped
if (!isEscaped) {
keyword = stack.PeekKeyword (0);
stack.Pop ();
}
} else {
// FoldedStatement, Block, Attribute or ParenList
if (pc == '@')
type = Inside.VerbatimString;
else
type = Inside.StringLiteral;
// push a new string onto the stack
stack.Push (type, keyword, curLineNr, 0);
}
}
示例15: Push
public void Push (Inside inside, string keyword, int lineNr, int nSpaces)
{
StringBuilder indentBuilder;
int sp = size - 1;
Node node;
int n = 0;
indentBuilder = new StringBuilder ();
if ((inside & (Inside.Attribute | Inside.ParenList)) != 0) {
if (size > 0 && stack[sp].Inside == inside) {
while (sp >= 0) {
if ((stack[sp].Inside & Inside.FoldedOrBlock) != 0)
break;
sp--;
}
if (sp >= 0) {
indentBuilder.Append (stack[sp].Indent);
if (stack[sp].LineNr == lineNr)
n = stack[sp].NumSpaces;
}
} else {
while (sp >= 0) {
if ((stack[sp].Inside & Inside.FoldedBlockOrCase) != 0) {
indentBuilder.Append (stack[sp].Indent);
break;
}
sp--;
}
}
if (nSpaces - n <= 0) {
indentBuilder.Append ('\t');
} else {
indentBuilder.Append (' ', nSpaces - n);
}
} else if (inside == Inside.MultiLineComment) {
if (size > 0) {
indentBuilder.Append (stack[sp].Indent);
if (stack[sp].LineNr == lineNr)
n = stack[sp].NumSpaces;
}
indentBuilder.Append (' ', nSpaces - n);
} else if (inside == Inside.Case) {
while (sp >= 0) {
if ((stack[sp].Inside & Inside.FoldedOrBlock) != 0) {
indentBuilder.Append (stack[sp].Indent);
break;
}
sp--;
}
if (engine.policy.IndentSwitchBody)
indentBuilder.Append ('\t');
nSpaces = 0;
} else if ((inside & (Inside.FoldedOrBlock)) != 0) {
while (sp >= 0) {
if ((stack[sp].Inside & Inside.FoldedBlockOrCase) != 0) {
indentBuilder.Append (stack[sp].Indent);
break;
}
sp--;
}
Inside parent = size > 0 ? stack[size - 1].Inside : Inside.Empty;
// This is a workaround to make anonymous methods indent nicely
if (parent == Inside.ParenList)
stack[size - 1].Indent = indentBuilder.ToString ();
if (inside == Inside.FoldedStatement) {
indentBuilder.Append ('\t');
} else if (inside == Inside.Block) {
if (parent != Inside.Case || nSpaces != -1)
indentBuilder.Append ('\t');
}
nSpaces = 0;
} else if ((inside & (Inside.PreProcessor | Inside.StringOrChar)) != 0) {
// if these fold, do not indent
nSpaces = 0;
//pop regions back out
if (keyword == "region" || keyword == "endregion") {
for (; sp >= 0; sp--) {
if ((stack[sp].Inside & Inside.FoldedBlockOrCase) != 0) {
indentBuilder.Append (stack[sp].Indent);
break;
}
}
}
} else if (inside == Inside.LineComment || inside == Inside.DocComment) {
// can't actually fold, but we still want to push it onto the stack
nSpaces = 0;
} else {
// not a valid argument?
throw new ArgumentOutOfRangeException ();
//.........这里部分代码省略.........