code
stringlengths 3
1.01M
| repo_name
stringlengths 5
116
| path
stringlengths 3
311
| language
stringclasses 30
values | license
stringclasses 15
values | size
int64 3
1.01M
|
|---|---|---|---|---|---|
<!-- get the typekit for fonts -->
<script src="https://use.typekit.net/dyl2urd.js"></script>
<script>try{Typekit.load({ async: true });}catch(e){}</script>
|
uvalib/staff-directory
|
bower_components/uvalib-helper-libs/typekit-dev.html
|
HTML
|
apache-2.0
| 157
|
package io.anyway.sherlock.spring;
public interface Constants {
final public static String DATA_SOURCE_PARTITIONS= "data-source-partitions";
final public static String DATA_SOURCE_PARTITION= "data-source-partition";
final public static String MASTER_DATA_SOURCE= "master-data-source";
final public static String SLAVE_DATA_SOURCE= "slave-data-source";
final public static String DATA_BASE_TYPE= "database-type";
final public static String POOL_SIZE= "pool-size";
final public static String TIME_OUT= "timeout";
final public static String READ_STRATEGY= "read-strategy";
final public static String DATABASE_ROUTER= "database-router";
final public static String SHARDING_CACHE= "sharding-cache";
final public static String DATA_SOURCE_NAME= "name";
final public static String DATA_SOURCE_REF= "ref";
final public static String DATA_SOURCE_WEIGHT= "weight";
final public static String TABLES= "tables";
final public static String GLOBAL_TABLE= "global-table";
final public static String LOGIC_TABLE= "logic-table";
final public static String LOGIC_CHILD_TABLE= "logic-child-table";
final public static String TABLE_NAME= "name";
final public static String PARTITION_DATA_SOURCE_NAMES= "data-sources";
final public static String PRIMARY_KEY= "primary-key";
final public static String FOREIGN_KEY= "foreign-key";
final public static String TABLE_STRATEGY= "table-strategy";
final public static String DATA_BASE_STRATEGY= "database-strategy";
final public static String TABLE_POSTFIXES= "table-postfixes";
}
|
balanacebeam/PDDL
|
sherlock-core/src/main/java/io/anyway/sherlock/spring/Constants.java
|
Java
|
apache-2.0
| 1,535
|
/*
* Copyright 2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.api.internal.file.pattern;
import com.google.common.base.Joiner;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.junit.Test;
import java.util.LinkedHashSet;
import java.util.Set;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
public class PatternMatcherFactoryTest {
private PatternMatcher matcher;
@Test public void testNoStackOverflowForManyPatterns() {
// The only reason for this unit test is to verify that no StackOverflowException is being thrown when
// many patterns are passed to getPatternsMatcher. See https://github.com/gradle/gradle/issues/10329
Set<String> manyPatterns = new LinkedHashSet<String>();
for (int i = 0; i < 5000; i++) {
manyPatterns.add("some/package/Some" + i + "ClassName.class");
manyPatterns.add("some/package/Some" + i + "ClassName.java");
manyPatterns.add("some/package/Some" + i + "ClassName.h");
manyPatterns.add("some/package/Some" + i + "ClassName$*.class");
manyPatterns.add("some/package/Some" + i + "ClassName$*.java");
manyPatterns.add("some/package/Some" + i + "ClassName$*.h");
}
matcher = PatternMatcherFactory.getPatternsMatcher(true, true, manyPatterns);
assertThat(matcher, not(matchesFile("some", "package", "SomeClassName.java")));
assertThat(matcher, matchesFile("some", "package", "Some123ClassName.java"));
}
@Test public void testManyOr() {
Set<String> manyPatterns = new LinkedHashSet<String>();
manyPatterns.add("some/package/SomeClassName.class");
manyPatterns.add("some/package/SomeClassName.java");
manyPatterns.add("some/package/SomeClassName.h");
manyPatterns.add("some/package/SomeClassName$*.class");
manyPatterns.add("some/package/SomeClassName$*.java");
manyPatterns.add("some/package/SomeClassName$*.h");
matcher = PatternMatcherFactory.getPatternsMatcher(true, true, manyPatterns);
assertThat(matcher, not(matchesFile()));
assertThat(matcher, matchesFile("some", "package", "SomeClassName.java"));
assertThat(matcher, matchesFile("some", "package", "SomeClassName.class"));
assertThat(matcher, matchesFile("some", "package", "SomeClassName.h"));
assertThat(matcher, matchesFile("some", "package", "SomeClassName$*.java"));
assertThat(matcher, matchesFile("some", "package", "SomeClassName$*.class"));
assertThat(matcher, matchesFile("some", "package", "SomeClassName$*.h"));
assertThat(matcher, not(matchesFile("a")));
}
@Test public void testEmpty() {
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "");
assertThat(matcher, matchesFile());
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("a", "b")));
}
@Test public void testSlashDirection() {
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "a/b/c");
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("a", "b")));
assertThat(matcher, not(matchesFile("a", "b", "c", "d")));
assertThat(matcher, not(matchesFile("a", "other", "c")));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "a\\b\\c");
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("a", "b")));
assertThat(matcher, not(matchesFile("a", "b", "c", "d")));
assertThat(matcher, not(matchesFile("a", "other", "c")));
}
@Test public void testCaseSensitive() {
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "a/b/c");
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, not(matchesFile("a", "b", "C")));
matcher = PatternMatcherFactory.getPatternMatcher(true, false, "a\\b\\c");
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, matchesFile("a", "b", "C"));
}
@Test public void testTrailingSlashIsReplacedWithTrailingGreedy() {
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "a/b/");
assertThat(matcher, matchesFile("a", "b"));
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("a", "c")));
assertThat(matcher, not(matchesFile("c", "b")));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "a\\b\\");
assertThat(matcher, matchesFile("a", "b"));
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("a", "c")));
assertThat(matcher, not(matchesFile("c", "b")));
}
@Test public void testDuplicateSeparatorIsIgnored() {
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "a//b");
assertThat(matcher, matchesFile("a", "b"));
assertThat(matcher, not(matchesFile("a", "b", "c")));
assertThat(matcher, not(matchesFile("a", "c")));
assertThat(matcher, not(matchesFile("c", "b")));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "a\\\\b");
assertThat(matcher, matchesFile("a", "b"));
assertThat(matcher, not(matchesFile("a", "b", "c")));
assertThat(matcher, not(matchesFile("a", "c")));
assertThat(matcher, not(matchesFile("c", "b")));
}
@Test public void testGreedyWithTrailingName() {
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "**/*.jsp");
assertThat(matcher, matchesFile("fred.jsp"));
assertThat(matcher, matchesFile("a", "fred.jsp"));
assertThat(matcher, matchesFile("a", "b", "fred.jsp"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("fred.txt")));
assertThat(matcher, not(matchesFile("src", "fred.txt")));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "**/**/*.jsp");
assertThat(matcher, matchesFile("fred.jsp"));
assertThat(matcher, matchesFile("a", "fred.jsp"));
assertThat(matcher, matchesFile("a", "b", "fred.jsp"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("fred.txt")));
assertThat(matcher, not(matchesFile("src", "fred.txt")));
}
@Test public void testGreedyWithSingleNameFollowedByGreedy() {
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "**/*a*/**");
assertThat(matcher, matchesFile("abc"));
assertThat(matcher, matchesFile("a", "abc", "a"));
assertThat(matcher, matchesFile("q", "abc", "r", "abc"));
assertThat(matcher, matchesFile("q", "r", "abc"));
assertThat(matcher, matchesFile("abc", "q", "r"));
assertThat(matcher, matchesFile("q", "r", "abc", "q", "r"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("b")));
assertThat(matcher, not(matchesFile("b", "b")));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "**/**/abc/**/**");
assertThat(matcher, matchesFile("abc"));
assertThat(matcher, matchesFile("a", "abc", "a"));
assertThat(matcher, matchesFile("q", "abc", "r", "abc"));
assertThat(matcher, matchesFile("q", "r", "abc"));
assertThat(matcher, matchesFile("abc", "q", "r"));
assertThat(matcher, matchesFile("q", "r", "abc", "q", "r"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("b")));
assertThat(matcher, not(matchesFile("b", "b")));
}
@Test public void testWildcards() {
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "a/*");
assertThat(matcher, matchesFile("a", "b"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("a", "b", "c")));
assertThat(matcher, not(matchesFile("other", "b")));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "?");
assertThat(matcher, matchesFile("?"));
assertThat(matcher, matchesFile("a"));
assertThat(matcher, matchesFile("C"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("abc")));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "?b??e*");
assertThat(matcher, matchesFile("?b??e*"));
assertThat(matcher, matchesFile("abcde"));
assertThat(matcher, matchesFile("abcdefgh"));
assertThat(matcher, not(matchesFile("aaaae")));
assertThat(matcher, not(matchesFile("abcdfe")));
assertThat(matcher, not(matchesFile("abc")));
}
@Test public void testLiteralsPartialMatchingDirs() {
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "a/b");
assertThat(matcher, matchesDir());
assertThat(matcher, matchesDir("a"));
assertThat(matcher, matchesDir("a", "b"));
assertThat(matcher, not(matchesDir("other")));
assertThat(matcher, not(matchesDir("other", "b")));
assertThat(matcher, not(matchesDir("b", "other")));
assertThat(matcher, not(matchesDir("a", "b", "c")));
}
@Test public void testGreedy() {
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "**");
assertThat(pathMatcher(matcher), instanceOf(AnythingMatcher.class));
assertThat(matcher, matchesFile());
assertThat(matcher, matchesFile("a"));
assertThat(matcher, matchesFile("a", "b", "c"));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "**/");
assertThat(pathMatcher(matcher), instanceOf(AnythingMatcher.class));
assertThat(matcher, matchesFile());
assertThat(matcher, matchesFile("a"));
assertThat(matcher, matchesFile("a", "b", "c"));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "**/**/**");
assertThat(pathMatcher(matcher), instanceOf(AnythingMatcher.class));
assertThat(matcher, matchesFile());
assertThat(matcher, matchesFile("a"));
assertThat(matcher, matchesFile("a", "b", "c"));
}
@Test public void testGreedyPatternsMatchingFiles() {
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "**");
assertThat(matcher, matchesFile());
assertThat(matcher, matchesFile("a"));
assertThat(matcher, matchesFile("a", "b", "c"));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "**/a");
assertThat(matcher, matchesFile("a"));
assertThat(matcher, matchesFile("b", "a"));
assertThat(matcher, matchesFile("a", "b", "a"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("b")));
assertThat(matcher, not(matchesFile("a", "b")));
assertThat(matcher, not(matchesFile("b", "a", "c")));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "**/a/b/**");
assertThat(matcher, matchesFile("a", "b"));
assertThat(matcher, matchesFile("c", "a", "b"));
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, matchesFile("c", "a", "b", "d"));
assertThat(matcher, matchesFile("a", "b", "a", "b"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("b")));
assertThat(matcher, not(matchesFile("a", "c", "b")));
assertThat(matcher, not(matchesFile("c", "d")));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "**/a/**/b");
assertThat(matcher, matchesFile("a", "b"));
assertThat(matcher, matchesFile("a", "c", "b"));
assertThat(matcher, matchesFile("c", "a", "b"));
assertThat(matcher, matchesFile("c", "a", "d", "b"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("a", "b", "c")));
assertThat(matcher, not(matchesFile("c", "d")));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "a/b/**");
assertThat(matcher, matchesFile("a", "b"));
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("a", "c", "b")));
assertThat(matcher, not(matchesFile("c", "a", "b")));
assertThat(matcher, not(matchesFile("c", "d")));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "a/b/**/c");
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, matchesFile("a", "b", "d", "c"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("a", "b")));
assertThat(matcher, not(matchesFile("a", "b", "c", "d")));
assertThat(matcher, not(matchesFile("a", "c", "b", "c")));
assertThat(matcher, not(matchesFile("d", "a", "b")));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "a/b/**/c/**");
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, matchesFile("a", "b", "d", "c"));
assertThat(matcher, matchesFile("a", "b", "c", "d"));
assertThat(matcher, matchesFile("a", "b", "d", "c", "d"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("a", "b")));
assertThat(matcher, not(matchesFile("d", "a", "b")));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "**/*");
assertThat(matcher, matchesFile("a"));
assertThat(matcher, matchesFile("a", "b"));
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, not(matchesFile()));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "*/**");
assertThat(matcher, matchesFile("a"));
assertThat(matcher, matchesFile("a", "b"));
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, not(matchesFile()));
matcher = PatternMatcherFactory.getPatternMatcher(false, true, "a/**/*");
assertThat(matcher, matchesFile("a", "b"));
assertThat(matcher, matchesFile("a", "b", "c"));
assertThat(matcher, matchesFile("a", "b", "c", "d"));
assertThat(matcher, not(matchesFile()));
assertThat(matcher, not(matchesFile("a")));
assertThat(matcher, not(matchesFile("b", "a")));
}
@Test public void testGreedyPatternsPartialMatchingDirs() {
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "**");
assertThat(matcher, matchesDir());
assertThat(matcher, matchesDir("a"));
assertThat(matcher, matchesDir("a", "b", "c"));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "**/a");
assertThat(matcher, matchesDir());
assertThat(matcher, matchesDir("a"));
assertThat(matcher, matchesDir("b", "a"));
assertThat(matcher, matchesDir("a", "b", "a"));
assertThat(matcher, matchesDir("d"));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "**/a/b/**");
assertThat(matcher, matchesDir());
assertThat(matcher, matchesDir("a", "b"));
assertThat(matcher, matchesDir("c", "a", "b"));
assertThat(matcher, matchesDir("a", "b", "c"));
assertThat(matcher, matchesDir("c", "a", "b", "d"));
assertThat(matcher, matchesDir("a", "b", "a", "b"));
assertThat(matcher, matchesDir("a"));
assertThat(matcher, matchesDir("c"));
assertThat(matcher, matchesDir("c", "a"));
assertThat(matcher, matchesDir("c", "a", "a", "b"));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "a/b/**");
assertThat(matcher, matchesDir());
assertThat(matcher, matchesDir("a", "b"));
assertThat(matcher, matchesDir("a", "b", "c"));
assertThat(matcher, matchesDir("a"));
assertThat(matcher, not(matchesDir("b")));
assertThat(matcher, not(matchesDir("d")));
assertThat(matcher, not(matchesDir("a", "c", "b")));
assertThat(matcher, not(matchesDir("c", "a", "b")));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "a/b/**/c");
assertThat(matcher, matchesDir());
assertThat(matcher, matchesDir("a", "b", "c"));
assertThat(matcher, matchesDir("a", "b", "d", "c"));
assertThat(matcher, matchesDir("a"));
assertThat(matcher, matchesDir("a", "b"));
assertThat(matcher, matchesDir("a", "b", "d"));
assertThat(matcher, matchesDir("a", "b", "c", "d"));
assertThat(matcher, not(matchesDir("b")));
assertThat(matcher, not(matchesDir("d")));
assertThat(matcher, not(matchesDir("a", "c", "b", "c")));
assertThat(matcher, not(matchesDir("d", "a", "b")));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "**/*");
assertThat(matcher, matchesDir());
assertThat(matcher, matchesDir("a"));
assertThat(matcher, matchesDir("a", "b"));
assertThat(matcher, matchesDir("a", "b", "c"));
assertThat(matcher, matchesDir("a", "b", "d", "c"));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "*/**");
assertThat(matcher, matchesDir());
assertThat(matcher, matchesDir("a"));
assertThat(matcher, matchesDir("a", "b"));
assertThat(matcher, matchesDir("a", "b", "c"));
assertThat(matcher, matchesDir("a", "b", "d", "c"));
matcher = PatternMatcherFactory.getPatternMatcher(true, true, "a/**/*");
assertThat(matcher, matchesDir());
assertThat(matcher, matchesDir("a"));
assertThat(matcher, matchesDir("a", "b"));
assertThat(matcher, matchesDir("a", "b", "c"));
assertThat(matcher, matchesDir("a", "b", "d", "c"));
assertThat(matcher, not(matchesDir("b")));
assertThat(matcher, not(matchesDir("b", "a")));
}
private static PathMatcher pathMatcher(PatternMatcher matcher) {
return ((PatternMatcherFactory.DefaultPatternMatcher) matcher).getPathMatcher();
}
private static Matcher<PatternMatcher> matchesFile(String... segments) {
return matches(segments, true);
}
private static Matcher<PatternMatcher> matchesDir(String... segments) {
return matches(segments, false);
}
private static Matcher<PatternMatcher> matches(final String[] segments, final boolean isFile) {
return new BaseMatcher<PatternMatcher>() {
public void describeTo(Description description) {
description.appendText("matches ").appendValue(Joiner.on("/").join(segments));
}
public boolean matches(Object o) {
PatternMatcher matcher = (PatternMatcher) o;
return matcher.test(segments, isFile);
}
};
}
}
|
gradle/gradle
|
subprojects/files/src/test/groovy/org/gradle/api/internal/file/pattern/PatternMatcherFactoryTest.java
|
Java
|
apache-2.0
| 20,189
|
/**
* State of the request.
*
* @enum {Number}
*/
var RequestState = {
/**
* Initial unissued state.
*
* @type Number
* @constant
*/
UNISSUED: 0,
/**
* Issued but not yet active. Will become active when open slots are available.
*
* @type Number
* @constant
*/
ISSUED: 1,
/**
* Actual http request has been sent.
*
* @type Number
* @constant
*/
ACTIVE: 2,
/**
* Request completed successfully.
*
* @type Number
* @constant
*/
RECEIVED: 3,
/**
* Request was cancelled, either explicitly or automatically because of low priority.
*
* @type Number
* @constant
*/
CANCELLED: 4,
/**
* Request failed.
*
* @type Number
* @constant
*/
FAILED: 5,
};
export default Object.freeze(RequestState);
|
progsung/cesium
|
Source/Core/RequestState.js
|
JavaScript
|
apache-2.0
| 809
|
/*
* Copyright 2015 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.plugin.thrift.descriptor;
import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;
import com.navercorp.pinpoint.common.trace.MethodType;
import com.navercorp.pinpoint.common.util.LineNumber;
/**
* @author HyunGil Jeong
*/
public class ThriftServerEntryMethodDescriptor implements MethodDescriptor {
private int apiId = 0;
@Override
public String getMethodName() {
return "";
}
@Override
public String getClassName() {
return "";
}
@Override
public String[] getParameterTypes() {
return null;
}
@Override
public String[] getParameterVariableName() {
return null;
}
@Override
public String getParameterDescriptor() {
return "()";
}
@Override
public int getLineNumber() {
return LineNumber.NO_LINE_NUMBER;
}
@Override
public String getFullName() {
return ThriftServerEntryMethodDescriptor.class.getName();
}
@Override
public void setApiId(int apiId) {
this.apiId = apiId;
}
@Override
public int getApiId() {
return this.apiId;
}
@Override
public String getApiDescriptor() {
return "Thrift Server Invocation";
}
@Override
public int getType() {
return MethodType.WEB_REQUEST;
}
}
|
emeroad/pinpoint
|
plugins/thrift/src/main/java/com/navercorp/pinpoint/plugin/thrift/descriptor/ThriftServerEntryMethodDescriptor.java
|
Java
|
apache-2.0
| 2,045
|
#### Analyzer package
Example: Microsoft.CodeQuality.Analyzers
#### Analyzer
Example: IdentifiersShouldNotMatchKeywords
#### Repro steps
1. One
1. Two
1. Three
#### Expected behavior
#### Actual behavior
|
heejaechang/roslyn-analyzers
|
.github/ISSUE_TEMPLATE.md
|
Markdown
|
apache-2.0
| 211
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_45) on Fri Aug 28 09:51:32 EDT 2015 -->
<title>Uses of Class org.apache.cassandra.cql3.CQL3Type.Raw (apache-cassandra API)</title>
<meta name="date" content="2015-08-28">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.cassandra.cql3.CQL3Type.Raw (apache-cassandra API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/cassandra/cql3/class-use/CQL3Type.Raw.html" target="_top">Frames</a></li>
<li><a href="CQL3Type.Raw.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.cassandra.cql3.CQL3Type.Raw" class="title">Uses of Class<br>org.apache.cassandra.cql3.CQL3Type.Raw</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.apache.cassandra.auth">org.apache.cassandra.auth</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#org.apache.cassandra.cql3">org.apache.cassandra.cql3</a></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="#org.apache.cassandra.cql3.statements">org.apache.cassandra.cql3.statements</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.apache.cassandra.auth">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> in <a href="../../../../../org/apache/cassandra/auth/package-summary.html">org.apache.cassandra.auth</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Method parameters in <a href="../../../../../org/apache/cassandra/auth/package-summary.html">org.apache.cassandra.auth</a> with type arguments of type <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/auth/FunctionResource.html" title="class in org.apache.cassandra.auth">FunctionResource</a></code></td>
<td class="colLast"><span class="typeNameLabel">FunctionResource.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/auth/FunctionResource.html#functionFromCql-java.lang.String-java.lang.String-java.util.List-">functionFromCql</a></span>(java.lang.String keyspace,
java.lang.String name,
java.util.List<<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a>> argTypes)</code>
<div class="block">Creates a FunctionResource representing a specific, keyspace-scoped function.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.apache.cassandra.cql3">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> in <a href="../../../../../org/apache/cassandra/cql3/package-summary.html">org.apache.cassandra.cql3</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/apache/cassandra/cql3/package-summary.html">org.apache.cassandra.cql3</a> that return <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#from-org.apache.cassandra.cql3.CQL3Type-">from</a></span>(<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.html" title="interface in org.apache.cassandra.cql3">CQL3Type</a> type)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#frozen-org.apache.cassandra.cql3.CQL3Type.Raw-">frozen</a></span>(<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> t)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#list-org.apache.cassandra.cql3.CQL3Type.Raw-">list</a></span>(<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> t)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#map-org.apache.cassandra.cql3.CQL3Type.Raw-org.apache.cassandra.cql3.CQL3Type.Raw-">map</a></span>(<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> t1,
<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> t2)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#set-org.apache.cassandra.cql3.CQL3Type.Raw-">set</a></span>(<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> t)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#tuple-java.util.List-">tuple</a></span>(java.util.List<<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a>> ts)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#userType-org.apache.cassandra.cql3.UTName-">userType</a></span>(<a href="../../../../../org/apache/cassandra/cql3/UTName.html" title="class in org.apache.cassandra.cql3">UTName</a> name)</code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/apache/cassandra/cql3/package-summary.html">org.apache.cassandra.cql3</a> with parameters of type <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#frozen-org.apache.cassandra.cql3.CQL3Type.Raw-">frozen</a></span>(<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> t)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#list-org.apache.cassandra.cql3.CQL3Type.Raw-">list</a></span>(<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> t)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#map-org.apache.cassandra.cql3.CQL3Type.Raw-org.apache.cassandra.cql3.CQL3Type.Raw-">map</a></span>(<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> t1,
<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> t2)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#set-org.apache.cassandra.cql3.CQL3Type.Raw-">set</a></span>(<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> t)</code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Method parameters in <a href="../../../../../org/apache/cassandra/cql3/package-summary.html">org.apache.cassandra.cql3</a> with type arguments of type <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">CQL3Type.Raw.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html#tuple-java.util.List-">tuple</a></span>(java.util.List<<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a>> ts)</code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
<caption><span>Constructors in <a href="../../../../../org/apache/cassandra/cql3/package-summary.html">org.apache.cassandra.cql3</a> with parameters of type <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/TypeCast.html#TypeCast-org.apache.cassandra.cql3.CQL3Type.Raw-org.apache.cassandra.cql3.Term.Raw-">TypeCast</a></span>(<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> type,
<a href="../../../../../org/apache/cassandra/cql3/Term.Raw.html" title="interface in org.apache.cassandra.cql3">Term.Raw</a> term)</code> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.apache.cassandra.cql3.statements">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> in <a href="../../../../../org/apache/cassandra/cql3/statements/package-summary.html">org.apache.cassandra.cql3.statements</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation">
<caption><span>Fields in <a href="../../../../../org/apache/cassandra/cql3/statements/package-summary.html">org.apache.cassandra.cql3.statements</a> declared as <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></code></td>
<td class="colLast"><span class="typeNameLabel">AlterTableStatement.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/AlterTableStatement.html#validator">validator</a></span></code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/apache/cassandra/cql3/statements/package-summary.html">org.apache.cassandra.cql3.statements</a> with parameters of type <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><span class="typeNameLabel">CreateTypeStatement.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/CreateTypeStatement.html#addDefinition-org.apache.cassandra.cql3.ColumnIdentifier-org.apache.cassandra.cql3.CQL3Type.Raw-">addDefinition</a></span>(<a href="../../../../../org/apache/cassandra/cql3/ColumnIdentifier.html" title="class in org.apache.cassandra.cql3">ColumnIdentifier</a> name,
<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> type)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><span class="typeNameLabel">CreateTableStatement.RawStatement.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/CreateTableStatement.RawStatement.html#addDefinition-org.apache.cassandra.cql3.ColumnIdentifier-org.apache.cassandra.cql3.CQL3Type.Raw-boolean-">addDefinition</a></span>(<a href="../../../../../org/apache/cassandra/cql3/ColumnIdentifier.html" title="class in org.apache.cassandra.cql3">ColumnIdentifier</a> def,
<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> type,
boolean isStatic)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/statements/AlterTypeStatement.html" title="class in org.apache.cassandra.cql3.statements">AlterTypeStatement</a></code></td>
<td class="colLast"><span class="typeNameLabel">AlterTypeStatement.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/AlterTypeStatement.html#addition-org.apache.cassandra.cql3.UTName-org.apache.cassandra.cql3.ColumnIdentifier-org.apache.cassandra.cql3.CQL3Type.Raw-">addition</a></span>(<a href="../../../../../org/apache/cassandra/cql3/UTName.html" title="class in org.apache.cassandra.cql3">UTName</a> name,
<a href="../../../../../org/apache/cassandra/cql3/ColumnIdentifier.html" title="class in org.apache.cassandra.cql3">ColumnIdentifier</a> fieldName,
<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> type)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/cql3/statements/AlterTypeStatement.html" title="class in org.apache.cassandra.cql3.statements">AlterTypeStatement</a></code></td>
<td class="colLast"><span class="typeNameLabel">AlterTypeStatement.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/AlterTypeStatement.html#alter-org.apache.cassandra.cql3.UTName-org.apache.cassandra.cql3.ColumnIdentifier-org.apache.cassandra.cql3.CQL3Type.Raw-">alter</a></span>(<a href="../../../../../org/apache/cassandra/cql3/UTName.html" title="class in org.apache.cassandra.cql3">UTName</a> name,
<a href="../../../../../org/apache/cassandra/cql3/ColumnIdentifier.html" title="class in org.apache.cassandra.cql3">ColumnIdentifier</a> fieldName,
<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> type)</code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
<caption><span>Constructors in <a href="../../../../../org/apache/cassandra/cql3/statements/package-summary.html">org.apache.cassandra.cql3.statements</a> with parameters of type <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/AlterTableStatement.html#AlterTableStatement-org.apache.cassandra.cql3.CFName-org.apache.cassandra.cql3.statements.AlterTableStatement.Type-org.apache.cassandra.cql3.ColumnIdentifier.Raw-org.apache.cassandra.cql3.CQL3Type.Raw-org.apache.cassandra.cql3.statements.CFPropDefs-java.util.Map-boolean-">AlterTableStatement</a></span>(<a href="../../../../../org/apache/cassandra/cql3/CFName.html" title="class in org.apache.cassandra.cql3">CFName</a> name,
<a href="../../../../../org/apache/cassandra/cql3/statements/AlterTableStatement.Type.html" title="enum in org.apache.cassandra.cql3.statements">AlterTableStatement.Type</a> type,
<a href="../../../../../org/apache/cassandra/cql3/ColumnIdentifier.Raw.html" title="class in org.apache.cassandra.cql3">ColumnIdentifier.Raw</a> columnName,
<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> validator,
<a href="../../../../../org/apache/cassandra/cql3/statements/CFPropDefs.html" title="class in org.apache.cassandra.cql3.statements">CFPropDefs</a> cfProps,
java.util.Map<<a href="../../../../../org/apache/cassandra/cql3/ColumnIdentifier.Raw.html" title="class in org.apache.cassandra.cql3">ColumnIdentifier.Raw</a>,<a href="../../../../../org/apache/cassandra/cql3/ColumnIdentifier.Raw.html" title="class in org.apache.cassandra.cql3">ColumnIdentifier.Raw</a>> renames,
boolean isStatic)</code> </td>
</tr>
<tr class="rowColor">
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/CreateAggregateStatement.html#CreateAggregateStatement-org.apache.cassandra.cql3.functions.FunctionName-java.util.List-java.lang.String-org.apache.cassandra.cql3.CQL3Type.Raw-java.lang.String-org.apache.cassandra.cql3.Term.Raw-boolean-boolean-">CreateAggregateStatement</a></span>(<a href="../../../../../org/apache/cassandra/cql3/functions/FunctionName.html" title="class in org.apache.cassandra.cql3.functions">FunctionName</a> functionName,
java.util.List<<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a>> argRawTypes,
java.lang.String stateFunc,
<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> stateType,
java.lang.String finalFunc,
<a href="../../../../../org/apache/cassandra/cql3/Term.Raw.html" title="interface in org.apache.cassandra.cql3">Term.Raw</a> ival,
boolean orReplace,
boolean ifNotExists)</code> </td>
</tr>
<tr class="altColor">
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/CreateFunctionStatement.html#CreateFunctionStatement-org.apache.cassandra.cql3.functions.FunctionName-java.lang.String-java.lang.String-java.util.List-java.util.List-org.apache.cassandra.cql3.CQL3Type.Raw-boolean-boolean-boolean-">CreateFunctionStatement</a></span>(<a href="../../../../../org/apache/cassandra/cql3/functions/FunctionName.html" title="class in org.apache.cassandra.cql3.functions">FunctionName</a> functionName,
java.lang.String language,
java.lang.String body,
java.util.List<<a href="../../../../../org/apache/cassandra/cql3/ColumnIdentifier.html" title="class in org.apache.cassandra.cql3">ColumnIdentifier</a>> argNames,
java.util.List<<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a>> argRawTypes,
<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> rawReturnType,
boolean calledOnNullInput,
boolean orReplace,
boolean ifNotExists)</code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
<caption><span>Constructor parameters in <a href="../../../../../org/apache/cassandra/cql3/statements/package-summary.html">org.apache.cassandra.cql3.statements</a> with type arguments of type <a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/CreateAggregateStatement.html#CreateAggregateStatement-org.apache.cassandra.cql3.functions.FunctionName-java.util.List-java.lang.String-org.apache.cassandra.cql3.CQL3Type.Raw-java.lang.String-org.apache.cassandra.cql3.Term.Raw-boolean-boolean-">CreateAggregateStatement</a></span>(<a href="../../../../../org/apache/cassandra/cql3/functions/FunctionName.html" title="class in org.apache.cassandra.cql3.functions">FunctionName</a> functionName,
java.util.List<<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a>> argRawTypes,
java.lang.String stateFunc,
<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> stateType,
java.lang.String finalFunc,
<a href="../../../../../org/apache/cassandra/cql3/Term.Raw.html" title="interface in org.apache.cassandra.cql3">Term.Raw</a> ival,
boolean orReplace,
boolean ifNotExists)</code> </td>
</tr>
<tr class="rowColor">
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/CreateFunctionStatement.html#CreateFunctionStatement-org.apache.cassandra.cql3.functions.FunctionName-java.lang.String-java.lang.String-java.util.List-java.util.List-org.apache.cassandra.cql3.CQL3Type.Raw-boolean-boolean-boolean-">CreateFunctionStatement</a></span>(<a href="../../../../../org/apache/cassandra/cql3/functions/FunctionName.html" title="class in org.apache.cassandra.cql3.functions">FunctionName</a> functionName,
java.lang.String language,
java.lang.String body,
java.util.List<<a href="../../../../../org/apache/cassandra/cql3/ColumnIdentifier.html" title="class in org.apache.cassandra.cql3">ColumnIdentifier</a>> argNames,
java.util.List<<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a>> argRawTypes,
<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a> rawReturnType,
boolean calledOnNullInput,
boolean orReplace,
boolean ifNotExists)</code> </td>
</tr>
<tr class="altColor">
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/DropAggregateStatement.html#DropAggregateStatement-org.apache.cassandra.cql3.functions.FunctionName-java.util.List-boolean-boolean-">DropAggregateStatement</a></span>(<a href="../../../../../org/apache/cassandra/cql3/functions/FunctionName.html" title="class in org.apache.cassandra.cql3.functions">FunctionName</a> functionName,
java.util.List<<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a>> argRawTypes,
boolean argsPresent,
boolean ifExists)</code> </td>
</tr>
<tr class="rowColor">
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/cassandra/cql3/statements/DropFunctionStatement.html#DropFunctionStatement-org.apache.cassandra.cql3.functions.FunctionName-java.util.List-boolean-boolean-">DropFunctionStatement</a></span>(<a href="../../../../../org/apache/cassandra/cql3/functions/FunctionName.html" title="class in org.apache.cassandra.cql3.functions">FunctionName</a> functionName,
java.util.List<<a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">CQL3Type.Raw</a>> argRawTypes,
boolean argsPresent,
boolean ifExists)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/cassandra/cql3/CQL3Type.Raw.html" title="class in org.apache.cassandra.cql3">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/cassandra/cql3/class-use/CQL3Type.Raw.html" target="_top">Frames</a></li>
<li><a href="CQL3Type.Raw.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2015 The Apache Software Foundation</small></p>
</body>
</html>
|
mitch-kyle/message-board
|
support/apache-cassandra-2.2.1/javadoc/org/apache/cassandra/cql3/class-use/CQL3Type.Raw.html
|
HTML
|
apache-2.0
| 33,725
|
"""Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import utils
import random
import constraint
from bitstring import BitArray, BitStream
class riscv_instr_base:
max_instr_length = 11
# Missing parts: latency
def __init__(self, name=""):
self.name = name
self.instr_group = "Instruction Group"
self.instr_format = "Instruction Format"
self.instr_category = "Instruction Category"
self.instr_name = "Instruction Name"
self.instr_imm_t = "Instruction Immediate Type"
self.instr_src2 = "Instruction Source 2"
self.instr_src1 = "Instruction Source 1"
self.instr_rd = "Instruction Destination"
self.imm = "Instruction Immediate"
self.imm_length = "Instruction Immediate Length"
self.imm_str = ""
self.csr = "CSR"
self.comment = ""
self.has_label = 1
self.label = ""
self.idx = -1
self.atomic = 0 # As of now, we don't support atomic instructions.
self.is_compressed = 0 # As of now, compressed instructions are not supported
self.is_illegal_instr = 0
self.is_local_numeric_label = 0
self.is_pseudo_instr = "Is it a pseudo instruction or not"
self.branch_assigned = 0
self.process_load_store = 1
self.solution = "A random solution which meets given constraints"
self.problem = constraint.Problem(constraint.MinConflictsSolver())
# Convert an instruction to its assembly form.
def convert2asm(self):
asm = name = self.solution[self.instr_name]
format = self.solution[self.instr_format]
category = self.solution[self.instr_category]
src2 = self.solution[self.instr_src2]
src1 = self.solution[self.instr_src1]
destination = self.solution[self.instr_rd]
csr = self.solution[self.csr]
if category != "SYSTEM":
if format == "J_FORMAT" or format == "U_FORMAT":
asm += " {}, {}".format(destination, self.get_imm())
elif format == "I_FORMAT":
if name == "NOP":
asm = "nop"
elif name == "FENCE":
asm = "fence"
elif name == "FENCEI":
asm = "fence.i"
elif category == "LOAD":
asm += " {}, {}({})".format(destination, self.get_imm(), src1)
elif category == "CSR":
asm += " {}, {}, {}".format(destination, hex(csr), self.get_imm())
else:
asm += " {}, {}, {}".format(destination, src1, self.get_imm())
elif format == "S_FORMAT" or format == "B_FORMAT":
if category == "STORE":
asm += " {}, {}({})".format(src2, self.get_imm(), src1)
else:
asm += " {}, {}, {}".format(src1, src2, self.get_imm())
elif format == "R_FORMAT":
if category == "CSR":
asm += " {}, {}, {}".format(destination, hex(csr), src1)
else:
asm += " {}, {}, {}".format(destination, src1, src2)
else:
if name == "BREAK":
asm = ".option norvc;ebreak;.option rvc;"
if self.comment != "":
asm += " # {}".format(self.comment)
return asm.lower()
# Instruction to binary format
# TODO: to do
def convert2bin(self, sol):
name = sol[self.instr_name]
format = sol[self.instr_format]
imm = sol[self.imm]
rd = sol[self.instr_rd]
if format == "J_FORMAT":
binary = ""
def post_randomize(self):
imm_length = self.solution[self.imm_length]
imm_t = self.solution[self.instr_imm_t]
imm = self.solution[self.imm]
imm_bit = BitArray(int=imm, length=32)
imm_mask = BitArray(uint=4294967295, length=32)
imm_mask = imm_mask << imm_length
if imm_t == "UIMM" or imm_t == "NZUIMM":
imm_bit = imm_bit & ~imm_mask
imm = imm_bit.int
else:
if imm_bit[-imm_length]:
imm_bit = imm_bit | imm_mask
imm = imm_bit.int
else:
imm_bit = imm_bit & ~imm_mask
imm = imm_bit.int
if (imm_t == "NZIMM" or imm_t == "NZUIMM") and imm == 0:
imm = random.randrange(1, 2**(imm_length - 1) - 1)
if self.imm_str == "":
self.imm_str = int(imm)
def get_imm(self):
return self.imm_str
def problem_definition(self,
no_branch=0,
no_load_store=1,
enable_hint_instr=0,
no_name_c=0):
# Adding variables to the problem
self.problem.addVariable(self.instr_group, utils.riscv_instr_group_t)
self.problem.addVariable(self.instr_format, utils.riscv_instr_format_t)
self.problem.addVariable(self.instr_category, utils.riscv_instr_category_t)
self.problem.addVariable(self.instr_name, utils.riscv_instr_name_t)
self.problem.addVariable(self.instr_imm_t, utils.imm_t)
self.problem.addVariables([self.instr_src2, self.instr_src1, self.instr_rd],
utils.riscv_reg_t)
self.problem.addVariable(self.imm_length, [5, 6, 8, 11, 20])
# problem.addVariable(self.imm, range(0x00000000, 0xffffffff)) # doesn't
# work because: OverflowError: Python int too large to convert to C ssize_t
# Need to change the constraint to a soft constraint, as the default_c in
# the pseudo instruction class is in conflict with this one
if self.imm not in self.problem._variables:
self.problem.addVariable(self.imm, range(0x0000, 0xffff))
self.problem.addVariable(self.csr, range(0x000, 0xfff))
def default_c(is_pseudo_instr):
if not is_pseudo_instr:
return True
def name_c(name, group, format, category, imm_t):
condition = (
# Load instructions
(name == "LB" and group == "RV32I" and format == "I_FORMAT" and
category == "LOAD" and imm_t == "IMM") or
(name == "LH" and group == "RV32I" and format == "I_FORMAT" and
category == "LOAD" and imm_t == "IMM") or
(name == "LW" and group == "RV32I" and format == "I_FORMAT" and
category == "LOAD" and imm_t == "IMM") or
(name == "LBU" and group == "RV32I" and format == "I_FORMAT" and
category == "LOAD" and imm_t == "IMM") or
(name == "LHU" and group == "RV32I" and format == "I_FORMAT" and
category == "LOAD" and imm_t == "IMM")
# Store instructions
or (name == "SB" and group == "RV32I" and format == "S_FORMAT" and
category == "STORE" and imm_t == "IMM") or
(name == "SH" and group == "RV32I" and format == "S_FORMAT" and
category == "STORE" and imm_t == "IMM") or
(name == "SW" and group == "RV32I" and format == "S_FORMAT" and
category == "STORE" and imm_t == "IMM")
# Shift istructions
or (name == "SLL" and group == "RV32I" and format == "R_FORMAT" and
category == "SHIFT" and imm_t == "IMM") or
(name == "SLLI" and group == "RV32I" and format == "I_FORMAT" and
category == "SHIFT" and imm_t == "IMM") or
(name == "SRL" and group == "RV32I" and format == "R_FORMAT" and
category == "SHIFT" and imm_t == "IMM") or
(name == "SRLI" and group == "RV32I" and format == "I_FORMAT" and
category == "SHIFT" and imm_t == "IMM") or
(name == "SRA" and group == "RV32I" and format == "R_FORMAT" and
category == "SHIFT" and imm_t == "IMM") or
(name == "SRAI" and group == "RV32I" and format == "I_FORMAT" and
category == "SHIFT" and imm_t == "IMM")
# Arithmetic instructions
or (name == "ADD" and group == "RV32I" and format == "R_FORMAT" and
category == "ARITHMETIC" and imm_t == "IMM") or
(name == "ADDI" and group == "RV32I" and format == "I_FORMAT" and
category == "ARITHMETIC" and imm_t == "IMM") or
(name == "NOP" and group == "RV32I" and format == "I_FORMAT" and
category == "ARITHMETIC" and imm_t == "IMM") or
(name == "SUB" and group == "RV32I" and format == "R_FORMAT" and
category == "ARITHMETIC" and imm_t == "IMM") or
(name == "LUI" and group == "RV32I" and format == "U_FORMAT" and
category == "ARITHMETIC" and imm_t == "UIMM") or
(name == "AUIPC" and group == "RV32I" and format == "U_FORMAT" and
category == "ARITHMETIC" and imm_t == "UIMM")
# Logical instructions
or (name == "XOR" and group == "RV32I" and format == "R_FORMAT" and
category == "LOGICAL" and imm_t == "IMM") or
(name == "XORI" and group == "RV32I" and format == "I_FORMAT" and
category == "LOGICAL" and imm_t == "IMM") or
(name == "OR" and group == "RV32I" and format == "R_FORMAT" and
category == "LOGICAL" and imm_t == "IMM") or
(name == "ORI" and group == "RV32I" and format == "I_FORMAT" and
category == "LOGICAL" and imm_t == "IMM") or
(name == "AND" and group == "RV32I" and format == "R_FORMAT" and
category == "LOGICAL" and imm_t == "IMM") or
(name == "ANDI" and group == "RV32I" and format == "I_FORMAT" and
category == "LOGICAL" and imm_t == "IMM")
# Compare instructions
or (name == "SLT" and group == "RV32I" and format == "R_FORMAT" and
category == "COMPARE" and imm_t == "IMM") or
(name == "SLTI" and group == "RV32I" and format == "I_FORMAT" and
category == "COMPARE" and imm_t == "IMM") or
(name == "SLTU" and group == "RV32I" and format == "R_FORMAT" and
category == "COMPARE" and imm_t == "IMM") or
(name == "SLTIU" and group == "RV32I" and format == "I_FORMAT" and
category == "COMPARE" and imm_t == "IMM")
# Branch instructions
or (name == "BEQ" and group == "RV32I" and format == "B_FORMAT" and
category == "BRANCH" and imm_t == "IMM") or
(name == "BNE" and group == "RV32I" and format == "B_FORMAT" and
category == "BRANCH" and imm_t == "IMM") or
(name == "BLT" and group == "RV32I" and format == "B_FORMAT" and
category == "BRANCH" and imm_t == "IMM") or
(name == "BGE" and group == "RV32I" and format == "B_FORMAT" and
category == "BRANCH" and imm_t == "IMM") or
(name == "BLTU" and group == "RV32I" and format == "B_FORMAT" and
category == "BRANCH" and imm_t == "IMM") or
(name == "BGEU" and group == "RV32I" and format == "B_FORMAT" and
category == "BRANCH" and imm_t == "IMM")
# Jump instructions
or (name == "JAL" and group == "RV32I" and format == "J_FORMAT" and
category == "JUMP" and imm_t == "IMM") or
(name == "JALR" and group == "RV32I" and format == "I_FORMAT" and
category == "JUMP" and imm_t == "IMM")
# Synch instructions
or (name == "FENCE" and group == "RV32I" and format == "I_FORMAT" and
category == "SYNCH" and imm_t == "IMM") or
(name == "FENCEI" and group == "RV32I" and format == "I_FORMAT" and
category == "SYNCH" and imm_t == "IMM")
# System instructions
or (name == "ECALL" and group == "RV32I" and format == "I_FORMAT" and
category == "SYSTEM" and imm_t == "IMM") or
(name == "EBREAK" and group == "RV32I" and format == "I_FORMAT" and
category == "SYSTEM" and imm_t == "IMM") or
(name == "URET" and group == "RV32I" and format == "I_FORMAT" and
category == "SYSTEM" and imm_t == "IMM") or
(name == "SRET" and group == "RV32I" and format == "I_FORMAT" and
category == "SYSTEM" and imm_t == "IMM") or
(name == "MRET" and group == "RV32I" and format == "I_FORMAT" and
category == "SYSTEM" and imm_t == "IMM") or
(name == "WFI" and group == "RV32I" and format == "I_FORMAT" and
category == "SYSTEM" and imm_t == "IMM")
# CSR instructions
or (name == "CSRRW" and group == "RV32I" and format == "R_FORMAT" and
category == "CSR" and imm_t == "UIMM") or
(name == "CSRRS" and group == "RV32I" and format == "R_FORMAT" and
category == "CSR" and imm_t == "UIMM") or
(name == "CSRRC" and group == "RV32I" and format == "R_FORMAT" and
category == "CSR" and imm_t == "UIMM") or
(name == "CSRRWI" and group == "RV32I" and format == "I_FORMAT" and
category == "CSR" and imm_t == "UIMM") or
(name == "CSRRSI" and group == "RV32I" and format == "I_FORMAT" and
category == "CSR" and imm_t == "UIMM") or
(name == "CSRRCI" and group == "RV32I" and format == "I_FORMAT" and
category == "CSR" and imm_t == "UIMM"))
if condition:
return True
def fence_c(name, source1, destination, imm):
if name == "FENCE" or name == "FENCEI":
if source1 == "ZERO" and destination == "ZERO" and imm == 0:
return True
else:
return True
def load_store_c(category, source1):
if category == "LOAD" or category == "STORE":
if source1 != "ZERO":
return True
else:
return True
def nop_c(name, source1, source2, destination):
if name == "NOP":
if source1 == "ZERO" and source2 == "ZERO" and destination == "ZERO":
return True
else:
return True
def system_instr_c(category, source1, destination):
if category == "SYSTEM" or category == "SYNCH":
if source1 == "ZERO" and destination == "ZERO":
return True
else:
return True
def imm_len_c(format, imm_t, imm_length):
if format == "U_FORMAT" or format == "J_FORMAT":
return imm_length == 20
elif format == "I_FORMAT" or format == "S_FORMAT" or format == "B_FORMAT":
if imm_t == "UIMM":
return imm_length == 5
else:
return imm_length == 11
else:
return True
def imm_val_c(imm_type, imm):
if imm_type == "NZIMM" or imm_type == "NZUIMM":
return imm != 0
else:
return True
def shift_imm_val_c(category, imm):
if category == "SHIFT":
return imm < utils.XLEN
else:
return True
def only_arithmetic_and_logical_c(category):
if category == "ARITHMETIC" or category == "LOGICAL" or \
category == "BRANCH" or category == "LOAD" or category == "STORE":
return True
def non_system(category):
if category != "SYSTEM":
return True
def non_csr(category):
if category != "CSR":
return True
def non_synch(category):
if category != "SYNCH":
return True
def no_branch_c(category):
if category != "BRANCH":
return True
def no_load_store_c(category):
if category != "LOAD" and category != "STORE":
return True
# Refer to pseudo class for explanation
if not no_name_c:
self.problem.addConstraint(name_c, [
self.instr_name, self.instr_group, self.instr_format,
self.instr_category, self.instr_imm_t
])
# TODO: add a temporarily constraint for generating only arithmetic random instructions
# self.problem.addConstraint(only_arithmetic_and_logical_c, [self.instr_category])
# self.problem.addConstraint(default_c, [self.is_pseudo_instr])
self.problem.addConstraint(non_csr, [self.instr_category])
self.problem.addConstraint(non_system, [self.instr_category])
self.problem.addConstraint(non_synch, [self.instr_category])
if no_branch:
self.problem.addConstraint(no_branch_c, [self.instr_category])
if no_load_store:
self.problem.addConstraint(no_load_store_c, [self.instr_category])
self.problem.addConstraint(
fence_c, [self.instr_name, self.instr_src1, self.instr_rd, self.imm])
self.problem.addConstraint(load_store_c,
[self.instr_category, self.instr_src1])
self.problem.addConstraint(
nop_c,
[self.instr_name, self.instr_src1, self.instr_src2, self.instr_rd
]) #: takes too long, don't know why
self.problem.addConstraint(
system_instr_c, [self.instr_category, self.instr_src1, self.instr_rd])
self.problem.addConstraint(
imm_len_c, [self.instr_format, self.instr_imm_t, self.imm_length])
self.problem.addConstraint(imm_val_c, [self.instr_imm_t, self.imm])
self.problem.addConstraint(shift_imm_val_c, [self.instr_category, self.imm])
# return
# return self.problem.getSolution()
def randomize(self):
# old randomize()
# self.solution = self.problem.getSolution()
# self.post_randomize()
self.solution = self.problem.getSolution()
if self.solution:
# print("TODO: randomized with steps: {}".format(self.problem._solver._steps))
pass
else:
i = 1
while self.solution is None:
for j in range(10):
self.solution = self.problem.getSolution()
if self.solution:
# print("TODO: randomized with steps: {}".format(self.problem._solver._steps))
break
i *= 5
self.problem._solver._steps *= i
self.post_randomize()
# Psuedo instructions are used to simplify assembly program writing
class riscv_pseudo_instr(riscv_instr_base):
def __init__(self, name=""):
# calling super constructor
riscv_instr_base.__init__(self, name)
# Important: Constraint solver gets too slow in pseudo class. We have three solutions:
# 1- change the type of the constraint solver, from MinConflict to regular, this one
# also takes fairly good amount of time, but it's good for validity check, to see
# if constraints are valid and there is no conflict between them.
# 2- Increase the number of steps for MinConflict...
# 3- Since we don't need to check the name_c constraint here, we can get rid of it
# for pseudo class! We're going to use this option for now
# self.problem = constraint.Problem(constraint.MinConflictsSolver(steps=10000))
# self.problem = constraint.Problem()
self.process_load_store = 0
self.pseudo_instr_name = "Pseudo instruction name"
def problem_definition(self, la_instr=0):
# Calling the super problem_definition, to apply all the constraints to the base object
# super().problem_definition(no_load_store=0, no_name_c=1)
super().problem_definition(no_load_store=0)
# To add the new constraint carried by the problem_definition
# fun()
self.problem.addVariable(self.pseudo_instr_name,
utils.riscv_pseudo_instr_name_t)
self.problem.addVariable(self.is_pseudo_instr, range(2))
def pseudo_name_c(name, group, format, category):
condition = (((name == "LI" or name == "LA") and group == "RV32I" and
format == "I_FORMAT" and category == "LOAD"))
if condition:
return True
def la_c(name):
if name == "LA":
return True
def default_c(is_pseudo_instr):
if is_pseudo_instr:
return True
self.problem.addConstraint(pseudo_name_c, [
self.pseudo_instr_name, self.instr_group, self.instr_format,
self.instr_category
])
if la_instr:
self.problem.addConstraint(la_c, [self.pseudo_instr_name])
self.problem.addConstraint(default_c, [self.is_pseudo_instr])
return
# Convert the instruction to assembly code
def convert2asm(self):
asm_str = self.get_instr_name()
destination = self.solution[self.instr_rd]
# instr rd,imm
asm_str = "{} {}, {}".format(asm_str, destination, self.get_imm())
if self.comment != "":
asm_str = asm_str + " #" + self.comment
return asm_str.lower()
def get_instr_name(self):
return self.solution[self.pseudo_instr_name]
|
lowRISC/ibex
|
vendor/google_riscv-dv/pygen/experimental/riscv_instr_base.py
|
Python
|
apache-2.0
| 20,190
|
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef WEBDRIVER_IE_DOCUMENTHOST_H_
#define WEBDRIVER_IE_DOCUMENTHOST_H_
#include <map>
#include <memory>
#include <string>
#include "LocationInfo.h"
namespace webdriver {
// Forward declaration of classes.
class BrowserCookie;
class CookieManager;
class DocumentHost {
public:
DocumentHost(HWND hwnd, HWND executor_handle);
virtual ~DocumentHost(void);
virtual void GetDocument(const bool force_top_level_document,
IHTMLDocument2** doc) = 0;
virtual void GetDocument(IHTMLDocument2** doc) = 0;
virtual void Close(void) = 0;
virtual bool Wait(const std::string& page_load_strategy) = 0;
virtual bool IsBusy(void) = 0;
virtual HWND GetContentWindowHandle(void) = 0;
virtual HWND GetBrowserWindowHandle(void) = 0;
virtual std::string GetWindowName(void) = 0;
virtual std::string GetTitle(void) = 0;
virtual std::string GetBrowserUrl(void) = 0;
virtual HWND GetActiveDialogWindowHandle(void) = 0;
virtual HWND GetTopLevelWindowHandle(void) = 0;
virtual long GetWidth(void) = 0;
virtual long GetHeight(void) = 0;
virtual void SetWidth(long width) = 0;
virtual void SetHeight(long height) = 0;
virtual int NavigateToUrl(const std::string& url,
std::string* error_message) = 0;
virtual int NavigateBack(void) = 0;
virtual int NavigateForward(void) = 0;
virtual int Refresh(void) = 0;
virtual bool IsValidWindow(void) = 0;
virtual bool IsFullScreen(void) = 0;
virtual bool SetFullScreen(bool is_full_screen) = 0;
void Restore(void);
virtual bool IsProtectedMode(void);
virtual bool IsCrossZoneUrl(std::string url);
virtual void InitiateBrowserReattach(void) = 0;
virtual void ReattachBrowser(IWebBrowser2* browser) = 0;
virtual IWebBrowser2* browser(void) = 0;
std::string GetCurrentUrl(void);
std::string GetPageSource(void);
static int GetDocumentMode(IHTMLDocument2* doc);
static bool IsStandardsMode(IHTMLDocument2* doc);
static bool GetDocumentDimensions(IHTMLDocument2* doc, LocationInfo* info);
int SetFocusedFrameByIndex(const int frame_index);
int SetFocusedFrameByName(const std::string& frame_name);
int SetFocusedFrameByElement(IHTMLElement* frame_element);
void SetFocusedFrameToParent(void);
bool SetFocusToBrowser(void);
bool is_edge_chromium(void) const { return this->is_edge_chromium_; }
void set_is_edge_chromium(const bool value) { this->is_edge_chromium_ = value; }
bool wait_required(void) const { return this->wait_required_; }
void set_wait_required(const bool value) { this->wait_required_ = value; }
bool script_wait_required(void) const { return this->script_wait_required_; }
void set_script_wait_required(const bool value) { this->script_wait_required_ = value; }
HWND script_executor_handle(void) const { return this->script_executor_handle_; }
void set_script_executor_handle(HWND value) { this->script_executor_handle_ = value; }
bool is_closing(void) const { return this->is_closing_; }
bool is_awaiting_new_process(void) const { return this->is_awaiting_new_process_; }
std::string browser_id(void) const { return this->browser_id_; }
HWND window_handle(void) const { return this->window_handle_; }
CookieManager* cookie_manager(void) { return this->cookie_manager_; }
protected:
void PostQuitMessage(void);
HWND FindContentWindowHandle(HWND top_level_window_handle);
void set_window_handle(const HWND window_handle) {
this->window_handle_ = window_handle;
}
HWND executor_handle(void) const { return this->executor_handle_; }
void set_is_closing(const bool value) { this->is_closing_ = value; }
void set_is_awaiting_new_process(const bool value) {
this->is_awaiting_new_process_ = value;
}
IHTMLWindow2* focused_frame_window(void) {
return this->focused_frame_window_;
}
private:
int SetFocusedFrameByIdentifier(VARIANT frame_identifier);
CookieManager* cookie_manager_;
CComPtr<IHTMLWindow2> focused_frame_window_;
HWND window_handle_;
HWND executor_handle_;
HWND script_executor_handle_;
std::string browser_id_;
bool wait_required_;
bool script_wait_required_;
bool is_closing_;
bool is_awaiting_new_process_;
bool is_edge_chromium_;
};
} // namespace webdriver
#endif // WEBDRIVER_IE_DOCUMENTHOST_H_
|
SeleniumHQ/selenium
|
cpp/iedriver/DocumentHost.h
|
C
|
apache-2.0
| 5,087
|
#!/bin/bash
sudo apt-get update
sudo apt-get install -y default-jre python-pip
sudo pip install flask==0.9 MarkupSafe==0.19 flask-restful==0.2.1
|
icanberk/Glassistant
|
gabriel/control/install.sh
|
Shell
|
apache-2.0
| 146
|
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 15.4.4.19-8-9
description: >
Array.prototype.map - modifications to length don't change number
of iterations on an Array
---*/
var called = 0;
function callbackfn(val, idx, obj) {
called += 1;
return val > 10;
}
var arr = [9, , 12];
Object.defineProperty(arr, "1", {
get: function () {
arr.length = 2;
return 8;
},
configurable: true
});
var testResult = arr.map(callbackfn);
assert.sameValue(testResult.length, 3, 'testResult.length');
assert.sameValue(called, 2, 'called');
assert.sameValue(typeof testResult[2], "undefined", 'typeof testResult[2]');
|
m0ppers/arangodb
|
3rdParty/V8/V8-5.0.71.39/test/test262/data/test/built-ins/Array/prototype/map/15.4.4.19-8-9.js
|
JavaScript
|
apache-2.0
| 863
|
package gov.hhs.onc.sdcct.data.parameter;
import gov.hhs.onc.sdcct.beans.IdentifiedBean;
public enum ResourceParamType implements IdentifiedBean {
COMPOSITE(ResourceParamTypeNames.COMPOSITE), DATE(ResourceParamTypeNames.DATE), NUMBER(ResourceParamTypeNames.NUMBER),
QUANTITY(ResourceParamTypeNames.QUANTITY), REFERENCE(ResourceParamTypeNames.REFERENCE), STRING(ResourceParamTypeNames.STRING),
TOKEN(ResourceParamTypeNames.TOKEN), URI(ResourceParamTypeNames.URI);
private final String id;
private ResourceParamType(String id) {
this.id = id;
}
@Override
public String getId() {
return this.id;
}
}
|
elizabethso/sdcct
|
sdcct-core/src/main/java/gov/hhs/onc/sdcct/data/parameter/ResourceParamType.java
|
Java
|
apache-2.0
| 654
|
//Wrapped in an outer function to preserve global this
(function (root) { var amdExports; define(['bootstrap/bootstrap-transition'], function () { (function () {
/* ============================================================
* bootstrap-dropdown.js v2.3.2
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
* ============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function ($) {
"use strict"; // jshint ;_;
/* DROPDOWN CLASS DEFINITION
* ========================= */
var toggle = '[data-toggle=dropdown]'
, Dropdown = function (element) {
var $el = $(element).on('click.dropdown.data-api', this.toggle)
$('html').on('click.dropdown.data-api', function () {
$el.parent().removeClass('open')
})
}
Dropdown.prototype = {
constructor: Dropdown
, toggle: function (e) {
var $this = $(this)
, $parent
, isActive
if ($this.is('.disabled, :disabled')) return
$parent = getParent($this)
isActive = $parent.hasClass('open')
clearMenus()
if (!isActive) {
if ('ontouchstart' in document.documentElement) {
// if mobile we we use a backdrop because click events don't delegate
$('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
}
$parent.toggleClass('open')
}
$this.focus()
return false
}
, keydown: function (e) {
var $this
, $items
, $active
, $parent
, isActive
, index
if (!/(38|40|27)/.test(e.keyCode)) return
$this = $(this)
e.preventDefault()
e.stopPropagation()
if ($this.is('.disabled, :disabled')) return
$parent = getParent($this)
isActive = $parent.hasClass('open')
if (!isActive || (isActive && e.keyCode == 27)) {
if (e.which == 27) $parent.find(toggle).focus()
return $this.click()
}
$items = $('[role=menu] li:not(.divider):visible a', $parent)
if (!$items.length) return
index = $items.index($items.filter(':focus'))
if (e.keyCode == 38 && index > 0) index-- // up
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0
$items
.eq(index)
.focus()
}
}
function clearMenus() {
$('.dropdown-backdrop').remove()
$(toggle).each(function () {
getParent($(this)).removeClass('open')
})
}
function getParent($this) {
var selector = $this.attr('data-target')
, $parent
if (!selector) {
selector = $this.attr('href')
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = selector && $(selector)
if (!$parent || !$parent.length) $parent = $this.parent()
return $parent
}
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
var old = $.fn.dropdown
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('dropdown')
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
$.fn.dropdown.Constructor = Dropdown
/* DROPDOWN NO CONFLICT
* ==================== */
$.fn.dropdown.noConflict = function () {
$.fn.dropdown = old
return this
}
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
$(document)
.on('click.dropdown.data-api', clearMenus)
.on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
.on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
}(window.jQuery);
}.call(root));
return amdExports;
}); }(this));
|
peterskim12/angularjs-mlrest
|
src/app/bower_components/fuelux/lib/bootstrap/js/bootstrap-dropdown.js
|
JavaScript
|
apache-2.0
| 4,631
|
# -*- coding: utf-8 -*-
from __future__ import absolute_import
# Generated by Django 1.9 on 2016-01-18 00:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0006_auto_20151218_1741'),
]
operations = [
migrations.AddField(
model_name='usersettings',
name='stripe_customer_id',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AddField(
model_name='usersettings',
name='stripe_payout_recipient',
field=models.CharField(blank=True, max_length=128, null=True),
),
]
|
Pinecast/pinecast
|
accounts/migrations/0007_auto_20160118_0017.py
|
Python
|
apache-2.0
| 726
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/pi/model/DescribeDimensionKeysResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::PI::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
DescribeDimensionKeysResult::DescribeDimensionKeysResult()
{
}
DescribeDimensionKeysResult::DescribeDimensionKeysResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
DescribeDimensionKeysResult& DescribeDimensionKeysResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("AlignedStartTime"))
{
m_alignedStartTime = jsonValue.GetDouble("AlignedStartTime");
}
if(jsonValue.ValueExists("AlignedEndTime"))
{
m_alignedEndTime = jsonValue.GetDouble("AlignedEndTime");
}
if(jsonValue.ValueExists("PartitionKeys"))
{
Array<JsonView> partitionKeysJsonList = jsonValue.GetArray("PartitionKeys");
for(unsigned partitionKeysIndex = 0; partitionKeysIndex < partitionKeysJsonList.GetLength(); ++partitionKeysIndex)
{
m_partitionKeys.push_back(partitionKeysJsonList[partitionKeysIndex].AsObject());
}
}
if(jsonValue.ValueExists("Keys"))
{
Array<JsonView> keysJsonList = jsonValue.GetArray("Keys");
for(unsigned keysIndex = 0; keysIndex < keysJsonList.GetLength(); ++keysIndex)
{
m_keys.push_back(keysJsonList[keysIndex].AsObject());
}
}
if(jsonValue.ValueExists("NextToken"))
{
m_nextToken = jsonValue.GetString("NextToken");
}
return *this;
}
|
jt70471/aws-sdk-cpp
|
aws-cpp-sdk-pi/source/model/DescribeDimensionKeysResult.cpp
|
C++
|
apache-2.0
| 1,847
|
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PXFOUNDATION_PXUNIXINTRINSICS_H
#define PXFOUNDATION_PXUNIXINTRINSICS_H
#include "foundation/Px.h"
#include "foundation/PxSharedAssert.h"
#if !(PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY)
#error "This file should only be included by Unix builds!!"
#endif
#if (PX_LINUX || PX_ANDROID) && !defined(__CUDACC__) && !PX_EMSCRIPTEN
// Linux/android and CUDA compilation does not work with std::isfnite, as it is not marked as CUDA callable
#include <cmath>
#ifndef isfinite
using std::isfinite;
#endif
#endif
#include <math.h>
#include <float.h>
namespace physx
{
namespace intrinsics
{
//! \brief platform-specific absolute value
PX_CUDA_CALLABLE PX_FORCE_INLINE float abs(float a)
{
return ::fabsf(a);
}
//! \brief platform-specific select float
PX_CUDA_CALLABLE PX_FORCE_INLINE float fsel(float a, float b, float c)
{
return (a >= 0.0f) ? b : c;
}
//! \brief platform-specific sign
PX_CUDA_CALLABLE PX_FORCE_INLINE float sign(float a)
{
return (a >= 0.0f) ? 1.0f : -1.0f;
}
//! \brief platform-specific reciprocal
PX_CUDA_CALLABLE PX_FORCE_INLINE float recip(float a)
{
return 1.0f / a;
}
//! \brief platform-specific reciprocal estimate
PX_CUDA_CALLABLE PX_FORCE_INLINE float recipFast(float a)
{
return 1.0f / a;
}
//! \brief platform-specific square root
PX_CUDA_CALLABLE PX_FORCE_INLINE float sqrt(float a)
{
return ::sqrtf(a);
}
//! \brief platform-specific reciprocal square root
PX_CUDA_CALLABLE PX_FORCE_INLINE float recipSqrt(float a)
{
return 1.0f / ::sqrtf(a);
}
PX_CUDA_CALLABLE PX_FORCE_INLINE float recipSqrtFast(float a)
{
return 1.0f / ::sqrtf(a);
}
//! \brief platform-specific sine
PX_CUDA_CALLABLE PX_FORCE_INLINE float sin(float a)
{
return ::sinf(a);
}
//! \brief platform-specific cosine
PX_CUDA_CALLABLE PX_FORCE_INLINE float cos(float a)
{
return ::cosf(a);
}
//! \brief platform-specific minimum
PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMin(float a, float b)
{
return a < b ? a : b;
}
//! \brief platform-specific maximum
PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMax(float a, float b)
{
return a > b ? a : b;
}
//! \brief platform-specific finiteness check (not INF or NAN)
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(float a)
{
//std::isfinite not recommended as of Feb 2017, since it doesn't work with g++/clang's floating point optimization.
union localU { PxU32 i; float f; } floatUnion;
floatUnion.f = a;
return !((floatUnion.i & 0x7fffffff) >= 0x7f800000);
}
//! \brief platform-specific finiteness check (not INF or NAN)
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(double a)
{
return !!isfinite(a);
}
/*!
Sets \c count bytes starting at \c dst to zero.
*/
PX_FORCE_INLINE void* memZero(void* dest, uint32_t count)
{
return memset(dest, 0, count);
}
/*!
Sets \c count bytes starting at \c dst to \c c.
*/
PX_FORCE_INLINE void* memSet(void* dest, int32_t c, uint32_t count)
{
return memset(dest, c, count);
}
/*!
Copies \c count bytes from \c src to \c dst. User memMove if regions overlap.
*/
PX_FORCE_INLINE void* memCopy(void* dest, const void* src, uint32_t count)
{
return memcpy(dest, src, count);
}
/*!
Copies \c count bytes from \c src to \c dst. Supports overlapping regions.
*/
PX_FORCE_INLINE void* memMove(void* dest, const void* src, uint32_t count)
{
return memmove(dest, src, count);
}
/*!
Set 128B to zero starting at \c dst+offset. Must be aligned.
*/
PX_FORCE_INLINE void memZero128(void* dest, uint32_t offset = 0)
{
PX_SHARED_ASSERT(((size_t(dest) + offset) & 0x7f) == 0);
memSet(reinterpret_cast<char*>(dest) + offset, 0, 128);
}
} // namespace intrinsics
} // namespace physx
#endif // #ifndef PXFOUNDATION_PXUNIXINTRINSICS_H
|
Mephostopilis/lua
|
physx/3rd/PhysX-4.1/pxshared/include/foundation/unix/PxUnixIntrinsics.h
|
C
|
apache-2.0
| 5,386
|
package org.zstack.sdk;
public class QueryFirewallIpSetTemplateResult {
public java.util.List inventories;
public void setInventories(java.util.List inventories) {
this.inventories = inventories;
}
public java.util.List getInventories() {
return this.inventories;
}
public java.lang.Long total;
public void setTotal(java.lang.Long total) {
this.total = total;
}
public java.lang.Long getTotal() {
return this.total;
}
}
|
zstackorg/zstack
|
sdk/src/main/java/org/zstack/sdk/QueryFirewallIpSetTemplateResult.java
|
Java
|
apache-2.0
| 497
|
!
function(a) {
function b(b, d) {
function e() {
if (w) {
$canvas = a('<canvas class="pg-canvas"></canvas>'),
v.prepend($canvas),
p = $canvas[0],
q = p.getContext("2d"),
f();
for (var b = Math.round(p.width * p.height / d.density), c = 0; b > c; c++) {
var e = new l;
e.setStackPos(c),
x.push(e)
}
a(window).on("resize",
function() {
h()
}),
a(document).on("mousemove",
function(a) {
y = a.pageX,
z = a.pageY
}),
B && !A && window.addEventListener("deviceorientation",
function() {
D = Math.min(Math.max( - event.beta, -30), 30),
C = Math.min(Math.max( - event.gamma, -30), 30)
},
!0),
g(),
o("onInit")
}
}
function f() {
p.width = v.width(),
p.height = v.height(),
q.fillStyle = d.dotColor,
q.strokeStyle = d.lineColor,
q.lineWidth = d.lineWidth
}
function g() {
if (w) {
s = a(window).width(),
t = a(window).height(),
q.clearRect(0, 0, p.width, p.height);
for (var b = 0; b < x.length; b++) x[b].updatePosition();
for (var b = 0; b < x.length; b++) x[b].draw();
E || (r = requestAnimationFrame(g))
}
}
function h() {
for (f(), i = x.length - 1; i >= 0; i--)(x[i].position.x > v.width() || x[i].position.y > v.height()) && x.splice(i, 1);
var a = Math.round(p.width * p.height / d.density);
if (a > x.length) for (; a > x.length;) {
var b = new l;
x.push(b)
} else a < x.length && x.splice(a);
for (i = x.length - 1; i >= 0; i--) x[i].setStackPos(i)
}
function j() {
E = !0
}
function k() {
E = !1,
g()
}
function l() {
switch (this.stackPos, this.active = !0, this.layer = Math.ceil(3 * Math.random()), this.parallaxOffsetX = 0, this.parallaxOffsetY = 0, this.position = {
x: Math.ceil(Math.random() * p.width),
y: Math.ceil(Math.random() * p.height)
},
this.speed = {},
d.directionX) {
case "left":
this.speed.x = +( - d.maxSpeedX + Math.random() * d.maxSpeedX - d.minSpeedX).toFixed(2);
break;
case "right":
this.speed.x = +(Math.random() * d.maxSpeedX + d.minSpeedX).toFixed(2);
break;
default:
this.speed.x = +( - d.maxSpeedX / 2 + Math.random() * d.maxSpeedX).toFixed(2),
this.speed.x += this.speed.x > 0 ? d.minSpeedX: -d.minSpeedX
}
switch (d.directionY) {
case "up":
this.speed.y = +( - d.maxSpeedY + Math.random() * d.maxSpeedY - d.minSpeedY).toFixed(2);
break;
case "down":
this.speed.y = +(Math.random() * d.maxSpeedY + d.minSpeedY).toFixed(2);
break;
default:
this.speed.y = +( - d.maxSpeedY / 2 + Math.random() * d.maxSpeedY).toFixed(2),
this.speed.x += this.speed.y > 0 ? d.minSpeedY: -d.minSpeedY
}
}
function m(a, b) {
return b ? void(d[a] = b) : d[a]
}
function n() {
v.find(".pg-canvas").remove(),
o("onDestroy"),
v.removeData("plugin_" + c)
}
function o(a) {
void 0 !== d[a] && d[a].call(u)
}
var p, q, r, s, t, u = b,
v = a(b),
w = !!document.createElement("canvas").getContext,
x = [],
y = 0,
z = 0,
A = !navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|mobi|tablet|opera mini|nexus 7)/i),
B = !!window.DeviceOrientationEvent,
C = 0,
D = 0,
E = !1;
return d = a.extend({},
a.fn[c].defaults, d),
l.prototype.draw = function() {
q.beginPath(),
q.arc(this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY, d.particleRadius / 2, 0, 2 * Math.PI, !0),
q.closePath(),
q.fill(),
q.beginPath();
for (var a = x.length - 1; a > this.stackPos; a--) {
var b = x[a],
c = this.position.x - b.position.x,
e = this.position.y - b.position.y,
f = Math.sqrt(c * c + e * e).toFixed(2);
f < d.proximity && (q.moveTo(this.position.x + this.parallaxOffsetX, this.position.y + this.parallaxOffsetY), d.curvedLines ? q.quadraticCurveTo(Math.max(b.position.x, b.position.x), Math.min(b.position.y, b.position.y), b.position.x + b.parallaxOffsetX, b.position.y + b.parallaxOffsetY) : q.lineTo(b.position.x + b.parallaxOffsetX, b.position.y + b.parallaxOffsetY))
}
q.stroke(),
q.closePath()
},
l.prototype.updatePosition = function() {
if (d.parallax) {
if (B && !A) {
var a = (s - 0) / 60;
pointerX = (C - -30) * a + 0;
var b = (t - 0) / 60;
pointerY = (D - -30) * b + 0
} else pointerX = y,
pointerY = z;
this.parallaxTargX = (pointerX - s / 2) / (d.parallaxMultiplier * this.layer),
this.parallaxOffsetX += (this.parallaxTargX - this.parallaxOffsetX) / 10,
this.parallaxTargY = (pointerY - t / 2) / (d.parallaxMultiplier * this.layer),
this.parallaxOffsetY += (this.parallaxTargY - this.parallaxOffsetY) / 10
}
switch (d.directionX) {
case "left":
this.position.x + this.speed.x + this.parallaxOffsetX < 0 && (this.position.x = v.width() - this.parallaxOffsetX);
break;
case "right":
this.position.x + this.speed.x + this.parallaxOffsetX > v.width() && (this.position.x = 0 - this.parallaxOffsetX);
break;
default:
(this.position.x + this.speed.x + this.parallaxOffsetX > v.width() || this.position.x + this.speed.x + this.parallaxOffsetX < 0) && (this.speed.x = -this.speed.x)
}
switch (d.directionY) {
case "up":
this.position.y + this.speed.y + this.parallaxOffsetY < 0 && (this.position.y = v.height() - this.parallaxOffsetY);
break;
case "down":
this.position.y + this.speed.y + this.parallaxOffsetY > v.height() && (this.position.y = 0 - this.parallaxOffsetY);
break;
default:
(this.position.y + this.speed.y + this.parallaxOffsetY > v.height() || this.position.y + this.speed.y + this.parallaxOffsetY < 0) && (this.speed.y = -this.speed.y)
}
this.position.x += this.speed.x,
this.position.y += this.speed.y
},
l.prototype.setStackPos = function(a) {
this.stackPos = a
},
e(),
{
option: m,
destroy: n,
start: k,
pause: j
}
}
var c = "particleground";
a.fn[c] = function(d) {
if ("string" == typeof arguments[0]) {
var e, f = arguments[0],
g = Array.prototype.slice.call(arguments, 1);
return this.each(function() {
a.data(this, "plugin_" + c) && "function" == typeof a.data(this, "plugin_" + c)[f] && (e = a.data(this, "plugin_" + c)[f].apply(this, g))
}),
void 0 !== e ? e: this
}
return "object" != typeof d && d ? void 0 : this.each(function() {
a.data(this, "plugin_" + c) || a.data(this, "plugin_" + c, new b(this, d))
})
},
a.fn[c].defaults = {
minSpeedX: .1,
maxSpeedX: .7,
minSpeedY: .1,
maxSpeedY: .7,
directionX: "center",
directionY: "center",
density: 1e4,
dotColor: "#000000",
lineColor: "#000000",
particleRadius: 7,
lineWidth: 1,
curvedLines: !1,
proximity: 100,
parallax: !0,
parallaxMultiplier: 5,
onInit: function() {},
onDestroy: function() {}
}
} (jQuery),
/**
* requestAnimationFrame polyfill by Erik M枚ller.
* @see: http://paulirish.com/2011/requestanimationframe-for-smart-animating/
* @see: http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
*/
function() {
for (var a = 0,
b = ["ms", "moz", "webkit", "o"], c = 0; c < b.length && !window.requestAnimationFrame; ++c) window.requestAnimationFrame = window[b[c] + "RequestAnimationFrame"],
window.cancelAnimationFrame = window[b[c] + "CancelAnimationFrame"] || window[b[c] + "CancelRequestAnimationFrame"];
window.requestAnimationFrame || (window.requestAnimationFrame = function(b) {
var c = (new Date).getTime(),
d = Math.max(0, 16 - (c - a)),
e = window.setTimeout(function() {
b(c + d)
},
d);
return a = c + d,
e
}),
window.cancelAnimationFrame || (window.cancelAnimationFrame = function(a) {
clearTimeout(a)
})
} ();
/*end-----------------------------*/
$(function() {
$(".islide .finger li").each(function(i) {
$(".islide .finger li").eq(i).hover(function() {
$(".islide .finger li a").removeClass("up");
$(".islide .finger li").eq(i).children("a").addClass("up");
$(".islide .box > .item").hide();
$(".islide .box > .item").eq(i).stop(true, true).show()
})
});
/**/
$("[title]").hover(function() {
$('<div class="tips" style="display:block;position:absolute;top:' + ($(this).offset().top + $(this).innerHeight() + 3) + 'px;left:' + ($(this).offset().left + ($(this).width() / 10)) + 'px;">' + $(this).attr('title') + '</div>').appendTo('body').show();
},
function() {
$(".tips").stop(true, true).hide(0).remove(0);
});
$("[focus]").focus(function() {
$('<div class="tips" style="display:block;position:absolute;top:' + ($(this).offset().top + $(this).innerHeight() + 3) + 'px;left:' + ($(this).offset().left + ($(this).width() / 10)) + 'px;">' + $(this).attr('focus') + '</div>').appendTo('body').show();
});
$("[focus]").blur(function() {
$(".tips").stop(true, true).hide(0).remove(0);
});
////////////////////////////////
$(".part").particleground();
$('[layer-alert]').on("click",
function() {
layer.alert($(this).attr("layer-alert"), {
time: 2900
});
})
});
|
liuzongwen1/mss
|
target/belling-admin/static/js/jump.js
|
JavaScript
|
apache-2.0
| 9,066
|
/**
* Copyright (c) 2019, WSO2 Inc. (http://wso2.com) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable */
import API from 'AppData/api';
import APIClientFactory from './APIClientFactory';
import Utils from './Utils';
import Resource from './Resource';
/**
* An abstract representation of an API Product
*/
class APIProduct extends Resource {
constructor(name, context, kwargs) {
super();
let properties = kwargs;
if (name instanceof Object) {
properties = name;
} else {
this.name = name;
this.version = '1.0.0';
this.context = context;
this.isDefaultVersion = false;
this.gatewayEnvironments = ['Production and Sandbox'];
this.transport = ['http', 'https'];
this.visibility = 'PUBLIC';
this.endpointConfig = {
endpoint_type: 'http',
sandbox_endpoints: {
url: '',
},
production_endpoints: {
url: '',
},
};
}
this._data = properties;
for (const key in properties) {
if (Object.prototype.hasOwnProperty.call(properties, key)) {
this[key] = properties[key];
}
}
this.apiType = API.CONSTS.APIProduct;
this.getType = this.getType.bind(this);
}
/**
*
* @param data
* @returns {object} Metadata for API request
* @private
*/
_requestMetaData() {
Resource._requestMetaData();
}
getType() {
return this.type;
}
getSettings() {
const promisedSettings = this.client.then(client => {
return client.apis['Settings'].getSettings();
});
return promisedSettings.then(response => response.body);
}
getMonetization(id, callback = null) {
const promiseMonetization = this.client.then(client => {
return client.apis['API Monetization'].getAPIMonetization(
{
apiId: id,
},
this._requestMetaData(),
);
});
return promiseMonetization.then(response => response.body);
}
configureMonetizationToApiProduct(id, body) {
const promised_status = this.client.then(client => {
return client.apis['API Monetization'].addAPIMonetization({
apiId: id,
body,
});
});
return promised_status;
}
getSubscriptionPolicies(id, callback = null) {
const promisePolicies = this.client.then(client => {
return client.apis['APIs'].getAPISubscriptionPolicies(
{
apiId: id,
},
this._requestMetaData(),
);
});
return promisePolicies.then(response => response.body);
}
getMonetizationInvoice(id, callback = null) {
const promiseInvoice = this.client.then(client => {
return client.apis['API Monetization'].getSubscriptionUsage(
{
subscriptionId: id
},
this._requestMetaData(),
);
});
return promiseInvoice.then(response => response.body);
}
/**
* Create an API Product with the given parameters in template
* @param {Object} api_product_data - APIProduct data which need to fill the placeholder values in the @get_template
* @returns {Promise} Promise after creating API Product
*/
saveProduct() {
const promisedAPIResponse = this.client.then(client => {
const properties = client.spec.components.schemas.APIProduct.properties;
const data = {};
Object.keys(this).forEach(apiAttribute => {
if (apiAttribute in properties) {
if (apiAttribute != 'apiType') {
data[apiAttribute] = this[apiAttribute];
}
}
});
const payload = {
'Content-Type': 'application/json',
};
const requestBody = {
requestBody: data
}
return client.apis['API Products'].createAPIProduct(payload, requestBody, this._requestMetaData());
});
return promisedAPIResponse.then(response => {
return new API(response.body);
});
}
/**
* Create an API Product with the given parameters in template and call the callback method given optional.
* @param {Object} apiData - API data which need to fill the placeholder values in the @get_template
* @returns {Promise} Promise after creating and optionally calling the callback method.
*/
create(apiData) {
let payload;
let promise_create;
payload = {
body: apiData,
'Content-Type': 'application/json',
};
promise_create = this.client.then(client => {
return client.apis['API Products'].createAPIProduct(payload, this._requestMetaData());
});
return promise_create;
}
/**
*
* Instance method of the API class to provide raw JSON object
* which is API body friendly to use with REST api requests
* Use this method instead of accessing the private _data object for
* converting to a JSON representation of an API object.
* Note: This is shallow coping
* Basically this is the revers operation in constructor.
* This method simply iterate through all the object properties
* and copy their values to new object excluding the properties in excludes list.
* So use this method sparingly!!
* @memberof API
* @param {Array} [userExcludes=[]] List of properties that are need to be excluded from the generated JSON object
* @returns {JSON} JSON representation of the API
*/
toJSON(resource = this, userExcludes = []) {
var copy = {},
excludes = ['_data', 'client', 'type', ...userExcludes];
for (var prop in resource) {
if (!excludes.includes(prop)) {
copy[prop] = resource[prop];
}
}
return copy;
}
/**
* Get details of a given APIProduct
* @param id {string} UUID of the api-product.
* @returns {promise} With given callback attached to the success chain else API invoke promise.
*/
static get(id) {
const apiClient = new APIClientFactory().getAPIClient(Utils.getCurrentEnvironment(), Utils.CONST.API_CLIENT).client;
const promisedAPIProduct = apiClient
.then(client => {
return client.apis['API Products'].getAPIProduct(
{
apiProductId: id,
},
this._requestMetaData(),
);
})
.catch(error => {
console.error(error);
});
return promisedAPIProduct.then(response => {
return new APIProduct(response.body);
});
}
/**
*
* Static method for get all API Products for current environment user.
* @param {Object} params API Products filtering parameters i:e { "name": "MyBank Product"}
* @returns {Promise} promise object return from SwaggerClient-js
*/
static all(params) {
let query = '';
if (params && 'query' in params) {
for (const [key, value] of Object.entries(params.query)) {
query += `${key}:${value},`;
}
params.query = query;
}
const apiClient = new APIClientFactory().getAPIClient(Utils.getCurrentEnvironment(), Utils.CONST.API_CLIENT).client;
const promisedProducts = apiClient
.then(client => {
return client.apis['API Products'].getAllAPIProducts(params, Resource._requestMetaData());
})
.catch(error => {
console.error(error);
});
return promisedProducts.then(response => {
response.obj.apiType = API.CONSTS.APIProduct;
return response;
});
}
/**
* Update an api Product via PUT HTTP method, Need to give the updated API Product object as the argument.
* @param apiProduct {Object} Updated API Product object(JSON) which needs to be updated
*/
update(updatedProperties) {
const updatedAPI = { ...this.toJSON(), ...this.toJSON(updatedProperties) };
const promisedUpdate = this.client.then(client => {
const payload = {
apiProductId: updatedAPI.id,
};
const requestBody = {
requestBody: updatedAPI,
}
return client.apis['API Products'].updateAPIProduct(payload, requestBody);
});
return promisedUpdate.then(response => {
return new APIProduct(response.body);
});
}
/**
* Get the thumnail of an API Product
*
* @param id {string} UUID of the api product
*/
getAPIProductThumbnail(id) {
const promisedAPIThumbnail = this.client
.then(client => {
return client.apis['API Products'].getAPIProductThumbnail(
{
apiProductId: id,
},
this._requestMetaData(),
);
})
.catch(error => {
console.error(error);
});
return promisedAPIThumbnail;
}
/**
* Add new thumbnail image to an API Product
*
* @param {String} id id of the API Product
* @param {File} imageFile thumbnail image to be uploaded
*/
addAPIProductThumbnail(id, imageFile) {
const promisedAddAPIThumbnail = this.client
.then(client => {
const payload = {
apiProductId: id,
'Content-Type': imageFile.type,
};
return client.apis['API Products'].updateAPIProductThumbnail(
payload,
{
requestBody: {
file: imageFile,
}
},
this._requestMetaData({
'Content-Type': 'multipart/form-data',
}),
);
})
.catch(error => {
console.error(error);
});
return promisedAddAPIThumbnail;
}
/**
*
* Delete an API Product given its UUID
* @static
* @param {String} id API Product UUID
*/
static delete(id) {
const apiClient = new APIClientFactory().getAPIClient(Utils.getCurrentEnvironment(), Utils.CONST.API_CLIENT).client;
return apiClient
.then(client => {
return client.apis['API Products'].deleteAPIProduct(
{
apiProductId: id,
},
this._requestMetaData(),
);
})
.catch(error => {
console.error(error);
});
}
/**
* Add document to API Product
* @param {*} id API Product ID to which the document should be attached
* @param {*} body
*/
addDocument(id, body) {
const promisedAddDocument = this.client
.then(client => {
const payload = {
apiProductId: id,
'Content-Type': 'application/json',
};
return client.apis['API Product Documents'].addAPIProductDocument(
payload,
{
requestBody: body,
},
this._requestMetaData(),
);
})
.catch(error => {
console.error(error);
});
return promisedAddDocument;
}
/**
* Returns documents attached to a given API Product
*
* @param {String} id API Product UUID
*/
getDocuments(id) {
const promisedDocuments = this.client
.then(client => {
return client.apis['API Product Documents'].getAPIProductDocuments(
{
apiProductId: id,
},
this._requestMetaData(),
);
})
.catch(error => {
console.error(error);
});
return promisedDocuments;
}
/**
* Updates a product document
* @param {*} productId
* @param {*} docId
* @param {*} body
*/
updateDocument(productId, docId, body) {
const promisedUpdateDocument = this.client.then(client => {
const payload = {
apiProductId: productId,
documentId: docId,
'Content-Type': 'application/json',
};
return client.apis['API Product Documents']
.updateAPIProductDocument(
payload,
{
requestBody: body,
},
this._requestMetaData()
)
.catch(error => {
console.error(error);
});
});
return promisedUpdateDocument;
}
/**
* Get specified document attached to specified product
* @param {*} productId
* @param {*} docId
*/
getDocument(productId, docId) {
const promisedDocument = this.client
.then(client => {
return client.apis['API Product Documents'].getAPIProductDocument(
{
apiProductId: productId,
documentId: docId,
},
this._requestMetaData(),
);
})
.catch(error => {
console.error(error);
});
return promisedDocument;
}
/**
* Add inline content to a INLINE type document
* @param {*} apiProductId API Product ID
* @param {*} documentId Document ID
* @param {*} sourceType
* @param {*} inlineContent Content to be added to document
*/
addInlineContentToDocument(apiProductId, documentId, sourceType, inlineContent) {
const promise = this.client
.then(client => {
const payload = {
apiProductId,
documentId,
sourceType,
'Content-Type': 'application/json',
};
return client.apis[
'API Product Documents'
].addAPIProductDocumentContent(
payload,
{
requestBody: {
inlineContent: inlineContent
}
},
this._requestMetaData({
'Content-Type': 'multipart/form-data',
}),
);
})
.catch(error => {
console.error(error);
});
return promise;
}
/**
* Get the inline content of a given document
* @param {*} apiProductId
* @param {*} docId
*/
getInlineContentOfDocument(apiProductId, docId) {
const promisedDocContent = this.client
.then(client => {
const payload = {
apiProductId,
documentId: docId,
};
return client.apis[
'API Product Documents'
].getAPIProductDocumentContent(payload);
})
.catch(error => {
console.error(error);
});
return promisedDocContent;
}
/**
* Delete specified document
* @param {*} productId
* @param {*} docId
*/
deleteDocument(productId, docId) {
const promiseDeleteDocument = this.client
.then(client => {
return client.apis['API Product Documents'].deleteAPIProductDocument(
{
apiProductId: productId,
documentId: docId,
},
this._requestMetaData(),
);
})
.catch(error => {
console.error(error);
});
return promiseDeleteDocument;
}
/**
* Add a File resource to a document
* @param {*} productId
* @param {*} docId
* @param {*} fileToDocument
*/
addFileToDocument(productId, docId, fileToDocument) {
const promiseAddFileToDocument = this.client.then(client => {
const payload = {
apiProductId: productId,
documentId: docId,
'Content-Type': 'application/json',
};
return client.apis['API Product Documents'].addAPIProductDocumentContent(
payload,
{
requestBody: {
file: fileToDocument
}
},
this._requestMetaData({
'Content-Type': 'multipart/form-data',
}),
);
});
return promiseAddFileToDocument;
}
/**
* Get list of revisions.
*
* @param {string} apiProductId Id of the API.
* */
getProductRevisions(apiProductId) {
const promiseGetRevision = this.client
.then(client => {
return client.apis['API Product Revisions'].getAPIProductRevisions( {
apiProductId: apiProductId,
},
);
});
return promiseGetRevision;
}
/**
* Get list of revisions with environments.
*
* @param {string} apiProductId Id of the API.
* */
getProductRevisionsWithEnv(apiProductId) {
const promiseGetRevisionWithEnv = this.client
.then(client => {
return client.apis['API Product Revisions'].getAPIProductRevisions(
{
apiProductId: apiProductId,
query: 'deployed:true',
},
);
});
return promiseGetRevisionWithEnv;
}
/**
* Add revision.
*
* @param {string} apiProductId Id of the API.
* @param {Object} body Revision Object.
* */
createProductRevision(apiProductId, body) {
const promiseAddRevision = this.client
.then(client => {
return client.apis['API Product Revisions'].createAPIProductRevision(
{apiProductId: apiProductId},
{ requestBody: body},
this._requestMetaData(),
);
});
return promiseAddRevision;
}
/**
* Delete revision.
*
* @param {string} apiProductId Id of the API.
* @param {Object} body Revision Object.
* */
deleteProductRevision(apiProductId, revisionId) {
const promiseDeleteRevision = this.client
.then(client => {
return client.apis['API Product Revisions'].deleteAPIProductRevision(
{
apiProductId: apiProductId,
revisionId: revisionId
},
this._requestMetaData(),
);
});
return promiseDeleteRevision;
}
/**
* Undeploy revision.
*
* @param {string} apiProductId Id of the API.
* @param {Object} body Revision Object.
* */
undeployProductRevision(apiProductId, revisionId, body) {
const promiseUndeployRevision = this.client
.then(client => {
return client.apis['API Product Revisions'].undeployAPIProductRevision(
{
apiProductId: apiProductId,
revisionId: revisionId
},
{ requestBody: body},
this._requestMetaData(),
);
});
return promiseUndeployRevision;
}
/**
* Undeploy revision.
*
* @param {string} apiProductId Id of the API.
* @param {Object} body Revision Object.
* */
deployProductRevision(apiProductId, revisionId, body) {
const promiseDeployRevision = this.client
.then(client => {
return client.apis['API Product Revisions'].deployAPIProductRevision(
{
apiProductId: apiProductId,
revisionId: revisionId
},
{ requestBody: body},
this._requestMetaData(),
);
});
return promiseDeployRevision;
}
/**
* Restore revision.
*
* @param {string} apiProductId Id of the API.
* @param {Object} body Revision Object.
* */
restoreProductRevision(apiProductId, revisionId) {
const promiseRestoreRevision = this.client
.then(client => {
return client.apis['API Product Revisions'].restoreAPIProductRevision(
{
apiProductId: apiProductId,
revisionId: revisionId
},
this._requestMetaData(),
);
});
return promiseRestoreRevision;
}
/**
* Update an api swagger via PUT HTTP method
* @param {*} swagger
*/
updateSwagger(swagger) {
const promisedUpdate = this.client.then(client => {
const payload = {
apiProductId: this.id,
apiDefinition: JSON.stringify(swagger),
'Content-Type': 'multipart/form-data',
};
return client.apis['API Products']
.put_api_products__apiProductId__swagger(
payload,
this._requestMetaData({
'Content-Type': 'multipart/form-data',
}),
)
.catch(error => {
console.error(error);
});
});
return promisedUpdate.then(response => {
return this;
});
}
/**
* Get the swagger of an API Product
* @param id {String} UUID of the API Product in which the swagger is needed
*/
getSwagger(id = this.id) {
const promiseGet = this.client
.then(client => {
return client.apis['API Products'].getAPIProductSwagger(
{
apiProductId: id,
},
this._requestMetaData(),
);
})
.catch(error => {
console.error(error);
});
return promiseGet;
}
}
export default APIProduct;
|
Rajith90/carbon-apimgt
|
features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/source/src/app/data/APIProduct.js
|
JavaScript
|
apache-2.0
| 23,913
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/robomaker/RoboMaker_EXPORTS.h>
#include <aws/robomaker/RoboMakerRequest.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace RoboMaker
{
namespace Model
{
/**
*/
class AWS_ROBOMAKER_API BatchDescribeSimulationJobRequest : public RoboMakerRequest
{
public:
BatchDescribeSimulationJobRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "BatchDescribeSimulationJob"; }
Aws::String SerializePayload() const override;
/**
* <p>A list of Amazon Resource Names (ARNs) of simulation jobs to describe.</p>
*/
inline const Aws::Vector<Aws::String>& GetJobs() const{ return m_jobs; }
/**
* <p>A list of Amazon Resource Names (ARNs) of simulation jobs to describe.</p>
*/
inline bool JobsHasBeenSet() const { return m_jobsHasBeenSet; }
/**
* <p>A list of Amazon Resource Names (ARNs) of simulation jobs to describe.</p>
*/
inline void SetJobs(const Aws::Vector<Aws::String>& value) { m_jobsHasBeenSet = true; m_jobs = value; }
/**
* <p>A list of Amazon Resource Names (ARNs) of simulation jobs to describe.</p>
*/
inline void SetJobs(Aws::Vector<Aws::String>&& value) { m_jobsHasBeenSet = true; m_jobs = std::move(value); }
/**
* <p>A list of Amazon Resource Names (ARNs) of simulation jobs to describe.</p>
*/
inline BatchDescribeSimulationJobRequest& WithJobs(const Aws::Vector<Aws::String>& value) { SetJobs(value); return *this;}
/**
* <p>A list of Amazon Resource Names (ARNs) of simulation jobs to describe.</p>
*/
inline BatchDescribeSimulationJobRequest& WithJobs(Aws::Vector<Aws::String>&& value) { SetJobs(std::move(value)); return *this;}
/**
* <p>A list of Amazon Resource Names (ARNs) of simulation jobs to describe.</p>
*/
inline BatchDescribeSimulationJobRequest& AddJobs(const Aws::String& value) { m_jobsHasBeenSet = true; m_jobs.push_back(value); return *this; }
/**
* <p>A list of Amazon Resource Names (ARNs) of simulation jobs to describe.</p>
*/
inline BatchDescribeSimulationJobRequest& AddJobs(Aws::String&& value) { m_jobsHasBeenSet = true; m_jobs.push_back(std::move(value)); return *this; }
/**
* <p>A list of Amazon Resource Names (ARNs) of simulation jobs to describe.</p>
*/
inline BatchDescribeSimulationJobRequest& AddJobs(const char* value) { m_jobsHasBeenSet = true; m_jobs.push_back(value); return *this; }
private:
Aws::Vector<Aws::String> m_jobs;
bool m_jobsHasBeenSet;
};
} // namespace Model
} // namespace RoboMaker
} // namespace Aws
|
jt70471/aws-sdk-cpp
|
aws-cpp-sdk-robomaker/include/aws/robomaker/model/BatchDescribeSimulationJobRequest.h
|
C
|
apache-2.0
| 3,200
|
'use strict';
let angular = require('angular');
module.exports = angular.module('spinnaker.core.delivery.executionStatus.controller', [
require('../../utils/lodash.js'),
])
.controller('executionStatus', function(_) {
var controller = this;
controller.getFailedStage = function(execution) {
let stages = execution.stageSummaries || [];
var failed = stages.filter(function(stage) {
return stage.isFailed;
});
if (failed && failed.length) {
return failed[0].name;
}
return 'Unknown';
};
controller.getRunningStage = function(execution) {
let stages = execution.stageSummaries || [];
var currentStages = stages.filter(function(stage) {
return stage.isRunning;
});
// if there are no running stages, find the first enqueued stage
if (!currentStages.length) {
var enqueued = stages.filter(function(stage) {
return stage.hasNotStarted;
});
if (enqueued && enqueued.length) {
currentStages = [enqueued[0]];
}
}
if (currentStages && currentStages.length) {
return _.pluck(currentStages, 'name').join(', ');
}
return 'Unknown';
};
controller.getSuspendedStage = function(execution) {
let stages = execution.stageSummaries || [];
var suspended = stages.filter(function(stage) {
return stage.isSuspended;
});
if (suspended && suspended.length) {
return suspended[0].name;
}
return 'Unknown';
};
}).name;
|
zanthrash/deck-1
|
app/scripts/modules/core/delivery/status/executionStatus.controller.js
|
JavaScript
|
apache-2.0
| 1,559
|
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for documentation parser."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import inspect
import os
import sys
from tensorflow.python.platform import googletest
from tensorflow.tools.docs import parser
def test_function_for_markdown_reference(unused_arg):
"""Docstring with reference to @{test_function}."""
pass
def test_function(unused_arg, unused_kwarg='default'):
"""Docstring for test function."""
pass
def test_function_with_args_kwargs(unused_arg, *unused_args, **unused_kwargs):
"""Docstring for second test function."""
pass
def test_function_with_fancy_docstring(arg):
"""Function with a fancy docstring.
Args:
arg: An argument.
Returns:
arg: the input, and
arg: the input, again.
"""
return arg, arg
class TestClass(object):
"""Docstring for TestClass itself."""
def a_method(self, arg='default'):
"""Docstring for a method."""
pass
class ChildClass(object):
"""Docstring for a child class."""
pass
@property
def a_property(self):
"""Docstring for a property."""
pass
CLASS_MEMBER = 'a class member'
class ParserTest(googletest.TestCase):
def test_documentation_path(self):
self.assertEqual('test.md', parser.documentation_path('test'))
self.assertEqual('test/module.md', parser.documentation_path('test.module'))
def test_documentation_path_empty(self):
self.assertEqual('index.md', parser.documentation_path(''))
def test_replace_references(self):
string = 'A @{reference}, another @{tf.reference}, and a @{third}.'
duplicate_of = {'third': 'fourth'}
result = parser.replace_references(string, '../..', duplicate_of)
self.assertEqual(
'A [`reference`](../../reference.md), another '
'[`tf.reference`](../../reference.md), '
'and a [`third`](../../fourth.md).',
result)
def test_generate_markdown_for_class(self):
index = {
'TestClass': TestClass,
'TestClass.a_method': TestClass.a_method,
'TestClass.a_property': TestClass.a_property,
'TestClass.ChildClass': TestClass.ChildClass,
'TestClass.CLASS_MEMBER': TestClass.CLASS_MEMBER
}
tree = {
'TestClass': ['a_method', 'a_property', 'ChildClass', 'CLASS_MEMBER']
}
docs = parser.generate_markdown(full_name='TestClass', py_object=TestClass,
duplicate_of={}, duplicates={},
index=index, tree=tree, base_dir='/')
# Make sure all required docstrings are present.
self.assertTrue(inspect.getdoc(TestClass) in docs)
self.assertTrue(inspect.getdoc(TestClass.a_method) in docs)
self.assertTrue(inspect.getdoc(TestClass.a_property) in docs)
# Make sure that the signature is extracted properly and omits self.
self.assertTrue('a_method(arg=\'default\')' in docs)
# Make sure there is a link to the child class and it points the right way.
self.assertTrue('[`class ChildClass`](./TestClass/ChildClass.md)' in docs)
# Make sure CLASS_MEMBER is mentioned.
self.assertTrue('CLASS_MEMBER' in docs)
# Make sure this file is contained as the definition location.
self.assertTrue(os.path.relpath(__file__, '/') in docs)
def test_generate_markdown_for_module(self):
module = sys.modules[__name__]
index = {
'TestModule': module,
'TestModule.test_function': test_function,
'TestModule.test_function_with_args_kwargs':
test_function_with_args_kwargs,
'TestModule.TestClass': TestClass,
}
tree = {
'TestModule': ['TestClass', 'test_function',
'test_function_with_args_kwargs']
}
docs = parser.generate_markdown(full_name='TestModule', py_object=module,
duplicate_of={}, duplicates={},
index=index, tree=tree, base_dir='/')
# Make sure all required docstrings are present.
self.assertTrue(inspect.getdoc(module) in docs)
# Make sure that links to the members are there (not asserting on exact link
# text for functions).
self.assertTrue('./TestModule/test_function.md' in docs)
self.assertTrue('./TestModule/test_function_with_args_kwargs.md' in docs)
# Make sure there is a link to the child class and it points the right way.
self.assertTrue('[`class TestClass`](./TestModule/TestClass.md)' in docs)
# Make sure this file is contained as the definition location.
self.assertTrue(os.path.relpath(__file__, '/') in docs)
def test_generate_markdown_for_function(self):
index = {
'test_function': test_function
}
tree = {
'': ['test_function']
}
docs = parser.generate_markdown(full_name='test_function',
py_object=test_function,
duplicate_of={}, duplicates={},
index=index, tree=tree, base_dir='/')
# Make sure docstring shows up.
self.assertTrue(inspect.getdoc(test_function) in docs)
# Make sure the extracted signature is good.
self.assertTrue(
'test_function(unused_arg, unused_kwarg=\'default\')' in docs)
# Make sure this file is contained as the definition location.
self.assertTrue(os.path.relpath(__file__, '/') in docs)
def test_generate_markdown_for_function_with_kwargs(self):
index = {
'test_function_with_args_kwargs': test_function_with_args_kwargs
}
tree = {
'': ['test_function_with_args_kwargs']
}
docs = parser.generate_markdown(full_name='test_function_with_args_kwargs',
py_object=test_function_with_args_kwargs,
duplicate_of={}, duplicates={},
index=index, tree=tree, base_dir='/')
# Make sure docstring shows up.
self.assertTrue(inspect.getdoc(test_function_with_args_kwargs) in docs)
# Make sure the extracted signature is good.
self.assertTrue(
'test_function_with_args_kwargs(unused_arg,'
' *unused_args, **unused_kwargs)' in docs)
def test_references_replaced_in_generated_markdown(self):
index = {
'test_function_for_markdown_reference':
test_function_for_markdown_reference
}
tree = {
'': ['test_function_for_markdown_reference']
}
docs = parser.generate_markdown(
full_name='test_function_for_markdown_reference',
py_object=test_function_for_markdown_reference,
duplicate_of={}, duplicates={},
index=index, tree=tree, base_dir='/')
# Make sure docstring shows up and is properly processed.
expected_docs = parser.replace_references(
inspect.getdoc(test_function_for_markdown_reference),
relative_path_to_root='.', duplicate_of={})
self.assertTrue(expected_docs in docs)
def test_docstring_special_section(self):
index = {
'test_function': test_function_with_fancy_docstring
}
tree = {
'': 'test_function'
}
docs = parser.generate_markdown(
full_name='test_function',
py_object=test_function_with_fancy_docstring,
duplicate_of={}, duplicates={},
index=index, tree=tree, base_dir='/')
expected = '\n'.join([
'Function with a fancy docstring.',
'',
'#### Args:',
'',
'* <b>`arg`</b>: An argument.',
'',
'',
'#### Returns:',
'',
'* <b>`arg`</b>: the input, and',
'* <b>`arg`</b>: the input, again.',
''])
self.assertTrue(expected in docs)
def test_generate_index(self):
module = sys.modules[__name__]
index = {
'TestModule': module,
'test_function': test_function,
'TestModule.test_function': test_function,
'TestModule.TestClass': TestClass,
'TestModule.TestClass.a_method': TestClass.a_method,
'TestModule.TestClass.a_property': TestClass.a_property,
'TestModule.TestClass.ChildClass': TestClass.ChildClass,
}
duplicate_of = {
'TestModule.test_function': 'test_function'
}
docs = parser.generate_global_index('TestLibrary', 'test',
index=index,
duplicate_of=duplicate_of)
# Make sure duplicates and non-top-level symbols are in the index, but
# methods and properties are not.
self.assertTrue('a_method' not in docs)
self.assertTrue('a_property' not in docs)
self.assertTrue('TestModule.TestClass' in docs)
self.assertTrue('TestModule.TestClass.ChildClass' in docs)
self.assertTrue('TestModule.test_function' in docs)
# Leading backtick to make sure it's included top-level.
# This depends on formatting, but should be stable.
self.assertTrue('`test_function' in docs)
def test_argspec_for_functoos_partial(self):
# pylint: disable=unused-argument
def test_function_for_partial1(arg1, arg2, kwarg1=1, kwarg2=2):
pass
def test_function_for_partial2(arg1, arg2, *my_args, **my_kwargs):
pass
# pylint: enable=unused-argument
# pylint: disable=protected-access
# Make sure everything works for regular functions.
expected = inspect.ArgSpec(['arg1', 'arg2', 'kwarg1', 'kwarg2'], None, None,
(1, 2))
self.assertEqual(expected, parser._get_arg_spec(test_function_for_partial1))
# Make sure doing nothing works.
expected = inspect.ArgSpec(['arg1', 'arg2', 'kwarg1', 'kwarg2'], None, None,
(1, 2))
partial = functools.partial(test_function_for_partial1)
self.assertEqual(expected, parser._get_arg_spec(partial))
# Make sure setting args from the front works.
expected = inspect.ArgSpec(['arg2', 'kwarg1', 'kwarg2'], None, None, (1, 2))
partial = functools.partial(test_function_for_partial1, 1)
self.assertEqual(expected, parser._get_arg_spec(partial))
expected = inspect.ArgSpec(['kwarg2',], None, None, (2,))
partial = functools.partial(test_function_for_partial1, 1, 2, 3)
self.assertEqual(expected, parser._get_arg_spec(partial))
# Make sure setting kwargs works.
expected = inspect.ArgSpec(['arg1', 'arg2', 'kwarg2'], None, None, (2,))
partial = functools.partial(test_function_for_partial1, kwarg1=0)
self.assertEqual(expected, parser._get_arg_spec(partial))
expected = inspect.ArgSpec(['arg1', 'arg2', 'kwarg1'], None, None, (1,))
partial = functools.partial(test_function_for_partial1, kwarg2=0)
self.assertEqual(expected, parser._get_arg_spec(partial))
expected = inspect.ArgSpec(['arg1'], None, None, ())
partial = functools.partial(test_function_for_partial1,
arg2=0, kwarg1=0, kwarg2=0)
self.assertEqual(expected, parser._get_arg_spec(partial))
# Make sure *args, *kwargs is accounted for.
expected = inspect.ArgSpec([], 'my_args', 'my_kwargs', ())
partial = functools.partial(test_function_for_partial2, 0, 1)
self.assertEqual(expected, parser._get_arg_spec(partial))
# pylint: enable=protected-access
if __name__ == '__main__':
googletest.main()
|
odejesush/tensorflow
|
tensorflow/tools/docs/parser_test.py
|
Python
|
apache-2.0
| 12,002
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wicket.core.util.resource.locator;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.io.File;
import java.net.URL;
import java.util.Locale;
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
import org.apache.wicket.core.util.resource.ClassPathResourceFinder;
import org.apache.wicket.core.util.resource.UrlResourceStream;
import org.apache.wicket.core.util.resource.locator.caching.CachingResourceStreamLocator;
import org.apache.wicket.util.resource.FileResourceStream;
import org.apache.wicket.util.resource.IResourceStream;
import org.apache.wicket.util.resource.StringResourceStream;
import org.junit.jupiter.api.Test;
/**
* Tests for CachingResourceStreamLocator
*
* <a href="https://issues.apache.org/jira/browse/WICKET-3511">WICKET-3511</a>
*/
class CachingResourceStreamLocatorTest
{
/**
* Tests NullResourceStreamReference
*/
@Test
void notExistingResource()
{
IResourceStreamLocator resourceStreamLocator = mock(IResourceStreamLocator.class);
CachingResourceStreamLocator cachingLocator = new CachingResourceStreamLocator(
resourceStreamLocator);
cachingLocator.locate(String.class, "path");
cachingLocator.locate(String.class, "path");
// there is no resource with that Key so a "miss" will be cached and expect 1 call to the
// delegate
verify(resourceStreamLocator, times(1)).locate(String.class, "path");
}
/**
* Tests strict before non-strict matching without a specific locale.
*/
@Test
void strictBeforeNonStrictMatchingWithoutLocaleDoesntResultInInvalidNonStrictMatch()
{
IResourceStreamLocator resourceStreamLocator = new ResourceStreamLocator(
new ClassPathResourceFinder(""));
CachingResourceStreamLocator cachingLocator = new CachingResourceStreamLocator(
resourceStreamLocator);
String style = null;
String variation = null;
Locale locale = null;
String extension = null;
String filename = "org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js";
// a strict lookup for the resource with no specific locale results in a match
IResourceStream strictLocate = cachingLocator.locate(AbstractDefaultAjaxBehavior.class,
filename, style, variation, locale, extension, true);
assertNotNull(strictLocate);
// followed by a non-strict search for the same resource also finds it
IResourceStream nonStrictLocate = cachingLocator.locate(AbstractDefaultAjaxBehavior.class,
filename, style, variation, locale, extension, false);
assertNotNull(nonStrictLocate);
}
/**
* Tests strict before non-strict matching with a specific locale.
*/
@Test
void strictMatchingDoesntInvalidateNonStrictMatching()
{
IResourceStreamLocator resourceStreamLocator = new ResourceStreamLocator(
new ClassPathResourceFinder(""));
CachingResourceStreamLocator cachingLocator = new CachingResourceStreamLocator(
resourceStreamLocator);
String style = null;
String variation = null;
Locale locale = new Locale("nl", "NL");
String extension = null;
String filename = "org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js";
// a strict lookup of a localized resource should not find the non-localized resource
IResourceStream strictLocate = cachingLocator.locate(AbstractDefaultAjaxBehavior.class,
filename, style, variation, locale, extension, true);
assertNull(strictLocate);
// but a non-strict lookup with a locale should fall back to the non-localized resource
IResourceStream nonStrictLocate = cachingLocator.locate(AbstractDefaultAjaxBehavior.class,
filename, style, variation, locale, extension, false);
assertNotNull(nonStrictLocate);
}
/**
* Tests non-strict before strict matching with a specific locale.
*/
@Test
void nonStrictMatchingDoesntResultInInvalidStrictMatch()
{
IResourceStreamLocator resourceStreamLocator = new ResourceStreamLocator(
new ClassPathResourceFinder(""));
CachingResourceStreamLocator cachingLocator = new CachingResourceStreamLocator(
resourceStreamLocator);
String style = null;
String variation = null;
Locale locale = new Locale("nl", "NL");
String extension = null;
String filename = "org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js";
// a non-strict lookup with a specific locale should find the non-localized resource
IResourceStream nonStrictLocate = cachingLocator.locate(AbstractDefaultAjaxBehavior.class,
filename, style, variation, locale, extension, false);
assertNotNull(nonStrictLocate);
// but a strict lookup with a specific locale should not fall back to the non-localized
// resource
IResourceStream strictLocate = cachingLocator.locate(AbstractDefaultAjaxBehavior.class,
filename, style, variation, locale, extension, true);
assertNull(strictLocate);
}
/**
* Tests FileResourceStreamReference
*/
@Test
void fileResource()
{
IResourceStreamLocator resourceStreamLocator = mock(IResourceStreamLocator.class);
FileResourceStream frs = new FileResourceStream(new File("."));
when(resourceStreamLocator.locate(String.class, "path", "style", "variation", null,
"extension", true)).thenReturn(frs);
CachingResourceStreamLocator cachingLocator = new CachingResourceStreamLocator(
resourceStreamLocator);
cachingLocator.locate(String.class, "path", "style", "variation", null, "extension", true);
cachingLocator.locate(String.class, "path", "style", "variation", null, "extension", true);
// there is a file resource with that Key so expect just one call to the delegate
verify(resourceStreamLocator, times(1)).locate(String.class, "path", "style", "variation",
null, "extension", true);
}
/**
* Tests two FileResourceStreamReferences with different extensions
*/
@Test
void fileResourceDifferentExtensions()
{
IResourceStreamLocator resourceStreamLocator = mock(IResourceStreamLocator.class);
FileResourceStream frs = new FileResourceStream(new File("."));
when(resourceStreamLocator.locate(String.class, "path", "style", "variation", null,
"extension", true)).thenReturn(frs);
CachingResourceStreamLocator cachingLocator = new CachingResourceStreamLocator(
resourceStreamLocator);
cachingLocator.locate(String.class, "path", "style", "variation", null, "extension", true);
cachingLocator.locate(String.class, "path", "style", "variation", null, "extension", true);
cachingLocator.locate(String.class, "path", "style", "variation", null, "extension2", true);
// there is a file resource with that Key so expect just one call to the delegate
verify(resourceStreamLocator, times(1)).locate(String.class, "path", "style", "variation",
null, "extension", true);
verify(resourceStreamLocator, times(1)).locate(String.class, "path", "style", "variation",
null, "extension2", true);
}
/**
* Tests UrlResourceStreamReference
*
* @throws Exception
*/
@Test
void urlResource() throws Exception
{
IResourceStreamLocator resourceStreamLocator = mock(IResourceStreamLocator.class);
UrlResourceStream urs = new UrlResourceStream(new URL("file:///"));
when(resourceStreamLocator.locate(String.class, "path")).thenReturn(urs);
CachingResourceStreamLocator cachingLocator = new CachingResourceStreamLocator(
resourceStreamLocator);
cachingLocator.locate(String.class, "path");
cachingLocator.locate(String.class, "path");
// there is a url resource with that Key so expect just one call to the delegate
verify(resourceStreamLocator, times(1)).locate(String.class, "path");
}
/**
* Tests light weight resource streams (everything but FileResourceStream and
* UrlResourceStream). These should <strong>not</strong> be cached.
*/
@Test
void lightweightResource()
{
IResourceStreamLocator resourceStreamLocator = mock(IResourceStreamLocator.class);
StringResourceStream srs = new StringResourceStream("anything");
when(resourceStreamLocator.locate(String.class, "path", "style", "variation", null,
"extension", true)).thenReturn(srs);
CachingResourceStreamLocator cachingLocator = new CachingResourceStreamLocator(
resourceStreamLocator);
cachingLocator.locate(String.class, "path", "style", "variation", null, "extension", true);
cachingLocator.locate(String.class, "path", "style", "variation", null, "extension", true);
// lightweight resource streams should not be cached so expect just a call to the delegate
// for each call to the caching locator
verify(resourceStreamLocator, times(2)).locate(String.class, "path", "style", "variation",
null, "extension", true);
}
}
|
mosoft521/wicket
|
wicket-core/src/test/java/org/apache/wicket/core/util/resource/locator/CachingResourceStreamLocatorTest.java
|
Java
|
apache-2.0
| 9,531
|
/*
* Copyright © 2002 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* California 95054, U.S.A. All rights reserved. Sun Microsystems, Inc. has
* intellectual property rights relating to technology embodied in the product
* that is described in this document. In particular, and without limitation,
* these intellectual property rights may include one or more of the U.S.
* patents listed at http://www.sun.com/patents and one or more additional
* patents or pending patent applications in the U.S. and in other countries.
* U.S. Government Rights - Commercial software. Government users are subject
* to the Sun Microsystems, Inc. standard license agreement and applicable
* provisions of the FAR and its supplements. Use is subject to license terms.
* Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
* trademarks of Sun Microsystems, Inc. in the U.S. and other countries. This
* product is covered and controlled by U.S. Export Control laws and may be
* subject to the export or import laws in other countries. Nuclear, missile,
* chemical biological weapons or nuclear maritime end uses or end users,
* whether direct or indirect, are strictly prohibited. Export or reexport
* to countries subject to U.S. embargo or to entities identified on U.S.
* export exclusion lists, including, but not limited to, the denied persons
* and specially designated nationals lists is strictly prohibited.
*/
/* JJT: 0.2.2 */
public class ASTReadStatement extends SimpleNode {
String name;
ASTReadStatement(int id) {
super(id);
}
public void interpret()
{
Object o;
byte[] b = new byte[64];
int i;
if ((o = symtab.get(name)) == null)
System.err.println("Undefined variable : " + name);
if (o instanceof Boolean)
{
System.out.print("Enter a value for \'" + name + "\' (boolean) : ");
System.out.flush();
try
{
i = System.in.read(b);
symtab.put(name, new Boolean((new String(b, 0, 0, i - 1)).trim()));
} catch(Exception e) { System.exit(1); }
}
else if (o instanceof Integer)
{
System.out.print("Enter a value for \'" + name + "\' (int) : ");
System.out.flush();
try
{
i = System.in.read(b);
symtab.put(name, new Integer((new String(b, 0, 0, i - 1)).trim()));
} catch(Exception e) {
System.out.println("Exceptio : " + e.getClass().getName());
System.exit(1);
}
}
}
}
|
MondecaLabs/rdf2xml
|
utilities/javacc-4.0/examples/Interpreter/ASTReadStatement.java
|
Java
|
apache-2.0
| 2,559
|
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 23.4.3.4
description: Throws TypeError if `this` is not Object.
info: >
WeakSet.prototype.has ( value )
1. Let S be the this value.
2. If Type(S) is not Object, throw a TypeError exception.
---*/
assert.throws(TypeError, function() {
WeakSet.prototype.has.call('', {});
});
assert.throws(TypeError, function() {
var s = new WeakSet();
s.has.call('', {});
});
|
m0ppers/arangodb
|
3rdParty/V8/V8-5.0.71.39/test/test262/data/test/built-ins/WeakSet/prototype/has/this-not-object-throw-string.js
|
JavaScript
|
apache-2.0
| 526
|
import React from 'react';
import { Field, FormikProps } from 'formik';
import { HelpField } from '@spinnaker/core';
import { IAmazonNetworkLoadBalancerUpsertCommand } from 'amazon/domain';
export interface INLBAdvancedSettingsProps {
formik: FormikProps<IAmazonNetworkLoadBalancerUpsertCommand>;
}
export class NLBAdvancedSettings extends React.Component<INLBAdvancedSettingsProps> {
public render() {
const { values } = this.props.formik;
return (
<div className="form-group">
<div className="col-md-3 sm-label-right">
<b>Protection</b> <HelpField id="loadBalancer.advancedSettings.deletionProtection" />
</div>
<div className="col-md-7 checkbox">
<label>
<Field type="checkbox" name="deletionProtection" checked={values.deletionProtection} />
Enable deletion protection
</label>
</div>
</div>
);
}
}
|
sgarlick987/deck
|
app/scripts/modules/amazon/src/loadBalancer/configure/network/NLBAdvancedSettings.tsx
|
TypeScript
|
apache-2.0
| 923
|
/*
* Copyright © 2012-2014 Cask Data, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package co.cask.coopr.scheduler.callback;
import co.cask.coopr.cluster.Node;
import co.cask.coopr.common.conf.Configuration;
import co.cask.coopr.common.conf.Constants;
import co.cask.coopr.scheduler.ClusterAction;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.config.SocketConfig;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Iterator;
import java.util.Set;
/**
* Executes before and after hooks by sending an HTTP POST request to some configurable endpoints, with the post body
* containing the cluster and job objects, assuming there is a valid url assigned to the start, success, and/or failure
* urls. If no url is specified, no request will be sent. Additionally, trigger actions can be configured so that
* the HTTP POST request is sent only for specific cluster actions. This is done by specifying a comma separated list
* of {@link ClusterAction}s in the configuration for start, success, and/or triggers.
*/
public class HttpPostClusterCallback implements ClusterCallback {
private static final Logger LOG = LoggerFactory.getLogger(HttpPostClusterCallback.class);
private final Gson gson = new Gson();
private String onStartUrl;
private String onSuccessUrl;
private String onFailureUrl;
private Set<ClusterAction> startTriggerActions;
private Set<ClusterAction> successTriggerActions;
private Set<ClusterAction> failureTriggerActions;
private HttpClient httpClient;
public void initialize(Configuration conf) {
this.onStartUrl = conf.get(Constants.HttpCallback.START_URL);
this.onSuccessUrl = conf.get(Constants.HttpCallback.SUCCESS_URL);
this.onFailureUrl = conf.get(Constants.HttpCallback.FAILURE_URL);
this.startTriggerActions = parseActionsString(conf.get(Constants.HttpCallback.START_TRIGGERS,
Constants.HttpCallback.DEFAULT_START_TRIGGERS));
this.successTriggerActions = parseActionsString(conf.get(Constants.HttpCallback.SUCCESS_TRIGGERS,
Constants.HttpCallback.DEFAULT_SUCCESS_TRIGGERS));
this.failureTriggerActions = parseActionsString(conf.get(Constants.HttpCallback.FAILURE_TRIGGERS,
Constants.HttpCallback.DEFAULT_FAILURE_TRIGGERS));
if (onStartUrl != null) {
LOG.debug("before hook will be triggered on actions {}", Joiner.on(',').join(startTriggerActions));
}
if (onSuccessUrl != null) {
LOG.debug("after hook will be triggered on actions {}", Joiner.on(',').join(successTriggerActions));
}
if (onFailureUrl != null) {
LOG.debug("after hook will be triggered on actions {}", Joiner.on(',').join(failureTriggerActions));
}
int maxConnections = conf.getInt(Constants.HttpCallback.MAX_CONNECTIONS,
Constants.HttpCallback.DEFAULT_MAX_CONNECTIONS);
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
connectionManager.setDefaultMaxPerRoute(maxConnections);
connectionManager.setMaxTotal(maxConnections);
SocketConfig socketConfig = SocketConfig.custom()
.setSoTimeout(conf.getInt(Constants.HttpCallback.SOCKET_TIMEOUT,
Constants.HttpCallback.DEFAULT_SOCKET_TIMEOUT))
.build();
connectionManager.setDefaultSocketConfig(socketConfig);
this.httpClient = HttpClientBuilder.create().setConnectionManager(connectionManager).build();
}
private Set<ClusterAction> parseActionsString(String actionsStr) {
if (actionsStr == null) {
return ImmutableSet.of();
}
Iterator<String> actionIter = Splitter.on(',').split(actionsStr).iterator();
Set<ClusterAction> actions = Sets.newHashSet();
while (actionIter.hasNext()) {
String actionStr = actionIter.next();
try {
ClusterAction action = ClusterAction.valueOf(actionStr.toUpperCase());
actions.add(action);
} catch (IllegalArgumentException e) {
LOG.warn("Unknown cluster action " + actionStr + ". Hooks will not be executed for that action");
}
}
return actions;
}
public boolean onStart(CallbackData data, CallbackContext context) {
ClusterAction jobAction = data.getJob().getClusterAction();
if (startTriggerActions.contains(jobAction)) {
if (onStartUrl != null) {
LOG.debug("sending request to {} before performing {} on cluster {}",
onStartUrl, jobAction, data.getCluster().getId());
sendPost(onStartUrl, data, context);
}
}
return true;
}
public void onSuccess(CallbackData data, CallbackContext context) {
ClusterAction jobAction = data.getJob().getClusterAction();
if (successTriggerActions.contains(data.getJob().getClusterAction())) {
if (onSuccessUrl != null) {
LOG.debug("{} completed successfully on cluster {}, sending request to {}",
jobAction, data.getCluster().getId(), onSuccessUrl);
sendPost(onSuccessUrl, data, context);
}
}
}
@Override
public void onFailure(CallbackData data, CallbackContext context) {
ClusterAction jobAction = data.getJob().getClusterAction();
if (failureTriggerActions.contains(data.getJob().getClusterAction())) {
if (onFailureUrl != null) {
LOG.debug("{} failed on cluster {}, sending request to {}",
jobAction, data.getCluster().getId(), onFailureUrl);
sendPost(onFailureUrl, data, context);
}
}
}
private void sendPost(String url, CallbackData data, CallbackContext context) {
HttpPost post = new HttpPost(url);
Set<Node> nodes;
try {
nodes = context.getClusterStoreView().getClusterNodes(data.getCluster().getId());
} catch (Exception e) {
LOG.error("Unable to fetch nodes for cluster {}, not sending post request.", data.getCluster().getId());
return;
}
try {
JsonObject body = new JsonObject();
body.add("cluster", gson.toJsonTree(data.getCluster()));
body.add("job", gson.toJsonTree(data.getJob()));
body.add("nodes", gson.toJsonTree(nodes));
post.setEntity(new StringEntity(gson.toJson(body)));
httpClient.execute(post);
} catch (UnsupportedEncodingException e) {
LOG.warn("Exception setting http post body", e);
} catch (ClientProtocolException e) {
LOG.warn("Exception executing http post callback to " + url, e);
} catch (IOException e) {
LOG.warn("Exception executing http post callback to " + url, e);
} catch (Exception e) {
LOG.warn("Exception executing http post callback to " + url, e);
} finally {
post.releaseConnection();
}
}
}
|
caskdata/coopr
|
coopr-server/src/main/java/co/cask/coopr/scheduler/callback/HttpPostClusterCallback.java
|
Java
|
apache-2.0
| 7,927
|
/*
* Copyright 2020 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.optaplanner.persistence.jpa.api.score.buildin.hardmediumsoftbigdecimal;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import org.optaplanner.core.api.score.buildin.hardmediumsoftbigdecimal.HardMediumSoftBigDecimalScore;
@Converter
public class HardMediumSoftBigDecimalScoreConverter implements AttributeConverter<HardMediumSoftBigDecimalScore, String> {
@Override
public String convertToDatabaseColumn(HardMediumSoftBigDecimalScore score) {
if (score == null) {
return null;
}
return score.toString();
}
@Override
public HardMediumSoftBigDecimalScore convertToEntityAttribute(String scoreString) {
if (scoreString == null) {
return null;
}
return HardMediumSoftBigDecimalScore.parseScore(scoreString);
}
}
|
ge0ffrey/optaplanner
|
optaplanner-persistence/optaplanner-persistence-jpa/src/main/java/org/optaplanner/persistence/jpa/api/score/buildin/hardmediumsoftbigdecimal/HardMediumSoftBigDecimalScoreConverter.java
|
Java
|
apache-2.0
| 1,478
|
{
title: "Appium",
description: "How to run Appium tests on Sauce Labs",
category: 'Tutorials',
index: 7,
image: "/images/tutorials/appium.png",
}
Appium is an open-source tool that can be used to automate your mobile applications. Just like the Selenium WebDriver - which is an open-source tool used to automate web browsers - Appium is an automation library used to drive your mobile applications, and even the web browser within the mobile simulator, emulator or real device.
**Advantages of using Appium:**
- It allows you to write tests against multiple mobile platforms using the same API.
- You can write and run your tests using any language or test framework.
- It is an open-source tool that you can easily contribute to.
**Advantages of using Appium on Sauce Labs:**
- You save the time it takes to set up the Appium server locally.
- You don't have to install/configure the mobile emulators/simulators in your local environment.
- You don't have to make any modifications to the source code of your application.
- You can start scaling your tests instantly.
For an in-depth explanation of what Appium is, how it works and the various technologies used to make Appium work, visit the [Appium Documentation](http://appium.io/documentation.html).
## Writing Tests With Appium
Getting started with Appium on Sauce Labs is really easy. As long as you are familiar with the fundamentals of automated testing, using [Selenium WebDriver](http://docs.seleniumhq.org/docs/03_webdriver.jsp) for automated tests, the specifics of your programming language and your test environment setup you should be able to follow along. All you need to do is the following:
1. Get a [Sauce Labs account](https://saucelabs.com/signup).
2. Decide on the type of mobile application that you will be testing:
- [Mobile Native Application](#mobile-native-application)
- [Mobile Web Application](#mobile-web-application)
- [Mobile Hybrid Application](#mobile-hybrid-application)
2. Write your mobile application tests using:
- The [Appium](http://appium.io/slate/en/master/?python#appium-client-libraries) client library for the language of your choice.
3. Use the [Platforms Configurator](https://docs.saucelabs.com/reference/platforms-configurator/#/) to obtain the correct desired capabilities for your test.
4. Point the driver address to use the Sauce Labs cloud:
- `http://SAUCE_USERNAME:SAUCE_ACCESS_KEY@ondemand.saucelabs.com:80/wd/hub`
5. Run your test and find the result in your [Sauce Labs test page](https://saucelabs.com/tests)
For more information on writing, configuring, and running your tests with Appium on Sauce Labs check out the [Running Your Mobile Test](#running-your-mobile-test) guidelines:
## Appium on Sauce Labs
### Running Your Mobile Test
During your mobile application automated tests, Appium will be the tool in the background that is starting and driving the simulator, emulator or device for each Sauce Labs test. For iOS **Appium is supported in iOS versions 6.1 and later**, for Android **Appium is supported in Android versions 4.4 or later for [Mobile Web Application](#mobile-web-application) tests and Android versions 2.3, 4.0 and later for [Mobile Native Application](#mobile-native-application) and [Mobile Hybrid Application](#mobile-hybrid-application) tests**.
First, decide on the type of mobile application that you will be testing. You can either test a [Mobile Native Application](#mobile-native-application) , a [Mobile Web Application](#mobile-web-application) or a [Mobile Hybrid Application](#mobile-hybrid-application) . If you are testing a [Mobile Native Application](#mobile-native-application) or a [Mobile Hybrid Application](#mobile-hybrid-application) , make sure that:
**For iOS**
- The mobile application is compiled in debug mode.
- The mobile application is compiled for the simulator/device version of your choice.
- The mobile application is signed with a developer certificate (only if the application is signed).
- The mobile application is hosted in a place that Sauce Labs can access, for example:
- A remote location (e.g a GitHub Repository)
- Your [Temporary Sauce Storage](https://docs.saucelabs.com/reference/rest-api/#temporary-storage).
**For Android**
- The mobile application is compiled for the emulator/device version of your choice.
- The mobile application has [internet permissions](http://developer.android.com/reference/android/Manifest.permission.html#INTERNET).
- The mobile application is hosted in a place that Sauce Labs can access, for example:
- A remote location (e.g a GitHub Repository)
- Your [Temporary Sauce Storage](https://docs.saucelabs.com/reference/rest-api/#temporary-storage).
Next, write your test using as a guideline the following Appium example tests:
**For iOS**
- [Java](https://github.com/appium/sample-code/blob/master/sample-code/examples/java/generic/src/test/java/SimpleIOSSauceTests.java)
- [PHP](https://github.com/appium/sample-code/blob/master/sample-code/examples/php/SauceTest.php)
- [Node.js](https://github.com/appium/sample-code/blob/master/sample-code/examples/node/ios-simple.js)
- [Python](https://github.com/appium/sample-code/blob/master/sample-code/examples/python/ios_sauce.py)
- [Ruby](https://github.com/appium/sample-code/blob/master/sample-code/examples/ruby/simple_test.rb)
**For Android**
- [Java](https://github.com/appium/sample-code/blob/master/sample-code/examples/java/junit/src/test/java/com/saucelabs/appium/AndroidTest.java)
- [PHP](https://github.com/appium/sample-code/blob/master/sample-code/examples/php/SauceTest.php)
- [Node.js](https://github.com/appium/sample-code/blob/master/sample-code/examples/node/android-simple.js)
- [Python](https://github.com/appium/sample-code/blob/master/sample-code/examples/python/android_simple.py)
- [Ruby](https://github.com/appium/sample-code/blob/master/sample-code/examples/ruby/android_on_sauce.rb)
The driver address in your test should be pointing to the Sauce Labs cloud (i.e `http://SAUCE_USERNAME:SAUCE_ACCESS_KEY@ondemand.saucelabs.com:80/wd/hub`), this is what indicates that the test will run on the Sauce Labs cloud. Also, for the corresponding programming language each test needs to extend/import the Appium client library instead of using the regular Selenium WebDriver client library. Finally, each test needs to be using the correct desired capabilities specifying the desired simulator/emulator platform, the Appium version and the mobile application location if using a mobile native app or a mobile hybrid app.
For more information about the desired capabilities that you should be using during your mobile tests, please read the [Setting Desired Capabilities for Mobile Tests](#setting-desired-capabilities-for-mobile-tests) section.
Finally, once your test is ready to be executed use the test framework of your choice to run the test. As your test runs you should be able to spy on the test by going into your [Sauce Labs test page](https://saucelabs.com/tests). For more information about what you should look for when viewing the results of your test, please read the [Viewing My Appium Tests on Sauce Labs](#viewing-my-appium-tests-on-sauce-labs) section.
To learn how Appium and Sauce Labs work read the [Understanding how Appium works on Sauce Labs](#understanding-how-appium-works-on-sauce-labs) section for an overview.
## Types of Mobile Applications
### Mobile Native Application
This type of application is developed for an specific platform (i.e., iOS or Android), using the native SDKs provided by the platform vendor, and distributed to users via the appropriate app store.
### Mobile Web Application
This type of application is formally what we call a mobile website. It can be accessed through a browser (e.g. Mobile Safari, Browser, Chrome, etc.) in a mobile simulator/emulator or real device.
### Mobile Hybrid Application
This type of application is part mobile native app and part mobile web app. Just like mobile native apps you can find and download mobile hybrid apps using the Apple’s App Store or the Google Play Store. In the same manner, just like a mobile web app, a mobile hybrid app would look like a mobile website that would be accessed through a "browser", but in this case the "browser" is an embedded webview within the application that would just allow to display some HTML.
## Setting Desired Capabilities for Mobile Tests
The desired capabilities are a set of keys and values that will be sent to the Appium server running in the Sauce Labs cloud. These keys and values tell the Appium server the specifications of the automated test that you will be running. Using our [Platforms Configurator](https://docs.saucelabs.com/reference/platforms-configurator/#/) you can easily determine the correct desired capabilities for the programming language of your choice.
Here is a list of the main desired capabilities that you will be using for your mobile tests:
- **browserName** (required):
The mobile web browser that will be automated in the simulator, emulator or device (e.g Mobile Safari, Browser, Chrome, etc). If testing a mobile native application or a mobile hybrid application the value for this capability should be an empty string.
- **deviceName** (required):
The name of the simulator, emulator or device that will be used (e.g iPhone Simulator, iPad Simulator, Android Emulator, Samsung Galaxy S4 Emulator, Samsung Galaxy S5 Device, etc.). To specify Android phones and tablets read the [Android Emulator Skins](#android-emulator-skins) section.
- **platformName** (required):
The mobile operating system platform that will be used (e.g iOS or Android).
- **platformVersion** (required):
The mobile operating system version that will be used (e.g 8.0, 7.1, 4.0, 5.0, etc.).
- **appiumVersion** (optional):
The version of the Appium driver that will be used. It is recommended to specify the latest Appium version which is the one suggested by the [Platforms Configurator](https://docs.saucelabs.com/reference/platforms-configurator/#/). If not specified the test will run against the default Appium version.
- **app** (only for mobile native application or mobile hybrid application tests):
The path to a .ipa, .apk or .zip file containing the app to test. This could be the location of your app in the [Temporary Sauce Storage](https://docs.saucelabs.com/reference/rest-api/#temporary-storage) (e.g sauce-storage:myapp.zip) or the URL to a remote location where your app is located (e.g http://myappurl.zip). This capability is not required for Android if you specify the **appPackage** and **appActivity** capabilities.
- **device-orientation** (optional):
The orientation in which the simulator/device will be rendered (e.g portrait or landscape).
- **appActivity** (optional):
The activity name for the Android activity you want to launch from your package. This often needs to be preceded by a `.` (dot) (e.g., .MainActivity instead of MainActivity). Appium will automatically determine the activity to launch, you only need to use this desired capability if you want to specify an activity different than the default one.
- **appPackage** (optional):
The Java package of the Android app you want to run (e.g com.example.android.myApp, com.android.settings, etc.). Appium will automatically determine the package to launch, you only need to use this desired capability if you want to specify a package different than the default one.
- **automationName**(optional):
The automation engine that will be used (e.g Appium or Selendroid). By default the automationName used is Appium.
**Note 1**: For **Mobile Native Applications** tests using Android versions 2.3, 4.0 and 4.1 you need to specify the following desired capability: `"automationName":"selendroid"`. The reason for this is that these Android versions are only supported via the Appium’s bundled version of Selendroid, which utilizes [Instrumentation](http://developer.android.com/reference/android/app/Instrumentation.html). For the remaining versions of Android (i.e Android 4.2 and later) you do not need to use the `'automationName':'selendroid'` desired capability since these later versions are supported via Appium’s own UiAutomator library which is the default automation backend.
**Note 2**: For **Mobile Hybrid Applications** tests using Android versions 2.3 to 4.3 you need to specify the following desired capability: `"automationName'":"selendroid"`. For the remaining versions of Android (i.e Android 4.4 and later) you do not need to use the `'automationName':'selendroid'` desired capability since these later versions are supported via Appium’s own UiAutomator library which is the default automation backend.
For more desired capabilities read the [Appium Server Capabilities](http://appium.io/slate/en/master/?python#appium-server-capabilities) documentation.
### Android Emulator Skins
For your Android emulator test you can request a regular Android emulator by using the desired capability `"deviceName":"Android Emulator"`. But if instead you are interested in using an Android emulator that looks and feels like a certain Android phone or tablet (e.g Google Nexus 7 HD Emulator, Samsung Galaxy S4, Google Nexus 7C, etc) then instead of `"deviceName":"Android Emulator"` you need to specify the corresponding Android emulator skin (e.g `"deviceName":"Samsung Galaxy S4 Emulator"`).
Each Android emulator skins will have a different configuration depending on the phone or table that it is trying to emulate. For instance all the skins have different resolutions, screen dimensions, pixel densities, memory, etc. To get a list of the available Android emulator skins for the different Android emulator versions use our [Platforms Configurator](https://docs.saucelabs.com/reference/platforms-configurator/#/).
## Viewing my Appium tests on Sauce Labs
Once your test is ready to be executed use the test framework of your choice to run the test. As your test runs you should be able to spy on the test by going into your [Sauce Labs test page](https://saucelabs.com/tests). In addition, after the test execution completes you will be able to see the commands executed during your test, the screenshots taken by Sauce Labs during your test, a video of of the test, the Appium server log and metadata information related to the test.
The **Appium Log** tab in your test indicates that this test ran using the Appium driver. If you take a look at the Appium Log, you will notice that the first line of the log provides information about the Appium version used during your test (e.g `info: Welcome to Appium v1.4.0`).
For **iOS tests**, you will notice that the iOS simulator log is embedded within the Appium log. The information from the iOS simulator is grayed out throughout the Appium log and has the following tag name: `info: [IOS_SYSLOG_ROW ]`. For **Android tests** you can find the Android emulator logs by clicking on the "Metadata" tab in your test page and searching for the "Logcat.log" file. This file contains all the information from the Android emulator log.
## Understanding how Appium works on Sauce Labs
The driver address in you test script is what points the test to the Sauce Labs cloud (i.e `http://SAUCE_USERNAME:SAUCE_ACCESS_KEY@ondemand.saucelabs.com:80/wd/hub`). Once you execute the test using the test framework of your choice, Sauce Labs initializes its own Appium server using the specifications taken from your desired capabilities.
For **iOS tests**, after the mobile application is initialized, the Appium server takes the driver commands in your test script which are in a [WebDriver JSON Wire Protocol](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Introduction) format and converts them into UIAutomation JavaScript commands which can be understood by [Apple Instruments](https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Introduction/Introduction.html). These commands once converted are sent to your iOS mobile application via Apple Instruments. Apple Instruments is what executes the commands against your mobile application in the simulator/device.
The responses obtained from your mobile application are received by Apple Instruments, sent to UI Automation and relayed to the Appium server in the Sauce Labs cloud. The Appium server then needs to convert the UI Automation JavaScript responses back into WebDriver JSON Wire Protocol format and send the JSON responses back to your test script.
For **Android tests**, after the mobile application is initialized, the Appium server receives your test script commands and launches your mobile application in the emulator/device that you've specified. Appium then takes the driver commands in your test script which are in a [WebDriver JSON Wire Protocol](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Introduction) format and converts them into UIAutomator Java commands. UIAutomator is the library provided by Google as part of the Android SDK and is the library that Appium uses to automate your Android mobile application tests.
In the case where you are connecting to the Selendroid automation backend, Appium simply proxies all requests to the Selendroid server running on the emulator/device.
The responses obtained from your mobile application are received by UIAutomator and relayed to the Appium server in the Sauce Labs cloud. The Appium server then needs to convert the UIAutomator Java responses back into WebDriver JSON Wire Protocol format and send the JSON responses back to your test script.
Appium hides all of this complexity from your test script (and from you!). Your test script thinks it's communicating with your mobile application, but in reality it is communicating with Appium's implementation of the WebDriver API. The fact that Appium is running your mobile application in the appropriate simulator, emulator or device and wrapping all of the communications with your mobile application including the commands conversions remains completely hidden, and your test script is none the wiser.
## Appium Resources
For more information, feel free to visit the resources listed below:
- [Appium](http://appium.io)
- [Introduction to Appium Concepts](http://appium.io/introduction.html)
- [Appium Docs](http://appium.io/slate/en/v1.0.0/)
- [Appium Discussion Group](https://discuss.appium.io)
- [Appium on Github](http://github.com/appium/appium)
- [Selenium WebDriver JSON Wire Protocol](http://code.google.com/p/selenium/wiki/JsonWireProtocol)
- [Selenium](http://www.seleniumhq.org)
- [Apple UI Automation Documentation](http://developer.apple.com/library/ios/#documentation/DeveloperTools/Reference/UIAutomationRef/_index.html)
- [Android UI Testing Documentation](http://developer.android.com/tools/testing/testing_ui.html)
## Frequently Asked Questions
- **How can I test Android tablets?**
The best way to test on different Android emulators screen sizes is by using the different [Android Emulator Skins](#android-emulator-skins) . For instance, if you use our [Platforms Configurator](https://docs.saucelabs.com/reference/platforms-configurator/#/) you'll see the available skins for the different Android versions (e.g Google Nexus 7 HD, LG Nexus 4, Samsung Galaxy Nexus, Samsung Galaxy S3, etc). Some of these skins are tablets, for example the Google Nexus 7C is a tablet which has a very large resolution and very high density.
- **How can I run manual tests for my mobile native app or mobile hybrid app?**
Sauce Labs doesn't support manual tests for mobile native app or mobile hybrid app tests.
- **What type of keyboard and buttons do the Android emulators have?**
Android Emulators have software buttons and a hardware keyboard. In a regular Android emulator the device buttons are software buttons displayed on the right size of the emulator. For the Android emulators with different skins (e.g Google Nexus 7 HD, LG Nexus 4, Samsung Galaxy Nexus, Samsung Galaxy S3, etc) the device buttons are also software buttons that are overplayed on top of the skin. For instance, if you hover the mouse around the edges of any of our Android emulators with an specified skin, a hover icon will appear and you should be able to find whatever buttons actually exist on the device that the skinned emulator is trying to emulate (e.g power button along the top, volume buttons along the edge, back/home buttons right below the screen, etc).
- **How can I run Android tests without Appium?**
For older versions of Android Appium might not be supported. For instance, Appium is only supported in Android versions 4.4 or later for [Mobile Web Application](#mobile-web-application) tests, and Android versions 2.3, 4.0 and later for [Mobile Native Application](#mobile-native-application) and [Mobile Hybrid Application](#mobile-hybrid-application) tests.
For those versions in which Appium is not supported you can request an emulator driven by Webdriver + Selendroid. All you need to do is use our [Platforms Configurator](https://docs.saucelabs.com/reference/platforms-configurator/#/) and select **Selenium** for the API instead of Appium.
In the Sauce Labs test you will notice that the top of the emulator says "AndroidDriver Webview App". In addition, you will notice that you will get a "Selenium Log" tab which has the output of the Selendroid driver.
With an emulator driven by Webdriver + Selendroid you will be able to test [Mobile Web Application](#mobile-web-application) only. You should be able to select any Android emulator version from 4.0 to the latest version and any Android emulator skin (e.g "deviceName":"Samsung Galaxy Tab 3 Emulator").
- **How can I run iOS tests without Appium?**
For older versions of iOS Appium might not be supported. For instance, Appium is supported in iOS versions 6.1 and later. For earlier versions of iOS the tool or driver used to drive your mobile applications automated test is called iWebdriver.
To obtain a simulator driven by iWebdriver use our [Platforms Configurator](https://docs.saucelabs.com/reference/platforms-configurator/#/) and select **Selenium** for the API instead of Appium. With an emulator driven by iWebdriver you will be able to test [Mobile Web Application](#mobile-web-application) only. In addition, in the Sauce Labs test you will notice a "Selenium Log" tab which has the output of iWebdriver.
- **What mobile web browsers can I automate in the Android emulator?**
Currently the only browser that can be automated in our Android emulators is the stock browser (i.e Browser). The Android stock browser is an Android flavor of 'chromium' which presumably implies that its behavior is closer to that of Google Chrome.
- **How can I test with mobile real devices instead of using the simulators or emulators?**
The mobile real device cloud is a new feature that Sauce Labs is currently working on. For more information about this feature please directly email one of our sales team representatives (saro@saucelabs.com).
|
mekhami/docs
|
markdown/tutorials/appium.md
|
Markdown
|
apache-2.0
| 23,086
|
/**
* Copyright 2011-2019 Asakusa Framework Team.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.asakusafw.spark.compiler.planning;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import org.junit.Test;
import com.asakusafw.lang.compiler.model.iterative.IterativeExtension;
import com.asakusafw.lang.compiler.model.testing.MockOperators;
import com.asakusafw.lang.compiler.planning.Plan;
import com.asakusafw.lang.compiler.planning.PlanDetail;
import com.asakusafw.lang.compiler.planning.SubPlan;
/**
* Test for {@link IterativeOperationAnalyzer}.
*/
public class IterativeOperationAnalyzerTest extends PlanningTestRoot {
/**
* simple case.
<pre>{@code
in[*] --- out
==>
in[*] --- *C[*] --- out[*]
}</pre>
*/
@Test
public void simple() {
PlanDetail detail = SparkPlanning.plan(context(), new MockOperators()
.input("in", new IterativeExtension())
.output("out").connect("in", "out")
.toGraph());
Plan plan = detail.getPlan();
assertThat(IterativeInfo.isIterative(plan), is(true));
IterativeInfo info = IterativeInfo.get(plan);
assertThat(info, is(IterativeInfo.always()));
MockOperators mock = restore(detail);
assertThat(plan.getElements(), hasSize(2));
SubPlan s0 = ownerOf(detail, mock.get("in"));
SubPlan s1 = ownerOf(detail, mock.get("out"));
assertThat(IterativeInfo.get(s0), is(IterativeInfo.always()));
assertThat(IterativeInfo.get(output(s0)), is(IterativeInfo.always()));
assertThat(IterativeInfo.get(s1), is(IterativeInfo.always()));
assertThat(IterativeInfo.get(input(s1)), is(IterativeInfo.always()));
}
/**
* not iterative.
<pre>{@code
in[-] --- out
==>
in[-] --- *C[-] --- out[-]
}</pre>
*/
@Test
public void non_iterative() {
PlanDetail detail = SparkPlanning.plan(context(), new MockOperators()
.input("in")
.output("out").connect("in", "out")
.toGraph());
Plan plan = detail.getPlan();
assertThat(IterativeInfo.isIterative(plan), is(false));
}
/**
* confluent iteratives.
<pre>{@code
in1[a] ---+ out
in2[b] --/
==>
in1[a] ---+ *C[a,b] --- out[*]
in2[b] --/
}</pre>
*/
@Test
public void confluent_iterative() {
PlanDetail detail = SparkPlanning.plan(context(), new MockOperators()
.input("in1", new IterativeExtension("a"))
.input("in2", new IterativeExtension("b"))
.output("out")
.connect("in1", "out")
.connect("in2", "out")
.toGraph());
Plan plan = detail.getPlan();
assertThat(IterativeInfo.isIterative(plan), is(true));
IterativeInfo info = IterativeInfo.get(plan);
assertThat(info, is(IterativeInfo.always()));
MockOperators mock = restore(detail);
assertThat(plan.getElements(), hasSize(3));
SubPlan s0 = ownerOf(detail, mock.get("in1"));
SubPlan s1 = ownerOf(detail, mock.get("in2"));
SubPlan s2 = ownerOf(detail, mock.get("out"));
assertThat(IterativeInfo.get(s0), is(IterativeInfo.parameter("a")));
assertThat(IterativeInfo.get(output(s0)), is(IterativeInfo.parameter("a")));
assertThat(IterativeInfo.get(s1), is(IterativeInfo.parameter("b")));
assertThat(IterativeInfo.get(output(s1)), is(IterativeInfo.parameter("b")));
assertThat(IterativeInfo.get(s2), is(IterativeInfo.always()));
assertThat(IterativeInfo.get(input(s2)), is(IterativeInfo.parameter("a", "b")));
}
/**
* confluent iteratives.
<pre>{@code
in1[a] ---+ out
in2[-] --/
==>
in1[a] ---+ *C[a] --- out[*]
in2[-] --/
}</pre>
*/
@Test
public void confluent_mixed() {
PlanDetail detail = SparkPlanning.plan(context(), new MockOperators()
.input("in1", new IterativeExtension("a"))
.input("in2")
.output("out")
.connect("in1", "out")
.connect("in2", "out")
.toGraph());
Plan plan = detail.getPlan();
assertThat(IterativeInfo.isIterative(plan), is(true));
IterativeInfo info = IterativeInfo.get(plan);
assertThat(info, is(IterativeInfo.always()));
MockOperators mock = restore(detail);
assertThat(plan.getElements(), hasSize(3));
SubPlan s0 = ownerOf(detail, mock.get("in1"));
SubPlan s1 = ownerOf(detail, mock.get("in2"));
SubPlan s2 = ownerOf(detail, mock.get("out"));
assertThat(IterativeInfo.get(s0), is(IterativeInfo.parameter("a")));
assertThat(IterativeInfo.get(output(s0)), is(IterativeInfo.parameter("a")));
assertThat(IterativeInfo.get(s1), is(IterativeInfo.never()));
assertThat(IterativeInfo.get(output(s1)), is(IterativeInfo.never()));
assertThat(IterativeInfo.get(s2), is(IterativeInfo.always()));
assertThat(IterativeInfo.get(input(s2)), is(IterativeInfo.parameter("a")));
}
}
|
ueshin/asakusafw-spark
|
planner/src/test/java/com/asakusafw/spark/compiler/planning/IterativeOperationAnalyzerTest.java
|
Java
|
apache-2.0
| 5,646
|
package fs
import (
"testing"
"github.com/dotcloud/docker/pkg/libcontainer/cgroups"
)
const (
sectorsRecursiveContents = `8:0 1024`
serviceBytesRecursiveContents = `8:0 Read 100
8:0 Write 200
8:0 Sync 300
8:0 Async 500
8:0 Total 500
Total 500`
servicedRecursiveContents = `8:0 Read 10
8:0 Write 40
8:0 Sync 20
8:0 Async 30
8:0 Total 50
Total 50`
queuedRecursiveContents = `8:0 Read 1
8:0 Write 4
8:0 Sync 2
8:0 Async 3
8:0 Total 5
Total 5`
)
var actualStats = *cgroups.NewStats()
func appendBlkioStatEntry(blkioStatEntries *[]cgroups.BlkioStatEntry, major, minor, value uint64, op string) {
*blkioStatEntries = append(*blkioStatEntries, cgroups.BlkioStatEntry{Major: major, Minor: minor, Value: value, Op: op})
}
func TestBlkioStats(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"blkio.io_service_bytes_recursive": serviceBytesRecursiveContents,
"blkio.io_serviced_recursive": servicedRecursiveContents,
"blkio.io_queued_recursive": queuedRecursiveContents,
"blkio.sectors_recursive": sectorsRecursiveContents,
})
blkio := &blkioGroup{}
err := blkio.GetStats(helper.CgroupData, &actualStats)
if err != nil {
t.Fatal(err)
}
// Verify expected stats.
expectedStats := cgroups.BlkioStats{}
appendBlkioStatEntry(&expectedStats.SectorsRecursive, 8, 0, 1024, "")
appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 100, "Read")
appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 200, "Write")
appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 300, "Sync")
appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 500, "Async")
appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 500, "Total")
appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 10, "Read")
appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 40, "Write")
appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 20, "Sync")
appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 30, "Async")
appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 50, "Total")
appendBlkioStatEntry(&expectedStats.IoQueuedRecursive, 8, 0, 1, "Read")
appendBlkioStatEntry(&expectedStats.IoQueuedRecursive, 8, 0, 4, "Write")
appendBlkioStatEntry(&expectedStats.IoQueuedRecursive, 8, 0, 2, "Sync")
appendBlkioStatEntry(&expectedStats.IoQueuedRecursive, 8, 0, 3, "Async")
appendBlkioStatEntry(&expectedStats.IoQueuedRecursive, 8, 0, 5, "Total")
expectBlkioStatsEquals(t, expectedStats, actualStats.BlkioStats)
}
func TestBlkioStatsNoSectorsFile(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"blkio.io_service_bytes_recursive": serviceBytesRecursiveContents,
"blkio.io_serviced_recursive": servicedRecursiveContents,
"blkio.io_queued_recursive": queuedRecursiveContents,
})
blkio := &blkioGroup{}
err := blkio.GetStats(helper.CgroupData, &actualStats)
if err == nil {
t.Fatal("Expected to fail, but did not")
}
}
func TestBlkioStatsNoServiceBytesFile(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"blkio.io_serviced_recursive": servicedRecursiveContents,
"blkio.io_queued_recursive": queuedRecursiveContents,
"blkio.sectors_recursive": sectorsRecursiveContents,
})
blkio := &blkioGroup{}
err := blkio.GetStats(helper.CgroupData, &actualStats)
if err == nil {
t.Fatal("Expected to fail, but did not")
}
}
func TestBlkioStatsNoServicedFile(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"blkio.io_service_bytes_recursive": serviceBytesRecursiveContents,
"blkio.io_queued_recursive": queuedRecursiveContents,
"blkio.sectors_recursive": sectorsRecursiveContents,
})
blkio := &blkioGroup{}
err := blkio.GetStats(helper.CgroupData, &actualStats)
if err == nil {
t.Fatal("Expected to fail, but did not")
}
}
func TestBlkioStatsNoQueuedFile(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"blkio.io_service_bytes_recursive": serviceBytesRecursiveContents,
"blkio.io_serviced_recursive": servicedRecursiveContents,
"blkio.sectors_recursive": sectorsRecursiveContents,
})
blkio := &blkioGroup{}
err := blkio.GetStats(helper.CgroupData, &actualStats)
if err == nil {
t.Fatal("Expected to fail, but did not")
}
}
func TestBlkioStatsUnexpectedNumberOfFields(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"blkio.io_service_bytes_recursive": "8:0 Read 100 100",
"blkio.io_serviced_recursive": servicedRecursiveContents,
"blkio.io_queued_recursive": queuedRecursiveContents,
"blkio.sectors_recursive": sectorsRecursiveContents,
})
blkio := &blkioGroup{}
err := blkio.GetStats(helper.CgroupData, &actualStats)
if err == nil {
t.Fatal("Expected to fail, but did not")
}
}
func TestBlkioStatsUnexpectedFieldType(t *testing.T) {
helper := NewCgroupTestUtil("blkio", t)
defer helper.cleanup()
helper.writeFileContents(map[string]string{
"blkio.io_service_bytes_recursive": "8:0 Read Write",
"blkio.io_serviced_recursive": servicedRecursiveContents,
"blkio.io_queued_recursive": queuedRecursiveContents,
"blkio.sectors_recursive": sectorsRecursiveContents,
})
blkio := &blkioGroup{}
err := blkio.GetStats(helper.CgroupData, &actualStats)
if err == nil {
t.Fatal("Expected to fail, but did not")
}
}
|
afdnlw/docker
|
pkg/libcontainer/cgroups/fs/blkio_test.go
|
GO
|
apache-2.0
| 5,775
|
// jshint node: true
// We need this so chai `expect` statements don't throw an error.
// jshint expr: true
'use strict';
import chai, {expect} from 'chai';
import EddystoneUID from '../../lib/eddystone-uid.js';
describe('Eddystone-UID', () => {
describe('getByteArray()', () => {
it('Invalid type', () => {
expect(() => EddystoneUID.getByteArray({}, 5)).to.throw(TypeError);
});
it('Valid String', () => {
expect(EddystoneUID.getByteArray('FF00', 2)).to.eql([0xFF, 0]);
});
it('Invalid String', () => {
expect(() => EddystoneUID.getByteArray('GGGG', 2)).to.throw(Error);
});
it('Valid byte array', () => {
expect(EddystoneUID.getByteArray([1, 2, 3, 4], 4)).to.eql([1, 2, 3, 4]);
});
it('Invalid byte array', () => {
expect(() => EddystoneUID.getByteArray([0xF00], 1)).to.throw(Error);
});
});
describe('getHexString()', () => {
it('Valid String', () => {
expect(EddystoneUID.getHexString([0xFF])).to.eql('ff');
});
it('Invalid String', () => {
expect(() => EddystoneUID.getHexString([0xF00])).to.throw(Error);
});
});
describe('_getNamespaceByteArray()', () => {
it('Valid String Namespace', () => {
expect(EddystoneUID._getNamespaceByteArray('0102030405060708090a'))
.to.eql([1,2,3,4,5,6,7,8,9,10]);
});
it('Invalid Length String Namespace', () => {
expect(() => EddystoneUID._getNamespaceByteArray('0102030405'))
.to.throw(Error);
});
it('Valid Byte Namespace', () => {
expect(EddystoneUID._getNamespaceByteArray([1,2,3,4,5,6,7,8,9,0]))
.to.eql([1,2,3,4,5,6,7,8,9,0]);
});
it('Invalid Length Byte Namespace', () => {
expect(() => EddystoneUID._getNamespaceByteArray([1,2,3,4]))
.to.throw(Error);
});
});
describe('_getInstanceByteArray()', () => {
it('Valid String Instance', () => {
expect(EddystoneUID._getInstanceByteArray('010203040506')).to.eql([1,2,3,4,5,6]);
});
it('Invalid Length String Instance', () => {
expect(() => EddystoneUID._getInstanceByteArray('010203')).to.throw(Error);
});
it('Valid Byte Array Instance', () => {
expect(EddystoneUID._getInstanceByteArray([1,2,3,4,5,6])).to.eql([1,2,3,4,5,6]);
});
it('Invalid Length Byte Array Instance', () => {
expect(() => EddystoneUID._getInstanceByteArray([1,2,3])).to.throw(Error);
});
});
describe('_encodeString()', () => {
it('Odd expected length', () => {
expect(() => EddystoneUID._encodeString('012', 3)).to.throw(/length/);
});
it('Too Long String', () => {
expect(() => EddystoneUID._encodeString('010203', 4)).to.throw(/length/);
});
it('Too Short String', () => {
expect(() => EddystoneUID._encodeString('01', 4)).to.throw(/length/);
});
it('Correct Length String', () => {
expect(EddystoneUID._encodeString('0102', 4)).to.eql([1,2]);
});
it('Invalid characters String', () => {
expect(() => EddystoneUID._encodeString('010G', 4)).to.throw(/character/);
});
it('Valid String', () => {
expect(EddystoneUID._encodeString('abcdef', 6)).eql([0xab, 0xcd, 0xef]);
});
});
describe('_validateByteArray()', () => {
it('Too long array', () => {
expect(() => EddystoneUID._validateByteArray([1,2,3], 2)).to.throw(/length/);
});
it('Too short array', () => {
expect(() => EddystoneUID._validateByteArray([1], 2)).to.throw(/length/);
});
it('Wrong type in array', () => {
expect(() => EddystoneUID._validateByteArray([1, {}], 2)).to.throw(/value/);
});
it('Wrong value in array', () => {
expect(() => EddystoneUID._validateByteArray([1, 0xF00], 2)).to.throw(/value/);
});
});
});
|
nirmankarta/eddystone
|
libraries/javascript/eddystone-advertising/test/unit/eddystone-uid-unit.js
|
JavaScript
|
apache-2.0
| 3,751
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/route53/model/TestDNSAnswerRequest.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <aws/core/http/URI.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::Route53::Model;
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
using namespace Aws::Http;
TestDNSAnswerRequest::TestDNSAnswerRequest() :
m_hostedZoneIdHasBeenSet(false),
m_recordNameHasBeenSet(false),
m_recordType(RRType::NOT_SET),
m_recordTypeHasBeenSet(false),
m_resolverIPHasBeenSet(false),
m_eDNS0ClientSubnetIPHasBeenSet(false),
m_eDNS0ClientSubnetMaskHasBeenSet(false)
{
}
Aws::String TestDNSAnswerRequest::SerializePayload() const
{
return {};
}
void TestDNSAnswerRequest::AddQueryStringParameters(URI& uri) const
{
Aws::StringStream ss;
if(m_hostedZoneIdHasBeenSet)
{
ss << m_hostedZoneId;
uri.AddQueryStringParameter("hostedzoneid", ss.str());
ss.str("");
}
if(m_recordNameHasBeenSet)
{
ss << m_recordName;
uri.AddQueryStringParameter("recordname", ss.str());
ss.str("");
}
if(m_recordTypeHasBeenSet)
{
ss << RRTypeMapper::GetNameForRRType(m_recordType);
uri.AddQueryStringParameter("recordtype", ss.str());
ss.str("");
}
if(m_resolverIPHasBeenSet)
{
ss << m_resolverIP;
uri.AddQueryStringParameter("resolverip", ss.str());
ss.str("");
}
if(m_eDNS0ClientSubnetIPHasBeenSet)
{
ss << m_eDNS0ClientSubnetIP;
uri.AddQueryStringParameter("edns0clientsubnetip", ss.str());
ss.str("");
}
if(m_eDNS0ClientSubnetMaskHasBeenSet)
{
ss << m_eDNS0ClientSubnetMask;
uri.AddQueryStringParameter("edns0clientsubnetmask", ss.str());
ss.str("");
}
}
|
awslabs/aws-sdk-cpp
|
aws-cpp-sdk-route53/source/model/TestDNSAnswerRequest.cpp
|
C++
|
apache-2.0
| 1,983
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_65) on Sun Mar 29 01:32:47 JST 2015 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>twitter4j.examples.media (twitter4j-examples 4.0.3 API)</title>
<meta name="date" content="2015-03-29">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<h1 class="bar"><a href="../../../twitter4j/examples/media/package-summary.html" target="classFrame">twitter4j.examples.media</a></h1>
</body>
</html>
|
egeyman/Final-Project
|
twitter4j-examples/javadoc/twitter4j/examples/media/package-frame.html
|
HTML
|
apache-2.0
| 656
|
package mil.nga.giat.geowave.core.ingest.operations;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.ParameterException;
import com.beust.jcommander.Parameters;
import com.beust.jcommander.ParametersDelegate;
import mil.nga.giat.geowave.core.cli.annotations.GeowaveOperation;
import mil.nga.giat.geowave.core.cli.api.Command;
import mil.nga.giat.geowave.core.cli.api.OperationParams;
import mil.nga.giat.geowave.core.cli.operations.config.options.ConfigOptions;
import mil.nga.giat.geowave.core.ingest.hdfs.mapreduce.IngestFromHdfsDriver;
import mil.nga.giat.geowave.core.ingest.hdfs.mapreduce.IngestFromHdfsPlugin;
import mil.nga.giat.geowave.core.ingest.hdfs.mapreduce.MapReduceCommandLineOptions;
import mil.nga.giat.geowave.core.ingest.local.LocalInputCommandLineOptions;
import mil.nga.giat.geowave.core.ingest.operations.options.IngestFormatPluginOptions;
import mil.nga.giat.geowave.core.store.operations.remote.options.DataStorePluginOptions;
import mil.nga.giat.geowave.core.store.operations.remote.options.IndexLoader;
import mil.nga.giat.geowave.core.store.operations.remote.options.IndexPluginOptions;
import mil.nga.giat.geowave.core.store.operations.remote.options.StoreLoader;
import mil.nga.giat.geowave.core.store.operations.remote.options.VisibilityOptions;
@GeowaveOperation(name = "mrToGW", parentOperation = IngestSection.class)
@Parameters(commandDescription = "Ingest supported files that already exist in HDFS")
public class MapReduceToGeowaveCommand implements
Command
{
@Parameter(description = "<hdfs host:port> <path to base directory to write to> <store name> <comma delimited index/group list>")
private List<String> parameters = new ArrayList<String>();
@ParametersDelegate
private VisibilityOptions ingestOptions = new VisibilityOptions();
@ParametersDelegate
private MapReduceCommandLineOptions mapReduceOptions = new MapReduceCommandLineOptions();
@ParametersDelegate
private LocalInputCommandLineOptions localInputOptions = new LocalInputCommandLineOptions();
// This helper is used to load the list of format SPI plugins that will be
// used
@ParametersDelegate
private IngestFormatPluginOptions pluginFormats = new IngestFormatPluginOptions();
private DataStorePluginOptions inputStoreOptions = null;
private List<IndexPluginOptions> inputIndexOptions = null;
@Override
public boolean prepare(
OperationParams params ) {
// TODO: localInputOptions has 'extensions' which doesn't mean
// anything for MapReduce to GeoWave.
// Based on the selected formats, select the format plugins
pluginFormats.selectPlugin(localInputOptions.getFormats());
return true;
}
/**
* Prep the driver & run the operation.
*/
@Override
public void execute(
OperationParams params ) {
// Ensure we have all the required arguments
if (parameters.size() != 4) {
throw new ParameterException(
"Requires arguments: <hdfs host:port> <path to base directory to write to> <store name> <comma delimited index/group list>");
}
if (mapReduceOptions.getJobTrackerOrResourceManagerHostPort() == null) {
throw new ParameterException(
"Requires job tracker or resource manager option (try geowave help <command>...)");
}
String hdfsHostPort = parameters.get(0);
String basePath = parameters.get(1);
String inputStoreName = parameters.get(2);
String indexList = parameters.get(3);
// Ensures that the url starts with hdfs://
if (!hdfsHostPort.contains("://")) {
hdfsHostPort = "hdfs://" + hdfsHostPort;
}
// Config file
File configFile = (File) params.getContext().get(
ConfigOptions.PROPERTIES_FILE_CONTEXT);
// Attempt to load input store.
if (inputStoreOptions == null) {
StoreLoader inputStoreLoader = new StoreLoader(
inputStoreName);
if (!inputStoreLoader.loadFromConfig(configFile)) {
throw new ParameterException(
"Cannot find store name: " + inputStoreLoader.getStoreName());
}
inputStoreOptions = inputStoreLoader.getDataStorePlugin();
}
// Load the Indexes
if (inputIndexOptions == null) {
IndexLoader indexLoader = new IndexLoader(
indexList);
if (!indexLoader.loadFromConfig(configFile)) {
throw new ParameterException(
"Cannot find index(s) by name: " + indexList);
}
inputIndexOptions = indexLoader.getLoadedIndexes();
}
// Ingest Plugins
Map<String, IngestFromHdfsPlugin<?, ?>> ingestPlugins = pluginFormats.createHdfsIngestPlugins();
// Driver
IngestFromHdfsDriver driver = new IngestFromHdfsDriver(
inputStoreOptions,
inputIndexOptions,
ingestOptions,
mapReduceOptions,
ingestPlugins,
hdfsHostPort,
basePath);
// Execute
if (!driver.runOperation()) {
throw new RuntimeException(
"Ingest failed to execute");
}
}
public List<String> getParameters() {
return parameters;
}
public void setParameters(
String hdfsHostPort,
String hdfsPath,
String storeName,
String commaSeparatedIndexes ) {
this.parameters = new ArrayList<String>();
this.parameters.add(hdfsHostPort);
this.parameters.add(hdfsPath);
this.parameters.add(storeName);
this.parameters.add(commaSeparatedIndexes);
}
public VisibilityOptions getIngestOptions() {
return ingestOptions;
}
public void setIngestOptions(
VisibilityOptions ingestOptions ) {
this.ingestOptions = ingestOptions;
}
public MapReduceCommandLineOptions getMapReduceOptions() {
return mapReduceOptions;
}
public void setMapReduceOptions(
MapReduceCommandLineOptions mapReduceOptions ) {
this.mapReduceOptions = mapReduceOptions;
}
public LocalInputCommandLineOptions getLocalInputOptions() {
return localInputOptions;
}
public void setLocalInputOptions(
LocalInputCommandLineOptions localInputOptions ) {
this.localInputOptions = localInputOptions;
}
public IngestFormatPluginOptions getPluginFormats() {
return pluginFormats;
}
public void setPluginFormats(
IngestFormatPluginOptions pluginFormats ) {
this.pluginFormats = pluginFormats;
}
public DataStorePluginOptions getInputStoreOptions() {
return inputStoreOptions;
}
public void setInputStoreOptions(
DataStorePluginOptions inputStoreOptions ) {
this.inputStoreOptions = inputStoreOptions;
}
public List<IndexPluginOptions> getInputIndexOptions() {
return inputIndexOptions;
}
public void setInputIndexOptions(
List<IndexPluginOptions> inputIndexOptions ) {
this.inputIndexOptions = inputIndexOptions;
}
}
|
chizou/geowave
|
core/ingest/src/main/java/mil/nga/giat/geowave/core/ingest/operations/MapReduceToGeowaveCommand.java
|
Java
|
apache-2.0
| 6,565
|
package com.cuitrip.app;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import com.cuitrip.adapter.MessageDetailListAdapter;
import com.cuitrip.business.MessageBusiness;
import com.cuitrip.login.LoginInstance;
import com.cuitrip.model.DialogItem;
import com.cuitrip.model.DialogList;
import com.cuitrip.model.UserInfo;
import com.cuitrip.push.MessagePrefs;
import com.cuitrip.service.R;
import com.lab.app.BaseActivity;
import com.lab.network.LabAsyncHttpResponseHandler;
import com.lab.network.LabResponse;
import com.lab.utils.MessageUtils;
import com.loopj.android.http.AsyncHttpClient;
import java.util.List;
/**
* Created on 7/18.
*/
public class OldConversatoinActivity extends BaseActivity implements View.OnClickListener {
public static final String ORDER_ID = "MessageDetailActivity.ORDER_ID";
public static final String RECEIVE_ID = "MessageDetailActivity.RECEIVE_ID";
//TODO 根据订单状态决定是否聊天
private String mOrderId;
private ListView mMessageList;
private AsyncHttpClient mClient = new AsyncHttpClient();
private DialogList mData;
private EditText mContent;
private Button mSend;
private String mReceiveId;
public static void start(Context context, String mOrderId,String receiveId) {
context.startActivity(new Intent(context, OldConversatoinActivity.class)
.putExtra(ORDER_ID, mOrderId)
.putExtra(RECEIVE_ID,receiveId));
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
if (intent == null) {
MessageUtils.showToast(R.string.parameter_error);
finish();
return;
}
mOrderId = intent.getStringExtra(ORDER_ID);
mReceiveId = intent.getStringExtra(RECEIVE_ID);
if (mOrderId == null) {
MessageUtils.showToast(R.string.parameter_error);
finish();
return;
}
showActionBar(R.string.ct_message);
setContentView(R.layout.ct_message_detail_list);
mMessageList = (ListView) findViewById(R.id.ct_list);
mContent = (EditText) findViewById(R.id.send_content);
mSend = (Button) findViewById(R.id.message_send);
mSend.setOnClickListener(this);
mContent.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
if (editable != null && editable.length() > 0) {
mSend.setEnabled(true);
} else {
mSend.setEnabled(false);
}
}
});
getMessageList();
MessagePrefs.setLastDialogReadTime(mOrderId, System.currentTimeMillis());
}
private void getMessageList() {
showLoading();
MessageBusiness.getDialogList(this, mClient, mResponseHandler, mOrderId,
MessageDetailListAdapter.PAGE_SIZE, 0);
}
protected void onLoginSuccess() {
getMessageList();
}
protected void onLoginFailed() {
finish();
}
private LabAsyncHttpResponseHandler mResponseHandler = new LabAsyncHttpResponseHandler(DialogList.class) {
@Override
public void onSuccess(LabResponse response, Object data) {
hideLoading();
if (data != null) {
mData = (DialogList) data;
// if (mData.isClosed()) {
// removeView(R.id.send_block);
// } else {
// showView(R.id.send_block);
// }
List<DialogItem> list = mData.getDialog();
if (list != null && !list.isEmpty()) {
MessageDetailListAdapter adapter = new MessageDetailListAdapter(OldConversatoinActivity.this,
list, R.layout.ct_list_pending, list.size() <= MessageDetailListAdapter.PAGE_SIZE,
mOrderId, mMessageList);
mMessageList.setAdapter(adapter);
mMessageList.setSelection(mMessageList.getCount() - 1);
}
}
}
@Override
public void onFailure(LabResponse response, Object data) {
hideLoading();
if (response != null && !TextUtils.isEmpty(response.msg)) {
MessageUtils.showToast(response.msg);
}
return;
}
};
@Override
public void onClick(View view) {
if (view.getId() == R.id.message_send) {
if (!TextUtils.isEmpty(mContent.getText())) {
final String content = mContent.getText().toString();
UserInfo info = LoginInstance.getInstance(this).getUserInfo();
if (info == null) {
return;
}
showLoading();
MessageBusiness.putDialog(this, mClient, new LabAsyncHttpResponseHandler() {
@Override
public void onSuccess(LabResponse response, Object data) {
hideLoading();
getMessageList();
mContent.setText("");
}
@Override
public void onFailure(LabResponse response, Object data) {
hideLoading();
MessageUtils.showToast(response.msg);
}
}, mOrderId, info.getToken(), info.getUid(), mReceiveId,
content, mData.getSid());
}
}
}
}
|
MoonRune/CuiTrip
|
TripApp/src/main/java/com/cuitrip/app/OldConversatoinActivity.java
|
Java
|
apache-2.0
| 6,234
|
import unittest
from openmdao.main.api import set_as_top
from openmdao.util.testutil import assert_rel_error
from pycycle import duct, flowstation
class DuctTestCase(unittest.TestCase):
def test_start(self):
comp = set_as_top(duct.Duct())
comp.dPqP = 0
comp.Q_dot = -237.8
comp.MNexit_des = .4
fs = flowstation.FlowStation()
fs.W = 1.080
fs.setTotalTP(1424.01, .34)
fs.Mach = .4
comp.Fl_I = fs
comp.design = True
comp.run()
assert_rel_error(self,comp.Fl_O.W, 1.080, .005)
assert_rel_error(self,comp.Fl_O.Pt, .34, .005)
assert_rel_error(self,comp.Fl_O.Tt, 540.00, .005)
assert_rel_error(self,comp.Fl_O.rhos, .001566, .005)
assert_rel_error(self,comp.Fl_O.Mach, 0.4, .005)
assert_rel_error(self,comp.Fl_O.area, 221.4, .005)
#check off design
comp.run()
assert_rel_error(self,comp.Fl_O.W, 1.080, .005)
assert_rel_error(self,comp.Fl_O.Pt, .34, .005)
assert_rel_error(self,comp.Fl_O.Tt, 540.00, .005)
assert_rel_error(self,comp.Fl_O.rhos, .001566, .005)
assert_rel_error(self,comp.Fl_O.Mach, 0.4, .005)
assert_rel_error(self,comp.Fl_O.area, 221.4, .005)
#vary something
comp.dPqP = .1
comp.run()
assert_rel_error(self,comp.Fl_O.W, 1.080, .005)
assert_rel_error(self,comp.Fl_O.Pt, .306, .005)
assert_rel_error(self,comp.Fl_O.Tt, 540.00, .005)
assert_rel_error(self,comp.Fl_O.rhos, .0013783, .005)
assert_rel_error(self,comp.Fl_O.Mach, 0.4572, .005)
assert_rel_error(self,comp.Fl_O.area, 221.4, .005)
if __name__ == "__main__":
unittest.main()
|
whiplash01/pyCycle
|
src/pycycle/test/test_duct.py
|
Python
|
apache-2.0
| 1,762
|
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrDefaultPathRenderer_DEFINED
#define GrDefaultPathRenderer_DEFINED
#include "GrPathRenderer.h"
#include "SkTemplates.h"
/**
* Subclass that renders the path using the stencil buffer to resolve fill
* rules (e.g. winding, even-odd)
*/
class GR_API GrDefaultPathRenderer : public GrPathRenderer {
public:
GrDefaultPathRenderer(bool separateStencilSupport,
bool stencilWrapOpsSupport);
virtual bool requiresStencilPass(const SkPath& path,
GrPathFill fill,
const GrDrawTarget* target) const SK_OVERRIDE;
virtual bool canDrawPath(const SkPath& path,
GrPathFill fill,
const GrDrawTarget* target,
bool antiAlias) const SK_OVERRIDE;
virtual void drawPathToStencil(const SkPath& path,
GrPathFill fill,
GrDrawTarget* target) SK_OVERRIDE;
private:
virtual bool onDrawPath(const SkPath& path,
GrPathFill fill,
const GrVec* translate,
GrDrawTarget* target,
bool antiAlias) SK_OVERRIDE;
bool internalDrawPath(const SkPath& path,
GrPathFill fill,
const GrVec* translate,
GrDrawTarget* target,
bool stencilOnly);
bool createGeom(const SkPath& path,
GrPathFill fill,
const GrVec* translate,
GrScalar srcSpaceTol,
GrDrawTarget* target,
GrPrimitiveType* primType,
int* vertexCnt,
int* indexCnt,
GrDrawTarget::AutoReleaseGeometry* arg);
bool fSeparateStencil;
bool fStencilWrapOps;
typedef GrPathRenderer INHERITED;
};
#endif
|
sergecodd/FireFox-OS
|
B2G/gecko/gfx/skia/src/gpu/GrDefaultPathRenderer.h
|
C
|
apache-2.0
| 2,154
|
package com.atlassian.maven.plugins.jgitflow.extension;
import com.atlassian.jgitflow.core.extension.ReleaseStartExtension;
import com.atlassian.maven.jgitflow.api.MavenJGitFlowExtension;
import com.atlassian.maven.plugins.jgitflow.extension.command.UpdateDevelopWithNextDevVersionCommand;
import com.atlassian.maven.plugins.jgitflow.extension.command.external.StartReleaseExternalExecutor;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
@Component(role = ReleaseStartPluginExtension.class)
public class ReleaseStartPluginExtension extends ProductionBranchCreatingPluginExtension implements ReleaseStartExtension
{
@Requirement
private UpdateDevelopWithNextDevVersionCommand updateDevelopWithNextDevVersionCommand;
@Requirement
private StartReleaseExternalExecutor releaseExecutor;
@Override
public void init(MavenJGitFlowExtension externalExtension)
{
super.init(externalExtension);
releaseExecutor.init(externalExtension);
addAfterCreateBranchCommands(
cacheVersionsCommand
, updateDevelopWithNextDevVersionCommand
, releaseExecutor
);
}
}
|
mrstig/jgitflow
|
jgitflow-maven-plugin/src/main/java/com/atlassian/maven/plugins/jgitflow/extension/ReleaseStartPluginExtension.java
|
Java
|
apache-2.0
| 1,236
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/lakeformation/LakeFormation_EXPORTS.h>
#include <aws/core/client/AWSErrorMarshaller.h>
namespace Aws
{
namespace Client
{
class AWS_LAKEFORMATION_API LakeFormationErrorMarshaller : public Aws::Client::JsonErrorMarshaller
{
public:
Aws::Client::AWSError<Aws::Client::CoreErrors> FindErrorByName(const char* exceptionName) const override;
};
} // namespace Client
} // namespace Aws
|
jt70471/aws-sdk-cpp
|
aws-cpp-sdk-lakeformation/include/aws/lakeformation/LakeFormationErrorMarshaller.h
|
C
|
apache-2.0
| 536
|
#include <memory>
#include <string>
#include <vector>
#include "common/buffer/buffer_impl.h"
#include "common/common/empty_string.h"
#include "common/http/filter/ratelimit.h"
#include "common/http/headers.h"
#include "test/mocks/http/mocks.h"
#include "test/mocks/local_info/mocks.h"
#include "test/mocks/ratelimit/mocks.h"
#include "test/mocks/runtime/mocks.h"
#include "test/mocks/tracing/mocks.h"
#include "test/mocks/upstream/mocks.h"
#include "test/test_common/printers.h"
#include "test/test_common/utility.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
using testing::InSequence;
using testing::Invoke;
using testing::NiceMock;
using testing::Return;
using testing::ReturnRef;
using testing::SetArgReferee;
using testing::WithArgs;
using testing::_;
namespace Envoy {
namespace Http {
namespace RateLimit {
class HttpRateLimitFilterTest : public testing::Test {
public:
HttpRateLimitFilterTest() {
ON_CALL(runtime_.snapshot_, featureEnabled("ratelimit.http_filter_enabled", 100))
.WillByDefault(Return(true));
ON_CALL(runtime_.snapshot_, featureEnabled("ratelimit.http_filter_enforcing", 100))
.WillByDefault(Return(true));
ON_CALL(runtime_.snapshot_, featureEnabled("ratelimit.test_key.http_filter_enabled", 100))
.WillByDefault(Return(true));
}
void SetUpTest(const std::string json) {
Json::ObjectSharedPtr config = Json::Factory::loadFromString(json);
config_.reset(new FilterConfig(*config, local_info_, stats_store_, runtime_, cm_));
client_ = new Envoy::RateLimit::MockClient();
filter_.reset(new Filter(config_, Envoy::RateLimit::ClientPtr{client_}));
filter_->setDecoderFilterCallbacks(filter_callbacks_);
filter_callbacks_.route_->route_entry_.rate_limit_policy_.rate_limit_policy_entry_.clear();
filter_callbacks_.route_->route_entry_.rate_limit_policy_.rate_limit_policy_entry_.emplace_back(
route_rate_limit_);
filter_callbacks_.route_->route_entry_.virtual_host_.rate_limit_policy_.rate_limit_policy_entry_
.clear();
filter_callbacks_.route_->route_entry_.virtual_host_.rate_limit_policy_.rate_limit_policy_entry_
.emplace_back(vh_rate_limit_);
}
const std::string filter_config_ = R"EOF(
{
"domain": "foo"
}
)EOF";
FilterConfigSharedPtr config_;
Envoy::RateLimit::MockClient* client_;
std::unique_ptr<Filter> filter_;
NiceMock<MockStreamDecoderFilterCallbacks> filter_callbacks_;
Envoy::RateLimit::RequestCallbacks* request_callbacks_{};
TestHeaderMapImpl request_headers_;
Buffer::OwnedImpl data_;
Stats::IsolatedStoreImpl stats_store_;
NiceMock<Runtime::MockLoader> runtime_;
NiceMock<Upstream::MockClusterManager> cm_;
NiceMock<Router::MockRateLimitPolicyEntry> route_rate_limit_;
NiceMock<Router::MockRateLimitPolicyEntry> vh_rate_limit_;
std::vector<Envoy::RateLimit::Descriptor> descriptor_{{{{"descriptor_key", "descriptor_value"}}}};
NiceMock<LocalInfo::MockLocalInfo> local_info_;
};
TEST_F(HttpRateLimitFilterTest, BadConfig) {
const std::string filter_config = R"EOF(
{
"domain": "foo",
"route_key" : "my_route"
}
)EOF";
Json::ObjectSharedPtr config = Json::Factory::loadFromString(filter_config);
EXPECT_THROW(FilterConfig(*config, local_info_, stats_store_, runtime_, cm_), Json::Exception);
}
TEST_F(HttpRateLimitFilterTest, NoRoute) {
SetUpTest(filter_config_);
EXPECT_CALL(*filter_callbacks_.route_, routeEntry()).WillOnce(Return(nullptr));
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers_, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
}
TEST_F(HttpRateLimitFilterTest, NoCluster) {
SetUpTest(filter_config_);
ON_CALL(cm_, get(_)).WillByDefault(Return(nullptr));
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers_, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
}
TEST_F(HttpRateLimitFilterTest, NoApplicableRateLimit) {
SetUpTest(filter_config_);
filter_callbacks_.route_->route_entry_.rate_limit_policy_.rate_limit_policy_entry_.clear();
EXPECT_CALL(*client_, limit(_, _, _, _)).Times(0);
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers_, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
}
TEST_F(HttpRateLimitFilterTest, NoDescriptor) {
SetUpTest(filter_config_);
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _)).Times(1);
EXPECT_CALL(vh_rate_limit_, populateDescriptors(_, _, _, _, _)).Times(1);
EXPECT_CALL(*client_, limit(_, _, _, _)).Times(0);
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers_, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
}
TEST_F(HttpRateLimitFilterTest, RuntimeDisabled) {
SetUpTest(filter_config_);
EXPECT_CALL(runtime_.snapshot_, featureEnabled("ratelimit.http_filter_enabled", 100))
.WillOnce(Return(false));
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers_, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
}
TEST_F(HttpRateLimitFilterTest, OkResponse) {
SetUpTest(filter_config_);
InSequence s;
EXPECT_CALL(filter_callbacks_.route_->route_entry_.rate_limit_policy_, getApplicableRateLimit(0))
.Times(1);
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _))
.WillOnce(SetArgReferee<1>(descriptor_));
EXPECT_CALL(filter_callbacks_.route_->route_entry_.virtual_host_.rate_limit_policy_,
getApplicableRateLimit(0))
.Times(1);
EXPECT_CALL(*client_, limit(_, "foo",
testing::ContainerEq(std::vector<Envoy::RateLimit::Descriptor>{
{{{"descriptor_key", "descriptor_value"}}}}),
_))
.WillOnce(WithArgs<0>(Invoke([&](Envoy::RateLimit::RequestCallbacks& callbacks) -> void {
request_callbacks_ = &callbacks;
})));
request_headers_.addCopy(Http::Headers::get().RequestId, "requestid");
EXPECT_EQ(FilterHeadersStatus::StopIteration, filter_->decodeHeaders(request_headers_, false));
EXPECT_EQ(FilterDataStatus::StopIterationAndWatermark, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::StopIteration, filter_->decodeTrailers(request_headers_));
EXPECT_CALL(filter_callbacks_, continueDecoding());
EXPECT_CALL(filter_callbacks_.request_info_,
setResponseFlag(AccessLog::ResponseFlag::RateLimited))
.Times(0);
request_callbacks_->complete(Envoy::RateLimit::LimitStatus::OK);
EXPECT_EQ(1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("ratelimit.ok").value());
}
TEST_F(HttpRateLimitFilterTest, ImmediateOkResponse) {
SetUpTest(filter_config_);
InSequence s;
EXPECT_CALL(vh_rate_limit_, populateDescriptors(_, _, _, _, _))
.WillOnce(SetArgReferee<1>(descriptor_));
EXPECT_CALL(*client_, limit(_, "foo",
testing::ContainerEq(std::vector<Envoy::RateLimit::Descriptor>{
{{{"descriptor_key", "descriptor_value"}}}}),
_))
.WillOnce(WithArgs<0>(Invoke([&](Envoy::RateLimit::RequestCallbacks& callbacks) -> void {
callbacks.complete(Envoy::RateLimit::LimitStatus::OK);
})));
EXPECT_CALL(filter_callbacks_, continueDecoding()).Times(0);
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers_, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
EXPECT_EQ(1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("ratelimit.ok").value());
}
TEST_F(HttpRateLimitFilterTest, ErrorResponse) {
SetUpTest(filter_config_);
InSequence s;
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _))
.WillOnce(SetArgReferee<1>(descriptor_));
EXPECT_CALL(*client_, limit(_, _, _, _))
.WillOnce(WithArgs<0>(Invoke([&](Envoy::RateLimit::RequestCallbacks& callbacks) -> void {
request_callbacks_ = &callbacks;
})));
EXPECT_EQ(FilterHeadersStatus::StopIteration, filter_->decodeHeaders(request_headers_, false));
EXPECT_CALL(filter_callbacks_, continueDecoding());
request_callbacks_->complete(Envoy::RateLimit::LimitStatus::Error);
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
EXPECT_CALL(filter_callbacks_.request_info_,
setResponseFlag(AccessLog::ResponseFlag::RateLimited))
.Times(0);
EXPECT_EQ(
1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("ratelimit.error").value());
}
TEST_F(HttpRateLimitFilterTest, LimitResponse) {
SetUpTest(filter_config_);
InSequence s;
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _))
.WillOnce(SetArgReferee<1>(descriptor_));
EXPECT_CALL(*client_, limit(_, _, _, _))
.WillOnce(WithArgs<0>(Invoke([&](Envoy::RateLimit::RequestCallbacks& callbacks) -> void {
request_callbacks_ = &callbacks;
})));
EXPECT_EQ(FilterHeadersStatus::StopIteration, filter_->decodeHeaders(request_headers_, false));
Http::TestHeaderMapImpl response_headers{{":status", "429"}};
EXPECT_CALL(filter_callbacks_, encodeHeaders_(HeaderMapEqualRef(&response_headers), true));
EXPECT_CALL(filter_callbacks_, continueDecoding()).Times(0);
EXPECT_CALL(filter_callbacks_.request_info_,
setResponseFlag(AccessLog::ResponseFlag::RateLimited));
request_callbacks_->complete(Envoy::RateLimit::LimitStatus::OverLimit);
EXPECT_EQ(1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("ratelimit.over_limit")
.value());
EXPECT_EQ(
1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("upstream_rq_4xx").value());
EXPECT_EQ(
1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("upstream_rq_429").value());
}
TEST_F(HttpRateLimitFilterTest, LimitResponseRuntimeDisabled) {
SetUpTest(filter_config_);
InSequence s;
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _))
.WillOnce(SetArgReferee<1>(descriptor_));
EXPECT_CALL(*client_, limit(_, _, _, _))
.WillOnce(WithArgs<0>(Invoke([&](Envoy::RateLimit::RequestCallbacks& callbacks) -> void {
request_callbacks_ = &callbacks;
})));
EXPECT_EQ(FilterHeadersStatus::StopIteration, filter_->decodeHeaders(request_headers_, false));
EXPECT_CALL(runtime_.snapshot_, featureEnabled("ratelimit.http_filter_enforcing", 100))
.WillOnce(Return(false));
EXPECT_CALL(filter_callbacks_, continueDecoding());
request_callbacks_->complete(Envoy::RateLimit::LimitStatus::OverLimit);
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
EXPECT_EQ(1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("ratelimit.over_limit")
.value());
EXPECT_EQ(
1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("upstream_rq_4xx").value());
EXPECT_EQ(
1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("upstream_rq_429").value());
}
TEST_F(HttpRateLimitFilterTest, ResetDuringCall) {
SetUpTest(filter_config_);
InSequence s;
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _))
.WillOnce(SetArgReferee<1>(descriptor_));
EXPECT_CALL(*client_, limit(_, _, _, _))
.WillOnce(WithArgs<0>(Invoke([&](Envoy::RateLimit::RequestCallbacks& callbacks) -> void {
request_callbacks_ = &callbacks;
})));
EXPECT_EQ(FilterHeadersStatus::StopIteration, filter_->decodeHeaders(request_headers_, false));
EXPECT_CALL(*client_, cancel());
filter_->onDestroy();
}
TEST_F(HttpRateLimitFilterTest, RouteRateLimitDisabledForRouteKey) {
route_rate_limit_.disable_key_ = "test_key";
SetUpTest(filter_config_);
ON_CALL(runtime_.snapshot_, featureEnabled("ratelimit.test_key.http_filter_enabled", 100))
.WillByDefault(Return(false));
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _)).Times(0);
EXPECT_CALL(*client_, limit(_, _, _, _)).Times(0);
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers_, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
}
TEST_F(HttpRateLimitFilterTest, VirtualHostRateLimitDisabledForRouteKey) {
vh_rate_limit_.disable_key_ = "test_vh_key";
SetUpTest(filter_config_);
ON_CALL(runtime_.snapshot_, featureEnabled("ratelimit.test_vh_key.http_filter_enabled", 100))
.WillByDefault(Return(false));
EXPECT_CALL(vh_rate_limit_, populateDescriptors(_, _, _, _, _)).Times(0);
EXPECT_CALL(*client_, limit(_, _, _, _)).Times(0);
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers_, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
}
TEST_F(HttpRateLimitFilterTest, IncorrectRequestType) {
std::string internal_filter_config = R"EOF(
{
"domain": "foo",
"request_type" : "internal"
}
)EOF";
SetUpTest(internal_filter_config);
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _)).Times(0);
EXPECT_CALL(vh_rate_limit_, populateDescriptors(_, _, _, _, _)).Times(0);
EXPECT_CALL(*client_, limit(_, _, _, _)).Times(0);
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers_, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
std::string external_filter_config = R"EOF(
{
"domain": "foo",
"request_type" : "external"
}
)EOF";
SetUpTest(external_filter_config);
Http::TestHeaderMapImpl request_headers{{"x-envoy-internal", "true"}};
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _)).Times(0);
EXPECT_CALL(vh_rate_limit_, populateDescriptors(_, _, _, _, _)).Times(0);
EXPECT_CALL(*client_, limit(_, _, _, _)).Times(0);
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers));
}
TEST_F(HttpRateLimitFilterTest, InternalRequestType) {
std::string internal_filter_config = R"EOF(
{
"domain": "foo",
"request_type" : "internal"
}
)EOF";
SetUpTest(internal_filter_config);
Http::TestHeaderMapImpl request_headers{{"x-envoy-internal", "true"}};
InSequence s;
EXPECT_CALL(filter_callbacks_.route_->route_entry_.rate_limit_policy_, getApplicableRateLimit(0))
.Times(1);
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _))
.WillOnce(SetArgReferee<1>(descriptor_));
EXPECT_CALL(filter_callbacks_.route_->route_entry_.virtual_host_.rate_limit_policy_,
getApplicableRateLimit(0))
.Times(1);
EXPECT_CALL(*client_, limit(_, "foo",
testing::ContainerEq(std::vector<Envoy::RateLimit::Descriptor>{
{{{"descriptor_key", "descriptor_value"}}}}),
_))
.WillOnce(WithArgs<0>(Invoke([&](Envoy::RateLimit::RequestCallbacks& callbacks) -> void {
callbacks.complete(Envoy::RateLimit::LimitStatus::OK);
})));
EXPECT_CALL(filter_callbacks_, continueDecoding()).Times(0);
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers));
EXPECT_EQ(1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("ratelimit.ok").value());
}
TEST_F(HttpRateLimitFilterTest, ExternalRequestType) {
std::string external_filter_config = R"EOF(
{
"domain": "foo",
"request_type" : "external"
}
)EOF";
SetUpTest(external_filter_config);
Http::TestHeaderMapImpl request_headers{{"x-envoy-internal", "false"}};
InSequence s;
EXPECT_CALL(filter_callbacks_.route_->route_entry_.rate_limit_policy_, getApplicableRateLimit(0))
.Times(1);
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _))
.WillOnce(SetArgReferee<1>(descriptor_));
EXPECT_CALL(filter_callbacks_.route_->route_entry_.virtual_host_.rate_limit_policy_,
getApplicableRateLimit(0))
.Times(1);
EXPECT_CALL(*client_, limit(_, "foo",
testing::ContainerEq(std::vector<Envoy::RateLimit::Descriptor>{
{{{"descriptor_key", "descriptor_value"}}}}),
_))
.WillOnce(WithArgs<0>(Invoke([&](Envoy::RateLimit::RequestCallbacks& callbacks) -> void {
callbacks.complete(Envoy::RateLimit::LimitStatus::OK);
})));
EXPECT_CALL(filter_callbacks_, continueDecoding()).Times(0);
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers));
EXPECT_EQ(1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("ratelimit.ok").value());
}
TEST_F(HttpRateLimitFilterTest, ExcludeVirtualHost) {
std::string external_filter_config = R"EOF(
{
"domain": "foo"
}
)EOF";
SetUpTest(external_filter_config);
InSequence s;
EXPECT_CALL(filter_callbacks_.route_->route_entry_.rate_limit_policy_, getApplicableRateLimit(0));
EXPECT_CALL(route_rate_limit_, populateDescriptors(_, _, _, _, _))
.WillOnce(SetArgReferee<1>(descriptor_));
EXPECT_CALL(filter_callbacks_.route_->route_entry_, includeVirtualHostRateLimits())
.WillOnce(Return(false));
EXPECT_CALL(filter_callbacks_.route_->route_entry_.virtual_host_.rate_limit_policy_,
getApplicableRateLimit(0))
.Times(0);
EXPECT_CALL(*client_, limit(_, "foo",
testing::ContainerEq(std::vector<Envoy::RateLimit::Descriptor>{
{{{"descriptor_key", "descriptor_value"}}}}),
_))
.WillOnce(WithArgs<0>(Invoke([&](Envoy::RateLimit::RequestCallbacks& callbacks) -> void {
callbacks.complete(Envoy::RateLimit::LimitStatus::OK);
})));
EXPECT_CALL(filter_callbacks_, continueDecoding()).Times(0);
EXPECT_EQ(FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers_, false));
EXPECT_EQ(FilterDataStatus::Continue, filter_->decodeData(data_, false));
EXPECT_EQ(FilterTrailersStatus::Continue, filter_->decodeTrailers(request_headers_));
EXPECT_EQ(1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("ratelimit.ok").value());
}
TEST_F(HttpRateLimitFilterTest, ConfigValueTest) {
std::string stage_filter_config = R"EOF(
{
"domain": "foo",
"stage": 5,
"request_type" : "internal"
}
)EOF";
SetUpTest(stage_filter_config);
EXPECT_EQ(5UL, config_->stage());
EXPECT_EQ("foo", config_->domain());
EXPECT_EQ(FilterRequestType::Internal, config_->requestType());
}
TEST_F(HttpRateLimitFilterTest, DefaultConfigValueTest) {
std::string stage_filter_config = R"EOF(
{
"domain": "foo"
}
)EOF";
SetUpTest(stage_filter_config);
EXPECT_EQ(0UL, config_->stage());
EXPECT_EQ("foo", config_->domain());
EXPECT_EQ(FilterRequestType::Both, config_->requestType());
}
} // namespace RateLimit
} // namespace Http
} // namespace Envoy
|
rlazarus/envoy
|
test/common/http/filter/ratelimit_test.cc
|
C++
|
apache-2.0
| 20,618
|
import { State } from '@ngrx/store';
import { ActionReducer } from '@ngrx/store';
import * as AreaActions from './../actions/area.actions';
import { AreaState, initialState } from './../states/area.state';
export type Action = AreaActions.All;
export const AreaReducer: ActionReducer<AreaState> = (state = initialState, action: Action) => {
switch (action.type) {
case AreaActions.GET_SUCCESS: {
return {...action.payload};
}
case AreaActions.GET_ERROR: {
return state;
}
default: {
return state;
}
}
};
|
fabric8io/fabric8-planner
|
src/app/reducers/area.reducer.ts
|
TypeScript
|
apache-2.0
| 552
|
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha2
import (
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
rest "k8s.io/client-go/rest"
v1alpha2 "k8s.io/kops/pkg/apis/kops/v1alpha2"
"k8s.io/kops/pkg/client/clientset_generated/clientset/scheme"
)
type KopsV1alpha2Interface interface {
RESTClient() rest.Interface
ClustersGetter
InstanceGroupsGetter
KeysetsGetter
SSHCredentialsGetter
}
// KopsV1alpha2Client is used to interact with features provided by the kops group.
type KopsV1alpha2Client struct {
restClient rest.Interface
}
func (c *KopsV1alpha2Client) Clusters(namespace string) ClusterInterface {
return newClusters(c, namespace)
}
func (c *KopsV1alpha2Client) InstanceGroups(namespace string) InstanceGroupInterface {
return newInstanceGroups(c, namespace)
}
func (c *KopsV1alpha2Client) Keysets(namespace string) KeysetInterface {
return newKeysets(c, namespace)
}
func (c *KopsV1alpha2Client) SSHCredentials(namespace string) SSHCredentialInterface {
return newSSHCredentials(c, namespace)
}
// NewForConfig creates a new KopsV1alpha2Client for the given config.
func NewForConfig(c *rest.Config) (*KopsV1alpha2Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &KopsV1alpha2Client{client}, nil
}
// NewForConfigOrDie creates a new KopsV1alpha2Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *KopsV1alpha2Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new KopsV1alpha2Client for the given RESTClient.
func New(c rest.Interface) *KopsV1alpha2Client {
return &KopsV1alpha2Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha2.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *KopsV1alpha2Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}
|
andrewsykim/kops
|
pkg/client/clientset_generated/clientset/typed/kops/v1alpha2/kops_client.go
|
GO
|
apache-2.0
| 2,899
|
#pragma once
#include "../BlockArea.h"
#include "../Entities/Player.h"
#include "Mixins.h"
class cBlockChestHandler final :
public cYawRotator<cClearMetaOnDrop<cBlockEntityHandler>, 0x07, 0x03, 0x04, 0x02, 0x05>
{
using Super = cYawRotator<cClearMetaOnDrop<cBlockEntityHandler>, 0x07, 0x03, 0x04, 0x02, 0x05>;
public:
using Super::Super;
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
{
UNUSED(a_Meta);
return 13;
}
} ;
|
mc-server/MCServer
|
src/Blocks/BlockChest.h
|
C
|
apache-2.0
| 464
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.jackrabbit.oak.plugins.segment;
import static com.google.common.collect.Maps.newHashMap;
import static com.google.common.collect.Sets.newHashSet;
import static java.util.Collections.singleton;
import static org.apache.jackrabbit.oak.plugins.segment.SegmentGraph.createRegExpFilter;
import static org.apache.jackrabbit.oak.plugins.segment.SegmentGraph.parseSegmentGraph;
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Multiset;
import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.oak.plugins.segment.SegmentGraph.Graph;
import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
import org.apache.jackrabbit.oak.plugins.segment.file.FileStore.ReadOnlyStore;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
public class SegmentGraphTest {
private final Set<UUID> segments = newHashSet(
UUID.fromString("5be0c2ea-b6ba-4f80-acad-657a20f920b6"),
UUID.fromString("fdaca71e-f71e-4f19-abf5-144e8c85f9e3"),
UUID.fromString("53be3b93-87fa-487f-a2fc-7c17e639c231"),
UUID.fromString("2eae0bc2-d3dd-4ba4-a765-70c38073437d"),
UUID.fromString("ab61b8c9-222c-4119-a73b-5f61c0bc4741"),
UUID.fromString("38c42dde-5928-4cc3-a483-37185d6971e4")
);
private final Map<UUID, Set<UUID>> references = ImmutableMap.<UUID, Set<UUID>>of(
UUID.fromString("5be0c2ea-b6ba-4f80-acad-657a20f920b6"),
newHashSet(UUID.fromString("2eae0bc2-d3dd-4ba4-a765-70c38073437d")),
UUID.fromString("fdaca71e-f71e-4f19-abf5-144e8c85f9e3"),
newHashSet(UUID.fromString("ab61b8c9-222c-4119-a73b-5f61c0bc4741")),
UUID.fromString("2eae0bc2-d3dd-4ba4-a765-70c38073437d"),
newHashSet(UUID.fromString("2fdaca71e-f71e-4f19-abf5-144e8c85f9e3"),
UUID.fromString("ab61b8c9-222c-4119-a73b-5f61c0bc4741"))
);
private final Set<UUID> filteredSegments = newHashSet(
UUID.fromString("fdaca71e-f71e-4f19-abf5-144e8c85f9e3"),
UUID.fromString("2eae0bc2-d3dd-4ba4-a765-70c38073437d"),
UUID.fromString("ab61b8c9-222c-4119-a73b-5f61c0bc4741")
);
private final Map<UUID, Set<UUID>> filteredReferences = ImmutableMap.<UUID, Set<UUID>>of(
UUID.fromString("fdaca71e-f71e-4f19-abf5-144e8c85f9e3"),
newHashSet(UUID.fromString("ab61b8c9-222c-4119-a73b-5f61c0bc4741")),
UUID.fromString("2eae0bc2-d3dd-4ba4-a765-70c38073437d"),
newHashSet(UUID.fromString("2fdaca71e-f71e-4f19-abf5-144e8c85f9e3"),
UUID.fromString("ab61b8c9-222c-4119-a73b-5f61c0bc4741"))
);
private final Set<String> gcGenerations = newHashSet("0", "1");
private final Map<String, Set<String>> gcReferences = ImmutableMap.of(
"0", singleton("0"),
"1", singleton("0")
);
@Rule
public TemporaryFolder storeFolder = new TemporaryFolder(new File("target"));
private File getStoreFolder() {
return storeFolder.getRoot();
}
@Before
public void setup() throws IOException {
System.out.println(getStoreFolder());
unzip(SegmentGraphTest.class.getResourceAsStream("file-store.zip"), getStoreFolder());
}
@Test
public void testSegmentGraph() throws Exception {
ReadOnlyStore store = FileStore.builder(getStoreFolder()).buildReadOnly();
try {
Graph<UUID> segmentGraph = parseSegmentGraph(store, Predicates.<UUID>alwaysTrue());
assertEquals(segments, newHashSet(segmentGraph.vertices()));
Map<UUID, Set<UUID>> map = newHashMap();
for (Entry<UUID, Multiset<UUID>> entry : segmentGraph.edges()) {
map.put(entry.getKey(), entry.getValue().elementSet());
}
assertEquals(references, map);
} finally {
store.close();
}
}
@Test
public void testSegmentGraphWithFilter() throws Exception {
ReadOnlyStore store = FileStore.builder(getStoreFolder()).buildReadOnly();
try {
Predicate<UUID> filter = createRegExpFilter(".*testWriter.*", store.getTracker());
Graph<UUID> segmentGraph = parseSegmentGraph(store, filter);
assertEquals(filteredSegments, newHashSet(segmentGraph.vertices()));
Map<UUID, Set<UUID>> map = newHashMap();
for (Entry<UUID, Multiset<UUID>> entry : segmentGraph.edges()) {
map.put(entry.getKey(), entry.getValue().elementSet());
}
assertEquals(filteredReferences, map);
} finally {
store.close();
}
}
@Test
public void testGCGraph() throws Exception {
ReadOnlyStore store = FileStore.builder(getStoreFolder()).buildReadOnly();
try {
Graph<String> gcGraph = SegmentGraph.parseGCGraph(store);
assertEquals(gcGenerations, newHashSet(gcGraph.vertices()));
Map<String, Set<String>> map = newHashMap();
for (Entry<String, Multiset<String>> entry : gcGraph.edges()) {
map.put(entry.getKey(), entry.getValue().elementSet());
}
assertEquals(gcReferences, map);
} finally {
store.close();
}
}
private static void unzip(InputStream is, File target) throws IOException {
ZipInputStream zis = new ZipInputStream(is);
try {
for (ZipEntry entry = zis.getNextEntry(); entry != null; entry = zis.getNextEntry()) {
OutputStream out = new FileOutputStream(new File(target, entry.getName()));
try {
IOUtils.copy(zis, out);
} finally {
out.close();
}
}
} finally {
zis.close();
}
}
}
|
meggermo/jackrabbit-oak
|
oak-segment/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentGraphTest.java
|
Java
|
apache-2.0
| 7,089
|
"""Utilities to help with aiohttp."""
import json
from typing import Any, Dict, Optional
from urllib.parse import parse_qsl
from multidict import CIMultiDict, MultiDict
class MockRequest:
"""Mock an aiohttp request."""
def __init__(
self,
content: bytes,
method: str = "GET",
status: int = 200,
headers: Optional[Dict[str, str]] = None,
query_string: Optional[str] = None,
url: str = "",
) -> None:
"""Initialize a request."""
self.method = method
self.url = url
self.status = status
self.headers: CIMultiDict[str] = CIMultiDict(headers or {})
self.query_string = query_string or ""
self._content = content
@property
def query(self) -> "MultiDict[str]":
"""Return a dictionary with the query variables."""
return MultiDict(parse_qsl(self.query_string, keep_blank_values=True))
@property
def _text(self) -> str:
"""Return the body as text."""
return self._content.decode("utf-8")
async def json(self) -> Any:
"""Return the body as JSON."""
return json.loads(self._text)
async def post(self) -> "MultiDict[str]":
"""Return POST parameters."""
return MultiDict(parse_qsl(self._text, keep_blank_values=True))
async def text(self) -> str:
"""Return the body as text."""
return self._text
|
leppa/home-assistant
|
homeassistant/util/aiohttp.py
|
Python
|
apache-2.0
| 1,424
|
/**
* Copyright 2005-2015 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version
* 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package io.fabric8.common.util;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
public class XmlNamespaceFinder extends DefaultHandler {
private Set<String> namespaces = new HashSet<String>();
private boolean namespaceFound = false;
private SAXParserFactory factory;
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
super.startElement(uri, localName, qName, attributes);
if (!namespaceFound) {
if (uri != null && uri.length() > 0) {
namespaces.add(uri);
}
}
}
public Set<String> getNamespaces() {
return namespaces;
}
public SAXParserFactory getFactory() {
return factory;
}
public void setFactory(SAXParserFactory factory) {
this.factory = factory;
}
public Set<String> parseContents(InputSource contents) throws IOException, ParserConfigurationException, SAXException {
namespaces.clear();
// Parse the file into we have what we need (or an error occurs).
if (factory == null) {
factory = SAXParserFactory.newInstance();
}
if (factory != null) {
SAXParser parser = createParser(factory);
// to support external entities specified as relative URIs (see bug 63298)
contents.setSystemId("/"); //$NON-NLS-1$
parser.parse(contents, this);
}
return namespaces;
}
protected final SAXParser createParser(SAXParserFactory parserFactory)
throws ParserConfigurationException, SAXException {
parserFactory.setNamespaceAware(true);
final SAXParser parser = parserFactory.newSAXParser();
final XMLReader reader = parser.getXMLReader();
//reader.setProperty("http://xml.org/sax/properties/lexical-handler", this); //$NON-NLS-1$
// disable DTD validation (bug 63625)
try {
// be sure validation is "off" or the feature to ignore DTD's will not apply
reader.setFeature("http://xml.org/sax/features/validation", false); //$NON-NLS-1$
reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); //$NON-NLS-1$
} catch (SAXNotRecognizedException e) {
// not a big deal if the parser does not recognize the features
} catch (SAXNotSupportedException e) {
// not a big deal if the parser does not support the features
}
return parser;
}
}
|
chirino/fabric8
|
common-util/src/main/java/io/fabric8/common/util/XmlNamespaceFinder.java
|
Java
|
apache-2.0
| 3,620
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_17) on Wed Jun 17 16:18:37 BST 2009 -->
<TITLE>
ReportWriter (Apache JMeter API)
</TITLE>
<META NAME="keywords" CONTENT="org.apache.jmeter.report.writers.ReportWriter interface">
<LINK REL="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle() {
parent.document.title = "ReportWriter (Apache JMeter API)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="../../../../../overview-summary.html"><FONT
CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="package-summary.html"><FONT
CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>
</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>
</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="../../../../../deprecated-list.html"><FONT
CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="../../../../../index-all.html"><FONT
CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="../../../../../help-doc.html"><FONT
CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Apache JMeter</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../org/apache/jmeter/report/writers/ReportSummary.html"
title="interface in org.apache.jmeter.report.writers"><B>PREV CLASS</B></A>
NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="ReportWriter.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if (window == top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | CONSTR | <A
HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.jmeter.report.writers</FONT>
<BR>
Interface ReportWriter</H2>
<DL>
<DT><B>All Known Implementing Classes:</B>
<DD><A HREF="../../../../../org/apache/jmeter/report/writers/AbstractReportWriter.html"
title="class in org.apache.jmeter.report.writers">AbstractReportWriter</A></DD>
</DL>
<HR>
<DL>
<DT>public interface <B>ReportWriter</B>
</DL>
<P>
ReportWriter defines the basic operations of a report writer. A report
plan may have multiple report writers. it might be nice to have a pdf
writer in the future.
<P>
<P>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html"
title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/jmeter/report/writers/ReportWriter.html#getTargetDirectory()">getTargetDirectory</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A
HREF="../../../../../org/apache/jmeter/report/writers/ReportWriter.html#setTargetDirectory(java.lang.String)">setTargetDirectory</A></B>(<A
HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html"
title="class or interface in java.lang">String</A> directory)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/jmeter/report/writers/ReportSummary.html"
title="interface in org.apache.jmeter.report.writers">ReportSummary</A></CODE></FONT></TD>
<TD><CODE><B><A
HREF="../../../../../org/apache/jmeter/report/writers/ReportWriter.html#writeReport(org.apache.jmeter.testelement.TestElement)">writeReport</A></B>(<A
HREF="../../../../../org/apache/jmeter/testelement/TestElement.html"
title="interface in org.apache.jmeter.testelement">TestElement</A> element)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="writeReport(org.apache.jmeter.testelement.TestElement)"><!-- --></A>
<H3>
writeReport</H3>
<PRE>
public <A HREF="../../../../../org/apache/jmeter/report/writers/ReportSummary.html"
title="interface in org.apache.jmeter.report.writers">ReportSummary</A> <B>writeReport</B>(<A
HREF="../../../../../org/apache/jmeter/testelement/TestElement.html"
title="interface in org.apache.jmeter.testelement">TestElement</A> element)</PRE>
<DL>
<DD>
<DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getTargetDirectory()"><!-- --></A>
<H3>
getTargetDirectory</H3>
<PRE>
public <A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getTargetDirectory</B>()</PRE>
<DL>
<DD>
<DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setTargetDirectory(java.lang.String)"><!-- --></A>
<H3>
setTargetDirectory</H3>
<PRE>
public void <B>setTargetDirectory</B>(<A HREF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html"
title="class or interface in java.lang">String</A> directory)</PRE>
<DL>
<DD>
<DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="../../../../../overview-summary.html"><FONT
CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="package-summary.html"><FONT
CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>
</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>
</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="../../../../../deprecated-list.html"><FONT
CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="../../../../../index-all.html"><FONT
CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A HREF="../../../../../help-doc.html"><FONT
CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Apache JMeter</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../org/apache/jmeter/report/writers/ReportSummary.html"
title="interface in org.apache.jmeter.report.writers"><B>PREV CLASS</B></A>
NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="ReportWriter.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if (window == top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | CONSTR | <A
HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 1998-2009 Apache Software Foundation. All Rights Reserved.
</BODY>
</HTML>
|
larsvandersangen/SWOS-WEEK-1
|
gameoflife-web/tools/jmeter/docs/api/org/apache/jmeter/report/writers/ReportWriter.html
|
HTML
|
apache-2.0
| 12,580
|
import struct
import numpy
import io
import pickle
import pyctrl.packet as packet
def testA():
# test A
assert packet.pack('A','C') == b'AC'
assert packet.pack('A','B') == b'AB'
assert packet.pack('A','C') != b'AB'
assert packet.unpack_stream(io.BytesIO(b'AC')) == ('A', 'C')
assert packet.unpack_stream(io.BytesIO(b'AB')) == ('A', 'B')
assert packet.unpack_stream(io.BytesIO(b'AB')) != ('A', 'C')
def testC():
# test C
assert packet.pack('C','C') == b'CC'
assert packet.pack('C','B') == b'CB'
assert packet.pack('C','C') != b'CB'
assert packet.unpack_stream(io.BytesIO(b'CC')) == ('C', 'C')
assert packet.unpack_stream(io.BytesIO(b'CB')) == ('C', 'B')
assert packet.unpack_stream(io.BytesIO(b'CB')) != ('C', 'C')
def testS():
# test S
assert packet.pack('S','abc') == struct.pack('<cI3s', b'S', 3, b'abc')
assert packet.pack('S','abcd') != struct.pack('<cI3s', b'S', 3, b'abc')
assert packet.unpack_stream(
io.BytesIO(struct.pack('<cI3s', b'S', 3, b'abc'))) == ('S', 'abc')
assert packet.unpack_stream(
io.BytesIO(struct.pack('<cI3s', b'S', 3, b'abc'))) != ('S', 'abcd')
def testIFD():
# test I
assert packet.pack('I',3) == struct.pack('<ci', b'I', 3)
assert packet.pack('I',3) != struct.pack('<ci', b'I', 4)
assert packet.unpack_stream(
io.BytesIO(struct.pack('<ci', b'I', 3))) == ('I', 3)
assert packet.unpack_stream(
io.BytesIO(struct.pack('<ci', b'I', 4))) != ('I', 3)
# test F
assert packet.pack('F',3.3) == struct.pack('<cf', b'F', 3.3)
assert packet.pack('F',3.3) != struct.pack('<cf', b'F', 4.3)
assert packet.unpack_stream(
io.BytesIO(struct.pack('<cf', b'F', numpy.float32(3.3)))) == ('F', numpy.float32(3.3))
assert packet.unpack_stream(
io.BytesIO(struct.pack('<cf', b'F', 4.3))) != ('F', 3.3)
# test D
assert packet.pack('D',3.3) == struct.pack('<cd', b'D', 3.3)
assert packet.pack('D',3.3) != struct.pack('<cd', b'D', 4.3)
assert packet.unpack_stream(
io.BytesIO(struct.pack('<cd', b'D', 3.3))) == ('D', 3.3)
assert packet.unpack_stream(
io.BytesIO(struct.pack('<cd', b'D', 4.3))) != ('D', 3.3)
def testV():
# test VI
vector = numpy.array((1,2,3), int)
assert packet.pack('V',vector) == struct.pack('<ccIiii', b'V', b'I', 3, 1, 2, 3)
(type, rvector) = packet.unpack_stream(
io.BytesIO(struct.pack('<ccIiii', b'V', b'I', 3, 1, 2, 3)))
assert type == 'V'
assert numpy.all(rvector == vector)
vector = numpy.array((1,-2,3), int)
assert packet.pack('V',vector) == struct.pack('<ccIiii', b'V', b'I', 3, 1, -2, 3)
(type, rvector) = packet.unpack_stream(
io.BytesIO(struct.pack('<ccIiii', b'V', b'I', 3, 1, -2, 3)))
assert type == 'V'
assert numpy.all(rvector == vector)
# test VF
vector = numpy.array((1.3,-2,3), numpy.float32)
assert packet.pack('V',vector) == struct.pack('<ccIfff', b'V', b'F', 3, 1.3, -2, 3)
(type, rvector) = packet.unpack_stream(
io.BytesIO(struct.pack('<ccIfff', b'V', b'F', 3, 1.3, -2, 3)))
assert type == 'V'
assert numpy.all(rvector == vector)
# test VD
vector = numpy.array((1.3,-2,3), float)
assert packet.pack('V',vector) == struct.pack('<ccIddd', b'V', b'D', 3, 1.3, -2, 3)
(type, rvector) = packet.unpack_stream(
io.BytesIO(struct.pack('<ccIddd', b'V', b'D', 3, 1.3, -2, 3)))
assert type == 'V'
assert numpy.all(rvector == vector)
def testM():
# test MI
vector = numpy.array(((1,2,3), (3,4,5)), int)
assert packet.pack('M',vector) == struct.pack('<cIccIiiiiii', b'M', 2, b'V', b'I', 6, 1, 2, 3, 3, 4, 5)
(type, rvector) = packet.unpack_stream(
io.BytesIO(struct.pack('<cIccIiiiiii', b'M', 2, b'V', b'I', 6, 1, 2, 3, 3, 4, 5)))
assert type == 'M'
assert numpy.all(rvector == vector)
vector = numpy.array(((1,-2,3), (3,4,-5)), int)
assert packet.pack('M',vector) == struct.pack('<cIccIiiiiii', b'M', 2, b'V', b'I', 6, 1, -2, 3, 3, 4, -5)
(type, rvector) = packet.unpack_stream(
io.BytesIO(struct.pack('<cIccIiiiiii', b'M', 2, b'V', b'I', 6, 1, -2, 3, 3, 4, -5)))
assert type == 'M'
assert numpy.all(rvector == vector)
# test MF
vector = numpy.array(((1.3,-2,3), (0,-1,2.5)), numpy.float32)
assert packet.pack('M',vector) == struct.pack('<cIccIffffff', b'M', 2, b'V', b'F', 6, 1.3, -2, 3, 0, -1, 2.5)
(type, rvector) = packet.unpack_stream(
io.BytesIO(struct.pack('<cIccIffffff', b'M', 2, b'V', b'F', 6, 1.3, -2, 3, 0, -1, 2.5)))
assert type == 'M'
assert numpy.all(rvector == vector)
# test MD
vector = numpy.array(((1.3,-2,3), (0,-1,2.5)), numpy.float)
assert packet.pack('M',vector) == struct.pack('<cIccIdddddd', b'M', 2, b'V', b'D', 6, 1.3, -2, 3, 0, -1, 2.5)
(type, rvector) = packet.unpack_stream(
io.BytesIO(struct.pack('<cIccIdddddd', b'M', 2, b'V', b'D', 6, 1.3, -2, 3, 0, -1, 2.5)))
assert type == 'M'
assert numpy.all(rvector == vector)
def testP():
vector = numpy.array(((1.3,-2,3), (0,-1,2.5)), numpy.float)
string = packet.pack('P', vector)
(type, rvector) = packet.unpack_stream(io.BytesIO(string))
assert type == 'P'
assert numpy.all(rvector == vector)
def testKR():
args = { 'a': 1, 'b': 2 }
string = packet.pack('K', args)
(type, rargs) = packet.unpack_stream(io.BytesIO(string))
assert type == 'K'
assert (args == rargs)
args = ('a', 1, 'b', 2)
string = packet.pack('R', args)
(type, rargs) = packet.unpack_stream(io.BytesIO(string))
assert type == 'R'
assert (args == rargs)
if __name__ == "__main__":
testA()
testC()
testS()
testIFD()
testV()
testM()
testP()
testKR()
|
mcdeoliveira/ctrl
|
test/test_packet.py
|
Python
|
apache-2.0
| 5,810
|
ALTER TABLE {$NAMESPACE}_differential.differential_inlinecomment
ADD KEY (revisionID, authorPHID);
|
apexstudios/phabricator
|
resources/sql/patches/025.commentopt.sql
|
SQL
|
apache-2.0
| 100
|
#include "parser_prod.sep.0.h"
/* method parser_prod#ASuperExpr#n_qualified= for (self: Object, nullable AQualified) */
void VIRTUAL_parser_prod__ASuperExpr__n_qualified_61d(val* self, val* p0) {
parser_prod__ASuperExpr__n_qualified_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ASuperExpr#n_kwsuper= for (self: ASuperExpr, TKwsuper) */
void parser_prod__ASuperExpr__n_kwsuper_61d(val* self, val* p0) {
val* var_node /* var node: TKwsuper */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ASuperExpr___n_kwsuper].val = var_node; /* _n_kwsuper on <self:ASuperExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwsuper>*/;
RET_LABEL:;
}
/* method parser_prod#ASuperExpr#n_kwsuper= for (self: Object, TKwsuper) */
void VIRTUAL_parser_prod__ASuperExpr__n_kwsuper_61d(val* self, val* p0) {
parser_prod__ASuperExpr__n_kwsuper_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ASuperExpr#n_args= for (self: ASuperExpr, AExprs) */
void parser_prod__ASuperExpr__n_args_61d(val* self, val* p0) {
val* var_node /* var node: AExprs */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ASuperExpr___n_args].val = var_node; /* _n_args on <self:ASuperExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExprs>*/;
RET_LABEL:;
}
/* method parser_prod#ASuperExpr#n_args= for (self: Object, AExprs) */
void VIRTUAL_parser_prod__ASuperExpr__n_args_61d(val* self, val* p0) {
parser_prod__ASuperExpr__n_args_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ASuperExpr#visit_all for (self: ASuperExpr, Visitor) */
void parser_prod__ASuperExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : nullable AQualified */;
val* var1 /* : null */;
short int var2 /* : Bool */;
val* var3 /* : nullable AQualified */;
val* var4 /* : TKwsuper */;
val* var5 /* : AExprs */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ASuperExpr___n_qualified].val; /* _n_qualified on <self:ASuperExpr> */
var1 = NULL;
if (var == NULL) {
var2 = 0; /* is null */
} else {
var2 = 1; /* arg is null and recv is not */
}
if (var2){
var3 = self->attrs[COLOR_parser_nodes__ASuperExpr___n_qualified].val; /* _n_qualified on <self:ASuperExpr> */
if (var3 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7773);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var3) /* enter_visit on <var_v:Visitor>*/;
} else {
}
var4 = self->attrs[COLOR_parser_nodes__ASuperExpr___n_kwsuper].val; /* _n_kwsuper on <self:ASuperExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwsuper");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7775);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
var5 = self->attrs[COLOR_parser_nodes__ASuperExpr___n_args].val; /* _n_args on <self:ASuperExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_args");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7776);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var5) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#ASuperExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ASuperExpr__visit_all(val* self, val* p0) {
parser_prod__ASuperExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AInitExpr#empty_init for (self: AInitExpr) */
void parser_prod__AInitExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AInitExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AInitExpr__empty_init(val* self) {
parser_prod__AInitExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AInitExpr#init_ainitexpr for (self: AInitExpr, nullable AExpr, nullable TKwinit, nullable AExprs) */
void parser_prod__AInitExpr__init_ainitexpr(val* self, val* p0, val* p1, val* p2) {
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_kwinit /* var n_kwinit: nullable TKwinit */;
val* var_n_args /* var n_args: nullable AExprs */;
var_n_expr = p0;
var_n_kwinit = p1;
var_n_args = p2;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AInitExpr__empty_init]))(self) /* empty_init on <self:AInitExpr>*/;
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7789);
exit(1);
}
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_n_expr; /* _n_expr on <self:AInitExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7790);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_kwinit == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7791);
exit(1);
}
self->attrs[COLOR_parser_nodes__AInitExpr___n_kwinit].val = var_n_kwinit; /* _n_kwinit on <self:AInitExpr> */
if (var_n_kwinit == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7792);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwinit->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwinit, self) /* parent= on <var_n_kwinit:nullable TKwinit>*/;
}
if (var_n_args == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7793);
exit(1);
}
self->attrs[COLOR_parser_nodes__AInitExpr___n_args].val = var_n_args; /* _n_args on <self:AInitExpr> */
if (var_n_args == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7794);
exit(1);
} else {
((void (*)(val*, val*))(var_n_args->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_args, self) /* parent= on <var_n_args:nullable AExprs>*/;
}
RET_LABEL:;
}
/* method parser_prod#AInitExpr#init_ainitexpr for (self: Object, nullable AExpr, nullable TKwinit, nullable AExprs) */
void VIRTUAL_parser_prod__AInitExpr__init_ainitexpr(val* self, val* p0, val* p1, val* p2) {
parser_prod__AInitExpr__init_ainitexpr(self, p0, p1, p2);
RET_LABEL:;
}
/* method parser_prod#AInitExpr#replace_child for (self: AInitExpr, ANode, nullable ANode) */
void parser_prod__AInitExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : AExpr */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : TKwinit */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : AExprs */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val; /* _n_expr on <self:AInitExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7799);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:AExpr>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7802);
exit(1);
}
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_new_child; /* _n_expr on <self:AInitExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7805);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__AInitExpr___n_kwinit].val; /* _n_kwinit on <self:AInitExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwinit");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7809);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:TKwinit>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwinit */
cltype10 = type_parser_nodes__TKwinit.color;
idtype11 = type_parser_nodes__TKwinit.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7812);
exit(1);
}
self->attrs[COLOR_parser_nodes__AInitExpr___n_kwinit].val = var_new_child; /* _n_kwinit on <self:AInitExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7815);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__AInitExpr___n_args].val; /* _n_args on <self:AInitExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_args");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7819);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:AExprs>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExprs */
cltype17 = type_parser_nodes__AExprs.color;
idtype18 = type_parser_nodes__AExprs.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7822);
exit(1);
}
self->attrs[COLOR_parser_nodes__AInitExpr___n_args].val = var_new_child; /* _n_args on <self:AInitExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7825);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AInitExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AInitExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AInitExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AInitExpr#n_expr= for (self: AInitExpr, AExpr) */
void parser_prod__AInitExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_node; /* _n_expr on <self:AInitExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#AInitExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__AInitExpr__n_expr_61d(val* self, val* p0) {
parser_prod__AInitExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AInitExpr#n_kwinit= for (self: AInitExpr, TKwinit) */
void parser_prod__AInitExpr__n_kwinit_61d(val* self, val* p0) {
val* var_node /* var node: TKwinit */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AInitExpr___n_kwinit].val = var_node; /* _n_kwinit on <self:AInitExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwinit>*/;
RET_LABEL:;
}
/* method parser_prod#AInitExpr#n_kwinit= for (self: Object, TKwinit) */
void VIRTUAL_parser_prod__AInitExpr__n_kwinit_61d(val* self, val* p0) {
parser_prod__AInitExpr__n_kwinit_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AInitExpr#n_args= for (self: AInitExpr, AExprs) */
void parser_prod__AInitExpr__n_args_61d(val* self, val* p0) {
val* var_node /* var node: AExprs */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AInitExpr___n_args].val = var_node; /* _n_args on <self:AInitExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExprs>*/;
RET_LABEL:;
}
/* method parser_prod#AInitExpr#n_args= for (self: Object, AExprs) */
void VIRTUAL_parser_prod__AInitExpr__n_args_61d(val* self, val* p0) {
parser_prod__AInitExpr__n_args_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AInitExpr#visit_all for (self: AInitExpr, Visitor) */
void parser_prod__AInitExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : AExpr */;
val* var1 /* : TKwinit */;
val* var2 /* : AExprs */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val; /* _n_expr on <self:AInitExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7850);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__AInitExpr___n_kwinit].val; /* _n_kwinit on <self:AInitExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwinit");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7851);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__AInitExpr___n_args].val; /* _n_args on <self:AInitExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_args");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7852);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AInitExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AInitExpr__visit_all(val* self, val* p0) {
parser_prod__AInitExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraExpr#empty_init for (self: ABraExpr) */
void parser_prod__ABraExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ABraExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ABraExpr__empty_init(val* self) {
parser_prod__ABraExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ABraExpr#init_abraexpr for (self: ABraExpr, nullable AExpr, nullable AExprs) */
void parser_prod__ABraExpr__init_abraexpr(val* self, val* p0, val* p1) {
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_args /* var n_args: nullable AExprs */;
var_n_expr = p0;
var_n_args = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ABraExpr__empty_init]))(self) /* empty_init on <self:ABraExpr>*/;
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7864);
exit(1);
}
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_n_expr; /* _n_expr on <self:ABraExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7865);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_args == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7866);
exit(1);
}
self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val = var_n_args; /* _n_args on <self:ABraExpr> */
if (var_n_args == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7867);
exit(1);
} else {
((void (*)(val*, val*))(var_n_args->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_args, self) /* parent= on <var_n_args:nullable AExprs>*/;
}
RET_LABEL:;
}
/* method parser_prod#ABraExpr#init_abraexpr for (self: Object, nullable AExpr, nullable AExprs) */
void VIRTUAL_parser_prod__ABraExpr__init_abraexpr(val* self, val* p0, val* p1) {
parser_prod__ABraExpr__init_abraexpr(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ABraExpr#replace_child for (self: ABraExpr, ANode, nullable ANode) */
void parser_prod__ABraExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : AExpr */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : AExprs */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val; /* _n_expr on <self:ABraExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7872);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:AExpr>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7875);
exit(1);
}
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_new_child; /* _n_expr on <self:ABraExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7878);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val; /* _n_args on <self:ABraExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_args");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7882);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:AExprs>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExprs */
cltype10 = type_parser_nodes__AExprs.color;
idtype11 = type_parser_nodes__AExprs.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7885);
exit(1);
}
self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val = var_new_child; /* _n_args on <self:ABraExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7888);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ABraExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ABraExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__ABraExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ABraExpr#n_expr= for (self: ABraExpr, AExpr) */
void parser_prod__ABraExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_node; /* _n_expr on <self:ABraExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#ABraExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__ABraExpr__n_expr_61d(val* self, val* p0) {
parser_prod__ABraExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraExpr#n_args= for (self: ABraExpr, AExprs) */
void parser_prod__ABraExpr__n_args_61d(val* self, val* p0) {
val* var_node /* var node: AExprs */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val = var_node; /* _n_args on <self:ABraExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExprs>*/;
RET_LABEL:;
}
/* method parser_prod#ABraExpr#n_args= for (self: Object, AExprs) */
void VIRTUAL_parser_prod__ABraExpr__n_args_61d(val* self, val* p0) {
parser_prod__ABraExpr__n_args_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraExpr#visit_all for (self: ABraExpr, Visitor) */
void parser_prod__ABraExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : AExpr */;
val* var1 /* : AExprs */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val; /* _n_expr on <self:ABraExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7908);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val; /* _n_args on <self:ABraExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_args");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7909);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#ABraExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ABraExpr__visit_all(val* self, val* p0) {
parser_prod__ABraExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#empty_init for (self: ABraAssignExpr) */
void parser_prod__ABraAssignExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ABraAssignExpr__empty_init(val* self) {
parser_prod__ABraAssignExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#init_abraassignexpr for (self: ABraAssignExpr, nullable AExpr, nullable AExprs, nullable TAssign, nullable AExpr) */
void parser_prod__ABraAssignExpr__init_abraassignexpr(val* self, val* p0, val* p1, val* p2, val* p3) {
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_args /* var n_args: nullable AExprs */;
val* var_n_assign /* var n_assign: nullable TAssign */;
val* var_n_value /* var n_value: nullable AExpr */;
var_n_expr = p0;
var_n_args = p1;
var_n_assign = p2;
var_n_value = p3;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ABraAssignExpr__empty_init]))(self) /* empty_init on <self:ABraAssignExpr>*/;
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7923);
exit(1);
}
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_n_expr; /* _n_expr on <self:ABraAssignExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7924);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_args == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7925);
exit(1);
}
self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val = var_n_args; /* _n_args on <self:ABraAssignExpr> */
if (var_n_args == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7926);
exit(1);
} else {
((void (*)(val*, val*))(var_n_args->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_args, self) /* parent= on <var_n_args:nullable AExprs>*/;
}
if (var_n_assign == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7927);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_assign].val = var_n_assign; /* _n_assign on <self:ABraAssignExpr> */
if (var_n_assign == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7928);
exit(1);
} else {
((void (*)(val*, val*))(var_n_assign->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_assign, self) /* parent= on <var_n_assign:nullable TAssign>*/;
}
if (var_n_value == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7929);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_value].val = var_n_value; /* _n_value on <self:ABraAssignExpr> */
if (var_n_value == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7930);
exit(1);
} else {
((void (*)(val*, val*))(var_n_value->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_value, self) /* parent= on <var_n_value:nullable AExpr>*/;
}
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#init_abraassignexpr for (self: Object, nullable AExpr, nullable AExprs, nullable TAssign, nullable AExpr) */
void VIRTUAL_parser_prod__ABraAssignExpr__init_abraassignexpr(val* self, val* p0, val* p1, val* p2, val* p3) {
parser_prod__ABraAssignExpr__init_abraassignexpr(self, p0, p1, p2, p3);
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#replace_child for (self: ABraAssignExpr, ANode, nullable ANode) */
void parser_prod__ABraAssignExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : AExpr */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : AExprs */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : TAssign */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
val* var19 /* : AExpr */;
short int var20 /* : Bool */;
val* var21 /* : null */;
short int var22 /* : Bool */;
short int var23 /* : Bool */;
int cltype24;
int idtype25;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val; /* _n_expr on <self:ABraAssignExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7935);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:AExpr>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7938);
exit(1);
}
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_new_child; /* _n_expr on <self:ABraAssignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7941);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val; /* _n_args on <self:ABraAssignExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_args");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7945);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:AExprs>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExprs */
cltype10 = type_parser_nodes__AExprs.color;
idtype11 = type_parser_nodes__AExprs.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7948);
exit(1);
}
self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val = var_new_child; /* _n_args on <self:ABraAssignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7951);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_assign].val; /* _n_assign on <self:ABraAssignExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_assign");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7955);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:TAssign>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TAssign */
cltype17 = type_parser_nodes__TAssign.color;
idtype18 = type_parser_nodes__TAssign.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7958);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_assign].val = var_new_child; /* _n_assign on <self:ABraAssignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7961);
exit(1);
}
goto RET_LABEL;
} else {
}
var19 = self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_value].val; /* _n_value on <self:ABraAssignExpr> */
if (var19 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_value");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7965);
exit(1);
}
var20 = ((short int (*)(val*, val*))(var19->class->vft[COLOR_kernel__Object___61d_61d]))(var19, var_old_child) /* == on <var19:AExpr>*/;
if (var20){
var21 = NULL;
if (var_new_child == NULL) {
var22 = 0; /* is null */
} else {
var22 = 1; /* arg is null and recv is not */
}
if (var22){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype24 = type_parser_nodes__AExpr.color;
idtype25 = type_parser_nodes__AExpr.id;
if(cltype24 >= var_new_child->type->table_size) {
var23 = 0;
} else {
var23 = var_new_child->type->type_table[cltype24] == idtype25;
}
if (!var23) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7968);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_value].val = var_new_child; /* _n_value on <self:ABraAssignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 7971);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ABraAssignExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__ABraAssignExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#n_expr= for (self: ABraAssignExpr, AExpr) */
void parser_prod__ABraAssignExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_node; /* _n_expr on <self:ABraAssignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__ABraAssignExpr__n_expr_61d(val* self, val* p0) {
parser_prod__ABraAssignExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#n_args= for (self: ABraAssignExpr, AExprs) */
void parser_prod__ABraAssignExpr__n_args_61d(val* self, val* p0) {
val* var_node /* var node: AExprs */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val = var_node; /* _n_args on <self:ABraAssignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExprs>*/;
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#n_args= for (self: Object, AExprs) */
void VIRTUAL_parser_prod__ABraAssignExpr__n_args_61d(val* self, val* p0) {
parser_prod__ABraAssignExpr__n_args_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#n_assign= for (self: ABraAssignExpr, TAssign) */
void parser_prod__ABraAssignExpr__n_assign_61d(val* self, val* p0) {
val* var_node /* var node: TAssign */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_assign].val = var_node; /* _n_assign on <self:ABraAssignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TAssign>*/;
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#n_assign= for (self: Object, TAssign) */
void VIRTUAL_parser_prod__ABraAssignExpr__n_assign_61d(val* self, val* p0) {
parser_prod__ABraAssignExpr__n_assign_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#n_value= for (self: ABraAssignExpr, AExpr) */
void parser_prod__ABraAssignExpr__n_value_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_value].val = var_node; /* _n_value on <self:ABraAssignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#n_value= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__ABraAssignExpr__n_value_61d(val* self, val* p0) {
parser_prod__ABraAssignExpr__n_value_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#visit_all for (self: ABraAssignExpr, Visitor) */
void parser_prod__ABraAssignExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : AExpr */;
val* var1 /* : AExprs */;
val* var2 /* : TAssign */;
val* var3 /* : AExpr */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val; /* _n_expr on <self:ABraAssignExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8001);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val; /* _n_args on <self:ABraAssignExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_args");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8002);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_assign].val; /* _n_assign on <self:ABraAssignExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_assign");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8003);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
var3 = self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_value].val; /* _n_value on <self:ABraAssignExpr> */
if (var3 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_value");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8004);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var3) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#ABraAssignExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ABraAssignExpr__visit_all(val* self, val* p0) {
parser_prod__ABraAssignExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#empty_init for (self: ABraReassignExpr) */
void parser_prod__ABraReassignExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ABraReassignExpr__empty_init(val* self) {
parser_prod__ABraReassignExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#init_abrareassignexpr for (self: ABraReassignExpr, nullable AExpr, nullable AExprs, nullable AAssignOp, nullable AExpr) */
void parser_prod__ABraReassignExpr__init_abrareassignexpr(val* self, val* p0, val* p1, val* p2, val* p3) {
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_args /* var n_args: nullable AExprs */;
val* var_n_assign_op /* var n_assign_op: nullable AAssignOp */;
val* var_n_value /* var n_value: nullable AExpr */;
var_n_expr = p0;
var_n_args = p1;
var_n_assign_op = p2;
var_n_value = p3;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ABraReassignExpr__empty_init]))(self) /* empty_init on <self:ABraReassignExpr>*/;
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8018);
exit(1);
}
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_n_expr; /* _n_expr on <self:ABraReassignExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8019);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_args == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8020);
exit(1);
}
self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val = var_n_args; /* _n_args on <self:ABraReassignExpr> */
if (var_n_args == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8021);
exit(1);
} else {
((void (*)(val*, val*))(var_n_args->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_args, self) /* parent= on <var_n_args:nullable AExprs>*/;
}
if (var_n_assign_op == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8022);
exit(1);
}
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_assign_op].val = var_n_assign_op; /* _n_assign_op on <self:ABraReassignExpr> */
if (var_n_assign_op == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8023);
exit(1);
} else {
((void (*)(val*, val*))(var_n_assign_op->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_assign_op, self) /* parent= on <var_n_assign_op:nullable AAssignOp>*/;
}
if (var_n_value == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8024);
exit(1);
}
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_value].val = var_n_value; /* _n_value on <self:ABraReassignExpr> */
if (var_n_value == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8025);
exit(1);
} else {
((void (*)(val*, val*))(var_n_value->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_value, self) /* parent= on <var_n_value:nullable AExpr>*/;
}
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#init_abrareassignexpr for (self: Object, nullable AExpr, nullable AExprs, nullable AAssignOp, nullable AExpr) */
void VIRTUAL_parser_prod__ABraReassignExpr__init_abrareassignexpr(val* self, val* p0, val* p1, val* p2, val* p3) {
parser_prod__ABraReassignExpr__init_abrareassignexpr(self, p0, p1, p2, p3);
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#replace_child for (self: ABraReassignExpr, ANode, nullable ANode) */
void parser_prod__ABraReassignExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : AExpr */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : AExprs */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : AAssignOp */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
val* var19 /* : AExpr */;
short int var20 /* : Bool */;
val* var21 /* : null */;
short int var22 /* : Bool */;
short int var23 /* : Bool */;
int cltype24;
int idtype25;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val; /* _n_expr on <self:ABraReassignExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8030);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:AExpr>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8033);
exit(1);
}
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_new_child; /* _n_expr on <self:ABraReassignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8036);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val; /* _n_args on <self:ABraReassignExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_args");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8040);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:AExprs>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExprs */
cltype10 = type_parser_nodes__AExprs.color;
idtype11 = type_parser_nodes__AExprs.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8043);
exit(1);
}
self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val = var_new_child; /* _n_args on <self:ABraReassignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8046);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_assign_op].val; /* _n_assign_op on <self:ABraReassignExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_assign_op");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8050);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:AAssignOp>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAssignOp */
cltype17 = type_parser_nodes__AAssignOp.color;
idtype18 = type_parser_nodes__AAssignOp.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8053);
exit(1);
}
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_assign_op].val = var_new_child; /* _n_assign_op on <self:ABraReassignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8056);
exit(1);
}
goto RET_LABEL;
} else {
}
var19 = self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_value].val; /* _n_value on <self:ABraReassignExpr> */
if (var19 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_value");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8060);
exit(1);
}
var20 = ((short int (*)(val*, val*))(var19->class->vft[COLOR_kernel__Object___61d_61d]))(var19, var_old_child) /* == on <var19:AExpr>*/;
if (var20){
var21 = NULL;
if (var_new_child == NULL) {
var22 = 0; /* is null */
} else {
var22 = 1; /* arg is null and recv is not */
}
if (var22){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype24 = type_parser_nodes__AExpr.color;
idtype25 = type_parser_nodes__AExpr.id;
if(cltype24 >= var_new_child->type->table_size) {
var23 = 0;
} else {
var23 = var_new_child->type->type_table[cltype24] == idtype25;
}
if (!var23) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8063);
exit(1);
}
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_value].val = var_new_child; /* _n_value on <self:ABraReassignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8066);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ABraReassignExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__ABraReassignExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#n_expr= for (self: ABraReassignExpr, AExpr) */
void parser_prod__ABraReassignExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val = var_node; /* _n_expr on <self:ABraReassignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__ABraReassignExpr__n_expr_61d(val* self, val* p0) {
parser_prod__ABraReassignExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#n_args= for (self: ABraReassignExpr, AExprs) */
void parser_prod__ABraReassignExpr__n_args_61d(val* self, val* p0) {
val* var_node /* var node: AExprs */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val = var_node; /* _n_args on <self:ABraReassignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExprs>*/;
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#n_args= for (self: Object, AExprs) */
void VIRTUAL_parser_prod__ABraReassignExpr__n_args_61d(val* self, val* p0) {
parser_prod__ABraReassignExpr__n_args_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#n_assign_op= for (self: ABraReassignExpr, AAssignOp) */
void parser_prod__ABraReassignExpr__n_assign_op_61d(val* self, val* p0) {
val* var_node /* var node: AAssignOp */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_assign_op].val = var_node; /* _n_assign_op on <self:ABraReassignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AAssignOp>*/;
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#n_assign_op= for (self: Object, AAssignOp) */
void VIRTUAL_parser_prod__ABraReassignExpr__n_assign_op_61d(val* self, val* p0) {
parser_prod__ABraReassignExpr__n_assign_op_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#n_value= for (self: ABraReassignExpr, AExpr) */
void parser_prod__ABraReassignExpr__n_value_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_value].val = var_node; /* _n_value on <self:ABraReassignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#n_value= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__ABraReassignExpr__n_value_61d(val* self, val* p0) {
parser_prod__ABraReassignExpr__n_value_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#visit_all for (self: ABraReassignExpr, Visitor) */
void parser_prod__ABraReassignExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : AExpr */;
val* var1 /* : AExprs */;
val* var2 /* : AAssignOp */;
val* var3 /* : AExpr */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ASendExpr___n_expr].val; /* _n_expr on <self:ABraReassignExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8096);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__ABraFormExpr___n_args].val; /* _n_args on <self:ABraReassignExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_args");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8097);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_assign_op].val; /* _n_assign_op on <self:ABraReassignExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_assign_op");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8098);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
var3 = self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_value].val; /* _n_value on <self:ABraReassignExpr> */
if (var3 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_value");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8099);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var3) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#ABraReassignExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ABraReassignExpr__visit_all(val* self, val* p0) {
parser_prod__ABraReassignExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AVarExpr#empty_init for (self: AVarExpr) */
void parser_prod__AVarExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AVarExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AVarExpr__empty_init(val* self) {
parser_prod__AVarExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AVarExpr#init_avarexpr for (self: AVarExpr, nullable TId) */
void parser_prod__AVarExpr__init_avarexpr(val* self, val* p0) {
val* var_n_id /* var n_id: nullable TId */;
var_n_id = p0;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AVarExpr__empty_init]))(self) /* empty_init on <self:AVarExpr>*/;
if (var_n_id == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8110);
exit(1);
}
self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val = var_n_id; /* _n_id on <self:AVarExpr> */
if (var_n_id == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8111);
exit(1);
} else {
((void (*)(val*, val*))(var_n_id->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_id, self) /* parent= on <var_n_id:nullable TId>*/;
}
RET_LABEL:;
}
/* method parser_prod#AVarExpr#init_avarexpr for (self: Object, nullable TId) */
void VIRTUAL_parser_prod__AVarExpr__init_avarexpr(val* self, val* p0) {
parser_prod__AVarExpr__init_avarexpr(self, p0);
RET_LABEL:;
}
/* method parser_prod#AVarExpr#replace_child for (self: AVarExpr, ANode, nullable ANode) */
void parser_prod__AVarExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TId */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val; /* _n_id on <self:AVarExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_id");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8116);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TId>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TId */
cltype = type_parser_nodes__TId.color;
idtype = type_parser_nodes__TId.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8119);
exit(1);
}
self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val = var_new_child; /* _n_id on <self:AVarExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8122);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AVarExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AVarExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AVarExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AVarExpr#n_id= for (self: AVarExpr, TId) */
void parser_prod__AVarExpr__n_id_61d(val* self, val* p0) {
val* var_node /* var node: TId */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val = var_node; /* _n_id on <self:AVarExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TId>*/;
RET_LABEL:;
}
/* method parser_prod#AVarExpr#n_id= for (self: Object, TId) */
void VIRTUAL_parser_prod__AVarExpr__n_id_61d(val* self, val* p0) {
parser_prod__AVarExpr__n_id_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AVarExpr#visit_all for (self: AVarExpr, Visitor) */
void parser_prod__AVarExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TId */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val; /* _n_id on <self:AVarExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_id");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8137);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AVarExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AVarExpr__visit_all(val* self, val* p0) {
parser_prod__AVarExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#empty_init for (self: AVarAssignExpr) */
void parser_prod__AVarAssignExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AVarAssignExpr__empty_init(val* self) {
parser_prod__AVarAssignExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#init_avarassignexpr for (self: AVarAssignExpr, nullable TId, nullable TAssign, nullable AExpr) */
void parser_prod__AVarAssignExpr__init_avarassignexpr(val* self, val* p0, val* p1, val* p2) {
val* var_n_id /* var n_id: nullable TId */;
val* var_n_assign /* var n_assign: nullable TAssign */;
val* var_n_value /* var n_value: nullable AExpr */;
var_n_id = p0;
var_n_assign = p1;
var_n_value = p2;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AVarAssignExpr__empty_init]))(self) /* empty_init on <self:AVarAssignExpr>*/;
if (var_n_id == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8150);
exit(1);
}
self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val = var_n_id; /* _n_id on <self:AVarAssignExpr> */
if (var_n_id == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8151);
exit(1);
} else {
((void (*)(val*, val*))(var_n_id->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_id, self) /* parent= on <var_n_id:nullable TId>*/;
}
if (var_n_assign == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8152);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_assign].val = var_n_assign; /* _n_assign on <self:AVarAssignExpr> */
if (var_n_assign == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8153);
exit(1);
} else {
((void (*)(val*, val*))(var_n_assign->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_assign, self) /* parent= on <var_n_assign:nullable TAssign>*/;
}
if (var_n_value == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8154);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_value].val = var_n_value; /* _n_value on <self:AVarAssignExpr> */
if (var_n_value == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8155);
exit(1);
} else {
((void (*)(val*, val*))(var_n_value->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_value, self) /* parent= on <var_n_value:nullable AExpr>*/;
}
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#init_avarassignexpr for (self: Object, nullable TId, nullable TAssign, nullable AExpr) */
void VIRTUAL_parser_prod__AVarAssignExpr__init_avarassignexpr(val* self, val* p0, val* p1, val* p2) {
parser_prod__AVarAssignExpr__init_avarassignexpr(self, p0, p1, p2);
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#replace_child for (self: AVarAssignExpr, ANode, nullable ANode) */
void parser_prod__AVarAssignExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TId */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : TAssign */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : AExpr */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val; /* _n_id on <self:AVarAssignExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_id");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8160);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TId>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TId */
cltype = type_parser_nodes__TId.color;
idtype = type_parser_nodes__TId.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8163);
exit(1);
}
self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val = var_new_child; /* _n_id on <self:AVarAssignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8166);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_assign].val; /* _n_assign on <self:AVarAssignExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_assign");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8170);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:TAssign>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TAssign */
cltype10 = type_parser_nodes__TAssign.color;
idtype11 = type_parser_nodes__TAssign.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8173);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_assign].val = var_new_child; /* _n_assign on <self:AVarAssignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8176);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_value].val; /* _n_value on <self:AVarAssignExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_value");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8180);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:AExpr>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype17 = type_parser_nodes__AExpr.color;
idtype18 = type_parser_nodes__AExpr.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8183);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_value].val = var_new_child; /* _n_value on <self:AVarAssignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8186);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AVarAssignExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AVarAssignExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#n_id= for (self: AVarAssignExpr, TId) */
void parser_prod__AVarAssignExpr__n_id_61d(val* self, val* p0) {
val* var_node /* var node: TId */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val = var_node; /* _n_id on <self:AVarAssignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TId>*/;
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#n_id= for (self: Object, TId) */
void VIRTUAL_parser_prod__AVarAssignExpr__n_id_61d(val* self, val* p0) {
parser_prod__AVarAssignExpr__n_id_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#n_assign= for (self: AVarAssignExpr, TAssign) */
void parser_prod__AVarAssignExpr__n_assign_61d(val* self, val* p0) {
val* var_node /* var node: TAssign */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_assign].val = var_node; /* _n_assign on <self:AVarAssignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TAssign>*/;
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#n_assign= for (self: Object, TAssign) */
void VIRTUAL_parser_prod__AVarAssignExpr__n_assign_61d(val* self, val* p0) {
parser_prod__AVarAssignExpr__n_assign_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#n_value= for (self: AVarAssignExpr, AExpr) */
void parser_prod__AVarAssignExpr__n_value_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_value].val = var_node; /* _n_value on <self:AVarAssignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#n_value= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__AVarAssignExpr__n_value_61d(val* self, val* p0) {
parser_prod__AVarAssignExpr__n_value_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#visit_all for (self: AVarAssignExpr, Visitor) */
void parser_prod__AVarAssignExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TId */;
val* var1 /* : TAssign */;
val* var2 /* : AExpr */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val; /* _n_id on <self:AVarAssignExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_id");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8211);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_assign].val; /* _n_assign on <self:AVarAssignExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_assign");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8212);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__AAssignFormExpr___n_value].val; /* _n_value on <self:AVarAssignExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_value");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8213);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AVarAssignExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AVarAssignExpr__visit_all(val* self, val* p0) {
parser_prod__AVarAssignExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#empty_init for (self: AVarReassignExpr) */
void parser_prod__AVarReassignExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AVarReassignExpr__empty_init(val* self) {
parser_prod__AVarReassignExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#init_avarreassignexpr for (self: AVarReassignExpr, nullable TId, nullable AAssignOp, nullable AExpr) */
void parser_prod__AVarReassignExpr__init_avarreassignexpr(val* self, val* p0, val* p1, val* p2) {
val* var_n_id /* var n_id: nullable TId */;
val* var_n_assign_op /* var n_assign_op: nullable AAssignOp */;
val* var_n_value /* var n_value: nullable AExpr */;
var_n_id = p0;
var_n_assign_op = p1;
var_n_value = p2;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AVarReassignExpr__empty_init]))(self) /* empty_init on <self:AVarReassignExpr>*/;
if (var_n_id == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8226);
exit(1);
}
self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val = var_n_id; /* _n_id on <self:AVarReassignExpr> */
if (var_n_id == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8227);
exit(1);
} else {
((void (*)(val*, val*))(var_n_id->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_id, self) /* parent= on <var_n_id:nullable TId>*/;
}
if (var_n_assign_op == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8228);
exit(1);
}
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_assign_op].val = var_n_assign_op; /* _n_assign_op on <self:AVarReassignExpr> */
if (var_n_assign_op == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8229);
exit(1);
} else {
((void (*)(val*, val*))(var_n_assign_op->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_assign_op, self) /* parent= on <var_n_assign_op:nullable AAssignOp>*/;
}
if (var_n_value == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8230);
exit(1);
}
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_value].val = var_n_value; /* _n_value on <self:AVarReassignExpr> */
if (var_n_value == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8231);
exit(1);
} else {
((void (*)(val*, val*))(var_n_value->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_value, self) /* parent= on <var_n_value:nullable AExpr>*/;
}
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#init_avarreassignexpr for (self: Object, nullable TId, nullable AAssignOp, nullable AExpr) */
void VIRTUAL_parser_prod__AVarReassignExpr__init_avarreassignexpr(val* self, val* p0, val* p1, val* p2) {
parser_prod__AVarReassignExpr__init_avarreassignexpr(self, p0, p1, p2);
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#replace_child for (self: AVarReassignExpr, ANode, nullable ANode) */
void parser_prod__AVarReassignExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TId */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : AAssignOp */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : AExpr */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val; /* _n_id on <self:AVarReassignExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_id");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8236);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TId>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TId */
cltype = type_parser_nodes__TId.color;
idtype = type_parser_nodes__TId.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8239);
exit(1);
}
self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val = var_new_child; /* _n_id on <self:AVarReassignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8242);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_assign_op].val; /* _n_assign_op on <self:AVarReassignExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_assign_op");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8246);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:AAssignOp>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAssignOp */
cltype10 = type_parser_nodes__AAssignOp.color;
idtype11 = type_parser_nodes__AAssignOp.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8249);
exit(1);
}
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_assign_op].val = var_new_child; /* _n_assign_op on <self:AVarReassignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8252);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_value].val; /* _n_value on <self:AVarReassignExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_value");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8256);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:AExpr>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype17 = type_parser_nodes__AExpr.color;
idtype18 = type_parser_nodes__AExpr.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8259);
exit(1);
}
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_value].val = var_new_child; /* _n_value on <self:AVarReassignExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8262);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AVarReassignExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AVarReassignExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#n_id= for (self: AVarReassignExpr, TId) */
void parser_prod__AVarReassignExpr__n_id_61d(val* self, val* p0) {
val* var_node /* var node: TId */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val = var_node; /* _n_id on <self:AVarReassignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TId>*/;
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#n_id= for (self: Object, TId) */
void VIRTUAL_parser_prod__AVarReassignExpr__n_id_61d(val* self, val* p0) {
parser_prod__AVarReassignExpr__n_id_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#n_assign_op= for (self: AVarReassignExpr, AAssignOp) */
void parser_prod__AVarReassignExpr__n_assign_op_61d(val* self, val* p0) {
val* var_node /* var node: AAssignOp */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_assign_op].val = var_node; /* _n_assign_op on <self:AVarReassignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AAssignOp>*/;
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#n_assign_op= for (self: Object, AAssignOp) */
void VIRTUAL_parser_prod__AVarReassignExpr__n_assign_op_61d(val* self, val* p0) {
parser_prod__AVarReassignExpr__n_assign_op_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#n_value= for (self: AVarReassignExpr, AExpr) */
void parser_prod__AVarReassignExpr__n_value_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_value].val = var_node; /* _n_value on <self:AVarReassignExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#n_value= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__AVarReassignExpr__n_value_61d(val* self, val* p0) {
parser_prod__AVarReassignExpr__n_value_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#visit_all for (self: AVarReassignExpr, Visitor) */
void parser_prod__AVarReassignExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TId */;
val* var1 /* : AAssignOp */;
val* var2 /* : AExpr */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AVarFormExpr___n_id].val; /* _n_id on <self:AVarReassignExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_id");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8287);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_assign_op].val; /* _n_assign_op on <self:AVarReassignExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_assign_op");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8288);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__AReassignFormExpr___n_value].val; /* _n_value on <self:AVarReassignExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_value");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8289);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AVarReassignExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AVarReassignExpr__visit_all(val* self, val* p0) {
parser_prod__AVarReassignExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#empty_init for (self: ARangeExpr) */
void parser_prod__ARangeExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ARangeExpr__empty_init(val* self) {
parser_prod__ARangeExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#init_arangeexpr for (self: ARangeExpr, nullable AExpr, nullable AExpr, nullable AAnnotations) */
void parser_prod__ARangeExpr__init_arangeexpr(val* self, val* p0, val* p1, val* p2) {
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_expr2 /* var n_expr2: nullable AExpr */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_expr = p0;
var_n_expr2 = p1;
var_n_annotations = p2;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ARangeExpr__empty_init]))(self) /* empty_init on <self:ARangeExpr>*/;
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8302);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val = var_n_expr; /* _n_expr on <self:ARangeExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8303);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_expr2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8304);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val = var_n_expr2; /* _n_expr2 on <self:ARangeExpr> */
if (var_n_expr2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8305);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr2->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr2, self) /* parent= on <var_n_expr2:nullable AExpr>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:ARangeExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#init_arangeexpr for (self: Object, nullable AExpr, nullable AExpr, nullable AAnnotations) */
void VIRTUAL_parser_prod__ARangeExpr__init_arangeexpr(val* self, val* p0, val* p1, val* p2) {
parser_prod__ARangeExpr__init_arangeexpr(self, p0, p1, p2);
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#replace_child for (self: ARangeExpr, ANode, nullable ANode) */
void parser_prod__ARangeExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : AExpr */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : AExpr */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : nullable AAnnotations */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
val* var19 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val; /* _n_expr on <self:ARangeExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8314);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:AExpr>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8317);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val = var_new_child; /* _n_expr on <self:ARangeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8320);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val; /* _n_expr2 on <self:ARangeExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr2");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8324);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:AExpr>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype10 = type_parser_nodes__AExpr.color;
idtype11 = type_parser_nodes__AExpr.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8327);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val = var_new_child; /* _n_expr2 on <self:ARangeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8330);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ARangeExpr> */
if (var12 == NULL) {
var13 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:nullable AAnnotations>*/;
}
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype17 = type_parser_nodes__AAnnotations.color;
idtype18 = type_parser_nodes__AAnnotations.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8337);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:ARangeExpr> */
} else {
var19 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var19; /* _n_annotations on <self:ARangeExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ARangeExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__ARangeExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#n_expr= for (self: ARangeExpr, AExpr) */
void parser_prod__ARangeExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val = var_node; /* _n_expr on <self:ARangeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__ARangeExpr__n_expr_61d(val* self, val* p0) {
parser_prod__ARangeExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#n_expr2= for (self: ARangeExpr, AExpr) */
void parser_prod__ARangeExpr__n_expr2_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val = var_node; /* _n_expr2 on <self:ARangeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#n_expr2= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__ARangeExpr__n_expr2_61d(val* self, val* p0) {
parser_prod__ARangeExpr__n_expr2_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#n_annotations= for (self: ARangeExpr, nullable AAnnotations) */
void parser_prod__ARangeExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:ARangeExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__ARangeExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__ARangeExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#visit_all for (self: ARangeExpr, Visitor) */
void parser_prod__ARangeExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : AExpr */;
val* var1 /* : AExpr */;
val* var2 /* : nullable AAnnotations */;
val* var3 /* : null */;
short int var4 /* : Bool */;
val* var5 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val; /* _n_expr on <self:ARangeExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8367);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val; /* _n_expr2 on <self:ARangeExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr2");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8368);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ARangeExpr> */
var3 = NULL;
if (var2 == NULL) {
var4 = 0; /* is null */
} else {
var4 = 1; /* arg is null and recv is not */
}
if (var4){
var5 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ARangeExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8370);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var5) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ARangeExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ARangeExpr__visit_all(val* self, val* p0) {
parser_prod__ARangeExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#empty_init for (self: ACrangeExpr) */
void parser_prod__ACrangeExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ACrangeExpr__empty_init(val* self) {
parser_prod__ACrangeExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#init_acrangeexpr for (self: ACrangeExpr, nullable TObra, nullable AExpr, nullable AExpr, nullable TCbra, nullable AAnnotations) */
void parser_prod__ACrangeExpr__init_acrangeexpr(val* self, val* p0, val* p1, val* p2, val* p3, val* p4) {
val* var_n_obra /* var n_obra: nullable TObra */;
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_expr2 /* var n_expr2: nullable AExpr */;
val* var_n_cbra /* var n_cbra: nullable TCbra */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_obra = p0;
var_n_expr = p1;
var_n_expr2 = p2;
var_n_cbra = p3;
var_n_annotations = p4;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ACrangeExpr__empty_init]))(self) /* empty_init on <self:ACrangeExpr>*/;
if (var_n_obra == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8386);
exit(1);
}
self->attrs[COLOR_parser_nodes__ACrangeExpr___n_obra].val = var_n_obra; /* _n_obra on <self:ACrangeExpr> */
if (var_n_obra == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8387);
exit(1);
} else {
((void (*)(val*, val*))(var_n_obra->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_obra, self) /* parent= on <var_n_obra:nullable TObra>*/;
}
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8388);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val = var_n_expr; /* _n_expr on <self:ACrangeExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8389);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_expr2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8390);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val = var_n_expr2; /* _n_expr2 on <self:ACrangeExpr> */
if (var_n_expr2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8391);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr2->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr2, self) /* parent= on <var_n_expr2:nullable AExpr>*/;
}
if (var_n_cbra == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8392);
exit(1);
}
self->attrs[COLOR_parser_nodes__ACrangeExpr___n_cbra].val = var_n_cbra; /* _n_cbra on <self:ACrangeExpr> */
if (var_n_cbra == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8393);
exit(1);
} else {
((void (*)(val*, val*))(var_n_cbra->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_cbra, self) /* parent= on <var_n_cbra:nullable TCbra>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:ACrangeExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#init_acrangeexpr for (self: Object, nullable TObra, nullable AExpr, nullable AExpr, nullable TCbra, nullable AAnnotations) */
void VIRTUAL_parser_prod__ACrangeExpr__init_acrangeexpr(val* self, val* p0, val* p1, val* p2, val* p3, val* p4) {
parser_prod__ACrangeExpr__init_acrangeexpr(self, p0, p1, p2, p3, p4);
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#replace_child for (self: ACrangeExpr, ANode, nullable ANode) */
void parser_prod__ACrangeExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TObra */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : AExpr */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : AExpr */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
val* var19 /* : TCbra */;
short int var20 /* : Bool */;
val* var21 /* : null */;
short int var22 /* : Bool */;
short int var23 /* : Bool */;
int cltype24;
int idtype25;
val* var26 /* : nullable AAnnotations */;
short int var27 /* : Bool */;
val* var28 /* : null */;
short int var29 /* : Bool */;
short int var30 /* : Bool */;
int cltype31;
int idtype32;
val* var33 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ACrangeExpr___n_obra].val; /* _n_obra on <self:ACrangeExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_obra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8402);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TObra>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TObra */
cltype = type_parser_nodes__TObra.color;
idtype = type_parser_nodes__TObra.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8405);
exit(1);
}
self->attrs[COLOR_parser_nodes__ACrangeExpr___n_obra].val = var_new_child; /* _n_obra on <self:ACrangeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8408);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val; /* _n_expr on <self:ACrangeExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8412);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:AExpr>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype10 = type_parser_nodes__AExpr.color;
idtype11 = type_parser_nodes__AExpr.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8415);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val = var_new_child; /* _n_expr on <self:ACrangeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8418);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val; /* _n_expr2 on <self:ACrangeExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr2");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8422);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:AExpr>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype17 = type_parser_nodes__AExpr.color;
idtype18 = type_parser_nodes__AExpr.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8425);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val = var_new_child; /* _n_expr2 on <self:ACrangeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8428);
exit(1);
}
goto RET_LABEL;
} else {
}
var19 = self->attrs[COLOR_parser_nodes__ACrangeExpr___n_cbra].val; /* _n_cbra on <self:ACrangeExpr> */
if (var19 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cbra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8432);
exit(1);
}
var20 = ((short int (*)(val*, val*))(var19->class->vft[COLOR_kernel__Object___61d_61d]))(var19, var_old_child) /* == on <var19:TCbra>*/;
if (var20){
var21 = NULL;
if (var_new_child == NULL) {
var22 = 0; /* is null */
} else {
var22 = 1; /* arg is null and recv is not */
}
if (var22){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TCbra */
cltype24 = type_parser_nodes__TCbra.color;
idtype25 = type_parser_nodes__TCbra.id;
if(cltype24 >= var_new_child->type->table_size) {
var23 = 0;
} else {
var23 = var_new_child->type->type_table[cltype24] == idtype25;
}
if (!var23) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8435);
exit(1);
}
self->attrs[COLOR_parser_nodes__ACrangeExpr___n_cbra].val = var_new_child; /* _n_cbra on <self:ACrangeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8438);
exit(1);
}
goto RET_LABEL;
} else {
}
var26 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ACrangeExpr> */
if (var26 == NULL) {
var27 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var27 = ((short int (*)(val*, val*))(var26->class->vft[COLOR_kernel__Object___61d_61d]))(var26, var_old_child) /* == on <var26:nullable AAnnotations>*/;
}
if (var27){
var28 = NULL;
if (var_new_child == NULL) {
var29 = 0; /* is null */
} else {
var29 = 1; /* arg is null and recv is not */
}
if (var29){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype31 = type_parser_nodes__AAnnotations.color;
idtype32 = type_parser_nodes__AAnnotations.id;
if(cltype31 >= var_new_child->type->table_size) {
var30 = 0;
} else {
var30 = var_new_child->type->type_table[cltype31] == idtype32;
}
if (!var30) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8445);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:ACrangeExpr> */
} else {
var33 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var33; /* _n_annotations on <self:ACrangeExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ACrangeExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__ACrangeExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#n_obra= for (self: ACrangeExpr, TObra) */
void parser_prod__ACrangeExpr__n_obra_61d(val* self, val* p0) {
val* var_node /* var node: TObra */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ACrangeExpr___n_obra].val = var_node; /* _n_obra on <self:ACrangeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TObra>*/;
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#n_obra= for (self: Object, TObra) */
void VIRTUAL_parser_prod__ACrangeExpr__n_obra_61d(val* self, val* p0) {
parser_prod__ACrangeExpr__n_obra_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#n_expr= for (self: ACrangeExpr, AExpr) */
void parser_prod__ACrangeExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val = var_node; /* _n_expr on <self:ACrangeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__ACrangeExpr__n_expr_61d(val* self, val* p0) {
parser_prod__ACrangeExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#n_expr2= for (self: ACrangeExpr, AExpr) */
void parser_prod__ACrangeExpr__n_expr2_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val = var_node; /* _n_expr2 on <self:ACrangeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#n_expr2= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__ACrangeExpr__n_expr2_61d(val* self, val* p0) {
parser_prod__ACrangeExpr__n_expr2_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#n_cbra= for (self: ACrangeExpr, TCbra) */
void parser_prod__ACrangeExpr__n_cbra_61d(val* self, val* p0) {
val* var_node /* var node: TCbra */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ACrangeExpr___n_cbra].val = var_node; /* _n_cbra on <self:ACrangeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TCbra>*/;
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#n_cbra= for (self: Object, TCbra) */
void VIRTUAL_parser_prod__ACrangeExpr__n_cbra_61d(val* self, val* p0) {
parser_prod__ACrangeExpr__n_cbra_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#n_annotations= for (self: ACrangeExpr, nullable AAnnotations) */
void parser_prod__ACrangeExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:ACrangeExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__ACrangeExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__ACrangeExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#visit_all for (self: ACrangeExpr, Visitor) */
void parser_prod__ACrangeExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TObra */;
val* var1 /* : AExpr */;
val* var2 /* : AExpr */;
val* var3 /* : TCbra */;
val* var4 /* : nullable AAnnotations */;
val* var5 /* : null */;
short int var6 /* : Bool */;
val* var7 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ACrangeExpr___n_obra].val; /* _n_obra on <self:ACrangeExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_obra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8485);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val; /* _n_expr on <self:ACrangeExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8486);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val; /* _n_expr2 on <self:ACrangeExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr2");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8487);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
var3 = self->attrs[COLOR_parser_nodes__ACrangeExpr___n_cbra].val; /* _n_cbra on <self:ACrangeExpr> */
if (var3 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cbra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8488);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var3) /* enter_visit on <var_v:Visitor>*/;
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ACrangeExpr> */
var5 = NULL;
if (var4 == NULL) {
var6 = 0; /* is null */
} else {
var6 = 1; /* arg is null and recv is not */
}
if (var6){
var7 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ACrangeExpr> */
if (var7 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8490);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var7) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ACrangeExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ACrangeExpr__visit_all(val* self, val* p0) {
parser_prod__ACrangeExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#empty_init for (self: AOrangeExpr) */
void parser_prod__AOrangeExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AOrangeExpr__empty_init(val* self) {
parser_prod__AOrangeExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#init_aorangeexpr for (self: AOrangeExpr, nullable TObra, nullable AExpr, nullable AExpr, nullable TObra, nullable AAnnotations) */
void parser_prod__AOrangeExpr__init_aorangeexpr(val* self, val* p0, val* p1, val* p2, val* p3, val* p4) {
val* var_n_obra /* var n_obra: nullable TObra */;
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_expr2 /* var n_expr2: nullable AExpr */;
val* var_n_cbra /* var n_cbra: nullable TObra */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_obra = p0;
var_n_expr = p1;
var_n_expr2 = p2;
var_n_cbra = p3;
var_n_annotations = p4;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AOrangeExpr__empty_init]))(self) /* empty_init on <self:AOrangeExpr>*/;
if (var_n_obra == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8506);
exit(1);
}
self->attrs[COLOR_parser_nodes__AOrangeExpr___n_obra].val = var_n_obra; /* _n_obra on <self:AOrangeExpr> */
if (var_n_obra == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8507);
exit(1);
} else {
((void (*)(val*, val*))(var_n_obra->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_obra, self) /* parent= on <var_n_obra:nullable TObra>*/;
}
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8508);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val = var_n_expr; /* _n_expr on <self:AOrangeExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8509);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_expr2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8510);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val = var_n_expr2; /* _n_expr2 on <self:AOrangeExpr> */
if (var_n_expr2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8511);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr2->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr2, self) /* parent= on <var_n_expr2:nullable AExpr>*/;
}
if (var_n_cbra == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8512);
exit(1);
}
self->attrs[COLOR_parser_nodes__AOrangeExpr___n_cbra].val = var_n_cbra; /* _n_cbra on <self:AOrangeExpr> */
if (var_n_cbra == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8513);
exit(1);
} else {
((void (*)(val*, val*))(var_n_cbra->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_cbra, self) /* parent= on <var_n_cbra:nullable TObra>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:AOrangeExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#init_aorangeexpr for (self: Object, nullable TObra, nullable AExpr, nullable AExpr, nullable TObra, nullable AAnnotations) */
void VIRTUAL_parser_prod__AOrangeExpr__init_aorangeexpr(val* self, val* p0, val* p1, val* p2, val* p3, val* p4) {
parser_prod__AOrangeExpr__init_aorangeexpr(self, p0, p1, p2, p3, p4);
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#replace_child for (self: AOrangeExpr, ANode, nullable ANode) */
void parser_prod__AOrangeExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TObra */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : AExpr */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : AExpr */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
val* var19 /* : TObra */;
short int var20 /* : Bool */;
val* var21 /* : null */;
short int var22 /* : Bool */;
short int var23 /* : Bool */;
int cltype24;
int idtype25;
val* var26 /* : nullable AAnnotations */;
short int var27 /* : Bool */;
val* var28 /* : null */;
short int var29 /* : Bool */;
short int var30 /* : Bool */;
int cltype31;
int idtype32;
val* var33 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AOrangeExpr___n_obra].val; /* _n_obra on <self:AOrangeExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_obra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8522);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TObra>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TObra */
cltype = type_parser_nodes__TObra.color;
idtype = type_parser_nodes__TObra.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8525);
exit(1);
}
self->attrs[COLOR_parser_nodes__AOrangeExpr___n_obra].val = var_new_child; /* _n_obra on <self:AOrangeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8528);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val; /* _n_expr on <self:AOrangeExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8532);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:AExpr>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype10 = type_parser_nodes__AExpr.color;
idtype11 = type_parser_nodes__AExpr.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8535);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val = var_new_child; /* _n_expr on <self:AOrangeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8538);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val; /* _n_expr2 on <self:AOrangeExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr2");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8542);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:AExpr>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype17 = type_parser_nodes__AExpr.color;
idtype18 = type_parser_nodes__AExpr.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8545);
exit(1);
}
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val = var_new_child; /* _n_expr2 on <self:AOrangeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8548);
exit(1);
}
goto RET_LABEL;
} else {
}
var19 = self->attrs[COLOR_parser_nodes__AOrangeExpr___n_cbra].val; /* _n_cbra on <self:AOrangeExpr> */
if (var19 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cbra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8552);
exit(1);
}
var20 = ((short int (*)(val*, val*))(var19->class->vft[COLOR_kernel__Object___61d_61d]))(var19, var_old_child) /* == on <var19:TObra>*/;
if (var20){
var21 = NULL;
if (var_new_child == NULL) {
var22 = 0; /* is null */
} else {
var22 = 1; /* arg is null and recv is not */
}
if (var22){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TObra */
cltype24 = type_parser_nodes__TObra.color;
idtype25 = type_parser_nodes__TObra.id;
if(cltype24 >= var_new_child->type->table_size) {
var23 = 0;
} else {
var23 = var_new_child->type->type_table[cltype24] == idtype25;
}
if (!var23) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8555);
exit(1);
}
self->attrs[COLOR_parser_nodes__AOrangeExpr___n_cbra].val = var_new_child; /* _n_cbra on <self:AOrangeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8558);
exit(1);
}
goto RET_LABEL;
} else {
}
var26 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AOrangeExpr> */
if (var26 == NULL) {
var27 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var27 = ((short int (*)(val*, val*))(var26->class->vft[COLOR_kernel__Object___61d_61d]))(var26, var_old_child) /* == on <var26:nullable AAnnotations>*/;
}
if (var27){
var28 = NULL;
if (var_new_child == NULL) {
var29 = 0; /* is null */
} else {
var29 = 1; /* arg is null and recv is not */
}
if (var29){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype31 = type_parser_nodes__AAnnotations.color;
idtype32 = type_parser_nodes__AAnnotations.id;
if(cltype31 >= var_new_child->type->table_size) {
var30 = 0;
} else {
var30 = var_new_child->type->type_table[cltype31] == idtype32;
}
if (!var30) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8565);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:AOrangeExpr> */
} else {
var33 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var33; /* _n_annotations on <self:AOrangeExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AOrangeExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AOrangeExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#n_obra= for (self: AOrangeExpr, TObra) */
void parser_prod__AOrangeExpr__n_obra_61d(val* self, val* p0) {
val* var_node /* var node: TObra */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AOrangeExpr___n_obra].val = var_node; /* _n_obra on <self:AOrangeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TObra>*/;
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#n_obra= for (self: Object, TObra) */
void VIRTUAL_parser_prod__AOrangeExpr__n_obra_61d(val* self, val* p0) {
parser_prod__AOrangeExpr__n_obra_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#n_expr= for (self: AOrangeExpr, AExpr) */
void parser_prod__AOrangeExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val = var_node; /* _n_expr on <self:AOrangeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__AOrangeExpr__n_expr_61d(val* self, val* p0) {
parser_prod__AOrangeExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#n_expr2= for (self: AOrangeExpr, AExpr) */
void parser_prod__AOrangeExpr__n_expr2_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val = var_node; /* _n_expr2 on <self:AOrangeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#n_expr2= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__AOrangeExpr__n_expr2_61d(val* self, val* p0) {
parser_prod__AOrangeExpr__n_expr2_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#n_cbra= for (self: AOrangeExpr, TObra) */
void parser_prod__AOrangeExpr__n_cbra_61d(val* self, val* p0) {
val* var_node /* var node: TObra */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AOrangeExpr___n_cbra].val = var_node; /* _n_cbra on <self:AOrangeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TObra>*/;
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#n_cbra= for (self: Object, TObra) */
void VIRTUAL_parser_prod__AOrangeExpr__n_cbra_61d(val* self, val* p0) {
parser_prod__AOrangeExpr__n_cbra_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#n_annotations= for (self: AOrangeExpr, nullable AAnnotations) */
void parser_prod__AOrangeExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:AOrangeExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__AOrangeExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__AOrangeExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#visit_all for (self: AOrangeExpr, Visitor) */
void parser_prod__AOrangeExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TObra */;
val* var1 /* : AExpr */;
val* var2 /* : AExpr */;
val* var3 /* : TObra */;
val* var4 /* : nullable AAnnotations */;
val* var5 /* : null */;
short int var6 /* : Bool */;
val* var7 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AOrangeExpr___n_obra].val; /* _n_obra on <self:AOrangeExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_obra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8605);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr].val; /* _n_expr on <self:AOrangeExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8606);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__ARangeExpr___n_expr2].val; /* _n_expr2 on <self:AOrangeExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr2");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8607);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
var3 = self->attrs[COLOR_parser_nodes__AOrangeExpr___n_cbra].val; /* _n_cbra on <self:AOrangeExpr> */
if (var3 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cbra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8608);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var3) /* enter_visit on <var_v:Visitor>*/;
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AOrangeExpr> */
var5 = NULL;
if (var4 == NULL) {
var6 = 0; /* is null */
} else {
var6 = 1; /* arg is null and recv is not */
}
if (var6){
var7 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AOrangeExpr> */
if (var7 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8610);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var7) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AOrangeExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AOrangeExpr__visit_all(val* self, val* p0) {
parser_prod__AOrangeExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#empty_init for (self: AArrayExpr) */
void parser_prod__AArrayExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AArrayExpr__empty_init(val* self) {
parser_prod__AArrayExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#init_aarrayexpr for (self: AArrayExpr, nullable AExprs, nullable AAnnotations) */
void parser_prod__AArrayExpr__init_aarrayexpr(val* self, val* p0, val* p1) {
val* var_n_exprs /* var n_exprs: nullable AExprs */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_exprs = p0;
var_n_annotations = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AArrayExpr__empty_init]))(self) /* empty_init on <self:AArrayExpr>*/;
if (var_n_exprs == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8623);
exit(1);
}
self->attrs[COLOR_parser_nodes__AArrayExpr___n_exprs].val = var_n_exprs; /* _n_exprs on <self:AArrayExpr> */
if (var_n_exprs == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8624);
exit(1);
} else {
((void (*)(val*, val*))(var_n_exprs->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_exprs, self) /* parent= on <var_n_exprs:nullable AExprs>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:AArrayExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#init_aarrayexpr for (self: Object, nullable AExprs, nullable AAnnotations) */
void VIRTUAL_parser_prod__AArrayExpr__init_aarrayexpr(val* self, val* p0, val* p1) {
parser_prod__AArrayExpr__init_aarrayexpr(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#replace_child for (self: AArrayExpr, ANode, nullable ANode) */
void parser_prod__AArrayExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : AExprs */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : nullable AAnnotations */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AArrayExpr___n_exprs].val; /* _n_exprs on <self:AArrayExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8633);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:AExprs>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExprs */
cltype = type_parser_nodes__AExprs.color;
idtype = type_parser_nodes__AExprs.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8636);
exit(1);
}
self->attrs[COLOR_parser_nodes__AArrayExpr___n_exprs].val = var_new_child; /* _n_exprs on <self:AArrayExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8639);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AArrayExpr> */
if (var5 == NULL) {
var6 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:nullable AAnnotations>*/;
}
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype10 = type_parser_nodes__AAnnotations.color;
idtype11 = type_parser_nodes__AAnnotations.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8646);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:AArrayExpr> */
} else {
var12 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var12; /* _n_annotations on <self:AArrayExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AArrayExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AArrayExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#n_exprs= for (self: AArrayExpr, AExprs) */
void parser_prod__AArrayExpr__n_exprs_61d(val* self, val* p0) {
val* var_node /* var node: AExprs */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AArrayExpr___n_exprs].val = var_node; /* _n_exprs on <self:AArrayExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExprs>*/;
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#n_exprs= for (self: Object, AExprs) */
void VIRTUAL_parser_prod__AArrayExpr__n_exprs_61d(val* self, val* p0) {
parser_prod__AArrayExpr__n_exprs_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#n_annotations= for (self: AArrayExpr, nullable AAnnotations) */
void parser_prod__AArrayExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:AArrayExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__AArrayExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__AArrayExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#visit_all for (self: AArrayExpr, Visitor) */
void parser_prod__AArrayExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : AExprs */;
val* var1 /* : nullable AAnnotations */;
val* var2 /* : null */;
short int var3 /* : Bool */;
val* var4 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AArrayExpr___n_exprs].val; /* _n_exprs on <self:AArrayExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8671);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AArrayExpr> */
var2 = NULL;
if (var1 == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AArrayExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8673);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AArrayExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AArrayExpr__visit_all(val* self, val* p0) {
parser_prod__AArrayExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#empty_init for (self: ASelfExpr) */
void parser_prod__ASelfExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ASelfExpr__empty_init(val* self) {
parser_prod__ASelfExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#init_aselfexpr for (self: ASelfExpr, nullable TKwself, nullable AAnnotations) */
void parser_prod__ASelfExpr__init_aselfexpr(val* self, val* p0, val* p1) {
val* var_n_kwself /* var n_kwself: nullable TKwself */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_kwself = p0;
var_n_annotations = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ASelfExpr__empty_init]))(self) /* empty_init on <self:ASelfExpr>*/;
if (var_n_kwself == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8686);
exit(1);
}
self->attrs[COLOR_parser_nodes__ASelfExpr___n_kwself].val = var_n_kwself; /* _n_kwself on <self:ASelfExpr> */
if (var_n_kwself == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8687);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwself->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwself, self) /* parent= on <var_n_kwself:nullable TKwself>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:ASelfExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#init_aselfexpr for (self: Object, nullable TKwself, nullable AAnnotations) */
void VIRTUAL_parser_prod__ASelfExpr__init_aselfexpr(val* self, val* p0, val* p1) {
parser_prod__ASelfExpr__init_aselfexpr(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#replace_child for (self: ASelfExpr, ANode, nullable ANode) */
void parser_prod__ASelfExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : nullable TKwself */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : nullable AAnnotations */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ASelfExpr___n_kwself].val; /* _n_kwself on <self:ASelfExpr> */
if (var == NULL) {
var1 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:nullable TKwself>*/;
}
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwself */
cltype = type_parser_nodes__TKwself.color;
idtype = type_parser_nodes__TKwself.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8699);
exit(1);
}
self->attrs[COLOR_parser_nodes__ASelfExpr___n_kwself].val = var_new_child; /* _n_kwself on <self:ASelfExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8702);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ASelfExpr> */
if (var5 == NULL) {
var6 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:nullable AAnnotations>*/;
}
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype10 = type_parser_nodes__AAnnotations.color;
idtype11 = type_parser_nodes__AAnnotations.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8709);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:ASelfExpr> */
} else {
var12 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var12; /* _n_annotations on <self:ASelfExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ASelfExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__ASelfExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#n_kwself= for (self: ASelfExpr, nullable TKwself) */
void parser_prod__ASelfExpr__n_kwself_61d(val* self, val* p0) {
val* var_node /* var node: nullable TKwself */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ASelfExpr___n_kwself].val = var_node; /* _n_kwself on <self:ASelfExpr> */
if (var_node == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8721);
exit(1);
} else {
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable TKwself>*/;
}
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#n_kwself= for (self: Object, nullable TKwself) */
void VIRTUAL_parser_prod__ASelfExpr__n_kwself_61d(val* self, val* p0) {
parser_prod__ASelfExpr__n_kwself_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#n_annotations= for (self: ASelfExpr, nullable AAnnotations) */
void parser_prod__ASelfExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:ASelfExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__ASelfExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__ASelfExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#visit_all for (self: ASelfExpr, Visitor) */
void parser_prod__ASelfExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : nullable TKwself */;
val* var1 /* : nullable AAnnotations */;
val* var2 /* : null */;
short int var3 /* : Bool */;
val* var4 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ASelfExpr___n_kwself].val; /* _n_kwself on <self:ASelfExpr> */
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ASelfExpr> */
var2 = NULL;
if (var1 == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ASelfExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8736);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ASelfExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ASelfExpr__visit_all(val* self, val* p0) {
parser_prod__ASelfExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AImplicitSelfExpr#empty_init for (self: AImplicitSelfExpr) */
void parser_prod__AImplicitSelfExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AImplicitSelfExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AImplicitSelfExpr__empty_init(val* self) {
parser_prod__AImplicitSelfExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AImplicitSelfExpr#init_aimplicitselfexpr for (self: AImplicitSelfExpr) */
void parser_prod__AImplicitSelfExpr__init_aimplicitselfexpr(val* self) {
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AImplicitSelfExpr__empty_init]))(self) /* empty_init on <self:AImplicitSelfExpr>*/;
RET_LABEL:;
}
/* method parser_prod#AImplicitSelfExpr#init_aimplicitselfexpr for (self: Object) */
void VIRTUAL_parser_prod__AImplicitSelfExpr__init_aimplicitselfexpr(val* self) {
parser_prod__AImplicitSelfExpr__init_aimplicitselfexpr(self);
RET_LABEL:;
}
/* method parser_prod#AImplicitSelfExpr#replace_child for (self: AImplicitSelfExpr, ANode, nullable ANode) */
void parser_prod__AImplicitSelfExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
var_old_child = p0;
var_new_child = p1;
RET_LABEL:;
}
/* method parser_prod#AImplicitSelfExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AImplicitSelfExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AImplicitSelfExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AImplicitSelfExpr#visit_all for (self: AImplicitSelfExpr, Visitor) */
void parser_prod__AImplicitSelfExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
var_v = p0;
RET_LABEL:;
}
/* method parser_prod#AImplicitSelfExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AImplicitSelfExpr__visit_all(val* self, val* p0) {
parser_prod__AImplicitSelfExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#empty_init for (self: ATrueExpr) */
void parser_prod__ATrueExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ATrueExpr__empty_init(val* self) {
parser_prod__ATrueExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#init_atrueexpr for (self: ATrueExpr, nullable TKwtrue, nullable AAnnotations) */
void parser_prod__ATrueExpr__init_atrueexpr(val* self, val* p0, val* p1) {
val* var_n_kwtrue /* var n_kwtrue: nullable TKwtrue */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_kwtrue = p0;
var_n_annotations = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ATrueExpr__empty_init]))(self) /* empty_init on <self:ATrueExpr>*/;
if (var_n_kwtrue == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8767);
exit(1);
}
self->attrs[COLOR_parser_nodes__ATrueExpr___n_kwtrue].val = var_n_kwtrue; /* _n_kwtrue on <self:ATrueExpr> */
if (var_n_kwtrue == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8768);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwtrue->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwtrue, self) /* parent= on <var_n_kwtrue:nullable TKwtrue>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:ATrueExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#init_atrueexpr for (self: Object, nullable TKwtrue, nullable AAnnotations) */
void VIRTUAL_parser_prod__ATrueExpr__init_atrueexpr(val* self, val* p0, val* p1) {
parser_prod__ATrueExpr__init_atrueexpr(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#replace_child for (self: ATrueExpr, ANode, nullable ANode) */
void parser_prod__ATrueExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TKwtrue */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : nullable AAnnotations */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ATrueExpr___n_kwtrue].val; /* _n_kwtrue on <self:ATrueExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwtrue");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8777);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TKwtrue>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwtrue */
cltype = type_parser_nodes__TKwtrue.color;
idtype = type_parser_nodes__TKwtrue.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8780);
exit(1);
}
self->attrs[COLOR_parser_nodes__ATrueExpr___n_kwtrue].val = var_new_child; /* _n_kwtrue on <self:ATrueExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8783);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ATrueExpr> */
if (var5 == NULL) {
var6 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:nullable AAnnotations>*/;
}
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype10 = type_parser_nodes__AAnnotations.color;
idtype11 = type_parser_nodes__AAnnotations.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8790);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:ATrueExpr> */
} else {
var12 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var12; /* _n_annotations on <self:ATrueExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ATrueExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__ATrueExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#n_kwtrue= for (self: ATrueExpr, TKwtrue) */
void parser_prod__ATrueExpr__n_kwtrue_61d(val* self, val* p0) {
val* var_node /* var node: TKwtrue */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ATrueExpr___n_kwtrue].val = var_node; /* _n_kwtrue on <self:ATrueExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwtrue>*/;
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#n_kwtrue= for (self: Object, TKwtrue) */
void VIRTUAL_parser_prod__ATrueExpr__n_kwtrue_61d(val* self, val* p0) {
parser_prod__ATrueExpr__n_kwtrue_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#n_annotations= for (self: ATrueExpr, nullable AAnnotations) */
void parser_prod__ATrueExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:ATrueExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__ATrueExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__ATrueExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#visit_all for (self: ATrueExpr, Visitor) */
void parser_prod__ATrueExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TKwtrue */;
val* var1 /* : nullable AAnnotations */;
val* var2 /* : null */;
short int var3 /* : Bool */;
val* var4 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ATrueExpr___n_kwtrue].val; /* _n_kwtrue on <self:ATrueExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwtrue");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8815);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ATrueExpr> */
var2 = NULL;
if (var1 == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ATrueExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8817);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ATrueExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ATrueExpr__visit_all(val* self, val* p0) {
parser_prod__ATrueExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#empty_init for (self: AFalseExpr) */
void parser_prod__AFalseExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AFalseExpr__empty_init(val* self) {
parser_prod__AFalseExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#init_afalseexpr for (self: AFalseExpr, nullable TKwfalse, nullable AAnnotations) */
void parser_prod__AFalseExpr__init_afalseexpr(val* self, val* p0, val* p1) {
val* var_n_kwfalse /* var n_kwfalse: nullable TKwfalse */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_kwfalse = p0;
var_n_annotations = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AFalseExpr__empty_init]))(self) /* empty_init on <self:AFalseExpr>*/;
if (var_n_kwfalse == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8830);
exit(1);
}
self->attrs[COLOR_parser_nodes__AFalseExpr___n_kwfalse].val = var_n_kwfalse; /* _n_kwfalse on <self:AFalseExpr> */
if (var_n_kwfalse == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8831);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwfalse->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwfalse, self) /* parent= on <var_n_kwfalse:nullable TKwfalse>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:AFalseExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#init_afalseexpr for (self: Object, nullable TKwfalse, nullable AAnnotations) */
void VIRTUAL_parser_prod__AFalseExpr__init_afalseexpr(val* self, val* p0, val* p1) {
parser_prod__AFalseExpr__init_afalseexpr(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#replace_child for (self: AFalseExpr, ANode, nullable ANode) */
void parser_prod__AFalseExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TKwfalse */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : nullable AAnnotations */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AFalseExpr___n_kwfalse].val; /* _n_kwfalse on <self:AFalseExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwfalse");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8840);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TKwfalse>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwfalse */
cltype = type_parser_nodes__TKwfalse.color;
idtype = type_parser_nodes__TKwfalse.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8843);
exit(1);
}
self->attrs[COLOR_parser_nodes__AFalseExpr___n_kwfalse].val = var_new_child; /* _n_kwfalse on <self:AFalseExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8846);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AFalseExpr> */
if (var5 == NULL) {
var6 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:nullable AAnnotations>*/;
}
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype10 = type_parser_nodes__AAnnotations.color;
idtype11 = type_parser_nodes__AAnnotations.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8853);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:AFalseExpr> */
} else {
var12 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var12; /* _n_annotations on <self:AFalseExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AFalseExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AFalseExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#n_kwfalse= for (self: AFalseExpr, TKwfalse) */
void parser_prod__AFalseExpr__n_kwfalse_61d(val* self, val* p0) {
val* var_node /* var node: TKwfalse */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AFalseExpr___n_kwfalse].val = var_node; /* _n_kwfalse on <self:AFalseExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwfalse>*/;
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#n_kwfalse= for (self: Object, TKwfalse) */
void VIRTUAL_parser_prod__AFalseExpr__n_kwfalse_61d(val* self, val* p0) {
parser_prod__AFalseExpr__n_kwfalse_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#n_annotations= for (self: AFalseExpr, nullable AAnnotations) */
void parser_prod__AFalseExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:AFalseExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__AFalseExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__AFalseExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#visit_all for (self: AFalseExpr, Visitor) */
void parser_prod__AFalseExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TKwfalse */;
val* var1 /* : nullable AAnnotations */;
val* var2 /* : null */;
short int var3 /* : Bool */;
val* var4 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AFalseExpr___n_kwfalse].val; /* _n_kwfalse on <self:AFalseExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwfalse");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8878);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AFalseExpr> */
var2 = NULL;
if (var1 == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AFalseExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8880);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AFalseExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AFalseExpr__visit_all(val* self, val* p0) {
parser_prod__AFalseExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ANullExpr#empty_init for (self: ANullExpr) */
void parser_prod__ANullExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ANullExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ANullExpr__empty_init(val* self) {
parser_prod__ANullExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ANullExpr#init_anullexpr for (self: ANullExpr, nullable TKwnull, nullable AAnnotations) */
void parser_prod__ANullExpr__init_anullexpr(val* self, val* p0, val* p1) {
val* var_n_kwnull /* var n_kwnull: nullable TKwnull */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_kwnull = p0;
var_n_annotations = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ANullExpr__empty_init]))(self) /* empty_init on <self:ANullExpr>*/;
if (var_n_kwnull == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8893);
exit(1);
}
self->attrs[COLOR_parser_nodes__ANullExpr___n_kwnull].val = var_n_kwnull; /* _n_kwnull on <self:ANullExpr> */
if (var_n_kwnull == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8894);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwnull->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwnull, self) /* parent= on <var_n_kwnull:nullable TKwnull>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:ANullExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ANullExpr#init_anullexpr for (self: Object, nullable TKwnull, nullable AAnnotations) */
void VIRTUAL_parser_prod__ANullExpr__init_anullexpr(val* self, val* p0, val* p1) {
parser_prod__ANullExpr__init_anullexpr(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ANullExpr#replace_child for (self: ANullExpr, ANode, nullable ANode) */
void parser_prod__ANullExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TKwnull */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : nullable AAnnotations */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ANullExpr___n_kwnull].val; /* _n_kwnull on <self:ANullExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwnull");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8903);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TKwnull>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwnull */
cltype = type_parser_nodes__TKwnull.color;
idtype = type_parser_nodes__TKwnull.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8906);
exit(1);
}
self->attrs[COLOR_parser_nodes__ANullExpr___n_kwnull].val = var_new_child; /* _n_kwnull on <self:ANullExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8909);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ANullExpr> */
if (var5 == NULL) {
var6 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:nullable AAnnotations>*/;
}
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype10 = type_parser_nodes__AAnnotations.color;
idtype11 = type_parser_nodes__AAnnotations.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8916);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:ANullExpr> */
} else {
var12 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var12; /* _n_annotations on <self:ANullExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ANullExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ANullExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__ANullExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ANullExpr#n_kwnull= for (self: ANullExpr, TKwnull) */
void parser_prod__ANullExpr__n_kwnull_61d(val* self, val* p0) {
val* var_node /* var node: TKwnull */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ANullExpr___n_kwnull].val = var_node; /* _n_kwnull on <self:ANullExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwnull>*/;
RET_LABEL:;
}
/* method parser_prod#ANullExpr#n_kwnull= for (self: Object, TKwnull) */
void VIRTUAL_parser_prod__ANullExpr__n_kwnull_61d(val* self, val* p0) {
parser_prod__ANullExpr__n_kwnull_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ANullExpr#n_annotations= for (self: ANullExpr, nullable AAnnotations) */
void parser_prod__ANullExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:ANullExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ANullExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__ANullExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__ANullExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ANullExpr#visit_all for (self: ANullExpr, Visitor) */
void parser_prod__ANullExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TKwnull */;
val* var1 /* : nullable AAnnotations */;
val* var2 /* : null */;
short int var3 /* : Bool */;
val* var4 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ANullExpr___n_kwnull].val; /* _n_kwnull on <self:ANullExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwnull");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8941);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ANullExpr> */
var2 = NULL;
if (var1 == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ANullExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8943);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ANullExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ANullExpr__visit_all(val* self, val* p0) {
parser_prod__ANullExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AIntExpr#empty_init for (self: AIntExpr) */
void parser_prod__AIntExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AIntExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AIntExpr__empty_init(val* self) {
parser_prod__AIntExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AIntExpr#init_aintexpr for (self: AIntExpr, nullable TNumber, nullable AAnnotations) */
void parser_prod__AIntExpr__init_aintexpr(val* self, val* p0, val* p1) {
val* var_n_number /* var n_number: nullable TNumber */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_number = p0;
var_n_annotations = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AIntExpr__empty_init]))(self) /* empty_init on <self:AIntExpr>*/;
if (var_n_number == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8956);
exit(1);
}
self->attrs[COLOR_parser_nodes__AIntExpr___n_number].val = var_n_number; /* _n_number on <self:AIntExpr> */
if (var_n_number == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8957);
exit(1);
} else {
((void (*)(val*, val*))(var_n_number->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_number, self) /* parent= on <var_n_number:nullable TNumber>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:AIntExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AIntExpr#init_aintexpr for (self: Object, nullable TNumber, nullable AAnnotations) */
void VIRTUAL_parser_prod__AIntExpr__init_aintexpr(val* self, val* p0, val* p1) {
parser_prod__AIntExpr__init_aintexpr(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AIntExpr#replace_child for (self: AIntExpr, ANode, nullable ANode) */
void parser_prod__AIntExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TNumber */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : nullable AAnnotations */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AIntExpr___n_number].val; /* _n_number on <self:AIntExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_number");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8966);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TNumber>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TNumber */
cltype = type_parser_nodes__TNumber.color;
idtype = type_parser_nodes__TNumber.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8969);
exit(1);
}
self->attrs[COLOR_parser_nodes__AIntExpr___n_number].val = var_new_child; /* _n_number on <self:AIntExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8972);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AIntExpr> */
if (var5 == NULL) {
var6 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:nullable AAnnotations>*/;
}
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype10 = type_parser_nodes__AAnnotations.color;
idtype11 = type_parser_nodes__AAnnotations.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 8979);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:AIntExpr> */
} else {
var12 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var12; /* _n_annotations on <self:AIntExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AIntExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AIntExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AIntExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AIntExpr#n_number= for (self: AIntExpr, TNumber) */
void parser_prod__AIntExpr__n_number_61d(val* self, val* p0) {
val* var_node /* var node: TNumber */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AIntExpr___n_number].val = var_node; /* _n_number on <self:AIntExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TNumber>*/;
RET_LABEL:;
}
/* method parser_prod#AIntExpr#n_number= for (self: Object, TNumber) */
void VIRTUAL_parser_prod__AIntExpr__n_number_61d(val* self, val* p0) {
parser_prod__AIntExpr__n_number_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AIntExpr#n_annotations= for (self: AIntExpr, nullable AAnnotations) */
void parser_prod__AIntExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:AIntExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AIntExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__AIntExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__AIntExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AIntExpr#visit_all for (self: AIntExpr, Visitor) */
void parser_prod__AIntExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TNumber */;
val* var1 /* : nullable AAnnotations */;
val* var2 /* : null */;
short int var3 /* : Bool */;
val* var4 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AIntExpr___n_number].val; /* _n_number on <self:AIntExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_number");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9004);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AIntExpr> */
var2 = NULL;
if (var1 == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AIntExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9006);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AIntExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AIntExpr__visit_all(val* self, val* p0) {
parser_prod__AIntExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#empty_init for (self: AFloatExpr) */
void parser_prod__AFloatExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AFloatExpr__empty_init(val* self) {
parser_prod__AFloatExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#init_afloatexpr for (self: AFloatExpr, nullable TFloat, nullable AAnnotations) */
void parser_prod__AFloatExpr__init_afloatexpr(val* self, val* p0, val* p1) {
val* var_n_float /* var n_float: nullable TFloat */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_float = p0;
var_n_annotations = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AFloatExpr__empty_init]))(self) /* empty_init on <self:AFloatExpr>*/;
if (var_n_float == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9019);
exit(1);
}
self->attrs[COLOR_parser_nodes__AFloatExpr___n_float].val = var_n_float; /* _n_float on <self:AFloatExpr> */
if (var_n_float == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9020);
exit(1);
} else {
((void (*)(val*, val*))(var_n_float->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_float, self) /* parent= on <var_n_float:nullable TFloat>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:AFloatExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#init_afloatexpr for (self: Object, nullable TFloat, nullable AAnnotations) */
void VIRTUAL_parser_prod__AFloatExpr__init_afloatexpr(val* self, val* p0, val* p1) {
parser_prod__AFloatExpr__init_afloatexpr(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#replace_child for (self: AFloatExpr, ANode, nullable ANode) */
void parser_prod__AFloatExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TFloat */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : nullable AAnnotations */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AFloatExpr___n_float].val; /* _n_float on <self:AFloatExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_float");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9029);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TFloat>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TFloat */
cltype = type_parser_nodes__TFloat.color;
idtype = type_parser_nodes__TFloat.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9032);
exit(1);
}
self->attrs[COLOR_parser_nodes__AFloatExpr___n_float].val = var_new_child; /* _n_float on <self:AFloatExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9035);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AFloatExpr> */
if (var5 == NULL) {
var6 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:nullable AAnnotations>*/;
}
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype10 = type_parser_nodes__AAnnotations.color;
idtype11 = type_parser_nodes__AAnnotations.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9042);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:AFloatExpr> */
} else {
var12 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var12; /* _n_annotations on <self:AFloatExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AFloatExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AFloatExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#n_float= for (self: AFloatExpr, TFloat) */
void parser_prod__AFloatExpr__n_float_61d(val* self, val* p0) {
val* var_node /* var node: TFloat */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AFloatExpr___n_float].val = var_node; /* _n_float on <self:AFloatExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TFloat>*/;
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#n_float= for (self: Object, TFloat) */
void VIRTUAL_parser_prod__AFloatExpr__n_float_61d(val* self, val* p0) {
parser_prod__AFloatExpr__n_float_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#n_annotations= for (self: AFloatExpr, nullable AAnnotations) */
void parser_prod__AFloatExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:AFloatExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__AFloatExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__AFloatExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#visit_all for (self: AFloatExpr, Visitor) */
void parser_prod__AFloatExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TFloat */;
val* var1 /* : nullable AAnnotations */;
val* var2 /* : null */;
short int var3 /* : Bool */;
val* var4 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AFloatExpr___n_float].val; /* _n_float on <self:AFloatExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_float");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9067);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AFloatExpr> */
var2 = NULL;
if (var1 == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AFloatExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9069);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AFloatExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AFloatExpr__visit_all(val* self, val* p0) {
parser_prod__AFloatExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ACharExpr#empty_init for (self: ACharExpr) */
void parser_prod__ACharExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ACharExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ACharExpr__empty_init(val* self) {
parser_prod__ACharExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ACharExpr#init_acharexpr for (self: ACharExpr, nullable TChar, nullable AAnnotations) */
void parser_prod__ACharExpr__init_acharexpr(val* self, val* p0, val* p1) {
val* var_n_char /* var n_char: nullable TChar */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_char = p0;
var_n_annotations = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ACharExpr__empty_init]))(self) /* empty_init on <self:ACharExpr>*/;
if (var_n_char == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9082);
exit(1);
}
self->attrs[COLOR_parser_nodes__ACharExpr___n_char].val = var_n_char; /* _n_char on <self:ACharExpr> */
if (var_n_char == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9083);
exit(1);
} else {
((void (*)(val*, val*))(var_n_char->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_char, self) /* parent= on <var_n_char:nullable TChar>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:ACharExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ACharExpr#init_acharexpr for (self: Object, nullable TChar, nullable AAnnotations) */
void VIRTUAL_parser_prod__ACharExpr__init_acharexpr(val* self, val* p0, val* p1) {
parser_prod__ACharExpr__init_acharexpr(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ACharExpr#replace_child for (self: ACharExpr, ANode, nullable ANode) */
void parser_prod__ACharExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TChar */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : nullable AAnnotations */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ACharExpr___n_char].val; /* _n_char on <self:ACharExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_char");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9092);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TChar>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TChar */
cltype = type_parser_nodes__TChar.color;
idtype = type_parser_nodes__TChar.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9095);
exit(1);
}
self->attrs[COLOR_parser_nodes__ACharExpr___n_char].val = var_new_child; /* _n_char on <self:ACharExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9098);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ACharExpr> */
if (var5 == NULL) {
var6 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:nullable AAnnotations>*/;
}
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype10 = type_parser_nodes__AAnnotations.color;
idtype11 = type_parser_nodes__AAnnotations.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9105);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:ACharExpr> */
} else {
var12 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var12; /* _n_annotations on <self:ACharExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ACharExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ACharExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__ACharExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ACharExpr#n_char= for (self: ACharExpr, TChar) */
void parser_prod__ACharExpr__n_char_61d(val* self, val* p0) {
val* var_node /* var node: TChar */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ACharExpr___n_char].val = var_node; /* _n_char on <self:ACharExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TChar>*/;
RET_LABEL:;
}
/* method parser_prod#ACharExpr#n_char= for (self: Object, TChar) */
void VIRTUAL_parser_prod__ACharExpr__n_char_61d(val* self, val* p0) {
parser_prod__ACharExpr__n_char_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ACharExpr#n_annotations= for (self: ACharExpr, nullable AAnnotations) */
void parser_prod__ACharExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:ACharExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ACharExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__ACharExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__ACharExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ACharExpr#visit_all for (self: ACharExpr, Visitor) */
void parser_prod__ACharExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TChar */;
val* var1 /* : nullable AAnnotations */;
val* var2 /* : null */;
short int var3 /* : Bool */;
val* var4 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ACharExpr___n_char].val; /* _n_char on <self:ACharExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_char");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9130);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ACharExpr> */
var2 = NULL;
if (var1 == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ACharExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9132);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ACharExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ACharExpr__visit_all(val* self, val* p0) {
parser_prod__ACharExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AStringExpr#empty_init for (self: AStringExpr) */
void parser_prod__AStringExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AStringExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AStringExpr__empty_init(val* self) {
parser_prod__AStringExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AStringExpr#init_astringexpr for (self: AStringExpr, nullable TString, nullable AAnnotations) */
void parser_prod__AStringExpr__init_astringexpr(val* self, val* p0, val* p1) {
val* var_n_string /* var n_string: nullable TString */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_string = p0;
var_n_annotations = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AStringExpr__empty_init]))(self) /* empty_init on <self:AStringExpr>*/;
if (var_n_string == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9145);
exit(1);
}
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_n_string; /* _n_string on <self:AStringExpr> */
if (var_n_string == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9146);
exit(1);
} else {
((void (*)(val*, val*))(var_n_string->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_string, self) /* parent= on <var_n_string:nullable TString>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:AStringExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AStringExpr#init_astringexpr for (self: Object, nullable TString, nullable AAnnotations) */
void VIRTUAL_parser_prod__AStringExpr__init_astringexpr(val* self, val* p0, val* p1) {
parser_prod__AStringExpr__init_astringexpr(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AStringExpr#replace_child for (self: AStringExpr, ANode, nullable ANode) */
void parser_prod__AStringExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : Token */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : nullable AAnnotations */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val; /* _n_string on <self:AStringExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_string");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9155);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:Token>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TString */
cltype = type_parser_nodes__TString.color;
idtype = type_parser_nodes__TString.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9158);
exit(1);
}
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_new_child; /* _n_string on <self:AStringExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9161);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AStringExpr> */
if (var5 == NULL) {
var6 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:nullable AAnnotations>*/;
}
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype10 = type_parser_nodes__AAnnotations.color;
idtype11 = type_parser_nodes__AAnnotations.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9168);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:AStringExpr> */
} else {
var12 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var12; /* _n_annotations on <self:AStringExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AStringExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AStringExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AStringExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AStringExpr#n_string= for (self: AStringExpr, Token) */
void parser_prod__AStringExpr__n_string_61d(val* self, val* p0) {
val* var_node /* var node: Token */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_node; /* _n_string on <self:AStringExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:Token>*/;
RET_LABEL:;
}
/* method parser_prod#AStringExpr#n_string= for (self: Object, Token) */
void VIRTUAL_parser_prod__AStringExpr__n_string_61d(val* self, val* p0) {
parser_prod__AStringExpr__n_string_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AStringExpr#n_annotations= for (self: AStringExpr, nullable AAnnotations) */
void parser_prod__AStringExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:AStringExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AStringExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__AStringExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__AStringExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AStringExpr#visit_all for (self: AStringExpr, Visitor) */
void parser_prod__AStringExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : Token */;
val* var1 /* : nullable AAnnotations */;
val* var2 /* : null */;
short int var3 /* : Bool */;
val* var4 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val; /* _n_string on <self:AStringExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_string");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9193);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AStringExpr> */
var2 = NULL;
if (var1 == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AStringExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9195);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AStringExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AStringExpr__visit_all(val* self, val* p0) {
parser_prod__AStringExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AStartStringExpr#empty_init for (self: AStartStringExpr) */
void parser_prod__AStartStringExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AStartStringExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AStartStringExpr__empty_init(val* self) {
parser_prod__AStartStringExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AStartStringExpr#init_astartstringexpr for (self: AStartStringExpr, nullable TStartString) */
void parser_prod__AStartStringExpr__init_astartstringexpr(val* self, val* p0) {
val* var_n_string /* var n_string: nullable TStartString */;
var_n_string = p0;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AStartStringExpr__empty_init]))(self) /* empty_init on <self:AStartStringExpr>*/;
if (var_n_string == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9207);
exit(1);
}
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_n_string; /* _n_string on <self:AStartStringExpr> */
if (var_n_string == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9208);
exit(1);
} else {
((void (*)(val*, val*))(var_n_string->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_string, self) /* parent= on <var_n_string:nullable TStartString>*/;
}
RET_LABEL:;
}
/* method parser_prod#AStartStringExpr#init_astartstringexpr for (self: Object, nullable TStartString) */
void VIRTUAL_parser_prod__AStartStringExpr__init_astartstringexpr(val* self, val* p0) {
parser_prod__AStartStringExpr__init_astartstringexpr(self, p0);
RET_LABEL:;
}
/* method parser_prod#AStartStringExpr#replace_child for (self: AStartStringExpr, ANode, nullable ANode) */
void parser_prod__AStartStringExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : Token */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val; /* _n_string on <self:AStartStringExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_string");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9213);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:Token>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TStartString */
cltype = type_parser_nodes__TStartString.color;
idtype = type_parser_nodes__TStartString.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9216);
exit(1);
}
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_new_child; /* _n_string on <self:AStartStringExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9219);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AStartStringExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AStartStringExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AStartStringExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AStartStringExpr#n_string= for (self: AStartStringExpr, Token) */
void parser_prod__AStartStringExpr__n_string_61d(val* self, val* p0) {
val* var_node /* var node: Token */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_node; /* _n_string on <self:AStartStringExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:Token>*/;
RET_LABEL:;
}
/* method parser_prod#AStartStringExpr#n_string= for (self: Object, Token) */
void VIRTUAL_parser_prod__AStartStringExpr__n_string_61d(val* self, val* p0) {
parser_prod__AStartStringExpr__n_string_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AStartStringExpr#visit_all for (self: AStartStringExpr, Visitor) */
void parser_prod__AStartStringExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : Token */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val; /* _n_string on <self:AStartStringExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_string");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9234);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AStartStringExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AStartStringExpr__visit_all(val* self, val* p0) {
parser_prod__AStartStringExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AMidStringExpr#empty_init for (self: AMidStringExpr) */
void parser_prod__AMidStringExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AMidStringExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AMidStringExpr__empty_init(val* self) {
parser_prod__AMidStringExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AMidStringExpr#init_amidstringexpr for (self: AMidStringExpr, nullable TMidString) */
void parser_prod__AMidStringExpr__init_amidstringexpr(val* self, val* p0) {
val* var_n_string /* var n_string: nullable TMidString */;
var_n_string = p0;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AMidStringExpr__empty_init]))(self) /* empty_init on <self:AMidStringExpr>*/;
if (var_n_string == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9245);
exit(1);
}
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_n_string; /* _n_string on <self:AMidStringExpr> */
if (var_n_string == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9246);
exit(1);
} else {
((void (*)(val*, val*))(var_n_string->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_string, self) /* parent= on <var_n_string:nullable TMidString>*/;
}
RET_LABEL:;
}
/* method parser_prod#AMidStringExpr#init_amidstringexpr for (self: Object, nullable TMidString) */
void VIRTUAL_parser_prod__AMidStringExpr__init_amidstringexpr(val* self, val* p0) {
parser_prod__AMidStringExpr__init_amidstringexpr(self, p0);
RET_LABEL:;
}
/* method parser_prod#AMidStringExpr#replace_child for (self: AMidStringExpr, ANode, nullable ANode) */
void parser_prod__AMidStringExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : Token */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val; /* _n_string on <self:AMidStringExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_string");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9251);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:Token>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TMidString */
cltype = type_parser_nodes__TMidString.color;
idtype = type_parser_nodes__TMidString.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9254);
exit(1);
}
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_new_child; /* _n_string on <self:AMidStringExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9257);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AMidStringExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AMidStringExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AMidStringExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AMidStringExpr#n_string= for (self: AMidStringExpr, Token) */
void parser_prod__AMidStringExpr__n_string_61d(val* self, val* p0) {
val* var_node /* var node: Token */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_node; /* _n_string on <self:AMidStringExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:Token>*/;
RET_LABEL:;
}
/* method parser_prod#AMidStringExpr#n_string= for (self: Object, Token) */
void VIRTUAL_parser_prod__AMidStringExpr__n_string_61d(val* self, val* p0) {
parser_prod__AMidStringExpr__n_string_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AMidStringExpr#visit_all for (self: AMidStringExpr, Visitor) */
void parser_prod__AMidStringExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : Token */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val; /* _n_string on <self:AMidStringExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_string");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9272);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AMidStringExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AMidStringExpr__visit_all(val* self, val* p0) {
parser_prod__AMidStringExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AEndStringExpr#empty_init for (self: AEndStringExpr) */
void parser_prod__AEndStringExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AEndStringExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AEndStringExpr__empty_init(val* self) {
parser_prod__AEndStringExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AEndStringExpr#init_aendstringexpr for (self: AEndStringExpr, nullable TEndString) */
void parser_prod__AEndStringExpr__init_aendstringexpr(val* self, val* p0) {
val* var_n_string /* var n_string: nullable TEndString */;
var_n_string = p0;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AEndStringExpr__empty_init]))(self) /* empty_init on <self:AEndStringExpr>*/;
if (var_n_string == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9283);
exit(1);
}
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_n_string; /* _n_string on <self:AEndStringExpr> */
if (var_n_string == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9284);
exit(1);
} else {
((void (*)(val*, val*))(var_n_string->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_string, self) /* parent= on <var_n_string:nullable TEndString>*/;
}
RET_LABEL:;
}
/* method parser_prod#AEndStringExpr#init_aendstringexpr for (self: Object, nullable TEndString) */
void VIRTUAL_parser_prod__AEndStringExpr__init_aendstringexpr(val* self, val* p0) {
parser_prod__AEndStringExpr__init_aendstringexpr(self, p0);
RET_LABEL:;
}
/* method parser_prod#AEndStringExpr#replace_child for (self: AEndStringExpr, ANode, nullable ANode) */
void parser_prod__AEndStringExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : Token */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val; /* _n_string on <self:AEndStringExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_string");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9289);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:Token>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TEndString */
cltype = type_parser_nodes__TEndString.color;
idtype = type_parser_nodes__TEndString.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9292);
exit(1);
}
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_new_child; /* _n_string on <self:AEndStringExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9295);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AEndStringExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AEndStringExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AEndStringExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AEndStringExpr#n_string= for (self: AEndStringExpr, Token) */
void parser_prod__AEndStringExpr__n_string_61d(val* self, val* p0) {
val* var_node /* var node: Token */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val = var_node; /* _n_string on <self:AEndStringExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:Token>*/;
RET_LABEL:;
}
/* method parser_prod#AEndStringExpr#n_string= for (self: Object, Token) */
void VIRTUAL_parser_prod__AEndStringExpr__n_string_61d(val* self, val* p0) {
parser_prod__AEndStringExpr__n_string_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AEndStringExpr#visit_all for (self: AEndStringExpr, Visitor) */
void parser_prod__AEndStringExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : Token */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AStringFormExpr___n_string].val; /* _n_string on <self:AEndStringExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_string");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9310);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AEndStringExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AEndStringExpr__visit_all(val* self, val* p0) {
parser_prod__AEndStringExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ASuperstringExpr#empty_init for (self: ASuperstringExpr) */
void parser_prod__ASuperstringExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ASuperstringExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ASuperstringExpr__empty_init(val* self) {
parser_prod__ASuperstringExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ASuperstringExpr#init_asuperstringexpr for (self: ASuperstringExpr, Collection[Object], nullable AAnnotations) */
void parser_prod__ASuperstringExpr__init_asuperstringexpr(val* self, val* p0, val* p1) {
val* var_n_exprs /* var n_exprs: Collection[Object] */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : Iterator[nullable Object] */;
short int var1 /* : Bool */;
val* var2 /* : nullable Object */;
val* var_n /* var n: Object */;
short int var3 /* : Bool */;
int cltype;
int idtype;
val* var4 /* : ANodes[AExpr] */;
val* var5 /* : null */;
short int var6 /* : Bool */;
var_n_exprs = p0;
var_n_annotations = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ASuperstringExpr__empty_init]))(self) /* empty_init on <self:ASuperstringExpr>*/;
var = ((val* (*)(val*))(var_n_exprs->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_n_exprs) /* iterator on <var_n_exprs:Collection[Object]>*/;
for(;;) {
var1 = ((short int (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var) /* is_ok on <var:Iterator[nullable Object]>*/;
if(!var1) break;
var2 = ((val* (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__item]))(var) /* item on <var:Iterator[nullable Object]>*/;
var_n = var2;
/* <var_n:Object> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_n->type->table_size) {
var3 = 0;
} else {
var3 = var_n->type->type_table[cltype] == idtype;
}
if (!var3) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9323);
exit(1);
}
var4 = self->attrs[COLOR_parser_nodes__ASuperstringExpr___n_exprs].val; /* _n_exprs on <self:ASuperstringExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9324);
exit(1);
}
((void (*)(val*, val*))(var4->class->vft[COLOR_abstract_collection__SimpleCollection__add]))(var4, var_n) /* add on <var4:ANodes[AExpr]>*/;
((void (*)(val*, val*))(var_n->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n, self) /* parent= on <var_n:Object(AExpr)>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__next]))(var) /* next on <var:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:ASuperstringExpr> */
var5 = NULL;
if (var_n_annotations == NULL) {
var6 = 0; /* is null */
} else {
var6 = 1; /* arg is null and recv is not */
}
if (var6){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ASuperstringExpr#init_asuperstringexpr for (self: Object, Collection[Object], nullable AAnnotations) */
void VIRTUAL_parser_prod__ASuperstringExpr__init_asuperstringexpr(val* self, val* p0, val* p1) {
parser_prod__ASuperstringExpr__init_asuperstringexpr(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ASuperstringExpr#replace_child for (self: ASuperstringExpr, ANode, nullable ANode) */
void parser_prod__ASuperstringExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : Range[Int] */;
long var1 /* : Int */;
val* var2 /* : ANodes[AExpr] */;
long var3 /* : Int */;
val* var4 /* : Discrete */;
val* var5 /* : Discrete */;
val* var6 /* : Iterator[nullable Object] */;
short int var7 /* : Bool */;
val* var8 /* : nullable Object */;
long var_i /* var i: Int */;
long var9 /* : Int */;
val* var10 /* : ANodes[AExpr] */;
val* var11 /* : nullable Object */;
short int var12 /* : Bool */;
val* var13 /* : null */;
short int var14 /* : Bool */;
short int var15 /* : Bool */;
int cltype;
int idtype;
val* var16 /* : ANodes[AExpr] */;
val* var17 /* : ANodes[AExpr] */;
val* var18 /* : nullable AAnnotations */;
short int var19 /* : Bool */;
val* var20 /* : null */;
short int var21 /* : Bool */;
short int var22 /* : Bool */;
int cltype23;
int idtype24;
val* var25 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = NEW_range__Range(&type_range__Rangekernel__Int);
var1 = 0;
var2 = self->attrs[COLOR_parser_nodes__ASuperstringExpr___n_exprs].val; /* _n_exprs on <self:ASuperstringExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9335);
exit(1);
}
var3 = ((long (*)(val*))(var2->class->vft[COLOR_abstract_collection__Collection__length]))(var2) /* length on <var2:ANodes[AExpr]>*/;
var4 = BOX_kernel__Int(var1); /* autobox from Int to Discrete */
var5 = BOX_kernel__Int(var3); /* autobox from Int to Discrete */
((void (*)(val*, val*, val*))(var->class->vft[COLOR_range__Range__without_last]))(var, var4, var5) /* without_last on <var:Range[Int]>*/;
CHECK_NEW_range__Range(var);
var6 = ((val* (*)(val*))(var->class->vft[COLOR_abstract_collection__Collection__iterator]))(var) /* iterator on <var:Range[Int]>*/;
for(;;) {
var7 = ((short int (*)(val*))(var6->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var6) /* is_ok on <var6:Iterator[nullable Object]>*/;
if(!var7) break;
var8 = ((val* (*)(val*))(var6->class->vft[COLOR_abstract_collection__Iterator__item]))(var6) /* item on <var6:Iterator[nullable Object]>*/;
var9 = ((struct instance_kernel__Int*)var8)->value; /* autounbox from nullable Object to Int */;
var_i = var9;
var10 = self->attrs[COLOR_parser_nodes__ASuperstringExpr___n_exprs].val; /* _n_exprs on <self:ASuperstringExpr> */
if (var10 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9336);
exit(1);
}
var11 = ((val* (*)(val*, long))(var10->class->vft[COLOR_abstract_collection__SequenceRead___91d_93d]))(var10, var_i) /* [] on <var10:ANodes[AExpr]>*/;
var12 = ((short int (*)(val*, val*))(var11->class->vft[COLOR_kernel__Object___61d_61d]))(var11, var_old_child) /* == on <var11:nullable Object(AExpr)>*/;
if (var12){
var13 = NULL;
if (var_new_child == NULL) {
var14 = 0; /* is null */
} else {
var14 = 1; /* arg is null and recv is not */
}
if (var14){
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_new_child->type->table_size) {
var15 = 0;
} else {
var15 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var15) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9338);
exit(1);
}
var16 = self->attrs[COLOR_parser_nodes__ASuperstringExpr___n_exprs].val; /* _n_exprs on <self:ASuperstringExpr> */
if (var16 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9339);
exit(1);
}
((void (*)(val*, long, val*))(var16->class->vft[COLOR_abstract_collection__Sequence___91d_93d_61d]))(var16, var_i, var_new_child) /* []= on <var16:ANodes[AExpr]>*/;
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(AExpr)>*/;
} else {
var17 = self->attrs[COLOR_parser_nodes__ASuperstringExpr___n_exprs].val; /* _n_exprs on <self:ASuperstringExpr> */
if (var17 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9342);
exit(1);
}
((void (*)(val*, long))(var17->class->vft[COLOR_abstract_collection__Sequence__remove_at]))(var17, var_i) /* remove_at on <var17:ANodes[AExpr]>*/;
}
goto RET_LABEL;
} else {
}
CONTINUE_label: (void)0;
((void (*)(val*))(var6->class->vft[COLOR_abstract_collection__Iterator__next]))(var6) /* next on <var6:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
var18 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ASuperstringExpr> */
if (var18 == NULL) {
var19 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var19 = ((short int (*)(val*, val*))(var18->class->vft[COLOR_kernel__Object___61d_61d]))(var18, var_old_child) /* == on <var18:nullable AAnnotations>*/;
}
if (var19){
var20 = NULL;
if (var_new_child == NULL) {
var21 = 0; /* is null */
} else {
var21 = 1; /* arg is null and recv is not */
}
if (var21){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype23 = type_parser_nodes__AAnnotations.color;
idtype24 = type_parser_nodes__AAnnotations.id;
if(cltype23 >= var_new_child->type->table_size) {
var22 = 0;
} else {
var22 = var_new_child->type->type_table[cltype23] == idtype24;
}
if (!var22) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9350);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:ASuperstringExpr> */
} else {
var25 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var25; /* _n_annotations on <self:ASuperstringExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ASuperstringExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ASuperstringExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__ASuperstringExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ASuperstringExpr#n_annotations= for (self: ASuperstringExpr, nullable AAnnotations) */
void parser_prod__ASuperstringExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:ASuperstringExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ASuperstringExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__ASuperstringExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__ASuperstringExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ASuperstringExpr#visit_all for (self: ASuperstringExpr, Visitor) */
void parser_prod__ASuperstringExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : ANodes[AExpr] */;
val* var1 /* : Iterator[nullable Object] */;
short int var2 /* : Bool */;
val* var3 /* : nullable Object */;
val* var_n /* var n: AExpr */;
val* var4 /* : nullable AAnnotations */;
val* var5 /* : null */;
short int var6 /* : Bool */;
val* var7 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ASuperstringExpr___n_exprs].val; /* _n_exprs on <self:ASuperstringExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9370);
exit(1);
}
var1 = ((val* (*)(val*))(var->class->vft[COLOR_abstract_collection__Collection__iterator]))(var) /* iterator on <var:ANodes[AExpr]>*/;
for(;;) {
var2 = ((short int (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var1) /* is_ok on <var1:Iterator[nullable Object]>*/;
if(!var2) break;
var3 = ((val* (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__item]))(var1) /* item on <var1:Iterator[nullable Object]>*/;
var_n = var3;
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var_n) /* enter_visit on <var_v:Visitor>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__next]))(var1) /* next on <var1:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
var4 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ASuperstringExpr> */
var5 = NULL;
if (var4 == NULL) {
var6 = 0; /* is null */
} else {
var6 = 1; /* arg is null and recv is not */
}
if (var6){
var7 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:ASuperstringExpr> */
if (var7 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9374);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var7) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ASuperstringExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ASuperstringExpr__visit_all(val* self, val* p0) {
parser_prod__ASuperstringExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AParExpr#empty_init for (self: AParExpr) */
void parser_prod__AParExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AParExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AParExpr__empty_init(val* self) {
parser_prod__AParExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AParExpr#init_aparexpr for (self: AParExpr, nullable TOpar, nullable AExpr, nullable TCpar, nullable AAnnotations) */
void parser_prod__AParExpr__init_aparexpr(val* self, val* p0, val* p1, val* p2, val* p3) {
val* var_n_opar /* var n_opar: nullable TOpar */;
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_cpar /* var n_cpar: nullable TCpar */;
val* var_n_annotations /* var n_annotations: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_n_opar = p0;
var_n_expr = p1;
var_n_cpar = p2;
var_n_annotations = p3;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AParExpr__empty_init]))(self) /* empty_init on <self:AParExpr>*/;
if (var_n_opar == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9389);
exit(1);
}
self->attrs[COLOR_parser_nodes__AParExpr___n_opar].val = var_n_opar; /* _n_opar on <self:AParExpr> */
if (var_n_opar == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9390);
exit(1);
} else {
((void (*)(val*, val*))(var_n_opar->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_opar, self) /* parent= on <var_n_opar:nullable TOpar>*/;
}
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9391);
exit(1);
}
self->attrs[COLOR_parser_nodes__AProxyExpr___n_expr].val = var_n_expr; /* _n_expr on <self:AParExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9392);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_cpar == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9393);
exit(1);
}
self->attrs[COLOR_parser_nodes__AParExpr___n_cpar].val = var_n_cpar; /* _n_cpar on <self:AParExpr> */
if (var_n_cpar == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9394);
exit(1);
} else {
((void (*)(val*, val*))(var_n_cpar->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_cpar, self) /* parent= on <var_n_cpar:nullable TCpar>*/;
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_n_annotations; /* _n_annotations on <self:AParExpr> */
var = NULL;
if (var_n_annotations == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_annotations->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_annotations, self) /* parent= on <var_n_annotations:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AParExpr#init_aparexpr for (self: Object, nullable TOpar, nullable AExpr, nullable TCpar, nullable AAnnotations) */
void VIRTUAL_parser_prod__AParExpr__init_aparexpr(val* self, val* p0, val* p1, val* p2, val* p3) {
parser_prod__AParExpr__init_aparexpr(self, p0, p1, p2, p3);
RET_LABEL:;
}
/* method parser_prod#AParExpr#replace_child for (self: AParExpr, ANode, nullable ANode) */
void parser_prod__AParExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TOpar */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : AExpr */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : TCpar */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
val* var19 /* : nullable AAnnotations */;
short int var20 /* : Bool */;
val* var21 /* : null */;
short int var22 /* : Bool */;
short int var23 /* : Bool */;
int cltype24;
int idtype25;
val* var26 /* : null */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AParExpr___n_opar].val; /* _n_opar on <self:AParExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_opar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9403);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TOpar>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TOpar */
cltype = type_parser_nodes__TOpar.color;
idtype = type_parser_nodes__TOpar.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9406);
exit(1);
}
self->attrs[COLOR_parser_nodes__AParExpr___n_opar].val = var_new_child; /* _n_opar on <self:AParExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9409);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__AProxyExpr___n_expr].val; /* _n_expr on <self:AParExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9413);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:AExpr>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype10 = type_parser_nodes__AExpr.color;
idtype11 = type_parser_nodes__AExpr.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9416);
exit(1);
}
self->attrs[COLOR_parser_nodes__AProxyExpr___n_expr].val = var_new_child; /* _n_expr on <self:AParExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9419);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__AParExpr___n_cpar].val; /* _n_cpar on <self:AParExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cpar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9423);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:TCpar>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TCpar */
cltype17 = type_parser_nodes__TCpar.color;
idtype18 = type_parser_nodes__TCpar.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9426);
exit(1);
}
self->attrs[COLOR_parser_nodes__AParExpr___n_cpar].val = var_new_child; /* _n_cpar on <self:AParExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9429);
exit(1);
}
goto RET_LABEL;
} else {
}
var19 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AParExpr> */
if (var19 == NULL) {
var20 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var20 = ((short int (*)(val*, val*))(var19->class->vft[COLOR_kernel__Object___61d_61d]))(var19, var_old_child) /* == on <var19:nullable AAnnotations>*/;
}
if (var20){
var21 = NULL;
if (var_new_child == NULL) {
var22 = 0; /* is null */
} else {
var22 = 1; /* arg is null and recv is not */
}
if (var22){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AAnnotations */
cltype24 = type_parser_nodes__AAnnotations.color;
idtype25 = type_parser_nodes__AAnnotations.id;
if(cltype24 >= var_new_child->type->table_size) {
var23 = 0;
} else {
var23 = var_new_child->type->type_table[cltype24] == idtype25;
}
if (!var23) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9436);
exit(1);
}
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_new_child; /* _n_annotations on <self:AParExpr> */
} else {
var26 = NULL;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var26; /* _n_annotations on <self:AParExpr> */
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AParExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AParExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AParExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AParExpr#n_opar= for (self: AParExpr, TOpar) */
void parser_prod__AParExpr__n_opar_61d(val* self, val* p0) {
val* var_node /* var node: TOpar */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AParExpr___n_opar].val = var_node; /* _n_opar on <self:AParExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TOpar>*/;
RET_LABEL:;
}
/* method parser_prod#AParExpr#n_opar= for (self: Object, TOpar) */
void VIRTUAL_parser_prod__AParExpr__n_opar_61d(val* self, val* p0) {
parser_prod__AParExpr__n_opar_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AParExpr#n_expr= for (self: AParExpr, AExpr) */
void parser_prod__AParExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AProxyExpr___n_expr].val = var_node; /* _n_expr on <self:AParExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#AParExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__AParExpr__n_expr_61d(val* self, val* p0) {
parser_prod__AParExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AParExpr#n_cpar= for (self: AParExpr, TCpar) */
void parser_prod__AParExpr__n_cpar_61d(val* self, val* p0) {
val* var_node /* var node: TCpar */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AParExpr___n_cpar].val = var_node; /* _n_cpar on <self:AParExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TCpar>*/;
RET_LABEL:;
}
/* method parser_prod#AParExpr#n_cpar= for (self: Object, TCpar) */
void VIRTUAL_parser_prod__AParExpr__n_cpar_61d(val* self, val* p0) {
parser_prod__AParExpr__n_cpar_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AParExpr#n_annotations= for (self: AParExpr, nullable AAnnotations) */
void parser_prod__AParExpr__n_annotations_61d(val* self, val* p0) {
val* var_node /* var node: nullable AAnnotations */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__Prod___n_annotations].val = var_node; /* _n_annotations on <self:AParExpr> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable AAnnotations(AAnnotations)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AParExpr#n_annotations= for (self: Object, nullable AAnnotations) */
void VIRTUAL_parser_prod__AParExpr__n_annotations_61d(val* self, val* p0) {
parser_prod__AParExpr__n_annotations_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AParExpr#visit_all for (self: AParExpr, Visitor) */
void parser_prod__AParExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TOpar */;
val* var1 /* : AExpr */;
val* var2 /* : TCpar */;
val* var3 /* : nullable AAnnotations */;
val* var4 /* : null */;
short int var5 /* : Bool */;
val* var6 /* : nullable AAnnotations */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AParExpr___n_opar].val; /* _n_opar on <self:AParExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_opar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9471);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__AProxyExpr___n_expr].val; /* _n_expr on <self:AParExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9472);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__AParExpr___n_cpar].val; /* _n_cpar on <self:AParExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cpar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9473);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
var3 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AParExpr> */
var4 = NULL;
if (var3 == NULL) {
var5 = 0; /* is null */
} else {
var5 = 1; /* arg is null and recv is not */
}
if (var5){
var6 = self->attrs[COLOR_parser_nodes__Prod___n_annotations].val; /* _n_annotations on <self:AParExpr> */
if (var6 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9475);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var6) /* enter_visit on <var_v:Visitor>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AParExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AParExpr__visit_all(val* self, val* p0) {
parser_prod__AParExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#empty_init for (self: AAsCastExpr) */
void parser_prod__AAsCastExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AAsCastExpr__empty_init(val* self) {
parser_prod__AAsCastExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#init_aascastexpr for (self: AAsCastExpr, nullable AExpr, nullable TKwas, nullable TOpar, nullable AType, nullable TCpar) */
void parser_prod__AAsCastExpr__init_aascastexpr(val* self, val* p0, val* p1, val* p2, val* p3, val* p4) {
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_kwas /* var n_kwas: nullable TKwas */;
val* var_n_opar /* var n_opar: nullable TOpar */;
val* var_n_type /* var n_type: nullable AType */;
val* var_n_cpar /* var n_cpar: nullable TCpar */;
var_n_expr = p0;
var_n_kwas = p1;
var_n_opar = p2;
var_n_type = p3;
var_n_cpar = p4;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AAsCastExpr__empty_init]))(self) /* empty_init on <self:AAsCastExpr>*/;
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9491);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_expr].val = var_n_expr; /* _n_expr on <self:AAsCastExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9492);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_kwas == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9493);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_kwas].val = var_n_kwas; /* _n_kwas on <self:AAsCastExpr> */
if (var_n_kwas == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9494);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwas->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwas, self) /* parent= on <var_n_kwas:nullable TKwas>*/;
}
if (var_n_opar == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9495);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_opar].val = var_n_opar; /* _n_opar on <self:AAsCastExpr> */
if (var_n_opar == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9496);
exit(1);
} else {
((void (*)(val*, val*))(var_n_opar->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_opar, self) /* parent= on <var_n_opar:nullable TOpar>*/;
}
if (var_n_type == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9497);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_type].val = var_n_type; /* _n_type on <self:AAsCastExpr> */
if (var_n_type == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9498);
exit(1);
} else {
((void (*)(val*, val*))(var_n_type->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_type, self) /* parent= on <var_n_type:nullable AType>*/;
}
if (var_n_cpar == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9499);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_cpar].val = var_n_cpar; /* _n_cpar on <self:AAsCastExpr> */
if (var_n_cpar == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9500);
exit(1);
} else {
((void (*)(val*, val*))(var_n_cpar->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_cpar, self) /* parent= on <var_n_cpar:nullable TCpar>*/;
}
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#init_aascastexpr for (self: Object, nullable AExpr, nullable TKwas, nullable TOpar, nullable AType, nullable TCpar) */
void VIRTUAL_parser_prod__AAsCastExpr__init_aascastexpr(val* self, val* p0, val* p1, val* p2, val* p3, val* p4) {
parser_prod__AAsCastExpr__init_aascastexpr(self, p0, p1, p2, p3, p4);
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#replace_child for (self: AAsCastExpr, ANode, nullable ANode) */
void parser_prod__AAsCastExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : AExpr */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : TKwas */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : TOpar */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
val* var19 /* : AType */;
short int var20 /* : Bool */;
val* var21 /* : null */;
short int var22 /* : Bool */;
short int var23 /* : Bool */;
int cltype24;
int idtype25;
val* var26 /* : TCpar */;
short int var27 /* : Bool */;
val* var28 /* : null */;
short int var29 /* : Bool */;
short int var30 /* : Bool */;
int cltype31;
int idtype32;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AAsCastExpr___n_expr].val; /* _n_expr on <self:AAsCastExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9505);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:AExpr>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9508);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_expr].val = var_new_child; /* _n_expr on <self:AAsCastExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9511);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__AAsCastExpr___n_kwas].val; /* _n_kwas on <self:AAsCastExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwas");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9515);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:TKwas>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwas */
cltype10 = type_parser_nodes__TKwas.color;
idtype11 = type_parser_nodes__TKwas.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9518);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_kwas].val = var_new_child; /* _n_kwas on <self:AAsCastExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9521);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__AAsCastExpr___n_opar].val; /* _n_opar on <self:AAsCastExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_opar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9525);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:TOpar>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TOpar */
cltype17 = type_parser_nodes__TOpar.color;
idtype18 = type_parser_nodes__TOpar.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9528);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_opar].val = var_new_child; /* _n_opar on <self:AAsCastExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9531);
exit(1);
}
goto RET_LABEL;
} else {
}
var19 = self->attrs[COLOR_parser_nodes__AAsCastExpr___n_type].val; /* _n_type on <self:AAsCastExpr> */
if (var19 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_type");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9535);
exit(1);
}
var20 = ((short int (*)(val*, val*))(var19->class->vft[COLOR_kernel__Object___61d_61d]))(var19, var_old_child) /* == on <var19:AType>*/;
if (var20){
var21 = NULL;
if (var_new_child == NULL) {
var22 = 0; /* is null */
} else {
var22 = 1; /* arg is null and recv is not */
}
if (var22){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AType */
cltype24 = type_parser_nodes__AType.color;
idtype25 = type_parser_nodes__AType.id;
if(cltype24 >= var_new_child->type->table_size) {
var23 = 0;
} else {
var23 = var_new_child->type->type_table[cltype24] == idtype25;
}
if (!var23) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9538);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_type].val = var_new_child; /* _n_type on <self:AAsCastExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9541);
exit(1);
}
goto RET_LABEL;
} else {
}
var26 = self->attrs[COLOR_parser_nodes__AAsCastExpr___n_cpar].val; /* _n_cpar on <self:AAsCastExpr> */
if (var26 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cpar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9545);
exit(1);
}
var27 = ((short int (*)(val*, val*))(var26->class->vft[COLOR_kernel__Object___61d_61d]))(var26, var_old_child) /* == on <var26:TCpar>*/;
if (var27){
var28 = NULL;
if (var_new_child == NULL) {
var29 = 0; /* is null */
} else {
var29 = 1; /* arg is null and recv is not */
}
if (var29){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TCpar */
cltype31 = type_parser_nodes__TCpar.color;
idtype32 = type_parser_nodes__TCpar.id;
if(cltype31 >= var_new_child->type->table_size) {
var30 = 0;
} else {
var30 = var_new_child->type->type_table[cltype31] == idtype32;
}
if (!var30) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9548);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_cpar].val = var_new_child; /* _n_cpar on <self:AAsCastExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9551);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AAsCastExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AAsCastExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#n_expr= for (self: AAsCastExpr, AExpr) */
void parser_prod__AAsCastExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_expr].val = var_node; /* _n_expr on <self:AAsCastExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__AAsCastExpr__n_expr_61d(val* self, val* p0) {
parser_prod__AAsCastExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#n_kwas= for (self: AAsCastExpr, TKwas) */
void parser_prod__AAsCastExpr__n_kwas_61d(val* self, val* p0) {
val* var_node /* var node: TKwas */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_kwas].val = var_node; /* _n_kwas on <self:AAsCastExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwas>*/;
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#n_kwas= for (self: Object, TKwas) */
void VIRTUAL_parser_prod__AAsCastExpr__n_kwas_61d(val* self, val* p0) {
parser_prod__AAsCastExpr__n_kwas_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#n_opar= for (self: AAsCastExpr, TOpar) */
void parser_prod__AAsCastExpr__n_opar_61d(val* self, val* p0) {
val* var_node /* var node: TOpar */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_opar].val = var_node; /* _n_opar on <self:AAsCastExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TOpar>*/;
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#n_opar= for (self: Object, TOpar) */
void VIRTUAL_parser_prod__AAsCastExpr__n_opar_61d(val* self, val* p0) {
parser_prod__AAsCastExpr__n_opar_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#n_type= for (self: AAsCastExpr, AType) */
void parser_prod__AAsCastExpr__n_type_61d(val* self, val* p0) {
val* var_node /* var node: AType */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_type].val = var_node; /* _n_type on <self:AAsCastExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AType>*/;
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#n_type= for (self: Object, AType) */
void VIRTUAL_parser_prod__AAsCastExpr__n_type_61d(val* self, val* p0) {
parser_prod__AAsCastExpr__n_type_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#n_cpar= for (self: AAsCastExpr, TCpar) */
void parser_prod__AAsCastExpr__n_cpar_61d(val* self, val* p0) {
val* var_node /* var node: TCpar */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAsCastExpr___n_cpar].val = var_node; /* _n_cpar on <self:AAsCastExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TCpar>*/;
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#n_cpar= for (self: Object, TCpar) */
void VIRTUAL_parser_prod__AAsCastExpr__n_cpar_61d(val* self, val* p0) {
parser_prod__AAsCastExpr__n_cpar_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#visit_all for (self: AAsCastExpr, Visitor) */
void parser_prod__AAsCastExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : AExpr */;
val* var1 /* : TKwas */;
val* var2 /* : TOpar */;
val* var3 /* : AType */;
val* var4 /* : TCpar */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AAsCastExpr___n_expr].val; /* _n_expr on <self:AAsCastExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9586);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__AAsCastExpr___n_kwas].val; /* _n_kwas on <self:AAsCastExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwas");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9587);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__AAsCastExpr___n_opar].val; /* _n_opar on <self:AAsCastExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_opar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9588);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
var3 = self->attrs[COLOR_parser_nodes__AAsCastExpr___n_type].val; /* _n_type on <self:AAsCastExpr> */
if (var3 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_type");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9589);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var3) /* enter_visit on <var_v:Visitor>*/;
var4 = self->attrs[COLOR_parser_nodes__AAsCastExpr___n_cpar].val; /* _n_cpar on <self:AAsCastExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cpar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9590);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AAsCastExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AAsCastExpr__visit_all(val* self, val* p0) {
parser_prod__AAsCastExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#empty_init for (self: AAsNotnullExpr) */
void parser_prod__AAsNotnullExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AAsNotnullExpr__empty_init(val* self) {
parser_prod__AAsNotnullExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#init_aasnotnullexpr for (self: AAsNotnullExpr, nullable AExpr, nullable TKwas, nullable TOpar, nullable TKwnot, nullable TKwnull, nullable TCpar) */
void parser_prod__AAsNotnullExpr__init_aasnotnullexpr(val* self, val* p0, val* p1, val* p2, val* p3, val* p4, val* p5) {
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_kwas /* var n_kwas: nullable TKwas */;
val* var_n_opar /* var n_opar: nullable TOpar */;
val* var_n_kwnot /* var n_kwnot: nullable TKwnot */;
val* var_n_kwnull /* var n_kwnull: nullable TKwnull */;
val* var_n_cpar /* var n_cpar: nullable TCpar */;
var_n_expr = p0;
var_n_kwas = p1;
var_n_opar = p2;
var_n_kwnot = p3;
var_n_kwnull = p4;
var_n_cpar = p5;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AAsNotnullExpr__empty_init]))(self) /* empty_init on <self:AAsNotnullExpr>*/;
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9606);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_expr].val = var_n_expr; /* _n_expr on <self:AAsNotnullExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9607);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_kwas == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9608);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwas].val = var_n_kwas; /* _n_kwas on <self:AAsNotnullExpr> */
if (var_n_kwas == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9609);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwas->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwas, self) /* parent= on <var_n_kwas:nullable TKwas>*/;
}
if (var_n_opar == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9610);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_opar].val = var_n_opar; /* _n_opar on <self:AAsNotnullExpr> */
if (var_n_opar == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9611);
exit(1);
} else {
((void (*)(val*, val*))(var_n_opar->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_opar, self) /* parent= on <var_n_opar:nullable TOpar>*/;
}
if (var_n_kwnot == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9612);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwnot].val = var_n_kwnot; /* _n_kwnot on <self:AAsNotnullExpr> */
if (var_n_kwnot == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9613);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwnot->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwnot, self) /* parent= on <var_n_kwnot:nullable TKwnot>*/;
}
if (var_n_kwnull == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9614);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwnull].val = var_n_kwnull; /* _n_kwnull on <self:AAsNotnullExpr> */
if (var_n_kwnull == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9615);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwnull->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwnull, self) /* parent= on <var_n_kwnull:nullable TKwnull>*/;
}
if (var_n_cpar == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9616);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_cpar].val = var_n_cpar; /* _n_cpar on <self:AAsNotnullExpr> */
if (var_n_cpar == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9617);
exit(1);
} else {
((void (*)(val*, val*))(var_n_cpar->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_cpar, self) /* parent= on <var_n_cpar:nullable TCpar>*/;
}
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#init_aasnotnullexpr for (self: Object, nullable AExpr, nullable TKwas, nullable TOpar, nullable TKwnot, nullable TKwnull, nullable TCpar) */
void VIRTUAL_parser_prod__AAsNotnullExpr__init_aasnotnullexpr(val* self, val* p0, val* p1, val* p2, val* p3, val* p4, val* p5) {
parser_prod__AAsNotnullExpr__init_aasnotnullexpr(self, p0, p1, p2, p3, p4, p5);
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#replace_child for (self: AAsNotnullExpr, ANode, nullable ANode) */
void parser_prod__AAsNotnullExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : AExpr */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : TKwas */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : TOpar */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
val* var19 /* : TKwnot */;
short int var20 /* : Bool */;
val* var21 /* : null */;
short int var22 /* : Bool */;
short int var23 /* : Bool */;
int cltype24;
int idtype25;
val* var26 /* : TKwnull */;
short int var27 /* : Bool */;
val* var28 /* : null */;
short int var29 /* : Bool */;
short int var30 /* : Bool */;
int cltype31;
int idtype32;
val* var33 /* : TCpar */;
short int var34 /* : Bool */;
val* var35 /* : null */;
short int var36 /* : Bool */;
short int var37 /* : Bool */;
int cltype38;
int idtype39;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_expr].val; /* _n_expr on <self:AAsNotnullExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9622);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:AExpr>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9625);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_expr].val = var_new_child; /* _n_expr on <self:AAsNotnullExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9628);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwas].val; /* _n_kwas on <self:AAsNotnullExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwas");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9632);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:TKwas>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwas */
cltype10 = type_parser_nodes__TKwas.color;
idtype11 = type_parser_nodes__TKwas.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9635);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwas].val = var_new_child; /* _n_kwas on <self:AAsNotnullExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9638);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_opar].val; /* _n_opar on <self:AAsNotnullExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_opar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9642);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:TOpar>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TOpar */
cltype17 = type_parser_nodes__TOpar.color;
idtype18 = type_parser_nodes__TOpar.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9645);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_opar].val = var_new_child; /* _n_opar on <self:AAsNotnullExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9648);
exit(1);
}
goto RET_LABEL;
} else {
}
var19 = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwnot].val; /* _n_kwnot on <self:AAsNotnullExpr> */
if (var19 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwnot");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9652);
exit(1);
}
var20 = ((short int (*)(val*, val*))(var19->class->vft[COLOR_kernel__Object___61d_61d]))(var19, var_old_child) /* == on <var19:TKwnot>*/;
if (var20){
var21 = NULL;
if (var_new_child == NULL) {
var22 = 0; /* is null */
} else {
var22 = 1; /* arg is null and recv is not */
}
if (var22){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwnot */
cltype24 = type_parser_nodes__TKwnot.color;
idtype25 = type_parser_nodes__TKwnot.id;
if(cltype24 >= var_new_child->type->table_size) {
var23 = 0;
} else {
var23 = var_new_child->type->type_table[cltype24] == idtype25;
}
if (!var23) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9655);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwnot].val = var_new_child; /* _n_kwnot on <self:AAsNotnullExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9658);
exit(1);
}
goto RET_LABEL;
} else {
}
var26 = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwnull].val; /* _n_kwnull on <self:AAsNotnullExpr> */
if (var26 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwnull");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9662);
exit(1);
}
var27 = ((short int (*)(val*, val*))(var26->class->vft[COLOR_kernel__Object___61d_61d]))(var26, var_old_child) /* == on <var26:TKwnull>*/;
if (var27){
var28 = NULL;
if (var_new_child == NULL) {
var29 = 0; /* is null */
} else {
var29 = 1; /* arg is null and recv is not */
}
if (var29){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwnull */
cltype31 = type_parser_nodes__TKwnull.color;
idtype32 = type_parser_nodes__TKwnull.id;
if(cltype31 >= var_new_child->type->table_size) {
var30 = 0;
} else {
var30 = var_new_child->type->type_table[cltype31] == idtype32;
}
if (!var30) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9665);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwnull].val = var_new_child; /* _n_kwnull on <self:AAsNotnullExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9668);
exit(1);
}
goto RET_LABEL;
} else {
}
var33 = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_cpar].val; /* _n_cpar on <self:AAsNotnullExpr> */
if (var33 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cpar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9672);
exit(1);
}
var34 = ((short int (*)(val*, val*))(var33->class->vft[COLOR_kernel__Object___61d_61d]))(var33, var_old_child) /* == on <var33:TCpar>*/;
if (var34){
var35 = NULL;
if (var_new_child == NULL) {
var36 = 0; /* is null */
} else {
var36 = 1; /* arg is null and recv is not */
}
if (var36){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TCpar */
cltype38 = type_parser_nodes__TCpar.color;
idtype39 = type_parser_nodes__TCpar.id;
if(cltype38 >= var_new_child->type->table_size) {
var37 = 0;
} else {
var37 = var_new_child->type->type_table[cltype38] == idtype39;
}
if (!var37) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9675);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_cpar].val = var_new_child; /* _n_cpar on <self:AAsNotnullExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9678);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AAsNotnullExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AAsNotnullExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_expr= for (self: AAsNotnullExpr, AExpr) */
void parser_prod__AAsNotnullExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_expr].val = var_node; /* _n_expr on <self:AAsNotnullExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__AAsNotnullExpr__n_expr_61d(val* self, val* p0) {
parser_prod__AAsNotnullExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_kwas= for (self: AAsNotnullExpr, TKwas) */
void parser_prod__AAsNotnullExpr__n_kwas_61d(val* self, val* p0) {
val* var_node /* var node: TKwas */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwas].val = var_node; /* _n_kwas on <self:AAsNotnullExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwas>*/;
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_kwas= for (self: Object, TKwas) */
void VIRTUAL_parser_prod__AAsNotnullExpr__n_kwas_61d(val* self, val* p0) {
parser_prod__AAsNotnullExpr__n_kwas_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_opar= for (self: AAsNotnullExpr, TOpar) */
void parser_prod__AAsNotnullExpr__n_opar_61d(val* self, val* p0) {
val* var_node /* var node: TOpar */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_opar].val = var_node; /* _n_opar on <self:AAsNotnullExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TOpar>*/;
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_opar= for (self: Object, TOpar) */
void VIRTUAL_parser_prod__AAsNotnullExpr__n_opar_61d(val* self, val* p0) {
parser_prod__AAsNotnullExpr__n_opar_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_kwnot= for (self: AAsNotnullExpr, TKwnot) */
void parser_prod__AAsNotnullExpr__n_kwnot_61d(val* self, val* p0) {
val* var_node /* var node: TKwnot */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwnot].val = var_node; /* _n_kwnot on <self:AAsNotnullExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwnot>*/;
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_kwnot= for (self: Object, TKwnot) */
void VIRTUAL_parser_prod__AAsNotnullExpr__n_kwnot_61d(val* self, val* p0) {
parser_prod__AAsNotnullExpr__n_kwnot_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_kwnull= for (self: AAsNotnullExpr, TKwnull) */
void parser_prod__AAsNotnullExpr__n_kwnull_61d(val* self, val* p0) {
val* var_node /* var node: TKwnull */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwnull].val = var_node; /* _n_kwnull on <self:AAsNotnullExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwnull>*/;
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_kwnull= for (self: Object, TKwnull) */
void VIRTUAL_parser_prod__AAsNotnullExpr__n_kwnull_61d(val* self, val* p0) {
parser_prod__AAsNotnullExpr__n_kwnull_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_cpar= for (self: AAsNotnullExpr, TCpar) */
void parser_prod__AAsNotnullExpr__n_cpar_61d(val* self, val* p0) {
val* var_node /* var node: TCpar */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_cpar].val = var_node; /* _n_cpar on <self:AAsNotnullExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TCpar>*/;
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#n_cpar= for (self: Object, TCpar) */
void VIRTUAL_parser_prod__AAsNotnullExpr__n_cpar_61d(val* self, val* p0) {
parser_prod__AAsNotnullExpr__n_cpar_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#visit_all for (self: AAsNotnullExpr, Visitor) */
void parser_prod__AAsNotnullExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : AExpr */;
val* var1 /* : TKwas */;
val* var2 /* : TOpar */;
val* var3 /* : TKwnot */;
val* var4 /* : TKwnull */;
val* var5 /* : TCpar */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_expr].val; /* _n_expr on <self:AAsNotnullExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9718);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwas].val; /* _n_kwas on <self:AAsNotnullExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwas");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9719);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_opar].val; /* _n_opar on <self:AAsNotnullExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_opar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9720);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
var3 = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwnot].val; /* _n_kwnot on <self:AAsNotnullExpr> */
if (var3 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwnot");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9721);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var3) /* enter_visit on <var_v:Visitor>*/;
var4 = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_kwnull].val; /* _n_kwnull on <self:AAsNotnullExpr> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwnull");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9722);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var4) /* enter_visit on <var_v:Visitor>*/;
var5 = self->attrs[COLOR_parser_nodes__AAsNotnullExpr___n_cpar].val; /* _n_cpar on <self:AAsNotnullExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cpar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9723);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var5) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AAsNotnullExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AAsNotnullExpr__visit_all(val* self, val* p0) {
parser_prod__AAsNotnullExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#empty_init for (self: AIssetAttrExpr) */
void parser_prod__AIssetAttrExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AIssetAttrExpr__empty_init(val* self) {
parser_prod__AIssetAttrExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#init_aissetattrexpr for (self: AIssetAttrExpr, nullable TKwisset, nullable AExpr, nullable TAttrid) */
void parser_prod__AIssetAttrExpr__init_aissetattrexpr(val* self, val* p0, val* p1, val* p2) {
val* var_n_kwisset /* var n_kwisset: nullable TKwisset */;
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_id /* var n_id: nullable TAttrid */;
var_n_kwisset = p0;
var_n_expr = p1;
var_n_id = p2;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AIssetAttrExpr__empty_init]))(self) /* empty_init on <self:AIssetAttrExpr>*/;
if (var_n_kwisset == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9736);
exit(1);
}
self->attrs[COLOR_parser_nodes__AIssetAttrExpr___n_kwisset].val = var_n_kwisset; /* _n_kwisset on <self:AIssetAttrExpr> */
if (var_n_kwisset == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9737);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwisset->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwisset, self) /* parent= on <var_n_kwisset:nullable TKwisset>*/;
}
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9738);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAttrFormExpr___n_expr].val = var_n_expr; /* _n_expr on <self:AIssetAttrExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9739);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_id == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9740);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAttrFormExpr___n_id].val = var_n_id; /* _n_id on <self:AIssetAttrExpr> */
if (var_n_id == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9741);
exit(1);
} else {
((void (*)(val*, val*))(var_n_id->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_id, self) /* parent= on <var_n_id:nullable TAttrid>*/;
}
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#init_aissetattrexpr for (self: Object, nullable TKwisset, nullable AExpr, nullable TAttrid) */
void VIRTUAL_parser_prod__AIssetAttrExpr__init_aissetattrexpr(val* self, val* p0, val* p1, val* p2) {
parser_prod__AIssetAttrExpr__init_aissetattrexpr(self, p0, p1, p2);
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#replace_child for (self: AIssetAttrExpr, ANode, nullable ANode) */
void parser_prod__AIssetAttrExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TKwisset */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : AExpr */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : TAttrid */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AIssetAttrExpr___n_kwisset].val; /* _n_kwisset on <self:AIssetAttrExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwisset");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9746);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TKwisset>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwisset */
cltype = type_parser_nodes__TKwisset.color;
idtype = type_parser_nodes__TKwisset.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9749);
exit(1);
}
self->attrs[COLOR_parser_nodes__AIssetAttrExpr___n_kwisset].val = var_new_child; /* _n_kwisset on <self:AIssetAttrExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9752);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__AAttrFormExpr___n_expr].val; /* _n_expr on <self:AIssetAttrExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9756);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:AExpr>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype10 = type_parser_nodes__AExpr.color;
idtype11 = type_parser_nodes__AExpr.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9759);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAttrFormExpr___n_expr].val = var_new_child; /* _n_expr on <self:AIssetAttrExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9762);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__AAttrFormExpr___n_id].val; /* _n_id on <self:AIssetAttrExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_id");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9766);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:TAttrid>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TAttrid */
cltype17 = type_parser_nodes__TAttrid.color;
idtype18 = type_parser_nodes__TAttrid.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9769);
exit(1);
}
self->attrs[COLOR_parser_nodes__AAttrFormExpr___n_id].val = var_new_child; /* _n_id on <self:AIssetAttrExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9772);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AIssetAttrExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__AIssetAttrExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#n_kwisset= for (self: AIssetAttrExpr, TKwisset) */
void parser_prod__AIssetAttrExpr__n_kwisset_61d(val* self, val* p0) {
val* var_node /* var node: TKwisset */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AIssetAttrExpr___n_kwisset].val = var_node; /* _n_kwisset on <self:AIssetAttrExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwisset>*/;
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#n_kwisset= for (self: Object, TKwisset) */
void VIRTUAL_parser_prod__AIssetAttrExpr__n_kwisset_61d(val* self, val* p0) {
parser_prod__AIssetAttrExpr__n_kwisset_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#n_expr= for (self: AIssetAttrExpr, AExpr) */
void parser_prod__AIssetAttrExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAttrFormExpr___n_expr].val = var_node; /* _n_expr on <self:AIssetAttrExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__AIssetAttrExpr__n_expr_61d(val* self, val* p0) {
parser_prod__AIssetAttrExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#n_id= for (self: AIssetAttrExpr, TAttrid) */
void parser_prod__AIssetAttrExpr__n_id_61d(val* self, val* p0) {
val* var_node /* var node: TAttrid */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AAttrFormExpr___n_id].val = var_node; /* _n_id on <self:AIssetAttrExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TAttrid>*/;
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#n_id= for (self: Object, TAttrid) */
void VIRTUAL_parser_prod__AIssetAttrExpr__n_id_61d(val* self, val* p0) {
parser_prod__AIssetAttrExpr__n_id_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#visit_all for (self: AIssetAttrExpr, Visitor) */
void parser_prod__AIssetAttrExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TKwisset */;
val* var1 /* : AExpr */;
val* var2 /* : TAttrid */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AIssetAttrExpr___n_kwisset].val; /* _n_kwisset on <self:AIssetAttrExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwisset");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9797);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__AAttrFormExpr___n_expr].val; /* _n_expr on <self:AIssetAttrExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9798);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__AAttrFormExpr___n_id].val; /* _n_id on <self:AIssetAttrExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_id");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9799);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AIssetAttrExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AIssetAttrExpr__visit_all(val* self, val* p0) {
parser_prod__AIssetAttrExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#empty_init for (self: ADebugTypeExpr) */
void parser_prod__ADebugTypeExpr__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ADebugTypeExpr__empty_init(val* self) {
parser_prod__ADebugTypeExpr__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#init_adebugtypeexpr for (self: ADebugTypeExpr, nullable TKwdebug, nullable TKwtype, nullable AExpr, nullable AType) */
void parser_prod__ADebugTypeExpr__init_adebugtypeexpr(val* self, val* p0, val* p1, val* p2, val* p3) {
val* var_n_kwdebug /* var n_kwdebug: nullable TKwdebug */;
val* var_n_kwtype /* var n_kwtype: nullable TKwtype */;
val* var_n_expr /* var n_expr: nullable AExpr */;
val* var_n_type /* var n_type: nullable AType */;
var_n_kwdebug = p0;
var_n_kwtype = p1;
var_n_expr = p2;
var_n_type = p3;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ADebugTypeExpr__empty_init]))(self) /* empty_init on <self:ADebugTypeExpr>*/;
if (var_n_kwdebug == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9813);
exit(1);
}
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_kwdebug].val = var_n_kwdebug; /* _n_kwdebug on <self:ADebugTypeExpr> */
if (var_n_kwdebug == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9814);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwdebug->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwdebug, self) /* parent= on <var_n_kwdebug:nullable TKwdebug>*/;
}
if (var_n_kwtype == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9815);
exit(1);
}
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_kwtype].val = var_n_kwtype; /* _n_kwtype on <self:ADebugTypeExpr> */
if (var_n_kwtype == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9816);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwtype->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwtype, self) /* parent= on <var_n_kwtype:nullable TKwtype>*/;
}
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9817);
exit(1);
}
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_expr].val = var_n_expr; /* _n_expr on <self:ADebugTypeExpr> */
if (var_n_expr == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9818);
exit(1);
} else {
((void (*)(val*, val*))(var_n_expr->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_expr, self) /* parent= on <var_n_expr:nullable AExpr>*/;
}
if (var_n_type == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9819);
exit(1);
}
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_type].val = var_n_type; /* _n_type on <self:ADebugTypeExpr> */
if (var_n_type == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9820);
exit(1);
} else {
((void (*)(val*, val*))(var_n_type->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_type, self) /* parent= on <var_n_type:nullable AType>*/;
}
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#init_adebugtypeexpr for (self: Object, nullable TKwdebug, nullable TKwtype, nullable AExpr, nullable AType) */
void VIRTUAL_parser_prod__ADebugTypeExpr__init_adebugtypeexpr(val* self, val* p0, val* p1, val* p2, val* p3) {
parser_prod__ADebugTypeExpr__init_adebugtypeexpr(self, p0, p1, p2, p3);
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#replace_child for (self: ADebugTypeExpr, ANode, nullable ANode) */
void parser_prod__ADebugTypeExpr__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TKwdebug */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : TKwtype */;
short int var6 /* : Bool */;
val* var7 /* : null */;
short int var8 /* : Bool */;
short int var9 /* : Bool */;
int cltype10;
int idtype11;
val* var12 /* : AExpr */;
short int var13 /* : Bool */;
val* var14 /* : null */;
short int var15 /* : Bool */;
short int var16 /* : Bool */;
int cltype17;
int idtype18;
val* var19 /* : AType */;
short int var20 /* : Bool */;
val* var21 /* : null */;
short int var22 /* : Bool */;
short int var23 /* : Bool */;
int cltype24;
int idtype25;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_kwdebug].val; /* _n_kwdebug on <self:ADebugTypeExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwdebug");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9825);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TKwdebug>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwdebug */
cltype = type_parser_nodes__TKwdebug.color;
idtype = type_parser_nodes__TKwdebug.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9828);
exit(1);
}
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_kwdebug].val = var_new_child; /* _n_kwdebug on <self:ADebugTypeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9831);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_kwtype].val; /* _n_kwtype on <self:ADebugTypeExpr> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwtype");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9835);
exit(1);
}
var6 = ((short int (*)(val*, val*))(var5->class->vft[COLOR_kernel__Object___61d_61d]))(var5, var_old_child) /* == on <var5:TKwtype>*/;
if (var6){
var7 = NULL;
if (var_new_child == NULL) {
var8 = 0; /* is null */
} else {
var8 = 1; /* arg is null and recv is not */
}
if (var8){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwtype */
cltype10 = type_parser_nodes__TKwtype.color;
idtype11 = type_parser_nodes__TKwtype.id;
if(cltype10 >= var_new_child->type->table_size) {
var9 = 0;
} else {
var9 = var_new_child->type->type_table[cltype10] == idtype11;
}
if (!var9) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9838);
exit(1);
}
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_kwtype].val = var_new_child; /* _n_kwtype on <self:ADebugTypeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9841);
exit(1);
}
goto RET_LABEL;
} else {
}
var12 = self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_expr].val; /* _n_expr on <self:ADebugTypeExpr> */
if (var12 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9845);
exit(1);
}
var13 = ((short int (*)(val*, val*))(var12->class->vft[COLOR_kernel__Object___61d_61d]))(var12, var_old_child) /* == on <var12:AExpr>*/;
if (var13){
var14 = NULL;
if (var_new_child == NULL) {
var15 = 0; /* is null */
} else {
var15 = 1; /* arg is null and recv is not */
}
if (var15){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype17 = type_parser_nodes__AExpr.color;
idtype18 = type_parser_nodes__AExpr.id;
if(cltype17 >= var_new_child->type->table_size) {
var16 = 0;
} else {
var16 = var_new_child->type->type_table[cltype17] == idtype18;
}
if (!var16) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9848);
exit(1);
}
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_expr].val = var_new_child; /* _n_expr on <self:ADebugTypeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9851);
exit(1);
}
goto RET_LABEL;
} else {
}
var19 = self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_type].val; /* _n_type on <self:ADebugTypeExpr> */
if (var19 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_type");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9855);
exit(1);
}
var20 = ((short int (*)(val*, val*))(var19->class->vft[COLOR_kernel__Object___61d_61d]))(var19, var_old_child) /* == on <var19:AType>*/;
if (var20){
var21 = NULL;
if (var_new_child == NULL) {
var22 = 0; /* is null */
} else {
var22 = 1; /* arg is null and recv is not */
}
if (var22){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa AType */
cltype24 = type_parser_nodes__AType.color;
idtype25 = type_parser_nodes__AType.id;
if(cltype24 >= var_new_child->type->table_size) {
var23 = 0;
} else {
var23 = var_new_child->type->type_table[cltype24] == idtype25;
}
if (!var23) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9858);
exit(1);
}
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_type].val = var_new_child; /* _n_type on <self:ADebugTypeExpr> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9861);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ADebugTypeExpr__replace_child(val* self, val* p0, val* p1) {
parser_prod__ADebugTypeExpr__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#n_kwdebug= for (self: ADebugTypeExpr, TKwdebug) */
void parser_prod__ADebugTypeExpr__n_kwdebug_61d(val* self, val* p0) {
val* var_node /* var node: TKwdebug */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_kwdebug].val = var_node; /* _n_kwdebug on <self:ADebugTypeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwdebug>*/;
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#n_kwdebug= for (self: Object, TKwdebug) */
void VIRTUAL_parser_prod__ADebugTypeExpr__n_kwdebug_61d(val* self, val* p0) {
parser_prod__ADebugTypeExpr__n_kwdebug_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#n_kwtype= for (self: ADebugTypeExpr, TKwtype) */
void parser_prod__ADebugTypeExpr__n_kwtype_61d(val* self, val* p0) {
val* var_node /* var node: TKwtype */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_kwtype].val = var_node; /* _n_kwtype on <self:ADebugTypeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwtype>*/;
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#n_kwtype= for (self: Object, TKwtype) */
void VIRTUAL_parser_prod__ADebugTypeExpr__n_kwtype_61d(val* self, val* p0) {
parser_prod__ADebugTypeExpr__n_kwtype_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#n_expr= for (self: ADebugTypeExpr, AExpr) */
void parser_prod__ADebugTypeExpr__n_expr_61d(val* self, val* p0) {
val* var_node /* var node: AExpr */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_expr].val = var_node; /* _n_expr on <self:ADebugTypeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AExpr>*/;
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#n_expr= for (self: Object, AExpr) */
void VIRTUAL_parser_prod__ADebugTypeExpr__n_expr_61d(val* self, val* p0) {
parser_prod__ADebugTypeExpr__n_expr_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#n_type= for (self: ADebugTypeExpr, AType) */
void parser_prod__ADebugTypeExpr__n_type_61d(val* self, val* p0) {
val* var_node /* var node: AType */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_type].val = var_node; /* _n_type on <self:ADebugTypeExpr> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:AType>*/;
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#n_type= for (self: Object, AType) */
void VIRTUAL_parser_prod__ADebugTypeExpr__n_type_61d(val* self, val* p0) {
parser_prod__ADebugTypeExpr__n_type_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#visit_all for (self: ADebugTypeExpr, Visitor) */
void parser_prod__ADebugTypeExpr__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TKwdebug */;
val* var1 /* : TKwtype */;
val* var2 /* : AExpr */;
val* var3 /* : AType */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_kwdebug].val; /* _n_kwdebug on <self:ADebugTypeExpr> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwdebug");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9891);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_kwtype].val; /* _n_kwtype on <self:ADebugTypeExpr> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwtype");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9892);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var1) /* enter_visit on <var_v:Visitor>*/;
var2 = self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_expr].val; /* _n_expr on <self:ADebugTypeExpr> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_expr");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9893);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var2) /* enter_visit on <var_v:Visitor>*/;
var3 = self->attrs[COLOR_parser_nodes__ADebugTypeExpr___n_type].val; /* _n_type on <self:ADebugTypeExpr> */
if (var3 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_type");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9894);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var3) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#ADebugTypeExpr#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ADebugTypeExpr__visit_all(val* self, val* p0) {
parser_prod__ADebugTypeExpr__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AListExprs#empty_init for (self: AListExprs) */
void parser_prod__AListExprs__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AListExprs#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AListExprs__empty_init(val* self) {
parser_prod__AListExprs__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AListExprs#init_alistexprs for (self: AListExprs, Collection[Object]) */
void parser_prod__AListExprs__init_alistexprs(val* self, val* p0) {
val* var_n_exprs /* var n_exprs: Collection[Object] */;
val* var /* : Iterator[nullable Object] */;
short int var1 /* : Bool */;
val* var2 /* : nullable Object */;
val* var_n /* var n: Object */;
short int var3 /* : Bool */;
int cltype;
int idtype;
val* var4 /* : ANodes[AExpr] */;
var_n_exprs = p0;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AListExprs__empty_init]))(self) /* empty_init on <self:AListExprs>*/;
var = ((val* (*)(val*))(var_n_exprs->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_n_exprs) /* iterator on <var_n_exprs:Collection[Object]>*/;
for(;;) {
var1 = ((short int (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var) /* is_ok on <var:Iterator[nullable Object]>*/;
if(!var1) break;
var2 = ((val* (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__item]))(var) /* item on <var:Iterator[nullable Object]>*/;
var_n = var2;
/* <var_n:Object> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_n->type->table_size) {
var3 = 0;
} else {
var3 = var_n->type->type_table[cltype] == idtype;
}
if (!var3) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9906);
exit(1);
}
var4 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AListExprs> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9907);
exit(1);
}
((void (*)(val*, val*))(var4->class->vft[COLOR_abstract_collection__SimpleCollection__add]))(var4, var_n) /* add on <var4:ANodes[AExpr]>*/;
((void (*)(val*, val*))(var_n->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n, self) /* parent= on <var_n:Object(AExpr)>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__next]))(var) /* next on <var:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
RET_LABEL:;
}
/* method parser_prod#AListExprs#init_alistexprs for (self: Object, Collection[Object]) */
void VIRTUAL_parser_prod__AListExprs__init_alistexprs(val* self, val* p0) {
parser_prod__AListExprs__init_alistexprs(self, p0);
RET_LABEL:;
}
/* method parser_prod#AListExprs#replace_child for (self: AListExprs, ANode, nullable ANode) */
void parser_prod__AListExprs__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : Range[Int] */;
long var1 /* : Int */;
val* var2 /* : ANodes[AExpr] */;
long var3 /* : Int */;
val* var4 /* : Discrete */;
val* var5 /* : Discrete */;
val* var6 /* : Iterator[nullable Object] */;
short int var7 /* : Bool */;
val* var8 /* : nullable Object */;
long var_i /* var i: Int */;
long var9 /* : Int */;
val* var10 /* : ANodes[AExpr] */;
val* var11 /* : nullable Object */;
short int var12 /* : Bool */;
val* var13 /* : null */;
short int var14 /* : Bool */;
short int var15 /* : Bool */;
int cltype;
int idtype;
val* var16 /* : ANodes[AExpr] */;
val* var17 /* : ANodes[AExpr] */;
var_old_child = p0;
var_new_child = p1;
var = NEW_range__Range(&type_range__Rangekernel__Int);
var1 = 0;
var2 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AListExprs> */
if (var2 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9914);
exit(1);
}
var3 = ((long (*)(val*))(var2->class->vft[COLOR_abstract_collection__Collection__length]))(var2) /* length on <var2:ANodes[AExpr]>*/;
var4 = BOX_kernel__Int(var1); /* autobox from Int to Discrete */
var5 = BOX_kernel__Int(var3); /* autobox from Int to Discrete */
((void (*)(val*, val*, val*))(var->class->vft[COLOR_range__Range__without_last]))(var, var4, var5) /* without_last on <var:Range[Int]>*/;
CHECK_NEW_range__Range(var);
var6 = ((val* (*)(val*))(var->class->vft[COLOR_abstract_collection__Collection__iterator]))(var) /* iterator on <var:Range[Int]>*/;
for(;;) {
var7 = ((short int (*)(val*))(var6->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var6) /* is_ok on <var6:Iterator[nullable Object]>*/;
if(!var7) break;
var8 = ((val* (*)(val*))(var6->class->vft[COLOR_abstract_collection__Iterator__item]))(var6) /* item on <var6:Iterator[nullable Object]>*/;
var9 = ((struct instance_kernel__Int*)var8)->value; /* autounbox from nullable Object to Int */;
var_i = var9;
var10 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AListExprs> */
if (var10 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9915);
exit(1);
}
var11 = ((val* (*)(val*, long))(var10->class->vft[COLOR_abstract_collection__SequenceRead___91d_93d]))(var10, var_i) /* [] on <var10:ANodes[AExpr]>*/;
var12 = ((short int (*)(val*, val*))(var11->class->vft[COLOR_kernel__Object___61d_61d]))(var11, var_old_child) /* == on <var11:nullable Object(AExpr)>*/;
if (var12){
var13 = NULL;
if (var_new_child == NULL) {
var14 = 0; /* is null */
} else {
var14 = 1; /* arg is null and recv is not */
}
if (var14){
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_new_child->type->table_size) {
var15 = 0;
} else {
var15 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var15) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9917);
exit(1);
}
var16 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AListExprs> */
if (var16 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9918);
exit(1);
}
((void (*)(val*, long, val*))(var16->class->vft[COLOR_abstract_collection__Sequence___91d_93d_61d]))(var16, var_i, var_new_child) /* []= on <var16:ANodes[AExpr]>*/;
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(AExpr)>*/;
} else {
var17 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AListExprs> */
if (var17 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9921);
exit(1);
}
((void (*)(val*, long))(var17->class->vft[COLOR_abstract_collection__Sequence__remove_at]))(var17, var_i) /* remove_at on <var17:ANodes[AExpr]>*/;
}
goto RET_LABEL;
} else {
}
CONTINUE_label: (void)0;
((void (*)(val*))(var6->class->vft[COLOR_abstract_collection__Iterator__next]))(var6) /* next on <var6:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
RET_LABEL:;
}
/* method parser_prod#AListExprs#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AListExprs__replace_child(val* self, val* p0, val* p1) {
parser_prod__AListExprs__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AListExprs#visit_all for (self: AListExprs, Visitor) */
void parser_prod__AListExprs__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : ANodes[AExpr] */;
val* var1 /* : Iterator[nullable Object] */;
short int var2 /* : Bool */;
val* var3 /* : nullable Object */;
val* var_n /* var n: AExpr */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AListExprs> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9932);
exit(1);
}
var1 = ((val* (*)(val*))(var->class->vft[COLOR_abstract_collection__Collection__iterator]))(var) /* iterator on <var:ANodes[AExpr]>*/;
for(;;) {
var2 = ((short int (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var1) /* is_ok on <var1:Iterator[nullable Object]>*/;
if(!var2) break;
var3 = ((val* (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__item]))(var1) /* item on <var1:Iterator[nullable Object]>*/;
var_n = var3;
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var_n) /* enter_visit on <var_v:Visitor>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__next]))(var1) /* next on <var1:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
RET_LABEL:;
}
/* method parser_prod#AListExprs#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AListExprs__visit_all(val* self, val* p0) {
parser_prod__AListExprs__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AParExprs#empty_init for (self: AParExprs) */
void parser_prod__AParExprs__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AParExprs#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AParExprs__empty_init(val* self) {
parser_prod__AParExprs__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AParExprs#init_aparexprs for (self: AParExprs, nullable TOpar, Collection[Object], nullable TCpar) */
void parser_prod__AParExprs__init_aparexprs(val* self, val* p0, val* p1, val* p2) {
val* var_n_opar /* var n_opar: nullable TOpar */;
val* var_n_exprs /* var n_exprs: Collection[Object] */;
val* var_n_cpar /* var n_cpar: nullable TCpar */;
val* var /* : Iterator[nullable Object] */;
short int var1 /* : Bool */;
val* var2 /* : nullable Object */;
val* var_n /* var n: Object */;
short int var3 /* : Bool */;
int cltype;
int idtype;
val* var4 /* : ANodes[AExpr] */;
var_n_opar = p0;
var_n_exprs = p1;
var_n_cpar = p2;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AParExprs__empty_init]))(self) /* empty_init on <self:AParExprs>*/;
if (var_n_opar == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9947);
exit(1);
}
self->attrs[COLOR_parser_nodes__AParExprs___n_opar].val = var_n_opar; /* _n_opar on <self:AParExprs> */
if (var_n_opar == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9948);
exit(1);
} else {
((void (*)(val*, val*))(var_n_opar->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_opar, self) /* parent= on <var_n_opar:nullable TOpar>*/;
}
var = ((val* (*)(val*))(var_n_exprs->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_n_exprs) /* iterator on <var_n_exprs:Collection[Object]>*/;
for(;;) {
var1 = ((short int (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var) /* is_ok on <var:Iterator[nullable Object]>*/;
if(!var1) break;
var2 = ((val* (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__item]))(var) /* item on <var:Iterator[nullable Object]>*/;
var_n = var2;
/* <var_n:Object> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_n->type->table_size) {
var3 = 0;
} else {
var3 = var_n->type->type_table[cltype] == idtype;
}
if (!var3) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9950);
exit(1);
}
var4 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AParExprs> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9951);
exit(1);
}
((void (*)(val*, val*))(var4->class->vft[COLOR_abstract_collection__SimpleCollection__add]))(var4, var_n) /* add on <var4:ANodes[AExpr]>*/;
((void (*)(val*, val*))(var_n->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n, self) /* parent= on <var_n:Object(AExpr)>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__next]))(var) /* next on <var:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
if (var_n_cpar == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9954);
exit(1);
}
self->attrs[COLOR_parser_nodes__AParExprs___n_cpar].val = var_n_cpar; /* _n_cpar on <self:AParExprs> */
if (var_n_cpar == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9955);
exit(1);
} else {
((void (*)(val*, val*))(var_n_cpar->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_cpar, self) /* parent= on <var_n_cpar:nullable TCpar>*/;
}
RET_LABEL:;
}
/* method parser_prod#AParExprs#init_aparexprs for (self: Object, nullable TOpar, Collection[Object], nullable TCpar) */
void VIRTUAL_parser_prod__AParExprs__init_aparexprs(val* self, val* p0, val* p1, val* p2) {
parser_prod__AParExprs__init_aparexprs(self, p0, p1, p2);
RET_LABEL:;
}
/* method parser_prod#AParExprs#replace_child for (self: AParExprs, ANode, nullable ANode) */
void parser_prod__AParExprs__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TOpar */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : Range[Int] */;
long var6 /* : Int */;
val* var7 /* : ANodes[AExpr] */;
long var8 /* : Int */;
val* var9 /* : Discrete */;
val* var10 /* : Discrete */;
val* var11 /* : Iterator[nullable Object] */;
short int var12 /* : Bool */;
val* var13 /* : nullable Object */;
long var_i /* var i: Int */;
long var14 /* : Int */;
val* var15 /* : ANodes[AExpr] */;
val* var16 /* : nullable Object */;
short int var17 /* : Bool */;
val* var18 /* : null */;
short int var19 /* : Bool */;
short int var20 /* : Bool */;
int cltype21;
int idtype22;
val* var23 /* : ANodes[AExpr] */;
val* var24 /* : ANodes[AExpr] */;
val* var25 /* : TCpar */;
short int var26 /* : Bool */;
val* var27 /* : null */;
short int var28 /* : Bool */;
short int var29 /* : Bool */;
int cltype30;
int idtype31;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AParExprs___n_opar].val; /* _n_opar on <self:AParExprs> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_opar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9960);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TOpar>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TOpar */
cltype = type_parser_nodes__TOpar.color;
idtype = type_parser_nodes__TOpar.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9963);
exit(1);
}
self->attrs[COLOR_parser_nodes__AParExprs___n_opar].val = var_new_child; /* _n_opar on <self:AParExprs> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9966);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = NEW_range__Range(&type_range__Rangekernel__Int);
var6 = 0;
var7 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AParExprs> */
if (var7 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9970);
exit(1);
}
var8 = ((long (*)(val*))(var7->class->vft[COLOR_abstract_collection__Collection__length]))(var7) /* length on <var7:ANodes[AExpr]>*/;
var9 = BOX_kernel__Int(var6); /* autobox from Int to Discrete */
var10 = BOX_kernel__Int(var8); /* autobox from Int to Discrete */
((void (*)(val*, val*, val*))(var5->class->vft[COLOR_range__Range__without_last]))(var5, var9, var10) /* without_last on <var5:Range[Int]>*/;
CHECK_NEW_range__Range(var5);
var11 = ((val* (*)(val*))(var5->class->vft[COLOR_abstract_collection__Collection__iterator]))(var5) /* iterator on <var5:Range[Int]>*/;
for(;;) {
var12 = ((short int (*)(val*))(var11->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var11) /* is_ok on <var11:Iterator[nullable Object]>*/;
if(!var12) break;
var13 = ((val* (*)(val*))(var11->class->vft[COLOR_abstract_collection__Iterator__item]))(var11) /* item on <var11:Iterator[nullable Object]>*/;
var14 = ((struct instance_kernel__Int*)var13)->value; /* autounbox from nullable Object to Int */;
var_i = var14;
var15 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AParExprs> */
if (var15 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9971);
exit(1);
}
var16 = ((val* (*)(val*, long))(var15->class->vft[COLOR_abstract_collection__SequenceRead___91d_93d]))(var15, var_i) /* [] on <var15:ANodes[AExpr]>*/;
var17 = ((short int (*)(val*, val*))(var16->class->vft[COLOR_kernel__Object___61d_61d]))(var16, var_old_child) /* == on <var16:nullable Object(AExpr)>*/;
if (var17){
var18 = NULL;
if (var_new_child == NULL) {
var19 = 0; /* is null */
} else {
var19 = 1; /* arg is null and recv is not */
}
if (var19){
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype21 = type_parser_nodes__AExpr.color;
idtype22 = type_parser_nodes__AExpr.id;
if(cltype21 >= var_new_child->type->table_size) {
var20 = 0;
} else {
var20 = var_new_child->type->type_table[cltype21] == idtype22;
}
if (!var20) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9973);
exit(1);
}
var23 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AParExprs> */
if (var23 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9974);
exit(1);
}
((void (*)(val*, long, val*))(var23->class->vft[COLOR_abstract_collection__Sequence___91d_93d_61d]))(var23, var_i, var_new_child) /* []= on <var23:ANodes[AExpr]>*/;
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(AExpr)>*/;
} else {
var24 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AParExprs> */
if (var24 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9977);
exit(1);
}
((void (*)(val*, long))(var24->class->vft[COLOR_abstract_collection__Sequence__remove_at]))(var24, var_i) /* remove_at on <var24:ANodes[AExpr]>*/;
}
goto RET_LABEL;
} else {
}
CONTINUE_label: (void)0;
((void (*)(val*))(var11->class->vft[COLOR_abstract_collection__Iterator__next]))(var11) /* next on <var11:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
var25 = self->attrs[COLOR_parser_nodes__AParExprs___n_cpar].val; /* _n_cpar on <self:AParExprs> */
if (var25 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cpar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9982);
exit(1);
}
var26 = ((short int (*)(val*, val*))(var25->class->vft[COLOR_kernel__Object___61d_61d]))(var25, var_old_child) /* == on <var25:TCpar>*/;
if (var26){
var27 = NULL;
if (var_new_child == NULL) {
var28 = 0; /* is null */
} else {
var28 = 1; /* arg is null and recv is not */
}
if (var28){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TCpar */
cltype30 = type_parser_nodes__TCpar.color;
idtype31 = type_parser_nodes__TCpar.id;
if(cltype30 >= var_new_child->type->table_size) {
var29 = 0;
} else {
var29 = var_new_child->type->type_table[cltype30] == idtype31;
}
if (!var29) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9985);
exit(1);
}
self->attrs[COLOR_parser_nodes__AParExprs___n_cpar].val = var_new_child; /* _n_cpar on <self:AParExprs> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 9988);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AParExprs#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AParExprs__replace_child(val* self, val* p0, val* p1) {
parser_prod__AParExprs__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AParExprs#n_opar= for (self: AParExprs, TOpar) */
void parser_prod__AParExprs__n_opar_61d(val* self, val* p0) {
val* var_node /* var node: TOpar */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AParExprs___n_opar].val = var_node; /* _n_opar on <self:AParExprs> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TOpar>*/;
RET_LABEL:;
}
/* method parser_prod#AParExprs#n_opar= for (self: Object, TOpar) */
void VIRTUAL_parser_prod__AParExprs__n_opar_61d(val* self, val* p0) {
parser_prod__AParExprs__n_opar_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AParExprs#n_cpar= for (self: AParExprs, TCpar) */
void parser_prod__AParExprs__n_cpar_61d(val* self, val* p0) {
val* var_node /* var node: TCpar */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AParExprs___n_cpar].val = var_node; /* _n_cpar on <self:AParExprs> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TCpar>*/;
RET_LABEL:;
}
/* method parser_prod#AParExprs#n_cpar= for (self: Object, TCpar) */
void VIRTUAL_parser_prod__AParExprs__n_cpar_61d(val* self, val* p0) {
parser_prod__AParExprs__n_cpar_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AParExprs#visit_all for (self: AParExprs, Visitor) */
void parser_prod__AParExprs__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TOpar */;
val* var1 /* : ANodes[AExpr] */;
val* var2 /* : Iterator[nullable Object] */;
short int var3 /* : Bool */;
val* var4 /* : nullable Object */;
val* var_n /* var n: AExpr */;
val* var5 /* : TCpar */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AParExprs___n_opar].val; /* _n_opar on <self:AParExprs> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_opar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10008);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:AParExprs> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10009);
exit(1);
}
var2 = ((val* (*)(val*))(var1->class->vft[COLOR_abstract_collection__Collection__iterator]))(var1) /* iterator on <var1:ANodes[AExpr]>*/;
for(;;) {
var3 = ((short int (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var2) /* is_ok on <var2:Iterator[nullable Object]>*/;
if(!var3) break;
var4 = ((val* (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__item]))(var2) /* item on <var2:Iterator[nullable Object]>*/;
var_n = var4;
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var_n) /* enter_visit on <var_v:Visitor>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__next]))(var2) /* next on <var2:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
var5 = self->attrs[COLOR_parser_nodes__AParExprs___n_cpar].val; /* _n_cpar on <self:AParExprs> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cpar");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10012);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var5) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AParExprs#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AParExprs__visit_all(val* self, val* p0) {
parser_prod__AParExprs__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraExprs#empty_init for (self: ABraExprs) */
void parser_prod__ABraExprs__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ABraExprs#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ABraExprs__empty_init(val* self) {
parser_prod__ABraExprs__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ABraExprs#init_abraexprs for (self: ABraExprs, nullable TObra, Collection[Object], nullable TCbra) */
void parser_prod__ABraExprs__init_abraexprs(val* self, val* p0, val* p1, val* p2) {
val* var_n_obra /* var n_obra: nullable TObra */;
val* var_n_exprs /* var n_exprs: Collection[Object] */;
val* var_n_cbra /* var n_cbra: nullable TCbra */;
val* var /* : Iterator[nullable Object] */;
short int var1 /* : Bool */;
val* var2 /* : nullable Object */;
val* var_n /* var n: Object */;
short int var3 /* : Bool */;
int cltype;
int idtype;
val* var4 /* : ANodes[AExpr] */;
var_n_obra = p0;
var_n_exprs = p1;
var_n_cbra = p2;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ABraExprs__empty_init]))(self) /* empty_init on <self:ABraExprs>*/;
if (var_n_obra == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10025);
exit(1);
}
self->attrs[COLOR_parser_nodes__ABraExprs___n_obra].val = var_n_obra; /* _n_obra on <self:ABraExprs> */
if (var_n_obra == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10026);
exit(1);
} else {
((void (*)(val*, val*))(var_n_obra->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_obra, self) /* parent= on <var_n_obra:nullable TObra>*/;
}
var = ((val* (*)(val*))(var_n_exprs->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_n_exprs) /* iterator on <var_n_exprs:Collection[Object]>*/;
for(;;) {
var1 = ((short int (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var) /* is_ok on <var:Iterator[nullable Object]>*/;
if(!var1) break;
var2 = ((val* (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__item]))(var) /* item on <var:Iterator[nullable Object]>*/;
var_n = var2;
/* <var_n:Object> isa AExpr */
cltype = type_parser_nodes__AExpr.color;
idtype = type_parser_nodes__AExpr.id;
if(cltype >= var_n->type->table_size) {
var3 = 0;
} else {
var3 = var_n->type->type_table[cltype] == idtype;
}
if (!var3) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10028);
exit(1);
}
var4 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:ABraExprs> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10029);
exit(1);
}
((void (*)(val*, val*))(var4->class->vft[COLOR_abstract_collection__SimpleCollection__add]))(var4, var_n) /* add on <var4:ANodes[AExpr]>*/;
((void (*)(val*, val*))(var_n->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n, self) /* parent= on <var_n:Object(AExpr)>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__next]))(var) /* next on <var:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
if (var_n_cbra == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10032);
exit(1);
}
self->attrs[COLOR_parser_nodes__ABraExprs___n_cbra].val = var_n_cbra; /* _n_cbra on <self:ABraExprs> */
if (var_n_cbra == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10033);
exit(1);
} else {
((void (*)(val*, val*))(var_n_cbra->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_cbra, self) /* parent= on <var_n_cbra:nullable TCbra>*/;
}
RET_LABEL:;
}
/* method parser_prod#ABraExprs#init_abraexprs for (self: Object, nullable TObra, Collection[Object], nullable TCbra) */
void VIRTUAL_parser_prod__ABraExprs__init_abraexprs(val* self, val* p0, val* p1, val* p2) {
parser_prod__ABraExprs__init_abraexprs(self, p0, p1, p2);
RET_LABEL:;
}
/* method parser_prod#ABraExprs#replace_child for (self: ABraExprs, ANode, nullable ANode) */
void parser_prod__ABraExprs__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TObra */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : Range[Int] */;
long var6 /* : Int */;
val* var7 /* : ANodes[AExpr] */;
long var8 /* : Int */;
val* var9 /* : Discrete */;
val* var10 /* : Discrete */;
val* var11 /* : Iterator[nullable Object] */;
short int var12 /* : Bool */;
val* var13 /* : nullable Object */;
long var_i /* var i: Int */;
long var14 /* : Int */;
val* var15 /* : ANodes[AExpr] */;
val* var16 /* : nullable Object */;
short int var17 /* : Bool */;
val* var18 /* : null */;
short int var19 /* : Bool */;
short int var20 /* : Bool */;
int cltype21;
int idtype22;
val* var23 /* : ANodes[AExpr] */;
val* var24 /* : ANodes[AExpr] */;
val* var25 /* : TCbra */;
short int var26 /* : Bool */;
val* var27 /* : null */;
short int var28 /* : Bool */;
short int var29 /* : Bool */;
int cltype30;
int idtype31;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__ABraExprs___n_obra].val; /* _n_obra on <self:ABraExprs> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_obra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10038);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TObra>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TObra */
cltype = type_parser_nodes__TObra.color;
idtype = type_parser_nodes__TObra.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10041);
exit(1);
}
self->attrs[COLOR_parser_nodes__ABraExprs___n_obra].val = var_new_child; /* _n_obra on <self:ABraExprs> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10044);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = NEW_range__Range(&type_range__Rangekernel__Int);
var6 = 0;
var7 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:ABraExprs> */
if (var7 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10048);
exit(1);
}
var8 = ((long (*)(val*))(var7->class->vft[COLOR_abstract_collection__Collection__length]))(var7) /* length on <var7:ANodes[AExpr]>*/;
var9 = BOX_kernel__Int(var6); /* autobox from Int to Discrete */
var10 = BOX_kernel__Int(var8); /* autobox from Int to Discrete */
((void (*)(val*, val*, val*))(var5->class->vft[COLOR_range__Range__without_last]))(var5, var9, var10) /* without_last on <var5:Range[Int]>*/;
CHECK_NEW_range__Range(var5);
var11 = ((val* (*)(val*))(var5->class->vft[COLOR_abstract_collection__Collection__iterator]))(var5) /* iterator on <var5:Range[Int]>*/;
for(;;) {
var12 = ((short int (*)(val*))(var11->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var11) /* is_ok on <var11:Iterator[nullable Object]>*/;
if(!var12) break;
var13 = ((val* (*)(val*))(var11->class->vft[COLOR_abstract_collection__Iterator__item]))(var11) /* item on <var11:Iterator[nullable Object]>*/;
var14 = ((struct instance_kernel__Int*)var13)->value; /* autounbox from nullable Object to Int */;
var_i = var14;
var15 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:ABraExprs> */
if (var15 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10049);
exit(1);
}
var16 = ((val* (*)(val*, long))(var15->class->vft[COLOR_abstract_collection__SequenceRead___91d_93d]))(var15, var_i) /* [] on <var15:ANodes[AExpr]>*/;
var17 = ((short int (*)(val*, val*))(var16->class->vft[COLOR_kernel__Object___61d_61d]))(var16, var_old_child) /* == on <var16:nullable Object(AExpr)>*/;
if (var17){
var18 = NULL;
if (var_new_child == NULL) {
var19 = 0; /* is null */
} else {
var19 = 1; /* arg is null and recv is not */
}
if (var19){
/* <var_new_child:nullable ANode(ANode)> isa AExpr */
cltype21 = type_parser_nodes__AExpr.color;
idtype22 = type_parser_nodes__AExpr.id;
if(cltype21 >= var_new_child->type->table_size) {
var20 = 0;
} else {
var20 = var_new_child->type->type_table[cltype21] == idtype22;
}
if (!var20) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10051);
exit(1);
}
var23 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:ABraExprs> */
if (var23 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10052);
exit(1);
}
((void (*)(val*, long, val*))(var23->class->vft[COLOR_abstract_collection__Sequence___91d_93d_61d]))(var23, var_i, var_new_child) /* []= on <var23:ANodes[AExpr]>*/;
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(AExpr)>*/;
} else {
var24 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:ABraExprs> */
if (var24 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10055);
exit(1);
}
((void (*)(val*, long))(var24->class->vft[COLOR_abstract_collection__Sequence__remove_at]))(var24, var_i) /* remove_at on <var24:ANodes[AExpr]>*/;
}
goto RET_LABEL;
} else {
}
CONTINUE_label: (void)0;
((void (*)(val*))(var11->class->vft[COLOR_abstract_collection__Iterator__next]))(var11) /* next on <var11:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
var25 = self->attrs[COLOR_parser_nodes__ABraExprs___n_cbra].val; /* _n_cbra on <self:ABraExprs> */
if (var25 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cbra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10060);
exit(1);
}
var26 = ((short int (*)(val*, val*))(var25->class->vft[COLOR_kernel__Object___61d_61d]))(var25, var_old_child) /* == on <var25:TCbra>*/;
if (var26){
var27 = NULL;
if (var_new_child == NULL) {
var28 = 0; /* is null */
} else {
var28 = 1; /* arg is null and recv is not */
}
if (var28){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TCbra */
cltype30 = type_parser_nodes__TCbra.color;
idtype31 = type_parser_nodes__TCbra.id;
if(cltype30 >= var_new_child->type->table_size) {
var29 = 0;
} else {
var29 = var_new_child->type->type_table[cltype30] == idtype31;
}
if (!var29) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10063);
exit(1);
}
self->attrs[COLOR_parser_nodes__ABraExprs___n_cbra].val = var_new_child; /* _n_cbra on <self:ABraExprs> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10066);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#ABraExprs#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__ABraExprs__replace_child(val* self, val* p0, val* p1) {
parser_prod__ABraExprs__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#ABraExprs#n_obra= for (self: ABraExprs, TObra) */
void parser_prod__ABraExprs__n_obra_61d(val* self, val* p0) {
val* var_node /* var node: TObra */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ABraExprs___n_obra].val = var_node; /* _n_obra on <self:ABraExprs> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TObra>*/;
RET_LABEL:;
}
/* method parser_prod#ABraExprs#n_obra= for (self: Object, TObra) */
void VIRTUAL_parser_prod__ABraExprs__n_obra_61d(val* self, val* p0) {
parser_prod__ABraExprs__n_obra_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraExprs#n_cbra= for (self: ABraExprs, TCbra) */
void parser_prod__ABraExprs__n_cbra_61d(val* self, val* p0) {
val* var_node /* var node: TCbra */;
var_node = p0;
self->attrs[COLOR_parser_nodes__ABraExprs___n_cbra].val = var_node; /* _n_cbra on <self:ABraExprs> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TCbra>*/;
RET_LABEL:;
}
/* method parser_prod#ABraExprs#n_cbra= for (self: Object, TCbra) */
void VIRTUAL_parser_prod__ABraExprs__n_cbra_61d(val* self, val* p0) {
parser_prod__ABraExprs__n_cbra_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#ABraExprs#visit_all for (self: ABraExprs, Visitor) */
void parser_prod__ABraExprs__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TObra */;
val* var1 /* : ANodes[AExpr] */;
val* var2 /* : Iterator[nullable Object] */;
short int var3 /* : Bool */;
val* var4 /* : nullable Object */;
val* var_n /* var n: AExpr */;
val* var5 /* : TCbra */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__ABraExprs___n_obra].val; /* _n_obra on <self:ABraExprs> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_obra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10086);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__AExprs___n_exprs].val; /* _n_exprs on <self:ABraExprs> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_exprs");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10087);
exit(1);
}
var2 = ((val* (*)(val*))(var1->class->vft[COLOR_abstract_collection__Collection__iterator]))(var1) /* iterator on <var1:ANodes[AExpr]>*/;
for(;;) {
var3 = ((short int (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var2) /* is_ok on <var2:Iterator[nullable Object]>*/;
if(!var3) break;
var4 = ((val* (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__item]))(var2) /* item on <var2:Iterator[nullable Object]>*/;
var_n = var4;
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var_n) /* enter_visit on <var_v:Visitor>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__next]))(var2) /* next on <var2:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
var5 = self->attrs[COLOR_parser_nodes__ABraExprs___n_cbra].val; /* _n_cbra on <self:ABraExprs> */
if (var5 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_cbra");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10090);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var5) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#ABraExprs#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__ABraExprs__visit_all(val* self, val* p0) {
parser_prod__ABraExprs__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#APlusAssignOp#empty_init for (self: APlusAssignOp) */
void parser_prod__APlusAssignOp__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#APlusAssignOp#empty_init for (self: Object) */
void VIRTUAL_parser_prod__APlusAssignOp__empty_init(val* self) {
parser_prod__APlusAssignOp__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#APlusAssignOp#init_aplusassignop for (self: APlusAssignOp, nullable TPluseq) */
void parser_prod__APlusAssignOp__init_aplusassignop(val* self, val* p0) {
val* var_n_pluseq /* var n_pluseq: nullable TPluseq */;
var_n_pluseq = p0;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__APlusAssignOp__empty_init]))(self) /* empty_init on <self:APlusAssignOp>*/;
if (var_n_pluseq == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10101);
exit(1);
}
self->attrs[COLOR_parser_nodes__APlusAssignOp___n_pluseq].val = var_n_pluseq; /* _n_pluseq on <self:APlusAssignOp> */
if (var_n_pluseq == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10102);
exit(1);
} else {
((void (*)(val*, val*))(var_n_pluseq->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_pluseq, self) /* parent= on <var_n_pluseq:nullable TPluseq>*/;
}
RET_LABEL:;
}
/* method parser_prod#APlusAssignOp#init_aplusassignop for (self: Object, nullable TPluseq) */
void VIRTUAL_parser_prod__APlusAssignOp__init_aplusassignop(val* self, val* p0) {
parser_prod__APlusAssignOp__init_aplusassignop(self, p0);
RET_LABEL:;
}
/* method parser_prod#APlusAssignOp#replace_child for (self: APlusAssignOp, ANode, nullable ANode) */
void parser_prod__APlusAssignOp__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TPluseq */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__APlusAssignOp___n_pluseq].val; /* _n_pluseq on <self:APlusAssignOp> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_pluseq");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10107);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TPluseq>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TPluseq */
cltype = type_parser_nodes__TPluseq.color;
idtype = type_parser_nodes__TPluseq.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10110);
exit(1);
}
self->attrs[COLOR_parser_nodes__APlusAssignOp___n_pluseq].val = var_new_child; /* _n_pluseq on <self:APlusAssignOp> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10113);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#APlusAssignOp#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__APlusAssignOp__replace_child(val* self, val* p0, val* p1) {
parser_prod__APlusAssignOp__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#APlusAssignOp#n_pluseq= for (self: APlusAssignOp, TPluseq) */
void parser_prod__APlusAssignOp__n_pluseq_61d(val* self, val* p0) {
val* var_node /* var node: TPluseq */;
var_node = p0;
self->attrs[COLOR_parser_nodes__APlusAssignOp___n_pluseq].val = var_node; /* _n_pluseq on <self:APlusAssignOp> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TPluseq>*/;
RET_LABEL:;
}
/* method parser_prod#APlusAssignOp#n_pluseq= for (self: Object, TPluseq) */
void VIRTUAL_parser_prod__APlusAssignOp__n_pluseq_61d(val* self, val* p0) {
parser_prod__APlusAssignOp__n_pluseq_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#APlusAssignOp#visit_all for (self: APlusAssignOp, Visitor) */
void parser_prod__APlusAssignOp__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TPluseq */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__APlusAssignOp___n_pluseq].val; /* _n_pluseq on <self:APlusAssignOp> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_pluseq");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10128);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#APlusAssignOp#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__APlusAssignOp__visit_all(val* self, val* p0) {
parser_prod__APlusAssignOp__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AMinusAssignOp#empty_init for (self: AMinusAssignOp) */
void parser_prod__AMinusAssignOp__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AMinusAssignOp#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AMinusAssignOp__empty_init(val* self) {
parser_prod__AMinusAssignOp__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AMinusAssignOp#init_aminusassignop for (self: AMinusAssignOp, nullable TMinuseq) */
void parser_prod__AMinusAssignOp__init_aminusassignop(val* self, val* p0) {
val* var_n_minuseq /* var n_minuseq: nullable TMinuseq */;
var_n_minuseq = p0;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AMinusAssignOp__empty_init]))(self) /* empty_init on <self:AMinusAssignOp>*/;
if (var_n_minuseq == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10139);
exit(1);
}
self->attrs[COLOR_parser_nodes__AMinusAssignOp___n_minuseq].val = var_n_minuseq; /* _n_minuseq on <self:AMinusAssignOp> */
if (var_n_minuseq == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10140);
exit(1);
} else {
((void (*)(val*, val*))(var_n_minuseq->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_minuseq, self) /* parent= on <var_n_minuseq:nullable TMinuseq>*/;
}
RET_LABEL:;
}
/* method parser_prod#AMinusAssignOp#init_aminusassignop for (self: Object, nullable TMinuseq) */
void VIRTUAL_parser_prod__AMinusAssignOp__init_aminusassignop(val* self, val* p0) {
parser_prod__AMinusAssignOp__init_aminusassignop(self, p0);
RET_LABEL:;
}
/* method parser_prod#AMinusAssignOp#replace_child for (self: AMinusAssignOp, ANode, nullable ANode) */
void parser_prod__AMinusAssignOp__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TMinuseq */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AMinusAssignOp___n_minuseq].val; /* _n_minuseq on <self:AMinusAssignOp> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_minuseq");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10145);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TMinuseq>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TMinuseq */
cltype = type_parser_nodes__TMinuseq.color;
idtype = type_parser_nodes__TMinuseq.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10148);
exit(1);
}
self->attrs[COLOR_parser_nodes__AMinusAssignOp___n_minuseq].val = var_new_child; /* _n_minuseq on <self:AMinusAssignOp> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10151);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AMinusAssignOp#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AMinusAssignOp__replace_child(val* self, val* p0, val* p1) {
parser_prod__AMinusAssignOp__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AMinusAssignOp#n_minuseq= for (self: AMinusAssignOp, TMinuseq) */
void parser_prod__AMinusAssignOp__n_minuseq_61d(val* self, val* p0) {
val* var_node /* var node: TMinuseq */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AMinusAssignOp___n_minuseq].val = var_node; /* _n_minuseq on <self:AMinusAssignOp> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TMinuseq>*/;
RET_LABEL:;
}
/* method parser_prod#AMinusAssignOp#n_minuseq= for (self: Object, TMinuseq) */
void VIRTUAL_parser_prod__AMinusAssignOp__n_minuseq_61d(val* self, val* p0) {
parser_prod__AMinusAssignOp__n_minuseq_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AMinusAssignOp#visit_all for (self: AMinusAssignOp, Visitor) */
void parser_prod__AMinusAssignOp__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TMinuseq */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AMinusAssignOp___n_minuseq].val; /* _n_minuseq on <self:AMinusAssignOp> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_minuseq");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10166);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AMinusAssignOp#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AMinusAssignOp__visit_all(val* self, val* p0) {
parser_prod__AMinusAssignOp__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AModuleName#empty_init for (self: AModuleName) */
void parser_prod__AModuleName__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AModuleName#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AModuleName__empty_init(val* self) {
parser_prod__AModuleName__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AModuleName#init_amodulename for (self: AModuleName, nullable TQuad, Collection[Object], nullable TId) */
void parser_prod__AModuleName__init_amodulename(val* self, val* p0, val* p1, val* p2) {
val* var_n_quad /* var n_quad: nullable TQuad */;
val* var_n_path /* var n_path: Collection[Object] */;
val* var_n_id /* var n_id: nullable TId */;
val* var /* : null */;
short int var1 /* : Bool */;
val* var2 /* : Iterator[nullable Object] */;
short int var3 /* : Bool */;
val* var4 /* : nullable Object */;
val* var_n /* var n: Object */;
short int var5 /* : Bool */;
int cltype;
int idtype;
val* var6 /* : ANodes[TId] */;
var_n_quad = p0;
var_n_path = p1;
var_n_id = p2;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AModuleName__empty_init]))(self) /* empty_init on <self:AModuleName>*/;
self->attrs[COLOR_parser_nodes__AModuleName___n_quad].val = var_n_quad; /* _n_quad on <self:AModuleName> */
var = NULL;
if (var_n_quad == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_n_quad->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_quad, self) /* parent= on <var_n_quad:nullable TQuad(TQuad)>*/;
} else {
}
var2 = ((val* (*)(val*))(var_n_path->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_n_path) /* iterator on <var_n_path:Collection[Object]>*/;
for(;;) {
var3 = ((short int (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var2) /* is_ok on <var2:Iterator[nullable Object]>*/;
if(!var3) break;
var4 = ((val* (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__item]))(var2) /* item on <var2:Iterator[nullable Object]>*/;
var_n = var4;
/* <var_n:Object> isa TId */
cltype = type_parser_nodes__TId.color;
idtype = type_parser_nodes__TId.id;
if(cltype >= var_n->type->table_size) {
var5 = 0;
} else {
var5 = var_n->type->type_table[cltype] == idtype;
}
if (!var5) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10184);
exit(1);
}
var6 = self->attrs[COLOR_parser_nodes__AModuleName___n_path].val; /* _n_path on <self:AModuleName> */
if (var6 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_path");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10185);
exit(1);
}
((void (*)(val*, val*))(var6->class->vft[COLOR_abstract_collection__SimpleCollection__add]))(var6, var_n) /* add on <var6:ANodes[TId]>*/;
((void (*)(val*, val*))(var_n->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n, self) /* parent= on <var_n:Object(TId)>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__next]))(var2) /* next on <var2:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
if (var_n_id == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10188);
exit(1);
}
self->attrs[COLOR_parser_nodes__AModuleName___n_id].val = var_n_id; /* _n_id on <self:AModuleName> */
if (var_n_id == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10189);
exit(1);
} else {
((void (*)(val*, val*))(var_n_id->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_id, self) /* parent= on <var_n_id:nullable TId>*/;
}
RET_LABEL:;
}
/* method parser_prod#AModuleName#init_amodulename for (self: Object, nullable TQuad, Collection[Object], nullable TId) */
void VIRTUAL_parser_prod__AModuleName__init_amodulename(val* self, val* p0, val* p1, val* p2) {
parser_prod__AModuleName__init_amodulename(self, p0, p1, p2);
RET_LABEL:;
}
/* method parser_prod#AModuleName#replace_child for (self: AModuleName, ANode, nullable ANode) */
void parser_prod__AModuleName__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : nullable TQuad */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : null */;
val* var6 /* : Range[Int] */;
long var7 /* : Int */;
val* var8 /* : ANodes[TId] */;
long var9 /* : Int */;
val* var10 /* : Discrete */;
val* var11 /* : Discrete */;
val* var12 /* : Iterator[nullable Object] */;
short int var13 /* : Bool */;
val* var14 /* : nullable Object */;
long var_i /* var i: Int */;
long var15 /* : Int */;
val* var16 /* : ANodes[TId] */;
val* var17 /* : nullable Object */;
short int var18 /* : Bool */;
val* var19 /* : null */;
short int var20 /* : Bool */;
short int var21 /* : Bool */;
int cltype22;
int idtype23;
val* var24 /* : ANodes[TId] */;
val* var25 /* : ANodes[TId] */;
val* var26 /* : TId */;
short int var27 /* : Bool */;
val* var28 /* : null */;
short int var29 /* : Bool */;
short int var30 /* : Bool */;
int cltype31;
int idtype32;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AModuleName___n_quad].val; /* _n_quad on <self:AModuleName> */
if (var == NULL) {
var1 = 0; /* <var_old_child:ANode> cannot be null */
} else {
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:nullable TQuad>*/;
}
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TQuad */
cltype = type_parser_nodes__TQuad.color;
idtype = type_parser_nodes__TQuad.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10197);
exit(1);
}
self->attrs[COLOR_parser_nodes__AModuleName___n_quad].val = var_new_child; /* _n_quad on <self:AModuleName> */
} else {
var5 = NULL;
self->attrs[COLOR_parser_nodes__AModuleName___n_quad].val = var5; /* _n_quad on <self:AModuleName> */
}
goto RET_LABEL;
} else {
}
var6 = NEW_range__Range(&type_range__Rangekernel__Int);
var7 = 0;
var8 = self->attrs[COLOR_parser_nodes__AModuleName___n_path].val; /* _n_path on <self:AModuleName> */
if (var8 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_path");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10204);
exit(1);
}
var9 = ((long (*)(val*))(var8->class->vft[COLOR_abstract_collection__Collection__length]))(var8) /* length on <var8:ANodes[TId]>*/;
var10 = BOX_kernel__Int(var7); /* autobox from Int to Discrete */
var11 = BOX_kernel__Int(var9); /* autobox from Int to Discrete */
((void (*)(val*, val*, val*))(var6->class->vft[COLOR_range__Range__without_last]))(var6, var10, var11) /* without_last on <var6:Range[Int]>*/;
CHECK_NEW_range__Range(var6);
var12 = ((val* (*)(val*))(var6->class->vft[COLOR_abstract_collection__Collection__iterator]))(var6) /* iterator on <var6:Range[Int]>*/;
for(;;) {
var13 = ((short int (*)(val*))(var12->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var12) /* is_ok on <var12:Iterator[nullable Object]>*/;
if(!var13) break;
var14 = ((val* (*)(val*))(var12->class->vft[COLOR_abstract_collection__Iterator__item]))(var12) /* item on <var12:Iterator[nullable Object]>*/;
var15 = ((struct instance_kernel__Int*)var14)->value; /* autounbox from nullable Object to Int */;
var_i = var15;
var16 = self->attrs[COLOR_parser_nodes__AModuleName___n_path].val; /* _n_path on <self:AModuleName> */
if (var16 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_path");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10205);
exit(1);
}
var17 = ((val* (*)(val*, long))(var16->class->vft[COLOR_abstract_collection__SequenceRead___91d_93d]))(var16, var_i) /* [] on <var16:ANodes[TId]>*/;
var18 = ((short int (*)(val*, val*))(var17->class->vft[COLOR_kernel__Object___61d_61d]))(var17, var_old_child) /* == on <var17:nullable Object(TId)>*/;
if (var18){
var19 = NULL;
if (var_new_child == NULL) {
var20 = 0; /* is null */
} else {
var20 = 1; /* arg is null and recv is not */
}
if (var20){
/* <var_new_child:nullable ANode(ANode)> isa TId */
cltype22 = type_parser_nodes__TId.color;
idtype23 = type_parser_nodes__TId.id;
if(cltype22 >= var_new_child->type->table_size) {
var21 = 0;
} else {
var21 = var_new_child->type->type_table[cltype22] == idtype23;
}
if (!var21) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10207);
exit(1);
}
var24 = self->attrs[COLOR_parser_nodes__AModuleName___n_path].val; /* _n_path on <self:AModuleName> */
if (var24 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_path");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10208);
exit(1);
}
((void (*)(val*, long, val*))(var24->class->vft[COLOR_abstract_collection__Sequence___91d_93d_61d]))(var24, var_i, var_new_child) /* []= on <var24:ANodes[TId]>*/;
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(TId)>*/;
} else {
var25 = self->attrs[COLOR_parser_nodes__AModuleName___n_path].val; /* _n_path on <self:AModuleName> */
if (var25 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_path");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10211);
exit(1);
}
((void (*)(val*, long))(var25->class->vft[COLOR_abstract_collection__Sequence__remove_at]))(var25, var_i) /* remove_at on <var25:ANodes[TId]>*/;
}
goto RET_LABEL;
} else {
}
CONTINUE_label: (void)0;
((void (*)(val*))(var12->class->vft[COLOR_abstract_collection__Iterator__next]))(var12) /* next on <var12:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
var26 = self->attrs[COLOR_parser_nodes__AModuleName___n_id].val; /* _n_id on <self:AModuleName> */
if (var26 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_id");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10216);
exit(1);
}
var27 = ((short int (*)(val*, val*))(var26->class->vft[COLOR_kernel__Object___61d_61d]))(var26, var_old_child) /* == on <var26:TId>*/;
if (var27){
var28 = NULL;
if (var_new_child == NULL) {
var29 = 0; /* is null */
} else {
var29 = 1; /* arg is null and recv is not */
}
if (var29){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TId */
cltype31 = type_parser_nodes__TId.color;
idtype32 = type_parser_nodes__TId.id;
if(cltype31 >= var_new_child->type->table_size) {
var30 = 0;
} else {
var30 = var_new_child->type->type_table[cltype31] == idtype32;
}
if (!var30) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10219);
exit(1);
}
self->attrs[COLOR_parser_nodes__AModuleName___n_id].val = var_new_child; /* _n_id on <self:AModuleName> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10222);
exit(1);
}
goto RET_LABEL;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AModuleName#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AModuleName__replace_child(val* self, val* p0, val* p1) {
parser_prod__AModuleName__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AModuleName#n_quad= for (self: AModuleName, nullable TQuad) */
void parser_prod__AModuleName__n_quad_61d(val* self, val* p0) {
val* var_node /* var node: nullable TQuad */;
val* var /* : null */;
short int var1 /* : Bool */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AModuleName___n_quad].val = var_node; /* _n_quad on <self:AModuleName> */
var = NULL;
if (var_node == NULL) {
var1 = 0; /* is null */
} else {
var1 = 1; /* arg is null and recv is not */
}
if (var1){
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:nullable TQuad(TQuad)>*/;
} else {
}
RET_LABEL:;
}
/* method parser_prod#AModuleName#n_quad= for (self: Object, nullable TQuad) */
void VIRTUAL_parser_prod__AModuleName__n_quad_61d(val* self, val* p0) {
parser_prod__AModuleName__n_quad_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AModuleName#n_id= for (self: AModuleName, TId) */
void parser_prod__AModuleName__n_id_61d(val* self, val* p0) {
val* var_node /* var node: TId */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AModuleName___n_id].val = var_node; /* _n_id on <self:AModuleName> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TId>*/;
RET_LABEL:;
}
/* method parser_prod#AModuleName#n_id= for (self: Object, TId) */
void VIRTUAL_parser_prod__AModuleName__n_id_61d(val* self, val* p0) {
parser_prod__AModuleName__n_id_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AModuleName#visit_all for (self: AModuleName, Visitor) */
void parser_prod__AModuleName__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : nullable TQuad */;
val* var1 /* : null */;
short int var2 /* : Bool */;
val* var3 /* : nullable TQuad */;
val* var4 /* : ANodes[TId] */;
val* var5 /* : Iterator[nullable Object] */;
short int var6 /* : Bool */;
val* var7 /* : nullable Object */;
val* var_n /* var n: TId */;
val* var8 /* : TId */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AModuleName___n_quad].val; /* _n_quad on <self:AModuleName> */
var1 = NULL;
if (var == NULL) {
var2 = 0; /* is null */
} else {
var2 = 1; /* arg is null and recv is not */
}
if (var2){
var3 = self->attrs[COLOR_parser_nodes__AModuleName___n_quad].val; /* _n_quad on <self:AModuleName> */
if (var3 == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10245);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var3) /* enter_visit on <var_v:Visitor>*/;
} else {
}
var4 = self->attrs[COLOR_parser_nodes__AModuleName___n_path].val; /* _n_path on <self:AModuleName> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_path");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10247);
exit(1);
}
var5 = ((val* (*)(val*))(var4->class->vft[COLOR_abstract_collection__Collection__iterator]))(var4) /* iterator on <var4:ANodes[TId]>*/;
for(;;) {
var6 = ((short int (*)(val*))(var5->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var5) /* is_ok on <var5:Iterator[nullable Object]>*/;
if(!var6) break;
var7 = ((val* (*)(val*))(var5->class->vft[COLOR_abstract_collection__Iterator__item]))(var5) /* item on <var5:Iterator[nullable Object]>*/;
var_n = var7;
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var_n) /* enter_visit on <var_v:Visitor>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var5->class->vft[COLOR_abstract_collection__Iterator__next]))(var5) /* next on <var5:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
var8 = self->attrs[COLOR_parser_nodes__AModuleName___n_id].val; /* _n_id on <self:AModuleName> */
if (var8 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_id");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10250);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var8) /* enter_visit on <var_v:Visitor>*/;
RET_LABEL:;
}
/* method parser_prod#AModuleName#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AModuleName__visit_all(val* self, val* p0) {
parser_prod__AModuleName__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AExternCalls#empty_init for (self: AExternCalls) */
void parser_prod__AExternCalls__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AExternCalls#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AExternCalls__empty_init(val* self) {
parser_prod__AExternCalls__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AExternCalls#init_aexterncalls for (self: AExternCalls, nullable TKwimport, Collection[Object]) */
void parser_prod__AExternCalls__init_aexterncalls(val* self, val* p0, val* p1) {
val* var_n_kwimport /* var n_kwimport: nullable TKwimport */;
val* var_n_extern_calls /* var n_extern_calls: Collection[Object] */;
val* var /* : Iterator[nullable Object] */;
short int var1 /* : Bool */;
val* var2 /* : nullable Object */;
val* var_n /* var n: Object */;
short int var3 /* : Bool */;
int cltype;
int idtype;
val* var4 /* : ANodes[AExternCall] */;
var_n_kwimport = p0;
var_n_extern_calls = p1;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AExternCalls__empty_init]))(self) /* empty_init on <self:AExternCalls>*/;
if (var_n_kwimport == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10262);
exit(1);
}
self->attrs[COLOR_parser_nodes__AExternCalls___n_kwimport].val = var_n_kwimport; /* _n_kwimport on <self:AExternCalls> */
if (var_n_kwimport == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10263);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwimport->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwimport, self) /* parent= on <var_n_kwimport:nullable TKwimport>*/;
}
var = ((val* (*)(val*))(var_n_extern_calls->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_n_extern_calls) /* iterator on <var_n_extern_calls:Collection[Object]>*/;
for(;;) {
var1 = ((short int (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var) /* is_ok on <var:Iterator[nullable Object]>*/;
if(!var1) break;
var2 = ((val* (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__item]))(var) /* item on <var:Iterator[nullable Object]>*/;
var_n = var2;
/* <var_n:Object> isa AExternCall */
cltype = type_parser_nodes__AExternCall.color;
idtype = type_parser_nodes__AExternCall.id;
if(cltype >= var_n->type->table_size) {
var3 = 0;
} else {
var3 = var_n->type->type_table[cltype] == idtype;
}
if (!var3) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10265);
exit(1);
}
var4 = self->attrs[COLOR_parser_nodes__AExternCalls___n_extern_calls].val; /* _n_extern_calls on <self:AExternCalls> */
if (var4 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_extern_calls");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10266);
exit(1);
}
((void (*)(val*, val*))(var4->class->vft[COLOR_abstract_collection__SimpleCollection__add]))(var4, var_n) /* add on <var4:ANodes[AExternCall]>*/;
((void (*)(val*, val*))(var_n->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n, self) /* parent= on <var_n:Object(AExternCall)>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var->class->vft[COLOR_abstract_collection__Iterator__next]))(var) /* next on <var:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
RET_LABEL:;
}
/* method parser_prod#AExternCalls#init_aexterncalls for (self: Object, nullable TKwimport, Collection[Object]) */
void VIRTUAL_parser_prod__AExternCalls__init_aexterncalls(val* self, val* p0, val* p1) {
parser_prod__AExternCalls__init_aexterncalls(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AExternCalls#replace_child for (self: AExternCalls, ANode, nullable ANode) */
void parser_prod__AExternCalls__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
val* var /* : TKwimport */;
short int var1 /* : Bool */;
val* var2 /* : null */;
short int var3 /* : Bool */;
short int var4 /* : Bool */;
int cltype;
int idtype;
val* var5 /* : Range[Int] */;
long var6 /* : Int */;
val* var7 /* : ANodes[AExternCall] */;
long var8 /* : Int */;
val* var9 /* : Discrete */;
val* var10 /* : Discrete */;
val* var11 /* : Iterator[nullable Object] */;
short int var12 /* : Bool */;
val* var13 /* : nullable Object */;
long var_i /* var i: Int */;
long var14 /* : Int */;
val* var15 /* : ANodes[AExternCall] */;
val* var16 /* : nullable Object */;
short int var17 /* : Bool */;
val* var18 /* : null */;
short int var19 /* : Bool */;
short int var20 /* : Bool */;
int cltype21;
int idtype22;
val* var23 /* : ANodes[AExternCall] */;
val* var24 /* : ANodes[AExternCall] */;
var_old_child = p0;
var_new_child = p1;
var = self->attrs[COLOR_parser_nodes__AExternCalls___n_kwimport].val; /* _n_kwimport on <self:AExternCalls> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwimport");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10273);
exit(1);
}
var1 = ((short int (*)(val*, val*))(var->class->vft[COLOR_kernel__Object___61d_61d]))(var, var_old_child) /* == on <var:TKwimport>*/;
if (var1){
var2 = NULL;
if (var_new_child == NULL) {
var3 = 0; /* is null */
} else {
var3 = 1; /* arg is null and recv is not */
}
if (var3){
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(ANode)>*/;
/* <var_new_child:nullable ANode(ANode)> isa TKwimport */
cltype = type_parser_nodes__TKwimport.color;
idtype = type_parser_nodes__TKwimport.id;
if(cltype >= var_new_child->type->table_size) {
var4 = 0;
} else {
var4 = var_new_child->type->type_table[cltype] == idtype;
}
if (!var4) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10276);
exit(1);
}
self->attrs[COLOR_parser_nodes__AExternCalls___n_kwimport].val = var_new_child; /* _n_kwimport on <self:AExternCalls> */
} else {
fprintf(stderr, "Runtime error: %s", "Aborted");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10279);
exit(1);
}
goto RET_LABEL;
} else {
}
var5 = NEW_range__Range(&type_range__Rangekernel__Int);
var6 = 0;
var7 = self->attrs[COLOR_parser_nodes__AExternCalls___n_extern_calls].val; /* _n_extern_calls on <self:AExternCalls> */
if (var7 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_extern_calls");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10283);
exit(1);
}
var8 = ((long (*)(val*))(var7->class->vft[COLOR_abstract_collection__Collection__length]))(var7) /* length on <var7:ANodes[AExternCall]>*/;
var9 = BOX_kernel__Int(var6); /* autobox from Int to Discrete */
var10 = BOX_kernel__Int(var8); /* autobox from Int to Discrete */
((void (*)(val*, val*, val*))(var5->class->vft[COLOR_range__Range__without_last]))(var5, var9, var10) /* without_last on <var5:Range[Int]>*/;
CHECK_NEW_range__Range(var5);
var11 = ((val* (*)(val*))(var5->class->vft[COLOR_abstract_collection__Collection__iterator]))(var5) /* iterator on <var5:Range[Int]>*/;
for(;;) {
var12 = ((short int (*)(val*))(var11->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var11) /* is_ok on <var11:Iterator[nullable Object]>*/;
if(!var12) break;
var13 = ((val* (*)(val*))(var11->class->vft[COLOR_abstract_collection__Iterator__item]))(var11) /* item on <var11:Iterator[nullable Object]>*/;
var14 = ((struct instance_kernel__Int*)var13)->value; /* autounbox from nullable Object to Int */;
var_i = var14;
var15 = self->attrs[COLOR_parser_nodes__AExternCalls___n_extern_calls].val; /* _n_extern_calls on <self:AExternCalls> */
if (var15 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_extern_calls");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10284);
exit(1);
}
var16 = ((val* (*)(val*, long))(var15->class->vft[COLOR_abstract_collection__SequenceRead___91d_93d]))(var15, var_i) /* [] on <var15:ANodes[AExternCall]>*/;
var17 = ((short int (*)(val*, val*))(var16->class->vft[COLOR_kernel__Object___61d_61d]))(var16, var_old_child) /* == on <var16:nullable Object(AExternCall)>*/;
if (var17){
var18 = NULL;
if (var_new_child == NULL) {
var19 = 0; /* is null */
} else {
var19 = 1; /* arg is null and recv is not */
}
if (var19){
/* <var_new_child:nullable ANode(ANode)> isa AExternCall */
cltype21 = type_parser_nodes__AExternCall.color;
idtype22 = type_parser_nodes__AExternCall.id;
if(cltype21 >= var_new_child->type->table_size) {
var20 = 0;
} else {
var20 = var_new_child->type->type_table[cltype21] == idtype22;
}
if (!var20) {
fprintf(stderr, "Runtime error: %s", "Assert failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10286);
exit(1);
}
var23 = self->attrs[COLOR_parser_nodes__AExternCalls___n_extern_calls].val; /* _n_extern_calls on <self:AExternCalls> */
if (var23 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_extern_calls");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10287);
exit(1);
}
((void (*)(val*, long, val*))(var23->class->vft[COLOR_abstract_collection__Sequence___91d_93d_61d]))(var23, var_i, var_new_child) /* []= on <var23:ANodes[AExternCall]>*/;
((void (*)(val*, val*))(var_new_child->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_new_child, self) /* parent= on <var_new_child:nullable ANode(AExternCall)>*/;
} else {
var24 = self->attrs[COLOR_parser_nodes__AExternCalls___n_extern_calls].val; /* _n_extern_calls on <self:AExternCalls> */
if (var24 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_extern_calls");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10290);
exit(1);
}
((void (*)(val*, long))(var24->class->vft[COLOR_abstract_collection__Sequence__remove_at]))(var24, var_i) /* remove_at on <var24:ANodes[AExternCall]>*/;
}
goto RET_LABEL;
} else {
}
CONTINUE_label: (void)0;
((void (*)(val*))(var11->class->vft[COLOR_abstract_collection__Iterator__next]))(var11) /* next on <var11:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
RET_LABEL:;
}
/* method parser_prod#AExternCalls#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AExternCalls__replace_child(val* self, val* p0, val* p1) {
parser_prod__AExternCalls__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AExternCalls#n_kwimport= for (self: AExternCalls, TKwimport) */
void parser_prod__AExternCalls__n_kwimport_61d(val* self, val* p0) {
val* var_node /* var node: TKwimport */;
var_node = p0;
self->attrs[COLOR_parser_nodes__AExternCalls___n_kwimport].val = var_node; /* _n_kwimport on <self:AExternCalls> */
((void (*)(val*, val*))(var_node->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_node, self) /* parent= on <var_node:TKwimport>*/;
RET_LABEL:;
}
/* method parser_prod#AExternCalls#n_kwimport= for (self: Object, TKwimport) */
void VIRTUAL_parser_prod__AExternCalls__n_kwimport_61d(val* self, val* p0) {
parser_prod__AExternCalls__n_kwimport_61d(self, p0);
RET_LABEL:;
}
/* method parser_prod#AExternCalls#visit_all for (self: AExternCalls, Visitor) */
void parser_prod__AExternCalls__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
val* var /* : TKwimport */;
val* var1 /* : ANodes[AExternCall] */;
val* var2 /* : Iterator[nullable Object] */;
short int var3 /* : Bool */;
val* var4 /* : nullable Object */;
val* var_n /* var n: AExternCall */;
var_v = p0;
var = self->attrs[COLOR_parser_nodes__AExternCalls___n_kwimport].val; /* _n_kwimport on <self:AExternCalls> */
if (var == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_kwimport");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10306);
exit(1);
}
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var) /* enter_visit on <var_v:Visitor>*/;
var1 = self->attrs[COLOR_parser_nodes__AExternCalls___n_extern_calls].val; /* _n_extern_calls on <self:AExternCalls> */
if (var1 == NULL) {
fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _n_extern_calls");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10307);
exit(1);
}
var2 = ((val* (*)(val*))(var1->class->vft[COLOR_abstract_collection__Collection__iterator]))(var1) /* iterator on <var1:ANodes[AExternCall]>*/;
for(;;) {
var3 = ((short int (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var2) /* is_ok on <var2:Iterator[nullable Object]>*/;
if(!var3) break;
var4 = ((val* (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__item]))(var2) /* item on <var2:Iterator[nullable Object]>*/;
var_n = var4;
((void (*)(val*, val*))(var_v->class->vft[COLOR_parser_nodes__Visitor__enter_visit]))(var_v, var_n) /* enter_visit on <var_v:Visitor>*/;
CONTINUE_label: (void)0;
((void (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__next]))(var2) /* next on <var2:Iterator[nullable Object]>*/;
}
BREAK_label: (void)0;
RET_LABEL:;
}
/* method parser_prod#AExternCalls#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AExternCalls__visit_all(val* self, val* p0) {
parser_prod__AExternCalls__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#AExternCall#empty_init for (self: AExternCall) */
void parser_prod__AExternCall__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#AExternCall#empty_init for (self: Object) */
void VIRTUAL_parser_prod__AExternCall__empty_init(val* self) {
parser_prod__AExternCall__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#AExternCall#init_aexterncall for (self: AExternCall) */
void parser_prod__AExternCall__init_aexterncall(val* self) {
((void (*)(val*))(self->class->vft[COLOR_parser_prod__AExternCall__empty_init]))(self) /* empty_init on <self:AExternCall>*/;
RET_LABEL:;
}
/* method parser_prod#AExternCall#init_aexterncall for (self: Object) */
void VIRTUAL_parser_prod__AExternCall__init_aexterncall(val* self) {
parser_prod__AExternCall__init_aexterncall(self);
RET_LABEL:;
}
/* method parser_prod#AExternCall#replace_child for (self: AExternCall, ANode, nullable ANode) */
void parser_prod__AExternCall__replace_child(val* self, val* p0, val* p1) {
val* var_old_child /* var old_child: ANode */;
val* var_new_child /* var new_child: nullable ANode */;
var_old_child = p0;
var_new_child = p1;
RET_LABEL:;
}
/* method parser_prod#AExternCall#replace_child for (self: Object, ANode, nullable ANode) */
void VIRTUAL_parser_prod__AExternCall__replace_child(val* self, val* p0, val* p1) {
parser_prod__AExternCall__replace_child(self, p0, p1);
RET_LABEL:;
}
/* method parser_prod#AExternCall#visit_all for (self: AExternCall, Visitor) */
void parser_prod__AExternCall__visit_all(val* self, val* p0) {
val* var_v /* var v: Visitor */;
var_v = p0;
RET_LABEL:;
}
/* method parser_prod#AExternCall#visit_all for (self: Object, Visitor) */
void VIRTUAL_parser_prod__AExternCall__visit_all(val* self, val* p0) {
parser_prod__AExternCall__visit_all(self, p0);
RET_LABEL:;
}
/* method parser_prod#ASuperExternCall#empty_init for (self: ASuperExternCall) */
void parser_prod__ASuperExternCall__empty_init(val* self) {
RET_LABEL:;
}
/* method parser_prod#ASuperExternCall#empty_init for (self: Object) */
void VIRTUAL_parser_prod__ASuperExternCall__empty_init(val* self) {
parser_prod__ASuperExternCall__empty_init(self);
RET_LABEL:;
}
/* method parser_prod#ASuperExternCall#init_asuperexterncall for (self: ASuperExternCall, nullable TKwsuper) */
void parser_prod__ASuperExternCall__init_asuperexterncall(val* self, val* p0) {
val* var_n_kwsuper /* var n_kwsuper: nullable TKwsuper */;
var_n_kwsuper = p0;
((void (*)(val*))(self->class->vft[COLOR_parser_prod__ASuperExternCall__empty_init]))(self) /* empty_init on <self:ASuperExternCall>*/;
if (var_n_kwsuper == NULL) {
fprintf(stderr, "Runtime error: %s", "Cast failed");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10338);
exit(1);
}
self->attrs[COLOR_parser_nodes__ASuperExternCall___n_kwsuper].val = var_n_kwsuper; /* _n_kwsuper on <self:ASuperExternCall> */
if (var_n_kwsuper == NULL) {
fprintf(stderr, "Runtime error: %s", "Reciever is null");
fprintf(stderr, " (%s:%d)\n", "src/parser/parser_prod.nit", 10339);
exit(1);
} else {
((void (*)(val*, val*))(var_n_kwsuper->class->vft[COLOR_parser_nodes__ANode__parent_61d]))(var_n_kwsuper, self) /* parent= on <var_n_kwsuper:nullable TKwsuper>*/;
}
RET_LABEL:;
}
/* method parser_prod#ASuperExternCall#init_asuperexterncall for (self: Object, nullable TKwsuper) */
void VIRTUAL_parser_prod__ASuperExternCall__init_asuperexterncall(val* self, val* p0) {
parser_prod__ASuperExternCall__init_asuperexterncall(self, p0);
RET_LABEL:;
}
|
Johann673/nit
|
c_src/parser_prod.sep.4.c
|
C
|
apache-2.0
| 419,245
|
package org.dasein.cloud.tier3.compute;
import javax.annotation.Nonnull;
import org.dasein.cloud.compute.AbstractComputeServices;
import org.dasein.cloud.compute.MachineImageSupport;
import org.dasein.cloud.compute.SnapshotSupport;
import org.dasein.cloud.compute.VirtualMachineSupport;
import org.dasein.cloud.tier3.Tier3;
import org.dasein.cloud.tier3.compute.image.Tier3Image;
import org.dasein.cloud.tier3.compute.snapshot.Tier3Snapshot;
import org.dasein.cloud.tier3.compute.vm.Tier3VM;
public class Tier3ComputeServices extends AbstractComputeServices {
private Tier3 provider;
public Tier3ComputeServices(@Nonnull Tier3 provider) {
this.provider = provider;
}
@Override
public boolean hasVirtualMachineSupport() {
return true;
}
@Override
public VirtualMachineSupport getVirtualMachineSupport() {
return new Tier3VM(provider);
}
@Override
public boolean hasImageSupport() {
return true;
}
@Override
public MachineImageSupport getImageSupport() {
return new Tier3Image(provider);
}
@Override
public boolean hasVolumeSupport() {
return false;
}
// @Override
// public VolumeSupport getVolumeSupport() {
// return new Tier3Storage(provider);
// }
@Override
public boolean hasAutoScalingSupport() {
return false;
}
@Override
public boolean hasSnapshotSupport() {
return false;
}
// @Override
// public SnapshotSupport getSnapshotSupport() {
// return new Tier3Snapshot(provider);
// }
}
|
greese/dasein-cloud-tier3
|
src/main/java/org/dasein/cloud/tier3/compute/Tier3ComputeServices.java
|
Java
|
apache-2.0
| 1,660
|
/*
* Copyright 2017 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.plugin.netty.interceptor;
import com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor;
import com.navercorp.pinpoint.bootstrap.context.AsyncContext;
import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;
import com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder;
import com.navercorp.pinpoint.bootstrap.context.Trace;
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor;
import com.navercorp.pinpoint.bootstrap.logging.PLogger;
import com.navercorp.pinpoint.bootstrap.logging.PLoggerFactory;
import com.navercorp.pinpoint.common.util.ArrayUtils;
import com.navercorp.pinpoint.plugin.netty.NettyConstants;
/**
* @author Taejin Koo
*/
public class ChannelPipelineWriteInterceptor implements AroundInterceptor {
private final PLogger logger = PLoggerFactory.getLogger(getClass());
private final boolean isDebug = logger.isDebugEnabled();
private final TraceContext traceContext;
private final MethodDescriptor descriptor;
public ChannelPipelineWriteInterceptor(TraceContext traceContext, MethodDescriptor descriptor) {
this.traceContext = traceContext;
this.descriptor = descriptor;
}
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, args);
}
if (!validate(args)) {
return;
}
Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
SpanEventRecorder recorder = trace.traceBlockBegin();
recorder.recordServiceType(NettyConstants.SERVICE_TYPE);
// Inner handler can run before after() method.
// If create AsyncContext in after() method, then there is a possibility that AsyncContext will be saved later than execution
// The write method returns an exception in the Future, so you do not needs to worry about to handle throwable field.
Object request = args[0];
if (isAsynchronousInvocation(request)) {
// set asynchronous trace
final AsyncContext asyncContext = recorder.recordNextAsyncContext();
((AsyncContextAccessor) request)._$PINPOINT$_setAsyncContext(asyncContext);
if (isDebug) {
logger.debug("Set AsyncContext {}", asyncContext);
}
}
}
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args);
}
if (!validate(args)) {
return;
}
Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
try {
SpanEventRecorder recorder = trace.currentSpanEventRecorder();
recorder.recordApi(descriptor);
recorder.recordException(throwable);
} finally {
trace.traceBlockEnd();
}
}
private boolean isAsynchronousInvocation(final Object request) {
if (!(request instanceof AsyncContextAccessor)) {
return false;
}
return true;
}
private boolean validate(Object[] args) {
if (ArrayUtils.isEmpty(args)) {
return false;
}
return true;
}
}
|
emeroad/pinpoint
|
plugins/netty/src/main/java/com/navercorp/pinpoint/plugin/netty/interceptor/ChannelPipelineWriteInterceptor.java
|
Java
|
apache-2.0
| 4,024
|
/**
* Copyright 2012 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.workbench.common.services.datamodeller.driver.impl.annotations;
import org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition;
import org.kie.workbench.common.services.datamodeller.core.impl.AbstractAnnotationDefinition;
import org.kie.workbench.common.services.datamodeller.core.impl.AnnotationValuePairDefinitionImpl;
@Deprecated
public class DescriptionAnnotationDefinition extends AbstractAnnotationDefinition {
public DescriptionAnnotationDefinition() {
super( org.kie.api.definition.type.Description.class.getName(), true, true);
addValuePair( new AnnotationValuePairDefinitionImpl( "value", String.class.getName(), AnnotationValuePairDefinition.ValuePairType.STRING, "" ) );
}
public static DescriptionAnnotationDefinition getInstance() {
return new DescriptionAnnotationDefinition();
}
}
|
nmirasch/kie-wb-common
|
kie-wb-common-services/kie-wb-common-data-modeller-core/src/main/java/org/kie/workbench/common/services/datamodeller/driver/impl/annotations/DescriptionAnnotationDefinition.java
|
Java
|
apache-2.0
| 1,479
|
/*
* Copyright 2019 Huawei Technologies Co.,Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.netflix.spinnaker.clouddriver.huaweicloud.client;
import com.huawei.openstack4j.api.OSClient;
import com.huawei.openstack4j.model.compute.ext.AvailabilityZone;
import com.huawei.openstack4j.openstack.ecs.v1.domain.Flavor;
import com.huawei.openstack4j.openstack.ims.v2.domain.Image;
import com.huawei.openstack4j.openstack.vpc.v1.domain.SecurityGroup;
import com.huawei.openstack4j.openstack.vpc.v1.domain.Subnet;
import com.huawei.openstack4j.openstack.vpc.v1.domain.Vpc;
import com.netflix.spinnaker.clouddriver.huaweicloud.exception.HuaweiCloudException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.Callable;
public class HuaweiCloudClientImpl implements HuaweiCloudClient {
private final AuthorizedClientProvider provider;
public HuaweiCloudClientImpl(AuthorizedClientProvider provider) {
this.provider = provider;
}
private static <T> T handleInvoking(String doWhat, Callable<T> closure, T defaultResult) {
try {
T r = closure.call();
return r == null ? defaultResult : r;
} catch (Exception e) {
throw new HuaweiCloudException(doWhat, e);
}
}
private static List emptyList() {
return Collections.emptyList();
}
private OSClient getRegionClient(String region) {
return this.provider.getAuthClient().useRegion(region);
}
@Override
public List<? extends AvailabilityZone> getZones(String region) throws HuaweiCloudException {
return handleInvoking(
String.format("getting zones in region(%s)", region),
() -> getRegionClient(region).compute().zones().list(),
emptyList());
}
@Override
public List<? extends Image> getImages(String region) throws HuaweiCloudException {
return handleInvoking(
String.format("getting images in region(%s)", region),
() ->
getRegionClient(region)
.imsV2()
.images()
.list(
new HashMap() {
{
put("__imagetype", "gold");
put("status", "active");
put("virtual_env_type", "FusionCompute");
}
}),
emptyList());
}
@Override
public List<? extends Flavor> getInstanceTypes(String region, String az)
throws HuaweiCloudException {
return handleInvoking(
String.format("getting flavors in availability zone(%s) of region(%s)", az, region),
() -> getRegionClient(region).ecs().servers().getSpecifications(az),
emptyList());
}
@Override
public List<? extends SecurityGroup> getSecurityGroups(String region)
throws HuaweiCloudException {
return handleInvoking(
String.format("getting all security groups in region(%s)", region),
() -> getRegionClient(region).vpc().securityGroups().list(),
emptyList());
}
@Override
public List<? extends Subnet> getSubnets(String region) throws HuaweiCloudException {
return handleInvoking(
String.format("getting all subnets in region(%s)", region),
() -> getRegionClient(region).vpc().subnets().list(),
emptyList());
}
@Override
public List<? extends Vpc> getVpcs(String region) throws HuaweiCloudException {
return handleInvoking(
String.format("getting all vpcs in region(%s)", region),
() -> getRegionClient(region).vpc().vpcs().list(),
emptyList());
}
}
|
ajordens/clouddriver
|
clouddriver-huaweicloud/src/main/java/com/netflix/spinnaker/clouddriver/huaweicloud/client/HuaweiCloudClientImpl.java
|
Java
|
apache-2.0
| 4,106
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Header <boost/algorithm/cxx11/find_if_not.hpp></title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../../../index.html" title="The Boost Algorithm Library">
<link rel="up" href="../../../../algorithm/reference.html" title="Reference">
<link rel="prev" href="../../../../boost/algorithm/copy_n.html" title="Function template copy_n">
<link rel="next" href="../../../../boost/algorithm/find_if_not_idp13874288.html" title="Function template find_if_not">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../../../boost/algorithm/copy_n.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../../algorithm/reference.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../../boost/algorithm/find_if_not_idp13874288.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="header.boost.algorithm.cxx11.find_if_not_hpp"></a>Header <<a href="../../../../../../../../boost/algorithm/cxx11/find_if_not.hpp" target="_top">boost/algorithm/cxx11/find_if_not.hpp</a>></h3></div></div></div>
<p>Find the first element in a sequence that does not satisfy a predicate. </p>
<p>Marshall Clow </p>
<p>
</p>
<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> InputIterator<span class="special">,</span> <span class="keyword">typename</span> Predicate<span class="special">></span>
<span class="identifier">InputIterator</span> <a class="link" href="../../../../boost/algorithm/find_if_not_idp13874288.html" title="Function template find_if_not"><span class="identifier">find_if_not</span></a><span class="special">(</span><span class="identifier">InputIterator</span><span class="special">,</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="identifier">Predicate</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Range<span class="special">,</span> <span class="keyword">typename</span> Predicate<span class="special">></span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special"><</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">></span><span class="special">::</span><span class="identifier">type</span>
<a class="link" href="../../../../boost/algorithm/find_if_not_idp13878144.html" title="Function template find_if_not"><span class="identifier">find_if_not</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">Predicate</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span></pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2010-2012 Marshall Clow<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../../../boost/algorithm/copy_n.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../../algorithm/reference.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../../boost/algorithm/find_if_not_idp13874288.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
|
ryancoleman/autodock-vina
|
boost_1_54_0/libs/algorithm/doc/html/header/boost/algorithm/cxx11/find_if_not_hpp.html
|
HTML
|
apache-2.0
| 5,493
|
템플릿 파일 명명 규칙
====================
* 파일 이름은 패키지(package)명을 제외한 해당 페이지의 기능으로 정하며 아래의 공통된 표현을 사용한다
신규: create
편집: edit
조회: view
목록: list
삭제: delete
* 신규(create)와 편집(edit)을 하나의 파일로 작성할 수 있을 때는 write로 한다
* 파일명은 카멜 표기법 ([CamelCase](http://en.wikipedia.org/wiki/CamelCase))을 준수한다
* 오류 페이지에 사용되는 템플릿 파일은 error 패키지 아래에 공통으로 위치시킨다
|
doortts/fork-yobi
|
docs/ko/technical/views-naming-guide.md
|
Markdown
|
apache-2.0
| 586
|
import contextlib
from django.core.exceptions import ValidationError as DjangoValidationError
# Remants from MODM days
# TODO: Remove usages of aliased Exceptions
ValidationError = DjangoValidationError
ValidationValueError = DjangoValidationError
ValidationTypeError = DjangoValidationError
class TokenError(Exception):
pass
class TokenHandlerNotFound(TokenError):
def __init__(self, action, *args, **kwargs):
super(TokenHandlerNotFound, self).__init__(*args, **kwargs)
self.action = action
class UnsupportedSanctionHandlerKind(Exception):
pass
class OSFError(Exception):
"""Base class for exceptions raised by the Osf application"""
pass
class NodeError(OSFError):
"""Raised when an action cannot be performed on a Node model"""
pass
class NodeStateError(NodeError):
"""Raised when the Node's state is not suitable for the requested action
Example: Node.remove_node() is called, but the node has non-deleted children
"""
pass
class UserStateError(OSFError):
"""Raised when the user's state is not suitable for the requested action
Example: user.gdpr_delete() is called, but the user has resources that cannot be deleted.
"""
pass
class SanctionTokenError(TokenError):
"""Base class for errors arising from the user of a sanction token."""
pass
class MaxRetriesError(OSFError):
"""Raised when an operation has been attempted a pre-determined number of times"""
pass
class InvalidSanctionRejectionToken(TokenError):
"""Raised if a Sanction subclass disapproval token submitted is invalid
or associated with another admin authorizer
"""
message_short = 'Invalid Token'
message_long = 'This disapproval link is invalid. Are you logged into the correct account?'
class InvalidSanctionApprovalToken(TokenError):
"""Raised if a Sanction subclass approval token submitted is invalid
or associated with another admin authorizer
"""
message_short = 'Invalid Token'
message_long = 'This approval link is invalid. Are you logged into the correct account?'
class InvalidTagError(OSFError):
"""Raised when attempting to perform an invalid operation on a tag"""
pass
class TagNotFoundError(OSFError):
"""Raised when attempting to perform an operation on an absent tag"""
pass
class UserNotAffiliatedError(OSFError):
"""Raised if a user attempts to add an institution that is not currently
one of its affiliations.
"""
message_short = 'User not affiliated'
message_long = 'This user is not affiliated with this institution.'
@contextlib.contextmanager
def reraise_django_validation_errors():
"""Context manager to reraise DjangoValidationErrors as `osf.exceptions.ValidationErrors` (for
MODM compat).
"""
try:
yield
except DjangoValidationError as err:
raise ValidationError(*err.args)
class NaiveDatetimeException(Exception):
pass
class InvalidTriggerError(Exception):
def __init__(self, trigger, state, valid_triggers):
self.trigger = trigger
self.state = state
self.valid_triggers = valid_triggers
self.message = 'Cannot trigger "{}" from state "{}". Valid triggers: {}'.format(trigger, state, valid_triggers)
super(Exception, self).__init__(self.message)
class InvalidTransitionError(Exception):
def __init__(self, machine, transition):
self.message = 'Machine "{}" received invalid transitions: "{}" expected but not defined'.format(machine, transition)
class PreprintError(OSFError):
"""Raised when an action cannot be performed on a Preprint model"""
pass
class PreprintStateError(PreprintError):
"""Raised when the Preprint's state is not suitable for the requested action"""
pass
class DraftRegistrationStateError(OSFError):
"""Raised when an action cannot be performed on a Draft Registration model"""
pass
class PreprintProviderError(PreprintError):
"""Raised when there is an error with the preprint provider"""
pass
class BlockedEmailError(OSFError):
"""Raised if a user tries to register an email that is included
in the blocked domains list
"""
pass
class SchemaBlockConversionError(OSFError):
"""Raised if unexpected data breaks the conversion between the legacy
nested registration schema/metadata format and the new, flattened,
'schema block' format.
"""
pass
class SchemaResponseError(OSFError):
"""Superclass for errors ariseing from unexpected SchemaResponse behavior."""
pass
class SchemaResponseStateError(SchemaResponseError):
"""Raised when attempting to perform an operation against a
SchemaResponse with an invalid state.
"""
pass
class PreviousSchemaResponseError(SchemaResponseError):
"""Raised when attempting to create a new SchemaResponse for a parent that
already has a SchemaResponse in an unsupported state
"""
pass
class RegistrationBulkCreationContributorError(OSFError):
"""Raised if contributor preparation has failed"""
def __init__(self, error=None):
self.error = error if error else 'Contributor preparation error'
class RegistrationBulkCreationRowError(OSFError):
"""Raised if a draft registration failed creation during bulk upload"""
def __init__(self, upload_id, row_id, title, external_id, draft_id=None, error=None, approval_failure=False):
# `draft_id` is provided when the draft is created but not related to the row object
self.draft_id = draft_id
# `approval_failure` determines whether the error happens during the approval process
self.approval_failure = approval_failure
# The error information for logging, sentry and email
self.error = error if error else 'Draft registration creation error'
# The short error message to be added to the error list that will be returned to the initiator via email
self.short_message = 'Title: {}, External ID: {}, Error: {}'.format(title, external_id, self.error)
# The long error message for logging and sentry
self.long_message = 'Draft registration creation failed: [upload_id="{}", row_id="{}", title="{}", ' \
'external_id="{}", error="{}"]'.format(upload_id, row_id, title, external_id, self.error)
class SchemaResponseUpdateError(SchemaResponseError):
"""Raised when assigning an invalid value (or key) to a SchemaResponseBlock."""
def __init__(self, response, invalid_responses=None, unsupported_keys=None):
self.invalid_responses = invalid_responses
self.unsupported_keys = unsupported_keys
invalid_response_message = ''
unsupported_keys_message = ''
if invalid_responses:
invalid_response_message = (
f'\nThe following responses had invalid values: {invalid_responses}'
)
if unsupported_keys:
unsupported_keys_message = (
f'\nReceived the following resposnes had invalid keys: {unsupported_keys}'
)
error_message = (
f'Error update SchemaResponse with id [{response._id}]:'
f'{invalid_response_message}{unsupported_keys_message}'
)
super().__init__(error_message)
|
Johnetordoff/osf.io
|
osf/exceptions.py
|
Python
|
apache-2.0
| 7,309
|
// Base property is optional and derived type has no property of that name
// object literal case
var a;
var b;
var r = true ? a : b; // ok
|
hippich/typescript
|
tests/baselines/reference/subtypingWithObjectMembersOptionality3.js
|
JavaScript
|
apache-2.0
| 147
|
<?php
final class DrydockRepositoryOperationStatusView
extends AphrontView {
private $operation;
private $boxView;
public function setOperation(DrydockRepositoryOperation $operation) {
$this->operation = $operation;
return $this;
}
public function getOperation() {
return $this->operation;
}
public function setBoxView(PHUIObjectBoxView $box_view) {
$this->boxView = $box_view;
return $this;
}
public function getBoxView() {
return $this->boxView;
}
public function render() {
$viewer = $this->getUser();
$operation = $this->getOperation();
$list = $this->renderUnderwayState();
// If the operation is currently underway, refresh the status view.
if ($operation->isUnderway()) {
$status_id = celerity_generate_unique_node_id();
$id = $operation->getID();
$list->setID($status_id);
Javelin::initBehavior(
'drydock-live-operation-status',
array(
'statusID' => $status_id,
'updateURI' => "/drydock/operation/{$id}/status/",
));
}
$box_view = $this->getBoxView();
if (!$box_view) {
$box_view = id(new PHUIObjectBoxView())
->setHeaderText(pht('Operation Status'));
}
$box_view->setObjectList($list);
return $box_view;
}
public function renderUnderwayState() {
$viewer = $this->getUser();
$operation = $this->getOperation();
$id = $operation->getID();
$state = $operation->getOperationState();
$icon = DrydockRepositoryOperation::getOperationStateIcon($state);
$name = DrydockRepositoryOperation::getOperationStateName($state);
$item = id(new PHUIObjectItemView())
->setHref("/drydock/operation/{$id}/")
->setObjectName(pht('Operation %d', $id))
->setHeader($operation->getOperationDescription($viewer))
->setStatusIcon($icon, $name);
if ($state != DrydockRepositoryOperation::STATE_FAIL) {
$item->addAttribute($operation->getOperationCurrentStatus($viewer));
} else {
$vcs_error = $operation->getWorkingCopyVCSError();
if ($vcs_error) {
switch ($vcs_error['phase']) {
case DrydockWorkingCopyBlueprintImplementation::PHASE_SQUASHMERGE:
$message = pht(
'This change did not merge cleanly. This usually indicates '.
'that the change is out of date and needs to be updated.');
break;
default:
$message = pht(
'Operation encountered an error while performing repository '.
'operations.');
break;
}
$item->addAttribute($message);
$table = $this->renderVCSErrorTable($vcs_error);
list($links, $info) = $this->renderDetailToggles($table);
$item->addAttribute($links);
$item->appendChild($info);
} else {
$item->addAttribute(pht('Operation encountered an error.'));
}
$is_dismissed = $operation->getIsDismissed();
$item->addAction(
id(new PHUIListItemView())
->setName('Dismiss')
->setIcon('fa-times')
->setDisabled($is_dismissed)
->setWorkflow(true)
->setHref("/drydock/operation/{$id}/dismiss/"));
}
return id(new PHUIObjectItemListView())
->addItem($item);
}
private function renderVCSErrorTable(array $vcs_error) {
$rows = array();
$rows[] = array(pht('Command'), $vcs_error['command']);
$rows[] = array(pht('Error'), $vcs_error['err']);
$rows[] = array(pht('Stdout'), $vcs_error['stdout']);
$rows[] = array(pht('Stderr'), $vcs_error['stderr']);
$table = id(new AphrontTableView($rows))
->setColumnClasses(
array(
'header',
'wide prewrap',
));
return $table;
}
private function renderDetailToggles(AphrontTableView $table) {
$show_id = celerity_generate_unique_node_id();
$hide_id = celerity_generate_unique_node_id();
$info_id = celerity_generate_unique_node_id();
Javelin::initBehavior('phabricator-reveal-content');
$show_details = javelin_tag(
'a',
array(
'id' => $show_id,
'href' => '#',
'sigil' => 'reveal-content',
'mustcapture' => true,
'meta' => array(
'hideIDs' => array($show_id),
'showIDs' => array($hide_id, $info_id),
),
),
pht('Show Details'));
$hide_details = javelin_tag(
'a',
array(
'id' => $hide_id,
'href' => '#',
'sigil' => 'reveal-content',
'mustcapture' => true,
'style' => 'display: none',
'meta' => array(
'hideIDs' => array($hide_id, $info_id),
'showIDs' => array($show_id),
),
),
pht('Hide Details'));
$info = javelin_tag(
'div',
array(
'id' => $info_id,
'style' => 'display: none',
),
$table);
$links = array(
$show_details,
$hide_details,
);
return array($links, $info);
}
}
|
zhihu/phabricator
|
src/applications/drydock/view/DrydockRepositoryOperationStatusView.php
|
PHP
|
apache-2.0
| 5,033
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.6.0_36) on Wed Jan 13 23:44:28 CST 2016 -->
<title>HadoopFSLogAppender</title>
<meta name="date" content="2016-01-13">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="HadoopFSLogAppender";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV CLASS</li>
<li><a href="../../../io/gearpump/util/RecreateRollingFileAppender.html" title="class in io.gearpump.util"><span class="strong">NEXT CLASS</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?io/gearpump/util/HadoopFSLogAppender.html" target="_top">FRAMES</a></li>
<li><a href="HadoopFSLogAppender.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>SUMMARY: </li>
<li>NESTED | </li>
<li><a href="#fields_inherited_from_class_org.apache.log4j.RollingFileAppender">FIELD</a> | </li>
<li><a href="#constructor_summary">CONSTR</a> | </li>
<li><a href="#methods_inherited_from_class_org.apache.log4j.RollingFileAppender">METHOD</a></li>
</ul>
<ul class="subNavList">
<li>DETAIL: </li>
<li>FIELD | </li>
<li><a href="#constructor_detail">CONSTR</a> | </li>
<li>METHOD</li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<p class="subTitle">io.gearpump.util</p>
<h2 title="Class HadoopFSLogAppender" class="title">Class HadoopFSLogAppender</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.log4j.AppenderSkeleton</li>
<li>
<ul class="inheritance">
<li>org.apache.log4j.WriterAppender</li>
<li>
<ul class="inheritance">
<li>org.apache.log4j.FileAppender</li>
<li>
<ul class="inheritance">
<li>org.apache.log4j.RollingFileAppender</li>
<li>
<ul class="inheritance">
<li>io.gearpump.util.HadoopFSLogAppender</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler</dd>
</dl>
<hr>
<br>
<pre>public class <strong>HadoopFSLogAppender</strong>
extends org.apache.log4j.RollingFileAppender</pre>
<div class="block">Log4j appender for to write to user specified Hadoop filesystem.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields_inherited_from_class_org.apache.log4j.RollingFileAppender">
<!-- -->
</a>
<h3>Fields inherited from class org.apache.log4j.RollingFileAppender</h3>
<code>maxBackupIndex, maxFileSize</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="fields_inherited_from_class_org.apache.log4j.FileAppender">
<!-- -->
</a>
<h3>Fields inherited from class org.apache.log4j.FileAppender</h3>
<code>bufferedIO, bufferSize, fileAppend, fileName</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="fields_inherited_from_class_org.apache.log4j.WriterAppender">
<!-- -->
</a>
<h3>Fields inherited from class org.apache.log4j.WriterAppender</h3>
<code>encoding, immediateFlush, qw</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="fields_inherited_from_class_org.apache.log4j.AppenderSkeleton">
<!-- -->
</a>
<h3>Fields inherited from class org.apache.log4j.AppenderSkeleton</h3>
<code>closed, errorHandler, headFilter, layout, name, tailFilter, threshold</code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../io/gearpump/util/HadoopFSLogAppender.html#HadoopFSLogAppender()">HadoopFSLogAppender</a></strong>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.log4j.RollingFileAppender">
<!-- -->
</a>
<h3>Methods inherited from class org.apache.log4j.RollingFileAppender</h3>
<code>getMaxBackupIndex, getMaximumFileSize, rollOver, setFile, setMaxBackupIndex, setMaxFileSize, setMaximumFileSize, setQWForFiles, subAppend</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.log4j.FileAppender">
<!-- -->
</a>
<h3>Methods inherited from class org.apache.log4j.FileAppender</h3>
<code>activateOptions, closeFile, getAppend, getBufferedIO, getBufferSize, getFile, reset, setAppend, setBufferedIO, setBufferSize, setFile</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.log4j.WriterAppender">
<!-- -->
</a>
<h3>Methods inherited from class org.apache.log4j.WriterAppender</h3>
<code>append, checkEntryConditions, close, closeWriter, createWriter, getEncoding, getImmediateFlush, requiresLayout, setEncoding, setErrorHandler, setImmediateFlush, setWriter, shouldFlush, writeFooter, writeHeader</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.log4j.AppenderSkeleton">
<!-- -->
</a>
<h3>Methods inherited from class org.apache.log4j.AppenderSkeleton</h3>
<code>addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setLayout, setName, setThreshold</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="HadoopFSLogAppender()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>HadoopFSLogAppender</h4>
<pre>public HadoopFSLogAppender()</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV CLASS</li>
<li><a href="../../../io/gearpump/util/RecreateRollingFileAppender.html" title="class in io.gearpump.util"><span class="strong">NEXT CLASS</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?io/gearpump/util/HadoopFSLogAppender.html" target="_top">FRAMES</a></li>
<li><a href="HadoopFSLogAppender.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>SUMMARY: </li>
<li>NESTED | </li>
<li><a href="#fields_inherited_from_class_org.apache.log4j.RollingFileAppender">FIELD</a> | </li>
<li><a href="#constructor_summary">CONSTR</a> | </li>
<li><a href="#methods_inherited_from_class_org.apache.log4j.RollingFileAppender">METHOD</a></li>
</ul>
<ul class="subNavList">
<li>DETAIL: </li>
<li>FIELD | </li>
<li><a href="#constructor_detail">CONSTR</a> | </li>
<li>METHOD</li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
stanleyxu2005/gearpump.github.io
|
releases/0.7.4/api/java/io/gearpump/util/HadoopFSLogAppender.html
|
HTML
|
apache-2.0
| 10,541
|
// Copyright 2015 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// Author: Peter Mattis (peter@cockroachlabs.com)
// This code was derived from https://github.com/youtube/vitess.
//
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file
package parser
import "bytes"
// DropBehavior represents options for dropping schema elements.
type DropBehavior int
// DropBehavior values.
const (
DropDefault DropBehavior = iota
DropRestrict
DropCascade
)
var dropBehaviorName = [...]string{
DropDefault: "",
DropRestrict: "RESTRICT",
DropCascade: "CASCADE",
}
func (d DropBehavior) String() string {
return dropBehaviorName[d]
}
// DropDatabase represents a DROP DATABASE statement.
type DropDatabase struct {
Name Name
IfExists bool
}
// Format implements the NodeFormatter interface.
func (node *DropDatabase) Format(buf *bytes.Buffer, f FmtFlags) {
buf.WriteString("DROP DATABASE ")
if node.IfExists {
buf.WriteString("IF EXISTS ")
}
FormatNode(buf, f, node.Name)
}
// DropIndex represents a DROP INDEX statement.
type DropIndex struct {
IndexList TableNameWithIndexList
IfExists bool
DropBehavior DropBehavior
}
// Format implements the NodeFormatter interface.
func (node *DropIndex) Format(buf *bytes.Buffer, f FmtFlags) {
buf.WriteString("DROP INDEX ")
if node.IfExists {
buf.WriteString("IF EXISTS ")
}
FormatNode(buf, f, node.IndexList)
if node.DropBehavior != DropDefault {
buf.WriteByte(' ')
buf.WriteString(node.DropBehavior.String())
}
}
// DropTable represents a DROP TABLE statement.
type DropTable struct {
Names QualifiedNames
IfExists bool
DropBehavior DropBehavior
}
// Format implements the NodeFormatter interface.
func (node *DropTable) Format(buf *bytes.Buffer, f FmtFlags) {
buf.WriteString("DROP TABLE ")
if node.IfExists {
buf.WriteString("IF EXISTS ")
}
FormatNode(buf, f, node.Names)
if node.DropBehavior != DropDefault {
buf.WriteByte(' ')
buf.WriteString(node.DropBehavior.String())
}
}
|
vivekmenezes/cockroach
|
sql/parser/drop.go
|
GO
|
apache-2.0
| 2,627
|
/*
* Copyright © 2015 Cask Data, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
#pragma once
#include "CdapException.h"
namespace Cask {
namespace CdapOdbc {
/**
* Reports errors that arise because query has no more data.
*/
class CancelException : public CdapException {
public:
/**
* Creates an instance.
*/
CancelException();
};
}
}
|
skilurus/cdap-odbc-driver
|
CdapOdbc/CancelException.h
|
C
|
apache-2.0
| 899
|
/*
* Copyright 1998-2016 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ru.org.linux.user;
import org.jasypt.exceptions.EncryptionOperationNotPossibleException;
import org.jasypt.util.password.BasicPasswordEncryptor;
import org.jasypt.util.password.PasswordEncryptor;
import org.springframework.validation.Errors;
import ru.org.linux.auth.AccessViolationException;
import ru.org.linux.auth.BadPasswordException;
import ru.org.linux.site.BadInputException;
import ru.org.linux.util.StringUtil;
import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
public class User implements Serializable {
private static final int ANONYMOUS_LEVEL_SCORE = 50;
public static final int ANONYMOUS_ID = 2;
private final String nick;
private final int id;
private final boolean canmod;
private final boolean candel;
private final boolean anonymous;
private final boolean corrector;
private final boolean blocked;
private final String password;
private final int score;
private final int maxScore;
private final String photo;
private final String email;
private final String fullName;
private final int unreadEvents;
private final String style;
private final boolean activated;
public static final int CORRECTOR_SCORE = 200;
public static final int MAX_NICK_LENGTH = 19; // check only on new user registration, do not check existing users!
private static final long serialVersionUID = 69986652856916540L;
public User(ResultSet rs) throws SQLException {
id = rs.getInt("id");
nick = rs.getString("nick");
canmod = rs.getBoolean("canmod");
candel = rs.getBoolean("candel");
corrector = rs.getBoolean("corrector");
activated = rs.getBoolean("activated");
blocked = rs.getBoolean("blocked");
score = rs.getInt("score");
maxScore = rs.getInt("max_score");
fullName = rs.getString("name");
String pwd = rs.getString("passwd");
if (pwd == null) {
pwd = "";
}
anonymous = pwd.isEmpty();
password = pwd;
photo=rs.getString("photo");
email = rs.getString("email");
unreadEvents = rs.getInt("unread_events");
style = rs.getString("style");
}
public int getId() {
return id;
}
public String getNick() {
return nick;
}
public String getPassword() {
return password;
}
public void checkPassword(String password) throws BadPasswordException {
if (blocked) {
throw new BadPasswordException(nick);
}
if (password==null) {
throw new BadPasswordException(nick);
}
if (anonymous && password.isEmpty()) {
return;
}
if (!matchPassword(password)) {
throw new BadPasswordException(nick);
}
}
public boolean matchPassword(String password) {
PasswordEncryptor encryptor = new BasicPasswordEncryptor();
try {
return encryptor.checkPassword(password, this.password);
} catch (EncryptionOperationNotPossibleException ex) {
return false;
}
}
/**
* Проверка на анонимность или заблокированность
* TODO проверка на бан в этой функции сбивает с толку
* @throws AccessViolationException если пользователь блокирован или анонимен
*/
public void checkAnonymous() throws AccessViolationException {
if (anonymous || blocked) {
throw new AccessViolationException("Anonymous user");
}
}
public void checkBlocked() throws AccessViolationException {
if (blocked) {
throw new AccessViolationException("Пользователь заблокирован");
}
if (!activated) {
throw new AccessViolationException("Пользователь не активирован");
}
}
public void checkBlocked(Errors errors) {
if (blocked) {
errors.reject(null, "Пользователь заблокирован");
}
if (!activated) {
errors.reject(null, "Пользователь не активирован");
}
}
public void checkCommit() throws AccessViolationException {
if (anonymous || blocked) {
throw new AccessViolationException("Commit access denied for anonymous user");
}
if (!canmod) {
throw new AccessViolationException("Commit access denied for user " + nick + " (" + id + ") ");
}
}
public boolean isBlocked() {
return blocked;
}
/**
* Check if use is super-moderator
*
* @throws AccessViolationException if use is not super-moderator
*/
public void checkDelete() throws AccessViolationException {
if (anonymous || blocked) {
throw new AccessViolationException("Delete access denied for anonymous user");
}
if (!candel) {
throw new AccessViolationException("Delete access denied for user " + nick + " (" + id + ") ");
}
}
public boolean isModerator() {
return canmod;
}
public boolean isAdministrator() {
return candel;
}
public boolean canCorrect() {
return corrector && score>= CORRECTOR_SCORE;
}
public int getCorrectorScore() {
return CORRECTOR_SCORE;
}
public boolean isAnonymous() {
return anonymous;
}
public String getActivationCode(String base) {
return getActivationCode(base, nick, email);
}
public String getActivationCode(String base, String email) {
return StringUtil.md5hash(base + ':' + nick + ':' + email);
}
public static String getActivationCode(String base, String nick, String email) {
return StringUtil.md5hash(base + ':' + nick + ':' + email);
}
public int getScore() {
if (anonymous) {
return 0;
} else {
return score;
}
}
public int getMaxScore() {
if (anonymous) {
return 0;
} else {
return maxScore;
}
}
@Deprecated
public String getStars() {
return getStars(score, maxScore, true);
}
private static int getGreenStars(int score) {
if (score < 0) {
score = 0;
}
if (score >= 600) {
score = 599;
}
return (int) Math.floor(score / 100.0);
}
private static int getGreyStars(int score, int maxScore) {
if (maxScore < 0) {
maxScore = 0;
}
if (maxScore < score) {
maxScore = score;
}
if (maxScore >= 600) {
maxScore = 599;
}
int stars = getGreenStars(score);
return (int) Math.floor(maxScore / 100.0) - stars;
}
public static String getStars(int score, int maxScore, boolean html) {
StringBuilder out = new StringBuilder();
int stars = getGreenStars(score);
int greyStars = getGreyStars(score, maxScore);
if (html) {
out.append("<span class=\"stars\">");
}
for (int i = 0; i < stars; i++) {
out.append("★");
}
for (int i = 0; i < greyStars; i++) {
out.append("☆");
}
if (html) {
out.append("</span>");
}
return out.toString();
}
public String getStatus() {
String text;
if (score < ANONYMOUS_LEVEL_SCORE) {
text = "анонимный";
} else if (score < 100 && maxScore < 100) {
text = "новый пользователь";
} else {
text = "";
}
if (maxScore>=100 && text.isEmpty()) {
return getStars(score, maxScore, true);
} else if (maxScore>=100 && !text.isEmpty()) {
return text + " " + getStars(score, maxScore, true);
} else {
return text;
}
}
public boolean isBlockable() {
if (id==2) {
return false;
}
return !canmod;
}
public boolean isActivated() {
return activated;
}
public String getPhoto() {
return photo;
}
public boolean isAnonymousScore() {
return anonymous || blocked || score<ANONYMOUS_LEVEL_SCORE;
}
public boolean isCorrector() {
return corrector;
}
public static void checkNick(String nick) throws BadInputException {
if (nick==null || !StringUtil.checkLoginName(nick)) {
throw new BadInputException("некорректное имя пользователя");
}
}
public String getEmail() {
return email;
}
public boolean hasGravatar() {
return email!=null;
}
public String getName() {
return fullName;
}
public int getUnreadEvents() {
return unreadEvents;
}
/**
* Стиль\тема пользователя
* @return название стиля\темы
*/
public String getStyle() {
return style;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return id == user.id;
}
@Override
public int hashCode() {
return id;
}
}
|
fat0troll/lorsource
|
src/main/java/ru/org/linux/user/User.java
|
Java
|
apache-2.0
| 9,275
|
/*
* Copyright 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.slice.widget;
import static android.app.slice.Slice.EXTRA_RANGE_VALUE;
import static android.app.slice.Slice.HINT_LARGE;
import static android.app.slice.Slice.HINT_NO_TINT;
import static android.app.slice.Slice.HINT_TITLE;
import static android.app.slice.Slice.SUBTYPE_MILLIS;
import static android.app.slice.SliceItem.FORMAT_ACTION;
import static android.app.slice.SliceItem.FORMAT_IMAGE;
import static android.app.slice.SliceItem.FORMAT_LONG;
import static android.app.slice.SliceItem.FORMAT_SLICE;
import static android.app.slice.SliceItem.FORMAT_TEXT;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static androidx.slice.core.SliceHints.LARGE_IMAGE;
import static androidx.slice.core.SliceHints.RAW_IMAGE_LARGE;
import static androidx.slice.core.SliceHints.SUBTYPE_DATE_PICKER;
import static androidx.slice.core.SliceHints.SUBTYPE_TIME_PICKER;
import static androidx.slice.widget.EventInfo.ACTION_TYPE_DATE_PICK;
import static androidx.slice.widget.EventInfo.ACTION_TYPE_TIME_PICK;
import static androidx.slice.widget.EventInfo.ACTION_TYPE_TOGGLE;
import static androidx.slice.widget.EventInfo.ROW_TYPE_DATE_PICK;
import static androidx.slice.widget.EventInfo.ROW_TYPE_TIME_PICK;
import static androidx.slice.widget.EventInfo.ROW_TYPE_TOGGLE;
import static androidx.slice.widget.SliceView.MODE_SMALL;
import android.app.DatePickerDialog;
import android.app.PendingIntent;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Pair;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.DatePicker;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.TimePicker;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.content.ContextCompat;
import androidx.slice.CornerDrawable;
import androidx.slice.SliceItem;
import androidx.slice.core.SliceActionImpl;
import androidx.slice.core.SliceHints;
import androidx.slice.core.SliceQuery;
import androidx.slice.view.R;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@RequiresApi(19)
public class GridRowView extends SliceChildView implements View.OnClickListener,
View.OnTouchListener {
private static final String TAG = "GridRowView";
private static final int TEXT_LAYOUT = R.layout.abc_slice_secondary_text;
// Max number of text items that can show in a cell
private static final int MAX_CELL_TEXT = 2;
// Max number of text items that can show in a cell if the mode is small
private static final int MAX_CELL_TEXT_SMALL = 1;
// Max number of images that can show in a cell
private static final int MAX_CELL_IMAGES = 1;
private final int mGutter;
private final int mTextPadding;
private final int[] mLoc = new int[2];
boolean mMaxCellUpdateScheduled;
private int mHiddenItemCount;
/**
* @hide
*/
protected final View mForeground;
/**
* @hide
*/
protected int mRowIndex;
/**
* @hide
*/
protected int mRowCount;
/**
* @hide
*/
protected int mMaxCells = -1;
/**
* @hide
*/
protected @Nullable GridContent mGridContent;
/**
* @hide
*/
protected final int mLargeImageHeight;
/**
* @hide
*/
protected final int mSmallImageSize;
/**
* @hide
*/
protected final int mSmallImageMinWidth;
/**
* @hide
*/
protected final int mIconSize;
/**
* @hide
*/
protected final LinearLayout mViewContainer;
public GridRowView(@NonNull Context context) {
this(context, null);
}
public GridRowView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
final Resources res = getContext().getResources();
mViewContainer = new LinearLayout(getContext());
mViewContainer.setOrientation(LinearLayout.HORIZONTAL);
addView(mViewContainer, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
mViewContainer.setGravity(Gravity.CENTER_VERTICAL);
mIconSize = res.getDimensionPixelSize(R.dimen.abc_slice_icon_size);
mSmallImageSize = res.getDimensionPixelSize(R.dimen.abc_slice_small_image_size);
mLargeImageHeight = res.getDimensionPixelSize(R.dimen.abc_slice_grid_image_only_height);
mSmallImageMinWidth = res.getDimensionPixelSize(R.dimen.abc_slice_grid_image_min_width);
mGutter = res.getDimensionPixelSize(R.dimen.abc_slice_grid_gutter);
mTextPadding = res.getDimensionPixelSize(R.dimen.abc_slice_grid_text_padding);
mForeground = new View(getContext());
addView(mForeground, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
}
/**
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
@Override
public void setInsets(int l, int t, int r, int b) {
super.setInsets(l, t, r, b);
mViewContainer.setPadding(l, t + getExtraTopPadding(), r, b + getExtraBottomPadding());
}
protected int getTitleTextLayout() {
return R.layout.abc_slice_title;
}
protected int getExtraTopPadding() {
if (mGridContent != null && mGridContent.isAllImages()) {
// Might need to add padding if in first or last position
if (mRowIndex == 0) {
return mSliceStyle != null ? mSliceStyle.getGridTopPadding() : 0;
}
}
return 0;
}
protected int getExtraBottomPadding() {
if (mGridContent != null && mGridContent.isAllImages()) {
if (mRowIndex == mRowCount - 1 || getMode() == MODE_SMALL) {
return mSliceStyle != null ? mSliceStyle.getGridBottomPadding() : 0;
}
}
return 0;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int height = mGridContent.getHeight(mSliceStyle, mViewPolicy)
+ mInsetTop + mInsetBottom;
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
mViewContainer.getLayoutParams().height = height;
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
/**
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
@Override
public void setTint(@ColorInt int tintColor) {
super.setTint(tintColor);
if (mGridContent != null) {
// TODO -- could be smarter about this
resetView();
populateViews();
}
}
/**
* This is called when GridView is being used as a component in a larger template.
*/
@Override
public void setSliceItem(@NonNull SliceContent slice, boolean isHeader, int rowIndex,
int rowCount, @Nullable SliceView.OnSliceActionListener observer) {
resetView();
setSliceActionListener(observer);
mRowIndex = rowIndex;
mRowCount = rowCount;
mGridContent = (GridContent) slice;
if (!scheduleMaxCellsUpdate()) {
populateViews();
}
mViewContainer.setPadding(mInsetStart, mInsetTop + getExtraTopPadding(), mInsetEnd,
mInsetBottom + getExtraBottomPadding());
}
/**
* Schedules update to determine the max number of cells that can be shown in this grid.
*
* @return true if update was scheduled, false if it wasn't needed
*/
protected boolean scheduleMaxCellsUpdate() {
if (mGridContent == null || !mGridContent.isValid()) {
return true;
}
if (getWidth() == 0) {
// Need to wait for layout pass so we know how much width we have for the grid items.
mMaxCellUpdateScheduled = true;
getViewTreeObserver().addOnPreDrawListener(mMaxCellsUpdater);
return true;
} else {
mMaxCells = getMaxCells();
return false;
}
}
protected int getMaxCells() {
if (mGridContent == null || !mGridContent.isValid() || getWidth() == 0) {
return -1;
}
ArrayList<GridContent.CellContent> cells = mGridContent.getGridContent();
if (cells.size() > 1) {
int desiredCellWidth;
switch (mGridContent.getLargestImageMode()) {
case LARGE_IMAGE:
desiredCellWidth = mLargeImageHeight;
break;
case RAW_IMAGE_LARGE:
desiredCellWidth = mGridContent.getFirstImageSize(getContext()).x;
break;
default:
desiredCellWidth = mSmallImageMinWidth;
}
return getWidth() / (desiredCellWidth + mGutter);
} else {
return 1;
}
}
protected void populateViews() {
if (mGridContent == null || !mGridContent.isValid()) {
resetView();
return;
}
if (scheduleMaxCellsUpdate()) {
return;
}
if (mGridContent.getLayoutDir() != -1) {
setLayoutDirection(mGridContent.getLayoutDir());
}
if (mGridContent.getContentIntent() != null) {
EventInfo info = new EventInfo(getMode(), EventInfo.ACTION_TYPE_CONTENT,
EventInfo.ROW_TYPE_GRID, mRowIndex);
Pair<SliceItem, EventInfo> tagItem = new Pair<>(mGridContent.getContentIntent(), info);
mViewContainer.setTag(tagItem);
makeEntireGridClickable(true);
}
CharSequence contentDescr = mGridContent.getContentDescription();
if (contentDescr != null) {
mViewContainer.setContentDescription(contentDescr);
}
ArrayList<GridContent.CellContent> cells = mGridContent.getGridContent();
if (mGridContent.getLargestImageMode() == LARGE_IMAGE
|| mGridContent.getLargestImageMode() == RAW_IMAGE_LARGE) {
mViewContainer.setGravity(Gravity.TOP);
} else {
mViewContainer.setGravity(Gravity.CENTER_VERTICAL);
}
int maxCells = mMaxCells;
boolean hasSeeMore = mGridContent.getSeeMoreItem() != null;
mHiddenItemCount = 0;
for (int i = 0; i < cells.size(); i++) {
if (mViewContainer.getChildCount() >= maxCells) {
mHiddenItemCount = cells.size() - maxCells;
if (hasSeeMore) {
addSeeMoreCount(mHiddenItemCount);
}
break;
}
addCell(cells.get(i), i, Math.min(cells.size(), maxCells));
}
}
private void addSeeMoreCount(int numExtra) {
// Remove last element
View last = mViewContainer.getChildAt(mViewContainer.getChildCount() - 1);
mViewContainer.removeView(last);
SliceItem seeMoreItem = mGridContent.getSeeMoreItem();
int index = mViewContainer.getChildCount();
int total = mMaxCells;
if ((FORMAT_SLICE.equals(seeMoreItem.getFormat())
|| FORMAT_ACTION.equals(seeMoreItem.getFormat()))
&& seeMoreItem.getSlice().getItems().size() > 0) {
// It's a custom see more cell, add it
addCell(new GridContent.CellContent(seeMoreItem), index, total);
return;
}
// Default see more, create it
LayoutInflater inflater = LayoutInflater.from(getContext());
TextView extraText;
View extraTint;
ViewGroup seeMoreView;
if (mGridContent.isAllImages()) {
seeMoreView = (FrameLayout) inflater.inflate(R.layout.abc_slice_grid_see_more_overlay,
mViewContainer, false);
seeMoreView.addView(last, 0, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
extraText = seeMoreView.findViewById(R.id.text_see_more_count);
extraTint = seeMoreView.findViewById(R.id.overlay_see_more);
extraTint.setBackground(new CornerDrawable(SliceViewUtil.getDrawable(
getContext(), android.R.attr.colorForeground),
mSliceStyle.getImageCornerRadius()));
} else {
seeMoreView = (LinearLayout) inflater.inflate(
R.layout.abc_slice_grid_see_more, mViewContainer, false);
extraText = seeMoreView.findViewById(R.id.text_see_more_count);
// Update text appearance
TextView moreText = seeMoreView.findViewById(R.id.text_see_more);
if (mSliceStyle != null && mRowStyle != null) {
moreText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mSliceStyle.getGridTitleSize());
moreText.setTextColor(mRowStyle.getTitleColor());
}
}
mViewContainer.addView(seeMoreView, new LinearLayout.LayoutParams(0, MATCH_PARENT, 1));
extraText.setText(getResources().getString(R.string.abc_slice_more_content, numExtra));
// Make it clickable
EventInfo info = new EventInfo(getMode(), EventInfo.ACTION_TYPE_SEE_MORE,
EventInfo.ROW_TYPE_GRID, mRowIndex);
info.setPosition(EventInfo.POSITION_CELL, index, total);
Pair<SliceItem, EventInfo> tagItem = new Pair<>(seeMoreItem, info);
seeMoreView.setTag(tagItem);
makeClickable(seeMoreView, true);
}
/**
* Adds a cell to the grid view based on the provided {@link SliceItem}.
*/
private void addCell(GridContent.CellContent cell, int index, int total) {
final int maxCellText = getMode() == MODE_SMALL && mGridContent.hasImage()
? MAX_CELL_TEXT_SMALL : MAX_CELL_TEXT;
LinearLayout cellContainer = new LinearLayout(getContext());
cellContainer.setOrientation(LinearLayout.VERTICAL);
cellContainer.setGravity(Gravity.CENTER_HORIZONTAL);
ArrayList<SliceItem> cellItems = cell.getCellItems();
SliceItem contentIntentItem = cell.getContentIntent();
SliceItem pickerItem = cell.getPicker();
SliceItem toggleItem = cell.getToggleItem();
int textCount = 0;
int imageCount = 0;
boolean added = false;
boolean isSingleItem = cellItems.size() == 1;
List<SliceItem> textItems = null;
// In small format we display one text item and prefer titles
if (!isSingleItem && getMode() == MODE_SMALL) {
// Get all our text items
textItems = new ArrayList<>();
for (SliceItem cellItem : cellItems) {
if (FORMAT_TEXT.equals(cellItem.getFormat())) {
textItems.add(cellItem);
}
}
// If we have more than 1 remove non-titles
Iterator<SliceItem> iterator = textItems.iterator();
while (textItems.size() > maxCellText) {
SliceItem item = iterator.next();
if (!item.hasAnyHints(HINT_TITLE, HINT_LARGE)) {
iterator.remove();
}
}
}
SliceItem prevItem = null;
for (int i = 0; i < cellItems.size(); i++) {
SliceItem item = cellItems.get(i);
final String itemFormat = item.getFormat();
int padding = determinePadding(prevItem);
if (textCount < maxCellText && (FORMAT_TEXT.equals(itemFormat)
|| FORMAT_LONG.equals(itemFormat))) {
if (textItems != null && !textItems.contains(item)) {
continue;
}
if (addTextItem(item, cellContainer, padding)) {
prevItem = item;
textCount++;
added = true;
}
} else if (imageCount < MAX_CELL_IMAGES && FORMAT_IMAGE.equals(item.getFormat())) {
if (addImageItem(item, cell.getOverlayItem(), mTintColor, cellContainer,
isSingleItem)) {
prevItem = item;
imageCount++;
added = true;
}
}
}
if (pickerItem != null) {
if (SUBTYPE_DATE_PICKER.equals(pickerItem.getSubType())) {
added = addPickerItem(pickerItem, cellContainer, determinePadding(prevItem),
/*isDatePicker=*/ true);
} else if (SUBTYPE_TIME_PICKER.equals(pickerItem.getSubType())) {
added = addPickerItem(pickerItem, cellContainer, determinePadding(prevItem),
/*isDatePicker=*/ false);
}
}
SliceActionView sav = null;
if (toggleItem != null) {
sav = new SliceActionView(getContext(), mSliceStyle, mRowStyle);
cellContainer.addView(sav);
added = true;
}
if (added) {
CharSequence contentDescr = cell.getContentDescription();
if (contentDescr != null) {
cellContainer.setContentDescription(contentDescr);
}
mViewContainer.addView(cellContainer,
new LinearLayout.LayoutParams(0, WRAP_CONTENT, 1));
if (index != total - 1) {
// If we're not the last or only element add space between items
MarginLayoutParams lp =
(LinearLayout.MarginLayoutParams) cellContainer.getLayoutParams();
lp.setMarginEnd(mGutter);
cellContainer.setLayoutParams(lp);
}
if (contentIntentItem != null) {
EventInfo info = new EventInfo(getMode(), EventInfo.ACTION_TYPE_BUTTON,
EventInfo.ROW_TYPE_GRID, mRowIndex);
info.setPosition(EventInfo.POSITION_CELL, index, total);
Pair<SliceItem, EventInfo> tagItem = new Pair<>(contentIntentItem, info);
cellContainer.setTag(tagItem);
makeClickable(cellContainer, true);
}
if (toggleItem != null) {
EventInfo info =
new EventInfo(getMode(), ACTION_TYPE_TOGGLE, ROW_TYPE_TOGGLE, mRowIndex);
sav.setAction(
new SliceActionImpl(toggleItem),
info, mObserver, mTintColor, mLoadingListener);
info.setPosition(EventInfo.POSITION_CELL, index, total);
}
}
}
/**
* Adds simple text based items to a container. Simple text items include text and
* timestamps.
*
* @param item item to add to the container.
* @param container the container to add to.
* @param padding the padding to apply to the item.
* @return Whether an item was added.
*/
private boolean addTextItem(SliceItem item, ViewGroup container, int padding) {
final String format = item.getFormat();
if (!FORMAT_TEXT.equals(format) && !FORMAT_LONG.equals(format)) {
return false;
}
boolean isTitle = SliceQuery.hasAnyHints(item, HINT_LARGE, HINT_TITLE);
TextView tv = (TextView) LayoutInflater.from(getContext()).inflate(isTitle
? getTitleTextLayout() : TEXT_LAYOUT, null);
if (mSliceStyle != null && mRowStyle != null) {
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, isTitle
? mSliceStyle.getGridTitleSize() : mSliceStyle.getGridSubtitleSize());
tv.setTextColor(isTitle
? mRowStyle.getTitleColor() : mRowStyle.getSubtitleColor());
}
CharSequence text = FORMAT_LONG.equals(format)
? SliceViewUtil.getTimestampString(getContext(), item.getLong())
: item.getSanitizedText();
tv.setText(text);
container.addView(tv);
tv.setPadding(0, padding, 0, 0);
return true;
}
/**
* Adds simple image based item to a container.
*
* @param item item to add to the container.
* @param overlayItem overlaid text to add to the image.
* @param container the container to add to.
* @param isSingle whether this is the only item in the cell or not.
* @return Whether an item was added.
*/
protected boolean addImageItem(@NonNull SliceItem item, @Nullable SliceItem overlayItem,
int color,
@NonNull ViewGroup container, boolean isSingle) {
final String format = item.getFormat();
final boolean hasRoundedImage =
mSliceStyle != null && mSliceStyle.getApplyCornerRadiusToLargeImages();
if (!FORMAT_IMAGE.equals(format) || item.getIcon() == null) {
return false;
}
Drawable d = item.getIcon().loadDrawable(getContext());
if (d == null) {
return false;
}
ImageView iv = new ImageView(getContext());
if (hasRoundedImage) {
CornerDrawable cd = new CornerDrawable(d, mSliceStyle.getImageCornerRadius());
iv.setImageDrawable(cd);
} else {
iv.setImageDrawable(d);
}
LinearLayout.LayoutParams lp;
if (item.hasHint(SliceHints.HINT_RAW)) {
iv.setScaleType(ScaleType.CENTER_INSIDE);
lp = new LinearLayout.LayoutParams(mGridContent.getFirstImageSize(getContext()).x,
mGridContent.getFirstImageSize(getContext()).y);
} else if (item.hasHint(HINT_LARGE)) {
iv.setScaleType(hasRoundedImage ? ScaleType.FIT_XY : ScaleType.CENTER_CROP);
int height = isSingle ? MATCH_PARENT : mLargeImageHeight;
lp = new LinearLayout.LayoutParams(MATCH_PARENT, height);
} else {
boolean isIcon = !item.hasHint(HINT_NO_TINT);
int size = !isIcon ? mSmallImageSize : mIconSize;
iv.setScaleType(isIcon ? ScaleType.CENTER_INSIDE : ScaleType.CENTER_CROP);
lp = new LinearLayout.LayoutParams(size, size);
}
if (color != -1 && !item.hasHint(HINT_NO_TINT)) {
iv.setColorFilter(color);
}
// don't add an overlay on see more
if (overlayItem == null || mViewContainer.getChildCount() == mMaxCells - 1) {
container.addView(iv, lp);
return true;
}
// add overlay on top of the ImageView
LayoutInflater inflater = LayoutInflater.from(getContext());
TextView overlayText;
View overlayTint;
ViewGroup overlayView;
overlayView = (FrameLayout) inflater.inflate(R.layout.abc_slice_grid_text_overlay_image,
container, false);
overlayView.addView(iv, 0, new LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
overlayText = overlayView.findViewById(R.id.text_overlay);
overlayText.setText(overlayItem.getText());
overlayTint = overlayView.findViewById(R.id.tint_overlay);
overlayTint.setBackground(new CornerDrawable(ContextCompat.getDrawable(getContext(),
R.drawable.abc_slice_gradient), mSliceStyle.getImageCornerRadius()));
container.addView(overlayView, lp);
return true;
}
/**
* Adds date or time picker to a container.
*
* @param pickerItem item to add to the container.
* @param container the container to add to.
* @param padding the padding to apply to the item.
* @param isDatePicker if true, it is a date picker, otherwise is a time picker.
* @return Whether an item was added.
*/
private boolean addPickerItem(SliceItem pickerItem, ViewGroup container, int padding,
boolean isDatePicker) {
SliceItem dateTimeItem = SliceQuery.findSubtype(pickerItem, FORMAT_LONG,
SUBTYPE_MILLIS);
if (dateTimeItem == null) {
return false;
}
long dateTimeMillis = dateTimeItem.getLong();
TextView tv = (TextView) LayoutInflater.from(getContext()).inflate(getTitleTextLayout(),
null);
if (mSliceStyle != null) {
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, mSliceStyle.getGridTitleSize());
tv.setTextColor(mSliceStyle.getTitleColor());
}
Date date = new Date(dateTimeMillis);
SliceItem titleItem = SliceQuery.find(pickerItem, FORMAT_TEXT, HINT_TITLE,
/*nonHints=*/null);
if (titleItem != null) {
tv.setText(titleItem.getText());
}
int rowIndex = mRowIndex;
container.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
if (isDatePicker) {
DatePickerDialog dialog = new DatePickerDialog(
getContext(),
R.style.DialogTheme,
new DateSetListener(pickerItem, rowIndex),
cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH),
cal.get(Calendar.DAY_OF_MONTH));
dialog.show();
} else {
TimePickerDialog dialog = new TimePickerDialog(
getContext(),
R.style.DialogTheme,
new TimeSetListener(pickerItem, rowIndex),
cal.get(Calendar.HOUR_OF_DAY),
cal.get(Calendar.MINUTE),
false);
dialog.show();
}
}
});
container.setClickable(true);
int backgroundAttr = android.R.attr.selectableItemBackground;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
backgroundAttr = android.R.attr.selectableItemBackgroundBorderless;
}
container.setBackground(SliceViewUtil.getDrawable(getContext(), backgroundAttr));
container.addView(tv);
tv.setPadding(0, padding, 0, 0);
return true;
}
private class DateSetListener implements DatePickerDialog.OnDateSetListener {
private final SliceItem mActionItem;
private final int mRowIndex;
DateSetListener(SliceItem datePickerItem, int mRowIndex) {
this.mActionItem = datePickerItem;
this.mRowIndex = mRowIndex;
}
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int day) {
Calendar c = Calendar.getInstance();
c.set(year, month, day);
Date date = c.getTime();
if (mActionItem != null) {
try {
mActionItem.fireAction(getContext(),
new Intent().addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
.putExtra(EXTRA_RANGE_VALUE, date.getTime()));
if (mObserver != null) {
EventInfo info = new EventInfo(getMode(), ACTION_TYPE_DATE_PICK,
ROW_TYPE_DATE_PICK,
mRowIndex);
mObserver.onSliceAction(info, mActionItem);
}
} catch (PendingIntent.CanceledException e) {
Log.e(TAG, "PendingIntent for slice cannot be sent", e);
}
}
}
}
private class TimeSetListener implements TimePickerDialog.OnTimeSetListener {
private final SliceItem mActionItem;
private final int mRowIndex;
TimeSetListener(SliceItem timePickerItem, int mRowIndex) {
this.mActionItem = timePickerItem;
this.mRowIndex = mRowIndex;
}
@Override
public void onTimeSet(TimePicker timePicker, int hour, int minute) {
Calendar c = Calendar.getInstance();
Date time = c.getTime();
time.setHours(hour);
time.setMinutes(minute);
if (mActionItem != null) {
try {
mActionItem.fireAction(getContext(),
new Intent().addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
.putExtra(EXTRA_RANGE_VALUE, time.getTime()));
if (mObserver != null) {
EventInfo info = new EventInfo(getMode(), ACTION_TYPE_TIME_PICK,
ROW_TYPE_TIME_PICK,
mRowIndex);
mObserver.onSliceAction(info, mActionItem);
}
} catch (PendingIntent.CanceledException e) {
Log.e(TAG, "PendingIntent for slice cannot be sent", e);
}
}
}
}
private int determinePadding(SliceItem prevItem) {
if (prevItem == null) {
// No need for top padding
return 0;
} else if (FORMAT_IMAGE.equals(prevItem.getFormat())) {
return mTextPadding;
} else if (FORMAT_TEXT.equals(prevItem.getFormat())
|| FORMAT_LONG.equals(prevItem.getFormat())) {
return mSliceStyle != null ? mSliceStyle.getVerticalGridTextPadding() : 0;
}
return 0;
}
private void makeEntireGridClickable(boolean isClickable) {
mViewContainer.setOnTouchListener(isClickable ? this : null);
mViewContainer.setOnClickListener((isClickable ? this : null));
mForeground.setBackground(isClickable
? SliceViewUtil.getDrawable(
getContext(), android.R.attr.selectableItemBackground)
: null);
mViewContainer.setClickable(isClickable);
setClickable(isClickable);
}
private void makeClickable(View layout, boolean isClickable) {
layout.setOnClickListener(isClickable ? this : null);
int backgroundAttr = android.R.attr.selectableItemBackground;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
backgroundAttr = android.R.attr.selectableItemBackgroundBorderless;
}
layout.setBackground(isClickable
? SliceViewUtil.getDrawable(getContext(), backgroundAttr)
: null);
layout.setClickable(isClickable);
}
/**
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
@Override
@SuppressWarnings("unchecked")
public void onClick(@NonNull View view) {
Pair<SliceItem, EventInfo> tagItem = (Pair<SliceItem, EventInfo>) view.getTag();
final SliceItem sliceItem = tagItem.first;
final EventInfo info = tagItem.second;
if (sliceItem != null) {
final SliceItem actionItem = SliceQuery.find(sliceItem,
FORMAT_ACTION, (String) null, null);
if (actionItem != null) {
try {
actionItem.fireAction(null, null);
if (mObserver != null) {
mObserver.onSliceAction(info, actionItem);
}
} catch (PendingIntent.CanceledException e) {
Log.e(TAG, "PendingIntent for slice cannot be sent", e);
}
}
}
}
/**
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
@Override
public boolean onTouch(@NonNull View view, @NonNull MotionEvent event) {
onForegroundActivated(event);
return false;
}
private void onForegroundActivated(MotionEvent event) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
mForeground.getLocationOnScreen(mLoc);
final int x = (int) (event.getRawX() - mLoc[0]);
final int y = (int) (event.getRawY() - mLoc[1]);
mForeground.getBackground().setHotspot(x, y);
}
int action = event.getActionMasked();
if (action == android.view.MotionEvent.ACTION_DOWN) {
mForeground.setPressed(true);
} else if (action == android.view.MotionEvent.ACTION_CANCEL
|| action == android.view.MotionEvent.ACTION_UP
|| action == android.view.MotionEvent.ACTION_MOVE) {
mForeground.setPressed(false);
}
}
@Override
public void resetView() {
if (mMaxCellUpdateScheduled) {
mMaxCellUpdateScheduled = false;
getViewTreeObserver().removeOnPreDrawListener(mMaxCellsUpdater);
}
mViewContainer.removeAllViews();
setLayoutDirection(View.LAYOUT_DIRECTION_INHERIT);
makeEntireGridClickable(false);
}
/**
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
@Override
public int getHiddenItemCount() {
return mHiddenItemCount;
}
private final ViewTreeObserver.OnPreDrawListener mMaxCellsUpdater =
new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
mMaxCells = getMaxCells();
populateViews();
getViewTreeObserver().removeOnPreDrawListener(this);
mMaxCellUpdateScheduled = false;
return true;
}
};
}
|
AndroidX/androidx
|
slice/slice-view/src/main/java/androidx/slice/widget/GridRowView.java
|
Java
|
apache-2.0
| 34,576
|
"""Playbook Args"""
from argparse import ArgumentParser
class Args:
"""Playbook Args"""
def __init__(self, parser: ArgumentParser):
"""Initialize class properties."""
|
kstilwell/tcex
|
app_init/service_webhook/args.py
|
Python
|
apache-2.0
| 186
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package javax.batch.operations;
public class JobExecutionNotRunningException extends BatchRuntimeException {
private static final long serialVersionUID = 1L;
public JobExecutionNotRunningException() {
// no-op
}
public JobExecutionNotRunningException(final String message) {
super(message);
}
public JobExecutionNotRunningException(final Throwable cause) {
super(cause);
}
public JobExecutionNotRunningException(final String message, final Throwable cause) {
super(message, cause);
}
}
|
salyh/javamailspec
|
geronimo-jbatch_1.0_spec/src/main/java/javax/batch/operations/JobExecutionNotRunningException.java
|
Java
|
apache-2.0
| 1,349
|
/*
* Copyright 2020 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.optaplanner.core.impl.score.stream.drools.common;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
public final class QuadTuple<A, B, C, D> implements FactTuple {
public final A a;
public final B b;
public final C c;
public final D d;
private final int hashCode;
public QuadTuple(A a, B b, C c, D d) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.hashCode = Objects.hash(a, b, c, d);
}
@Override
public List<Object> asList() {
return Arrays.asList(a, b, c, d);
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || !Objects.equals(getClass(), o.getClass())) {
return false;
}
final QuadTuple<?, ?, ?, ?> other = (QuadTuple<?, ?, ?, ?>) o;
return hashCode == other.hashCode &&
Objects.equals(a, other.a) &&
Objects.equals(b, other.b) &&
Objects.equals(c, other.c) &&
Objects.equals(d, other.d);
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public String toString() {
return "QuadTuple(" + a + ", " + b + ", " + c + ", " + d + ")";
}
}
|
ge0ffrey/optaplanner
|
optaplanner-core/src/main/java/org/optaplanner/core/impl/score/stream/drools/common/QuadTuple.java
|
Java
|
apache-2.0
| 1,951
|
package org.elasticsearch.painless;
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/** Currently just a dummy class for testing a few features not yet exposed by whitelist! */
public class FeatureTest {
private int x;
private int y;
/** empty ctor */
public FeatureTest() {
}
/** ctor with params */
public FeatureTest(int x, int y) {
this.x = x;
this.y = y;
}
/** getter for x */
public int getX() {
return x;
}
/** setter for x */
public void setX(int x) {
this.x = x;
}
/** getter for y */
public int getY() {
return y;
}
/** setter for y */
public void setY(int y) {
this.y = y;
}
/** static method that returns true */
public static boolean overloadedStatic() {
return true;
}
/** static method that returns what you ask it */
public static boolean overloadedStatic(boolean whatToReturn) {
return whatToReturn;
}
}
|
camilojd/elasticsearch
|
modules/lang-painless/src/main/java/org/elasticsearch/painless/FeatureTest.java
|
Java
|
apache-2.0
| 1,752
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
The internal helper function CharacterRange takes two CharSet parameters A and B and performs the
following:
2. Let a be the one character in CharSet A.
3. Let b be the one character in CharSet B.
4. Let i be the character value of character a.
5. Let j be the character value of character b.
6. If i > j, throw a SyntaxError exception.
es5id: 15.10.2.15_A1_T40
description: >
Checking if execution of "/[d-G\u0061]/.exec("a")" leads to
throwing the correct exception
---*/
//CHECK#1
try {
$ERROR('#1.1: /[d-G\\u0061]/.exec("a") throw SyntaxError. Actual: ' + (new RegExp("[d-G\\u0061]").exec("a")));
} catch (e) {
if((e instanceof SyntaxError) !== true){
$ERROR('#1.2: /[d-G\\u0061]/.exec("a") throw SyntaxError. Actual: ' + (e));
}
}
|
baslr/ArangoDB
|
3rdParty/V8/V8-5.0.71.39/test/test262/data/test/built-ins/RegExp/S15.10.2.15_A1_T40.js
|
JavaScript
|
apache-2.0
| 930
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* The transaction buffer snapshot metadata.
*/
package org.apache.pulsar.broker.transaction.buffer.matadata;
|
massakam/pulsar
|
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/matadata/package-info.java
|
Java
|
apache-2.0
| 924
|
// Copyright 2017 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.
package ranger
import (
"github.com/juju/errors"
"github.com/pingcap/tidb/ast"
"github.com/pingcap/tidb/expression"
"github.com/pingcap/tidb/model"
"github.com/pingcap/tidb/sessionctx"
"github.com/pingcap/tidb/types"
)
// detachColumnCNFConditions detaches the condition for calculating range from the other conditions.
// Please make sure that the top level is CNF form.
func detachColumnCNFConditions(sctx sessionctx.Context, conditions []expression.Expression, checker *conditionChecker) ([]expression.Expression, []expression.Expression) {
var accessConditions, filterConditions []expression.Expression
for _, cond := range conditions {
if sf, ok := cond.(*expression.ScalarFunction); ok && sf.FuncName.L == ast.LogicOr {
dnfItems := expression.FlattenDNFConditions(sf)
colulmnDNFItems, hasResidual := detachColumnDNFConditions(sctx, dnfItems, checker)
// If this CNF has expression that cannot be resolved as access condition, then the total DNF expression
// should be also appended into filter condition.
if hasResidual {
filterConditions = append(filterConditions, cond)
}
if len(colulmnDNFItems) == 0 {
continue
}
rebuildDNF := expression.ComposeDNFCondition(sctx, colulmnDNFItems...)
accessConditions = append(accessConditions, rebuildDNF)
continue
}
if !checker.check(cond) {
filterConditions = append(filterConditions, cond)
continue
}
accessConditions = append(accessConditions, cond)
if checker.shouldReserve {
filterConditions = append(filterConditions, cond)
checker.shouldReserve = checker.length != types.UnspecifiedLength
}
}
return accessConditions, filterConditions
}
// detachColumnDNFConditions detaches the condition for calculating range from the other conditions.
// Please make sure that the top level is DNF form.
func detachColumnDNFConditions(sctx sessionctx.Context, conditions []expression.Expression, checker *conditionChecker) ([]expression.Expression, bool) {
var (
hasResidualConditions bool
accessConditions []expression.Expression
)
for _, cond := range conditions {
if sf, ok := cond.(*expression.ScalarFunction); ok && sf.FuncName.L == ast.LogicAnd {
cnfItems := expression.FlattenCNFConditions(sf)
columnCNFItems, others := detachColumnCNFConditions(sctx, cnfItems, checker)
if len(others) > 0 {
hasResidualConditions = true
}
// If one part of DNF has no access condition. Then this DNF cannot get range.
if len(columnCNFItems) == 0 {
return nil, true
}
rebuildCNF := expression.ComposeCNFCondition(sctx, columnCNFItems...)
accessConditions = append(accessConditions, rebuildCNF)
} else if checker.check(cond) {
accessConditions = append(accessConditions, cond)
if checker.shouldReserve {
hasResidualConditions = true
checker.shouldReserve = checker.length != types.UnspecifiedLength
}
} else {
return nil, true
}
}
return accessConditions, hasResidualConditions
}
// getEqOrInColOffset checks if the expression is a eq function that one side is constant and another is column or an
// in function which is `column in (constant list)`.
// If so, it will return the offset of this column in the slice, otherwise return -1 for not found.
func getEqOrInColOffset(expr expression.Expression, cols []*expression.Column) int {
f, ok := expr.(*expression.ScalarFunction)
if !ok {
return -1
}
if f.FuncName.L == ast.EQ {
if c, ok := f.GetArgs()[0].(*expression.Column); ok {
if _, ok := f.GetArgs()[1].(*expression.Constant); ok {
for i, col := range cols {
if col.Equal(nil, c) {
return i
}
}
}
}
if c, ok := f.GetArgs()[1].(*expression.Column); ok {
if _, ok := f.GetArgs()[0].(*expression.Constant); ok {
for i, col := range cols {
if col.Equal(nil, c) {
return i
}
}
}
}
}
if f.FuncName.L == ast.In {
c, ok := f.GetArgs()[0].(*expression.Column)
if !ok {
return -1
}
for _, arg := range f.GetArgs()[1:] {
if _, ok := arg.(*expression.Constant); !ok {
return -1
}
}
for i, col := range cols {
if col.Equal(nil, c) {
return i
}
}
}
return -1
}
// detachCNFCondAndBuildRangeForIndex will detach the index filters from table filters. These conditions are connected with `and`
// It will first find the point query column and then extract the range query column.
// considerDNF is true means it will try to extract access conditions from the DNF expressions.
func detachCNFCondAndBuildRangeForIndex(sctx sessionctx.Context, conditions []expression.Expression, cols []*expression.Column,
tpSlice []*types.FieldType, lengths []int, considerDNF bool) ([]*Range, []expression.Expression, []expression.Expression, int, error) {
var (
eqCount int
ranges []*Range
err error
)
accessConds, filterConds := extractEqAndInCondition(conditions, cols, lengths)
for ; eqCount < len(accessConds); eqCount++ {
if accessConds[eqCount].(*expression.ScalarFunction).FuncName.L != ast.EQ {
break
}
}
// We should remove all accessConds, so that they will not be added to filter conditions.
conditions = removeAccessConditions(conditions, accessConds)
eqOrInCount := len(accessConds)
if eqOrInCount == len(cols) {
// If curIndex equals to len of index columns, it means the rest conditions haven't been appended to filter conditions.
filterConds = append(filterConds, conditions...)
ranges, err = buildCNFIndexRange(sctx.GetSessionVars().StmtCtx, cols, tpSlice, lengths, eqOrInCount, accessConds)
if err != nil {
return nil, nil, nil, 0, errors.Trace(err)
}
return ranges, accessConds, filterConds, eqCount, nil
}
checker := &conditionChecker{
colName: cols[eqOrInCount].ColName,
length: lengths[eqOrInCount],
shouldReserve: lengths[eqOrInCount] != types.UnspecifiedLength,
}
if considerDNF {
accesses, filters := detachColumnCNFConditions(sctx, conditions, checker)
accessConds = append(accessConds, accesses...)
filterConds = append(filterConds, filters...)
} else {
for _, cond := range conditions {
if !checker.check(cond) {
filterConds = append(filterConds, cond)
continue
}
accessConds = append(accessConds, cond)
}
}
ranges, err = buildCNFIndexRange(sctx.GetSessionVars().StmtCtx, cols, tpSlice, lengths, eqOrInCount, accessConds)
return ranges, accessConds, filterConds, eqCount, errors.Trace(err)
}
func extractEqAndInCondition(conditions []expression.Expression, cols []*expression.Column,
lengths []int) (accesses, filters []expression.Expression) {
accesses = make([]expression.Expression, len(cols))
for _, cond := range conditions {
offset := getEqOrInColOffset(cond, cols)
if offset != -1 {
accesses[offset] = cond
}
}
for i, cond := range accesses {
if cond == nil {
accesses = accesses[:i]
break
}
if lengths[i] != types.UnspecifiedLength {
filters = append(filters, cond)
}
}
return accesses, filters
}
// detachDNFCondAndBuildRangeForIndex will detach the index filters from table filters when it's a DNF.
// We will detach the conditions of every DNF items, then compose them to a DNF.
func detachDNFCondAndBuildRangeForIndex(sctx sessionctx.Context, condition *expression.ScalarFunction,
cols []*expression.Column, newTpSlice []*types.FieldType, lengths []int) ([]*Range, []expression.Expression, bool, error) {
sc := sctx.GetSessionVars().StmtCtx
firstColumnChecker := &conditionChecker{
colName: cols[0].ColName,
shouldReserve: lengths[0] != types.UnspecifiedLength,
length: lengths[0],
}
rb := builder{sc: sc}
dnfItems := expression.FlattenDNFConditions(condition)
newAccessItems := make([]expression.Expression, 0, len(dnfItems))
var totalRanges []*Range
hasResidual := false
for _, item := range dnfItems {
if sf, ok := item.(*expression.ScalarFunction); ok && sf.FuncName.L == ast.LogicAnd {
cnfItems := expression.FlattenCNFConditions(sf)
var accesses, filters []expression.Expression
ranges, accesses, filters, _, err := detachCNFCondAndBuildRangeForIndex(sctx, cnfItems, cols, newTpSlice, lengths, true)
if err != nil {
return nil, nil, false, nil
}
if len(accesses) == 0 {
return FullRange(), nil, true, nil
}
if len(filters) > 0 {
hasResidual = true
}
totalRanges = append(totalRanges, ranges...)
newAccessItems = append(newAccessItems, expression.ComposeCNFCondition(sctx, accesses...))
} else if firstColumnChecker.check(item) {
if firstColumnChecker.shouldReserve {
hasResidual = true
firstColumnChecker.shouldReserve = lengths[0] != types.UnspecifiedLength
}
points := rb.build(item)
ranges, err := points2Ranges(sc, points, newTpSlice[0])
if err != nil {
return nil, nil, false, errors.Trace(err)
}
totalRanges = append(totalRanges, ranges...)
newAccessItems = append(newAccessItems, item)
} else {
return FullRange(), nil, true, nil
}
}
totalRanges, err := unionRanges(sc, totalRanges)
if err != nil {
return nil, nil, false, errors.Trace(err)
}
return totalRanges, []expression.Expression{expression.ComposeDNFCondition(sctx, newAccessItems...)}, hasResidual, nil
}
// DetachCondAndBuildRangeForIndex will detach the index filters from table filters.
// If the top layer is DNF, we return a int slice which is eqAndInCount of every DNF item.
// Otherwise just one number is returned.
func DetachCondAndBuildRangeForIndex(sctx sessionctx.Context, conditions []expression.Expression, cols []*expression.Column,
lengths []int) ([]*Range, []expression.Expression, []expression.Expression, int, error) {
newTpSlice := make([]*types.FieldType, 0, len(cols))
for _, col := range cols {
newTpSlice = append(newTpSlice, newFieldType(col.RetType))
}
if len(conditions) == 1 {
if sf, ok := conditions[0].(*expression.ScalarFunction); ok && sf.FuncName.L == ast.LogicOr {
ranges, accesses, hasResidual, err := detachDNFCondAndBuildRangeForIndex(sctx, sf, cols, newTpSlice, lengths)
if err != nil {
return nil, nil, nil, 0, errors.Trace(err)
}
// If this DNF have something cannot be to calculate range, then all this DNF should be pushed as filter condition.
if hasResidual {
return ranges, accesses, conditions, 0, nil
}
return ranges, accesses, nil, 0, nil
}
}
return detachCNFCondAndBuildRangeForIndex(sctx, conditions, cols, newTpSlice, lengths, true)
}
// DetachSimpleCondAndBuildRangeForIndex will detach the index filters from table filters.
// It will find the point query column firstly and then extract the range query column.
func DetachSimpleCondAndBuildRangeForIndex(sctx sessionctx.Context, conditions []expression.Expression,
cols []*expression.Column, lengths []int) (ranges []*Range, accessConds []expression.Expression, err error) {
newTpSlice := make([]*types.FieldType, 0, len(cols))
for _, col := range cols {
newTpSlice = append(newTpSlice, newFieldType(col.RetType))
}
ranges, accessConds, _, _, err = detachCNFCondAndBuildRangeForIndex(sctx, conditions, cols, newTpSlice, lengths, false)
return ranges, accessConds, nil
}
func removeAccessConditions(conditions, accessConds []expression.Expression) []expression.Expression {
filterConds := make([]expression.Expression, 0, len(conditions))
for _, cond := range conditions {
if !expression.Contains(accessConds, cond) {
filterConds = append(filterConds, cond)
}
}
return filterConds
}
// ExtractAccessConditionsForColumn detaches the access conditions used for range calculation.
func ExtractAccessConditionsForColumn(conds []expression.Expression, colName model.CIStr) []expression.Expression {
if colName.L == "" {
return nil
}
checker := conditionChecker{
colName: colName,
length: types.UnspecifiedLength,
}
accessConds := make([]expression.Expression, 0, 8)
return expression.Filter(accessConds, conds, checker.check)
}
// DetachCondsForTableRange detaches the conditions used for range calculation form other useless conditions for
// calculating the table range.
func DetachCondsForTableRange(sctx sessionctx.Context, conds []expression.Expression, col *expression.Column) (accessContditions, otherConditions []expression.Expression) {
checker := &conditionChecker{
colName: col.ColName,
length: types.UnspecifiedLength,
}
return detachColumnCNFConditions(sctx, conds, checker)
}
|
ngaut/tidb
|
util/ranger/detacher.go
|
GO
|
apache-2.0
| 12,839
|
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/oslogin/common/common.proto
namespace Google\Cloud\OsLogin\Common;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* The SSH public key information associated with a Google account.
*
* Generated from protobuf message <code>google.cloud.oslogin.common.SshPublicKey</code>
*/
class SshPublicKey extends \Google\Protobuf\Internal\Message
{
/**
* Public key text in SSH format, defined by
* <a href="https://www.ietf.org/rfc/rfc4253.txt" target="_blank">RFC4253</a>
* section 6.6.
*
* Generated from protobuf field <code>string key = 1;</code>
*/
private $key = '';
/**
* An expiration time in microseconds since epoch.
*
* Generated from protobuf field <code>int64 expiration_time_usec = 2;</code>
*/
private $expiration_time_usec = 0;
/**
* Output only. The SHA-256 fingerprint of the SSH public key.
*
* Generated from protobuf field <code>string fingerprint = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
*/
private $fingerprint = '';
/**
* Output only. The canonical resource name.
*
* Generated from protobuf field <code>string name = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
*/
private $name = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $key
* Public key text in SSH format, defined by
* <a href="https://www.ietf.org/rfc/rfc4253.txt" target="_blank">RFC4253</a>
* section 6.6.
* @type int|string $expiration_time_usec
* An expiration time in microseconds since epoch.
* @type string $fingerprint
* Output only. The SHA-256 fingerprint of the SSH public key.
* @type string $name
* Output only. The canonical resource name.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Cloud\Oslogin\Common\Common::initOnce();
parent::__construct($data);
}
/**
* Public key text in SSH format, defined by
* <a href="https://www.ietf.org/rfc/rfc4253.txt" target="_blank">RFC4253</a>
* section 6.6.
*
* Generated from protobuf field <code>string key = 1;</code>
* @return string
*/
public function getKey()
{
return $this->key;
}
/**
* Public key text in SSH format, defined by
* <a href="https://www.ietf.org/rfc/rfc4253.txt" target="_blank">RFC4253</a>
* section 6.6.
*
* Generated from protobuf field <code>string key = 1;</code>
* @param string $var
* @return $this
*/
public function setKey($var)
{
GPBUtil::checkString($var, True);
$this->key = $var;
return $this;
}
/**
* An expiration time in microseconds since epoch.
*
* Generated from protobuf field <code>int64 expiration_time_usec = 2;</code>
* @return int|string
*/
public function getExpirationTimeUsec()
{
return $this->expiration_time_usec;
}
/**
* An expiration time in microseconds since epoch.
*
* Generated from protobuf field <code>int64 expiration_time_usec = 2;</code>
* @param int|string $var
* @return $this
*/
public function setExpirationTimeUsec($var)
{
GPBUtil::checkInt64($var);
$this->expiration_time_usec = $var;
return $this;
}
/**
* Output only. The SHA-256 fingerprint of the SSH public key.
*
* Generated from protobuf field <code>string fingerprint = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return string
*/
public function getFingerprint()
{
return $this->fingerprint;
}
/**
* Output only. The SHA-256 fingerprint of the SSH public key.
*
* Generated from protobuf field <code>string fingerprint = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @param string $var
* @return $this
*/
public function setFingerprint($var)
{
GPBUtil::checkString($var, True);
$this->fingerprint = $var;
return $this;
}
/**
* Output only. The canonical resource name.
*
* Generated from protobuf field <code>string name = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Output only. The canonical resource name.
*
* Generated from protobuf field <code>string name = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
}
|
googleapis/google-cloud-php-oslogin
|
src/Common/SshPublicKey.php
|
PHP
|
apache-2.0
| 5,050
|
package org.ovirt.engine.core.utils;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Provides utilities for handling resource files.
*/
public class ResourceUtils {
private static final Logger log = LoggerFactory.getLogger(ResourceUtils.class);
/**
* Loads a collection of {@link Properties} from a resource file.
*
* @param cls
* The class (used by the ClassLoader)
* @param name
* The resource file name
* @return The Properties class
*/
public static Properties loadProperties(Class<?> cls, String name) throws IOException {
final String ERR_MSG = "Failed to locate resource file: " + name;
InputStream is = cls.getClassLoader().getResourceAsStream(name);
if (is == null) {
log.error(ERR_MSG);
throw new FileNotFoundException(ERR_MSG);
}
try {
Properties props = new Properties();
props.load(is);
return props;
} finally {
try {
is.close();
} catch (Exception e) {
log.error("Failed to close input stream: {}", e.getMessage());
log.debug("Exception", e);
}
}
}
}
|
OpenUniversity/ovirt-engine
|
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ResourceUtils.java
|
Java
|
apache-2.0
| 1,389
|
from src.utils import glove
import numpy as np
import string
class jester_vectorize():
def __init__(self, user_interactions, content, user_vector_type, content_vector_type, **support_files):
"""Set up the Jester Vectorizer.
Args:
user_interactions (rdd): The raw data of users interactions with
the system. For Jester, each "row" is as follows:
Row(joke_id, rating, user_id)
content (rdd): The raw data about the items in the dataset. For
Jester, each row is as follows: Row(joke_id, joke_text)
user_vector_type (str): The type of user vector desired. One of
'ratings', 'pos_ratings', 'ratings_to_interact', or None.
content_vector_type: The type of content vector desired. One of
'glove' or None.
support_files: Only one support file is used for this class:
glove_model: An instantiated glove model.
"""
self.user_vector_type = user_vector_type
self.content_vector_type = content_vector_type
self.user_interactions = user_interactions
self.content = content
# If no support files were passed in, initialize an empty support file
if support_files:
self.support_files = support_files
else:
self.support_files = {}
def get_user_vector(self):
"""Produce an RDD containing tuples of the form (user, item, rating).
There are three options when producing these user vectors:
ratings: The ratings the users assigned
pos_ratings: Only ratings > 0, all others are discarded
ratings_to_interact: Positive ratings are mapped to 1, negative to -1.
"""
uir = self.user_interactions.map(lambda row: (row.user_id, row.joke_id, row.rating))
if self.user_vector_type == 'ratings':
return uir
elif self.user_vector_type == 'pos_ratings':
return uir.filter(lambda (u, i, r): r > 0)
elif self.user_vector_type == 'ratings_to_interact':
return uir.map(lambda (u, i, r): (u, i, 1 if r > 0 else -1))
elif self.user_vector_type == 'none' or self.user_vector_type is None:
return None
else:
print "Please choose a user_vector_type between 'ratings', 'pos_ratings', 'ratings_to_interact', and 'none'"
return None
def get_content_vector(self):
"""Produce an RDD containing tuples of the form (item, content_vector).
There is one method of producing content vectors:
glove: Use the Stanford GloVe model to sum vector ratings of all
the words in the joke.
"""
if self.content_vector_type == 'glove':
# The model is initialized by the user and passed in via the
# support_file object
glove_model = self.support_files["glove_model"]
# Transformation function
def joke_to_glove(row, glove):
vector = np.zeros(glove.vector_size)
for chunk in row.joke_text.split():
word = chunk.lower().strip(string.punctuation)
vector += glove[word]
return (row.joke_id, vector)
# Run the transformation function over the data
return self.content.map(lambda row: joke_to_glove(row, glove_model))
elif self.content_vector_type == 'none' or self.content_vector_type is None:
return None
else:
print "Please choose a content_vector_type between 'glove' or None"
return None
|
tiffanyj41/hermes
|
src/data_prep/jester_vectorize.py
|
Python
|
apache-2.0
| 3,684
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/rekognition/model/Parent.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace Rekognition
{
namespace Model
{
Parent::Parent() :
m_nameHasBeenSet(false)
{
}
Parent::Parent(JsonView jsonValue) :
m_nameHasBeenSet(false)
{
*this = jsonValue;
}
Parent& Parent::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("Name"))
{
m_name = jsonValue.GetString("Name");
m_nameHasBeenSet = true;
}
return *this;
}
JsonValue Parent::Jsonize() const
{
JsonValue payload;
if(m_nameHasBeenSet)
{
payload.WithString("Name", m_name);
}
return payload;
}
} // namespace Model
} // namespace Rekognition
} // namespace Aws
|
awslabs/aws-sdk-cpp
|
aws-cpp-sdk-rekognition/source/model/Parent.cpp
|
C++
|
apache-2.0
| 903
|
/*
* ModeShape (http://www.modeshape.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.modeshape.jcr;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import org.modeshape.common.annotation.Immutable;
import org.modeshape.common.logging.Logger;
import org.modeshape.common.util.CheckArg;
import org.modeshape.common.util.StringUtil;
import org.modeshape.jcr.RepositoryConfiguration.Component;
import org.modeshape.jcr.api.text.TextExtractor;
import org.modeshape.jcr.text.TextExtractorOutput;
import org.modeshape.jcr.value.BinaryKey;
import org.modeshape.jcr.value.BinaryValue;
import org.modeshape.jcr.value.binary.AbstractBinaryStore;
import org.modeshape.jcr.value.binary.InMemoryBinaryValue;
/**
* Facility for managing {@link TextExtractor} instances and submitting text extraction work
*/
@Immutable
public final class TextExtractors {
private static final Logger LOGGER = Logger.getLogger(TextExtractors.class);
private final List<TextExtractor> extractors;
private final ExecutorService extractingQueue;
private final List<Future<?>> extractionResults;
private final ConcurrentHashMap<BinaryKey, CountDownLatch> workerLatches;
private volatile boolean active;
public TextExtractors( ExecutorService extractingQueue,
List<TextExtractor> extractors ) {
this.extractingQueue = extractingQueue;
this.workerLatches = new ConcurrentHashMap<>();
this.extractionResults = new ArrayList<>();
this.extractors = extractors;
this.active = true;
}
protected TextExtractors( JcrRepository.RunningState repository,
RepositoryConfiguration.TextExtraction extracting ) {
this(repository.context().getCachedTreadPool(extracting.getThreadPoolName(), extracting.getMaxPoolSize()),
getConfiguredExtractors(repository, extracting));
}
protected void shutdown() {
this.active = false;
this.extractors.clear();
this.extractingQueue.shutdown();
for (Future<?> extractionResult : extractionResults ) {
extractionResult.cancel(true);
}
extractionResults.clear();
}
public boolean extractionEnabled() {
return active && !extractors.isEmpty();
}
public String extract( InMemoryBinaryValue inMemoryBinaryValue,
TextExtractor.Context context ) {
if (!extractionEnabled()) {
return null;
}
try {
String mimeType = inMemoryBinaryValue.getMimeType();
TextExtractorOutput output = new TextExtractorOutput();
// Run through the extractors and have them extract the text - the first one which accepts the mime-type will win
for (TextExtractor extractor : extractors) {
if (!extractor.supportsMimeType(mimeType)) {
continue;
}
extractor.extractFrom(inMemoryBinaryValue, output, context);
break;
}
return output.getText();
} catch (Exception e) {
LOGGER.error(e, JcrI18n.errorExtractingTextFromBinary, inMemoryBinaryValue.getHexHash(), e.getLocalizedMessage());
}
return null;
}
public CountDownLatch extract( AbstractBinaryStore store,
BinaryValue binaryValue,
TextExtractor.Context context ) {
if (!extractionEnabled()) {
return null;
}
if (binaryValue instanceof InMemoryBinaryValue) {
// We never extract the text for binary values this way ...
return null;
}
CheckArg.isNotNull(binaryValue, "binaryValue");
CountDownLatch latch = getWorkerLatch(binaryValue.getKey(), true);
extractionResults.add(extractingQueue.submit(new Worker(store, binaryValue, context, latch)));
return latch;
}
public CountDownLatch getWorkerLatch( BinaryKey binaryKey,
boolean createIfMissing ) {
if (createIfMissing) {
CountDownLatch latch = new CountDownLatch(1);
CountDownLatch existingLatch = workerLatches.putIfAbsent(binaryKey, latch);
return existingLatch != null ? existingLatch : latch;
}
return workerLatches.get(binaryKey);
}
private static List<TextExtractor> getConfiguredExtractors( JcrRepository.RunningState repository,
RepositoryConfiguration.TextExtraction extracting ) {
List<Component> extractorComponents = extracting.getTextExtractors(repository.problems());
List<TextExtractor> extractors = new ArrayList<TextExtractor>(extractorComponents.size());
for (Component component : extractorComponents) {
try {
TextExtractor extractor = component.createInstance(TextExtractors.class.getClassLoader());
extractor.setLogger(ExtensionLogger.getLogger(extractor.getClass()));
extractors.add(extractor);
} catch (Throwable t) {
String desc = component.getName();
String repoName = repository.name();
repository.error(t, JcrI18n.unableToInitializeTextExtractor, desc, repoName, t.getMessage());
}
}
return extractors;
}
/**
* A unit of work which extracts text from a binary value, stores that text in a store and notifies a latch that the
* extraction operation has finished.
*/
protected final class Worker implements Runnable {
private final BinaryValue binaryValue;
private final TextExtractor.Context context;
private final AbstractBinaryStore store;
private final CountDownLatch latch;
protected Worker( AbstractBinaryStore store,
BinaryValue binaryValue,
TextExtractor.Context context,
CountDownLatch latch ) {
this.store = store;
this.binaryValue = binaryValue;
this.context = context;
this.latch = latch;
}
@SuppressWarnings( "synthetic-access" )
@Override
public void run() {
if (!active) {
return;
}
try {
// only extract text if there isn't a stored value for the binary key (note that any changes in the binary will
// produce a different key)
if (store.getExtractedText(binaryValue) != null) {
return;
}
String mimeType = binaryValue.getMimeType();
TextExtractorOutput output = new TextExtractorOutput();
// Run through the extractors and have them extract the text - the first one which accepts the mime-type will win
for (TextExtractor extractor : extractors) {
if (!extractor.supportsMimeType(mimeType)) {
continue;
}
extractor.extractFrom(binaryValue, output, context);
break;
}
String extractedText = output.getText();
if (extractedText != null && !StringUtil.isBlank(extractedText)) {
store.storeExtractedText(binaryValue, extractedText);
}
} catch (InterruptedException ie) {
Thread.interrupted();
LOGGER.warn(RepositoryI18n.shutdownWhileExtractingText, binaryValue.getKey(), ie.getMessage());
} catch (Throwable t) {
if (!active) {
LOGGER.warn(RepositoryI18n.shutdownWhileExtractingText, binaryValue.getKey(), t.getMessage());
} else {
LOGGER.error(t, JcrI18n.errorExtractingTextFromBinary, binaryValue.getHexHash(), t.getLocalizedMessage());
}
} finally {
// decrement the latch regardless of success/failure to avoid blocking, as extraction is not retried
latch.countDown();
}
}
}
}
|
stemig62/modeshape
|
modeshape-jcr/src/main/java/org/modeshape/jcr/TextExtractors.java
|
Java
|
apache-2.0
| 8,945
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/sagemaker/model/UpdateTrialComponentResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::SageMaker::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
UpdateTrialComponentResult::UpdateTrialComponentResult()
{
}
UpdateTrialComponentResult::UpdateTrialComponentResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
UpdateTrialComponentResult& UpdateTrialComponentResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("TrialComponentArn"))
{
m_trialComponentArn = jsonValue.GetString("TrialComponentArn");
}
return *this;
}
|
jt70471/aws-sdk-cpp
|
aws-cpp-sdk-sagemaker/source/model/UpdateTrialComponentResult.cpp
|
C++
|
apache-2.0
| 1,020
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import errno
import functools
import os
import shutil
import tempfile
import time
import weakref
from eventlet import semaphore
from nova.openstack.common import cfg
from nova.openstack.common import fileutils
from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
util_opts = [
cfg.BoolOpt('disable_process_locking', default=False,
help='Whether to disable inter-process locks'),
cfg.StrOpt('lock_path',
default=os.path.abspath(os.path.join(os.path.dirname(__file__),
'../')),
help='Directory to use for lock files')
]
CONF = cfg.CONF
CONF.register_opts(util_opts)
class _InterProcessLock(object):
"""Lock implementation which allows multiple locks, working around
issues like bugs.debian.org/cgi-bin/bugreport.cgi?bug=632857 and does
not require any cleanup. Since the lock is always held on a file
descriptor rather than outside of the process, the lock gets dropped
automatically if the process crashes, even if __exit__ is not executed.
There are no guarantees regarding usage by multiple green threads in a
single process here. This lock works only between processes. Exclusive
access between local threads should be achieved using the semaphores
in the @synchronized decorator.
Note these locks are released when the descriptor is closed, so it's not
safe to close the file descriptor while another green thread holds the
lock. Just opening and closing the lock file can break synchronisation,
so lock files must be accessed only using this abstraction.
"""
def __init__(self, name):
self.lockfile = None
self.fname = name
def __enter__(self):
self.lockfile = open(self.fname, 'w')
while True:
try:
# Using non-blocking locks since green threads are not
# patched to deal with blocking locking calls.
# Also upon reading the MSDN docs for locking(), it seems
# to have a laughable 10 attempts "blocking" mechanism.
self.trylock()
return self
except IOError, e:
if e.errno in (errno.EACCES, errno.EAGAIN):
# external locks synchronise things like iptables
# updates - give it some time to prevent busy spinning
time.sleep(0.01)
else:
raise
def __exit__(self, exc_type, exc_val, exc_tb):
try:
self.unlock()
self.lockfile.close()
except IOError:
LOG.exception(_("Could not release the acquired lock `%s`"),
self.fname)
def trylock(self):
raise NotImplementedError()
def unlock(self):
raise NotImplementedError()
class _WindowsLock(_InterProcessLock):
def trylock(self):
msvcrt.locking(self.lockfile, msvcrt.LK_NBLCK, 1)
def unlock(self):
msvcrt.locking(self.lockfile, msvcrt.LK_UNLCK, 1)
class _PosixLock(_InterProcessLock):
def trylock(self):
fcntl.lockf(self.lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
def unlock(self):
fcntl.lockf(self.lockfile, fcntl.LOCK_UN)
if os.name == 'nt':
import msvcrt
InterProcessLock = _WindowsLock
else:
import fcntl
InterProcessLock = _PosixLock
_semaphores = weakref.WeakValueDictionary()
def synchronized(name, lock_file_prefix, external=False, lock_path=None):
"""Synchronization decorator.
Decorating a method like so::
@synchronized('mylock')
def foo(self, *args):
...
ensures that only one thread will execute the bar method at a time.
Different methods can share the same lock::
@synchronized('mylock')
def foo(self, *args):
...
@synchronized('mylock')
def bar(self, *args):
...
This way only one of either foo or bar can be executing at a time.
The lock_file_prefix argument is used to provide lock files on disk with a
meaningful prefix. The prefix should end with a hyphen ('-') if specified.
The external keyword argument denotes whether this lock should work across
multiple processes. This means that if two different workers both run a
a method decorated with @synchronized('mylock', external=True), only one
of them will execute at a time.
The lock_path keyword argument is used to specify a special location for
external lock files to live. If nothing is set, then CONF.lock_path is
used as a default.
"""
def wrap(f):
@functools.wraps(f)
def inner(*args, **kwargs):
# NOTE(soren): If we ever go natively threaded, this will be racy.
# See http://stackoverflow.com/questions/5390569/dyn
# amically-allocating-and-destroying-mutexes
sem = _semaphores.get(name, semaphore.Semaphore())
if name not in _semaphores:
# this check is not racy - we're already holding ref locally
# so GC won't remove the item and there was no IO switch
# (only valid in greenthreads)
_semaphores[name] = sem
with sem:
LOG.debug(_('Got semaphore "%(lock)s" for method '
'"%(method)s"...'), {'lock': name,
'method': f.__name__})
if external and not CONF.disable_process_locking:
LOG.debug(_('Attempting to grab file lock "%(lock)s" for '
'method "%(method)s"...'),
{'lock': name, 'method': f.__name__})
cleanup_dir = False
# We need a copy of lock_path because it is non-local
local_lock_path = lock_path
if not local_lock_path:
local_lock_path = CONF.lock_path
if not local_lock_path:
cleanup_dir = True
local_lock_path = tempfile.mkdtemp()
if not os.path.exists(local_lock_path):
cleanup_dir = True
fileutils.ensure_tree(local_lock_path)
# NOTE(mikal): the lock name cannot contain directory
# separators
safe_name = name.replace(os.sep, '_')
lock_file_name = '%s%s' % (lock_file_prefix, safe_name)
lock_file_path = os.path.join(local_lock_path,
lock_file_name)
try:
lock = InterProcessLock(lock_file_path)
with lock:
LOG.debug(_('Got file lock "%(lock)s" at %(path)s '
'for method "%(method)s"...'),
{'lock': name,
'path': lock_file_path,
'method': f.__name__})
retval = f(*args, **kwargs)
finally:
# NOTE(vish): This removes the tempdir if we needed
# to create one. This is used to cleanup
# the locks left behind by unit tests.
if cleanup_dir:
shutil.rmtree(local_lock_path)
else:
retval = f(*args, **kwargs)
return retval
return inner
return wrap
|
houshengbo/nova_vmware_compute_driver
|
nova/openstack/common/lockutils.py
|
Python
|
apache-2.0
| 8,446
|
/*
* Copyright 2017 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.netflix.spinnaker.clouddriver.aws.lifecycle;
import com.netflix.spinnaker.clouddriver.aws.security.NetflixAmazonCredentials;
import com.netflix.spinnaker.clouddriver.security.AccountCredentials;
import java.util.Collection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
class ARN {
static final Pattern PATTERN = Pattern.compile("arn:aws(?:-cn|-us-gov)?:.*:(.*):(\\d+):(.*)");
String arn;
String region;
String name;
NetflixAmazonCredentials account;
ARN(Collection<? extends AccountCredentials> accountCredentials, String arn) {
this.arn = arn;
Matcher sqsMatcher = PATTERN.matcher(arn);
if (!sqsMatcher.matches()) {
throw new IllegalArgumentException(arn + " is not a valid SNS or SQS ARN");
}
this.region = sqsMatcher.group(1);
this.name = sqsMatcher.group(3);
String accountId = sqsMatcher.group(2);
this.account = (NetflixAmazonCredentials) accountCredentials.stream()
.filter(c -> accountId.equals(c.getAccountId()))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("No account credentials found for " + accountId));
}
}
|
danveloper/clouddriver
|
clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/lifecycle/ARN.java
|
Java
|
apache-2.0
| 1,746
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/iot1click-projects/IoT1ClickProjects_EXPORTS.h>
#include <aws/iot1click-projects/IoT1ClickProjectsRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace IoT1ClickProjects
{
namespace Model
{
/**
*/
class AWS_IOT1CLICKPROJECTS_API AssociateDeviceWithPlacementRequest : public IoT1ClickProjectsRequest
{
public:
AssociateDeviceWithPlacementRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "AssociateDeviceWithPlacement"; }
Aws::String SerializePayload() const override;
/**
* <p>The name of the project containing the placement in which to associate the
* device.</p>
*/
inline const Aws::String& GetProjectName() const{ return m_projectName; }
/**
* <p>The name of the project containing the placement in which to associate the
* device.</p>
*/
inline bool ProjectNameHasBeenSet() const { return m_projectNameHasBeenSet; }
/**
* <p>The name of the project containing the placement in which to associate the
* device.</p>
*/
inline void SetProjectName(const Aws::String& value) { m_projectNameHasBeenSet = true; m_projectName = value; }
/**
* <p>The name of the project containing the placement in which to associate the
* device.</p>
*/
inline void SetProjectName(Aws::String&& value) { m_projectNameHasBeenSet = true; m_projectName = std::move(value); }
/**
* <p>The name of the project containing the placement in which to associate the
* device.</p>
*/
inline void SetProjectName(const char* value) { m_projectNameHasBeenSet = true; m_projectName.assign(value); }
/**
* <p>The name of the project containing the placement in which to associate the
* device.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithProjectName(const Aws::String& value) { SetProjectName(value); return *this;}
/**
* <p>The name of the project containing the placement in which to associate the
* device.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithProjectName(Aws::String&& value) { SetProjectName(std::move(value)); return *this;}
/**
* <p>The name of the project containing the placement in which to associate the
* device.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithProjectName(const char* value) { SetProjectName(value); return *this;}
/**
* <p>The name of the placement in which to associate the device.</p>
*/
inline const Aws::String& GetPlacementName() const{ return m_placementName; }
/**
* <p>The name of the placement in which to associate the device.</p>
*/
inline bool PlacementNameHasBeenSet() const { return m_placementNameHasBeenSet; }
/**
* <p>The name of the placement in which to associate the device.</p>
*/
inline void SetPlacementName(const Aws::String& value) { m_placementNameHasBeenSet = true; m_placementName = value; }
/**
* <p>The name of the placement in which to associate the device.</p>
*/
inline void SetPlacementName(Aws::String&& value) { m_placementNameHasBeenSet = true; m_placementName = std::move(value); }
/**
* <p>The name of the placement in which to associate the device.</p>
*/
inline void SetPlacementName(const char* value) { m_placementNameHasBeenSet = true; m_placementName.assign(value); }
/**
* <p>The name of the placement in which to associate the device.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithPlacementName(const Aws::String& value) { SetPlacementName(value); return *this;}
/**
* <p>The name of the placement in which to associate the device.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithPlacementName(Aws::String&& value) { SetPlacementName(std::move(value)); return *this;}
/**
* <p>The name of the placement in which to associate the device.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithPlacementName(const char* value) { SetPlacementName(value); return *this;}
/**
* <p>The ID of the physical device to be associated with the given placement in
* the project. Note that a mandatory 4 character prefix is required for all
* <code>deviceId</code> values.</p>
*/
inline const Aws::String& GetDeviceId() const{ return m_deviceId; }
/**
* <p>The ID of the physical device to be associated with the given placement in
* the project. Note that a mandatory 4 character prefix is required for all
* <code>deviceId</code> values.</p>
*/
inline bool DeviceIdHasBeenSet() const { return m_deviceIdHasBeenSet; }
/**
* <p>The ID of the physical device to be associated with the given placement in
* the project. Note that a mandatory 4 character prefix is required for all
* <code>deviceId</code> values.</p>
*/
inline void SetDeviceId(const Aws::String& value) { m_deviceIdHasBeenSet = true; m_deviceId = value; }
/**
* <p>The ID of the physical device to be associated with the given placement in
* the project. Note that a mandatory 4 character prefix is required for all
* <code>deviceId</code> values.</p>
*/
inline void SetDeviceId(Aws::String&& value) { m_deviceIdHasBeenSet = true; m_deviceId = std::move(value); }
/**
* <p>The ID of the physical device to be associated with the given placement in
* the project. Note that a mandatory 4 character prefix is required for all
* <code>deviceId</code> values.</p>
*/
inline void SetDeviceId(const char* value) { m_deviceIdHasBeenSet = true; m_deviceId.assign(value); }
/**
* <p>The ID of the physical device to be associated with the given placement in
* the project. Note that a mandatory 4 character prefix is required for all
* <code>deviceId</code> values.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithDeviceId(const Aws::String& value) { SetDeviceId(value); return *this;}
/**
* <p>The ID of the physical device to be associated with the given placement in
* the project. Note that a mandatory 4 character prefix is required for all
* <code>deviceId</code> values.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithDeviceId(Aws::String&& value) { SetDeviceId(std::move(value)); return *this;}
/**
* <p>The ID of the physical device to be associated with the given placement in
* the project. Note that a mandatory 4 character prefix is required for all
* <code>deviceId</code> values.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithDeviceId(const char* value) { SetDeviceId(value); return *this;}
/**
* <p>The device template name to associate with the device ID.</p>
*/
inline const Aws::String& GetDeviceTemplateName() const{ return m_deviceTemplateName; }
/**
* <p>The device template name to associate with the device ID.</p>
*/
inline bool DeviceTemplateNameHasBeenSet() const { return m_deviceTemplateNameHasBeenSet; }
/**
* <p>The device template name to associate with the device ID.</p>
*/
inline void SetDeviceTemplateName(const Aws::String& value) { m_deviceTemplateNameHasBeenSet = true; m_deviceTemplateName = value; }
/**
* <p>The device template name to associate with the device ID.</p>
*/
inline void SetDeviceTemplateName(Aws::String&& value) { m_deviceTemplateNameHasBeenSet = true; m_deviceTemplateName = std::move(value); }
/**
* <p>The device template name to associate with the device ID.</p>
*/
inline void SetDeviceTemplateName(const char* value) { m_deviceTemplateNameHasBeenSet = true; m_deviceTemplateName.assign(value); }
/**
* <p>The device template name to associate with the device ID.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithDeviceTemplateName(const Aws::String& value) { SetDeviceTemplateName(value); return *this;}
/**
* <p>The device template name to associate with the device ID.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithDeviceTemplateName(Aws::String&& value) { SetDeviceTemplateName(std::move(value)); return *this;}
/**
* <p>The device template name to associate with the device ID.</p>
*/
inline AssociateDeviceWithPlacementRequest& WithDeviceTemplateName(const char* value) { SetDeviceTemplateName(value); return *this;}
private:
Aws::String m_projectName;
bool m_projectNameHasBeenSet;
Aws::String m_placementName;
bool m_placementNameHasBeenSet;
Aws::String m_deviceId;
bool m_deviceIdHasBeenSet;
Aws::String m_deviceTemplateName;
bool m_deviceTemplateNameHasBeenSet;
};
} // namespace Model
} // namespace IoT1ClickProjects
} // namespace Aws
|
awslabs/aws-sdk-cpp
|
aws-cpp-sdk-iot1click-projects/include/aws/iot1click-projects/model/AssociateDeviceWithPlacementRequest.h
|
C
|
apache-2.0
| 9,371
|
$toolsPath = Split-Path $MyInvocation.MyCommand.Definition
. $toolsPath\helpers.ps1
$packageName = 'php'
$installLocation = GetInstallLocation -libDirectory "$toolsPath\.."
if ($installLocation) {
UninstallPackage -libDirectory "$toolsPath\.." -packageName $packageName
$di = Get-ChildItem $installLocation -ea 0 | Measure-Object
if ($di.Count -eq 0) {
Remove-Item -Force -ea 0 $installLocation
}
Uninstall-ChocolateyPath $installLocation
} else {
Write-Warning "$packageName install path was not found. It may already be uninstalled!"
}
|
octomike/chocolatey-coreteampackages
|
automatic/php/tools/chocolateyUninstall.ps1
|
PowerShell
|
apache-2.0
| 563
|
{#
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
#}
{% extends "airflow/dag.html" %}
{% block page_title %}{{ dag.dag_id }} - {{ title }} - Airflow{% endblock %}
{% block content %}
{{ super() }}
<h3>{{ title }}</h3>
<div>
{% for state, count in states %}
<a
class="btn"
style="border: 0; background-color:{{ State.color(state)}}; color: {{ State.color_fg(state) }};"
href="{{ url_for('TaskInstanceModelView.list', _flt_3_dag_id=dag.dag_id, _flt_3_state=state) }}">
{{ state }} <span class="badge">{{ count }}</span>
</a>
{% endfor %}
</div>
<br>
<table class="table table-striped table-bordered">
{% if dag.parent_dag is defined and dag.parent_dag %}
<tr>
<th>Parent DAG</th>
<td>
<a href="{{ url_for('Airflow.' + dag.default_view, dag_id=dag.parent_dag.dag_id) }}">{{ dag.parent_dag.dag_id }}</a>
</td>
</tr>
{% endif %}
<tr>
<th>Schedule Interval</th>
<td>{{ dag.schedule_interval }}</td>
</tr>
<tr>
<th>Start Date</th>
<td>{{ dag.start_date }}</td>
</tr>
<tr>
<th>End Date</th>
<td>{{ dag.end_date }}</td>
</tr>
<tr>
<th>Max Active Runs</th>
<td>{{ active_runs | length }} / {{ dag.max_active_runs }}</td>
</tr>
<tr>
<th>Concurrency</th>
<td>{{ dag.concurrency }}</td>
</tr>
<tr>
<th>Default Args</th>
<td><code>{{ dag.default_args }}</code></td>
</tr>
<tr>
<th>Tasks Count</th>
<td>{{ dag.tasks|length }}</td>
</tr>
<tr>
<th>Task IDs</th>
<td>{{ dag.task_ids }}</td>
</tr>
<tr>
<th>Filepath</th>
<td>{{ dag.filepath }}</td>
</tr>
<tr>
<th>Owner</th>
<td>{{ dag.owner }}</td>
</tr>
<tr>
<th>Tags</th>
<td>
{% if tags is defined and tags %}
{% for tag in tags | sort(attribute='name') %}
<a class="label label-info"
href="/home?tags={{ tag.name }}"
style="margin: 3px 6px 3px 0;"
title="All DAGs tagged “{{ tag.name }}”"
>
{{ tag.name }}
</a>
{% endfor %}
{% else %}
None
{% endif %}
</td>
</tr>
</table>
{% endblock %}
|
airbnb/airflow
|
airflow/www/templates/airflow/dag_details.html
|
HTML
|
apache-2.0
| 3,056
|
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-ngModelOptions-directive-blur-jquery</title>
<script src="../../components/jquery-3.1.1/jquery.js"></script>
<script src="../../../angular.js"></script>
<script src="app.js"></script>
</head>
<body ng-app="optionsExample">
<div ng-controller="ExampleController">
<form name="userForm">
<label>
Name:
<input type="text" name="userName"
ng-model="user.name"
ng-model-options="{ updateOn: 'blur' }"
ng-keyup="cancel($event)" />
</label><br />
<label>
Other data:
<input type="text" ng-model="user.data" />
</label><br />
</form>
<pre>user.name = <span ng-bind="user.name"></span></pre>
</div>
</body>
</html>
|
chdyi/Angular.js
|
BookStore/app/framework/angular-1.6.2/docs/examples/example-ngModelOptions-directive-blur/index-jquery.html
|
HTML
|
apache-2.0
| 801
|
package ca.uhn.fhir.model;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
import org.hl7.fhir.instance.model.IdType;
import org.hl7.fhir.instance.model.Patient;
import org.hl7.fhir.instance.model.Reference;
import org.junit.BeforeClass;
import org.junit.Test;
import ca.uhn.fhir.context.FhirContext;
public class IdTypeTest {
private static FhirContext ourCtx;
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(IdTypeTest.class);
@Test
public void testDetectLocal() {
IdType id;
id = new IdType("#123");
assertEquals("#123", id.getValue());
assertTrue(id.isLocal());
id = new IdType("#Medication/499059CE-CDD4-48BC-9014-528A35D15CED/_history/1");
assertEquals("#Medication/499059CE-CDD4-48BC-9014-528A35D15CED/_history/1", id.getValue());
assertTrue(id.isLocal());
id = new IdType("http://example.com/Patient/33#123");
assertEquals("http://example.com/Patient/33#123", id.getValue());
assertFalse(id.isLocal());
}
@Test
public void testConstructorsWithNullArguments() {
IdType id = new IdType(null, null, null);
assertEquals(null, id.getValue());
}
@Test
public void testDetectLocalBase() {
assertEquals("urn:uuid:180f219f-97a8-486d-99d9-ed631fe4fc57", new IdType("urn:uuid:180f219f-97a8-486d-99d9-ed631fe4fc57").getValue());
assertEquals("urn:uuid:", new IdType("urn:uuid:180f219f-97a8-486d-99d9-ed631fe4fc57").getBaseUrl());
assertEquals("180f219f-97a8-486d-99d9-ed631fe4fc57", new IdType("urn:uuid:180f219f-97a8-486d-99d9-ed631fe4fc57").getIdPart());
assertEquals("cid:180f219f-97a8-486d-99d9-ed631fe4fc57", new IdType("cid:180f219f-97a8-486d-99d9-ed631fe4fc57").getValue());
assertEquals("cid:", new IdType("cid:180f219f-97a8-486d-99d9-ed631fe4fc57").getBaseUrl());
assertEquals("180f219f-97a8-486d-99d9-ed631fe4fc57", new IdType("cid:180f219f-97a8-486d-99d9-ed631fe4fc57").getIdPart());
assertEquals("#180f219f-97a8-486d-99d9-ed631fe4fc57", new IdType("#180f219f-97a8-486d-99d9-ed631fe4fc57").getValue());
assertEquals("#", new IdType("#180f219f-97a8-486d-99d9-ed631fe4fc57").getBaseUrl());
assertEquals("180f219f-97a8-486d-99d9-ed631fe4fc57", new IdType("#180f219f-97a8-486d-99d9-ed631fe4fc57").getIdPart());
}
/**
* See #67
*/
@Test
public void testComplicatedLocal() {
IdType id = new IdType("#Patient/cid:Patient-72/_history/1");
assertTrue(id.isLocal());
assertEquals("#", id.getBaseUrl());
assertNull(id.getResourceType());
assertNull(id.getVersionIdPart());
assertEquals("Patient/cid:Patient-72/_history/1", id.getIdPart());
IdType id2 = new IdType("#Patient/cid:Patient-72/_history/1");
assertEquals(id, id2);
id2 = id2.toUnqualified();
assertFalse(id2.isLocal());
assertNull(id2.getBaseUrl());
assertNull(id2.getResourceType());
assertNull(id2.getVersionIdPart());
assertEquals("Patient/cid:Patient-72/_history/1", id2.getIdPart());
}
@Test
public void testDetermineBase() {
IdType rr;
rr = new IdType("http://foo/fhir/Organization/123");
assertEquals("http://foo/fhir", rr.getBaseUrl());
rr = new IdType("http://foo/fhir/Organization/123/_history/123");
assertEquals("http://foo/fhir", rr.getBaseUrl());
rr = new IdType("Organization/123/_history/123");
assertEquals(null, rr.getBaseUrl());
}
@Test
public void testParseValueAbsolute() {
Patient patient = new Patient();
IdType rr = new IdType();
rr.setValue("http://foo/fhir/Organization/123");
patient.setManagingOrganization(new Reference(rr));
Patient actual = parseAndEncode(patient);
Reference ref = actual.getManagingOrganization();
assertEquals("Organization", ref.getReferenceElement().getResourceType());
assertEquals("123", ref.getReferenceElement().getIdPart());
}
@Test
public void testBigDecimalIds() {
IdType id = new IdType(new BigDecimal("123"));
assertEquals(id.getIdPartAsBigDecimal(), new BigDecimal("123"));
}
@Test
public void testParseValueAbsoluteWithVersion() {
Patient patient = new Patient();
IdType rr = new IdType();
rr.setValue("http://foo/fhir/Organization/123/_history/999");
patient.setManagingOrganization(new Reference(rr));
Patient actual = parseAndEncode(patient);
Reference ref = actual.getManagingOrganization();
assertEquals("Organization", ref.getReferenceElement().getResourceType());
assertEquals("123", ref.getReferenceElement().getIdPart());
assertEquals(null, ref.getReferenceElement().getVersionIdPart());
}
@Test
public void testViewMethods() {
IdType i = new IdType("http://foo/fhir/Organization/123/_history/999");
assertEquals("Organization/123/_history/999", i.toUnqualified().getValue());
assertEquals("http://foo/fhir/Organization/123", i.toVersionless().getValue());
assertEquals("Organization/123", i.toUnqualifiedVersionless().getValue());
}
@Test
public void testParseValueWithVersion() {
Patient patient = new Patient();
IdType rr = new IdType();
rr.setValue("/123/_history/999");
patient.setManagingOrganization(new Reference(rr));
Patient actual = parseAndEncode(patient);
Reference ref = actual.getManagingOrganization();
assertEquals(null, ref.getReferenceElement().getResourceType());
assertEquals("123", ref.getReferenceElement().getIdPart());
assertEquals(null, ref.getReferenceElement().getVersionIdPart());
}
@Test
public void testParseValueMissingType1() {
Patient patient = new Patient();
IdType rr = new IdType();
rr.setValue("/123");
patient.setManagingOrganization(new Reference(rr));
Patient actual = parseAndEncode(patient);
Reference ref = actual.getManagingOrganization();
assertEquals(null, ref.getReferenceElement().getResourceType());
assertEquals("123", ref.getReferenceElement().getIdPart());
}
@Test
public void testParseValueMissingType2() {
Patient patient = new Patient();
IdType rr = new IdType();
rr.setValue("123");
patient.setManagingOrganization(new Reference(rr));
Patient actual = parseAndEncode(patient);
Reference ref = actual.getManagingOrganization();
assertEquals(null, ref.getReferenceElement().getResourceType());
assertEquals("123", ref.getReferenceElement().getIdPart());
}
@Test
public void testParseValueRelative1() {
Patient patient = new Patient();
IdType rr = new IdType();
rr.setValue("Organization/123");
patient.setManagingOrganization(new Reference(rr));
Patient actual = parseAndEncode(patient);
Reference ref = actual.getManagingOrganization();
assertEquals("Organization", ref.getReferenceElement().getResourceType());
assertEquals("123", ref.getReferenceElement().getIdPart());
}
@Test
public void testParseValueRelative2() {
Patient patient = new Patient();
IdType rr = new IdType();
rr.setValue("/Organization/123");
patient.setManagingOrganization(new Reference(rr));
Patient actual = parseAndEncode(patient);
Reference ref = actual.getManagingOrganization();
assertEquals("Organization", ref.getReferenceElement().getResourceType());
assertEquals("123", ref.getReferenceElement().getIdPart());
}
private Patient parseAndEncode(Patient patient) {
String encoded = ourCtx.newXmlParser().encodeResourceToString(patient);
ourLog.info("\n" + encoded);
return ourCtx.newXmlParser().parseResource(Patient.class, encoded);
}
@BeforeClass
public static void beforeClass() {
ourCtx = FhirContext.forDstu2Hl7Org();
}
}
|
Gaduo/hapi-fhir
|
hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/IdTypeTest.java
|
Java
|
apache-2.0
| 7,535
|
# Copyright 2013-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import re
from wlauto import AndroidUiAutoBenchmark, Parameter, Alias
from wlauto.exceptions import ConfigError
class Andebench(AndroidUiAutoBenchmark):
name = 'andebench'
description = """
AndEBench is an industry standard Android benchmark provided by The
Embedded Microprocessor Benchmark Consortium (EEMBC).
http://www.eembc.org/andebench/about.php
From the website:
- Initial focus on CPU and Dalvik interpreter performance
- Internal algorithms concentrate on integer operations
- Compares the difference between native and Java performance
- Implements flexible multicore performance analysis
- Results displayed in Iterations per second
- Detailed log file for comprehensive engineering analysis
"""
package = 'com.eembc.coremark'
activity = 'com.eembc.coremark.splash'
summary_metrics = ['AndEMark Java', 'AndEMark Native']
parameters = [
Parameter('number_of_threads', kind=int,
description='Number of threads that will be spawned by AndEBench.'),
Parameter('single_threaded', kind=bool,
description="""
If ``true``, AndEBench will run with a single thread. Note: this must
not be specified if ``number_of_threads`` has been specified.
"""),
]
aliases = [
Alias('andebenchst', number_of_threads=1),
]
regex = re.compile('\s*(?P<key>(AndEMark Native|AndEMark Java))\s*:'
'\s*(?P<value>\d+)')
def validate(self):
if (self.number_of_threads is not None) and (self.single_threaded is not None): # pylint: disable=E1101
raise ConfigError('Can\'t specify both number_of_threads and single_threaded parameters.')
def setup(self, context):
if self.number_of_threads is None: # pylint: disable=access-member-before-definition
if self.single_threaded: # pylint: disable=E1101
self.number_of_threads = 1 # pylint: disable=attribute-defined-outside-init
else:
self.number_of_threads = self.device.number_of_cores # pylint: disable=W0201
self.logger.debug('Using {} threads'.format(self.number_of_threads))
self.uiauto_params['number_of_threads'] = self.number_of_threads
# Called after this setup as modifying uiauto_params
super(Andebench, self).setup(context)
def update_result(self, context):
super(Andebench, self).update_result(context)
results = {}
with open(self.logcat_log) as fh:
for line in fh:
match = self.regex.search(line)
if match:
data = match.groupdict()
results[data['key']] = data['value']
for key, value in results.iteritems():
context.result.add_metric(key, value)
|
freedomtan/workload-automation
|
wlauto/workloads/andebench/__init__.py
|
Python
|
apache-2.0
| 3,485
|
/*******************************************************************************
* Copyright 2014, 2018 gwt-ol3
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package ol.layer;
import ol.GwtOLBaseTestCase;
/**
* A test case for {@link ol.layer.Tile}.
*
* @author Tino Desjardins
*
*/
public class TileTest extends GwtOLBaseTestCase {
@SuppressWarnings({ "static-method", "javadoc" })
public void testTileLayer() {
injectUrlAndTest(() -> {
TileLayerOptions tileLayerOptions = new TileLayerOptions();
assertNotNull(tileLayerOptions);
Tile tile = new Tile(tileLayerOptions);
assertTrue(tile instanceof Base);
assertTrue(tile instanceof Tile);
});
}
}
|
TDesjardins/GWT-OL3-Playground
|
gwt-ol3-client/src/test/java/ol/layer/TileTest.java
|
Java
|
apache-2.0
| 1,342
|
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Copyright (c) frentix GmbH<br>
* http://www.frentix.com<br>
* <p>
*/
package org.olat.modules.webFeed;
import java.util.ArrayList;
import java.util.List;
import org.olat.commons.servlets.RSSServlet;
import org.olat.core.id.Identity;
import org.olat.core.util.filter.FilterFactory;
import org.olat.modules.webFeed.models.Enclosure;
import org.olat.modules.webFeed.models.Feed;
import org.olat.modules.webFeed.models.Item;
import com.sun.syndication.feed.synd.SyndContent;
import com.sun.syndication.feed.synd.SyndContentImpl;
import com.sun.syndication.feed.synd.SyndEnclosure;
import com.sun.syndication.feed.synd.SyndEnclosureImpl;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeedImpl;
import com.sun.syndication.feed.synd.SyndImage;
import com.sun.syndication.feed.synd.SyndImageImpl;
/**
* Creates a podcast feed (syndication feed) from a podcast resource.
* <P>
* Initial Date: Feb 25, 2009 <br>
*
* @author Gregor Wassmann
*/
public class RSSFeed extends SyndFeedImpl {
/**
* Constructor. The identityKey is needed to generate personal URLs for the corresponding user.
*/
public RSSFeed(final Feed feed, final Identity identity, final Long courseId, final String nodeId) {
super();
// This helper object is required for generating the appropriate URLs for
// the given user (identity)
final FeedViewHelper helper = new FeedViewHelper(feed, identity, courseId, nodeId);
setFeedType("rss_2.0");
setEncoding(RSSServlet.DEFAULT_ENCODING);
setTitle(feed.getTitle());
// According to the rss specification, the feed channel description is not
// (explicitly) allowed to contain html tags.
String strippedDescription = FilterFactory.getHtmlTagsFilter().filter(feed.getDescription());
strippedDescription = strippedDescription.replaceAll(" ", " "); // TODO: remove when filter
// does it
setDescription(strippedDescription);
setLink(helper.getJumpInLink());
setPublishedDate(feed.getLastModified());
// The image
if (feed.getImageName() != null) {
final SyndImage image = new SyndImageImpl();
image.setDescription(feed.getDescription());
image.setTitle(feed.getTitle());
image.setLink(getLink());
image.setUrl(helper.getImageUrl());
setImage(image);
}
final List<SyndEntry> episodes = new ArrayList<SyndEntry>();
for (final Item item : feed.getPublishedItems()) {
final SyndEntry entry = new SyndEntryImpl();
entry.setTitle(item.getTitle());
final SyndContent itemDescription = new SyndContentImpl();
itemDescription.setType("text/plain");
itemDescription.setValue(helper.getItemDescriptionForBrowser(item));
entry.setDescription(itemDescription);
// Link will also be converted to the rss guid tag. Except if there's an
// enclosure, then the enclosure url is used.
// Use jump-in link far all entries. This will be overriden if the item
// has an enclosure.
entry.setLink(helper.getJumpInLink() + "#" + item.getGuid());
entry.setPublishedDate(item.getPublishDate());
entry.setUpdatedDate(item.getLastModified());
// The enclosure is the media (audio or video) file of the episode
final Enclosure media = item.getEnclosure();
if (media != null) {
final SyndEnclosure enclosure = new SyndEnclosureImpl();
enclosure.setUrl(helper.getMediaUrl(item));
enclosure.setType(media.getType());
enclosure.setLength(media.getLength());
// Also set the item link to point to the enclosure
entry.setLink(helper.getMediaUrl(item));
final List<SyndEnclosure> enclosures = new ArrayList<SyndEnclosure>();
enclosures.add(enclosure);
entry.setEnclosures(enclosures);
}
episodes.add(entry);
}
setEntries(episodes);
}
}
|
RLDevOps/Scholastic
|
src/main/java/org/olat/modules/webFeed/RSSFeed.java
|
Java
|
apache-2.0
| 4,455
|
package org.jetbrains.plugins.javaFX.fxml.codeInsight.inspections;
import com.intellij.codeInsight.daemon.impl.analysis.RemoveAttributeIntentionFix;
import com.intellij.codeInsight.daemon.impl.analysis.RemoveTagIntentionFix;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.codeInspection.XmlSuppressableInspectionTool;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.psi.*;
import com.intellij.psi.xml.XmlAttribute;
import com.intellij.psi.xml.XmlFile;
import com.intellij.psi.xml.XmlTag;
import com.intellij.reference.SoftReference;
import com.intellij.xml.XmlAttributeDescriptor;
import com.intellij.xml.XmlElementDescriptor;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.javaFX.fxml.FxmlConstants;
import org.jetbrains.plugins.javaFX.fxml.JavaFxFileTypeFactory;
import org.jetbrains.plugins.javaFX.fxml.JavaFxPsiUtil;
import org.jetbrains.plugins.javaFX.fxml.descriptors.JavaFxPropertyAttributeDescriptor;
import org.jetbrains.plugins.javaFX.fxml.descriptors.JavaFxPropertyTagDescriptor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.ref.Reference;
import java.net.URL;
import java.util.Collections;
import java.util.Map;
/**
* @author Pavel.Dolgov
*/
public class JavaFxRedundantPropertyValueInspection extends XmlSuppressableInspectionTool {
private static final Logger LOG = Logger.getInstance("#" + JavaFxRedundantPropertyValueInspection.class.getName());
private static Reference<Map<String, Map<String, String>>> ourDefaultPropertyValues;
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
return new XmlElementVisitor() {
@Override
public void visitXmlFile(XmlFile file) {
if (!JavaFxFileTypeFactory.isFxml(file)) return;
super.visitXmlFile(file);
}
@Override
public void visitXmlAttribute(XmlAttribute attribute) {
super.visitXmlAttribute(attribute);
final XmlAttributeDescriptor descriptor = attribute.getDescriptor();
if (!(descriptor instanceof JavaFxPropertyAttributeDescriptor)) return;
final String attributeName = attribute.getName();
final String attributeValue = attribute.getValue();
if (attributeValue == null ||
attributeValue.startsWith("$") ||
attributeValue.startsWith("#") ||
attributeValue.startsWith("%") ||
FxmlConstants.FX_ID.equals(attributeName) ||
FxmlConstants.FX_VALUE.equals(attributeName) ||
FxmlConstants.FX_CONSTANT.equals(attributeName) ||
FxmlConstants.FX_CONTROLLER.equals(attributeName)) {
return;
}
final PsiClass tagClass = JavaFxPsiUtil.getTagClass(attribute.getParent());
final String defaultValue = getDefaultValue(attributeName, tagClass);
if (defaultValue == null) return;
if (isEqualValue(tagClass, attributeValue, defaultValue, descriptor.getDeclaration())) {
holder.registerProblem(attribute, "Attribute is redundant because it contains default value",
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
new RemoveAttributeIntentionFix(attributeName, attribute));
}
}
@Override
public void visitXmlTag(XmlTag tag) {
super.visitXmlTag(tag);
final XmlElementDescriptor descriptor = tag.getDescriptor();
if (!(descriptor instanceof JavaFxPropertyTagDescriptor)) {
return;
}
if (tag.getSubTags().length != 0) return;
final String tagText = tag.getValue().getTrimmedText();
if (tagText.startsWith("$") ||
tagText.startsWith("#") ||
tagText.startsWith("%")) {
return;
}
final XmlTag parentTag = tag.getParentTag();
if (parentTag == null) return;
final PsiClass tagClass = JavaFxPsiUtil.getTagClass(parentTag);
final String defaultValue = getDefaultValue(tag.getName(), tagClass);
if (defaultValue == null) return;
if (isEqualValue(tagClass, tagText, defaultValue, descriptor.getDeclaration())) {
holder.registerProblem(tag, "Tag is redundant because it contains default value",
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
new RemoveTagIntentionFix(tag.getName(), tag));
}
}
};
}
@Nullable
private static String getDefaultValue(@NotNull String propertyName, @Nullable PsiClass containingClass) {
for (PsiClass psiClass = containingClass; psiClass != null; psiClass = psiClass.getSuperClass()) {
final String qualifiedName = psiClass.getQualifiedName();
if (CommonClassNames.JAVA_LANG_OBJECT.equals(qualifiedName)) break;
final String defaultValue = getDefaultPropertyValue(qualifiedName, propertyName);
if (defaultValue != null) {
return defaultValue;
}
}
return null;
}
private static boolean isEqualValue(@Nullable PsiClass containingClass,
@NotNull String attributeValue,
@NotNull String defaultValue,
@Nullable PsiElement declaration) {
if (!(declaration instanceof PsiMember)) return false;
final String boxedQName = JavaFxPsiUtil.getBoxedPropertyType(containingClass, (PsiMember)declaration);
if (boxedQName == null) {
return defaultValue.equals(attributeValue);
}
try {
switch (boxedQName) {
case CommonClassNames.JAVA_LANG_BOOLEAN:
return Boolean.parseBoolean(defaultValue) == Boolean.parseBoolean(attributeValue);
case CommonClassNames.JAVA_LANG_DOUBLE:
return Double.compare(Double.parseDouble(defaultValue), Double.parseDouble(attributeValue)) == 0;
case CommonClassNames.JAVA_LANG_FLOAT:
return Float.compare(Float.parseFloat(defaultValue), Float.parseFloat(attributeValue)) == 0;
case CommonClassNames.JAVA_LANG_INTEGER:
return Integer.parseInt(defaultValue) == Integer.parseInt(attributeValue);
case CommonClassNames.JAVA_LANG_LONG:
return Long.parseLong(defaultValue) == Long.parseLong(attributeValue);
case CommonClassNames.JAVA_LANG_SHORT:
return Short.parseShort(defaultValue) == Short.parseShort(attributeValue);
case CommonClassNames.JAVA_LANG_BYTE:
return Byte.parseByte(defaultValue) == Byte.parseByte(attributeValue);
default:
return defaultValue.equals(attributeValue);
}
}
catch (NumberFormatException ignored) {
return false;
}
}
@Nullable
private static String getDefaultPropertyValue(String classQualifiedName, String propertyName) {
final Map<String, String> values = getDefaultPropertyValues(classQualifiedName);
return values != null ? values.get(propertyName) : null;
}
/**
* Load property values resource. The resource is produced with the script JavaFxGenerateDefaultPropertyValuesScript (can be found in tests)
*/
@Nullable
private static Map<String, String> getDefaultPropertyValues(String classQualifiedName) {
Map<String, Map<String, String>> values = SoftReference.dereference(ourDefaultPropertyValues);
if (values == null) {
values = loadDefaultPropertyValues(JavaFxRedundantPropertyValueInspection.class.getSimpleName() + "8.txt");
ourDefaultPropertyValues = new SoftReference<>(values);
}
return values.get(classQualifiedName);
}
/**
* The file format is <code>ClassName#propertyName:type=value</code> per line, line with leading double dash (--) is commented out
*/
@NotNull
private static Map<String, Map<String, String>> loadDefaultPropertyValues(@NotNull String resourceName) {
final URL resource = JavaFxRedundantPropertyValueInspection.class.getResource(resourceName);
if (resource == null) {
LOG.warn("Resource not found: " + resourceName);
return Collections.emptyMap();
}
final Map<String, Map<String, String>> result = new THashMap<>(200);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource.openStream(), CharsetToolkit.UTF8_CHARSET))) {
for (String line : FileUtil.loadLines(reader)) {
if (line.isEmpty() || line.startsWith("--")) continue;
boolean lineParsed = false;
final int p1 = line.indexOf('#');
if (p1 > 0 && p1 < line.length()) {
final String className = line.substring(0, p1);
final int p2 = line.indexOf('=', p1);
if (p2 > p1 && p2 < line.length()) {
final String propertyName = line.substring(p1 + 1, p2);
final String valueText = line.substring(p2 + 1);
lineParsed = true;
final Map<String, String> properties = result.computeIfAbsent(className, ignored -> new THashMap<>());
if (properties.put(propertyName, valueText) != null) {
LOG.warn("Duplicate default property value " + line);
}
}
}
if (!lineParsed) {
LOG.warn("Can't parse default property value " + line);
}
}
}
catch (IOException e) {
LOG.warn("Can't read resource: " + resourceName, e);
return Collections.emptyMap();
}
return result;
}
}
|
hurricup/intellij-community
|
plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/codeInsight/inspections/JavaFxRedundantPropertyValueInspection.java
|
Java
|
apache-2.0
| 9,676
|
// stdafx.cpp : source file that includes just the standard includes
// kdb+.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
|
FlyingOE/q_Wind
|
kdb+/stdafx.cpp
|
C++
|
apache-2.0
| 283
|
<?php
/**
* THE CODE IN THIS FILE WAS GENERATED FROM THE EBAY WSDL USING THE PROJECT:
*
* https://github.com/davidtsadler/ebay-api-sdk-php
*
* Copyright 2014 David T. Sadler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace DTS\eBaySDK\Trading\Types\Test;
use DTS\eBaySDK\Trading\Types\SKUArrayType;
class SKUArrayTypeTest extends \PHPUnit_Framework_TestCase
{
private $obj;
protected function setUp()
{
$this->obj = new SKUArrayType();
}
public function testCanBeCreated()
{
$this->assertInstanceOf('\DTS\eBaySDK\Trading\Types\SKUArrayType', $this->obj);
}
public function testExtendsBaseType()
{
$this->assertInstanceOf('\DTS\eBaySDK\Types\BaseType', $this->obj);
}
}
|
davidtsadler/ebay-sdk-trading
|
test/DTS/eBaySDK/Trading/Types/SKUArrayTypeTest.php
|
PHP
|
apache-2.0
| 1,263
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0) on Mon Jan 13 19:53:37 EST 2014 -->
<title>Uses of Class org.drip.analytics.holset.DOPHoliday</title>
<meta name="date" content="2014-01-13">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.drip.analytics.holset.DOPHoliday";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/drip/analytics/holset/DOPHoliday.html" title="class in org.drip.analytics.holset">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/drip/analytics/holset/\class-useDOPHoliday.html" target="_top">Frames</a></li>
<li><a href="DOPHoliday.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.drip.analytics.holset.DOPHoliday" class="title">Uses of Class<br>org.drip.analytics.holset.DOPHoliday</h2>
</div>
<div class="classUseContainer">No usage of org.drip.analytics.holset.DOPHoliday</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/drip/analytics/holset/DOPHoliday.html" title="class in org.drip.analytics.holset">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/drip/analytics/holset/\class-useDOPHoliday.html" target="_top">Frames</a></li>
<li><a href="DOPHoliday.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
tectronics/splinelibrary
|
2.3/docs/Javadoc/org/drip/analytics/holset/class-use/DOPHoliday.html
|
HTML
|
apache-2.0
| 4,253
|
/* FlowMeter.java
*
* Copyright 2009-2015 Comcast Interactive Media, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.fishwife.jrugged;
/** This class uses a raw {@link RequestCounter} to compute request rates
* over time for total rate of request, rate of successful requests, and
* rate of failed requests.
*/
public class FlowMeter {
private RequestCounter counter;
private long lastTotal;
private long lastSuccesses;
private long lastFailures;
private long lastSampleMillis;
private double[] lastKnownRates = new double[3];
/**
* Constructs a {@link FlowMeter}.
* @param counter the {@link RequestCounter} to calculate request
* rates from
*/
public FlowMeter(RequestCounter counter) {
this.counter = counter;
}
/**
* Calculates requests per second.
*
* @param events how many have occured
* @param t time
* @return double rate
*/
private double rate(long events, long t) {
return ((double)events / (double)t) * 1000.0;
}
/**
* Takes a sample of the request rates. Calculations are based on
* differences in request counts since the last call to
* <code>sample()</code>.
* @return an array of three <code>doubles</code>: total requests per
* second, successful requests per second, failed requests per
* second. If this is the first sample, all three rates will be
* reported as zero requests per second.
*/
public synchronized double[] sample() {
long[] currCounts = counter.sample();
long now = System.currentTimeMillis();
if (lastSampleMillis != 0) {
long deltaTime = now - lastSampleMillis;
if (deltaTime == 0) return lastKnownRates;
lastKnownRates[0] = rate(currCounts[0] - lastTotal, deltaTime);
lastKnownRates[1] = rate(currCounts[1] - lastSuccesses, deltaTime);
lastKnownRates[2] = rate(currCounts[2] - lastFailures, deltaTime);
} else {
lastKnownRates[0] = lastKnownRates[1] = lastKnownRates[2] = 0.0;
}
lastTotal = currCounts[0];
lastSuccesses = currCounts[1];
lastFailures = currCounts[2];
lastSampleMillis = now;
return lastKnownRates;
}
}
|
ekmason12/jrugged
|
jrugged-core/src/main/java/org/fishwife/jrugged/FlowMeter.java
|
Java
|
apache-2.0
| 2,837
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/detective/model/ListGraphsRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Detective::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
ListGraphsRequest::ListGraphsRequest() :
m_nextTokenHasBeenSet(false),
m_maxResults(0),
m_maxResultsHasBeenSet(false)
{
}
Aws::String ListGraphsRequest::SerializePayload() const
{
JsonValue payload;
if(m_nextTokenHasBeenSet)
{
payload.WithString("NextToken", m_nextToken);
}
if(m_maxResultsHasBeenSet)
{
payload.WithInteger("MaxResults", m_maxResults);
}
return payload.View().WriteReadable();
}
|
aws/aws-sdk-cpp
|
aws-cpp-sdk-detective/source/model/ListGraphsRequest.cpp
|
C++
|
apache-2.0
| 785
|
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.server.am;
import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
import static android.content.Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS;
import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_ALWAYS;
import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_DEFAULT;
import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED;
import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_NEVER;
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_PRIVILEGED;
import static com.android.server.am.ActivityManagerDebugConfig.*;
import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.RECENTS_ACTIVITY_TYPE;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.TaskThumbnail;
import android.app.ActivityManager.TaskDescription;
import android.app.ActivityOptions;
import android.app.AppGlobals;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.os.Debug;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.UserHandle;
import android.service.voice.IVoiceInteractionSession;
import android.util.Slog;
import com.android.internal.app.IVoiceInteractor;
import com.android.internal.util.XmlUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
final class TaskRecord {
private static final String TAG = TAG_WITH_CLASS_NAME ? "TaskRecord" : TAG_AM;
private static final String TAG_ADD_REMOVE = TAG + POSTFIX_ADD_REMOVE;
private static final String TAG_RECENTS = TAG + POSTFIX_RECENTS;
private static final String TAG_LOCKTASK = TAG + POSTFIX_LOCKTASK;
private static final String TAG_TASKS = TAG + POSTFIX_TASKS;
static final String ATTR_TASKID = "task_id";
private static final String TAG_INTENT = "intent";
private static final String TAG_AFFINITYINTENT = "affinity_intent";
static final String ATTR_REALACTIVITY = "real_activity";
private static final String ATTR_ORIGACTIVITY = "orig_activity";
private static final String TAG_ACTIVITY = "activity";
private static final String ATTR_AFFINITY = "affinity";
private static final String ATTR_ROOT_AFFINITY = "root_affinity";
private static final String ATTR_ROOTHASRESET = "root_has_reset";
private static final String ATTR_AUTOREMOVERECENTS = "auto_remove_recents";
private static final String ATTR_ASKEDCOMPATMODE = "asked_compat_mode";
private static final String ATTR_USERID = "user_id";
private static final String ATTR_EFFECTIVE_UID = "effective_uid";
private static final String ATTR_TASKTYPE = "task_type";
private static final String ATTR_FIRSTACTIVETIME = "first_active_time";
private static final String ATTR_LASTACTIVETIME = "last_active_time";
private static final String ATTR_LASTDESCRIPTION = "last_description";
private static final String ATTR_LASTTIMEMOVED = "last_time_moved";
private static final String ATTR_NEVERRELINQUISH = "never_relinquish_identity";
static final String ATTR_TASK_AFFILIATION = "task_affiliation";
private static final String ATTR_PREV_AFFILIATION = "prev_affiliation";
private static final String ATTR_NEXT_AFFILIATION = "next_affiliation";
private static final String ATTR_TASK_AFFILIATION_COLOR = "task_affiliation_color";
private static final String ATTR_CALLING_UID = "calling_uid";
private static final String ATTR_CALLING_PACKAGE = "calling_package";
private static final String ATTR_RESIZEABLE = "resizeable";
private static final String ATTR_PRIVILEGED = "privileged";
private static final String TASK_THUMBNAIL_SUFFIX = "_task_thumbnail";
static final boolean IGNORE_RETURN_TO_RECENTS = true;
static final int INVALID_TASK_ID = -1;
final int taskId; // Unique identifier for this task.
String affinity; // The affinity name for this task, or null; may change identity.
String rootAffinity; // Initial base affinity, or null; does not change from initial root.
final IVoiceInteractionSession voiceSession; // Voice interaction session driving task
final IVoiceInteractor voiceInteractor; // Associated interactor to provide to app
Intent intent; // The original intent that started the task.
Intent affinityIntent; // Intent of affinity-moved activity that started this task.
int effectiveUid; // The current effective uid of the identity of this task.
ComponentName origActivity; // The non-alias activity component of the intent.
ComponentName realActivity; // The actual activity component that started the task.
long firstActiveTime; // First time this task was active.
long lastActiveTime; // Last time this task was active, including sleep.
boolean inRecents; // Actually in the recents list?
boolean isAvailable; // Is the activity available to be launched?
boolean rootWasReset; // True if the intent at the root of the task had
// the FLAG_ACTIVITY_RESET_TASK_IF_NEEDED flag.
boolean autoRemoveRecents; // If true, we should automatically remove the task from
// recents when activity finishes
boolean askedCompatMode;// Have asked the user about compat mode for this task.
boolean hasBeenVisible; // Set if any activities in the task have been visible to the user.
String stringName; // caching of toString() result.
int userId; // user for which this task was created
int numFullscreen; // Number of fullscreen activities.
boolean mResizeable; // Activities in the task resizeable. Based on the resizable setting of
// the root activity.
int mLockTaskMode; // Which tasklock mode to launch this task in. One of
// ActivityManager.LOCK_TASK_LAUNCH_MODE_*
private boolean mPrivileged; // The root activity application of this task holds
// privileged permissions.
/** Can't be put in lockTask mode. */
final static int LOCK_TASK_AUTH_DONT_LOCK = 0;
/** Can enter app pinning with user approval. Can never start over existing lockTask task. */
final static int LOCK_TASK_AUTH_PINNABLE = 1;
/** Starts in LOCK_TASK_MODE_LOCKED automatically. Can start over existing lockTask task. */
final static int LOCK_TASK_AUTH_LAUNCHABLE = 2;
/** Can enter lockTask without user approval. Can start over existing lockTask task. */
final static int LOCK_TASK_AUTH_WHITELISTED = 3;
/** Priv-app that starts in LOCK_TASK_MODE_LOCKED automatically. Can start over existing
* lockTask task. */
final static int LOCK_TASK_AUTH_LAUNCHABLE_PRIV = 4;
int mLockTaskAuth = LOCK_TASK_AUTH_PINNABLE;
int mLockTaskUid = -1; // The uid of the application that called startLockTask().
// This represents the last resolved activity values for this task
// NOTE: This value needs to be persisted with each task
TaskDescription lastTaskDescription = new TaskDescription();
/** List of all activities in the task arranged in history order */
final ArrayList<ActivityRecord> mActivities;
/** Current stack */
ActivityStack stack;
/** Takes on same set of values as ActivityRecord.mActivityType */
int taskType;
/** Takes on same value as first root activity */
boolean isPersistable = false;
int maxRecents;
/** Only used for persistable tasks, otherwise 0. The last time this task was moved. Used for
* determining the order when restoring. Sign indicates whether last task movement was to front
* (positive) or back (negative). Absolute value indicates time. */
long mLastTimeMoved = System.currentTimeMillis();
/** Indication of what to run next when task exits. Use ActivityRecord types.
* ActivityRecord.APPLICATION_ACTIVITY_TYPE indicates to resume the task below this one in the
* task stack. */
private int mTaskToReturnTo = APPLICATION_ACTIVITY_TYPE;
/** If original intent did not allow relinquishing task identity, save that information */
boolean mNeverRelinquishIdentity = true;
// Used in the unique case where we are clearing the task in order to reuse it. In that case we
// do not want to delete the stack when the task goes empty.
boolean mReuseTask = false;
private Bitmap mLastThumbnail; // Last thumbnail captured for this item.
private final File mLastThumbnailFile; // File containing last thumbnail.
private final String mFilename;
CharSequence lastDescription; // Last description captured for this item.
int mAffiliatedTaskId; // taskId of parent affiliation or self if no parent.
int mAffiliatedTaskColor; // color of the parent task affiliation.
TaskRecord mPrevAffiliate; // previous task in affiliated chain.
int mPrevAffiliateTaskId = INVALID_TASK_ID; // previous id for persistence.
TaskRecord mNextAffiliate; // next task in affiliated chain.
int mNextAffiliateTaskId = INVALID_TASK_ID; // next id for persistence.
// For relaunching the task from recents as though it was launched by the original launcher.
int mCallingUid;
String mCallingPackage;
final ActivityManagerService mService;
TaskRecord(ActivityManagerService service, int _taskId, ActivityInfo info, Intent _intent,
IVoiceInteractionSession _voiceSession, IVoiceInteractor _voiceInteractor) {
mService = service;
mFilename = String.valueOf(_taskId) + TASK_THUMBNAIL_SUFFIX +
TaskPersister.IMAGE_EXTENSION;
mLastThumbnailFile = new File(TaskPersister.sImagesDir, mFilename);
taskId = _taskId;
mAffiliatedTaskId = _taskId;
voiceSession = _voiceSession;
voiceInteractor = _voiceInteractor;
isAvailable = true;
mActivities = new ArrayList<>();
mCallingUid = info.applicationInfo.uid;
mCallingPackage = info.packageName;
setIntent(_intent, info);
}
TaskRecord(ActivityManagerService service, int _taskId, ActivityInfo info, Intent _intent,
TaskDescription _taskDescription) {
mService = service;
mFilename = String.valueOf(_taskId) + TASK_THUMBNAIL_SUFFIX +
TaskPersister.IMAGE_EXTENSION;
mLastThumbnailFile = new File(TaskPersister.sImagesDir, mFilename);
taskId = _taskId;
mAffiliatedTaskId = _taskId;
voiceSession = null;
voiceInteractor = null;
isAvailable = true;
mActivities = new ArrayList<>();
mCallingUid = info.applicationInfo.uid;
mCallingPackage = info.packageName;
setIntent(_intent, info);
taskType = ActivityRecord.APPLICATION_ACTIVITY_TYPE;
isPersistable = true;
// Clamp to [1, max].
maxRecents = Math.min(Math.max(info.maxRecents, 1),
ActivityManager.getMaxAppRecentsLimitStatic());
taskType = APPLICATION_ACTIVITY_TYPE;
mTaskToReturnTo = HOME_ACTIVITY_TYPE;
userId = UserHandle.getUserId(info.applicationInfo.uid);
lastTaskDescription = _taskDescription;
}
private TaskRecord(ActivityManagerService service, int _taskId, Intent _intent,
Intent _affinityIntent, String _affinity, String _rootAffinity,
ComponentName _realActivity, ComponentName _origActivity, boolean _rootWasReset,
boolean _autoRemoveRecents, boolean _askedCompatMode, int _taskType, int _userId,
int _effectiveUid, String _lastDescription, ArrayList<ActivityRecord> activities,
long _firstActiveTime, long _lastActiveTime, long lastTimeMoved,
boolean neverRelinquishIdentity, TaskDescription _lastTaskDescription,
int taskAffiliation, int prevTaskId, int nextTaskId, int taskAffiliationColor,
int callingUid, String callingPackage, boolean resizeable, boolean privileged) {
mService = service;
mFilename = String.valueOf(_taskId) + TASK_THUMBNAIL_SUFFIX +
TaskPersister.IMAGE_EXTENSION;
mLastThumbnailFile = new File(TaskPersister.sImagesDir, mFilename);
taskId = _taskId;
intent = _intent;
affinityIntent = _affinityIntent;
affinity = _affinity;
rootAffinity = _rootAffinity;
voiceSession = null;
voiceInteractor = null;
realActivity = _realActivity;
origActivity = _origActivity;
rootWasReset = _rootWasReset;
isAvailable = true;
autoRemoveRecents = _autoRemoveRecents;
askedCompatMode = _askedCompatMode;
taskType = _taskType;
mTaskToReturnTo = HOME_ACTIVITY_TYPE;
userId = _userId;
effectiveUid = _effectiveUid;
firstActiveTime = _firstActiveTime;
lastActiveTime = _lastActiveTime;
lastDescription = _lastDescription;
mActivities = activities;
mLastTimeMoved = lastTimeMoved;
mNeverRelinquishIdentity = neverRelinquishIdentity;
lastTaskDescription = _lastTaskDescription;
mAffiliatedTaskId = taskAffiliation;
mAffiliatedTaskColor = taskAffiliationColor;
mPrevAffiliateTaskId = prevTaskId;
mNextAffiliateTaskId = nextTaskId;
mCallingUid = callingUid;
mCallingPackage = callingPackage;
mResizeable = resizeable;
mPrivileged = privileged;
}
void touchActiveTime() {
lastActiveTime = System.currentTimeMillis();
if (firstActiveTime == 0) {
firstActiveTime = lastActiveTime;
}
}
long getInactiveDuration() {
return System.currentTimeMillis() - lastActiveTime;
}
/** Sets the original intent, and the calling uid and package. */
void setIntent(ActivityRecord r) {
mCallingUid = r.launchedFromUid;
mCallingPackage = r.launchedFromPackage;
setIntent(r.intent, r.info);
}
/** Sets the original intent, _without_ updating the calling uid or package. */
private void setIntent(Intent _intent, ActivityInfo info) {
if (intent == null) {
mNeverRelinquishIdentity =
(info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0;
} else if (mNeverRelinquishIdentity) {
return;
}
affinity = info.taskAffinity;
if (intent == null) {
// If this task already has an intent associated with it, don't set the root
// affinity -- we don't want it changing after initially set, but the initially
// set value may be null.
rootAffinity = affinity;
}
effectiveUid = info.applicationInfo.uid;
stringName = null;
if (info.targetActivity == null) {
if (_intent != null) {
// If this Intent has a selector, we want to clear it for the
// recent task since it is not relevant if the user later wants
// to re-launch the app.
if (_intent.getSelector() != null || _intent.getSourceBounds() != null) {
_intent = new Intent(_intent);
_intent.setSelector(null);
_intent.setSourceBounds(null);
}
}
if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Setting Intent of " + this + " to " + _intent);
intent = _intent;
realActivity = _intent != null ? _intent.getComponent() : null;
origActivity = null;
} else {
ComponentName targetComponent = new ComponentName(
info.packageName, info.targetActivity);
if (_intent != null) {
Intent targetIntent = new Intent(_intent);
targetIntent.setComponent(targetComponent);
targetIntent.setSelector(null);
targetIntent.setSourceBounds(null);
if (DEBUG_TASKS) Slog.v(TAG_TASKS,
"Setting Intent of " + this + " to target " + targetIntent);
intent = targetIntent;
realActivity = targetComponent;
origActivity = _intent.getComponent();
} else {
intent = null;
realActivity = targetComponent;
origActivity = new ComponentName(info.packageName, info.name);
}
}
final int intentFlags = intent == null ? 0 : intent.getFlags();
if ((intentFlags & Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) != 0) {
// Once we are set to an Intent with this flag, we count this
// task as having a true root activity.
rootWasReset = true;
}
userId = UserHandle.getUserId(info.applicationInfo.uid);
if ((info.flags & ActivityInfo.FLAG_AUTO_REMOVE_FROM_RECENTS) != 0) {
// If the activity itself has requested auto-remove, then just always do it.
autoRemoveRecents = true;
} else if ((intentFlags & (FLAG_ACTIVITY_NEW_DOCUMENT | FLAG_ACTIVITY_RETAIN_IN_RECENTS))
== FLAG_ACTIVITY_NEW_DOCUMENT) {
// If the caller has not asked for the document to be retained, then we may
// want to turn on auto-remove, depending on whether the target has set its
// own document launch mode.
if (info.documentLaunchMode != ActivityInfo.DOCUMENT_LAUNCH_NONE) {
autoRemoveRecents = false;
} else {
autoRemoveRecents = true;
}
} else {
autoRemoveRecents = false;
}
mResizeable = info.resizeable;
mLockTaskMode = info.lockTaskLaunchMode;
mPrivileged = (info.applicationInfo.privateFlags & PRIVATE_FLAG_PRIVILEGED) != 0;
setLockTaskAuth();
}
void setTaskToReturnTo(int taskToReturnTo) {
mTaskToReturnTo = (IGNORE_RETURN_TO_RECENTS && taskToReturnTo == RECENTS_ACTIVITY_TYPE)
? HOME_ACTIVITY_TYPE : taskToReturnTo;
}
int getTaskToReturnTo() {
return mTaskToReturnTo;
}
void setPrevAffiliate(TaskRecord prevAffiliate) {
mPrevAffiliate = prevAffiliate;
mPrevAffiliateTaskId = prevAffiliate == null ? INVALID_TASK_ID : prevAffiliate.taskId;
}
void setNextAffiliate(TaskRecord nextAffiliate) {
mNextAffiliate = nextAffiliate;
mNextAffiliateTaskId = nextAffiliate == null ? INVALID_TASK_ID : nextAffiliate.taskId;
}
// Close up recents linked list.
void closeRecentsChain() {
if (mPrevAffiliate != null) {
mPrevAffiliate.setNextAffiliate(mNextAffiliate);
}
if (mNextAffiliate != null) {
mNextAffiliate.setPrevAffiliate(mPrevAffiliate);
}
setPrevAffiliate(null);
setNextAffiliate(null);
}
void removedFromRecents() {
disposeThumbnail();
closeRecentsChain();
if (inRecents) {
inRecents = false;
mService.notifyTaskPersisterLocked(this, false);
}
}
void setTaskToAffiliateWith(TaskRecord taskToAffiliateWith) {
closeRecentsChain();
mAffiliatedTaskId = taskToAffiliateWith.mAffiliatedTaskId;
mAffiliatedTaskColor = taskToAffiliateWith.mAffiliatedTaskColor;
// Find the end
while (taskToAffiliateWith.mNextAffiliate != null) {
final TaskRecord nextRecents = taskToAffiliateWith.mNextAffiliate;
if (nextRecents.mAffiliatedTaskId != mAffiliatedTaskId) {
Slog.e(TAG, "setTaskToAffiliateWith: nextRecents=" + nextRecents + " affilTaskId="
+ nextRecents.mAffiliatedTaskId + " should be " + mAffiliatedTaskId);
if (nextRecents.mPrevAffiliate == taskToAffiliateWith) {
nextRecents.setPrevAffiliate(null);
}
taskToAffiliateWith.setNextAffiliate(null);
break;
}
taskToAffiliateWith = nextRecents;
}
taskToAffiliateWith.setNextAffiliate(this);
setPrevAffiliate(taskToAffiliateWith);
setNextAffiliate(null);
}
/**
* Sets the last thumbnail.
* @return whether the thumbnail was set
*/
boolean setLastThumbnail(Bitmap thumbnail) {
if (mLastThumbnail != thumbnail) {
mLastThumbnail = thumbnail;
if (thumbnail == null) {
if (mLastThumbnailFile != null) {
mLastThumbnailFile.delete();
}
} else {
mService.mTaskPersister.saveImage(thumbnail, mFilename);
}
return true;
}
return false;
}
void getLastThumbnail(TaskThumbnail thumbs) {
thumbs.mainThumbnail = mLastThumbnail;
thumbs.thumbnailFileDescriptor = null;
if (mLastThumbnail == null) {
thumbs.mainThumbnail = mService.mTaskPersister.getImageFromWriteQueue(mFilename);
}
// Only load the thumbnail file if we don't have a thumbnail
if (thumbs.mainThumbnail == null && mLastThumbnailFile.exists()) {
try {
thumbs.thumbnailFileDescriptor = ParcelFileDescriptor.open(mLastThumbnailFile,
ParcelFileDescriptor.MODE_READ_ONLY);
} catch (IOException e) {
}
}
}
void freeLastThumbnail() {
mLastThumbnail = null;
}
void disposeThumbnail() {
mLastThumbnail = null;
lastDescription = null;
}
/** Returns the intent for the root activity for this task */
Intent getBaseIntent() {
return intent != null ? intent : affinityIntent;
}
/** Returns the first non-finishing activity from the root. */
ActivityRecord getRootActivity() {
for (int i = 0; i < mActivities.size(); i++) {
final ActivityRecord r = mActivities.get(i);
if (r.finishing) {
continue;
}
return r;
}
return null;
}
ActivityRecord getTopActivity() {
for (int i = mActivities.size() - 1; i >= 0; --i) {
final ActivityRecord r = mActivities.get(i);
if (r.finishing) {
continue;
}
return r;
}
return null;
}
ActivityRecord topRunningActivityLocked(ActivityRecord notTop) {
if (stack != null) {
for (int activityNdx = mActivities.size() - 1; activityNdx >= 0; --activityNdx) {
ActivityRecord r = mActivities.get(activityNdx);
if (!r.finishing && r != notTop && stack.okToShowLocked(r)) {
return r;
}
}
}
return null;
}
/** Call after activity movement or finish to make sure that frontOfTask is set correctly */
final void setFrontOfTask() {
boolean foundFront = false;
final int numActivities = mActivities.size();
for (int activityNdx = 0; activityNdx < numActivities; ++activityNdx) {
final ActivityRecord r = mActivities.get(activityNdx);
if (foundFront || r.finishing) {
r.frontOfTask = false;
} else {
r.frontOfTask = true;
// Set frontOfTask false for every following activity.
foundFront = true;
}
}
if (!foundFront && numActivities > 0) {
// All activities of this task are finishing. As we ought to have a frontOfTask
// activity, make the bottom activity front.
mActivities.get(0).frontOfTask = true;
}
}
/**
* Reorder the history stack so that the passed activity is brought to the front.
*/
final void moveActivityToFrontLocked(ActivityRecord newTop) {
if (DEBUG_ADD_REMOVE) Slog.i(TAG_ADD_REMOVE,
"Removing and adding activity " + newTop
+ " to stack at top callers=" + Debug.getCallers(4));
mActivities.remove(newTop);
mActivities.add(newTop);
updateEffectiveIntent();
setFrontOfTask();
}
void addActivityAtBottom(ActivityRecord r) {
addActivityAtIndex(0, r);
}
void addActivityToTop(ActivityRecord r) {
addActivityAtIndex(mActivities.size(), r);
}
void addActivityAtIndex(int index, ActivityRecord r) {
// Remove r first, and if it wasn't already in the list and it's fullscreen, count it.
if (!mActivities.remove(r) && r.fullscreen) {
// Was not previously in list.
numFullscreen++;
}
// Only set this based on the first activity
if (mActivities.isEmpty()) {
taskType = r.mActivityType;
isPersistable = r.isPersistable();
mCallingUid = r.launchedFromUid;
mCallingPackage = r.launchedFromPackage;
// Clamp to [1, max].
maxRecents = Math.min(Math.max(r.info.maxRecents, 1),
ActivityManager.getMaxAppRecentsLimitStatic());
} else {
// Otherwise make all added activities match this one.
r.mActivityType = taskType;
}
mActivities.add(index, r);
updateEffectiveIntent();
if (r.isPersistable()) {
mService.notifyTaskPersisterLocked(this, false);
}
}
/** @return true if this was the last activity in the task */
boolean removeActivity(ActivityRecord r) {
if (mActivities.remove(r) && r.fullscreen) {
// Was previously in list.
numFullscreen--;
}
if (r.isPersistable()) {
mService.notifyTaskPersisterLocked(this, false);
}
if (mActivities.isEmpty()) {
return !mReuseTask;
}
updateEffectiveIntent();
return false;
}
boolean autoRemoveFromRecents() {
// We will automatically remove the task either if it has explicitly asked for
// this, or it is empty and has never contained an activity that got shown to
// the user.
return autoRemoveRecents || (mActivities.isEmpty() && !hasBeenVisible);
}
/**
* Completely remove all activities associated with an existing
* task starting at a specified index.
*/
final void performClearTaskAtIndexLocked(int activityNdx) {
int numActivities = mActivities.size();
for ( ; activityNdx < numActivities; ++activityNdx) {
final ActivityRecord r = mActivities.get(activityNdx);
if (r.finishing) {
continue;
}
if (stack == null) {
// Task was restored from persistent storage.
r.takeFromHistory();
mActivities.remove(activityNdx);
--activityNdx;
--numActivities;
} else if (stack.finishActivityLocked(
r, Activity.RESULT_CANCELED, null, "clear-task-index", false)) {
--activityNdx;
--numActivities;
}
}
}
/**
* Completely remove all activities associated with an existing task.
*/
final void performClearTaskLocked() {
mReuseTask = true;
performClearTaskAtIndexLocked(0);
mReuseTask = false;
}
/**
* Perform clear operation as requested by
* {@link Intent#FLAG_ACTIVITY_CLEAR_TOP}: search from the top of the
* stack to the given task, then look for
* an instance of that activity in the stack and, if found, finish all
* activities on top of it and return the instance.
*
* @param newR Description of the new activity being started.
* @return Returns the old activity that should be continued to be used,
* or null if none was found.
*/
final ActivityRecord performClearTaskLocked(ActivityRecord newR, int launchFlags) {
int numActivities = mActivities.size();
for (int activityNdx = numActivities - 1; activityNdx >= 0; --activityNdx) {
ActivityRecord r = mActivities.get(activityNdx);
if (r.finishing) {
continue;
}
if (r.realActivity.equals(newR.realActivity)) {
// Here it is! Now finish everything in front...
final ActivityRecord ret = r;
for (++activityNdx; activityNdx < numActivities; ++activityNdx) {
r = mActivities.get(activityNdx);
if (r.finishing) {
continue;
}
ActivityOptions opts = r.takeOptionsLocked();
if (opts != null) {
ret.updateOptionsLocked(opts);
}
if (stack != null && stack.finishActivityLocked(
r, Activity.RESULT_CANCELED, null, "clear-task-stack", false)) {
--activityNdx;
--numActivities;
}
}
// Finally, if this is a normal launch mode (that is, not
// expecting onNewIntent()), then we will finish the current
// instance of the activity so a new fresh one can be started.
if (ret.launchMode == ActivityInfo.LAUNCH_MULTIPLE
&& (launchFlags & Intent.FLAG_ACTIVITY_SINGLE_TOP) == 0) {
if (!ret.finishing) {
if (stack != null) {
stack.finishActivityLocked(
ret, Activity.RESULT_CANCELED, null, "clear-task-top", false);
}
return null;
}
}
return ret;
}
}
return null;
}
public TaskThumbnail getTaskThumbnailLocked() {
if (stack != null) {
final ActivityRecord resumedActivity = stack.mResumedActivity;
if (resumedActivity != null && resumedActivity.task == this) {
final Bitmap thumbnail = stack.screenshotActivities(resumedActivity);
setLastThumbnail(thumbnail);
}
}
final TaskThumbnail taskThumbnail = new TaskThumbnail();
getLastThumbnail(taskThumbnail);
return taskThumbnail;
}
public void removeTaskActivitiesLocked() {
// Just remove the entire task.
performClearTaskAtIndexLocked(0);
}
String lockTaskAuthToString() {
switch (mLockTaskAuth) {
case LOCK_TASK_AUTH_DONT_LOCK: return "LOCK_TASK_AUTH_DONT_LOCK";
case LOCK_TASK_AUTH_PINNABLE: return "LOCK_TASK_AUTH_PINNABLE";
case LOCK_TASK_AUTH_LAUNCHABLE: return "LOCK_TASK_AUTH_LAUNCHABLE";
case LOCK_TASK_AUTH_WHITELISTED: return "LOCK_TASK_AUTH_WHITELISTED";
case LOCK_TASK_AUTH_LAUNCHABLE_PRIV: return "LOCK_TASK_AUTH_LAUNCHABLE_PRIV";
default: return "unknown=" + mLockTaskAuth;
}
}
void setLockTaskAuth() {
if (!mPrivileged &&
(mLockTaskMode == LOCK_TASK_LAUNCH_MODE_ALWAYS ||
mLockTaskMode == LOCK_TASK_LAUNCH_MODE_NEVER)) {
// Non-priv apps are not allowed to use always or never, fall back to default
mLockTaskMode = LOCK_TASK_LAUNCH_MODE_DEFAULT;
}
switch (mLockTaskMode) {
case LOCK_TASK_LAUNCH_MODE_DEFAULT:
mLockTaskAuth = isLockTaskWhitelistedLocked() ?
LOCK_TASK_AUTH_WHITELISTED : LOCK_TASK_AUTH_PINNABLE;
break;
case LOCK_TASK_LAUNCH_MODE_NEVER:
mLockTaskAuth = LOCK_TASK_AUTH_DONT_LOCK;
break;
case LOCK_TASK_LAUNCH_MODE_ALWAYS:
mLockTaskAuth = LOCK_TASK_AUTH_LAUNCHABLE_PRIV;
break;
case LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED:
mLockTaskAuth = isLockTaskWhitelistedLocked() ?
LOCK_TASK_AUTH_LAUNCHABLE : LOCK_TASK_AUTH_PINNABLE;
break;
}
if (DEBUG_LOCKTASK) Slog.d(TAG_LOCKTASK, "setLockTaskAuth: task=" + this +
" mLockTaskAuth=" + lockTaskAuthToString());
}
boolean isLockTaskWhitelistedLocked() {
String pkg = (realActivity != null) ? realActivity.getPackageName() : null;
if (pkg == null) {
return false;
}
String[] packages = mService.mLockTaskPackages.get(userId);
if (packages == null) {
return false;
}
for (int i = packages.length - 1; i >= 0; --i) {
if (pkg.equals(packages[i])) {
return true;
}
}
return false;
}
boolean isHomeTask() {
return taskType == HOME_ACTIVITY_TYPE;
}
boolean isApplicationTask() {
return taskType == APPLICATION_ACTIVITY_TYPE;
}
boolean isOverHomeStack() {
return mTaskToReturnTo == HOME_ACTIVITY_TYPE || mTaskToReturnTo == RECENTS_ACTIVITY_TYPE;
}
/**
* Find the activity in the history stack within the given task. Returns
* the index within the history at which it's found, or < 0 if not found.
*/
final ActivityRecord findActivityInHistoryLocked(ActivityRecord r) {
final ComponentName realActivity = r.realActivity;
for (int activityNdx = mActivities.size() - 1; activityNdx >= 0; --activityNdx) {
ActivityRecord candidate = mActivities.get(activityNdx);
if (candidate.finishing) {
continue;
}
if (candidate.realActivity.equals(realActivity)) {
return candidate;
}
}
return null;
}
/** Updates the last task description values. */
void updateTaskDescription() {
// Traverse upwards looking for any break between main task activities and
// utility activities.
int activityNdx;
final int numActivities = mActivities.size();
final boolean relinquish = numActivities == 0 ? false :
(mActivities.get(0).info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) != 0;
for (activityNdx = Math.min(numActivities, 1); activityNdx < numActivities;
++activityNdx) {
final ActivityRecord r = mActivities.get(activityNdx);
if (relinquish && (r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
// This will be the top activity for determining taskDescription. Pre-inc to
// overcome initial decrement below.
++activityNdx;
break;
}
if (r.intent != null &&
(r.intent.getFlags() & Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) != 0) {
break;
}
}
if (activityNdx > 0) {
// Traverse downwards starting below break looking for set label, icon.
// Note that if there are activities in the task but none of them set the
// recent activity values, then we do not fall back to the last set
// values in the TaskRecord.
String label = null;
String iconFilename = null;
int colorPrimary = 0;
for (--activityNdx; activityNdx >= 0; --activityNdx) {
final ActivityRecord r = mActivities.get(activityNdx);
if (r.taskDescription != null) {
if (label == null) {
label = r.taskDescription.getLabel();
}
if (iconFilename == null) {
iconFilename = r.taskDescription.getIconFilename();
}
if (colorPrimary == 0) {
colorPrimary = r.taskDescription.getPrimaryColor();
}
}
}
lastTaskDescription = new TaskDescription(label, colorPrimary, iconFilename);
// Update the task affiliation color if we are the parent of the group
if (taskId == mAffiliatedTaskId) {
mAffiliatedTaskColor = lastTaskDescription.getPrimaryColor();
}
}
}
int findEffectiveRootIndex() {
int effectiveNdx = 0;
final int topActivityNdx = mActivities.size() - 1;
for (int activityNdx = 0; activityNdx <= topActivityNdx; ++activityNdx) {
final ActivityRecord r = mActivities.get(activityNdx);
if (r.finishing) {
continue;
}
effectiveNdx = activityNdx;
if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
break;
}
}
return effectiveNdx;
}
void updateEffectiveIntent() {
final int effectiveRootIndex = findEffectiveRootIndex();
final ActivityRecord r = mActivities.get(effectiveRootIndex);
setIntent(r);
}
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
if (DEBUG_RECENTS) Slog.i(TAG_RECENTS, "Saving task=" + this);
out.attribute(null, ATTR_TASKID, String.valueOf(taskId));
if (realActivity != null) {
out.attribute(null, ATTR_REALACTIVITY, realActivity.flattenToShortString());
}
if (origActivity != null) {
out.attribute(null, ATTR_ORIGACTIVITY, origActivity.flattenToShortString());
}
// Write affinity, and root affinity if it is different from affinity.
// We use the special string "@" for a null root affinity, so we can identify
// later whether we were given a root affinity or should just make it the
// same as the affinity.
if (affinity != null) {
out.attribute(null, ATTR_AFFINITY, affinity);
if (!affinity.equals(rootAffinity)) {
out.attribute(null, ATTR_ROOT_AFFINITY, rootAffinity != null ? rootAffinity : "@");
}
} else if (rootAffinity != null) {
out.attribute(null, ATTR_ROOT_AFFINITY, rootAffinity != null ? rootAffinity : "@");
}
out.attribute(null, ATTR_ROOTHASRESET, String.valueOf(rootWasReset));
out.attribute(null, ATTR_AUTOREMOVERECENTS, String.valueOf(autoRemoveRecents));
out.attribute(null, ATTR_ASKEDCOMPATMODE, String.valueOf(askedCompatMode));
out.attribute(null, ATTR_USERID, String.valueOf(userId));
out.attribute(null, ATTR_EFFECTIVE_UID, String.valueOf(effectiveUid));
out.attribute(null, ATTR_TASKTYPE, String.valueOf(taskType));
out.attribute(null, ATTR_FIRSTACTIVETIME, String.valueOf(firstActiveTime));
out.attribute(null, ATTR_LASTACTIVETIME, String.valueOf(lastActiveTime));
out.attribute(null, ATTR_LASTTIMEMOVED, String.valueOf(mLastTimeMoved));
out.attribute(null, ATTR_NEVERRELINQUISH, String.valueOf(mNeverRelinquishIdentity));
if (lastDescription != null) {
out.attribute(null, ATTR_LASTDESCRIPTION, lastDescription.toString());
}
if (lastTaskDescription != null) {
lastTaskDescription.saveToXml(out);
}
out.attribute(null, ATTR_TASK_AFFILIATION_COLOR, String.valueOf(mAffiliatedTaskColor));
out.attribute(null, ATTR_TASK_AFFILIATION, String.valueOf(mAffiliatedTaskId));
out.attribute(null, ATTR_PREV_AFFILIATION, String.valueOf(mPrevAffiliateTaskId));
out.attribute(null, ATTR_NEXT_AFFILIATION, String.valueOf(mNextAffiliateTaskId));
out.attribute(null, ATTR_CALLING_UID, String.valueOf(mCallingUid));
out.attribute(null, ATTR_CALLING_PACKAGE, mCallingPackage == null ? "" : mCallingPackage);
out.attribute(null, ATTR_RESIZEABLE, String.valueOf(mResizeable));
out.attribute(null, ATTR_PRIVILEGED, String.valueOf(mPrivileged));
if (affinityIntent != null) {
out.startTag(null, TAG_AFFINITYINTENT);
affinityIntent.saveToXml(out);
out.endTag(null, TAG_AFFINITYINTENT);
}
out.startTag(null, TAG_INTENT);
intent.saveToXml(out);
out.endTag(null, TAG_INTENT);
final ArrayList<ActivityRecord> activities = mActivities;
final int numActivities = activities.size();
for (int activityNdx = 0; activityNdx < numActivities; ++activityNdx) {
final ActivityRecord r = activities.get(activityNdx);
if (r.info.persistableMode == ActivityInfo.PERSIST_ROOT_ONLY || !r.isPersistable() ||
((r.intent.getFlags() & FLAG_ACTIVITY_NEW_DOCUMENT
| FLAG_ACTIVITY_RETAIN_IN_RECENTS) == FLAG_ACTIVITY_NEW_DOCUMENT) &&
activityNdx > 0) {
// Stop at first non-persistable or first break in task (CLEAR_WHEN_TASK_RESET).
break;
}
out.startTag(null, TAG_ACTIVITY);
r.saveToXml(out);
out.endTag(null, TAG_ACTIVITY);
}
}
static TaskRecord restoreFromXml(XmlPullParser in, ActivityStackSupervisor stackSupervisor)
throws IOException, XmlPullParserException {
Intent intent = null;
Intent affinityIntent = null;
ArrayList<ActivityRecord> activities = new ArrayList<ActivityRecord>();
ComponentName realActivity = null;
ComponentName origActivity = null;
String affinity = null;
String rootAffinity = null;
boolean hasRootAffinity = false;
boolean rootHasReset = false;
boolean autoRemoveRecents = false;
boolean askedCompatMode = false;
int taskType = ActivityRecord.APPLICATION_ACTIVITY_TYPE;
int userId = 0;
int effectiveUid = -1;
String lastDescription = null;
long firstActiveTime = -1;
long lastActiveTime = -1;
long lastTimeOnTop = 0;
boolean neverRelinquishIdentity = true;
int taskId = INVALID_TASK_ID;
final int outerDepth = in.getDepth();
TaskDescription taskDescription = new TaskDescription();
int taskAffiliation = INVALID_TASK_ID;
int taskAffiliationColor = 0;
int prevTaskId = INVALID_TASK_ID;
int nextTaskId = INVALID_TASK_ID;
int callingUid = -1;
String callingPackage = "";
boolean resizeable = false;
boolean privileged = false;
for (int attrNdx = in.getAttributeCount() - 1; attrNdx >= 0; --attrNdx) {
final String attrName = in.getAttributeName(attrNdx);
final String attrValue = in.getAttributeValue(attrNdx);
if (TaskPersister.DEBUG) Slog.d(TaskPersister.TAG, "TaskRecord: attribute name=" +
attrName + " value=" + attrValue);
if (ATTR_TASKID.equals(attrName)) {
if (taskId == INVALID_TASK_ID) taskId = Integer.valueOf(attrValue);
} else if (ATTR_REALACTIVITY.equals(attrName)) {
realActivity = ComponentName.unflattenFromString(attrValue);
} else if (ATTR_ORIGACTIVITY.equals(attrName)) {
origActivity = ComponentName.unflattenFromString(attrValue);
} else if (ATTR_AFFINITY.equals(attrName)) {
affinity = attrValue;
} else if (ATTR_ROOT_AFFINITY.equals(attrName)) {
rootAffinity = attrValue;
hasRootAffinity = true;
} else if (ATTR_ROOTHASRESET.equals(attrName)) {
rootHasReset = Boolean.valueOf(attrValue);
} else if (ATTR_AUTOREMOVERECENTS.equals(attrName)) {
autoRemoveRecents = Boolean.valueOf(attrValue);
} else if (ATTR_ASKEDCOMPATMODE.equals(attrName)) {
askedCompatMode = Boolean.valueOf(attrValue);
} else if (ATTR_USERID.equals(attrName)) {
userId = Integer.valueOf(attrValue);
} else if (ATTR_EFFECTIVE_UID.equals(attrName)) {
effectiveUid = Integer.valueOf(attrValue);
} else if (ATTR_TASKTYPE.equals(attrName)) {
taskType = Integer.valueOf(attrValue);
} else if (ATTR_FIRSTACTIVETIME.equals(attrName)) {
firstActiveTime = Long.valueOf(attrValue);
} else if (ATTR_LASTACTIVETIME.equals(attrName)) {
lastActiveTime = Long.valueOf(attrValue);
} else if (ATTR_LASTDESCRIPTION.equals(attrName)) {
lastDescription = attrValue;
} else if (ATTR_LASTTIMEMOVED.equals(attrName)) {
lastTimeOnTop = Long.valueOf(attrValue);
} else if (ATTR_NEVERRELINQUISH.equals(attrName)) {
neverRelinquishIdentity = Boolean.valueOf(attrValue);
} else if (attrName.startsWith(TaskDescription.ATTR_TASKDESCRIPTION_PREFIX)) {
taskDescription.restoreFromXml(attrName, attrValue);
} else if (ATTR_TASK_AFFILIATION.equals(attrName)) {
taskAffiliation = Integer.valueOf(attrValue);
} else if (ATTR_PREV_AFFILIATION.equals(attrName)) {
prevTaskId = Integer.valueOf(attrValue);
} else if (ATTR_NEXT_AFFILIATION.equals(attrName)) {
nextTaskId = Integer.valueOf(attrValue);
} else if (ATTR_TASK_AFFILIATION_COLOR.equals(attrName)) {
taskAffiliationColor = Integer.valueOf(attrValue);
} else if (ATTR_CALLING_UID.equals(attrName)) {
callingUid = Integer.valueOf(attrValue);
} else if (ATTR_CALLING_PACKAGE.equals(attrName)) {
callingPackage = attrValue;
} else if (ATTR_RESIZEABLE.equals(attrName)) {
resizeable = Boolean.valueOf(attrValue);
} else if (ATTR_PRIVILEGED.equals(attrName)) {
privileged = Boolean.valueOf(attrValue);
} else {
Slog.w(TAG, "TaskRecord: Unknown attribute=" + attrName);
}
}
int event;
while (((event = in.next()) != XmlPullParser.END_DOCUMENT) &&
(event != XmlPullParser.END_TAG || in.getDepth() < outerDepth)) {
if (event == XmlPullParser.START_TAG) {
final String name = in.getName();
if (TaskPersister.DEBUG) Slog.d(TaskPersister.TAG, "TaskRecord: START_TAG name=" +
name);
if (TAG_AFFINITYINTENT.equals(name)) {
affinityIntent = Intent.restoreFromXml(in);
} else if (TAG_INTENT.equals(name)) {
intent = Intent.restoreFromXml(in);
} else if (TAG_ACTIVITY.equals(name)) {
ActivityRecord activity = ActivityRecord.restoreFromXml(in, stackSupervisor);
if (TaskPersister.DEBUG) Slog.d(TaskPersister.TAG, "TaskRecord: activity=" +
activity);
if (activity != null) {
activities.add(activity);
}
} else {
Slog.e(TAG, "restoreTask: Unexpected name=" + name);
XmlUtils.skipCurrentTag(in);
}
}
}
if (!hasRootAffinity) {
rootAffinity = affinity;
} else if ("@".equals(rootAffinity)) {
rootAffinity = null;
}
if (effectiveUid <= 0) {
Intent checkIntent = intent != null ? intent : affinityIntent;
effectiveUid = 0;
if (checkIntent != null) {
IPackageManager pm = AppGlobals.getPackageManager();
try {
ApplicationInfo ai = pm.getApplicationInfo(
checkIntent.getComponent().getPackageName(),
PackageManager.GET_UNINSTALLED_PACKAGES
| PackageManager.GET_DISABLED_COMPONENTS, userId);
if (ai != null) {
effectiveUid = ai.uid;
}
} catch (RemoteException e) {
}
}
Slog.w(TAG, "Updating task #" + taskId + " for " + checkIntent
+ ": effectiveUid=" + effectiveUid);
}
final TaskRecord task = new TaskRecord(stackSupervisor.mService, taskId, intent,
affinityIntent, affinity, rootAffinity, realActivity, origActivity, rootHasReset,
autoRemoveRecents, askedCompatMode, taskType, userId, effectiveUid, lastDescription,
activities, firstActiveTime, lastActiveTime, lastTimeOnTop, neverRelinquishIdentity,
taskDescription, taskAffiliation, prevTaskId, nextTaskId, taskAffiliationColor,
callingUid, callingPackage, resizeable, privileged);
for (int activityNdx = activities.size() - 1; activityNdx >=0; --activityNdx) {
activities.get(activityNdx).task = task;
}
if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "Restored task=" + task);
return task;
}
void dump(PrintWriter pw, String prefix) {
pw.print(prefix); pw.print("userId="); pw.print(userId);
pw.print(" effectiveUid="); UserHandle.formatUid(pw, effectiveUid);
pw.print(" mCallingUid="); UserHandle.formatUid(pw, mCallingUid);
pw.print(" mCallingPackage="); pw.println(mCallingPackage);
if (affinity != null || rootAffinity != null) {
pw.print(prefix); pw.print("affinity="); pw.print(affinity);
if (affinity == null || !affinity.equals(rootAffinity)) {
pw.print(" root="); pw.println(rootAffinity);
} else {
pw.println();
}
}
if (voiceSession != null || voiceInteractor != null) {
pw.print(prefix); pw.print("VOICE: session=0x");
pw.print(Integer.toHexString(System.identityHashCode(voiceSession)));
pw.print(" interactor=0x");
pw.println(Integer.toHexString(System.identityHashCode(voiceInteractor)));
}
if (intent != null) {
StringBuilder sb = new StringBuilder(128);
sb.append(prefix); sb.append("intent={");
intent.toShortString(sb, false, true, false, true);
sb.append('}');
pw.println(sb.toString());
}
if (affinityIntent != null) {
StringBuilder sb = new StringBuilder(128);
sb.append(prefix); sb.append("affinityIntent={");
affinityIntent.toShortString(sb, false, true, false, true);
sb.append('}');
pw.println(sb.toString());
}
if (origActivity != null) {
pw.print(prefix); pw.print("origActivity=");
pw.println(origActivity.flattenToShortString());
}
if (realActivity != null) {
pw.print(prefix); pw.print("realActivity=");
pw.println(realActivity.flattenToShortString());
}
if (autoRemoveRecents || isPersistable || taskType != 0 || mTaskToReturnTo != 0
|| numFullscreen != 0) {
pw.print(prefix); pw.print("autoRemoveRecents="); pw.print(autoRemoveRecents);
pw.print(" isPersistable="); pw.print(isPersistable);
pw.print(" numFullscreen="); pw.print(numFullscreen);
pw.print(" taskType="); pw.print(taskType);
pw.print(" mTaskToReturnTo="); pw.println(mTaskToReturnTo);
}
if (rootWasReset || mNeverRelinquishIdentity || mReuseTask
|| mLockTaskAuth != LOCK_TASK_AUTH_PINNABLE) {
pw.print(prefix); pw.print("rootWasReset="); pw.print(rootWasReset);
pw.print(" mNeverRelinquishIdentity="); pw.print(mNeverRelinquishIdentity);
pw.print(" mReuseTask="); pw.print(mReuseTask);
pw.print(" mLockTaskAuth="); pw.println(lockTaskAuthToString());
}
if (mAffiliatedTaskId != taskId || mPrevAffiliateTaskId != INVALID_TASK_ID
|| mPrevAffiliate != null || mNextAffiliateTaskId != INVALID_TASK_ID
|| mNextAffiliate != null) {
pw.print(prefix); pw.print("affiliation="); pw.print(mAffiliatedTaskId);
pw.print(" prevAffiliation="); pw.print(mPrevAffiliateTaskId);
pw.print(" (");
if (mPrevAffiliate == null) {
pw.print("null");
} else {
pw.print(Integer.toHexString(System.identityHashCode(mPrevAffiliate)));
}
pw.print(") nextAffiliation="); pw.print(mNextAffiliateTaskId);
pw.print(" (");
if (mNextAffiliate == null) {
pw.print("null");
} else {
pw.print(Integer.toHexString(System.identityHashCode(mNextAffiliate)));
}
pw.println(")");
}
pw.print(prefix); pw.print("Activities="); pw.println(mActivities);
if (!askedCompatMode || !inRecents || !isAvailable) {
pw.print(prefix); pw.print("askedCompatMode="); pw.print(askedCompatMode);
pw.print(" inRecents="); pw.print(inRecents);
pw.print(" isAvailable="); pw.println(isAvailable);
}
pw.print(prefix); pw.print("lastThumbnail="); pw.print(mLastThumbnail);
pw.print(" lastThumbnailFile="); pw.println(mLastThumbnailFile);
if (lastDescription != null) {
pw.print(prefix); pw.print("lastDescription="); pw.println(lastDescription);
}
if (stack != null) {
pw.print(prefix); pw.print("stackId="); pw.println(stack.mStackId);
}
pw.print(prefix); pw.print("hasBeenVisible="); pw.print(hasBeenVisible);
pw.print(" mResizeable="); pw.print(mResizeable);
pw.print(" firstActiveTime="); pw.print(lastActiveTime);
pw.print(" lastActiveTime="); pw.print(lastActiveTime);
pw.print(" (inactive for ");
pw.print((getInactiveDuration()/1000)); pw.println("s)");
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(128);
if (stringName != null) {
sb.append(stringName);
sb.append(" U=");
sb.append(userId);
sb.append(" sz=");
sb.append(mActivities.size());
sb.append('}');
return sb.toString();
}
sb.append("TaskRecord{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
sb.append(" #");
sb.append(taskId);
if (affinity != null) {
sb.append(" A=");
sb.append(affinity);
} else if (intent != null) {
sb.append(" I=");
sb.append(intent.getComponent().flattenToShortString());
} else if (affinityIntent != null) {
sb.append(" aI=");
sb.append(affinityIntent.getComponent().flattenToShortString());
} else {
sb.append(" ??");
}
stringName = sb.toString();
return toString();
}
}
|
Ant-Droid/android_frameworks_base_OLD
|
services/core/java/com/android/server/am/TaskRecord.java
|
Java
|
apache-2.0
| 56,682
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_14) on Tue Aug 17 01:02:52 EDT 2010 -->
<TITLE>
Uses of Class org.apache.hadoop.io.compress.DefaultCodec (Hadoop-common 0.21.0 API)
</TITLE>
<META NAME="date" CONTENT="2010-08-17">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.io.compress.DefaultCodec (Hadoop-common 0.21.0 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/hadoop/io/compress/DefaultCodec.html" title="class in org.apache.hadoop.io.compress"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/hadoop/io/compress//class-useDefaultCodec.html" target="_top"><B>FRAMES</B></A>
<A HREF="DefaultCodec.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.hadoop.io.compress.DefaultCodec</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../../org/apache/hadoop/io/compress/DefaultCodec.html" title="class in org.apache.hadoop.io.compress">DefaultCodec</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.io.compress"><B>org.apache.hadoop.io.compress</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.io.compress"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../../org/apache/hadoop/io/compress/DefaultCodec.html" title="class in org.apache.hadoop.io.compress">DefaultCodec</A> in <A HREF="../../../../../../org/apache/hadoop/io/compress/package-summary.html">org.apache.hadoop.io.compress</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Subclasses of <A HREF="../../../../../../org/apache/hadoop/io/compress/DefaultCodec.html" title="class in org.apache.hadoop.io.compress">DefaultCodec</A> in <A HREF="../../../../../../org/apache/hadoop/io/compress/package-summary.html">org.apache.hadoop.io.compress</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/compress/GzipCodec.html" title="class in org.apache.hadoop.io.compress">GzipCodec</A></B></CODE>
<BR>
This class creates gzip compressors/decompressors.</TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/hadoop/io/compress/DefaultCodec.html" title="class in org.apache.hadoop.io.compress"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/hadoop/io/compress//class-useDefaultCodec.html" target="_top"><B>FRAMES</B></A>
<A HREF="DefaultCodec.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2009 The Apache Software Foundation
</BODY>
</HTML>
|
jayantgolhar/Hadoop-0.21.0
|
common/docs/api/org/apache/hadoop/io/compress/class-use/DefaultCodec.html
|
HTML
|
apache-2.0
| 7,986
|
/**
* Copyright (C) 2014 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dashbuilder.dataset.engine.index;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.dashbuilder.dataset.impl.MemSizeEstimator;
import org.dashbuilder.dataset.engine.index.visitor.DataSetIndexVisitor;
import org.dashbuilder.dataset.filter.ColumnFilter;
import org.dashbuilder.dataset.group.AggregateFunctionType;
import org.dashbuilder.dataset.group.ColumnGroup;
import org.dashbuilder.dataset.sort.DataSetSort;
/**
* A DataSet index node
*/
public abstract class DataSetIndexNode extends DataSetIndexElement {
DataSetIndexNode parent = null;
List<Integer> rows = null;
List<DataSetGroupIndex> groupIndexes = null;
List<DataSetSortIndex> sortIndexes = null;
List<DataSetFilterIndex> filterIndexes = null;
Map<String, Map<AggregateFunctionType, DataSetFunctionIndex>> functionIndexes = null;
public DataSetIndexNode() {
this(null, null, 0);
}
public DataSetIndexNode(DataSetIndexNode parent, List<Integer> rows, long buildTime) {
super(buildTime);
this.parent = parent;
this.rows = rows;
}
public DataSetIndexNode getParent() {
return parent;
}
public void setParent(DataSetIndexNode parent) {
this.parent = parent;
}
public List<Integer> getRows() {
return rows;
}
public long getEstimatedSize() {
long result = super.getEstimatedSize();
if (rows != null) {
result += rows.size() * MemSizeEstimator.sizeOfInteger;
}
return result;
}
public void acceptVisitor(DataSetIndexVisitor visitor) {
super.acceptVisitor(visitor);
if (groupIndexes != null) {
for (DataSetGroupIndex index : groupIndexes) {
index.acceptVisitor(visitor);
}
}
if (filterIndexes != null) {
for (DataSetFilterIndex index : filterIndexes) {
index.acceptVisitor(visitor);
}
}
if (sortIndexes != null) {
for (DataSetSortIndex index : sortIndexes) {
index.acceptVisitor(visitor);
}
}
if (functionIndexes != null) {
for (Map<AggregateFunctionType, DataSetFunctionIndex> indexMap : functionIndexes.values()) {
for (DataSetFunctionIndex index : indexMap.values()) {
index.acceptVisitor(visitor);
}
}
}
}
// Aggregate function indexes
public DataSetFunctionIndex indexAggValue(String columnId, AggregateFunctionType type, Double value, long buildTime) {
if (functionIndexes == null) functionIndexes = new HashMap<String, Map<AggregateFunctionType, DataSetFunctionIndex>>();
Map<AggregateFunctionType,DataSetFunctionIndex> columnAggFunctions = functionIndexes.get(columnId);
if (columnAggFunctions == null) {
functionIndexes.put(columnId, columnAggFunctions
= new EnumMap<AggregateFunctionType, DataSetFunctionIndex>(AggregateFunctionType.class));
}
DataSetFunctionIndex index = new DataSetFunctionIndex(value, buildTime);
columnAggFunctions.put(type, index);
return index;
}
public Double getAggValue(String columnId, AggregateFunctionType type) {
if (functionIndexes == null) return null;
Map<AggregateFunctionType,DataSetFunctionIndex> columnAggFunctions = functionIndexes.get(columnId);
if (columnAggFunctions == null) return null;
DataSetFunctionIndex functionIndex = columnAggFunctions.get(type);
if (functionIndex == null) return null;
functionIndex.reuseHit();
return functionIndex.getValue();
}
// TODO: coordinate concurrent index modifications
// Group indexes
public DataSetGroupIndex indexGroup(DataSetGroupIndex index) {
if (groupIndexes == null) groupIndexes = new ArrayList<DataSetGroupIndex>();
index.setParent(this);
index.setBuildTime(buildTime);
groupIndexes.add(index);
return index;
}
public DataSetGroupIndex getGroupIndex(ColumnGroup gc) {
if (groupIndexes == null) return null;
String key = getGroupKey(gc);
for (DataSetGroupIndex groupIndex : groupIndexes) {
ColumnGroup c = groupIndex.columnGroup;
if (key.equals(getGroupKey(c))) {
groupIndex.reuseHit();
return groupIndex;
}
}
return null;
}
public String getGroupKey(ColumnGroup columnGroup) {
return columnGroup.getSourceId()
+ "_" + columnGroup.getStrategy().toString()
+ "_" + columnGroup.getIntervalSize()
+ "_" + columnGroup.getMaxIntervals()
+ "_" + columnGroup.areEmptyIntervalsAllowed()
+ "_" + columnGroup.isAscendingOrder()
+ (columnGroup.getFirstMonthOfYear() != null ? "_" + columnGroup.getFirstMonthOfYear() : "")
+ (columnGroup.getFirstDayOfWeek() != null ? "_" + columnGroup.getFirstDayOfWeek() : "");
}
// Filter indexes
public DataSetFilterIndex indexFilter(ColumnFilter filter, List<Integer> rows, long buildTime) {
if (filterIndexes == null) filterIndexes = new ArrayList<DataSetFilterIndex>();
DataSetFilterIndex index = new DataSetFilterIndex(filter, rows);
index.setParent(this);
index.setBuildTime(buildTime);
filterIndexes.add(index);
return index;
}
public DataSetFilterIndex getFilterIndex(ColumnFilter filter) {
if (filterIndexes == null) return null;
for (DataSetFilterIndex index: filterIndexes) {
if (filter.equals(index.getColumnFilter())) {
index.reuseHit();
return index;
}
}
return null;
}
// Sort indexes
public DataSetSortIndex indexSort(DataSetSort sortOp, List<Integer> sortedRows, long buildTime) {
if (sortIndexes == null) sortIndexes = new ArrayList<DataSetSortIndex>();
DataSetSortIndex index = new DataSetSortIndex(sortOp, sortedRows);
index.setParent(this);
index.setBuildTime(buildTime);
sortIndexes.add(index);
// Also create an index for the inverted sort.
DataSetSort invertedSortOp = sortOp.cloneInstance().invertOrder();
List<Integer> invertedRows = new ArrayList<Integer>(sortedRows);
Collections.reverse(invertedRows);
DataSetSortIndex invertedIndex = new DataSetSortIndex(invertedSortOp, invertedRows);
invertedIndex.setParent(this);
sortIndexes.add(invertedIndex);
return index;
}
public DataSetSortIndex getSortIndex(DataSetSort sortOp) {
if (sortIndexes == null) return null;
for (DataSetSortIndex sortIndex : sortIndexes) {
if (sortOp.equals(sortIndex.getSortOp())) {
sortIndex.reuseHit();
return sortIndex;
}
}
return null;
}
}
|
porcelli-forks/dashbuilder
|
dashbuilder-shared/dashbuilder-dataset-shared/src/main/java/org/dashbuilder/dataset/engine/index/DataSetIndexNode.java
|
Java
|
apache-2.0
| 7,771
|
/**
* This header is generated by class-dump-z 0.2a.
* class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3.
*
* Source: /System/Library/PrivateFrameworks/BackRow.framework/BackRow
*/
@class NSString;
@interface BRMediaHostState : NSObject {
@private
NSString *_description; // 4 = 0x4
}
@property(readonly, retain) NSString *description; // G=0x3158eb41; converted property
+ (id)available; // 0x31590ffd
+ (id)mountFailed; // 0x31632f01
+ (id)mounted; // 0x31591279
+ (id)mounting; // 0x315910d1
+ (id)unavailable; // 0x3158e819
+ (id)unmounting; // 0x315911a5
- (id)initWithDescription:(id)description; // 0x3158e8ed
- (void)dealloc; // 0x31632c11
// converted property getter: - (id)description; // 0x3158eb41
- (id)mediaHostEvent:(id)event forMediaHost:(id)mediaHost; // 0x3159154d
@end
|
bboyle18/AppleTV-LiveTV
|
theos/include/BackRow/BRMediaHostState.h
|
C
|
apache-2.0
| 818
|
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for rnn module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import time
import timeit
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
from tensorflow.python.util import nest
class Plus1RNNCell(tf.nn.rnn_cell.RNNCell):
"""RNN Cell generating (output, new_state) = (input + 1, state + 1)."""
@property
def output_size(self):
return 5
@property
def state_size(self):
return 5
def __call__(self, input_, state, scope=None):
return (input_ + 1, state + 1)
class DummyMultiDimensionalLSTM(tf.nn.rnn_cell.RNNCell):
"""LSTM Cell generating (output, new_state) = (input + 1, state + 1).
The input to this cell may have an arbitrary number of dimensions that follow
the preceding 'Time' and 'Batch' dimensions.
"""
def __init__(self, dims):
"""Initialize the Multi-dimensional LSTM cell.
Args:
dims: tuple that contains the dimensions of the output of the cell,
without including 'Time' or 'Batch' dimensions.
"""
if not isinstance(dims, tuple):
raise TypeError("The dimensions passed to DummyMultiDimensionalLSTM"
"should be a tuple of ints.")
self._dims = dims
self._output_size = tf.TensorShape(self._dims)
self._state_size = (tf.TensorShape(self._dims), tf.TensorShape(self._dims))
@property
def output_size(self):
return self._output_size
@property
def state_size(self):
return self._state_size
def __call__(self, input_, state, scope=None):
h, c = state
return (input_ + 1, (h + 1, c + 1))
class NestedRNNCell(tf.nn.rnn_cell.RNNCell):
"""RNN Cell generating (output, new_state) = (input + 1, state + 1).
The input, output and state of this cell is a tuple of two tensors.
"""
@property
def output_size(self):
return (5, 5)
@property
def state_size(self):
return (6, 6)
def __call__(self, input_, state, scope=None):
h, c = state
x, y = input_
return ((x + 1, y + 1), (h + 1, c + 1))
class TestStateSaver(object):
def __init__(self, batch_size, state_size):
self._batch_size = batch_size
self._state_size = state_size
self.saved_state = {}
def state(self, name):
if isinstance(self._state_size, dict):
state_size = self._state_size[name]
else:
state_size = self._state_size
if isinstance(state_size, int):
state_size = (state_size,)
elif isinstance(state_size, tuple):
pass
else:
raise TypeError("state_size should either be an int or a tuple")
return tf.zeros((self._batch_size,) + state_size)
def save_state(self, name, state):
self.saved_state[name] = state
return tf.identity(state)
class RNNTest(tf.test.TestCase):
def setUp(self):
self._seed = 23489
np.random.seed(self._seed)
def testInvalidSequenceLengthShape(self):
cell = Plus1RNNCell()
inputs = [tf.placeholder(tf.float32, shape=(3, 4))]
with self.assertRaisesRegexp(ValueError, "must be a vector"):
tf.nn.rnn(cell, inputs, dtype=tf.float32, sequence_length=4)
with self.assertRaisesRegexp(ValueError, "must be a vector"):
tf.nn.dynamic_rnn(
cell, tf.pack(inputs), dtype=tf.float32, sequence_length=[[4]])
def testRNN(self):
cell = Plus1RNNCell()
batch_size = 2
input_size = 5
max_length = 8 # unrolled up to this length
inputs = max_length * [
tf.placeholder(tf.float32, shape=(batch_size, input_size))]
outputs, state = tf.nn.rnn(cell, inputs, dtype=tf.float32)
self.assertEqual(len(outputs), len(inputs))
for out, inp in zip(outputs, inputs):
self.assertEqual(out.get_shape(), inp.get_shape())
self.assertEqual(out.dtype, inp.dtype)
with self.test_session(use_gpu=False) as sess:
input_value = np.random.randn(batch_size, input_size)
values = sess.run(outputs + [state],
feed_dict={inputs[0]: input_value})
# Outputs
for v in values[:-1]:
self.assertAllClose(v, input_value + 1.0)
# Final state
self.assertAllClose(
values[-1],
max_length * np.ones((batch_size, input_size), dtype=np.float32))
def testDropout(self):
cell = Plus1RNNCell()
full_dropout_cell = tf.nn.rnn_cell.DropoutWrapper(
cell, input_keep_prob=1e-12, seed=0)
batch_size = 2
input_size = 5
max_length = 8
inputs = max_length * [
tf.placeholder(tf.float32, shape=(batch_size, input_size))]
with tf.variable_scope("share_scope"):
outputs, state = tf.nn.rnn(cell, inputs, dtype=tf.float32)
with tf.variable_scope("drop_scope"):
dropped_outputs, _ = tf.nn.rnn(
full_dropout_cell, inputs, dtype=tf.float32)
self.assertEqual(len(outputs), len(inputs))
for out, inp in zip(outputs, inputs):
self.assertEqual(out.get_shape().as_list(), inp.get_shape().as_list())
self.assertEqual(out.dtype, inp.dtype)
with self.test_session(use_gpu=False) as sess:
input_value = np.random.randn(batch_size, input_size)
values = sess.run(outputs + [state],
feed_dict={inputs[0]: input_value})
full_dropout_values = sess.run(dropped_outputs,
feed_dict={inputs[0]: input_value})
for v in values[:-1]:
self.assertAllClose(v, input_value + 1.0)
for d_v in full_dropout_values[:-1]: # Add 1.0 to dropped_out (all zeros)
self.assertAllClose(d_v, np.ones_like(input_value))
def _testDynamicCalculation(self, use_gpu):
cell = Plus1RNNCell()
sequence_length = tf.placeholder(tf.int64)
batch_size = 2
input_size = 5
max_length = 8
inputs = max_length * [
tf.placeholder(tf.float32, shape=(batch_size, input_size))]
with tf.variable_scope("drop_scope"):
dynamic_outputs, dynamic_state = tf.nn.rnn(
cell, inputs, sequence_length=sequence_length, dtype=tf.float32)
self.assertEqual(len(dynamic_outputs), len(inputs))
with self.test_session(use_gpu=use_gpu) as sess:
input_value = np.random.randn(batch_size, input_size)
dynamic_values = sess.run(dynamic_outputs,
feed_dict={inputs[0]: input_value,
sequence_length: [2, 3]})
dynamic_state_value = sess.run([dynamic_state],
feed_dict={inputs[0]: input_value,
sequence_length: [2, 3]})
# outputs are fully calculated for t = 0, 1
for v in dynamic_values[:2]:
self.assertAllClose(v, input_value + 1.0)
# outputs at t = 2 are zero for entry 0, calculated for entry 1
self.assertAllClose(
dynamic_values[2],
np.vstack((
np.zeros((input_size)),
1.0 + input_value[1, :])))
# outputs at t = 3+ are zero
for v in dynamic_values[3:]:
self.assertAllEqual(v, np.zeros_like(input_value))
# the final states are:
# entry 0: the values from the calculation at t=1
# entry 1: the values from the calculation at t=2
self.assertAllEqual(
dynamic_state_value[0],
np.vstack((
1.0 * (1 + 1) * np.ones((input_size)),
1.0 * (2 + 1) * np.ones((input_size)))))
def testDynamicCalculation(self):
self._testDynamicCalculation(True)
self._testDynamicCalculation(False)
def _testScope(self, factory, prefix="prefix", use_outer_scope=True):
with self.test_session(use_gpu=True, graph=tf.Graph()):
if use_outer_scope:
with tf.variable_scope(prefix) as scope:
factory(scope)
else:
factory(prefix)
# check that all the variables names starts
# with the proper scope.
tf.initialize_all_variables()
all_vars = tf.all_variables()
prefix = prefix or "RNN"
scope_vars = [v for v in all_vars if v.name.startswith(prefix + "/")]
tf.logging.info("RNN with scope: %s (%s)"
% (prefix, "scope" if use_outer_scope else "str"))
for v in scope_vars:
tf.logging.info(v.name)
self.assertEqual(len(scope_vars), len(all_vars))
def testScope(self):
def factory(scope):
cell = Plus1RNNCell()
batch_size = 2
input_size = 5
max_length = 8 # unrolled up to this length
inputs = max_length * [
tf.placeholder(tf.float32, shape=(batch_size, input_size))]
return tf.nn.rnn(cell, inputs, dtype=tf.float32, scope=scope)
self._testScope(factory, use_outer_scope=True)
self._testScope(factory, use_outer_scope=False)
self._testScope(factory, prefix=None, use_outer_scope=False)
class GRUTest(tf.test.TestCase):
def setUp(self):
self._seed = 23489
np.random.seed(self._seed)
def _testDynamic(self, use_gpu):
time_steps = 8
num_units = 3
input_size = 5
batch_size = 2
input_values = np.random.randn(time_steps, batch_size, input_size)
sequence_length = np.random.randint(0, time_steps, size=batch_size)
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
concat_inputs = tf.placeholder(
tf.float32, shape=(time_steps, batch_size, input_size))
cell = tf.nn.rnn_cell.GRUCell(num_units=num_units)
with tf.variable_scope("dynamic_scope"):
outputs_dynamic, state_dynamic = tf.nn.dynamic_rnn(
cell, inputs=concat_inputs, sequence_length=sequence_length,
time_major=True, dtype=tf.float32)
feeds = {concat_inputs: input_values}
# Initialize
tf.initialize_all_variables().run(feed_dict=feeds)
sess.run([outputs_dynamic, state_dynamic], feed_dict=feeds)
def testDynamic(self):
self._testDynamic(use_gpu=False)
self._testDynamic(use_gpu=True)
def _testScope(self, factory, prefix="prefix", use_outer_scope=True):
with self.test_session(use_gpu=True, graph=tf.Graph()):
if use_outer_scope:
with tf.variable_scope(prefix) as scope:
factory(scope)
else:
factory(prefix)
tf.initialize_all_variables()
# check that all the variables names starts
# with the proper scope.
all_vars = tf.all_variables()
prefix = prefix or "RNN"
scope_vars = [v for v in all_vars if v.name.startswith(prefix + "/")]
tf.logging.info("RNN with scope: %s (%s)"
% (prefix, "scope" if use_outer_scope else "str"))
for v in scope_vars:
tf.logging.info(v.name)
self.assertEqual(len(scope_vars), len(all_vars))
def testDynamicScope(self):
time_steps = 8
num_units = 3
input_size = 5
batch_size = 2
sequence_length = np.random.randint(0, time_steps, size=batch_size)
def factory(scope):
concat_inputs = tf.placeholder(
tf.float32, shape=(time_steps, batch_size, input_size))
cell = tf.nn.rnn_cell.GRUCell(num_units=num_units)
return tf.nn.dynamic_rnn(cell, inputs=concat_inputs,
sequence_length=sequence_length,
time_major=True, dtype=tf.float32,
scope=scope)
self._testScope(factory, use_outer_scope=True)
self._testScope(factory, use_outer_scope=False)
self._testScope(factory, prefix=None, use_outer_scope=False)
class LSTMTest(tf.test.TestCase):
def setUp(self):
self._seed = 23489
np.random.seed(self._seed)
def _testNoProjNoSharding(self, use_gpu):
num_units = 3
input_size = 5
batch_size = 2
max_length = 8
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
cell = tf.nn.rnn_cell.LSTMCell(num_units, initializer=initializer,
state_is_tuple=False)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(batch_size, input_size))]
outputs, _ = tf.nn.rnn(cell, inputs, dtype=tf.float32)
self.assertEqual(len(outputs), len(inputs))
for out in outputs:
self.assertEqual(out.get_shape().as_list(), [batch_size, num_units])
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
sess.run(outputs, feed_dict={inputs[0]: input_value})
def _testCellClipping(self, use_gpu):
num_units = 3
input_size = 5
batch_size = 2
max_length = 8
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
cell = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=True, cell_clip=0.0, initializer=initializer,
state_is_tuple=False)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(batch_size, input_size))]
outputs, _ = tf.nn.rnn(cell, inputs, dtype=tf.float32)
self.assertEqual(len(outputs), len(inputs))
for out in outputs:
self.assertEqual(out.get_shape().as_list(), [batch_size, num_units])
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
values = sess.run(outputs, feed_dict={inputs[0]: input_value})
for value in values:
# if cell c is clipped to 0, tanh(c) = 0 => m==0
self.assertAllEqual(value, np.zeros((batch_size, num_units)))
def _testNoProjNoShardingSimpleStateSaver(self, use_gpu):
num_units = 3
input_size = 5
batch_size = 2
max_length = 8
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
state_saver = TestStateSaver(batch_size, 2 * num_units)
cell = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=False, initializer=initializer,
state_is_tuple=False)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(batch_size, input_size))]
with tf.variable_scope("share_scope"):
outputs, state = tf.nn.state_saving_rnn(
cell, inputs, state_saver=state_saver, state_name="save_lstm")
self.assertEqual(len(outputs), len(inputs))
for out in outputs:
self.assertEqual(out.get_shape().as_list(), [batch_size, num_units])
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
(last_state_value, saved_state_value) = sess.run(
[state, state_saver.saved_state["save_lstm"]],
feed_dict={inputs[0]: input_value})
self.assertAllEqual(last_state_value, saved_state_value)
def testNoProjNoShardingTupleStateSaver(self):
num_units = 3
input_size = 5
batch_size = 2
max_length = 8
with self.test_session(graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
state_saver = TestStateSaver(batch_size, num_units)
cell = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=False, initializer=initializer,
state_is_tuple=True)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(batch_size, input_size))]
with tf.variable_scope("share_scope"):
outputs, state = tf.nn.state_saving_rnn(
cell, inputs, state_saver=state_saver, state_name=("c", "m"))
self.assertEqual(len(outputs), len(inputs))
for out in outputs:
self.assertEqual(out.get_shape().as_list(), [batch_size, num_units])
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
last_and_saved_states = sess.run(
state + (state_saver.saved_state["c"], state_saver.saved_state["m"]),
feed_dict={inputs[0]: input_value})
self.assertEqual(4, len(last_and_saved_states))
self.assertAllEqual(last_and_saved_states[:2], last_and_saved_states[2:])
def testNoProjNoShardingNestedTupleStateSaver(self):
num_units = 3
input_size = 5
batch_size = 2
max_length = 8
with self.test_session(graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
state_saver = TestStateSaver(batch_size, {"c0": num_units,
"m0": num_units,
"c1": num_units + 1,
"m1": num_units + 1,
"c2": num_units + 2,
"m2": num_units + 2,
"c3": num_units + 3,
"m3": num_units + 3})
def _cell(i):
return tf.nn.rnn_cell.LSTMCell(
num_units + i, use_peepholes=False, initializer=initializer,
state_is_tuple=True)
# This creates a state tuple which has 4 sub-tuples of length 2 each.
cell = tf.nn.rnn_cell.MultiRNNCell(
[_cell(i) for i in range(4)], state_is_tuple=True)
self.assertEqual(len(cell.state_size), 4)
for i in range(4):
self.assertEqual(len(cell.state_size[i]), 2)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(batch_size, input_size))]
state_names = (("c0", "m0"), ("c1", "m1"),
("c2", "m2"), ("c3", "m3"))
with tf.variable_scope("share_scope"):
outputs, state = tf.nn.state_saving_rnn(
cell, inputs, state_saver=state_saver, state_name=state_names)
self.assertEqual(len(outputs), len(inputs))
# Final output comes from _cell(3) which has state size num_units + 3
for out in outputs:
self.assertEqual(out.get_shape().as_list(), [batch_size, num_units + 3])
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
last_states = sess.run(
list(nest.flatten(state)), feed_dict={inputs[0]: input_value})
saved_states = sess.run(
list(state_saver.saved_state.values()),
feed_dict={inputs[0]: input_value})
self.assertEqual(8, len(last_states))
self.assertEqual(8, len(saved_states))
flat_state_names = nest.flatten(state_names)
named_saved_states = dict(
zip(state_saver.saved_state.keys(), saved_states))
for i in range(8):
self.assertAllEqual(
last_states[i],
named_saved_states[flat_state_names[i]])
def _testProjNoSharding(self, use_gpu):
num_units = 3
input_size = 5
batch_size = 2
num_proj = 4
max_length = 8
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(None, input_size))]
cell = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=True,
num_proj=num_proj, initializer=initializer,
state_is_tuple=False)
outputs, _ = tf.nn.rnn(cell, inputs, dtype=tf.float32)
self.assertEqual(len(outputs), len(inputs))
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
sess.run(outputs, feed_dict={inputs[0]: input_value})
def testStateTupleWithProjAndSequenceLength(self):
num_units = 3
input_size = 5
batch_size = 2
num_proj = 4
max_length = 8
sequence_length = [4, 6]
with self.test_session(graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(None, input_size))]
cell_notuple = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=True,
num_proj=num_proj, initializer=initializer, state_is_tuple=False)
cell_tuple = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=True,
num_proj=num_proj, initializer=initializer, state_is_tuple=True)
outputs_notuple, state_notuple = tf.nn.rnn(
cell_notuple, inputs, dtype=tf.float32,
sequence_length=sequence_length)
tf.get_variable_scope().reuse_variables()
outputs_tuple, state_tuple = tf.nn.rnn(
cell_tuple, inputs, dtype=tf.float32,
sequence_length=sequence_length)
self.assertEqual(len(outputs_notuple), len(inputs))
self.assertEqual(len(outputs_tuple), len(inputs))
self.assertTrue(isinstance(state_tuple, tuple))
self.assertTrue(isinstance(state_notuple, tf.Tensor))
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
outputs_notuple_v = sess.run(
outputs_notuple, feed_dict={inputs[0]: input_value})
outputs_tuple_v = sess.run(
outputs_tuple, feed_dict={inputs[0]: input_value})
self.assertAllEqual(outputs_notuple_v, outputs_tuple_v)
(state_notuple_v,) = sess.run(
(state_notuple,), feed_dict={inputs[0]: input_value})
state_tuple_v = sess.run(
state_tuple, feed_dict={inputs[0]: input_value})
self.assertAllEqual(state_notuple_v, np.hstack(state_tuple_v))
def _testProjSharding(self, use_gpu):
num_units = 3
input_size = 5
batch_size = 2
num_proj = 4
num_proj_shards = 3
num_unit_shards = 2
max_length = 8
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(None, input_size))]
cell = tf.nn.rnn_cell.LSTMCell(
num_units,
use_peepholes=True,
num_proj=num_proj,
num_unit_shards=num_unit_shards,
num_proj_shards=num_proj_shards,
initializer=initializer,
state_is_tuple=False)
outputs, _ = tf.nn.rnn(cell, inputs, dtype=tf.float32)
self.assertEqual(len(outputs), len(inputs))
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
sess.run(outputs, feed_dict={inputs[0]: input_value})
def _testTooManyShards(self, use_gpu):
num_units = 3
input_size = 5
num_proj = 4
num_proj_shards = 4
num_unit_shards = 2
max_length = 8
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()):
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(None, input_size))]
cell = tf.nn.rnn_cell.LSTMCell(
num_units,
use_peepholes=True,
num_proj=num_proj,
num_unit_shards=num_unit_shards,
num_proj_shards=num_proj_shards,
initializer=initializer,
state_is_tuple=False)
with self.assertRaises(ValueError):
tf.nn.rnn(cell, inputs, dtype=tf.float32)
def _testDoubleInput(self, use_gpu):
num_units = 3
input_size = 5
batch_size = 2
num_proj = 4
num_proj_shards = 3
num_unit_shards = 2
max_length = 8
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-1, 1, seed=self._seed)
inputs = max_length * [
tf.placeholder(tf.float64, shape=(None, input_size))]
cell = tf.nn.rnn_cell.LSTMCell(
num_units,
use_peepholes=True,
num_proj=num_proj,
num_unit_shards=num_unit_shards,
num_proj_shards=num_proj_shards,
initializer=initializer,
state_is_tuple=False)
outputs, _ = tf.nn.rnn(
cell, inputs, initial_state=cell.zero_state(batch_size, tf.float64))
self.assertEqual(len(outputs), len(inputs))
tf.initialize_all_variables().run()
input_value = np.asarray(np.random.randn(batch_size, input_size),
dtype=np.float64)
values = sess.run(outputs, feed_dict={inputs[0]: input_value})
self.assertEqual(values[0].dtype, input_value.dtype)
def _testShardNoShardEquivalentOutput(self, use_gpu):
num_units = 3
input_size = 5
batch_size = 2
num_proj = 4
num_proj_shards = 3
num_unit_shards = 2
max_length = 8
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
inputs = max_length * [
tf.placeholder(tf.float32, shape=(None, input_size))]
initializer = tf.constant_initializer(0.001)
cell_noshard = tf.nn.rnn_cell.LSTMCell(
num_units,
num_proj=num_proj,
use_peepholes=True,
initializer=initializer,
num_unit_shards=num_unit_shards,
num_proj_shards=num_proj_shards,
state_is_tuple=False)
cell_shard = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=True,
initializer=initializer, num_proj=num_proj,
state_is_tuple=False)
with tf.variable_scope("noshard_scope"):
outputs_noshard, state_noshard = tf.nn.rnn(
cell_noshard, inputs, dtype=tf.float32)
with tf.variable_scope("shard_scope"):
outputs_shard, state_shard = tf.nn.rnn(
cell_shard, inputs, dtype=tf.float32)
self.assertEqual(len(outputs_noshard), len(inputs))
self.assertEqual(len(outputs_noshard), len(outputs_shard))
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
feeds = dict((x, input_value) for x in inputs)
values_noshard = sess.run(outputs_noshard, feed_dict=feeds)
values_shard = sess.run(outputs_shard, feed_dict=feeds)
state_values_noshard = sess.run([state_noshard], feed_dict=feeds)
state_values_shard = sess.run([state_shard], feed_dict=feeds)
self.assertEqual(len(values_noshard), len(values_shard))
self.assertEqual(len(state_values_noshard), len(state_values_shard))
for (v_noshard, v_shard) in zip(values_noshard, values_shard):
self.assertAllClose(v_noshard, v_shard, atol=1e-3)
for (s_noshard, s_shard) in zip(state_values_noshard, state_values_shard):
self.assertAllClose(s_noshard, s_shard, atol=1e-3)
def _testDoubleInputWithDropoutAndDynamicCalculation(
self, use_gpu):
"""Smoke test for using LSTM with doubles, dropout, dynamic calculation."""
num_units = 3
input_size = 5
batch_size = 2
num_proj = 4
num_proj_shards = 3
num_unit_shards = 2
max_length = 8
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
sequence_length = tf.placeholder(tf.int64)
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
inputs = max_length * [
tf.placeholder(tf.float64, shape=(None, input_size))]
cell = tf.nn.rnn_cell.LSTMCell(
num_units,
use_peepholes=True,
num_proj=num_proj,
num_unit_shards=num_unit_shards,
num_proj_shards=num_proj_shards,
initializer=initializer,
state_is_tuple=False)
dropout_cell = tf.nn.rnn_cell.DropoutWrapper(cell, 0.5, seed=0)
outputs, state = tf.nn.rnn(
dropout_cell, inputs, sequence_length=sequence_length,
initial_state=cell.zero_state(batch_size, tf.float64))
self.assertEqual(len(outputs), len(inputs))
tf.initialize_all_variables().run(feed_dict={sequence_length: [2, 3]})
input_value = np.asarray(np.random.randn(batch_size, input_size),
dtype=np.float64)
values = sess.run(outputs, feed_dict={inputs[0]: input_value,
sequence_length: [2, 3]})
state_value = sess.run([state], feed_dict={inputs[0]: input_value,
sequence_length: [2, 3]})
self.assertEqual(values[0].dtype, input_value.dtype)
self.assertEqual(state_value[0].dtype, input_value.dtype)
def testSharingWeightsWithReuse(self):
num_units = 3
input_size = 5
batch_size = 2
num_proj = 4
max_length = 8
with self.test_session(graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-1, 1, seed=self._seed)
initializer_d = tf.random_uniform_initializer(-1, 1, seed=self._seed+1)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(None, input_size))]
cell = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=True,
num_proj=num_proj, initializer=initializer,
state_is_tuple=False)
cell_d = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=True,
num_proj=num_proj, initializer=initializer_d,
state_is_tuple=False)
with tf.variable_scope("share_scope"):
outputs0, _ = tf.nn.rnn(cell, inputs, dtype=tf.float32)
with tf.variable_scope("share_scope", reuse=True):
outputs1, _ = tf.nn.rnn(cell, inputs, dtype=tf.float32)
with tf.variable_scope("diff_scope"):
outputs2, _ = tf.nn.rnn(cell_d, inputs, dtype=tf.float32)
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
output_values = sess.run(
outputs0 + outputs1 + outputs2, feed_dict={inputs[0]: input_value})
outputs0_values = output_values[:max_length]
outputs1_values = output_values[max_length:2*max_length]
outputs2_values = output_values[2*max_length:]
self.assertEqual(len(outputs0_values), len(outputs1_values))
self.assertEqual(len(outputs0_values), len(outputs2_values))
for o1, o2, o3 in zip(outputs0_values, outputs1_values, outputs2_values):
# Same weights used by both RNNs so outputs should be the same.
self.assertAllEqual(o1, o2)
# Different weights used so outputs should be different.
self.assertTrue(np.linalg.norm(o1-o3) > 1e-6)
def testSharingWeightsWithDifferentNamescope(self):
num_units = 3
input_size = 5
batch_size = 2
num_proj = 4
max_length = 8
with self.test_session(graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-1, 1, seed=self._seed)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(None, input_size))]
cell = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=True,
num_proj=num_proj, initializer=initializer,
state_is_tuple=False)
with tf.name_scope("scope0"):
with tf.variable_scope("share_scope"):
outputs0, _ = tf.nn.rnn(cell, inputs, dtype=tf.float32)
with tf.name_scope("scope1"):
with tf.variable_scope("share_scope", reuse=True):
outputs1, _ = tf.nn.rnn(cell, inputs, dtype=tf.float32)
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
output_values = sess.run(
outputs0 + outputs1, feed_dict={inputs[0]: input_value})
outputs0_values = output_values[:max_length]
outputs1_values = output_values[max_length:]
self.assertEqual(len(outputs0_values), len(outputs1_values))
for out0, out1 in zip(outputs0_values, outputs1_values):
self.assertAllEqual(out0, out1)
def testDynamicRNNWithTupleStates(self):
num_units = 3
input_size = 5
batch_size = 2
num_proj = 4
max_length = 8
sequence_length = [4, 6]
with self.test_session(graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(None, input_size))]
inputs_c = tf.pack(inputs)
cell = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=True,
num_proj=num_proj, initializer=initializer, state_is_tuple=True)
outputs_static, state_static = tf.nn.rnn(
cell, inputs, dtype=tf.float32,
sequence_length=sequence_length)
tf.get_variable_scope().reuse_variables()
outputs_dynamic, state_dynamic = tf.nn.dynamic_rnn(
cell, inputs_c, dtype=tf.float32, time_major=True,
sequence_length=sequence_length)
self.assertTrue(isinstance(state_static, tf.nn.rnn_cell.LSTMStateTuple))
self.assertTrue(isinstance(state_dynamic, tf.nn.rnn_cell.LSTMStateTuple))
self.assertEqual(state_static[0], state_static.c)
self.assertEqual(state_static[1], state_static.h)
self.assertEqual(state_dynamic[0], state_dynamic.c)
self.assertEqual(state_dynamic[1], state_dynamic.h)
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
outputs_static_v = sess.run(
outputs_static, feed_dict={inputs[0]: input_value})
outputs_dynamic_v = sess.run(
outputs_dynamic, feed_dict={inputs[0]: input_value})
self.assertAllEqual(outputs_static_v, outputs_dynamic_v)
state_static_v = sess.run(
state_static, feed_dict={inputs[0]: input_value})
state_dynamic_v = sess.run(
state_dynamic, feed_dict={inputs[0]: input_value})
self.assertAllEqual(
np.hstack(state_static_v), np.hstack(state_dynamic_v))
def testDynamicRNNWithNestedTupleStates(self):
num_units = 3
input_size = 5
batch_size = 2
num_proj = 4
max_length = 8
sequence_length = [4, 6]
with self.test_session(graph=tf.Graph()) as sess:
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(None, input_size))]
inputs_c = tf.pack(inputs)
def _cell(i):
return tf.nn.rnn_cell.LSTMCell(
num_units + i, use_peepholes=True,
num_proj=num_proj + i, initializer=initializer, state_is_tuple=True)
# This creates a state tuple which has 4 sub-tuples of length 2 each.
cell = tf.nn.rnn_cell.MultiRNNCell(
[_cell(i) for i in range(4)], state_is_tuple=True)
self.assertEqual(len(cell.state_size), 4)
for i in range(4):
self.assertEqual(len(cell.state_size[i]), 2)
test_zero = cell.zero_state(1, tf.float32)
self.assertEqual(len(test_zero), 4)
for i in range(4):
self.assertEqual(test_zero[i][0].get_shape()[1], cell.state_size[i][0])
self.assertEqual(test_zero[i][1].get_shape()[1], cell.state_size[i][1])
outputs_static, state_static = tf.nn.rnn(
cell, inputs, dtype=tf.float32,
sequence_length=sequence_length)
tf.get_variable_scope().reuse_variables()
outputs_dynamic, state_dynamic = tf.nn.dynamic_rnn(
cell, inputs_c, dtype=tf.float32, time_major=True,
sequence_length=sequence_length)
tf.initialize_all_variables().run()
input_value = np.random.randn(batch_size, input_size)
outputs_static_v = sess.run(
outputs_static, feed_dict={inputs[0]: input_value})
outputs_dynamic_v = sess.run(
outputs_dynamic, feed_dict={inputs[0]: input_value})
self.assertAllEqual(outputs_static_v, outputs_dynamic_v)
state_static_v = sess.run(
nest.flatten(state_static), feed_dict={inputs[0]: input_value})
state_dynamic_v = sess.run(
nest.flatten(state_dynamic), feed_dict={inputs[0]: input_value})
self.assertAllEqual(
np.hstack(state_static_v), np.hstack(state_dynamic_v))
def _testDynamicEquivalentToStaticRNN(self, use_gpu, use_sequence_length):
time_steps = 8
num_units = 3
num_proj = 4
input_size = 5
batch_size = 2
input_values = np.random.randn(time_steps, batch_size, input_size)
if use_sequence_length:
sequence_length = np.random.randint(0, time_steps, size=batch_size)
else:
sequence_length = None
########### Step 1: Run static graph and generate readouts
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
concat_inputs = tf.placeholder(tf.float32,
shape=(time_steps, batch_size, input_size))
inputs = tf.unpack(concat_inputs)
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
cell = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=True,
initializer=initializer, num_proj=num_proj, state_is_tuple=False)
with tf.variable_scope("dynamic_scope"):
outputs_static, state_static = tf.nn.rnn(
cell, inputs, sequence_length=sequence_length, dtype=tf.float32)
feeds = {concat_inputs: input_values}
# Initialize
tf.initialize_all_variables().run(feed_dict=feeds)
# Generate gradients of sum of outputs w.r.t. inputs
static_gradients = tf.gradients(
outputs_static + [state_static], [concat_inputs])
# Generate gradients of individual outputs w.r.t. inputs
static_individual_gradients = nest.flatten([
tf.gradients(y, [concat_inputs])
for y in [outputs_static[0],
outputs_static[-1],
state_static]])
# Generate gradients of individual variables w.r.t. inputs
trainable_variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
assert len(trainable_variables) > 1, (
"Count of trainable variables: %d" % len(trainable_variables))
# pylint: disable=bad-builtin
static_individual_variable_gradients = nest.flatten([
tf.gradients(y, trainable_variables)
for y in [outputs_static[0],
outputs_static[-1],
state_static]])
# Test forward pass
values_static = sess.run(outputs_static, feed_dict=feeds)
(state_value_static,) = sess.run((state_static,), feed_dict=feeds)
# Test gradients to inputs and variables w.r.t. outputs & final state
static_grad_values = sess.run(static_gradients, feed_dict=feeds)
static_individual_grad_values = sess.run(
static_individual_gradients, feed_dict=feeds)
static_individual_var_grad_values = sess.run(
static_individual_variable_gradients, feed_dict=feeds)
########## Step 2: Run dynamic graph and generate readouts
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
concat_inputs = tf.placeholder(tf.float32,
shape=(time_steps, batch_size, input_size))
inputs = tf.unpack(concat_inputs)
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
cell = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=True,
initializer=initializer, num_proj=num_proj, state_is_tuple=False)
with tf.variable_scope("dynamic_scope"):
outputs_dynamic, state_dynamic = tf.nn.dynamic_rnn(
cell, inputs=concat_inputs, sequence_length=sequence_length,
time_major=True, dtype=tf.float32)
split_outputs_dynamic = tf.unpack(outputs_dynamic, time_steps)
feeds = {concat_inputs: input_values}
# Initialize
tf.initialize_all_variables().run(feed_dict=feeds)
# Generate gradients of sum of outputs w.r.t. inputs
dynamic_gradients = tf.gradients(
split_outputs_dynamic + [state_dynamic], [concat_inputs])
# Generate gradients of several individual outputs w.r.t. inputs
dynamic_individual_gradients = nest.flatten([
tf.gradients(y, [concat_inputs])
for y in [split_outputs_dynamic[0],
split_outputs_dynamic[-1],
state_dynamic]])
# Generate gradients of individual variables w.r.t. inputs
trainable_variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
assert len(trainable_variables) > 1, (
"Count of trainable variables: %d" % len(trainable_variables))
dynamic_individual_variable_gradients = nest.flatten([
tf.gradients(y, trainable_variables)
for y in [split_outputs_dynamic[0],
split_outputs_dynamic[-1],
state_dynamic]])
# Test forward pass
values_dynamic = sess.run(split_outputs_dynamic, feed_dict=feeds)
(state_value_dynamic,) = sess.run(
(state_dynamic,), feed_dict=feeds)
# Test gradients to inputs and variables w.r.t. outputs & final state
dynamic_grad_values = sess.run(dynamic_gradients, feed_dict=feeds)
dynamic_individual_grad_values = sess.run(
dynamic_individual_gradients, feed_dict=feeds)
dynamic_individual_var_grad_values = sess.run(
dynamic_individual_variable_gradients, feed_dict=feeds)
######### Step 3: Comparisons
self.assertEqual(len(values_static), len(values_dynamic))
for (value_static, value_dynamic) in zip(values_static, values_dynamic):
self.assertAllEqual(value_static, value_dynamic)
self.assertAllEqual(state_value_static, state_value_dynamic)
self.assertAllEqual(static_grad_values, dynamic_grad_values)
self.assertEqual(len(static_individual_grad_values),
len(dynamic_individual_grad_values))
self.assertEqual(len(static_individual_var_grad_values),
len(dynamic_individual_var_grad_values))
for i, (a, b) in enumerate(zip(static_individual_grad_values,
dynamic_individual_grad_values)):
tf.logging.info("Comparing individual gradients iteration %d" % i)
self.assertAllEqual(a, b)
for i, (a, b) in enumerate(zip(static_individual_var_grad_values,
dynamic_individual_var_grad_values)):
tf.logging.info(
"Comparing individual variable gradients iteration %d" % i)
self.assertAllEqual(a, b)
def testNoProjNoShardingSimpleStateSaver(self):
self._testNoProjNoShardingSimpleStateSaver(use_gpu=False)
self._testNoProjNoShardingSimpleStateSaver(use_gpu=True)
def testNoProjNoSharding(self):
self._testNoProjNoSharding(use_gpu=False)
self._testNoProjNoSharding(use_gpu=True)
def testCellClipping(self):
self._testCellClipping(use_gpu=False)
self._testCellClipping(use_gpu=True)
def testProjNoSharding(self):
self._testProjNoSharding(use_gpu=False)
self._testProjNoSharding(use_gpu=True)
def testProjSharding(self):
self._testProjSharding(use_gpu=False)
self._testProjSharding(use_gpu=True)
def testTooManyShards(self):
self._testTooManyShards(use_gpu=False)
self._testTooManyShards(use_gpu=True)
def testShardNoShardEquivalentOutput(self):
self._testShardNoShardEquivalentOutput(use_gpu=False)
self._testShardNoShardEquivalentOutput(use_gpu=True)
def testDoubleInput(self):
self._testDoubleInput(use_gpu=False)
self._testDoubleInput(use_gpu=True)
def testDoubleInputWithDropoutAndDynamicCalculation(self):
self._testDoubleInputWithDropoutAndDynamicCalculation(use_gpu=False)
self._testDoubleInputWithDropoutAndDynamicCalculation(use_gpu=True)
def testDynamicEquivalentToStaticRNN(self):
self._testDynamicEquivalentToStaticRNN(
use_gpu=False, use_sequence_length=False)
self._testDynamicEquivalentToStaticRNN(
use_gpu=True, use_sequence_length=False)
self._testDynamicEquivalentToStaticRNN(
use_gpu=False, use_sequence_length=True)
self._testDynamicEquivalentToStaticRNN(
use_gpu=True, use_sequence_length=True)
class BidirectionalRNNTest(tf.test.TestCase):
def setUp(self):
self._seed = 23489
np.random.seed(self._seed)
def _createBidirectionalRNN(self,
use_gpu,
use_shape,
use_sequence_length,
scope=None):
num_units = 3
input_size = 5
batch_size = 2
max_length = 8
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
sequence_length = tf.placeholder(tf.int64) if use_sequence_length else None
cell_fw = tf.nn.rnn_cell.LSTMCell(num_units,
input_size,
initializer=initializer,
state_is_tuple=False)
cell_bw = tf.nn.rnn_cell.LSTMCell(num_units,
input_size,
initializer=initializer,
state_is_tuple=False)
inputs = max_length * [
tf.placeholder(
tf.float32,
shape=(batch_size, input_size) if use_shape else (None, input_size))
]
outputs, state_fw, state_bw = tf.nn.bidirectional_rnn(
cell_fw,
cell_bw,
inputs,
dtype=tf.float32,
sequence_length=sequence_length,
scope=scope)
self.assertEqual(len(outputs), len(inputs))
for out in outputs:
self.assertEqual(
out.get_shape().as_list(),
[batch_size if use_shape else None, 2 * num_units])
input_value = np.random.randn(batch_size, input_size)
outputs = tf.pack(outputs)
return input_value, inputs, outputs, state_fw, state_bw, sequence_length
def _testBidirectionalRNN(self, use_gpu, use_shape):
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
input_value, inputs, outputs, state_fw, state_bw, sequence_length = (
self._createBidirectionalRNN(use_gpu, use_shape, True))
tf.initialize_all_variables().run()
# Run with pre-specified sequence length of 2, 3
out, s_fw, s_bw = sess.run([outputs, state_fw, state_bw],
feed_dict={inputs[0]: input_value,
sequence_length: [2, 3]})
# Since the forward and backward LSTM cells were initialized with the
# same parameters, the forward and backward output has to be the same,
# but reversed in time. The format is output[time][batch][depth], and
# due to depth concatenation (as num_units=3 for both RNNs):
# - forward output: out[][][depth] for 0 <= depth < 3
# - backward output: out[][][depth] for 4 <= depth < 6
#
# First sequence in batch is length=2
# Check that the time=0 forward output is equal to time=1 backward output
self.assertEqual(out[0][0][0], out[1][0][3])
self.assertEqual(out[0][0][1], out[1][0][4])
self.assertEqual(out[0][0][2], out[1][0][5])
# Check that the time=1 forward output is equal to time=0 backward output
self.assertEqual(out[1][0][0], out[0][0][3])
self.assertEqual(out[1][0][1], out[0][0][4])
self.assertEqual(out[1][0][2], out[0][0][5])
# Second sequence in batch is length=3
# Check that the time=0 forward output is equal to time=2 backward output
self.assertEqual(out[0][1][0], out[2][1][3])
self.assertEqual(out[0][1][1], out[2][1][4])
self.assertEqual(out[0][1][2], out[2][1][5])
# Check that the time=1 forward output is equal to time=1 backward output
self.assertEqual(out[1][1][0], out[1][1][3])
self.assertEqual(out[1][1][1], out[1][1][4])
self.assertEqual(out[1][1][2], out[1][1][5])
# Check that the time=2 forward output is equal to time=0 backward output
self.assertEqual(out[2][1][0], out[0][1][3])
self.assertEqual(out[2][1][1], out[0][1][4])
self.assertEqual(out[2][1][2], out[0][1][5])
# Via the reasoning above, the forward and backward final state should be
# exactly the same
self.assertAllClose(s_fw, s_bw)
def _testBidirectionalRNNWithoutSequenceLength(self, use_gpu, use_shape):
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
input_value, inputs, outputs, state_fw, state_bw, _ = (
self._createBidirectionalRNN(use_gpu, use_shape, False))
tf.initialize_all_variables().run()
out, s_fw, s_bw = sess.run([outputs, state_fw, state_bw],
feed_dict={inputs[0]: input_value})
# Since the forward and backward LSTM cells were initialized with the
# same parameters, the forward and backward output has to be the same,
# but reversed in time. The format is output[time][batch][depth], and
# due to depth concatenation (as num_units=3 for both RNNs):
# - forward output: out[][][depth] for 0 <= depth < 3
# - backward output: out[][][depth] for 4 <= depth < 6
#
# Both sequences in batch are length=8. Check that the time=i
# forward output is equal to time=8-1-i backward output
for i in xrange(8):
self.assertEqual(out[i][0][0], out[8 - 1 - i][0][3])
self.assertEqual(out[i][0][1], out[8 - 1 - i][0][4])
self.assertEqual(out[i][0][2], out[8 - 1 - i][0][5])
for i in xrange(8):
self.assertEqual(out[i][1][0], out[8 - 1 - i][1][3])
self.assertEqual(out[i][1][1], out[8 - 1 - i][1][4])
self.assertEqual(out[i][1][2], out[8 - 1 - i][1][5])
# Via the reasoning above, the forward and backward final state should be
# exactly the same
self.assertAllClose(s_fw, s_bw)
def testBidirectionalRNN(self):
self._testBidirectionalRNN(use_gpu=False, use_shape=False)
self._testBidirectionalRNN(use_gpu=True, use_shape=False)
self._testBidirectionalRNN(use_gpu=False, use_shape=True)
self._testBidirectionalRNN(use_gpu=True, use_shape=True)
def testBidirectionalRNNWithoutSequenceLength(self):
self._testBidirectionalRNNWithoutSequenceLength(use_gpu=False,
use_shape=False)
self._testBidirectionalRNNWithoutSequenceLength(use_gpu=True,
use_shape=False)
self._testBidirectionalRNNWithoutSequenceLength(use_gpu=False,
use_shape=True)
self._testBidirectionalRNNWithoutSequenceLength(use_gpu=True,
use_shape=True)
def _createBidirectionalDynamicRNN(self, use_gpu, use_shape,
use_state_tuple, use_time_major,
scope=None):
num_units = 3
input_size = 5
batch_size = 2
max_length = 8
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
sequence_length = tf.placeholder(tf.int64)
cell_fw = tf.nn.rnn_cell.LSTMCell(num_units,
initializer=initializer,
state_is_tuple=use_state_tuple)
cell_bw = tf.nn.rnn_cell.LSTMCell(num_units,
initializer=initializer,
state_is_tuple=use_state_tuple)
inputs = max_length * [
tf.placeholder(tf.float32,
shape=(batch_size if use_shape else None, input_size))]
inputs_c = tf.pack(inputs)
if not use_time_major:
inputs_c = tf.transpose(inputs_c, [1, 0, 2])
outputs, states = tf.nn.bidirectional_dynamic_rnn(
cell_fw,
cell_bw,
inputs_c,
sequence_length,
dtype=tf.float32,
time_major=use_time_major,
scope=scope)
outputs = tf.concat(2, outputs)
state_fw, state_bw = states
outputs_shape = [None, max_length, 2 * num_units]
if use_shape:
outputs_shape[0] = batch_size
if use_time_major:
outputs_shape[0], outputs_shape[1] = outputs_shape[1], outputs_shape[0]
self.assertEqual(
outputs.get_shape().as_list(),
outputs_shape)
input_value = np.random.randn(batch_size, input_size)
return input_value, inputs, outputs, state_fw, state_bw, sequence_length
def _testBidirectionalDynamicRNN(self, use_gpu, use_shape,
use_state_tuple, use_time_major):
with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
input_value, inputs, outputs, state_fw, state_bw, sequence_length = (
self._createBidirectionalDynamicRNN(
use_gpu, use_shape, use_state_tuple, use_time_major))
tf.initialize_all_variables().run()
# Run with pre-specified sequence length of 2, 3
if use_state_tuple:
out, c_fw, m_fw, c_bw, m_bw = sess.run(
[outputs, state_fw[0], state_fw[1], state_bw[0], state_bw[1]],
feed_dict={inputs[0]: input_value,
sequence_length: [2, 3]})
s_fw = (c_fw, m_fw)
s_bw = (c_bw, m_bw)
else:
out, s_fw, s_bw = sess.run([outputs, state_fw, state_bw],
feed_dict={inputs[0]: input_value,
sequence_length: [2, 3]})
# Since the forward and backward LSTM cells were initialized with the
# same parameters, the forward and backward output has to be the same,
# but reversed in time. The format is output[time][batch][depth], and
# due to depth concatenation (as num_units=3 for both RNNs):
# - forward output: out[][][depth] for 0 <= depth < 3
# - backward output: out[][][depth] for 4 <= depth < 6
#
# First sequence in batch is length=2
# Check that the time=0 forward output is equal to time=1 backward output
if not use_time_major:
out = np.swapaxes(out, 0, 1)
self.assertEqual(out[0][0][0], out[1][0][3])
self.assertEqual(out[0][0][1], out[1][0][4])
self.assertEqual(out[0][0][2], out[1][0][5])
# Check that the time=1 forward output is equal to time=0 backward output
self.assertEqual(out[1][0][0], out[0][0][3])
self.assertEqual(out[1][0][1], out[0][0][4])
self.assertEqual(out[1][0][2], out[0][0][5])
# Second sequence in batch is length=3
# Check that the time=0 forward output is equal to time=2 backward output
self.assertEqual(out[0][1][0], out[2][1][3])
self.assertEqual(out[0][1][1], out[2][1][4])
self.assertEqual(out[0][1][2], out[2][1][5])
# Check that the time=1 forward output is equal to time=1 backward output
self.assertEqual(out[1][1][0], out[1][1][3])
self.assertEqual(out[1][1][1], out[1][1][4])
self.assertEqual(out[1][1][2], out[1][1][5])
# Check that the time=2 forward output is equal to time=0 backward output
self.assertEqual(out[2][1][0], out[0][1][3])
self.assertEqual(out[2][1][1], out[0][1][4])
self.assertEqual(out[2][1][2], out[0][1][5])
# Via the reasoning above, the forward and backward final state should be
# exactly the same
self.assertAllClose(s_fw, s_bw)
def testBidirectionalDynamicRNN(self):
# Generate 2^4 option values
# from [True, True, True, True] to [False, False, False, False]
options = itertools.product([True, False], repeat=4)
for option in options:
self._testBidirectionalDynamicRNN(use_gpu=option[0], use_shape=option[1],
use_state_tuple=option[2],
use_time_major=option[3])
def _testScope(self, factory, prefix="prefix", use_outer_scope=True):
# REMARKS: factory(scope) is a function accepting a scope
# as an argument, such scope can be None, a string
# or a VariableScope instance.
with self.test_session(use_gpu=True, graph=tf.Graph()):
if use_outer_scope:
with tf.variable_scope(prefix) as scope:
factory(scope)
else:
factory(prefix)
# check that all the variables names starts
# with the proper scope.
tf.initialize_all_variables()
all_vars = tf.all_variables()
prefix = prefix or "BiRNN"
scope_vars = [v for v in all_vars if v.name.startswith(prefix + "/")]
tf.logging.info("BiRNN with scope: %s (%s)"
% (prefix, "scope" if use_outer_scope else "str"))
for v in scope_vars:
tf.logging.info(v.name)
self.assertEqual(len(scope_vars), len(all_vars))
def testBidirectionalRNNScope(self):
def factory(scope):
return self._createBidirectionalRNN(
use_gpu=True, use_shape=True,
use_sequence_length=True, scope=scope)
self._testScope(factory, use_outer_scope=True)
self._testScope(factory, use_outer_scope=False)
self._testScope(factory, prefix=None, use_outer_scope=False)
def testBidirectionalDynamicRNNScope(self):
def get_factory(use_time_major):
def factory(scope):
return self._createBidirectionalDynamicRNN(
use_gpu=True, use_shape=True, use_state_tuple=True,
use_time_major=use_time_major, scope=scope)
return factory
self._testScope(get_factory(True), use_outer_scope=True)
self._testScope(get_factory(True), use_outer_scope=False)
self._testScope(get_factory(True), prefix=None, use_outer_scope=False)
self._testScope(get_factory(False), use_outer_scope=True)
self._testScope(get_factory(False), use_outer_scope=False)
self._testScope(get_factory(False), prefix=None, use_outer_scope=False)
class MultiDimensionalLSTMTest(tf.test.TestCase):
def setUp(self):
self._seed = 23489
np.random.seed(self._seed)
def testMultiDimensionalLSTMAllRNNContainers(self):
feature_dims = (3, 4, 5)
input_size = feature_dims
batch_size = 2
max_length = 8
sequence_length = [4, 6]
with self.test_session(graph=tf.Graph()) as sess:
inputs = max_length * [
tf.placeholder(tf.float32, shape=(None,) + input_size)]
inputs_using_dim = max_length * [
tf.placeholder(tf.float32, shape=(batch_size,) + input_size)]
inputs_c = tf.pack(inputs)
# Create a cell for the whole test. This is fine because the cell has no
# variables.
cell = DummyMultiDimensionalLSTM(feature_dims)
state_saver = TestStateSaver(batch_size, input_size)
outputs_static, state_static = tf.nn.rnn(
cell, inputs, dtype=tf.float32,
sequence_length=sequence_length)
outputs_dynamic, state_dynamic = tf.nn.dynamic_rnn(
cell, inputs_c, dtype=tf.float32, time_major=True,
sequence_length=sequence_length)
outputs_bid, state_bid_fw, state_bid_bw = tf.nn.bidirectional_rnn(
cell, cell, inputs_using_dim, dtype=tf.float32,
sequence_length=sequence_length)
outputs_sav, state_sav = tf.nn.state_saving_rnn(
cell, inputs_using_dim, sequence_length=sequence_length,
state_saver=state_saver, state_name=("h", "c"))
for out, inp in zip(outputs_static, inputs):
self.assertEqual(out.get_shape().as_list(), inp.get_shape().as_list())
self.assertEqual(outputs_dynamic.get_shape().as_list(),
inputs_c.get_shape().as_list())
for out, inp in zip(outputs_bid, inputs_using_dim):
input_shape_list = inp.get_shape().as_list()
# fwd and bwd activations are concatenated along the second dim.
input_shape_list[1] *= 2
self.assertEqual(out.get_shape().as_list(), input_shape_list)
tf.initialize_all_variables().run()
input_total_size = (batch_size,) + input_size
input_value = np.random.randn(*input_total_size)
outputs_static_v = sess.run(
outputs_static, feed_dict={inputs[0]: input_value})
outputs_dynamic_v = sess.run(
outputs_dynamic, feed_dict={inputs[0]: input_value})
outputs_bid_v = sess.run(
outputs_bid, feed_dict={inputs_using_dim[0]: input_value})
outputs_sav_v = sess.run(
outputs_sav, feed_dict={inputs_using_dim[0]: input_value})
self.assertAllEqual(outputs_static_v, outputs_dynamic_v)
self.assertAllEqual(outputs_static_v, outputs_sav_v)
outputs_static_array = np.array(outputs_static_v)
outputs_static_array_double = np.concatenate(
(outputs_static_array, outputs_static_array), axis=2)
outputs_bid_array = np.array(outputs_bid_v)
self.assertAllEqual(outputs_static_array_double, outputs_bid_array)
state_static_v = sess.run(
state_static, feed_dict={inputs[0]: input_value})
state_dynamic_v = sess.run(
state_dynamic, feed_dict={inputs[0]: input_value})
state_bid_fw_v = sess.run(
state_bid_fw, feed_dict={inputs_using_dim[0]: input_value})
state_bid_bw_v = sess.run(
state_bid_bw, feed_dict={inputs_using_dim[0]: input_value})
state_sav_v = sess.run(
state_sav, feed_dict={inputs_using_dim[0]: input_value})
self.assertAllEqual(
np.hstack(state_static_v), np.hstack(state_dynamic_v))
self.assertAllEqual(
np.hstack(state_static_v), np.hstack(state_sav_v))
self.assertAllEqual(
np.hstack(state_static_v), np.hstack(state_bid_fw_v))
self.assertAllEqual(
np.hstack(state_static_v), np.hstack(state_bid_bw_v))
class NestedLSTMTest(tf.test.TestCase):
def setUp(self):
self._seed = 23489
np.random.seed(self._seed)
def testNestedIOLSTMAllRNNContainers(self):
input_size = 5
batch_size = 2
state_size = 6
max_length = 8
sequence_length = [4, 6]
with self.test_session(graph=tf.Graph()) as sess:
state_saver = TestStateSaver(batch_size, state_size)
single_input = (tf.placeholder(tf.float32, shape=(None, input_size)),
tf.placeholder(tf.float32, shape=(None, input_size)))
inputs = max_length * [single_input]
inputs_c = (tf.pack([input_[0] for input_ in inputs]),
tf.pack([input_[1] for input_ in inputs]))
single_input_using_dim = (
tf.placeholder(tf.float32, shape=(batch_size, input_size)),
tf.placeholder(tf.float32, shape=(batch_size, input_size)))
inputs_using_dim = max_length * [single_input_using_dim]
# Create a cell for the whole test. This is fine because the cell has no
# variables.
cell = NestedRNNCell()
outputs_dynamic, state_dynamic = tf.nn.dynamic_rnn(
cell, inputs_c, dtype=tf.float32, time_major=True,
sequence_length=sequence_length)
outputs_static, state_static = tf.nn.rnn(
cell, inputs, dtype=tf.float32,
sequence_length=sequence_length)
outputs_bid, state_bid_fw, state_bid_bw = tf.nn.bidirectional_rnn(
cell, cell, inputs_using_dim, dtype=tf.float32,
sequence_length=sequence_length)
outputs_sav, state_sav = tf.nn.state_saving_rnn(
cell, inputs_using_dim, sequence_length=sequence_length,
state_saver=state_saver, state_name=("h", "c"))
def _assert_same_shape(input1, input2, double=False):
flat_input1 = nest.flatten(input1)
flat_input2 = nest.flatten(input2)
for inp1, inp2 in zip(flat_input1, flat_input2):
input_shape = inp1.get_shape().as_list()
if double:
input_shape[1] *= 2
self.assertEqual(input_shape, inp2.get_shape().as_list())
_assert_same_shape(inputs_c, outputs_dynamic)
_assert_same_shape(inputs, outputs_static)
_assert_same_shape(inputs_using_dim, outputs_sav)
_assert_same_shape(inputs_using_dim, outputs_bid, double=True)
tf.initialize_all_variables().run()
input_total_size = (batch_size, input_size)
input_value = (np.random.randn(*input_total_size),
np.random.randn(*input_total_size))
outputs_dynamic_v = sess.run(
outputs_dynamic, feed_dict={single_input: input_value})
outputs_static_v = sess.run(
outputs_static, feed_dict={single_input: input_value})
outputs_sav_v = sess.run(
outputs_sav, feed_dict={single_input_using_dim: input_value})
outputs_bid_v = sess.run(
outputs_bid, feed_dict={single_input_using_dim: input_value})
self.assertAllEqual(outputs_static_v,
np.transpose(outputs_dynamic_v, (1, 0, 2, 3)))
self.assertAllEqual(outputs_static_v, outputs_sav_v)
outputs_static_array = np.array(outputs_static_v)
outputs_static_array_double = np.concatenate(
(outputs_static_array, outputs_static_array), axis=3)
outputs_bid_array = np.array(outputs_bid_v)
self.assertAllEqual(outputs_static_array_double, outputs_bid_array)
state_dynamic_v = sess.run(
state_dynamic, feed_dict={single_input: input_value})
state_static_v = sess.run(
state_static, feed_dict={single_input: input_value})
state_bid_fw_v = sess.run(
state_bid_fw, feed_dict={single_input_using_dim: input_value})
state_bid_bw_v = sess.run(
state_bid_bw, feed_dict={single_input_using_dim: input_value})
state_sav_v = sess.run(
state_sav, feed_dict={single_input_using_dim: input_value})
self.assertAllEqual(
np.hstack(state_static_v), np.hstack(state_dynamic_v))
self.assertAllEqual(
np.hstack(state_static_v), np.hstack(state_sav_v))
self.assertAllEqual(
np.hstack(state_static_v), np.hstack(state_bid_fw_v))
self.assertAllEqual(
np.hstack(state_static_v), np.hstack(state_bid_bw_v))
class RawRNNTest(tf.test.TestCase):
def setUp(self):
self._seed = 23489
np.random.seed(self._seed)
def _testRawRNN(self, max_time):
with self.test_session(graph=tf.Graph()) as sess:
batch_size = 16
input_depth = 4
num_units = 3
inputs = tf.placeholder(shape=(max_time, batch_size, input_depth),
dtype=tf.float32)
sequence_length = tf.placeholder(shape=(batch_size,), dtype=tf.int32)
inputs_ta = tf.TensorArray(dtype=tf.float32, size=tf.shape(inputs)[0])
inputs_ta = inputs_ta.unpack(inputs)
cell = tf.nn.rnn_cell.LSTMCell(num_units, state_is_tuple=True)
def loop_fn(time_, cell_output, cell_state, unused_loop_state):
emit_output = cell_output # == None for time == 0
if cell_output is None: # time == 0
next_state = cell.zero_state(batch_size, tf.float32)
else:
next_state = cell_state # copy state through
elements_finished = (time_ >= sequence_length)
finished = tf.reduce_all(elements_finished)
# For the very final iteration, we must emit a dummy input
next_input = tf.cond(
finished,
lambda: tf.zeros([batch_size, input_depth], dtype=tf.float32),
lambda: inputs_ta.read(time_))
return (elements_finished, next_input, next_state, emit_output, None)
outputs_ta, final_state, _ = tf.nn.raw_rnn(cell, loop_fn)
outputs = outputs_ta.pack()
tf.get_variable_scope().reuse_variables()
outputs_dynamic_rnn, final_state_dynamic_rnn = tf.nn.dynamic_rnn(
cell, inputs, time_major=True, dtype=tf.float32,
sequence_length=sequence_length)
variables = tf.trainable_variables()
gradients = tf.gradients([outputs, final_state], [inputs] + variables)
gradients_dynamic_rnn = tf.gradients(
[outputs_dynamic_rnn, final_state_dynamic_rnn], [inputs] + variables)
tf.initialize_all_variables().run()
rand_input = np.random.randn(max_time, batch_size, input_depth)
if max_time == 0:
rand_seq_len = np.zeros(batch_size)
else:
rand_seq_len = np.random.randint(max_time, size=batch_size)
# To ensure same output lengths for dynamic_rnn and raw_rnn
rand_seq_len[0] = max_time
(outputs_val, outputs_dynamic_rnn_val,
final_state_val, final_state_dynamic_rnn_val) = sess.run(
[outputs, outputs_dynamic_rnn, final_state, final_state_dynamic_rnn],
feed_dict={inputs: rand_input, sequence_length: rand_seq_len})
self.assertAllClose(outputs_dynamic_rnn_val, outputs_val)
self.assertAllClose(final_state_dynamic_rnn_val, final_state_val)
# NOTE: Because with 0 time steps, raw_rnn does not have shape
# information about the input, it is impossible to perform
# gradients comparisons as the gradients eval will fail. So
# this case skips the gradients test.
if max_time > 0:
self.assertEqual(len(gradients), len(gradients_dynamic_rnn))
gradients_val = sess.run(
gradients,
feed_dict={inputs: rand_input, sequence_length: rand_seq_len})
gradients_dynamic_rnn_val = sess.run(
gradients_dynamic_rnn,
feed_dict={inputs: rand_input, sequence_length: rand_seq_len})
self.assertEqual(len(gradients_val), len(gradients_dynamic_rnn_val))
input_gradients_val = gradients_val[0]
input_gradients_dynamic_rnn_val = gradients_dynamic_rnn_val[0]
self.assertAllClose(
input_gradients_val, input_gradients_dynamic_rnn_val)
for i in range(1, len(gradients_val)):
self.assertAllClose(gradients_dynamic_rnn_val[i], gradients_val[i])
def testRawRNNZeroLength(self):
# NOTE: Because with 0 time steps, raw_rnn does not have shape
# information about the input, it is impossible to perform
# gradients comparisons as the gradients eval will fail. So this
# case skips the gradients test.
self._testRawRNN(max_time=0)
def testRawRNN(self):
self._testRawRNN(max_time=10)
def testLoopState(self):
with self.test_session(graph=tf.Graph()):
max_time = 10
batch_size = 16
input_depth = 4
num_units = 3
inputs = np.random.randn(max_time, batch_size, input_depth)
inputs_ta = tf.TensorArray(dtype=tf.float32, size=tf.shape(inputs)[0])
inputs_ta = inputs_ta.unpack(inputs)
cell = tf.nn.rnn_cell.LSTMCell(num_units, state_is_tuple=True)
def loop_fn(time_, cell_output, cell_state, loop_state):
if cell_output is None:
loop_state = tf.constant([0])
next_state = cell.zero_state(batch_size, tf.float32)
else:
loop_state = tf.pack([tf.squeeze(loop_state) + 1])
next_state = cell_state
emit_output = cell_output # == None for time == 0
elements_finished = tf.tile([time_ >= max_time], [batch_size])
finished = tf.reduce_all(elements_finished)
# For the very final iteration, we must emit a dummy input
next_input = tf.cond(
finished,
lambda: tf.zeros([batch_size, input_depth], dtype=tf.float32),
lambda: inputs_ta.read(time_))
return (elements_finished, next_input,
next_state, emit_output, loop_state)
r = tf.nn.raw_rnn(cell, loop_fn)
loop_state = r[-1]
self.assertEqual([10], loop_state.eval())
def testLoopStateWithTensorArray(self):
with self.test_session(graph=tf.Graph()):
max_time = 4
batch_size = 16
input_depth = 4
num_units = 3
inputs = np.random.randn(max_time, batch_size, input_depth)
inputs_ta = tf.TensorArray(dtype=tf.float32, size=tf.shape(inputs)[0])
inputs_ta = inputs_ta.unpack(inputs)
cell = tf.nn.rnn_cell.LSTMCell(num_units, state_is_tuple=True)
def loop_fn(time_, cell_output, cell_state, loop_state):
if cell_output is None:
loop_state = tf.TensorArray(
dynamic_size=True, size=0, dtype=tf.int32, clear_after_read=False)
loop_state = loop_state.write(0, 1)
next_state = cell.zero_state(batch_size, tf.float32)
else:
loop_state = loop_state.write(
time_, loop_state.read(time_ - 1) + time_)
next_state = cell_state
emit_output = cell_output # == None for time == 0
elements_finished = tf.tile([time_ >= max_time], [batch_size])
finished = tf.reduce_all(elements_finished)
# For the very final iteration, we must emit a dummy input
next_input = tf.cond(
finished,
lambda: tf.zeros([batch_size, input_depth], dtype=tf.float32),
lambda: inputs_ta.read(time_))
return (elements_finished, next_input,
next_state, emit_output, loop_state)
r = tf.nn.raw_rnn(cell, loop_fn)
loop_state = r[-1]
loop_state = loop_state.pack()
self.assertAllEqual([1, 2, 2 + 2, 4 + 3, 7 + 4], loop_state.eval())
def testEmitDifferentStructureThanCellOutput(self):
with self.test_session(graph=tf.Graph()) as sess:
max_time = 10
batch_size = 16
input_depth = 4
num_units = 3
inputs = np.random.randn(max_time, batch_size, input_depth)
inputs_ta = tf.TensorArray(dtype=tf.float32, size=tf.shape(inputs)[0])
inputs_ta = inputs_ta.unpack(inputs)
cell = tf.nn.rnn_cell.LSTMCell(num_units, state_is_tuple=True)
def loop_fn(time_, cell_output, cell_state, _):
if cell_output is None:
emit_output = (tf.zeros([2, 3], dtype=tf.int32),
tf.zeros([1], dtype=tf.int64))
next_state = cell.zero_state(batch_size, tf.float32)
else:
emit_output = (tf.ones([batch_size, 2, 3], dtype=tf.int32),
tf.ones([batch_size, 1], dtype=tf.int64))
next_state = cell_state
elements_finished = tf.tile([time_ >= max_time], [batch_size])
finished = tf.reduce_all(elements_finished)
# For the very final iteration, we must emit a dummy input
next_input = tf.cond(
finished,
lambda: tf.zeros([batch_size, input_depth], dtype=tf.float32),
lambda: inputs_ta.read(time_))
return (elements_finished, next_input, next_state, emit_output, None)
r = tf.nn.raw_rnn(cell, loop_fn)
output_ta = r[0]
self.assertEqual(2, len(output_ta))
self.assertEqual([tf.int32, tf.int64], [ta.dtype for ta in output_ta])
output = [ta.pack() for ta in output_ta]
output_vals = sess.run(output)
self.assertAllEqual(
np.ones((max_time, batch_size, 2, 3), np.int32), output_vals[0])
self.assertAllEqual(
np.ones((max_time, batch_size, 1), np.int64), output_vals[1])
def _testScope(self, factory, prefix="prefix", use_outer_scope=True):
with self.test_session(use_gpu=True, graph=tf.Graph()):
if use_outer_scope:
with tf.variable_scope(prefix) as scope:
factory(scope)
else:
factory(prefix)
tf.initialize_all_variables()
# check that all the variables names starts
# with the proper scope.
all_vars = tf.all_variables()
prefix = prefix or "RNN"
scope_vars = [v for v in all_vars if v.name.startswith(prefix + "/")]
tf.logging.info("RNN with scope: %s (%s)"
% (prefix, "scope" if use_outer_scope else "str"))
for v in scope_vars:
tf.logging.info(v.name)
self.assertEqual(len(scope_vars), len(all_vars))
def testRawRNNScope(self):
max_time = 10
batch_size = 16
input_depth = 4
num_units = 3
def factory(scope):
inputs = tf.placeholder(shape=(max_time, batch_size, input_depth),
dtype=tf.float32)
sequence_length = tf.placeholder(shape=(batch_size,), dtype=tf.int32)
inputs_ta = tf.TensorArray(dtype=tf.float32, size=tf.shape(inputs)[0])
inputs_ta = inputs_ta.unpack(inputs)
cell = tf.nn.rnn_cell.LSTMCell(num_units, state_is_tuple=True)
def loop_fn(time_, cell_output, cell_state, unused_loop_state):
emit_output = cell_output # == None for time == 0
if cell_output is None: # time == 0
next_state = cell.zero_state(batch_size, tf.float32)
else:
next_state = cell_state
elements_finished = (time_ >= sequence_length)
finished = tf.reduce_all(elements_finished)
# For the very final iteration, we must emit a dummy input
next_input = tf.cond(
finished,
lambda: tf.zeros([batch_size, input_depth], dtype=tf.float32),
lambda: inputs_ta.read(time_))
return (elements_finished, next_input, next_state, emit_output, None)
return tf.nn.raw_rnn(cell, loop_fn, scope=scope)
self._testScope(factory, use_outer_scope=True)
self._testScope(factory, use_outer_scope=False)
self._testScope(factory, prefix=None, use_outer_scope=False)
class StateSaverRNNTest(tf.test.TestCase):
def setUp(self):
self._seed = 23489
np.random.seed(self._seed)
def _testScope(self, factory, prefix="prefix", use_outer_scope=True):
with self.test_session(use_gpu=True, graph=tf.Graph()):
if use_outer_scope:
with tf.variable_scope(prefix) as scope:
factory(scope)
else:
factory(prefix)
tf.initialize_all_variables()
# check that all the variables names starts
# with the proper scope.
all_vars = tf.all_variables()
prefix = prefix or "RNN"
scope_vars = [v for v in all_vars if v.name.startswith(prefix + "/")]
tf.logging.info("RNN with scope: %s (%s)"
% (prefix, "scope" if use_outer_scope else "str"))
for v in scope_vars:
tf.logging.info(v.name)
self.assertEqual(len(scope_vars), len(all_vars))
def testStateSaverRNNScope(self):
num_units = 3
input_size = 5
batch_size = 2
max_length = 8
def factory(scope):
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
state_saver = TestStateSaver(batch_size, 2 * num_units)
cell = tf.nn.rnn_cell.LSTMCell(
num_units, use_peepholes=False, initializer=initializer,
state_is_tuple=False)
inputs = max_length * [
tf.placeholder(tf.float32, shape=(batch_size, input_size))]
return tf.nn.state_saving_rnn(
cell, inputs, state_saver=state_saver,
state_name="save_lstm", scope=scope)
self._testScope(factory, use_outer_scope=True)
self._testScope(factory, use_outer_scope=False)
self._testScope(factory, prefix=None, use_outer_scope=False)
######### Benchmarking RNN code
def _static_vs_dynamic_rnn_benchmark_static(inputs_list_t, sequence_length):
(_, input_size) = inputs_list_t[0].get_shape().as_list()
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=127)
cell = tf.nn.rnn_cell.LSTMCell(
num_units=input_size, use_peepholes=True, initializer=initializer,
state_is_tuple=False)
outputs, final_state = tf.nn.rnn(
cell, inputs_list_t, sequence_length=sequence_length, dtype=tf.float32)
trainable_variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
gradients = tf.gradients(outputs + [final_state], trainable_variables)
return tf.group(final_state, *(gradients + outputs))
def _static_vs_dynamic_rnn_benchmark_dynamic(inputs_t, sequence_length):
(unused_0, unused_1, input_size) = inputs_t.get_shape().as_list()
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=127)
cell = tf.nn.rnn_cell.LSTMCell(
num_units=input_size, use_peepholes=True, initializer=initializer,
state_is_tuple=False)
outputs, final_state = tf.nn.dynamic_rnn(
cell, inputs_t, sequence_length=sequence_length, dtype=tf.float32)
trainable_variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
gradients = tf.gradients([outputs, final_state], trainable_variables)
return tf.group(final_state, outputs, *gradients)
def graph_creation_static_vs_dynamic_rnn_benchmark(max_time):
config = tf.ConfigProto()
config.allow_soft_placement = True
# These parameters don't matter
batch_size = 512
num_units = 512
# Set up sequence lengths
np.random.seed([127])
sequence_length = np.random.randint(0, max_time, size=batch_size)
inputs_list = [
np.random.randn(batch_size, num_units).astype(np.float32)
for _ in range(max_time)]
inputs = np.dstack(inputs_list).transpose([0, 2, 1]) # batch x time x depth
def _create_static_rnn():
with tf.Session(config=config, graph=tf.Graph()) as sess:
inputs_list_t = [
tf.Variable(x, trainable=False).value() for x in inputs_list]
ops = _static_vs_dynamic_rnn_benchmark_static(
inputs_list_t, sequence_length)
def _create_dynamic_rnn():
with tf.Session(config=config, graph=tf.Graph()) as sess:
inputs_t = tf.Variable(inputs, trainable=False).value()
ops = _static_vs_dynamic_rnn_benchmark_dynamic(
inputs_t, sequence_length)
delta_static = timeit.timeit(_create_static_rnn, number=5)
delta_dynamic = timeit.timeit(_create_dynamic_rnn, number=5)
print("%d \t %f \t %f \t %f" %
(max_time, delta_static, delta_dynamic, delta_dynamic/delta_static))
return delta_static, delta_dynamic
def _timer(sess, ops):
# Warm in
for _ in range(2):
sess.run(ops)
# Timing run
runs = 20
start = time.time()
for _ in range(runs):
sess.run(ops)
end = time.time()
return (end - start)/float(runs)
def static_vs_dynamic_rnn_benchmark(batch_size, max_time, num_units, use_gpu):
config = tf.ConfigProto()
config.allow_soft_placement = True
# Set up sequence lengths
np.random.seed([127])
sequence_length = np.random.randint(0, max_time, size=batch_size)
inputs_list = [
np.random.randn(batch_size, num_units).astype(np.float32)
for _ in range(max_time)]
inputs = np.dstack(inputs_list).transpose([0, 2, 1]) # batch x time x depth
# Using rnn()
with tf.Session(config=config, graph=tf.Graph()) as sess:
with tf.device("/cpu:0" if not use_gpu else None):
inputs_list_t = [
tf.Variable(x, trainable=False).value() for x in inputs_list]
ops = _static_vs_dynamic_rnn_benchmark_static(
inputs_list_t, sequence_length)
tf.initialize_all_variables().run()
delta_static = _timer(sess, ops)
# Using dynamic_rnn()
with tf.Session(config=config, graph=tf.Graph()) as sess:
with tf.device("/cpu:0" if not use_gpu else None):
inputs_t = tf.Variable(inputs, trainable=False).value()
ops = _static_vs_dynamic_rnn_benchmark_dynamic(
inputs_t, sequence_length)
tf.initialize_all_variables().run()
delta_dynamic = _timer(sess, ops)
print("%d \t %d \t %d \t %s \t %f \t %f \t %f" %
(batch_size, max_time, num_units, use_gpu, delta_static,
delta_dynamic, delta_dynamic/delta_static))
return delta_static, delta_dynamic
def _half_seq_len_vs_unroll_half_rnn_benchmark(inputs_list_t, sequence_length):
(_, input_size) = inputs_list_t[0].get_shape().as_list()
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=127)
cell = tf.nn.rnn_cell.LSTMCell(
num_units=input_size, use_peepholes=True, initializer=initializer,
state_is_tuple=False)
outputs, final_state = tf.nn.rnn(
cell, inputs_list_t, sequence_length=sequence_length, dtype=tf.float32)
trainable_variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
gradients = tf.gradients(outputs + [final_state], trainable_variables)
return tf.group(final_state, *(gradients + outputs))
def half_seq_len_vs_unroll_half_rnn_benchmark(
batch_size, max_time, num_units, use_gpu):
config = tf.ConfigProto()
config.allow_soft_placement = True
# Set up sequence lengths
np.random.seed([127])
sequence_length = max_time * np.ones((batch_size,))
inputs_list = [
np.random.randn(batch_size, num_units).astype(np.float32)
for _ in range(max_time)]
# Halve the sequence length, full static unroll
with tf.Session(config=config, graph=tf.Graph()) as sess:
with tf.device("/cpu:0" if not use_gpu else None):
inputs_list_t = [
tf.Variable(x, trainable=False).value() for x in inputs_list]
ops = _half_seq_len_vs_unroll_half_rnn_benchmark(
inputs_list_t, sequence_length / 2)
tf.initialize_all_variables().run()
delta_half_seq_len = _timer(sess, ops)
# Halve the unroll size, don't use sequence length
with tf.Session(config=config, graph=tf.Graph()) as sess:
with tf.device("/cpu:0" if not use_gpu else None):
inputs_list_t = [
tf.Variable(x, trainable=False).value() for x in inputs_list]
ops = _half_seq_len_vs_unroll_half_rnn_benchmark(
inputs_list_t[:(max_time // 2)], sequence_length / 2)
tf.initialize_all_variables().run()
delta_unroll_half = _timer(sess, ops)
print("%d \t %d \t\t %d \t %s \t %f \t\t %f \t\t %f" %
(batch_size, max_time, num_units, use_gpu, delta_half_seq_len,
delta_unroll_half, delta_half_seq_len/delta_unroll_half))
return delta_half_seq_len, delta_unroll_half
def _concat_state_vs_tuple_state_rnn_benchmark(
inputs_list_t, sequence_length, state_is_tuple):
(_, input_size) = inputs_list_t[0].get_shape().as_list()
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=127)
cell = tf.nn.rnn_cell.LSTMCell(
num_units=input_size, use_peepholes=True,
initializer=initializer, state_is_tuple=state_is_tuple)
outputs, final_state = tf.nn.rnn(
cell, inputs_list_t, sequence_length=sequence_length, dtype=tf.float32)
final_state = list(final_state) if state_is_tuple else [final_state]
trainable_variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
gradients = tf.gradients(outputs + final_state, trainable_variables)
return tf.group(*(final_state + gradients + outputs))
def concat_state_vs_tuple_state_rnn_benchmark(
batch_size, max_time, num_units, use_gpu):
config = tf.ConfigProto()
config.allow_soft_placement = True
# Set up sequence lengths
np.random.seed([127])
sequence_length = max_time * np.ones((batch_size,))
inputs_list = [
np.random.randn(batch_size, num_units).astype(np.float32)
for _ in range(max_time)]
# Run with concatenated states (default)
with tf.Session(config=config, graph=tf.Graph()) as sess:
with tf.device("/cpu:0" if not use_gpu else None):
inputs_list_t = [
tf.Variable(x, trainable=False).value() for x in inputs_list]
ops = _concat_state_vs_tuple_state_rnn_benchmark(
inputs_list_t, sequence_length, state_is_tuple=False)
tf.initialize_all_variables().run()
delta_concat_state = _timer(sess, ops)
# Run with tuple states (new)
with tf.Session(config=config, graph=tf.Graph()) as sess:
with tf.device("/cpu:0" if not use_gpu else None):
inputs_list_t = [
tf.Variable(x, trainable=False).value() for x in inputs_list]
ops = _concat_state_vs_tuple_state_rnn_benchmark(
inputs_list_t, sequence_length, state_is_tuple=True)
tf.initialize_all_variables().run()
delta_tuple_state = _timer(sess, ops)
print("%d \t %d \t %d \t %s \t %f \t\t %f \t\t %f" %
(batch_size, max_time, num_units, use_gpu, delta_concat_state,
delta_tuple_state, delta_concat_state/delta_tuple_state))
return delta_concat_state, delta_tuple_state
def _dynamic_rnn_swap_memory_benchmark(inputs_t, sequence_length,
swap_memory):
(unused_0, unused_1, input_size) = inputs_t.get_shape().as_list()
initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=127)
cell = tf.nn.rnn_cell.LSTMCell(
num_units=input_size, use_peepholes=True, initializer=initializer,
state_is_tuple=False)
outputs, final_state = tf.nn.dynamic_rnn(
cell, inputs_t, sequence_length=sequence_length,
swap_memory=swap_memory, dtype=tf.float32)
trainable_variables = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES)
gradients = tf.gradients([outputs, final_state], trainable_variables)
return tf.group(final_state, outputs, *gradients)
def dynamic_rnn_swap_memory_benchmark(batch_size, max_time, num_units):
config = tf.ConfigProto()
config.allow_soft_placement = True
# Set up sequence lengths
np.random.seed([127])
sequence_length = np.random.randint(0, max_time, size=batch_size)
inputs_list = [
np.random.randn(batch_size, num_units).astype(np.float32)
for _ in range(max_time)]
inputs = np.dstack(inputs_list).transpose([0, 2, 1]) # batch x time x depth
# No memory swap
with tf.Session(config=config, graph=tf.Graph()) as sess:
inputs_t = tf.Variable(inputs, trainable=False).value()
ops = _dynamic_rnn_swap_memory_benchmark(
inputs_t, sequence_length, swap_memory=False)
tf.initialize_all_variables().run()
no_swap = _timer(sess, ops)
# Memory swap
with tf.Session(config=config, graph=tf.Graph()) as sess:
inputs_t = tf.Variable(inputs, trainable=False).value()
ops = _dynamic_rnn_swap_memory_benchmark(
inputs_t, sequence_length, swap_memory=True)
tf.initialize_all_variables().run()
swap = _timer(sess, ops)
print("%d \t %d \t %d \t %f \t %f \t %f" %
(batch_size, max_time, num_units, no_swap, swap, swap/no_swap))
return no_swap, swap
def rnn_long_sequence_benchmark(batch_size, seqlen, num_units,
dynamic, swap_memory):
config = tf.ConfigProto()
config.allow_soft_placement = True
# Set up sequence lengths
np.random.seed([127])
sequence_length = [seqlen for _ in range(batch_size)]
inputs_list = [
np.random.randn(batch_size, num_units).astype(np.float32)
for _ in range(seqlen)]
inputs = np.dstack(inputs_list).transpose([0, 2, 1]) # batch x time x depth
for _ in range(5):
if dynamic:
with tf.Session(config=config, graph=tf.Graph()) as sess:
inputs_t = tf.Variable(inputs, trainable=False).value()
ops = _dynamic_rnn_swap_memory_benchmark(
inputs_t, sequence_length, swap_memory=swap_memory)
tf.initialize_all_variables().run()
elapsed = _timer(sess, ops)
else:
with tf.Session(config=config, graph=tf.Graph()) as sess:
inputs_list_t = [
tf.Variable(x, trainable=False).value() for x in inputs_list]
ops = _static_vs_dynamic_rnn_benchmark_static(
inputs_list_t, sequence_length)
tf.initialize_all_variables().run()
elapsed = _timer(sess, ops)
print("%d \t %d \t %d \t %s \t %f \t %f" %
(batch_size, seqlen, num_units, dynamic, elapsed,
elapsed/seqlen))
class BenchmarkRNN(tf.test.Benchmark):
def benchmarkGraphCreationStaticVsDynamicLSTM(self):
print("Graph Creation: Static Unroll vs. Dynamic Unroll LSTM")
print("max_t \t dt(static) \t dt(dynamic) \t dt(dynamic)/dt(static)")
for max_time in (1, 25, 50):
s_dt, d_dt = graph_creation_static_vs_dynamic_rnn_benchmark(max_time)
self.report_benchmark(name="graph_creation_time_static_T%02d" % max_time,
iters=5, wall_time=s_dt)
self.report_benchmark(name="graph_creation_time_dynamic_T%02d" % max_time,
iters=5, wall_time=d_dt)
def benchmarkStaticUnrollVsDynamicFlowLSTM(self):
print("Calculation: Static Unroll with Dynamic Flow LSTM "
"vs. Dynamic Unroll LSTM")
print("batch \t max_t \t units \t gpu \t dt(static) \t dt(dynamic) "
"\t dt(dynamic)/dt(static)")
for batch_size in (256,):
for max_time in (50,):
for num_units in (512, 256, 128):
for use_gpu in (False, True):
s_dt, d_dt = static_vs_dynamic_rnn_benchmark(
batch_size, max_time, num_units, use_gpu)
self.report_benchmark(
name="static_unroll_time_T%02d_B%03d_N%03d_gpu_%s"
% (max_time, batch_size, num_units, use_gpu),
iters=20, wall_time=s_dt)
self.report_benchmark(
name="dynamic_unroll_time_T%02d_B%03d_N%03d_gpu_%s"
% (max_time, batch_size, num_units, use_gpu),
iters=20, wall_time=d_dt)
def benchmarkDynamicLSTMNoMemorySwapVsMemorySwap(self):
print("Calculation: Dynamic LSTM No Memory Swap vs. Memory Swap")
print("batch \t max_t \t units \t no_swap \t swap \t swap/no_swap")
for batch_size in (256, 512):
for max_time in (100,):
for num_units in (512, 256, 128):
no_swap, swap = dynamic_rnn_swap_memory_benchmark(
batch_size, max_time, num_units)
self.report_benchmark(
name="dynamic_lstm_no_memory_swap_T%02d_B%03d_N%03d"
% (max_time, batch_size, num_units),
iters=20, wall_time=no_swap)
self.report_benchmark(
name="dynamic_lstm_with_memory_swap_T%02d_B%03d_N%03d"
% (max_time, batch_size, num_units),
iters=20, wall_time=swap)
def benchmarkStaticUnrollHalfSequenceLengthVsHalfUnroll(self):
print("Calculation: Static Unroll with Halved Sequence Length "
"vs. Half Static Unroll")
print("batch \t full_t \t units \t gpu \t dt(half_seq_len) "
"\t dt(unroll_half) \t dt(half_seq_len)/dt(unroll_half)")
for batch_size in (128,):
for max_time in (50,):
for num_units in (256,):
for use_gpu in (False, True):
s_dt, d_dt = half_seq_len_vs_unroll_half_rnn_benchmark(
batch_size, max_time, num_units, use_gpu)
self.report_benchmark(
name="half_seq_len_time_T%02d_B%03d_N%03d_gpu_%s"
% (max_time, batch_size, num_units, use_gpu),
iters=20, wall_time=s_dt)
self.report_benchmark(
name="unroll_half_time_T%02d_B%03d_N%03d_gpu_%s"
% (max_time, batch_size, num_units, use_gpu),
iters=20, wall_time=d_dt)
def benchmarkStaticUnrollStateConcatVsStateTuple(self):
print("Calculation: Static Unroll with Concatenated State "
"vs. Tuple State")
print("batch \t time \t units \t gpu \t dt(concat_state) "
"\t dt(tuple_state) \t dt(concat_state)/dt(tuple_state)")
for batch_size in (16, 128,):
for max_time in (50,):
for num_units in (16, 128,):
for use_gpu in (False, True):
c_dt, t_dt = concat_state_vs_tuple_state_rnn_benchmark(
batch_size, max_time, num_units, use_gpu)
self.report_benchmark(
name="concat_state_time_T%02d_B%03d_N%03d_gpu_%s"
% (max_time, batch_size, num_units, use_gpu),
iters=20, wall_time=c_dt)
self.report_benchmark(
name="tuple_state_time_T%02d_B%03d_N%03d_gpu_%s"
% (max_time, batch_size, num_units, use_gpu),
iters=20, wall_time=t_dt)
if __name__ == "__main__":
tf.test.main()
|
neilhan/tensorflow
|
tensorflow/python/kernel_tests/rnn_test.py
|
Python
|
apache-2.0
| 95,137
|
/*
* Copyright 2020 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thoughtworks.go.api.util;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.thoughtworks.go.api.representers.JsonReader;
import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Type;
import java.util.Map;
public class GsonTransformer {
private static final Gson GSON = new GsonBuilder().create();
private GsonTransformer() {
}
public static GsonTransformer getInstance() {
return SingletonHolder.INSTANCE;
}
public JsonReader jsonReaderFrom(String string) {
try {
if (StringUtils.isBlank(string)) {
string = "{}";
}
return new JsonReader(GSON.fromJson(string, JsonElement.class).getAsJsonObject());
} catch (Exception e) {
throw new JsonParseException(e);
}
}
public JsonReader jsonReaderFrom(Map map) {
try {
return new JsonReader(GSON.toJsonTree(map).getAsJsonObject());
} catch (Exception e) {
throw new JsonParseException(e);
}
}
public <T> T fromJson(String string, Class<T> classOfT) {
return GSON.fromJson(string, classOfT);
}
public <T> T fromJson(String string, Type classOfT) {
return GSON.fromJson(string, classOfT);
}
private static class SingletonHolder {
private static final GsonTransformer INSTANCE = new GsonTransformer();
}
}
|
arvindsv/gocd
|
api/api-base/src/main/java/com/thoughtworks/go/api/util/GsonTransformer.java
|
Java
|
apache-2.0
| 2,116
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.