text
stringlengths 2
1.04M
| meta
dict |
---|---|
package core;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import config.GeneratorConfiguration;
import de.uni_hildesheim.sse.model.varModel.Project;
import de.uni_hildesheim.sse.persistency.IVMLWriter;
public class Main {
/*
* Define the path and the file name (including IVML file extension)
* where the generated file shall be stored.
*/
private static String path = "/Users/Phani/Documents/Uni-Work/Reasoning_Stats/DroolsModels/";
private static String fileName = "IVML_gen";
private static String fileExtension = ".ivml";
// Define the name of the IVML project to be generated.
private static String projectName = "Project_gen";
// Define the number of models to be generated (results in the specified number of files)
private static int numberOfModels = 10;
/*
* Define the complexity level (1-3) of the constraints to be generated.
* "1" produces simple constraints for each type of elements, while "3"
* will produce the most complex constraints provided by the generator.
*
* For more information read the Excel-sheet in this Java project.
*/
private static int complexityLevel = 3;
// Define if Boolean variables shall be generated.
private static boolean useBooleanElements = true;
// Define the number of Boolean variables to be generated.
private static final int booleanVariableNum = 400;
/*
* Define the number of logical constraints to be generated.
* Please note, that these logical constraints are exclusive for Boolean
* variables. Complex arithmetic constraints will also be produced
* by relating two or more constraints by logical operators. However, this
* will be done automatically and not on the basis of this switch(the number
* defined the following variable).
*/
private static int booleanConstraintNum = 400;
// Define if integer variables shall be generated.
private static boolean useIntegerElements = true;
// Define the number of integer variables to be generated.
private static int intVariableNum = 300;
// Define the upper bound of the integer variable values (exclusive).
private static int intVarBound = 20;
// Define if real variables shall be generated.
private static boolean useRealElements = true;
// Define the number of real variables to be generated.
private static int realVariableNum = 300;
/*
* Define the multiplicator for real values to be assigned to the generated
* real variables. This is required as the method for random values will
* produce, for example, 0.2356. In order to generate more realistic real
* values, the random values are adjusted in terms of:
* 0.2356 * realValMultiplicator - in this example: 2.356
*/
private static int realValMultiplicator = 10;
/*
* !!IMPORTANT!!
* The number of arithmetic constraints will be used for generating
* constraints among integer and real variables. In case that both
* types of elements are enables for generation it will produce:
* arithmeticConstraintNum * 2
*/
private static int arithmeticConstraintNum = 300;
/**
* The main method of the IVML File Generator.
* It first sets the generator configuration based on the values
* defined above, start the generator, and writes the file based
* on the generated IVML project.
*
* @param args NOT USED!
*/
public static void main (String[] args) {
System.out.print("Setting Generator Configuration...");
setGeneratorConfiguration();
System.out.println(" Finished!");
System.out.print("Start Generator...");
IVMLGenerator iGen = new IVMLGenerator();
for (int i=0; i<numberOfModels; i++) {
Project generatedProject = iGen.generate(projectName);
System.out.println(" Finished! - Model " + i);
System.out.print("Start IVML File Writer...");
String filePathAndName = path + fileName + i + fileExtension;
File file = new File(filePathAndName);
if (file.exists()) {
file.delete();
}
FileWriter fileWriter;
try {
fileWriter = new FileWriter(file);
IVMLWriter iWriter = new IVMLWriter(fileWriter);
generatedProject.accept(iWriter);
fileWriter.flush();
fileWriter.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
System.out.println(" Finished!");
}
/**
* This method sets the generator configuration accordingly to the
* values defined for the variables above.
*/
private static void setGeneratorConfiguration() {
GeneratorConfiguration.INSTANCE.setComplexityLevel(complexityLevel);
GeneratorConfiguration.INSTANCE.setUseBooleanElements(useBooleanElements);
GeneratorConfiguration.INSTANCE.setBoolVarNum(booleanVariableNum);
GeneratorConfiguration.INSTANCE.setLogicalConstraintNum(booleanConstraintNum);
GeneratorConfiguration.INSTANCE.setUseIntElements(useIntegerElements);
GeneratorConfiguration.INSTANCE.setIntVarNum(intVariableNum);
GeneratorConfiguration.INSTANCE.setIntVarBounds(intVarBound);
GeneratorConfiguration.INSTANCE.setUseRealElements(useRealElements);
GeneratorConfiguration.INSTANCE.setRealVarNum(realVariableNum);
GeneratorConfiguration.INSTANCE.setRealValMultiplicator(realValMultiplicator);
// Note: this will set the number of constraints for both integer and real variables!
GeneratorConfiguration.INSTANCE.setArithmeticConstraintNum(arithmeticConstraintNum);
}
}
| {
"content_hash": "3c9ac82aaddb2ebce0fc2677b81a2a25",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 94,
"avg_line_length": 37.31506849315068,
"alnum_prop": 0.7448604992657856,
"repo_name": "SSEHUB/EASyProducer",
"id": "4fb04db83e75414c690dfb3380278d05f37d5c37",
"size": "5448",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Tools/IVMLFileGenerator/src/core/Main.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AspectJ",
"bytes": "1184"
},
{
"name": "Batchfile",
"bytes": "6836"
},
{
"name": "GAP",
"bytes": "2073949"
},
{
"name": "HTML",
"bytes": "112226"
},
{
"name": "Java",
"bytes": "30149700"
},
{
"name": "Shell",
"bytes": "2416"
},
{
"name": "Velocity Template Language",
"bytes": "231811"
},
{
"name": "Xtend",
"bytes": "2141"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Euro+Med Plantbase
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "d128c59aa5e95275a60aa5781008c3a5",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 18,
"avg_line_length": 8.692307692307692,
"alnum_prop": 0.6814159292035398,
"repo_name": "mdoering/backbone",
"id": "00fe736a3d2577886918ccce72d3009c9e1b9707",
"size": "164",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Taraxacum/Taraxacum vastisectum/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
layout : blocks/page-component
component : schedule/track.html
title : CISO
---
| {
"content_hash": "1441237e7c36045a3ec10a3684ef7cb1",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 36,
"avg_line_length": 24,
"alnum_prop": 0.625,
"repo_name": "mkasmani/owasp-devseccon-summit",
"id": "c58401de7cc90b1769c39cb98e777ed6f64d569a",
"size": "100",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "pages/schedule/tracks/CISO.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1554481"
},
{
"name": "CoffeeScript",
"bytes": "35227"
},
{
"name": "HTML",
"bytes": "1129397"
},
{
"name": "JavaScript",
"bytes": "319138"
},
{
"name": "Nginx",
"bytes": "1101"
},
{
"name": "PHP",
"bytes": "198040"
},
{
"name": "Shell",
"bytes": "3457"
}
],
"symlink_target": ""
} |
.class public final Lcom/fasterxml/jackson/databind/type/TypeFactory;
.super Ljava/lang/Object;
.source ""
# interfaces
.implements Ljava/io/Serializable;
# static fields
.field protected static final CORE_TYPE_BOOL:Lcom/fasterxml/jackson/databind/type/SimpleType; = null
.field protected static final CORE_TYPE_INT:Lcom/fasterxml/jackson/databind/type/SimpleType; = null
.field protected static final CORE_TYPE_LONG:Lcom/fasterxml/jackson/databind/type/SimpleType; = null
.field protected static final CORE_TYPE_STRING:Lcom/fasterxml/jackson/databind/type/SimpleType; = null
.field private static final NO_TYPES:[Lcom/fasterxml/jackson/databind/JavaType; = null
.field protected static final instance:Lcom/fasterxml/jackson/databind/type/TypeFactory; = null
.field private static final serialVersionUID:J = 0x1L
# instance fields
.field protected transient _cachedArrayListType:Lcom/fasterxml/jackson/databind/type/HierarchicType;
.field protected transient _cachedHashMapType:Lcom/fasterxml/jackson/databind/type/HierarchicType;
.field protected final _modifiers:[Lcom/fasterxml/jackson/databind/type/TypeModifier;
.field protected final _parser:Lcom/fasterxml/jackson/databind/type/TypeParser;
.field protected final _typeCache:Lcom/fasterxml/jackson/databind/util/LRUMap;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/fasterxml/jackson/databind/util/LRUMap<Lcom/fasterxml/jackson/databind/type/ClassKey;Lcom/fasterxml/jackson/databind/JavaType;>;"
}
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.locals 2
.line 38
const/4 v0, 0x0
new-array v0, v0, [Lcom/fasterxml/jackson/databind/JavaType;
sput-object v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->NO_TYPES:[Lcom/fasterxml/jackson/databind/JavaType;
.line 45
new-instance v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;
invoke-direct {v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;-><init>()V
sput-object v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->instance:Lcom/fasterxml/jackson/databind/type/TypeFactory;
.line 57
new-instance v0, Lcom/fasterxml/jackson/databind/type/SimpleType;
const-class v1, Ljava/lang/String;
invoke-direct {v0, v1}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;)V
sput-object v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->CORE_TYPE_STRING:Lcom/fasterxml/jackson/databind/type/SimpleType;
.line 58
new-instance v0, Lcom/fasterxml/jackson/databind/type/SimpleType;
sget-object v1, Ljava/lang/Boolean;->TYPE:Ljava/lang/Class;
invoke-direct {v0, v1}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;)V
sput-object v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->CORE_TYPE_BOOL:Lcom/fasterxml/jackson/databind/type/SimpleType;
.line 59
new-instance v0, Lcom/fasterxml/jackson/databind/type/SimpleType;
sget-object v1, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
invoke-direct {v0, v1}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;)V
sput-object v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->CORE_TYPE_INT:Lcom/fasterxml/jackson/databind/type/SimpleType;
.line 60
new-instance v0, Lcom/fasterxml/jackson/databind/type/SimpleType;
sget-object v1, Ljava/lang/Long;->TYPE:Ljava/lang/Class;
invoke-direct {v0, v1}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;)V
sput-object v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->CORE_TYPE_LONG:Lcom/fasterxml/jackson/databind/type/SimpleType;
return-void
.end method
.method private constructor <init>()V
.locals 3
.line 107
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 67
new-instance v0, Lcom/fasterxml/jackson/databind/util/LRUMap;
const/16 v1, 0x10
const/16 v2, 0x64
invoke-direct {v0, v1, v2}, Lcom/fasterxml/jackson/databind/util/LRUMap;-><init>(II)V
iput-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_typeCache:Lcom/fasterxml/jackson/databind/util/LRUMap;
.line 108
new-instance v0, Lcom/fasterxml/jackson/databind/type/TypeParser;
invoke-direct {v0, p0}, Lcom/fasterxml/jackson/databind/type/TypeParser;-><init>(Lcom/fasterxml/jackson/databind/type/TypeFactory;)V
iput-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_parser:Lcom/fasterxml/jackson/databind/type/TypeParser;
.line 109
const/4 v0, 0x0
iput-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_modifiers:[Lcom/fasterxml/jackson/databind/type/TypeModifier;
.line 110
return-void
.end method
.method protected constructor <init>(Lcom/fasterxml/jackson/databind/type/TypeParser;[Lcom/fasterxml/jackson/databind/type/TypeModifier;)V
.locals 3
.line 112
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 67
new-instance v0, Lcom/fasterxml/jackson/databind/util/LRUMap;
const/16 v1, 0x10
const/16 v2, 0x64
invoke-direct {v0, v1, v2}, Lcom/fasterxml/jackson/databind/util/LRUMap;-><init>(II)V
iput-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_typeCache:Lcom/fasterxml/jackson/databind/util/LRUMap;
.line 113
iput-object p1, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_parser:Lcom/fasterxml/jackson/databind/type/TypeParser;
.line 114
iput-object p2, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_modifiers:[Lcom/fasterxml/jackson/databind/type/TypeModifier;
.line 115
return-void
.end method
.method private _collectionType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 893
const-class v0, Ljava/util/Collection;
invoke-virtual {p0, p1, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->findTypeParameters(Ljava/lang/Class;Ljava/lang/Class;)[Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
.line 895
move-object v3, v0
if-nez v0, :cond_0
.line 896
invoke-virtual {p0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
invoke-static {p1, v0}, Lcom/fasterxml/jackson/databind/type/CollectionType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;
move-result-object v0
return-object v0
.line 899
:cond_0
array-length v0, v3
const/4 v1, 0x1
if-eq v0, v1, :cond_1
.line 900
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Strange Collection type "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, ": can not determine type parameters"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 902
:cond_1
const/4 v0, 0x0
aget-object v0, v3, v0
invoke-static {p1, v0}, Lcom/fasterxml/jackson/databind/type/CollectionType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;
move-result-object v0
return-object v0
.end method
.method private _mapType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 879
const-class v0, Ljava/util/Map;
invoke-virtual {p0, p1, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->findTypeParameters(Ljava/lang/Class;Ljava/lang/Class;)[Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
.line 881
move-object v3, v0
if-nez v0, :cond_0
.line 882
invoke-virtual {p0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
invoke-virtual {p0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v1
invoke-static {p1, v0, v1}, Lcom/fasterxml/jackson/databind/type/MapType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapType;
move-result-object v0
return-object v0
.line 885
:cond_0
array-length v0, v3
const/4 v1, 0x2
if-eq v0, v1, :cond_1
.line 886
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Strange Map type "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, ": can not determine type parameters"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 888
:cond_1
const/4 v0, 0x0
aget-object v0, v3, v0
const/4 v1, 0x1
aget-object v1, v3, v1
invoke-static {p1, v0, v1}, Lcom/fasterxml/jackson/databind/type/MapType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapType;
move-result-object v0
return-object v0
.end method
.method public static defaultInstance()Lcom/fasterxml/jackson/databind/type/TypeFactory;
.locals 1
.line 130
sget-object v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->instance:Lcom/fasterxml/jackson/databind/type/TypeFactory;
return-object v0
.end method
.method public static rawClass(Ljava/lang/reflect/Type;)Ljava/lang/Class;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/reflect/Type;)Ljava/lang/Class<*>;"
}
.end annotation
.line 154
instance-of v0, p0, Ljava/lang/Class;
if-eqz v0, :cond_0
.line 155
move-object v0, p0
check-cast v0, Ljava/lang/Class;
return-object v0
.line 158
:cond_0
invoke-static {}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->defaultInstance()Lcom/fasterxml/jackson/databind/type/TypeFactory;
move-result-object v0
invoke-virtual {v0, p0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructType(Ljava/lang/reflect/Type;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
invoke-virtual {v0}, Lcom/fasterxml/jackson/databind/JavaType;->getRawClass()Ljava/lang/Class;
move-result-object v0
return-object v0
.end method
.method public static unknownType()Lcom/fasterxml/jackson/databind/JavaType;
.locals 1
.line 144
invoke-static {}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->defaultInstance()Lcom/fasterxml/jackson/databind/type/TypeFactory;
move-result-object v0
invoke-virtual {v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
# virtual methods
.method protected final declared-synchronized _arrayListSuperInterfaceChain(Lcom/fasterxml/jackson/databind/type/HierarchicType;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
.locals 2
monitor-enter p0
.line 1039
:try_start_0
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_cachedArrayListType:Lcom/fasterxml/jackson/databind/type/HierarchicType;
if-nez v0, :cond_0
.line 1040
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->deepCloneWithoutSubtype()Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v1
.line 1041
const-class v0, Ljava/util/List;
invoke-virtual {p0, v1, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_doFindSuperInterfaceChain(Lcom/fasterxml/jackson/databind/type/HierarchicType;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
.line 1042
invoke-virtual {v1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->getSuperType()Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
iput-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_cachedArrayListType:Lcom/fasterxml/jackson/databind/type/HierarchicType;
.line 1044
:cond_0
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_cachedArrayListType:Lcom/fasterxml/jackson/databind/type/HierarchicType;
invoke-virtual {v0}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->deepCloneWithoutSubtype()Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v1
.line 1045
invoke-virtual {p1, v1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->setSuperType(Lcom/fasterxml/jackson/databind/type/HierarchicType;)V
.line 1046
invoke-virtual {v1, p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->setSubType(Lcom/fasterxml/jackson/databind/type/HierarchicType;)V
.line 1047
monitor-exit p0
return-object p1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
.method protected final _constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 7
.line 365
instance-of v0, p1, Ljava/lang/Class;
if-eqz v0, :cond_0
.line 366
move-object v0, p1
check-cast v0, Ljava/lang/Class;
move-object v4, v0
.line 367
invoke-virtual {p0, v4, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_fromClass(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v3
.line 368
goto/16 :goto_1
.line 370
:cond_0
instance-of v0, p1, Ljava/lang/reflect/ParameterizedType;
if-eqz v0, :cond_1
.line 371
move-object v0, p1
check-cast v0, Ljava/lang/reflect/ParameterizedType;
invoke-virtual {p0, v0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_fromParamType(Ljava/lang/reflect/ParameterizedType;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v3
goto :goto_1
.line 373
:cond_1
instance-of v0, p1, Lcom/fasterxml/jackson/databind/JavaType;
if-eqz v0, :cond_2
.line 374
move-object v0, p1
check-cast v0, Lcom/fasterxml/jackson/databind/JavaType;
return-object v0
.line 376
:cond_2
instance-of v0, p1, Ljava/lang/reflect/GenericArrayType;
if-eqz v0, :cond_3
.line 377
move-object v0, p1
check-cast v0, Ljava/lang/reflect/GenericArrayType;
invoke-virtual {p0, v0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_fromArrayType(Ljava/lang/reflect/GenericArrayType;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v3
goto :goto_1
.line 379
:cond_3
instance-of v0, p1, Ljava/lang/reflect/TypeVariable;
if-eqz v0, :cond_4
.line 380
move-object v0, p1
check-cast v0, Ljava/lang/reflect/TypeVariable;
invoke-virtual {p0, v0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_fromVariable(Ljava/lang/reflect/TypeVariable;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v3
goto :goto_1
.line 382
:cond_4
instance-of v0, p1, Ljava/lang/reflect/WildcardType;
if-eqz v0, :cond_5
.line 383
move-object v0, p1
check-cast v0, Ljava/lang/reflect/WildcardType;
invoke-virtual {p0, v0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_fromWildcard(Ljava/lang/reflect/WildcardType;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v3
goto :goto_1
.line 386
:cond_5
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Unrecognized Type: "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
if-nez p1, :cond_6
const-string v2, "[null]"
goto :goto_0
:cond_6
invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v2
:goto_0
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 392
:goto_1
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_modifiers:[Lcom/fasterxml/jackson/databind/type/TypeModifier;
if-eqz v0, :cond_7
invoke-virtual {v3}, Lcom/fasterxml/jackson/databind/JavaType;->isContainerType()Z
move-result v0
if-nez v0, :cond_7
.line 393
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_modifiers:[Lcom/fasterxml/jackson/databind/type/TypeModifier;
move-object v4, v0
array-length v5, v0
const/4 v6, 0x0
:goto_2
if-ge v6, v5, :cond_7
aget-object v0, v4, v6
.line 394
invoke-virtual {v0, v3, p1, p2, p0}, Lcom/fasterxml/jackson/databind/type/TypeModifier;->modifyType(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;Lcom/fasterxml/jackson/databind/type/TypeFactory;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v3
.line 393
add-int/lit8 v6, v6, 0x1
goto :goto_2
.line 397
:cond_7
return-object v3
.end method
.method protected final _doFindSuperInterfaceChain(Lcom/fasterxml/jackson/databind/type/HierarchicType;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
.locals 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(Lcom/fasterxml/jackson/databind/type/HierarchicType;Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/type/HierarchicType;"
}
.end annotation
.line 997
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->getRawClass()Ljava/lang/Class;
move-result-object v0
.line 998
move-object v1, v0
invoke-virtual {v0}, Ljava/lang/Class;->getGenericInterfaces()[Ljava/lang/reflect/Type;
move-result-object v0
.line 1001
move-object v2, v0
if-eqz v0, :cond_1
.line 1002
move-object v0, v2
move-object v2, v0
array-length v3, v0
const/4 v4, 0x0
:goto_0
if-ge v4, v3, :cond_1
aget-object v5, v2, v4
.line 1003
invoke-virtual {p0, v5, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_findSuperInterfaceChain(Ljava/lang/reflect/Type;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
.line 1004
move-object v5, v0
if-eqz v0, :cond_0
.line 1005
invoke-virtual {v5, p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->setSubType(Lcom/fasterxml/jackson/databind/type/HierarchicType;)V
.line 1006
invoke-virtual {p1, v5}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->setSuperType(Lcom/fasterxml/jackson/databind/type/HierarchicType;)V
.line 1007
return-object p1
.line 1002
:cond_0
add-int/lit8 v4, v4, 0x1
goto :goto_0
.line 1012
:cond_1
invoke-virtual {v1}, Ljava/lang/Class;->getGenericSuperclass()Ljava/lang/reflect/Type;
move-result-object v0
.line 1013
move-object v2, v0
if-eqz v0, :cond_2
.line 1014
invoke-virtual {p0, v2, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_findSuperInterfaceChain(Ljava/lang/reflect/Type;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
.line 1015
move-object v3, v0
if-eqz v0, :cond_2
.line 1016
invoke-virtual {v3, p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->setSubType(Lcom/fasterxml/jackson/databind/type/HierarchicType;)V
.line 1017
invoke-virtual {p1, v3}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->setSuperType(Lcom/fasterxml/jackson/databind/type/HierarchicType;)V
.line 1018
return-object p1
.line 1021
:cond_2
const/4 v0, 0x0
return-object v0
.end method
.method protected final _findSuperClassChain(Ljava/lang/reflect/Type;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/reflect/Type;Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/type/HierarchicType;"
}
.end annotation
.line 953
new-instance v0, Lcom/fasterxml/jackson/databind/type/HierarchicType;
invoke-direct {v0, p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;-><init>(Ljava/lang/reflect/Type;)V
.line 954
move-object p1, v0
invoke-virtual {v0}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->getRawClass()Ljava/lang/Class;
move-result-object v0
.line 955
move-object v1, v0
if-ne v0, p2, :cond_0
.line 956
return-object p1
.line 959
:cond_0
invoke-virtual {v1}, Ljava/lang/Class;->getGenericSuperclass()Ljava/lang/reflect/Type;
move-result-object v0
.line 960
move-object v1, v0
if-eqz v0, :cond_1
.line 961
invoke-virtual {p0, v1, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_findSuperClassChain(Ljava/lang/reflect/Type;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
.line 962
move-object p2, v0
if-eqz v0, :cond_1
.line 963
invoke-virtual {p2, p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->setSubType(Lcom/fasterxml/jackson/databind/type/HierarchicType;)V
.line 964
invoke-virtual {p1, p2}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->setSuperType(Lcom/fasterxml/jackson/databind/type/HierarchicType;)V
.line 965
return-object p1
.line 968
:cond_1
const/4 v0, 0x0
return-object v0
.end method
.method protected final _findSuperInterfaceChain(Ljava/lang/reflect/Type;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/reflect/Type;Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/type/HierarchicType;"
}
.end annotation
.line 973
new-instance v0, Lcom/fasterxml/jackson/databind/type/HierarchicType;
invoke-direct {v0, p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;-><init>(Ljava/lang/reflect/Type;)V
.line 974
move-object v1, v0
invoke-virtual {v0}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->getRawClass()Ljava/lang/Class;
move-result-object v0
.line 975
move-object v2, v0
if-ne v0, p2, :cond_0
.line 976
new-instance v0, Lcom/fasterxml/jackson/databind/type/HierarchicType;
invoke-direct {v0, p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;-><init>(Ljava/lang/reflect/Type;)V
return-object v0
.line 982
:cond_0
const-class v0, Ljava/util/HashMap;
if-ne v2, v0, :cond_1
.line 983
const-class v0, Ljava/util/Map;
if-ne p2, v0, :cond_1
.line 984
invoke-virtual {p0, v1}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_hashMapSuperInterfaceChain(Lcom/fasterxml/jackson/databind/type/HierarchicType;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
return-object v0
.line 987
:cond_1
const-class v0, Ljava/util/ArrayList;
if-ne v2, v0, :cond_2
.line 988
const-class v0, Ljava/util/List;
if-ne p2, v0, :cond_2
.line 989
invoke-virtual {p0, v1}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_arrayListSuperInterfaceChain(Lcom/fasterxml/jackson/databind/type/HierarchicType;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
return-object v0
.line 992
:cond_2
invoke-virtual {p0, v1, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_doFindSuperInterfaceChain(Lcom/fasterxml/jackson/databind/type/HierarchicType;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
return-object v0
.end method
.method protected final _findSuperTypeChain(Ljava/lang/Class;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/type/HierarchicType;"
}
.end annotation
.line 945
invoke-virtual {p2}, Ljava/lang/Class;->isInterface()Z
move-result v0
if-eqz v0, :cond_0
.line 946
invoke-virtual {p0, p1, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_findSuperInterfaceChain(Ljava/lang/reflect/Type;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
return-object v0
.line 948
:cond_0
invoke-virtual {p0, p1, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_findSuperClassChain(Ljava/lang/reflect/Type;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
return-object v0
.end method
.method protected final _fromArrayType(Ljava/lang/reflect/GenericArrayType;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 3
.line 819
invoke-interface {p1}, Ljava/lang/reflect/GenericArrayType;->getGenericComponentType()Ljava/lang/reflect/Type;
move-result-object v0
invoke-virtual {p0, v0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
.line 820
const/4 v1, 0x0
const/4 v2, 0x0
invoke-static {v0, v1, v2}, Lcom/fasterxml/jackson/databind/type/ArrayType;->construct(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/ArrayType;
move-result-object v0
return-object v0
.end method
.method protected final _fromClass(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 680
const-class v0, Ljava/lang/String;
if-ne p1, v0, :cond_0
sget-object v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->CORE_TYPE_STRING:Lcom/fasterxml/jackson/databind/type/SimpleType;
return-object v0
.line 681
:cond_0
sget-object v0, Ljava/lang/Boolean;->TYPE:Ljava/lang/Class;
if-ne p1, v0, :cond_1
sget-object v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->CORE_TYPE_BOOL:Lcom/fasterxml/jackson/databind/type/SimpleType;
return-object v0
.line 682
:cond_1
sget-object v0, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
if-ne p1, v0, :cond_2
sget-object v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->CORE_TYPE_INT:Lcom/fasterxml/jackson/databind/type/SimpleType;
return-object v0
.line 683
:cond_2
sget-object v0, Ljava/lang/Long;->TYPE:Ljava/lang/Class;
if-ne p1, v0, :cond_3
sget-object v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->CORE_TYPE_LONG:Lcom/fasterxml/jackson/databind/type/SimpleType;
return-object v0
.line 686
:cond_3
new-instance p2, Lcom/fasterxml/jackson/databind/type/ClassKey;
invoke-direct {p2, p1}, Lcom/fasterxml/jackson/databind/type/ClassKey;-><init>(Ljava/lang/Class;)V
.line 689
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_typeCache:Lcom/fasterxml/jackson/databind/util/LRUMap;
move-object v4, v0
monitor-enter v0
.line 690
:try_start_0
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_typeCache:Lcom/fasterxml/jackson/databind/util/LRUMap;
invoke-virtual {v0, p2}, Lcom/fasterxml/jackson/databind/util/LRUMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/fasterxml/jackson/databind/JavaType;
move-object v3, v0
.line 691
monitor-exit v4
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
:catchall_0
:try_start_1
move-exception p1
monitor-exit v4
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw p1
.line 692
:goto_0
if-eqz v3, :cond_4
.line 693
return-object v3
.line 704
:cond_4
invoke-virtual {p1}, Ljava/lang/Class;->isArray()Z
move-result v0
if-eqz v0, :cond_5
.line 705
invoke-virtual {p1}, Ljava/lang/Class;->getComponentType()Ljava/lang/Class;
move-result-object v0
const/4 v1, 0x0
invoke-virtual {p0, v0, v1}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
const/4 v1, 0x0
const/4 v2, 0x0
invoke-static {v0, v1, v2}, Lcom/fasterxml/jackson/databind/type/ArrayType;->construct(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/ArrayType;
move-result-object v3
goto :goto_1
.line 709
:cond_5
invoke-virtual {p1}, Ljava/lang/Class;->isEnum()Z
move-result v0
if-eqz v0, :cond_6
.line 710
new-instance v3, Lcom/fasterxml/jackson/databind/type/SimpleType;
invoke-direct {v3, p1}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;)V
goto :goto_1
.line 715
:cond_6
const-class v0, Ljava/util/Map;
invoke-virtual {v0, p1}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-eqz v0, :cond_7
.line 716
invoke-direct {p0, p1}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_mapType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v3
goto :goto_1
.line 717
:cond_7
const-class v0, Ljava/util/Collection;
invoke-virtual {v0, p1}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-eqz v0, :cond_8
.line 718
invoke-direct {p0, p1}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_collectionType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v3
goto :goto_1
.line 720
:cond_8
new-instance v3, Lcom/fasterxml/jackson/databind/type/SimpleType;
invoke-direct {v3, p1}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;)V
.line 723
:goto_1
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_typeCache:Lcom/fasterxml/jackson/databind/util/LRUMap;
move-object v4, v0
monitor-enter v0
.line 724
:try_start_2
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_typeCache:Lcom/fasterxml/jackson/databind/util/LRUMap;
invoke-virtual {v0, p2, v3}, Lcom/fasterxml/jackson/databind/util/LRUMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 725
monitor-exit v4
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_1
goto :goto_2
:catchall_1
:try_start_3
move-exception p1
monitor-exit v4
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_1
throw p1
.line 727
:goto_2
return-object v3
.end method
.method protected final _fromParamType(Ljava/lang/reflect/ParameterizedType;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 7
.line 778
invoke-interface {p1}, Ljava/lang/reflect/ParameterizedType;->getRawType()Ljava/lang/reflect/Type;
move-result-object v0
check-cast v0, Ljava/lang/Class;
move-object v3, v0
.line 779
invoke-interface {p1}, Ljava/lang/reflect/ParameterizedType;->getActualTypeArguments()[Ljava/lang/reflect/Type;
move-result-object v0
.line 780
move-object p1, v0
if-nez v0, :cond_0
const/4 v0, 0x0
goto :goto_0
:cond_0
array-length v0, p1
.line 784
:goto_0
move v4, v0
if-nez v0, :cond_1
.line 785
sget-object v5, Lcom/fasterxml/jackson/databind/type/TypeFactory;->NO_TYPES:[Lcom/fasterxml/jackson/databind/JavaType;
goto :goto_2
.line 787
:cond_1
new-array v5, v4, [Lcom/fasterxml/jackson/databind/JavaType;
.line 788
const/4 v6, 0x0
:goto_1
if-ge v6, v4, :cond_2
.line 789
aget-object v0, p1, v6
invoke-virtual {p0, v0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
aput-object v0, v5, v6
.line 788
add-int/lit8 v6, v6, 0x1
goto :goto_1
.line 794
:cond_2
:goto_2
const-class v0, Ljava/util/Map;
invoke-virtual {v0, v3}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-eqz v0, :cond_4
.line 795
invoke-virtual {p0, v3, v5}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructSimpleType(Ljava/lang/Class;[Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v6
.line 796
const-class v0, Ljava/util/Map;
invoke-virtual {p0, v6, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->findTypeParameters(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Class;)[Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
.line 797
move-object p1, v0
array-length v0, v0
const/4 v1, 0x2
if-eq v0, v1, :cond_3
.line 798
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Could not find 2 type parameters for Map class "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {v3}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, " (found "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
array-length v2, p1
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, ")"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 800
:cond_3
const/4 v0, 0x0
aget-object v0, p1, v0
const/4 v1, 0x1
aget-object v1, p1, v1
invoke-static {v3, v0, v1}, Lcom/fasterxml/jackson/databind/type/MapType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapType;
move-result-object v0
return-object v0
.line 802
:cond_4
const-class v0, Ljava/util/Collection;
invoke-virtual {v0, v3}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-eqz v0, :cond_6
.line 803
invoke-virtual {p0, v3, v5}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructSimpleType(Ljava/lang/Class;[Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v6
.line 804
const-class v0, Ljava/util/Collection;
invoke-virtual {p0, v6, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->findTypeParameters(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Class;)[Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
.line 805
move-object p1, v0
array-length v0, v0
const/4 v1, 0x1
if-eq v0, v1, :cond_5
.line 806
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Could not find 1 type parameter for Collection class "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {v3}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, " (found "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
array-length v2, p1
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, ")"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 808
:cond_5
const/4 v0, 0x0
aget-object v0, p1, v0
invoke-static {v3, v0}, Lcom/fasterxml/jackson/databind/type/CollectionType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;
move-result-object v0
return-object v0
.line 810
:cond_6
if-nez v4, :cond_7
.line 811
new-instance v0, Lcom/fasterxml/jackson/databind/type/SimpleType;
invoke-direct {v0, v3}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;)V
return-object v0
.line 813
:cond_7
invoke-virtual {p0, v3, v5}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructSimpleType(Ljava/lang/Class;[Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method protected final _fromParameterizedClass(Ljava/lang/Class;Ljava/util/List;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;Ljava/util/List<Lcom/fasterxml/jackson/databind/JavaType;>;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 736
invoke-virtual {p1}, Ljava/lang/Class;->isArray()Z
move-result v0
if-eqz v0, :cond_0
.line 737
invoke-virtual {p1}, Ljava/lang/Class;->getComponentType()Ljava/lang/Class;
move-result-object v0
const/4 v1, 0x0
invoke-virtual {p0, v0, v1}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
const/4 v1, 0x0
const/4 v2, 0x0
invoke-static {v0, v1, v2}, Lcom/fasterxml/jackson/databind/type/ArrayType;->construct(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/ArrayType;
move-result-object v0
return-object v0
.line 739
:cond_0
invoke-virtual {p1}, Ljava/lang/Class;->isEnum()Z
move-result v0
if-eqz v0, :cond_1
.line 740
new-instance v0, Lcom/fasterxml/jackson/databind/type/SimpleType;
invoke-direct {v0, p1}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;)V
return-object v0
.line 742
:cond_1
const-class v0, Ljava/util/Map;
invoke-virtual {v0, p1}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-eqz v0, :cond_4
.line 745
invoke-interface {p2}, Ljava/util/List;->size()I
move-result v0
if-lez v0, :cond_3
.line 746
const/4 v0, 0x0
invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/fasterxml/jackson/databind/JavaType;
move-object v3, v0
.line 747
invoke-interface {p2}, Ljava/util/List;->size()I
move-result v0
const/4 v1, 0x2
if-lt v0, v1, :cond_2
const/4 v0, 0x1
invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/fasterxml/jackson/databind/JavaType;
move-object p2, v0
goto :goto_0
:cond_2
invoke-virtual {p0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object p2
.line 749
:goto_0
invoke-static {p1, v3, p2}, Lcom/fasterxml/jackson/databind/type/MapType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapType;
move-result-object v0
return-object v0
.line 751
:cond_3
invoke-direct {p0, p1}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_mapType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.line 753
:cond_4
const-class v0, Ljava/util/Collection;
invoke-virtual {v0, p1}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-eqz v0, :cond_6
.line 754
invoke-interface {p2}, Ljava/util/List;->size()I
move-result v0
if-lez v0, :cond_5
.line 755
const/4 v0, 0x0
invoke-interface {p2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lcom/fasterxml/jackson/databind/JavaType;
invoke-static {p1, v0}, Lcom/fasterxml/jackson/databind/type/CollectionType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;
move-result-object v0
return-object v0
.line 757
:cond_5
invoke-direct {p0, p1}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_collectionType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.line 759
:cond_6
invoke-interface {p2}, Ljava/util/List;->size()I
move-result v0
if-nez v0, :cond_7
.line 760
new-instance v0, Lcom/fasterxml/jackson/databind/type/SimpleType;
invoke-direct {v0, p1}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;)V
return-object v0
.line 762
:cond_7
invoke-interface {p2}, Ljava/util/List;->size()I
move-result v0
new-array v0, v0, [Lcom/fasterxml/jackson/databind/JavaType;
invoke-interface {p2, v0}, Ljava/util/List;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
move-result-object v0
check-cast v0, [Lcom/fasterxml/jackson/databind/JavaType;
move-object v3, v0
.line 763
invoke-virtual {p0, p1, v3}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructSimpleType(Ljava/lang/Class;[Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method protected final _fromVariable(Ljava/lang/reflect/TypeVariable;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/reflect/TypeVariable<*>;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 829
if-nez p2, :cond_0
.line 830
invoke-virtual {p0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.line 834
:cond_0
invoke-interface {p1}, Ljava/lang/reflect/TypeVariable;->getName()Ljava/lang/String;
move-result-object v1
.line 835
invoke-virtual {p2, v1}, Lcom/fasterxml/jackson/databind/type/TypeBindings;->findType(Ljava/lang/String;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
.line 836
move-object v2, v0
if-eqz v0, :cond_1
.line 837
return-object v2
.line 845
:cond_1
invoke-interface {p1}, Ljava/lang/reflect/TypeVariable;->getBounds()[Ljava/lang/reflect/Type;
move-result-object p1
.line 860
invoke-virtual {p2, v1}, Lcom/fasterxml/jackson/databind/type/TypeBindings;->_addPlaceholder(Ljava/lang/String;)V
.line 861
const/4 v0, 0x0
aget-object v0, p1, v0
invoke-virtual {p0, v0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method protected final _fromWildcard(Ljava/lang/reflect/WildcardType;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 2
.line 874
invoke-interface {p1}, Ljava/lang/reflect/WildcardType;->getUpperBounds()[Ljava/lang/reflect/Type;
move-result-object v0
const/4 v1, 0x0
aget-object v0, v0, v1
invoke-virtual {p0, v0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method protected final declared-synchronized _hashMapSuperInterfaceChain(Lcom/fasterxml/jackson/databind/type/HierarchicType;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
.locals 2
monitor-enter p0
.line 1026
:try_start_0
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_cachedHashMapType:Lcom/fasterxml/jackson/databind/type/HierarchicType;
if-nez v0, :cond_0
.line 1027
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->deepCloneWithoutSubtype()Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v1
.line 1028
const-class v0, Ljava/util/Map;
invoke-virtual {p0, v1, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_doFindSuperInterfaceChain(Lcom/fasterxml/jackson/databind/type/HierarchicType;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
.line 1029
invoke-virtual {v1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->getSuperType()Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
iput-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_cachedHashMapType:Lcom/fasterxml/jackson/databind/type/HierarchicType;
.line 1031
:cond_0
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_cachedHashMapType:Lcom/fasterxml/jackson/databind/type/HierarchicType;
invoke-virtual {v0}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->deepCloneWithoutSubtype()Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v1
.line 1032
invoke-virtual {p1, v1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->setSuperType(Lcom/fasterxml/jackson/databind/type/HierarchicType;)V
.line 1033
invoke-virtual {v1, p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->setSubType(Lcom/fasterxml/jackson/databind/type/HierarchicType;)V
.line 1034
monitor-exit p0
return-object p1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
:catchall_0
move-exception p1
monitor-exit p0
throw p1
.end method
.method protected final _resolveVariableViaSubTypes(Lcom/fasterxml/jackson/databind/type/HierarchicType;Ljava/lang/String;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 5
.line 908
:goto_0
if-eqz p1, :cond_2
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->isGeneric()Z
move-result v0
if-eqz v0, :cond_2
.line 909
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->getRawClass()Ljava/lang/Class;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/Class;->getTypeParameters()[Ljava/lang/reflect/TypeVariable;
move-result-object v1
.line 910
const/4 v2, 0x0
array-length v3, v1
:goto_1
if-ge v2, v3, :cond_2
.line 911
aget-object v4, v1, v2
.line 912
invoke-interface {v4}, Ljava/lang/reflect/TypeVariable;->getName()Ljava/lang/String;
move-result-object v0
invoke-virtual {p2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1
.line 914
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->asGeneric()Ljava/lang/reflect/ParameterizedType;
move-result-object v0
invoke-interface {v0}, Ljava/lang/reflect/ParameterizedType;->getActualTypeArguments()[Ljava/lang/reflect/Type;
move-result-object v0
aget-object v0, v0, v2
.line 915
move-object p2, v0
instance-of v0, v0, Ljava/lang/reflect/TypeVariable;
if-eqz v0, :cond_0
.line 916
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->getSubType()Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object p1
move-object v0, p2
check-cast v0, Ljava/lang/reflect/TypeVariable;
invoke-interface {v0}, Ljava/lang/reflect/TypeVariable;->getName()Ljava/lang/String;
move-result-object p2
goto :goto_0
.line 919
:cond_0
invoke-virtual {p0, p2, p3}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.line 910
:cond_1
add-int/lit8 v2, v2, 0x1
goto :goto_1
.line 923
:cond_2
invoke-virtual {p0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method protected final _unknownType()Lcom/fasterxml/jackson/databind/JavaType;
.locals 2
.line 927
new-instance v0, Lcom/fasterxml/jackson/databind/type/SimpleType;
const-class v1, Ljava/lang/Object;
invoke-direct {v0, v1}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;)V
return-object v0
.end method
.method public final constructArrayType(Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/ArrayType;
.locals 2
.line 423
const/4 v0, 0x0
const/4 v1, 0x0
invoke-static {p1, v0, v1}, Lcom/fasterxml/jackson/databind/type/ArrayType;->construct(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/ArrayType;
move-result-object v0
return-object v0
.end method
.method public final constructArrayType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/ArrayType;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/type/ArrayType;"
}
.end annotation
.line 413
const/4 v0, 0x0
invoke-virtual {p0, p1, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
const/4 v1, 0x0
const/4 v2, 0x0
invoke-static {v0, v1, v2}, Lcom/fasterxml/jackson/databind/type/ArrayType;->construct(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/type/ArrayType;
move-result-object v0
return-object v0
.end method
.method public final constructCollectionLikeType(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;"
}
.end annotation
.line 463
invoke-static {p1, p2}, Lcom/fasterxml/jackson/databind/type/CollectionLikeType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
move-result-object v0
return-object v0
.end method
.method public final constructCollectionLikeType(Ljava/lang/Class;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;"
}
.end annotation
.line 453
invoke-virtual {p0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructType(Ljava/lang/reflect/Type;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
invoke-static {p1, v0}, Lcom/fasterxml/jackson/databind/type/CollectionLikeType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
move-result-object v0
return-object v0
.end method
.method public final constructCollectionType(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<+Ljava/util/Collection;>;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;"
}
.end annotation
.line 443
invoke-static {p1, p2}, Lcom/fasterxml/jackson/databind/type/CollectionType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;
move-result-object v0
return-object v0
.end method
.method public final constructCollectionType(Ljava/lang/Class;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/CollectionType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<+Ljava/util/Collection;>;Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/type/CollectionType;"
}
.end annotation
.line 433
invoke-virtual {p0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructType(Ljava/lang/reflect/Type;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
invoke-static {p1, v0}, Lcom/fasterxml/jackson/databind/type/CollectionType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;
move-result-object v0
return-object v0
.end method
.method public final constructFromCanonical(Ljava/lang/String;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 1
.line 216
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_parser:Lcom/fasterxml/jackson/databind/type/TypeParser;
invoke-virtual {v0, p1}, Lcom/fasterxml/jackson/databind/type/TypeParser;->parse(Ljava/lang/String;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method public final constructMapLikeType(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapLikeType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapLikeType;"
}
.end annotation
.line 493
invoke-static {p1, p2, p3}, Lcom/fasterxml/jackson/databind/type/MapLikeType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapLikeType;
move-result-object v0
return-object v0
.end method
.method public final constructMapLikeType(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/MapLikeType;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;Ljava/lang/Class<*>;Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/type/MapLikeType;"
}
.end annotation
.line 503
invoke-virtual {p0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructType(Ljava/lang/reflect/Type;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
invoke-virtual {p0, p3}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructType(Ljava/lang/reflect/Type;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v1
invoke-static {p1, v0, v1}, Lcom/fasterxml/jackson/databind/type/MapType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapType;
move-result-object v0
return-object v0
.end method
.method public final constructMapType(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<+Ljava/util/Map;>;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapType;"
}
.end annotation
.line 473
invoke-static {p1, p2, p3}, Lcom/fasterxml/jackson/databind/type/MapType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapType;
move-result-object v0
return-object v0
.end method
.method public final constructMapType(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/MapType;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<+Ljava/util/Map;>;Ljava/lang/Class<*>;Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/type/MapType;"
}
.end annotation
.line 483
invoke-virtual {p0, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructType(Ljava/lang/reflect/Type;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
invoke-virtual {p0, p3}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructType(Ljava/lang/reflect/Type;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v1
invoke-static {p1, v0, v1}, Lcom/fasterxml/jackson/databind/type/MapType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapType;
move-result-object v0
return-object v0
.end method
.method public final varargs constructParametricType(Ljava/lang/Class;[Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;[Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 576
invoke-virtual {p1}, Ljava/lang/Class;->isArray()Z
move-result v0
if-eqz v0, :cond_1
.line 578
array-length v0, p2
const/4 v1, 0x1
if-eq v0, v1, :cond_0
.line 579
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Need exactly 1 parameter type for arrays ("
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, ")"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 581
:cond_0
const/4 v0, 0x0
aget-object v0, p2, v0
invoke-virtual {p0, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructArrayType(Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/ArrayType;
move-result-object p1
goto/16 :goto_0
.line 583
:cond_1
const-class v0, Ljava/util/Map;
invoke-virtual {v0, p1}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-eqz v0, :cond_3
.line 584
array-length v0, p2
const/4 v1, 0x2
if-eq v0, v1, :cond_2
.line 585
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Need exactly 2 parameter types for Map types ("
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, ")"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 587
:cond_2
const/4 v0, 0x0
aget-object v0, p2, v0
const/4 v1, 0x1
aget-object v1, p2, v1
invoke-virtual {p0, p1, v0, v1}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructMapType(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapType;
move-result-object p1
goto :goto_0
.line 589
:cond_3
const-class v0, Ljava/util/Collection;
invoke-virtual {v0, p1}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-eqz v0, :cond_5
.line 590
array-length v0, p2
const/4 v1, 0x1
if-eq v0, v1, :cond_4
.line 591
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Need exactly 1 parameter type for Collection types ("
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, ")"
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 593
:cond_4
const/4 v0, 0x0
aget-object v0, p2, v0
invoke-virtual {p0, p1, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructCollectionType(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;
move-result-object p1
goto :goto_0
.line 595
:cond_5
invoke-virtual {p0, p1, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructSimpleType(Ljava/lang/Class;[Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object p1
.line 597
:goto_0
return-object p1
.end method
.method public final varargs constructParametricType(Ljava/lang/Class;[Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;[Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 550
array-length v0, p2
.line 551
move v2, v0
new-array v3, v0, [Lcom/fasterxml/jackson/databind/JavaType;
.line 552
const/4 v4, 0x0
:goto_0
if-ge v4, v2, :cond_0
.line 553
aget-object v0, p2, v4
const/4 v1, 0x0
invoke-virtual {p0, v0, v1}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_fromClass(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
aput-object v0, v3, v4
.line 552
add-int/lit8 v4, v4, 0x1
goto :goto_0
.line 555
:cond_0
invoke-virtual {p0, p1, v3}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->constructParametricType(Ljava/lang/Class;[Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method public final constructRawCollectionLikeType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;"
}
.end annotation
.line 634
invoke-static {}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
invoke-static {p1, v0}, Lcom/fasterxml/jackson/databind/type/CollectionLikeType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionLikeType;
move-result-object v0
return-object v0
.end method
.method public final constructRawCollectionType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/CollectionType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<+Ljava/util/Collection;>;)Lcom/fasterxml/jackson/databind/type/CollectionType;"
}
.end annotation
.line 619
invoke-static {}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
invoke-static {p1, v0}, Lcom/fasterxml/jackson/databind/type/CollectionType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/CollectionType;
move-result-object v0
return-object v0
.end method
.method public final constructRawMapLikeType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/MapLikeType;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/type/MapLikeType;"
}
.end annotation
.line 664
invoke-static {}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
invoke-static {}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v1
invoke-static {p1, v0, v1}, Lcom/fasterxml/jackson/databind/type/MapLikeType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapLikeType;
move-result-object v0
return-object v0
.end method
.method public final constructRawMapType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/MapType;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<+Ljava/util/Map;>;)Lcom/fasterxml/jackson/databind/type/MapType;"
}
.end annotation
.line 649
invoke-static {}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
invoke-static {}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->unknownType()Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v1
invoke-static {p1, v0, v1}, Lcom/fasterxml/jackson/databind/type/MapType;->construct(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/type/MapType;
move-result-object v0
return-object v0
.end method
.method public final constructSimpleType(Ljava/lang/Class;[Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 11
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;[Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 512
invoke-virtual {p1}, Ljava/lang/Class;->getTypeParameters()[Ljava/lang/reflect/TypeVariable;
move-result-object v0
.line 513
move-object v7, v0
array-length v0, v0
array-length v1, p2
if-eq v0, v1, :cond_0
.line 514
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Parameter type mismatch for "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, ": expected "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
array-length v2, v7
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, " parameters, was given "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
array-length v2, p2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 517
:cond_0
array-length v0, v7
new-array v8, v0, [Ljava/lang/String;
.line 518
const/4 v9, 0x0
array-length v10, v7
:goto_0
if-ge v9, v10, :cond_1
.line 519
aget-object v0, v7, v9
invoke-interface {v0}, Ljava/lang/reflect/TypeVariable;->getName()Ljava/lang/String;
move-result-object v0
aput-object v0, v8, v9
.line 518
add-int/lit8 v9, v9, 0x1
goto :goto_0
.line 521
:cond_1
new-instance v0, Lcom/fasterxml/jackson/databind/type/SimpleType;
move-object v1, p1
move-object v2, v8
move-object v3, p2
const/4 v4, 0x0
const/4 v5, 0x0
const/4 v6, 0x0
invoke-direct/range {v0 .. v6}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;[Ljava/lang/String;[Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Object;Ljava/lang/Object;Z)V
.line 522
return-object v0
.end method
.method public final constructSpecializedType(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 177
instance-of v0, p1, Lcom/fasterxml/jackson/databind/type/SimpleType;
if-eqz v0, :cond_4
.line 179
invoke-virtual {p2}, Ljava/lang/Class;->isArray()Z
move-result v0
if-nez v0, :cond_0
const-class v0, Ljava/util/Map;
invoke-virtual {v0, p2}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-nez v0, :cond_0
const-class v0, Ljava/util/Collection;
invoke-virtual {v0, p2}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-eqz v0, :cond_4
.line 183
:cond_0
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/JavaType;->getRawClass()Ljava/lang/Class;
move-result-object v0
invoke-virtual {v0, p2}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-nez v0, :cond_1
.line 184
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Class "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p2}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, " not subtype of "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 187
:cond_1
new-instance v0, Lcom/fasterxml/jackson/databind/type/TypeBindings;
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/JavaType;->getRawClass()Ljava/lang/Class;
move-result-object v1
invoke-direct {v0, p0, v1}, Lcom/fasterxml/jackson/databind/type/TypeBindings;-><init>(Lcom/fasterxml/jackson/databind/type/TypeFactory;Ljava/lang/Class;)V
invoke-virtual {p0, p2, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_fromClass(Ljava/lang/Class;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object p2
.line 189
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/JavaType;->getValueHandler()Ljava/lang/Object;
move-result-object v0
.line 190
move-object v3, v0
if-eqz v0, :cond_2
.line 191
invoke-virtual {p2, v3}, Lcom/fasterxml/jackson/databind/JavaType;->withValueHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object p2
.line 193
:cond_2
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/JavaType;->getTypeHandler()Ljava/lang/Object;
move-result-object v0
.line 194
move-object v3, v0
if-eqz v0, :cond_3
.line 195
invoke-virtual {p2, v3}, Lcom/fasterxml/jackson/databind/JavaType;->withTypeHandler(Ljava/lang/Object;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object p2
.line 197
:cond_3
return-object p2
.line 201
:cond_4
invoke-virtual {p1, p2}, Lcom/fasterxml/jackson/databind/JavaType;->narrowBy(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method public final constructType(Lcom/fasterxml/jackson/core/type/TypeReference;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(Lcom/fasterxml/jackson/core/type/TypeReference<*>;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 342
invoke-virtual {p1}, Lcom/fasterxml/jackson/core/type/TypeReference;->getType()Ljava/lang/reflect/Type;
move-result-object v0
const/4 v1, 0x0
invoke-virtual {p0, v0, v1}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method public final constructType(Ljava/lang/reflect/Type;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 1
.line 334
const/4 v0, 0x0
invoke-virtual {p0, p1, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method public final constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 1
.line 351
if-nez p2, :cond_0
const/4 v0, 0x0
goto :goto_0
:cond_0
new-instance v0, Lcom/fasterxml/jackson/databind/type/TypeBindings;
invoke-direct {v0, p0, p2}, Lcom/fasterxml/jackson/databind/type/TypeBindings;-><init>(Lcom/fasterxml/jackson/databind/type/TypeFactory;Lcom/fasterxml/jackson/databind/JavaType;)V
:goto_0
move-object p2, v0
.line 352
invoke-virtual {p0, p1, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method public final constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 1
.line 338
invoke-virtual {p0, p1, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method public final constructType(Ljava/lang/reflect/Type;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/reflect/Type;Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 346
if-nez p2, :cond_0
const/4 v0, 0x0
goto :goto_0
:cond_0
new-instance v0, Lcom/fasterxml/jackson/databind/type/TypeBindings;
invoke-direct {v0, p0, p2}, Lcom/fasterxml/jackson/databind/type/TypeBindings;-><init>(Lcom/fasterxml/jackson/databind/type/TypeFactory;Ljava/lang/Class;)V
:goto_0
move-object p2, v0
.line 347
invoke-virtual {p0, p1, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method public final findTypeParameters(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Class;)[Lcom/fasterxml/jackson/databind/JavaType;
.locals 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(Lcom/fasterxml/jackson/databind/JavaType;Ljava/lang/Class<*>;)[Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 238
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/JavaType;->getRawClass()Ljava/lang/Class;
move-result-object v0
.line 239
move-object v1, v0
if-ne v0, p2, :cond_2
.line 241
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/JavaType;->containedTypeCount()I
move-result v0
.line 242
move p2, v0
if-nez v0, :cond_0
const/4 v0, 0x0
return-object v0
.line 243
:cond_0
new-array v1, p2, [Lcom/fasterxml/jackson/databind/JavaType;
.line 244
const/4 v2, 0x0
:goto_0
if-ge v2, p2, :cond_1
.line 245
invoke-virtual {p1, v2}, Lcom/fasterxml/jackson/databind/JavaType;->containedType(I)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
aput-object v0, v1, v2
.line 244
add-int/lit8 v2, v2, 0x1
goto :goto_0
.line 247
:cond_1
return-object v1
.line 255
:cond_2
new-instance v0, Lcom/fasterxml/jackson/databind/type/TypeBindings;
invoke-direct {v0, p0, p1}, Lcom/fasterxml/jackson/databind/type/TypeBindings;-><init>(Lcom/fasterxml/jackson/databind/type/TypeFactory;Lcom/fasterxml/jackson/databind/JavaType;)V
invoke-virtual {p0, v1, p2, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->findTypeParameters(Ljava/lang/Class;Ljava/lang/Class;Lcom/fasterxml/jackson/databind/type/TypeBindings;)[Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method public final findTypeParameters(Ljava/lang/Class;Ljava/lang/Class;)[Lcom/fasterxml/jackson/databind/JavaType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;Ljava/lang/Class<*>;)[Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 259
new-instance v0, Lcom/fasterxml/jackson/databind/type/TypeBindings;
invoke-direct {v0, p0, p1}, Lcom/fasterxml/jackson/databind/type/TypeBindings;-><init>(Lcom/fasterxml/jackson/databind/type/TypeFactory;Ljava/lang/Class;)V
invoke-virtual {p0, p1, p2, v0}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->findTypeParameters(Ljava/lang/Class;Ljava/lang/Class;Lcom/fasterxml/jackson/databind/type/TypeBindings;)[Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method public final findTypeParameters(Ljava/lang/Class;Ljava/lang/Class;Lcom/fasterxml/jackson/databind/type/TypeBindings;)[Lcom/fasterxml/jackson/databind/JavaType;
.locals 9
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;Ljava/lang/Class<*>;Lcom/fasterxml/jackson/databind/type/TypeBindings;)[Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 265
invoke-virtual {p0, p1, p2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_findSuperTypeChain(Ljava/lang/Class;Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
.line 267
move-object v3, v0
if-nez v0, :cond_0
.line 268
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Class "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, " is not a subtype of "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {p2}, Ljava/lang/Class;->getName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.line 271
:cond_0
move-object p1, v3
.line 272
:goto_0
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->getSuperType()Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
if-eqz v0, :cond_2
.line 273
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->getSuperType()Lcom/fasterxml/jackson/databind/type/HierarchicType;
move-result-object v0
.line 274
move-object p1, v0
invoke-virtual {v0}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->getRawClass()Ljava/lang/Class;
move-result-object p2
.line 275
new-instance v3, Lcom/fasterxml/jackson/databind/type/TypeBindings;
invoke-direct {v3, p0, p2}, Lcom/fasterxml/jackson/databind/type/TypeBindings;-><init>(Lcom/fasterxml/jackson/databind/type/TypeFactory;Ljava/lang/Class;)V
.line 276
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->isGeneric()Z
move-result v0
if-eqz v0, :cond_1
.line 277
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->asGeneric()Ljava/lang/reflect/ParameterizedType;
move-result-object v0
.line 278
invoke-interface {v0}, Ljava/lang/reflect/ParameterizedType;->getActualTypeArguments()[Ljava/lang/reflect/Type;
move-result-object v4
.line 279
invoke-virtual {p2}, Ljava/lang/Class;->getTypeParameters()[Ljava/lang/reflect/TypeVariable;
move-result-object p2
.line 280
array-length v5, v4
.line 281
const/4 v6, 0x0
:goto_1
if-ge v6, v5, :cond_1
.line 282
aget-object v0, p2, v6
invoke-interface {v0}, Ljava/lang/reflect/TypeVariable;->getName()Ljava/lang/String;
move-result-object v7
.line 283
aget-object v0, v4, v6
invoke-virtual {p0, v0, p3}, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_constructType(Ljava/lang/reflect/Type;Lcom/fasterxml/jackson/databind/type/TypeBindings;)Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v8
.line 284
invoke-virtual {v3, v7, v8}, Lcom/fasterxml/jackson/databind/type/TypeBindings;->addBinding(Ljava/lang/String;Lcom/fasterxml/jackson/databind/JavaType;)V
.line 281
add-int/lit8 v6, v6, 0x1
goto :goto_1
.line 287
:cond_1
move-object p3, v3
.line 288
goto :goto_0
.line 291
:cond_2
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/type/HierarchicType;->isGeneric()Z
move-result v0
if-nez v0, :cond_3
.line 292
const/4 v0, 0x0
return-object v0
.line 294
:cond_3
invoke-virtual {p3}, Lcom/fasterxml/jackson/databind/type/TypeBindings;->typesAsArray()[Lcom/fasterxml/jackson/databind/JavaType;
move-result-object v0
return-object v0
.end method
.method public final moreSpecificType(Lcom/fasterxml/jackson/databind/JavaType;Lcom/fasterxml/jackson/databind/JavaType;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 3
.line 309
if-nez p1, :cond_0
.line 310
return-object p2
.line 312
:cond_0
if-nez p2, :cond_1
.line 313
return-object p1
.line 315
:cond_1
invoke-virtual {p1}, Lcom/fasterxml/jackson/databind/JavaType;->getRawClass()Ljava/lang/Class;
move-result-object v1
.line 316
invoke-virtual {p2}, Lcom/fasterxml/jackson/databind/JavaType;->getRawClass()Ljava/lang/Class;
move-result-object v2
.line 317
if-ne v1, v2, :cond_2
.line 318
return-object p1
.line 321
:cond_2
invoke-virtual {v1, v2}, Ljava/lang/Class;->isAssignableFrom(Ljava/lang/Class;)Z
move-result v0
if-eqz v0, :cond_3
.line 322
return-object p2
.line 324
:cond_3
return-object p1
.end method
.method public final uncheckedSimpleType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/JavaType;
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(Ljava/lang/Class<*>;)Lcom/fasterxml/jackson/databind/JavaType;"
}
.end annotation
.line 533
new-instance v0, Lcom/fasterxml/jackson/databind/type/SimpleType;
invoke-direct {v0, p1}, Lcom/fasterxml/jackson/databind/type/SimpleType;-><init>(Ljava/lang/Class;)V
return-object v0
.end method
.method public final withModifier(Lcom/fasterxml/jackson/databind/type/TypeModifier;)Lcom/fasterxml/jackson/databind/type/TypeFactory;
.locals 4
.line 119
iget-object v0, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_modifiers:[Lcom/fasterxml/jackson/databind/type/TypeModifier;
if-nez v0, :cond_0
.line 120
new-instance v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;
iget-object v1, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_parser:Lcom/fasterxml/jackson/databind/type/TypeParser;
const/4 v2, 0x1
new-array v2, v2, [Lcom/fasterxml/jackson/databind/type/TypeModifier;
const/4 v3, 0x0
aput-object p1, v2, v3
invoke-direct {v0, v1, v2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;-><init>(Lcom/fasterxml/jackson/databind/type/TypeParser;[Lcom/fasterxml/jackson/databind/type/TypeModifier;)V
return-object v0
.line 122
:cond_0
new-instance v0, Lcom/fasterxml/jackson/databind/type/TypeFactory;
iget-object v1, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_parser:Lcom/fasterxml/jackson/databind/type/TypeParser;
iget-object v2, p0, Lcom/fasterxml/jackson/databind/type/TypeFactory;->_modifiers:[Lcom/fasterxml/jackson/databind/type/TypeModifier;
invoke-static {v2, p1}, Lcom/fasterxml/jackson/databind/util/ArrayBuilders;->insertInListNoDup([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;
move-result-object v2
check-cast v2, [Lcom/fasterxml/jackson/databind/type/TypeModifier;
invoke-direct {v0, v1, v2}, Lcom/fasterxml/jackson/databind/type/TypeFactory;-><init>(Lcom/fasterxml/jackson/databind/type/TypeParser;[Lcom/fasterxml/jackson/databind/type/TypeModifier;)V
return-object v0
.end method
| {
"content_hash": "c4a12f7ecbe7451bfddee33ce80fe465",
"timestamp": "",
"source": "github",
"line_count": 3131,
"max_line_length": 310,
"avg_line_length": 29.632066432449697,
"alnum_prop": 0.7182737286856798,
"repo_name": "mmmsplay10/QuizUpWinner",
"id": "d8a1e52e8485a1fa42129b31aebec0e8203786c1",
"size": "92778",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "com.quizup.core/smali/com/fasterxml/jackson/databind/type/TypeFactory.smali",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "6075"
},
{
"name": "Java",
"bytes": "23608889"
},
{
"name": "JavaScript",
"bytes": "6345"
},
{
"name": "Python",
"bytes": "933916"
}
],
"symlink_target": ""
} |
#ifndef _SYS_PARAM_H_
#define _SYS_PARAM_H_
/* from newlib's <sys/param.h> */
#include <sys/config.h>
#include <machine/endian.h>
# define PATHSIZE (1024)
/* end of from newlib's <sys/param.h> */
#include <unistd.h>
#define BSD 199506 /* System version (year & month). */
#define BSD4_3 1
#define BSD4_4 1
#ifndef NULL
#define NULL 0
#endif
#ifndef LOCORE
#include <sys/types.h>
#endif
/*
* Machine-independent constants (some used in following include files).
* Redefined constants are from POSIX 1003.1 limits file.
*
* MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
* MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
*/
#include <sys/syslimits.h>
#define MAXCOMLEN 16 /* max command name remembered */
#define MAXINTERP 32 /* max interpreter file name length */
#define MAXLOGNAME 12 /* max login name length */
#define MAXUPRC CHILD_MAX /* max simultaneous processes */
#define NCARGS ARG_MAX /* max bytes for an exec function */
#define NGROUPS NGROUPS_MAX /* max number groups */
#define NOFILE OPEN_MAX /* max open files per process */
#define NOGROUP 65535 /* marker for empty group set member */
#define MAXHOSTNAMELEN 256 /* max hostname size */
/* More types and definitions used throughout the kernel. */
#if defined(KERNEL) || defined(_KERNEL)
#include <sys/cdefs.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/uio.h>
#include <sys/priority.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#endif
/* Signals. */
#include <sys/signal.h>
/* Machine type dependent parameters. */
#include <machine/param.h>
#include <machine/limits.h>
#define PRIMASK 0x0ff
#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
#define NZERO 0 /* default "nice" */
#define NBPW sizeof(int) /* number of bytes per word (integer) */
#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */
#define NODEV (dev_t)(-1) /* non-existent device */
#define CBLOCK 128 /* Clist block size, must be a power of 2. */
#define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */
/* Data chars/clist. */
#define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE)
#define CROUND (CBLOCK - 1) /* Clist rounding. */
/*
* File system parameters and macros.
*
* The file system is made out of blocks of at most MAXBSIZE units, with
* smaller units (fragments) only in the last direct block. MAXBSIZE
* primarily determines the size of buffers in the buffer pool. It may be
* made larger without any effect on existing file systems; however making
* it smaller make make some file systems unmountable. Also, MAXBSIZE
* must be less than MAXPHYS!!! DFLTBSIZE is the average amount of
* memory allocated by vfs_bio per nbuf. BKVASIZE is the average amount
* of kernel virtual space allocated per nbuf. BKVASIZE should be >=
* DFLTBSIZE. If it is significantly bigger than DFLTBSIZE, then
* kva fragmentation causes fewer performance problems.
*/
#define MAXBSIZE 65536
#define BKVASIZE 8192
#define DFLTBSIZE 4096
#define MAXFRAG 8
/*
* MAXPATHLEN defines the longest permissible path length after expanding
* symbolic links. It is used to allocate a temporary buffer from the buffer
* pool in which to do the name expansion, hence should be a power of two,
* and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the
* maximum number of symbolic links that may be expanded in a path name.
* It should be set high enough to allow all legitimate uses, but halt
* infinite loops reasonably quickly.
*/
#if !defined(__rtems__)
#define MAXPATHLEN PATH_MAX
#endif
#define MAXSYMLINKS 32
/* Bit map related macros. */
#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
/* Macros for counting and rounding. */
#ifndef howmany
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
#define rounddown(x, y) (((x)/(y))*(y))
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#define powerof2(x) ((((x)-1)&(x))==0)
/* Macros for min/max. */
#if !(defined(KERNEL) || defined(_KERNEL))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
/*
* Constants for setting the parameters of the kernel memory allocator.
*
* 2 ** MINBUCKET is the smallest unit of memory that will be
* allocated. It must be at least large enough to hold a pointer.
*
* Units of memory less or equal to MAXALLOCSAVE will permanently
* allocate physical memory; requests for these size pieces of
* memory are quite fast. Allocations greater than MAXALLOCSAVE must
* always allocate and free physical memory; requests for these
* size allocations should be done infrequently as they will be slow.
*
* Constraints: PAGE_SIZE <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and
* MAXALLOCSIZE must be a power of two.
*/
#define MINBUCKET 4 /* 4 => min allocation of 16 bytes */
#define MAXALLOCSAVE (2 * PAGE_SIZE)
/*
* Scale factor for scaled integers used to count %cpu time and load avgs.
*
* The number of CPU `tick's that map to a unique `%age' can be expressed
* by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that
* can be calculated (assuming 32 bits) can be closely approximated using
* the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).
*
* For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',
* FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.
*/
#define FSHIFT 11 /* bits to right of fixed binary point */
#define FSCALE (1<<FSHIFT)
#endif /* _SYS_PARAM_H_ */
| {
"content_hash": "f5e7aadb71b05cf2f31ade43d425cbd1",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 77,
"avg_line_length": 33.160919540229884,
"alnum_prop": 0.6880415944540728,
"repo_name": "Earlz/earlzos",
"id": "bd09185fbbf9142a00462653f1a18a39c378bebe",
"size": "7778",
"binary": false,
"copies": "26",
"ref": "refs/heads/master",
"path": "newlib-2.0.0/newlib/libc/sys/rtems/sys/param.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "1658466"
},
{
"name": "Awk",
"bytes": "570"
},
{
"name": "C",
"bytes": "25437762"
},
{
"name": "C++",
"bytes": "546039"
},
{
"name": "Emacs Lisp",
"bytes": "21698"
},
{
"name": "Logos",
"bytes": "14359"
},
{
"name": "Objective-C",
"bytes": "178668"
},
{
"name": "Perl",
"bytes": "81245"
},
{
"name": "Shell",
"bytes": "313922"
},
{
"name": "SuperCollider",
"bytes": "8638"
}
],
"symlink_target": ""
} |
#include "rpcconsole.h"
#include "ui_rpcconsole.h"
#include "clientmodel.h"
#include "bitcoinrpc.h"
#include "guiutil.h"
#include <QTime>
#include <QThread>
#include <QKeyEvent>
#if QT_VERSION < 0x050000
#include <QUrl>
#endif
#include <QScrollBar>
#include <openssl/crypto.h>
// TODO: add a scrollback limit, as there is currently none
// TODO: make it possible to filter out categories (esp debug messages when implemented)
// TODO: receive errors and debug messages through ClientModel
const int CONSOLE_HISTORY = 50;
const QSize ICON_SIZE(24, 24);
const struct {
const char *url;
const char *source;
} ICON_MAPPING[] = {
{"cmd-request", ":/icons/tx_input"},
{"cmd-reply", ":/icons/tx_output"},
{"cmd-error", ":/icons/tx_output"},
{"misc", ":/icons/tx_inout"},
{NULL, NULL}
};
/* Object for executing console RPC commands in a separate thread.
*/
class RPCExecutor : public QObject
{
Q_OBJECT
public slots:
void request(const QString &command);
signals:
void reply(int category, const QString &command);
};
#include "rpcconsole.moc"
/**
* Split shell command line into a list of arguments. Aims to emulate \c bash and friends.
*
* - Arguments are delimited with whitespace
* - Extra whitespace at the beginning and end and between arguments will be ignored
* - Text can be "double" or 'single' quoted
* - The backslash \c \ is used as escape character
* - Outside quotes, any character can be escaped
* - Within double quotes, only escape \c " and backslashes before a \c " or another backslash
* - Within single quotes, no escaping is possible and no special interpretation takes place
*
* @param[out] args Parsed arguments will be appended to this list
* @param[in] strCommand Command line to split
*/
bool parseCommandLine(std::vector<std::string> &args, const std::string &strCommand)
{
enum CmdParseState
{
STATE_EATING_SPACES,
STATE_ARGUMENT,
STATE_SINGLEQUOTED,
STATE_DOUBLEQUOTED,
STATE_ESCAPE_OUTER,
STATE_ESCAPE_DOUBLEQUOTED
} state = STATE_EATING_SPACES;
std::string curarg;
foreach(char ch, strCommand)
{
switch(state)
{
case STATE_ARGUMENT: // In or after argument
case STATE_EATING_SPACES: // Handle runs of whitespace
switch(ch)
{
case '"': state = STATE_DOUBLEQUOTED; break;
case '\'': state = STATE_SINGLEQUOTED; break;
case '\\': state = STATE_ESCAPE_OUTER; break;
case ' ': case '\n': case '\t':
if(state == STATE_ARGUMENT) // Space ends argument
{
args.push_back(curarg);
curarg.clear();
}
state = STATE_EATING_SPACES;
break;
default: curarg += ch; state = STATE_ARGUMENT;
}
break;
case STATE_SINGLEQUOTED: // Single-quoted string
switch(ch)
{
case '\'': state = STATE_ARGUMENT; break;
default: curarg += ch;
}
break;
case STATE_DOUBLEQUOTED: // Double-quoted string
switch(ch)
{
case '"': state = STATE_ARGUMENT; break;
case '\\': state = STATE_ESCAPE_DOUBLEQUOTED; break;
default: curarg += ch;
}
break;
case STATE_ESCAPE_OUTER: // '\' outside quotes
curarg += ch; state = STATE_ARGUMENT;
break;
case STATE_ESCAPE_DOUBLEQUOTED: // '\' in double-quoted text
if(ch != '"' && ch != '\\') curarg += '\\'; // keep '\' for everything but the quote and '\' itself
curarg += ch; state = STATE_DOUBLEQUOTED;
break;
}
}
switch(state) // final state
{
case STATE_EATING_SPACES:
return true;
case STATE_ARGUMENT:
args.push_back(curarg);
return true;
default: // ERROR to end in one of the other states
return false;
}
}
void RPCExecutor::request(const QString &command)
{
std::vector<std::string> args;
if(!parseCommandLine(args, command.toStdString()))
{
emit reply(RPCConsole::CMD_ERROR, QString("Parse error: unbalanced ' or \""));
return;
}
if(args.empty())
return; // Nothing to do
try
{
std::string strPrint;
// Convert argument list to JSON objects in method-dependent way,
// and pass it along with the method name to the dispatcher.
json_spirit::Value result = tableRPC.execute(
args[0],
RPCConvertValues(args[0], std::vector<std::string>(args.begin() + 1, args.end())));
// Format result reply
if (result.type() == json_spirit::null_type)
strPrint = "";
else if (result.type() == json_spirit::str_type)
strPrint = result.get_str();
else
strPrint = write_string(result, true);
emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint));
}
catch (json_spirit::Object& objError)
{
try // Nice formatting for standard-format error
{
int code = find_value(objError, "code").get_int();
std::string message = find_value(objError, "message").get_str();
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(message) + " (code " + QString::number(code) + ")");
}
catch(std::runtime_error &) // raised when converting to invalid type, i.e. missing code or message
{ // Show raw JSON object
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false)));
}
}
catch (std::exception& e)
{
emit reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what()));
}
}
RPCConsole::RPCConsole(QWidget *parent) :
QDialog(parent),
ui(new Ui::RPCConsole),
clientModel(0),
historyPtr(0)
{
ui->setupUi(this);
#ifndef Q_OS_MAC
ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export"));
ui->showCLOptionsButton->setIcon(QIcon(":/icons/options"));
#endif
// Install event filter for up and down arrow
ui->lineEdit->installEventFilter(this);
ui->messagesWidget->installEventFilter(this);
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
// set OpenSSL version label
ui->openSSLVersion->setText(SSLeay_version(SSLEAY_VERSION));
startExecutor();
clear();
}
RPCConsole::~RPCConsole()
{
emit stopExecutor();
delete ui;
}
bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
{
if(event->type() == QEvent::KeyPress) // Special key handling
{
QKeyEvent *keyevt = static_cast<QKeyEvent*>(event);
int key = keyevt->key();
Qt::KeyboardModifiers mod = keyevt->modifiers();
switch(key)
{
case Qt::Key_Up: if(obj == ui->lineEdit) { browseHistory(-1); return true; } break;
case Qt::Key_Down: if(obj == ui->lineEdit) { browseHistory(1); return true; } break;
case Qt::Key_PageUp: /* pass paging keys to messages widget */
case Qt::Key_PageDown:
if(obj == ui->lineEdit)
{
QApplication::postEvent(ui->messagesWidget, new QKeyEvent(*keyevt));
return true;
}
break;
default:
// Typing in messages widget brings focus to line edit, and redirects key there
// Exclude most combinations and keys that emit no text, except paste shortcuts
if(obj == ui->messagesWidget && (
(!mod && !keyevt->text().isEmpty() && key != Qt::Key_Tab) ||
((mod & Qt::ControlModifier) && key == Qt::Key_V) ||
((mod & Qt::ShiftModifier) && key == Qt::Key_Insert)))
{
ui->lineEdit->setFocus();
QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt));
return true;
}
}
}
return QDialog::eventFilter(obj, event);
}
void RPCConsole::setClientModel(ClientModel *model)
{
this->clientModel = model;
if(model)
{
// Subscribe to information, replies, messages, errors
connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
connect(model, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
// Provide initial values
ui->clientVersion->setText(model->formatFullVersion());
ui->clientName->setText(model->clientName());
ui->buildDate->setText(model->formatBuildDate());
ui->startupTime->setText(model->formatClientStartupTime());
setNumConnections(model->getNumConnections());
ui->isTestNet->setChecked(model->isTestNet());
}
}
static QString categoryClass(int category)
{
switch(category)
{
case RPCConsole::CMD_REQUEST: return "cmd-request"; break;
case RPCConsole::CMD_REPLY: return "cmd-reply"; break;
case RPCConsole::CMD_ERROR: return "cmd-error"; break;
default: return "misc";
}
}
void RPCConsole::clear()
{
ui->messagesWidget->clear();
history.clear();
historyPtr = 0;
ui->lineEdit->clear();
ui->lineEdit->setFocus();
// Add smoothly scaled icon images.
// (when using width/height on an img, Qt uses nearest instead of linear interpolation)
for(int i=0; ICON_MAPPING[i].url; ++i)
{
ui->messagesWidget->document()->addResource(
QTextDocument::ImageResource,
QUrl(ICON_MAPPING[i].url),
QImage(ICON_MAPPING[i].source).scaled(ICON_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
}
// Set default style sheet
ui->messagesWidget->document()->setDefaultStyleSheet(
"table { }"
"td.time { color: #808080; padding-top: 3px; } "
"td.message { font-family: Monospace; font-size: 12px; } "
"td.cmd-request { color: #006060; } "
"td.cmd-error { color: red; } "
"b { color: #006060; } "
);
message(CMD_REPLY, (tr("Welcome to the Cypherfunk RPC console.") + "<br>" +
tr("Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.") + "<br>" +
tr("Type <b>help</b> for an overview of available commands.")), true);
}
void RPCConsole::message(int category, const QString &message, bool html)
{
QTime time = QTime::currentTime();
QString timeString = time.toString();
QString out;
out += "<table><tr><td class=\"time\" width=\"65\">" + timeString + "</td>";
out += "<td class=\"icon\" width=\"32\"><img src=\"" + categoryClass(category) + "\"></td>";
out += "<td class=\"message " + categoryClass(category) + "\" valign=\"middle\">";
if(html)
out += message;
else
out += GUIUtil::HtmlEscape(message, true);
out += "</td></tr></table>";
ui->messagesWidget->append(out);
}
void RPCConsole::setNumConnections(int count)
{
ui->numberOfConnections->setText(QString::number(count));
}
void RPCConsole::setNumBlocks(int count, int countOfPeers)
{
ui->numberOfBlocks->setText(QString::number(count));
// If there is no current countOfPeers available display N/A instead of 0, which can't ever be true
ui->totalBlocks->setText(countOfPeers == 0 ? tr("N/A") : QString::number(countOfPeers));
if(clientModel)
ui->lastBlockTime->setText(clientModel->getLastBlockDate().toString());
}
void RPCConsole::on_lineEdit_returnPressed()
{
QString cmd = ui->lineEdit->text();
ui->lineEdit->clear();
if(!cmd.isEmpty())
{
message(CMD_REQUEST, cmd);
emit cmdRequest(cmd);
// Truncate history from current position
history.erase(history.begin() + historyPtr, history.end());
// Append command to history
history.append(cmd);
// Enforce maximum history size
while(history.size() > CONSOLE_HISTORY)
history.removeFirst();
// Set pointer to end of history
historyPtr = history.size();
// Scroll console view to end
scrollToEnd();
}
}
void RPCConsole::browseHistory(int offset)
{
historyPtr += offset;
if(historyPtr < 0)
historyPtr = 0;
if(historyPtr > history.size())
historyPtr = history.size();
QString cmd;
if(historyPtr < history.size())
cmd = history.at(historyPtr);
ui->lineEdit->setText(cmd);
}
void RPCConsole::startExecutor()
{
QThread *thread = new QThread;
RPCExecutor *executor = new RPCExecutor();
executor->moveToThread(thread);
// Replies from executor object must go to this object
connect(executor, SIGNAL(reply(int,QString)), this, SLOT(message(int,QString)));
// Requests from this object must go to executor
connect(this, SIGNAL(cmdRequest(QString)), executor, SLOT(request(QString)));
// On stopExecutor signal
// - queue executor for deletion (in execution thread)
// - quit the Qt event loop in the execution thread
connect(this, SIGNAL(stopExecutor()), executor, SLOT(deleteLater()));
connect(this, SIGNAL(stopExecutor()), thread, SLOT(quit()));
// Queue the thread for deletion (in this thread) when it is finished
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
// Default implementation of QThread::run() simply spins up an event loop in the thread,
// which is what we want.
thread->start();
}
void RPCConsole::on_tabWidget_currentChanged(int index)
{
if(ui->tabWidget->widget(index) == ui->tab_console)
{
ui->lineEdit->setFocus();
}
}
void RPCConsole::on_openDebugLogfileButton_clicked()
{
GUIUtil::openDebugLogfile();
}
void RPCConsole::scrollToEnd()
{
QScrollBar *scrollbar = ui->messagesWidget->verticalScrollBar();
scrollbar->setValue(scrollbar->maximum());
}
void RPCConsole::on_showCLOptionsButton_clicked()
{
GUIUtil::HelpMessageBox help;
help.exec();
}
| {
"content_hash": "34e844882d548800ed2329601721ab75",
"timestamp": "",
"source": "github",
"line_count": 429,
"max_line_length": 121,
"avg_line_length": 33.0979020979021,
"alnum_prop": 0.6046904711599408,
"repo_name": "sengmangan/DRB",
"id": "21cc584def74fd6fdf3b2bfe15968bb4d092ad9e",
"size": "14199",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/qt/rpcconsole.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "31870"
},
{
"name": "C++",
"bytes": "2591472"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "Groff",
"bytes": "18284"
},
{
"name": "HTML",
"bytes": "50615"
},
{
"name": "Makefile",
"bytes": "18244"
},
{
"name": "NSIS",
"bytes": "5889"
},
{
"name": "Objective-C",
"bytes": "858"
},
{
"name": "Objective-C++",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "69724"
},
{
"name": "QMake",
"bytes": "15148"
},
{
"name": "Shell",
"bytes": "9702"
}
],
"symlink_target": ""
} |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __nsBidiKeyboard
#define __nsBidiKeyboard
#include "nsIBidiKeyboard.h"
#include <windows.h>
class nsBidiKeyboard : public nsIBidiKeyboard
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIBIDIKEYBOARD
nsBidiKeyboard();
virtual ~nsBidiKeyboard();
protected:
nsresult SetupBidiKeyboards();
bool IsRTLLanguage(HKL aLocale);
bool mInitialized;
bool mHaveBidiKeyboards;
PRUnichar mLTRKeyboard[KL_NAMELENGTH];
PRUnichar mRTLKeyboard[KL_NAMELENGTH];
PRUnichar mCurrentLocaleName[KL_NAMELENGTH];
};
#endif // __nsBidiKeyboard
| {
"content_hash": "54996ea59314a21502a2c3b3ceda7e03",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 76,
"avg_line_length": 24.5,
"alnum_prop": 0.7298919567827131,
"repo_name": "sergecodd/FireFox-OS",
"id": "73c583037dddd312ac72002dffe584e39785db43",
"size": "833",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "B2G/gecko/widget/windows/nsBidiKeyboard.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ada",
"bytes": "443"
},
{
"name": "ApacheConf",
"bytes": "85"
},
{
"name": "Assembly",
"bytes": "5123438"
},
{
"name": "Awk",
"bytes": "46481"
},
{
"name": "Batchfile",
"bytes": "56250"
},
{
"name": "C",
"bytes": "101720951"
},
{
"name": "C#",
"bytes": "38531"
},
{
"name": "C++",
"bytes": "148896543"
},
{
"name": "CMake",
"bytes": "23541"
},
{
"name": "CSS",
"bytes": "2758664"
},
{
"name": "DIGITAL Command Language",
"bytes": "56757"
},
{
"name": "Emacs Lisp",
"bytes": "12694"
},
{
"name": "Erlang",
"bytes": "889"
},
{
"name": "FLUX",
"bytes": "34449"
},
{
"name": "GLSL",
"bytes": "26344"
},
{
"name": "Gnuplot",
"bytes": "710"
},
{
"name": "Groff",
"bytes": "447012"
},
{
"name": "HTML",
"bytes": "43343468"
},
{
"name": "IDL",
"bytes": "1455122"
},
{
"name": "Java",
"bytes": "43261012"
},
{
"name": "JavaScript",
"bytes": "46646658"
},
{
"name": "Lex",
"bytes": "38358"
},
{
"name": "Logos",
"bytes": "21054"
},
{
"name": "Makefile",
"bytes": "2733844"
},
{
"name": "Matlab",
"bytes": "67316"
},
{
"name": "Max",
"bytes": "3698"
},
{
"name": "NSIS",
"bytes": "421625"
},
{
"name": "Objective-C",
"bytes": "877657"
},
{
"name": "Objective-C++",
"bytes": "737713"
},
{
"name": "PHP",
"bytes": "17415"
},
{
"name": "Pascal",
"bytes": "6780"
},
{
"name": "Perl",
"bytes": "1153180"
},
{
"name": "Perl6",
"bytes": "1255"
},
{
"name": "PostScript",
"bytes": "1139"
},
{
"name": "PowerShell",
"bytes": "8252"
},
{
"name": "Protocol Buffer",
"bytes": "26553"
},
{
"name": "Python",
"bytes": "8453201"
},
{
"name": "Ragel in Ruby Host",
"bytes": "3481"
},
{
"name": "Ruby",
"bytes": "5116"
},
{
"name": "Scilab",
"bytes": "7"
},
{
"name": "Shell",
"bytes": "3383832"
},
{
"name": "SourcePawn",
"bytes": "23661"
},
{
"name": "TeX",
"bytes": "879606"
},
{
"name": "WebIDL",
"bytes": "1902"
},
{
"name": "XSLT",
"bytes": "13134"
},
{
"name": "Yacc",
"bytes": "112744"
}
],
"symlink_target": ""
} |
<?php
namespace Strident\Router\Tests;
use PHPUnit_Framework_TestCase as TestCase;
use Strident\Router\Route;
/**
* RouteTest
*
* @author Elliot Wright
*/
class RouteTest extends TestCase
{
/**
* @var string
*/
protected $testName;
/**
* @var string
*/
protected $testPath;
/**
* @var Route
*/
protected $testRoute;
/**
* @var string
*/
protected $testTarget;
public function setUp()
{
$this->testName = "test_route";
$this->testPath = "/foo/{bar}";
$this->testTarget = "FooController::barAction";
$this->testRoute = new Route($this->testName, $this->testPath);
}
public function testGetName()
{
$this->assertEquals($this->testName, $this->testRoute->getName());
}
public function testSetName()
{
$newName = "test_route2";
$this->testRoute->setName($newName);
$this->assertEquals($newName, $this->testRoute->getName());
}
public function testGetPath()
{
$this->assertEquals($this->testPath, $this->testRoute->getPath());
}
public function testSetPath()
{
$newPath = "/baz/{qux}";
$this->testRoute->setPath($newPath);
$this->assertEquals($newPath, $this->testRoute->getPath());
}
public function testGetTargets()
{
$targets = $this->testRoute->getTargets();
$this->assertInternalType("array", $targets);
$this->assertEquals([], $targets);
}
public function testGetTargetsForMethod()
{
$this->testRoute->target("GET", $this->testTarget);
$this->assertEquals(
$this->testTarget,
$this->testRoute->getTargetForMethod("GET")
);
}
/**
* @expectedException \RuntimeException
*/
public function testGetTargetsForMethodThrowsIfNoTarget()
{
$this->testRoute->getTargetForMethod("GET");
}
public function testHasTargetsForMethod()
{
$this->assertFalse($this->testRoute->hasTargetForMethod("GET"));
$this->testRoute->target("GET", $this->testTarget);
$this->assertTrue($this->testRoute->hasTargetForMethod("GET"));
}
public function testSetTargets()
{
$newTargets = [
"GET" => $this->testTarget
];
$this->assertEquals([], $this->testRoute->getTargets());
$this->testRoute->setTargets($newTargets);
$this->assertEquals($newTargets, $this->testRoute->getTargets());
}
public function testTarget()
{
$this->testRoute->target("GET", $this->testTarget);
$targets = $this->testRoute->getTargets();
$this->assertEquals($targets, [
"GET" => $this->testTarget
]);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testTargetThrowsIfProvidedInvalidMethod()
{
$this->testRoute->target("FOOBAR", $this->testTarget);
}
}
| {
"content_hash": "6c0ff73bbc22b28aee222428e356b4e6",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 74,
"avg_line_length": 21.60431654676259,
"alnum_prop": 0.5787545787545788,
"repo_name": "strident/Router",
"id": "fd74d139ac881c6fe8019681c4322aaec3e6f826",
"size": "3223",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/RouteTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "18792"
}
],
"symlink_target": ""
} |
<div class="col-md-12">
<h4>Monitor de Perfomance</h4>
<p> </p>
<div class="col-md-4 monitor"><img src="../../../static/img/produtos/modelod/pm5_black.jpg"/></div>
<div class="col-md-8 descricao-monitor"><p>Cada Modelo D inclui um PM5, o monitor de desempenho mais evoluído, dando-lhe dados precisos e comparáveis para cada remada. O braço de monitor ajustável permite posicionar o monitor onde você preferir.
</p></div>
</div>
<p> </p>
<p> </p>
<div class="col-md-12">
<h4>Flywheel e dragagem</h4>
<div class="col-md-9"><p>Nossos remoergômetros respondem ao seu esforço a cada remada, então você está no controle total do seu esforço e resistência em todos os momentos. A entrada de ar em espiral permite facilmente ajustar o fluxo de ar para o flywheel, assim você pode mudar a sensação da remada de acordo com sua preferência. O design do flywheel minimiza o ruído e maximiza a sensação de suavidade.</p></div>
<div class="col-md-3"><img src="../../../static/img/produtos/modelod/flywheel.jpg"/></div>
</div>
<p> </p>
<p> </p>
<h4>Perfil baixo</h4>
<p>Com a sua altura de (35,6 cm) no assento, o Modelo D mantém um perfil baixo.</p>
<img style="margin-left: 160px;" src="../../../static/img/produtos/modelod/profile.jpg"/>
<p> </p>
<p> </p>
<div class="col-md-12">
<h4>Armazenamento e Mobilidade</h4>
<p> </p>
<div class="col-md-3"><img style="width: 80%; margin-left: 35px;" src="../../../static/img/produtos/modelod/apart.jpg"/></div>
<div class="col-md-9"><p>O modelo D apresenta um mecanismo de liberação rápida (sem necessidade de ferramentas!), assim você pode facilmente separar a máquina em duas partes para armazenamento. Rodas no pé da frente permitem rolar a máquina totalmente montada para posição escolhida.</p></div>
</div>
<p> </p>
<p> </p>
<div class="col-md-12">
<h4>Fincapés ajustáveis e punho</h4>
<p> </p>
<div class="col-md-8"><p>Usamos fincapés ajustáveis em nossos ergômetros para dimensionamento rápido e fácil. (Os fincapés acomodam uma ampla gama de tamanhos de sapato.) Nosso punho confortável é ergonômico porque apresenta uma curva de 10 graus que lhe permite remar com uma posição natural do braço e da mão. </p></div>
<div class="col-md-4"><img src="../../../static/img/produtos/modelod/footstretcher.jpg"/></div>
</div>
<p> </p>
<div class="col-md-12">
<h4>Corrente niquelada</h4>
<p> </p>
<p>Corrente niquelada: é bonita e trabalha duro. O níquel permite períodos maiores entre lubrificação, por isso, mesmo que a manutenção não é o seu forte, o Modelo D ainda vai sentir suave e sedoso durante o próximo treino.</p>
</div>
<p> </p>
<div class="col-md-12">
<h4>Trilho de aço inoxidável</h4>
<p> </p>
<p>O trilho de alumínio recebe como capa uma faixa de aço inoxidável para garantir um movimento suave do assento.</p>
</div>
<p> </p>
<div class="col-md-12">
<h4>Construção durável que é fácil de preservar</h4>
<p> </p>
<p>Nossas máquinas são bem conhecidas por sua durabilidade e construção. Resistente e construída para durar, as nossas máquinas suportam o uso rigoroso em clubes de remo, centros de treinamento, salas de estar, hotéis, academias de ginástica e as bases militares ao redor do mundo. Temos certeza de nossas máquinas são fáceis de cuidar para que você possa se concentrar no uso do seu investimento, e não em preservá-la.</p>
</div>
<div class="col-md-12">
<h4>Acessórios Inclusos</h4>
<p>Nós incluímos os seguintes itens com a compra do modelo D com o PM5:</p>
<p><i class="fa fa-check">Manual do usuário</i></p>
<p><i class="fa fa-check">Ferramentas e instruções ilustradas para montagem</i></p>
</div>
<div class="col-md-12">
<h4>Opção para a treinamento de equipe ou simulação na água</h4>
<p>O <a href="">slide Concept2</a> (vendido separadamente) proporciona a sensação de remar sob a água ao remar no Modelo D e permite que você conecte múltiplos Modelo Cs, Ds e/ou Es para treinamento da equipe.</p>
</div>
<div class="col-md-12">
<h4>Garantia</h4>
<p>O Modelo D está coberto pela nossa garantia limitada de cinco anos da estrutura e garantia de dois anos do monitor de performance e partes móveis. <a href="">Veja todos os detalhes da garantia.</a></p>
</div> | {
"content_hash": "d6f387bb6ea3416028ad475e1dab35b0",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 429,
"avg_line_length": 52.964285714285715,
"alnum_prop": 0.6862216228365925,
"repo_name": "Maethorin/concept2",
"id": "3035a9fec3f5398833e3ecbbc72e27dd5a1cc12a",
"size": "4553",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/templates/produtos/modelod/caracteristicas.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "69895"
},
{
"name": "HTML",
"bytes": "261608"
},
{
"name": "JavaScript",
"bytes": "112024"
},
{
"name": "Mako",
"bytes": "423"
},
{
"name": "Python",
"bytes": "98372"
},
{
"name": "Ruby",
"bytes": "2549"
}
],
"symlink_target": ""
} |
<!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_112-google-v7) on Tue Jun 20 10:03:37 CDT 2017 -->
<title>com.apigee.flow.execution</title>
<meta name="date" content="2017-06-20">
<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="com.apigee.flow.execution";
}
}
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 class="navBarCell1Rev">Package</li>
<li>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 Package</li>
<li><a href="../../../../com/apigee/flow/execution/spi/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/apigee/flow/execution/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.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">
<h1 title="Package" class="title">Package com.apigee.flow.execution</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Interface Summary table, listing interfaces, and an explanation">
<caption><span>Interface Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/apigee/flow/execution/Callback.html" title="interface in com.apigee.flow.execution">Callback</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/apigee/flow/execution/ExecutionContext.html" title="interface in com.apigee.flow.execution">ExecutionContext</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/apigee/flow/execution/ExecutionResult.html" title="class in com.apigee.flow.execution">ExecutionResult</a></td>
<td class="colLast">
<div class="block">
Represents a result of the execution.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum Summary table, listing enums, and an explanation">
<caption><span>Enum Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Enum</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/apigee/flow/execution/Action.html" title="enum in com.apigee.flow.execution">Action</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</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 class="navBarCell1Rev">Package</li>
<li>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 Package</li>
<li><a href="../../../../com/apigee/flow/execution/spi/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/apigee/flow/execution/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.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>
| {
"content_hash": "65a39336d7e9ec02239bb5c2a188eeca",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 163,
"avg_line_length": 34.56497175141243,
"alnum_prop": 0.6374632232755802,
"repo_name": "WWitman/api-platform-samples",
"id": "855403ccb0803870aca2787b9bd61f670b9e688f",
"size": "6118",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/javadocs-javacallout/com/apigee/flow/execution/package-summary.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "14651"
},
{
"name": "HTML",
"bytes": "13083"
},
{
"name": "Java",
"bytes": "5713"
},
{
"name": "JavaScript",
"bytes": "90978"
},
{
"name": "Python",
"bytes": "17990"
},
{
"name": "Shell",
"bytes": "117446"
},
{
"name": "XSLT",
"bytes": "6949"
}
],
"symlink_target": ""
} |
set -e
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
if [ -L "${source}" ]; then
echo "Symlinked..."
source="$(readlink "${source}")"
fi
# use filter instead of exclude so missing patterns dont' throw errors
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\""
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1"
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "$BUILT_PRODUCTS_DIR/SPCalendar/SPCalendar.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "$BUILT_PRODUCTS_DIR/SPCalendar/SPCalendar.framework"
fi
| {
"content_hash": "f6ed978a4a21ddd578e635b010471f3b",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 209,
"avg_line_length": 40.077777777777776,
"alnum_prop": 0.6373717771000832,
"repo_name": "sarfraz-akhtar01/SPCalendar",
"id": "94bf854741af4c010c7fe118cfd0f9e569682835",
"size": "3617",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Example/Pods/Target Support Files/Pods-SPCalendar_Example/Pods-SPCalendar_Example-frameworks.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "963"
},
{
"name": "Ruby",
"bytes": "1910"
},
{
"name": "Shell",
"bytes": "17013"
},
{
"name": "Swift",
"bytes": "191140"
}
],
"symlink_target": ""
} |
package main
import (
"math/rand"
"reflect"
"strings"
"testing"
"github.com/mitchellh/cli"
"github.com/mitchellh/packer/command"
)
func TestExcludeHelpFunc(t *testing.T) {
commands := map[string]cli.CommandFactory{
"build": func() (cli.Command, error) {
return &command.BuildCommand{
Meta: command.Meta{},
}, nil
},
"fix": func() (cli.Command, error) {
return &command.FixCommand{
Meta: command.Meta{},
}, nil
},
}
helpFunc := excludeHelpFunc(commands, []string{"fix"})
helpText := helpFunc(commands)
if strings.Contains(helpText, "fix") {
t.Fatalf("Found fix in help text even though we excluded it: \n\n%s\n\n", helpText)
}
}
func TestExtractMachineReadable(t *testing.T) {
var args, expected, result []string
var mr bool
// Not
args = []string{"foo", "bar", "baz"}
result, mr = extractMachineReadable(args)
expected = []string{"foo", "bar", "baz"}
if !reflect.DeepEqual(result, expected) {
t.Fatalf("bad: %#v", result)
}
if mr {
t.Fatal("should not be mr")
}
// Yes
args = []string{"foo", "-machine-readable", "baz"}
result, mr = extractMachineReadable(args)
expected = []string{"foo", "baz"}
if !reflect.DeepEqual(result, expected) {
t.Fatalf("bad: %#v", result)
}
if !mr {
t.Fatal("should be mr")
}
}
func TestRandom(t *testing.T) {
if rand.Intn(9999999) == 8498210 {
t.Fatal("math.rand is not seeded properly")
}
}
| {
"content_hash": "626bb1b96289ad120974f379144ce5bf",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 85,
"avg_line_length": 20.36231884057971,
"alnum_prop": 0.6469750889679715,
"repo_name": "andrewjcasal/koding",
"id": "0bc7ba96ffa283920be66f64417ed9a3d8f52be6",
"size": "1405",
"binary": false,
"copies": "49",
"ref": "refs/heads/master",
"path": "go/src/vendor/github.com/mitchellh/packer/main_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "593895"
},
{
"name": "CoffeeScript",
"bytes": "3988625"
},
{
"name": "Go",
"bytes": "6760994"
},
{
"name": "HTML",
"bytes": "107319"
},
{
"name": "JavaScript",
"bytes": "2204965"
},
{
"name": "Makefile",
"bytes": "5994"
},
{
"name": "PHP",
"bytes": "1570"
},
{
"name": "PLSQL",
"bytes": "370"
},
{
"name": "PLpgSQL",
"bytes": "16704"
},
{
"name": "Perl",
"bytes": "1612"
},
{
"name": "Python",
"bytes": "27895"
},
{
"name": "Ruby",
"bytes": "1763"
},
{
"name": "SQLPL",
"bytes": "6868"
},
{
"name": "Shell",
"bytes": "112388"
}
],
"symlink_target": ""
} |
[react-babylonjs](../README.md) / [Exports](../modules.md) / loaders
# Module: loaders
## Table of contents
### Enumerations
- [LoaderStatus](../enums/loaders.loaderstatus.md)
- [TaskType](../enums/loaders.tasktype.md)
### Classes
- [LoadedModel](../classes/loaders.loadedmodel.md)
### Interfaces
- [ILoadedModel](../interfaces/loaders.iloadedmodel.md)
### Type aliases
- [AssetManagerContextProviderProps](loaders.md#assetmanagercontextproviderprops)
- [AssetManagerContextType](loaders.md#assetmanagercontexttype)
- [AssetManagerOptions](loaders.md#assetmanageroptions)
- [AssetManagerProgressType](loaders.md#assetmanagerprogresstype)
- [BinaryTask](loaders.md#binarytask)
- [MeshTask](loaders.md#meshtask)
- [SceneLoaderContextProviderProps](loaders.md#sceneloadercontextproviderprops)
- [SceneLoaderContextType](loaders.md#sceneloadercontexttype)
- [SceneLoaderOptions](loaders.md#sceneloaderoptions)
- [Task](loaders.md#task)
- [TextureTask](loaders.md#texturetask)
### Variables
- [AssetManagerContext](loaders.md#assetmanagercontext)
- [AssetManagerContextProvider](loaders.md#assetmanagercontextprovider)
- [SceneLoaderContext](loaders.md#sceneloadercontext)
- [SceneLoaderContextProvider](loaders.md#sceneloadercontextprovider)
### Functions
- [useAssetManager](loaders.md#useassetmanager)
- [useSceneLoader](loaders.md#usesceneloader)
## Type aliases
### AssetManagerContextProviderProps
Ƭ **AssetManagerContextProviderProps**: { `children`: React.ReactNode ; `startProgress?`: [*AssetManagerProgressType*](loaders_useassetmanager.md#assetmanagerprogresstype) }
#### Type declaration:
Name | Type |
------ | ------ |
`children` | React.ReactNode |
`startProgress?` | [*AssetManagerProgressType*](loaders_useassetmanager.md#assetmanagerprogresstype) |
Defined in: [loaders/useAssetManager.tsx:48](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useAssetManager.tsx#L48)
___
### AssetManagerContextType
Ƭ **AssetManagerContextType**: { `lastProgress?`: [*AssetManagerProgressType*](loaders_useassetmanager.md#assetmanagerprogresstype) ; `updateProgress`: (`progress`: [*AssetManagerProgressType*](loaders_useassetmanager.md#assetmanagerprogresstype)) => *void* } \| *undefined*
Defined in: [loaders/useAssetManager.tsx:36](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useAssetManager.tsx#L36)
___
### AssetManagerOptions
Ƭ **AssetManagerOptions**: { `reportProgress?`: *boolean* ; `scene?`: Scene ; `useDefaultLoadingScreen?`: *boolean* }
#### Type declaration:
Name | Type |
------ | ------ |
`reportProgress?` | *boolean* |
`scene?` | Scene |
`useDefaultLoadingScreen?` | *boolean* |
Defined in: [loaders/useAssetManager.tsx:61](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useAssetManager.tsx#L61)
___
### AssetManagerProgressType
Ƭ **AssetManagerProgressType**: { `eventData`: IAssetsProgressEvent ; `eventState`: EventState } \| *undefined*
Defined in: [loaders/useAssetManager.tsx:43](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useAssetManager.tsx#L43)
___
### BinaryTask
Ƭ **BinaryTask**: { `name`: *string* ; `taskType`: [*Binary*](../enums/loaders/useassetmanager.tasktype.md#binary) ; `url`: *string* }
#### Type declaration:
Name | Type |
------ | ------ |
`name` | *string* |
`taskType` | [*Binary*](../enums/loaders/useassetmanager.tasktype.md#binary) |
`url` | *string* |
Defined in: [loaders/useAssetManager.tsx:11](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useAssetManager.tsx#L11)
___
### MeshTask
Ƭ **MeshTask**: { `meshesNames?`: *any* ; `name`: *string* ; `rootUrl`: *string* ; `sceneFilename`: *string* ; `taskType`: [*Mesh*](../enums/loaders/useassetmanager.tasktype.md#mesh) }
#### Type declaration:
Name | Type |
------ | ------ |
`meshesNames?` | *any* |
`name` | *string* |
`rootUrl` | *string* |
`sceneFilename` | *string* |
`taskType` | [*Mesh*](../enums/loaders/useassetmanager.tasktype.md#mesh) |
Defined in: [loaders/useAssetManager.tsx:17](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useAssetManager.tsx#L17)
___
### SceneLoaderContextProviderProps
Ƭ **SceneLoaderContextProviderProps**: { `children`: React.ReactNode ; `startProgress?`: ISceneLoaderProgressEvent }
#### Type declaration:
Name | Type |
------ | ------ |
`children` | React.ReactNode |
`startProgress?` | ISceneLoaderProgressEvent |
Defined in: [loaders/useSceneLoader.tsx:14](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useSceneLoader.tsx#L14)
___
### SceneLoaderContextType
Ƭ **SceneLoaderContextType**: { `lastProgress?`: *Nullable*<ISceneLoaderProgressEvent\> ; `updateProgress`: (`progress`: ISceneLoaderProgressEvent) => *void* } \| *undefined*
Defined in: [loaders/useSceneLoader.tsx:7](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useSceneLoader.tsx#L7)
___
### SceneLoaderOptions
Ƭ **SceneLoaderOptions**: { `alwaysSelectAsActiveMesh?`: *boolean* ; `onModelLoaded?`: (`loadedModel`: [*ILoadedModel*](../interfaces/loaders/loadedmodel.iloadedmodel.md)) => *void* ; `receiveShadows?`: *boolean* ; `reportProgress?`: *boolean* ; `scaleToDimension?`: *number* ; `scene?`: Scene }
#### Type declaration:
Name | Type | Description |
------ | ------ | ------ |
`alwaysSelectAsActiveMesh?` | *boolean* | Always select root mesh as active. Defaults to false. |
`onModelLoaded?` | (`loadedModel`: [*ILoadedModel*](../interfaces/loaders/loadedmodel.iloadedmodel.md)) => *void* | Access to loaded model as soon as it is loaded, so it provides a way to hide or scale the meshes before the first render. |
`receiveShadows?` | *boolean* | set that all meshes receive shadows. Defaults to false. |
`reportProgress?` | *boolean* | SceneLoader progress events are set on context provider (when available). Defaults to false. |
`scaleToDimension?` | *number* | Scale entire model within these square bounds Defaults to no scaling. |
`scene?` | Scene | - |
Defined in: [loaders/useSceneLoader.tsx:27](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useSceneLoader.tsx#L27)
___
### Task
Ƭ **Task**: [*BinaryTask*](loaders_useassetmanager.md#binarytask) \| [*MeshTask*](loaders_useassetmanager.md#meshtask) \| [*TextureTask*](loaders_useassetmanager.md#texturetask)
Defined in: [loaders/useAssetManager.tsx:34](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useAssetManager.tsx#L34)
___
### TextureTask
Ƭ **TextureTask**: { `invertY?`: *boolean* ; `name`: *string* ; `noMipmap?`: *boolean* ; `samplingMode?`: *number* ; `taskType`: [*Texture*](../enums/loaders/useassetmanager.tasktype.md#texture) ; `url`: *string* }
#### Type declaration:
Name | Type |
------ | ------ |
`invertY?` | *boolean* |
`name` | *string* |
`noMipmap?` | *boolean* |
`samplingMode?` | *number* |
`taskType` | [*Texture*](../enums/loaders/useassetmanager.tasktype.md#texture) |
`url` | *string* |
Defined in: [loaders/useAssetManager.tsx:25](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useAssetManager.tsx#L25)
## Variables
### AssetManagerContext
• `Const` **AssetManagerContext**: *Context*<[*AssetManagerContextType*](loaders_useassetmanager.md#assetmanagercontexttype)\>
Defined in: [loaders/useAssetManager.tsx:41](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useAssetManager.tsx#L41)
___
### AssetManagerContextProvider
• `Const` **AssetManagerContextProvider**: *React.FC*<[*AssetManagerContextProviderProps*](loaders_useassetmanager.md#assetmanagercontextproviderprops)\>
Defined in: [loaders/useAssetManager.tsx:53](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useAssetManager.tsx#L53)
___
### SceneLoaderContext
• `Const` **SceneLoaderContext**: *Context*<[*SceneLoaderContextType*](loaders_usesceneloader.md#sceneloadercontexttype)\>
Defined in: [loaders/useSceneLoader.tsx:12](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useSceneLoader.tsx#L12)
___
### SceneLoaderContextProvider
• `Const` **SceneLoaderContextProvider**: *React.FC*<[*SceneLoaderContextProviderProps*](loaders_usesceneloader.md#sceneloadercontextproviderprops)\>
Defined in: [loaders/useSceneLoader.tsx:19](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useSceneLoader.tsx#L19)
## Functions
### useAssetManager
▸ `Const`**useAssetManager**(`tasks`: [*Task*](loaders_useassetmanager.md#task)[], `options?`: [*AssetManagerOptions*](loaders_useassetmanager.md#assetmanageroptions)): AssetManagerResult
#### Parameters:
Name | Type |
------ | ------ |
`tasks` | [*Task*](loaders_useassetmanager.md#task)[] |
`options?` | [*AssetManagerOptions*](loaders_useassetmanager.md#assetmanageroptions) |
**Returns:** AssetManagerResult
Defined in: [loaders/useAssetManager.tsx:249](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useAssetManager.tsx#L249)
___
### useSceneLoader
▸ `Const`**useSceneLoader**(`rootUrl`: *string*, `sceneFilename`: *string*, `pluginExtension?`: *string*, `options?`: [*SceneLoaderOptions*](loaders_usesceneloader.md#sceneloaderoptions)): [*LoadedModel*](../classes/loaders/loadedmodel.loadedmodel.md)
#### Parameters:
Name | Type |
------ | ------ |
`rootUrl` | *string* |
`sceneFilename` | *string* |
`pluginExtension?` | *string* |
`options?` | [*SceneLoaderOptions*](loaders_usesceneloader.md#sceneloaderoptions) |
**Returns:** [*LoadedModel*](../classes/loaders/loadedmodel.loadedmodel.md)
Defined in: [loaders/useSceneLoader.tsx:202](https://github.com/brianzinn/react-babylonjs/blob/eba7b00/src/hooks/loaders/useSceneLoader.tsx#L202)
| {
"content_hash": "efc4b738c896959586b0276690520833",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 296,
"avg_line_length": 37.48091603053435,
"alnum_prop": 0.7344195519348269,
"repo_name": "brianzinn/react-babylonJS",
"id": "dec1387e403e9efd81620c5642b04ed3df2913ea",
"size": "9843",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/hooks/modules/loaders.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1014"
},
{
"name": "TypeScript",
"bytes": "24537"
}
],
"symlink_target": ""
} |
require 'rack/test'
require_relative '../app.rb'
Bundler.require :test
module RSpecMixin
include Rack::Test::Methods
def app() WishyWishyApp end
end
RSpec.configure do |config|
config.include RSpecMixin
config.include FactoryGirl::Syntax::Methods
config.before :suite do
if ENV['RACK_ENV'] == 'localtest' && `ps -eaf | grep mongo` !~ /mongod/
$stderr.puts "\e[0;31mERROR: mongod is not running. Please start it!\e[0m"
exit
end
DatabaseCleaner[:mongoid].strategy = :truncation
DatabaseCleaner[:mongoid].clean_with :truncation
end
config.before :each do
DatabaseCleaner.start
@user = User.create(events: [], fbid: '1')
@user.groups << Group.new(name: 'General')
token = generate_token(1)
@request_headers = {'HTTP_AUTHORIZATION' => token}
end
config.after :each do
DatabaseCleaner.clean
end
def generate_token(fbid, expires = 9999999999)
JWT.encode({
:expires => expires,
:fbid => fbid.to_s
}, app().settings.token_secret)
end
end
FactoryGirl.find_definitions
| {
"content_hash": "ace3f9f95f31aab7bc1dc57911f7aa0d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 80,
"avg_line_length": 23.755555555555556,
"alnum_prop": 0.6716557530402245,
"repo_name": "miguelfrde/wishywishy",
"id": "4b52c877e863642189e62bd9ff4dc7759ee39a8e",
"size": "1069",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "spec/spec_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "833"
},
{
"name": "HTML",
"bytes": "410"
},
{
"name": "Ruby",
"bytes": "39404"
}
],
"symlink_target": ""
} |
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/")
public class app extends HttpServlet
{
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
response.addHeader("X-Reply", request.getHeader("X-Header"));
}
}
| {
"content_hash": "cb8b8110f4c78d1ec64777408a2206a2",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 79,
"avg_line_length": 29.4,
"alnum_prop": 0.7806122448979592,
"repo_name": "nginx/unit",
"id": "c981835d119ac2f1fdc5aa5e48ecb9a0acaa18b1",
"size": "589",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/java/get_header/app.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2948852"
},
{
"name": "C++",
"bytes": "49444"
},
{
"name": "Dockerfile",
"bytes": "3409"
},
{
"name": "Go",
"bytes": "19213"
},
{
"name": "HTML",
"bytes": "847"
},
{
"name": "Java",
"bytes": "780057"
},
{
"name": "JavaScript",
"bytes": "87653"
},
{
"name": "Makefile",
"bytes": "32267"
},
{
"name": "PHP",
"bytes": "7022"
},
{
"name": "Perl",
"bytes": "9359"
},
{
"name": "Python",
"bytes": "706893"
},
{
"name": "Raku",
"bytes": "1497"
},
{
"name": "Roff",
"bytes": "6774"
},
{
"name": "Ruby",
"bytes": "9880"
},
{
"name": "Shell",
"bytes": "14683"
}
],
"symlink_target": ""
} |
package cmdexec
import (
"testing"
rex "github.com/heketi/heketi/pkg/remoteexec"
"github.com/heketi/tests"
)
func TestSshExecPeerProbe(t *testing.T) {
f := NewCommandFaker()
s, err := NewFakeExecutor(f)
tests.Assert(t, err == nil)
tests.Assert(t, s != nil)
// Mock ssh function
f.FakeConnectAndExec = func(host string,
commands []string,
timeoutMinutes int,
useSudo bool) (rex.Results, error) {
tests.Assert(t, host == "host:22", host)
tests.Assert(t, len(commands) == 1)
tests.Assert(t, commands[0] == "gluster --mode=script --timeout=42 peer probe newnode", commands)
return nil, nil
}
// Call function
err = s.PeerProbe("host", "newnode")
tests.Assert(t, err == nil, err)
s, err = NewFakeExecutor(f)
tests.Assert(t, err == nil)
tests.Assert(t, s != nil)
// set the snapshot limit > 0 to trigger settings probe from gluster
s.snapShotLimit = 14
// Mock ssh function
count := 0
f.FakeConnectAndExec = func(host string,
commands []string,
timeoutMinutes int,
useSudo bool) (rex.Results, error) {
switch count {
case 0:
tests.Assert(t, host == "host:22", host)
tests.Assert(t, len(commands) == 1)
tests.Assert(t, commands[0] == "gluster --mode=script --timeout=42 peer probe newnode", commands)
case 1:
tests.Assert(t, host == "host:22", host)
tests.Assert(t, len(commands) == 1)
tests.Assert(t, commands[0] == "gluster --mode=script --timeout=42 snapshot config snap-max-hard-limit 14", commands)
default:
tests.Assert(t, false, "Should not be reached")
}
count++
return nil, nil
}
// Call function
err = s.PeerProbe("host", "newnode")
tests.Assert(t, err == nil, err)
tests.Assert(t, count == 2, "expected count == 2, got:", count)
}
func TestSshExecGlusterdCheck(t *testing.T) {
f := NewCommandFaker()
s, err := NewFakeExecutor(f)
tests.Assert(t, err == nil)
tests.Assert(t, s != nil)
// Mock ssh function
f.FakeConnectAndExec = func(host string,
commands []string,
timeoutMinutes int,
useSudo bool) (rex.Results, error) {
tests.Assert(t, host == "newhost:22", host)
tests.Assert(t, len(commands) == 1)
tests.Assert(t, commands[0] == "systemctl status glusterd", commands)
return nil, nil
}
// Call function
err = s.GlusterdCheck("newhost")
tests.Assert(t, err == nil, err)
}
| {
"content_hash": "424fb2ef9b43fe16176ff33ca00d05aa",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 120,
"avg_line_length": 24.5,
"alnum_prop": 0.667390360399479,
"repo_name": "pecameron/origin",
"id": "a77623f412ff9cc3e02fefc878ed9e3ad7b4cd91",
"size": "2618",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "vendor/github.com/heketi/heketi/executors/cmdexec/peer_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "921"
},
{
"name": "Dockerfile",
"bytes": "2240"
},
{
"name": "Go",
"bytes": "2260347"
},
{
"name": "Makefile",
"bytes": "6395"
},
{
"name": "Python",
"bytes": "14593"
},
{
"name": "Shell",
"bytes": "310150"
}
],
"symlink_target": ""
} |
class AddIndexesToPage < ActiveRecord::Migration[6.0]
def change
add_index :pages,:ocr
add_index :pages,:status
add_index :pages, :backup
add_index :pages, :document_id
end
end
| {
"content_hash": "1cf8fb2d4157b277dd5c95f0ae02f850",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 53,
"avg_line_length": 23.625,
"alnum_prop": 0.7195767195767195,
"repo_name": "happychriss/DocumentBox-Server",
"id": "179385e2611a436b59e319b934053dc5cef71a87",
"size": "189",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/migrate/20200525193622_add_indexes_to_page.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "526"
},
{
"name": "HTML",
"bytes": "37046"
},
{
"name": "JavaScript",
"bytes": "42666"
},
{
"name": "Ruby",
"bytes": "108474"
},
{
"name": "SCSS",
"bytes": "11043"
},
{
"name": "Shell",
"bytes": "136"
}
],
"symlink_target": ""
} |
namespace sh
{
namespace
{
constexpr const ImmutableString kEmulatedGLDrawIDName("angle_DrawID");
class FindGLDrawIDTraverser : public TIntermTraverser
{
public:
FindGLDrawIDTraverser() : TIntermTraverser(true, false, false), mVariable(nullptr) {}
const TVariable *getGLDrawIDBuiltinVariable() { return mVariable; }
protected:
void visitSymbol(TIntermSymbol *node) override
{
if (&node->variable() == BuiltInVariable::gl_DrawID())
{
mVariable = &node->variable();
}
}
private:
const TVariable *mVariable;
};
class AddBaseVertexToGLVertexIDTraverser : public TIntermTraverser
{
public:
AddBaseVertexToGLVertexIDTraverser() : TIntermTraverser(true, false, false) {}
protected:
void visitSymbol(TIntermSymbol *node) override
{
if (&node->variable() == BuiltInVariable::gl_VertexID())
{
TIntermSymbol *baseVertexRef = new TIntermSymbol(BuiltInVariable::gl_BaseVertex());
TIntermBinary *addBaseVertex = new TIntermBinary(EOpAdd, node, baseVertexRef);
queueReplacement(addBaseVertex, OriginalNode::BECOMES_CHILD);
}
}
};
constexpr const ImmutableString kEmulatedGLBaseVertexName("angle_BaseVertex");
class FindGLBaseVertexTraverser : public TIntermTraverser
{
public:
FindGLBaseVertexTraverser() : TIntermTraverser(true, false, false), mVariable(nullptr) {}
const TVariable *getGLBaseVertexBuiltinVariable() { return mVariable; }
protected:
void visitSymbol(TIntermSymbol *node) override
{
if (&node->variable() == BuiltInVariable::gl_BaseVertex())
{
mVariable = &node->variable();
}
}
private:
const TVariable *mVariable;
};
constexpr const ImmutableString kEmulatedGLBaseInstanceName("angle_BaseInstance");
class FindGLBaseInstanceTraverser : public TIntermTraverser
{
public:
FindGLBaseInstanceTraverser() : TIntermTraverser(true, false, false), mVariable(nullptr) {}
const TVariable *getGLBaseInstanceBuiltinVariable() { return mVariable; }
protected:
void visitSymbol(TIntermSymbol *node) override
{
if (&node->variable() == BuiltInVariable::gl_BaseInstance())
{
mVariable = &node->variable();
}
}
private:
const TVariable *mVariable;
};
} // namespace
bool EmulateGLDrawID(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable,
std::vector<sh::ShaderVariable> *uniforms,
bool shouldCollect)
{
FindGLDrawIDTraverser traverser;
root->traverse(&traverser);
const TVariable *builtInVariable = traverser.getGLDrawIDBuiltinVariable();
if (builtInVariable)
{
const TType *type = StaticType::Get<EbtInt, EbpHigh, EvqUniform, 1, 1>();
const TVariable *drawID =
new TVariable(symbolTable, kEmulatedGLDrawIDName, type, SymbolType::AngleInternal);
const TIntermSymbol *drawIDSymbol = new TIntermSymbol(drawID);
// AngleInternal variables don't get collected
if (shouldCollect)
{
ShaderVariable uniform;
uniform.name = kEmulatedGLDrawIDName.data();
uniform.mappedName = kEmulatedGLDrawIDName.data();
uniform.type = GLVariableType(*type);
uniform.precision = GLVariablePrecision(*type);
uniform.staticUse = symbolTable->isStaticallyUsed(*builtInVariable);
uniform.active = true;
uniform.binding = type->getLayoutQualifier().binding;
uniform.location = type->getLayoutQualifier().location;
uniform.offset = type->getLayoutQualifier().offset;
uniform.readonly = type->getMemoryQualifier().readonly;
uniform.writeonly = type->getMemoryQualifier().writeonly;
uniforms->push_back(uniform);
}
DeclareGlobalVariable(root, drawID);
if (!ReplaceVariableWithTyped(compiler, root, builtInVariable, drawIDSymbol))
{
return false;
}
}
return true;
}
bool EmulateGLBaseVertexBaseInstance(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable *symbolTable,
std::vector<sh::ShaderVariable> *uniforms,
bool shouldCollect,
bool addBaseVertexToVertexID)
{
bool addBaseVertex = false, addBaseInstance = false;
ShaderVariable uniformBaseVertex, uniformBaseInstance;
if (addBaseVertexToVertexID)
{
// This is a workaround for Mac AMD GPU
// Replace gl_VertexID with (gl_VertexID + gl_BaseVertex)
AddBaseVertexToGLVertexIDTraverser traverserVertexID;
root->traverse(&traverserVertexID);
if (!traverserVertexID.updateTree(compiler, root))
{
return false;
}
}
FindGLBaseVertexTraverser traverserBaseVertex;
root->traverse(&traverserBaseVertex);
const TVariable *builtInVariableBaseVertex =
traverserBaseVertex.getGLBaseVertexBuiltinVariable();
if (builtInVariableBaseVertex)
{
const TType *type = StaticType::Get<EbtInt, EbpHigh, EvqUniform, 1, 1>();
const TVariable *baseVertex =
new TVariable(symbolTable, kEmulatedGLBaseVertexName, type, SymbolType::AngleInternal);
const TIntermSymbol *baseVertexSymbol = new TIntermSymbol(baseVertex);
// AngleInternal variables don't get collected
if (shouldCollect)
{
uniformBaseVertex.name = kEmulatedGLBaseVertexName.data();
uniformBaseVertex.mappedName = kEmulatedGLBaseVertexName.data();
uniformBaseVertex.type = GLVariableType(*type);
uniformBaseVertex.precision = GLVariablePrecision(*type);
uniformBaseVertex.staticUse = symbolTable->isStaticallyUsed(*builtInVariableBaseVertex);
uniformBaseVertex.active = true;
uniformBaseVertex.binding = type->getLayoutQualifier().binding;
uniformBaseVertex.location = type->getLayoutQualifier().location;
uniformBaseVertex.offset = type->getLayoutQualifier().offset;
uniformBaseVertex.readonly = type->getMemoryQualifier().readonly;
uniformBaseVertex.writeonly = type->getMemoryQualifier().writeonly;
addBaseVertex = true;
}
DeclareGlobalVariable(root, baseVertex);
if (!ReplaceVariableWithTyped(compiler, root, builtInVariableBaseVertex, baseVertexSymbol))
{
return false;
}
}
FindGLBaseInstanceTraverser traverserInstance;
root->traverse(&traverserInstance);
const TVariable *builtInVariableBaseInstance =
traverserInstance.getGLBaseInstanceBuiltinVariable();
if (builtInVariableBaseInstance)
{
const TType *type = StaticType::Get<EbtInt, EbpHigh, EvqUniform, 1, 1>();
const TVariable *baseInstance = new TVariable(symbolTable, kEmulatedGLBaseInstanceName,
type, SymbolType::AngleInternal);
const TIntermSymbol *baseInstanceSymbol = new TIntermSymbol(baseInstance);
// AngleInternal variables don't get collected
if (shouldCollect)
{
uniformBaseInstance.name = kEmulatedGLBaseInstanceName.data();
uniformBaseInstance.mappedName = kEmulatedGLBaseInstanceName.data();
uniformBaseInstance.type = GLVariableType(*type);
uniformBaseInstance.precision = GLVariablePrecision(*type);
uniformBaseInstance.staticUse =
symbolTable->isStaticallyUsed(*builtInVariableBaseInstance);
uniformBaseInstance.active = true;
uniformBaseInstance.binding = type->getLayoutQualifier().binding;
uniformBaseInstance.location = type->getLayoutQualifier().location;
uniformBaseInstance.offset = type->getLayoutQualifier().offset;
uniformBaseInstance.readonly = type->getMemoryQualifier().readonly;
uniformBaseInstance.writeonly = type->getMemoryQualifier().writeonly;
addBaseInstance = true;
}
DeclareGlobalVariable(root, baseInstance);
if (!ReplaceVariableWithTyped(compiler, root, builtInVariableBaseInstance,
baseInstanceSymbol))
{
return false;
}
}
// Make sure the order in uniforms is the same as the traverse order
if (addBaseInstance)
{
uniforms->push_back(uniformBaseInstance);
}
if (addBaseVertex)
{
uniforms->push_back(uniformBaseVertex);
}
return true;
}
} // namespace sh
| {
"content_hash": "5b525cb37dcdeb27d349e2e240978475",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 100,
"avg_line_length": 36.1336032388664,
"alnum_prop": 0.6460504201680672,
"repo_name": "youtube/cobalt",
"id": "dd5a4865be963b0455177607eef5a6f31c27c47e",
"size": "9839",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "third_party/angle/src/compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
using System.Diagnostics;
using System.Runtime.InteropServices;
using JetBrains.Annotations;
namespace IX.StandardExtensions.Debugging;
/// <summary>
/// A debug view for a key/value pair. This class cannot be inherited.
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <typeparam name="TValue">The type of the value.</typeparam>
[ComVisible(false)]
[DebuggerDisplay("[{" + nameof(Key) + "}] = \"{" + nameof(Value) + "}\"")]
[PublicAPI]
public sealed class KyeValuePairDebugView<TKey, TValue>
{
#region Properties and indexers
/// <summary>
/// Gets the key.
/// </summary>
/// <value>The key.</value>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public TKey? Key { get; internal set; }
/// <summary>
/// Gets the value.
/// </summary>
/// <value>The value.</value>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public TValue? Value { get; internal set; }
#endregion
} | {
"content_hash": "1675925264332d74f1c95fc54758b6c8",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 74,
"avg_line_length": 28.58823529411765,
"alnum_prop": 0.661522633744856,
"repo_name": "adimosh/IX.StandardExtensions",
"id": "417032f0e5094186e64cfd50c7b2f060e954232c",
"size": "1150",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/IX.StandardExtensions/StandardExtensions/Debugging/KyeValuePairDebugView{TKey,TValue}.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Berry",
"bytes": "1080"
},
{
"name": "C#",
"bytes": "6260245"
},
{
"name": "Vim Snippet",
"bytes": "1732"
}
],
"symlink_target": ""
} |
#include "stdafx.h"
// cameras/realistic.cpp*
#include "cameras/realistic.h"
#include "paramset.h"
#include "sampler.h"
#include "sampling.h"
#include "floatfile.h"
#include "imageio.h"
#include "reflection.h"
#include "stats.h"
#include "lowdiscrepancy.h"
STAT_PERCENT("Camera/Rays vignetted by lens system", vignettedRays, totalRays);
// RealisticCamera Method Definitions
RealisticCamera::RealisticCamera(const AnimatedTransform &CameraToWorld,
Float shutterOpen, Float shutterClose,
Float apertureDiameter, Float focusDistance,
bool simpleWeighting, std::vector<Float> &lensData,
Film *film, const Medium *medium)
: Camera(CameraToWorld, shutterOpen, shutterClose, film, medium),
simpleWeighting(simpleWeighting) {
for (int i = 0; i < (int)lensData.size(); i += 4) {
if (lensData[i] == 0) {
if (apertureDiameter > lensData[i + 3]) {
Warning(
"Specified aperture diameter %f is greater than maximum "
"possible %f. Clamping it.",
apertureDiameter, lensData[i + 3]);
} else {
lensData[i + 3] = apertureDiameter;
}
}
elementInterfaces.push_back(LensElementInterface({
lensData[i] * (Float).001, lensData[i + 1] * (Float).001,
lensData[i + 2], lensData[i + 3] * Float(.001) / Float(2.)}));
}
// Compute lens--film distance for given focus distance
Float fb = FocusBinarySearch(focusDistance);
Info("Binary search focus: %f -> %f\n", fb, FocusDistance(fb));
elementInterfaces.back().thickness = FocusThickLens(focusDistance);
Info("Thick lens focus: %f -> %f\n", elementInterfaces.back().thickness,
FocusDistance(elementInterfaces.back().thickness));
// Compute exit pupil bounds at sampled points on the film
int nSamples = 64;
exitPupilBounds.resize(nSamples);
ParallelFor([&](int i) {
Float r0 = (Float)i / nSamples * film->diagonal / 2;
Float r1 = (Float)(i + 1) / nSamples * film->diagonal / 2;
exitPupilBounds[i] = BoundExitPupil(r0, r1);
}, nSamples);
}
bool RealisticCamera::TraceLensesFromFilm(const Ray &rCamera, Ray *rOut) const {
Float elementZ = 0;
// Transform _rCamera_ from camera to lens system space
static const Transform CameraToLens = Scale(1, 1, -1);
Ray rLens = CameraToLens(rCamera);
for (int i = elementInterfaces.size() - 1; i >= 0; --i) {
const LensElementInterface &element = elementInterfaces[i];
// Update ray from film accounting for interaction with _element_
elementZ -= element.thickness;
// Compute intersection of ray with lens element
Float t;
Normal3f n;
bool isStop = (element.curvatureRadius == 0);
if (isStop)
t = (elementZ - rLens.o.z) / rLens.d.z;
else {
Float radius = element.curvatureRadius;
Float zCenter = elementZ + element.curvatureRadius;
if (!IntersectSphericalElement(radius, zCenter, rLens, &t, &n))
return false;
}
Assert(t >= 0);
// Test intersection point against element aperture
Point3f pHit = rLens(t);
Float r2 = pHit.x * pHit.x + pHit.y * pHit.y;
if (r2 > element.apertureRadius * element.apertureRadius) return false;
rLens.o = pHit;
// Update ray path for element interface interaction
if (!isStop) {
Vector3f w;
Float etaI = element.eta;
Float etaT = (i > 0 && elementInterfaces[i - 1].eta != 0)
? elementInterfaces[i - 1].eta
: 1;
if (!Refract(Normalize(-rLens.d), n, etaI / etaT, &w)) return false;
rLens.d = w;
}
}
// Transform _rLens_ from lens system space back to camera space
if (rOut != nullptr) {
static const Transform LensToCamera = Scale(1, 1, -1);
*rOut = LensToCamera(rLens);
}
return true;
}
bool RealisticCamera::IntersectSphericalElement(Float radius, Float zCenter,
const Ray &ray, Float *t,
Normal3f *n) {
// Compute _t0_ and _t1_ for ray--element intersection
Point3f o = ray.o - Vector3f(0, 0, zCenter);
Float A = ray.d.x * ray.d.x + ray.d.y * ray.d.y + ray.d.z * ray.d.z;
Float B = 2 * (ray.d.x * o.x + ray.d.y * o.y + ray.d.z * o.z);
Float C = o.x * o.x + o.y * o.y + o.z * o.z - radius * radius;
Float t0, t1;
if (!Quadratic(A, B, C, &t0, &t1)) return false;
// Select intersection $t$ based on ray direction and element curvature
bool useCloserT = (ray.d.z > 0) ^ (radius < 0);
*t = useCloserT ? std::min(t0, t1) : std::max(t0, t1);
if (*t < 0) return false;
// Compute surface normal of element at ray intersection point
*n = Normal3f(Vector3f(o + *t * ray.d));
*n = Faceforward(Normalize(*n), -ray.d);
return true;
}
bool RealisticCamera::TraceLensesFromScene(const Ray &rCamera,
Ray *rOut) const {
Float elementZ = -LensFrontZ();
// Transform _rCamera_ from camera to lens system space
static const Transform CameraToLens = Scale(1, 1, -1);
Ray rLens = CameraToLens(rCamera);
for (size_t i = 0; i < elementInterfaces.size(); ++i) {
const LensElementInterface &element = elementInterfaces[i];
// Compute intersection of ray with lens element
Float t;
Normal3f n;
bool isStop = (element.curvatureRadius == 0);
if (isStop)
t = (elementZ - rLens.o.z) / rLens.d.z;
else {
Float radius = element.curvatureRadius;
Float zCenter = elementZ + element.curvatureRadius;
if (!IntersectSphericalElement(radius, zCenter, rLens, &t, &n))
return false;
}
Assert(t >= 0);
// Test intersection point against element aperture
Point3f pHit = rLens(t);
Float r2 = pHit.x * pHit.x + pHit.y * pHit.y;
if (r2 > element.apertureRadius * element.apertureRadius) return false;
rLens.o = pHit;
// Update ray path for from-scene element interface interaction
if (!isStop) {
Vector3f wt;
Float etaI = (i == 0 || elementInterfaces[i - 1].eta == 0)
? 1
: elementInterfaces[i - 1].eta;
Float etaT =
(elementInterfaces[i].eta != 0) ? elementInterfaces[i].eta : 1;
if (!Refract(Normalize(-rLens.d), n, etaI / etaT, &wt))
return false;
rLens.d = wt;
}
elementZ += element.thickness;
}
// Transform _rLens_ from lens system space back to camera space
if (rOut != nullptr) {
static const Transform LensToCamera = Scale(1, 1, -1);
*rOut = LensToCamera(rLens);
}
return true;
}
void RealisticCamera::DrawLensSystem() const {
Float sumz = -LensFrontZ();
Float z = sumz;
for (size_t i = 0; i < elementInterfaces.size(); ++i) {
const LensElementInterface &element = elementInterfaces[i];
Float r = element.curvatureRadius;
if (r == 0) {
// stop
printf("{Thick, Line[{{%f, %f}, {%f, %f}}], ", z,
element.apertureRadius, z, 2 * element.apertureRadius);
printf("Line[{{%f, %f}, {%f, %f}}]}, ", z, -element.apertureRadius,
z, -2 * element.apertureRadius);
} else {
Float theta = std::abs(std::asin(element.apertureRadius / r));
if (r > 0) {
// convex as seen from front of lens
Float t0 = Pi - theta;
Float t1 = Pi + theta;
printf("Circle[{%f, 0}, %f, {%f, %f}], ", z + r, r, t0, t1);
} else {
// concave as seen from front of lens
Float t0 = -theta;
Float t1 = theta;
printf("Circle[{%f, 0}, %f, {%f, %f}], ", z + r, -r, t0, t1);
}
if (element.eta != 0 && element.eta != 1) {
// connect top/bottom to next element
Assert(i + 1 < elementInterfaces.size());
Float nextApertureRadius =
elementInterfaces[i + 1].apertureRadius;
Float h = std::max(element.apertureRadius, nextApertureRadius);
Float hlow =
std::min(element.apertureRadius, nextApertureRadius);
Float zp0, zp1;
if (r > 0) {
zp0 = z + element.curvatureRadius -
element.apertureRadius / std::tan(theta);
} else {
zp0 = z + element.curvatureRadius +
element.apertureRadius / std::tan(theta);
}
Float nextCurvatureRadius =
elementInterfaces[i + 1].curvatureRadius;
Float nextTheta = std::abs(
std::asin(nextApertureRadius / nextCurvatureRadius));
if (nextCurvatureRadius > 0) {
zp1 = z + element.thickness + nextCurvatureRadius -
nextApertureRadius / std::tan(nextTheta);
} else {
zp1 = z + element.thickness + nextCurvatureRadius +
nextApertureRadius / std::tan(nextTheta);
}
// Connect tops
printf("Line[{{%f, %f}, {%f, %f}}], ", zp0, h, zp1, h);
printf("Line[{{%f, %f}, {%f, %f}}], ", zp0, -h, zp1, -h);
// vertical lines when needed to close up the element profile
if (element.apertureRadius < nextApertureRadius) {
printf("Line[{{%f, %f}, {%f, %f}}], ", zp0, h, zp0, hlow);
printf("Line[{{%f, %f}, {%f, %f}}], ", zp0, -h, zp0, -hlow);
} else if (element.apertureRadius > nextApertureRadius) {
printf("Line[{{%f, %f}, {%f, %f}}], ", zp1, h, zp1, hlow);
printf("Line[{{%f, %f}, {%f, %f}}], ", zp1, -h, zp1, -hlow);
}
}
}
z += element.thickness;
}
// 24mm height for 35mm film
printf("Line[{{0, -.012}, {0, .012}}], ");
// optical axis
printf("Line[{{0, 0}, {%f, 0}}] ", 1.2f * sumz);
}
void RealisticCamera::DrawRayPathFromFilm(const Ray &r, bool arrow,
bool toOpticalIntercept) const {
Float elementZ = 0;
// Transform _ray_ from camera to lens system space
static const Transform CameraToLens = Scale(1, 1, -1);
Ray ray = CameraToLens(r);
printf("{ ");
if (!TraceLensesFromFilm(r, nullptr)) printf("Dashed, ");
for (int i = elementInterfaces.size() - 1; i >= 0; --i) {
const LensElementInterface &element = elementInterfaces[i];
elementZ -= element.thickness;
bool isStop = (element.curvatureRadius == 0);
// Compute intersection of ray with lens element
Float t;
Normal3f n;
if (isStop)
t = -(ray.o.z - elementZ) / ray.d.z;
else {
Float radius = element.curvatureRadius;
Float zCenter = elementZ + element.curvatureRadius;
if (!IntersectSphericalElement(radius, zCenter, ray, &t, &n))
goto done;
}
Assert(t >= 0);
printf("Line[{{%f, %f}, {%f, %f}}],", ray.o.z, ray.o.x, ray(t).z,
ray(t).x);
// Test intersection point against element aperture
Point3f pHit = ray(t);
Float r2 = pHit.x * pHit.x + pHit.y * pHit.y;
Float apertureRadius2 = element.apertureRadius * element.apertureRadius;
if (r2 > apertureRadius2) goto done;
ray.o = pHit;
// Update ray path for element interface interaction
if (!isStop) {
Vector3f wt;
Float etaI = element.eta;
Float etaT = (i > 0 && elementInterfaces[i - 1].eta != 0)
? elementInterfaces[i - 1].eta
: 1;
if (!Refract(Normalize(-ray.d), n, etaI / etaT, &wt)) goto done;
ray.d = wt;
}
}
ray.d = Normalize(ray.d);
{
Float ta = std::abs(elementZ / 4);
if (toOpticalIntercept) {
ta = -ray.o.x / ray.d.x;
printf("Point[{%f, %f}], ", ray(ta).z, ray(ta).x);
}
printf("%s[{{%f, %f}, {%f, %f}}]", arrow ? "Arrow" : "Line", ray.o.z,
ray.o.x, ray(ta).z, ray(ta).x);
// overdraw the optical axis if needed...
if (toOpticalIntercept)
printf(", Line[{{%f, 0}, {%f, 0}}]", ray.o.z, ray(ta).z * 1.05f);
}
done:
printf("}");
}
void RealisticCamera::DrawRayPathFromScene(const Ray &r, bool arrow,
bool toOpticalIntercept) const {
Float elementZ = LensFrontZ() * -1;
// Transform _ray_ from camera to lens system space
static const Transform CameraToLens = Scale(1, 1, -1);
Ray ray = CameraToLens(r);
for (size_t i = 0; i < elementInterfaces.size(); ++i) {
const LensElementInterface &element = elementInterfaces[i];
bool isStop = (element.curvatureRadius == 0);
// Compute intersection of ray with lens element
Float t;
Normal3f n;
if (isStop)
t = -(ray.o.z - elementZ) / ray.d.z;
else {
Float radius = element.curvatureRadius;
Float zCenter = elementZ + element.curvatureRadius;
if (!IntersectSphericalElement(radius, zCenter, ray, &t, &n))
return;
}
Assert(t >= 0.f);
printf("Line[{{%f, %f}, {%f, %f}}],", ray.o.z, ray.o.x, ray(t).z,
ray(t).x);
// Test intersection point against element aperture
Point3f pHit = ray(t);
Float r2 = pHit.x * pHit.x + pHit.y * pHit.y;
Float apertureRadius2 = element.apertureRadius * element.apertureRadius;
if (r2 > apertureRadius2) return;
ray.o = pHit;
// Update ray path for from-scene element interface interaction
if (!isStop) {
Vector3f wt;
Float etaI = (i == 0 || elementInterfaces[i - 1].eta == 0.f)
? 1.f
: elementInterfaces[i - 1].eta;
Float etaT = (elementInterfaces[i].eta != 0.f)
? elementInterfaces[i].eta
: 1.f;
if (!Refract(Normalize(-ray.d), n, etaI / etaT, &wt)) return;
ray.d = wt;
}
elementZ += element.thickness;
}
// go to the film plane by default
{
Float ta = -ray.o.z / ray.d.z;
if (toOpticalIntercept) {
ta = -ray.o.x / ray.d.x;
printf("Point[{%f, %f}], ", ray(ta).z, ray(ta).x);
}
printf("%s[{{%f, %f}, {%f, %f}}]", arrow ? "Arrow" : "Line", ray.o.z,
ray.o.x, ray(ta).z, ray(ta).x);
}
}
void RealisticCamera::ComputeCardinalPoints(const Ray &rIn, const Ray &rOut,
Float *pz, Float *fz) {
Float tf = -rOut.o.x / rOut.d.x;
*fz = -rOut(tf).z;
Float tp = (rIn.o.x - rOut.o.x) / rOut.d.x;
*pz = -rOut(tp).z;
}
void RealisticCamera::ComputeThickLensApproximation(Float pz[2],
Float fz[2]) const {
// Find height $x$ from optical axis for parallel rays
Float x = .001 * film->diagonal;
// Compute cardinal points for film side of lens system
Ray rScene(Point3f(x, 0, LensFrontZ() + 1), Vector3f(0, 0, -1));
Ray rFilm;
bool ok = TraceLensesFromScene(rScene, &rFilm);
if (!ok)
Severe(
"Unable to trace ray from scene to film for thick lens "
"approximation. Is aperture stop extremely small?");
ComputeCardinalPoints(rScene, rFilm, &pz[0], &fz[0]);
// Compute cardinal points for scene side of lens system
rFilm = Ray(Point3f(x, 0, LensRearZ() - 1), Vector3f(0, 0, 1));
ok = TraceLensesFromFilm(rFilm, &rScene);
if (!ok)
Severe(
"Unable to trace ray from film to scene for thick lens "
"approximation. Is aperture stop extremely small?");
ComputeCardinalPoints(rFilm, rScene, &pz[1], &fz[1]);
}
Float RealisticCamera::FocusThickLens(Float focusDistance) {
Float pz[2], fz[2];
ComputeThickLensApproximation(pz, fz);
Info("Cardinal points: p' = %f f' = %f, p = %f f = %f.\n", pz[0], fz[0],
pz[1], fz[1]);
Info("Effective focal length %f\n", fz[0] - pz[0]);
// Compute translation of lens, _delta_, to focus at _focusDistance_
Float f = fz[0] - pz[0];
Float z = -focusDistance;
Float delta =
0.5f * (pz[1] - z + pz[0] -
std::sqrt((pz[1] - z - pz[0]) * (pz[1] - z - 4 * f - pz[0])));
return elementInterfaces.back().thickness + delta;
}
Float RealisticCamera::FocusBinarySearch(Float focusDistance) {
Float filmDistanceLower, filmDistanceUpper;
// Find _filmDistanceLower_, _filmDistanceUpper_ that bound focus distance
filmDistanceLower = filmDistanceUpper = FocusThickLens(focusDistance);
while (FocusDistance(filmDistanceLower) > focusDistance)
filmDistanceLower *= 1.005f;
while (FocusDistance(filmDistanceUpper) < focusDistance)
filmDistanceUpper /= 1.005f;
// Do binary search on film distances to focus
for (int i = 0; i < 20; ++i) {
Float fmid = 0.5f * (filmDistanceLower + filmDistanceUpper);
Float midFocus = FocusDistance(fmid);
if (midFocus < focusDistance)
filmDistanceLower = fmid;
else
filmDistanceUpper = fmid;
}
return 0.5f * (filmDistanceLower + filmDistanceUpper);
}
Float RealisticCamera::FocusDistance(Float filmDistance) {
// Find offset ray from film center through lens
Bounds2f bounds = BoundExitPupil(0, .001 * film->diagonal);
Float lu = 0.1f * bounds.pMax[0];
Ray ray;
if (!TraceLensesFromFilm(Ray(Point3f(0, 0, LensRearZ() - filmDistance),
Vector3f(lu, 0, filmDistance)),
&ray)) {
Error(
"Focus ray at lens pos(%f,0) didn't make it through the lenses "
"with film distance %f?!??\n",
lu, filmDistance);
return Infinity;
}
// Compute distance _zFocus_ where ray intersects the principal axis
Float tFocus = -ray.o.x / ray.d.x;
Float zFocus = ray(tFocus).z;
if (zFocus < 0) zFocus = Infinity;
return zFocus;
}
Bounds2f RealisticCamera::BoundExitPupil(Float pFilmX0, Float pFilmX1) const {
Bounds2f pupilBounds;
// Sample a collection of points on the rear lens to find exit pupil
const int nSamples = 1024 * 1024;
int nExitingRays = 0;
// Compute bounding box of projection of rear element on sampling plane
Float rearRadius = RearElementRadius();
Bounds2f projRearBounds(Point2f(-1.5f * rearRadius, -1.5f * rearRadius),
Point2f(1.5f * rearRadius, 1.5f * rearRadius));
for (int i = 0; i < nSamples; ++i) {
// Find location of sample points on $x$ segment and rear lens element
Point3f pFilm(Lerp((i + 0.5f) / nSamples, pFilmX0, pFilmX1), 0, 0);
Float u[2] = {RadicalInverse(0, i), RadicalInverse(1, i)};
Point3f pRear(Lerp(u[0], projRearBounds.pMin.x, projRearBounds.pMax.x),
Lerp(u[1], projRearBounds.pMin.y, projRearBounds.pMax.y),
LensRearZ());
// Expand pupil bounds if ray makes it through the lens system
if (Inside(Point2f(pRear.x, pRear.y), pupilBounds) ||
TraceLensesFromFilm(Ray(pFilm, pRear - pFilm), nullptr)) {
pupilBounds = Union(pupilBounds, Point2f(pRear.x, pRear.y));
++nExitingRays;
}
}
// Return entire element bounds if no rays made it through the lens system
if (nExitingRays == 0) {
Info("Unable to find exit pupil in x = [%f,%f] on film.", pFilmX0,
pFilmX1);
return projRearBounds;
}
// Expand bounds to account for sample spacing
pupilBounds = Expand(pupilBounds, 2 * projRearBounds.Diagonal().Length() /
std::sqrt(nSamples));
return pupilBounds;
}
void RealisticCamera::RenderExitPupil(Float sx, Float sy,
const char *filename) const {
Point3f pFilm(sx, sy, 0);
const int nSamples = 2048;
Float *image = new Float[3 * nSamples * nSamples];
Float *imagep = image;
for (int y = 0; y < nSamples; ++y) {
Float fy = (Float)y / (Float)(nSamples - 1);
Float ly = Lerp(fy, -RearElementRadius(), RearElementRadius());
for (int x = 0; x < nSamples; ++x) {
Float fx = (Float)x / (Float)(nSamples - 1);
Float lx = Lerp(fx, -RearElementRadius(), RearElementRadius());
Point3f pRear(lx, ly, LensRearZ());
if (lx * lx + ly * ly > RearElementRadius() * RearElementRadius()) {
*imagep++ = 1;
*imagep++ = 1;
*imagep++ = 1;
} else if (TraceLensesFromFilm(Ray(pFilm, pRear - pFilm),
nullptr)) {
*imagep++ = 0.5f;
*imagep++ = 0.5f;
*imagep++ = 0.5f;
} else {
*imagep++ = 0.f;
*imagep++ = 0.f;
*imagep++ = 0.f;
}
}
}
WriteImage(filename, image,
Bounds2i(Point2i(0, 0), Point2i(nSamples, nSamples)),
Point2i(nSamples, nSamples));
delete[] image;
}
Point3f RealisticCamera::SampleExitPupil(const Point2f &pFilm,
const Point2f &lensSample,
Float *sampleBoundsArea) const {
// Find exit pupil bound for sample distance from film center
Float rFilm = std::sqrt(pFilm.x * pFilm.x + pFilm.y * pFilm.y);
int rIndex = rFilm / (film->diagonal / 2) * exitPupilBounds.size();
rIndex = std::min((int)exitPupilBounds.size() - 1, rIndex);
Bounds2f pupilBounds = exitPupilBounds[rIndex];
if (sampleBoundsArea) *sampleBoundsArea = pupilBounds.Area();
// Generate sample point inside exit pupil bound
Point2f pLens = pupilBounds.Lerp(lensSample);
// Return sample point rotated by angle of _pFilm_ with $+x$ axis
Float sinTheta = (rFilm != 0) ? pFilm.y / rFilm : 0;
Float cosTheta = (rFilm != 0) ? pFilm.x / rFilm : 1;
return Point3f(cosTheta * pLens.x - sinTheta * pLens.y,
sinTheta * pLens.x + cosTheta * pLens.y, LensRearZ());
}
void RealisticCamera::TestExitPupilBounds() const {
Float filmDiagonal = film->diagonal;
static RNG rng;
Float u = rng.UniformFloat();
Point3f pFilm(u * filmDiagonal / 2, 0, 0);
Float r = pFilm.x / (filmDiagonal / 2);
int pupilIndex =
std::min((int)exitPupilBounds.size() - 1,
(int)std::floor(r * (exitPupilBounds.size() - 1)));
Bounds2f pupilBounds = exitPupilBounds[pupilIndex];
if (pupilIndex + 1 < (int)exitPupilBounds.size())
pupilBounds = Union(pupilBounds, exitPupilBounds[pupilIndex + 1]);
// Now, randomly pick points on the aperture and see if any are outside
// of pupil bounds...
for (int i = 0; i < 1000; ++i) {
Point2f pd = ConcentricSampleDisk(
Point2f(rng.UniformFloat(), rng.UniformFloat()));
pd *= RearElementRadius();
Ray testRay(pFilm, Point3f(pd.x, pd.y, 0.f) - pFilm);
Ray testOut;
if (!TraceLensesFromFilm(testRay, &testOut)) continue;
if (!Inside(pd, pupilBounds)) {
fprintf(stderr,
"Aha! (%f,%f) went through, but outside bounds (%f,%f) - "
"(%f,%f)\n",
pd.x, pd.y, pupilBounds.pMin[0], pupilBounds.pMin[1],
pupilBounds.pMax[0], pupilBounds.pMax[1]);
RenderExitPupil(
(Float)pupilIndex / exitPupilBounds.size() * filmDiagonal / 2.f,
0.f, "low.exr");
RenderExitPupil((Float)(pupilIndex + 1) / exitPupilBounds.size() *
filmDiagonal / 2.f,
0.f, "high.exr");
RenderExitPupil(pFilm.x, 0.f, "mid.exr");
exit(0);
}
}
fprintf(stderr, ".");
}
Float RealisticCamera::GenerateRay(const CameraSample &sample, Ray *ray) const {
ProfilePhase prof(Prof::GenerateCameraRay);
++totalRays;
// Find point on film, _pFilm_, corresponding to _sample.pFilm_
Point2f s(sample.pFilm.x / film->fullResolution.x,
sample.pFilm.y / film->fullResolution.y);
Point2f pFilm2 = film->GetPhysicalExtent().Lerp(s);
Point3f pFilm(-pFilm2.x, pFilm2.y, 0);
// Trace ray from _pFilm_ through lens system
Float exitPupilBoundsArea;
Point3f pRear = SampleExitPupil(Point2f(pFilm.x, pFilm.y), sample.pLens,
&exitPupilBoundsArea);
Ray rFilm(pFilm, pRear - pFilm, Infinity,
Lerp(sample.time, shutterOpen, shutterClose));
if (!TraceLensesFromFilm(rFilm, ray)) {
++vignettedRays;
return 0;
}
// Finish initialization of _RealisticCamera_ ray
*ray = CameraToWorld(*ray);
ray->d = Normalize(ray->d);
ray->medium = medium;
// Return weighting for _RealisticCamera_ ray
Float cosTheta = Normalize(rFilm.d).z;
Float cos4Theta = (cosTheta * cosTheta) * (cosTheta * cosTheta);
if (simpleWeighting)
return cos4Theta;
else
return (shutterClose - shutterOpen) *
(cos4Theta * exitPupilBoundsArea) / (LensRearZ() * LensRearZ());
}
RealisticCamera *CreateRealisticCamera(const ParamSet ¶ms,
const AnimatedTransform &cam2world,
Film *film, const Medium *medium) {
Float shutteropen = params.FindOneFloat("shutteropen", 0.f);
Float shutterclose = params.FindOneFloat("shutterclose", 1.f);
if (shutterclose < shutteropen) {
Warning("Shutter close time [%f] < shutter open [%f]. Swapping them.",
shutterclose, shutteropen);
std::swap(shutterclose, shutteropen);
}
// Realistic camera-specific parameters
std::string lensFile = params.FindOneFilename("lensfile", "");
Float apertureDiameter = params.FindOneFloat("aperturediameter", 1.0);
Float focusDistance = params.FindOneFloat("focusdistance", 10.0);
bool simpleWeighting = params.FindOneBool("simpleweighting", true);
if (lensFile == "") {
Error("No lens description file supplied!");
return nullptr;
}
// Load element data from lens description file
std::vector<Float> lensData;
if (!ReadFloatFile(lensFile.c_str(), &lensData)) {
Error("Error reading lens specification file \"%s\".", lensFile.c_str());
return nullptr;
}
if (lensData.size() % 4 != 0) {
Error("Excess values in lens specification file \"%s\"; "
"must be multiple-of-four values, read %d.",
lensFile.c_str(), (int)lensData.size());
return nullptr;
}
return new RealisticCamera(cam2world, shutteropen, shutterclose,
apertureDiameter, focusDistance, simpleWeighting,
lensData, film, medium);
}
| {
"content_hash": "ef4fbd6ab759e22aacee463bbbdf8b7d",
"timestamp": "",
"source": "github",
"line_count": 692,
"max_line_length": 84,
"avg_line_length": 40.34537572254335,
"alnum_prop": 0.5513091443103263,
"repo_name": "Vertexwahn/pbrt-v3",
"id": "88f29aa55ce191c39728c6303ffac13a29c45772",
"size": "29392",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/cameras/realistic.cpp",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "61891"
},
{
"name": "C++",
"bytes": "5156720"
},
{
"name": "CMake",
"bytes": "6384"
},
{
"name": "LLVM",
"bytes": "6486"
},
{
"name": "Python",
"bytes": "69066"
},
{
"name": "Yacc",
"bytes": "19957"
}
],
"symlink_target": ""
} |
<!--
@license Apache-2.0
Copyright (c) 2018 The Stdlib 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.
-->
# Logarithm of Cumulative Distribution Function
> Evaluate the natural logarithm of the [cumulative distribution function][cdf] for a [discrete uniform][discrete-uniform-distribution] distribution.
<section class="intro">
The [cumulative distribution function][cdf] for a [discrete uniform][discrete-uniform-distribution] random variable is
<!-- <equation class="equation" label="eq:discrete_uniform_cdf" align="center" raw="F(x)= \begin{cases} 0 & \text{for }x < a \\ \frac{\lfloor x \rfloor - a + 1}{b-a+1} & \text{for }a \le x < b \\ 1 & \text{for }x \ge b \end{cases}" alt="Cumulative distribution function for a discrete uniform distribution."> -->
<div class="equation" align="center" data-raw-text="F(x)= \begin{cases} 0 & \text{for }x < a \\ \frac{\lfloor x \rfloor - a + 1}{b-a+1} & \text{for }a \le x < b \\ 1 & \text{for }x \ge b \end{cases}" data-equation="eq:discrete_uniform_cdf">
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@591cf9d5c3a0cd3c1ceec961e5c49d73a68374cb/lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/logcdf/docs/img/equation_discrete_uniform_cdf.svg" alt="Cumulative distribution function for a discrete uniform distribution.">
<br>
</div>
<!-- </equation> -->
where `a` is the minimum support and `b` is the maximum support. The parameters must satisfy `a <= b`.
</section>
<!-- /.intro -->
<section class="usage">
## Usage
```javascript
var logcdf = require( '@stdlib/stats/base/dists/discrete-uniform/logcdf' );
```
#### logcdf( x, a, b )
Evaluates the natural logarithm of the [cumulative distribution function][cdf] (CDF) for a [discrete uniform][discrete-uniform-distribution] distribution with parameters `a` (minimum support) and `b` (maximum support).
```javascript
var y = logcdf( 9.0, 0, 10 );
// returns ~-0.095
y = logcdf( 0.5, -2, 2 );
// returns ~-0.511
y = logcdf( -Infinity, 2, 4 );
// returns -Infinity
y = logcdf( Infinity, 2, 4 );
// returns 0.0
```
If `a` or `b` is not an integer value, the function returns `NaN`.
```javascript
var y = logcdf( 2.0, 1, 5.5 );
// returns NaN
```
If provided `a > b`, the function returns `NaN`.
```javascript
var y = logcdf( 0.5, 3, 2);
// returns NaN
```
If provided `NaN` for any parameter, the function returns `NaN`.
```javascript
var y = logcdf( NaN, 0, 1 );
// returns NaN
y = logcdf( 0.0, NaN, 1 );
// returns NaN
y = logcdf( 0.0, 0, NaN );
// returns NaN
```
#### logcdf.factory( a, b )
Returns a function for evaluating the natural logarithm of the [cumulative distribution function][cdf] of a [discrete uniform][discrete-uniform-distribution] distribution with parameters `a` (minimum support) and `b` (maximum support).
```javascript
var myLogCDF = logcdf.factory( 0, 10 );
var y = myLogCDF( 0.5 );
// returns ~-2.398
y = myLogCDF( 8.0 );
// returns ~-0.201
```
</section>
<!-- /.usage -->
<section class="examples">
## Examples
<!-- eslint no-undef: "error" -->
```javascript
var randint = require( '@stdlib/random/base/discrete-uniform' );
var randu = require( '@stdlib/random/base/randu' );
var logcdf = require( '@stdlib/stats/base/dists/discrete-uniform/logcdf' );
var randa = randint.factory( 0, 10 );
var randb = randint.factory();
var a;
var b;
var x;
var v;
var i;
for ( i = 0; i < 10; i++ ) {
x = randu() * 15.0;
a = randa();
b = randb( a, a+randa() );
v = logcdf( x, a, b );
console.log( 'x: %d, a: %d, b: %d, ln(F(x;a,b)): %d', x.toFixed( 4 ), a.toFixed( 4 ), b.toFixed( 4 ), v.toFixed( 4 ) );
}
```
</section>
<!-- /.examples -->
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
<section class="related">
</section>
<!-- /.related -->
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
<section class="links">
[cdf]: https://en.wikipedia.org/wiki/Cumulative_distribution_function
[discrete-uniform-distribution]: https://en.wikipedia.org/wiki/Discrete_uniform_distribution
</section>
<!-- /.links -->
| {
"content_hash": "41b356fcce92cfe15a793eb91764fbbe",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 312,
"avg_line_length": 28.48780487804878,
"alnum_prop": 0.6772260273972602,
"repo_name": "stdlib-js/stdlib",
"id": "eb9741cafbef91769040df06b8b817a6e03f703b",
"size": "4672",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/logcdf/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "21739"
},
{
"name": "C",
"bytes": "15336495"
},
{
"name": "C++",
"bytes": "1349482"
},
{
"name": "CSS",
"bytes": "58039"
},
{
"name": "Fortran",
"bytes": "198059"
},
{
"name": "HTML",
"bytes": "56181"
},
{
"name": "Handlebars",
"bytes": "16114"
},
{
"name": "JavaScript",
"bytes": "85975525"
},
{
"name": "Julia",
"bytes": "1508654"
},
{
"name": "Makefile",
"bytes": "4806816"
},
{
"name": "Python",
"bytes": "3343697"
},
{
"name": "R",
"bytes": "576612"
},
{
"name": "Shell",
"bytes": "559315"
},
{
"name": "TypeScript",
"bytes": "19309407"
},
{
"name": "WebAssembly",
"bytes": "5980"
}
],
"symlink_target": ""
} |
#ifndef __itkLabelImageToLabelMapFilter_h
#define __itkLabelImageToLabelMapFilter_h
#include "itkImageToImageFilter.h"
#include "itkLabelMap.h"
#include "itkLabelObject.h"
namespace itk
{
/** \class LabelImageToLabelMapFilter
* \brief convert a labeled image to a label collection image
*
* LabelImageToLabelMapFilter converts a label image to a label collection image.
* The labels are the same in the input and the output image.
*
* \author Gaetan Lehmann. Biologie du Developpement et de la Reproduction, INRA de Jouy-en-Josas, France.
*
* This implementation was taken from the Insight Journal paper:
* http://hdl.handle.net/1926/584 or
* http://www.insight-journal.org/browse/publication/176
*
* \sa BinaryImageToLabelMapFilter, LabelMapToLabelImageFilter
* \ingroup ImageEnhancement MathematicalMorphologyImageFilters
* \ingroup ITKLabelMap
*
* \wiki
* \wikiexample{ImageSegmentation/LabelImageToLabelMapFilter,Convert an itk::Image consisting of labeled regions to a LabelMap}
* \endwiki
*/
template< class TInputImage, class TOutputImage =
LabelMap< LabelObject< typename TInputImage::PixelType,
::itk::GetImageDimension< TInputImage >::ImageDimension > > >
class ITK_EXPORT LabelImageToLabelMapFilter:
public ImageToImageFilter< TInputImage, TOutputImage >
{
public:
/** Standard class typedefs. */
typedef LabelImageToLabelMapFilter Self;
typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Some convenient typedefs. */
typedef TInputImage InputImageType;
typedef TOutputImage OutputImageType;
typedef typename InputImageType::Pointer InputImagePointer;
typedef typename InputImageType::ConstPointer InputImageConstPointer;
typedef typename InputImageType::RegionType InputImageRegionType;
typedef typename InputImageType::PixelType InputImagePixelType;
typedef typename InputImageType::IndexType IndexType;
typedef typename OutputImageType::Pointer OutputImagePointer;
typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef typename OutputImageType::PixelType OutputImagePixelType;
typedef typename OutputImageType::LabelObjectType LabelObjectType;
typedef typename LabelObjectType::LengthType LengthType;
/** ImageDimension constants */
itkStaticConstMacro(InputImageDimension, unsigned int,
TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int,
TOutputImage::ImageDimension);
/** Standard New method. */
itkNewMacro(Self);
/** Runtime information support. */
itkTypeMacro(LabelImageToLabelMapFilter,
ImageToImageFilter);
/**
* Set/Get the value used as "background" in the output image.
* Defaults to NumericTraits<PixelType>::NonpositiveMin().
*/
itkSetMacro(BackgroundValue, OutputImagePixelType);
itkGetConstMacro(BackgroundValue, OutputImagePixelType);
#ifdef ITK_USE_CONCEPT_CHECKING
itkConceptMacro( SameDimensionCheck,
( Concept::SameDimension< InputImageDimension, OutputImageDimension > ) );
#endif
protected:
LabelImageToLabelMapFilter();
~LabelImageToLabelMapFilter() {}
void PrintSelf(std::ostream & os, Indent indent) const;
/** LabelImageToLabelMapFilter needs the entire input be
* available. Thus, it needs to provide an implementation of
* GenerateInputRequestedRegion(). */
void GenerateInputRequestedRegion();
/** LabelImageToLabelMapFilter will produce the entire output. */
void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
virtual void BeforeThreadedGenerateData();
virtual void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId);
virtual void AfterThreadedGenerateData();
private:
LabelImageToLabelMapFilter(const Self &); //purposely not implemented
void operator=(const Self &); //purposely not implemented
OutputImagePixelType m_BackgroundValue;
typename std::vector< OutputImagePointer > m_TemporaryImages;
}; // end of class
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkLabelImageToLabelMapFilter.hxx"
#endif
#endif
| {
"content_hash": "1a525fc23c8bfda5bc446b5f8f143382",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 127,
"avg_line_length": 38.64102564102564,
"alnum_prop": 0.7438619774386198,
"repo_name": "CapeDrew/DCMTK-ITK",
"id": "b867ccc71a76cfe6d2685297145187a0a71217d8",
"size": "5296",
"binary": false,
"copies": "4",
"ref": "refs/heads/AddDCMTK",
"path": "Modules/Filtering/LabelMap/include/itkLabelImageToLabelMapFilter.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "27077612"
},
{
"name": "C#",
"bytes": "1714"
},
{
"name": "C++",
"bytes": "38101837"
},
{
"name": "FORTRAN",
"bytes": "2241251"
},
{
"name": "Io",
"bytes": "1833"
},
{
"name": "Java",
"bytes": "60450"
},
{
"name": "Objective-C",
"bytes": "6591"
},
{
"name": "Perl",
"bytes": "17899"
},
{
"name": "Prolog",
"bytes": "4406"
},
{
"name": "Python",
"bytes": "934200"
},
{
"name": "Ruby",
"bytes": "296"
},
{
"name": "Rust",
"bytes": "895"
},
{
"name": "Shell",
"bytes": "215658"
},
{
"name": "Tcl",
"bytes": "130560"
}
],
"symlink_target": ""
} |
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__slice = [].slice;
(function($) {
$.FormCheck.Validations = {};
$.FormCheck.findValidator = function(kind) {
var k, validator, _ref;
_ref = $.FormCheck.Validations;
for (k in _ref) {
validator = _ref[k];
if (validator.kind === kind) {
return validator;
}
}
return null;
};
$.FormCheck.Validator = (function() {
function Validator(options) {
this.options = options;
}
Validator.prototype.kind = function() {};
Validator.prototype.validate = function(form) {};
return Validator;
})();
$.FormCheck.EachValidator = (function(_super) {
__extends(EachValidator, _super);
function EachValidator(options) {
this.attributes = Array.wrap(deleteObjectProperty(options, "attributes"));
if (options["allowNil"]) {
options["allowBlank"] = true;
}
if (options["allowBlank"]) {
options["allowNil"] = true;
}
EachValidator.__super__.constructor.call(this, options);
this.checkValitity();
}
EachValidator.prototype.validate = function(form) {
var attribute, value, _i, _len, _ref, _results;
_ref = this.attributes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
attribute = _ref[_i];
value = form.field(attribute).value();
if (isBlank(value) && this.options["allowBlank"]) {
continue;
}
_results.push(this.validateEach(form, attribute, value));
}
return _results;
};
EachValidator.prototype.validateEach = function(record, attribute, value) {};
EachValidator.prototype.checkValitity = function() {};
return EachValidator;
})($.FormCheck.Validator);
$.FormCheck.prototype.validatesWith = function() {
var options, validator, validatorKlass, validators, _i, _j, _len, _results;
validators = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), options = arguments[_i++];
_results = [];
for (_j = 0, _len = validators.length; _j < _len; _j++) {
validatorKlass = validators[_j];
validator = new validatorKlass(options);
_results.push(this.validate(function(form) {
return validator.validate(form);
}));
}
return _results;
};
$.FormCheck.prototype.attributesForWith = function(attributes) {
var options;
options = attributes.extractOptions();
return $.extend(options, {
attributes: attributes
});
};
$.FormCheck.Validator.create = function(name, object, base) {
var className, validator;
if (object == null) {
object = {};
}
if (base == null) {
base = $.FormCheck.EachValidator;
}
object = $.extend({
initializer: function() {
return base.prototype.constructor.apply(this, arguments);
},
baseClass: base
}, object || {});
className = name.camelize() + "Validator";
validator = (function(_super) {
__extends(validator, _super);
function validator() {
this.initializer.apply(this, arguments);
}
return validator;
})(base);
$.extend(validator.prototype, object);
validator.kind = name;
$.FormCheck.Validations[className] = validator;
$.FormCheck.prototype["validates" + (name.camelize()) + "Of"] = function() {
var attributes;
attributes = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return this.validatesWith(validator, this.attributesForWith(attributes));
};
return validator;
};
$.FormCheck.Validations.BlockValidator = (function(_super) {
__extends(BlockValidator, _super);
function BlockValidator(options) {
this.callback = deleteObjectProperty(options, 'callback') || $.noop;
BlockValidator.__super__.constructor.call(this, options);
}
BlockValidator.prototype.validateEach = function(form, attribute, value) {
return this.callback.call(this, form, attribute, value);
};
return BlockValidator;
})($.FormCheck.EachValidator);
$.FormCheck.prototype.validatesEach = function() {
var attributes, options;
attributes = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
options = this.attributesForWith(attributes);
if ($.isFunction(options.attributes[options.attributes.length - 1])) {
options.callback = attributes.pop();
}
return this.validatesWith($.FormCheck.Validations.BlockValidator, options);
};
$.FormCheck.Validator.create("acceptance", {
initializer: function(options) {
return this.baseClass.prototype.constructor.call(this, $.extend({
accept: '1'
}, options));
},
validateEach: function(form, attribute, value) {
if (value !== this.options.accept) {
return form.errors.add(attribute, ":accepted", objectWithoutProperties(this.options, ['accept', 'allowNil']));
}
}
});
$.FormCheck.Validator.create("confirmation", {
validateEach: function(form, attribute, value) {
var confirmed, confirmedFieldName;
confirmedFieldName = attribute + "_confirmation";
confirmed = form.field(confirmedFieldName).value();
if (value !== confirmed) {
return form.errors.add(confirmedFieldName, ":confirmation", this.options);
}
}
});
$.FormCheck.Validator.create("exclusion", {
validateEach: function(form, attribute, value) {
if ($.inArray(value, this.options["in"]) > -1) {
return form.errors.add(attribute, ":exclusion", $.extend(objectWithoutProperties(this.options, ['in']), {
value: value
}));
}
}
});
$.FormCheck.Validator.create("format", {
initializer: function(options) {
var opt, _i, _len, _ref;
_ref = ["with", "without"];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
opt = _ref[_i];
if ((options[opt] != null) && $.isString(options[opt])) {
options[opt] = $.FormCheck.Validations.FormatValidator.FORMATS[options[opt]];
}
}
return this.baseClass.prototype.constructor.call(this, options);
},
validateEach: function(form, attribute, value) {
if (this.options["with"] && !((value + "").match(this.options["with"]))) {
form.errors.add(attribute, ":invalid", $.extend(objectWithoutProperties(this.options, ['with']), {
value: value
}));
}
if (this.options["without"] && (value + "").match(this.options["without"])) {
return form.errors.add(attribute, ":invalid", $.extend(objectWithoutProperties(this.options, ['without']), {
value: value
}));
}
}
});
$.FormCheck.Validations.FormatValidator.FORMATS = {
email: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,
url: /^[A-Za-z]+:\/\/[A-Za-z0-9-_]+(\.[a-zA-Z0-9]+)+(:\d+)?[A-Za-z0-9-_%&\?\/.=]+$/
};
$.FormCheck.Validator.create("inclusion", {
validateEach: function(form, attribute, value) {
if ($.inArray(value, this.options["in"]) === -1) {
return form.errors.add(attribute, ":inclusion", $.extend(objectWithoutProperties(this.options, ['in']), {
value: value
}));
}
}
});
$.FormCheck.Validator.create("length", {
initializer: function(options) {
return this.baseClass.prototype.constructor.call(this, $.extend({
tokenizer: $.FormCheck.Validations.LengthValidator.DEFAULT_TOKENIZER
}, options));
},
validateEach: function(form, attribute, value) {
var _base, _base1, _base2, _ref, _ref1, _ref2;
if ($.isString(value)) {
value = this.options.tokenizer(value);
}
if (this.options["is"] && this.options["is"] !== value.length) {
if (this.options["wrongLength"] != null) {
if ((_ref = (_base = this.options)["message"]) == null) {
_base["message"] = this.options["wrongLength"];
}
}
form.errors.add(attribute, ":wrong_length", $.extend(objectWithoutProperties(this.options, $.FormCheck.Validations.LengthValidator.RESERVED_OPTIONS), {
count: this.options["is"]
}));
}
if (this.options["minimum"] && this.options["minimum"] > value.length) {
if (this.options["tooShort"] != null) {
if ((_ref1 = (_base1 = this.options)["message"]) == null) {
_base1["message"] = this.options["tooShort"];
}
}
form.errors.add(attribute, ":too_short", $.extend(objectWithoutProperties(this.options, $.FormCheck.Validations.LengthValidator.RESERVED_OPTIONS), {
count: this.options["minimum"]
}));
}
if (this.options["maximum"] && this.options["maximum"] < value.length) {
if (this.options["tooLong"] != null) {
if ((_ref2 = (_base2 = this.options)["message"]) == null) {
_base2["message"] = this.options["tooLong"];
}
}
return form.errors.add(attribute, ":too_long", $.extend(objectWithoutProperties(this.options, $.FormCheck.Validations.LengthValidator.RESERVED_OPTIONS), {
count: this.options["maximum"]
}));
}
}
});
$.FormCheck.Validations.LengthValidator.DEFAULT_TOKENIZER = function(value) {
return value.split('');
};
$.FormCheck.Validations.LengthValidator.RESERVED_OPTIONS = ["minimum", "maximum", "is", "tokenizer", "tooLong", "tooShort"];
$.FormCheck.Validator.create("numericality", {
validateEach: function(form, attribute, value) {
var check, rawValue, val, _ref, _results;
rawValue = value;
value = parseFloat(value);
if (isNaN(value) || !(rawValue.match(/\d+$/))) {
form.errors.add(attribute, ":not_a_number", this.filteredOptions(rawValue));
return;
}
if (this.options.onlyInteger && !(rawValue.match(/^[-]?\d+$/))) {
form.errors.add(attribute, ":not_an_integer", this.filteredOptions(rawValue));
return;
} else {
value = parseInt(value);
}
_ref = sliceObject(this.options, extractKeys($.FormCheck.Validations.NumericalityValidator.CHECKS));
_results = [];
for (check in _ref) {
val = _ref[check];
switch (check) {
case "odd":
case "even":
if (!$.FormCheck.Validations.NumericalityValidator.CHECKS[check](value)) {
_results.push(form.errors.add(attribute, ":" + check, this.filteredOptions(val)));
} else {
_results.push(void 0);
}
break;
default:
if (!$.FormCheck.Validations.NumericalityValidator.CHECKS[check](value, val)) {
_results.push(form.errors.add(attribute, ":" + check.snakeCase(), this.filteredOptions(val)));
} else {
_results.push(void 0);
}
}
}
return _results;
},
filteredOptions: function(value) {
return $.extend(objectWithoutProperties(this.options, $.FormCheck.Validations.NumericalityValidator.RESERVED_OPTIONS), {
count: value
});
}
});
$.FormCheck.Validations.NumericalityValidator.CHECKS = {
greaterThan: function(a, b) {
return a > b;
},
greaterThanOrEqualTo: function(a, b) {
return a >= b;
},
equalTo: function(a, b) {
return a === b;
},
lessThan: function(a, b) {
return a < b;
},
lessThanOrEqualTo: function(a, b) {
return a <= b;
},
odd: function(n) {
return (n % 2) === 1;
},
even: function(n) {
return (n % 2) === 0;
}
};
$.FormCheck.Validations.NumericalityValidator.RESERVED_OPTIONS = extractKeys($.FormCheck.Validations.NumericalityValidator.CHECKS).concat(["onlyInteger"]);
$.FormCheck.Validator.create("presence", {
validateEach: function(form, attribute, value) {
if (isBlank(value)) {
return form.errors.add(attribute, ":blank", this.options);
}
}
});
$.FormCheck.prototype.validates = function() {
var attributes, currentOptions, defaults, kind, options, validations, validator, _results;
attributes = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
defaults = attributes.extractOptions();
validations = sliceObjectAndRemove(defaults, ["if", "unless", "allowBlank", "allowNil"]);
$.extend(defaults, {
attributes: attributes
});
_results = [];
for (kind in validations) {
options = validations[kind];
validator = $.FormCheck.findValidator(kind);
currentOptions = $.extend({}, defaults);
if (validator) {
_results.push(this.validatesWith(validator, $.extend(currentOptions, $.FormCheck.parseValidatesOptions(options))));
} else {
_results.push(void 0);
}
}
return _results;
};
return $.FormCheck.parseValidatesOptions = function(options) {
if ($.isArray(options)) {
return {
"in": options
};
}
if (options.test != null) {
return {
"with": options
};
}
if (options === true) {
return {};
}
if ($.isPlainObject) {
return options;
}
return {};
};
})(jQuery);
}).call(this);
| {
"content_hash": "64bab4fa29d2d806c15dc5701bf7b9e4",
"timestamp": "",
"source": "github",
"line_count": 384,
"max_line_length": 292,
"avg_line_length": 36.9375,
"alnum_prop": 0.5646503102086858,
"repo_name": "wilkerlucio/jcheck",
"id": "e149469c181d03919a46000afc53fda05f6a0cf1",
"size": "14219",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/jcheck.validations.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "3019"
},
{
"name": "CoffeeScript",
"bytes": "28626"
},
{
"name": "JavaScript",
"bytes": "103786"
},
{
"name": "Ruby",
"bytes": "2961"
}
],
"symlink_target": ""
} |
<widget id='http://tizen.org/test/tct-video-html5-tests' xmlns='http://www.w3.org/ns/widgets' xmlns:tizen='http://tizen.org/ns/widgets'>
<access origin="*"/>
<icon src="icon.png" height="117" width="117"/>
<name>tct-video-html5-tests</name>
<tizen:application id="html5video.WebAPIHTML5VideoTests" package="html5video" required_version="2.2"/>
<tizen:setting screen-orientation="landscape"/>
</widget>
| {
"content_hash": "ae25fab0d18cf5024a3c996b1a5e9b12",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 136,
"avg_line_length": 58.857142857142854,
"alnum_prop": 0.7160194174757282,
"repo_name": "qiuzhong/crosswalk-test-suite",
"id": "308c42a30a42bab7ff0fa0b082cc825442716f74",
"size": "412",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "webapi/tct-video-html5-tests/config.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1544"
},
{
"name": "C",
"bytes": "28136"
},
{
"name": "CSS",
"bytes": "403019"
},
{
"name": "CoffeeScript",
"bytes": "18978"
},
{
"name": "Cucumber",
"bytes": "107768"
},
{
"name": "GLSL",
"bytes": "6990"
},
{
"name": "Groff",
"bytes": "16"
},
{
"name": "HTML",
"bytes": "40900599"
},
{
"name": "Java",
"bytes": "948516"
},
{
"name": "JavaScript",
"bytes": "4764134"
},
{
"name": "Logos",
"bytes": "16"
},
{
"name": "Makefile",
"bytes": "1044"
},
{
"name": "PHP",
"bytes": "45437"
},
{
"name": "Python",
"bytes": "4132857"
},
{
"name": "Shell",
"bytes": "853076"
}
],
"symlink_target": ""
} |
#pragma once
#include <aws/iotevents/IoTEvents_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/DateTime.h>
#include <aws/iotevents/model/DetectorModelVersionStatus.h>
#include <aws/iotevents/model/EvaluationMethod.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace IoTEvents
{
namespace Model
{
/**
* <p>Information about how the detector model is configured.</p><p><h3>See
* Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/iotevents-2018-07-27/DetectorModelConfiguration">AWS
* API Reference</a></p>
*/
class AWS_IOTEVENTS_API DetectorModelConfiguration
{
public:
DetectorModelConfiguration();
DetectorModelConfiguration(Aws::Utils::Json::JsonView jsonValue);
DetectorModelConfiguration& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The name of the detector model.</p>
*/
inline const Aws::String& GetDetectorModelName() const{ return m_detectorModelName; }
/**
* <p>The name of the detector model.</p>
*/
inline bool DetectorModelNameHasBeenSet() const { return m_detectorModelNameHasBeenSet; }
/**
* <p>The name of the detector model.</p>
*/
inline void SetDetectorModelName(const Aws::String& value) { m_detectorModelNameHasBeenSet = true; m_detectorModelName = value; }
/**
* <p>The name of the detector model.</p>
*/
inline void SetDetectorModelName(Aws::String&& value) { m_detectorModelNameHasBeenSet = true; m_detectorModelName = std::move(value); }
/**
* <p>The name of the detector model.</p>
*/
inline void SetDetectorModelName(const char* value) { m_detectorModelNameHasBeenSet = true; m_detectorModelName.assign(value); }
/**
* <p>The name of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelName(const Aws::String& value) { SetDetectorModelName(value); return *this;}
/**
* <p>The name of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelName(Aws::String&& value) { SetDetectorModelName(std::move(value)); return *this;}
/**
* <p>The name of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelName(const char* value) { SetDetectorModelName(value); return *this;}
/**
* <p>The version of the detector model.</p>
*/
inline const Aws::String& GetDetectorModelVersion() const{ return m_detectorModelVersion; }
/**
* <p>The version of the detector model.</p>
*/
inline bool DetectorModelVersionHasBeenSet() const { return m_detectorModelVersionHasBeenSet; }
/**
* <p>The version of the detector model.</p>
*/
inline void SetDetectorModelVersion(const Aws::String& value) { m_detectorModelVersionHasBeenSet = true; m_detectorModelVersion = value; }
/**
* <p>The version of the detector model.</p>
*/
inline void SetDetectorModelVersion(Aws::String&& value) { m_detectorModelVersionHasBeenSet = true; m_detectorModelVersion = std::move(value); }
/**
* <p>The version of the detector model.</p>
*/
inline void SetDetectorModelVersion(const char* value) { m_detectorModelVersionHasBeenSet = true; m_detectorModelVersion.assign(value); }
/**
* <p>The version of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelVersion(const Aws::String& value) { SetDetectorModelVersion(value); return *this;}
/**
* <p>The version of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelVersion(Aws::String&& value) { SetDetectorModelVersion(std::move(value)); return *this;}
/**
* <p>The version of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelVersion(const char* value) { SetDetectorModelVersion(value); return *this;}
/**
* <p>A brief description of the detector model.</p>
*/
inline const Aws::String& GetDetectorModelDescription() const{ return m_detectorModelDescription; }
/**
* <p>A brief description of the detector model.</p>
*/
inline bool DetectorModelDescriptionHasBeenSet() const { return m_detectorModelDescriptionHasBeenSet; }
/**
* <p>A brief description of the detector model.</p>
*/
inline void SetDetectorModelDescription(const Aws::String& value) { m_detectorModelDescriptionHasBeenSet = true; m_detectorModelDescription = value; }
/**
* <p>A brief description of the detector model.</p>
*/
inline void SetDetectorModelDescription(Aws::String&& value) { m_detectorModelDescriptionHasBeenSet = true; m_detectorModelDescription = std::move(value); }
/**
* <p>A brief description of the detector model.</p>
*/
inline void SetDetectorModelDescription(const char* value) { m_detectorModelDescriptionHasBeenSet = true; m_detectorModelDescription.assign(value); }
/**
* <p>A brief description of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelDescription(const Aws::String& value) { SetDetectorModelDescription(value); return *this;}
/**
* <p>A brief description of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelDescription(Aws::String&& value) { SetDetectorModelDescription(std::move(value)); return *this;}
/**
* <p>A brief description of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelDescription(const char* value) { SetDetectorModelDescription(value); return *this;}
/**
* <p>The ARN of the detector model.</p>
*/
inline const Aws::String& GetDetectorModelArn() const{ return m_detectorModelArn; }
/**
* <p>The ARN of the detector model.</p>
*/
inline bool DetectorModelArnHasBeenSet() const { return m_detectorModelArnHasBeenSet; }
/**
* <p>The ARN of the detector model.</p>
*/
inline void SetDetectorModelArn(const Aws::String& value) { m_detectorModelArnHasBeenSet = true; m_detectorModelArn = value; }
/**
* <p>The ARN of the detector model.</p>
*/
inline void SetDetectorModelArn(Aws::String&& value) { m_detectorModelArnHasBeenSet = true; m_detectorModelArn = std::move(value); }
/**
* <p>The ARN of the detector model.</p>
*/
inline void SetDetectorModelArn(const char* value) { m_detectorModelArnHasBeenSet = true; m_detectorModelArn.assign(value); }
/**
* <p>The ARN of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelArn(const Aws::String& value) { SetDetectorModelArn(value); return *this;}
/**
* <p>The ARN of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelArn(Aws::String&& value) { SetDetectorModelArn(std::move(value)); return *this;}
/**
* <p>The ARN of the detector model.</p>
*/
inline DetectorModelConfiguration& WithDetectorModelArn(const char* value) { SetDetectorModelArn(value); return *this;}
/**
* <p>The ARN of the role that grants permission to AWS IoT Events to perform its
* operations.</p>
*/
inline const Aws::String& GetRoleArn() const{ return m_roleArn; }
/**
* <p>The ARN of the role that grants permission to AWS IoT Events to perform its
* operations.</p>
*/
inline bool RoleArnHasBeenSet() const { return m_roleArnHasBeenSet; }
/**
* <p>The ARN of the role that grants permission to AWS IoT Events to perform its
* operations.</p>
*/
inline void SetRoleArn(const Aws::String& value) { m_roleArnHasBeenSet = true; m_roleArn = value; }
/**
* <p>The ARN of the role that grants permission to AWS IoT Events to perform its
* operations.</p>
*/
inline void SetRoleArn(Aws::String&& value) { m_roleArnHasBeenSet = true; m_roleArn = std::move(value); }
/**
* <p>The ARN of the role that grants permission to AWS IoT Events to perform its
* operations.</p>
*/
inline void SetRoleArn(const char* value) { m_roleArnHasBeenSet = true; m_roleArn.assign(value); }
/**
* <p>The ARN of the role that grants permission to AWS IoT Events to perform its
* operations.</p>
*/
inline DetectorModelConfiguration& WithRoleArn(const Aws::String& value) { SetRoleArn(value); return *this;}
/**
* <p>The ARN of the role that grants permission to AWS IoT Events to perform its
* operations.</p>
*/
inline DetectorModelConfiguration& WithRoleArn(Aws::String&& value) { SetRoleArn(std::move(value)); return *this;}
/**
* <p>The ARN of the role that grants permission to AWS IoT Events to perform its
* operations.</p>
*/
inline DetectorModelConfiguration& WithRoleArn(const char* value) { SetRoleArn(value); return *this;}
/**
* <p>The time the detector model was created.</p>
*/
inline const Aws::Utils::DateTime& GetCreationTime() const{ return m_creationTime; }
/**
* <p>The time the detector model was created.</p>
*/
inline bool CreationTimeHasBeenSet() const { return m_creationTimeHasBeenSet; }
/**
* <p>The time the detector model was created.</p>
*/
inline void SetCreationTime(const Aws::Utils::DateTime& value) { m_creationTimeHasBeenSet = true; m_creationTime = value; }
/**
* <p>The time the detector model was created.</p>
*/
inline void SetCreationTime(Aws::Utils::DateTime&& value) { m_creationTimeHasBeenSet = true; m_creationTime = std::move(value); }
/**
* <p>The time the detector model was created.</p>
*/
inline DetectorModelConfiguration& WithCreationTime(const Aws::Utils::DateTime& value) { SetCreationTime(value); return *this;}
/**
* <p>The time the detector model was created.</p>
*/
inline DetectorModelConfiguration& WithCreationTime(Aws::Utils::DateTime&& value) { SetCreationTime(std::move(value)); return *this;}
/**
* <p>The time the detector model was last updated.</p>
*/
inline const Aws::Utils::DateTime& GetLastUpdateTime() const{ return m_lastUpdateTime; }
/**
* <p>The time the detector model was last updated.</p>
*/
inline bool LastUpdateTimeHasBeenSet() const { return m_lastUpdateTimeHasBeenSet; }
/**
* <p>The time the detector model was last updated.</p>
*/
inline void SetLastUpdateTime(const Aws::Utils::DateTime& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = value; }
/**
* <p>The time the detector model was last updated.</p>
*/
inline void SetLastUpdateTime(Aws::Utils::DateTime&& value) { m_lastUpdateTimeHasBeenSet = true; m_lastUpdateTime = std::move(value); }
/**
* <p>The time the detector model was last updated.</p>
*/
inline DetectorModelConfiguration& WithLastUpdateTime(const Aws::Utils::DateTime& value) { SetLastUpdateTime(value); return *this;}
/**
* <p>The time the detector model was last updated.</p>
*/
inline DetectorModelConfiguration& WithLastUpdateTime(Aws::Utils::DateTime&& value) { SetLastUpdateTime(std::move(value)); return *this;}
/**
* <p>The status of the detector model.</p>
*/
inline const DetectorModelVersionStatus& GetStatus() const{ return m_status; }
/**
* <p>The status of the detector model.</p>
*/
inline bool StatusHasBeenSet() const { return m_statusHasBeenSet; }
/**
* <p>The status of the detector model.</p>
*/
inline void SetStatus(const DetectorModelVersionStatus& value) { m_statusHasBeenSet = true; m_status = value; }
/**
* <p>The status of the detector model.</p>
*/
inline void SetStatus(DetectorModelVersionStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); }
/**
* <p>The status of the detector model.</p>
*/
inline DetectorModelConfiguration& WithStatus(const DetectorModelVersionStatus& value) { SetStatus(value); return *this;}
/**
* <p>The status of the detector model.</p>
*/
inline DetectorModelConfiguration& WithStatus(DetectorModelVersionStatus&& value) { SetStatus(std::move(value)); return *this;}
/**
* <p>The value used to identify a detector instance. When a device or system sends
* input, a new detector instance with a unique key value is created. AWS IoT
* Events can continue to route input to its corresponding detector instance based
* on this identifying information. </p> <p>This parameter uses a JSON-path
* expression to select the attribute-value pair in the message payload that is
* used for identification. To route the message to the correct detector instance,
* the device must send a message payload that contains the same
* attribute-value.</p>
*/
inline const Aws::String& GetKey() const{ return m_key; }
/**
* <p>The value used to identify a detector instance. When a device or system sends
* input, a new detector instance with a unique key value is created. AWS IoT
* Events can continue to route input to its corresponding detector instance based
* on this identifying information. </p> <p>This parameter uses a JSON-path
* expression to select the attribute-value pair in the message payload that is
* used for identification. To route the message to the correct detector instance,
* the device must send a message payload that contains the same
* attribute-value.</p>
*/
inline bool KeyHasBeenSet() const { return m_keyHasBeenSet; }
/**
* <p>The value used to identify a detector instance. When a device or system sends
* input, a new detector instance with a unique key value is created. AWS IoT
* Events can continue to route input to its corresponding detector instance based
* on this identifying information. </p> <p>This parameter uses a JSON-path
* expression to select the attribute-value pair in the message payload that is
* used for identification. To route the message to the correct detector instance,
* the device must send a message payload that contains the same
* attribute-value.</p>
*/
inline void SetKey(const Aws::String& value) { m_keyHasBeenSet = true; m_key = value; }
/**
* <p>The value used to identify a detector instance. When a device or system sends
* input, a new detector instance with a unique key value is created. AWS IoT
* Events can continue to route input to its corresponding detector instance based
* on this identifying information. </p> <p>This parameter uses a JSON-path
* expression to select the attribute-value pair in the message payload that is
* used for identification. To route the message to the correct detector instance,
* the device must send a message payload that contains the same
* attribute-value.</p>
*/
inline void SetKey(Aws::String&& value) { m_keyHasBeenSet = true; m_key = std::move(value); }
/**
* <p>The value used to identify a detector instance. When a device or system sends
* input, a new detector instance with a unique key value is created. AWS IoT
* Events can continue to route input to its corresponding detector instance based
* on this identifying information. </p> <p>This parameter uses a JSON-path
* expression to select the attribute-value pair in the message payload that is
* used for identification. To route the message to the correct detector instance,
* the device must send a message payload that contains the same
* attribute-value.</p>
*/
inline void SetKey(const char* value) { m_keyHasBeenSet = true; m_key.assign(value); }
/**
* <p>The value used to identify a detector instance. When a device or system sends
* input, a new detector instance with a unique key value is created. AWS IoT
* Events can continue to route input to its corresponding detector instance based
* on this identifying information. </p> <p>This parameter uses a JSON-path
* expression to select the attribute-value pair in the message payload that is
* used for identification. To route the message to the correct detector instance,
* the device must send a message payload that contains the same
* attribute-value.</p>
*/
inline DetectorModelConfiguration& WithKey(const Aws::String& value) { SetKey(value); return *this;}
/**
* <p>The value used to identify a detector instance. When a device or system sends
* input, a new detector instance with a unique key value is created. AWS IoT
* Events can continue to route input to its corresponding detector instance based
* on this identifying information. </p> <p>This parameter uses a JSON-path
* expression to select the attribute-value pair in the message payload that is
* used for identification. To route the message to the correct detector instance,
* the device must send a message payload that contains the same
* attribute-value.</p>
*/
inline DetectorModelConfiguration& WithKey(Aws::String&& value) { SetKey(std::move(value)); return *this;}
/**
* <p>The value used to identify a detector instance. When a device or system sends
* input, a new detector instance with a unique key value is created. AWS IoT
* Events can continue to route input to its corresponding detector instance based
* on this identifying information. </p> <p>This parameter uses a JSON-path
* expression to select the attribute-value pair in the message payload that is
* used for identification. To route the message to the correct detector instance,
* the device must send a message payload that contains the same
* attribute-value.</p>
*/
inline DetectorModelConfiguration& WithKey(const char* value) { SetKey(value); return *this;}
/**
* <p>Information about the order in which events are evaluated and how actions are
* executed. </p>
*/
inline const EvaluationMethod& GetEvaluationMethod() const{ return m_evaluationMethod; }
/**
* <p>Information about the order in which events are evaluated and how actions are
* executed. </p>
*/
inline bool EvaluationMethodHasBeenSet() const { return m_evaluationMethodHasBeenSet; }
/**
* <p>Information about the order in which events are evaluated and how actions are
* executed. </p>
*/
inline void SetEvaluationMethod(const EvaluationMethod& value) { m_evaluationMethodHasBeenSet = true; m_evaluationMethod = value; }
/**
* <p>Information about the order in which events are evaluated and how actions are
* executed. </p>
*/
inline void SetEvaluationMethod(EvaluationMethod&& value) { m_evaluationMethodHasBeenSet = true; m_evaluationMethod = std::move(value); }
/**
* <p>Information about the order in which events are evaluated and how actions are
* executed. </p>
*/
inline DetectorModelConfiguration& WithEvaluationMethod(const EvaluationMethod& value) { SetEvaluationMethod(value); return *this;}
/**
* <p>Information about the order in which events are evaluated and how actions are
* executed. </p>
*/
inline DetectorModelConfiguration& WithEvaluationMethod(EvaluationMethod&& value) { SetEvaluationMethod(std::move(value)); return *this;}
private:
Aws::String m_detectorModelName;
bool m_detectorModelNameHasBeenSet = false;
Aws::String m_detectorModelVersion;
bool m_detectorModelVersionHasBeenSet = false;
Aws::String m_detectorModelDescription;
bool m_detectorModelDescriptionHasBeenSet = false;
Aws::String m_detectorModelArn;
bool m_detectorModelArnHasBeenSet = false;
Aws::String m_roleArn;
bool m_roleArnHasBeenSet = false;
Aws::Utils::DateTime m_creationTime;
bool m_creationTimeHasBeenSet = false;
Aws::Utils::DateTime m_lastUpdateTime;
bool m_lastUpdateTimeHasBeenSet = false;
DetectorModelVersionStatus m_status;
bool m_statusHasBeenSet = false;
Aws::String m_key;
bool m_keyHasBeenSet = false;
EvaluationMethod m_evaluationMethod;
bool m_evaluationMethodHasBeenSet = false;
};
} // namespace Model
} // namespace IoTEvents
} // namespace Aws
| {
"content_hash": "0159249e62b5dca550b75462aa42d095",
"timestamp": "",
"source": "github",
"line_count": 515,
"max_line_length": 160,
"avg_line_length": 39.88155339805825,
"alnum_prop": 0.6874726130775598,
"repo_name": "aws/aws-sdk-cpp",
"id": "4411874187b250f259ea3f2c52d700fc8e23599a",
"size": "20658",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "aws-cpp-sdk-iotevents/include/aws/iotevents/model/DetectorModelConfiguration.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "309797"
},
{
"name": "C++",
"bytes": "476866144"
},
{
"name": "CMake",
"bytes": "1245180"
},
{
"name": "Dockerfile",
"bytes": "11688"
},
{
"name": "HTML",
"bytes": "8056"
},
{
"name": "Java",
"bytes": "413602"
},
{
"name": "Python",
"bytes": "79245"
},
{
"name": "Shell",
"bytes": "9246"
}
],
"symlink_target": ""
} |
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "tbproduct".
*
* @property integer $product_id
* @property string $product_partno
* @property string $product_name
* @property string $product_sellingPice
* @property integer $product_stock
* @property integer $product_categoryid
* @property string $product_description
* @property integer $product_reorderLevel
* @property string $product_unitName
* @property string $product_active
* @property string $product_averageCost
* @property integer $product_markupPercent
* @property string $product_type
*
* @property Tbcategory $productCategory
*/
class Product extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'tbproduct';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['product_partno', 'product_name', 'product_sellingPice', 'product_stock', 'product_categoryid', 'product_description', 'product_reorderLevel', 'product_unitName', 'product_averageCost', 'product_markupPercent', 'product_type'], 'required'],
[['product_sellingPice', 'product_averageCost'], 'number'],
[['product_stock', 'product_categoryid', 'product_reorderLevel', 'product_markupPercent'], 'integer'],
[['product_description'], 'string'],
[['product_supply_tax', 'product_purchase_tax'], 'string', 'max' => 10],
[['product_partno'], 'string', 'max' => 15],
[['product_name'], 'string', 'max' => 55],
[['product_unitName'], 'string', 'max' => 6],
[['product_active', 'product_type'], 'string', 'max' => 1]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'product_id' => 'Product ID',
'product_partno' => 'Product Partno',
'product_name' => 'Product Name',
'product_sellingPice' => 'Product Selling Pice',
'product_stock' => 'Product Stock',
'product_categoryid' => 'Product Categoryid',
'product_description' => 'Product Description',
'product_reorderLevel' => 'Product Reorder Level',
'product_unitName' => 'Product Unit Name',
'product_active' => 'Product Active',
'product_averageCost' => 'Product Average Cost',
'product_markupPercent' => 'Product Markup Percent',
'product_type' => 'Product Type',
'product_supply_tax' => 'Product Supply Tax',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProductCategory()
{
return $this->hasOne(Tbcategory::className(), ['category_id' => 'product_categoryid']);
}
}
| {
"content_hash": "c26eae71b0c582b6c7358c36658be223",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 254,
"avg_line_length": 33.154761904761905,
"alnum_prop": 0.5938958707360862,
"repo_name": "GSTProject/GST",
"id": "a6522180e5b30c2aeb841286b3bff49f8ee4e84d",
"size": "2785",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "models/Product.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1060"
},
{
"name": "CSS",
"bytes": "8699"
},
{
"name": "JavaScript",
"bytes": "334"
},
{
"name": "PHP",
"bytes": "289186"
}
],
"symlink_target": ""
} |
<?php
namespace Polyether\Taxonomy\Models;
use Illuminate\Database\Eloquent\Model;
class TermTaxonomyRelationships extends Model
{
public $timestamps = false;
protected $table = 'term_relationships';
protected $fillable = ['object_id', 'term_taxonomy_id'];
public function termTaxonomies()
{
return $this->belongsTo(TermTaxonomy::class, 'term_taxonomy_id', 'id');
}
}
| {
"content_hash": "31b31b7217bc8c9315d4b75a36f98112",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 79,
"avg_line_length": 22.5,
"alnum_prop": 0.6962962962962963,
"repo_name": "puresolcom/polyether",
"id": "1fd8dba9b5de252ff98d8867cf016cf91da52b79",
"size": "405",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Taxonomy/Models/TermTaxonomyRelationships.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1125459"
},
{
"name": "HTML",
"bytes": "2279886"
},
{
"name": "JavaScript",
"bytes": "5389358"
},
{
"name": "PHP",
"bytes": "223493"
}
],
"symlink_target": ""
} |
package org.waveprotocol.wave.model.document.util;
import org.waveprotocol.wave.model.document.AnnotationMutationHandler;
import org.waveprotocol.wave.model.document.MutableAnnotationSet;
import org.waveprotocol.wave.model.document.MutableDocument;
import org.waveprotocol.wave.model.document.MutableDocumentImpl;
import org.waveprotocol.wave.model.document.indexed.AnnotationSetListener;
import org.waveprotocol.wave.model.document.indexed.AnnotationTree;
import org.waveprotocol.wave.model.document.indexed.DocumentHandler;
import org.waveprotocol.wave.model.document.indexed.IndexedDocument;
import org.waveprotocol.wave.model.document.indexed.LocationMapper;
import org.waveprotocol.wave.model.document.indexed.ObservableIndexedDocument;
import org.waveprotocol.wave.model.document.operation.Attributes;
import org.waveprotocol.wave.model.document.operation.DocInitialization;
import org.waveprotocol.wave.model.document.operation.automaton.DocumentSchema;
import org.waveprotocol.wave.model.document.raw.RawDocument;
import org.waveprotocol.wave.model.document.raw.TextNodeOrganiser;
import org.waveprotocol.wave.model.document.raw.impl.Element;
import org.waveprotocol.wave.model.document.raw.impl.Node;
import org.waveprotocol.wave.model.document.raw.impl.RawDocumentImpl;
import org.waveprotocol.wave.model.document.raw.impl.Text;
import org.waveprotocol.wave.model.document.util.ContextProviders.TestDocumentContext.MiscListener;
import org.waveprotocol.wave.model.operation.OperationException;
import org.waveprotocol.wave.model.operation.OperationRuntimeException;
import org.waveprotocol.wave.model.util.Box;
import java.util.Iterator;
import java.util.Map;
/**
* Document context providers
*
* @author [email protected] (Daniel Danilatos)
*/
public class ContextProviders {
/**
* Extension for testing purposes, exposing some more internals
*/
public interface TestDocumentContext<N, E extends N, T extends N>
extends DocumentContext<N, E, T> {
public interface MiscListener {
// void onBegin();
// void onFinish();
void onSchedulePaint(Node node);
}
RawDocument<N, E, T> getFullRawDoc();
RawDocument<N, E, T> getPersistentRawDoc();
/** Gets the indexed doc */
IndexedDocument<N, E, T> getIndexedDoc();
}
public static class LocalDocImpl<N, E extends N, T extends N> extends IdentityView<N, E, T>
implements LocalDocument<N, E, T> {
private final WritableLocalDocument<N, E, T> writable;
public LocalDocImpl(RawDocument<N, E, T> fullDoc, WritableLocalDocument<N, E, T> local) {
super(fullDoc);
this.writable = local;
}
@Override
public <T> T getProperty(Property<T> property, E element) {
return writable.getProperty(property, element);
}
@Override
public boolean isDestroyed(E element) {
return writable.isDestroyed(element);
}
@Override
public <T> void setProperty(Property<T> property, E element, T value) {
writable.setProperty(property, element, value);
}
@Override
public T transparentCreate(String text, E parent, N nodeAfter) {
return writable.transparentCreate(text, parent, nodeAfter);
}
@Override
public E transparentCreate(String tagName, Map<String, String> attributes,
E parent, N nodeAfter) {
return writable.transparentCreate(tagName, attributes, parent, nodeAfter);
}
@Override
public void transparentSetAttribute(E element, String name, String value) {
writable.transparentSetAttribute(element, name, value);
}
@Override
public void transparentDeepRemove(N node) {
writable.transparentDeepRemove(node);
}
@Override
public void transparentMove(E newParent, N fromIncl, N toExcl, N refChild) {
writable.transparentMove(newParent, fromIncl, toExcl, refChild);
}
@Override
public N transparentSlice(N splitAt) {
return writable.transparentSlice(splitAt);
}
@Override
public void transparentUnwrap(E element) {
writable.transparentUnwrap(element);
}
@Override
public void markNodeForPersistence(N localNode, boolean lazy) {
writable.markNodeForPersistence(localNode, lazy);
}
@Override
public boolean isTransparent(N node) {
return writable.isTransparent(node);
}
}
/**
* @param docHandler
* @return a self-contained document context suitable for testing
*/
public static TestDocumentContext<Node, Element, Text> createTestPojoContext2(
final String initialInnerXml,
final DocumentHandler<Node, Element, Text> docHandler,
final AnnotationRegistry annotationRegistry,
final MiscListener miscListener,
final DocumentSchema schemaConstraints) {
final Box<TestDocumentContext<Node, Element, Text>> box = Box.create();
return box.boxed = createTestPojoContext(initialInnerXml,
docHandler, new AnnotationSetListener<Object>() {
@Override
public void onAnnotationChange(int start, int end, String key, Object newValue) {
Iterator<AnnotationMutationHandler> handlers = annotationRegistry.getHandlers(key);
while (handlers.hasNext()) {
handlers.next().handleAnnotationChange(
box.boxed, start, end, key, newValue);
}
}
}, miscListener, schemaConstraints);
}
/**
* @param docHandler
* @param annotationSetListener
* @return a self-contained document context suitable for testing
*/
public static TestDocumentContext<Node, Element, Text> createTestPojoContext(
final String initialInnerXml,
final DocumentHandler<Node, Element, Text> docHandler,
final AnnotationSetListener<Object> annotationSetListener,
final MiscListener miscListener,
final DocumentSchema schemaConstraints) {
return createTestPojoContext(
// FIXME(ohler): it's a bit weird that we parse into an IndexedDocument just to
// get its asOperation().
DocProviders.POJO.parse(initialInnerXml).asOperation(),
docHandler, annotationSetListener, miscListener, schemaConstraints);
}
/**
* @param docHandler
* @param annotationSetListener
* @return a self-contained document context suitable for testing
*/
public static TestDocumentContext<Node, Element, Text> createTestPojoContext(
final DocInitialization initialContent,
final DocumentHandler<Node, Element, Text> docHandler,
final AnnotationSetListener<Object> annotationSetListener,
final MiscListener miscListener,
final DocumentSchema schemaConstraints) {
final AnnotationSetListener<Object> annotationListener = annotationSetListener != null
? annotationSetListener : new AnnotationSetListener<Object>() {
@Override
public void onAnnotationChange(int start, int end, String key, Object newValue) {
// Do nothing
}
};
TestDocumentContext<Node, Element, Text> documentContext =
new TestDocumentContext<Node, Element, Text>() {
private final RawDocument<Node, Element, Text> fullDoc =
RawDocumentImpl.PROVIDER.create("doc", Attributes.EMPTY_MAP);
private final PersistentContent<Node, Element, Text> persistentDoc =
new RepaintingPersistentContent<Node, Element, Text>(
fullDoc, Element.ELEMENT_MANAGER) {
@Override
protected void schedulePaint(Node node) {
if (miscListener != null) {
miscListener.onSchedulePaint(node);
}
}
};
AnnotationTree<Object> fullAnnotations = new AnnotationTree<Object>(
"a", "b", annotationListener);
private final LocalDocImpl<Node, Element, Text> localDoc =
new LocalDocImpl<Node, Element, Text>(fullDoc, persistentDoc);
private final IndexedDocument<Node, Element, Text> indexedDoc =
new ObservableIndexedDocument<Node, Element, Text, Void>(
docHandler, persistentDoc, fullAnnotations, schemaConstraints) {
// @Override
// public void begin() {
// super.begin();
// if (miscListener != null) {
// miscListener.onBegin();
// }
// }
//
// @Override
// public void finish() {
// if (miscListener != null) {
// miscListener.onFinish();
// }
// super.finish();
// }
};
private final MutableDocument<Node, Element, Text> mutableDoc =
new MutableDocumentImpl<Node, Element, Text>(
DocProviders.createTrivialSequencer(indexedDoc, null), indexedDoc);
private final LocalAnnotationSetImpl localAnnotations =
new LocalAnnotationSetImpl(fullAnnotations);
@Override
public LocalDocument<Node, Element, Text> annotatableContent() {
return localDoc;
}
@Override
public MutableDocument<Node, Element, Text> document() {
return mutableDoc;
}
@Override
public ElementManager<Element> elementManager() {
return Element.ELEMENT_MANAGER;
}
@Override
public MutableAnnotationSet.Local localAnnotations() {
return localAnnotations;
}
@Override
public LocationMapper<Node> locationMapper() {
return indexedDoc;
}
@Override
public ReadableDocumentView<Node, Element, Text> persistentView() {
return persistentDoc;
}
@Override
public ReadableDocumentView<Node, Element, Text> hardView() {
return persistentDoc.hardView();
}
@Override
public TextNodeOrganiser<Text> textNodeOrganiser() {
return indexedDoc;
}
@Override
public IndexedDocument<Node, Element, Text> getIndexedDoc() {
return indexedDoc;
}
@Override
public RawDocument<Node, Element, Text> getFullRawDoc() {
return fullDoc;
}
@Override
public RawDocument<Node, Element, Text> getPersistentRawDoc() {
return persistentDoc;
}
};
try {
documentContext.getIndexedDoc().consume(initialContent);
} catch (OperationException e) {
throw new OperationRuntimeException("Invalid constructing op", e);
}
return documentContext;
}
}
| {
"content_hash": "a611e1971ebe2674479c5648df3f026a",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 99,
"avg_line_length": 37.197916666666664,
"alnum_prop": 0.6687202464295715,
"repo_name": "P2Pvalue/swellrt",
"id": "e15ae49fc617a9dc600ca5679a173626f909dcf7",
"size": "11521",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "wave/src/main/java/org/waveprotocol/wave/model/document/util/ContextProviders.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1893"
},
{
"name": "CSS",
"bytes": "133405"
},
{
"name": "Dockerfile",
"bytes": "1106"
},
{
"name": "HTML",
"bytes": "199097"
},
{
"name": "Java",
"bytes": "13662385"
},
{
"name": "JavaScript",
"bytes": "520586"
},
{
"name": "Shell",
"bytes": "7549"
},
{
"name": "Smalltalk",
"bytes": "23006"
}
],
"symlink_target": ""
} |
import { Component, ChangeDetectionStrategy } from '@angular/core';
const EXAMPLE_TAGS = ['column-data-safe', 'No errors exist despite of bad data'];
@Component({
selector: 'example-column-data-safe',
templateUrl: 'example-column-data-safe.component.html',
styleUrls: ['example-column-data-safe.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ExampleColumnDataSafeComponent {
static tags = EXAMPLE_TAGS;
title = EXAMPLE_TAGS[1];
rows = [
{
level0: {
currency: 10,
number: 12,
date: '1983-09-18',
boolean: true,
email: '[email protected]',
time: '12:00',
image: 'https://upload.wikimedia.org/wikipedia/commons/e/e4/Hydrogen_Spectra.jpg',
array: [
1,
2,
3,
],
},
},
{},
{
level0: {
time: '13:00',
},
},
];
}
| {
"content_hash": "221413de6b0e6cb78afa74095b9f8b85",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 90,
"avg_line_length": 22.775,
"alnum_prop": 0.5740944017563118,
"repo_name": "qgrid/ng2",
"id": "07d4cfb6647ce5a359e00d632012606745303f2d",
"size": "911",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/qgrid-ngx-examples/src/examples/column-data-safe/example-column-data-safe.component.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Gherkin",
"bytes": "82564"
},
{
"name": "HTML",
"bytes": "225314"
},
{
"name": "JavaScript",
"bytes": "669142"
},
{
"name": "SCSS",
"bytes": "76745"
},
{
"name": "TypeScript",
"bytes": "581689"
}
],
"symlink_target": ""
} |
// Parts of this code sourced from SnopyDogy
// https://gist.github.com/SnopyDogy/a9a22497a893ec86aa3e
#if defined(WITH_GRAPHICS)
#include <interopManager.hpp>
#include <err_cuda.hpp>
#include <util.hpp>
#include <cstdio>
namespace cuda
{
void InteropManager::destroyResources()
{
typedef std::vector<CGR_t>::iterator CGRIter_t;
int n = getActiveDeviceId();
for(iter_t iter = interop_maps[n].begin(); iter != interop_maps[n].end(); iter++) {
for(CGRIter_t ct = (iter->second).begin(); ct != (iter->second).end(); ct++) {
CUDA_CHECK(cudaGraphicsUnregisterResource(*ct));
}
(iter->second).clear();
}
}
InteropManager::~InteropManager()
{
try {
for(int i = 0; i < getDeviceCount(); i++) {
setDevice(i);
destroyResources();
}
} catch (AfError &ex) {
std::string perr = getEnvVar("AF_PRINT_ERRORS");
if(!perr.empty()) {
if(perr != "0")
fprintf(stderr, "%s\n", ex.what());
}
}
}
InteropManager& InteropManager::getInstance()
{
static InteropManager my_instance;
return my_instance;
}
interop_t& InteropManager::getDeviceMap(int device)
{
return (device == -1) ? interop_maps[getActiveDeviceId()] : interop_maps[device];
}
CGR_t* InteropManager::getBufferResource(const forge::Image* key)
{
void* key_value = (void*)key;
interop_t& i_map = getDeviceMap();
if(i_map.find(key_value) == i_map.end()) {
CGR_t pixelsResource;
// Register pixels with CUDA
CUDA_CHECK(cudaGraphicsGLRegisterBuffer(&pixelsResource, key->pixels(), cudaGraphicsMapFlagsWriteDiscard));
// TODO:
// A way to store multiple buffers and take PBO/CBO etc as
// argument and return the appropriate buffer
std::vector<CGR_t> vec(1);
vec[0] = pixelsResource;
i_map[key_value] = vec;
}
return &i_map[key_value].front();
}
CGR_t* InteropManager::getBufferResource(const forge::Plot* key)
{
void* key_value = (void*)key;
interop_t& i_map = getDeviceMap();
iter_t iter = i_map.find(key_value);
if(iter == i_map.end()) {
CGR_t vboResource;
// Register VBO with CUDA
CUDA_CHECK(cudaGraphicsGLRegisterBuffer(&vboResource, key->vertices(), cudaGraphicsMapFlagsWriteDiscard));
// TODO:
// A way to store multiple buffers and take PBO/CBO etc as
// argument and return the appropriate buffer
std::vector<CGR_t> vec(1);
vec[0] = vboResource;
i_map[key_value] = vec;
}
return &i_map[key_value].front();
}
CGR_t* InteropManager::getBufferResource(const forge::Histogram* key)
{
void* key_value = (void*)key;
interop_t& i_map = getDeviceMap();
iter_t iter = i_map.find(key_value);
if(iter == i_map.end()) {
CGR_t vboResource;
// Register VBO with CUDA
CUDA_CHECK(cudaGraphicsGLRegisterBuffer(&vboResource, key->vertices(), cudaGraphicsMapFlagsWriteDiscard));
// TODO:
// A way to store multiple buffers and take PBO/CBO etc as
// argument and return the appropriate buffer
std::vector<CGR_t> vec(1);
vec[0] = vboResource;
i_map[key_value] = vec;
}
return &i_map[key_value].front();
}
CGR_t* InteropManager::getBufferResource(const forge::Surface* key)
{
void* key_value = (void*)key;
interop_t& i_map = getDeviceMap();
iter_t iter = i_map.find(key_value);
if(iter == i_map.end()) {
CGR_t vboResource;
// Register VBO with CUDA
CUDA_CHECK(cudaGraphicsGLRegisterBuffer(&vboResource, key->vertices(), cudaGraphicsMapFlagsWriteDiscard));
// TODO:
// A way to store multiple buffers and take PBO/CBO etc as
// argument and return the appropriate buffer
std::vector<CGR_t> vec(1);
vec[0] = vboResource;
i_map[key_value] = vec;
}
return &i_map[key_value].front();
}
CGR_t* InteropManager::getBufferResource(const forge::VectorField* key)
{
void* key_value = (void*)key;
interop_t& i_map = getDeviceMap();
iter_t iter = i_map.find(key_value);
if(iter == i_map.end()) {
CGR_t pResource;
CGR_t dResource;
// Register VBO with CUDA
CUDA_CHECK(cudaGraphicsGLRegisterBuffer(&pResource, key->vertices(), cudaGraphicsMapFlagsWriteDiscard));
CUDA_CHECK(cudaGraphicsGLRegisterBuffer(&dResource, key->directions(), cudaGraphicsMapFlagsWriteDiscard));
// TODO:
// A way to store multiple buffers and take PBO/CBO etc as
// argument and return the appropriate buffer
std::vector<CGR_t> vec(2);
vec[0] = pResource;
vec[1] = dResource;
i_map[key_value] = vec;
}
return &i_map[key_value].front();
}
bool InteropManager::checkGraphicsInteropCapability()
{
static bool run_once = true;
static bool capable = true;
if(run_once) {
unsigned int pCudaEnabledDeviceCount = 0;
int pCudaGraphicsEnabledDeviceIds = 0;
cudaGetLastError(); // Reset Errors
cudaError_t err = cudaGLGetDevices(&pCudaEnabledDeviceCount, &pCudaGraphicsEnabledDeviceIds, getDeviceCount(), cudaGLDeviceListAll);
if(err == 63) { // OS Support Failure - Happens when devices are only Tesla
capable = false;
printf("Warning: No CUDA Device capable of CUDA-OpenGL. CUDA-OpenGL Interop will use CPU fallback.\n");
printf("Corresponding CUDA Error (%d): %s.\n", err, cudaGetErrorString(err));
printf("This may happen if all CUDA Devices are in TCC Mode and/or not connected to a display.\n");
}
cudaGetLastError(); // Reset Errors
run_once = false;
}
return capable;
}
}
#endif
| {
"content_hash": "60dc75daa62b160d11c6ed9abaf1e05c",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 140,
"avg_line_length": 30.197916666666668,
"alnum_prop": 0.6229734391169369,
"repo_name": "victorv/arrayfire",
"id": "077e4ac70346880be6f7187e42df7335be0f826f",
"size": "6129",
"binary": false,
"copies": "5",
"ref": "refs/heads/devel",
"path": "src/backend/cuda/interopManager.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "505764"
},
{
"name": "C++",
"bytes": "3901559"
},
{
"name": "CMake",
"bytes": "110732"
},
{
"name": "Cuda",
"bytes": "197347"
},
{
"name": "HTML",
"bytes": "1457"
},
{
"name": "Shell",
"bytes": "1615"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using LASI.Content.FileTypes;
using SerializationInfo = System.Runtime.Serialization.SerializationInfo;
using StreamingContext = System.Runtime.Serialization.StreamingContext;
namespace LASI.Content.Exceptions
{
/// <summary>
/// The base class for all Exceptions thrown by the FileManager.
/// </summary>
[Serializable]
public abstract class FileManagerException : ContentFileException
{
/// <summary>
/// Initializes a new instance of the FileManagerException class with its message string set to message.
/// </summary>
/// <param name="message">A description of the error. The content of message is intended to be understood</param>
protected FileManagerException(string message)
: base(message)
{
CollectDirInfo();
}
/// <summary>
/// Initializes a new instance of the FileManagerException class with its message string set to message and containing the provided inner exception.
/// </summary>
/// <param name="message">A description of the error. The content of message is intended to be understood</param>
/// <param name="inner">
/// The exception that is the cause of the current exception. If the innerException
/// parameter is not null, the current exception is raised in a catch block that
/// handles the inner exception.
/// </param>
protected FileManagerException(string message, Exception inner)
: base(message, inner)
{
CollectDirInfo();
}
/// <summary>
///Initializes a new instance of the FileManagerException class with serialized data.
/// </summary>
/// <param name="info">
/// The object that holds the serialized object data about the exception being
/// thrown.</param>
/// <param name="context">
/// The object that holds the serialized object data about the exception being
/// thrown.</param>
protected FileManagerException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
CollectDirInfo();
}
public FileManagerException() { }
/// <summary>
/// Sets the System.Runtime.Serialization.SerializationInfo with information about the exception.
/// </summary>
/// <param name="info">
/// The System.Runtime.Serialization.SerializationInfo that holds the serialized
/// object data about the exception being thrown.
/// </param>
/// <param name="context">
/// The System.Runtime.Serialization.StreamingContext that contains contextual
/// information about the source or destination.
/// </param>
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
}
/// <summary>
/// Sets data about the current contents of the ProjectDirectory at the time the FileManagerException is constructed.
/// </summary>
protected void CollectDirInfo()
{
if (FileManager.Initialized && FileManager.TxtFiles.Any())
{
filesInProjectDirectories = new DirectoryInfo(FileManager.ProjectDirectory).EnumerateFiles("*", SearchOption.AllDirectories)
.Select(di => FileManager.WrapperMap[di.Extension](di.FullName)).DefaultIfEmpty();
}
}
private IEnumerable<InputFile> filesInProjectDirectories = new List<InputFile>();
/// <summary>
/// Gets data about the contents of the ProjectDirectory when the FileManagerException was constructed.
/// </summary>
public IEnumerable<InputFile> FilesInProjectDirectories
{
get => filesInProjectDirectories;
protected set => filesInProjectDirectories = value;
}
}
}
| {
"content_hash": "09db5aa417aa58781914407a43750259",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 156,
"avg_line_length": 42.98947368421052,
"alnum_prop": 0.6371204701273262,
"repo_name": "lasiproject/LASI",
"id": "582ffe630aaf6aa2dac220fe8328c49df7139bc0",
"size": "4086",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "LASI.Content/Exceptions/FileManagerExceptions.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "2242739"
},
{
"name": "F#",
"bytes": "10255"
},
{
"name": "Python",
"bytes": "3677"
},
{
"name": "Roff",
"bytes": "2511"
},
{
"name": "Smalltalk",
"bytes": "2587"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
public class VehiclePark
{
public static string GetPrice(string vehicle)
{
char type = vehicle[0];
int amountOfSeats = int.Parse(vehicle.Substring(1));
return string.Empty + ((int)type * amountOfSeats);
}
private static void Main()
{
List<string> availableVehicles = new List<string>();
int vehiclesSold = 0;
string input = Console.ReadLine();
// vehicles that are available for selling
availableVehicles = input
.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
.ToList();
string line;
// list with vehicle requests
List<string> requestedVehicles = new List<string>();
// process a sequence of incoming requests
while (!string.IsNullOrEmpty(line = Console.ReadLine()) && line != "End of customers!")
{
string[] items = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray();
char type = char.ToLower(items[0][0]);
int amountOfSeats = int.Parse(items[2]);
requestedVehicles.Add(string.Empty + type + amountOfSeats);
}
// iterate through buy requests
foreach (var requestedVehicle in requestedVehicles)
{
if (availableVehicles.Contains(requestedVehicle))
{
Console.WriteLine("Yes, sold for {0}$", GetPrice(requestedVehicle));
vehiclesSold++;
availableVehicles.Remove(requestedVehicle);
}
else
{
Console.WriteLine("No");
}
}
Console.WriteLine("Vehicles left: {0}", string.Join(", ", availableVehicles));
Console.WriteLine("Vehicles sold: {0}", vehiclesSold);
}
}
| {
"content_hash": "96c6bcf821ca360178ba87639f3db5ef",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 109,
"avg_line_length": 29.015384615384615,
"alnum_prop": 0.5827147401908802,
"repo_name": "SoftUni-marks/Programming-Basics-Jan-2016",
"id": "6902107b2677d021868d35e0e3227e9a6bf2c9f9",
"size": "1888",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "__Exams/Part-II-C#-Basics-Exam-Preparation-15-April-2016/Tasks/04.Vehicle-Park/Vehicle-Park.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "102"
},
{
"name": "C#",
"bytes": "379610"
},
{
"name": "CSS",
"bytes": "513"
},
{
"name": "HTML",
"bytes": "5127"
},
{
"name": "JavaScript",
"bytes": "146951"
}
],
"symlink_target": ""
} |
using System;
using System.Web;
using System.Web.Routing;
using Valcon.HelloWorld.Configuration;
namespace Valcon.HelloWorld
{
public class Global : HttpApplication
{
protected void Application_Start(object sender, EventArgs args)
{
var routes = RouteTable.Routes;
FubuStructureMapBootstrapper.Bootstrap(routes);
}
}
}
| {
"content_hash": "90dd6424f66be44c1ebaf1392e7093d9",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 71,
"avg_line_length": 24.8125,
"alnum_prop": 0.6523929471032746,
"repo_name": "jmlopez/Valcon",
"id": "5c23af932d29b0dea330a8d5ee626b9f7de899ab",
"size": "399",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Valcon.HelloWorld/Global.asax.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
import { expect } from '@playwright/test';
import { SessionContext } from '@sentry/types';
import { sentryTest } from '../../../utils/fixtures';
import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers';
sentryTest('should update session when an error is thrown.', async ({ getLocalTestPath, page }) => {
const url = await getLocalTestPath({ testDir: __dirname });
const pageloadSession = await getFirstSentryEnvelopeRequest<SessionContext>(page, url);
const updatedSession = (
await Promise.all([page.click('#throw-error'), getFirstSentryEnvelopeRequest<SessionContext>(page)])
)[1];
expect(pageloadSession).toBeDefined();
expect(pageloadSession.init).toBe(true);
expect(pageloadSession.errors).toBe(0);
expect(updatedSession).toBeDefined();
expect(updatedSession.init).toBe(false);
expect(updatedSession.errors).toBe(1);
expect(updatedSession.status).toBe('ok');
expect(pageloadSession.sid).toBe(updatedSession.sid);
});
sentryTest('should update session when an exception is captured.', async ({ getLocalTestPath, page }) => {
const url = await getLocalTestPath({ testDir: __dirname });
const pageloadSession = await getFirstSentryEnvelopeRequest<SessionContext>(page, url);
const updatedSession = (
await Promise.all([page.click('#capture-exception'), getFirstSentryEnvelopeRequest<SessionContext>(page)])
)[1];
expect(pageloadSession).toBeDefined();
expect(pageloadSession.init).toBe(true);
expect(pageloadSession.errors).toBe(0);
expect(updatedSession).toBeDefined();
expect(updatedSession.init).toBe(false);
expect(updatedSession.errors).toBe(1);
expect(updatedSession.status).toBe('ok');
expect(pageloadSession.sid).toBe(updatedSession.sid);
});
| {
"content_hash": "a0628589a136da769257fa165f5339f6",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 110,
"avg_line_length": 43.225,
"alnum_prop": 0.7420474262579526,
"repo_name": "getsentry/raven-js",
"id": "9634e66c360e7a0fd3030198019f49b7e60b1bf7",
"size": "1729",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/integration-tests/suites/sessions/update-session/test.ts",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CoffeeScript",
"bytes": "375"
},
{
"name": "HTML",
"bytes": "6107"
},
{
"name": "JavaScript",
"bytes": "556534"
},
{
"name": "Makefile",
"bytes": "492"
},
{
"name": "Shell",
"bytes": "2911"
},
{
"name": "TypeScript",
"bytes": "251447"
}
],
"symlink_target": ""
} |
/**
* Created by Hyiero on 12/9/2016.
*/
import appTemplate from './app.html';
import appController from './app.controller';
/* @ngInject */
export default function appConfig($stateProvider){
"use strict";
$stateProvider
.state('app',{
url: '',
views: {
'':{
template: appTemplate,
controller: appController,
controllerAs: 'appCtrl'
}
}
});
} | {
"content_hash": "c8b36d6d295a74b7d92fcc4cc9bf589b",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 50,
"avg_line_length": 21.695652173913043,
"alnum_prop": 0.47695390781563124,
"repo_name": "Hyiero/AngularWebpackSeedProject",
"id": "25be632e133085a0b90c29a06a392b47998fbf0e",
"size": "499",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/app.config.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "60"
},
{
"name": "HTML",
"bytes": "281"
},
{
"name": "JavaScript",
"bytes": "10398"
}
],
"symlink_target": ""
} |
<?php
$form = Loader::helper('form');
?>
<form action="<?php echo $view->action('save')?>" method='POST'>
<div class="ccm-dashboard-header-buttons">
<a class='add_word btn btn-primary' href='#'><?php echo t('Add Word')?></a>
</div>
<div class="checkbox">
<label>
<input value=1 name='banned_list_enabled' <?php echo $bannedListEnabled?'checked ':''?>type='checkbox'> <?php echo t('Disallow posts that include banned words?')?>
</label>
</div>
<script class='word_template' type="text/template" charset="utf-8">
<tr class='editing'>
<th class='id'></th>
<td class='word'><span></span><input name='banned_word[]' class="form-control"></td>
<td style='text-align:right'><a href='#' class='save_word btn btn-primary'><?php echo t('Save')?></a></td>
</tr>
</script>
<div class='banned_words_table' style='overflow:hidden'>
<table class='banned_word_list table'>
<thead>
<tr>
<th style='width:20px'>ID</th>
<th><?php echo t('Word')?></th>
<th style='width:200px;text-align:right'></th>
</tr>
</thead>
<tbody>
<?php
foreach ($bannedWords as $word) {
if (!is_object($word)) continue;
?>
<tr>
<th class='id'><?php echo $word->getID()?></th>
<td class='word'><span><?php echo $word->getWord()?></span><input style='display:none' name='banned_word[]' value='<?php echo $word->getWord()?>'></td>
<td style='text-align:right'>
<div class="btn-group">
<a href='#' class='edit_word btn btn-default'><?php echo t('Edit')?></a>
<a href='#' class='delete_word btn btn-danger'><?php echo t('Delete')?></a>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="ccm-dashboard-form-actions-wrapper">
<div class="ccm-dashboard-form-actions">
<?php echo $interface->submit(t('Save'), 'bannedwords-form', 'right', 'btn-primary'); ?>
</div>
</div>
</form>
<script>
var ctx = $('table.banned_word_list'), template = $('script.word_template'),
getTemplate = function(){return $(template.text());},
save = $("<a href='#' class='save_word btn btn-primary'><?php echo t('Save')?></a>"),
edit = $("<div class=\"btn-group\"><a href='#' class='edit_word btn btn-default'><?php echo t('Edit')?></a><a href='#' class='delete_word btn btn-danger'><?php echo t('Delete')?></a></div>"),
totalheight = ctx.parent().height();
if (!$('input[name=banned_list_enabled]').get(0).checked) {
ctx.hide();
ctx.parent().height(0);
}
$('input[name=banned_list_enabled]').click(function(){
if (this.checked) {
ctx.fadeIn(200);
ctx.parent().animate({height:totalheight},200,function(){
$(this).height('auto');
});
} else {
totalheight = ctx.parent().height();
ctx.fadeOut(200);
ctx.parent().animate({height:0},200);
}
});
$(".add_word").on('click', function(e) {
ctx.find('tr.editing').find('a.save_word').click();
var newWord = getTemplate();
newWord.find('th.id').text(' ');
newWord.appendTo(ctx.find('tbody'));
ctx.find('td.word').children('input').focus();
e.preventDefault();
e.stopPropagation();
return false;
});
ctx.on('click','a.edit_word',function(e){
var me = $(this);
ctx.find('tr.editing').find('a.save_word').click();
me.closest('tr').addClass('editing').find('td.word').children('span').hide().end()
.children('input').addClass('form-control').show().focus().end().end().end()
.closest('td').empty().append(save.clone());
e.preventDefault();
e.stopPropagation();
return false;
}).on('click','a.save_word',function(e){
var me = $(this);
var tr = me.closest('tr');
tr.removeClass('editing')
.find('td.word').children('span').text(tr.find('td.word').children('input').val()).show().end()
.children('input').removeClass('form-control').hide().end().end().end();
tr.find('td:eq(1)').empty().append(edit.clone());
e.preventDefault();
e.stopPropagation();
return false;
}).on('blur', '.word', function(e) {
var me = $(this);
var tr = me.closest('tr');
tr.removeClass('editing')
.find('td.word').children('span').text(tr.find('td.word').children('input').val()).show().end()
.children('input').removeClass('form-control').hide().end().end().end();
tr.find('td:eq(1)').empty().append(edit.clone());
e.preventDefault();
e.stopPropagation();
return false;
}).on('click','a.delete_word',function(e){
if (confirm("<?php echo t('Are you sure you want to delete this word?')?>"))
$(this).closest('tr').remove();
});
</script>
| {
"content_hash": "595b5a2253d7ba2f4f51977d585c1a6b",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 192,
"avg_line_length": 34.48888888888889,
"alnum_prop": 0.5798969072164949,
"repo_name": "imyuvii/concrete",
"id": "bddb67a2984784ab03d6a60de89a82d994aae694",
"size": "4656",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "concrete/single_pages/dashboard/system/conversations/bannedwords.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "169025"
},
{
"name": "CSS",
"bytes": "461380"
},
{
"name": "HTML",
"bytes": "4108"
},
{
"name": "JavaScript",
"bytes": "636985"
},
{
"name": "PHP",
"bytes": "5316028"
}
],
"symlink_target": ""
} |
"""Definition of the PhraseElement class and associated subclasses:
- NounPhraseElement
- AdjectivePhraseElement
- VerbPhraseElement
- ClausePhraseElement
"""
import six
from .base import NLGElement
from .string import StringElement
from .word import WordElement
from ..util import get_phrase_helper
from ..lexicon.feature import ELIDED, NUMBER
from ..lexicon.feature import category as cat
from ..lexicon.feature import internal
from ..lexicon.feature import clause
from ..lexicon.feature import discourse
__all__ = ['PhraseElement', 'AdjectivePhraseElement', 'NounPhraseElement']
class PhraseElement(NLGElement):
def __init__(self, lexicon, category):
"""Create a phrase of the given type."""
super(PhraseElement, self).__init__(category=category, lexicon=lexicon)
self.features[ELIDED] = False
self.helper = get_phrase_helper(language=self.lexicon.language,
phrase_type='phrase')()
@property
def head(self):
return self.features[internal.HEAD]
@head.setter
def head(self, value):
if isinstance(value, NLGElement):
head = value
else:
head = StringElement(string=value)
head.parent = self
self.features[internal.HEAD] = head
def get_children(self):
"""Return the child components of the phrase.
The returned list will depend of the category of the element:
- Clauses consist of cue phrases, front modifiers, pre-modifiers
subjects, verb phrases and complements.
- Noun phrases consist of the specifier, pre-modifiers, the noun
subjects, complements and post-modifiers.
- Verb phrases consist of pre-modifiers, the verb group,
complements and post-modifiers.
- Canned text phrases have no children.
- All other phrases consist of pre-modifiers, the main phrase
element, complements and post-modifiers.
"""
children = []
if self.category == cat.CLAUSE:
children.append(self.cue_phrase or [])
children.extend(self.front_modifiers or [])
children.extend(self.premodifiers or [])
children.extend(self.subjects or [])
children.extend(self.verb_phrase or [])
children.extend(self.complements or [])
elif self.category == cat.NOUN_PHRASE:
children.append(self.specifier or [])
children.extend(self.premodifiers or [])
children.append(self.head or [])
children.extend(self.complements or [])
children.extend(self.postmodifiers or [])
elif self.category == cat.VERB_PHRASE:
children.extend(self.premodifiers or [])
children.append(self.head or [])
children.extend(self.complements or [])
children.extend(self.postmodifiers or [])
else:
children.extend(self.premodifiers or [])
children.append(self.head or [])
children.extend(self.complements or [])
children.extend(self.postmodifiers or [])
children = (child for child in children if child)
children = [
StringElement(string=child)
if not isinstance(child, NLGElement) else child
for child in children]
return children
def add_complement(self, complement):
"""Adds a new complement to the phrase element.
Complements will be realised in the syntax after the head
element of the phrase. Complements differ from post-modifiers
in that complements are crucial to the understanding of a phrase
whereas post-modifiers are optional.
If the new complement being added is a clause or a
CoordinatedPhraseElement then its clause status feature is set
to ClauseStatus.SUBORDINATE and it's discourse function is set
to DiscourseFunction.OBJECT by default unless an existing
discourse function exists on the complement.
"""
complements = self.features[internal.COMPLEMENTS] or []
if (
complement.category == cat.CLAUSE
# TODO: define CoordinatedPhraseElement
# or isinstance(complement, CoordinatedPhraseElement)
):
complement[internal.CLAUSE_STATUS] = clause.SUBORDINATE
if not complement.discourse_function:
complement[internal.DISCOURSE_FUNCTION] = discourse.OBJECT
complement.parent = self
complements.append(complement)
self.features[internal.COMPLEMENTS] = complements
def add_post_modifier(self, new_post_modifier):
"""Add the argument post_modifer as the phrase post modifier,
and set the parent of the post modifier as the current sentence.
"""
new_post_modifier.parent = self
current_post_modifiers = self.postmodifiers or []
current_post_modifiers.append(new_post_modifier)
self.postmodifiers = current_post_modifiers
def add_pre_modifier(self, new_pre_modifier):
"""Add the argument pre_modifer as the phrase pre modifier,
and set the parent of the pre modifier as the current sentence.
"""
new_pre_modifier.parent = self
current_pre_modifiers = self.premodifiers or []
current_pre_modifiers.append(new_pre_modifier)
self.premodifiers = current_pre_modifiers
def realise(self):
return self.helper.realise(phrase=self)
class AdjectivePhraseElement(PhraseElement):
"""This class defines a adjective phrase.
It is essentially a wrapper around the
PhraseElement class, with methods for setting common constituents
such as pre_modifiers.
"""
def __init__(self, lexicon):
super(AdjectivePhraseElement, self).__init__(
category=cat.ADJECTIVE_PHRASE, lexicon=lexicon)
@property
def adjective(self):
return self.head
@adjective.setter
def adjective(self, adjective):
if isinstance(adjective, six.text_type):
# Create a word, if not found in lexicon
adjective = self.lexicon.first(adjective, category=cat.ADJECTIVE)
self.features[internal.HEAD] = adjective
class NounPhraseElement(PhraseElement):
"""
This class defines a noun phrase. It is essentially a wrapper around the
PhraseElement class, with methods for setting common
constituents such as specifier. For example, the setNoun method
in this class sets the head of the element to be the specified noun
From an API perspective, this class is a simplified version of the
NPPhraseSpec class in simplenlg V3. It provides an alternative way for
creating syntactic structures, compared to directly manipulating a V4
PhraseElement.
"""
def __init__(self, lexicon, phrase=None):
super(NounPhraseElement, self).__init__(
category=cat.NOUN_PHRASE,
lexicon=lexicon)
self.helper = get_phrase_helper(
language=self.lexicon.language,
phrase_type=cat.NOUN_PHRASE)()
if phrase:
self.features.update(phrase.features)
self.parent = phrase.parent
@property
def noun(self):
return self.head
@noun.setter
def noun(self, value):
self.features[cat.NOUN] = value
self.features[internal.HEAD] = value
@property
def pronoun(self):
return self.features[cat.PRONOUN]
@pronoun.setter
def pronoun(self, value):
self.features[cat.PRONOUN] = value
self.features[internal.HEAD] = value
@property
def specifier(self):
return self.features[internal.SPECIFIER]
@specifier.setter
def specifier(self, value):
if isinstance(value, NLGElement):
specifier = value
else:
specifier = self.lexicon.first(value, category=cat.DETERMINER)
if specifier:
specifier.features[internal.DISCOURSE_FUNCTION] = discourse.SPECIFIER
specifier.parent = self
if isinstance(self.head, WordElement) and self.head.category == cat.PRONOUN:
self.noun = self.lexicon.first(self.head.base_form, category=cat.NOUN)
if specifier.number:
self.features[NUMBER] = specifier.number
self.features[internal.SPECIFIER] = specifier
def add_modifier(self, modifier):
self.helper.add_modifier(phrase=self, modifier=modifier)
def check_if_ne_only_negation(self):
return self.specifier.ne_only_negation or self.head.ne_only_negation
| {
"content_hash": "1565b6fea4b52a958f1e7ecc9481e08f",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 88,
"avg_line_length": 35.454918032786885,
"alnum_prop": 0.6534504681539707,
"repo_name": "brouberol/pynlg",
"id": "54cd8559984922f71866949f4f7d5cf822e84086",
"size": "8670",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "pynlg/spec/phrase.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "242719"
}
],
"symlink_target": ""
} |
define([
'knockout',
'components/Component',
'utils/AutoBind',
'utils/CommonUtils',
'text!./nav-pills.html',
'less!./nav-pills.less',
], function (
ko,
Component,
AutoBind,
commonUtils,
view
) {
class NavPills extends AutoBind(Component) {
constructor(params) {
super();
this.selected = params.selected;
this.pills = params.pills;
}
onSelect(pill, event) {
this.selected(pill.key);
}
}
return commonUtils.build('nav-pills', NavPills, view);
}); | {
"content_hash": "4dabb6a585e78a8cede00ae82a5321f7",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 55,
"avg_line_length": 17.392857142857142,
"alnum_prop": 0.6550308008213552,
"repo_name": "OHDSI/Atlas",
"id": "ea1acb27318c9f200a20e4a35f73d526d00170bc",
"size": "487",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "js/components/nav-pills.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "77555"
},
{
"name": "Dockerfile",
"bytes": "2111"
},
{
"name": "HTML",
"bytes": "1145023"
},
{
"name": "JavaScript",
"bytes": "2067738"
},
{
"name": "Less",
"bytes": "63037"
},
{
"name": "R",
"bytes": "4254"
},
{
"name": "Shell",
"bytes": "847"
}
],
"symlink_target": ""
} |
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <vmcs_sm_ioctl.h>
#include "user-vcsm.h"
#include "interface/vcos/vcos.h"
typedef struct
{
VCSM_CACHE_TYPE_T cur; /* Current pattern. */
VCSM_CACHE_TYPE_T new; /* New pattern. */
VCSM_CACHE_TYPE_T res; /* End result. */
} VCSM_CACHE_MUTEX_LKUP_T;
#define VCSM_DEVICE_NAME "/dev/vcsm"
#define VCSM_INVALID_HANDLE (-1)
static VCOS_LOG_CAT_T usrvcsm_log_category;
#define VCOS_LOG_CATEGORY (&usrvcsm_log_category)
static int vcsm_handle = VCSM_INVALID_HANDLE;
static int vcsm_refcount;
static unsigned int vcsm_page_size = 0;
static VCOS_ONCE_T vcsm_once = VCOS_ONCE_INIT;
static VCOS_MUTEX_T vcsm_mutex;
/* Cache [(current, new) -> outcome] mapping table, ignoring identity.
**
** Note: Videocore cache mode cannot be udpated 'lock' time.
*/
static VCSM_CACHE_MUTEX_LKUP_T vcsm_cache_mutex_table[] =
{
/* ------ CURRENT ------- *//* ---------- NEW --------- *//* --------- RESULT --------- */
{ VCSM_CACHE_TYPE_NONE, VCSM_CACHE_TYPE_HOST, VCSM_CACHE_TYPE_HOST },
{ VCSM_CACHE_TYPE_NONE, VCSM_CACHE_TYPE_VC, VCSM_CACHE_TYPE_NONE },
{ VCSM_CACHE_TYPE_NONE, VCSM_CACHE_TYPE_HOST_AND_VC, VCSM_CACHE_TYPE_HOST },
{ VCSM_CACHE_TYPE_HOST, VCSM_CACHE_TYPE_NONE, VCSM_CACHE_TYPE_NONE },
{ VCSM_CACHE_TYPE_HOST, VCSM_CACHE_TYPE_VC, VCSM_CACHE_TYPE_HOST },
{ VCSM_CACHE_TYPE_HOST, VCSM_CACHE_TYPE_HOST_AND_VC, VCSM_CACHE_TYPE_HOST },
{ VCSM_CACHE_TYPE_VC, VCSM_CACHE_TYPE_NONE, VCSM_CACHE_TYPE_NONE },
{ VCSM_CACHE_TYPE_VC, VCSM_CACHE_TYPE_HOST, VCSM_CACHE_TYPE_HOST_AND_VC },
{ VCSM_CACHE_TYPE_VC, VCSM_CACHE_TYPE_HOST_AND_VC, VCSM_CACHE_TYPE_HOST_AND_VC },
{ VCSM_CACHE_TYPE_HOST_AND_VC, VCSM_CACHE_TYPE_NONE, VCSM_CACHE_TYPE_VC },
{ VCSM_CACHE_TYPE_HOST_AND_VC, VCSM_CACHE_TYPE_HOST, VCSM_CACHE_TYPE_HOST_AND_VC },
{ VCSM_CACHE_TYPE_HOST_AND_VC, VCSM_CACHE_TYPE_VC, VCSM_CACHE_TYPE_VC },
/* Used for lookup termination. */
{ VCSM_CACHE_TYPE_NONE, VCSM_CACHE_TYPE_NONE, VCSM_CACHE_TYPE_NONE },
};
static VCSM_CACHE_TYPE_T vcsm_cache_table_lookup( VCSM_CACHE_TYPE_T current,
VCSM_CACHE_TYPE_T new )
{
VCSM_CACHE_MUTEX_LKUP_T *p_map = vcsm_cache_mutex_table;
while ( !( (p_map->cur == VCSM_CACHE_TYPE_NONE) &&
(p_map->new == VCSM_CACHE_TYPE_NONE) ) )
{
if ( (p_map->cur == current) && (p_map->new == new) )
{
return p_map->res;
}
p_map++;
};
vcos_log_error( "[%s]: [%d]: no mapping found for current %d - new %d",
__func__,
getpid(),
current,
new );
return current;
}
/* A one off vcsm initialization routine
*/
static void vcsm_init_once(void)
{
vcos_mutex_create(&vcsm_mutex, VCOS_FUNCTION);
vcos_log_set_level(&usrvcsm_log_category, VCOS_LOG_ERROR);
usrvcsm_log_category.flags.want_prefix = 0;
vcos_log_register( "usrvcsm", &usrvcsm_log_category );
}
/* Initialize the vcsm processing.
**
** Must be called once before attempting to do anything else.
**
** Returns 0 on success, -1 on error.
*/
int vcsm_init( void )
{
int result = VCSM_INVALID_HANDLE;
vcos_once(&vcsm_once, vcsm_init_once);
/* Only open the VCSM device once per process.
*/
vcos_mutex_lock( &vcsm_mutex );
if ( vcsm_refcount != 0 )
{
goto out; /* VCSM already opened. Nothing to do. */
}
vcsm_handle = open( VCSM_DEVICE_NAME, O_RDWR, 0 );
vcsm_page_size = getpagesize();
out:
if ( vcsm_handle != VCSM_INVALID_HANDLE )
{
result = 0;
vcsm_refcount++;
vcos_log_trace( "[%s]: [%d]: %d (align: %u) - ref-cnt %u",
__func__,
getpid(),
vcsm_handle,
vcsm_page_size,
vcsm_refcount );
}
vcos_mutex_unlock( &vcsm_mutex );
return result;
}
/* Terminates the vcsm processing.
**
** Must be called vcsm services are no longer needed, it will
** take care of removing any allocation under the current process
** control if deemed necessary.
*/
void vcsm_exit( void )
{
vcos_mutex_lock( &vcsm_mutex );
if ( vcsm_refcount == 0 )
{
goto out; /* Shouldn't really happen. */
}
if ( --vcsm_refcount != 0 )
{
vcos_log_trace( "[%s]: [%d]: %d - ref-cnt: %u",
__func__,
getpid(),
vcsm_handle,
vcsm_refcount );
goto out; /* We're done. */
}
close( vcsm_handle );
vcsm_handle = VCSM_INVALID_HANDLE;
out:
vcos_mutex_unlock( &vcsm_mutex );
}
/* Allocates a cached block of memory of size 'size' via the vcsm memory
** allocator, the type of caching requested is passed as argument of the
** function call.
**
** Returns: 0 on error
** a non-zero opaque handle on success.
**
** On success, the user must invoke vcsm_lock with the returned opaque
** handle to gain access to the memory associated with the opaque handle.
** When finished using the memory, the user calls vcsm_unlock_xx (see those
** function definition for more details on the one that can be used).
**
** A well behaved application should make every attempt to lock/unlock
** only for the duration it needs to access the memory data associated with
** the opaque handle.
*/
unsigned int vcsm_malloc_cache( unsigned int size, VCSM_CACHE_TYPE_T cache, char *name )
{
struct vmcs_sm_ioctl_alloc alloc;
unsigned int size_aligned = size;
void *usr_ptr = NULL;
int rc;
if ( (size == 0) || (vcsm_handle == VCSM_INVALID_HANDLE) )
{
vcos_log_error( "[%s]: [%d] [%s]: NULL size or invalid device!",
__func__,
getpid(),
name );
return 0;
}
memset( &alloc, 0, sizeof(alloc) );
/* Ask for page aligned.
*/
size_aligned = (size + vcsm_page_size - 1) & ~(vcsm_page_size - 1);
/* Allocate the buffer on videocore via the VCSM (Videocore Shared Memory)
** interface.
*/
alloc.size = size_aligned;
alloc.num = 1;
alloc.cached = (enum vmcs_sm_cache_e) cache; /* Convenient one to one mapping. */
alloc.handle = 0;
if ( name != NULL )
{
memcpy ( alloc.name, name, 32 );
}
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_ALLOC,
&alloc );
if ( rc < 0 || alloc.handle == 0 )
{
vcos_log_error( "[%s]: [%d] [%s]: ioctl mem-alloc FAILED [%d] (hdl: %x)",
__func__,
getpid(),
alloc.name,
rc,
alloc.handle );
goto error;
}
vcos_log_trace( "[%s]: [%d] [%s]: ioctl mem-alloc %d (hdl: %x)",
__func__,
getpid(),
alloc.name,
rc,
alloc.handle );
/* Map the buffer into user space.
*/
usr_ptr = mmap( 0,
alloc.size,
PROT_READ | PROT_WRITE,
MAP_SHARED,
vcsm_handle,
alloc.handle );
if ( usr_ptr == NULL )
{
vcos_log_error( "[%s]: [%d]: mmap FAILED (hdl: %x)",
__func__,
getpid(),
alloc.handle );
goto error;
}
return alloc.handle;
error:
if ( alloc.handle )
{
vcsm_free( alloc.handle );
}
return 0;
}
/* Allocates a non-cached block of memory of size 'size' via the vcsm memory
** allocator.
**
** Returns: 0 on error
** a non-zero opaque handle on success.
**
** On success, the user must invoke vcsm_lock with the returned opaque
** handle to gain access to the memory associated with the opaque handle.
** When finished using the memory, the user calls vcsm_unlock_xx (see those
** function definition for more details on the one that can be used).
**
** A well behaved application should make every attempt to lock/unlock
** only for the duration it needs to access the memory data associated with
** the opaque handle.
*/
unsigned int vcsm_malloc( unsigned int size, char *name )
{
return vcsm_malloc_cache( size, VMCS_SM_CACHE_NONE, name );
}
/* Shares an allocated block of memory.
**
** Returns: 0 on error
** a non-zero opaque handle on success.
**
** On success, the user must invoke vcsm_lock with the returned opaque
** handle to gain access to the memory associated with the opaque handle.
** When finished using the memory, the user calls vcsm_unlock_xx (see those
** function definition for more details on the one that can be used).
**
** A well behaved application should make every attempt to lock/unlock
** only for the duration it needs to access the memory data associated with
** the opaque handle.
*/
unsigned int vcsm_malloc_share( unsigned int handle )
{
struct vmcs_sm_ioctl_alloc_share alloc;
void *usr_ptr = NULL;
int rc;
if ( (vcsm_handle == VCSM_INVALID_HANDLE) )
{
vcos_log_error( "[%s]: [%d]: NULL size or invalid device!",
__func__,
getpid() );
return 0;
}
memset( &alloc, 0, sizeof(alloc) );
/* Share the buffer on videocore via the VCSM (Videocore Shared Memory)
** interface.
*/
alloc.handle = handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_ALLOC_SHARE,
&alloc );
if ( rc < 0 || alloc.handle == 0 )
{
vcos_log_error( "[%s]: [%d]: ioctl mem-share FAILED [%d] (hdl: %x->%x)",
__func__,
getpid(),
rc,
handle,
alloc.handle );
goto error;
}
vcos_log_trace( "[%s]: [%d]: ioctl mem-share %d (hdl: %x->%x)",
__func__,
getpid(),
rc,
handle,
alloc.handle );
/* Map the buffer into user space.
*/
usr_ptr = mmap( 0,
alloc.size,
PROT_READ | PROT_WRITE,
MAP_SHARED,
vcsm_handle,
alloc.handle );
if ( usr_ptr == NULL )
{
vcos_log_error( "[%s]: [%d]: mmap FAILED (hdl: %x)",
__func__,
getpid(),
alloc.handle );
goto error;
}
return alloc.handle;
error:
if ( alloc.handle )
{
vcsm_free( alloc.handle );
}
return 0;
}
/* Frees a block of memory that was successfully allocated by
** a prior call the vcms_alloc.
**
** The handle should be considered invalid upon return from this
** call.
**
** Whether any memory is actually freed up or not as the result of
** this call will depends on many factors, if all goes well it will
** be freed. If something goes wrong, the memory will likely end up
** being freed up as part of the vcsm_exit process. In the end the
** memory is guaranteed to be freed one way or another.
*/
void vcsm_free( unsigned int handle )
{
int rc;
struct vmcs_sm_ioctl_free alloc_free;
struct vmcs_sm_ioctl_size sz;
struct vmcs_sm_ioctl_map map;
void *usr_ptr = NULL;
if ( (vcsm_handle == VCSM_INVALID_HANDLE) || (handle == 0) )
{
vcos_log_error( "[%s]: [%d]: invalid device or handle!",
__func__,
getpid() );
goto out;
}
memset( &sz, 0, sizeof(sz) );
memset( &alloc_free, 0, sizeof(alloc_free) );
memset( &map, 0, sizeof(map) );
/* Verify what we want is valid.
*/
sz.handle = handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_SIZE_USR_HDL,
&sz );
vcos_log_trace( "[%s]: [%d]: ioctl size-usr-hdl %d (hdl: %x) - size %u",
__func__,
getpid(),
rc,
sz.handle,
sz.size );
/* We will not be able to free up the resource!
**
** However, the driver will take care of it eventually once the device is
** closed (or dies), so this is not such a dramatic event...
*/
if ( (rc < 0) || (sz.size == 0) )
{
goto out;
}
/* Un-map the buffer from user space, using the last known mapped
** address valid.
*/
usr_ptr = (void *) vcsm_usr_address( sz.handle );
if ( usr_ptr != NULL )
{
munmap( usr_ptr, sz.size );
vcos_log_trace( "[%s]: [%d]: ioctl unmap hdl: %x",
__func__,
getpid(),
sz.handle );
}
else
{
vcos_log_trace( "[%s]: [%d]: freeing unmapped area (hdl: %x)",
__func__,
getpid(),
map.handle );
}
/* Free the allocated buffer all the way through videocore.
*/
alloc_free.handle = sz.handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_FREE,
&alloc_free );
vcos_log_trace( "[%s]: [%d]: ioctl mem-free %d (hdl: %x)",
__func__,
getpid(),
rc,
alloc_free.handle );
out:
return;
}
/* Queries the status of the the vcsm.
**
** Triggers dump of various kind of information, see the
** different variants specified in VCSM_STATUS_T.
**
** Pid is optional.
*/
void vcsm_status( VCSM_STATUS_T status, int pid )
{
struct vmcs_sm_ioctl_walk walk;
if ( vcsm_handle == VCSM_INVALID_HANDLE )
{
vcos_log_error( "[%s]: [%d]: invalid device!",
__func__,
getpid() );
return;
}
memset( &walk, 0, sizeof(walk) );
/* Allow user to specify the pid of interest if desired, otherwise
** assume the current one.
*/
walk.pid = (pid == VCSM_INVALID_HANDLE) ? getpid() : pid;
switch ( status )
{
case VCSM_STATUS_VC_WALK_ALLOC:
{
ioctl( vcsm_handle,
VMCS_SM_IOCTL_VC_WALK_ALLOC,
NULL );
}
break;
case VCSM_STATUS_HOST_WALK_MAP:
{
ioctl( vcsm_handle,
VMCS_SM_IOCTL_HOST_WALK_MAP,
NULL );
}
break;
case VCSM_STATUS_HOST_WALK_PID_MAP:
{
ioctl( vcsm_handle,
VMCS_SM_IOCTL_HOST_WALK_PID_ALLOC,
&walk );
}
break;
case VCSM_STATUS_HOST_WALK_PID_ALLOC:
{
ioctl( vcsm_handle,
VMCS_SM_IOCTL_HOST_WALK_PID_MAP,
&walk );
}
break;
case VCSM_STATUS_NONE:
default:
vcos_log_error( "[%s]: [%d]: invalid argument %d",
__func__,
getpid(),
status );
break;
}
}
/* Retrieves a videocore opaque handle from a mapped user address
** pointer. The videocore handle will correspond to the actual
** memory mapped in videocore.
**
** Returns: 0 on error
** a non-zero opaque handle on success.
**
** Note: the videocore opaque handle is distinct from the user
** opaque handle (allocated via vcsm_malloc) and it is only
** significant for such application which knows what to do
** with it, for the others it is just a number with little
** use since nothing can be done with it (in particular
** for safety reason it cannot be used to map anything).
*/
unsigned int vcsm_vc_hdl_from_ptr( void *usr_ptr )
{
int rc;
struct vmcs_sm_ioctl_map map;
if ( (vcsm_handle == VCSM_INVALID_HANDLE) || (usr_ptr == NULL) )
{
vcos_log_error( "[%s]: [%d]: invalid device!",
__func__,
getpid() );
return 0;
}
memset( &map, 0, sizeof(map) );
map.pid = getpid();
map.addr = (unsigned int) usr_ptr;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MAP_VC_HDL_FR_ADDR,
&map );
if ( rc < 0 )
{
vcos_log_error( "[%s]: [%d]: ioctl mapped-usr-hdl FAILED [%d] (pid: %d, addr: %x)",
__func__,
getpid(),
rc,
map.pid,
map.addr );
return 0;
}
else
{
vcos_log_trace( "[%s]: [%d]: ioctl mapped-usr-hdl %d (hdl: %x, addr: %x)",
__func__,
getpid(),
rc,
map.handle,
map.addr );
return map.handle;
}
}
/* Retrieves a videocore opaque handle from a opaque handle
** pointer. The videocore handle will correspond to the actual
** memory mapped in videocore.
**
** Returns: 0 on error
** a non-zero opaque handle on success.
**
** Note: the videocore opaque handle is distinct from the user
** opaque handle (allocated via vcsm_malloc) and it is only
** significant for such application which knows what to do
** with it, for the others it is just a number with little
** use since nothing can be done with it (in particular
** for safety reason it cannot be used to map anything).
*/
unsigned int vcsm_vc_hdl_from_hdl( unsigned int handle )
{
int rc;
struct vmcs_sm_ioctl_map map;
if ( (vcsm_handle == VCSM_INVALID_HANDLE) || (handle == 0) )
{
vcos_log_error( "[%s]: [%d]: invalid device or handle!",
__func__,
getpid() );
return 0;
}
memset( &map, 0, sizeof(map) );
map.pid = getpid();
map.handle = handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MAP_VC_HDL_FR_HDL,
&map );
if ( rc < 0 )
{
vcos_log_error( "[%s]: [%d]: ioctl mapped-usr-hdl FAILED [%d] (pid: %d, hdl: %x)",
__func__,
getpid(),
rc,
map.pid,
map.handle );
return 0;
}
else
{
vcos_log_trace( "[%s]: [%d]: ioctl mapped-usr-hdl %d (hdl: %x)",
__func__,
getpid(),
rc,
map.handle );
return map.handle;
}
}
/* Retrieves a mapped user address from an opaque user
** handle.
**
** Returns: 0 on error
** a non-zero address on success.
**
** On success, the address corresponds to the pointer
** which can access the data allocated via the vcsm_malloc
** call.
*/
void *vcsm_usr_address( unsigned int handle )
{
int rc;
struct vmcs_sm_ioctl_map map;
if ( (vcsm_handle == VCSM_INVALID_HANDLE) || (handle == 0) )
{
vcos_log_error( "[%s]: [%d]: invalid device or handle!",
__func__,
getpid() );
return NULL;
}
memset( &map, 0, sizeof(map) );
map.pid = getpid();
map.handle = handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MAP_USR_ADDRESS,
&map );
if ( rc < 0 )
{
vcos_log_error( "[%s]: [%d]: ioctl mapped-usr-address FAILED [%d] (pid: %d, addr: %x)",
__func__,
getpid(),
rc,
map.pid,
map.addr );
return NULL;
}
else
{
vcos_log_trace( "[%s]: [%d]: ioctl mapped-usr-address %d (hdl: %x, addr: %x)",
__func__,
getpid(),
rc,
map.handle,
map.addr );
return (void*)map.addr;
}
}
/* Retrieves a user opaque handle from a mapped user address
** pointer.
**
** Returns: 0 on error
** a non-zero opaque handle on success.
*/
unsigned int vcsm_usr_handle( void *usr_ptr )
{
int rc;
struct vmcs_sm_ioctl_map map;
if ( (vcsm_handle == VCSM_INVALID_HANDLE) || (usr_ptr == NULL) )
{
vcos_log_error( "[%s]: [%d]: invalid device or null usr-ptr!",
__func__,
getpid() );
return 0;
}
memset( &map, 0, sizeof(map) );
map.pid = getpid();
map.addr = (unsigned int) usr_ptr;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MAP_USR_HDL,
&map );
if ( rc < 0 )
{
vcos_log_error( "[%s]: [%d]: ioctl mapped-usr-hdl FAILED [%d] (pid: %d, addr: %x)",
__func__,
getpid(),
rc,
map.pid,
map.addr );
return 0;
}
else
{
vcos_log_trace( "[%s]: [%d]: ioctl mapped-usr-hdl %d (hdl: %x, addr: %x)",
__func__,
getpid(),
rc,
map.handle,
map.addr );
return map.handle;
}
}
/* Locks the memory associated with this opaque handle.
**
** Returns: NULL on error
** a valid pointer on success.
**
** A user MUST lock the handle received from vcsm_malloc
** in order to be able to use the memory associated with it.
**
** On success, the pointer returned is only valid within
** the lock content (ie until a corresponding vcsm_unlock_xx
** is invoked).
*/
void *vcsm_lock( unsigned int handle )
{
int rc;
struct vmcs_sm_ioctl_lock_unlock lock_unlock;
struct vmcs_sm_ioctl_size sz;
struct vmcs_sm_ioctl_map map;
struct vmcs_sm_ioctl_cache cache;
void *usr_ptr = NULL;
if ( (vcsm_handle == VCSM_INVALID_HANDLE) || (handle == 0) )
{
vcos_log_error( "[%s]: [%d]: invalid device or invalid handle!",
__func__,
getpid() );
goto out;
}
memset( &sz, 0, sizeof(sz) );
memset( &lock_unlock, 0, sizeof(lock_unlock) );
memset( &map, 0, sizeof(map) );
memset( &cache, 0, sizeof(cache) );
/* Verify what we want is valid.
*/
sz.handle = handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_SIZE_USR_HDL,
&sz );
vcos_log_trace( "[%s]: [%d]: ioctl size-usr-hdl %d (hdl: %x) - size %u",
__func__,
getpid(),
rc,
sz.handle,
sz.size );
/* We will not be able to lock the resource!
*/
if ( (rc < 0) || (sz.size == 0) )
{
goto out;
}
/* Lock the allocated buffer all the way through videocore.
*/
lock_unlock.handle = sz.handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_LOCK,
&lock_unlock );
vcos_log_trace( "[%s]: [%d]: ioctl mem-lock %d (hdl: %x)",
__func__,
getpid(),
rc,
lock_unlock.handle );
/* We will not be able to lock the resource!
*/
if ( rc < 0 )
{
goto out;
}
usr_ptr = (void *) lock_unlock.addr;
/* If applicable, invalidate the cache now.
*/
if ( usr_ptr && sz.size )
{
cache.handle = sz.handle;
cache.addr = (unsigned int) usr_ptr;
cache.size = sz.size;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_INVALID,
&cache );
vcos_log_trace( "[%s]: [%d]: ioctl invalidate (cache) %d (hdl: %x, addr: %x, size: %u)",
__func__,
getpid(),
rc,
cache.handle,
cache.addr,
cache.size );
if ( rc < 0 )
{
vcos_log_error( "[%s]: [%d]: invalidate failed (rc: %d) - [%x;%x] - size: %u (hdl: %x) - cache incoherency",
__func__,
getpid(),
rc,
(unsigned int) cache.addr,
(unsigned int) (cache.addr + cache.size),
(unsigned int) (cache.addr + cache.size) - (unsigned int) cache.addr,
cache.handle );
}
}
/* Done.
*/
goto out;
out:
return usr_ptr;
}
/* Locks the memory associated with this opaque handle. The lock
** also gives a chance to update the *host* cache behavior of the
** allocated buffer if so desired. The *videocore* cache behavior
** of the allocated buffer cannot be changed by this call and such
** attempt will be ignored.
**
** The system will attempt to honour the cache_update mode request,
** the cache_result mode will provide the final answer on which cache
** mode is really in use. Failing to change the cache mode will not
** result in a failure to lock the buffer as it is an application
** decision to choose what to do if (cache_result != cache_update)
**
** The value returned in cache_result can only be considered valid if
** the returned pointer is non NULL. The cache_result pointer may be
** NULL if the application does not care about the actual outcome of
** its action with regards to the cache behavior change.
**
** Returns: NULL on error
** a valid pointer on success.
**
** A user MUST lock the handle received from vcsm_malloc
** in order to be able to use the memory associated with it.
**
** On success, the pointer returned is only valid within
** the lock content (ie until a corresponding vcsm_unlock_xx
** is invoked).
*/
void *vcsm_lock_cache( unsigned int handle,
VCSM_CACHE_TYPE_T cache_update,
VCSM_CACHE_TYPE_T *cache_result )
{
int rc;
struct vmcs_sm_ioctl_lock_cache lock_cache;
struct vmcs_sm_ioctl_chk chk;
struct vmcs_sm_ioctl_map map;
struct vmcs_sm_ioctl_cache cache;
struct vmcs_sm_ioctl_size sz;
void *usr_ptr = NULL;
VCSM_CACHE_TYPE_T new_cache;
if ( (vcsm_handle == VCSM_INVALID_HANDLE) || (handle == 0) )
{
vcos_log_error( "[%s]: [%d]: invalid device or invalid handle!",
__func__,
getpid() );
goto out;
}
memset( &chk, 0, sizeof(chk) );
memset( &sz, 0, sizeof(sz) );
memset( &lock_cache, 0, sizeof(lock_cache) );
memset( &map, 0, sizeof(map) );
memset( &cache, 0, sizeof(cache) );
/* Verify what we want is valid.
*/
chk.handle = handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_CHK_USR_HDL,
&chk );
vcos_log_trace( "[%s]: [%d]: ioctl chk-usr-hdl %d (hdl: %x, addr: %x, sz: %u, cache: %d)",
__func__,
getpid(),
rc,
chk.handle,
chk.addr,
chk.size,
chk.cache );
/* We will not be able to lock the resource!
*/
if ( rc < 0 )
{
goto out;
}
/* Validate cache requirements.
*/
if ( cache_update != (VCSM_CACHE_TYPE_T)chk.cache )
{
new_cache = vcsm_cache_table_lookup( (VCSM_CACHE_TYPE_T) chk.cache,
cache_update );
vcos_log_trace( "[%s]: [%d]: cache lookup hdl: %x: [cur %d ; req %d] -> new %d ",
__func__,
getpid(),
chk.handle,
(VCSM_CACHE_TYPE_T)chk.cache,
cache_update,
new_cache );
if ( (enum vmcs_sm_cache_e)new_cache == chk.cache )
{
/* Effectively no change.
*/
if ( cache_result != NULL )
{
*cache_result = new_cache;
}
goto lock_default;
}
}
else
{
if ( cache_result != NULL )
{
*cache_result = (VCSM_CACHE_TYPE_T)chk.cache;
}
goto lock_default;
}
/* At this point we know we want to lock the buffer and apply a cache
** behavior change. Start by cleaning out whatever is already setup.
*/
if ( chk.addr && chk.size )
{
munmap( (void *)chk.addr, chk.size );
vcos_log_trace( "[%s]: [%d]: ioctl unmap hdl: %x",
__func__,
getpid(),
chk.handle );
}
/* Lock and apply cache behavior change to the allocated buffer all the
** way through videocore.
*/
lock_cache.handle = chk.handle;
lock_cache.cached = (enum vmcs_sm_cache_e) new_cache; /* Convenient one to one mapping. */
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_LOCK_CACHE,
&lock_cache );
vcos_log_trace( "[%s]: [%d]: ioctl mem-lock-cache %d (hdl: %x)",
__func__,
getpid(),
rc,
lock_cache.handle );
/* We will not be able to lock the resource!
*/
if ( rc < 0 )
{
goto out;
}
/* It is possible that this size was zero if the resource was
** already un-mapped when we queried it, in such case we need
** to figure out the size now to allow mapping to work.
*/
if ( chk.size == 0 )
{
sz.handle = chk.handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_SIZE_USR_HDL,
&sz );
vcos_log_trace( "[%s]: [%d]: ioctl size-usr-hdl %d (hdl: %x) - size %u",
__func__,
getpid(),
rc,
sz.handle,
sz.size );
/* We will not be able to map again the resource!
*/
if ( (rc < 0) || (sz.size == 0) )
{
goto out;
}
}
/* Map the locked buffer into user space.
*/
usr_ptr = mmap( 0,
(chk.size != 0) ? chk.size : sz.size,
PROT_READ | PROT_WRITE,
MAP_SHARED,
vcsm_handle,
chk.handle );
if ( usr_ptr == NULL )
{
vcos_log_error( "[%s]: [%d]: mmap FAILED (hdl: %x)",
__func__,
getpid(),
chk.handle );
}
/* If applicable, invalidate the cache now.
*/
cache.size = (chk.size != 0) ? chk.size : sz.size;
if ( usr_ptr && cache.size )
{
cache.handle = chk.handle;
cache.addr = (unsigned int) usr_ptr;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_INVALID,
&cache );
vcos_log_trace( "[%s]: [%d]: ioctl invalidate (cache) %d (hdl: %x, addr: %x, size: %u)",
__func__,
getpid(),
rc,
cache.handle,
cache.addr,
cache.size );
if ( rc < 0 )
{
vcos_log_error( "[%s]: [%d]: invalidate failed (rc: %d) - [%x;%x] - size: %u (hdl: %x) - cache incoherency",
__func__,
getpid(),
rc,
(unsigned int) cache.addr,
(unsigned int) (cache.addr + cache.size),
(unsigned int) (cache.addr + cache.size) - (unsigned int) cache.addr,
cache.handle );
}
}
/* Update the caller with the information it expects to see.
*/
if ( cache_result != NULL )
{
*cache_result = new_cache;
}
/* Done.
*/
goto out;
lock_default:
usr_ptr = vcsm_lock ( handle );
out:
return usr_ptr;
}
/* Unlocks the memory associated with this user mapped address.
** Apply special processing that would override the otherwise
** default behavior.
**
** If 'cache_no_flush' is specified:
** Do not flush cache as the result of the unlock (if cache
** flush was otherwise applicable in this case).
**
** Returns: 0 on success
** -errno on error.
**
** After unlocking a mapped address, the user should no longer
** attempt to reference it.
*/
int vcsm_unlock_ptr_sp( void *usr_ptr, int cache_no_flush )
{
int rc;
struct vmcs_sm_ioctl_lock_unlock lock_unlock;
struct vmcs_sm_ioctl_map map;
struct vmcs_sm_ioctl_cache cache;
if ( (vcsm_handle == VCSM_INVALID_HANDLE) || (usr_ptr == NULL) )
{
vcos_log_error( "[%s]: [%d]: invalid device or invalid user-ptr!",
__func__,
getpid() );
rc = -EIO;
goto out;
}
memset( &map, 0, sizeof(map) );
memset( &lock_unlock, 0, sizeof(lock_unlock) );
memset( &cache, 0, sizeof(cache) );
/* Retrieve the handle of the memory we want to lock.
*/
map.pid = getpid();
map.addr = (unsigned int) usr_ptr;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MAP_USR_HDL,
&map );
vcos_log_trace( "[%s]: [%d]: ioctl mapped-usr-hdl %d (hdl: %x, addr: %x, sz: %u)",
__func__,
getpid(),
rc,
map.handle,
map.addr,
map.size );
/* We will not be able to flush/unlock the resource!
*/
if ( rc < 0 )
{
goto out;
}
/* If applicable, flush the cache now.
*/
if ( !cache_no_flush && map.addr && map.size )
{
cache.handle = map.handle;
cache.addr = map.addr;
cache.size = map.size;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_FLUSH,
&cache );
vcos_log_trace( "[%s]: [%d]: ioctl flush (cache) %d (hdl: %x, addr: %x, size: %u)",
__func__,
getpid(),
rc,
cache.handle,
cache.addr,
cache.size );
if ( rc < 0 )
{
vcos_log_error( "[%s]: [%d]: flush failed (rc: %d) - [%x;%x] - size: %u (hdl: %x) - cache incoherency",
__func__,
getpid(),
rc,
(unsigned int) cache.addr,
(unsigned int) (cache.addr + cache.size),
(unsigned int) (cache.addr + cache.size) - (unsigned int) cache.addr,
cache.handle );
}
}
/* Unock the allocated buffer all the way through videocore.
*/
lock_unlock.handle = map.handle; /* From above ioctl. */
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_UNLOCK,
&lock_unlock );
vcos_log_trace( "[%s]: [%d]: ioctl mem-unlock %d (hdl: %x)",
__func__,
getpid(),
rc,
lock_unlock.handle );
out:
return rc;
}
/* Unlocks the memory associated with this user mapped address.
**
** Returns: 0 on success
** -errno on error.
**
** After unlocking a mapped address, the user should no longer
** attempt to reference it.
*/
int vcsm_unlock_ptr( void *usr_ptr )
{
return vcsm_unlock_ptr_sp( usr_ptr, 0 );
}
/* Unlocks the memory associated with this user opaque handle.
** Apply special processing that would override the otherwise
** default behavior.
**
** If 'cache_no_flush' is specified:
** Do not flush cache as the result of the unlock (if cache
** flush was otherwise applicable in this case).
**
** Returns: 0 on success
** -errno on error.
**
** After unlocking an opaque handle, the user should no longer
** attempt to reference the mapped addressed once associated
** with it.
*/
int vcsm_unlock_hdl_sp( unsigned int handle, int cache_no_flush )
{
int rc;
struct vmcs_sm_ioctl_lock_unlock lock_unlock;
struct vmcs_sm_ioctl_chk chk;
struct vmcs_sm_ioctl_cache cache;
struct vmcs_sm_ioctl_map map;
if ( (vcsm_handle == VCSM_INVALID_HANDLE) || (handle == 0) )
{
vcos_log_error( "[%s]: [%d]: invalid device or invalid handle!",
__func__,
getpid() );
rc = -EIO;
goto out;
}
memset( &chk, 0, sizeof(chk) );
memset( &lock_unlock, 0, sizeof(lock_unlock) );
memset( &cache, 0, sizeof(cache) );
memset( &map, 0, sizeof(map) );
/* Retrieve the handle of the memory we want to lock.
*/
chk.handle = handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_CHK_USR_HDL,
&chk );
vcos_log_trace( "[%s]: [%d]: ioctl chk-usr-hdl %d (hdl: %x, addr: %x, sz: %u) nf %d",
__func__,
getpid(),
rc,
chk.handle,
chk.addr,
chk.size,
cache_no_flush);
/* We will not be able to flush/unlock the resource!
*/
if ( rc < 0 )
{
goto out;
}
/* If applicable, flush the cache now.
*/
if ( !cache_no_flush && chk.addr && chk.size )
{
cache.handle = chk.handle;
cache.addr = chk.addr;
cache.size = chk.size;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_FLUSH,
&cache );
vcos_log_trace( "[%s]: [%d]: ioctl flush (cache) %d (hdl: %x)",
__func__,
getpid(),
rc,
cache.handle );
if ( rc < 0 )
{
vcos_log_error( "[%s]: [%d]: flush failed (rc: %d) - [%x;%x] - size: %u (hdl: %x) - cache incoherency",
__func__,
getpid(),
rc,
(unsigned int) cache.addr,
(unsigned int) (cache.addr + cache.size),
(unsigned int) (cache.addr + cache.size) - (unsigned int) cache.addr,
cache.handle );
}
}
/* Unlock the allocated buffer all the way through videocore.
*/
lock_unlock.handle = chk.handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_UNLOCK,
&lock_unlock );
vcos_log_trace( "[%s]: [%d]: ioctl mem-unlock %d (hdl: %x)",
__func__,
getpid(),
rc,
lock_unlock.handle );
out:
return rc;
}
/* Unlocks the memory associated with this user opaque handle.
**
** Returns: 0 on success
** -errno on error.
**
** After unlocking an opaque handle, the user should no longer
** attempt to reference the mapped addressed once associated
** with it.
*/
int vcsm_unlock_hdl( unsigned int handle )
{
return vcsm_unlock_hdl_sp( handle, 0 );
}
/* Resizes a block of memory allocated previously by vcsm_alloc.
**
** Returns: 0 on success
** -errno on error.
**
** The handle must be unlocked by user prior to attempting any
** resize action.
**
** On error, the original size allocated against the handle
** remains available the same way it would be following a
** successful vcsm_malloc.
*/
int vcsm_resize( unsigned int handle, unsigned int new_size )
{
int rc;
struct vmcs_sm_ioctl_size sz;
struct vmcs_sm_ioctl_resize resize;
struct vmcs_sm_ioctl_lock_unlock lock_unlock;
struct vmcs_sm_ioctl_map map;
unsigned int size_aligned = new_size;
void *usr_ptr = NULL;
if ( (vcsm_handle == VCSM_INVALID_HANDLE) || (handle == 0) )
{
vcos_log_error( "[%s]: [%d]: invalid device or invalid handle!",
__func__,
getpid() );
rc = -EIO;
goto out;
}
memset( &sz, 0, sizeof(sz) );
memset( &resize, 0, sizeof(resize) );
memset( &lock_unlock, 0, sizeof(lock_unlock) );
memset( &map, 0, sizeof(map) );
/* Ask for page aligned.
*/
size_aligned = (new_size + vcsm_page_size - 1) & ~(vcsm_page_size - 1);
/* Verify what we want is valid.
*/
sz.handle = handle;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_SIZE_USR_HDL,
&sz );
vcos_log_trace( "[%s]: [%d]: ioctl size-usr-hdl %d (hdl: %x) - size %u",
__func__,
getpid(),
rc,
sz.handle,
sz.size );
/* We will not be able to free up the resource!
**
** However, the driver will take care of it eventually once the device is
** closed (or dies), so this is not such a dramatic event...
*/
if ( (rc < 0) || (sz.size == 0) )
{
goto out;
}
/* We first need to unmap the resource
*/
usr_ptr = (void *) vcsm_usr_address( sz.handle );
if ( usr_ptr != NULL )
{
munmap( usr_ptr, sz.size );
vcos_log_trace( "[%s]: [%d]: ioctl unmap hdl: %x",
__func__,
getpid(),
sz.handle );
}
else
{
vcos_log_trace( "[%s]: [%d]: freeing unmapped area (hdl: %x)",
__func__,
getpid(),
map.handle );
}
/* Resize the allocated buffer all the way through videocore.
*/
resize.handle = sz.handle;
resize.new_size = size_aligned;
rc = ioctl( vcsm_handle,
VMCS_SM_IOCTL_MEM_RESIZE,
&resize );
vcos_log_trace( "[%s]: [%d]: ioctl resize %d (hdl: %x)",
__func__,
getpid(),
rc,
resize.handle );
/* Although resized, the resource will not be usable.
*/
if ( rc < 0 )
{
goto out;
}
/* Remap the resource
*/
if ( mmap( 0,
resize.new_size,
PROT_READ | PROT_WRITE,
MAP_SHARED,
vcsm_handle,
resize.handle ) == NULL )
{
vcos_log_error( "[%s]: [%d]: mmap FAILED (hdl: %x)",
__func__,
getpid(),
resize.handle );
/* At this point, it is not yet a problem that we failed to
** map the buffer because it will not be used right away.
**
** Possibly the mapping may work the next time the user tries
** to lock the buffer for usage, and if it still fails, it will
** be up to the user to deal with it.
*/
// goto out;
}
out:
return rc;
}
| {
"content_hash": "2db78cf111ab104cd6907299b99f1473",
"timestamp": "",
"source": "github",
"line_count": 1536,
"max_line_length": 117,
"avg_line_length": 27.516927083333332,
"alnum_prop": 0.5041167841764066,
"repo_name": "guker/userland",
"id": "2202949035e30e7590ed2ac6b259d51832609215",
"size": "43797",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "host_applications/linux/libs/sm/user-vcsm.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
Change the appearance or behavior of DOM elements and Angular components with attribute directives.
<div class="alert is-helpful">
See the <live-example></live-example> for a working example containing the code snippets in this guide.
</div>
## Building an attribute directive
This section walks you through creating a highlight directive that sets the background color of the host element to yellow.
1. To create a directive, use the CLI command [`ng generate directive`](cli/generate).
<code-example format="shell" language="shell">
ng generate directive highlight
</code-example>
The CLI creates `src/app/highlight.directive.ts`, a corresponding test file `src/app/highlight.directive.spec.ts`, and declares the directive class in the `AppModule`.
The CLI generates the default `src/app/highlight.directive.ts` as follows:
<code-example header="src/app/highlight.directive.ts" path="attribute-directives/src/app/highlight.directive.0.ts"></code-example>
The `@Directive()` decorator's configuration property specifies the directive's CSS attribute selector, `[appHighlight]`.
1. Import `ElementRef` from `@angular/core`.
`ElementRef` grants direct access to the host DOM element through its `nativeElement` property.
1. Add `ElementRef` in the directive's `constructor()` to [inject](guide/dependency-injection) a reference to the host DOM element, the element to which you apply `appHighlight`.
1. Add logic to the `HighlightDirective` class that sets the background to yellow.
<code-example header="src/app/highlight.directive.ts" path="attribute-directives/src/app/highlight.directive.1.ts"></code-example>
<div class="alert is-helpful">
Directives *do not* support namespaces.
<code-example header="src/app/app.component.avoid.html (unsupported)" path="attribute-directives/src/app/app.component.avoid.html" region="unsupported"></code-example>
</div>
<a id="apply-directive"></a>
## Applying an attribute directive
1. To use the `HighlightDirective`, add a `<p>` element to the HTML template with the directive as an attribute.
<code-example header="src/app/app.component.html" path="attribute-directives/src/app/app.component.1.html" region="applied"></code-example>
Angular creates an instance of the `HighlightDirective` class and injects a reference to the `<p>` element into the directive's constructor, which sets the `<p>` element's background style to yellow.
<a id="respond-to-user"></a>
## Handling user events
This section shows you how to detect when a user mouses into or out of the element and to respond by setting or clearing the highlight color.
1. Import `HostListener` from '@angular/core'.
<code-example header="src/app/highlight.directive.ts (imports)" path="attribute-directives/src/app/highlight.directive.2.ts" region="imports"></code-example>
1. Add two event handlers that respond when the mouse enters or leaves, each with the `@HostListener()` decorator.
<code-example header="src/app/highlight.directive.ts (mouse-methods)" path="attribute-directives/src/app/highlight.directive.2.ts" region="mouse-methods"></code-example>
Subscribe to events of the DOM element that hosts an attribute directive, the `<p>` in this case, with the `@HostListener()` decorator.
<div class="alert is-helpful">
The handlers delegate to a helper method, `highlight()`, that sets the color on the host DOM element, `el`.
</div>
The complete directive is as follows:
<code-example header="src/app/highlight.directive.ts" path="attribute-directives/src/app/highlight.directive.2.ts"></code-example>
The background color appears when the pointer hovers over the paragraph element and disappears as the pointer moves out.
<div class="lightbox">
<img alt="Second Highlight" src="generated/images/guide/attribute-directives/highlight-directive-anim.gif">
</div>
<a id="bindings"></a>
## Passing values into an attribute directive
This section walks you through setting the highlight color while applying the `HighlightDirective`.
1. In `highlight.directive.ts`, import `Input` from `@angular/core`.
<code-example header="src/app/highlight.directive.ts (imports)" path="attribute-directives/src/app/highlight.directive.3.ts" region="imports"></code-example>
1. Add an `appHighlight` `@Input()` property.
<code-example header="src/app/highlight.directive.ts" path="attribute-directives/src/app/highlight.directive.3.ts" region="input"></code-example>
The `@Input()` decorator adds metadata to the class that makes the directive's `appHighlight` property available for binding.
1. In `app.component.ts`, add a `color` property to the `AppComponent`.
<code-example header="src/app/app.component.ts (class)" path="attribute-directives/src/app/app.component.1.ts" region="class"></code-example>
1. To simultaneously apply the directive and the color, use property binding with the `appHighlight` directive selector, setting it equal to `color`.
<code-example header="src/app/app.component.html (color)" path="attribute-directives/src/app/app.component.html" region="color"></code-example>
The `[appHighlight]` attribute binding performs two tasks:
* Applies the highlighting directive to the `<p>` element
* Sets the directive's highlight color with a property binding
### Setting the value with user input
This section guides you through adding radio buttons to bind your color choice to the `appHighlight` directive.
1. Add markup to `app.component.html` for choosing a color as follows:
<code-example header="src/app/app.component.html (v2)" path="attribute-directives/src/app/app.component.html" region="v2"></code-example>
1. Revise the `AppComponent.color` so that it has no initial value.
<code-example header="src/app/app.component.ts (class)" path="attribute-directives/src/app/app.component.ts" region="class"></code-example>
1. In `highlight.directive.ts`, revise `onMouseEnter` method so that it first tries to highlight with `appHighlight` and falls back to `red` if `appHighlight` is `undefined`.
<code-example header="src/app/highlight.directive.ts (mouse-enter)" path="attribute-directives/src/app/highlight.directive.3.ts" region="mouse-enter"></code-example>
1. Serve your application to verify that the user can choose the color with the radio buttons.
<div class="lightbox">
<img alt="Animated gif of the refactored highlight directive changing color according to the radio button the user selects" src="generated/images/guide/attribute-directives/highlight-directive-v2-anim.gif">
</div>
<a id="second-property"></a>
## Binding to a second property
This section guides you through configuring your application so the developer can set the default color.
1. Add a second `Input()` property to `HighlightDirective` called `defaultColor`.
<code-example header="src/app/highlight.directive.ts (defaultColor)" path="attribute-directives/src/app/highlight.directive.ts" region="defaultColor"></code-example>
1. Revise the directive's `onMouseEnter` so that it first tries to highlight with the `appHighlight`, then with the `defaultColor`, and falls back to `red` if both properties are `undefined`.
<code-example header="src/app/highlight.directive.ts (mouse-enter)" path="attribute-directives/src/app/highlight.directive.ts" region="mouse-enter"></code-example>
1. To bind to the `AppComponent.color` and fall back to "violet" as the default color, add the following HTML.
In this case, the `defaultColor` binding doesn't use square brackets, `[]`, because it is static.
<code-example header="src/app/app.component.html (defaultColor)" path="attribute-directives/src/app/app.component.html" region="defaultColor"></code-example>
As with components, you can add multiple directive property bindings to a host element.
The default color is red if there is no default color binding.
When the user chooses a color the selected color becomes the active highlight color.
<div class="lightbox">
<img alt="Animated gif of final highlight directive that shows red color with no binding and violet with the default color set. When user selects color, the selection takes precedence." src="generated/images/guide/attribute-directives/highlight-directive-final-anim.gif">
</div>
<a id="ngNonBindable"></a>
## Deactivating Angular processing with `NgNonBindable`
To prevent expression evaluation in the browser, add `ngNonBindable` to the host element.
`ngNonBindable` deactivates interpolation, directives, and binding in templates.
In the following example, the expression `{{ 1 + 1 }}` renders just as it does in your code editor, and does not display `2`.
<code-example header="src/app/app.component.html" linenums="false" path="attribute-directives/src/app/app.component.html" region="ngNonBindable"></code-example>
Applying `ngNonBindable` to an element stops binding for that element's child elements.
However, `ngNonBindable` still lets directives work on the element where you apply `ngNonBindable`.
In the following example, the `appHighlight` directive is still active but Angular does not evaluate the expression `{{ 1 + 1 }}`.
<code-example header="src/app/app.component.html" linenums="false" path="attribute-directives/src/app/app.component.html" region="ngNonBindable-with-directive"></code-example>
If you apply `ngNonBindable` to a parent element, Angular disables interpolation and binding of any sort, such as property binding or event binding, for the element's children.
<!-- links -->
<!-- external links -->
<!-- end links -->
@reviewed 2022-02-28
| {
"content_hash": "69063794ba2c66355fb4bdd85eb3405d",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 271,
"avg_line_length": 48.59090909090909,
"alnum_prop": 0.7593805217752833,
"repo_name": "angular-indonesia/angular",
"id": "00d9f9e6a329d63e0f88845f87806648034cbc74",
"size": "9645",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "aio/content/guide/attribute-directives.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "250751"
},
{
"name": "Dockerfile",
"bytes": "9419"
},
{
"name": "HTML",
"bytes": "539499"
},
{
"name": "JavaScript",
"bytes": "2378405"
},
{
"name": "Less",
"bytes": "80"
},
{
"name": "NASL",
"bytes": "7222"
},
{
"name": "SCSS",
"bytes": "133406"
},
{
"name": "Shell",
"bytes": "74640"
},
{
"name": "Starlark",
"bytes": "593052"
},
{
"name": "TypeScript",
"bytes": "23491491"
},
{
"name": "jq",
"bytes": "619"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<rootTag>
<Award>
<AwardTitle>Graduate Research Fellowship Program (GRFP)</AwardTitle>
<AwardEffectiveDate>02/01/2013</AwardEffectiveDate>
<AwardExpirationDate>01/31/2018</AwardExpirationDate>
<AwardAmount>776855</AwardAmount>
<AwardInstrument>
<Value>Fellowship</Value>
</AwardInstrument>
<Organization>
<Code>11010101</Code>
<Directorate>
<LongName>Direct For Education and Human Resources</LongName>
</Directorate>
<Division>
<LongName>Division Of Graduate Education</LongName>
</Division>
</Organization>
<ProgramOfficer>
<SignBlockName>Gisele T. Muller-Parker</SignBlockName>
</ProgramOfficer>
<AbstractNarration/>
<MinAmdLetterDate>02/05/2013</MinAmdLetterDate>
<MaxAmdLetterDate>08/15/2016</MaxAmdLetterDate>
<ARRAAmount/>
<AwardID>1321850</AwardID>
<Investigator>
<FirstName>Radmila</FirstName>
<LastName>Prislin</LastName>
<EmailAddress>[email protected]</EmailAddress>
<StartDate>02/05/2013</StartDate>
<EndDate/>
<RoleCode>Principal Investigator</RoleCode>
</Investigator>
<Institution>
<Name>San Diego State University Foundation</Name>
<CityName>San Diego</CityName>
<ZipCode>921822190</ZipCode>
<PhoneNumber>6195945731</PhoneNumber>
<StreetAddress>5250 Campanile Drive</StreetAddress>
<CountryName>United States</CountryName>
<StateName>California</StateName>
<StateCode>CA</StateCode>
</Institution>
<ProgramElement>
<Code>007Y</Code>
<Text/>
</ProgramElement>
<ProgramElement>
<Code>008y</Code>
<Text/>
</ProgramElement>
<ProgramElement>
<Code>7172</Code>
<Text>GRADUATE RESEARCH FELLOWSHIPS</Text>
</ProgramElement>
<ProgramReference>
<Code>7172</Code>
<Text>GRADUATE FELLOWSHIPS</Text>
</ProgramReference>
<ProgramReference>
<Code>9179</Code>
<Text>GRADUATE INVOLVEMENT</Text>
</ProgramReference>
<ProgramReference>
<Code>SMET</Code>
<Text>SCIENCE, MATH, ENG & TECH EDUCATION</Text>
</ProgramReference>
</Award>
</rootTag>
| {
"content_hash": "68f3c66594476069b5495a4a82a859d2",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 72,
"avg_line_length": 31.069444444444443,
"alnum_prop": 0.6665176575771122,
"repo_name": "jallen2/Research-Trend",
"id": "f6e19372285998e0af8ffbde4ac7b7f9149fc361",
"size": "2237",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CU_Funding/2013/1321850.xml",
"mode": "33261",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<listing xmlns="http://release.ihtsdo.org/manifest/1.0.0">
<folder Name="SnomedCT_Release_INTBadDelta_20140131">
<file Name="Readme_20140131.txt"/>
<folder Name="RF2Release">
<folder Name="Full">
<folder Name="Refset">
<folder Name="Language">
<file Name="der2_cRefset_LanguageFull-en_INT_20140131.txt"/>
</folder>
</folder>
<folder Name="Terminology">
<file Name="sct2_Concept_Full_INT_20140131.txt"/>
</folder>
</folder>
<folder Name="Snapshot">
<folder Name="Refset">
<folder Name="Language">
<file Name="der2_cRefset_LanguageSnapshot-en_INT_20140131.txt"/>
</folder>
</folder>
<folder Name="Terminology">
<file Name="sct2_Concept_Snapshot_INT_20140131.txt"/>
</folder>
</folder>
<folder Name="Delta">
<folder Name="Refset">
<folder Name="Language">
<file Name="der2_cRefset_LanguageDelta-en_INT_20140131.txt"/>
</folder>
</folder>
<folder Name="Terminology">
<file Name="sct2_Concept_Delta_INT_20140131.txt"/>
</folder>
</folder>
</folder>
</folder>
</listing>
| {
"content_hash": "a7f83024229065870771e58d124be44f",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 70,
"avg_line_length": 29.783783783783782,
"alnum_prop": 0.632486388384755,
"repo_name": "IHTSDO/snomed-release-service",
"id": "c0074c678cd66073bf1300fcd62ea1c91c5e83d5",
"size": "1102",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/resources/org/ihtsdo/buildcloud/integration/workbenchworkarround/discardbaddelta/core_manifest_20140131.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1323299"
},
{
"name": "Shell",
"bytes": "25224"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL2_gfx: I:/Sources/sdl2gfx/README Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL2_gfx
 <span id="projectnumber">1.0.1</span>
</div>
<div id="projectbrief">GraphicsprimitivesandsurfacefunctionsforSDL2</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">I:/Sources/sdl2gfx/README</div> </div>
</div><!--header-->
<div class="contents">
<a href="_r_e_a_d_m_e.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| {
"content_hash": "a825a156fa86873790ee37cf9d8e45c1",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 140,
"avg_line_length": 29,
"alnum_prop": 0.6276861569215393,
"repo_name": "ring-lang/ring",
"id": "2445ca98f68160e9ceafe5404bb0cd9b8e7ad689",
"size": "2001",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "extensions/android/ringlibsdl/project/jni/ring/src/SDL2_gfx/Docs/html/_r_e_a_d_m_e_source.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ada",
"bytes": "89080"
},
{
"name": "Assembly",
"bytes": "296081"
},
{
"name": "Awk",
"bytes": "46636"
},
{
"name": "Batchfile",
"bytes": "101663"
},
{
"name": "C",
"bytes": "71469704"
},
{
"name": "C#",
"bytes": "80097"
},
{
"name": "C++",
"bytes": "20961776"
},
{
"name": "CLIPS",
"bytes": "5291"
},
{
"name": "CMake",
"bytes": "67747"
},
{
"name": "CSS",
"bytes": "82643"
},
{
"name": "DIGITAL Command Language",
"bytes": "110604"
},
{
"name": "Emacs Lisp",
"bytes": "7096"
},
{
"name": "Java",
"bytes": "60236"
},
{
"name": "JavaScript",
"bytes": "77844"
},
{
"name": "Less",
"bytes": "246"
},
{
"name": "M4",
"bytes": "493435"
},
{
"name": "Makefile",
"bytes": "3116661"
},
{
"name": "Module Management System",
"bytes": "17479"
},
{
"name": "Objective-C",
"bytes": "376958"
},
{
"name": "Pascal",
"bytes": "72283"
},
{
"name": "Perl",
"bytes": "85778"
},
{
"name": "Python",
"bytes": "263263"
},
{
"name": "QML",
"bytes": "1152"
},
{
"name": "QMake",
"bytes": "36639"
},
{
"name": "Rebol",
"bytes": "6496"
},
{
"name": "Ring",
"bytes": "45850703"
},
{
"name": "Roff",
"bytes": "677912"
},
{
"name": "SAS",
"bytes": "16030"
},
{
"name": "SWIG",
"bytes": "13206"
},
{
"name": "Shell",
"bytes": "5483160"
},
{
"name": "Smalltalk",
"bytes": "5908"
},
{
"name": "StringTemplate",
"bytes": "4184"
},
{
"name": "TeX",
"bytes": "352002"
},
{
"name": "WebAssembly",
"bytes": "13987"
},
{
"name": "sed",
"bytes": "236"
}
],
"symlink_target": ""
} |
package com.microsoft.azure.management.apimanagement.v2018_06_01_preview;
import com.microsoft.azure.arm.model.HasInner;
import com.microsoft.azure.management.apimanagement.v2018_06_01_preview.implementation.QuotaCounterContractInner;
import com.microsoft.azure.arm.resources.models.HasManager;
import com.microsoft.azure.management.apimanagement.v2018_06_01_preview.implementation.ApiManagementManager;
import org.joda.time.DateTime;
/**
* Type representing QuotaCounterContract.
*/
public interface QuotaCounterContract extends HasInner<QuotaCounterContractInner>, HasManager<ApiManagementManager> {
/**
* @return the counterKey value.
*/
String counterKey();
/**
* @return the periodEndTime value.
*/
DateTime periodEndTime();
/**
* @return the periodKey value.
*/
String periodKey();
/**
* @return the periodStartTime value.
*/
DateTime periodStartTime();
/**
* @return the value value.
*/
QuotaCounterValueContractProperties value();
}
| {
"content_hash": "dd30402495377349445409b9c14de744",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 117,
"avg_line_length": 26.05,
"alnum_prop": 0.7226487523992322,
"repo_name": "selvasingh/azure-sdk-for-java",
"id": "85fa4f7f29d37d6c9d8bd9ffb92f0ea70cf9fb2a",
"size": "1272",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "sdk/apimanagement/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/apimanagement/v2018_06_01_preview/QuotaCounterContract.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "29891970"
},
{
"name": "JavaScript",
"bytes": "6198"
},
{
"name": "PowerShell",
"bytes": "160"
},
{
"name": "Shell",
"bytes": "609"
}
],
"symlink_target": ""
} |
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
namespace Microsoft.Win32.SafeHandles
{
/// <summary>
/// Wrapper around a gss_name_t_desc*
/// </summary>
internal sealed class SafeGssNameHandle : SafeHandle
{
public static SafeGssNameHandle CreateUser(string name)
{
Debug.Assert(!string.IsNullOrEmpty(name), "Invalid user name passed to SafeGssNameHandle create");
SafeGssNameHandle retHandle;
Interop.NetSecurityNative.Status minorStatus;
Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ImportUserName(
out minorStatus, name, Encoding.UTF8.GetByteCount(name), out retHandle);
if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE)
{
retHandle.Dispose();
throw new Interop.NetSecurityNative.GssApiException(status, minorStatus);
}
return retHandle;
}
public static SafeGssNameHandle CreateTarget(string name)
{
Debug.Assert(!string.IsNullOrEmpty(name), "Invalid target name passed to SafeGssNameHandle create");
SafeGssNameHandle retHandle;
Interop.NetSecurityNative.Status minorStatus;
Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ImportPrincipalName(
out minorStatus, name, Encoding.UTF8.GetByteCount(name), out retHandle);
if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE)
{
retHandle.Dispose();
throw new Interop.NetSecurityNative.GssApiException(status, minorStatus);
}
return retHandle;
}
public override bool IsInvalid
{
get { return handle == IntPtr.Zero; }
}
protected override bool ReleaseHandle()
{
Interop.NetSecurityNative.Status minorStatus;
Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseName(out minorStatus, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
private SafeGssNameHandle()
: base(IntPtr.Zero, true)
{
}
}
/// <summary>
/// Wrapper around a gss_cred_id_t_desc_struct*
/// </summary>
internal class SafeGssCredHandle : SafeHandle
{
private static readonly Lazy<bool> s_IsNtlmInstalled = new Lazy<bool>(InitIsNtlmInstalled);
/// <summary>
/// returns the handle for the given credentials.
/// The method returns an invalid handle if the username is null or empty.
/// </summary>
public static SafeGssCredHandle Create(string username, string password, bool isNtlmOnly)
{
if (isNtlmOnly && !s_IsNtlmInstalled.Value)
{
throw new Interop.NetSecurityNative.GssApiException(
Interop.NetSecurityNative.Status.GSS_S_BAD_MECH,
0,
SR.net_gssapi_ntlm_missing_plugin);
}
if (string.IsNullOrEmpty(username))
{
return new SafeGssCredHandle();
}
SafeGssCredHandle retHandle = null;
using (SafeGssNameHandle userHandle = SafeGssNameHandle.CreateUser(username))
{
Interop.NetSecurityNative.Status status;
Interop.NetSecurityNative.Status minorStatus;
if (string.IsNullOrEmpty(password))
{
status = Interop.NetSecurityNative.InitiateCredSpNego(out minorStatus, userHandle, out retHandle);
}
else
{
status = Interop.NetSecurityNative.InitiateCredWithPassword(out minorStatus, isNtlmOnly, userHandle, password, Encoding.UTF8.GetByteCount(password), out retHandle);
}
if (status != Interop.NetSecurityNative.Status.GSS_S_COMPLETE)
{
retHandle.Dispose();
throw new Interop.NetSecurityNative.GssApiException(status, minorStatus, null);
}
}
return retHandle;
}
private SafeGssCredHandle()
: base(IntPtr.Zero, true)
{
}
public override bool IsInvalid
{
get { return handle == IntPtr.Zero; }
}
protected override bool ReleaseHandle()
{
Interop.NetSecurityNative.Status minorStatus;
Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseCred(out minorStatus, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
private static bool InitIsNtlmInstalled()
{
return Interop.NetSecurityNative.IsNtlmInstalled();
}
}
internal sealed class SafeGssContextHandle : SafeHandle
{
public SafeGssContextHandle()
: base(IntPtr.Zero, true)
{
}
public override bool IsInvalid
{
get { return handle == IntPtr.Zero; }
}
protected override bool ReleaseHandle()
{
Interop.NetSecurityNative.Status minorStatus;
Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.DeleteSecContext(out minorStatus, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
}
}
| {
"content_hash": "d3e1faf65cf0922da70f493fd0b3199b",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 184,
"avg_line_length": 35.6625,
"alnum_prop": 0.6019978969505784,
"repo_name": "shimingsg/corefx",
"id": "aa3727c1cd70d24a0ab04baf81e10909add44b2e",
"size": "5910",
"binary": false,
"copies": "29",
"ref": "refs/heads/master",
"path": "src/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "1C Enterprise",
"bytes": "327222"
},
{
"name": "ASP",
"bytes": "1687"
},
{
"name": "Batchfile",
"bytes": "24745"
},
{
"name": "C",
"bytes": "1113348"
},
{
"name": "C#",
"bytes": "139667788"
},
{
"name": "C++",
"bytes": "712083"
},
{
"name": "CMake",
"bytes": "63626"
},
{
"name": "DIGITAL Command Language",
"bytes": "26402"
},
{
"name": "Groovy",
"bytes": "41755"
},
{
"name": "HTML",
"bytes": "653"
},
{
"name": "Makefile",
"bytes": "9085"
},
{
"name": "Objective-C",
"bytes": "9948"
},
{
"name": "OpenEdge ABL",
"bytes": "139178"
},
{
"name": "Perl",
"bytes": "3895"
},
{
"name": "PowerShell",
"bytes": "43073"
},
{
"name": "Python",
"bytes": "1535"
},
{
"name": "Roff",
"bytes": "4236"
},
{
"name": "Shell",
"bytes": "72621"
},
{
"name": "Visual Basic",
"bytes": "827108"
},
{
"name": "XSLT",
"bytes": "462346"
}
],
"symlink_target": ""
} |
class CreateDeviceProfiles < ActiveRecord::Migration
def change
create_table :device_profiles do |t|
t.string :data_transformer
t.timestamps null: false
end
end
end
| {
"content_hash": "2a731b82d718ad6bb970b659a302d4fd",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 52,
"avg_line_length": 21.11111111111111,
"alnum_prop": 0.7052631578947368,
"repo_name": "cwateam/cyclingweatherapp",
"id": "66e93082cea6de9e92acb6454f96e38dd0ef74c6",
"size": "190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cwa/db/migrate/20150617074750_create_device_profiles.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3412"
},
{
"name": "CoffeeScript",
"bytes": "422"
},
{
"name": "HTML",
"bytes": "23899"
},
{
"name": "JavaScript",
"bytes": "15014"
},
{
"name": "Ruby",
"bytes": "110428"
}
],
"symlink_target": ""
} |
title: ISTIO-SECURITY-2022-007
subtitle: Security Bulletin
description: Denial of service attack due to Go Regex Library.
cves: [CVE-2022-39278]
cvss: "7.5"
vector: "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
releases: ["All releases prior to 1.13", "1.13.0 to 1.13.8", "1.14.0 to 1.14.4", "1.15.0 to 1.15.1"]
publishdate: 2022-10-12
keywords: [CVE]
skip_seealso: true
---
{{< security_bulletin >}}
## CVE
### CVE-2022-39278
- __[CVE-2022-39278](https://github.com/istio/istio/security/advisories/GHSA-86vr-4wcv-mm9w)__:
(CVSS Score 7.5, High): Denial of service attack due to Go Regex Library.
The Istio control plane, istiod, is vulnerable to a request processing error, allowing a malicious attacker that sends a
specially crafted or oversized message, to crash the control plane process. This can be exploited when the Kubernetes validating or
mutating webhook service is exposed publicly. This endpoint is served over TLS port 15017, but does not require any
authentication from an attacker.
For simple installations, Istiod is typically only reachable from within the cluster, limiting the blast radius. However,
for some deployments, especially those where the control plane runs in a different cluster, this port is exposed over the public internet.
### Go CVE
The following Go issue points to the security vulnerability caused by the Go regex library. It is publicly fixed in Go 1.18.7 and Go 1.19.2
- [CVE-2022-41715](https://github.com/golang/go/issues/55949)
## Am I Impacted?
You are at most risk if you are running Istio in an external istiod environment, or if you have exposed your istiod externally and you are using any of the affected Istio versions. | {
"content_hash": "83978b1218c2a7a155661006d25b1483",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 180,
"avg_line_length": 45.513513513513516,
"alnum_prop": 0.7589073634204275,
"repo_name": "istio/istio.io",
"id": "316f58fd9a38e463f95dce0a39f84d49d4fbffb9",
"size": "1688",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "content/en/news/security/istio-security-2022-007/index.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "70128"
},
{
"name": "Go",
"bytes": "39192"
},
{
"name": "HTML",
"bytes": "866919838"
},
{
"name": "JavaScript",
"bytes": "372035"
},
{
"name": "Makefile",
"bytes": "18567"
},
{
"name": "Python",
"bytes": "8488"
},
{
"name": "Ruby",
"bytes": "634"
},
{
"name": "SCSS",
"bytes": "117075"
},
{
"name": "Shell",
"bytes": "8934097"
},
{
"name": "TypeScript",
"bytes": "75683"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.shoghibagul.musicstructureapp.GenreActivity"
tools:showIn="@layout/activity_genre">
<include
android:id="@+id/button_bar_view"
layout="@layout/button_bar_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_vertical_margin"/>
<LinearLayout
android:id="@+id/music_player_ll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separator_height"
android:background="@color/black"/>
<include
android:id="@+id/music_player_layout"
layout="@layout/music_player"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<TextView
style="@style/TextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/music_player_ll"
android:text="@string/genre_details"/>
</RelativeLayout>
| {
"content_hash": "34cbe59900057d4422c95177b24fcc6c",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 75,
"avg_line_length": 36.91489361702128,
"alnum_prop": 0.6570605187319885,
"repo_name": "shoghi07/Android-Basics-Nanodegree-Udacity",
"id": "170156bc054d45cf68fdd8bf829462b0758feee4",
"size": "1735",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MusicStructureApp/app/src/main/res/layout/content_genre.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "12108"
}
],
"symlink_target": ""
} |
package org.thingsboard.server.actors.device;
import org.junit.Before;
import org.junit.Test;
import org.thingsboard.common.util.LinkedHashMapRemoveEldest;
import org.thingsboard.server.actors.ActorSystemContext;
import org.thingsboard.server.common.data.id.DeviceId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.dao.device.DeviceService;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.mock;
public class DeviceActorMessageProcessorTest {
public static final long MAX_CONCURRENT_SESSIONS_PER_DEVICE = 10L;
ActorSystemContext systemContext;
DeviceService deviceService;
TenantId tenantId = TenantId.SYS_TENANT_ID;
DeviceId deviceId = DeviceId.fromString("78bf9b26-74ef-4af2-9cfb-ad6cf24ad2ec");
DeviceActorMessageProcessor processor;
@Before
public void setUp() {
systemContext = mock(ActorSystemContext.class);
deviceService = mock(DeviceService.class);
willReturn(MAX_CONCURRENT_SESSIONS_PER_DEVICE).given(systemContext).getMaxConcurrentSessionsPerDevice();
willReturn(deviceService).given(systemContext).getDeviceService();
processor = new DeviceActorMessageProcessor(systemContext, tenantId, deviceId);
}
@Test
public void givenSystemContext_whenNewInstance_thenVerifySessionMapMaxSize() {
assertThat(processor.sessions, instanceOf(LinkedHashMapRemoveEldest.class));
assertThat(processor.sessions.getMaxEntries(), is(MAX_CONCURRENT_SESSIONS_PER_DEVICE));
assertThat(processor.sessions.getRemovalConsumer(), notNullValue());
}
} | {
"content_hash": "c42f1af166652f92928dbaadf87bd841",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 112,
"avg_line_length": 41.56818181818182,
"alnum_prop": 0.7895024603608529,
"repo_name": "thingsboard/thingsboard",
"id": "850e048ba22c32161d12b018b763cc983a58025e",
"size": "2444",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "application/src/test/java/org/thingsboard/server/actors/device/DeviceActorMessageProcessorTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5292"
},
{
"name": "CSS",
"bytes": "1419"
},
{
"name": "Dockerfile",
"bytes": "16044"
},
{
"name": "FreeMarker",
"bytes": "76776"
},
{
"name": "HTML",
"bytes": "1592357"
},
{
"name": "Java",
"bytes": "13339554"
},
{
"name": "JavaScript",
"bytes": "32179"
},
{
"name": "PLpgSQL",
"bytes": "175849"
},
{
"name": "Python",
"bytes": "7686"
},
{
"name": "SCSS",
"bytes": "401062"
},
{
"name": "Shell",
"bytes": "98582"
},
{
"name": "TypeScript",
"bytes": "5235207"
}
],
"symlink_target": ""
} |
<!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-beta2) on Mon Mar 19 19:31:35 CST 2007 -->
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>
类 javax.swing.text.html.HTMLWriter 的使用 (Java Platform SE 6)
</TITLE><script>var _hmt = _hmt || [];(function() {var hm = document.createElement("script");hm.src = "//hm.baidu.com/hm.js?dd1361ca20a10cc161e72d4bc4fef6df";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm, s);})();</script>
<META NAME="date" CONTENT="2007-03-19">
<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="类 javax.swing.text.html.HTMLWriter 的使用 (Java Platform SE 6)";
}
}
</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="跳过导航链接"></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>概述</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../javax/swing/text/html/HTMLWriter.html" title="javax.swing.text.html 中的类"><FONT CLASS="NavBarFont1"><B>类</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Java<sup><font size=-2>TM</font></sup> Platform<br>Standard Ed. 6</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
上一个
下一个</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?javax/swing/text/html//class-useHTMLWriter.html" target="_top"><B>框架</B></A>
<A HREF="HTMLWriter.html" target="_top"><B>无框架</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>所有类</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>所有类</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>类 javax.swing.text.html.HTMLWriter<br>的使用</B></H2>
</CENTER>
没有 javax.swing.text.html.HTMLWriter 的用法
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="跳过导航链接"></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>概述</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../javax/swing/text/html/HTMLWriter.html" title="javax.swing.text.html 中的类"><FONT CLASS="NavBarFont1"><B>类</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Java<sup><font size=-2>TM</font></sup> Platform<br>Standard Ed. 6</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
上一个
下一个</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?javax/swing/text/html//class-useHTMLWriter.html" target="_top"><B>框架</B></A>
<A HREF="HTMLWriter.html" target="_top"><B>无框架</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>所有类</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>所有类</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<font size="-1"><a href="http://bugs.sun.com/services/bugreport/index.jsp">提交错误或意见</a><br>有关更多的 API 参考资料和开发人员文档,请参阅 <a href="http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html">Java SE 开发人员文档</a>。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。 <p>版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守<a href="http://java.sun.com/javase/6/docs/legal/license.html">许可证条款</a>。另请参阅<a href="http://java.sun.com/docs/redist.html">文档重新分发政策</a>。</font>
</BODY>
</HTML>
| {
"content_hash": "59a0a8659f1b0b7049ca1eb9d30f6ec2",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 441,
"avg_line_length": 45.827586206896555,
"alnum_prop": 0.618961625282167,
"repo_name": "piterlin/piterlin.github.io",
"id": "49af8b62fd7da02d8392b33f1bc2bcb4289b099e",
"size": "7069",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/jdk6_cn/javax/swing/text/html/class-use/HTMLWriter.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "479"
},
{
"name": "HTML",
"bytes": "9480869"
},
{
"name": "JavaScript",
"bytes": "246"
}
],
"symlink_target": ""
} |
/**
* This is a generated file. Do not edit or your changes will be lost
*/
#import "IoBranchSdkModuleAssets.h"
extern NSData* filterDataInRange(NSData* thedata, NSRange range);
@implementation IoBranchSdkModuleAssets
- (NSData *)moduleAsset
{
return nil;
}
- (NSData *)resolveModuleAsset:(NSString *)path
{
return nil;
}
@end
| {
"content_hash": "dcef7e6b9b3d2322d9f399bda33c1a44",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 69,
"avg_line_length": 14.416666666666666,
"alnum_prop": 0.7138728323699421,
"repo_name": "BranchMetrics/Titanium-Deferred-Deep-Linking-SDK",
"id": "0bfada47cae62d29599eeb9587c7111c9ce0f3e7",
"size": "346",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "iphone/Classes/IoBranchSdkModuleAssets.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1276"
},
{
"name": "Java",
"bytes": "28225"
},
{
"name": "JavaScript",
"bytes": "36990"
},
{
"name": "Objective-C",
"bytes": "413788"
},
{
"name": "Python",
"bytes": "13864"
}
],
"symlink_target": ""
} |
<?php
namespace cms\routes\Quotes\views;
/**
* FormView for deleting one or more quotes
*/
class DeleteForm extends \rakelley\jhframe\classes\FormView implements
\rakelley\jhframe\interfaces\view\IRequiresData
{
/**
* {@inheritdoc}
* @see \rakelley\jhframe\classes\FormView::$fields
*/
protected $fields = [
'quotes' => [
'method' => 'fillQuotes',
],
'submit' => [
'type' => 'submit',
'attr' => [
'value' => 'Delete Quote(s)',
'class' => 'button_dangerous',
],
],
];
/**
* {@inheritdoc}
* @see \rakelley\jhframe\classes\FormView::$attributes
*/
protected $attributes = [
'action' => 'quotes/delete',
'method' => 'post',
'data-valmethods' => 'reload-hide',
];
/**
* {@inheritdoc}
* @see \rakelley\jhframe\classes\FormView::$title
*/
protected $title = 'Delete One or More Quotes';
/**
* Quotes repo instance
* @var object
*/
private $quotes;
/**
* @param \rakelley\jhframe\interfaces\services\IFormBuilder $builder
* @param \main\repositories\Quotes $quotes
*/
function __construct(
\rakelley\jhframe\interfaces\services\IFormBuilder $builder,
\main\repositories\Quotes $quotes
) {
parent::__construct($builder);
$this->quotes = $quotes;
}
/**
* {@inheritdoc}
* @see \rakelley\jhframe\interfaces\view\IRequiresData::fetchData()
*/
public function fetchData()
{
$this->data = $this->quotes->getAll();
}
/**
* Custom field method for generating quote markup
*
* @return string
*/
protected function fillQuotes()
{
return implode('', array_map(
function($row) {
return <<<HTML
<label>
<input type="checkbox" name="quote{$row['id']}" value="{$row['id']}" />
{$row['quote']}
</label>
HTML;
},
$this->data
));
}
}
| {
"content_hash": "39f91202af24e42649c0f1bb92761c71",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 75,
"avg_line_length": 23.252747252747252,
"alnum_prop": 0.5146502835538752,
"repo_name": "rakelley/jakkedweb",
"id": "e37ea6ff51aacd2a24c70079f9157979a676d2c1",
"size": "2419",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/cms/routes/Quotes/views/DeleteForm.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "88741"
},
{
"name": "HTML",
"bytes": "33840"
},
{
"name": "JavaScript",
"bytes": "42486"
},
{
"name": "PHP",
"bytes": "1104514"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>MAGMA: Initialization</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="magma-logo.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">MAGMA
 <span id="projectnumber">1.6.1</span>
</div>
<div id="projectbrief">Matrix Algebra for GPU and Multicore Architectures</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.7 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__magma__init.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Initialization</div> </div>
</div><!--header-->
<div class="contents">
<p><hr/>
<a href="#details">More...</a></p>
<hr/>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Fri Jan 30 2015 19:00:45 for MAGMA by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.7 </li>
</ul>
</div>
</body>
</html>
| {
"content_hash": "7d3457cca6611b3cac42a6ca6923b939",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 951,
"avg_line_length": 44.4765625,
"alnum_prop": 0.657122782364307,
"repo_name": "shengren/magma-1.6.1",
"id": "832e02bc53549d172715faecd91a787affb50165",
"size": "5693",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/html/group__magma__init.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "1297542"
},
{
"name": "C++",
"bytes": "16293832"
},
{
"name": "CMake",
"bytes": "9105"
},
{
"name": "CSS",
"bytes": "3918"
},
{
"name": "Cuda",
"bytes": "4111432"
},
{
"name": "FORTRAN",
"bytes": "8313800"
},
{
"name": "Makefile",
"bytes": "74059"
},
{
"name": "Objective-C",
"bytes": "29164"
},
{
"name": "Perl",
"bytes": "5174"
},
{
"name": "Python",
"bytes": "103553"
}
],
"symlink_target": ""
} |
package armm365securityandcompliance
import (
"context"
"errors"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"net/http"
"net/url"
"strings"
)
// PrivateEndpointConnectionsAdtAPIClient contains the methods for the PrivateEndpointConnectionsAdtAPI group.
// Don't use this type directly, use NewPrivateEndpointConnectionsAdtAPIClient() instead.
type PrivateEndpointConnectionsAdtAPIClient struct {
host string
subscriptionID string
pl runtime.Pipeline
}
// NewPrivateEndpointConnectionsAdtAPIClient creates a new instance of PrivateEndpointConnectionsAdtAPIClient with the specified values.
// subscriptionID - The subscription identifier.
// credential - used to authorize requests. Usually a credential from azidentity.
// options - pass nil to accept the default values.
func NewPrivateEndpointConnectionsAdtAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsAdtAPIClient, error) {
if options == nil {
options = &arm.ClientOptions{}
}
ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint
if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok {
ep = c.Endpoint
}
pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options)
if err != nil {
return nil, err
}
client := &PrivateEndpointConnectionsAdtAPIClient{
subscriptionID: subscriptionID,
host: ep,
pl: pl,
}
return client, nil
}
// BeginCreateOrUpdate - Update the state of the specified private endpoint connection associated with the service.
// If the operation fails it returns an *azcore.ResponseError type.
// Generated from API version 2021-03-25-preview
// resourceGroupName - The name of the resource group that contains the service instance.
// resourceName - The name of the service instance.
// privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource
// properties - The private endpoint connection properties.
// options - PrivateEndpointConnectionsAdtAPIClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsAdtAPIClient.BeginCreateOrUpdate
// method.
func (client *PrivateEndpointConnectionsAdtAPIClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsAdtAPIClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsAdtAPIClientCreateOrUpdateResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties, options)
if err != nil {
return nil, err
}
return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateEndpointConnectionsAdtAPIClientCreateOrUpdateResponse]{
FinalStateVia: runtime.FinalStateViaLocation,
})
} else {
return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsAdtAPIClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil)
}
}
// CreateOrUpdate - Update the state of the specified private endpoint connection associated with the service.
// If the operation fails it returns an *azcore.ResponseError type.
// Generated from API version 2021-03-25-preview
func (client *PrivateEndpointConnectionsAdtAPIClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsAdtAPIClientBeginCreateOrUpdateOptions) (*http.Response, error) {
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, properties, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) {
return nil, runtime.NewResponseError(resp)
}
return resp, nil
}
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
func (client *PrivateEndpointConnectionsAdtAPIClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsAdtAPIClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if resourceName == "" {
return nil, errors.New("parameter resourceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName))
if privateEndpointConnectionName == "" {
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-03-25-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, runtime.MarshalAsJSON(req, properties)
}
// BeginDelete - Deletes a private endpoint connection.
// If the operation fails it returns an *azcore.ResponseError type.
// Generated from API version 2021-03-25-preview
// resourceGroupName - The name of the resource group that contains the service instance.
// resourceName - The name of the service instance.
// privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource
// options - PrivateEndpointConnectionsAdtAPIClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsAdtAPIClient.BeginDelete
// method.
func (client *PrivateEndpointConnectionsAdtAPIClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsAdtAPIClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsAdtAPIClientDeleteResponse], error) {
if options == nil || options.ResumeToken == "" {
resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options)
if err != nil {
return nil, err
}
return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateEndpointConnectionsAdtAPIClientDeleteResponse]{
FinalStateVia: runtime.FinalStateViaLocation,
})
} else {
return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsAdtAPIClientDeleteResponse](options.ResumeToken, client.pl, nil)
}
}
// Delete - Deletes a private endpoint connection.
// If the operation fails it returns an *azcore.ResponseError type.
// Generated from API version 2021-03-25-preview
func (client *PrivateEndpointConnectionsAdtAPIClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsAdtAPIClientBeginDeleteOptions) (*http.Response, error) {
req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options)
if err != nil {
return nil, err
}
resp, err := client.pl.Do(req)
if err != nil {
return nil, err
}
if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) {
return nil, runtime.NewResponseError(resp)
}
return resp, nil
}
// deleteCreateRequest creates the Delete request.
func (client *PrivateEndpointConnectionsAdtAPIClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsAdtAPIClientBeginDeleteOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if resourceName == "" {
return nil, errors.New("parameter resourceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName))
if privateEndpointConnectionName == "" {
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-03-25-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// Get - Gets the specified private endpoint connection associated with the service.
// If the operation fails it returns an *azcore.ResponseError type.
// Generated from API version 2021-03-25-preview
// resourceGroupName - The name of the resource group that contains the service instance.
// resourceName - The name of the service instance.
// privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource
// options - PrivateEndpointConnectionsAdtAPIClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsAdtAPIClient.Get
// method.
func (client *PrivateEndpointConnectionsAdtAPIClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsAdtAPIClientGetOptions) (PrivateEndpointConnectionsAdtAPIClientGetResponse, error) {
req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options)
if err != nil {
return PrivateEndpointConnectionsAdtAPIClientGetResponse{}, err
}
resp, err := client.pl.Do(req)
if err != nil {
return PrivateEndpointConnectionsAdtAPIClientGetResponse{}, err
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
return PrivateEndpointConnectionsAdtAPIClientGetResponse{}, runtime.NewResponseError(resp)
}
return client.getHandleResponse(resp)
}
// getCreateRequest creates the Get request.
func (client *PrivateEndpointConnectionsAdtAPIClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsAdtAPIClientGetOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if resourceName == "" {
return nil, errors.New("parameter resourceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName))
if privateEndpointConnectionName == "" {
return nil, errors.New("parameter privateEndpointConnectionName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-03-25-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getHandleResponse handles the Get response.
func (client *PrivateEndpointConnectionsAdtAPIClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsAdtAPIClientGetResponse, error) {
result := PrivateEndpointConnectionsAdtAPIClientGetResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil {
return PrivateEndpointConnectionsAdtAPIClientGetResponse{}, err
}
return result, nil
}
// NewListByServicePager - Lists all private endpoint connections for a service.
// If the operation fails it returns an *azcore.ResponseError type.
// Generated from API version 2021-03-25-preview
// resourceGroupName - The name of the resource group that contains the service instance.
// resourceName - The name of the service instance.
// options - PrivateEndpointConnectionsAdtAPIClientListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsAdtAPIClient.ListByService
// method.
func (client *PrivateEndpointConnectionsAdtAPIClient) NewListByServicePager(resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsAdtAPIClientListByServiceOptions) *runtime.Pager[PrivateEndpointConnectionsAdtAPIClientListByServiceResponse] {
return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsAdtAPIClientListByServiceResponse]{
More: func(page PrivateEndpointConnectionsAdtAPIClientListByServiceResponse) bool {
return page.NextLink != nil && len(*page.NextLink) > 0
},
Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsAdtAPIClientListByServiceResponse) (PrivateEndpointConnectionsAdtAPIClientListByServiceResponse, error) {
var req *policy.Request
var err error
if page == nil {
req, err = client.listByServiceCreateRequest(ctx, resourceGroupName, resourceName, options)
} else {
req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink)
}
if err != nil {
return PrivateEndpointConnectionsAdtAPIClientListByServiceResponse{}, err
}
resp, err := client.pl.Do(req)
if err != nil {
return PrivateEndpointConnectionsAdtAPIClientListByServiceResponse{}, err
}
if !runtime.HasStatusCode(resp, http.StatusOK) {
return PrivateEndpointConnectionsAdtAPIClientListByServiceResponse{}, runtime.NewResponseError(resp)
}
return client.listByServiceHandleResponse(resp)
},
})
}
// listByServiceCreateRequest creates the ListByService request.
func (client *PrivateEndpointConnectionsAdtAPIClient) listByServiceCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsAdtAPIClientListByServiceOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.M365SecurityAndCompliance/privateLinkServicesForO365ManagementActivityAPI/{resourceName}/privateEndpointConnections"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if resourceName == "" {
return nil, errors.New("parameter resourceName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName))
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2021-03-25-preview")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// listByServiceHandleResponse handles the ListByService response.
func (client *PrivateEndpointConnectionsAdtAPIClient) listByServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsAdtAPIClientListByServiceResponse, error) {
result := PrivateEndpointConnectionsAdtAPIClientListByServiceResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil {
return PrivateEndpointConnectionsAdtAPIClientListByServiceResponse{}, err
}
return result, nil
}
| {
"content_hash": "d434698cb7d6d72c8315b21dd0de01c3",
"timestamp": "",
"source": "github",
"line_count": 320,
"max_line_length": 381,
"avg_line_length": 55.565625,
"alnum_prop": 0.8005174062201226,
"repo_name": "Azure/azure-sdk-for-go",
"id": "133981be2afe99daa67f1408e2df341b58c3f80a",
"size": "18120",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/resourcemanager/m365securityandcompliance/armm365securityandcompliance/zz_generated_privateendpointconnectionsadtapi_client.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1629"
},
{
"name": "Bicep",
"bytes": "8394"
},
{
"name": "CSS",
"bytes": "6089"
},
{
"name": "Dockerfile",
"bytes": "1435"
},
{
"name": "Go",
"bytes": "5463500"
},
{
"name": "HTML",
"bytes": "8933"
},
{
"name": "JavaScript",
"bytes": "8137"
},
{
"name": "PowerShell",
"bytes": "504494"
},
{
"name": "Shell",
"bytes": "3893"
},
{
"name": "Smarty",
"bytes": "1723"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>qarith: 20 s 🏆</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.8.1 / qarith - 8.8.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
qarith
<small>
8.8.0
<span class="label label-success">20 s 🏆</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-16 04:20:23 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-16 04:20:23 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.8.1 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.02.3 The OCaml compiler (virtual package)
ocaml-base-compiler 4.02.3 Official 4.02.3 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://github.com/coq-contribs/qarith"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/QArith"]
depends: [
"ocaml"
"coq" {>= "8.8" & < "8.9~"}
]
tags: [
"keyword: Q"
"keyword: arithmetic"
"keyword: rational numbers"
"keyword: setoid"
"keyword: ring"
"category: Mathematics/Arithmetic and Number Theory/Rational numbers"
"category: Miscellaneous/Extracted Programs/Arithmetic"
]
authors: [ "Pierre Letouzey" ]
bug-reports: "https://github.com/coq-contribs/qarith/issues"
dev-repo: "git+https://github.com/coq-contribs/qarith.git"
synopsis: "A Library for Rational Numbers (QArith)"
description: """
This contribution is a proposition of a library formalizing
rational number in Coq."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/qarith/archive/v8.8.0.tar.gz"
checksum: "md5=ee44f341443451374cd1610fd6133bc9"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-qarith.8.8.0 coq.8.8.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-qarith.8.8.0 coq.8.8.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>12 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-qarith.8.8.0 coq.8.8.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>20 s</dd>
</dl>
<h2>Installation size</h2>
<p>Total: 429 K</p>
<ul>
<li>310 K <code>../ocaml-base-compiler.4.02.3/lib/coq/user-contrib/QArith/Sqrt2/Reals.vo</code></li>
<li>69 K <code>../ocaml-base-compiler.4.02.3/lib/coq/user-contrib/QArith/Sqrt2/Reals.glob</code></li>
<li>29 K <code>../ocaml-base-compiler.4.02.3/lib/coq/user-contrib/QArith/Sqrt2/nat_log.vo</code></li>
<li>15 K <code>../ocaml-base-compiler.4.02.3/lib/coq/user-contrib/QArith/Sqrt2/Reals.v</code></li>
<li>4 K <code>../ocaml-base-compiler.4.02.3/lib/coq/user-contrib/QArith/Sqrt2/nat_log.glob</code></li>
<li>2 K <code>../ocaml-base-compiler.4.02.3/lib/coq/user-contrib/QArith/Sqrt2/nat_log.v</code></li>
</ul>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq-qarith.8.8.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "a6e9680ae09433df70f066e68db4afb6",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 159,
"avg_line_length": 43.55428571428571,
"alnum_prop": 0.5481500918394122,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "cb1272943aff55f0f688a3398c87f4f327cfc66f",
"size": "7647",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.02.3-2.0.6/released/8.8.1/qarith/8.8.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package ddf.minim.analysis;
/**
* A Bartlett window function.
*
* @author Damien Di Fede
* @author Corban Brook
* @see <a href="http://en.wikipedia.org/wiki/Window_function#Bartlett_window_.28zero_valued_end-points.29">The Bartlett Window</a>
*
* @invisible
*/
public class BartlettWindow extends WindowFunction
{
/** Constructs a Bartlett window. */
public BartlettWindow()
{
}
protected float value(int length, int index)
{
return 2f / (length - 1) * ((length - 1) / 2f - Math.abs(index - (length - 1) / 2f));
}
public String toString()
{
return "Bartlett Window";
}
}
| {
"content_hash": "99dfc29a84eafa93b8aff09fc7ca8615",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 133,
"avg_line_length": 21.032258064516128,
"alnum_prop": 0.6150306748466258,
"repo_name": "UTSDataArena/examples",
"id": "5a54e029e92156a68b532e3b3f981219b80d3c91",
"size": "1492",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "processing/sketchbook/libraries/minim/src/ddf/minim/analysis/BartlettWindow.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "76811"
},
{
"name": "HTML",
"bytes": "791628"
},
{
"name": "Java",
"bytes": "1060796"
},
{
"name": "JavaScript",
"bytes": "1863596"
},
{
"name": "Matlab",
"bytes": "16205"
},
{
"name": "Processing",
"bytes": "506308"
},
{
"name": "Python",
"bytes": "118339"
},
{
"name": "Shell",
"bytes": "165"
}
],
"symlink_target": ""
} |
from __future__ import print_function
import jupyter_client
import sys
import threading
import time
from concurrent import futures
import grpc
import ipython_pb2
import ipython_pb2_grpc
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
is_py2 = sys.version[0] == '2'
if is_py2:
import Queue as queue
else:
import queue as queue
TIMEOUT = 60*60*24*365*100 # 100 years
class IPython(ipython_pb2_grpc.IPythonServicer):
def __init__(self, server):
self._status = ipython_pb2.STARTING
self._server = server
def start(self):
print("starting...")
sys.stdout.flush()
self._km, self._kc = jupyter_client.manager.start_new_kernel(kernel_name='python')
self._status = ipython_pb2.RUNNING
def execute(self, request, context):
print("execute code:\n")
print(request.code)
sys.stdout.flush()
stdout_queue = queue.Queue(maxsize = 10)
stderr_queue = queue.Queue(maxsize = 10)
image_queue = queue.Queue(maxsize = 5)
def _output_hook(msg):
msg_type = msg['header']['msg_type']
content = msg['content']
if msg_type == 'stream':
stdout_queue.put(content['text'])
elif msg_type in ('display_data', 'execute_result'):
stdout_queue.put(content['data'].get('text/plain', ''))
if 'image/png' in content['data']:
image_queue.put(content['data']['image/png'])
elif msg_type == 'error':
stderr_queue.put('\n'.join(content['traceback']))
payload_reply = []
def execute_worker():
reply = self._kc.execute_interactive(request.code,
output_hook=_output_hook,
timeout=TIMEOUT)
payload_reply.append(reply)
t = threading.Thread(name="ConsumerThread", target=execute_worker)
t.start()
while t.is_alive():
while not stdout_queue.empty():
output = stdout_queue.get()
yield ipython_pb2.ExecuteResponse(status=ipython_pb2.SUCCESS,
type=ipython_pb2.TEXT,
output=output)
while not stderr_queue.empty():
output = stderr_queue.get()
yield ipython_pb2.ExecuteResponse(status=ipython_pb2.ERROR,
type=ipython_pb2.TEXT,
output=output)
while not image_queue.empty():
output = image_queue.get()
yield ipython_pb2.ExecuteResponse(status=ipython_pb2.SUCCESS,
type=ipython_pb2.IMAGE,
output=output)
while not stdout_queue.empty():
output = stdout_queue.get()
yield ipython_pb2.ExecuteResponse(status=ipython_pb2.SUCCESS,
type=ipython_pb2.TEXT,
output=output)
while not stderr_queue.empty():
output = stderr_queue.get()
yield ipython_pb2.ExecuteResponse(status=ipython_pb2.ERROR,
type=ipython_pb2.TEXT,
output=output)
while not image_queue.empty():
output = image_queue.get()
yield ipython_pb2.ExecuteResponse(status=ipython_pb2.SUCCESS,
type=ipython_pb2.IMAGE,
output=output)
if payload_reply:
result = []
for payload in payload_reply[0]['content']['payload']:
if payload['data']['text/plain']:
result.append(payload['data']['text/plain'])
if result:
yield ipython_pb2.ExecuteResponse(status=ipython_pb2.SUCCESS,
type=ipython_pb2.TEXT,
output='\n'.join(result))
def cancel(self, request, context):
self._km.interrupt_kernel()
return ipython_pb2.CancelResponse()
def complete(self, request, context):
reply = self._kc.complete(request.code, request.cursor, reply=True, timeout=TIMEOUT)
return ipython_pb2.CompletionResponse(matches=reply['content']['matches'])
def status(self, request, context):
return ipython_pb2.StatusResponse(status = self._status)
def stop(self, request, context):
self._server.stop(0)
sys.exit(0)
def serve(port):
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
ipython = IPython(server)
ipython_pb2_grpc.add_IPythonServicer_to_server(ipython, server)
server.add_insecure_port('[::]:' + port)
server.start()
ipython.start()
try:
while True:
time.sleep(_ONE_DAY_IN_SECONDS)
except KeyboardInterrupt:
server.stop(0)
if __name__ == '__main__':
serve(sys.argv[1])
| {
"content_hash": "fb9ca424d405ffceb62fd0c88b69b923",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 92,
"avg_line_length": 36.97872340425532,
"alnum_prop": 0.5237821250479479,
"repo_name": "vipul1409/zeppelin",
"id": "98fa616c2d034d52e73e1be1af06389fdcd0d3fb",
"size": "5995",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "python/src/main/resources/grpc/python/ipython_server.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "12046"
},
{
"name": "CSS",
"bytes": "88655"
},
{
"name": "Groovy",
"bytes": "9274"
},
{
"name": "HTML",
"bytes": "309510"
},
{
"name": "Java",
"bytes": "4389371"
},
{
"name": "JavaScript",
"bytes": "592817"
},
{
"name": "Jupyter Notebook",
"bytes": "84915"
},
{
"name": "Python",
"bytes": "119001"
},
{
"name": "R",
"bytes": "21301"
},
{
"name": "Roff",
"bytes": "60995"
},
{
"name": "Ruby",
"bytes": "3101"
},
{
"name": "Scala",
"bytes": "344340"
},
{
"name": "Shell",
"bytes": "78697"
},
{
"name": "Thrift",
"bytes": "5234"
},
{
"name": "XSLT",
"bytes": "1326"
}
],
"symlink_target": ""
} |
class SignatureSignDocumentStatusResponse
attr_accessor :result, :status, :error_message, :composed_on
# :internal => :external
def self.attribute_map
{
:result => :result, :status => :status, :error_message => :error_message, :composed_on => :composedOn
}
end
def initialize(attributes = {})
# Morph attribute keys into undescored rubyish style
if attributes.to_s != ""
if SignatureSignDocumentStatusResponse.attribute_map["result".to_sym] != nil
name = "result".to_sym
value = attributes["result"]
send("#{name}=", value) if self.respond_to?(name)
end
if SignatureSignDocumentStatusResponse.attribute_map["status".to_sym] != nil
name = "status".to_sym
value = attributes["status"]
send("#{name}=", value) if self.respond_to?(name)
end
if SignatureSignDocumentStatusResponse.attribute_map["error_message".to_sym] != nil
name = "error_message".to_sym
value = attributes["error_message"]
send("#{name}=", value) if self.respond_to?(name)
end
if SignatureSignDocumentStatusResponse.attribute_map["composed_on".to_sym] != nil
name = "composed_on".to_sym
value = attributes["composedOn"]
send("#{name}=", value) if self.respond_to?(name)
end
end
end
def to_body
body = {}
SignatureSignDocumentStatusResponse.attribute_map.each_pair do |key,value|
body[value] = self.send(key) unless self.send(key).nil?
end
body
end
end
| {
"content_hash": "0d0be6b3197f391a52c673734c0b685d",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 107,
"avg_line_length": 32.59574468085106,
"alnum_prop": 0.6377284595300261,
"repo_name": "liosha2007/groupdocs-ruby",
"id": "011275945ab10b1218f0f45bf76fecc72a35e195",
"size": "1532",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "groupdocs/models/signaturesigndocumentstatusresponse.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ruby",
"bytes": "1008444"
}
],
"symlink_target": ""
} |
/**
* \file
* \brief Morecore implementation for malloc
*/
/*
* Copyright (c) 2007, 2008, 2009, 2010, 2011, ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
*/
#include <barrelfish/barrelfish.h>
#include <barrelfish/core_state.h>
#include <barrelfish/morecore.h>
#include <stdio.h>
/// Amount of virtual space for malloc
#ifdef __x86_64__
# define HEAP_REGION (3500UL * 1024 * 1024) /* 2GB */
#else
# define HEAP_REGION (512UL * 1024 * 1024) /* 512MB */
#endif
typedef void *(*morecore_alloc_func_t)(size_t bytes, size_t *retbytes);
extern morecore_alloc_func_t sys_morecore_alloc;
typedef void (*morecore_free_func_t)(void *base, size_t bytes);
extern morecore_free_func_t sys_morecore_free;
/**
* \brief Allocate some memory for malloc to use
*
* This function will keep trying with smaller and smaller frames till
* it finds a set of frames that satisfy the requirement. retbytes can
* be smaller than bytes if we were able to allocate a smaller memory
* region than requested for.
*/
static void *morecore_alloc(size_t bytes, size_t *retbytes)
{
errval_t err;
struct morecore_state *state = get_morecore_state();
void *buf = NULL;
size_t mapped = 0;
size_t step = bytes;
while (mapped < bytes) {
struct capref cap;
err = slot_alloc(&cap);
if (err_is_fail(err)) {
USER_PANIC_ERR(err, "slot_alloc failed");
}
void *mid_buf = NULL;
err = vspace_mmu_aware_map(&state->mmu_state, cap, step,
&mid_buf, &step);
if (err_is_ok(err)) {
if (buf == NULL) {
buf = mid_buf;
}
mapped += step;
} else {
/*
vspace_mmu_aware_map failed probably because we asked
for a very large frame, will try asking for smaller one.
*/
if (err_no(err) == LIB_ERR_FRAME_CREATE_MS_CONSTRAINTS) {
err = slot_free(cap);
if (err_is_fail(err)) {
debug_err(__FILE__, __func__, __LINE__, err,
"slot_free failed");
return NULL;
}
if (step < BASE_PAGE_SIZE) {
// Return whatever we have allocated until now
break;
}
step /= 2;
continue;
} else {
debug_err(__FILE__, __func__, __LINE__, err,
"vspace_mmu_aware_map fail");
return NULL;
}
}
}
*retbytes = mapped;
return buf;
}
static void morecore_free(void *base, size_t bytes)
{
struct morecore_state *state = get_morecore_state();
errval_t err = vspace_mmu_aware_unmap(&state->mmu_state,
(lvaddr_t)base, bytes);
if(err_is_fail(err)) {
USER_PANIC_ERR(err, "vspace_mmu_aware_unmap");
}
}
Header *get_malloc_freep(void);
Header *get_malloc_freep(void)
{
return get_morecore_state()->header_freep;
}
errval_t morecore_init(void)
{
errval_t err;
struct morecore_state *state = get_morecore_state();
thread_mutex_init(&state->mutex);
err = vspace_mmu_aware_init(&state->mmu_state, HEAP_REGION);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_VSPACE_MMU_AWARE_INIT);
}
sys_morecore_alloc = morecore_alloc;
sys_morecore_free = morecore_free;
return SYS_ERR_OK;
}
| {
"content_hash": "59a515d32c4cf82c1179a446170ec1e5",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 76,
"avg_line_length": 29.46031746031746,
"alnum_prop": 0.5635775862068966,
"repo_name": "utsav2601/cmpe295A",
"id": "eb9c9ef0464a95e18d780edfef82112423a182fc",
"size": "3712",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "lib/barrelfish/morecore.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "1174817"
},
{
"name": "Awk",
"bytes": "8608"
},
{
"name": "Bison",
"bytes": "3089"
},
{
"name": "C",
"bytes": "142721209"
},
{
"name": "C++",
"bytes": "5993764"
},
{
"name": "CMake",
"bytes": "5175"
},
{
"name": "CSS",
"bytes": "1905"
},
{
"name": "Emacs Lisp",
"bytes": "1639"
},
{
"name": "Gnuplot",
"bytes": "3383"
},
{
"name": "Groff",
"bytes": "327931"
},
{
"name": "HTML",
"bytes": "390157"
},
{
"name": "Haskell",
"bytes": "1042657"
},
{
"name": "Logos",
"bytes": "17532"
},
{
"name": "Makefile",
"bytes": "24909381"
},
{
"name": "Objective-C",
"bytes": "73687"
},
{
"name": "Perl",
"bytes": "2729747"
},
{
"name": "Perl6",
"bytes": "27602"
},
{
"name": "Prolog",
"bytes": "2799760"
},
{
"name": "Protocol Buffer",
"bytes": "2764"
},
{
"name": "Scheme",
"bytes": "4249"
},
{
"name": "Scilab",
"bytes": "5315"
},
{
"name": "Shell",
"bytes": "415416"
},
{
"name": "Tcl",
"bytes": "18591"
},
{
"name": "TeX",
"bytes": "112247"
},
{
"name": "XS",
"bytes": "4319"
},
{
"name": "eC",
"bytes": "5079"
}
],
"symlink_target": ""
} |
<?php
namespace App\Providers;
use App\Events\ReplyWasCreated;
use App\Listeners\SendNewReplyNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
ReplyWasCreated::class => [
SendNewReplyNotification::class,
],
];
}
| {
"content_hash": "00cab70534d033ff8244521c3dbed94c",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 84,
"avg_line_length": 22.476190476190474,
"alnum_prop": 0.690677966101695,
"repo_name": "LaravelIO/laravel.io",
"id": "3dfb5e070e3b628984a6648a9fc828f3d79193fe",
"size": "472",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Providers/EventServiceProvider.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "412"
},
{
"name": "CSS",
"bytes": "49268"
},
{
"name": "JavaScript",
"bytes": "15617"
},
{
"name": "PHP",
"bytes": "273627"
},
{
"name": "Ruby",
"bytes": "887"
}
],
"symlink_target": ""
} |
<?php
namespace Gstt\Tests\Achievements;
use Gstt\Achievements\Achievement;
class FirstPost extends Achievement
{
public $name = "First Post";
public $description = "You made your first post!";
}
| {
"content_hash": "d143058aa3e6cc8f59870f66885f8a77",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 54,
"avg_line_length": 20.6,
"alnum_prop": 0.7330097087378641,
"repo_name": "gstt/laravel-achievements",
"id": "006146987561703492d845621d5fe16a5563364a",
"size": "206",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/Achievements/FirstPost.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "51728"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Cats.Models.Hubs;
using Cats.Services.Hub;
using Cats.Web.Hub;
namespace Cats.Areas.Hub.Controllers
{
public class LetterTemplateController : BaseController
{
private readonly ILetterTemplateService _letterTemplateService;
public LetterTemplateController(ILetterTemplateService letterTemplateService, IUserProfileService userProfileService)
: base(userProfileService)
{
_letterTemplateService = letterTemplateService;
}
//
// GET: /LetterTemplate/
public ViewResult Index()
{
return View(_letterTemplateService.GetAllLetterTemplate());
}
//
// GET: /LetterTemplate/Details/5
public ViewResult Details(int id)
{
LetterTemplate lettertemplate = _letterTemplateService.FindById(id);
lettertemplate.Template = Server.HtmlDecode(lettertemplate.Template);
return View(lettertemplate);
//LetterTemplate lettertemplate = repositories.LetterTemplate.FindById(id);
//lettertemplate.Template = Server.HtmlDecode(lettertemplate.Template);
//return View(lettertemplate);
}
//
// GET: /LetterTemplate/Create
public ActionResult Create()
{
LetterTemplate template = new LetterTemplate();
//template.Template = new Helpers.LetterTemplateHelper().GetDefaultGiftDetail();
return View(template);
}
//
// POST: /LetterTemplate/Create
[HttpPost]
public ActionResult Create(LetterTemplate lettertemplate)
{
if (ModelState.IsValid)
{
_letterTemplateService.AddLetterTemplate(lettertemplate);
// repositories.LetterTemplate.Add(lettertemplate);
return RedirectToAction("Index");
}
return View(lettertemplate);
}
//
// GET: /LetterTemplate/Edit/5
public ActionResult Edit(int id)
{
LetterTemplate lettertemplate = _letterTemplateService.FindById(id);
lettertemplate.Template = Server.HtmlDecode(lettertemplate.Template);
return View(lettertemplate);
}
//
// POST: /LetterTemplate/Edit/5
[HttpPost]
public ActionResult Edit(LetterTemplate lettertemplate)
{
if (ModelState.IsValid)
{
_letterTemplateService.EditLetterTemplate(lettertemplate);
return RedirectToAction("Index");
}
return View(lettertemplate);
}
//
// GET: /LetterTemplate/Delete/5
public ActionResult Delete(int id)
{
LetterTemplate lettertemplate = _letterTemplateService.FindById(id);
return View(lettertemplate);
}
//
// POST: /LetterTemplate/Delete/5
[HttpPost, ActionName("Delete")]
public ActionResult DeleteConfirmed(int id)
{
_letterTemplateService.DeleteById(id);
//repositories.LetterTemplate.DeleteByID(id);
return RedirectToAction("Index");
}
public ActionResult SelectPrintTemplate(int certificateId)
{
List<LetterTemplate> templates = _letterTemplateService.GetAllLetterTemplate();
ViewBag.Templates = new SelectList(templates.OrderBy(p => p.Name),"LetterTemplateID", "Name");
var model = new PrintCertificateModel();
model.SelectedCertificateId = certificateId;
return PartialView("SelectTemplatePartial", model);
}
[HttpPost]
public ActionResult SelectPrintTemplate(PrintCertificateModel model)
{
if (ModelState.IsValid)
{
return RedirectToAction("LetterPreview",new {certificateId = model.SelectedCertificateId, templateId = model.SelctedTemplateId});
}
return PartialView("SelectTemplatePartial", model);
}
public ActionResult LetterBody(int certificateId, int templateId)
{
string letter = new Web.Hub.Helpers.LetterTemplateHelper().Parse(certificateId, templateId);
ViewBag.Letter = letter;
return PartialView("LetterBodyPartial");
}
public ActionResult LetterPreview(int certificateId)
{
List<LetterTemplate> templates = _letterTemplateService.GetAllLetterTemplate();
ViewBag.Templates = new SelectList(templates.OrderBy(p => p.Name), "LetterTemplateID", "Name");
PrintCertificateModel model = new PrintCertificateModel();
model.SelectedCertificateId = certificateId;
return View("LetterPreview", model);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
}
} | {
"content_hash": "e030402b896963f7fd4cec9869f275a5",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 145,
"avg_line_length": 32.06875,
"alnum_prop": 0.6150847787955565,
"repo_name": "ndrmc/cats",
"id": "d953c90f1cec09afbc4fc49f5511ca054999a482",
"size": "5133",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Web/Areas/Hub/Controllers/LetterTemplateController.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "23179"
},
{
"name": "Batchfile",
"bytes": "220"
},
{
"name": "C#",
"bytes": "17077194"
},
{
"name": "CSS",
"bytes": "1272649"
},
{
"name": "HTML",
"bytes": "1205906"
},
{
"name": "JavaScript",
"bytes": "4300261"
},
{
"name": "PLpgSQL",
"bytes": "10605"
},
{
"name": "SQLPL",
"bytes": "11550"
},
{
"name": "Smalltalk",
"bytes": "10"
}
],
"symlink_target": ""
} |
/*
* Author: digitkhrisnaa
*/
var cores = require("../controller/core_controller");
//Define routes for core logic
module.exports = function(app){
app.get("/api/v1/findmatch", cores.findMatch);
app.get("/api/v1/findmatch/like", cores.matchLike);
app.get("/api/v1/findmatch/reject", cores.matchReject);
app.get("/api/v1/findmatch/match", cores.matched);
app.get("/api/v1/findmatch/unmatch", cores.unmatch);
} | {
"content_hash": "d2da7acc5b3d649c8e462ee5f4d73b5f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 59,
"avg_line_length": 32.92307692307692,
"alnum_prop": 0.6915887850467289,
"repo_name": "digitkhrisnaa/Jojoba-API",
"id": "d0b8cc8f532a3ea408efc2d1b561acdeda75d1cb",
"size": "428",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/routes/core_routes.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "24798"
}
],
"symlink_target": ""
} |
package org.apache.spark.sql.execution.datasources
import java.io.File
import java.net.URI
import scala.collection.mutable
import scala.language.reflectiveCalls
import org.apache.hadoop.fs.{BlockLocation, FileStatus, LocatedFileStatus, Path, RawLocalFileSystem}
import org.apache.spark.metrics.source.HiveCatalogMetrics
import org.apache.spark.sql.catalyst.util._
import org.apache.spark.sql.functions.col
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.SharedSQLContext
import org.apache.spark.sql.types.{IntegerType, StringType, StructField, StructType}
import org.apache.spark.util.{KnownSizeEstimation, SizeEstimator}
class FileIndexSuite extends SharedSQLContext {
test("InMemoryFileIndex: leaf files are qualified paths") {
withTempDir { dir =>
val file = new File(dir, "text.txt")
stringToFile(file, "text")
val path = new Path(file.getCanonicalPath)
val catalog = new InMemoryFileIndex(spark, Seq(path), Map.empty, None) {
def leafFilePaths: Seq[Path] = leafFiles.keys.toSeq
def leafDirPaths: Seq[Path] = leafDirToChildrenFiles.keys.toSeq
}
assert(catalog.leafFilePaths.forall(p => p.toString.startsWith("file:/")))
assert(catalog.leafDirPaths.forall(p => p.toString.startsWith("file:/")))
}
}
test("SPARK-26188: don't infer data types of partition columns if user specifies schema") {
withTempDir { dir =>
val partitionDirectory = new File(dir, "a=4d")
partitionDirectory.mkdir()
val file = new File(partitionDirectory, "text.txt")
stringToFile(file, "text")
val path = new Path(dir.getCanonicalPath)
val schema = StructType(Seq(StructField("a", StringType, false)))
val fileIndex = new InMemoryFileIndex(spark, Seq(path), Map.empty, Some(schema))
val partitionValues = fileIndex.partitionSpec().partitions.map(_.values)
assert(partitionValues.length == 1 && partitionValues(0).numFields == 1 &&
partitionValues(0).getString(0) == "4d")
}
}
test("SPARK-26230: if case sensitive, validate partitions with original column names") {
withTempDir { dir =>
val partitionDirectory = new File(dir, "a=1")
partitionDirectory.mkdir()
val file = new File(partitionDirectory, "text.txt")
stringToFile(file, "text")
val partitionDirectory2 = new File(dir, "A=2")
partitionDirectory2.mkdir()
val file2 = new File(partitionDirectory2, "text.txt")
stringToFile(file2, "text")
val path = new Path(dir.getCanonicalPath)
withSQLConf(SQLConf.CASE_SENSITIVE.key -> "false") {
val fileIndex = new InMemoryFileIndex(spark, Seq(path), Map.empty, None)
val partitionValues = fileIndex.partitionSpec().partitions.map(_.values)
assert(partitionValues.length == 2)
}
withSQLConf(SQLConf.CASE_SENSITIVE.key -> "true") {
val msg = intercept[AssertionError] {
val fileIndex = new InMemoryFileIndex(spark, Seq(path), Map.empty, None)
fileIndex.partitionSpec()
}.getMessage
assert(msg.contains("Conflicting partition column names detected"))
assert("Partition column name list #[0-1]: A".r.findFirstIn(msg).isDefined)
assert("Partition column name list #[0-1]: a".r.findFirstIn(msg).isDefined)
}
}
}
test("SPARK-26263: Throw exception when partition value can't be casted to user-specified type") {
withTempDir { dir =>
val partitionDirectory = new File(dir, "a=foo")
partitionDirectory.mkdir()
val file = new File(partitionDirectory, "text.txt")
stringToFile(file, "text")
val path = new Path(dir.getCanonicalPath)
val schema = StructType(Seq(StructField("a", IntegerType, false)))
withSQLConf(SQLConf.VALIDATE_PARTITION_COLUMNS.key -> "true") {
val fileIndex = new InMemoryFileIndex(spark, Seq(path), Map.empty, Some(schema))
val msg = intercept[RuntimeException] {
fileIndex.partitionSpec()
}.getMessage
assert(msg == "Failed to cast value `foo` to `IntegerType` for partition column `a`")
}
withSQLConf(SQLConf.VALIDATE_PARTITION_COLUMNS.key -> "false") {
val fileIndex = new InMemoryFileIndex(spark, Seq(path), Map.empty, Some(schema))
val partitionValues = fileIndex.partitionSpec().partitions.map(_.values)
assert(partitionValues.length == 1 && partitionValues(0).numFields == 1 &&
partitionValues(0).isNullAt(0))
}
}
}
test("InMemoryFileIndex: input paths are converted to qualified paths") {
withTempDir { dir =>
val file = new File(dir, "text.txt")
stringToFile(file, "text")
val unqualifiedDirPath = new Path(dir.getCanonicalPath)
val unqualifiedFilePath = new Path(file.getCanonicalPath)
require(!unqualifiedDirPath.toString.contains("file:"))
require(!unqualifiedFilePath.toString.contains("file:"))
val fs = unqualifiedDirPath.getFileSystem(spark.sessionState.newHadoopConf())
val qualifiedFilePath = fs.makeQualified(new Path(file.getCanonicalPath))
require(qualifiedFilePath.toString.startsWith("file:"))
val catalog1 = new InMemoryFileIndex(
spark, Seq(unqualifiedDirPath), Map.empty, None)
assert(catalog1.allFiles.map(_.getPath) === Seq(qualifiedFilePath))
val catalog2 = new InMemoryFileIndex(
spark, Seq(unqualifiedFilePath), Map.empty, None)
assert(catalog2.allFiles.map(_.getPath) === Seq(qualifiedFilePath))
}
}
test("InMemoryFileIndex: folders that don't exist don't throw exceptions") {
withTempDir { dir =>
val deletedFolder = new File(dir, "deleted")
assert(!deletedFolder.exists())
val catalog1 = new InMemoryFileIndex(
spark, Seq(new Path(deletedFolder.getCanonicalPath)), Map.empty, None)
// doesn't throw an exception
assert(catalog1.listLeafFiles(catalog1.rootPaths).isEmpty)
}
}
test("PartitioningAwareFileIndex listing parallelized with many top level dirs") {
for ((scale, expectedNumPar) <- Seq((10, 0), (50, 1))) {
withTempDir { dir =>
val topLevelDirs = (1 to scale).map { i =>
val tmp = new File(dir, s"foo=$i.txt")
tmp.mkdir()
new Path(tmp.getCanonicalPath)
}
HiveCatalogMetrics.reset()
assert(HiveCatalogMetrics.METRIC_PARALLEL_LISTING_JOB_COUNT.getCount() == 0)
new InMemoryFileIndex(spark, topLevelDirs, Map.empty, None)
assert(HiveCatalogMetrics.METRIC_PARALLEL_LISTING_JOB_COUNT.getCount() == expectedNumPar)
}
}
}
test("PartitioningAwareFileIndex listing parallelized with large child dirs") {
for ((scale, expectedNumPar) <- Seq((10, 0), (50, 1))) {
withTempDir { dir =>
for (i <- 1 to scale) {
new File(dir, s"foo=$i.txt").mkdir()
}
HiveCatalogMetrics.reset()
assert(HiveCatalogMetrics.METRIC_PARALLEL_LISTING_JOB_COUNT.getCount() == 0)
new InMemoryFileIndex(spark, Seq(new Path(dir.getCanonicalPath)), Map.empty, None)
assert(HiveCatalogMetrics.METRIC_PARALLEL_LISTING_JOB_COUNT.getCount() == expectedNumPar)
}
}
}
test("PartitioningAwareFileIndex listing parallelized with large, deeply nested child dirs") {
for ((scale, expectedNumPar) <- Seq((10, 0), (50, 4))) {
withTempDir { dir =>
for (i <- 1 to 2) {
val subdirA = new File(dir, s"a=$i")
subdirA.mkdir()
for (j <- 1 to 2) {
val subdirB = new File(subdirA, s"b=$j")
subdirB.mkdir()
for (k <- 1 to scale) {
new File(subdirB, s"foo=$k.txt").mkdir()
}
}
}
HiveCatalogMetrics.reset()
assert(HiveCatalogMetrics.METRIC_PARALLEL_LISTING_JOB_COUNT.getCount() == 0)
new InMemoryFileIndex(spark, Seq(new Path(dir.getCanonicalPath)), Map.empty, None)
assert(HiveCatalogMetrics.METRIC_PARALLEL_LISTING_JOB_COUNT.getCount() == expectedNumPar)
}
}
}
test("InMemoryFileIndex - file filtering") {
assert(!InMemoryFileIndex.shouldFilterOut("abcd"))
assert(InMemoryFileIndex.shouldFilterOut(".ab"))
assert(InMemoryFileIndex.shouldFilterOut("_cd"))
assert(!InMemoryFileIndex.shouldFilterOut("_metadata"))
assert(!InMemoryFileIndex.shouldFilterOut("_common_metadata"))
assert(InMemoryFileIndex.shouldFilterOut("_ab_metadata"))
assert(InMemoryFileIndex.shouldFilterOut("_cd_common_metadata"))
assert(InMemoryFileIndex.shouldFilterOut("a._COPYING_"))
}
test("SPARK-17613 - PartitioningAwareFileIndex: base path w/o '/' at end") {
class MockCatalog(
override val rootPaths: Seq[Path])
extends PartitioningAwareFileIndex(spark, Map.empty, None) {
override def refresh(): Unit = {}
override def leafFiles: mutable.LinkedHashMap[Path, FileStatus] = mutable.LinkedHashMap(
new Path("mockFs://some-bucket/file1.json") -> new FileStatus()
)
override def leafDirToChildrenFiles: Map[Path, Array[FileStatus]] = Map(
new Path("mockFs://some-bucket/") -> Array(new FileStatus())
)
override def partitionSpec(): PartitionSpec = {
PartitionSpec.emptySpec
}
}
withSQLConf(
"fs.mockFs.impl" -> classOf[FakeParentPathFileSystem].getName,
"fs.mockFs.impl.disable.cache" -> "true") {
val pathWithSlash = new Path("mockFs://some-bucket/")
assert(pathWithSlash.getParent === null)
val pathWithoutSlash = new Path("mockFs://some-bucket")
assert(pathWithoutSlash.getParent === null)
val catalog1 = new MockCatalog(Seq(pathWithSlash))
val catalog2 = new MockCatalog(Seq(pathWithoutSlash))
assert(catalog1.allFiles().nonEmpty)
assert(catalog2.allFiles().nonEmpty)
}
}
test("InMemoryFileIndex with empty rootPaths when PARALLEL_PARTITION_DISCOVERY_THRESHOLD" +
"is a nonpositive number") {
withSQLConf(SQLConf.PARALLEL_PARTITION_DISCOVERY_THRESHOLD.key -> "0") {
new InMemoryFileIndex(spark, Seq.empty, Map.empty, None)
}
val e = intercept[IllegalArgumentException] {
withSQLConf(SQLConf.PARALLEL_PARTITION_DISCOVERY_THRESHOLD.key -> "-1") {
new InMemoryFileIndex(spark, Seq.empty, Map.empty, None)
}
}.getMessage
assert(e.contains("The maximum number of paths allowed for listing files at " +
"driver side must not be negative"))
}
test("refresh for InMemoryFileIndex with FileStatusCache") {
withTempDir { dir =>
val fileStatusCache = FileStatusCache.getOrCreate(spark)
val dirPath = new Path(dir.getAbsolutePath)
val fs = dirPath.getFileSystem(spark.sessionState.newHadoopConf())
val catalog =
new InMemoryFileIndex(spark, Seq(dirPath), Map.empty, None, fileStatusCache) {
def leafFilePaths: Seq[Path] = leafFiles.keys.toSeq
def leafDirPaths: Seq[Path] = leafDirToChildrenFiles.keys.toSeq
}
val file = new File(dir, "text.txt")
stringToFile(file, "text")
assert(catalog.leafDirPaths.isEmpty)
assert(catalog.leafFilePaths.isEmpty)
catalog.refresh()
assert(catalog.leafFilePaths.size == 1)
assert(catalog.leafFilePaths.head == fs.makeQualified(new Path(file.getAbsolutePath)))
assert(catalog.leafDirPaths.size == 1)
assert(catalog.leafDirPaths.head == fs.makeQualified(dirPath))
}
}
test("SPARK-20280 - FileStatusCache with a partition with very many files") {
/* fake the size, otherwise we need to allocate 2GB of data to trigger this bug */
class MyFileStatus extends FileStatus with KnownSizeEstimation {
override def estimatedSize: Long = 1000 * 1000 * 1000
}
/* files * MyFileStatus.estimatedSize should overflow to negative integer
* so, make it between 2bn and 4bn
*/
val files = (1 to 3).map { i =>
new MyFileStatus()
}
val fileStatusCache = FileStatusCache.getOrCreate(spark)
fileStatusCache.putLeafFiles(new Path("/tmp", "abc"), files.toArray)
}
test("SPARK-20367 - properly unescape column names in inferPartitioning") {
withTempPath { path =>
val colToUnescape = "Column/#%'?"
spark
.range(1)
.select(col("id").as(colToUnescape), col("id"))
.write.partitionBy(colToUnescape).parquet(path.getAbsolutePath)
assert(spark.read.parquet(path.getAbsolutePath).schema.exists(_.name == colToUnescape))
}
}
test("SPARK-25062 - InMemoryFileIndex stores BlockLocation objects no matter what subclass " +
"the FS returns") {
withSQLConf("fs.file.impl" -> classOf[SpecialBlockLocationFileSystem].getName) {
withTempDir { dir =>
val file = new File(dir, "text.txt")
stringToFile(file, "text")
val inMemoryFileIndex = new InMemoryFileIndex(
spark, Seq(new Path(file.getCanonicalPath)), Map.empty, None) {
def leafFileStatuses = leafFiles.values
}
val blockLocations = inMemoryFileIndex.leafFileStatuses.flatMap(
_.asInstanceOf[LocatedFileStatus].getBlockLocations)
assert(blockLocations.forall(_.getClass == classOf[BlockLocation]))
}
}
}
}
class FakeParentPathFileSystem extends RawLocalFileSystem {
override def getScheme: String = "mockFs"
override def getUri: URI = {
URI.create("mockFs://some-bucket")
}
}
class SpecialBlockLocationFileSystem extends RawLocalFileSystem {
class SpecialBlockLocation(
names: Array[String],
hosts: Array[String],
offset: Long,
length: Long)
extends BlockLocation(names, hosts, offset, length)
override def getFileBlockLocations(
file: FileStatus,
start: Long,
len: Long): Array[BlockLocation] = {
Array(new SpecialBlockLocation(Array("dummy"), Array("dummy"), 0L, file.getLen))
}
}
| {
"content_hash": "ddc496103830f65d860686157ef3f315",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 100,
"avg_line_length": 39.42897727272727,
"alnum_prop": 0.6749045320268031,
"repo_name": "WindCanDie/spark",
"id": "6bd0a2591fc1fe247c51adfc224e3fccf378cd91",
"size": "14679",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/FileIndexSuite.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "35161"
},
{
"name": "Batchfile",
"bytes": "30468"
},
{
"name": "C",
"bytes": "1493"
},
{
"name": "CSS",
"bytes": "26884"
},
{
"name": "Dockerfile",
"bytes": "8760"
},
{
"name": "HTML",
"bytes": "70197"
},
{
"name": "HiveQL",
"bytes": "1823426"
},
{
"name": "Java",
"bytes": "3428135"
},
{
"name": "JavaScript",
"bytes": "196704"
},
{
"name": "Makefile",
"bytes": "9397"
},
{
"name": "PLpgSQL",
"bytes": "191716"
},
{
"name": "PowerShell",
"bytes": "3856"
},
{
"name": "Python",
"bytes": "2858499"
},
{
"name": "R",
"bytes": "1168957"
},
{
"name": "Roff",
"bytes": "15669"
},
{
"name": "SQLPL",
"bytes": "3603"
},
{
"name": "Scala",
"bytes": "28234516"
},
{
"name": "Shell",
"bytes": "202816"
},
{
"name": "Thrift",
"bytes": "33605"
},
{
"name": "q",
"bytes": "146878"
}
],
"symlink_target": ""
} |
package monkit
// spanBag is a bag data structure (can add 0 or more references to a span,
// where every add needs to be matched with an equivalent remove). spanBag has
// a fast path for dealing with cases where the bag only has one element (the
// common case). spanBag is not threadsafe
type spanBag struct {
first *Span
rest map[*Span]int32
}
func (b *spanBag) Add(s *Span) {
if b.first == nil {
b.first = s
return
}
if b.rest == nil {
b.rest = map[*Span]int32{}
}
b.rest[s] += 1
}
func (b *spanBag) Remove(s *Span) {
if b.first == s {
b.first = nil
return
}
// okay it must be in b.rest
count := b.rest[s]
if count <= 1 {
delete(b.rest, s)
} else {
b.rest[s] = count - 1
}
}
// Iterate returns all elements
func (b *spanBag) Iterate(cb func(*Span)) {
if b.first != nil {
cb(b.first)
}
for s := range b.rest {
cb(s)
}
}
| {
"content_hash": "b69f6fdac821770b9a05d8374abeaa29",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 78,
"avg_line_length": 19.244444444444444,
"alnum_prop": 0.628175519630485,
"repo_name": "spacemonkeygo/monkit",
"id": "4e9a6d268413dda390cbf513e97cd639e7682b3e",
"size": "1464",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spanbag.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "236153"
},
{
"name": "M4",
"bytes": "7719"
}
],
"symlink_target": ""
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Elevator002 : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Vector3 pos = transform.position;
pos.y = Mathf.PingPong(Time.time * 6, 25) + 126.69f;
transform.position = pos;
}
}
| {
"content_hash": "67ed5d0f686d47b451688191071eca08",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 60,
"avg_line_length": 21.166666666666668,
"alnum_prop": 0.6614173228346457,
"repo_name": "rc7s/spacecadet",
"id": "91e2ff80e42442f8a20cc7994933a3b836b3cd1c",
"size": "383",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assets/scripts/Elevator002.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "736588"
},
{
"name": "HLSL",
"bytes": "17861"
},
{
"name": "ShaderLab",
"bytes": "361808"
}
],
"symlink_target": ""
} |
<?php
require_once 'Exceptions/APIException.php';
require_once 'Response/ResponseInterface.php';
require_once 'Response/Response.php';
require_once 'Response/JSON.php';
use API\Exceptions\APIException;
use API\Response\JSON;
class RapidRest {
/**
* Initializes RedBean.
* Call this once in index.php (which I did by default...) and you're good to go!
* If making changes check out the RedBeanPHP doc...
* @url http://redbeanphp.com/connection
*/
public static function dbInit() {
global $DB_CONFIG;
switch (strtolower($DB_CONFIG['engine'])) {
/*
* SQLite Connection
*/
case "sqlite":
R::setup('sqlite:'.$DB_CONFIG['SQLiteDB']);
break;
/*
* PostgreSQL & MySQL Connections
*/
case "postgresql": # In case you didn't follow the instructions ;)
default:
R::setup($DB_CONFIG['engine'] . ':host='.$DB_CONFIG['host'].';dbname='.$DB_CONFIG['db'],$DB_CONFIG['user'],$DB_CONFIG['pass']);
break;
}
}
/**
* Return all records for a type
* @param string $type Database table
* @return string JSON All of the records and their contents
* @throws API\Exceptions\APIException No records found, 404
*/
public static function getList($type) {
$beans = R::find($type);
$response = R::exportAll($beans);
if(sizeof($response) > 0) {
return new JSON(array("statuscode"=>200, "data"=>$response, "count" => count($response)));
} else {
return new JSON(array("statuscode"=>404, "data"=>array(), "count" => 0));
}
}
/**
* Fetch a bean from the database and display its contents
* @param string $type Database Table
* @param int $id Record ID
* @return string JSON Item contents
* @throws API\Exceptions\APIException Record not found, 404.
*/
public static function getItem($type,$id) {
$response = array();
$$type = R::load($type, $id);
$response = $$type->export(); # Exports the RedBean to an array
if($response['id'] == 0) { # RedBean returns ID 0 for new records.
throw new APIException($type . " not found.", 404);
} else {
return new JSON(array("statuscode"=>200, "data"=>$response));
}
}
/**
* Create a bean using post data and store it in the database
* @param string $type Table
* @return string JSON {"data":{"id":new_id}}
* @throws API\Exceptions\APIException No data received, 400
*/
public static function postItem($type) {
$bean = R::dispense($type);
if(sizeof($_POST) > 0) {
$bean->import($_POST);
$id = R::store($bean);
return new JSON(array("statuscode"=>200, "data"=>array("id"=>$id)));
} else {
throw new APIException("No data received.",400);
}
}
/**
* PUT request to update an existing bean
* @param string $type Table
* @param int $id ID
* @return string JSON {"data":{"id":$id}}
* @throws API\Exceptions\APIException { Not found, 404 | No $_POST data received, 400 }
*/
public static function putItem($type,$id) {
$bean = R::load($type,$id);
# Make sure we have a result
$id = $bean->export(); # Exports the RedBean to an array
if($id['id'] == 0) {
throw new APIException("Record not found.",404);
} else {
if(sizeof($_REQUEST) > 0) {
$bean->import($_REQUEST);
R::store($bean);
return new JSON(array("statuscode"=>200, "data"=>array("id"=>$id['id'])));
} else {
throw new APIException("No data received.", 400);
}
}
}
/**
* DELETE request to delete an existing record
* @param string $type Table
* @param int $id Record ID
* @return string JSON {"deleted": true}
* @throws API\Exceptions\APIException { Record not found, 404 }
*/
public static function deleteItem($type,$id) {
$bean = R::load($type,$id);
# Make sure we have a result
$id = $bean->export(); # Exports the RedBean to an array
if($id['id'] == 0) {
return new JSON(array("deleted"=>false));
} else {
R::trash($bean);
return new JSON(array("deleted"=>true));
}
}
} | {
"content_hash": "678e5a9ff824b06b99ffcb1c07613b60",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 143,
"avg_line_length": 33.58518518518518,
"alnum_prop": 0.542787825319806,
"repo_name": "AndrewNatoli/PHP-RapidREST",
"id": "e8628e3cb2dff9e7588b6325b61d4f6d97de6518",
"size": "4534",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/RapidRest/RapidRest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "84"
},
{
"name": "PHP",
"bytes": "11075"
}
],
"symlink_target": ""
} |
<?php
namespace DCS\VATValidatorBundle\Validation;
interface ValidationInterface
{
/**
* Check is valid VAT
*
* @param string $vatID
* @return boolean
*/
public function check($vatID);
}
| {
"content_hash": "878dc891e123c1607ad234ecec8d1284",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 44,
"avg_line_length": 15.857142857142858,
"alnum_prop": 0.6261261261261262,
"repo_name": "damianociarla/DCSVATValidator",
"id": "35485142b354696bd95b004578bfe88c6a755f99",
"size": "222",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Validation/ValidationInterface.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "4013"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "7885908125fe992b9694324e937a941a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "462f5317857a715a68aca4b619f1d1dd15ba9711",
"size": "216",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Tephroseris/Tephroseris integrifolia/Senecio campestris kirilowii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package org.apache.camel.management;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.engine.ExplicitCamelContextNameStrategy;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@DisabledOnOs(OS.AIX)
public class ManagedCamelContextTotalCounterTest extends ManagementTestSupport {
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
// to force a different management name than the camel id
context.getManagementNameStrategy().setNamePattern("20-#name#");
context.setNameStrategy(new ExplicitCamelContextNameStrategy("my-camel-context"));
return context;
}
@Test
public void testContextTotalCounter() throws Exception {
template.sendBody("direct:a", "Hello World");
MBeanServer mbeanServer = getMBeanServer();
ObjectName on = getContextObjectName();
assertTrue(mbeanServer.isRegistered(on), "Should be registered");
String name = (String) mbeanServer.getAttribute(on, "CamelId");
assertEquals("my-camel-context", name);
String managementName = (String) mbeanServer.getAttribute(on, "ManagementName");
assertEquals("20-my-camel-context", managementName);
Integer total = (Integer) mbeanServer.getAttribute(on, "TotalRoutes");
assertEquals(3, total.intValue());
// 3 routes but only 1 exchange completed
Long ec = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
assertEquals(1, ec.intValue());
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:a")
.to("log:a")
.to("direct:b");
from("direct:b")
.to("log:b")
.to("direct:c");
from("direct:c")
.to("log:c");
}
};
}
}
| {
"content_hash": "71322dc685567f8212bca0cdef3699e8",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 90,
"avg_line_length": 34.542857142857144,
"alnum_prop": 0.6563275434243176,
"repo_name": "tadayosi/camel",
"id": "5fb6b28cd250183f597c1db756b3ca23fedcb050",
"size": "3220",
"binary": false,
"copies": "5",
"ref": "refs/heads/main",
"path": "core/camel-management/src/test/java/org/apache/camel/management/ManagedCamelContextTotalCounterTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6695"
},
{
"name": "Batchfile",
"bytes": "2353"
},
{
"name": "CSS",
"bytes": "5472"
},
{
"name": "Dockerfile",
"bytes": "5676"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "8015"
},
{
"name": "Groovy",
"bytes": "405043"
},
{
"name": "HTML",
"bytes": "212954"
},
{
"name": "Java",
"bytes": "114726986"
},
{
"name": "JavaScript",
"bytes": "103655"
},
{
"name": "Jsonnet",
"bytes": "1734"
},
{
"name": "Kotlin",
"bytes": "41869"
},
{
"name": "Mustache",
"bytes": "525"
},
{
"name": "RobotFramework",
"bytes": "8461"
},
{
"name": "Ruby",
"bytes": "88"
},
{
"name": "Shell",
"bytes": "15327"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "Thrift",
"bytes": "6979"
},
{
"name": "XQuery",
"bytes": "699"
},
{
"name": "XSLT",
"bytes": "276597"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="white">#FFFFFF</color>-->
<color name="gray">#eeeeee</color>
<color name="colorPrimary">#ff313131</color>
<color name="colorPrimaryDark">#ff030303</color>
<color name="colorAccent">#FF4081</color>
<color name="transparent">#00000000</color>
<color name="theme_bg_color_black">#ff313131</color>
<color name="item_column_page_textcolor_title">#ff030303</color>
<color name="item_column_page_textcolor_author">#ff9b9b9b</color>
<color name="theme_bg_color">#fff8f7f5</color>
<color name="pagefragment_textcolor_cust1">#ff000000</color>
<color name="pagefragment_textcolor_common">#ff000000</color>
<color name="pagefragment_view_line_bg_common">#ffc0c0c0</color>
<color name="red">#ff990000</color>
<color name="green">#ff009900</color>
<color name="blue">#ff000099</color>
<color name="white">#ffffffff</color>
<color name="black">#ff000000</color>
<color name="primary">#ff212324</color>
<color name="setting_act_viewline_common">#ffc6c5c4</color>
<color name="setting_act_textcolor_common">#ff727272</color>
<color name="setting_act_textcolor_cus1">#ffd4d4d4</color>
<color name="setting_act_rl_bgcolor_common">#ffffffff</color>
<color name="article_page_textcolor_author">#ff000000</color>
<color name="article_page_textcolor_cust1">#ff000000</color>
<color name="article_page_textcolor_cust2">#ffc3c3c3</color>
<color name="article_page_textcolor_cust3">#ff000000</color>
<color name="article_page_text_select_bg">#ffebe1c4</color>
<color name="article_page_textcolor_select_text">#ff000000</color>
<color name="article_page_textcolor_selected">#ffad8a5a</color>
</resources>
| {
"content_hash": "43d8d442c12fe0f0a029f8a5068b6202",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 70,
"avg_line_length": 44.58139534883721,
"alnum_prop": 0.6932707355242567,
"repo_name": "Loofer/WeRead",
"id": "f4093702b9d9fa3dd1f60b8a8daaef4463abac3e",
"size": "1917",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/values/colors.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "947826"
}
],
"symlink_target": ""
} |
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <[email protected]>
* Mikael Lagerkvist <[email protected]>
*
* Copyright:
* Christian Schulte, 2005
* Mikael Lagerkvist, 2006
*
* Last modified:
* $Date: 2010-06-03 13:11:11 +0200 (Thu, 03 Jun 2010) $ by $Author: tack $
* $Revision: 11013 $
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef __GECODE_TEST_INT_HH__
#define __GECODE_TEST_INT_HH__
#include "test/test.hh"
#include <gecode/int.hh>
namespace Test {
/// Testing finite domain integers
namespace Int {
/**
* \defgroup TaskTestInt Testing finite domain integers
* \ingroup TaskTest
*/
/**
* \defgroup TaskTestIntInt General test support
* \ingroup TaskTestInt
*/
//@{
/// %Base class for assignments
class Assignment {
protected:
int n; ///< Number of variables
Gecode::IntSet d; ///< Domain for each variable
public:
/// Initialize assignments for \a n0 variables and values \a d0
Assignment(int n0, const Gecode::IntSet& d0);
/// Test whether all assignments have been iterated
virtual bool operator()(void) const = 0;
/// Move to next assignment
virtual void operator++(void) = 0;
/// Return value for variable \a i
virtual int operator[](int i) const = 0;
/// Return number of variables
int size(void) const;
/// Destructor
virtual ~Assignment(void);
};
/// Generate all assignments
class CpltAssignment : public Assignment {
protected:
Gecode::IntSetValues* dsv; ///< Iterator for each variable
public:
/// Initialize assignments for \a n0 variables and values \a d0
CpltAssignment(int n, const Gecode::IntSet& d);
/// Test whether all assignments have been iterated
virtual bool operator()(void) const;
/// Move to next assignment
virtual void operator++(void);
/// Return value for variable \a i
virtual int operator[](int i) const;
/// Destructor
virtual ~CpltAssignment(void);
};
/// Generate random selection of assignments
class RandomAssignment : public Assignment {
protected:
int* vals; ///< The current values for the variables
int a; ///< How many assigments still to be generated
/// Generate new value according to domain
int randval(void);
public:
/// Initialize for \a a assignments for \a n0 variables and values \a d0
RandomAssignment(int n, const Gecode::IntSet& d, int a);
/// Test whether all assignments have been iterated
virtual bool operator()(void) const;
/// Move to next assignment
virtual void operator++(void);
/// Return value for variable \a i
virtual int operator[](int i) const;
/// Destructor
virtual ~RandomAssignment(void);
};
/// Generate random selection of assignments
class RandomMixAssignment : public Assignment {
protected:
int* vals; ///< The current values for the variables
int a; ///< How many assigments still to be generated
int _n1; ///< How many variables in the second set
Gecode::IntSet _d1; ///< Domain for second set of variables
/// Generate new value according to domain \a d
int randval(const Gecode::IntSet& d);
public:
/// Initialize for \a a assignments for \a n0 variables and values \a d0
RandomMixAssignment(int n0, const Gecode::IntSet& d0,
int n1, const Gecode::IntSet& d1, int a0);
/// Test whether all assignments have been iterated
virtual bool operator()(void) const;
/// Move to next assignment
virtual void operator++(void);
/// Return value for variable \a i
virtual int operator[](int i) const;
/// Destructor
virtual ~RandomMixAssignment(void);
};
/// Level of consistency to test for
enum ConTestLevel {
CTL_NONE, ///< No consistency-test
CTL_DOMAIN, ///< Test for domain-consistency
CTL_BOUNDS_D, ///< Test for bounds(d)-consistency
CTL_BOUNDS_Z, ///< Test for bounds(z)-consistency
};
class Test;
/// Space for executing tests
class TestSpace : public Gecode::Space {
public:
/// Initial domain
Gecode::IntSet d;
/// Variables to be tested
Gecode::IntVarArray x;
/// Control variable for reified propagators
Gecode::BoolVar b;
/// Whether the test is for a reified propagator
bool reified;
/// The test currently run
Test* test;
/**
* \brief Create test space
*
* Creates \a n variables with domain \a d0 and stores whether
* the test is for a reified propagator (\a r), and the test itself
* (\a t).
*
*/
TestSpace(int n, Gecode::IntSet& d0, bool r, Test* t, bool log=true);
/// Constructor for cloning \a s
TestSpace(bool share, TestSpace& s);
/// Copy space during cloning
virtual Gecode::Space* copy(bool share);
/// Test whether all variables are assigned
bool assigned(void) const;
/// Post propagator
void post(void);
/// Compute a fixpoint and check for failure
bool failed(void);
/// Perform integer tell operation on \a x[i]
void rel(int i, Gecode::IntRelType irt, int n);
/// Perform Boolean tell on \a b
void rel(bool sol);
/// Assign all (or all but one, if \a skip is true) variables to values in \a a
void assign(const Assignment& a, bool skip=false);
/// Assing a random variable to a random bound
void bound(void);
/** \brief Prune some random values from variable \a i
*
* If \a bounds_only is true, then the pruning is only done on the
* bounds of the variable.
*/
void prune(int i, bool bounds_only);
/// Prune some random values for some random variable
void prune(void);
/// Prune values but not those in assignment \a a
bool prune(const Assignment& a, bool testfix);
};
/**
* \brief %Base class for tests with integer constraints
*
*/
class Test : public Base {
protected:
/// Number of variables
int arity;
/// Domain of variables
Gecode::IntSet dom;
/// Does the constraint also exist as reified constraint
bool reified;
/// Consistency level
Gecode::IntConLevel icl;
/// Whether to test for certain consistency
ConTestLevel contest;
/// Whether to perform search test
bool testsearch;
/// Whether to perform fixpoint test
bool testfix;
public:
/**
* \brief Constructor
*
* Constructs a test with name \a s and arity \a a and variable
* domain \a d. Also tests for a reified constraint,
* if \a r is true. The consistency level is
* maintained for convenience.
*/
Test(const std::string& s, int a, const Gecode::IntSet& d, bool r=false,
Gecode::IntConLevel i=Gecode::ICL_DEF);
/**
* \brief Constructor
*
* Constructs a test with name \a s and arity \a a and variable
* domain \a min ... \a max. Also tests for a reified constraint,
* if \a r is true. The consistency level is
* maintained for convenience.
*/
Test(const std::string& s, int a, int min, int max, bool r=false,
Gecode::IntConLevel i=Gecode::ICL_DEF);
/// Create assignment
virtual Assignment* assignment(void) const;
/// Check for solution
virtual bool solution(const Assignment&) const = 0;
/// Whether to ignore assignment for reification
virtual bool ignore(const Assignment&) const;
/// Post constraint
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) = 0;
/// Post reified constraint
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x,
Gecode::BoolVar b);
/// Perform test
virtual bool run(void);
/// \name Mapping scalar values to strings
//@{
/// Map extensional propagation kind to string
static std::string str(Gecode::ExtensionalPropKind epk);
/// Map integer consistency level to string
static std::string str(Gecode::IntConLevel icl);
/// Map integer relation to string
static std::string str(Gecode::IntRelType irl);
/// Map Boolean operation to string
static std::string str(Gecode::BoolOpType bot);
/// Map integer to string
static std::string str(int i);
/// Map integer array to string
static std::string str(const Gecode::IntArgs& i);
//@}
/// \name General support
//@{
/// Compare \a x and \a y with respect to \a r
template<class T> static bool cmp(T x, Gecode::IntRelType r, T y);
//@}
};
//@}
/// Iterator for integer consistency levels
class IntConLevels {
private:
/// Array of consistency levels
static const Gecode::IntConLevel icls[3];
/// Current position in level array
int i;
public:
/// Initialize iterator
IntConLevels(void);
/// Test whether iterator is done
bool operator()(void) const;
/// Increment to next level
void operator++(void);
/// Return current level
Gecode::IntConLevel icl(void) const;
};
/// Iterator for integer relation types
class IntRelTypes {
private:
/// Array of relation types
static const Gecode::IntRelType irts[6];
/// Current position in relation type array
int i;
public:
/// Initialize iterator
IntRelTypes(void);
/// Reset iterator
void reset(void);
/// Test whether iterator is done
bool operator()(void) const;
/// Increment to next relation type
void operator++(void);
/// Return current relation type
Gecode::IntRelType irt(void) const;
};
/// Iterator for Boolean operation types
class BoolOpTypes {
private:
/// Array of operation types
static const Gecode::BoolOpType bots[5];
/// Current position in operation type array
int i;
public:
/// Initialize iterator
BoolOpTypes(void);
/// Test whether iterator is done
bool operator()(void) const;
/// Increment to next operation type
void operator++(void);
/// Return current operation type
Gecode::BoolOpType bot(void) const;
};
}
}
/**
* \brief Print assignment \a
* \relates Assignment
*/
std::ostream& operator<<(std::ostream& os, const Test::Int::Assignment& a);
#include "test/int.hpp"
#endif
// STATISTICS: test-int
| {
"content_hash": "b50a3811d6a276c0943b2f7a7a07091f",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 85,
"avg_line_length": 33.94050991501416,
"alnum_prop": 0.6267423420415658,
"repo_name": "racker/omnibus",
"id": "fa35c686ff3ad4584f60abe0d1640183197b6d33",
"size": "11981",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/gecode-3.7.1/test/int.hh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "21896"
},
{
"name": "ActionScript",
"bytes": "7811"
},
{
"name": "Ada",
"bytes": "913692"
},
{
"name": "Assembly",
"bytes": "546596"
},
{
"name": "Awk",
"bytes": "147229"
},
{
"name": "C",
"bytes": "118056858"
},
{
"name": "C#",
"bytes": "1871806"
},
{
"name": "C++",
"bytes": "28581121"
},
{
"name": "CLIPS",
"bytes": "6933"
},
{
"name": "CSS",
"bytes": "162089"
},
{
"name": "Clojure",
"bytes": "79070"
},
{
"name": "D",
"bytes": "4925"
},
{
"name": "DOT",
"bytes": "1898"
},
{
"name": "Emacs Lisp",
"bytes": "625560"
},
{
"name": "Erlang",
"bytes": "79712366"
},
{
"name": "FORTRAN",
"bytes": "3755"
},
{
"name": "Java",
"bytes": "5632652"
},
{
"name": "JavaScript",
"bytes": "1240931"
},
{
"name": "Logos",
"bytes": "119270"
},
{
"name": "Objective-C",
"bytes": "1088478"
},
{
"name": "PHP",
"bytes": "39064"
},
{
"name": "Pascal",
"bytes": "66389"
},
{
"name": "Perl",
"bytes": "4971637"
},
{
"name": "PowerShell",
"bytes": "1885"
},
{
"name": "Prolog",
"bytes": "5214"
},
{
"name": "Python",
"bytes": "912999"
},
{
"name": "R",
"bytes": "4009"
},
{
"name": "Racket",
"bytes": "2713"
},
{
"name": "Ragel in Ruby Host",
"bytes": "24585"
},
{
"name": "Rebol",
"bytes": "106436"
},
{
"name": "Ruby",
"bytes": "27360215"
},
{
"name": "Scala",
"bytes": "5487"
},
{
"name": "Scheme",
"bytes": "5036"
},
{
"name": "Scilab",
"bytes": "771"
},
{
"name": "Shell",
"bytes": "8793006"
},
{
"name": "Tcl",
"bytes": "3330919"
},
{
"name": "Visual Basic",
"bytes": "10926"
},
{
"name": "XQuery",
"bytes": "4276"
},
{
"name": "XSLT",
"bytes": "2003063"
},
{
"name": "eC",
"bytes": "4568"
}
],
"symlink_target": ""
} |
layout: article
title: Eat This Book - Talking Donkey
date: '2015-10-28T07:13:00.000-04:00'
author: bohanan.jp
tags:
- worship
- children
- video
modified_time: '2015-10-28T07:13:00.050-04:00'
thumbnail: https://img.youtube.com/vi/LbaRAyEsxJc/default.jpg
blogger_id: tag:blogger.com,1999:blog-2749744699161548108.post-2597114240564879051
blogger_orig_url: http://christonthemountaintop.blogspot.com/2015/10/eat-this-book-talking-donkey.html
---
<iframe allowfullscreen="" frameborder="0" height="284" src="https://www.youtube.com/embed/LbaRAyEsxJc" width="504"></iframe> | {
"content_hash": "1c12d3dbea31621a04f5f4084350b501",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 125,
"avg_line_length": 38.06666666666667,
"alnum_prop": 0.7723292469352014,
"repo_name": "justathoughtor2/christchurch",
"id": "8bbfa14fc5b85143e35087abd0ada6512b3b99cf",
"size": "575",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/imported/2015-10-28-eat-this-book-talking-donkey.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "52614"
},
{
"name": "HTML",
"bytes": "2852101"
},
{
"name": "JavaScript",
"bytes": "14694"
},
{
"name": "Ruby",
"bytes": "2082"
}
],
"symlink_target": ""
} |
package edu.columbia.cs.psl.test.phosphor.runtime;
import edu.columbia.cs.psl.phosphor.runtime.MultiTainter;
import edu.columbia.cs.psl.test.phosphor.BaseMultiTaintClass;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
@RunWith(Theories.class)
public class GetCharsObjTagITCase extends BaseMultiTaintClass {
@DataPoints
public static Integer[] intValues() {
return new Integer[]{-10000, -1000, -100, -10, 0, 10, 100, 1000, 10000};
}
@DataPoints
public static Long[] longValues() {
return new Long[]{-10000L, -1000L, -100L, -10L, 0L, 10L, 100L, 1000L, 10000L};
}
@DataPoints
public static Boolean[] tainted() {
return new Boolean[]{Boolean.TRUE, Boolean.FALSE};
}
@Theory
public void testGetCharsInt(Integer value, Boolean tainted) {
int val = tainted ? MultiTainter.taintedInt(value, "tainted int") : value;
String result = new StringBuilder().append(val).toString();
for(char c : result.toCharArray()) {
if(tainted) {
assertNonNullTaint(MultiTainter.getTaint(c));
} else {
assertNullOrEmpty(MultiTainter.getTaint(c));
}
}
}
@Theory
public void testGetCharsLong(Long value, Boolean tainted) {
long val = tainted ? MultiTainter.taintedLong(value, "tainted long") : value;
String result = new StringBuilder().append(val).toString();
for(char c : result.toCharArray()) {
if(tainted) {
assertNonNullTaint(MultiTainter.getTaint(c));
} else {
assertNullOrEmpty(MultiTainter.getTaint(c));
}
}
}
}
| {
"content_hash": "aac3eeb4b49da36bec627549307ae6bc",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 86,
"avg_line_length": 34.20754716981132,
"alnum_prop": 0.6420297848869277,
"repo_name": "Programming-Systems-Lab/phosphor",
"id": "2c6f76751472275e8e2f0fd57d0a69c962b293d0",
"size": "1813",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "integration-tests/src/test/java/edu/columbia/cs/psl/test/phosphor/runtime/GetCharsObjTagITCase.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "11872"
},
{
"name": "Java",
"bytes": "1887818"
},
{
"name": "Makefile",
"bytes": "553"
},
{
"name": "Shell",
"bytes": "5454"
}
],
"symlink_target": ""
} |
import mock
from nose.tools import eq_
from django import forms
import amo.tests
from files.utils import WebAppParser
class TestWebAppParser(amo.tests.TestCase):
@mock.patch('files.utils.WebAppParser.get_json_data')
def test_no_developer_name(self, get_json_data):
get_json_data.return_value = {
'name': 'Blah'
}
with self.assertRaises(forms.ValidationError) as e:
# The argument to parse() is supposed to be a filename, it doesn't
# matter here though since we are mocking get_json_data().
WebAppParser().parse('')
eq_(e.exception.messages, ["Developer name is required in the manifest"
" in order to display it on the app's "
"listing."])
@mock.patch('files.utils.WebAppParser.get_json_data')
def test_empty_developer_object(self, get_json_data):
get_json_data.return_value = {
'name': 'Blah',
'developer': {}
}
with self.assertRaises(forms.ValidationError) as e:
# The argument to parse() is supposed to be a filename, it doesn't
# matter here though since we are mocking get_json_data().
WebAppParser().parse('')
eq_(e.exception.messages, ["Developer name is required in the manifest"
" in order to display it on the app's "
"listing."])
@mock.patch('files.utils.WebAppParser.get_json_data')
def test_developer_name(self, get_json_data):
get_json_data.return_value = {
'name': 'Blah',
'developer': {
'name': 'Mozilla Marketplace Testing'
}
}
# The argument to parse() is supposed to be a filename, it doesn't
# matter here though since we are mocking get_json_data().
parsed_results = WebAppParser().parse('')
eq_(parsed_results['developer_name'], 'Mozilla Marketplace Testing')
@mock.patch('files.utils.WebAppParser.get_json_data')
def test_name_with_translations(self, get_json_data):
get_json_data.return_value = {
'name': 'Blah',
'developer': {
'name': 'Mozilla Marketplace Testing'
},
'default_locale': 'en-US',
'locales': {
'fr': {
'name': 'Blah (fr)',
},
'es': {
'name': 'Blah (es)',
}
}
}
# The argument to parse() is supposed to be a filename, it doesn't
# matter here though since we are mocking get_json_data().
parsed_results = WebAppParser().parse('')
eq_(parsed_results['name'].get('fr'), 'Blah (fr)')
eq_(parsed_results['name'].get('es'), 'Blah (es)')
eq_(parsed_results['name'].get('en-US'), 'Blah')
eq_(parsed_results['name'].get('de'), None)
eq_(parsed_results['default_locale'], 'en-US')
@mock.patch('files.utils.WebAppParser.get_json_data')
def test_name_with_translations_fallback(self, get_json_data):
get_json_data.return_value = {
'name': 'Blah',
'description': 'Blah Description',
'developer': {
'name': 'Mozilla Marketplace Testing'
},
'default_locale': 'en-US',
'locales': {
'fr': {
'description': 'Blah Description (fr)',
},
'es': {
'name': 'Blah (es)',
}
}
}
# The argument to parse() is supposed to be a filename, it doesn't
# matter here though since we are mocking get_json_data().
parsed_results = WebAppParser().parse('')
eq_(parsed_results['name'].get('fr'), 'Blah') # Falls back to default.
eq_(parsed_results['name'].get('es'), 'Blah (es)')
eq_(parsed_results['name'].get('en-US'), 'Blah')
eq_(parsed_results['name'].get('de'), None)
eq_(parsed_results['default_locale'], 'en-US')
| {
"content_hash": "367ab33c7947f16d279e723383aca727",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 79,
"avg_line_length": 40.19417475728155,
"alnum_prop": 0.5285024154589372,
"repo_name": "spasovski/zamboni",
"id": "2c60fdff0cd58dff66b744142e762942b1661579",
"size": "4140",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "mkt/files/tests/test_utils_.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "4145"
},
{
"name": "CSS",
"bytes": "885279"
},
{
"name": "JavaScript",
"bytes": "1677601"
},
{
"name": "Puppet",
"bytes": "13808"
},
{
"name": "Python",
"bytes": "6279560"
},
{
"name": "Shell",
"bytes": "19774"
}
],
"symlink_target": ""
} |
// This file is part of SNMP#NET.
//
// SNMP#NET is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// SNMP#NET is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SNMP#NET. If not, see <http://www.gnu.org/licenses/>.
//
using System;
using System.Text;
using System.Security.Cryptography;
namespace SnmpSharpNet
{
/// <summary>
/// MD5 Authentication class.
/// </summary>
public class AuthenticationMD5: IAuthenticationDigest
{
/// <summary>
/// Standard constructor
/// </summary>
public AuthenticationMD5()
{
}
/// <summary>
/// Authenticate packet and return authentication parameters value to the caller
/// </summary>
/// <param name="authenticationSecret">User authentication secret</param>
/// <param name="engineId">SNMP agent authoritative engine id</param>
/// <param name="wholeMessage">Message to authenticate</param>
/// <returns>Authentication parameters value</returns>
public byte[] authenticate(byte[] authenticationSecret, byte[] engineId, byte[] wholeMessage)
{
byte[] result = new byte[12];
byte[] authKey = PasswordToKey(authenticationSecret, engineId);
HMACMD5 md5 = new HMACMD5(authKey);
byte[] hash = md5.ComputeHash(wholeMessage);
// copy 12 bytes of the hash into the wholeMessage
Buffer.BlockCopy(hash, 0, result, 0, 12);
return result;
}
/// <summary>
/// Authenticate packet and return authentication parameters value to the caller
/// </summary>
/// <param name="authKey">Pre-generated authentication key</param>
/// <param name="wholeMessage">Message being authenticated</param>
/// <returns>Authentication parameters value</returns>
public byte[] authenticate(byte[] authKey, byte[] wholeMessage)
{
byte[] result = new byte[12];
HMACMD5 md5 = new HMACMD5(authKey);
byte[] hash = md5.ComputeHash(wholeMessage);
// copy 12 bytes of the hash into the wholeMessage
Buffer.BlockCopy(hash, 0, result, 0, 12);
return result;
}
/// <summary>
/// Verifies correct MD5 authentication of the frame. Prior to calling this method, you have to extract authentication
/// parameters from the wholeMessage and reset authenticationParameters field in the USM information block to 12 0x00
/// values.
/// </summary>
/// <param name="userPassword">User password</param>
/// <param name="engineId">Authoritative engine id</param>
/// <param name="authenticationParameters">Extracted USM authentication parameters</param>
/// <param name="wholeMessage">Whole message with authentication parameters zeroed (0x00) out</param>
/// <returns>True if message authentication has passed the check, otherwise false</returns>
public bool authenticateIncomingMsg(byte[] userPassword, byte[] engineId, byte[] authenticationParameters, MutableByte wholeMessage)
{
byte[] authKey = PasswordToKey(userPassword, engineId);
HMACMD5 md5 = new HMACMD5(authKey);
byte[] hash = md5.ComputeHash(wholeMessage, 0, wholeMessage.Length);
MutableByte myhash = new MutableByte(hash, 12);
if (myhash.Equals(authenticationParameters))
{
return true;
}
return false;
}
/// <summary>
/// Verify MD5 authentication of a packet.
/// </summary>
/// <param name="authKey">Authentication key (not password)</param>
/// <param name="authenticationParameters">Authentication parameters extracted from the packet being authenticated</param>
/// <param name="wholeMessage">Entire packet being authenticated</param>
/// <returns>True on authentication success, otherwise false</returns>
public bool authenticateIncomingMsg(byte[] authKey, byte[] authenticationParameters, MutableByte wholeMessage)
{
HMACMD5 md5 = new HMACMD5(authKey);
byte[] hash = md5.ComputeHash(wholeMessage, 0, wholeMessage.Length);
MutableByte myhash = new MutableByte(hash, 12);
if (myhash.Equals(authenticationParameters))
{
return true;
}
return false;
}
/// <summary>
/// Convert user password to acceptable authentication key.
/// </summary>
/// <param name="userPassword">Authentication password</param>
/// <param name="engineID">Authoritative engine id</param>
/// <returns>Localized authentication key</returns>
/// <exception cref="SnmpAuthenticationException">Thrown when key length is less then 8 bytes</exception>
public byte[] PasswordToKey(byte[] userPassword, byte[] engineID)
{
// key length has to be at least 8 bytes long (RFC3414)
if (userPassword == null || userPassword.Length < 8)
throw new SnmpAuthenticationException("Secret key is too short.");
int password_index = 0;
int count = 0;
MD5 md5 = new MD5CryptoServiceProvider();
byte[] sourceBuffer = new byte[1048576];
byte[] buf = new byte[64];
while (count < 1048576)
{
for (int i = 0; i < 64; ++i)
{
buf[i] = userPassword[password_index++ % userPassword.Length];
}
Buffer.BlockCopy(buf, 0, sourceBuffer, count, buf.Length);
count += 64;
}
byte[] digest = md5.ComputeHash(sourceBuffer);
MutableByte tmpbuf = new MutableByte();
tmpbuf.Append(digest);
tmpbuf.Append(engineID);
tmpbuf.Append(digest);
byte[] key = md5.ComputeHash(tmpbuf);
return key;
}
/// <summary>
/// Length of the digest generated by the authentication protocol
/// </summary>
public int DigestLength
{
get { return 16; }
}
/// <summary>
/// Return protocol name.
/// </summary>
public string Name
{
get { return "HMAC-MD5"; }
}
/// <summary>
/// Compute hash using authentication protocol.
/// </summary>
/// <param name="data">Data to hash</param>
/// <param name="offset">Compute hash from the source buffer offset</param>
/// <param name="count">Compute hash for source data length</param>
/// <returns>Hash value</returns>
public byte[] ComputeHash(byte[] data, int offset, int count)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] res = md5.ComputeHash(data, offset, count);
md5.Clear();
return res;
}
}
}
| {
"content_hash": "90f8cdf7d24a88434df8d52629b3d17b",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 134,
"avg_line_length": 36.11797752808989,
"alnum_prop": 0.7001088816301135,
"repo_name": "Proxx/Proxx.SNMP",
"id": "769472e4dce49ecc7ae0ba319d7f0824b7d117f0",
"size": "6431",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "old/src/security/AuthenticationMD5.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "610395"
},
{
"name": "PowerShell",
"bytes": "14700"
}
],
"symlink_target": ""
} |
package me.devsaki.hentoid.dirpicker.model;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
/**
* Created by avluis on 06/12/2016.
* Directory List Builder
*/
public class DirList extends ArrayList<File> {
public void sort() {
Collections.sort(this, new FileComparator());
}
}
| {
"content_hash": "20d4a57244d009563e3cb186b25c4e7b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 53,
"avg_line_length": 20.625,
"alnum_prop": 0.7090909090909091,
"repo_name": "csaki/Hentoid",
"id": "9de14a72c2365abb2ca5289a94d6efc89b4dc8a4",
"size": "330",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/me/devsaki/hentoid/dirpicker/model/DirList.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "227125"
}
],
"symlink_target": ""
} |
guid: d86dfee3-196b-4c05-99b9-76135099c3f0
type: Live
reformat: True
shortenReferences: True
categories: mnemonics
scopes: InCSharpTypeAndNamespace(minimumLanguageVersion=2.0); InCSharpTypeMember(minimumLanguageVersion=2.0)
parameterOrder: propname
propname-expression: constant("MyProperty")
---
# pr~b
An automatic property of type System.Collections.Generic.IEnumerable<bool> with a private setter
```
public System.Collections.Generic.IEnumerable<bool> $propname${ get; private set; }$END$
```
| {
"content_hash": "4e15ef3b746abc7a0a59b0448f31ff7a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 108,
"avg_line_length": 29.470588235294116,
"alnum_prop": 0.8063872255489022,
"repo_name": "citizenmatt/resharper-template-compiler",
"id": "3184af219d3070dc8b59dcc213425898a22019eb",
"size": "505",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "samples/mnemonics/pr~b.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "82018"
}
],
"symlink_target": ""
} |
package model
import (
"context"
"testing"
)
func TestGroupRepository_IsGranted(t *testing.T) {
suite := &postgresSuite{}
suite.setup(t)
defer suite.teardown(t)
for ur := range loadGroupFixtures(t, suite.repository.group, groupPermissionsTestFixtures) {
for pr := range loadPermissionFixtures(t, suite.repository.permission, ur.given.Permissions) {
add := []*GroupPermissionsEntity{{
GroupID: ur.got.ID,
PermissionSubsystem: pr.got.Subsystem,
PermissionModule: pr.got.Module,
PermissionAction: pr.got.Action,
}}
for range loadGroupPermissionsFixtures(t, suite.repository.groupPermissions, add) {
exists, err := suite.repository.group.IsGranted(context.TODO(), ur.given.ID, pr.given.Permission())
if err != nil {
t.Errorf("group permission cannot be found, unexpected error: %s", err.Error())
continue
}
if !exists {
t.Errorf("group permission not found for group %d and permission %d", ur.given.ID, pr.given.ID)
} else {
t.Logf("group permission relationship exists for group %d and permission %d", ur.given.ID, pr.given.ID)
}
}
}
}
}
type groupFixtures struct {
got, given GroupEntity
}
func loadGroupFixtures(t *testing.T, r GroupProvider, f []*GroupEntity) chan groupFixtures {
data := make(chan groupFixtures, 1)
go func() {
for _, given := range f {
entity, err := r.Insert(context.TODO(), given)
if err != nil {
t.Errorf("group cannot be created, unexpected error: %s", err.Error())
continue
} else {
t.Logf("group has been created, got id %d", entity.ID)
}
data <- groupFixtures{
got: *entity,
given: *given,
}
}
close(data)
}()
return data
}
| {
"content_hash": "11a4e59d5442400c7125da3e5a4e7a9c",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 108,
"avg_line_length": 25.954545454545453,
"alnum_prop": 0.6649153531815528,
"repo_name": "go-soa/charon",
"id": "dacc72f1d5448a876748e6d185a689081ee1ae04",
"size": "1713",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "internal/model/group_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "231572"
},
{
"name": "Makefile",
"bytes": "4113"
},
{
"name": "Protocol Buffer",
"bytes": "7511"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CodePen - A Pen by Benjamin Laguna</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div>
<h1>Programming Notes</h1>
</div>
<div class="first-paragraph">
<h2 class="lesson">Stage 0</h2>
<div class="Section Header"> Key Terms/Ideas
</div>
<p><em>HTML</em>: HypertextMarkup Language
</p>
<p><em>HTTP</em>: Hypertext transfer protocol
</p>
<p><em>Tags</em>: These start and end a string of code, and give it a function to do something. Tags the browser to interpret the HTML into a specific type of element
</p>
<p><em>Inline vs. Block</em>: In reference to whether the tag provides an output that is part of a continuous line vs. making an editable box of code.</p>
<p> <em>Inserting Comments</em>: To insert comments into the HTML code, you can use the tag <!--or as such-->
</p>
<p><em>Head</em>: Element contains information that won't be displayed on the page
</p>
<p><em>Title</em>: Element normally sets the name of the browser tab
</p>
<p><em>Linking a webpage</em>: You can place the following code: a href="www.google.com" TEXT /a, or simply
<a href="www.google.com"> Google </a>
</p>
<p><em>Linking to an image</em>: You can linke to an image by placing an inline tag img src="link to an image.jpg" alt="text" style="something by something" or simply
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Olympic_rings_without_rims.svg/342px-Olympic_rings_without_rims.svg.png" alt="olympic rings" height="42">
</p>
</div>
<div class="second-paragraph">
<h2 class="lesson"> Stage 1.1
</h2>
<div>
<p>
<em>Page Languages</em>: Overall, webpages are made up of HTML, CSS, and javascript which provide the structure, style, and interaction of elements within a page.
</p>
<p>
<em>Format of a page</em>: It is reasonable to approach a page as a bunch of boxes within boxes, and each element can be broken down. An easy way to evaluate the structure is by using the web developer tools provided by a browser.
</p>
<em>Breaking down the boxes</em>: You can approach these boxes by using the div tag, and then labeling each of these tags so as to read the code in a faster manner.
<p>
<em>Creating/Analyzing code</em>: You can use scratchpad.io to see instant results of the HTML, but is slightly limited. You can use codepen.io to save and to incorporate css and js. Finally, you can use all of these features and more through sublime, a dedicated text editor.
</p>
</div>
</div>
<div class="third-paragraph">
<h2 class="lesson">
Stage 1.2+1.3: Structured document+Adding CSS Style
</h2>
<div>
<p> CSS: Code to control style of HTML
</p>
<p> Selector: basically gives a command to a specific element. For example, you can have a selector h1 {background-color: black; color: white;} to apply to every h1 element.
</p>
<p> Declaration: within brackets, which contains the comand of a selector. The declaration is made up of a property (background-color) and then a value of the property (black)
</p>
<p> Selecting by class: You can use div tag to select a certain type of class. Then you can use the style tag to define the elements of each of the div elements, by using .class-name
</p>
<div>
<h3>Including CSS:</h3>
<ol>
<li>You can write CSS within the head of the HTML, best for simple elements.</li>
<li>You can link HTML to a separate CSS file. You basically link a CSS file, take for example main.css, and this will apply style to your document. Within the css file, you can assign a style like div{background-color: red;}</li>
<li>Style inline with HTML: Dont do this. It makes you rewrite a bunch of code.</li>
</ol>
</div>
<div>
<p> Linking CSS to HTML: You can assign div tags classes, and then refer to them in css by using .lesson {}, and within that have a declaration with a value
</p>
<p> Variations in CSS: there are often many ways to style something, for example with font color, you can use hex colors, font colors, etc.
</p>
<p> Choosing the right type of element: regardless of the style, if you don't choose the right element, things will start to look wonky. In cases of text, using the h tag is more correct than using the div tag.
</p>
</div>
<div>
<h3>Technical Notes on Boxes
</h3>
<p> HTML elements, like div elements, makeup boxes, and box sizing isn't trivial. To allows sizing to be flexible, you can either set sizes in terms of percentages, or use the box-sizing attribute to border-box for every element.
</p>
<p> More on Div elements: these are block elements, so they take up the entire width of a page, and you can use the display:flex rule to allow div's to line up next to each other, rather than always having to stack.
</p>
<!--Its interesting that anything you need can be found online-->
<ol>
<li>These are important items</li>
<li>And this is how they look</li>
<li>To Find more click
<a href="http://www.w3schools.com/tags/tag_comment.asp"> here </a>
</li>
</ol>
</div>
</div>
</div>
</body>
</html> | {
"content_hash": "dc5de965d7e8a12c21ea9e12b69315cf",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 287,
"avg_line_length": 52.56880733944954,
"alnum_prop": 0.6280977312390925,
"repo_name": "blaguna/make-a-web-page_2",
"id": "f5f531be84a31694edac894c5c1389f8b49ad32a",
"size": "5730",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "633"
},
{
"name": "HTML",
"bytes": "5730"
}
],
"symlink_target": ""
} |
class Movie < ActiveRecord::Base
RATINGS = [:R, :PG13]
has_and_belongs_to_many :genres
has_many :characters
collate_group :basic_information, default_open: true do
collate_on :name, field_transformations: [:downcase, :pizza]
collate_on :name, operator: :ilike
collate_on 'genres.id', operator: :contains, component: {load_records: true}, field_transformations: [:array_agg], value_transformations: [[:join, ', '], :as_array]
collate_on 'select_genres.id', joins: [:genres], joins_prefix: 'select_', operator: :&, not: true, field_transformations: [:array_agg], value_transformations: [[:join, ', '], :as_array]
collate_on :good_movie, operator: :present?
collate_on :release_date, operator: :ge, field_transformations: [[:date_difference, "date '2017-01-01'"], [:date_part, 'year']]
collate_on :synopsis, label: 'Keywords', operator: :contains, component: {tags: true}, field_transformations: [:downcase, [:split, ' ']], value_transformations: [[:join, ', '], :as_array, :downcase]
collate_on :user_rating, operator: :le
collate_on :synopsis, operator: :le, field_transformations: [[:split, ' '], [:array_length, 1]]
collate_on :user_rating, operator: :null
collate_on :name, operator: :pizza
collate_on 'genres.id', value_transformations: [:pizza]
collate_on :director_id, component: {load_records: true, type: 'checkboxgroup'}
collate_on :mpaa_rating, component: {type: 'checkboxgroup', values: Movie::RATINGS}
end
end
| {
"content_hash": "bfd2286fee28a1d438d124583358cf87",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 202,
"avg_line_length": 64.73913043478261,
"alnum_prop": 0.6816655473472129,
"repo_name": "trackingboard/collate",
"id": "e50965db96fd3714c9f1e7f1db17efa434017296",
"size": "1489",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/models/movie.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1685"
},
{
"name": "Ruby",
"bytes": "42000"
},
{
"name": "Shell",
"bytes": "88"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for node.js v4.2.2: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v4.2.2
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1HeapGraphNode.html">HeapGraphNode</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">v8::HeapGraphNode Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html#ac3435611573e58b6614aeaab68442905">GetChild</a>(int index) const </td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html#a0a49abe006755dd5536d15ae42f552d4">GetChildrenCount</a>() const </td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html#a0faf2a07888af9ca938b3ac089500b4c">GetId</a>() const </td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html#afd02d17040ae74f40d60d921795aacdb">GetName</a>() const </td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html#a5f6f1e87efce0b297c3ffad0b50f34d5">GetShallowSize</a>() const </td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html#a5e07fc855bded52229e62b855fa08c5d">GetType</a>() const </td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>kArray</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>kClosure</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>kCode</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>kConsString</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>kHeapNumber</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>kHidden</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>kNative</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>kObject</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>kRegExp</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>kSimdValue</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>kSlicedString</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>kString</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>kSymbol</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>kSynthetic</b> enum value (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Type</b> enum name (defined in <a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a>)</td><td class="entry"><a class="el" href="classv8_1_1HeapGraphNode.html">v8::HeapGraphNode</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
| {
"content_hash": "199fd33ce10b0220110a011edce2b879",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 300,
"avg_line_length": 81.46456692913385,
"alnum_prop": 0.6742702493717379,
"repo_name": "v8-dox/v8-dox.github.io",
"id": "3528a574404ac891678a6c9d5cdbc5e9ea366962",
"size": "10346",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "0b32bbb/html/classv8_1_1HeapGraphNode-members.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Common.LogicObject
{
public class AttachFileParams
{
public Guid AttId;
public Guid ArticleId;
public string FilePath;
public string FileSavedName;
public int FileSize;
public int SortNo;
public string FileMIME;
public bool DontDelete;
public string PostAccount;
}
}
| {
"content_hash": "b1cb1e418568f6bd9bbd5cbe0d6815db",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 36,
"avg_line_length": 22.45,
"alnum_prop": 0.6614699331848553,
"repo_name": "lozenlin/SampleCMS",
"id": "9d7a6cd8d893fc07c7deda21f8cf48f40d00ffdc",
"size": "451",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Common/Common.LogicObject/QueryParam/AttachFileParams.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "277981"
},
{
"name": "Batchfile",
"bytes": "784"
},
{
"name": "C#",
"bytes": "1109075"
},
{
"name": "CSS",
"bytes": "225537"
},
{
"name": "HTML",
"bytes": "636798"
},
{
"name": "JavaScript",
"bytes": "2168414"
},
{
"name": "PowerShell",
"bytes": "640"
},
{
"name": "SQLPL",
"bytes": "135111"
}
],
"symlink_target": ""
} |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example113-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.1/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.1/angular-touch.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="ngSwipeLeftExample">
<div ng-show="!showActions" ng-swipe-left="showActions = true">
Some list content, like an email in the inbox
</div>
<div ng-show="showActions" ng-swipe-right="showActions = false">
<button ng-click="reply()">Reply</button>
<button ng-click="delete()">Delete</button>
</div>
</body>
</html> | {
"content_hash": "81e468cdc241ab0e3803cb561047f9b8",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 90,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.6704545454545454,
"repo_name": "viral810/ngSimpleCMS",
"id": "8ef36d22cd31776f1afc0012616f4b473c6c7fbe",
"size": "704",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "web/bundles/sunraangular/js/angular/angular-1.3.2/docs/examples/example-example113/index-production.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3606"
},
{
"name": "CSS",
"bytes": "380387"
},
{
"name": "HTML",
"bytes": "15140977"
},
{
"name": "JavaScript",
"bytes": "3143485"
},
{
"name": "PHP",
"bytes": "69377"
},
{
"name": "Ruby",
"bytes": "1784"
}
],
"symlink_target": ""
} |
functional-jpa
==============
Functional style helpers for jpa and guava (tests fine with 16.0.1). Has an optional dependency
on [RxJava](http://github.com/Netflix/RxJava) if you wish to use Observables (which are very cool!).
Status: *released to Maven Central*
Release notes
--------------
* 0.1.1-SNAPSHOT use rxjava-core 0.18.3, guava 17.0
* 0.1 inital release to Maven Central
Features
-------------------
* method chaining for EntityManager, EntityManagerFactory
* improved Query builder
* lazy iteration and paging of result sets (great for large result sets)
* can return result set as [Guava](https://code.google.com/p/guava-libraries/) [FluentIterable](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/FluentIterable.html)
* can return result set as [RxJava](http://github.com/Netflix/RxJava) Observable
* RichEntityManager.run handles try catch final noise for closing resources and logging (slf4j)
* Funcito helper methods
Getting started
------------------
Add this dependency to your project:
```xml
<dependency>
<groupId>com.github.davidmoten</groupId>
<artifactId>functional-jpa</artifactId>
<version>0.1</version>
</dependency>
```
Query iterators
------------------
*Rich* versions of `EntityManager.createQuery` method have fluent style and enable lazy iteration
of the result set of a query (which uses `setFirst` and `setMaxResults` for paging under the covers).
To get a rich version of an `EntityManagerFactory`:
```java
EntityManagers.enrich(normalEmf);
```
Now to an example:
Given this jpa class (note the use of [Funcito](https://code.google.com/p/funcito/) to create the guava function for id):
```java
@Entity
public class Document {
@Id
private String id;
public Document(String id) {
this.id = id;
}
public String getId() {
return id;
}
@Column
public String status;
public static Function<Document, String> toId = functionFor(callsTo(
Document.class).getId());
}
```
You can do stuff like this:
```java
import com.github.davidmoten.fjpa.EntityManagers;
RichEntityManagerFactory emf = EntityManagers.emf("test");
RichEntityManager em = emf.createEntityManager();
// get a list of all ids in documents
List<String> list =
em
.createQuery("from Document order by id",String.class)
.pageSize(2000) //default page size is 100
.fluent() //as FluentIterable
.transform(toId) //get id (lazily)
.toList(); //force evaluation to list
```
or using Java 8 lambdas:
```java
// get a list of all ids in documents
List<String> list =
em
.createQuery("from Document order by id",String.class)
.pageSize(2000) //default page size is 100
.fluent() //as FluentIterable
.transform(d -> d.id) //get id (lazily)
.toList(); //force evaluation to list
```
Eliminating try-catch-final noise
---------------------------------------
You can also get the `RichEntityManagerFactory` to perform all of the usual try-catch-final
closing of resources and logging of errors using the `RichEntityManagerFactory` run method:
```java
RichEntityManagerFactory emf = EntityManagers.emf("test");
List<String> list =
emf.run(new Task<List<String>>() {
@Override
public List<String> run(RichEntityManager em) {
return em
.persist(new Document("a"))
.persist(new Document("b"))
.persist(new Document("c"))
.createQuery("from Document order by id",
Document.class)
.fluent()
.transform(toId).toList();
}
});
assertEquals(newArrayList("a", "b", "c"), list);
emf.close();
```
or using method chaining even further for the same result:
```java
emf("test")
.run(new Task<List<String>>() {
@Override
public List<String> run(RichEntityManager em) {
return em
.persist(new Document("a"))
.persist(new Document("b"))
.persist(new Document("c"))
.createQuery("from Document order by id",
Document.class)
.fluent()
.transform(toId)
.toList();
}
}).process(new Processor<List<String>>() {
@Override
public void process(List<String> list) {
assertEquals(newArrayList("a", "b", "c"), list);
}
}).emf().close();
```
or the same again but using Java 8 lambdas for less noise:
```java
emf("test")
.run(em -> em.persist(new Document("a"))
.persist(new Document("b"))
.persist(new Document("c"))
.createQuery("from Document order by id",
Document.class)
.fluent()
.transform(toId)
.toList())
.process(list ->
assertEquals(newArrayList("a", "b", "c"), list))
.emf().close();
```
Funcito helper methods
--------------------------
[Funcito](https://code.google.com/p/funcito/) is a great tool in the absence of Java 8. The methods `FuncitoGuava.functionFor` combined with `FuncitoGuava.callsTo` allow
wonderfully concise creation of Guava Functions.
For example:
```java
Function<Document,String> toId = functionFor(callsTo(Document.class).getId());
```
I love it but its a bit verbose so I added a simple `FuncitoHelper` class to functional-jpa that allows for an abbreviated version:
```java
import com.github.davidmoten.fjpa.FuncitoHelper.*;
Function<Document,String> toId = f(c(Document.class).getId();
```
Here's an example using *functional-jpa* that is very close in conciseness to using Java 8 lambdas:
```java
import com.github.davidmoten.fjpa.EntityManagers;
RichEntityManagerFactory emf = EntityManagers.emf("test");
RichEntityManager em = emf.createEntityManager();
// get a list of all ids in documents
List<String> list =
em
.createQuery("from Document order by id",String.class)
.pageSize(2000) //default page size is 100
.fluent() //as FluentIterable
.transform(f(c(Document.class).getId()) //get id (lazily)
.toList(); //force evaluation to list
```
Using Observables
---------------------
Support for rxjava is limited to evaluating queries:
```java
Observable<Document> documents = em
// begin transaction
.begin()
// persist a document
.persist(new Document("a"))
// persist one more
.persist(new Document("b"))
// persist one more
.persist(new Document("c"))
// commit
.commit()
// get all documents
.createQuery("from Document order by id", Document.class)
// as observable
.observable();
```
In the example above a, b, and c are persisted and committed but the query is not run until the documents observable is subscribed to.
| {
"content_hash": "14848371bc6f4ae92b16d16c7a198e72",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 198,
"avg_line_length": 28.84,
"alnum_prop": 0.6762212975805209,
"repo_name": "davidmoten/functional-jpa",
"id": "ca54036d7e49ae65178ce948229bcf3ea64ac19b",
"size": "6489",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "49617"
}
],
"symlink_target": ""
} |
<?php
namespace Pluma\Support\Bootstrap;
use Illuminate\Log\Writer;
use Monolog\Logger as Monolog;
use Illuminate\Contracts\Foundation\Application;
class ConfigureLogging
{
/**
* Bootstrap the given application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public function bootstrap(Application $app)
{
$log = $this->registerLogger($app);
// If a custom Monolog configurator has been registered for the application
// we will call that, passing Monolog along. Otherwise, we will grab the
// the configurations for the log system and use it for configuration.
if ($app->hasMonologConfigurator()) {
call_user_func(
$app->getMonologConfigurator(), $log->getMonolog()
);
} else {
$this->configureHandlers($app, $log);
}
}
/**
* Register the logger instance in the container.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return \Illuminate\Log\Writer
*/
protected function registerLogger(Application $app)
{
$app->instance('log', $log = new Writer(
new Monolog($app->environment()), $app['events'])
);
return $log;
}
/**
* Configure the Monolog handlers for the application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Log\Writer $log
* @return void
*/
protected function configureHandlers(Application $app, Writer $log)
{
$method = 'configure'.ucfirst($app['config']['logging.log']).'Handler';
$this->{$method}($app, $log);
}
/**
* Configure the Monolog handlers for the application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Log\Writer $log
* @return void
*/
protected function configureSingleHandler(Application $app, Writer $log)
{
$log->useFiles(
$app->storagePath().'/logs/logs.log',
$app->make('config')->get('logging.log_level', 'debug')
);
}
/**
* Configure the Monolog handlers for the application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Log\Writer $log
* @return void
*/
protected function configureDailyHandler(Application $app, Writer $log)
{
$config = $app->make('config');
$maxFiles = $config->get('logging.log_max_files');
$log->useDailyFiles(
$app->storagePath().'/logs/logs.log', is_null($maxFiles) ? 5 : $maxFiles,
$config->get('logging.log_level', 'debug')
);
}
/**
* Configure the Monolog handlers for the application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Log\Writer $log
* @return void
*/
protected function configureSyslogHandler(Application $app, Writer $log)
{
$log->useSyslog(
'laravel',
$app->make('config')->get('logging.log_level', 'debug')
);
}
/**
* Configure the Monolog handlers for the application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Log\Writer $log
* @return void
*/
protected function configureErrorlogHandler(Application $app, Writer $log)
{
$log->useErrorLog($app->make('config')->get('logging.log_level', 'debug'));
}
}
| {
"content_hash": "f76d84f58c8b5931694ef6dc4bbae790",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 85,
"avg_line_length": 29.295081967213115,
"alnum_prop": 0.5976496922216005,
"repo_name": "lioneil/pluma",
"id": "231f8526366d758a6935b77749ab0c83d7e66aad",
"size": "3574",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/Support/Bootstrap/ConfigureLogging.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "824073"
},
{
"name": "HTML",
"bytes": "1722082"
},
{
"name": "JavaScript",
"bytes": "5087941"
},
{
"name": "PHP",
"bytes": "1477653"
},
{
"name": "Pascal",
"bytes": "123999"
},
{
"name": "Vue",
"bytes": "246527"
}
],
"symlink_target": ""
} |
<?php
namespace Liquipedia\TournamentsMenu;
use Title;
class Hooks {
/**
* Hook callback for 'SkinBuildSidebar'
* @param Skin $skin Skin object for context purposes
* @param array &$bar array that holds the sidebar
* @return array|null tournament list
*/
public static function onSkinBuildSidebar( $skin, &$bar ) {
$key = 'TOURNAMENTS';
if ( array_key_exists( $key, $bar ) ) {
$wgOut = $skin->getOutput();
$wgCommandLineMode = $wgOut->getConfig()->get( 'CommandLineMode' );
$message = Data::getStandardPageName();
$iconTemplatePrefix = Data::getIconPrefix();
$titleFromText = Title::newFromText( $message, NS_PROJECT );
$tournamentsData = Data::getFromTitle( $titleFromText );
if ( !is_null( $tournamentsData ) ) {
$tournamentsMenu = [];
foreach ( $tournamentsData as $heading => $tournaments ) {
if ( !array_key_exists( $heading, $tournamentsMenu ) ) {
$tournamentsMenu[ $heading ] = [];
}
foreach ( $tournaments as $tournament ) {
$text = $tournament[ 'text' ];
$data = [
'href' => $tournament[ 'href' ],
'id' => $tournament[ 'id' ],
'active' => $tournament[ 'active' ],
];
// Should we add an icon
// icon = SMW.Is part of series; iconfile = SMW.Has icon
if ( array_key_exists( 'icon', $tournament ) ) {
$iconTitle = Title::newFromText(
$iconTemplatePrefix . '/' . $tournament[ 'icon' ],
NS_TEMPLATE
);
if ( !is_null( $iconTitle ) && $iconTitle->exists() && !is_null( $skin->getTitle() ) ) {
if ( !$wgCommandLineMode ) {
$iconHTML = $wgOut->parseInline(
'{{' . $iconTemplatePrefix . '/' . $tournament[ 'icon' ] . '|link=}}',
false
);
if ( strpos( $iconHTML, 'mw-parser-output' ) !== false ) {
$iconHTML = substr(
$iconHTML,
strlen( '<div class="mw-parser-output">' ),
-strlen( '</div>' )
);
}
$text = $iconHTML . ' ' . $text;
}
}
} elseif ( array_key_exists( 'iconfile', $tournament ) ) {
$iconfileTitle = Title::newFromText(
$iconTemplatePrefix . '/mainpageTST',
NS_TEMPLATE
);
if ( !is_null( $iconfileTitle ) && $iconfileTitle->exists() && !is_null( $skin->getTitle() ) ) {
if ( !$wgCommandLineMode ) {
$iconHTML = $wgOut->parseInline(
'{{' . $iconTemplatePrefix . '/mainpageTST|' . $tournament[ 'iconfile' ] . '|link=}}',
false
);
if ( strpos( $iconHTML, 'mw-parser-output' ) !== false ) {
$iconHTML = substr(
$iconHTML,
strlen( '<div class="mw-parser-output">' ),
-strlen( '</div>' )
);
}
$text = $iconHTML . ' ' . $text;
}
}
}
$data[ 'text' ] = $text;
$tournamentsMenu[ $heading ][] = $data;
}
}
$bar[ $key ] = $tournamentsMenu;
}
}
return true;
}
}
| {
"content_hash": "00083859c8969d7c3e8a739f3bd971cc",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 103,
"avg_line_length": 30.282828282828284,
"alnum_prop": 0.5270180120080054,
"repo_name": "Liquipedia/brief-tournament-list-extension",
"id": "a2cbfc7c98bdb99a3c23d97acc02f40556a5e589",
"size": "2998",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Hooks.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "12507"
}
],
"symlink_target": ""
} |
package view.optionsPanel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import view.Constants;
import view.ViewController;
/**
* Class for button that enables changing of pen color based on available color indexes
* stored in Model class
*
* @author Lalita Maraj
* @author Susan Zhang
*
*/
public class PenColorChooser extends ColorChooser {
ViewController myController;
/**
* Constructor for PenColorChooser class
*
* @param controller Controller used to send pen index selection to Model
*/
public PenColorChooser (final ViewController controller) {
super(Constants.CHANGE_PEN_BUTTON, controller);
myController = controller;
addActionListener(new ActionListener() {
@Override
public void actionPerformed (ActionEvent e) {
int i = createPenSelector();
myController.setPenColor(i);
}
});
}
/**
* Method that returns an integer based on user's selection from InputDialog dropdown
*
* @return new pen index
*/
private int createPenSelector () {
String[] possibilities = getIndexOptions();
String choice =
(String) JOptionPane.showInputDialog(
null,
Constants.CHOOSE_COLOR_INDEX +
myController.getPenIndex(),
Constants.PEN_CHOOSER_TITLE,
JOptionPane.PLAIN_MESSAGE,
null,
possibilities,
"");
if (choice == null) { return myController.getPenIndex(); }
return Integer.parseInt(choice);
}
}
| {
"content_hash": "47ccce484a3821f56245f9399dd644c0",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 89,
"avg_line_length": 32.88709677419355,
"alnum_prop": 0.5267287886218734,
"repo_name": "chinnychin19/CS308_Proj3",
"id": "e8761c36d0882a877a6554de623bd4d678490f38",
"size": "2039",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/view/optionsPanel/PenColorChooser.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "748368"
}
],
"symlink_target": ""
} |
package kubernetes
import (
"fmt"
"log"
"math/rand"
"os"
"os/exec"
"path/filepath"
"regexp"
"time"
"github.com/Azure/acs-engine/pkg/api/common"
"github.com/Azure/acs-engine/test/e2e/config"
"github.com/Azure/acs-engine/test/e2e/engine"
"github.com/Azure/acs-engine/test/e2e/kubernetes/deployment"
"github.com/Azure/acs-engine/test/e2e/kubernetes/job"
"github.com/Azure/acs-engine/test/e2e/kubernetes/node"
"github.com/Azure/acs-engine/test/e2e/kubernetes/pod"
"github.com/Azure/acs-engine/test/e2e/kubernetes/service"
"github.com/Azure/acs-engine/test/e2e/kubernetes/util"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
const (
WorkloadDir = "workloads"
)
var (
cfg config.Config
eng engine.Engine
err error
)
var _ = BeforeSuite(func() {
cwd, _ := os.Getwd()
rootPath := filepath.Join(cwd, "../../..") // The current working dir of these tests is down a few levels from the root of the project. We should traverse up that path so we can find the _output dir
c, err := config.ParseConfig()
c.CurrentWorkingDir = rootPath
Expect(err).NotTo(HaveOccurred())
cfg = *c // We have to do this because golang anon functions and scoping and stuff
engCfg, err := engine.ParseConfig(c.CurrentWorkingDir, c.ClusterDefinition, c.Name)
Expect(err).NotTo(HaveOccurred())
csInput, err := engine.ParseInput(engCfg.ClusterDefinitionTemplate)
Expect(err).NotTo(HaveOccurred())
csGenerated, err := engine.ParseOutput(engCfg.GeneratedDefinitionPath + "/apimodel.json")
Expect(err).NotTo(HaveOccurred())
eng = engine.Engine{
Config: engCfg,
ClusterDefinition: csInput,
ExpandedDefinition: csGenerated,
}
})
var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", func() {
Describe("regardless of agent pool type", func() {
It("should have have the appropriate node count", func() {
nodeList, err := node.Get()
Expect(err).NotTo(HaveOccurred())
Expect(len(nodeList.Nodes)).To(Equal(eng.NodeCount()))
})
It("should be running the expected version", func() {
version, err := node.Version()
Expect(err).NotTo(HaveOccurred())
var expectedVersion string
if eng.ClusterDefinition.Properties.OrchestratorProfile.OrchestratorRelease != "" ||
eng.ClusterDefinition.Properties.OrchestratorProfile.OrchestratorVersion != "" {
expectedVersion = common.RationalizeReleaseAndVersion(
common.Kubernetes,
eng.ClusterDefinition.Properties.OrchestratorProfile.OrchestratorRelease,
eng.ClusterDefinition.Properties.OrchestratorProfile.OrchestratorVersion)
} else {
expectedVersion = common.RationalizeReleaseAndVersion(
common.Kubernetes,
eng.Config.OrchestratorRelease,
eng.Config.OrchestratorVersion)
}
Expect(version).To(Equal("v" + expectedVersion))
})
It("should have kube-dns running", func() {
running, err := pod.WaitOnReady("kube-dns", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
})
It("should have kube-proxy running", func() {
running, err := pod.WaitOnReady("kube-proxy", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
})
It("should have heapster running", func() {
running, err := pod.WaitOnReady("heapster", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
})
It("should have kube-addon-manager running", func() {
running, err := pod.WaitOnReady("kube-addon-manager", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
})
It("should have kube-apiserver running", func() {
running, err := pod.WaitOnReady("kube-apiserver", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
})
It("should have kube-controller-manager running", func() {
running, err := pod.WaitOnReady("kube-controller-manager", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
})
It("should have kube-scheduler running", func() {
running, err := pod.WaitOnReady("kube-scheduler", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
})
It("should have tiller running", func() {
if hasTiller, tillerAddon := eng.HasAddon("tiller"); hasTiller {
running, err := pod.WaitOnReady("tiller", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
pods, err := pod.GetAllByPrefix("tiller-deploy", "kube-system")
Expect(err).NotTo(HaveOccurred())
By("Ensuring that the correct max-history has been applied")
maxHistory := tillerAddon.Config["max-history"]
// There is only one tiller pod and one container in that pod
actualTillerMaxHistory, err := pods[0].Spec.Containers[0].GetEnvironmentVariable("TILLER_HISTORY_MAX")
Expect(err).NotTo(HaveOccurred())
Expect(actualTillerMaxHistory).To(Equal(maxHistory))
By("Ensuring that the correct resources have been applied")
err = pods[0].Spec.Containers[0].ValidateResources(tillerAddon.Containers[0])
Expect(err).NotTo(HaveOccurred())
} else {
Skip("tiller disabled for this cluster, will not test")
}
})
It("should be able to access the dashboard from each node", func() {
if hasDashboard, dashboardAddon := eng.HasAddon("kubernetes-dashboard"); hasDashboard {
By("Ensuring that the kubernetes-dashboard pod is Running")
running, err := pod.WaitOnReady("kubernetes-dashboard", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
By("Ensuring that the kubernetes-dashboard service is Running")
s, err := service.Get("kubernetes-dashboard", "kube-system")
Expect(err).NotTo(HaveOccurred())
if !eng.HasWindowsAgents() {
By("Gathering connection information to determine whether or not to connect via HTTP or HTTPS")
dashboardPort := 80
version, err := node.Version()
Expect(err).NotTo(HaveOccurred())
re := regexp.MustCompile("v1.9")
if re.FindString(version) != "" {
dashboardPort = 443
}
port := s.GetNodePort(dashboardPort)
kubeConfig, err := GetConfig()
Expect(err).NotTo(HaveOccurred())
master := fmt.Sprintf("azureuser@%s", kubeConfig.GetServerName())
sshKeyPath := cfg.GetSSHKeyPath()
if dashboardPort == 80 {
By("Ensuring that we can connect via HTTP to the dashboard on any one node")
} else {
By("Ensuring that we can connect via HTTPS to the dashboard on any one node")
}
nodeList, err := node.Get()
Expect(err).NotTo(HaveOccurred())
for _, node := range nodeList.Nodes {
success := false
for i := 0; i < 60; i++ {
dashboardURL := fmt.Sprintf("http://%s:%v", node.Status.GetAddressByType("InternalIP").Address, port)
curlCMD := fmt.Sprintf("curl --max-time 60 %s", dashboardURL)
cmd := exec.Command("ssh", "-i", sshKeyPath, "-o", "ConnectTimeout=10", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", master, curlCMD)
util.PrintCommand(cmd)
out, err := cmd.CombinedOutput()
if err == nil {
success = true
break
}
if i > 58 {
log.Printf("Error while connecting to Windows dashboard:%s\n", err)
log.Println(string(out))
}
time.Sleep(10 * time.Second)
}
Expect(success).To(BeTrue())
}
By("Ensuring that the correct resources have been applied")
// Assuming one dashboard pod
pods, err := pod.GetAllByPrefix("kubernetes-dashboard", "kube-system")
Expect(err).NotTo(HaveOccurred())
for i, c := range dashboardAddon.Containers {
err := pods[0].Spec.Containers[i].ValidateResources(c)
Expect(err).NotTo(HaveOccurred())
}
}
} else {
Skip("kubernetes-dashboard disabled for this cluster, will not test")
}
})
It("should have aci-connector running", func() {
if hasACIConnector, ACIConnectorAddon := eng.HasAddon("aci-connector"); hasACIConnector {
running, err := pod.WaitOnReady("aci-connector", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
By("Ensuring that the correct resources have been applied")
// Assuming one aci-connector pod
pods, err := pod.GetAllByPrefix("aci-connector", "kube-system")
Expect(err).NotTo(HaveOccurred())
for i, c := range ACIConnectorAddon.Containers {
err := pods[0].Spec.Containers[i].ValidateResources(c)
Expect(err).NotTo(HaveOccurred())
}
} else {
Skip("aci-connector disabled for this cluster, will not test")
}
})
It("should have rescheduler running", func() {
if hasRescheduler, reschedulerAddon := eng.HasAddon("rescheduler"); hasRescheduler {
running, err := pod.WaitOnReady("rescheduler", "kube-system", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
By("Ensuring that the correct resources have been applied")
// Assuming one rescheduler pod
pods, err := pod.GetAllByPrefix("rescheduler", "kube-system")
Expect(err).NotTo(HaveOccurred())
for i, c := range reschedulerAddon.Containers {
err := pods[0].Spec.Containers[i].ValidateResources(c)
Expect(err).NotTo(HaveOccurred())
}
} else {
Skip("rescheduler disabled for this cluster, will not test")
}
})
})
Describe("with a linux agent pool", func() {
It("should be able to autoscale", func() {
if eng.HasLinuxAgents() {
By("Creating a test php-apache deployment with request limit thresholds")
// Inspired by http://blog.kubernetes.io/2016/07/autoscaling-in-kubernetes.html
r := rand.New(rand.NewSource(time.Now().UnixNano()))
phpApacheName := fmt.Sprintf("php-apache-%s-%v", cfg.Name, r.Intn(99999))
phpApacheDeploy, err := deployment.CreateLinuxDeploy("gcr.io/google_containers/hpa-example", phpApacheName, "default", "--requests=cpu=50m,memory=50M")
if err != nil {
fmt.Println(err)
}
Expect(err).NotTo(HaveOccurred())
By("Ensuring that one php-apache pod is running before autoscale configuration or load applied")
running, err := pod.WaitOnReady(phpApacheName, "default", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
phpPods, err := phpApacheDeploy.Pods()
Expect(err).NotTo(HaveOccurred())
// We should have exactly 1 pod to begin
Expect(len(phpPods)).To(Equal(1))
By("Exposing TCP 80 internally on the php-apache deployment")
err = phpApacheDeploy.Expose("ClusterIP", 80, 80)
Expect(err).NotTo(HaveOccurred())
s, err := service.Get(phpApacheName, "default")
Expect(err).NotTo(HaveOccurred())
By("Assigning hpa configuration to the php-apache deployment")
// Apply autoscale characteristics to deployment
err = phpApacheDeploy.CreateDeploymentHPA(5, 1, 10)
Expect(err).NotTo(HaveOccurred())
By("Sending load to the php-apache service by creating a 3 replica deployment")
// Launch a simple busybox pod that wget's continuously to the apache serviceto simulate load
commandString := fmt.Sprintf("while true; do wget -q -O- http://%s.default.svc.cluster.local; done", phpApacheName)
loadTestName := fmt.Sprintf("load-test-%s-%v", cfg.Name, r.Intn(99999))
numLoadTestPods := 3
loadTestDeploy, err := deployment.RunLinuxDeploy("busybox", loadTestName, "default", commandString, numLoadTestPods)
Expect(err).NotTo(HaveOccurred())
By("Ensuring there are 3 load test pods")
running, err = pod.WaitOnReady(loadTestName, "default", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
// We should have three load tester pods running
loadTestPods, err := loadTestDeploy.Pods()
Expect(err).NotTo(HaveOccurred())
Expect(len(loadTestPods)).To(Equal(numLoadTestPods))
By("Waiting 3 minutes for load to take effect")
// Wait 3 minutes for autoscaler to respond to load
time.Sleep(3 * time.Minute)
By("Ensuring we have more than 1 apache-php pods due to hpa enforcement")
phpPods, err = phpApacheDeploy.Pods()
Expect(err).NotTo(HaveOccurred())
// We should have > 1 pods after autoscale effects
Expect(len(phpPods) > 1).To(BeTrue())
By("Cleaning up after ourselves")
err = loadTestDeploy.Delete()
Expect(err).NotTo(HaveOccurred())
err = phpApacheDeploy.Delete()
Expect(err).NotTo(HaveOccurred())
err = s.Delete()
Expect(err).NotTo(HaveOccurred())
} else {
Skip("This flavor/version of Kubernetes doesn't support hpa autoscale")
}
})
It("should be able to deploy an nginx service", func() {
if eng.HasLinuxAgents() {
By("Creating a nginx deployment")
r := rand.New(rand.NewSource(time.Now().UnixNano()))
deploymentName := fmt.Sprintf("nginx-%s-%v", cfg.Name, r.Intn(99999))
nginxDeploy, err := deployment.CreateLinuxDeploy("library/nginx:latest", deploymentName, "default", "")
Expect(err).NotTo(HaveOccurred())
By("Ensure there is a Running nginx pod")
running, err := pod.WaitOnReady(deploymentName, "default", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
By("Exposing TCP 80 LB on the nginx deployment")
err = nginxDeploy.Expose("LoadBalancer", 80, 80)
Expect(err).NotTo(HaveOccurred())
By("Ensuring we can connect to the service")
s, err := service.Get(deploymentName, "default")
Expect(err).NotTo(HaveOccurred())
By("Ensuring the service root URL returns the expected payload")
valid := s.Validate("(Welcome to nginx)", 5, 30*time.Second, cfg.Timeout)
Expect(valid).To(BeTrue())
By("Ensuring we have outbound internet access from the nginx pods")
nginxPods, err := nginxDeploy.Pods()
Expect(err).NotTo(HaveOccurred())
Expect(len(nginxPods)).ToNot(BeZero())
for _, nginxPod := range nginxPods {
pass, err := nginxPod.CheckLinuxOutboundConnection(5*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(pass).To(BeTrue())
}
By("Cleaning up after ourselves")
err = nginxDeploy.Delete()
Expect(err).NotTo(HaveOccurred())
err = s.Delete()
Expect(err).NotTo(HaveOccurred())
} else {
Skip("No linux agent was provisioned for this Cluster Definition")
}
})
})
Describe("with a GPU-enabled agent pool", func() {
It("should be able to run a nvidia-gpu job", func() {
if eng.HasGPUNodes() {
j, err := job.CreateJobFromFile(filepath.Join(WorkloadDir, "nvidia-smi.yaml"), "nvidia-smi", "default")
Expect(err).NotTo(HaveOccurred())
ready, err := j.WaitOnReady(30*time.Second, cfg.Timeout)
delErr := j.Delete()
if delErr != nil {
fmt.Printf("could not delete job %s\n", j.Metadata.Name)
fmt.Println(delErr)
}
Expect(err).NotTo(HaveOccurred())
Expect(ready).To(Equal(true))
}
})
})
Describe("with a windows agent pool", func() {
// TODO stabilize this test
/*It("should be able to deploy an iis webserver", func() {
if eng.HasWindowsAgents() {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
deploymentName := fmt.Sprintf("iis-%s-%v", cfg.Name, r.Intn(99999))
iisDeploy, err := deployment.CreateWindowsDeploy("microsoft/iis:windowsservercore-1709", deploymentName, "default", 80, -1)
Expect(err).NotTo(HaveOccurred())
running, err := pod.WaitOnReady(deploymentName, "default", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
err = iisDeploy.Expose("LoadBalancer", 80, 80)
Expect(err).NotTo(HaveOccurred())
s, err := service.Get(deploymentName, "default")
Expect(err).NotTo(HaveOccurred())
valid := s.Validate("(IIS Windows Server)", 10, 10*time.Second, cfg.Timeout)
Expect(valid).To(BeTrue())
iisPods, err := iisDeploy.Pods()
Expect(err).NotTo(HaveOccurred())
Expect(len(iisPods)).ToNot(BeZero())
for _, iisPod := range iisPods {
pass, err := iisPod.CheckWindowsOutboundConnection(10*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(pass).To(BeTrue())
}
err = iisDeploy.Delete()
Expect(err).NotTo(HaveOccurred())
err = s.Delete()
Expect(err).NotTo(HaveOccurred())
} else {
Skip("No windows agent was provisioned for this Cluster Definition")
}
})*/
// TODO stabilize this test
/*It("should be able to reach hostport in an iis webserver", func() {
if eng.HasWindowsAgents() {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
hostport := 8123
deploymentName := fmt.Sprintf("iis-%s-%v", cfg.Name, r.Intn(99999))
iisDeploy, err := deployment.CreateWindowsDeploy("microsoft/iis:windowsservercore-1709", deploymentName, "default", 80, hostport)
Expect(err).NotTo(HaveOccurred())
running, err := pod.WaitOnReady(deploymentName, "default", 3, 30*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(running).To(Equal(true))
iisPods, err := iisDeploy.Pods()
Expect(err).NotTo(HaveOccurred())
Expect(len(iisPods)).ToNot(BeZero())
kubeConfig, err := GetConfig()
Expect(err).NotTo(HaveOccurred())
master := fmt.Sprintf("azureuser@%s", kubeConfig.GetServerName())
sshKeyPath := cfg.GetSSHKeyPath()
for _, iisPod := range iisPods {
valid := iisPod.ValidateHostPort("(IIS Windows Server)", 10, 10*time.Second, master, sshKeyPath)
Expect(valid).To(BeTrue())
}
err = iisDeploy.Delete()
Expect(err).NotTo(HaveOccurred())
} else {
Skip("No windows agent was provisioned for this Cluster Definition")
}
})*/
// TODO stabilize this test
/*It("should be able to attach azure file", func() {
if eng.HasWindowsAgents() {
if eng.OrchestratorVersion1Dot8AndUp() {
storageclassName := "azurefile" // should be the same as in storageclass-azurefile.yaml
sc, err := storageclass.CreateStorageClassFromFile(filepath.Join(WorkloadDir, "storageclass-azurefile.yaml"), storageclassName)
Expect(err).NotTo(HaveOccurred())
ready, err := sc.WaitOnReady(5*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(ready).To(Equal(true))
pvcName := "pvc-azurefile" // should be the same as in pvc-azurefile.yaml
pvc, err := persistentvolumeclaims.CreatePersistentVolumeClaimsFromFile(filepath.Join(WorkloadDir, "pvc-azurefile.yaml"), pvcName, "default")
Expect(err).NotTo(HaveOccurred())
ready, err = pvc.WaitOnReady("default", 5*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(ready).To(Equal(true))
podName := "iis-azurefile" // should be the same as in iis-azurefile.yaml
iisPod, err := pod.CreatePodFromFile(filepath.Join(WorkloadDir, "iis-azurefile.yaml"), podName, "default")
Expect(err).NotTo(HaveOccurred())
ready, err = iisPod.WaitOnReady(5*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
Expect(ready).To(Equal(true))
valid, err := iisPod.ValidateAzureFile("mnt\\azure", 10, 10*time.Second)
Expect(valid).To(BeTrue())
Expect(err).NotTo(HaveOccurred())
err = iisPod.Delete()
Expect(err).NotTo(HaveOccurred())
} else {
Skip("Kubernetes version needs to be 1.8 and up for Azure File test")
}
} else {
Skip("No windows agent was provisioned for this Cluster Definition")
}
})*/
})
})
| {
"content_hash": "d9a4c908ad18469b6d1d72d87ad02ea2",
"timestamp": "",
"source": "github",
"line_count": 508,
"max_line_length": 199,
"avg_line_length": 38.94094488188976,
"alnum_prop": 0.6827924375695076,
"repo_name": "yangl900/acs-engine",
"id": "e8322cef089048e6818787e30e5c463e17cd676d",
"size": "19782",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/e2e/kubernetes/kubernetes_test.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "1130739"
},
{
"name": "Groovy",
"bytes": "24761"
},
{
"name": "Makefile",
"bytes": "5600"
},
{
"name": "Perl",
"bytes": "49872"
},
{
"name": "Perl 6",
"bytes": "273634"
},
{
"name": "PowerShell",
"bytes": "47216"
},
{
"name": "Python",
"bytes": "6094"
},
{
"name": "Shell",
"bytes": "126394"
}
],
"symlink_target": ""
} |
import compose from '../../utils/compose';
/**
Le principe d'un atomic property object est que sur change, une nouvelle valeur est initialisée sans tenir compte de la valeur précédente
*/
var PropertyObject = compose(function(properties) {
this._properties = properties;
}, {
initValue: function(initArg) {
initArg = initArg || {};
var value = {};
var properties = this._properties;
Object.keys(properties).forEach(function(key) {
var property = properties[key];
value[key] = property.initValue(initArg[key]);
});
return value;
},
computeValue: function(changeArg, initValue) {
return this.initValue(changeArg);
},
computeChangeArg: function(changeArg, initValue) {
var outChangeArg = {};
var properties = this._properties;
Object.keys(properties).forEach(function(key) {
var property = properties[key];
if (property.computeChangeArg) {
outChangeArg[key] = property.computeChangeArg(changeArg[key], initValue[key]); // faut-il tenir compte de initValue ?
}
});
return outChangeArg;
},
});
export default PropertyObject; | {
"content_hash": "8ae9dec94cc2d908dc9071793c75abf1",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 137,
"avg_line_length": 36.93939393939394,
"alnum_prop": 0.6267432321575062,
"repo_name": "KAESapps/ksf",
"id": "9508721719dc031595ccebda16f74608e0b6d4f0",
"size": "1222",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "observable/computers/AtomicPropertyObject.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "4457"
},
{
"name": "JavaScript",
"bytes": "320335"
}
],
"symlink_target": ""
} |
// Originally from UpdatedComponentTests/ResponseTypes/RPC/RPC_Post_MapResponse_Empty.xls;
package com.betfair.cougar.tests.updatedcomponenttests.responsetypes.rpc;
import com.betfair.testing.utils.cougar.assertions.AssertionUtils;
import com.betfair.testing.utils.cougar.beans.HttpCallBean;
import com.betfair.testing.utils.cougar.beans.HttpResponseBean;
import com.betfair.testing.utils.cougar.helpers.CougarHelpers;
import com.betfair.testing.utils.cougar.manager.AccessLogRequirement;
import com.betfair.testing.utils.cougar.manager.CougarManager;
import com.betfair.testing.utils.cougar.manager.RequestLogRequirement;
import org.testng.annotations.Test;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
/**
* Ensure that when a Batched JSON request is performed against Cougar, passing in an empty Map in the post body, it is correctly de-serialized, processed, returned the correct Map response.
*/
public class RPCPostMapResponseEmptyTest {
@Test
public void doTest() throws Exception {
// Set up the Http Call Bean to make the request
CougarManager cougarManager1 = CougarManager.getInstance();
HttpCallBean callBean = cougarManager1.getNewHttpCallBean("87.248.113.14");
CougarManager cougarManager = cougarManager1;
// Set the call bean to use JSON batching
callBean.setJSONRPC(true);
// Set the list of requests to make a batched call to
Map[] mapArray2 = new Map[2];
mapArray2[0] = new HashMap();
mapArray2[0].put("method","testSimpleMapGet");
mapArray2[0].put("params","[{}]");
mapArray2[0].put("id","1");
mapArray2[1] = new HashMap();
mapArray2[1].put("method","testSimpleMapGet");
mapArray2[1].put("params","[{}]");
mapArray2[1].put("id","2");
callBean.setBatchedRequests(mapArray2);
// Get current time for getting log entries later
Timestamp timeStamp = new Timestamp(System.currentTimeMillis());
// Make JSON call to the operation requesting a JSON response
cougarManager.makeRestCougarHTTPCall(callBean, com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTJSON, com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.JSON);
// Get the response to the batched query (store the response for further comparison as order of batched responses cannot be relied on)
HttpResponseBean response = callBean.getResponseObjectsByEnum(com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.RESTJSONJSON);
// Convert the returned json object to a map for comparison
CougarHelpers cougarHelpers4 = new CougarHelpers();
Map<String, Object> map5 = cougarHelpers4.convertBatchedResponseToMap(response);
AssertionUtils.multiAssertEquals("{\"id\":1,\"result\":{},\"jsonrpc\":\"2.0\"}", map5.get("response1"));
AssertionUtils.multiAssertEquals("{\"id\":2,\"result\":{},\"jsonrpc\":\"2.0\"}", map5.get("response2"));
AssertionUtils.multiAssertEquals(200, map5.get("httpStatusCode"));
AssertionUtils.multiAssertEquals("OK", map5.get("httpStatusText"));
// Pause the test to allow the logs to be filled
// generalHelpers.pauseTest(500L);
// Check the log entries are as expected
cougarManager.verifyRequestLogEntriesAfterDate(timeStamp, new RequestLogRequirement("2.8", "testSimpleMapGet"),new RequestLogRequirement("2.8", "testSimpleMapGet") );
cougarManager.verifyAccessLogEntriesAfterDate(timeStamp, new AccessLogRequirement("87.248.113.14", "/json-rpc", "Ok") );
}
}
| {
"content_hash": "b3e1283e7db96c85430ca5cf2ba78a46",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 215,
"avg_line_length": 55.65151515151515,
"alnum_prop": 0.7252926762864144,
"repo_name": "olupas/cougar",
"id": "7717991c8b16f281345658225e3cc6cebb7dd2a2",
"size": "4286",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cougar-test/cougar-normal-code-tests/src/test/java/com/betfair/cougar/tests/updatedcomponenttests/responsetypes/rpc/RPCPostMapResponseEmptyTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "83394"
},
{
"name": "HTML",
"bytes": "23595"
},
{
"name": "Java",
"bytes": "9535986"
},
{
"name": "Shell",
"bytes": "19139"
},
{
"name": "XSLT",
"bytes": "57361"
}
],
"symlink_target": ""
} |
"""
SeqFindr BLAST methods
"""
import subprocess
import shutil
import os
import sys
from Bio.Blast import NCBIXML
from Bio.Blast.Applications import NcbiblastnCommandline
from Bio.Blast.Applications import NcbitblastnCommandline
from Bio.Blast.Applications import NcbitblastxCommandline
import SeqFindr.util
def make_BLAST_database(fasta_file):
"""
Given a fasta_file, generate a nucleotide BLAST database
Database will end up in DB/ of working directory or OUTPUT/DB if an
output directory is given in the arguments
:param fasta_file: full path to a fasta file
:type fasta_file: string
:rtype: the strain id **(must be delimited by '_')**
"""
proc = subprocess.Popen(["makeblastdb", "-in", fasta_file, "-dbtype",
'nucl'], stdout=subprocess.PIPE)
sys.stderr.write(proc.stdout.read())
for file_ext in ['.nhr', '.nin', '.nsq']:
path = fasta_file + file_ext
shutil.move(path, os.path.join('DBs', os.path.basename(path)))
sys.stderr.write(("Getting %s and assocaiated database files to the DBs "
"location\n") % (fasta_file))
shutil.copy2(fasta_file, os.path.join('DBs', os.path.basename(fasta_file)))
return os.path.basename(fasta_file).split('_')[0]
def run_BLAST(query, database, args, cons_run):
"""
Given a mfa of query sequences of interest & a database, search for them.
Important to note:
* Turns dust filter off,
* Only a single target sequence (top hit),
* Output in XML format as blast.xml.
# TODO: Add evalue filtering ?
# TODO: add task='blastn' to use blastn scoring ?
.. warning:: default is megablast
.. warning:: tblastx funcationality has not been checked
:param query: the fullpath to the vf.mfa
:param database: the full path of the databse to search for the vf in
:param args: the arguments parsed to argparse
:param cons_run: part of a mapping consensus run
:type query: string
:type database: string
:type args: argparse args (dictionary)
:type cons_run: boolean
:returns: the path of the blast.xml file
"""
tmp1 = os.path.splitext(query.split('/')[-1])[0]
tmp2 = os.path.splitext(database.split('/')[-1])[0]
if not cons_run:
outfile = os.path.join("BLAST_results/",
"DB="+tmp1+"ID="+tmp2+"_blast.xml")
else:
outfile = os.path.join("BLAST_results/",
"cons_DB="+tmp1+"ID="+tmp2+"_blast.xml")
protein = False
# File type not specified, determine using util.is_protein()
if args.reftype is None:
if SeqFindr.util.is_protein(query) != -1:
protein = True
sys.stderr.write('%s is protein' % (query))
elif args.reftype == 'prot':
protein = True
sys.stderr.write('%s is protein\n' % (query))
run_command = ''
if protein:
sys.stderr.write('Using tblastn\n')
run_command = NcbitblastnCommandline(query=query, seg='no',
db=database, outfmt=5, num_threads=args.BLAST_THREADS,
max_target_seqs=1, evalue=args.evalue, out=outfile)
else:
if args.tblastx:
sys.stderr.write('Using tblastx\n')
run_command = NcbitblastxCommandline(query=query, seg='no',
db=database, outfmt=5, num_threads=args.BLAST_THREADS,
max_target_seqs=1, evalue=args.evalue,
out=outfile)
else:
sys.stderr.write('Using blastn\n')
if args.short == False:
run_command = NcbiblastnCommandline(query=query, dust='no',
db=database, outfmt=5,
num_threads=args.BLAST_THREADS,
max_target_seqs=1, evalue=args.evalue,
out=outfile)
else:
sys.stderr.write('Optimising for short query sequences\n')
run_command = NcbiblastnCommandline(query=query, dust='no',
db=database, outfmt=5, word_size=7,
num_threads=args.BLAST_THREADS, evalue=1000,
max_target_seqs=1, out=outfile)
sys.stderr.write(str(run_command)+"\n")
run_command()
return os.path.join(os.getcwd(), outfile)
def parse_BLAST(blast_results, tol, cov, careful):
"""
Using NCBIXML parse the BLAST results, storing & returning good hits
:param blast_results: full path to a blast run output file (in XML format)
:param tol: the cutoff threshold (see above for explaination)
:param cov: alignement coverage cut-off (see above for explaination)
:type blast_results: string
:type tol: float
:type cov: float
:rtype: list of satifying hit names
"""
if os.path.isfile(os.path.expanduser(blast_results)):
hits = []
for record in NCBIXML.parse(open(blast_results)):
for align in record.alignments:
for hsp in align.hsps:
hit_name = record.query.split(',')[1].strip()
# cutoff is now calculated with reference to the alignment length
cutoff = hsp.identities/float(hsp.align_length)
# added condition that the alignment length (hsp.align_length) must be at least equal to the length of the target sequence
# added coverage option allowing the alignment length to be shorter than the length of the target sequence (DEFAULT=1)
if cutoff >= tol and (record.query_length * cov) <= hsp.align_length:
hits.append(hit_name.strip())
# New method for the --careful option
# added condition that the alignment length (hsp.align_length) must be at least equal to the length of the target sequence
elif cutoff >= tol-careful and (record.query_length * cov) <= hsp.align_length:
print "Please confirm this hit:"
print "Name,SeqFindr score,Len(align),Len(query),Identities,Gaps"
print "%s,%f,%i,%i,%i,%i" % (hit_name, cutoff, hsp.align_length, record.query_length, hsp.identities, hsp.gaps)
accept = raw_input("Should this be considered a hit? (y/N)")
if accept == '':
pass
elif accept.lower() == 'n':
pass
elif accept.lower() == 'y':
hits.append(hit_name.strip())
else:
print "Input must be y, n or enter."
print "Assuming n"
else:
pass
else:
sys.stderr.write("BLAST results do not exist. Exiting.\n")
sys.exit(1)
return hits
| {
"content_hash": "c443b56cb0b8225b5f7620c82200a77f",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 142,
"avg_line_length": 41.194117647058825,
"alnum_prop": 0.5740396972725974,
"repo_name": "nbenzakour/SeqFindR",
"id": "57341478e01f8b5f18350e77602568877dabfa6a",
"size": "7635",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "SeqFindr/blast.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groff",
"bytes": "2390"
},
{
"name": "Python",
"bytes": "62775"
},
{
"name": "Shell",
"bytes": "3594"
}
],
"symlink_target": ""
} |
using Foundation;
using UIKit;
namespace tvAlerts
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
// class-level declarations
public override UIWindow Window {
get;
set;
}
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
return true;
}
public override void OnResignActivation (UIApplication application)
{
// Invoked when the application is about to move from active to inactive state.
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
// or when the user quits the application and it begins the transition to the background state.
// Games should use this method to pause the game.
}
public override void DidEnterBackground (UIApplication application)
{
// Use this method to release shared resources, save user data, invalidate timers and store the application state.
// If your application supports background exection this method is called instead of WillTerminate when the user quits.
}
public override void WillEnterForeground (UIApplication application)
{
// Called as part of the transiton from background to active state.
// Here you can undo many of the changes made on entering the background.
}
public override void OnActivated (UIApplication application)
{
// Restart any tasks that were paused (or not yet started) while the application was inactive.
// If the application was previously in the background, optionally refresh the user interface.
}
public override void WillTerminate (UIApplication application)
{
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
}
}
}
| {
"content_hash": "9ee92722bd590824bd5da787dddfa170",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 122,
"avg_line_length": 36.23728813559322,
"alnum_prop": 0.7605238540692236,
"repo_name": "xamarin/monotouch-samples",
"id": "8384ec85c3eb0f2dd9374366ce0e433e875bed5e",
"size": "2140",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tvos/tvAlerts/tvAlerts/AppDelegate.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "5568672"
},
{
"name": "F#",
"bytes": "11402"
},
{
"name": "GLSL",
"bytes": "13657"
},
{
"name": "HTML",
"bytes": "9912"
},
{
"name": "Makefile",
"bytes": "16378"
},
{
"name": "Metal",
"bytes": "4299"
},
{
"name": "Objective-C",
"bytes": "106014"
},
{
"name": "Shell",
"bytes": "6235"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>FST - Alan Jhones</title>
<meta name="description" content="Keep track of the statistics from Alan Jhones. Average heat score, heat wins, heat wins percentage, epic heats road to the final">
<meta name="author" content="">
<link rel="apple-touch-icon" sizes="57x57" href="/favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<meta property="og:title" content="Fantasy Surfing tips"/>
<meta property="og:image" content="https://fantasysurfingtips.com/img/just_waves.png"/>
<meta property="og:description" content="See how great Alan Jhones is surfing this year"/>
<!-- Bootstrap Core CSS - Uses Bootswatch Flatly Theme: https://bootswatch.com/flatly/ -->
<link href="https://fantasysurfingtips.com/css/bootstrap.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="https://fantasysurfingtips.com/css/freelancer.css" rel="stylesheet">
<link href="https://cdn.datatables.net/plug-ins/1.10.7/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet" />
<!-- Custom Fonts -->
<link href="https://fantasysurfingtips.com/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">
<script src="https://code.jquery.com/jquery-2.x-git.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ujs/1.2.1/rails.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>
<script src="https://www.w3schools.com/lib/w3data.js"></script>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-2675412311042802",
enable_page_level_ads: true
});
</script>
</head>
<body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.6";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- Navigation -->
<div w3-include-html="https://fantasysurfingtips.com/layout/header.html"></div>
<!-- Header -->
<div w3-include-html="https://fantasysurfingtips.com/layout/sponsor.html"></div>
<section >
<div class="container">
<div class="row">
<div class="col-sm-3 ">
<div class="col-sm-2 ">
</div>
<div class="col-sm-8 ">
<!-- <img src="http://fantasysurfingtips.com/img/surfers/ajho.png" class="img-responsive" alt=""> -->
<h3 style="text-align:center;">Alan Jhones</h3>
<a href="https://twitter.com/share" class="" data-via="fansurfingtips"><i class="fa fa-twitter"></i> Share on Twitter</i></a> <br/>
<a class="fb-xfbml-parse-ignore" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Ffantasysurfingtips.com%2Fsurfers%2Fajho&src=sdkpreparse"><i class="fa fa-facebook"></i> Share on Facebook</a>
</div>
<div class="col-sm-2 ">
</div>
</div>
<div class="col-sm-3 portfolio-item">
</div>
<div class="col-sm-3 portfolio-item">
<h6 style="text-align:center;">Avg Heat Score (FST DATA)</h6>
<h1 style="text-align:center;">11.24</h1>
</div>
</div>
<hr/>
<h4 style="text-align:center;" >Heat Stats (FST data)</h4>
<div class="row">
<div class="col-sm-4 portfolio-item">
<h6 style="text-align:center;">Heats</h6>
<h2 style="text-align:center;">13</h2>
</div>
<div class="col-sm-4 portfolio-item">
<h6 style="text-align:center;">Heat wins</h6>
<h2 style="text-align:center;">0</h2>
</div>
<div class="col-sm-4 portfolio-item">
<h6 style="text-align:center;">HEAT WINS PERCENTAGE</h6>
<h2 style="text-align:center;">0.0%</h2>
</div>
</div>
<hr/>
<h4 style="text-align:center;">Avg Heat Score progression</h4>
<div id="avg_chart" style="height: 250px;"></div>
<hr/>
<h4 style="text-align:center;">Heat stats progression</h4>
<div id="heat_chart" style="height: 250px;"></div>
<hr/>
<style type="text/css">
.heats-all{
z-index: 3;
margin-left: 5px;
cursor: pointer;
}
</style>
<div class="container">
<div id="disqus_thread"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
var disqus_config = function () {
this.page.url = "http://fantasysurfingtips.com/surfers/ajho"; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = '1431'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//fantasysurfingtips.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</section>
<script type="text/javascript">
$('.heats-all').click(function(){
$('.heats-all-stat').css('display', 'none')
$('#'+$(this).attr('id')+'-stat').css('display', 'block')
});
$('.heats-2016').click(function(){
$('.heats-2016-stat').css('display', 'none')
$('#'+$(this).attr('id')+'-stat').css('display', 'block')
});
$('document').ready(function(){
new Morris.Line({
// ID of the element in which to draw the chart.
element: 'avg_chart',
// Chart data records -- each entry in this array corresponds to a point on
// the chart.
data: [],
// The name of the data record attribute that contains x-values.
xkey: 'year',
// A list of names of data record attributes that contain y-values.
ykeys: ['avg', 'avg_all'],
// Labels for the ykeys -- will be displayed when you hover over the
// chart.
labels: ['Avg score in year', 'Avg score FST DATA']
});
new Morris.Bar({
// ID of the element in which to draw the chart.
element: 'heat_chart',
// Chart data records -- each entry in this array corresponds to a point on
// the chart.
data: [],
// The name of the data record attribute that contains x-values.
xkey: 'year',
// A list of names of data record attributes that contain y-values.
ykeys: ['heats', 'wins', 'percs'],
// Labels for the ykeys -- will be displayed when you hover over the
// chart.
labels: ['Heats surfed', 'Heats won', 'Winning percentage']
});
});
</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<!-- Footer -->
<div w3-include-html="https://fantasysurfingtips.com/layout/footer.html"></div>
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-74337819-1', 'auto'); // Replace with your property ID.
ga('send', 'pageview');
</script>
<script>
w3IncludeHTML();
</script>
<!-- jQuery -->
<script src="https://fantasysurfingtips.com/js/jquery.js"></script>
<script src="https://cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="https://fantasysurfingtips.com/js/bootstrap.min.js"></script>
<!-- Plugin JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="https://fantasysurfingtips.com/js/classie.js"></script>
<script src="https://fantasysurfingtips.com/js/cbpAnimatedHeader.js"></script>
<!-- Contact Form JavaScript -->
<script src="https://fantasysurfingtips.com/js/jqBootstrapValidation.js"></script>
<script src="https://fantasysurfingtips.com/js/contact_me.js"></script>
<!-- Custom Theme JavaScript -->
<script src="https://fantasysurfingtips.com/js/freelancer.js"></script>
<script type="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script type="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "8e2fa1725e86473df334d11a74ca133b",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 295,
"avg_line_length": 39.309859154929576,
"alnum_prop": 0.631225367251881,
"repo_name": "chicofilho/fst",
"id": "1be5020bf146147ad08706123292d3c07a777b20",
"size": "11164",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "surfers/mqs/ajho.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "25157"
},
{
"name": "HTML",
"bytes": "114679577"
},
{
"name": "JavaScript",
"bytes": "43263"
},
{
"name": "PHP",
"bytes": "1097"
}
],
"symlink_target": ""
} |
layout: post102
title: Scripting Executor
categories: XAP102
parent: scala.html
weight: 400
---
{% summary %}{% endsummary %}
[Dynamic Language Tasks](./dynamic-language-tasks.html) feature has been extended and now supports Scala based script execution.
# Configuration
Here is how you would configure a processing unit to run a scripting executor with scala support and use it from a client proxy. For detailed information on the `Scripting Executor` framework, see [Dynamic Language Tasks](./dynamic-language-tasks.html).
## Processing Unit Configuration
{% highlight xml %}
<os-core:embedded-space id="space" name="mySpace"/>
<os-core:giga-space id="gigaSpace" space="space"/>
<bean id="scriptingExecutorImpl" class="org.openspaces.remoting.scripting.DefaultScriptingExecutor">
<property name="executors">
<map>
<entry key="scala">
<bean class="org.openspaces.remoting.scripting.ScalaLocalScriptExecutor">
</bean>
</entry>
</map>
</property>
</bean>
<os-remoting:service-exporter id="serviceExporter">
<os-remoting:service ref="scriptingExecutorImpl"/>
</os-remoting:service-exporter>
<os-events:polling-container id="remotingContainer" giga-space="gigaSpace">
<os-events:listener ref="serviceExporter"/>
</os-events:polling-container>
{% endhighlight %}
## Client Side Configuration
{% highlight xml %}
<os-core:space-proxy id="space" name="mySpace"/>
<os-core:giga-space id="gigaSpace" space="space"/>
<os-remoting:executor-proxy id="executorScriptingExecutor" giga-space="gigaSpace"
interface="org.openspaces.remoting.scripting.ScriptingExecutor">
<os-remoting:aspect>
<bean class="org.openspaces.remoting.scripting.LazyLoadingRemoteInvocationAspect" />
</os-remoting:aspect>
<os-remoting:routing-handler>
<bean class="org.openspaces.remoting.scripting.ScriptingRemoteRoutingHandler" />
</os-remoting:routing-handler>
<os-remoting:meta-arguments-handler>
<bean class="org.openspaces.remoting.scripting.ScriptingMetaArgumentsHandler" />
</os-remoting:meta-arguments-handler>
</os-remoting:executor-proxy>
{% endhighlight %}
# Usage
3 new [Script](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/index.html?org/openspaces/remoting/scripting/Script.html) implementations have been added to support compilation and caching of compiled scala scripts. These provide the ability to explicitly set the static type for script parameters which is required when the runtime type is not public. In most cases, there is no need to define these as they can be deduced to use the parameter runtime type.
- `org.openspaces.remoting.scripting.ScalaTypedStaticScript` which extends [StaticScript](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/index.html?org/openspaces/remoting/scripting/StaticScript.html).
- `org.openspaces.remoting.scripting.ScalaTypedStaticResourceScript` which extends [StaticResourceScript](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/index.html?org/openspaces/remoting/scripting/StaticResourceScript.html).
- `org.openspaces.remoting.scripting.ScalaTypedResourceLazyLoadingScript` which extends [ResourceLazyLoadingScript](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/index.html?org/openspaces/remoting/scripting/ResourceLazyLoadingScript.html).
# Example
{% highlight scala %}
val code = """
val readData: Any = gigaSpace.read(null)
val numberAsString = someNumber.toString
val setAsString = someSet.toString
numberAsString + " " + someString + " " + setAsString + " " + readData
"""
val script = new ScalaTypedStaticScript("myScript", "scala", code)
.parameter("someNumber", 1)
.parameter("someString", "str")
// explicit type is requierd because the runtime type of the generated
// set is not public
.parameter("someSet", Set(1,2,3), classOf[Set[_]])
val result = executor.execute(script)
println("Script execution result: " + result)
{% endhighlight %}
| {
"content_hash": "085bb4605fe6c5555de1607e828e197b",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 468,
"avg_line_length": 41.16842105263158,
"alnum_prop": 0.7673229353106622,
"repo_name": "barakb/gigaspaces-wiki-jekyll",
"id": "214ca84d1195035f921db9f6a42d76458fd308ff",
"size": "3915",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "xap102/scala-scripting-executor.markdown",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "483"
},
{
"name": "C#",
"bytes": "24326"
},
{
"name": "CSS",
"bytes": "404231"
},
{
"name": "HTML",
"bytes": "7948077"
},
{
"name": "JavaScript",
"bytes": "84963"
},
{
"name": "Ruby",
"bytes": "59064"
}
],
"symlink_target": ""
} |
layout: page
title: CV
permalink: /cv/
order: 4
---
<br>
<p>► Expand / collapse</p>
<br>
# Summary
*2017 --*
<details>
<summary>Developer, <a href="https://lambertlabs.com/">Lambert Labs</a></summary>
<br>
Established team member
<ul>
<li>Implement bug fixes, features; refactoring</li>
<li>POCs</li>
<li>Mix of independent, collaborative work (pair programming, code review)</li>
<li>Juggling multiple tickets</li>
<li>Adherence to developer workflow</li>
<li>Testing, QA</li>
<li>Writing documentation</li>
<li>Daily stand-up, biweekly sprint-planning / retrospective</li>
</ul>
Frontend
<ul>
<li>AngularJS</li>
</ul>
Backend
<ul>
<li>Python</li>
<li>Microservices (Kafka, ZeroMQ, PostgreSQL, Elasticsearch, REST API)</li>
<li>API integrations (publishing: Wordpress, Twitter, Facebook; trending: SharedCount; email: Mailgun)</li>
<li>Scraping (Beautiful Soup)</li>
</ul>
Devops
<ul>
<li>Package management / virtual environment (conda)</li>
<li>Containerisation (Docker)</li>
<li>Continuous integration (Gitlab)</li>
<li>Continuous delivery (Kubernetes, Google Cloud Platform)</li>
<li>Logging / monitoring (Sentry, Kibana, Grafana, Prometheus)</li>
</ul>
</details>
<br>
*2016 --*
<details>
<summary>Co-founder, <a href="https://zorncapital.com/">Zorn Capital</a></summary>
<br>
Solution architecture, business strategy, quantitative research
<br>
<br>
<strong>V0:</strong>
<br>
<br>
Backend
<ul>
<li>Python</li>
<li>Data analysis (pandas, MySQL)</li>
<li>API integrations (trading: OANDA)</li>
</ul>
Devops
<ul>
<li>pip, virtualenv</li>
<li> AWS (EC2, CodeCommit)</li>
</ul>
</details>
<br>
*2014 -- 2015*
<details>
<summary>Account Technologist, <a href="http://www.brainlabsdigital.com/">Brainlabs Digital</a></summary>
<br>
Mostly independent work in a more unstructured environment
<br>
<br>
Backend
<ul>
<li>PHP, JavaScript</li>
<li>Data pipelines (MySQL, Google Apps Script, AdWords scripts)</li>
<li>API integrations (advertising: Google, Facebook, Microsoft, Response Tap)</li>
</ul>
Devops
<ul>
<li>On-site (Microsoft IIS)</li>
</ul>
</details>
<br>
*2011 -- 2014*
<br>
: Licence de mathématiques, [Université Montpellier 2](http://www.umontpellier.fr/)
<br>
<br>
<br>
# [Full CV]({{ site.url }}/full-cv.pdf)
| {
"content_hash": "b47f37cdccc52f85c3d913af9beba4a6",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 109,
"avg_line_length": 23.574257425742573,
"alnum_prop": 0.6631667366652667,
"repo_name": "family-guy/minima",
"id": "c7cd92de02ffdbbde4a1f8eaa54587f6c663432a",
"size": "2387",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cv.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "12352"
},
{
"name": "Dockerfile",
"bytes": "136"
},
{
"name": "HTML",
"bytes": "10970"
},
{
"name": "Ruby",
"bytes": "871"
},
{
"name": "Shell",
"bytes": "1153"
}
],
"symlink_target": ""
} |
/*
*********************************************************************************************************
* INCLUDES
*********************************************************************************************************
*/
#include "TCPIP Stack/WFMac.h"
#include "TCPIP Stack/TCPIP.h"
#if defined(WF_CS_TRIS)
/* used for assertions */
#if defined(WF_DEBUG)
#define WF_MODULE_NUMBER WF_MODULE_WF_DRIVER_RAW
#endif
/*
*********************************************************************************************************
* DEFINES
*********************************************************************************************************
*/
// RAW register masks
#define WF_RAW_STATUS_REG_ERROR_MASK ((UINT16)(0x0002))
#define WF_RAW_STATUS_REG_BUSY_MASK ((UINT16)(0x0001))
/*
*********************************************************************************************************
* LOCAL DATA TYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/
BOOL g_HostRAWDataPacketReceived = FALSE; // set TRUE by state machine in WFDriverCom.c
extern BOOL g_rxIndexSetBeyondBuffer; // debug -- remove after test
BOOL RawWindowReady[2]; /* for Tx and Rx, TRUE = ready for use, FALSE = not ready for use */
UINT8 RawWindowState[2];
extern BOOL g_WaitingForMgmtResponse;
/*
*********************************************************************************************************
* LOCAL FUNCTION PROTOTYPES
*********************************************************************************************************
*/
static UINT16 RawMove(UINT16 rawId, UINT16 srcDest, BOOL rawIsDestination, UINT16 size);
static UINT16 WaitForRawMoveComplete(UINT8 rawId);
BOOL AllocateMgmtTxBuffer(UINT16 bytesNeeded)
{
UINT16 bufAvail;
UINT16 byteCount;
/* get total bytes available for MGMT tx memory pool */
bufAvail = Read16BitWFRegister(WF_HOST_WFIFO_BCNT1_REG) & 0x0fff; /* LS 12 bits contain length */
/* if enough bytes available to allocate */
if ( bufAvail >= bytesNeeded )
{
/* allocate and create the new Tx buffer (mgmt or data) */
byteCount = RawMove(RAW_TX_ID, RAW_MGMT_POOL, TRUE, bytesNeeded);
if (byteCount == 0)
return FALSE; // just return and let host retry again
}
/* else not enough bytes available at this time to satisfy request */
else
{
return FALSE;
}
RawWindowReady[RAW_TX_ID] = TRUE;
SetRawWindowState(RAW_TX_ID, WF_RAW_MGMT_MOUNTED);
return TRUE;
}
void DeallocateMgmtRxBuffer(void)
{
/* Unmount (release) mgmt packet now that we are done with it */
RawMove(RAW_RX_ID, RAW_MGMT_POOL, FALSE, 0);
SetRawRxMgmtInProgress(FALSE);
g_WaitingForMgmtResponse = FALSE;
}
BOOL AllocateDataTxBuffer(UINT16 bytesNeeded)
{
UINT16 bufAvail;
UINT16 byteCount;
/* Ensure the MRF24W is awake (only applies if PS-Poll was enabled) */
EnsureWFisAwake();
/* get total bytes available for DATA tx memory pool */
bufAvail = Read16BitWFRegister(WF_HOST_WFIFO_BCNT0_REG) & 0x0fff; /* LS 12 bits contain length */
/* if enough bytes available to allocate */
if ( bufAvail >= bytesNeeded )
{
/* allocate and create the new Tx buffer (mgmt or data) */
byteCount = RawMove(RAW_TX_ID, RAW_DATA_POOL, TRUE, bytesNeeded);
if (byteCount == 0)
return FALSE; // just return and let host retry again.
}
/* else not enough bytes available at this time to satisfy request */
else
{
return FALSE;
}
RawWindowReady[RAW_TX_ID] = TRUE;
SetRawWindowState(RAW_TX_ID, WF_RAW_DATA_MOUNTED);
return TRUE;
}
void DeallocateDataTxBuffer(void)
{
RawMove(RAW_TX_ID, RAW_DATA_POOL, FALSE, 0);
RawWindowReady[RAW_TX_ID] = FALSE;
SetRawWindowState(RAW_TX_ID, WF_RAW_UNMOUNTED);
}
void DeallocateDataRxBuffer(void)
{
RawMove(RAW_RX_ID, RAW_DATA_POOL, FALSE, 0);
}
/* if a mgmt msg mounted in RAW window then message handled by MRF24W. */
/* If a data message mounted in RAW window then will be transmitted to 802.11 network */
void RawSendTxBuffer(UINT16 len)
{
RawMove(RAW_TX_ID, RAW_MAC, FALSE, len);
RawWindowReady[RAW_TX_ID] = FALSE;
SetRawWindowState(RAW_TX_ID, WF_RAW_UNMOUNTED);
}
/* mounts the most recent Rx message. Could be a management or data message. */
UINT16 RawMountRxBuffer(void)
{
UINT16 length;
length = RawMove(RAW_RX_ID, RAW_MAC, TRUE, 0);
RawWindowReady[RAW_RX_ID] = TRUE;
SetRawWindowState(RAW_RX_ID, WF_RAW_DATA_MOUNTED);
return length;
}
/* Copies from source raw window to destination raw window, each from their current indexes. */
void RawToRawCopy(UINT8 rawDestId, UINT16 length)
{
RawMove(rawDestId, RAW_COPY, TRUE, length);
}
/*
*********************************************************************************************************
* PushRawWindow()
*
* Description : Pushes a RAW window onto the 1-level deep RAW stack. The RAW window state is preserved
* and is restored when PopRawWindow() is called.
*
* Argument(s) : rawId -- RAW window ID that is being pushed.
*
* Return(s) : None
*
* Caller(s) : WF Driver
*
* Notes: : (1) The RAW architecture supports a 1-level deep stack. Each time this function is called
* any state that had been previously saved is lost.
*
*********************************************************************************************************
*/
void PushRawWindow(UINT8 rawId)
{
RawMove(rawId, RAW_STACK_MEM, FALSE, 0);
}
/*
*********************************************************************************************************
* PopRawWindow()
*
* Description : Pops a RAW window state from the 1-level deep RAW stack. The RAW window state that was
* mounted prior to this call is lost.
*
* Argument(s) : rawId -- RAW window ID that is being popped.
*
* Return(s) : byte count of the RAW window state that was saved and is now restored. In other words, the
* size, in bytes, of the RAW window when it was first created.
* of the o
*
* Caller(s) : WF Driver
*
* Notes: : (1) The RAW architecture supports a 1-level deep stack. When this fucntion is called the
* RAW window state that had been mounted is lost. If trying to pop a non-existent RAW
* window state (no push has taken place), the the returned byte count is 0.
*
*********************************************************************************************************
*/
UINT16 PopRawWindow(UINT8 rawId)
{
UINT16 byteCount;
byteCount = RawMove(rawId, RAW_STACK_MEM, TRUE, 0);
return byteCount;
}
/*
*********************************************************************************************************
* ScratchMount()
*
* Description : Mounts Scratch using the specified RAW window.
*
* Argument(s) : rawId -- desired RAW window to mount Scratch to.
*
* Return(s) : None
*
* Caller(s) : WF Driver
*
* Notes: : None
*
*********************************************************************************************************
*/
UINT16 ScratchMount(UINT8 rawId)
{
UINT16 byteCount;
byteCount = RawMove(rawId, RAW_SCRATCH_POOL, TRUE, 0);
if (byteCount == 0)
{
/* work-around, somehow the scratch was already mounted to the other raw window */
rawId = !rawId;
// WF_ASSERT(byteCount > 0); /* scratch mount should always return value > 0 */
}
SetRawWindowState(rawId, WF_SCRATCH_MOUNTED);
return byteCount;
}
/*
*********************************************************************************************************
* ScratchUnmount()
*
* Description : Unmounts Scratch from the specified RAW window.
*
* Argument(s) : rawId -- RAW window ID that scratch had been mounted to.
*
* Return(s) : None
*
* Caller(s) : WF Driver
*
* Notes: : None
*
*********************************************************************************************************
*/
void ScratchUnmount(UINT8 rawId)
{
RawMove(rawId, RAW_SCRATCH_POOL, FALSE, 0);
if (rawId == RAW_RX_ID)
{
SetRawWindowState(RAW_RX_ID, WF_RAW_UNMOUNTED);
}
else
{
SetRawWindowState(RAW_TX_ID, WF_RAW_UNMOUNTED);
}
}
/*
*********************************************************************************************************
* RawRead()
*
* Description : Reads the specified number of bytes from a mounted RAW window from the specified starting
* index;
*
* Argument(s) : rawId -- RAW window ID being read from
* startIndex -- start index within RAW window to read from
* length -- number of bytes to read from the RAW window
* p_dest -- pointer to Host buffer where read data is copied
*
* Return(s) : error code
*
* Caller(s) : WF Driver
*
* Notes: : None
*
*********************************************************************************************************
*/
void RawRead(UINT8 rawId, UINT16 startIndex, UINT16 length, UINT8 *p_dest)
{
RawSetIndex(rawId, startIndex);
RawGetByte(rawId, p_dest, length);
}
/*
*********************************************************************************************************
* RawWrite()
*
* Description : Writes the specified number of bytes to a mounted RAW window at the specified starting
* index
*
* Argument(s) : rawId -- RAW window ID being written to
* startIndex -- start index within RAW window to write to
* length -- number of bytes to write to RAW window
* p_src -- pointer to Host buffer write data
*
* Return(s) : None
*
* Caller(s) : WF Driver
*
* Notes: : None
*
*********************************************************************************************************
*/
void RawWrite(UINT8 rawId, UINT16 startIndex, UINT16 length, UINT8 *p_src)
{
/*set raw index in dest memory */
RawSetIndex(rawId, startIndex);
/* write data to RAW window */
RawSetByte(rawId, p_src, length);
}
/*****************************************************************************
* FUNCTION: RawMove
*
* RETURNS: Number of bytes that were overlayed (not always applicable)
*
* PARAMS:
* rawId - RAW ID
* srcDest - MRF24W object that will either source or destination of move
* rawIsDestination - TRUE if RAW engine is the destination, FALSE if its the source
* size - number of bytes to overlay (not always applicable)
*
* NOTES: Performs a RAW move operation between a RAW engine and a MRF24W object
*****************************************************************************/
static UINT16 RawMove(UINT16 rawId,
UINT16 srcDest,
BOOL rawIsDestination,
UINT16 size)
{
UINT16 byteCount;
UINT8 regId;
UINT8 regValue8;
UINT16 ctrlVal = 0;
if (rawIsDestination)
{
ctrlVal |= 0x8000;
}
/* fix later, simply need to ensure that size is 12 bits are less */
ctrlVal |= (srcDest << 8); /* defines are already shifted by 4 bits */
ctrlVal |= ((size >> 8) & 0x0f) << 8; /* MS 4 bits of size (bits 11:8) */
ctrlVal |= (size & 0x00ff); /* LS 8 bits of size (bits 7:0) */
/* Clear the interrupt bit in the register */
regValue8 = (rawId == RAW_ID_0)?WF_HOST_INT_MASK_RAW_0_INT_0:WF_HOST_INT_MASK_RAW_1_INT_0;
Write8BitWFRegister(WF_HOST_INTR_REG, regValue8);
/* write update control value to register to control register */
regId = (rawId==RAW_ID_0)?RAW_0_CTRL_0_REG:RAW_1_CTRL_0_REG;
Write16BitWFRegister(regId, ctrlVal);
// Wait for the RAW move operation to complete, and read back the number of bytes, if any, that were overlayed
byteCount = WaitForRawMoveComplete(rawId);
return byteCount;
}
/*****************************************************************************
* FUNCTION: RawSetIndex
*
* RETURNS: True is success, false if timed out, which means attempted to set
* raw index past end of raw window. Not a problem as long as no read
* or write occurs.
*
* PARAMS:
* rawId - RAW ID
* index - desired index
*
* NOTES: Sets the RAW index for the specified RAW engine. If attempt to set RAW
* index outside boundaries of RAW window this function will time out.
*****************************************************************************/
BOOL RawSetIndex(UINT16 rawId, UINT16 index)
{
UINT8 regId;
UINT16 regValue;
UINT32 startTickCount;
UINT32 maxAllowedTicks;
// set the RAW index
regId = (rawId==RAW_ID_0)?RAW_0_INDEX_REG:RAW_1_INDEX_REG;
Write16BitWFRegister(regId, index);
startTickCount = (UINT32)TickGet();
maxAllowedTicks = TICKS_PER_SECOND / 200; /* 5ms */
regId = (rawId==RAW_ID_0)?RAW_0_STATUS_REG:RAW_1_STATUS_REG;
while (1)
{
regValue = Read16BitWFRegister(regId);
if ((regValue & WF_RAW_STATUS_REG_BUSY_MASK) == 0)
{
return TRUE;
}
/* if timed out then trying to set index past end of raw window, which is OK so long as the app */
/* doesn't try to access it */
if (TickGet() - startTickCount >= maxAllowedTicks)
{
return FALSE; /* timed out waiting for Raw set index to complete */
}
}
}
/*****************************************************************************
* FUNCTION: RawGetIndex
*
* RETURNS: Returns the current RAW index for the specified RAW engine.
*
* PARAMS:
* rawId - RAW ID
*
* NOTES: None
*****************************************************************************/
UINT16 RawGetIndex(UINT16 rawId)
{
UINT8 regId;
UINT16 index;
regId = (rawId==RAW_ID_0)?RAW_0_INDEX_REG:RAW_1_INDEX_REG;
index = Read16BitWFRegister(regId);
return index;
}
//#define OUTPUT_RAW_TX_RX
extern BOOL g_WaitingForMgmtResponse;
/*****************************************************************************
* FUNCTION: RawGetByte
*
* RETURNS: error code
*
* PARAMS:
* rawId - RAW ID
* pBuffer - Buffer to read bytes into
* length - number of bytes to read
*
* NOTES: Reads bytes from the RAW engine
*****************************************************************************/
void RawGetByte(UINT16 rawId, UINT8 *pBuffer, UINT16 length)
{
UINT8 regId;
#if defined(OUTPUT_RAW_TX_RX)
UINT16 i;
#endif
/* if reading a data message do following check */
if (!g_WaitingForMgmtResponse)
{
// if RAW index previously set out of range and caller is trying to do illegal read
if ( (rawId==RAW_RX_ID) &&
g_rxIndexSetBeyondBuffer &&
(GetRawWindowState(RAW_RX_ID) == WF_RAW_DATA_MOUNTED) )
{
WF_ASSERT(FALSE); /* attempting to read past end of RAW buffer */
}
}
regId = (rawId==RAW_ID_0)?RAW_0_DATA_REG:RAW_1_DATA_REG;
ReadWFArray(regId, pBuffer, length);
#if defined(OUTPUT_RAW_TX_RX)
for (i = 0; i < length; ++i)
{
char buf[16];
sprintf(buf,"R: %#x\r\n", pBuffer[i]);
putsUART(buf);
}
#endif
}
/*****************************************************************************
* FUNCTION: RawSetByte
*
* RETURNS: None
*
* PARAMS:
* rawId - RAW ID
* pBuffer - Buffer containing bytes to write
* length - number of bytes to read
*
* NOTES: Writes bytes to RAW window
*****************************************************************************/
void RawSetByte(UINT16 rawId, UINT8 *pBuffer, UINT16 length)
{
UINT8 regId;
#if defined(OUTPUT_RAW_TX_RX)
UINT16 i;
#endif
/* if previously set index past legal range and now trying to write to RAW engine */
if ( (rawId == 0) && g_rxIndexSetBeyondBuffer && (GetRawWindowState(RAW_TX_ID) == WF_RAW_DATA_MOUNTED) )
{
//WF_ASSERT(FALSE); /* attempting to write past end of RAW window */
}
/* write RAW data to chip */
regId = (rawId==RAW_ID_0)?RAW_0_DATA_REG:RAW_1_DATA_REG;
WriteWFArray(regId, pBuffer, length);
#if defined(OUTPUT_RAW_TX_RX)
for (i = 0; i < length; ++i)
{
char buf[16];
sprintf(buf,"T: %#x\r\n", pBuffer[i]);
putsUART(buf);
}
#endif
}
#if defined (__18CXX)
/*****************************************************************************
* FUNCTION: RawSetByteROM
*
* RETURNS: True if successful, else FALSE
*
* PARAMS:
* rawId - RAW ID
* pBuffer - Buffer containing bytes to write
* length - number of bytes to read
*
* NOTES: Reads bytes from the RAW engine. Same as RawSetByte except
* using a ROM pointer instead of RAM pointer
*****************************************************************************/
void RawSetByteROM(UINT16 rawId, ROM UINT8 *pBuffer, UINT16 length)
{
UINT8 regId;
regId = (rawId==RAW_ID_0)?RAW_0_DATA_REG:RAW_1_DATA_REG;
WriteWFROMArray(regId, pBuffer, length);
}
#endif
/*****************************************************************************
* FUNCTION: WaitForRawMoveComplete
*
* RETURNS: Number of bytes that were overlayed (not always applicable)
*
* PARAMS:
* rawId - RAW ID
*
* NOTES: Waits for a RAW move to complete.
*****************************************************************************/
static UINT16 WaitForRawMoveComplete(UINT8 rawId)
{
UINT8 rawIntMask;
UINT16 byteCount;
UINT8 regId;
BOOL intDisabled;
#if defined(WF_DEBUG)
UINT32 startTickCount;
UINT32 maxAllowedTicks;
#endif
/* create mask to check against for Raw Move complete interrupt for either RAW0 or RAW1 */
rawIntMask = (rawId == RAW_ID_0)?WF_HOST_INT_MASK_RAW_0_INT_0:WF_HOST_INT_MASK_RAW_1_INT_0;
/*
These variables are shared with the ISR so need to be careful when setting them.
the WFEintHandler() is the isr that will touch these variables but will only touch
them if RawMoveState.waitingForRawMoveCompleteInterrupt is set to TRUE.
RawMoveState.waitingForRawMoveCompleteInterrupt is only set TRUE here and only here.
so as long as we set RawMoveState.rawInterrupt first and then set RawMoveState.waitingForRawMoveCompleteInterrupt
to TRUE, we are guranteed that the ISR won't touch RawMoveState.rawInterrupt and
RawMoveState.waitingForRawMoveCompleteInterrupt.
*/
RawMoveState.rawInterrupt = 0;
RawMoveState.waitingForRawMoveCompleteInterrupt = TRUE;
// save state of external interrupt here
intDisabled = WF_EintIsDisabled();
// if external interrupt is disabled, enable it because we need it for the while(1) loop to exit
if(intDisabled)
{
WF_EintEnable();
}
else if(WF_EintIsPending())
{
WF_EintEnable();
}
#if defined(WF_DEBUG)
// Before we enter the while loop, get the tick timer count and save it
maxAllowedTicks = TICKS_PER_SECOND / 2; /* 500 ms timeout */
startTickCount = (UINT32)TickGet();
#endif
while (1)
{
/* if received an external interrupt that signalled the RAW Move */
/* completed then break out of this loop */
if(RawMoveState.rawInterrupt & rawIntMask)
{
break;
}
#if defined(WF_DEBUG)
/* If timed out waiting for RAW Move complete than lock up */
if (TickGet() - startTickCount >= maxAllowedTicks)
{
WF_ASSERT(FALSE);
}
#endif
} /* end while */
/* if interrupt was enabled by us here, we should disable it now that we're finished */
if(intDisabled)
{
WF_EintDisable();
}
/* read the byte count and return it */
regId = (rawId == RAW_ID_0)?WF_HOST_RAW0_CTRL1_REG:WF_HOST_RAW1_CTRL1_REG;
byteCount = Read16BitWFRegister(regId);
return ( byteCount );
}
/*****************************************************************************
* FUNCTION: SendRAWDataFrame
*
* RETURNS: TRUE or FALSE
*
* PARAMS:
* UINT8* pBuf -> pointer to the command buffer.
* UINT16 bufLen -> length in bytes of the buffer (pBuf).
*
*
* NOTES: SendRAWDataFrame sends a Data Transmit request to the WF chip
* using the Random Access Window (RAW) interface. The pre-buffer
* is used by the WF MAC to send routing information for the packet
* while pBuf is the request that was submitted by the application.
* The order of operations are
* 1) reserve a memory buffer of sufficient length on the WF chip
* using RawMove.
* 2) Write the bytes for the pre-buffer and then the buffer
* using the RawSetByte. Because the bytes are written
* sequentially there is no need to call WFRawSetIndex
* to adjust the write position.
* 3) instruct the WF chip that the command is ready for
* processing.
* 4) perform any necessary cleanup.
*****************************************************************************/
void SendRAWDataFrame(UINT16 bufLen)
{
UINT8 txDataPreamble[4] = { WF_DATA_REQUEST_TYPE, WF_STD_DATA_MSG_SUBTYPE, 1, 0};
RawWrite(RAW_TX_ID, 0, sizeof(txDataPreamble), txDataPreamble);
RawSendTxBuffer(bufLen);
}
#else
// dummy func to keep compiler happy when module has no executeable code
void DriverRaw_EmptyFunc(void)
{
}
#endif /* WF_CS_TRIS */
/* EOF */
| {
"content_hash": "23d1d48e44dda2176c61c92e84dcdc74",
"timestamp": "",
"source": "github",
"line_count": 710,
"max_line_length": 121,
"avg_line_length": 32.252112676056335,
"alnum_prop": 0.5114197126512074,
"repo_name": "exosite-garage/mcp_dv102412_cloud",
"id": "54a1f1299b1e57ae9a46f24c6737e74191cf0f5b",
"size": "25249",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Microchip/TCPIP Stack/WiFi/WFDriverRaw.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "277329"
},
{
"name": "C",
"bytes": "3539012"
},
{
"name": "C#",
"bytes": "129222"
},
{
"name": "C++",
"bytes": "112895"
},
{
"name": "CSS",
"bytes": "2867"
},
{
"name": "Java",
"bytes": "406021"
},
{
"name": "JavaScript",
"bytes": "24573"
},
{
"name": "Objective-C",
"bytes": "258516"
},
{
"name": "Shell",
"bytes": "1864"
}
],
"symlink_target": ""
} |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Generic;
namespace Microsoft.CodeAnalysis.BuildTasks
{
internal class PropertyDictionary : Dictionary<string, object?>
{
public T GetOrDefault<T>(string name, T @default)
{
object? value;
if (this.TryGetValue(name, out value))
{
return (T)value!;
}
return @default;
}
public new object? this[string name]
{
get
{
object? value;
return this.TryGetValue(name, out value)
? value : null;
}
set { base[name] = value; }
}
}
}
| {
"content_hash": "97bce044601512ae7e5afe36ee77565a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 71,
"avg_line_length": 26.676470588235293,
"alnum_prop": 0.5468577728776185,
"repo_name": "jmarolf/roslyn",
"id": "abca8be6b9dfb6611f4381d1e3ad22c8898aa9a3",
"size": "909",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "src/Compilers/Core/MSBuildTask/PropertyDictionary.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "1C Enterprise",
"bytes": "257760"
},
{
"name": "Batchfile",
"bytes": "9059"
},
{
"name": "C#",
"bytes": "139027042"
},
{
"name": "C++",
"bytes": "5602"
},
{
"name": "CMake",
"bytes": "9153"
},
{
"name": "Dockerfile",
"bytes": "2450"
},
{
"name": "F#",
"bytes": "549"
},
{
"name": "PowerShell",
"bytes": "243026"
},
{
"name": "Shell",
"bytes": "92965"
},
{
"name": "Visual Basic .NET",
"bytes": "71729344"
}
],
"symlink_target": ""
} |
package org.assertj.db.api;
import org.junit.Test;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Test on the utility class {@code Assertions} : the private constructor.
*
* @author Régis Pouiller
*
*/
public class Assertions_Constructor_Test {
/**
* This method tests the private constructor of {@code Assertions} for the tests coverage..
* @throws NoSuchMethodException
* @throws SecurityException
* @throws java.lang.reflect.InvocationTargetException
* @throws IllegalAccessException
* @throws InstantiationException
* @throws IllegalArgumentException
*/
@Test
public void test_private_constructor_for_the_tests_coverage() throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
Constructor<Assertions> constructor = Assertions.class.getDeclaredConstructor();
assertThat(Modifier.isPrivate(constructor.getModifiers())).isTrue();
constructor.setAccessible(true);
constructor.newInstance();
constructor.setAccessible(false);
}
}
| {
"content_hash": "09ba878638cdd4aec18b9e0477feca44",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 214,
"avg_line_length": 33.432432432432435,
"alnum_prop": 0.7728375101050929,
"repo_name": "otoniel-isidoro-sofist/assertj-db",
"id": "d55ac80be02cb01130f8cc996a29e66c6d2ce19e",
"size": "1845",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/test/java/org/assertj/db/api/Assertions_Constructor_Test.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3582361"
},
{
"name": "PLSQL",
"bytes": "1731"
}
],
"symlink_target": ""
} |
class AddWeightToReleases < ActiveRecord::Migration
def change
add_column :releases, :weight, :string
end
end
| {
"content_hash": "dc12e9d33d34851e10e0be45dc653099",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 51,
"avg_line_length": 23.6,
"alnum_prop": 0.7542372881355932,
"repo_name": "tshedor/fae",
"id": "acb01a0d235316fdff6301a2e36af574825744e2",
"size": "118",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "spec/dummy/db/migrate/20150213170720_add_weight_to_releases.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "82070"
},
{
"name": "HTML",
"bytes": "105603"
},
{
"name": "JavaScript",
"bytes": "94678"
},
{
"name": "Ruby",
"bytes": "358802"
}
],
"symlink_target": ""
} |
Subsets and Splits