本文整理汇总了C#中Inside类的典型用法代码示例。如果您正苦于以下问题:C# Inside类的具体用法?C# Inside怎么用?C# Inside使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Inside类属于命名空间,在下文中一共展示了Inside类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Day
//constructor
public Day(int number)
{
for (int i = 0; i < 148; i++)
{
//to adapt with schedule
l_activity[i] = new Inside();
}
}
开发者ID:Elsakhi,项目名称:PI_Mars,代码行数:9,代码来源:Day.cs
示例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;
}
}
开发者ID:RxnDbr,项目名称:PI_Mars,代码行数:11,代码来源:Day.cs
示例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);
}
开发者ID:RxnDbr,项目名称:PI_Mars,代码行数:13,代码来源:Future.cs
示例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);
}
}
开发者ID:RxnDbr,项目名称:PI_Mars,代码行数:14,代码来源:Day.cs
示例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];
}
}
}
}
}
}
开发者ID:RxnDbr,项目名称:PI_Mars,代码行数:51,代码来源:Day.cs
示例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
}
}
开发者ID:RxnDbr,项目名称:PI_Mars,代码行数:17,代码来源:Future.cs
示例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.");
}
开发者ID:RxnDbr,项目名称:PI_Mars,代码行数:18,代码来源:DayTest.cs
示例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;
}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:15,代码来源:CSharpIndentEngine.cs
示例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;
}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:13,代码来源:CSharpIndentEngine.cs
示例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);
}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:13,代码来源:CSharpIndentEngine.cs
示例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);
}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:20,代码来源:CSharpIndentEngine.cs
示例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;
}
}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:55,代码来源:CSharpIndentEngine.cs
示例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;
}
开发者ID:atsushieno,项目名称:md-typescript,代码行数:17,代码来源:TypeScriptIndentEngine.cs
示例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);
}
}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:34,代码来源:CSharpIndentEngine.cs
示例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 ();
//.........这里部分代码省略.........
开发者ID:segaman,项目名称:monodevelop,代码行数:101,代码来源:CSharpIndentEngineStack.cs
示例16: Push
public void Push(char ch)
{
if (readPreprocessorExpression) {
wordBuf.Append(ch);
}
if (inside.HasFlag(Inside.VerbatimString) && pc == '"' && ch != '"') {
inside &= ~Inside.StringLiteral;
}
switch (ch) {
case '#':
if (IsLineStart)
inside = Inside.PreProcessor;
break;
case '/':
if (IsInStringOrChar || IsInPreProcessorComment)
break;
if (pc == '/') {
if (inside.HasFlag(Inside.Comment)) {
inside |= Inside.DocComment;
} else {
inside |= Inside.Comment;
}
}
break;
case '*':
if (IsInStringOrChar || IsInComment || IsInPreProcessorComment)
break;
if (pc == '/')
inside |= Inside.MultiLineComment;
break;
case ' ':
currentIndent.Append(' ');
break;
case '\t':
var nextTabStop = (col - 1 + textEditorOptions.IndentSize) / textEditorOptions.IndentSize;
col = 1 + nextTabStop * textEditorOptions.IndentSize;
currentIndent.Append('\t');
offset++;
return;
case '\r':
if (readPreprocessorExpression) {
if (!eval(wordBuf.ToString()))
inside |= Inside.PreProcessorComment;
}
inside &= ~(Inside.Comment | Inside.String | Inside.CharLiteral | Inside.PreProcessor);
CheckKeyword(wordBuf.ToString());
wordBuf.Length = 0;
indent.Push(indentDelta);
indentDelta = new Indent(textEditorOptions);
if (addContinuation) {
indent.Push(IndentType.Continuation);
}
thisLineindent = indent.Clone();
addContinuation = false;
IsLineStart = true;
readPreprocessorExpression = false;
col = 1;
line++;
currentIndent.Length = 0;
break;
case '\n':
if (pc == '\r')
break;
goto case '\r';
case '"':
if (IsInComment || IsInPreProcessorComment)
break;
if (inside.HasFlag(Inside.StringLiteral)) {
if (pc != '\\')
inside &= ~Inside.StringLiteral;
break;
}
if (pc == '@') {
inside |= Inside.VerbatimString;
} else {
inside |= Inside.StringLiteral;
}
break;
case '<':
case '[':
case '(':
if (IsInComment || IsInStringOrChar || IsInPreProcessorComment)
break;
parenStack.Push(new TextLocation(line, col));
popNextParenBlock = true;
indent.Push(IndentType.Block);
break;
case '>':
case ']':
case ')':
if (IsInComment || IsInStringOrChar || IsInPreProcessorComment)
break;
if (popNextParenBlock && parenStack.Count > 0)
parenStack.Pop();
if (indent.Count > 0)
//.........这里部分代码省略.........
开发者ID:segaman,项目名称:NRefactory,代码行数:101,代码来源:CSharpIndentEngine.cs
示例17: PushCloseBrace
void PushCloseBrace (Inside inside)
{
if ((inside & (Inside.PreProcessor | Inside.StringOrChar | Inside.Comment)) != 0)
return;
if (inside != Inside.Block && inside != Inside.Case) {
if (stack.PeekInside (0) == Inside.FoldedStatement) {
while (stack.PeekInside (0) == Inside.FoldedStatement) {
stack.Pop ();
}
curIndent = stack.PeekIndent (0);
keyword = stack.PeekKeyword (0);
inside = stack.PeekInside (0);
}
//Console.WriteLine ("can't pop a '{' if we ain't got one?");
if (inside != Inside.Block && inside != Inside.Case)
return;
}
if (inside == Inside.Case) {
curIndent = stack.PeekIndent (1);
keyword = stack.PeekKeyword (0);
inside = stack.PeekInside (1);
stack.Pop ();
}
if (inside == Inside.ParenList) {
curIndent = stack.PeekIndent (0);
keyword = stack.PeekKeyword (0);
inside = stack.PeekInside (0);
}
// pop this block off the stack
keyword = stack.PeekKeyword (0);
if (keyword != "case" && keyword != "default")
keyword = String.Empty;
stack.Pop ();
while (stack.PeekInside (0) == Inside.FoldedStatement) {
stack.Pop ();
}
if (firstNonLwsp == -1) {
needsReindent = true;
TrimIndent ();
}
}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:47,代码来源:CSharpIndentEngine.cs
示例18: PushCloseParen
void PushCloseParen (Inside inside)
{
if ((inside & (Inside.PreProcessor | Inside.StringOrChar | Inside.Comment)) != 0)
return;
if (inside != Inside.ParenList) {
//Console.WriteLine ("can't pop a '(' if we ain't got one?");
return;
}
// pop this paren list off the stack
keyword = stack.PeekKeyword (0);
stack.Pop ();
}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:14,代码来源:CSharpIndentEngine.cs
示例19: Push
public void Push (Inside inside, byte keyword, int lineNr, int nSpaces)
{
int sp = size - 1;
Node node;
int n = 0;
var 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].nSpaces;
}
} 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.NestedComment | Inside.BlockComment)) != 0) {
if (size > 0) {
indentBuilder.Append (stack[sp].indent);
if (stack[sp].lineNr == lineNr)
n = stack[sp].nSpaces;
}
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 (ie.Options.IndentSwitchBody)
indentBuilder.Append ('\t');
nSpaces = 0;
} else if ((inside & (Inside.FoldedOrBlock)) != 0) {
while (sp >= 0) {
if ((stack[sp].inside & Inside.FoldedBlockOrCase) != 0) { // Optional: Check for Inside.ParenList to align the following lines like the previous line
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 || inside == Inside.SquareBracketList) {
if (parent != Inside.Case || nSpaces != -1)
indentBuilder.Append ('\t');
}
nSpaces = 0;
} else if ((inside & (Inside.Shebang | Inside.PreProcessor | Inside.StringOrChar)) != 0) {
// if these fold, do not indent
nSpaces = 0;
} 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 ();
}
// Replace additionally inserted spaces with tabs
if (!ie.tabsToSpaces && !ie.keepAlignmentSpaces)
{
n = 0;
for(int i = 0; i < indentBuilder.Length; i++)
{
if (indentBuilder[i] == ' ')
{
n++;
//.........这里部分代码省略.........
开发者ID:DinrusGroup,项目名称:DinrusIDE,代码行数:101,代码来源:IndentStack.cs
示例20: Push
public void Push (Inside inside, byte keyword, int lineNr, int nSpaces, string indent)
{
Node node;
node.indent = indent;
node.keyword = keyword;
node.nSpaces = nSpaces;
node.lineNr = lineNr;
node.inside = inside;
node.ifelseBackupStack = null;
if (size == stack.Length)
Array.Resize <Node> (ref stack, 2 * size);
stack[size++] = node;
}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:16,代码来源:IndentStack.cs
注:本文中的Inside类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论