text stringlengths 2 1.04M | meta dict |
|---|---|
import java.util.Queue;
import java.util.LinkedList;
public class IsSubsequence {
public boolean isSubsequence(String s, String t) {
Queue<Character> queue = new LinkedList<>();
for(char x : s.toCharArray()) {
queue.offer(x);
}
for(char x : t.toCharArray()) {
if(!queue.isEmpty() && queue.peek() == x) {
queue.poll();
}
}
return queue.isEmpty();
}
public static void main(String[] args) {
String s = "";
String t = "ahbgdc";
System.out.printf("s = %s\n", s);
System.out.printf("t = %s\n", t);
IsSubsequence solution = new IsSubsequence();
System.out.printf("s %s subsequence of t\n", solution.isSubsequence(s, t) ? "is" : "is NOT");
}
} | {
"content_hash": "90d206dae023a4d0dd1f8ebb87ee2670",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 101,
"avg_line_length": 27.75862068965517,
"alnum_prop": 0.5316770186335403,
"repo_name": "dantin/leetcode-solutions",
"id": "432f40e1a9325db8c9b42d9e63ffc8b564790765",
"size": "805",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "java/IsSubsequence.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "7428"
},
{
"name": "Java",
"bytes": "193005"
},
{
"name": "Python",
"bytes": "606"
}
],
"symlink_target": ""
} |
#import "ImportMenuDelegate.h"
#import "ImportPluginInterface.h"
@implementation ImportMenuDelegate
- (void) findPlugins
{
NSString * appSupport = @"Library/Application Support/Books/Plugins/";
NSString * appPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/Contents/Resources/"];
NSString * userPath = [NSHomeDirectory () stringByAppendingPathComponent:appSupport];
NSString * sysPath = [@"/" stringByAppendingPathComponent:appSupport];
NSArray * paths = [NSArray arrayWithObjects:appPath, sysPath, userPath, nil];
NSEnumerator * pathEnum = [paths objectEnumerator];
NSString * path;
plugins = [[NSMutableDictionary alloc] init];
while (path = [pathEnum nextObject])
{
NSEnumerator * e = [[[NSFileManager defaultManager] directoryContentsAtPath:path] objectEnumerator];
NSString * name;
while (name = [e nextObject])
{
if ([[name pathExtension] isEqualToString:@"app"])
{
NSBundle * plugin = [NSBundle bundleWithPath:[path stringByAppendingPathComponent:name]];
NSDictionary * pluginDict = [plugin infoDictionary];
if ([[pluginDict objectForKey:@"BooksPluginType"] isEqual:@"Import"])
{
NSString * pluginName = (NSString *) [[pluginDict objectForKey:@"BooksPluginName"] copy];
[plugins setObject:plugin forKey:pluginName];
}
}
}
}
pluginKeys = [[plugins allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
[pluginKeys retain];
}
- (int) numberOfItemsInMenu:(NSMenu *) menu;
{
if (plugins == nil)
[self findPlugins];
return [plugins count];
}
- (BOOL) menu:(NSMenu *) menu updateItem:(NSMenuItem *) item atIndex:(int) index shouldCancel:(BOOL) shouldCancel;
{
if (plugins == nil)
[self findPlugins];
NSString * title = (NSString *) [pluginKeys objectAtIndex:index];
NSBundle * bundle = (NSBundle *) [plugins objectForKey:title];
[item setTitle:title];
[item setRepresentedObject:bundle];
[item setTarget:self];
[item setAction:NSSelectorFromString (@"importFromMenuItem:")];
return YES;
}
- (IBAction) importFromMenuItem:(NSMenuItem *) menuItem
{
NSBundle * importPlugin = (NSBundle *) [menuItem representedObject];
ImportPluginInterface * import = [[ImportPluginInterface alloc] init];
[NSThread detachNewThreadSelector:NSSelectorFromString(@"importFromBundle:") toTarget:import withObject:importPlugin];
}
@end
| {
"content_hash": "0a1ddd9dca7b47977380171f6bcf91bd",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 119,
"avg_line_length": 26.988636363636363,
"alnum_prop": 0.7267368421052631,
"repo_name": "audaciouscode/Books-Mac-OS-X",
"id": "c0921789a5af26aa5d8de97b2f176208715956ed",
"size": "3505",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Versions/Books_3.0b6/ImportMenuDelegate.m",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "6188"
},
{
"name": "C",
"bytes": "87465"
},
{
"name": "CSS",
"bytes": "32131"
},
{
"name": "Erlang",
"bytes": "17191"
},
{
"name": "Java",
"bytes": "78847"
},
{
"name": "JavaScript",
"bytes": "16180"
},
{
"name": "Objective-C",
"bytes": "1745241"
},
{
"name": "Perl",
"bytes": "127010"
},
{
"name": "Python",
"bytes": "22846682"
},
{
"name": "R",
"bytes": "13555"
},
{
"name": "Ruby",
"bytes": "109727"
},
{
"name": "Shell",
"bytes": "36745"
},
{
"name": "XSLT",
"bytes": "244237"
}
],
"symlink_target": ""
} |
'use strict';
const babel = require('babel-core');
const babylon = require('babylon');
/**
* Extracts dependencies (module IDs imported with the `require` function) from
* a string containing code. This walks the full AST for correctness (versus
* using, for example, regular expressions, that would be faster but inexact.)
*
* The result of the dependency extraction is an de-duplicated array of
* dependencies, and an array of offsets to the string literals with module IDs.
* The index points to the opening quote.
*/
function extractDependencies(code: string) {
const ast = babylon.parse(code);
const dependencies = new Set();
const dependencyOffsets = [];
babel.traverse(ast, {
CallExpression(path) {
const node = path.node;
const callee = node.callee;
const arg = node.arguments[0];
if (callee.type !== 'Identifier' || callee.name !== 'require' || !arg || arg.type !== 'StringLiteral') {
return;
}
dependencyOffsets.push(arg.start);
dependencies.add(arg.value);
},
});
return {dependencyOffsets, dependencies: Array.from(dependencies)};
}
module.exports = extractDependencies;
| {
"content_hash": "d79e718a40598cf80d0508d978742ee2",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 110,
"avg_line_length": 30.736842105263158,
"alnum_prop": 0.6875,
"repo_name": "CodeLinkIO/react-native",
"id": "d88407f11650e4b492fb1b80be0ca5ac754cfec5",
"size": "1488",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packager/src/JSTransformer/worker/extract-dependencies.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "15612"
},
{
"name": "Awk",
"bytes": "121"
},
{
"name": "Batchfile",
"bytes": "683"
},
{
"name": "C",
"bytes": "194918"
},
{
"name": "C++",
"bytes": "736969"
},
{
"name": "CSS",
"bytes": "31493"
},
{
"name": "HTML",
"bytes": "34338"
},
{
"name": "IDL",
"bytes": "897"
},
{
"name": "Java",
"bytes": "2771822"
},
{
"name": "JavaScript",
"bytes": "4125864"
},
{
"name": "Makefile",
"bytes": "8496"
},
{
"name": "Objective-C",
"bytes": "1428979"
},
{
"name": "Objective-C++",
"bytes": "204096"
},
{
"name": "Prolog",
"bytes": "287"
},
{
"name": "Python",
"bytes": "133906"
},
{
"name": "Ruby",
"bytes": "7562"
},
{
"name": "Shell",
"bytes": "39234"
}
],
"symlink_target": ""
} |
/**
*
*/
package com.evolveum.midpoint.provisioning.impl;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.util.PrismAsserts;
import com.evolveum.midpoint.prism.util.PrismTestUtil;
import com.evolveum.midpoint.provisioning.api.ProvisioningService;
import com.evolveum.midpoint.provisioning.impl.mock.SynchornizationServiceMock;
import com.evolveum.midpoint.schema.CapabilityUtil;
import com.evolveum.midpoint.schema.internals.InternalsConfig;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.SchemaDebugUtil;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.test.AbstractIntegrationTest;
import com.evolveum.midpoint.test.util.DerbyController;
import com.evolveum.midpoint.test.util.TestUtil;
import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CredentialsCapabilityType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PasswordCapabilityType;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;
import static com.evolveum.midpoint.test.IntegrationTestTools.*;
import static org.testng.AssertJUnit.*;
/**
*
* @author Radovan Semancik
*
*/
@ContextConfiguration(locations = "classpath:ctx-provisioning-test-main.xml")
@DirtiesContext
public class TestDBTable extends AbstractIntegrationTest {
protected static final File TEST_DIR = new File("src/test/resources/db");
private static final File RESOURCE_DERBY_FILE = new File(TEST_DIR, "resource-derby.xml");
private static final String RESOURCE_DERBY_OID = "ef2bc95b-76e0-59e2-86d6-999902d3abab";
private static final File ACCOUNT_WILL_FILE = new File(TEST_DIR, "account-derby.xml");
private static final String ACCOUNT_WILL_OID = "c0c010c0-d34d-b44f-f11d-333222123456";
private static final String ACCOUNT_WILL_USERNAME = "will";
private static final String ACCOUNT_WILL_FULLNAME = "Will Turner";
private static final String ACCOUNT_WILL_PASSWORD = "3lizab3th";
private static final String DB_TABLE_CONNECTOR_TYPE = "org.identityconnectors.databasetable.DatabaseTableConnector";
private static final Trace LOGGER = TraceManager.getTrace(TestDBTable.class);
private static DerbyController derbyController = new DerbyController();
@Autowired
private ProvisioningService provisioningService;
// @Autowired
// private TaskManager taskManager;
@Autowired
private SynchornizationServiceMock syncServiceMock;
/* (non-Javadoc)
* @see com.evolveum.midpoint.test.AbstractIntegrationTest#initSystem()
*/
@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
// We need to switch off the encryption checks. Some values cannot be encrypted as we do
// not have a definition here
InternalsConfig.encryptionChecks = false;
provisioningService.postInit(initResult);
addResourceFromFile(RESOURCE_DERBY_FILE, DB_TABLE_CONNECTOR_TYPE, initResult);
}
@BeforeClass
public static void startDb() throws Exception {
LOGGER.info("------------------------------------------------------------------------------");
LOGGER.info("START: ProvisioningServiceImplDBTest");
LOGGER.info("------------------------------------------------------------------------------");
derbyController.startCleanServer();
}
@AfterClass
public static void stopDb() throws Exception {
derbyController.stop();
LOGGER.info("------------------------------------------------------------------------------");
LOGGER.info("STOP: ProvisioningServiceImplDBTest");
LOGGER.info("------------------------------------------------------------------------------");
}
@Test
public void test000Integrity() throws ObjectNotFoundException, SchemaException {
TestUtil.displayTestTile("test000Integrity");
OperationResult result = new OperationResult(TestDBTable.class.getName()+".test000Integrity");
ResourceType resource = repositoryService.getObject(ResourceType.class, RESOURCE_DERBY_OID, null, result).asObjectable();
String connectorOid = resource.getConnectorRef().getOid();
ConnectorType connector = repositoryService.getObject(ConnectorType.class, connectorOid, null, result).asObjectable();
assertNotNull(connector);
display("DB Connector",connector);
}
@Test
public void test001Connection() throws Exception {
final String TEST_NAME = "test001Connection";
TestUtil.displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
// WHEN
OperationResult testResult = provisioningService.testResource(RESOURCE_DERBY_OID, task);
display("Test result",testResult);
TestUtil.assertSuccess("Test resource failed (result)", testResult);
ResourceType resource = repositoryService.getObject(ResourceType.class, RESOURCE_DERBY_OID, null, result).asObjectable();
display("Resource after test",resource);
display("Resource after test (XML)", PrismTestUtil.serializeObjectToString(resource.asPrismObject(), PrismContext.LANG_XML));
List<Object> nativeCapabilities = resource.getCapabilities().getNative().getAny();
CredentialsCapabilityType credentialsCapabilityType = CapabilityUtil.getCapability(nativeCapabilities, CredentialsCapabilityType.class);
assertNotNull("No credentials capability", credentialsCapabilityType);
PasswordCapabilityType passwordCapabilityType = credentialsCapabilityType.getPassword();
assertNotNull("No password in credentials capability", passwordCapabilityType);
assertEquals("Wrong password capability ReturnedByDefault", Boolean.FALSE, passwordCapabilityType.isReturnedByDefault());
}
@Test
public void test002AddAccount() throws Exception {
final String TEST_NAME = "test002AddAccount";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
OperationResult result = new OperationResult(TestDBTable.class.getName()
+ "." + TEST_NAME);
ShadowType account = parseObjectType(ACCOUNT_WILL_FILE, ShadowType.class);
System.out.println(SchemaDebugUtil.prettyPrint(account));
System.out.println(account.asPrismObject().debugDump());
Task task = taskManager.createTaskInstance();
// WHEN
String addedObjectOid = provisioningService.addObject(account.asPrismObject(), null, null, task, result);
// THEN
result.computeStatus();
display("add object result",result);
TestUtil.assertSuccess("addObject has failed (result)",result);
assertEquals(ACCOUNT_WILL_OID, addedObjectOid);
ShadowType accountType = repositoryService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, result).asObjectable();
PrismAsserts.assertEqualsPolyString("Name not equal.", ACCOUNT_WILL_USERNAME, accountType.getName());
// assertEquals("will", accountType.getName());
ShadowType provisioningAccountType = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result).asObjectable();
PrismAsserts.assertEqualsPolyString("Name not equal.", ACCOUNT_WILL_USERNAME, provisioningAccountType.getName());
// assertEquals("will", provisioningAccountType.getName());
// Check database content
Connection conn = derbyController.getConnection();
// Check if it empty
Statement stmt = conn.createStatement();
stmt.execute("select * from users");
ResultSet rs = stmt.getResultSet();
assertTrue("The \"users\" table is empty",rs.next());
assertEquals(ACCOUNT_WILL_USERNAME,rs.getString(DerbyController.COLUMN_LOGIN));
assertEquals(ACCOUNT_WILL_PASSWORD,rs.getString(DerbyController.COLUMN_PASSWORD));
assertEquals(ACCOUNT_WILL_FULLNAME,rs.getString(DerbyController.COLUMN_FULL_NAME));
assertFalse("The \"users\" table has more than one record",rs.next());
rs.close();
stmt.close();
}
// MID-1234
@Test(enabled=false)
public void test005GetAccount() throws Exception {
final String TEST_NAME = "test005GetAccount";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
OperationResult result = new OperationResult(TestDBTable.class.getName()
+ "." + TEST_NAME);
Task task = taskManager.createTaskInstance();
// WHEN
PrismObject<ShadowType> account = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result);
// THEN
result.computeStatus();
display(result);
TestUtil.assertSuccess(result);
PrismAsserts.assertEqualsPolyString("Name not equal.", ACCOUNT_WILL_USERNAME, account.asObjectable().getName());
assertNotNull("No credentials", account.asObjectable().getCredentials());
assertNotNull("No password", account.asObjectable().getCredentials().getPassword());
assertNotNull("No password value", account.asObjectable().getCredentials().getPassword().getValue());
ProtectedStringType password = account.asObjectable().getCredentials().getPassword().getValue();
display("Password", password);
String clearPassword = protector.decryptString(password);
assertEquals("Wrong password", ACCOUNT_WILL_PASSWORD, clearPassword);
}
}
| {
"content_hash": "34b4ad4d7b70fb3af419b3c651885817",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 140,
"avg_line_length": 42.71304347826087,
"alnum_prop": 0.7618078175895765,
"repo_name": "Pardus-Engerek/engerek",
"id": "7d5e4829f965c410de1675b82b49552fdf282067",
"size": "10424",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "provisioning/provisioning-impl/src/test/java/com/evolveum/midpoint/provisioning/impl/TestDBTable.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "326114"
},
{
"name": "CSS",
"bytes": "239831"
},
{
"name": "HTML",
"bytes": "1850180"
},
{
"name": "Java",
"bytes": "27920377"
},
{
"name": "JavaScript",
"bytes": "17360"
},
{
"name": "PLSQL",
"bytes": "174615"
},
{
"name": "PLpgSQL",
"bytes": "9336"
},
{
"name": "Shell",
"bytes": "397540"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!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" xml:lang="en" lang="en">
<head>
<title>ActiveRecord::Railtie::Rails</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/github.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<span>Ruby on Rails 4.1.6</span><br />
<h1>
<span class="type">Module</span>
ActiveRecord::Railtie::Rails
</h1>
<ul class="files">
<li><a href="../../../files/__/__/_rbenv/versions/2_1_0/lib/ruby/gems/2_1_0/gems/activerecord-4_1_6/lib/active_record/railtie_rb.html">/Users/Sean/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activerecord-4.1.6/lib/active_record/railtie.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<!-- Methods -->
</div>
</div>
</body>
</html> | {
"content_hash": "6d05edca5f54516642b13572b3ed0ba5",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 262,
"avg_line_length": 24.541666666666668,
"alnum_prop": 0.5529145444255801,
"repo_name": "SeanYamaguchi/circle",
"id": "fe039dd28a698cdb3823b27639807a44da695881",
"size": "1767",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "doc/api/classes/ActiveRecord/Railtie/Rails.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "138"
},
{
"name": "CSS",
"bytes": "5877"
},
{
"name": "CoffeeScript",
"bytes": "1575"
},
{
"name": "Common Lisp",
"bytes": "6178"
},
{
"name": "Groff",
"bytes": "55408"
},
{
"name": "HTML",
"bytes": "162594"
},
{
"name": "JavaScript",
"bytes": "2396"
},
{
"name": "Ruby",
"bytes": "88577"
},
{
"name": "Scheme",
"bytes": "1995"
}
],
"symlink_target": ""
} |
Particle Photon Prototyping board on a USB Stick
## Currently untested (11 July 2015). PCBs ordered for testing.
## Use Case
* Prototype post breadboard.
* Connection of sensors, LEDs, SparkFun style breakout boards etc.
* Deployed Thing on a Stick where the Photon may be used to make an internet connected sensor for a room, or lighting or ??? and can be plugged into a USB wall adaptor.
* Using readily available wall plugs board may be connected:
** with the board vertical, Photon facing outwards flat to the wall.
** with the board horizontal, Photon facing upwards.
* These options makes for a nice option for uplighting (internet controlled nightlight?), or a room sensor.
* Other power adaptors exist, e.g. USB in a multi-gang outlet.
## Usage
* USB powered by plugging into a USB A socket on a USB Wall Adaptor, or A -> Micro B on the Particle Photon. Do not connect both at once.
* Top layer is mainly for 0805 devices (and through hole).
* Bottom layer is for 1206 devices (and through hole).
## Botton (looking at the baord with USB connector to the left)
* A0-A7 Analog signals come out to the option of a round test point (solder connection) via an 0805. Can be resistor, 0 ohm link or ....
* A0-A7 Analog signals also come out to a 1206 package with the other side unconnected so this can have a wire tacked on as needed.
** This arrangement may be used to provide either imput impedance/capacitance filter to the analog signal,
** or by connecting the unterminated end to GND or 3V3 this can provice half of a potential divider for a sensor - the sensor may be providing the other half.
* +5V, Gnd, Tx and Rx come out to a 1206 only. Allows for a resitor and/or wire tacking.
## Center
* Top layer in the middle is a SO16 package outline, can be used for SO8 or anything that would fit. Pins 1-8 go to connectors by the USB port, 9-16 by the bottom of the Photon.
* Top 2 connectors in the middle of the Photon have +5V, +3V3 and Gnd available.
## Top (looking at the baord with USB connector to the left)
* 3v3, VBat and Gnd brought out to 4 pin connector. Pin 2 unconnected (may be used for polarity).
* D0-D7 connected to 1206 package on bottom layer with other end unconnected available for wire.
* D0-D7 on top layer go to 0805 package which is liked to a second 0805 with the far end connected to ground.
** This arrangement allows D0-D7 to be connected to a (0805) LED then a (0805)current limiting resitor on the top layer
** or to provide a pull down where the input is connected to the middle of the pins 0805 packages.
## Prototyping area (Right hand side looking at the baord with USB connector to the left).
* Top rail is 3v3 from the Photon (3)
* Second rail down is GND (G)
* Bottom rail is +5V (5)
* 3V3 and GND have a 0805 connection for a capacitor.
* Each pair of rows have possible connection for 0805 and 1206 device near the Photon to allow for capacitor, resistor or LED.
* Only power rails are connected hole to hole.
* 8 1206 or 8 * 2 0805s are available on the right, again for LEDs, Sensors, Resistors or Capacitors.
** The 2x 0805 combination allows for a LED + resistor. Either side of the 1206 or 0805 pair are connected to the pins to the outside of them.
## Spark Photon
* This board is designed for the Particle Photon. It does need headers though.
* The Particle Core (Spark Core) may also be used.
## Eagle Libraries Used:
Particle Photon Library: https://github.com/spark/photon/tree/master/libraries
SparkFun: https://github.com/sparkfun/SparkFun-Eagle-Libraries
## Versioning
* Board will have multiple major versions. e.g.
** V1 A0-A8 1206/0805's unterminated.
** V1.x bug fixes for V1 board.
** V2 A0-A8 1206/0805's terminated with +5 or GND based on layer
** V2.x bug fixes for V2 board.
## Ideas
### Different versions
* Change A0-A8 1206 packages so unconnected end is connected to
* Much narrower (just room for Photon)
* Wonly - USB port at Top Right corner to allow for top exit wall adaptors where USB socket is perpendicular to the wall.
* Surface mount photon
* Timer version. LED/LCD/OLED dispay. Sensor to allow for setting and starting of timer (Hands free)
## Bugs
* Missing Open Hardware Logo. | {
"content_hash": "8ca62f7bdec0d87a871dfc73964e3906",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 177,
"avg_line_length": 50.506024096385545,
"alnum_prop": 0.7540553435114504,
"repo_name": "Tinamous/PhotonOnAStick",
"id": "7b364379a391eccc75f5a7c6aa3c857c9963501c",
"size": "4209",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Eagle",
"bytes": "1131242"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
Integrated Taxonomic Information System
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "05c69b1460c361ce6f7bf6632d3d8a2e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.7218045112781954,
"repo_name": "mdoering/backbone",
"id": "92d8a6e1199c81928ed8e26b9e69c54f92af61c9",
"size": "182",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Lupinus/Lupinus sericeus/ Syn. Lupinus habrocomus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
"""Support for Netgear Arlo IP cameras."""
from __future__ import annotations
from datetime import datetime, timedelta
import logging
from pyarlo import PyArlo
from requests.exceptions import ConnectTimeout, HTTPError
import voluptuous as vol
from homeassistant.components import persistent_notification
from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.dispatcher import dispatcher_send
from homeassistant.helpers.event import track_time_interval
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__)
ATTRIBUTION = "Data provided by arlo.netgear.com"
DATA_ARLO = "data_arlo"
DEFAULT_BRAND = "Netgear Arlo"
DOMAIN = "arlo"
NOTIFICATION_ID = "arlo_notification"
NOTIFICATION_TITLE = "Arlo Component Setup"
SCAN_INTERVAL = timedelta(seconds=60)
SIGNAL_UPDATE_ARLO = "arlo_update"
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
{
vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
vol.Optional(CONF_SCAN_INTERVAL, default=SCAN_INTERVAL): cv.time_period,
}
)
},
extra=vol.ALLOW_EXTRA,
)
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up an Arlo component."""
conf = config[DOMAIN]
username = conf[CONF_USERNAME]
password = conf[CONF_PASSWORD]
scan_interval = conf[CONF_SCAN_INTERVAL]
try:
arlo = PyArlo(username, password, preload=False)
if not arlo.is_connected:
return False
# assign refresh period to base station thread
arlo_base_station = next((station for station in arlo.base_stations), None)
if arlo_base_station is not None:
arlo_base_station.refresh_rate = scan_interval.total_seconds()
elif not arlo.cameras:
_LOGGER.error("No Arlo camera or base station available")
return False
hass.data[DATA_ARLO] = arlo
except (ConnectTimeout, HTTPError) as ex:
_LOGGER.error("Unable to connect to Netgear Arlo: %s", str(ex))
persistent_notification.create(
hass,
f"Error: {ex}<br />You will need to restart hass after fixing.",
title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID,
)
return False
def hub_refresh(_: ServiceCall | datetime) -> None:
"""Call ArloHub to refresh information."""
_LOGGER.debug("Updating Arlo Hub component")
hass.data[DATA_ARLO].update(update_cameras=True, update_base_station=True)
dispatcher_send(hass, SIGNAL_UPDATE_ARLO)
# register service
hass.services.register(DOMAIN, "update", hub_refresh)
# register scan interval for ArloHub
track_time_interval(hass, hub_refresh, scan_interval)
return True
| {
"content_hash": "a609a08b99203d47f20520cc27f40322",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 88,
"avg_line_length": 32.064516129032256,
"alnum_prop": 0.6824279007377599,
"repo_name": "GenericStudent/home-assistant",
"id": "f7a368c7a4cc576366a644c5a37490c187084d5a",
"size": "2982",
"binary": false,
"copies": "2",
"ref": "refs/heads/dev",
"path": "homeassistant/components/arlo/__init__.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "3070"
},
{
"name": "Python",
"bytes": "44491729"
},
{
"name": "Shell",
"bytes": "5092"
}
],
"symlink_target": ""
} |
FROM balenalib/up-core-plus-fedora:32-run
ENV NODE_VERSION 12.21.0
ENV YARN_VERSION 1.22.4
RUN for key in \
6A010C5166006599AA17F08146C2130DFD2497F5 \
; do \
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
done \
&& curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
&& echo "ab121de3c472d76ec425480b0594e43109ee607bd57c3d5314bdb65fa816bf1c node-v$NODE_VERSION-linux-x64.tar.gz" | sha256sum -c - \
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-x64.tar.gz" \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& mkdir -p /opt/yarn \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& npm config set unsafe-perm true -g --unsafe-perm \
&& rm -rf /tmp/*
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@node.sh" \
&& echo "Running test-stack@node" \
&& chmod +x test-stack@node.sh \
&& bash test-stack@node.sh \
&& rm -rf test-stack@node.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: Intel 64-bit (x86-64) \nOS: Fedora 32 \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nNode.js v12.21.0, Yarn v1.22.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo $'#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | {
"content_hash": "db60092058cb0875cd52775508a3d901",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 704,
"avg_line_length": 66.7560975609756,
"alnum_prop": 0.7066130800146145,
"repo_name": "nghiant2710/base-images",
"id": "3a31afba20958ef6d8bd85d4acf754c8307a436f",
"size": "2758",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/node/up-core-plus/fedora/32/12.21.0/run/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "144558581"
},
{
"name": "JavaScript",
"bytes": "16316"
},
{
"name": "Shell",
"bytes": "368690"
}
],
"symlink_target": ""
} |
Acceptance testing with cucumber.js
===================================
There are some acceptance tests for the demo application http://rest-bookmarks.herokuapp.com/.
The source code of the demo application is available in this [repo](https://github.com/spoonless/rest-bookmarks).
This project is based on cucumber-js. Therefore once you have installed npm and node.js, you have
to install cucumber globally:
> npm install -g cucumber
to install project dependencies:
> npm install
and then to run the feature:
> cucumber.js create-bookmark.feature -r restbookmark.steps.js -f pretty
| {
"content_hash": "62a338095fe325618a954346d483f926",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 113,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.7411167512690355,
"repo_name": "spoonless/rest-bookmarks-bdd",
"id": "d1ceab4405e6f5829c0199c22f3872422faa1507",
"size": "591",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Cucumber",
"bytes": "1705"
},
{
"name": "JavaScript",
"bytes": "2856"
},
{
"name": "Shell",
"bytes": "118"
}
],
"symlink_target": ""
} |
var util = require('util');
var RedisPool = require('../index');
var LOG_MESSAGE = 'Available: %s, Pool Size: %s';
var redisSettings = {
// Use TCP connections for Redis clients.
host: '127.0.0.1',
port: 6379,
// Set a redis client option.
password: 'dingbats' // Authenticate using the password dingbats...
};
var poolSettings = {
// Set the max milliseconds a resource can go unused before it should be destroyed.
idleTimeoutMillis: 5000,
max: 5
// Setting min > 0 will prevent this application from ending.
};
// Create the pool.
var pool = RedisPool(redisSettings, poolSettings);
// Get connection errors for logging...
pool.on('error', function(reason) {
console.log('Connection Error:', reason);
});
pool.acquire(clientConnection);
function clientConnection(err, client) {
console.log(err);
// Issue the PING command.
client.ping(getPingResponse);
function getPingResponse(err, response) {
console.log('getPingResponse', err, response);
setTimeout(delayResponse, 2500);
}
function delayResponse() {
// Release the client after 2500ms.
pool.release(client);
}
}
// Setup up a poller to see how many objects are in the pool. Close out when done.
var poller = setInterval(pollRedisPool, 500);
function pollRedisPool() {
console.log(util.format(LOG_MESSAGE, pool.availableObjectsCount(), pool.getPoolSize()));
if (pool.availableObjectsCount() === 0 && pool.getPoolSize() === 0) {
clearInterval(poller);
console.log('There are no more requests in this pool, the program should exit now...');
}
} | {
"content_hash": "1f893d89315885b6d1bb38b25a905366",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 91,
"avg_line_length": 28.089285714285715,
"alnum_prop": 0.6993006993006993,
"repo_name": "joshuah/sol-redis-pool",
"id": "e1e4591bbb2348d872e0b137bc952dbe3c122acb",
"size": "1573",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/authentication.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "8401"
}
],
"symlink_target": ""
} |
package com.intellij.ui;
import com.intellij.util.ui.UIUtil;
import javax.annotation.Nonnull;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public abstract class ClickListener {
private static final int EPS = 4;
private MouseAdapter myListener;
public abstract boolean onClick(@Nonnull MouseEvent event, int clickCount);
public void installOn(@Nonnull Component c) {
installOn(c, false);
}
public void installOn(@Nonnull Component c, boolean allowDragWhileClicking) {
myListener = new MouseAdapter() {
private Point pressPoint;
private Point lastClickPoint;
private long lastTimeClicked = -1;
private int clickCount = 0;
@Override
public void mousePressed(MouseEvent e) {
final Point point = e.getPoint();
SwingUtilities.convertPointToScreen(point, e.getComponent());
if (Math.abs(lastTimeClicked - e.getWhen()) > UIUtil.getMultiClickInterval() || lastClickPoint != null && !isWithinEps(lastClickPoint, point)) {
clickCount = 0;
lastClickPoint = null;
}
clickCount++;
lastTimeClicked = e.getWhen();
if (!e.isPopupTrigger()) {
pressPoint = point;
}
}
@Override
public void mouseReleased(MouseEvent e) {
Point releasedAt = e.getPoint();
SwingUtilities.convertPointToScreen(releasedAt, e.getComponent());
Point clickedAt = pressPoint;
lastClickPoint = clickedAt;
pressPoint = null;
if (e.isConsumed() || clickedAt == null || e.isPopupTrigger() || !e.getComponent().contains(e.getPoint())) {
return;
}
if ((allowDragWhileClicking || isWithinEps(releasedAt, clickedAt)) && onClick(e, clickCount)) {
e.consume();
}
}
};
c.addMouseListener(myListener);
}
private static boolean isWithinEps(Point releasedAt, Point clickedAt) {
return Math.abs(clickedAt.x - releasedAt.x) < EPS && Math.abs(clickedAt.y - releasedAt.y) < EPS;
}
public void uninstall(Component c) {
c.removeMouseListener(myListener);
}
}
| {
"content_hash": "8a389c8937aa824d0df6f133826568f6",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 152,
"avg_line_length": 29.2972972972973,
"alnum_prop": 0.6563653136531366,
"repo_name": "consulo/consulo",
"id": "3025ee8fc6c8805b5553ac4b28773b1a75447fff",
"size": "2309",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/desktop-awt/desktop-util-awt/src/main/java/com/intellij/ui/ClickListener.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "299"
},
{
"name": "C",
"bytes": "52718"
},
{
"name": "C++",
"bytes": "72795"
},
{
"name": "CMake",
"bytes": "854"
},
{
"name": "CSS",
"bytes": "64655"
},
{
"name": "Groovy",
"bytes": "36006"
},
{
"name": "HTML",
"bytes": "173780"
},
{
"name": "Java",
"bytes": "64026758"
},
{
"name": "Lex",
"bytes": "5909"
},
{
"name": "Objective-C",
"bytes": "23787"
},
{
"name": "Python",
"bytes": "3276"
},
{
"name": "SCSS",
"bytes": "9782"
},
{
"name": "Shell",
"bytes": "5689"
},
{
"name": "Thrift",
"bytes": "1216"
},
{
"name": "XSLT",
"bytes": "49230"
}
],
"symlink_target": ""
} |
package com.github.dockerjava.core.command;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.dockerjava.api.command.CreateContainerCmd;
import com.github.dockerjava.api.command.CreateContainerResponse;
import com.github.dockerjava.api.exception.ConflictException;
import com.github.dockerjava.api.exception.NotFoundException;
import com.github.dockerjava.api.model.Bind;
import com.github.dockerjava.api.model.Capability;
import com.github.dockerjava.api.model.ContainerNetwork;
import com.github.dockerjava.api.model.Device;
import com.github.dockerjava.api.model.ExposedPort;
import com.github.dockerjava.api.model.ExposedPorts;
import com.github.dockerjava.api.model.HostConfig;
import com.github.dockerjava.api.model.Link;
import com.github.dockerjava.api.model.LogConfig;
import com.github.dockerjava.api.model.LxcConf;
import com.github.dockerjava.api.model.PortBinding;
import com.github.dockerjava.api.model.Ports;
import com.github.dockerjava.api.model.RestartPolicy;
import com.github.dockerjava.api.model.Ulimit;
import com.github.dockerjava.api.model.Volume;
import com.github.dockerjava.api.model.Volumes;
import com.github.dockerjava.api.model.VolumesFrom;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.Collections.singletonMap;
/**
* Creates a new container.
* `/containers/create`
*/
@JsonInclude(Include.NON_NULL)
public class CreateContainerCmdImpl extends AbstrDockerCmd<CreateContainerCmd, CreateContainerResponse> implements
CreateContainerCmd {
private String name;
@JsonProperty("Hostname")
private String hostName;
@JsonProperty("Domainname")
private String domainName;
@JsonProperty("User")
private String user;
@JsonProperty("AttachStdin")
private Boolean attachStdin;
@JsonProperty("AttachStdout")
private Boolean attachStdout;
@JsonProperty("AttachStderr")
private Boolean attachStderr;
@JsonProperty("PortSpecs")
private String[] portSpecs;
@JsonProperty("Tty")
private Boolean tty;
@JsonProperty("OpenStdin")
private Boolean stdinOpen;
@JsonProperty("StdinOnce")
private Boolean stdInOnce;
@JsonProperty("Env")
private String[] env;
@JsonProperty("Cmd")
private String[] cmd;
@JsonProperty("Entrypoint")
private String[] entrypoint;
@JsonProperty("Image")
private String image;
@JsonProperty("Volumes")
private Volumes volumes = new Volumes();
@JsonProperty("WorkingDir")
private String workingDir;
@JsonProperty("MacAddress")
private String macAddress;
@JsonProperty("NetworkDisabled")
private Boolean networkDisabled;
@JsonProperty("ExposedPorts")
private ExposedPorts exposedPorts = new ExposedPorts();
/**
* @since {@link com.github.dockerjava.core.RemoteApiVersion#VERSION_1_21}
*/
@JsonProperty("StopSignal")
private String stopSignal;
@JsonProperty("HostConfig")
private HostConfig hostConfig = new HostConfig();
@JsonProperty("Labels")
private Map<String, String> labels;
@JsonProperty("NetworkingConfig")
private NetworkingConfig networkingConfig;
@JsonIgnore
private String ipv4Address = null;
@JsonIgnore
private String ipv6Address = null;
@JsonIgnore
private List<String> aliases = null;
public CreateContainerCmdImpl(CreateContainerCmd.Exec exec, String image) {
super(exec);
checkNotNull(image, "image was not specified");
withImage(image);
}
/**
* @throws NotFoundException
* No such container
* @throws ConflictException
* Named container already exists
*/
@Override
public CreateContainerResponse exec() throws NotFoundException, ConflictException {
//code flow taken from https://github.com/docker/docker/blob/master/runconfig/opts/parse.go
ContainerNetwork containerNetwork = null;
if (ipv4Address != null || ipv6Address != null) {
containerNetwork = new ContainerNetwork()
.withIpamConfig(new ContainerNetwork.Ipam()
.withIpv4Address(ipv4Address)
.withIpv6Address(ipv6Address)
);
}
if (hostConfig.isUserDefinedNetwork() && hostConfig.getLinks().length > 0) {
if (containerNetwork == null) {
containerNetwork = new ContainerNetwork();
}
containerNetwork.withLinks(hostConfig.getLinks());
}
if (aliases != null) {
if (containerNetwork == null) {
containerNetwork = new ContainerNetwork();
}
containerNetwork.withAliases(aliases);
}
if (containerNetwork != null) {
networkingConfig = new NetworkingConfig()
.withEndpointsConfig(singletonMap(hostConfig.getNetworkMode(), containerNetwork));
}
return super.exec();
}
@Override
@JsonIgnore
public List<String> getAliases() {
return aliases;
}
@Override
@JsonIgnore
public Bind[] getBinds() {
return hostConfig.getBinds();
}
@Override
@JsonIgnore
public Integer getBlkioWeight() {
return hostConfig.getBlkioWeight();
}
@Override
@JsonIgnore
public Capability[] getCapAdd() {
return hostConfig.getCapAdd();
}
@Override
@JsonIgnore
public Capability[] getCapDrop() {
return hostConfig.getCapDrop();
}
@Override
public String[] getCmd() {
return cmd;
}
@Override
@JsonIgnore
public Integer getCpuPeriod() {
return hostConfig.getCpuPeriod();
}
@Override
@JsonIgnore
public String getCpusetCpus() {
return hostConfig.getCpusetCpus();
}
@Override
@JsonIgnore
public String getCpusetMems() {
return hostConfig.getCpusetMems();
}
@Override
@JsonIgnore
public Integer getCpuShares() {
return hostConfig.getCpuShares();
}
@Override
@JsonIgnore
public Device[] getDevices() {
return hostConfig.getDevices();
}
@Override
@JsonIgnore
public String[] getDns() {
return hostConfig.getDns();
}
@Override
@JsonIgnore
public String[] getDnsSearch() {
return hostConfig.getDnsSearch();
}
@Override
public String getDomainName() {
return domainName;
}
@Override
public String[] getEntrypoint() {
return entrypoint;
}
@Override
public String[] getEnv() {
return env;
}
@Override
@JsonIgnore
public ExposedPort[] getExposedPorts() {
return exposedPorts.getExposedPorts();
}
/**
* @see #stopSignal
*/
@JsonIgnore
@Override
public String getStopSignal() {
return stopSignal;
}
@Override
@JsonIgnore
public String[] getExtraHosts() {
return hostConfig.getExtraHosts();
}
@Override
public String getHostName() {
return hostName;
}
@Override
public String getImage() {
return image;
}
@Override
public String getIpv4Address() {
return ipv4Address;
}
@Override
public String getIpv6Address() {
return ipv6Address;
}
@Override
@JsonIgnore
public Map<String, String> getLabels() {
return labels;
}
@Override
@JsonIgnore
public Link[] getLinks() {
return hostConfig.getLinks();
}
@Override
@JsonIgnore
public LxcConf[] getLxcConf() {
return hostConfig.getLxcConf();
}
@Override
@JsonIgnore
public LogConfig getLogConfig() {
return hostConfig.getLogConfig();
}
@Override
public String getMacAddress() {
return macAddress;
}
@Override
@JsonIgnore
public Long getMemory() {
return hostConfig.getMemory();
}
@Override
@JsonIgnore
public Long getMemorySwap() {
return hostConfig.getMemorySwap();
}
@Override
public String getName() {
return name;
}
@Override
@JsonIgnore
public String getNetworkMode() {
return hostConfig.getNetworkMode();
}
@Override
@JsonIgnore
public Ports getPortBindings() {
return hostConfig.getPortBindings();
}
@Override
public String[] getPortSpecs() {
return portSpecs;
}
@Override
@JsonIgnore
public RestartPolicy getRestartPolicy() {
return hostConfig.getRestartPolicy();
}
@Override
@JsonIgnore
public Ulimit[] getUlimits() {
return hostConfig.getUlimits();
}
@Override
public String getUser() {
return user;
}
@Override
@JsonIgnore
public Volume[] getVolumes() {
return volumes.getVolumes();
}
@Override
@JsonIgnore
public VolumesFrom[] getVolumesFrom() {
return hostConfig.getVolumesFrom();
}
@Override
public String getWorkingDir() {
return workingDir;
}
@Override
public Boolean isAttachStderr() {
return attachStderr;
}
@Override
public Boolean isAttachStdin() {
return attachStdin;
}
@Override
public Boolean isAttachStdout() {
return attachStdout;
}
@Override
public Boolean isNetworkDisabled() {
return networkDisabled;
}
@Override
@JsonIgnore
public Boolean getOomKillDisable() {
return hostConfig.getOomKillDisable();
}
@Override
@JsonIgnore
public Boolean getPrivileged() {
return hostConfig.getPrivileged();
}
@Override
@JsonIgnore
public Boolean getPublishAllPorts() {
return hostConfig.getPublishAllPorts();
}
@Override
@JsonIgnore
public Boolean getReadonlyRootfs() {
return hostConfig.getReadonlyRootfs();
}
@Override
public Boolean isStdInOnce() {
return stdInOnce;
}
@Override
public Boolean isStdinOpen() {
return stdinOpen;
}
@Override
public Boolean isTty() {
return tty;
}
@Override
@JsonIgnore
public String getPidMode() {
return hostConfig.getPidMode();
}
@Override
public String getCgroupParent() {
return hostConfig.getCgroupParent();
}
@Override
public CreateContainerCmd withAliases(String... aliases) {
this.aliases = Arrays.asList(aliases);
return this;
}
@Override
public CreateContainerCmd withAliases(List<String> aliases) {
checkNotNull(aliases, "aliases was not specified");
this.aliases = aliases;
return this;
}
@Override
public CreateContainerCmd withAttachStderr(Boolean attachStderr) {
checkNotNull(attachStderr, "attachStderr was not specified");
this.attachStderr = attachStderr;
return this;
}
@Override
public CreateContainerCmd withAttachStdin(Boolean attachStdin) {
checkNotNull(attachStdin, "attachStdin was not specified");
this.attachStdin = attachStdin;
return this;
}
@Override
public CreateContainerCmd withAttachStdout(Boolean attachStdout) {
checkNotNull(attachStdout, "attachStdout was not specified");
this.attachStdout = attachStdout;
return this;
}
@Override
public CreateContainerCmd withBinds(Bind... binds) {
checkNotNull(binds, "binds was not specified");
hostConfig.setBinds(binds);
return this;
}
@Override
public CreateContainerCmd withBinds(List<Bind> binds) {
checkNotNull(binds, "binds was not specified");
return withBinds(binds.toArray(new Bind[binds.size()]));
}
@Override
public CreateContainerCmd withBlkioWeight(Integer blkioWeight) {
checkNotNull(blkioWeight, "blkioWeight was not specified");
hostConfig.withBlkioWeight(blkioWeight);
return this;
}
@Override
public CreateContainerCmd withCapAdd(Capability... capAdd) {
checkNotNull(capAdd, "capAdd was not specified");
hostConfig.withCapAdd(capAdd);
return this;
}
@Override
public CreateContainerCmd withCapAdd(List<Capability> capAdd) {
checkNotNull(capAdd, "capAdd was not specified");
return withCapAdd(capAdd.toArray(new Capability[capAdd.size()]));
}
@Override
public CreateContainerCmd withCapDrop(Capability... capDrop) {
checkNotNull(capDrop, "capDrop was not specified");
hostConfig.withCapDrop(capDrop);
return this;
}
@Override
public CreateContainerCmd withCapDrop(List<Capability> capDrop) {
checkNotNull(capDrop, "capDrop was not specified");
return withCapDrop(capDrop.toArray(new Capability[capDrop.size()]));
}
@Override
public CreateContainerCmd withCmd(String... cmd) {
checkNotNull(cmd, "cmd was not specified");
this.cmd = cmd;
return this;
}
@Override
public CreateContainerCmd withCmd(List<String> cmd) {
checkNotNull(cmd, "cmd was not specified");
return withCmd(cmd.toArray(new String[cmd.size()]));
}
@Override
public CreateContainerCmd withContainerIDFile(String containerIDFile) {
checkNotNull(containerIDFile, "no containerIDFile was specified");
hostConfig.withContainerIDFile(containerIDFile);
return this;
}
@Override
public CreateContainerCmd withCpuPeriod(Integer cpuPeriod) {
checkNotNull(cpuPeriod, "cpuPeriod was not specified");
hostConfig.withCpuPeriod(cpuPeriod);
return this;
}
@Override
public CreateContainerCmd withCpusetCpus(String cpusetCpus) {
checkNotNull(cpusetCpus, "cpusetCpus was not specified");
hostConfig.withCpusetCpus(cpusetCpus);
return this;
}
@Override
public CreateContainerCmd withCpusetMems(String cpusetMems) {
checkNotNull(cpusetMems, "cpusetMems was not specified");
hostConfig.withCpusetMems(cpusetMems);
return this;
}
@Override
public CreateContainerCmd withCpuShares(Integer cpuShares) {
checkNotNull(cpuShares, "cpuShares was not specified");
hostConfig.withCpuShares(cpuShares);
return this;
}
@Override
public CreateContainerCmd withDevices(Device... devices) {
checkNotNull(devices, "devices was not specified");
this.hostConfig.withDevices(devices);
return this;
}
@Override
public CreateContainerCmd withDevices(List<Device> devices) {
checkNotNull(devices, "devices was not specified");
return withDevices(devices.toArray(new Device[devices.size()]));
}
@Override
public CreateContainerCmd withDns(String... dns) {
checkNotNull(dns, "dns was not specified");
this.hostConfig.withDns(dns);
return this;
}
@Override
public CreateContainerCmd withDns(List<String> dns) {
checkNotNull(dns, "dns was not specified");
return withDns(dns.toArray(new String[dns.size()]));
}
@Override
public CreateContainerCmd withDnsSearch(String... dnsSearch) {
checkNotNull(dnsSearch, "dnsSearch was not specified");
this.hostConfig.withDnsSearch(dnsSearch);
return this;
}
@Override
public CreateContainerCmd withDnsSearch(List<String> dnsSearch) {
checkNotNull(dnsSearch, "dnsSearch was not specified");
return withDnsSearch(dnsSearch.toArray(new String[0]));
}
@Override
public CreateContainerCmd withDomainName(String domainName) {
checkNotNull(domainName, "no domainName was specified");
this.domainName = domainName;
return this;
}
@Override
public CreateContainerCmd withEntrypoint(String... entrypoint) {
checkNotNull(entrypoint, "entrypoint was not specified");
this.entrypoint = entrypoint;
return this;
}
@Override
public CreateContainerCmd withEntrypoint(List<String> entrypoint) {
checkNotNull(entrypoint, "entrypoint was not specified");
return withEntrypoint(entrypoint.toArray(new String[entrypoint.size()]));
}
@Override
public CreateContainerCmd withEnv(String... env) {
checkNotNull(env, "env was not specified");
this.env = env;
return this;
}
@Override
public CreateContainerCmd withEnv(List<String> env) {
checkNotNull(env, "env was not specified");
return withEnv(env.toArray(new String[env.size()]));
}
@Override
public CreateContainerCmd withExposedPorts(ExposedPort... exposedPorts) {
checkNotNull(exposedPorts, "exposedPorts was not specified");
this.exposedPorts = new ExposedPorts(exposedPorts);
return this;
}
@Override
public CreateContainerCmd withStopSignal(String stopSignal) {
checkNotNull(stopSignal, "stopSignal wasn't specified.");
this.stopSignal = stopSignal;
return this;
}
@Override
public CreateContainerCmd withExposedPorts(List<ExposedPort> exposedPorts) {
checkNotNull(exposedPorts, "exposedPorts was not specified");
return withExposedPorts(exposedPorts.toArray(new ExposedPort[exposedPorts.size()]));
}
@Override
public CreateContainerCmd withExtraHosts(String... extraHosts) {
checkNotNull(extraHosts, "extraHosts was not specified");
this.hostConfig.withExtraHosts(extraHosts);
return this;
}
@Override
public CreateContainerCmd withExtraHosts(List<String> extraHosts) {
checkNotNull(extraHosts, "extraHosts was not specified");
return withExtraHosts(extraHosts.toArray(new String[extraHosts.size()]));
}
@Override
public CreateContainerCmd withHostName(String hostName) {
checkNotNull(hostConfig, "no hostName was specified");
this.hostName = hostName;
return this;
}
@Override
public CreateContainerCmd withImage(String image) {
checkNotNull(image, "no image was specified");
this.image = image;
return this;
}
@Override
public CreateContainerCmd withIpv4Address(String ipv4Address) {
checkNotNull(ipv4Address, "no ipv4Address was specified");
this.ipv4Address = ipv4Address;
return this;
}
@Override
public CreateContainerCmd withIpv6Address(String ipv6Address) {
checkNotNull(ipv6Address, "no ipv6Address was specified");
this.ipv6Address = ipv6Address;
return this;
}
@Override
public CreateContainerCmd withLabels(Map<String, String> labels) {
checkNotNull(labels, "labels was not specified");
this.labels = labels;
return this;
}
@Override
public CreateContainerCmd withLinks(Link... links) {
checkNotNull(links, "links was not specified");
this.hostConfig.setLinks(links);
return this;
}
@Override
public CreateContainerCmd withLinks(List<Link> links) {
checkNotNull(links, "links was not specified");
return withLinks(links.toArray(new Link[links.size()]));
}
@Override
public CreateContainerCmd withLxcConf(LxcConf... lxcConf) {
checkNotNull(lxcConf, "lxcConf was not specified");
this.hostConfig.withLxcConf(lxcConf);
return this;
}
@Override
public CreateContainerCmd withLxcConf(List<LxcConf> lxcConf) {
checkNotNull(lxcConf, "lxcConf was not specified");
return withLxcConf(lxcConf.toArray(new LxcConf[0]));
}
@Override
public CreateContainerCmd withLogConfig(LogConfig logConfig) {
checkNotNull(logConfig, "logConfig was not specified");
this.hostConfig.withLogConfig(logConfig);
return this;
}
@Override
public CreateContainerCmd withMacAddress(String macAddress) {
checkNotNull(macAddress, "macAddress was not specified");
this.macAddress = macAddress;
return this;
}
@Override
public CreateContainerCmd withMemory(Long memory) {
checkNotNull(memory, "memory was not specified");
hostConfig.withMemory(memory);
return this;
}
@Override
public CreateContainerCmd withMemorySwap(Long memorySwap) {
checkNotNull(memorySwap, "memorySwap was not specified");
hostConfig.withMemorySwap(memorySwap);
return this;
}
@Override
public CreateContainerCmd withName(String name) {
checkNotNull(name, "name was not specified");
this.name = name;
return this;
}
@Override
public CreateContainerCmd withNetworkDisabled(Boolean disableNetwork) {
checkNotNull(disableNetwork, "disableNetwork was not specified");
this.networkDisabled = disableNetwork;
return this;
}
@Override
public CreateContainerCmd withNetworkMode(String networkMode) {
checkNotNull(networkMode, "networkMode was not specified");
this.hostConfig.withNetworkMode(networkMode);
return this;
}
@Override
public CreateContainerCmd withOomKillDisable(Boolean oomKillDisable) {
checkNotNull(oomKillDisable, "oomKillDisable was not specified");
hostConfig.withOomKillDisable(oomKillDisable);
return this;
}
@Override
public CreateContainerCmd withPortBindings(PortBinding... portBindings) {
checkNotNull(portBindings, "portBindings was not specified");
this.hostConfig.withPortBindings(new Ports(portBindings));
return this;
}
@Override
public CreateContainerCmd withPortBindings(List<PortBinding> portBindings) {
checkNotNull(portBindings, "portBindings was not specified");
return withPortBindings(portBindings.toArray(new PortBinding[0]));
}
@Override
public CreateContainerCmd withPortBindings(Ports portBindings) {
checkNotNull(portBindings, "portBindings was not specified");
this.hostConfig.withPortBindings(portBindings);
return this;
}
@Override
public CreateContainerCmd withPortSpecs(String... portSpecs) {
checkNotNull(portSpecs, "portSpecs was not specified");
this.portSpecs = portSpecs;
return this;
}
@Override
public CreateContainerCmd withPortSpecs(List<String> portSpecs) {
checkNotNull(portSpecs, "portSpecs was not specified");
return withPortSpecs(portSpecs.toArray(new String[portSpecs.size()]));
}
@Override
public CreateContainerCmd withPrivileged(Boolean privileged) {
checkNotNull(privileged, "no privileged was specified");
this.hostConfig.withPrivileged(privileged);
return this;
}
@Override
public CreateContainerCmd withPublishAllPorts(Boolean publishAllPorts) {
checkNotNull(publishAllPorts, "no publishAllPorts was specified");
this.hostConfig.withPublishAllPorts(publishAllPorts);
return this;
}
@Override
public CreateContainerCmd withReadonlyRootfs(Boolean readonlyRootfs) {
checkNotNull(readonlyRootfs, "no readonlyRootfs was specified");
hostConfig.withReadonlyRootfs(readonlyRootfs);
return this;
}
@Override
public CreateContainerCmd withRestartPolicy(RestartPolicy restartPolicy) {
checkNotNull(restartPolicy, "restartPolicy was not specified");
this.hostConfig.withRestartPolicy(restartPolicy);
return this;
}
@Override
public CreateContainerCmd withStdInOnce(Boolean stdInOnce) {
checkNotNull(stdInOnce, "no stdInOnce was specified");
this.stdInOnce = stdInOnce;
return this;
}
@Override
public CreateContainerCmd withStdinOpen(Boolean stdinOpen) {
checkNotNull(stdinOpen, "no stdinOpen was specified");
this.stdinOpen = stdinOpen;
return this;
}
@Override
public CreateContainerCmd withTty(Boolean tty) {
checkNotNull(tty, "no tty was specified");
this.tty = tty;
return this;
}
@Override
public CreateContainerCmd withUlimits(Ulimit... ulimits) {
checkNotNull(ulimits, "no ulimits was specified");
hostConfig.withUlimits(ulimits);
return this;
}
@Override
public CreateContainerCmd withUlimits(List<Ulimit> ulimits) {
checkNotNull(ulimits, "no ulimits was specified");
return withUlimits(ulimits.toArray(new Ulimit[ulimits.size()]));
}
@Override
public CreateContainerCmd withUser(String user) {
checkNotNull(user, "user was not specified");
this.user = user;
return this;
}
@Override
public CreateContainerCmd withVolumes(Volume... volumes) {
checkNotNull(volumes, "volumes was not specified");
this.volumes = new Volumes(volumes);
return this;
}
@Override
public CreateContainerCmd withVolumes(List<Volume> volumes) {
checkNotNull(volumes, "volumes was not specified");
return withVolumes(volumes.toArray(new Volume[volumes.size()]));
}
@Override
public CreateContainerCmd withVolumesFrom(VolumesFrom... volumesFrom) {
checkNotNull(volumesFrom, "volumesFrom was not specified");
this.hostConfig.withVolumesFrom(volumesFrom);
return this;
}
@Override
public CreateContainerCmd withVolumesFrom(List<VolumesFrom> volumesFrom) {
checkNotNull(volumesFrom, "volumesFrom was not specified");
return withVolumesFrom(volumesFrom.toArray(new VolumesFrom[volumesFrom.size()]));
}
@Override
public CreateContainerCmd withWorkingDir(String workingDir) {
checkNotNull(workingDir, "workingDir was not specified");
this.workingDir = workingDir;
return this;
}
@Override
public CreateContainerCmd withCgroupParent(final String cgroupParent) {
checkNotNull(cgroupParent, "cgroupParent was not specified");
this.hostConfig.withCgroupParent(cgroupParent);
return this;
}
@Override
public CreateContainerCmd withPidMode(String pidMode) {
checkNotNull(pidMode, "pidMode was not specified");
this.hostConfig.withPidMode(pidMode);
return this;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
@Override
public boolean equals(Object o) {
return EqualsBuilder.reflectionEquals(this, o);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
public static class NetworkingConfig {
@JsonProperty("EndpointsConfig")
public Map<String, ContainerNetwork> endpointsConfig;
public Map<String, ContainerNetwork> getEndpointsConfig() {
return endpointsConfig;
}
public NetworkingConfig withEndpointsConfig(Map<String, ContainerNetwork> endpointsConfig) {
this.endpointsConfig = endpointsConfig;
return this;
}
}
}
| {
"content_hash": "9790f38c178aa3b2284bd04d637d687f",
"timestamp": "",
"source": "github",
"line_count": 1007,
"max_line_length": 114,
"avg_line_length": 27.46573982125124,
"alnum_prop": 0.6676187721454914,
"repo_name": "llamahunter/docker-java",
"id": "0b6944b046dda52c3a58a35fa8bf03d30a6a0f5b",
"size": "27658",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/github/dockerjava/core/command/CreateContainerCmdImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1335481"
},
{
"name": "Shell",
"bytes": "2953"
}
],
"symlink_target": ""
} |
require 'abstract_unit'
require 'pp'
module ModuleWithMissing
mattr_accessor :missing_count
def self.const_missing(name)
self.missing_count += 1
name
end
end
module ModuleWithConstant
InheritedConstant = "Hello"
end
class DependenciesTest < Test::Unit::TestCase
def teardown
ActiveSupport::Dependencies.clear
end
def with_loading(*from)
old_mechanism, ActiveSupport::Dependencies.mechanism = ActiveSupport::Dependencies.mechanism, :load
dir = File.dirname(__FILE__)
prior_load_paths = ActiveSupport::Dependencies.load_paths
ActiveSupport::Dependencies.load_paths = from.collect { |f| "#{dir}/#{f}" }
yield
ensure
ActiveSupport::Dependencies.load_paths = prior_load_paths
ActiveSupport::Dependencies.mechanism = old_mechanism
ActiveSupport::Dependencies.explicitly_unloadable_constants = []
end
def test_tracking_loaded_files
require_dependency 'dependencies/service_one'
require_dependency 'dependencies/service_two'
assert_equal 2, ActiveSupport::Dependencies.loaded.size
end
def test_tracking_identical_loaded_files
require_dependency 'dependencies/service_one'
require_dependency 'dependencies/service_one'
assert_equal 1, ActiveSupport::Dependencies.loaded.size
end
def test_missing_dependency_raises_missing_source_file
assert_raises(MissingSourceFile) { require_dependency("missing_service") }
end
def test_missing_association_raises_nothing
assert_nothing_raised { require_association("missing_model") }
end
def test_dependency_which_raises_exception_isnt_added_to_loaded_set
with_loading do
filename = 'dependencies/raises_exception'
$raises_exception_load_count = 0
5.times do |count|
begin
require_dependency filename
flunk 'should have loaded dependencies/raises_exception which raises an exception'
rescue Exception => e
assert_equal 'Loading me failed, so do not add to loaded or history.', e.message
end
assert_equal count + 1, $raises_exception_load_count
assert !ActiveSupport::Dependencies.loaded.include?(filename)
assert !ActiveSupport::Dependencies.history.include?(filename)
end
end
end
def test_warnings_should_be_enabled_on_first_load
with_loading 'dependencies' do
old_warnings, ActiveSupport::Dependencies.warnings_on_first_load = ActiveSupport::Dependencies.warnings_on_first_load, true
filename = "check_warnings"
expanded = File.expand_path("test/dependencies/#{filename}")
$check_warnings_load_count = 0
assert !ActiveSupport::Dependencies.loaded.include?(expanded)
assert !ActiveSupport::Dependencies.history.include?(expanded)
silence_warnings { require_dependency filename }
assert_equal 1, $check_warnings_load_count
assert_equal true, $checked_verbose, 'On first load warnings should be enabled.'
assert ActiveSupport::Dependencies.loaded.include?(expanded)
ActiveSupport::Dependencies.clear
assert !ActiveSupport::Dependencies.loaded.include?(expanded)
assert ActiveSupport::Dependencies.history.include?(expanded)
silence_warnings { require_dependency filename }
assert_equal 2, $check_warnings_load_count
assert_equal nil, $checked_verbose, 'After first load warnings should be left alone.'
assert ActiveSupport::Dependencies.loaded.include?(expanded)
ActiveSupport::Dependencies.clear
assert !ActiveSupport::Dependencies.loaded.include?(expanded)
assert ActiveSupport::Dependencies.history.include?(expanded)
enable_warnings { require_dependency filename }
assert_equal 3, $check_warnings_load_count
assert_equal true, $checked_verbose, 'After first load warnings should be left alone.'
assert ActiveSupport::Dependencies.loaded.include?(expanded)
end
end
def test_mutual_dependencies_dont_infinite_loop
with_loading 'dependencies' do
$mutual_dependencies_count = 0
assert_nothing_raised { require_dependency 'mutual_one' }
assert_equal 2, $mutual_dependencies_count
ActiveSupport::Dependencies.clear
$mutual_dependencies_count = 0
assert_nothing_raised { require_dependency 'mutual_two' }
assert_equal 2, $mutual_dependencies_count
end
end
def test_as_load_path
assert_equal '', DependenciesTest.as_load_path
end
def test_module_loading
with_loading 'autoloading_fixtures' do
assert_kind_of Module, A
assert_kind_of Class, A::B
assert_kind_of Class, A::C::D
assert_kind_of Class, A::C::E::F
end
end
def test_non_existing_const_raises_name_error
with_loading 'autoloading_fixtures' do
assert_raises(NameError) { DoesNotExist }
assert_raises(NameError) { NoModule::DoesNotExist }
assert_raises(NameError) { A::DoesNotExist }
assert_raises(NameError) { A::B::DoesNotExist }
end
end
def test_directories_manifest_as_modules_unless_const_defined
with_loading 'autoloading_fixtures' do
assert_kind_of Module, ModuleFolder
Object.send! :remove_const, :ModuleFolder
end
end
def test_module_with_nested_class
with_loading 'autoloading_fixtures' do
assert_kind_of Class, ModuleFolder::NestedClass
Object.send! :remove_const, :ModuleFolder
end
end
def test_module_with_nested_inline_class
with_loading 'autoloading_fixtures' do
assert_kind_of Class, ModuleFolder::InlineClass
Object.send! :remove_const, :ModuleFolder
end
end
def test_directories_may_manifest_as_nested_classes
with_loading 'autoloading_fixtures' do
assert_kind_of Class, ClassFolder
Object.send! :remove_const, :ClassFolder
end
end
def test_class_with_nested_class
with_loading 'autoloading_fixtures' do
assert_kind_of Class, ClassFolder::NestedClass
Object.send! :remove_const, :ClassFolder
end
end
def test_class_with_nested_inline_class
with_loading 'autoloading_fixtures' do
assert_kind_of Class, ClassFolder::InlineClass
Object.send! :remove_const, :ClassFolder
end
end
def test_class_with_nested_inline_subclass_of_parent
with_loading 'autoloading_fixtures' do
assert_kind_of Class, ClassFolder::ClassFolderSubclass
assert_kind_of Class, ClassFolder
assert_equal 'indeed', ClassFolder::ClassFolderSubclass::ConstantInClassFolder
Object.send! :remove_const, :ClassFolder
end
end
def test_nested_class_can_access_sibling
with_loading 'autoloading_fixtures' do
sibling = ModuleFolder::NestedClass.class_eval "NestedSibling"
assert defined?(ModuleFolder::NestedSibling)
assert_equal ModuleFolder::NestedSibling, sibling
Object.send! :remove_const, :ModuleFolder
end
end
def failing_test_access_thru_and_upwards_fails
with_loading 'autoloading_fixtures' do
assert ! defined?(ModuleFolder)
assert_raises(NameError) { ModuleFolder::Object }
assert_raises(NameError) { ModuleFolder::NestedClass::Object }
Object.send! :remove_const, :ModuleFolder
end
end
def test_non_existing_const_raises_name_error_with_fully_qualified_name
with_loading 'autoloading_fixtures' do
begin
A::DoesNotExist.nil?
flunk "No raise!!"
rescue NameError => e
assert_equal "uninitialized constant A::DoesNotExist", e.message
end
begin
A::B::DoesNotExist.nil?
flunk "No raise!!"
rescue NameError => e
assert_equal "uninitialized constant A::B::DoesNotExist", e.message
end
end
end
def test_smart_name_error_strings
begin
Object.module_eval "ImaginaryObject"
flunk "No raise!!"
rescue NameError => e
assert e.message.include?("uninitialized constant ImaginaryObject")
end
end
def test_loadable_constants_for_path_should_handle_empty_autoloads
assert_equal [], ActiveSupport::Dependencies.loadable_constants_for_path('hello')
end
def test_loadable_constants_for_path_should_handle_relative_paths
fake_root = 'dependencies'
relative_root = File.dirname(__FILE__) + '/dependencies'
['', '/'].each do |suffix|
with_loading fake_root + suffix do
assert_equal ["A::B"], ActiveSupport::Dependencies.loadable_constants_for_path(relative_root + '/a/b')
end
end
end
def test_loadable_constants_for_path_should_provide_all_results
fake_root = '/usr/apps/backpack'
with_loading fake_root, fake_root + '/lib' do
root = ActiveSupport::Dependencies.load_paths.first
assert_equal ["Lib::A::B", "A::B"], ActiveSupport::Dependencies.loadable_constants_for_path(root + '/lib/a/b')
end
end
def test_loadable_constants_for_path_should_uniq_results
fake_root = '/usr/apps/backpack/lib'
with_loading fake_root, fake_root + '/' do
root = ActiveSupport::Dependencies.load_paths.first
assert_equal ["A::B"], ActiveSupport::Dependencies.loadable_constants_for_path(root + '/a/b')
end
end
def test_loadable_constants_with_load_path_without_trailing_slash
path = File.dirname(__FILE__) + '/autoloading_fixtures/class_folder/inline_class.rb'
with_loading 'autoloading_fixtures/class/' do
assert_equal [], ActiveSupport::Dependencies.loadable_constants_for_path(path)
end
end
def test_qualified_const_defined
assert ActiveSupport::Dependencies.qualified_const_defined?("Object")
assert ActiveSupport::Dependencies.qualified_const_defined?("::Object")
assert ActiveSupport::Dependencies.qualified_const_defined?("::Object::Kernel")
assert ActiveSupport::Dependencies.qualified_const_defined?("::Object::Dependencies")
assert ActiveSupport::Dependencies.qualified_const_defined?("::Test::Unit::TestCase")
end
def test_qualified_const_defined_should_not_call_method_missing
ModuleWithMissing.missing_count = 0
assert ! ActiveSupport::Dependencies.qualified_const_defined?("ModuleWithMissing::A")
assert_equal 0, ModuleWithMissing.missing_count
assert ! ActiveSupport::Dependencies.qualified_const_defined?("ModuleWithMissing::A::B")
assert_equal 0, ModuleWithMissing.missing_count
end
def test_autoloaded?
with_loading 'autoloading_fixtures' do
assert ! ActiveSupport::Dependencies.autoloaded?("ModuleFolder")
assert ! ActiveSupport::Dependencies.autoloaded?("ModuleFolder::NestedClass")
assert ActiveSupport::Dependencies.autoloaded?(ModuleFolder)
assert ActiveSupport::Dependencies.autoloaded?("ModuleFolder")
assert ! ActiveSupport::Dependencies.autoloaded?("ModuleFolder::NestedClass")
assert ActiveSupport::Dependencies.autoloaded?(ModuleFolder::NestedClass)
assert ActiveSupport::Dependencies.autoloaded?("ModuleFolder")
assert ActiveSupport::Dependencies.autoloaded?("ModuleFolder::NestedClass")
assert ActiveSupport::Dependencies.autoloaded?("::ModuleFolder")
assert ActiveSupport::Dependencies.autoloaded?(:ModuleFolder)
# Anonymous modules aren't autoloaded.
assert !ActiveSupport::Dependencies.autoloaded?(Module.new)
nil_name = Module.new
def nil_name.name() nil end
assert !ActiveSupport::Dependencies.autoloaded?(nil_name)
Object.class_eval { remove_const :ModuleFolder }
end
end
def test_qualified_name_for
assert_equal "A", ActiveSupport::Dependencies.qualified_name_for(Object, :A)
assert_equal "A", ActiveSupport::Dependencies.qualified_name_for(:Object, :A)
assert_equal "A", ActiveSupport::Dependencies.qualified_name_for("Object", :A)
assert_equal "A", ActiveSupport::Dependencies.qualified_name_for("::Object", :A)
assert_equal "A", ActiveSupport::Dependencies.qualified_name_for("::Kernel", :A)
assert_equal "ActiveSupport::Dependencies::A", ActiveSupport::Dependencies.qualified_name_for(:'ActiveSupport::Dependencies', :A)
assert_equal "ActiveSupport::Dependencies::A", ActiveSupport::Dependencies.qualified_name_for(ActiveSupport::Dependencies, :A)
end
def test_file_search
with_loading 'dependencies' do
root = ActiveSupport::Dependencies.load_paths.first
assert_equal nil, ActiveSupport::Dependencies.search_for_file('service_three')
assert_equal nil, ActiveSupport::Dependencies.search_for_file('service_three.rb')
assert_equal root + '/service_one.rb', ActiveSupport::Dependencies.search_for_file('service_one')
assert_equal root + '/service_one.rb', ActiveSupport::Dependencies.search_for_file('service_one.rb')
end
end
def test_file_search_uses_first_in_load_path
with_loading 'dependencies', 'autoloading_fixtures' do
deps, autoload = ActiveSupport::Dependencies.load_paths
assert_match %r/dependencies/, deps
assert_match %r/autoloading_fixtures/, autoload
assert_equal deps + '/conflict.rb', ActiveSupport::Dependencies.search_for_file('conflict')
end
with_loading 'autoloading_fixtures', 'dependencies' do
autoload, deps = ActiveSupport::Dependencies.load_paths
assert_match %r/dependencies/, deps
assert_match %r/autoloading_fixtures/, autoload
assert_equal autoload + '/conflict.rb', ActiveSupport::Dependencies.search_for_file('conflict')
end
end
def test_custom_const_missing_should_work
Object.module_eval <<-end_eval
module ModuleWithCustomConstMissing
def self.const_missing(name)
const_set name, name.to_s.hash
end
module A
end
end
end_eval
with_loading 'autoloading_fixtures' do
assert_kind_of Integer, ::ModuleWithCustomConstMissing::B
assert_kind_of Module, ::ModuleWithCustomConstMissing::A
assert_kind_of String, ::ModuleWithCustomConstMissing::A::B
end
end
def test_const_missing_should_not_double_load
$counting_loaded_times = 0
with_loading 'autoloading_fixtures' do
require_dependency '././counting_loader'
assert_equal 1, $counting_loaded_times
assert_raises(ArgumentError) { ActiveSupport::Dependencies.load_missing_constant Object, :CountingLoader }
assert_equal 1, $counting_loaded_times
end
end
def test_const_missing_within_anonymous_module
$counting_loaded_times = 0
m = Module.new
m.module_eval "def a() CountingLoader; end"
extend m
kls = nil
with_loading 'autoloading_fixtures' do
kls = nil
assert_nothing_raised { kls = a }
assert_equal "CountingLoader", kls.name
assert_equal 1, $counting_loaded_times
assert_nothing_raised { kls = a }
assert_equal 1, $counting_loaded_times
end
end
def test_removal_from_tree_should_be_detected
with_loading 'dependencies' do
root = ActiveSupport::Dependencies.load_paths.first
c = ServiceOne
ActiveSupport::Dependencies.clear
assert ! defined?(ServiceOne)
begin
ActiveSupport::Dependencies.load_missing_constant(c, :FakeMissing)
flunk "Expected exception"
rescue ArgumentError => e
assert_match %r{ServiceOne has been removed from the module tree}i, e.message
end
end
end
def test_nested_load_error_isnt_rescued
with_loading 'dependencies' do
assert_raises(MissingSourceFile) do
RequiresNonexistent1
end
end
end
def test_load_once_paths_do_not_add_to_autoloaded_constants
with_loading 'autoloading_fixtures' do
ActiveSupport::Dependencies.load_once_paths = ActiveSupport::Dependencies.load_paths.dup
assert ! ActiveSupport::Dependencies.autoloaded?("ModuleFolder")
assert ! ActiveSupport::Dependencies.autoloaded?("ModuleFolder::NestedClass")
assert ! ActiveSupport::Dependencies.autoloaded?(ModuleFolder)
1 if ModuleFolder::NestedClass # 1 if to avoid warning
assert ! ActiveSupport::Dependencies.autoloaded?(ModuleFolder::NestedClass)
end
ensure
Object.class_eval { remove_const :ModuleFolder }
ActiveSupport::Dependencies.load_once_paths = []
end
def test_application_should_special_case_application_controller
with_loading 'autoloading_fixtures' do
require_dependency 'application'
assert_equal 10, ApplicationController
assert ActiveSupport::Dependencies.autoloaded?(:ApplicationController)
end
end
def test_const_missing_on_kernel_should_fallback_to_object
with_loading 'autoloading_fixtures' do
kls = Kernel::E
assert_equal "E", kls.name
assert_equal kls.object_id, Kernel::E.object_id
end
end
def test_preexisting_constants_are_not_marked_as_autoloaded
with_loading 'autoloading_fixtures' do
require_dependency 'e'
assert ActiveSupport::Dependencies.autoloaded?(:E)
ActiveSupport::Dependencies.clear
end
Object.const_set :E, Class.new
with_loading 'autoloading_fixtures' do
require_dependency 'e'
assert ! ActiveSupport::Dependencies.autoloaded?(:E), "E shouldn't be marked autoloaded!"
ActiveSupport::Dependencies.clear
end
ensure
Object.class_eval { remove_const :E }
end
def test_unloadable
with_loading 'autoloading_fixtures' do
Object.const_set :M, Module.new
M.unloadable
ActiveSupport::Dependencies.clear
assert ! defined?(M)
Object.const_set :M, Module.new
ActiveSupport::Dependencies.clear
assert ! defined?(M), "Dependencies should unload unloadable constants each time"
end
end
def test_unloadable_should_fail_with_anonymous_modules
with_loading 'autoloading_fixtures' do
m = Module.new
assert_raises(ArgumentError) { m.unloadable }
end
end
def test_unloadable_should_return_change_flag
with_loading 'autoloading_fixtures' do
Object.const_set :M, Module.new
assert_equal true, M.unloadable
assert_equal false, M.unloadable
end
end
def test_new_contants_in_without_constants
assert_equal [], (ActiveSupport::Dependencies.new_constants_in(Object) { })
assert ActiveSupport::Dependencies.constant_watch_stack.empty?
end
def test_new_constants_in_with_a_single_constant
assert_equal ["Hello"], ActiveSupport::Dependencies.new_constants_in(Object) {
Object.const_set :Hello, 10
}.map(&:to_s)
assert ActiveSupport::Dependencies.constant_watch_stack.empty?
ensure
Object.class_eval { remove_const :Hello }
end
def test_new_constants_in_with_nesting
outer = ActiveSupport::Dependencies.new_constants_in(Object) do
Object.const_set :OuterBefore, 10
assert_equal ["Inner"], ActiveSupport::Dependencies.new_constants_in(Object) {
Object.const_set :Inner, 20
}.map(&:to_s)
Object.const_set :OuterAfter, 30
end
assert_equal ["OuterAfter", "OuterBefore"], outer.sort.map(&:to_s)
assert ActiveSupport::Dependencies.constant_watch_stack.empty?
ensure
%w(OuterBefore Inner OuterAfter).each do |name|
Object.class_eval { remove_const name if const_defined?(name) }
end
end
def test_new_constants_in_module
Object.const_set :M, Module.new
outer = ActiveSupport::Dependencies.new_constants_in(M) do
M.const_set :OuterBefore, 10
inner = ActiveSupport::Dependencies.new_constants_in(M) do
M.const_set :Inner, 20
end
assert_equal ["M::Inner"], inner
M.const_set :OuterAfter, 30
end
assert_equal ["M::OuterAfter", "M::OuterBefore"], outer.sort
assert ActiveSupport::Dependencies.constant_watch_stack.empty?
ensure
Object.class_eval { remove_const :M }
end
def test_new_constants_in_module_using_name
outer = ActiveSupport::Dependencies.new_constants_in(:M) do
Object.const_set :M, Module.new
M.const_set :OuterBefore, 10
inner = ActiveSupport::Dependencies.new_constants_in(:M) do
M.const_set :Inner, 20
end
assert_equal ["M::Inner"], inner
M.const_set :OuterAfter, 30
end
assert_equal ["M::OuterAfter", "M::OuterBefore"], outer.sort
assert ActiveSupport::Dependencies.constant_watch_stack.empty?
ensure
Object.class_eval { remove_const :M }
end
def test_new_constants_in_with_inherited_constants
m = ActiveSupport::Dependencies.new_constants_in(:Object) do
Object.class_eval { include ModuleWithConstant }
end
assert_equal [], m
end
def test_new_constants_in_with_illegal_module_name_raises_correct_error
assert_raises(NameError) do
ActiveSupport::Dependencies.new_constants_in("Illegal-Name") {}
end
end
def test_file_with_multiple_constants_and_require_dependency
with_loading 'autoloading_fixtures' do
assert ! defined?(MultipleConstantFile)
assert ! defined?(SiblingConstant)
require_dependency 'multiple_constant_file'
assert defined?(MultipleConstantFile)
assert defined?(SiblingConstant)
assert ActiveSupport::Dependencies.autoloaded?(:MultipleConstantFile)
assert ActiveSupport::Dependencies.autoloaded?(:SiblingConstant)
ActiveSupport::Dependencies.clear
assert ! defined?(MultipleConstantFile)
assert ! defined?(SiblingConstant)
end
end
def test_file_with_multiple_constants_and_auto_loading
with_loading 'autoloading_fixtures' do
assert ! defined?(MultipleConstantFile)
assert ! defined?(SiblingConstant)
assert_equal 10, MultipleConstantFile
assert defined?(MultipleConstantFile)
assert defined?(SiblingConstant)
assert ActiveSupport::Dependencies.autoloaded?(:MultipleConstantFile)
assert ActiveSupport::Dependencies.autoloaded?(:SiblingConstant)
ActiveSupport::Dependencies.clear
assert ! defined?(MultipleConstantFile)
assert ! defined?(SiblingConstant)
end
end
def test_nested_file_with_multiple_constants_and_require_dependency
with_loading 'autoloading_fixtures' do
assert ! defined?(ClassFolder::NestedClass)
assert ! defined?(ClassFolder::SiblingClass)
require_dependency 'class_folder/nested_class'
assert defined?(ClassFolder::NestedClass)
assert defined?(ClassFolder::SiblingClass)
assert ActiveSupport::Dependencies.autoloaded?("ClassFolder::NestedClass")
assert ActiveSupport::Dependencies.autoloaded?("ClassFolder::SiblingClass")
ActiveSupport::Dependencies.clear
assert ! defined?(ClassFolder::NestedClass)
assert ! defined?(ClassFolder::SiblingClass)
end
end
def test_nested_file_with_multiple_constants_and_auto_loading
with_loading 'autoloading_fixtures' do
assert ! defined?(ClassFolder::NestedClass)
assert ! defined?(ClassFolder::SiblingClass)
assert_kind_of Class, ClassFolder::NestedClass
assert defined?(ClassFolder::NestedClass)
assert defined?(ClassFolder::SiblingClass)
assert ActiveSupport::Dependencies.autoloaded?("ClassFolder::NestedClass")
assert ActiveSupport::Dependencies.autoloaded?("ClassFolder::SiblingClass")
ActiveSupport::Dependencies.clear
assert ! defined?(ClassFolder::NestedClass)
assert ! defined?(ClassFolder::SiblingClass)
end
end
def test_autoload_doesnt_shadow_no_method_error_with_relative_constant
with_loading 'autoloading_fixtures' do
assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it hasn't been referenced yet!"
2.times do
assert_raise(NoMethodError) { RaisesNoMethodError }
assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it should have failed!"
end
end
ensure
Object.class_eval { remove_const :RaisesNoMethodError if const_defined?(:RaisesNoMethodError) }
end
def test_autoload_doesnt_shadow_no_method_error_with_absolute_constant
with_loading 'autoloading_fixtures' do
assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it hasn't been referenced yet!"
2.times do
assert_raise(NoMethodError) { ::RaisesNoMethodError }
assert !defined?(::RaisesNoMethodError), "::RaisesNoMethodError is defined but it should have failed!"
end
end
ensure
Object.class_eval { remove_const :RaisesNoMethodError if const_defined?(:RaisesNoMethodError) }
end
def test_autoload_doesnt_shadow_error_when_mechanism_not_set_to_load
with_loading 'autoloading_fixtures' do
ActiveSupport::Dependencies.mechanism = :require
2.times do
assert_raise(NameError) {"RaisesNameError".constantize}
end
end
end
def test_autoload_doesnt_shadow_name_error
with_loading 'autoloading_fixtures' do
assert !defined?(::RaisesNameError), "::RaisesNameError is defined but it hasn't been referenced yet!"
2.times do
begin
::RaisesNameError.object_id
flunk 'should have raised NameError when autoloaded file referenced FooBarBaz'
rescue NameError => e
assert_equal 'uninitialized constant RaisesNameError::FooBarBaz', e.message
end
assert !defined?(::RaisesNameError), "::RaisesNameError is defined but it should have failed!"
end
assert !defined?(RaisesNameError)
2.times do
assert_raise(NameError) { RaisesNameError }
assert !defined?(::RaisesNameError), "::RaisesNameError is defined but it should have failed!"
end
end
ensure
Object.class_eval { remove_const :RaisesNoMethodError if const_defined?(:RaisesNoMethodError) }
end
def test_remove_constant_handles_double_colon_at_start
Object.const_set 'DeleteMe', Module.new
DeleteMe.const_set 'OrMe', Module.new
ActiveSupport::Dependencies.remove_constant "::DeleteMe::OrMe"
assert ! defined?(DeleteMe::OrMe)
assert defined?(DeleteMe)
ActiveSupport::Dependencies.remove_constant "::DeleteMe"
assert ! defined?(DeleteMe)
end
def test_load_once_constants_should_not_be_unloaded
with_loading 'autoloading_fixtures' do
ActiveSupport::Dependencies.load_once_paths = ActiveSupport::Dependencies.load_paths
::A.to_s
assert defined?(A)
ActiveSupport::Dependencies.clear
assert defined?(A)
end
ensure
ActiveSupport::Dependencies.load_once_paths = []
Object.class_eval { remove_const :A if const_defined?(:A) }
end
def test_load_once_paths_should_behave_when_recursively_loading
with_loading 'dependencies', 'autoloading_fixtures' do
ActiveSupport::Dependencies.load_once_paths = [ActiveSupport::Dependencies.load_paths.last]
assert !defined?(CrossSiteDependency)
assert_nothing_raised { CrossSiteDepender.nil? }
assert defined?(CrossSiteDependency)
assert !ActiveSupport::Dependencies.autoloaded?(CrossSiteDependency),
"CrossSiteDependency shouldn't be marked as autoloaded!"
ActiveSupport::Dependencies.clear
assert defined?(CrossSiteDependency),
"CrossSiteDependency shouldn't have been unloaded!"
end
ensure
ActiveSupport::Dependencies.load_once_paths = []
end
def test_hook_called_multiple_times
assert_nothing_raised { ActiveSupport::Dependencies.hook! }
end
def test_unhook
ActiveSupport::Dependencies.unhook!
assert !Module.new.respond_to?(:const_missing_without_dependencies)
assert !Module.new.respond_to?(:load_without_new_constant_marking)
ensure
ActiveSupport::Dependencies.hook!
end
end
| {
"content_hash": "9d7741f2f4bdf24ba6a02451142923b2",
"timestamp": "",
"source": "github",
"line_count": 777,
"max_line_length": 133,
"avg_line_length": 35.34877734877735,
"alnum_prop": 0.7107696788757009,
"repo_name": "marten/opinionated-forum",
"id": "39c9c74c9467b4c07e1bb5821a415a027735b0bb",
"size": "27466",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/rails/activesupport/test/dependencies_test.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "569"
},
{
"name": "Ruby",
"bytes": "35689"
}
],
"symlink_target": ""
} |
package Client; /**
* Created by zhaokuo on 2016/2/24.
*/
import ServerInterface.*;
import ServerInterface.TableInfo;
import javax.swing.*;
import javax.swing.text.html.Option;
import java.net.InetAddress;
public class PlayLogic extends OriginInterface{
/**
* 构造函数
*
* @param inetAddress 服务器地址
* @param port
*/
LoginWindow loginWindow = null;
ChoiceTableWindow choiceTableWindow = null;
RegisterWindow registerWindow = null;
GameWindow gameWindow = null;
private boolean isLogin = false;
public ServerInterface.TableInfo[] tableInfos = null;
public PlayLogic(InetAddress inetAddress, int port) {
super(inetAddress, port);
showLoginWindow();
}
/**
*
* @param ifRegistered
* 是否注册成功
* @param reason 若是注册失败, 则失败的原因
*/
@Override
public void onRespondRegister(boolean ifRegistered, String reason) {
if (ifRegistered){
JOptionPane.showMessageDialog(registerWindow,"注册成功");
showLoginWindow();
hideRegisterWindow();
}
}
/**
* 登录时网络连接失败
* @param reason 失败的原因
*/
@Override
public void onConnectionFail(String reason) {
JOptionPane.showMessageDialog(loginWindow,"网络连接失败!请检查网络后再登录\n错误原因: "+reason);
}
/**
* 游戏进行中网络断开
* @param reason 错误原因
*/
@Override
public void onLostConnection(String reason) {
JOptionPane.showMessageDialog(loginWindow,"网络断开, 退出游戏, 请重新连接\n错误原因: " + reason);
System.exit(0);
}
/**
*
* @param ifLogined
* 是否登陆成功
* @param score
* 玩家的分数
* @param reason
*/
@Override
public void onRespondLogin(boolean ifLogined, int score, String reason) {
//System.out.println(ifLogined + " " + score + " " + reason);
if(!ifLogined){
JOptionPane.showMessageDialog(loginWindow,"登录失败: "+reason);
showLoginWindow();
}
else {
hideLoginWindow();
this.isLogin = ifLogined;
}
}
/**
* 收到桌子信息
* @param tableInfos 桌子信息数组
*/
@Override
public void onRespondGetTables(ServerInterface.TableInfo[] tableInfos) {
if (isLogin){
if (choiceTableWindow != null){
choiceTableWindow.addTable(tableInfos);
}
if (choiceTableWindow == null){
newChoiceTableWindow();
}
}
}
public ServerInterface.TableInfo[] getTable(){
return this.tableInfos;
}
/**
* 接收到是否进入游戏桌信息
* @param tableId
* 游戏桌编号
* @param ifEntered
* 是否进入游戏桌
* @param reason
*/
@Override
public void onRespondEnterTable(int tableId, boolean ifEntered, String reason) {
if (ifEntered){
hideChoiceTableWindow();
showGameWindow(tableId);
}
else {
JOptionPane.showMessageDialog(choiceTableWindow,"进入游戏桌失败: "+reason);
}
}
/**
* @param opponentInfo
* 对手信息
* @param ifMyHandUp
* 自己是否举手
* @param ifOpponentHandUp
* 对手是否举手
* @param isPlaying
* 游戏是否进行中
* @param board
* 棋盘的逻辑数组,1表黑棋,2表白旗,0表空
* @param isBlack
* 自己是否执黑子
* @param isMyTurn
*/
@Override
public void onTableChange(PlayerInfo myInfo,PlayerInfo opponentInfo, boolean ifMyHandUp, boolean ifOpponentHandUp, boolean isPlaying, int[][] board, boolean isBlack, boolean isMyTurn) {
//System.out.println(ifMyHandUp + " "+ ifOpponentHandUp);
gameWindow.resetInfo(myInfo,opponentInfo,ifMyHandUp,ifOpponentHandUp,isPlaying,board,isBlack,isMyTurn);
gameWindow.repaint();
}
/**
* 游戏结果
* @param isDraw
* 是否是平局
* @param ifWin
* 是否是自己赢
* @param ifGiveUp
* 是否是某一方认输
*/
@Override
public void onGameOver(boolean isDraw, boolean ifWin, boolean ifGiveUp) {
StringBuffer str = new StringBuffer();
str.append("游戏结束 : ");
if (isDraw)
str.append("平局.");
else if (ifWin){
if (ifGiveUp)
str.append("对方认输, ");
str.append("我赢了!!!");
}
else {
str.append("我输了...");
}
JOptionPane.showMessageDialog(gameWindow,str);
}
/**
* 当收到请求悔棋响应<br>
* 服务器返回 ON_RESPOND_RETRACT#ifAgree
* @param ifAgree
* 对手是否同意悔棋,若同意,会随后收到onBoardChange
*/
@Override
public void onRespondRetract(boolean ifAgree) {
String str = "同意";
if (!ifAgree)
str = "不同意";
gameWindow.txtChatHis.append("[系统消息]: 对手["+str+"]悔棋请求!\n");
}
/**
* 当收到对手请求悔棋<br>
* 服务器返回 ON_OPPONENT_RETRACT
*/
@Override
public void onOpponentRetract() {
if (JOptionPane.showConfirmDialog(gameWindow,"是否同意悔棋","悔棋",JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION){
this.respondRetract(true);
}
else {
this.respondRetract(false);
}
}
@Override
public void onReceiveMessage(String message) {
gameWindow.txtChatHis.append("对方: " + message + "\n");
}
@Override
public void onRespondQuitTable() {
JOptionPane.showMessageDialog(gameWindow,"你已经退出游戏");
}
/**
* 显示注册窗口
*/
public void showRegisterWindow(){
if (registerWindow == null)
registerWindow = new RegisterWindow(this);
else
registerWindow.setVisible(true);
}
/**
* 隐藏注册窗口
*/
public void hideRegisterWindow(){
if (registerWindow != null)
registerWindow.setVisible(false);
}
/**
* 显示登录窗口
*/
public void showLoginWindow(){
if (loginWindow == null)
loginWindow = new LoginWindow(this);
else
loginWindow.setVisible(true);
}
/**
* 隐藏登录窗口
*/
public void hideLoginWindow(){
// if (loginWindow != null)
// loginWindow.setVisible(false);
loginWindow.dispose();
loginWindow = null;
}
/**
* 显示游戏窗口
*/
public void showGameWindow(int tableNum){
if (gameWindow != null){
gameWindow.dispose();
}
gameWindow = new GameWindow(this);
}
/**
* 隐藏游戏窗口
*/
public void hideGameWindow(){
if (gameWindow != null)
gameWindow.dispose();
}
/**
* 创建大厅窗口
*/
public void newChoiceTableWindow(){
choiceTableWindow = new ChoiceTableWindow(this);
}
/**
* 显示选桌窗口
*/
public void showChoiceTableWindow(){
if (choiceTableWindow == null){
newChoiceTableWindow();
}
else
choiceTableWindow.setVisible(true);
}
/**
* 隐藏选桌窗口
*/
public void hideChoiceTableWindow(){
choiceTableWindow.setVisible(false);
}
}
| {
"content_hash": "b6feb9343ee794cb39b45409f94f9ee7",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 189,
"avg_line_length": 22.832236842105264,
"alnum_prop": 0.5660567641550209,
"repo_name": "JavaAndroidBigProject/WindowsClient",
"id": "1a2996988fc048401689cbb2b4193c8fff8396e5",
"size": "7683",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "WindowsClint/src/Client/PlayLogic.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "63414"
}
],
"symlink_target": ""
} |
<?php
namespace App\Core\Request;
use App\Core\Request\RequestInterface;
class Post implements RequestInterface{
private $post ;
public function __construct(){
$this->post = $_POST;
}
public function get($key, $defaultValue = null, $deep = false){
return isset($this->post[$key]) ? $this->post[$key] : $defaultValue;
}
public function set($key, $value){
if(is_array($key)){
foreach($key as $k=>$v){
$this->post[$k] = $v;
}
return $this;
}
$this->post[$key] = $value;
return $this;
}
public function update($key, $value){
return $this->set($key, $value);
}
public function delete($key){
if(isset($this->post[$key])){
unset($this->post[$key]);
return true;
}else{
return false;
}
}
public function all(){
return $this->post;
}
} | {
"content_hash": "fbf5d3585eec71e92683c18eae18b734",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 76,
"avg_line_length": 21.58695652173913,
"alnum_prop": 0.49244712990936557,
"repo_name": "ahmedali5530/core",
"id": "99085907049f721afac08b09942c8d6abdc74b30",
"size": "993",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Core/Request/Post.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "150"
},
{
"name": "PHP",
"bytes": "85559"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="fa_IR" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Litecoin</source>
<translation>در مورد بیتکویین</translation>
</message>
<message>
<location line="+39"/>
<source><b>Litecoin</b> version</source>
<translation><b>QPSCoin</b> version</translation>
</message>
<message>
<location line="+57"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The Litecoin developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>دفترچه آدرس</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>برای ویرایش آدرس/برچسب دوبار کلیک نمایید</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>یک آدرس جدید بسازید</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>آدرس انتخاب شده را در کلیپ بوردِ سیستم کپی کنید</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>و آدرس جدید</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your Litecoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>و کپی آدرس</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>نشان و کد QR</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a Litecoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation>صدور داده نوار جاری به یک فایل</translation>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified Litecoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>و حذف</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your Litecoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>کپی و برچسب</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>و ویرایش</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>انتقال اطلاعات دفترچه آدرس</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>سی.اس.وی. (فایل جداگانه دستوری)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>صدور پیام خطا</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>قابل کپی در فایل نیست %1</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>برچسب</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>آدرس</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(برچسب ندارد)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>رمز/پَس فرِیز را وارد کنید</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>رمز/پَس فرِیز جدید را وارد کنید</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>رمز/پَس فرِیز را دوباره وارد کنید</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>رمز/پَس فرِیز جدید را در wallet وارد کنید. برای انتخاب رمز/پَس فرِیز از 10 کاراکتر تصادفی یا بیشتر و یا هشت کلمه یا بیشتر استفاده کنید. </translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>wallet را رمزگذاری کنید</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>برای انجام این عملکرد به رمز/پَس فرِیزِwallet نیاز است تا آن را از حالت قفل درآورد.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>باز کردن قفل wallet </translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>برای کشف رمز wallet، به رمز/پَس فرِیزِwallet نیاز است.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>کشف رمز wallet</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>تغییر رمز/پَس فرِیز</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>رمز/پَس فرِیزِ قدیم و جدید را در wallet وارد کنید</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>رمزگذاری wallet را تایید کنید</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR LITECOINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>تایید رمزگذاری</translation>
</message>
<message>
<location line="-56"/>
<source>Litecoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your litecoins from being stolen by malware infecting your computer.</source>
<translation>QPSCoin برای اتمام فرایند رمزگذاری بسته خواهد شد. به خاطر داشته باشید که رمزگذاری WALLET شما، کامپیوتر شما را از آلودگی به بدافزارها مصون نمی دارد.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>رمزگذاری تایید نشد</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>رمزگذاری به علت خطای داخلی تایید نشد. wallet شما رمزگذاری نشد</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>رمزهای/پَس فرِیزهایِ وارد شده با هم تطابق ندارند</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>قفل wallet باز نشد</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>رمزهای/پَس فرِیزهایِ وارد شده wallet برای کشف رمز اشتباه است.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>کشف رمز wallet انجام نشد</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>امضا و پیام</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>به روز رسانی با شبکه...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>و بازبینی</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>نمای کلی از wallet را نشان بده</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>و تراکنش</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>تاریخچه تراکنش را باز کن</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>فهرست آدرسها و برچسبهای ذخیره شده را ویرایش کن</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>فهرست آدرسها را برای دریافت وجه نشان بده</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>خروج</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>از "درخواست نامه"/ application خارج شو</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Litecoin</source>
<translation>اطلاعات در مورد QPSCoin را نشان بده</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>درباره و QT</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>نمایش اطلاعات درباره QT</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>و انتخابها</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>و رمزگذاری wallet</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>و گرفتن نسخه پیشتیبان از wallet</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>تغییر رمز/پَس فرِیز</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-347"/>
<source>Send coins to a Litecoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for Litecoin</source>
<translation>اصلاح انتخابها برای پیکربندی QPSCoin</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>گرفتن نسخه پیشتیبان در آدرسی دیگر</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>رمز مربوط به رمزگذاریِ wallet را تغییر دهید</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>Litecoin</source>
<translation>QPSCoin</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>کیف پول</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>&About Litecoin</source>
<translation>&در مورد بیتکویین</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&نمایش/ عدم نمایش و</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your Litecoin addresses to prove you own them</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified Litecoin addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>و فایل</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>و تنظیمات</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>و راهنما</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>نوار ابزار</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
<message>
<location line="+47"/>
<source>Litecoin client</source>
<translation>مشتری QPSCoin</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to Litecoin network</source>
<translation><numerusform>%n ارتباط فعال به شبکه Litecoin
%n ارتباط فعال به شبکه Litecoin</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+70"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>روزآمد</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>در حال روزآمد سازی..</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>ارسال تراکنش</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>تراکنش دریافتی</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>تاریخ: %1⏎ میزان وجه : %2⏎ نوع: %3⏎ آدرس: %4⏎
</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid Litecoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>wallet رمزگذاری شد و در حال حاضر از حالت قفل در آمده است</translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>wallet رمزگذاری شد و در حال حاضر قفل است</translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. Litecoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>هشدار شبکه</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>ویرایش آدرسها</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>و برچسب</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>برچسب مربوط به این دفترچه آدرس</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>و آدرس</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation>برچسب مربوط به این دفترچه آدرس و تنها ب</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>آدرسِ دریافت کننده جدید</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>آدرس ارسال کننده جدید</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>ویرایش آدرسِ دریافت کننده</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>ویرایش آدرسِ ارسال کننده</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>آدرس وارد شده %1 قبلا به فهرست آدرسها اضافه شده بوده است.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Litecoin address.</source>
<translation>آدرس وارد شده "%1" یک آدرس صحیح برای QPSCoin نسشت</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>عدم توانیی برای قفل گشایی wallet</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>عدم توانیی در ایجاد کلید جدید</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>Litecoin-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>نسخه</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>میزان استفاده:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>انتخاب/آپشن</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start Litecoin after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start Litecoin on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the Litecoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Connect to the Litecoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting Litecoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Whether to show Litecoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>و نمایش آدرسها در فهرست تراکنش</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>و تایید</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>و رد</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>و به کار گرفتن</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>پیش فرض</translation>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Litecoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>فرم</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the Litecoin network after a connection is established, but this process has not completed yet.</source>
<translation>اطلاعات نمایش داده شده ممکن است روزآمد نباشد. wallet شما به صورت خودکار بعد از برقراری اتصال با شبکه QPSCoin به روز می شود اما این فرایند هنوز تکمیل نشده است.</translation>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>مانده حساب:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>تایید نشده</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>کیف پول</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation>تراکنشهای اخیر</translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>مانده حساب جاری</translation>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>تعداد تراکنشهایی که نیاز به تایید دارند و هنوز در مانده حساب جاری شما به حساب نیامده اند</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>خارج از روزآمد سازی</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start litecoin: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>درخواست وجه</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>میزان وجه:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>برچسب:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>پیام:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>و ذخیره با عنوانِ...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>متن وارد شده طولانی است، متنِ برچسب/پیام را کوتاه کنید</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>تصاویر با فرمت PNG
(*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+339"/>
<source>N/A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the Litecoin-Qt help message to get a list with possible Litecoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-104"/>
<source>Litecoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Litecoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the Litecoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the Litecoin RPC console.</source>
<translation>به کنسول آر.پی.سی. QPSCoin خوش آمدید</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>سکه های ارسالی</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>ارسال همزمان به گیرنده های متعدد</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>تمامی فیلدهای تراکنش حذف شوند</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>مانده حساب:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123.456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>تایید عملیات ارسال </translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>و ارسال</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation>%1 به %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>تایید ارسال سکه ها</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>شما مطمئن هستید که می خواهید %1 را ارسال کنید؟</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation>و</translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>میزان پرداخت باید بیشتر از 0 باشد</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>خطا: تراکنش تایید نشد. این خطا ممکن است به این دلیل اتفاق بیافتد که سکه های wallet شما خرج شده باشند مثلا اگر wallet.dat را مپی کرده باشید و سکه های شما در آن کپی استفاده شده باشند اما در اینجا نمایش داده نشده اند.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>فرم</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>و میزان وجه</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>پرداخت و به چه کسی</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>یک برچسب برای این آدرس بنویسید تا به دفترچه آدرسهای شما اضافه شود</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>و برچسب</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>آدرس از فهرست آدرس انتخاب کنید</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt و A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>آدرس را بر کلیپ بورد کپی کنید</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt و P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>این گیرنده را حذف کن</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Litecoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>یک آدرس QPSCoin وارد کنید (مثال Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation>و امضای پیام </translation>
</message>
<message>
<location line="+6"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>یک آدرس QPSCoin وارد کنید (مثال Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>آدرس از فهرست آدرس انتخاب کنید</translation>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt و A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>آدرس را بر کلیپ بورد کپی کنید</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt و P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Litecoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>یک آدرس QPSCoin وارد کنید (مثال Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Litecoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Litecoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>یک آدرس QPSCoin وارد کنید (مثال Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter Litecoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The Litecoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>باز کن تا %1</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1 غیرقابل تایید</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 تاییدها</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>تاریخ</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>برچسب</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>پیام</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>میزان</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>تا به حال با موفقیت انتشار نیافته است</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>ناشناس</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>جزئیات تراکنش</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>این بخش جزئیات تراکنش را نشان می دهد</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>تاریخ</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>نوع</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>آدرس</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>میزان وجه</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>باز کن تا %1</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>برون خطی (%1 تاییدها)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>تایید نشده (%1 از %2 تاییدها)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>تایید شده (%1 تاییدها)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>این block توسط گره های دیگری دریافت نشده است و ممکن است قبول نشود</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>تولید شده اما قبول نشده است</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>قبول با </translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>دریافت شده از</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>ارسال به</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>وجه برای شما </translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>استخراج شده</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>خالی</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>وضعیت تراکنش. با اشاره به این بخش تعداد تاییدها نمایش داده می شود</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>زمان و تاریخی که تراکنش دریافت شده است</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>نوع تراکنش</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>آدرس مقصد در تراکنش</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>میزان وجه کم شده یا اضافه شده به حساب</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>همه</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>امروز</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>این هفته</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>این ماه</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>ماه گذشته</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>این سال</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>حدود..</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>دریافت با</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>ارسال به</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>به شما</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>استخراج شده</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>دیگر</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>آدرس یا برچسب را برای جستجو وارد کنید</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>حداقل میزان وجه</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>آدرس را کپی کنید</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>برچسب را کپی کنید</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>میزان وجه کپی شود</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>برچسب را ویرایش کنید</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>داده های تراکنش را صادر کنید</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Comma separated file (*.csv) فایل جداگانه دستوری</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>تایید شده</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>تاریخ</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>نوع</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>برچسب</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>آدرس</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>میزان</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>شناسه کاربری</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>خطا در ارسال</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>قابل کپی به فایل نیست %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>دامنه:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>به</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation>سکه های ارسالی</translation>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation>صدور داده نوار جاری به یک فایل</translation>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>Litecoin version</source>
<translation>نسخه QPSCoin</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>میزان استفاده:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or litecoind</source>
<translation>ارسال دستور به سرور یا QPSCoined</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>فهرست دستورها</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>درخواست کمک برای یک دستور</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>انتخابها:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: litecoin.conf)</source>
<translation>فایل پیکربندیِ را مشخص کنید (پیش فرض: QPSCoin.conf)</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: litecoind.pid)</source>
<translation>فایل pid را مشخص کنید (پیش فرض: QPSCoind.pid)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>دایرکتوری داده را مشخص کن</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>حافظه بانک داده را به مگابایت تنظیم کنید (پیش فرض: 25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 9333 or testnet: 19333)</source>
<translation>ارتباطات را در <PORT> بشنوید (پیش فرض: 9333 or testnet: 19333)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>نگهداری <N> ارتباطات برای قرینه سازی (پیش فرض:125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>آستانه قطع برای قرینه سازی اشتباه (پیش فرض:100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>تعداد ثانیه ها برای اتصال دوباره قرینه های اشتباه (پیش فرض:86400)</translation>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 9332 or testnet: 19332)</source>
<translation>ارتباطاتِ JSON-RPC را در <port> گوش کنید (پیش فرض:9332)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>command line و JSON-RPC commands را قبول کنید</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>به عنوان daemon بک گراند را اجرا کنید و دستورات را قبول نمایید</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>از تستِ شبکه استفاده نمایید</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=litecoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "Litecoin Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Litecoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Litecoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>برونداد اشکال زدایی با timestamp</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the Litecoin Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>ارسال اطلاعات پیگیری/خطایابی به کنسول به جای ارسال به فایل debug.log</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>ارسال اطاعات خطایابی/پیگیری به سیستم خطایاب</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>تعیین مدت زمان وقفه (time out) به هزارم ثانیه</translation>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>شناسه کاربری برای ارتباطاتِ JSON-RPC</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>رمز برای ارتباطاتِ JSON-RPC</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>ارتباطاتِ JSON-RPC را از آدرس آی.پی. مشخصی برقرار کنید.</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>دستورات را به گره اجرا شده در<ip> ارسال کنید (پیش فرض:127.0.0.1)</translation>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>دستور را وقتی بهترین بلاک تغییر کرد اجرا کن (%s در دستور توسط block hash جایگزین شده است)</translation>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>wallet را به جدیدترین نسخه روزآمد کنید</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>حجم key pool را به اندازه <n> تنظیم کنید (پیش فرض:100)</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>زنجیره بلاک را برای تراکنش جا افتاده در WALLET دوباره اسکن کنید</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>برای ارتباطاتِ JSON-RPC از OpenSSL (https) استفاده کنید</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>فایل certificate سرور (پیش فرض server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>رمز اختصاصی سرور (پیش فرض: server.pem)</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>ciphers قابل قبول (پیش فرض: default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>این پیام راهنما</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>لود شدن آدرسها..</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>خطا در هنگام لود شدن wallet.dat: Wallet corrupted</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of Litecoin</source>
<translation>خطا در هنگام لود شدن wallet.dat. به نسخه جدید Bitocin برای wallet نیاز است.</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart Litecoin to complete</source>
<translation>wallet نیاز به بازنویسی دارد. QPSCoin را برای تکمیل عملیات دوباره اجرا کنید.</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>خطا در هنگام لود شدن wallet.dat</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>میزان اشتباه است for -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>میزان اشتباه است</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>وجوه ناکافی</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>لود شدن نمایه بلاکها..</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>یک گره برای اتصال اضافه کنید و تلاش کنید تا اتصال را باز نگاه دارید</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. Litecoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>هزینه بر اساس کیلو بایت برای اضافه شدن به تراکنشی که ارسال کرده اید</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>wallet در حال لود شدن است...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation>قابلیت برگشت به نسخه قبلی برای wallet امکان پذیر نیست</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>آدرس پیش فرض قابل ذخیره نیست</translation>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>اسکنِ دوباره...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>اتمام لود شدن</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation>برای استفاده از %s از اختیارات</translation>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>خطا</translation>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>شما باید یک رمز rpcpassword=<password> را در فایل تنظیمات ایجاد کنید⏎ %s ⏎ اگر فایل ایجاد نشده است، آن را با یک فایل "فقط متنی" ایجاد کنید.
</translation>
</message>
</context>
</TS> | {
"content_hash": "b351b01fb5db999d4a5cc0c12a49a91f",
"timestamp": "",
"source": "github",
"line_count": 2921,
"max_line_length": 395,
"avg_line_length": 35.04621704895584,
"alnum_prop": 0.6000683794080297,
"repo_name": "szenekonzept/QPSCoin-Source",
"id": "901e24419df3c146b5d34df0d3df35b264983e4f",
"size": "107423",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/qt/locale/bitcoin_fa_IR.ts",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<mix:NoMixed xmlns:mix="http://openuri.org/test/MixedContent"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Your Order is being Shipped.
<mix:name>John Doe</mix:name>
<mix:orderid>1000</mix:orderid>
Your expected Ship-date is: <mix:shipdate>2004-12-12</mix:shipdate>
Thank you for your order
</mix:NoMixed> | {
"content_hash": "5b038f3eb32ee6fbc38c4c7fb9689e82",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 71,
"avg_line_length": 42.44444444444444,
"alnum_prop": 0.6884816753926701,
"repo_name": "crow-misia/xmlbeans",
"id": "53be90766cc6deea9cf7e5f4828b68924fe43fef",
"size": "382",
"binary": false,
"copies": "1",
"ref": "refs/heads/trunk",
"path": "test/cases/xbean/ValidatingStream/nomixed-content-inv.xml",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "62587"
},
{
"name": "CSS",
"bytes": "1961"
},
{
"name": "GAP",
"bytes": "102"
},
{
"name": "HTML",
"bytes": "2640"
},
{
"name": "Java",
"bytes": "8062111"
},
{
"name": "Shell",
"bytes": "39024"
},
{
"name": "XQuery",
"bytes": "256"
},
{
"name": "XS",
"bytes": "2512"
},
{
"name": "XSLT",
"bytes": "78459"
}
],
"symlink_target": ""
} |
package com.amazonaws.services.chime.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/chime-2018-05-01/PutVoiceConnectorTerminationCredentials"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class PutVoiceConnectorTerminationCredentialsResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements
Serializable, Cloneable {
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof PutVoiceConnectorTerminationCredentialsResult == false)
return false;
PutVoiceConnectorTerminationCredentialsResult other = (PutVoiceConnectorTerminationCredentialsResult) obj;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
return hashCode;
}
@Override
public PutVoiceConnectorTerminationCredentialsResult clone() {
try {
return (PutVoiceConnectorTerminationCredentialsResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| {
"content_hash": "81b17c0af28dbc671a8c3f9a468a283e",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 146,
"avg_line_length": 31.096774193548388,
"alnum_prop": 0.6664937759336099,
"repo_name": "aws/aws-sdk-java",
"id": "1c8deb6f635f172db06d1918a75f5c633f4ba788",
"size": "2508",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-chime/src/main/java/com/amazonaws/services/chime/model/PutVoiceConnectorTerminationCredentialsResult.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
service 'openhab' do
supports restart: true, start: true, stop: true, reload: true
action :nothing
end
template 'openhab' do
path '/etc/init.d/openhab'
source 'openhab.erb'
owner 'root'
group 'root'
mode '0755'
notifies :enable, 'service[openhab]'
notifies :start, 'service[openhab]'
end
| {
"content_hash": "db236173ba5a3d31f5184f04d6bd5a39",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 63,
"avg_line_length": 22,
"alnum_prop": 0.6948051948051948,
"repo_name": "JustinAiken/openhab-cookbook",
"id": "e2af7abdc0cdb6145d8357c60592cb225d6eabff",
"size": "406",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "recipes/init_script.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "7638"
},
{
"name": "Shell",
"bytes": "2291"
}
],
"symlink_target": ""
} |
package com.amazonaws.services.clouddirectory.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/clouddirectory-2016-05-10/ListIndex" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ListIndexResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {
/**
* <p>
* The objects and indexed values attached to the index.
* </p>
*/
private java.util.List<IndexAttachment> indexAttachments;
/**
* <p>
* The pagination token.
* </p>
*/
private String nextToken;
/**
* <p>
* The objects and indexed values attached to the index.
* </p>
*
* @return The objects and indexed values attached to the index.
*/
public java.util.List<IndexAttachment> getIndexAttachments() {
return indexAttachments;
}
/**
* <p>
* The objects and indexed values attached to the index.
* </p>
*
* @param indexAttachments
* The objects and indexed values attached to the index.
*/
public void setIndexAttachments(java.util.Collection<IndexAttachment> indexAttachments) {
if (indexAttachments == null) {
this.indexAttachments = null;
return;
}
this.indexAttachments = new java.util.ArrayList<IndexAttachment>(indexAttachments);
}
/**
* <p>
* The objects and indexed values attached to the index.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setIndexAttachments(java.util.Collection)} or {@link #withIndexAttachments(java.util.Collection)} if you
* want to override the existing values.
* </p>
*
* @param indexAttachments
* The objects and indexed values attached to the index.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ListIndexResult withIndexAttachments(IndexAttachment... indexAttachments) {
if (this.indexAttachments == null) {
setIndexAttachments(new java.util.ArrayList<IndexAttachment>(indexAttachments.length));
}
for (IndexAttachment ele : indexAttachments) {
this.indexAttachments.add(ele);
}
return this;
}
/**
* <p>
* The objects and indexed values attached to the index.
* </p>
*
* @param indexAttachments
* The objects and indexed values attached to the index.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ListIndexResult withIndexAttachments(java.util.Collection<IndexAttachment> indexAttachments) {
setIndexAttachments(indexAttachments);
return this;
}
/**
* <p>
* The pagination token.
* </p>
*
* @param nextToken
* The pagination token.
*/
public void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
/**
* <p>
* The pagination token.
* </p>
*
* @return The pagination token.
*/
public String getNextToken() {
return this.nextToken;
}
/**
* <p>
* The pagination token.
* </p>
*
* @param nextToken
* The pagination token.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ListIndexResult withNextToken(String nextToken) {
setNextToken(nextToken);
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getIndexAttachments() != null)
sb.append("IndexAttachments: ").append(getIndexAttachments()).append(",");
if (getNextToken() != null)
sb.append("NextToken: ").append(getNextToken());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ListIndexResult == false)
return false;
ListIndexResult other = (ListIndexResult) obj;
if (other.getIndexAttachments() == null ^ this.getIndexAttachments() == null)
return false;
if (other.getIndexAttachments() != null && other.getIndexAttachments().equals(this.getIndexAttachments()) == false)
return false;
if (other.getNextToken() == null ^ this.getNextToken() == null)
return false;
if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getIndexAttachments() == null) ? 0 : getIndexAttachments().hashCode());
hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
return hashCode;
}
@Override
public ListIndexResult clone() {
try {
return (ListIndexResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| {
"content_hash": "8e39a923c8219e337d6b29fcfb038e60",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 142,
"avg_line_length": 29.624365482233504,
"alnum_prop": 0.6058944482522276,
"repo_name": "dagnir/aws-sdk-java",
"id": "e97b4f6e1b1226563181651947dee284eb3e3666",
"size": "6416",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/ListIndexResult.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "FreeMarker",
"bytes": "157317"
},
{
"name": "Gherkin",
"bytes": "25556"
},
{
"name": "Java",
"bytes": "165755153"
},
{
"name": "Scilab",
"bytes": "3561"
}
],
"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.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Windows C++ SDK: 类成员</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="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</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>
<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="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Windows C++ SDK
 <span id="projectnumber">1.0.0</span>
</div>
<div id="projectbrief">Windows C++ SDK</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','搜索');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></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('functions_e.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)">
</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="contents">
<div class="textblock">这里列出了所有类成员,并附带类的详细说明:</div>
<h3><a id="index_e"></a>- e -</h3><ul>
<li>error()
: <a class="el" href="class_jmcpp_1_1_logger.html#acaa2475a4176707586dbb2e82f91150c">Jmcpp::Logger</a>
</li>
<li>eventId
: <a class="el" href="struct_jmcpp_1_1_event_base.html#a88cca08f1f025bd49fe86ad603cfd881">Jmcpp::EventBase</a>
</li>
<li>exitGroup()
: <a class="el" href="group___xE7_xBE_xA4_xE7_xBB_x84_xE7_xAE_xA1_xE7_x90_x86.html#ga8591a01a68d1c7f1b14cd854099429e8">Jmcpp::Client</a>
</li>
<li>extras
: <a class="el" href="struct_jmcpp_1_1_content_base.html#a595b529d68d21a11615ec32bee88fa6d">Jmcpp::ContentBase</a>
, <a class="el" href="struct_jmcpp_1_1_update_user_info_param.html#a2fd3d3e5d7fbd65a2a66e918b090bc37">Jmcpp::UpdateUserInfoParam</a>
, <a class="el" href="struct_jmcpp_1_1_user_info.html#a9b320f32340e1345ca9cad8322cf7bb9">Jmcpp::UserInfo</a>
</li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">制作者
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
</ul>
</div>
</body>
</html>
| {
"content_hash": "86caad002e6c83921bd4e0c30dd3351f",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 136,
"avg_line_length": 37.51327433628319,
"alnum_prop": 0.6803491389478651,
"repo_name": "Nocturnana/jpush-docs",
"id": "fff656fd26cadecf7b34b9df3e1c5d58bd357b8f",
"size": "4305",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "zh/jmessage/client/im_win_api_docs/functions_e.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "71045"
},
{
"name": "HTML",
"bytes": "3819888"
},
{
"name": "JavaScript",
"bytes": "157240"
},
{
"name": "Python",
"bytes": "4590"
},
{
"name": "Shell",
"bytes": "2945"
}
],
"symlink_target": ""
} |
//
// (C) Copyright 2005-2009 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
// DESCRIPTION:
// Classes for recording and retrieving render settings and render history.
//
// AcDbRenderSettings
// AcDbMentalRayRenderSettings
// AcDbRenderGlobal
// AcDbRenderEntry
//
#pragma once
#include "AcGiEnvironment.h"
#ifdef SCENEDLLIMPEXP
#undef SCENEDLLIMPEXP
#endif
#ifdef SCENEOE
#define SCENEDLLIMPEXP __declspec( dllexport )
#else
// NOTE: Don't use __declspec( dllimport ) here, to avoid having vtables
// allocated in the client DLL instead of the server DLL.
#define SCENEDLLIMPEXP //__declspec( dllimport )
#endif
class AcDbImpRenderSettings;
class AcDbImpRenderEnvironment;
class AcDbImpRenderGlobal;
class AcDbImpMentalRayRenderSettings;
/// <summary>
/// Container for all properties relating to a generic high-fidelity renderer.
/// A dictionary of these objects is resident in the database, in the named
/// object dictionary as ACAD_RENDER_SETTINGS.
/// In the user interface, the contents of this
/// dictionary correspond to user-defined render presets (not predefined
/// presets). For Postrio, these are actually AcDbMentalRayRenderSettings
/// objects.
///
/// The active render settings is stored separately in the named object dictionary
/// as ACAD_RENDER_ACTIVE_SETTINGS.
/// </summary>
class SCENEDLLIMPEXP AcDbRenderSettings : public AcDbObject
{
public:
ACRX_DECLARE_MEMBERS(AcDbRenderSettings);
/// <summary>
/// Default constructor.
/// </summary>
AcDbRenderSettings();
/// <summary>
/// Destructor.
/// </summary>
virtual ~AcDbRenderSettings();
virtual AcGiDrawable* drawable();
/// <summary>
/// Sets the name of the render settings.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if a name with valid characters is provided.
/// </returns>
///
/// <remarks>
/// This function does not check for duplicate names for render settings.
/// </remarks>
Acad::ErrorStatus setName(const AcString& strName);
/// <summary>
/// The user-defined name of the render settings.
/// </summary>
AcString name() const;
/// <summary>
/// Sets the description of the render settings.
/// </summary>
void setDescription(const AcString& strDes);
/// <summary>
/// The user-specified description of the render settings.
/// </summary>
AcString description() const;
/// <summary>
/// Sets the DisplayIndex of the render settings.
/// DisplayIndex is used to determine the displaying order in the UI
/// of the render settings stored in a dictionary.
/// Render settings are displayed in the order from the smallest index to the largest.
/// The indices can be negative and need not to form a contiguous sequence.
/// DisplayIndex is not meant to be used as an Id.
/// </summary>
void setDisplayIndex(int idx);
/// <summary>
/// The DisplayIndex of the render settings.
/// </summary>
int displayIndex() const;
/// <summary>
/// Sets whether per-object materials are used.
/// </summary>
///
/// <remarks>
/// If set to false, the global material is used for all objects. The
/// default value is true.
/// </remarks>
void setMaterialsEnabled(bool bEnabled);
/// <summary>
/// Whether per-object materials are used.
/// </summary>
bool materialsEnabled() const;
/// <summary>
/// Sets the method used for sampling (filtering) image textures.
/// </summary>
///
/// <remarks>
/// This does not apply to procedural textures. The default value is
/// kMedium.
/// </remarks>
void setTextureSampling(bool bSampling);
/// <summary>
/// The method used for sampling (filtering) image textures.
/// </summary>
bool textureSampling() const;
/// <summary>
/// Whether back-facing faces are rendered.
/// </summary>
///
/// <remarks>
/// The default value is true.
/// </remarks>
void setBackFacesEnabled(bool bEnabled);
/// <summary>
/// Whether back-facing faces are rendered.
/// </summary>
bool backFacesEnabled() const;
/// <summary>
/// Sets whether shadows are cast.
/// </summary>
///
/// <remarks>
/// The default value is true.
/// </remarks>
void setShadowsEnabled(bool bEnabled);
/// <summary>
/// Whether shadows are cast.
/// </summary>
bool shadowsEnabled() const;
/// <summary>
/// Sets the full file name on disk of the preview image.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the file name is valid.
/// </returns>
///
/// <remarks>
/// If a blank name is provided, no preview image is associated with the
/// render settings. The default value is blank.
/// </remarks>
Acad::ErrorStatus setPreviewImageFileName(const AcString& strFileName);
/// <summary>
/// The full file name on disk of the preview image.
/// </summary>
AcString previewImageFileName() const;
/// <summary>
/// Sets whether the diagnostic (checker) background is used for rendering.
/// </summary>
///
/// <remarks>
/// If enabled, the diagnostic background overrides any user-defined
/// background, such as a gradient. The default value is false.
/// </remarks>
void setDiagnosticBackgroundEnabled(bool bEnabled);
/// <summary>
/// Whether the diagnostic (checker) background is used for rendering.
/// </summary>
bool diagnosticBackgroundEnabled() const;
// AcDbObject functions
virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler* pFiler);
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler* pFiler);
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* pFiler) const;
virtual Acad::ErrorStatus copyFrom(const AcRxObject* other);
virtual bool operator==(const AcDbRenderSettings& settings);
protected:
// AcGiDrawable functions
virtual Adesk::UInt32 subSetAttributes(AcGiDrawableTraits* pTraits);
private:
AcDbImpRenderSettings* mpImp;
};
/// <summary>
/// Container for all properties relating to the mental ray renderer. See
/// the base class AcDbRenderSettings for more information.
/// </summary>
class SCENEDLLIMPEXP AcDbMentalRayRenderSettings : public AcDbRenderSettings
{
public:
ACRX_DECLARE_MEMBERS(AcDbMentalRayRenderSettings);
/// <summary>
/// Constructor.
/// </summary>
AcDbMentalRayRenderSettings();
/// <summary>
/// Destructor.
/// </summary>
virtual ~AcDbMentalRayRenderSettings();
/// <summary>
/// Sets the minimum and maximum numbers of samples to take when shading a
/// pixel during rendering.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if valid sampling values are provided.
/// </returns>
///
/// <param name="iMin">
/// The minimum sampling rate, in the range -3 to 5. Values less than zero
/// enable subsampling. -3 corresponds to one sample for every 64 pixel
/// (1/64) and 5 corresponds to 1024 samples per pixel. iMin must be less
/// than or equal to iMax. The default value is -1.
/// </param>
///
/// <param name="iMax">
/// The maximum sampling rate, in the range -3 to 5. The default value is
/// 0. See iMin for details.
/// </param>
Acad::ErrorStatus setSampling(int iMin, int iMax);
/// <summary>
/// The minimum and maximum numbers of samples to take when shading a
/// pixel during rendering.
/// </summary>
void sampling(int& iMin, int& iMax) const;
/// <summary>
/// Sets the filtering parameters for combining multiple samples into a
/// single pixel color.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if valid filtering parameters are provided.
/// </returns>
///
/// <param name="eFilter">
/// The filtering method (kernel) used to combine samples into a pixel
/// color. The default value is kBox.
/// </param>
///
/// <param name="fWidth">
/// The width of the filter area, in the range 0.0 to 8.0, in pixels. The
/// default is 1.0.
/// </param>
///
/// <param name="fHeight">
/// The height of the filter area, in the range 0.0 to 8.0, in pixels. The
/// default is 1.0.
/// </param>
Acad::ErrorStatus setSamplingFilter(AcGiMrFilter eFilter, double fWidth,
double fHeight);
/// <summary>
/// The filtering parameters for combining multiple samples into a single
/// pixel color.
/// </summary>
void SamplingFilter(AcGiMrFilter& eFilter, double& fWidth, double& fHeight)
const;
/// <summary>
/// Sets the threshold above which further samples will be taken, per-color
/// channel.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if valid values are provided for each color channel.
/// </returns>
///
/// <remarks>
/// Each color channel value can be in the range 0.0 to 1.0. The default
/// is 0.1 for each color channel.
/// </remarks>
Acad::ErrorStatus setSamplingContrastColor(float r, float g, float b,
float a);
/// <summary>
/// The threshold above which further samples will be taken, per-color
/// channel.
/// </summary>
void samplingContrastColor(float& r, float& g, float& b, float& a) const;
/// <summary>
/// Sets the method used to compute ray-traced shadows.
/// </summary>
///
/// <remarks>
/// This only affects lights using ray-traced shadows. The default value
/// is kSimple.
/// </remarks>
void setShadowMode(AcGiMrShadowMode eShadowMode);
/// <summary>
/// The method used to compute ray-traced shadows.
/// </summary>
AcGiMrShadowMode shadowMode() const;
/// <summary>
/// Whether shadow maps are computed.
/// </summary>
///
/// <remarks>
/// This only affects lights using mapped shadows. The default value is
/// true.
/// </remarks>
void setShadowMapsEnabled(bool bEnabled);
/// <summary>
/// Whether shadow maps are computed.
/// </summary>
bool shadowMapsEnabled() const;
/// <summary>
/// Whether ray-tracing is performed.
/// </summary>
///
/// <remarks>
/// If ray-tracing is disabled, various effects such as reflection and
/// refraction will not be computed. The default value is true.
/// </remarks>
void setRayTracingEnabled(bool bEnabled);
/// <summary>
/// Whether ray-tracing is performed.
/// </summary>
bool rayTracingEnabled() const;
/// <summary>
/// Sets the maximum trace depth (recursion level) for rays.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the ray trace depth values are valid.
/// </returns>
///
/// <param name="iReflection">
/// The maximum recursion level of reflection rays, greater than or equal
/// to 0. The default value is 2.
/// </param>
///
/// <param name="iRefraction">
/// The maximum recursion level of refraction rays, greater than or equal
/// to 0. The default value is 2.
/// </param>
///
/// <param name="iSum">
/// The maximum recursion level of reflection and refraction rays,
/// combined. The default value is 4.
/// </param>
Acad::ErrorStatus setRayTraceDepth(int iReflection, int iRefraction,
int iSum);
/// <summary>
/// The maximum trace depth (recursion level) for rays.
/// </summary>
void rayTraceDepth(int& iReflection, int& iRefraction, int& iSum) const;
/// <summary>
/// Whether global illumination (using photon mapping) is computed.
/// </summary>
///
/// <remarks>
/// Global illumination allows for indirect illumination effects such as
/// color-bleeding. The default value is false.
/// </remarks>
void setGlobalIlluminationEnabled(bool bEnabled);
/// <summary>
/// Whether global illumination (using photon mapping) is computed.
/// </summary>
bool globalIlluminationEnabled() const;
/// <summary>
/// Sets the maximum number of photons near a render sample point to use
/// for computing global illumination.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the photon count value is valid.
/// </returns>
///
/// <remarks>
/// The indicated number of photons around each render sample are used to
/// to compute global illumination at that point, within the area defined
/// by setGIPhotonRadius(). This value must be must be greater than zero.
/// The default value is 500.
/// </remarks>
Acad::ErrorStatus setGISampleCount(int iNum);
/// <summary>
/// The maximum number of photons near a render sample point to use for
/// computing global illumination.
/// </summary>
int giSampleCount() const;
/// <summary>
/// Whether the user-defined photon sampling radius is used.
/// </summary>
///
/// <remarks>
/// If the photon sampling radius is not used, a default radius based on
/// the model extents is used. The default value is false.
/// </remarks>
void setGISampleRadiusEnabled(bool bEnabled);
/// <summary>
/// Whether the user-defined photon sampling radius is used.
/// </summary>
bool giSampleRadiusEnabled() const;
/// <summary>
/// Sets the radius of the area used to sample photons for global
/// illumination.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the radius value is valid.
/// </returns>
///
/// <remarks>
/// The indicated area around each render sample is searched for photons,
/// up to the number of photons specified by setGIPhotonCount(). The
/// radius is in model units, and must be greater than or equal to zero.
/// The default value is 1.0.
/// </remarks>
Acad::ErrorStatus setGISampleRadius(double fRadius);
/// <summary>
/// The radius of the area used to sample photons for global illumination.
/// </summary>
double giSampleRadius() const;
/// <summary>
/// Sets the average number of GI photons to shoot for each light.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the photon count value is valid.
/// </returns>
///
/// <remarks>
/// This value must be greater than zero. The default value is 10000.
/// </remarks>
Acad::ErrorStatus setGIPhotonsPerLight(int iNum);
/// <summary>
/// The average number of GI photons to shoot for each light.
/// </summary>
int giPhotonsPerLight() const;
/// <summary>
/// Sets the maximum trace depth (recursion level) for photon.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the photon trace depth values are valid.
/// </returns>
///
/// <param name="iReflection">
/// The maximum recursion level of reflected photons, greater than or equal
/// to 0. The default value is 5.
/// </param>
///
/// <param name="iRefraction">
/// The maximum recursion level of refracted photons, greater than or equal
/// to 0. The default value is 5.
/// </param>
///
/// <param name="iSum">
/// The maximum recursion level of reflected and refracted photon,
/// combined. The default value is 5.
/// </param>
Acad::ErrorStatus setPhotonTraceDepth(int iReflection, int iRefraction,
int iSum);
/// <summary>
/// The maximum trace depth (recursion level) for photons.
/// </summary>
void photonTraceDepth(int& iReflection, int& iRefraction, int& iSum) const;
/// <summary>
/// Whether final gathering is applied.
/// </summary>
///
/// <remarks>
/// Final gathering allows for indirect illumination effects such as
/// color-bleeding, and can be combined with global illumination to enhance
/// the effect of GI. The default value is false.
/// </remarks>
void setFinalGatheringEnabled(bool bEnabled);
/// <summary>
/// Whether final gathering is applied.
/// </summary>
bool finalGatheringEnabled() const;
/// <summary>
/// Whether final gathering is applied.
/// </summary>
///
/// <remarks>
/// Final gathering allows for indirect illumination effects such as
/// color-bleeding, and can be combined with global illumination to enhance
/// the effect of GI. The default value is
/// AcGiMrFinalGatheringMode::krFinalGatherAuto.
/// </remarks>
Acad::ErrorStatus setFinalGatheringMode(AcGiMrFinalGatheringMode mode);
/// <summary>
/// Whether final gathering is applied.
/// </summary>
AcGiMrFinalGatheringMode finalGatheringMode() const;
/// <summary>
/// Sets the number of final gather rays to be used for each final gather
/// point.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the final gather ray count count value is valid.
/// </returns>
///
/// <remarks>
/// The indicated number of rays are shot into the scene for each final
/// gather point to compute indirect illumination. This value must be must
/// be greater than zero. The default value is 1000.
/// </remarks>
Acad::ErrorStatus setFGRayCount(int iNum);
/// <summary>
/// Sets the number of final gather rays to be used for each final gather
/// point.
/// </summary>
int fgRayCount() const;
/// <summary>
/// Sets the flags indicating the user-defined final gathering sampling
/// radii are used, and what units they are defined in.
/// </summary>
///
/// <param name="bMin">
/// The flag indicating whether the user-defined minimum radius is used,
/// otherwise a default radius is applied. The default value is false.
/// </param>
///
/// <param name="bMax">
/// The flag indicating whether the user-defined maximum radius is used,
/// otherwise a default radius is applied. The default value is false.
/// </param>
///
/// <param name="bPixels">
/// The flag indicating whether the user-defined radii are in pixel units.
/// The default value is false.
/// </param>
void setFGRadiusState(bool bMin, bool bMax, bool bPixels);
/// <summary>
/// The flags indicating the user-defined final gathering sampling radii
/// are used, and what units they are defined in.
/// </summary>
void fgSampleRadiusState(bool& bMin, bool& bMax, bool& bPixels) const;
/// <summary>
/// Sets the minimum and maximum radii of the area used to sample final
/// gather points to compute indirect illumination.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the radius values are valid.
/// </returns>
///
/// <param name="fMin">
/// The minimum final gather sample radius, in units defined by
/// setFGRadiusState(). This value must be less than or equal to fMax, and
/// greater than zero. The default values are 0.1 for model units and 0.5
/// for pixel units.
/// </param>
///
/// <param name="fMax">
/// The maximum final gather sample radius, in units defined by
/// setFGRadiusState(). This value must be greater than or equal to fMin,
/// and greater than zero. The default values are 1.0 for model units and
/// 5.0 for pixel units.
/// </param>
Acad::ErrorStatus setFGSampleRadius(double fMin, double fMax);
/// <summary>
/// The minimum and maximum radii of the area used to sample final gather
/// points to compute indirect illumination.
/// </summary>
void fgSampleRadius(double& fMin, double& fMax) const;
/// <summary>
/// Sets a physical scale factor to use with lights that are not physically based.
/// Physical scale may be necessary to set to a non-default value when rendering
/// with self-illuminating materials or extremely bright photometric lights in
/// order to approximate the eyes response to the scene.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the luminance value is valid.
/// </returns>
///
/// <param name="fLuminance">
/// The physical scale factor to use with lights that are not physically based.
/// </param>
///
/// <remarks>
/// This value must be greater than zero and less than or equal to 200000.0.
/// The default value is 1500.0.
/// </remarks>
Acad::ErrorStatus setLightLuminanceScale(double fLuminance);
/// <summary>
/// The physical scale factor to use with lights that are not physically based.
/// </summary>
double lightLuminanceScale() const;
/// <summary>
/// Sets the magnitude of indirect illumination.
/// This parameter will effectively provide a global way to adjust the effect of GI.
/// It multiplies the flux of every light as it pertains to photon emission.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the parameter value is valid.
/// </returns>
///
/// <remarks>
/// This value must be greater than zero. The default value is 1.0.
/// </remarks>
Acad::ErrorStatus setEnergyMultiplier(float fScale);
/// <summary>
/// The magnitude of indirect illumination.
/// </summary>
float energyMultiplier() const;
/// <summary>
/// Sets the mode for rendering diagnostic images.
/// </summary>
///
/// <remarks>
/// The default value is krOff.
/// </remarks>
void setDiagnosticMode(AcGiMrDiagnosticMode eDiagnosticMode);
/// <summary>
/// The mode for rendering diagnostic images.
/// </summary>
AcGiMrDiagnosticMode diagnosticMode() const;
/// <summary>
/// Set the coordinate system to use for the diagnostic grid including
/// the distance between grid lines (size).
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the specified grid size is valid.
/// </returns>
///
/// <remarks>
/// The grid size must be greater than zero. The default mode is krObject
/// and size is 10.0.
/// </remarks>
Acad::ErrorStatus setDiagnosticGridMode(
AcGiMrDiagnosticGridMode eDiagnosticGridMode, float fSize);
/// <summary>
/// The coordinate system to use for the diagnostic grid including
/// the distance between grid lines (size).
/// </summary>
void diagnosticGridMode(
AcGiMrDiagnosticGridMode& eDiagnosticGridMode, float& fSize) const;
/// <summary>
/// Sets the type of photon information to visualize with the photon
/// diagnostic mode.
/// </summary>
///
/// <remarks>
/// The default value is krDensity.
/// </remarks>
void setDiagnosticPhotonMode(
AcGiMrDiagnosticPhotonMode eDiagnosticPhotonMode);
/// <summary>
/// The type of photon information to visualize with the photon diagnostic
/// mode.
/// </summary>
AcGiMrDiagnosticPhotonMode diagnosticPhotonMode() const;
/// <summary>
/// Sets the samples diagnostic mode.
/// </summary>
///
/// <remarks>
/// The default value is false(off).
/// </remarks>
void setDiagnosticSamplesMode(bool bDiagnosticSamplesMode);
/// <summary>
/// The samples diagnostic mode.
/// </summary>
bool diagnosticSamplesMode() const;
/// <summary>
/// Sets the type of BSP information to visualize with the BSP diagnostic mode.
/// </summary>
///
/// <remarks>
/// The default value is krDepth.
/// </remarks>
void setDiagnosticBSPMode(AcGiMrDiagnosticBSPMode eDiagnosticBSPMode);
/// <summary>
/// The type of BSP information to visualize with the BSP diagnostic mode.
/// </summary>
AcGiMrDiagnosticBSPMode diagnosticBSPMode() const;
/// <summary>
/// Sets whether to export an MI file after rendering.
/// </summary>
///
/// <remarks>
/// If set to true, the file name specified with setExportMIFileName() is
/// used to save the MI file. The default value is false.
/// </remarks>
void setExportMIEnabled(bool bEnabled);
/// <summary>
/// Whether to export an MI file after rendering.
/// </summary>
bool exportMIEnabled() const;
/// <summary>
/// Set the export to mi mode.
/// </summary>
///
/// <remarks>
/// The default value is AcGiMrExportMIMode::krExportMIOff.
/// </remarks>
Acad::ErrorStatus setExportMIMode(AcGiMrExportMIMode eExportMIMode);
/// <summary>
/// The export to mi mode.
/// </summary>
AcGiMrExportMIMode exportMIMode() const;
/// <summary>
/// Sets full file name on disk to use for an exported MI file.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the file name is valid.
/// </returns>
///
/// <remarks>
/// The default value is blank.
/// </remarks>
Acad::ErrorStatus setExportMIFileName(const AcString& strFileName);
/// <summary>
/// The full file name on disk to use for an exported MI file.
/// </summary>
AcString exportMIFileName() const;
/// <summary>
/// Sets the size of the image tiles to use when rendering.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the tile size is valid.
/// </returns>
///
/// <remarks>
/// Smaller values increase rendering time, but provide more frequent
/// updates during rendering.The size must be in the range 4 to 512, and
/// has a default value of 32.
/// </remarks>
Acad::ErrorStatus setTileSize(int iTileSize);
/// <summary>
/// The size of the image tiles to use when rendering.
/// </summary>
int tileSize() const;
/// <summary>
/// Sets the sequence (order) used to render image tiles.
/// </summary>
///
/// <remarks>
/// The default value is krHilbert.
/// </remarks>
void setTileOrder(AcGiMrTileOrder eTileOrder);
/// <summary>
/// The sequence (order) used to render image tiles.
/// </summary>
AcGiMrTileOrder tileOrder() const;
/// <summary>
/// Sets the maximum amount of memory (in MB) that the renderer will
/// allocate for rendering.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the memory limit is valid.
/// </returns>
///
/// <remarks>
/// After the memory limit is reached, the renderer will begin making
/// performance tradeoffs to stay under the memory limit. The memory limit
/// must be at least 128 MB, and the default value is 1048 MB.
/// </remarks>
Acad::ErrorStatus setMemoryLimit(int iMemoryLimit);
/// <summary>
/// The maximum amount of memory (in MB) that the renderer will allocate
/// for rendering.
/// </summary>
int memoryLimit() const;
/// <summary>
/// The shadow sampling multiplier for area lights.
/// </summary>
enum ShadowSamplingMultiplier {
/// <summary>
/// Zero.
/// </summary>
kSamplingMultiplierZero = 0,
/// <summary>
/// One-eighth.
/// </summary>
kSamplingMultiplierOneEighth,
/// <summary>
/// One-fourth.
/// </summary>
kSamplingMultiplierOneFourth,
/// <summary>
/// One-half.
/// </summary>
kSamplingMultiplierOneHalf,
/// <summary>
/// One.
/// </summary>
kSamplingMultiplierOne,
/// <summary>
/// Two.
/// </summary>
kSamplingMultiplierTwo
};
/// <summary>
/// Specifies the shadow sampling multiplier for area lights.
/// </summary>
///
/// <remarks>
/// The default value is ShadowSamplingMultiplier::kSamplingMultiplierOne.
/// </remarks>
Acad::ErrorStatus setShadowSamplingMultiplier(
AcDbMentalRayRenderSettings::ShadowSamplingMultiplier multiplier);
/// <summary>
/// The shadow sampling multiplier for area lights.
/// </summary>
AcDbMentalRayRenderSettings::ShadowSamplingMultiplier shadowSamplingMultiplier() const;
// AcDbObject functions
virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler* pFiler);
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler* pFiler);
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* pFiler) const;
virtual bool operator==(const AcDbMentalRayRenderSettings& settings);
Acad::ErrorStatus copyFrom(const AcRxObject* other);
protected:
// AcGiDrawable functions
virtual Adesk::UInt32 subSetAttributes(AcGiDrawableTraits* pTraits);
private:
friend class AcDbImpMentalRayRenderSettings;
Adesk::UInt32 baseSetAttributes(AcGiDrawableTraits* pTraits);
AcDbImpMentalRayRenderSettings* mpImpMentalRay;
};
/// <summary>
/// Container for environment-related properties, including fog / depth cue and
/// the global environment image. One and only one of these objects is
/// resident in the database, in the named object dictionary as ACAD_RENDER_ENVIRONMENT.
/// </summary>
class SCENEDLLIMPEXP AcDbRenderEnvironment : public AcDbObject
{
public:
ACRX_DECLARE_MEMBERS(AcDbRenderEnvironment);
/// <summary>
/// Constructor.
/// </summary>
AcDbRenderEnvironment();
/// <summary>
/// Destructor.
/// </summary>
virtual ~AcDbRenderEnvironment();
virtual AcGiDrawable* drawable();
/// <summary>
/// Sets whether a fog effect is applied to the rendered image.
/// </summary>
///
/// <remarks>
/// The default value is false.
/// </remarks>
void setFogEnabled(bool bEnable);
/// <summary>
/// Whether a fog effect is applied to the rendered image.
/// </summary>
bool fogEnabled() const;
/// <summary>
/// Sets whether the fog affects the background.
/// </summary>
///
/// <remarks>
/// The default value is false.
/// </remarks>
void setFogBackgroundEnabled(bool bEnable);
/// <summary>
/// Whether the fog affects the background.
/// </summary>
bool fogBackgroundEnabled() const;
/// <summary>
/// Sets the color of the fog effect.
/// </summary>
///
/// <remarks>
/// The default value is medium gray: 128, 128, 128.
/// </remarks>
void setFogColor(const AcCmEntityColor& color);
/// <summary>
/// The color of the fog effect.
/// </summary>
AcCmEntityColor fogColor() const;
/// <summary>
/// Sets the density of the fog effect.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the density values are valid.
/// </returns>
///
/// <param name="dNear">
/// The density of the fog at the near distance specified with
/// setDistances(), expressed as a percentage in the range 0.0 to 100.0.
/// The value must be less than or equal to the density at the far
/// distance. The default value is 0.0 (no fog).
/// </param>
///
/// <param name="dFar">
/// The density of the fog at the far distance specified with
/// setDistances(), expressed as a percentage in the range 0.0 to 100.0.
/// The value must be greater than or equal to the density at the near
/// distance. The default value is 100.0 (opaque fog).
/// </param>
Acad::ErrorStatus setFogDensity(double dNear, double dFar);
/// <summary>
/// The density of the fog effect.
/// </summary>
void fogDensity(double& dNear, double& dFar) const;
/// <summary>
/// Sets the near and far distances of the fog effect.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the distances are valid.
/// </returns>
///
/// <param name="dNear">
/// The near distance of the fog, expressed as a percentage of the distance
/// between the camera and the far clipping plane. The value must be in
/// the range 0.0 to 100.0, and must be less than or equal to the far
/// distance. The default value is 0.0 (at the camera).
/// </param>
///
/// <param name="dFar">
/// The far distance of the fog, expressed as a percentage of the distance
/// between the camera and the far clipping plane. The value must be in
/// the range 0.0 to 100.0, and must be greater than or equal to the near
/// distance. The default value is 100.0 (at the far clipping plane).
/// </param>
Acad::ErrorStatus setDistances(double dNear, double dFar);
/// <summary>
/// The near and far distances of the fog effect.
/// </summary>
void distances(double& dNear, double& dFar) const;
/// <summary>
/// Sets whether to use an image for the environment.
/// </summary>
///
/// <remarks>
/// If set to true, the file name specified with
/// setEnvironmentImageFileName() is used as the environment image. The
/// The default value is false.
/// </remarks>
void setEnvironmentImageEnabled(bool bEnabled);
/// <summary>
/// Whether to use an image for the environment.
/// </summary>
bool environmentImageEnabled() const;
/// <summary>
/// Sets the full file name on disk of the environment image.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the file name is valid.
/// </returns>
///
/// <remarks>
/// The default value is blank.
/// </remarks>
Acad::ErrorStatus setEnvironmentImageFileName(const AcString& strFileName);
/// <summary>
/// The full file name on disk of the environment image.
/// </summary>
AcString environmentImageFileName() const;
// AcDbObject functions
virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler* pFiler);
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler* pFiler);
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* pFiler) const;
virtual bool operator==(const AcDbRenderEnvironment& environment);
protected:
// AcGiDrawable functions
virtual Adesk::UInt32 subSetAttributes(AcGiDrawableTraits* pTraits);
private:
AcDbImpRenderEnvironment* mpImp;
};
/// <summary>
/// Container for all global rendering properties. One and only one of these
/// objects is resident in the database, in the named object dictionary as
/// ACAD_RENDER_GLOBAL.
/// </summary>
class SCENEDLLIMPEXP AcDbRenderGlobal : public AcDbObject
{
public:
ACRX_DECLARE_MEMBERS(AcDbRenderGlobal);
/// <summary>
/// The available types of view content to render (render procedures).
/// </summary>
enum Procedure
{
/// <summary>
/// Render the complete contents of the view.
/// </summary>
krView = 0,
/// <summary>
/// Render only the user-defined rectangular region of the view.
/// </summary>
krCrop,
/// <summary>
/// Render only the selected objects in the view.
/// </summary>
krSelected
};
/// <summary>
/// The available output targets for rendering.
/// </summary>
enum Destination
{
/// <summary>
/// The rendered image appears in the separate Render window.
/// </summary>
krWindow = 0,
/// <summary>
/// The rendered image appears directly in the current viewport.
/// </summary>
krViewport
};
/// <summary>
/// Constructor.
/// </summary>
AcDbRenderGlobal();
/// <summary>
/// Destructor.
/// </summary>
virtual ~AcDbRenderGlobal();
/// <summary>
/// Sets the type of view content to render (the procedure) and the desired
/// output target for rendering.
/// </summary>
///
/// <remarks>
/// The default values are krView and krWindow.
/// </remarks>
void setProcedureAndDestination(Procedure eProcedure,
Destination eDestination);
/// <summary>
/// The type of view content to render (the procedure) and the desired
/// output target for rendering.
/// </summary>
void procedureAndDestination(Procedure& eProcedure,
Destination& eDestination) const;
/// <summary>
/// Sets whether to save an image on disk after rendering.
/// </summary>
///
/// <remarks>
/// If set to true, the file name specified with setSaveFileName() is used
/// to save the image. The default value is false.
/// </remarks>
void setSaveEnabled(bool bEnabled);
/// <summary>
/// Whether to save an image on disk after rendering.
/// </summary>
bool saveEnabled() const;
/// <summary>
/// Sets the full file name on disk with which to save the rendered image.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the file name is valid.
/// </returns>
///
/// <remarks>
/// The default value is blank.
/// </remarks>
Acad::ErrorStatus setSaveFileName(const AcString& strFileName);
/// <summary>
/// The full file name on disk with which to save the rendered image.
/// </summary>
AcString saveFileName() const;
/// <summary>
/// Sets the dimensions of the rendered image.
/// </summary>
///
/// <returns>
/// Returns Acad::eOk if the dimensions are valid.
/// </returns>
///
/// <remarks>
/// Each dimension must be in the range 1 to 4096. The default values are
/// 640 and 480.
/// </remarks>
Acad::ErrorStatus setDimensions(int w, int h);
/// <summary>
/// The dimensions of the rendered image.
/// </summary>
void dimensions(int& w, int& h) const;
/// <summary>
/// Sets whether predefined (factory) presets appear before the user-
/// defined presets in the user interface.
/// </summary>
///
/// <remarks>
/// The default value is true.
/// </remarks>
void setPredefinedPresetsFirst(bool bPredefinedPresetsFirst);
/// <summary>
/// Whether predefined (factory) presets appear before the user-defined
/// presets in the user interface.
/// </summary>
bool predefinedPresetsFirst() const;
/// <summary>
/// Sets whether settings / statistics are displayed in the user interface
/// with the higher level of detail.
/// </summary>
///
/// <remarks>
/// The default value is true.
/// </remarks>
void setHighInfoLevel(bool bHighInfoLevel);
/// <summary>
/// Whether settings / statistics are displayed in the user interface with
/// the higher level of detail.
/// </summary>
bool highInfoLevel() const;
/// <summary>
/// Sets the exposure control type.
/// </summary>
///
/// <remarks>
/// The default value is AcGiMrExposureType::krAutomatic.
/// </remarks>
Acad::ErrorStatus setExposureType(AcGiMrExposureType type);
/// <summary>
/// The exposure control type.
/// </summary>
AcGiMrExposureType exposureType() const;
// AcDbObject functions
virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler* pFiler);
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler* pFiler);
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* pFiler) const;
Acad::ErrorStatus copyFrom( const AcRxObject* other );
private:
AcDbImpRenderGlobal* mpImp;
};
| {
"content_hash": "bfad5d97175975a5233062e55ed9c9f2",
"timestamp": "",
"source": "github",
"line_count": 1297,
"max_line_length": 91,
"avg_line_length": 32.28064764841943,
"alnum_prop": 0.6106573039075188,
"repo_name": "kevinzhwl/ObjectARXCore",
"id": "3216b3209549f9f7acc5e56c5654acbff177a6af",
"size": "41868",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "2011/inc/dbRender.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "14344996"
},
{
"name": "C++",
"bytes": "77699473"
},
{
"name": "Objective-C",
"bytes": "2136952"
}
],
"symlink_target": ""
} |
'use strict'
const Entities = require('html-entities').AllHtmlEntities;
const entities = new Entities();
module.exports = {
decodeHtmlSymbols: s => {
return entities.decode(s)
},
parseLiUserTag: s => {
while (s.indexOf('<li-user') > -1) {
// Find user tag.
let liUserTag = s.replace(s.substring(0, s.indexOf('<li-user')), '')
liUserTag = liUserTag.replace(liUserTag.substring(liUserTag.indexOf('</li-user>') + 10, liUserTag.length), '')
// Find user.
let user = liUserTag.replace(liUserTag.substring(0, liUserTag.indexOf('login="') + 7), '')
user = user.replace(user.substring(user.indexOf('"'), user.indexOf('</li-user>') + 10), '')
// Replace user tag.
s = s.replace(liUserTag, `@${user}`)
}
return s
}
}
| {
"content_hash": "602672fb8fec27d930844813521debc8",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 116,
"avg_line_length": 30.153846153846153,
"alnum_prop": 0.6096938775510204,
"repo_name": "vimla-se/lithium-nodebb-migrator",
"id": "eb789e2c9675d2c09ab5cffc9e90ec809deadee6",
"size": "784",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/helpers/string.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "44347"
},
{
"name": "Shell",
"bytes": "1726"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- From: file:/Users/jonathan/Documents/cucei2016B/sbc/se-ov/android/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/values-eu-rES/values-eu-rES.xml -->
<eat-comment/>
<string msgid="4600421777120114993" name="abc_action_bar_home_description">"Joan orri nagusira"</string>
<string msgid="1397052879051804371" name="abc_action_bar_home_description_format">"%1$s, %2$s"</string>
<string msgid="6623331958280229229" name="abc_action_bar_home_subtitle_description_format">"%1$s, %2$s, %3$s"</string>
<string msgid="1594238315039666878" name="abc_action_bar_up_description">"Joan gora"</string>
<string msgid="3588849162933574182" name="abc_action_menu_overflow_description">"Aukera gehiago"</string>
<string msgid="4076576682505996667" name="abc_action_mode_done">"Eginda"</string>
<string msgid="7468859129482906941" name="abc_activity_chooser_view_see_all">"Ikusi guztiak"</string>
<string msgid="2031811694353399454" name="abc_activitychooserview_choose_application">"Aukeratu aplikazio bat"</string>
<string msgid="7723749260725869598" name="abc_search_hint">"Bilatu…"</string>
<string msgid="3691816814315814921" name="abc_searchview_description_clear">"Garbitu kontsulta"</string>
<string msgid="2550479030709304392" name="abc_searchview_description_query">"Bilaketa-kontsulta"</string>
<string msgid="8264924765203268293" name="abc_searchview_description_search">"Bilatu"</string>
<string msgid="8928215447528550784" name="abc_searchview_description_submit">"Bidali kontsulta"</string>
<string msgid="893419373245838918" name="abc_searchview_description_voice">"Ahots bidezko bilaketa"</string>
<string msgid="3421042268587513524" name="abc_shareactionprovider_share_with">"Partekatu hauekin"</string>
<string msgid="7165123711973476752" name="abc_shareactionprovider_share_with_application">"Partekatu %s erabiltzailearekin"</string>
<string msgid="1603543279005712093" name="abc_toolbar_collapse_description">"Tolestu"</string>
<string msgid="2869576371154716097" name="status_bar_notification_info_overflow">"999+"</string>
</resources> | {
"content_hash": "88c6cbeb855b291eccdad21d6ccc8bb7",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 191,
"avg_line_length": 96,
"alnum_prop": 0.7576992753623188,
"repo_name": "jonajgs/se-ov",
"id": "2f37762b2653387efbde968d5f6751fb565647b8",
"size": "2210",
"binary": false,
"copies": "2",
"ref": "refs/heads/dev",
"path": "android/app/build/intermediates/res/merged/debug/values-eu-rES/values-eu-rES.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3223"
},
{
"name": "HTML",
"bytes": "903"
},
{
"name": "Java",
"bytes": "1172894"
},
{
"name": "JavaScript",
"bytes": "24745"
},
{
"name": "Objective-C",
"bytes": "4386"
},
{
"name": "Python",
"bytes": "1633"
}
],
"symlink_target": ""
} |
<?php
// Insert:: INSERT INTO `wrud`.`classlist` (`id`, `owner`, `created`, `classcode`) VALUES (NULL, 'aidancornelius@research.tfel.edu.au', '2014-07-15 12:15:00', '8883cc34');
// Insert User:: INSERT INTO `wrud`.`teachers` (`id`, `emailaddress`, `created`, `password`) VALUES (NULL, 'aidancornelius@research.tfel.edu.au', '2014-07-15 00:00:00', 'rabbit10');
// Query:: SELECT * FROM `classlist` WHERE `classcode`="8883cc34";
// Query:: SELECT * FROM `teachers` WHERE `emailaddress`='aidancornelius@research.tfel.edu.au' AND `password`='rabbit10';
// ext-silk02.aueast.tfel.edu.au
function configure_active_database ( ) {
$db = array();
$db["DatabaseHost"] = "ext-silk02.aueast.tfel.edu.au";
$db["DatabasePort"] = "3306";
$db["DatabaseName"] = "reservations";
$db["DatabaseUsername"] = "reservations";
$db["DatabasePassword"] = "qthNeYtzvNvTttrF";
return $db;
} | {
"content_hash": "d71cfd19ba69376cc1c5483df92242b7",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 181,
"avg_line_length": 31.535714285714285,
"alnum_prop": 0.6727066817667045,
"repo_name": "TfEL/guru-reservations",
"id": "67f80208b95081dbb9ae83044a2c3a4508869bd4",
"size": "883",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/settings.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "31517"
}
],
"symlink_target": ""
} |
Huffman
=======
Huffman Compression and Decompression
| {
"content_hash": "ca54cd796ab858aa249c23c0face97b9",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 37,
"avg_line_length": 13.75,
"alnum_prop": 0.7454545454545455,
"repo_name": "CKBird/Huffman",
"id": "d9f043691670f847beae31e88831d418a0cd1d9c",
"size": "55",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "9998"
}
],
"symlink_target": ""
} |
"use strict";
var Tinkerforge = require('tinkerforge');
var devices = require('../lib/devices');
module.exports = function(RED) {
function tinkerForgeRotaryPoti(n) {
RED.nodes.createNode(this,n);
this.device = n.device;
this.sensor = n.sensor;
this.name = n.name;
this.topic = n.topic;
this.pollTime = n.pollTime;
var node = this;
node.ipcon = new Tinkerforge.IPConnection(); //devices[this.device].ipcon;
node.ipcon.setAutoReconnect(true);
var devs = devices.getDevices();
node.ipcon.connect(devs[node.device].host, devs[node.device].port,function(error){
if(error) {
node.warn("couldn't connect");
}
});
node.ipcon.on(Tinkerforge.IPConnection.CALLBACK_CONNECTED,
function(connectReason) {
node.t = new Tinkerforge.BrickletRotaryPoti(node.sensor, node.ipcon);
node.interval = setInterval(function(){
if (node.t) {
node.t.getPosition(function(pos) {
node.send({
topic: node.topic || 'position',
payload: pos
});
},
function(err) {
//error
node.error("PTC - " + err);
});
}
},(node.pollTime * 1000));
});
node.on('close',function() {
clearInterval(node.interval);
node.ipcon.disconnect();
});
}
RED.nodes.registerType('TinkerForge RotaryPoti', tinkerForgeRotaryPoti);
};
| {
"content_hash": "0b29c1c79a4a59a97839384c2b09907f",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 90,
"avg_line_length": 30.70909090909091,
"alnum_prop": 0.5020722320899941,
"repo_name": "tyrrellsystems/node-red-contrib-tinkerforge",
"id": "f96a5fb96ed78757eb735f7be1c3e7f9dee001f4",
"size": "2279",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bricklets/RotaryPoti.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "119264"
},
{
"name": "JavaScript",
"bytes": "106365"
}
],
"symlink_target": ""
} |
module PlazrStore
class DiscountType < ActiveRecord::Base
# Overrides some basic methods for the current model so that calling #destroy sets a 'deleted_at' field to the current timestamp
include PZS::ParanoiaInterface
## Relations ##
has_many :promotions
has_many :promotional_codes
## Attributes ##
attr_accessible :description, :name, :scope
## Validations ##
validates :name, :presence => true, uniqueness_without_deleted: true
# scope is 0 if belongs both to PromotionalCode and to Promotion
# scope is 1 if belongs only to PromotionalCode
# scope is 2 if belongs only to Promotion
validates :scope, :inclusion => 0..2
## Scopes ##
scope :promotion_types, where(:scope => [0,2])
scope :promotional_code_types, where(:scope => [0,1])
end
end
| {
"content_hash": "d08fb4061b458a676b455fa9825b6fb9",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 132,
"avg_line_length": 35.47826086956522,
"alnum_prop": 0.6899509803921569,
"repo_name": "Plazr/plazr_store",
"id": "54838fd2584e29c02206554b181a140d3c8c3372",
"size": "834",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/models/plazr_store/discount_type.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "168621"
},
{
"name": "Ruby",
"bytes": "265231"
}
],
"symlink_target": ""
} |
cask 'milanote' do
version '1.4.8'
sha256 '3455d4310937518feb8844831fd9c7adaed24f97b49d6ec1f7e2edc7b49ab7a7'
# milanote-app-releases.s3.amazonaws.com was verified as official when first introduced to the cask
url "https://milanote-app-releases.s3.amazonaws.com/Milanote-#{version}.dmg"
appcast 'https://www.milanote.com/download-mac-app'
name 'Milanote'
homepage 'https://www.milanote.com/'
app 'Milanote.app'
zap trash: [
'~/Library/Application Support/Milanote',
'~/Library/Caches/com.milanote.app',
'~/Library/Caches/com.milanote.app.ShipIt',
'~/Library/Library/Logs/Milanote',
'~/Library/Preferences/com.milanote.app.helper.plist',
'~/Library/Preferences/com.milanote.app.plist',
]
end
| {
"content_hash": "ee55e0fd049f7d1161b487fd3b389517",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 101,
"avg_line_length": 38.76190476190476,
"alnum_prop": 0.6609336609336609,
"repo_name": "scribblemaniac/homebrew-cask",
"id": "c9f235fd7747e482ceaea1621d96d08806f3c100",
"size": "814",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Casks/milanote.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Dockerfile",
"bytes": "778"
},
{
"name": "HCL",
"bytes": "1658"
},
{
"name": "Python",
"bytes": "3532"
},
{
"name": "Ruby",
"bytes": "2086879"
},
{
"name": "Shell",
"bytes": "36113"
}
],
"symlink_target": ""
} |
namespace Atata
{
/// <summary>
/// Represents the text select control (<c><select></c>).
/// Default search is performed by the label.
/// Selects an option using text.
/// Option selection is configured via <see cref="SelectOptionBehaviorAttribute"/>.
/// Possible selection behavior attributes are:
/// <see cref="SelectsOptionByTextAttribute"/>, <see cref="SelectsOptionByValueAttribute"/>,
/// <see cref="SelectsOptionByLabelAttributeAttribute"/> and <see cref="SelectsOptionByAttributeAttribute"/>.
/// Default option selection is performed by text using <see cref="SelectsOptionByTextAttribute"/>.
/// </summary>
/// <typeparam name="TOwner">The type of the owner page object.</typeparam>
public class Select<TOwner> : Select<string, TOwner>
where TOwner : PageObject<TOwner>
{
}
}
| {
"content_hash": "6f045d136c1ea01caf84356d6f5143f9",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 113,
"avg_line_length": 48.333333333333336,
"alnum_prop": 0.6816091954022988,
"repo_name": "YevgeniyShunevych/Atata",
"id": "fb5c7c7f118e6dce08c104cab2dded0ef69b272e",
"size": "872",
"binary": false,
"copies": "1",
"ref": "refs/heads/v2.0.0",
"path": "src/Atata/Components/Fields/Select`1.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "220178"
},
{
"name": "HTML",
"bytes": "8639"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "6e37bc3243e4b1e73773f2f2689e4b20",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "cd82d0eab0a45f7f2a6d1d61a28e67b25bf8a4e8",
"size": "173",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Lamiales/Lamiaceae/Callicarpa/Callicarpa woodii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<sky-modal>
<sky-modal-header>{{ title }}</sky-modal-header>
<sky-modal-content>
<form [formGroup]="form" (submit)="modal.save()">
<ng-container *ngFor="let field of fields" class="row">
<ng-container [ngSwitch]="title">
<ng-container *ngSwitchDefault>
<sky-input-box>
<label class="sky-control-label" [for]="input.id">{{
field
}}</label>
<input
[formControlName]="field"
skyId
#input="skyId"
type="text"
class="sky-form-control"
/>
</sky-input-box>
</ng-container>
<ng-container *ngSwitchCase="'Color'">
<div class="sky-form-group">
<label class="sky-control-label" [for]="input.id">{{
field
}}</label>
<sky-colorpicker #colorPicker>
<input
[formControlName]="field"
[skyColorpickerInput]="colorPicker"
skyId
#input="skyId"
type="text"
/>
</sky-colorpicker>
</div>
</ng-container>
</ng-container>
</ng-container>
</form>
</sky-modal-content>
<sky-modal-footer>
<button
class="sky-btn sky-btn-primary sky-margin-inline-sm"
type="button"
(click)="modal.save()"
>
Save
</button>
<button class="sky-btn sky-btn-link" type="button" (click)="modal.close()">
Close
</button>
</sky-modal-footer>
</sky-modal>
| {
"content_hash": "8c5071bd31745ff37639b00dfd127e9a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 79,
"avg_line_length": 30.79245283018868,
"alnum_prop": 0.47058823529411764,
"repo_name": "blackbaud/skyux",
"id": "1804a704789a2ad92e71cbf8ba60d5247559e5f0",
"size": "1632",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "apps/code-examples/src/app/code-examples/pages/action-hub/settings-modal.component.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "806202"
},
{
"name": "JavaScript",
"bytes": "39129"
},
{
"name": "SCSS",
"bytes": "320321"
},
{
"name": "TypeScript",
"bytes": "7288448"
}
],
"symlink_target": ""
} |
package org.keycloak.configuration;
import java.util.Map;
import java.util.TreeMap;
import org.eclipse.microprofile.config.spi.ConfigSource;
/**
* The only reason for this config source is to keep the Keycloak specific properties when configuring the server so that
* they are read again when running the server after the configuration.
*/
public class SysPropConfigSource implements ConfigSource {
public Map<String, String> getProperties() {
Map<String, String> output = new TreeMap<>();
for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) {
String key = (String) entry.getKey();
if (key.startsWith(MicroProfileConfigProvider.NS_KEYCLOAK_PREFIX)) {
output.put(key, entry.getValue().toString());
}
}
return output;
}
public String getValue(final String propertyName) {
return System.getProperty(propertyName);
}
public String getName() {
return "KcSysPropConfigSource";
}
public int getOrdinal() {
return 400;
}
}
| {
"content_hash": "d299ff71d4a35e8a574edd4e80749245",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 121,
"avg_line_length": 28.657894736842106,
"alnum_prop": 0.6666666666666666,
"repo_name": "vmuzikar/keycloak",
"id": "cb798e5e8d2f9d5c2b5a8dd378dd2b58103a8df8",
"size": "1763",
"binary": false,
"copies": "1",
"ref": "refs/heads/quickstarts",
"path": "quarkus/runtime/src/main/java/org/keycloak/configuration/SysPropConfigSource.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "4656"
},
{
"name": "Batchfile",
"bytes": "11293"
},
{
"name": "CSS",
"bytes": "100416"
},
{
"name": "Dockerfile",
"bytes": "3788"
},
{
"name": "FreeMarker",
"bytes": "188469"
},
{
"name": "Gnuplot",
"bytes": "2173"
},
{
"name": "Groovy",
"bytes": "4973"
},
{
"name": "HTML",
"bytes": "958755"
},
{
"name": "Java",
"bytes": "28636514"
},
{
"name": "JavaScript",
"bytes": "2120739"
},
{
"name": "Python",
"bytes": "74970"
},
{
"name": "Scala",
"bytes": "67175"
},
{
"name": "Shell",
"bytes": "73331"
},
{
"name": "TypeScript",
"bytes": "182292"
},
{
"name": "XSLT",
"bytes": "37701"
}
],
"symlink_target": ""
} |
<?php
namespace Black\Component\Page\Domain\Model;
/**
* Interface WebPageWriteRepository
*/
interface WebPageWriteRepository
{
public function add(WebPage $webPage);
public function remove(WebPage $webPage);
}
| {
"content_hash": "ff5c3abb65b187d4b45b0e12b7139495",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 45,
"avg_line_length": 17.23076923076923,
"alnum_prop": 0.75,
"repo_name": "black-project/page",
"id": "00f2c400d3945d1b89dc04b558cb3e94873a28d1",
"size": "443",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Black/Component/Page/Domain/Model/WebPageWriteRepository.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "81238"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon.identity</groupId>
<artifactId>sso-saml-feature</artifactId>
<version>4.4.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.sso.saml.feature</artifactId>
<packaging>pom</packaging>
<name>SAML 2.0 Web SSO Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the bundles required for Identity SAML2.0 based Single Sign-on functionality
</description>
<dependencies>
<dependency>
<groupId>org.wso2.carbon.identity</groupId>
<artifactId>org.wso2.carbon.identity.sso.saml.server.feature</artifactId>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity</groupId>
<artifactId>org.wso2.carbon.identity.sso.saml.ui.feature</artifactId>
<type>zip</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>${carbon.p2.plugin.version}</version>
<executions>
<execution>
<id>4-p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>org.wso2.carbon.identity.sso.saml</id>
<propertiesFile>../../etc/feature.properties</propertiesFile>
<includedFeatures>
<includedFeatureDef>
org.wso2.carbon.identity:org.wso2.carbon.identity.sso.saml.server.feature
</includedFeatureDef>
<includedFeatureDef>
org.wso2.carbon.identity:org.wso2.carbon.identity.sso.saml.ui.feature
</includedFeatureDef>
</includedFeatures>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
| {
"content_hash": "94585f33660a8eae63309fa73091884e",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 201,
"avg_line_length": 42.35,
"alnum_prop": 0.5608028335301063,
"repo_name": "cdwijayarathna/carbon-identity",
"id": "79178cc1b0b5bf6bff00eeb034e3ced799681a33",
"size": "3388",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "features/sso-saml/org.wso2.carbon.identity.sso.saml.feature/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "97558"
},
{
"name": "HTML",
"bytes": "89563"
},
{
"name": "Java",
"bytes": "10125395"
},
{
"name": "JavaScript",
"bytes": "245863"
},
{
"name": "PLSQL",
"bytes": "47991"
},
{
"name": "Thrift",
"bytes": "338"
},
{
"name": "XSLT",
"bytes": "951"
}
],
"symlink_target": ""
} |
package io.netty.channel;
import static org.junit.Assert.assertTrue;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.LoggingHandler.Event;
import io.netty.channel.local.LocalAddress;
import org.junit.Test;
public class ReentrantChannelTest extends BaseChannelTest {
@Test
public void testWritabilityChanged() throws Exception {
LocalAddress addr = new LocalAddress("testWritabilityChanged");
ServerBootstrap sb = getLocalServerBootstrap();
sb.bind(addr).sync().channel();
Bootstrap cb = getLocalClientBootstrap();
setInterest(Event.WRITE, Event.FLUSH, Event.WRITABILITY);
Channel clientChannel = cb.connect(addr).sync().channel();
clientChannel.config().setWriteBufferLowWaterMark(512);
clientChannel.config().setWriteBufferHighWaterMark(1024);
ChannelFuture future = clientChannel.write(createTestBuf(2000));
clientChannel.flush();
future.sync();
clientChannel.close().sync();
assertLog(
"WRITABILITY: writable=false\n" +
"WRITABILITY: writable=true\n" +
"WRITE\n" +
"WRITABILITY: writable=false\n" +
"FLUSH\n" +
"WRITABILITY: writable=true\n");
}
@Test
public void testFlushInWritabilityChanged() throws Exception {
LocalAddress addr = new LocalAddress("testFlushInWritabilityChanged");
ServerBootstrap sb = getLocalServerBootstrap();
sb.bind(addr).sync().channel();
Bootstrap cb = getLocalClientBootstrap();
setInterest(Event.WRITE, Event.FLUSH, Event.WRITABILITY);
Channel clientChannel = cb.connect(addr).sync().channel();
clientChannel.config().setWriteBufferLowWaterMark(512);
clientChannel.config().setWriteBufferHighWaterMark(1024);
clientChannel.pipeline().addLast(new ChannelInboundHandlerAdapter() {
@Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
if (!ctx.channel().isWritable()) {
ctx.channel().flush();
}
ctx.fireChannelWritabilityChanged();
}
});
assertTrue(clientChannel.isWritable());
clientChannel.write(createTestBuf(2000)).sync();
clientChannel.close().sync();
assertLog(
"WRITABILITY: writable=false\n" +
"FLUSH\n" +
"WRITABILITY: writable=true\n" +
"WRITE\n" +
"WRITABILITY: writable=false\n" +
"FLUSH\n" +
"WRITABILITY: writable=true\n");
}
}
| {
"content_hash": "01116dfeecc41bd06b35b315bbe66853",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 95,
"avg_line_length": 31.67058823529412,
"alnum_prop": 0.6367013372956909,
"repo_name": "kyle-liu/netty4study",
"id": "3f75017e3d6f8b62ddaa719949419f9d71068b2b",
"size": "3326",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "transport/src/test/java/io/netty/channel/ReentrantChannelTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "49"
},
{
"name": "Java",
"bytes": "5545922"
},
{
"name": "JavaScript",
"bytes": "1514"
}
],
"symlink_target": ""
} |
require 'set'
require 'jinx/helpers/inflector'
require 'jinx/helpers/validation'
module CaTissue
class AbstractSpecimen
# Sets the specimen type to the specified value. The value can be a permissible caTissue String value or
# the shortcut symbols :fresh, :fixed and +:frozen+.
#
# @param [String, Symbol, nil] value the value to set
def specimen_type=(value)
value = value.to_s.capitalize_first + ' Tissue' if Symbol === value
setSpecimenType(value)
end
add_attribute_aliases(:parent => :parent_specimen,
:children => :child_specimens,
:events => :specimen_events,
:specimen_event_parameters => :specimen_events,
:event_parameters => :specimen_events,
:characteristics => :specimen_characteristics)
# @quirk caTissue initial_quantity must be set (cf. Bug #160)
add_attribute_defaults(:initial_quantity => 0.0, :pathological_status => 'Not Specified', :specimen_type => 'Not Specified')
add_mandatory_attributes(:lineage, :pathological_status, :specimen_class, :specimen_type, :specimen_characteristics)
# @quirk caTissue Specimen characteristics are auto-generated but SpecimenRequirement
# characteristics are not. It is safe to set the +:autogenerated+ flag for both
# AbstractSpecimen subclasses. This results in an unnecessary SpecimenRequirement
# create database query, but SpecimenRequirement create is rare and there is no harm.
#
# @quirk caTissue Specimen characteristics is cascaded but is not an exclusive dependent,
# since it is shared by aliquots.
#
# @quirk caTissue Bug 166: API update Specimen ignores a SpecimenCharacteristics with a
# different id. Guard against updating a Specimen with a SpecimenCharacteristics whose id
# differs from the existing id.
#
# @quirk caTissue Unlike other dependents, AbstractSpecimen characteristics, events and child
# specimens have cascade style +all+. This implies that an AbstractSpecimen update does not
# create a referenced dependent. AbstractSpecimen create cascades to create and AbstractSpecimen
# update cascades to update, but AbstractSpecimen update does not cascade to create.
# The +:no_cascade_update_to_create flag+ is set to handle this feature of cascade style +all+.
qualify_attribute(:specimen_characteristics, :cascaded, :fetched, :autogenerated, :no_cascade_update_to_create)
# The +:no_cascade_update_to_create+ flag is set since specimen_events has cascade style +all+.
add_dependent_attribute(:specimen_event_parameters, :disjoint)
set_attribute_inverse(:parent_specimen, :child_specimens)
# @quirk caTissue A Specimen update cascades to a child specimen, but the update is not reflected
# in the caTissue updateObject result. Work-around is to fetch the updated child from the
# database to ensure that the database content reflects the intended update argument.
#
# The +:no_cascade_update_to_create+ flag is set since child_specimens has cascade style +all+.
add_dependent_attribute(:child_specimens, :unfetched, :fetch_saved, :no_cascade_update_to_create)
# The specimen_class attribute constants.
class SpecimenClass
TISSUE = 'Tissue'
FLUID = 'Fluid'
MOLECULAR = 'Molecular'
CELL = 'Cell'
# The standard units used for each specimen class.
UNIT_HASH = {TISSUE => 'gm', FLUID => 'ml', MOLECULAR => 'ug'}
# @return [Boolean] whether the value is an accepted tissue class value
def self.include?(value)
EXTENT.include?(value)
end
private
EXTENT = Set.new([TISSUE, FLUID, MOLECULAR, CELL])
end
# Initializes this AbstractSpecimen. The default +specimen_class+ is inferred from this
# AbstractSpecimen instance's subclass.
def initialize
super
self.specimen_class ||= infer_specimen_class(self.class)
end
# @return [Boolean] whether this specimen is derived from a parent specimen
def derived?
!!parent
end
# @return [Boolean] whether this specimen is an aliquot
def aliquot?
lineage ||= default_lineage
lineage == 'Aliquot'
end
# @return [<AbstractSpecimen>] this specimen's aliquots
def aliquots
children.filter { |child| child.aliquot? }
end
# @return [Boolean] whether this specimen's type is 'Fresh Tissue'
def fresh?
specimen_type == 'Fresh Tissue'
end
# @return [Boolean] whether this specimen's type starts with 'Fixed'
def fixed?
specimen_type =~ /^Fixed/
end
# @return [Boolean] whether this specimen's type starts with 'Frozen'
def frozen?
specimen_type =~ /^Frozen/
end
# @return <AbstractSpecimen> the transitive closure consisting of this AbstractSpecimen
# and all AbstractSpecimen in the derivation hierarcy.
def closure
children.inject([self]) { |coll, spc| coll.concat(spc.closure) }
end
# Returns the standard unit for this specimen
def standard_unit
self.specimen_class ||= infer_specimen_class(self.class)
SpecimenClass::UNIT_HASH[self.specimen_class]
end
# Derives a new specimen from this specimen. The options are described in
# {Specimen.create_specimen}, with one addition:
# * +:count+(+Integer+) - the optional number of specimens to derive
#
# If the +:count+ option is greater than one and the +:specimen_class+,
# +:specimen_type+ and +:specimen_characteristics+ options are not set to values
# which differ from the respective values for this Specimen, then the specimen is
# aliquoted, otherwise the derived specimens are created independently, e.g.:
# spc = Specimen.create_specimen(:specimen_class => :tissue, :specimen_type => :frozen)
# spc.derive(:count => 1) #=> not aliquoted
# spc.derive(:count => 2) #=> aliquoted
# spc.derive(:specimen_type => 'Frozen Specimen') #=> two aliquots
#
# The default derived _initial_quantity_ is the parent specimen _available_quantity_
# divided by _count_ for aliquots, zero otherwise. If the child _specimen_class_
# is the same as this Specimen class, then this parent Specimen's _available_quantity_
# is decremented by the child _initial_quantity_, e.g.:
# spc.available_quantity #=> 4
# spc.derive(:initial_quantity => 1)
# spc.available_quantity #=> 3
# spc.derive(:count => 2, :specimen_type => 'Frozen Tissue')
# spc.derive(:count => 2) #=> two aliquots with quantity 1 each
# spc.available_quantity #=> 0
#
# The default derived specimen label is _label_+_+_n_, where _label_ is this specimen's
# label and _n_ is this specimen's child count after including the new derived specimen,
# e.g. +3090_3+ for the third child in the parent specimen with label +3090+.
#
# @param [{Symbol => Object}, nil] opts the attribute => value hash
# @return [AbstractSpecimen, <AbstractSpecimen>] the new derived specimen if the +:count+ option
# is missing or one, otherwise an Array of _count_ derived specimens
# @raise [Jinx::ValidationError] if an aliquoted parent available quantity is not greater than zero
# or the derived specimen quantities exceed the parent available quantity
def derive(opts=Hash::EMPTY_HASH)
# add defaults
add_defaults if specimen_class.nil?
# copy the option hash
opts = opts.dup
# standardize the requirement param, if any
rqmt = opts.delete(:requirement)
opts[:specimen_requirement] ||= rqmt if rqmt
# the default specimen parameters
unless opts.has_key?(:specimen_requirement) then
opts[:specimen_class] ||= self.specimen_class ||= infer_specimen_class
opts[:specimen_type] ||= self.specimen_type
end
unless Class === opts[:specimen_class] then
opts[:specimen_class] = infer_class(opts)
end
count = opts.delete(:count)
count ||= 1
aliquot_flag = false
if count > 1 and opts[:specimen_class] == self.class and opts[:specimen_type] == self.specimen_type then
# aliquots share the specimen_characteristics
child_chr = opts[:specimen_characteristics] ||= specimen_characteristics
aliquot_flag = child_chr == specimen_characteristics
end
# set aliquot parameters if necessary
if aliquot_flag then set_aliquot_parameters(opts, count) end
# make the derived specimens
count == 1 ? create_derived(opts) : Array.new(count) { create_derived(opts) }
end
# Returns whether this AbstractSpecimen is minimally consistent with the other specimen.
# This method augments the +Jinx::Resource.minimal_match?+ with an additional restriction
# that the other specimen is the same type as this specimen and
# is a tolerant match on specimen class, specimen type and pathological status.
# A _tolerant_ match condition holds if the other attribute value is equal to this
# AbstractSpecimen's attribute value or the other value is the default 'Not Specified'.
#
# @param (see Jinx::Resource#minimal_match?)
# @return (see Jinx::Resource#minimal_match?)
def minimal_match?(other)
super and tolerant_match?(other, TOLERANT_MATCH_ATTRS)
end
private
TOLERANT_MATCH_ATTRS = [:specimen_class, :specimen_type, :pathological_status]
# The attributes which can be merged as defaults from a parent into a derived child Specimen.
DERIVED_MERGEABLE_ATTRS = [:activity_status, :pathological_status, :specimen_class, :specimen_type]
# Sets special aliquot parameters for the given count of aliquots.
# This default implementation is a no-op. Subclasses can override.
#
# @param [{Symbol => Object}] params the specimen attribute => value hash
# @param [Integer] count the number of aliquots
def set_aliquot_parameters(params, count); end
# Overrides +Jinx::Resource.each_defaultable_reference} to visit the {CaTissue::SpecimenCharacteristics+.
# The characteristics are not dependent since they can be shared among aliquots.
# However, the defaults should be added to them. Do so here.
#
# @yield (see Jinx::Resource#each_defaultable_reference)
def each_defaultable_reference
super { |dep| yield dep }
yield characteristics if characteristics
end
def add_defaults_local
super
# parent pathological status is preferred over the configuration defaults
self.pathological_status ||= parent.pathological_status if parent
# the configuration defaults
# set the required but redundant tissue class and lineage values
self.specimen_class ||= infer_specimen_class(self.class)
self.lineage ||= default_lineage
# copy the parent characteristics or add empty characteristics
self.characteristics ||= default_characteristics
end
# Returns the Class from the given params hash.If the +:specimen_class+ parameter
# is set to a Class, then this method returns that Class. Otherwise, if the parameter is a
# String or Symbol, then the Class is formed from the parameter as a prefix and 'Specimen' or
# 'SpecimenRequirement' depending on this AbstractSpecimen's subclass. If the
# :specimen_class parameter is missing and there is a +:specimen_requirement+ parameter,
# then the specimen requirement specimen_class attribute value is used.
#
# @param [{Symbol => Object}] params the specimen attribute => value hash
# @return [Class] the AbstactSpecimen subclass to use
def infer_class(params)
opt = params[:specimen_class]
if opt.nil? then
rqmt = params[:specimen_requirement]
opt = rqmt.specimen_class if rqmt
end
raise ArgumentError.new("Specimen class is missing from the create parameters") if opt.nil?
return opt if Class === opt
# infer the specimen domain class from the specimen_class prefix and Specimen or SpecimenRequirement suffix
cls_nm = opt.to_s.capitalize_first + 'Specimen'
cls_nm += 'Requirement' if CaTissue::SpecimenRequirement === self
CaTissue.const_get(cls_nm)
end
# Creates a derived specimen. The options is an attribute => value hash. The options
# can also include a +:specimen_requirement+. The non-domain attribute values of the
# new derived specimen are determined according to the following precedence rule:
# 1. The attribute => value option.
# 2. The requirement property value.
# 3. This specimen's property value.
#
# @param [{Symbol => Object}] opts the derived specimen attribute => value hash
# @return [AbstractSpecimen] the derived specimen or requirement
def create_derived(opts)
# Merge the non-domain attribute values from this specimen, unless there is a requirement.
opts = value_hash(DERIVED_MERGEABLE_ATTRS).merge!(opts) unless opts.has_key?(:specimen_requirement)
# Copy this specimen's characteristics, if not already given in the options.
opts[:specimen_characteristics] ||= default_derived_characteristics
# Make the new specimen.
spc = Specimen.create_specimen(opts)
# The derived specimen's parent is this specimen.
spc.parent = self
spc
end
# Returns characteristics to use for a derived specimen. The new characteristics is copied from this
# parent specimen's characteristics, without the identifier.
#
# @return [CaTissue::SpecimenCharacteristics, nil] a copy of this Specimen's specimen_characteristics, or nil if none
def default_derived_characteristics
chrs = specimen_characteristics || return
pas = chrs.class.nondomain_attributes.reject { |pa| pa == :identifier }
chrs.copy(pas)
end
# @return a copy of the parent characteristics, if any, or a new SpecimenCharacteristics otherwise
def default_characteristics
if parent and parent.characteristics then
parent.characteristics.copy
else
CaTissue::SpecimenCharacteristics.new
end
end
# Returns the the default lineage value computed as follows:
# * if there is no parent specimen, then 'New'
# * otherwise, if this Specimen's specimen_characteristics object is identical to that of
# the parent, then 'Aliquot'
# * otherwise, 'Derived'
# The aliquot condition requires that the specimen_characteristics is the same object,
# not just the same content. This odd condition is a caTissue artifact. A more sensible
# criterion is whether this Specimen and its parent share the same tissue_class and
# tissue_type, but so it goes.
#
# @return ['New', 'Aliqout', 'Derived'] the lineage to use
def default_lineage
if parent.nil? then
'New'
elsif specimen_characteristics.equal?(parent.specimen_characteristics) then
'Aliquot'
else
'Derived'
end
end
# Infers the specimen class from the first word on the specified klass Ruby class name.
#
# @example
# infer_specimen_class(CaTissue::TissueRequirement) #=> "Tissue"
#
# @param [Class, nil] the AbstractSpecimen domain object class (default this specimen's class)
# @return [String] the +specimen_class+ value
def infer_specimen_class(klass=self.class)
klass.to_s[/(\w+?)(Specimen(Requirement)?)$/, 1] if klass
end
end
end | {
"content_hash": "7ffe6d0da7662ec73f7ec728ad1b811a",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 128,
"avg_line_length": 45.913690476190474,
"alnum_prop": 0.6953393401179749,
"repo_name": "caruby/tissue",
"id": "16faa621b3332881bae279061a1985df54b95596",
"size": "15427",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/catissue/domain/abstract_specimen.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "2319"
},
{
"name": "Ruby",
"bytes": "529962"
},
{
"name": "Shell",
"bytes": "396"
}
],
"symlink_target": ""
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>W28602_text</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div style="margin-left: auto; margin-right: auto; width: 800px; overflow: hidden;">
<div style="float: left;">
<a href="page11.html">«</a>
</div>
<div style="float: right;">
</div>
</div>
<hr/>
<div style="position: absolute; margin-left: 217px; margin-top: 135px;">
<p class="styleSans19.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">#5 Energy Servicesv </p>
</div>
<div style="position: absolute; margin-left: 189px; margin-top: 597px;">
<p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">july 22, 2014 </p>
</div>
<div style="position: absolute; margin-left: 189px; margin-top: 841px;">
<p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">North Dakota Industrial Commission Oil & Gas Division <br/>600 North Boulevard Ave Department 405 <br/>Bismarck, North Dakota 58505 </p>
</div>
<div style="position: absolute; margin-left: 189px; margin-top: 1303px;">
<p class="styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">RE: EOG Resources, Inc. Parshall 154—17211-1 Mountrail County, ND Rig: Stoneham #17 </p>
</div>
<div style="position: absolute; margin-left: 217px; margin-top: 1656px;">
<p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Dear North Dakota Industrial Commission: </p>
</div>
<div style="position: absolute; margin-left: 216px; margin-top: 1765px;">
<p class="styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Please find enclosed the original certified Rate Gyro Surveys run Erom Surface to a depth of 1,946’ MD. on the above mentioned well. <br/>If I can be of any further assistance, please do not hesitate to call me at 936-442—2567. </p>
</div>
<div style="position: absolute; margin-left: 217px; margin-top: 2308px;">
<p class="styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Sincerely, </p>
</div>
<div style="position: absolute; margin-left: 217px; margin-top: 2552px;">
<p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Crystal Venino MS Survey </p>
</div>
<div style="position: absolute; margin-left: 380px; margin-top: 3068px;">
<p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 434px; margin-top: 3068px;">
<p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"> <br/>MS Directional </p>
</div>
<div style="position: absolute; margin-left: 1955px; margin-top: 135px;">
<p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">742 W. White Ave Grand Junction. Colorado 81501 </p>
</div>
<div style="position: absolute; margin-left: 2009px; margin-top: 271px;">
<p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">970.257.1911 (office) 970.257.1947(fax) www.msenergyservioes.com </p>
</div>
<div style="position: absolute; margin-left: 1194px; margin-top: 3068px;">
<p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 1275px; margin-top: 3068px;">
<p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 977px; margin-top: 3096px;">
<p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">N5 Guidance </p>
</div>
<div style="position: absolute; margin-left: 1792px; margin-top: 3068px;">
<p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 1900px; margin-top: 3068px;">
<p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 1439px; margin-top: 3096px;">
<p class="styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">M8 Survey </p>
</div>
<div style="position: absolute; margin-left: 1873px; margin-top: 3096px;">
<p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">M5 Wimliae </p>
</div>
</body>
</html>
| {
"content_hash": "cdb2721fdcaf2046443223f1dd3441b1",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 352,
"avg_line_length": 55.084210526315786,
"alnum_prop": 0.712019873877317,
"repo_name": "datamade/elpc_bakken",
"id": "69a7b6ca4c030cf2436a685215ab2505a00e8221",
"size": "5246",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ocr_extracted/W28602_text/page12.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "17512999"
},
{
"name": "HTML",
"bytes": "421900941"
},
{
"name": "Makefile",
"bytes": "991"
},
{
"name": "Python",
"bytes": "7186"
}
],
"symlink_target": ""
} |
package org.http4s
import java.util.Locale
import scalaz.scalacheck.ScalazProperties
import org.http4s.parser.Rfc2616BasicRules
import org.scalacheck.Prop.forAll
import Http4s._
class MethodSpec extends Http4sSpec {
import Method._
"parses own string rendering to equal value" in {
forAll(tokens) { token => fromString(token).map(_.renderString) must be_\/-(token) }
}
"only tokens are valid methods" in {
prop { s: String => fromString(s).isRight must_== (Rfc2616BasicRules.isToken(s)) }
}
"name is case sensitive" in {
prop { m: Method => {
val upper = m.name.toUpperCase(Locale.ROOT)
val lower = m.name.toLowerCase(Locale.ROOT)
(upper != lower) ==> { fromString(upper) must_!= fromString(lower) }
}}
}
checkAll(ScalazProperties.equal.laws[Method])
"methods are equal by name" in {
prop { m: Method => Method.fromString(m.name) must be_\/-(m) }
}
"safety implies idempotence" in {
foreach(Method.registered.filter(_.isSafe)) { _.isIdempotent }
}
}
| {
"content_hash": "7ee67c216dc3e5d51ed6b85ec6e44b78",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 88,
"avg_line_length": 25.675,
"alnum_prop": 0.6777020447906524,
"repo_name": "hvesalai/http4s",
"id": "904a23ec1069a150bf2c12c494627940bb65d563",
"size": "1027",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/test/scala/org/http4s/MethodSpec.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "18"
},
{
"name": "JavaScript",
"bytes": "9"
},
{
"name": "Scala",
"bytes": "989823"
},
{
"name": "Shell",
"bytes": "1324"
}
],
"symlink_target": ""
} |
@implementation XBMessage
@end
| {
"content_hash": "7328add19467a7459f3197d10783adc0",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 25,
"avg_line_length": 10.666666666666666,
"alnum_prop": 0.8125,
"repo_name": "EugeneNguyen/XBChatModule",
"id": "31a6aabf6d346c90e10466a99c8b3e8d61793010",
"size": "137",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Pod/Classes/XBMessage.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "74717"
},
{
"name": "C++",
"bytes": "4467"
},
{
"name": "Objective-C",
"bytes": "2957287"
},
{
"name": "Ruby",
"bytes": "2900"
},
{
"name": "Shell",
"bytes": "15470"
}
],
"symlink_target": ""
} |
<?php
defined( 'ABSPATH' ) or die( 'Cheatin’ uh?' );
/**
* Allow to purge the Varnish cache
*
* @since 2.6.8
*
* @param bool true will force the Varnish purge
*/
if ( apply_filters( 'do_rocket_varnish_http_purge', false ) || get_rocket_option( 'varnish_auto_purge', 0 ) ) :
/**
* Purge all the domain
*
* @since 2.6.8
*
* @param string $root The path of home cache file.
* @param string $lang The current lang to purge.
* @param string $url The home url.
*/
function rocket_varnish_clean_domain( $root, $lang, $url ) {
rocket_varnish_http_purge( trailingslashit( $url ) . '?vregex' );
}
add_action( 'before_rocket_clean_domain', 'rocket_varnish_clean_domain', 10, 3 );
/**
* Purge a specific page
*
* @since 2.6.8
*
* @param string $url The url to purge.
*/
function rocket_varnish_clean_file( $url ) {
rocket_varnish_http_purge( trailingslashit( $url ) . '?vregex' );
}
add_action( 'before_rocket_clean_file', 'rocket_varnish_clean_file' );
/**
* Purge the homepage and its pagination
*
* @since 2.6.8
*
* @param string $root The path of home cache file.
* @param string $lang The current lang to purge.
*/
function rocket_varnish_clean_home( $root, $lang ) {
$home_url = trailingslashit( get_rocket_i18n_home_url( $lang ) );
$home_pagination_url = $home_url . trailingslashit( $GLOBALS['wp_rewrite']->pagination_base ) . '?vregex';
rocket_varnish_http_purge( $home_url );
rocket_varnish_http_purge( $home_pagination_url );
}
add_action( 'before_rocket_clean_home', 'rocket_varnish_clean_home', 10, 2 );
endif;
| {
"content_hash": "fb93c6b9d08ce093f6fb7e4f59e7787c",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 111,
"avg_line_length": 29.537037037037038,
"alnum_prop": 0.6495297805642634,
"repo_name": "smile-monkey/xusah.boutique",
"id": "a7182e0a3d6afa774599d64f426333dccb577ffa",
"size": "1595",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "wp-content/plugins/wp-rocket/inc/3rd-party/hosting/varnish.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "512954"
},
{
"name": "Java",
"bytes": "14870"
},
{
"name": "JavaScript",
"bytes": "381001"
},
{
"name": "PHP",
"bytes": "2990444"
}
],
"symlink_target": ""
} |
package io.openvidu.recording.java.test;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.junit.Assert;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.github.bonigarcia.seljup.SeleniumExtension;
import io.github.bonigarcia.wdm.WebDriverManager;
import io.openvidu.java.client.OpenVidu;
import io.openvidu.java.client.OpenViduHttpException;
import io.openvidu.java.client.OpenViduJavaClientException;
import io.openvidu.java.client.Recording;
import io.openvidu.java.client.Recording.OutputMode;
import io.openvidu.test.browsers.BrowserUser;
import io.openvidu.test.browsers.ChromeUser;
import ws.schild.jave.EncoderException;
import ws.schild.jave.MultimediaInfo;
import ws.schild.jave.MultimediaObject;
/**
* E2E tests for openvidu-java-recording app
*
* mvn -Dtest=AppTestE2e -DAPP_URL=https://localhost:5000/
* -DOPENVIDU_URL=https://localhost:4443/ -DOPENVIDU_SECRET=MY_SECRET
* -DNUMBER_OF_ATTEMPTS=30 -DRECORDING_DURATION=5 -DDURATION_THRESHOLD=5 test
*
* @author Pablo Fuente (pablofuenteperez@gmail.com)
*/
@DisplayName("E2E tests for openvidu-java-recording")
@ExtendWith(SeleniumExtension.class)
@RunWith(JUnitPlatform.class)
public class AppTestE2e {
private static final Logger log = LoggerFactory.getLogger(AppTestE2e.class);
static String OPENVIDU_SECRET = "MY_SECRET";
static String OPENVIDU_URL = "https://localhost:4443/";
static String APP_URL = "https://localhost:5000/";
static int NUMBER_OF_ATTEMPTS = 10;
static int RECORDING_DURATION = 5; // seconds
static double DURATION_THRESHOLD = 10.0; // seconds
static String RECORDING_PATH = "/opt/openvidu/recordings/";
private BrowserUser user;
private static OpenVidu OV;
boolean deleteRecordings = true;
@BeforeAll()
static void setupAll() {
WebDriverManager.chromedriver().setup();
String appUrl = System.getProperty("APP_URL");
if (appUrl != null) {
APP_URL = appUrl;
}
log.info("Using URL {} to connect to openvidu-recording-java app", APP_URL);
String openviduUrl = System.getProperty("OPENVIDU_URL");
if (openviduUrl != null) {
OPENVIDU_URL = openviduUrl;
}
log.info("Using URL {} to connect to openvidu-server", OPENVIDU_URL);
String openvidusecret = System.getProperty("OPENVIDU_SECRET");
if (openvidusecret != null) {
OPENVIDU_SECRET = openvidusecret;
}
log.info("Using secret {} to connect to openvidu-server", OPENVIDU_SECRET);
String numberOfAttempts = System.getProperty("NUMBER_OF_ATTEMPTS");
if (numberOfAttempts != null) {
NUMBER_OF_ATTEMPTS = Integer.parseInt(numberOfAttempts);
}
log.info("Number of attempts: {}", NUMBER_OF_ATTEMPTS);
String recordingDuration = System.getProperty("RECORDING_DURATION");
if (recordingDuration != null) {
RECORDING_DURATION = Integer.parseInt(recordingDuration);
}
log.info("Recording duration: {} s", RECORDING_DURATION);
String durationThreshold = System.getProperty("DURATION_THRESHOLD");
if (durationThreshold != null) {
DURATION_THRESHOLD = Double.parseDouble(durationThreshold);
}
log.info("Duration threshold: {} s", DURATION_THRESHOLD);
String recordingPath = System.getProperty("RECORDING_PATH");
if (recordingPath != null) {
recordingPath = recordingPath.endsWith("/") ? recordingPath : recordingPath + "/";
RECORDING_PATH = recordingPath;
}
log.info("Using recording path {} to search for recordings", RECORDING_PATH);
try {
log.info("Cleaning folder {}", RECORDING_PATH);
FileUtils.cleanDirectory(new File(RECORDING_PATH));
} catch (IOException e) {
log.error(e.getMessage());
}
OV = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET);
}
@AfterEach()
void dispose() {
try {
OV.fetch();
} catch (OpenViduJavaClientException | OpenViduHttpException e1) {
log.error("Error fetching sessions: {}", e1.getMessage());
}
OV.getActiveSessions().forEach(session -> {
try {
session.close();
log.info("Session {} successfully closed", session.getSessionId());
} catch (OpenViduJavaClientException | OpenViduHttpException e2) {
log.error("Error closing session: {}", e2.getMessage());
}
});
if (deleteRecordings) {
try {
OV.listRecordings().forEach(recording -> {
if (recording.getStatus().equals(Recording.Status.started)) {
try {
OV.stopRecording(recording.getId());
log.info("Recording {} successfully stopped", recording.getId());
} catch (OpenViduJavaClientException | OpenViduHttpException e) {
log.error("Error stopping recording {}: {}", recording.getId(), e.getMessage());
}
}
try {
OV.deleteRecording(recording.getId());
log.info("Recording {} successfully deleted", recording.getId());
} catch (OpenViduJavaClientException | OpenViduHttpException e1) {
log.error("Error deleting recording {}: {}", recording.getId(), e1.getMessage());
}
});
} catch (OpenViduJavaClientException | OpenViduHttpException e2) {
log.error("Error listing recordings: {}", e2.getMessage());
}
}
this.user.dispose();
}
void setupBrowser() {
user = new ChromeUser("TestUser", 20, false);
user.getDriver().manage().timeouts().setScriptTimeout(20, TimeUnit.SECONDS);
user.getDriver().manage().window().setSize(new Dimension(1920, 1080));
}
@Test
@DisplayName("Composed recording test")
void composedRecordingTest() throws Exception {
boolean durationDifferenceAcceptable = true;
int i = 0;
double realTimeDuration = 0;
double entityDuration = 0;
String videoFile = "";
setupBrowser();
user.getDriver().get(APP_URL);
user.getDriver().findElement(By.id("join-btn")).click();
waitUntilEvents("connectionCreated", "videoElementCreated", "accessAllowed", "streamCreated", "streamPlaying");
user.getDriver().findElement(By.id("has-video-checkbox")).click();
while (durationDifferenceAcceptable && (i < NUMBER_OF_ATTEMPTS)) {
log.info("----------");
log.info("Attempt {}", i + 1);
log.info("----------");
user.getDriver().findElement(By.id("buttonStartRecording")).click();
waitUntilEvents("recordingStarted");
Thread.sleep(RECORDING_DURATION * 1000);
user.getDriver().findElement(By.id("buttonStopRecording")).click();
waitUntilEvents("recordingStopped");
Recording rec = OV.listRecordings().get(0);
String extension = rec.getOutputMode().equals(OutputMode.COMPOSED) && rec.hasVideo() ? ".mp4" : ".webm";
videoFile = RECORDING_PATH + rec.getId() + "/" + rec.getName() + extension;
realTimeDuration = getRealTimeDuration(videoFile);
entityDuration = rec.getDuration();
double differenceInDurations = (double) Math.abs(realTimeDuration - entityDuration);
log.info("Real media file duration: {} s", realTimeDuration);
log.info("Entity file duration: {} s", entityDuration);
log.info("Difference between durations: {} s", differenceInDurations);
durationDifferenceAcceptable = differenceInDurations < DURATION_THRESHOLD;
i++;
if (durationDifferenceAcceptable) {
// Delete acceptable recording
try {
OV.deleteRecording(rec.getId());
log.info("Recording {} was acceptable and is succesfully deleted", rec.getId());
} catch (OpenViduJavaClientException | OpenViduHttpException e) {
log.error("Error deleteing acceptable recording {}: {}", rec.getId(), e.getMessage());
}
}
}
if (i == NUMBER_OF_ATTEMPTS) {
log.info("Media file recorded with Composite has not exceeded the duration threshold ({} s) in {} attempts",
DURATION_THRESHOLD, NUMBER_OF_ATTEMPTS);
} else {
log.error(
"Real video duration recorded with Composite ({} s) exceeds threshold of {} s compared to entity duration ({} s), in file {}",
realTimeDuration, DURATION_THRESHOLD, entityDuration, videoFile);
deleteRecordings = false;
Assert.fail("Real video duration recorded with Composite (" + realTimeDuration + " s) exceeds threshold of "
+ DURATION_THRESHOLD + " s compared to entity duration (" + entityDuration + " s), in file "
+ videoFile);
}
}
private void waitUntilEvents(String... events) {
user.getWaiter().until(eventsToBe(events));
user.getDriver().findElement(By.id("clear-events-btn")).click();
user.getWaiter().until(ExpectedConditions.textToBePresentInElementLocated(By.id("textarea-events"), ""));
}
private ExpectedCondition<Boolean> eventsToBe(String... events) {
final Map<String, Integer> expectedEvents = new HashMap<>();
for (String event : events) {
Integer currentNumber = expectedEvents.get(event);
if (currentNumber == null) {
expectedEvents.put(event, 1);
} else {
expectedEvents.put(event, currentNumber++);
}
}
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
boolean eventsCorrect = true;
String events = driver.findElement(By.id("textarea-events")).getText();
for (Entry<String, Integer> entry : expectedEvents.entrySet()) {
eventsCorrect = eventsCorrect
&& StringUtils.countMatches(events, entry.getKey()) == entry.getValue();
if (!eventsCorrect) {
break;
}
}
return eventsCorrect;
}
@Override
public String toString() {
return " OpenVidu events " + expectedEvents.toString();
}
};
}
private double getRealTimeDuration(String pathToVideoFile) {
long time = 0;
File source = new File(pathToVideoFile);
try {
MultimediaObject media = new MultimediaObject(source);
MultimediaInfo info = media.getInfo();
time = info.getDuration();
} catch (EncoderException e) {
log.error("Error getting MultimediaInfo from file {}: {}", pathToVideoFile, e.getMessage());
}
return (double) time / 1000;
}
}
| {
"content_hash": "add6bdbdf68ef10f74a922ab104a95cb",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 131,
"avg_line_length": 34.475083056478404,
"alnum_prop": 0.7137901127493496,
"repo_name": "OpenVidu/openvidu-tutorials",
"id": "0ae058295456e7ca758a12f9abfbfcfc73963088",
"size": "10377",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "openvidu-recording-java/src/test/java/io/openvidu/recording/java/test/AppTestE2e.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "3205"
},
{
"name": "CSS",
"bytes": "81905"
},
{
"name": "Dockerfile",
"bytes": "2761"
},
{
"name": "HTML",
"bytes": "101515"
},
{
"name": "Java",
"bytes": "131154"
},
{
"name": "JavaScript",
"bytes": "27776173"
},
{
"name": "Objective-C",
"bytes": "4151"
},
{
"name": "Python",
"bytes": "1494"
},
{
"name": "Ruby",
"bytes": "1239"
},
{
"name": "SCSS",
"bytes": "18239"
},
{
"name": "Shell",
"bytes": "20331"
},
{
"name": "Starlark",
"bytes": "602"
},
{
"name": "Swift",
"bytes": "3480"
},
{
"name": "TypeScript",
"bytes": "176554"
},
{
"name": "Vue",
"bytes": "8040"
}
],
"symlink_target": ""
} |
// RobotBuilder Version: 1.5
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.
package org.usfirst.frc1073.SwerveBaseJ;
import org.usfirst.frc1073.SwerveBaseJ.commands.*;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.*;
/**
* This class is the glue that binds the controls on the physical operator
* interface to the commands and command groups that allow control of the robot.
*/
public class OI {
//// CREATING BUTTONS
// One type of button is a joystick button which is any button on a joystick.
// You create one by telling it which joystick it's on and which button
// number it is.
// Joystick stick = new Joystick(port);
// Button button = new JoystickButton(stick, buttonNumber);
// There are a few additional built in buttons you can use. Additionally,
// by subclassing Button you can create custom triggers and bind those to
// commands the same as any other Button.
//// TRIGGERING COMMANDS WITH BUTTONS
// Once you have a button, it's trivial to bind it to a button in one of
// three ways:
// Start the command when the button is pressed and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenPressed(new ExampleCommand());
// Run the command while the button is being held down and interrupt it once
// the button is released.
// button.whileHeld(new ExampleCommand());
// Start the command when the button is released and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenReleased(new ExampleCommand());
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
public Joystick driver;
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
public OI() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driver = new Joystick(0);
// SmartDashboard Buttons
SmartDashboard.putData("Autonomous Command", new AutonomousCommand());
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=FUNCTIONS
public Joystick getDriver() {
return driver;
}
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=FUNCTIONS
}
| {
"content_hash": "8a9716c63b7db53ee4f05903cfacfe40",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 81,
"avg_line_length": 36.379746835443036,
"alnum_prop": 0.6903270702853166,
"repo_name": "FRCTeam1073-TheForceTeam/SwerveBaseJ",
"id": "16a88fe11415d8b1d493551a0276e6d5f6010964",
"size": "2874",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/org/usfirst/frc1073/SwerveBaseJ/OI.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "36571"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
NUB Generator [autonym]
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "fd0d2272aa8bd82ed8cf31a250526e41",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 23,
"avg_line_length": 9.076923076923077,
"alnum_prop": 0.6779661016949152,
"repo_name": "mdoering/backbone",
"id": "a419cbd4fd95ea6b3a3f81d0052d2a7af399d56a",
"size": "169",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Brassicales/Brassicaceae/Boechera/Boechera lyallii/Arabis lyallii lyallii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
import { ReplaceCommand } from 'vs/editor/common/commands/replaceCommand';
import { CursorColumns, CursorConfiguration, ICursorSimpleModel, EditOperationResult, EditOperationType, isQuote } from 'vs/editor/common/controller/cursorCommon';
import { Range } from 'vs/editor/common/core/range';
import { Selection } from 'vs/editor/common/core/selection';
import { MoveOperations } from 'vs/editor/common/controller/cursorMoveOperations';
import * as strings from 'vs/base/common/strings';
import { ICommand } from 'vs/editor/common/editorCommon';
export class DeleteOperations {
public static deleteRight(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ICursorSimpleModel, selections: Selection[]): [boolean, (ICommand | null)[]] {
let commands: (ICommand | null)[] = [];
let shouldPushStackElementBefore = (prevEditOperationType !== EditOperationType.DeletingRight);
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
let deleteSelection: Range = selection;
if (deleteSelection.isEmpty()) {
let position = selection.getPosition();
let rightOfPosition = MoveOperations.right(config, model, position.lineNumber, position.column);
deleteSelection = new Range(
rightOfPosition.lineNumber,
rightOfPosition.column,
position.lineNumber,
position.column
);
}
if (deleteSelection.isEmpty()) {
// Probably at end of file => ignore
commands[i] = null;
continue;
}
if (deleteSelection.startLineNumber !== deleteSelection.endLineNumber) {
shouldPushStackElementBefore = true;
}
commands[i] = new ReplaceCommand(deleteSelection, '');
}
return [shouldPushStackElementBefore, commands];
}
private static _isAutoClosingPairDelete(config: CursorConfiguration, model: ICursorSimpleModel, selections: Selection[]): boolean {
if (config.autoClosingBrackets === 'never' && config.autoClosingQuotes === 'never') {
return false;
}
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
const position = selection.getPosition();
if (!selection.isEmpty()) {
return false;
}
const lineText = model.getLineContent(position.lineNumber);
const character = lineText[position.column - 2];
if (!config.autoClosingPairsOpen.hasOwnProperty(character)) {
return false;
}
if (isQuote(character)) {
if (config.autoClosingQuotes === 'never') {
return false;
}
} else {
if (config.autoClosingBrackets === 'never') {
return false;
}
}
const afterCharacter = lineText[position.column - 1];
const closeCharacter = config.autoClosingPairsOpen[character];
if (afterCharacter !== closeCharacter) {
return false;
}
}
return true;
}
private static _runAutoClosingPairDelete(config: CursorConfiguration, model: ICursorSimpleModel, selections: Selection[]): [boolean, ICommand[]] {
let commands: ICommand[] = [];
for (let i = 0, len = selections.length; i < len; i++) {
const position = selections[i].getPosition();
const deleteSelection = new Range(
position.lineNumber,
position.column - 1,
position.lineNumber,
position.column + 1
);
commands[i] = new ReplaceCommand(deleteSelection, '');
}
return [true, commands];
}
public static deleteLeft(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ICursorSimpleModel, selections: Selection[]): [boolean, (ICommand | null)[]] {
if (this._isAutoClosingPairDelete(config, model, selections)) {
return this._runAutoClosingPairDelete(config, model, selections);
}
let commands: (ICommand | null)[] = [];
let shouldPushStackElementBefore = (prevEditOperationType !== EditOperationType.DeletingLeft);
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
let deleteSelection: Range = selection;
if (deleteSelection.isEmpty()) {
let position = selection.getPosition();
if (config.useTabStops && position.column > 1) {
let lineContent = model.getLineContent(position.lineNumber);
let firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineContent);
let lastIndentationColumn = (
firstNonWhitespaceIndex === -1
? /* entire string is whitespace */lineContent.length + 1
: firstNonWhitespaceIndex + 1
);
if (position.column <= lastIndentationColumn) {
let fromVisibleColumn = CursorColumns.visibleColumnFromColumn2(config, model, position);
let toVisibleColumn = CursorColumns.prevTabStop(fromVisibleColumn, config.tabSize);
let toColumn = CursorColumns.columnFromVisibleColumn2(config, model, position.lineNumber, toVisibleColumn);
deleteSelection = new Range(position.lineNumber, toColumn, position.lineNumber, position.column);
} else {
deleteSelection = new Range(position.lineNumber, position.column - 1, position.lineNumber, position.column);
}
} else {
let leftOfPosition = MoveOperations.left(config, model, position.lineNumber, position.column);
deleteSelection = new Range(
leftOfPosition.lineNumber,
leftOfPosition.column,
position.lineNumber,
position.column
);
}
}
if (deleteSelection.isEmpty()) {
// Probably at beginning of file => ignore
commands[i] = null;
continue;
}
if (deleteSelection.startLineNumber !== deleteSelection.endLineNumber) {
shouldPushStackElementBefore = true;
}
commands[i] = new ReplaceCommand(deleteSelection, '');
}
return [shouldPushStackElementBefore, commands];
}
public static cut(config: CursorConfiguration, model: ICursorSimpleModel, selections: Selection[]): EditOperationResult {
let commands: (ICommand | null)[] = [];
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
if (selection.isEmpty()) {
if (config.emptySelectionClipboard) {
// This is a full line cut
let position = selection.getPosition();
let startLineNumber: number,
startColumn: number,
endLineNumber: number,
endColumn: number;
if (position.lineNumber < model.getLineCount()) {
// Cutting a line in the middle of the model
startLineNumber = position.lineNumber;
startColumn = 1;
endLineNumber = position.lineNumber + 1;
endColumn = 1;
} else if (position.lineNumber > 1) {
// Cutting the last line & there are more than 1 lines in the model
startLineNumber = position.lineNumber - 1;
startColumn = model.getLineMaxColumn(position.lineNumber - 1);
endLineNumber = position.lineNumber;
endColumn = model.getLineMaxColumn(position.lineNumber);
} else {
// Cutting the single line that the model contains
startLineNumber = position.lineNumber;
startColumn = 1;
endLineNumber = position.lineNumber;
endColumn = model.getLineMaxColumn(position.lineNumber);
}
let deleteSelection = new Range(
startLineNumber,
startColumn,
endLineNumber,
endColumn
);
if (!deleteSelection.isEmpty()) {
commands[i] = new ReplaceCommand(deleteSelection, '');
} else {
commands[i] = null;
}
} else {
// Cannot cut empty selection
commands[i] = null;
}
} else {
commands[i] = new ReplaceCommand(selection, '');
}
}
return new EditOperationResult(EditOperationType.Other, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: true
});
}
}
| {
"content_hash": "5e67336836e7754c5f5bc13faa956336",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 183,
"avg_line_length": 33.808035714285715,
"alnum_prop": 0.6949689687046084,
"repo_name": "0xmohit/vscode",
"id": "e1a7cf779d65577485e48306c412ea3645d8cec6",
"size": "7924",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/vs/editor/common/controller/cursorDeleteOperations.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "5838"
},
{
"name": "C",
"bytes": "818"
},
{
"name": "C#",
"bytes": "1640"
},
{
"name": "C++",
"bytes": "1072"
},
{
"name": "CSS",
"bytes": "498480"
},
{
"name": "Clojure",
"bytes": "1206"
},
{
"name": "CoffeeScript",
"bytes": "590"
},
{
"name": "Dockerfile",
"bytes": "3689"
},
{
"name": "F#",
"bytes": "634"
},
{
"name": "Go",
"bytes": "652"
},
{
"name": "Groovy",
"bytes": "3928"
},
{
"name": "HLSL",
"bytes": "184"
},
{
"name": "HTML",
"bytes": "37165"
},
{
"name": "Inno Setup",
"bytes": "165483"
},
{
"name": "Java",
"bytes": "599"
},
{
"name": "JavaScript",
"bytes": "926375"
},
{
"name": "Lua",
"bytes": "252"
},
{
"name": "Makefile",
"bytes": "1380"
},
{
"name": "Objective-C",
"bytes": "1387"
},
{
"name": "PHP",
"bytes": "998"
},
{
"name": "Perl",
"bytes": "857"
},
{
"name": "Perl 6",
"bytes": "1065"
},
{
"name": "PowerShell",
"bytes": "5118"
},
{
"name": "Python",
"bytes": "2405"
},
{
"name": "R",
"bytes": "362"
},
{
"name": "Roff",
"bytes": "351"
},
{
"name": "Ruby",
"bytes": "1703"
},
{
"name": "Rust",
"bytes": "532"
},
{
"name": "ShaderLab",
"bytes": "330"
},
{
"name": "Shell",
"bytes": "29933"
},
{
"name": "Swift",
"bytes": "284"
},
{
"name": "TypeScript",
"bytes": "19113179"
},
{
"name": "Visual Basic",
"bytes": "893"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Interim Register of Marine and Nonmarine Genera
#### Published in
Geologica romana 7: 150.
#### Original name
null
### Remarks
null | {
"content_hash": "dcf022485a0e00b85f697aaaf0e3582c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 47,
"avg_line_length": 12.461538461538462,
"alnum_prop": 0.7222222222222222,
"repo_name": "mdoering/backbone",
"id": "0b60413975094dabe45fdd3905015736c7da77c6",
"size": "236",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Protozoa/Granuloreticulosea/Foraminiferida/Parurgonina/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the BuffersHelper. For example:
#
# describe BuffersHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe BuffersHelper, :type => :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
| {
"content_hash": "59b8966dfb8bc8b3dee308660b3d3806",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 71,
"avg_line_length": 29.266666666666666,
"alnum_prop": 0.6902050113895216,
"repo_name": "buildmore/buffercaster",
"id": "023f3c599346caae529836985788136823547529",
"size": "439",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/helpers/buffers_helper_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2067"
},
{
"name": "CoffeeScript",
"bytes": "422"
},
{
"name": "JavaScript",
"bytes": "664"
},
{
"name": "Ruby",
"bytes": "42810"
}
],
"symlink_target": ""
} |
using System;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace MachiningCloudManager
{
public class WebApiApplication : HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
Console.Write("ggg");
}
}
}
| {
"content_hash": "1bdf56e2d6f2a97c4f3b84f57209965c",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 70,
"avg_line_length": 26.833333333333332,
"alnum_prop": 0.687888198757764,
"repo_name": "thomhong/MachiningCloudManager",
"id": "d798597f6662dcd14dce917cc7fe73261f42a013",
"size": "646",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MachiningCloudManager/MachiningCloudManager/Global.asax.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "115"
},
{
"name": "C#",
"bytes": "172185"
},
{
"name": "CSS",
"bytes": "2626"
},
{
"name": "HTML",
"bytes": "5069"
},
{
"name": "JavaScript",
"bytes": "19771"
},
{
"name": "Puppet",
"bytes": "178"
}
],
"symlink_target": ""
} |
package org.sagebionetworks.web.client.widget.table.modal.download;
import com.google.gwt.user.client.ui.IsWidget;
/**
* This view shows the options that for a table query download.
*
* @author John
*
*/
public interface CreateDownloadPageView extends IsWidget {
/**
* The type of file to create.
*
* @param csv
*/
void setFileType(FileType csv);
/**
* The type of file to create.
*
* @return
*/
FileType getFileType();
/**
* Should the first row be a header row?
*
* @param include
*/
void setIncludeHeaders(boolean include);
/**
* Should the first row be a header row?
*
* @return
*/
boolean getIncludeHeaders();
/**
* Should the row metadata be included in the file?
*
* @param include
*/
void setIncludeRowMetadata(boolean include);
/**
* Should the row metadata be included in the file?
*
* @return
*/
boolean getIncludeRowMetadata();
/**
* Add the tracker widget to the view.
*
* @param trackerWidget
*/
public void addTrackerWidget(IsWidget trackerWidget);
/**
* Show/hide the tracker panel.
*
* @param visible
*/
public void setTrackerVisible(boolean visible);
}
| {
"content_hash": "211308bec01376aec013e91a4fdf4e6c",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 67,
"avg_line_length": 18.104477611940297,
"alnum_prop": 0.638911788953009,
"repo_name": "Sage-Bionetworks/SynapseWebClient",
"id": "7eb40214080f1a3f5dfea0517aed1f1b23ee982d",
"size": "1213",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/main/java/org/sagebionetworks/web/client/widget/table/modal/download/CreateDownloadPageView.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "392172"
},
{
"name": "HTML",
"bytes": "3791715"
},
{
"name": "Java",
"bytes": "8502799"
},
{
"name": "JavaScript",
"bytes": "8787133"
},
{
"name": "SCSS",
"bytes": "72670"
},
{
"name": "Shell",
"bytes": "1422"
}
],
"symlink_target": ""
} |
using Umbraco.Core.Services;
using System;
using System.Linq;
using System.Web.UI.WebControls;
using Umbraco.Core;
using Umbraco.Core.IO;
namespace umbraco.presentation.umbraco.dialogs
{
public partial class insertMasterpageContent : Umbraco.Web.UI.Pages.UmbracoEnsuredPage
{
public insertMasterpageContent()
{
CurrentApp = Constants.Applications.Settings.ToString();
}
protected void Page_Load(object sender, EventArgs e)
{
//labels
pp_placeholder.Text = Services.TextService.Localize("placeHolderID");
//Add a default Item
var li = new ListItem("Choose ID...");
li.Selected = true;
dd_detectedAlias.Items.Add(li);
//var t = new cms.businesslogic.template.Template(int.Parse(Request["id"]));
var t = Services.FileService.GetTemplate(int.Parse(Request["id"]));
//if (t.MasterTemplate > 0)
if (string.IsNullOrWhiteSpace(t.MasterTemplateAlias) != true)
{
//t = new cms.businesslogic.template.Template(t.MasterTemplate);
t = Services.FileService.GetTemplate(t.MasterTemplateAlias);
}
//foreach (string cpId in t.contentPlaceholderIds())
foreach (string cpId in MasterPageHelper.GetContentPlaceholderIds(t))
{
dd_detectedAlias.Items.Add(cpId);
}
if (dd_detectedAlias.Items.Count == 1)
dd_detectedAlias.Items.Add("ContentPlaceHolderDefault");
}
}
}
| {
"content_hash": "76f7507cfd804db9c5f67a69726ae969",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 90,
"avg_line_length": 30.71153846153846,
"alnum_prop": 0.6073888541014402,
"repo_name": "lars-erik/Umbraco-CMS",
"id": "96b1006de549a3c7145d0a8dfd229d0108670fff",
"size": "1599",
"binary": false,
"copies": "1",
"ref": "refs/heads/temp8-u4-11427-remove-propertyinjection",
"path": "src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "753790"
},
{
"name": "ActionScript",
"bytes": "11355"
},
{
"name": "Batchfile",
"bytes": "10962"
},
{
"name": "C#",
"bytes": "11869028"
},
{
"name": "CSS",
"bytes": "287452"
},
{
"name": "Erlang",
"bytes": "1782"
},
{
"name": "HTML",
"bytes": "497648"
},
{
"name": "JavaScript",
"bytes": "2430525"
},
{
"name": "PowerShell",
"bytes": "1212"
},
{
"name": "Python",
"bytes": "876"
},
{
"name": "Ruby",
"bytes": "765"
},
{
"name": "XSLT",
"bytes": "49960"
}
],
"symlink_target": ""
} |
#ifndef __BTRFS_COMPRESSION_
#define __BTRFS_COMPRESSION_
void btrfs_init_compress(void);
void btrfs_exit_compress(void);
int btrfs_compress_pages(int type, struct address_space *mapping,
u64 start, unsigned long len,
struct page **pages,
unsigned long nr_dest_pages,
unsigned long *out_pages,
unsigned long *total_in,
unsigned long *total_out,
unsigned long max_out);
int btrfs_decompress(int type, unsigned char *data_in, struct page *dest_page,
unsigned long start_byte, size_t srclen, size_t destlen);
int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
unsigned long total_out, u64 disk_start,
struct bio_vec *bvec, int vcnt,
unsigned long *pg_index,
unsigned long *pg_offset);
int btrfs_submit_compressed_write(struct inode *inode, u64 start,
unsigned long len, u64 disk_start,
unsigned long compressed_len,
struct page **compressed_pages,
unsigned long nr_pages);
int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
int mirror_num, unsigned long bio_flags);
void btrfs_clear_biovec_end(struct bio_vec *bvec, int vcnt,
unsigned long pg_index,
unsigned long pg_offset);
enum btrfs_compression_type {
BTRFS_COMPRESS_NONE = 0,
BTRFS_COMPRESS_ZLIB = 1,
BTRFS_COMPRESS_LZO = 2,
BTRFS_COMPRESS_TYPES = 2,
BTRFS_COMPRESS_LAST = 3,
};
struct btrfs_compress_op {
struct list_head *(*alloc_workspace)(void);
void (*free_workspace)(struct list_head *workspace);
int (*compress_pages)(struct list_head *workspace,
struct address_space *mapping,
u64 start, unsigned long len,
struct page **pages,
unsigned long nr_dest_pages,
unsigned long *out_pages,
unsigned long *total_in,
unsigned long *total_out,
unsigned long max_out);
int (*decompress_biovec)(struct list_head *workspace,
struct page **pages_in,
u64 disk_start,
struct bio_vec *bvec,
int vcnt,
size_t srclen);
int (*decompress)(struct list_head *workspace,
unsigned char *data_in,
struct page *dest_page,
unsigned long start_byte,
size_t srclen, size_t destlen);
};
extern const struct btrfs_compress_op btrfs_zlib_compress;
extern const struct btrfs_compress_op btrfs_lzo_compress;
#endif
| {
"content_hash": "63ef68973160144f15edbd6141160753",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 78,
"avg_line_length": 30.710526315789473,
"alnum_prop": 0.681662382176521,
"repo_name": "AlbandeCrevoisier/ldd-athens",
"id": "f49d8b8c0f00cf6fb41a988681ec4c89615a9ae5",
"size": "3041",
"binary": false,
"copies": "213",
"ref": "refs/heads/master",
"path": "linux-socfpga/fs/btrfs/compression.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "10184236"
},
{
"name": "Awk",
"bytes": "40418"
},
{
"name": "Batchfile",
"bytes": "81753"
},
{
"name": "C",
"bytes": "566858455"
},
{
"name": "C++",
"bytes": "21399133"
},
{
"name": "Clojure",
"bytes": "971"
},
{
"name": "Cucumber",
"bytes": "5998"
},
{
"name": "FORTRAN",
"bytes": "11832"
},
{
"name": "GDB",
"bytes": "18113"
},
{
"name": "Groff",
"bytes": "2686457"
},
{
"name": "HTML",
"bytes": "34688334"
},
{
"name": "Lex",
"bytes": "56961"
},
{
"name": "Logos",
"bytes": "133810"
},
{
"name": "M4",
"bytes": "3325"
},
{
"name": "Makefile",
"bytes": "1685015"
},
{
"name": "Objective-C",
"bytes": "920162"
},
{
"name": "Perl",
"bytes": "752477"
},
{
"name": "Perl6",
"bytes": "3783"
},
{
"name": "Python",
"bytes": "533352"
},
{
"name": "Shell",
"bytes": "468244"
},
{
"name": "SourcePawn",
"bytes": "2711"
},
{
"name": "UnrealScript",
"bytes": "12824"
},
{
"name": "XC",
"bytes": "33970"
},
{
"name": "XS",
"bytes": "34909"
},
{
"name": "Yacc",
"bytes": "113516"
}
],
"symlink_target": ""
} |
// caffe2/caffe2/core/flags.cc
#include "platform/caffe2_flags.h"
#include <stdlib.h>
#include <sstream>
namespace bubblefs {
namespace mycaffe2 {
void SetUsageMessage(const std::string& str) {
if (UsageMessage() != nullptr) {
// Usage message has already been set, so we will simply return.
return;
}
gflags::SetUsageMessage(str);
}
const char* UsageMessage() {
return gflags::ProgramUsage();
}
bool ParseCaffeCommandLineFlags(int* pargc, char*** pargv) {
if (*pargc == 0) return true;
return gflags::ParseCommandLineFlags(pargc, pargv, true);
}
bool CommandLineFlagsHasBeenParsed() {
// There is no way we query gflags right now, so we will simply return true.
return true;
}
} // namespace mycaffe2
} // namespace bubblefs | {
"content_hash": "3818a0bd5b2e1d9f9454876fefa660b2",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 78,
"avg_line_length": 21.714285714285715,
"alnum_prop": 0.7092105263157895,
"repo_name": "mengjiahao/bubblefs",
"id": "713d863761f1d56f618366ce14506e1040623027",
"size": "1371",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/platform/caffe2_flags.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "106898"
},
{
"name": "C++",
"bytes": "13707092"
},
{
"name": "Makefile",
"bytes": "16035"
},
{
"name": "Shell",
"bytes": "30451"
}
],
"symlink_target": ""
} |
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">8dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources> | {
"content_hash": "12f61059ead7d98f51544f6088764704",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 71,
"avg_line_length": 41.8,
"alnum_prop": 0.7081339712918661,
"repo_name": "lulumeya/billiards",
"id": "e65e003ab64056dd6bcc4d2a232fab9e628e3bbc",
"size": "209",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/values/dimens.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "153998"
}
],
"symlink_target": ""
} |
package org.elasticsearch.index.mapper;
import org.apache.lucene.document.DoubleRange;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FloatRange;
import org.apache.lucene.document.InetAddressPoint;
import org.apache.lucene.document.InetAddressRange;
import org.apache.lucene.document.IntRange;
import org.apache.lucene.document.LongRange;
import org.apache.lucene.document.StoredField;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.queries.BinaryDocValuesRangeQuery;
import org.apache.lucene.queries.BinaryDocValuesRangeQuery.QueryType;
import org.apache.lucene.search.BoostQuery;
import org.apache.lucene.search.IndexOrDocValuesQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.store.ByteArrayDataOutput;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.common.Explicit;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.geo.ShapeRelation;
import org.elasticsearch.common.joda.DateMathParser;
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
import org.elasticsearch.common.network.InetAddresses;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.LocaleUtils;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.mapper.NumberFieldMapper.NumberType;
import org.elasticsearch.index.query.QueryShardContext;
import org.joda.time.DateTimeZone;
import java.io.IOException;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import static org.elasticsearch.index.mapper.TypeParsers.parseDateTimeFormatter;
import static org.elasticsearch.index.query.RangeQueryBuilder.GTE_FIELD;
import static org.elasticsearch.index.query.RangeQueryBuilder.GT_FIELD;
import static org.elasticsearch.index.query.RangeQueryBuilder.LTE_FIELD;
import static org.elasticsearch.index.query.RangeQueryBuilder.LT_FIELD;
/** A {@link FieldMapper} for indexing numeric and date ranges, and creating queries */
public class RangeFieldMapper extends FieldMapper {
public static final boolean DEFAULT_INCLUDE_UPPER = true;
public static final boolean DEFAULT_INCLUDE_LOWER = true;
public static class Defaults {
public static final Explicit<Boolean> COERCE = new Explicit<>(true, false);
}
// this is private since it has a different default
static final Setting<Boolean> COERCE_SETTING =
Setting.boolSetting("index.mapping.coerce", true, Setting.Property.IndexScope);
public static class Builder extends FieldMapper.Builder<Builder, RangeFieldMapper> {
private Boolean coerce;
private Locale locale;
public Builder(String name, RangeType type, Version indexVersionCreated) {
super(name, new RangeFieldType(type, indexVersionCreated), new RangeFieldType(type, indexVersionCreated));
builder = this;
locale = Locale.ROOT;
}
@Override
public RangeFieldType fieldType() {
return (RangeFieldType)fieldType;
}
@Override
public Builder docValues(boolean docValues) {
if (docValues == true) {
throw new IllegalArgumentException("field [" + name + "] does not currently support " + TypeParsers.DOC_VALUES);
}
return super.docValues(docValues);
}
public Builder coerce(boolean coerce) {
this.coerce = coerce;
return builder;
}
protected Explicit<Boolean> coerce(BuilderContext context) {
if (coerce != null) {
return new Explicit<>(coerce, true);
}
if (context.indexSettings() != null) {
return new Explicit<>(COERCE_SETTING.get(context.indexSettings()), false);
}
return Defaults.COERCE;
}
public Builder dateTimeFormatter(FormatDateTimeFormatter dateTimeFormatter) {
fieldType().setDateTimeFormatter(dateTimeFormatter);
return this;
}
@Override
public Builder nullValue(Object nullValue) {
throw new IllegalArgumentException("Field [" + name() + "] does not support null value.");
}
public void locale(Locale locale) {
this.locale = locale;
}
@Override
protected void setupFieldType(BuilderContext context) {
super.setupFieldType(context);
FormatDateTimeFormatter dateTimeFormatter = fieldType().dateTimeFormatter;
if (fieldType().rangeType == RangeType.DATE) {
if (!locale.equals(dateTimeFormatter.locale())) {
fieldType().setDateTimeFormatter(new FormatDateTimeFormatter(dateTimeFormatter.format(),
dateTimeFormatter.parser(), dateTimeFormatter.printer(), locale));
}
} else if (dateTimeFormatter != null) {
throw new IllegalArgumentException("field [" + name() + "] of type [" + fieldType().rangeType
+ "] should not define a dateTimeFormatter unless it is a " + RangeType.DATE + " type");
}
}
@Override
public RangeFieldMapper build(BuilderContext context) {
setupFieldType(context);
return new RangeFieldMapper(name, fieldType, defaultFieldType, coerce(context), includeInAll,
context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
}
}
public static class TypeParser implements Mapper.TypeParser {
final RangeType type;
public TypeParser(RangeType type) {
this.type = type;
}
@Override
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node,
ParserContext parserContext) throws MapperParsingException {
Builder builder = new Builder(name, type, parserContext.indexVersionCreated());
TypeParsers.parseField(builder, name, node, parserContext);
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
Map.Entry<String, Object> entry = iterator.next();
String propName = entry.getKey();
Object propNode = entry.getValue();
if (propName.equals("null_value")) {
throw new MapperParsingException("Property [null_value] is not supported for [" + this.type.name
+ "] field types.");
} else if (propName.equals("coerce")) {
builder.coerce(TypeParsers.nodeBooleanValue(name, "coerce", propNode, parserContext));
iterator.remove();
} else if (propName.equals("locale")) {
builder.locale(LocaleUtils.parse(propNode.toString()));
iterator.remove();
} else if (propName.equals("format")) {
builder.dateTimeFormatter(parseDateTimeFormatter(propNode));
iterator.remove();
} else if (TypeParsers.parseMultiField(builder, name, parserContext, propName, propNode)) {
iterator.remove();
}
}
return builder;
}
}
public static final class RangeFieldType extends MappedFieldType {
protected RangeType rangeType;
protected FormatDateTimeFormatter dateTimeFormatter;
protected DateMathParser dateMathParser;
RangeFieldType(RangeType type, Version indexVersionCreated) {
super();
this.rangeType = Objects.requireNonNull(type);
setTokenized(false);
setHasDocValues(indexVersionCreated.onOrAfter(Version.V_6_0_0_beta1));
setOmitNorms(true);
if (rangeType == RangeType.DATE) {
setDateTimeFormatter(DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER);
}
}
RangeFieldType(RangeFieldType other) {
super(other);
this.rangeType = other.rangeType;
if (other.dateTimeFormatter() != null) {
setDateTimeFormatter(other.dateTimeFormatter);
}
}
@Override
public MappedFieldType clone() {
return new RangeFieldType(this);
}
@Override
public boolean equals(Object o) {
if (!super.equals(o)) return false;
RangeFieldType that = (RangeFieldType) o;
return Objects.equals(rangeType, that.rangeType) &&
(rangeType == RangeType.DATE) ?
Objects.equals(dateTimeFormatter.format(), that.dateTimeFormatter.format())
&& Objects.equals(dateTimeFormatter.locale(), that.dateTimeFormatter.locale())
: dateTimeFormatter == null && that.dateTimeFormatter == null;
}
@Override
public int hashCode() {
return (dateTimeFormatter == null) ? Objects.hash(super.hashCode(), rangeType)
: Objects.hash(super.hashCode(), rangeType, dateTimeFormatter.format(), dateTimeFormatter.locale());
}
@Override
public String typeName() {
return rangeType.name;
}
@Override
public void checkCompatibility(MappedFieldType fieldType, List<String> conflicts, boolean strict) {
super.checkCompatibility(fieldType, conflicts, strict);
if (strict) {
RangeFieldType other = (RangeFieldType)fieldType;
if (this.rangeType != other.rangeType) {
conflicts.add("mapper [" + name()
+ "] is attempting to update from type [" + rangeType.name
+ "] to incompatible type [" + other.rangeType.name + "].");
}
if (this.rangeType == RangeType.DATE) {
if (Objects.equals(dateTimeFormatter().format(), other.dateTimeFormatter().format()) == false) {
conflicts.add("mapper [" + name()
+ "] is used by multiple types. Set update_all_types to true to update [format] across all types.");
}
if (Objects.equals(dateTimeFormatter().locale(), other.dateTimeFormatter().locale()) == false) {
conflicts.add("mapper [" + name()
+ "] is used by multiple types. Set update_all_types to true to update [locale] across all types.");
}
}
}
}
public FormatDateTimeFormatter dateTimeFormatter() {
return dateTimeFormatter;
}
public void setDateTimeFormatter(FormatDateTimeFormatter dateTimeFormatter) {
checkIfFrozen();
this.dateTimeFormatter = dateTimeFormatter;
this.dateMathParser = new DateMathParser(dateTimeFormatter);
}
protected DateMathParser dateMathParser() {
return dateMathParser;
}
@Override
public Query termQuery(Object value, QueryShardContext context) {
Query query = rangeQuery(value, value, true, true, ShapeRelation.INTERSECTS, context);
if (boost() != 1f) {
query = new BoostQuery(query, boost());
}
return query;
}
public Query rangeQuery(Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper,
ShapeRelation relation, QueryShardContext context) {
failIfNotIndexed();
return rangeQuery(lowerTerm, upperTerm, includeLower, includeUpper, relation, null, dateMathParser, context);
}
public Query rangeQuery(Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper,
ShapeRelation relation, DateTimeZone timeZone, DateMathParser parser, QueryShardContext context) {
return rangeType.rangeQuery(name(), hasDocValues(), lowerTerm, upperTerm, includeLower, includeUpper, relation,
timeZone, parser, context);
}
}
private Boolean includeInAll;
private Explicit<Boolean> coerce;
private RangeFieldMapper(
String simpleName,
MappedFieldType fieldType,
MappedFieldType defaultFieldType,
Explicit<Boolean> coerce,
Boolean includeInAll,
Settings indexSettings,
MultiFields multiFields,
CopyTo copyTo) {
super(simpleName, fieldType, defaultFieldType, indexSettings, multiFields, copyTo);
this.coerce = coerce;
this.includeInAll = includeInAll;
}
@Override
public RangeFieldType fieldType() {
return (RangeFieldType) super.fieldType();
}
@Override
protected String contentType() {
return fieldType.typeName();
}
@Override
protected RangeFieldMapper clone() {
return (RangeFieldMapper) super.clone();
}
@Override
protected void parseCreateField(ParseContext context, List<IndexableField> fields) throws IOException {
final boolean includeInAll = context.includeInAll(this.includeInAll, this);
Range range;
if (context.externalValueSet()) {
range = context.parseExternalValue(Range.class);
} else {
XContentParser parser = context.parser();
if (parser.currentToken() == XContentParser.Token.START_OBJECT) {
RangeFieldType fieldType = fieldType();
RangeType rangeType = fieldType.rangeType;
String fieldName = null;
Object from = rangeType.minValue();
Object to = rangeType.maxValue();
boolean includeFrom = DEFAULT_INCLUDE_LOWER;
boolean includeTo = DEFAULT_INCLUDE_UPPER;
XContentParser.Token token;
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
fieldName = parser.currentName();
} else {
if (fieldName.equals(GT_FIELD.getPreferredName())) {
includeFrom = false;
if (parser.currentToken() != XContentParser.Token.VALUE_NULL) {
from = rangeType.parseFrom(fieldType, parser, coerce.value(), includeFrom);
}
} else if (fieldName.equals(GTE_FIELD.getPreferredName())) {
includeFrom = true;
if (parser.currentToken() != XContentParser.Token.VALUE_NULL) {
from = rangeType.parseFrom(fieldType, parser, coerce.value(), includeFrom);
}
} else if (fieldName.equals(LT_FIELD.getPreferredName())) {
includeTo = false;
if (parser.currentToken() != XContentParser.Token.VALUE_NULL) {
to = rangeType.parseTo(fieldType, parser, coerce.value(), includeTo);
}
} else if (fieldName.equals(LTE_FIELD.getPreferredName())) {
includeTo = true;
if (parser.currentToken() != XContentParser.Token.VALUE_NULL) {
to = rangeType.parseTo(fieldType, parser, coerce.value(), includeTo);
}
} else {
throw new MapperParsingException("error parsing field [" +
name() + "], with unknown parameter [" + fieldName + "]");
}
}
}
range = new Range(rangeType, from, to, includeFrom, includeTo);
} else {
throw new MapperParsingException("error parsing field ["
+ name() + "], expected an object but got " + parser.currentName());
}
}
if (includeInAll) {
context.allEntries().addText(fieldType.name(), range.toString(), fieldType.boost());
}
boolean indexed = fieldType.indexOptions() != IndexOptions.NONE;
boolean docValued = fieldType.hasDocValues();
boolean stored = fieldType.stored();
fields.addAll(fieldType().rangeType.createFields(context, name(), range, indexed, docValued, stored));
}
@Override
protected void doMerge(Mapper mergeWith, boolean updateAllTypes) {
super.doMerge(mergeWith, updateAllTypes);
RangeFieldMapper other = (RangeFieldMapper) mergeWith;
this.includeInAll = other.includeInAll;
if (other.coerce.explicit()) {
this.coerce = other.coerce;
}
}
@Override
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException {
super.doXContentBody(builder, includeDefaults, params);
if (fieldType().rangeType == RangeType.DATE
&& (includeDefaults || (fieldType().dateTimeFormatter() != null
&& fieldType().dateTimeFormatter().format().equals(DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.format()) == false))) {
builder.field("format", fieldType().dateTimeFormatter().format());
}
if (fieldType().rangeType == RangeType.DATE
&& (includeDefaults || (fieldType().dateTimeFormatter() != null
&& fieldType().dateTimeFormatter().locale() != Locale.ROOT))) {
builder.field("locale", fieldType().dateTimeFormatter().locale());
}
if (includeDefaults || coerce.explicit()) {
builder.field("coerce", coerce.value());
}
if (includeInAll != null) {
builder.field("include_in_all", includeInAll);
} else if (includeDefaults) {
builder.field("include_in_all", false);
}
}
/** Enum defining the type of range */
public enum RangeType {
IP("ip_range") {
@Override
public Field getRangeField(String name, Range r) {
return new InetAddressRange(name, (InetAddress)r.from, (InetAddress)r.to);
}
@Override
public InetAddress parseFrom(RangeFieldType fieldType, XContentParser parser, boolean coerce, boolean included)
throws IOException {
InetAddress address = InetAddresses.forString(parser.text());
return included ? address : nextUp(address);
}
@Override
public InetAddress parseTo(RangeFieldType fieldType, XContentParser parser, boolean coerce, boolean included)
throws IOException {
InetAddress address = InetAddresses.forString(parser.text());
return included ? address : nextDown(address);
}
@Override
public InetAddress parse(Object value, boolean coerce) {
if (value instanceof InetAddress) {
return (InetAddress) value;
} else {
if (value instanceof BytesRef) {
value = ((BytesRef) value).utf8ToString();
}
return InetAddresses.forString(value.toString());
}
}
@Override
public InetAddress minValue() {
return InetAddressPoint.MIN_VALUE;
}
@Override
public InetAddress maxValue() {
return InetAddressPoint.MAX_VALUE;
}
@Override
public InetAddress nextUp(Object value) {
return InetAddressPoint.nextUp((InetAddress)value);
}
@Override
public InetAddress nextDown(Object value) {
return InetAddressPoint.nextDown((InetAddress)value);
}
@Override
public BytesRef encodeRanges(Set<Range> ranges) throws IOException {
final byte[] encoded = new byte[5 + (16 * 2) * ranges.size()];
ByteArrayDataOutput out = new ByteArrayDataOutput(encoded);
out.writeVInt(ranges.size());
for (Range range : ranges) {
out.writeVInt(16);
InetAddress fromValue = (InetAddress) range.from;
byte[] encodedFromValue = InetAddressPoint.encode(fromValue);
out.writeBytes(encodedFromValue, 0, encodedFromValue.length);
out.writeVInt(16);
InetAddress toValue = (InetAddress) range.to;
byte[] encodedToValue = InetAddressPoint.encode(toValue);
out.writeBytes(encodedToValue, 0, encodedToValue.length);
}
return new BytesRef(encoded, 0, out.getPosition());
}
@Override
BytesRef[] encodeRange(Object from, Object to) {
BytesRef encodedFrom = new BytesRef(InetAddressPoint.encode((InetAddress) from));
BytesRef encodedTo = new BytesRef(InetAddressPoint.encode((InetAddress) to));
return new BytesRef[]{encodedFrom, encodedTo};
}
@Override
public Query withinQuery(String field, Object from, Object to, boolean includeLower, boolean includeUpper) {
InetAddress lower = (InetAddress)from;
InetAddress upper = (InetAddress)to;
return InetAddressRange.newWithinQuery(field,
includeLower ? lower : nextUp(lower), includeUpper ? upper : nextDown(upper));
}
@Override
public Query containsQuery(String field, Object from, Object to, boolean includeLower, boolean includeUpper) {
InetAddress lower = (InetAddress)from;
InetAddress upper = (InetAddress)to;
return InetAddressRange.newContainsQuery(field,
includeLower ? lower : nextUp(lower), includeUpper ? upper : nextDown(upper));
}
@Override
public Query intersectsQuery(String field, Object from, Object to, boolean includeLower, boolean includeUpper) {
InetAddress lower = (InetAddress)from;
InetAddress upper = (InetAddress)to;
return InetAddressRange.newIntersectsQuery(field,
includeLower ? lower : nextUp(lower), includeUpper ? upper : nextDown(upper));
}
public String toString(InetAddress address) {
return InetAddresses.toAddrString(address);
}
},
DATE("date_range", NumberType.LONG) {
@Override
public Field getRangeField(String name, Range r) {
return new LongRange(name, new long[] {((Number)r.from).longValue()}, new long[] {((Number)r.to).longValue()});
}
private Number parse(DateMathParser dateMathParser, String dateStr) {
return dateMathParser.parse(dateStr, () -> {throw new IllegalArgumentException("now is not used at indexing time");});
}
@Override
public Number parseFrom(RangeFieldType fieldType, XContentParser parser, boolean coerce, boolean included)
throws IOException {
Number value = parse(fieldType.dateMathParser, parser.text());
return included ? value : nextUp(value);
}
@Override
public Number parseTo(RangeFieldType fieldType, XContentParser parser, boolean coerce, boolean included)
throws IOException{
Number value = parse(fieldType.dateMathParser, parser.text());
return included ? value : nextDown(value);
}
@Override
public Long minValue() {
return Long.MIN_VALUE;
}
@Override
public Long maxValue() {
return Long.MAX_VALUE;
}
@Override
public Long nextUp(Object value) {
return (long) LONG.nextUp(value);
}
@Override
public Long nextDown(Object value) {
return (long) LONG.nextDown(value);
}
@Override
public BytesRef encodeRanges(Set<Range> ranges) throws IOException {
return LONG.encodeRanges(ranges);
}
@Override
BytesRef[] encodeRange(Object from, Object to) {
return LONG.encodeRange(from, to);
}
@Override
public Query rangeQuery(String field, boolean hasDocValues, Object lowerTerm, Object upperTerm, boolean includeLower,
boolean includeUpper, ShapeRelation relation, @Nullable DateTimeZone timeZone,
@Nullable DateMathParser parser, QueryShardContext context) {
DateTimeZone zone = (timeZone == null) ? DateTimeZone.UTC : timeZone;
DateMathParser dateMathParser = (parser == null) ?
new DateMathParser(DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER) : parser;
Long low = lowerTerm == null ? Long.MIN_VALUE :
dateMathParser.parse(lowerTerm instanceof BytesRef ? ((BytesRef) lowerTerm).utf8ToString() : lowerTerm.toString(),
context::nowInMillis, false, zone);
Long high = upperTerm == null ? Long.MAX_VALUE :
dateMathParser.parse(upperTerm instanceof BytesRef ? ((BytesRef) upperTerm).utf8ToString() : upperTerm.toString(),
context::nowInMillis, false, zone);
return super.rangeQuery(field, hasDocValues, low, high, includeLower, includeUpper, relation, zone,
dateMathParser, context);
}
@Override
public Query withinQuery(String field, Object from, Object to, boolean includeLower, boolean includeUpper) {
return LONG.withinQuery(field, from, to, includeLower, includeUpper);
}
@Override
public Query containsQuery(String field, Object from, Object to, boolean includeLower, boolean includeUpper) {
return LONG.containsQuery(field, from, to, includeLower, includeUpper);
}
@Override
public Query intersectsQuery(String field, Object from, Object to, boolean includeLower, boolean includeUpper) {
return LONG.intersectsQuery(field, from, to, includeLower, includeUpper);
}
},
// todo support half_float
FLOAT("float_range", NumberType.FLOAT) {
@Override
public Float minValue() {
return Float.NEGATIVE_INFINITY;
}
@Override
public Float maxValue() {
return Float.POSITIVE_INFINITY;
}
@Override
public Float nextUp(Object value) {
return Math.nextUp(((Number)value).floatValue());
}
@Override
public Float nextDown(Object value) {
return Math.nextDown(((Number)value).floatValue());
}
@Override
public BytesRef encodeRanges(Set<Range> ranges) throws IOException {
return DOUBLE.encodeRanges(ranges);
}
@Override
BytesRef[] encodeRange(Object from, Object to) {
return DOUBLE.encodeRange(((Number) from).floatValue(), ((Number) to).floatValue());
}
@Override
public Field getRangeField(String name, Range r) {
return new FloatRange(name, new float[] {((Number)r.from).floatValue()}, new float[] {((Number)r.to).floatValue()});
}
@Override
public Query withinQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return FloatRange.newWithinQuery(field,
new float[] {includeFrom ? (Float)from : Math.nextUp((Float)from)},
new float[] {includeTo ? (Float)to : Math.nextDown((Float)to)});
}
@Override
public Query containsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return FloatRange.newContainsQuery(field,
new float[] {includeFrom ? (Float)from : Math.nextUp((Float)from)},
new float[] {includeTo ? (Float)to : Math.nextDown((Float)to)});
}
@Override
public Query intersectsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return FloatRange.newIntersectsQuery(field,
new float[] {includeFrom ? (Float)from : Math.nextUp((Float)from)},
new float[] {includeTo ? (Float)to : Math.nextDown((Float)to)});
}
},
DOUBLE("double_range", NumberType.DOUBLE) {
@Override
public Double minValue() {
return Double.NEGATIVE_INFINITY;
}
@Override
public Double maxValue() {
return Double.POSITIVE_INFINITY;
}
@Override
public Double nextUp(Object value) {
return Math.nextUp(((Number)value).doubleValue());
}
@Override
public Double nextDown(Object value) {
return Math.nextDown(((Number)value).doubleValue());
}
@Override
public BytesRef encodeRanges(Set<Range> ranges) throws IOException {
return BinaryRangeUtil.encodeDoubleRanges(ranges);
}
@Override
BytesRef[] encodeRange(Object from, Object to) {
byte[] fromValue = BinaryRangeUtil.encode(((Number) from).doubleValue());
byte[] toValue = BinaryRangeUtil.encode(((Number) to).doubleValue());
return new BytesRef[]{new BytesRef(fromValue), new BytesRef(toValue)};
}
@Override
public Field getRangeField(String name, Range r) {
return new DoubleRange(name, new double[] {((Number)r.from).doubleValue()}, new double[] {((Number)r.to).doubleValue()});
}
@Override
public Query withinQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return DoubleRange.newWithinQuery(field,
new double[] {includeFrom ? (Double)from : Math.nextUp((Double)from)},
new double[] {includeTo ? (Double)to : Math.nextDown((Double)to)});
}
@Override
public Query containsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return DoubleRange.newContainsQuery(field,
new double[] {includeFrom ? (Double)from : Math.nextUp((Double)from)},
new double[] {includeTo ? (Double)to : Math.nextDown((Double)to)});
}
@Override
public Query intersectsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return DoubleRange.newIntersectsQuery(field,
new double[] {includeFrom ? (Double)from : Math.nextUp((Double)from)},
new double[] {includeTo ? (Double)to : Math.nextDown((Double)to)});
}
},
// todo add BYTE support
// todo add SHORT support
INTEGER("integer_range", NumberType.INTEGER) {
@Override
public Integer minValue() {
return Integer.MIN_VALUE;
}
@Override
public Integer maxValue() {
return Integer.MAX_VALUE;
}
@Override
public Integer nextUp(Object value) {
return ((Number)value).intValue() + 1;
}
@Override
public Integer nextDown(Object value) {
return ((Number)value).intValue() - 1;
}
@Override
public BytesRef encodeRanges(Set<Range> ranges) throws IOException {
return LONG.encodeRanges(ranges);
}
@Override
BytesRef[] encodeRange(Object from, Object to) {
return LONG.encodeRange(from, to);
}
@Override
public Field getRangeField(String name, Range r) {
return new IntRange(name, new int[] {((Number)r.from).intValue()}, new int[] {((Number)r.to).intValue()});
}
@Override
public Query withinQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return IntRange.newWithinQuery(field, new int[] {(Integer)from + (includeFrom ? 0 : 1)},
new int[] {(Integer)to - (includeTo ? 0 : 1)});
}
@Override
public Query containsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return IntRange.newContainsQuery(field, new int[] {(Integer)from + (includeFrom ? 0 : 1)},
new int[] {(Integer)to - (includeTo ? 0 : 1)});
}
@Override
public Query intersectsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return IntRange.newIntersectsQuery(field, new int[] {(Integer)from + (includeFrom ? 0 : 1)},
new int[] {(Integer)to - (includeTo ? 0 : 1)});
}
},
LONG("long_range", NumberType.LONG) {
@Override
public Long minValue() {
return Long.MIN_VALUE;
}
@Override
public Long maxValue() {
return Long.MAX_VALUE;
}
@Override
public Long nextUp(Object value) {
return ((Number)value).longValue() + 1;
}
@Override
public Long nextDown(Object value) {
return ((Number)value).longValue() - 1;
}
@Override
public BytesRef encodeRanges(Set<Range> ranges) throws IOException {
return BinaryRangeUtil.encodeLongRanges(ranges);
}
@Override
BytesRef[] encodeRange(Object from, Object to) {
byte[] encodedFrom = BinaryRangeUtil.encode(((Number) from).longValue());
byte[] encodedTo = BinaryRangeUtil.encode(((Number) to).longValue());
return new BytesRef[]{new BytesRef(encodedFrom), new BytesRef(encodedTo)};
}
@Override
public Field getRangeField(String name, Range r) {
return new LongRange(name, new long[] {((Number)r.from).longValue()},
new long[] {((Number)r.to).longValue()});
}
@Override
public Query withinQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return LongRange.newWithinQuery(field, new long[] {(Long)from + (includeFrom ? 0 : 1)},
new long[] {(Long)to - (includeTo ? 0 : 1)});
}
@Override
public Query containsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return LongRange.newContainsQuery(field, new long[] {(Long)from + (includeFrom ? 0 : 1)},
new long[] {(Long)to - (includeTo ? 0 : 1)});
}
@Override
public Query intersectsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo) {
return LongRange.newIntersectsQuery(field, new long[] {(Long)from + (includeFrom ? 0 : 1)},
new long[] {(Long)to - (includeTo ? 0 : 1)});
}
};
RangeType(String name) {
this.name = name;
this.numberType = null;
}
RangeType(String name, NumberType type) {
this.name = name;
this.numberType = type;
}
/** Get the associated type name. */
public final String typeName() {
return name;
}
public abstract Field getRangeField(String name, Range range);
public List<IndexableField> createFields(ParseContext context, String name, Range range, boolean indexed,
boolean docValued, boolean stored) {
assert range != null : "range cannot be null when creating fields";
List<IndexableField> fields = new ArrayList<>();
if (indexed) {
fields.add(getRangeField(name, range));
}
if (docValued) {
BinaryRangesDocValuesField field = (BinaryRangesDocValuesField) context.doc().getByKey(name);
if (field == null) {
field = new BinaryRangesDocValuesField(name, range, this);
context.doc().addWithKey(name, field);
} else {
field.add(range);
}
}
if (stored) {
fields.add(new StoredField(name, range.toString()));
}
return fields;
}
/** parses from value. rounds according to included flag */
public Object parseFrom(RangeFieldType fieldType, XContentParser parser, boolean coerce, boolean included) throws IOException {
Number value = numberType.parse(parser, coerce);
return included ? value : (Number)nextUp(value);
}
/** parses to value. rounds according to included flag */
public Object parseTo(RangeFieldType fieldType, XContentParser parser, boolean coerce, boolean included) throws IOException {
Number value = numberType.parse(parser, coerce);
return included ? value : (Number)nextDown(value);
}
public abstract Object minValue();
public abstract Object maxValue();
public abstract Object nextUp(Object value);
public abstract Object nextDown(Object value);
public abstract Query withinQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo);
public abstract Query containsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo);
public abstract Query intersectsQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo);
public Object parse(Object value, boolean coerce) {
return numberType.parse(value, coerce);
}
public Query rangeQuery(String field, boolean hasDocValues, Object from, Object to, boolean includeFrom, boolean includeTo,
ShapeRelation relation, @Nullable DateTimeZone timeZone, @Nullable DateMathParser dateMathParser,
QueryShardContext context) {
Object lower = from == null ? minValue() : parse(from, false);
Object upper = to == null ? maxValue() : parse(to, false);
Query indexQuery;
if (relation == ShapeRelation.WITHIN) {
indexQuery = withinQuery(field, lower, upper, includeFrom, includeTo);
} else if (relation == ShapeRelation.CONTAINS) {
indexQuery = containsQuery(field, lower, upper, includeFrom, includeTo);
} else {
indexQuery = intersectsQuery(field, lower, upper, includeFrom, includeTo);
}
if (hasDocValues) {
final QueryType queryType;
if (relation == ShapeRelation.WITHIN) {
queryType = QueryType.WITHIN;
} else if (relation == ShapeRelation.CONTAINS) {
queryType = QueryType.CONTAINS;
} else {
queryType = QueryType.INTERSECTS;
}
Query dvQuery = dvRangeQuery(field, queryType, lower, upper, includeFrom, includeTo);
return new IndexOrDocValuesQuery(indexQuery, dvQuery);
} else {
return indexQuery;
}
}
// No need to take into account Range#includeFrom or Range#includeTo, because from and to have already been
// rounded up via parseFrom and parseTo methods.
public abstract BytesRef encodeRanges(Set<Range> ranges) throws IOException;
public Query dvRangeQuery(String field, QueryType queryType, Object from, Object to, boolean includeFrom, boolean includeTo) {
if (includeFrom == false) {
from = nextUp(from);
}
if (includeTo == false) {
to = nextDown(to);
}
BytesRef[] range = encodeRange(from, to);
return new BinaryDocValuesRangeQuery(field, queryType, range[0], range[1], from, to);
}
abstract BytesRef[] encodeRange(Object from, Object to);
public final String name;
private final NumberType numberType;
}
/** Class defining a range */
public static class Range {
RangeType type;
Object from;
Object to;
private boolean includeFrom;
private boolean includeTo;
public Range(RangeType type, Object from, Object to, boolean includeFrom, boolean includeTo) {
this.type = type;
this.from = from;
this.to = to;
this.includeFrom = includeFrom;
this.includeTo = includeTo;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(includeFrom ? '[' : '(');
Object f = includeFrom || from.equals(type.minValue()) ? from : type.nextDown(from);
Object t = includeTo || to.equals(type.maxValue()) ? to : type.nextUp(to);
sb.append(type == RangeType.IP ? InetAddresses.toAddrString((InetAddress)f) : f.toString());
sb.append(" : ");
sb.append(type == RangeType.IP ? InetAddresses.toAddrString((InetAddress)t) : t.toString());
sb.append(includeTo ? ']' : ')');
return sb.toString();
}
}
static class BinaryRangesDocValuesField extends CustomDocValuesField {
private final Set<Range> ranges;
private final RangeType rangeType;
BinaryRangesDocValuesField(String name, Range range, RangeType rangeType) {
super(name);
this.rangeType = rangeType;
ranges = new HashSet<>();
add(range);
}
void add(Range range) {
ranges.add(range);
}
@Override
public BytesRef binaryValue() {
try {
return rangeType.encodeRanges(ranges);
} catch (IOException e) {
throw new ElasticsearchException("failed to encode ranges", e);
}
}
}
}
| {
"content_hash": "a61665d7c5e429d32124468cc0e18aca",
"timestamp": "",
"source": "github",
"line_count": 966,
"max_line_length": 137,
"avg_line_length": 45.53623188405797,
"alnum_prop": 0.5817723015367827,
"repo_name": "brandonkearby/elasticsearch",
"id": "1f1cdd71e4b1141037767267eaee7386c276565f",
"size": "44778",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "core/src/main/java/org/elasticsearch/index/mapper/RangeFieldMapper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "11082"
},
{
"name": "Batchfile",
"bytes": "10864"
},
{
"name": "Emacs Lisp",
"bytes": "3341"
},
{
"name": "FreeMarker",
"bytes": "45"
},
{
"name": "Groovy",
"bytes": "331503"
},
{
"name": "HTML",
"bytes": "2186"
},
{
"name": "Java",
"bytes": "42817099"
},
{
"name": "Perl",
"bytes": "11756"
},
{
"name": "Python",
"bytes": "19852"
},
{
"name": "Shell",
"bytes": "99126"
}
],
"symlink_target": ""
} |
/*----------------------
AUTHORS: Tuan Anh Nguyen
DESCRIPTION: system stuffs and declarations used by the runtime
Modified by L.Winkler (2008-2009) for Version 1.3
P.Kuonen February 2010 (GetHost, GetIP, add POPC_Host_Name,...)
for version 1.3m (see comments 1.3m)
----------------------*/
#include <stdio.h>
#include <netdb.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ctype.h>
#include "paroc_system.h"
#include <appservice.ph>
#include <paroc_buffer_factory_finder.h>
#include <paroc_utils.h>
paroc_accesspoint paroc_system::appservice;
paroc_accesspoint paroc_system::jobservice;
paroc_string paroc_system::platform;
//V1.3m
paroc_string paroc_system::POPC_HostName;
#define LOCALHOST "localhost"
//End modif
const char *paroc_system::paroc_errstr[17]=
{
"Out of resource",
"Fail to bind to the remote object broker",
"Mismatch remote method id",
"Can not access code service",
"Object allocation failed",
"No parallel object executable",
"Bad paroc package format",
"Local application service failed",
"Job manager service failed",
"Execution of object code failed",
"Bad binding reply",
"No support protocol",
"No support data encoding",
"Standard exception",
"Acknowledgement not received",
"Network configuration error",
"Unknown exception"
};
AppCoreService *paroc_system::mgr=NULL;
paroc_string paroc_system::challenge;
paroc_system::paroc_system()
{
paroc_combox_factory::GetInstance();
paroc_buffer_factory_finder::GetInstance();
char *tmp=getenv("POPC_PLATFORM");
if (tmp!=NULL)
{
platform=tmp;
}
else
{
char str[128];
#ifndef POPC_ARCH
char arch[64], sysname[64];
sysinfo(SI_SYSNAME,sysname,64);
sysinfo(SI_ARCHITECTURE,arch,64);
sprintf(str,"%s-%s",sysname,arch);
#else
strcpy(str,POPC_ARCH);
#endif
platform=str;
}
POPC_HostName = paroc_string(""); //V1.3m
}
paroc_system::~paroc_system()
{
if (mgr!=NULL)
{
Finalize(false);
delete mgr;
}
mgr=NULL;
paroc_combox_factory *pf=paroc_combox_factory::GetInstance();
paroc_buffer_factory_finder *bf=paroc_buffer_factory_finder::GetInstance();
pf->Destroy();
delete bf;
}
void paroc_system::perror(const char *msg)
{
//DEBUG("paroc_system::perror : %d",errno);
if (errno>USER_DEFINE_ERROR && errno<=USER_DEFINE_LASTERROR)
{
if (msg==NULL) msg="POP-C++ Error";
fprintf(stderr,"%s: %s (errno %d)\n",msg,paroc_errstr[errno-USER_DEFINE_ERROR-1],errno);
}
else if (errno>USER_DEFINE_LASTERROR) fprintf(stderr,"%s: Unknown error (errno %d)\n",msg, errno);
else ::perror(msg);
}
void paroc_system::perror(const paroc_exception *e)
{
errno=e->Code();
paroc_system::perror((const char*)e->Extra());
}
// V1.3m
// Try to determine the Host Name of the machine and put it in POPC_Host_Name
// IF env. variable POPC_HOST is defined THEN use POPC_HOST
// ELSE IF try to use gethostname() and possibly env. variable POPC_DOMAIN
// ELSE call GetIP()
//----------------------------------------------------------------------------
paroc_string paroc_system::GetHost()
{
if (POPC_HostName.Length()<1)
{
char str[128];
char *t=getenv("POPC_HOST");
if (t==NULL || *t==0)
{
gethostname(str,127);
if (strchr(str,'.')==NULL || strstr(str,".local\0")!=NULL)
{
int len=strlen(str);
char *domain=getenv("POPC_DOMAIN");
if (domain!=NULL && domain!=0)
{
str[len]='.';
strcpy(str+len+1,domain);
POPC_HostName = str;
}
else //(domain!=NULL && domain!=0)
POPC_HostName = GetIP();
}
else //(strchr(str,'.')==NULL || strstr(str,".local\0")!=NULL)
POPC_HostName = str;
}
else //(t==NULL || *t==0)
POPC_HostName=t;
}
//printf("GetHost returns %s\n", (const char*)POPC_HostName);
return POPC_HostName;
}
// V1.3m
// Try to determine the IP address of the machine.
// If fail return the localhost IP = LOCALHOST
//------------------------------------------------------
paroc_string paroc_system::GetIP()
{
paroc_string iface,ip;
char* tmp;
ip = paroc_string(LOCALHOST);
tmp=getenv("POPC_IP");
if (tmp!=NULL) // Env. variable POPC_IP is defined
{
ip=tmp;
}
else //Env. variable POPC_IP is not defined
{
tmp=getenv("POPC_IFACE");
if (tmp!=NULL) // Env. Variable POP_IFACE is defined
{
iface=tmp;
if (!(GetIPFromInterface(iface,ip)))
{
printf("POP-C++ Warning: Cannot find an IP for interface %s, using '%s' as IP address.\n",(const char*)iface, LOCALHOST);
}
}
else // Env. Variable POP_IFACE is not defined
{
iface=GetDefaultInterface();
if (iface.Length()>0)
{
if (!(GetIPFromInterface(iface,ip)))
{
printf("POP-C++ Warning: host IP not found, using '%s' as IP address.\n",LOCALHOST);
}
}
else
{
printf("POP-C++ Warning: no default network interface found, using '%s' as IP address.\n", LOCALHOST);
}
}
}
return ip;
}
int paroc_system::GetIP(const char *hostname, int *iplist, int listsize)
{
/* This method should normally not be used to return more than one ip*/
assert(listsize==1);
struct hostent *hp;
int n;
char **p;
int addr;
if ((int)(addr = inet_addr(hostname)) == -1)
{
hp=gethostbyname(hostname);
}
else
{
if (listsize>0)
{
*iplist=ntohl(addr);
return 1;
}
return 0;
}
if (hp==NULL) return 0;
n=0;
for (p = hp->h_addr_list; *p != 0 && n<listsize; p++)
{
memcpy(iplist, *p, sizeof (int));
*iplist=ntohl(*iplist);
if (*iplist==(int(127)<<24)+1) continue;
n++;
iplist++;
}
endhostent();
if (n==0) n=1;
return n;
}
int paroc_system::GetIP(int *iplist, int listsize)
{
assert(listsize==1); /* This method cannot return more than one ip*/
char* parocip=strdup((const char*)GetIP());
int n;
int addr;
char *tmp;
char *tok=strtok_r(parocip," \n\r\t",&tmp);
n=0;
while (tok!=NULL && n<listsize) {
if ((int)(addr = inet_addr(tok)) != -1) {
*iplist=ntohl(addr);
iplist++;
n++;
}
tok=strtok_r(NULL," \n\r\t",&tmp);
}
return n;
}
paroc_string paroc_system::GetDefaultInterface()
{
char buff[1024], iface[16], net_addr[128];
//char flags[64], mask_addr[128], gate_addr[128];
//int iflags, metric, refcnt, use, mss, window, irtt;
bool found=false;
FILE *fp = fopen("/proc/net/route", "r");
if (fp != NULL) //else
{
while (fgets(buff, 1023, fp) && !found)
{
//num = sscanf(buff, "%16s %128s %128s %X %d %d %d %128s %d %d %d",
// iface, net_addr, gate_addr, &iflags, &refcnt, &use, &metric, mask_addr, &mss, &window, &irtt);
int num = sscanf(buff, "%16s %128s",iface, net_addr);
if (num < 2)
paroc_exception::paroc_throw_errno();
//DEBUG("iface %s, net_addr %s, gate_addr %s, iflags %X, &refcnt %d, &use %d, &metric %d, mask_addr %s, &mss %d, &window %d, &irtt %d\n\n",iface, net_addr, gate_addr,iflags, refcnt, use, metric, mask_addr, mss, window, irtt);
if (!strcmp(net_addr,"00000000"))
{
//DEBUG("Default gateway : %s", iface);
found=true;
}
}
fclose(fp);
}
if (!found) iface[0] = '\0'; // if not found iface = ""
return paroc_string(iface);
}
bool paroc_system::GetIPFromInterface(paroc_string &iface, paroc_string &str_ip)
{
struct ifaddrs *addrs, *iap;
struct sockaddr_in *sa;
char str_ip_local[32];
getifaddrs(&addrs);
//The getifaddrs() function creates a linked list of structures describing the
//network interfaces of the local system, and stores the address of the first
//item of the list in *ifap. The list consists of ifaddrs structures, defined
//as follows:
//struct ifaddrs
//{
//struct ifaddrs *ifa_next; /* Next item in list */
//char *ifa_name; /* Name of interface */
//unsigned int ifa_flags; /* Flags from SIOCGIFFLAGS */
//struct sockaddr *ifa_addr; /* Address of interface */
//struct sockaddr *ifa_netmask; /* Netmask of interface */
//union
//{
//struct sockaddr *ifu_broadaddr; /* Broadcast address of interface */
//struct sockaddr *ifu_dstaddr; /* Point-to-point destination address */
//} ifa_ifu;
//#define ifa_broadaddr ifa_ifu.ifu_broadaddr
//#define ifa_dstaddr ifa_ifu.ifu_dstaddr
//void *ifa_data; /* Address-specific data */
//};
//printf("\nLooking for interface: %s --->\n",(const char*)iface);
for (iap = addrs; iap != NULL; iap = iap->ifa_next){
//printf("name=%s, addr=%p, flag=%d (%d), familly=%d (%d)\n",iap->ifa_name, iap->ifa_addr, iap->ifa_flags, IFF_UP, iap->ifa_addr->sa_family, AF_INET);
if ( iap->ifa_addr &&
(iap->ifa_flags & IFF_UP) &&
(iap->ifa_addr->sa_family == AF_INET) &&
!strcmp(iap->ifa_name, (const char*)iface) )
{
sa = (struct sockaddr_in *)(iap->ifa_addr);
inet_ntop(iap->ifa_addr->sa_family,
(void *)&(sa->sin_addr),
str_ip_local,
sizeof(str_ip_local) );
//DEBUG("The IP of interface %s is %s",iap->ifa_name,str_ip_local);
//printf("The IP of interface %s is %s\n",iap->ifa_name,str_ip_local);
str_ip=str_ip_local;
freeifaddrs(addrs);
return true;
}}
freeifaddrs(addrs);
return false;
}
bool paroc_system::Initialize(int *argc,char ***argv)
{
char *info=paroc_utils::checkremove(argc,argv,"-jobservice=");
if (info==NULL) return false;
paroc_system::jobservice.SetAccessString(info);
char *codeser=paroc_utils::checkremove(argc,argv,"-appservicecode=");
char *proxy=paroc_utils::checkremove(argc,argv,"-proxy=");
if (paroc_utils::checkremove(argc,argv,"-runlocal")) paroc_od::defaultLocalJob=true;
char *appcontact=paroc_utils::checkremove(argc,argv,"-appservicecontact=");
if (codeser==NULL && appcontact==NULL) return false;
try
{
if (appcontact==NULL)
{
char url[1024];
if (proxy==NULL) strcpy(url,codeser);
else sprintf(url,"%s -proxy=%s",codeser, proxy);
//rprintf("mgr=CreateAppCoreService(url=%s);\n", url);
mgr=CreateAppCoreService(url);
}
else
{
challenge=NULL;
paroc_accesspoint app;
app.SetAccessString(appcontact);
//rprintf("mgr=CreateAppCoreService(app=accesspoint);\n");
mgr=new AppCoreService(app);
}
paroc_system::appservice=mgr->GetAccessPoint();
}
catch (POPException *e)
{
printf("POP-C++ Exception occurs in paroc_system::Initialize\n");
POPSystem::perror(e);
delete e;
if (mgr!=NULL)
{
mgr->KillAll();
mgr->Stop(challenge);
delete mgr;
mgr=NULL;
}
return false;
}
catch (...)
{
if (mgr!=NULL)
{
mgr->KillAll();
mgr->Stop(challenge);
delete mgr;
mgr=NULL;
}
return false;
}
char *codeconf=paroc_utils::checkremove(argc,argv,"-codeconf=");
DEBUGIF(codeconf==NULL,"No code config file\n");
/*if (codeconf!=NULL && !paroc_utils::InitCodeService(codeconf,mgr))
return false;
else return true; */
return !(codeconf!=NULL && !paroc_utils::InitCodeService(codeconf,mgr));
}
void paroc_system::Finalize(bool normalExit)
{
if (mgr!=NULL)
{
try
{
if (normalExit)
{
//Wait all object to be terminated!
int timeout=10;
int oldcount=0, count;
while ((count=mgr->CheckObjects())>0)
{
if (timeout<1800 && oldcount==count) timeout=timeout*4/3;
else timeout=10;
sleep(timeout);
oldcount=count;
}
}
else mgr->KillAll();
mgr->Stop(challenge);
delete mgr;
// DEBUG("Application scope services are terminated");
}
catch (paroc_exception *e)
{
paroc_system::perror(e->Extra());
delete e;
}
catch (...)
{
fprintf(stderr,"POP-C++ error on finalizing the application\n");
}
mgr=NULL;
}
}
AppCoreService *paroc_system::CreateAppCoreService(char *codelocation)
{
int i=0;
int range=40;
srand(time(NULL));
char tmp[256];
for (int i=0;i<255;i++) tmp[i]=(char)(1+254.0*rand()/(RAND_MAX+1.0) );
tmp[255]='\0';
challenge=tmp;
return new AppCoreService(challenge, false, codelocation);
}
void paroc_system::processor_set(int cpu)
{
#ifndef ARCH_MAC
//debug(1, "cpu=%d", cpu);
if (cpu < 0) {
printf("POP-C++ Warning : Cannot set processor to %d<0", cpu);
exit(EXIT_FAILURE);
}
if (cpu >= CPU_SETSIZE) {
printf("POP-C++ Warning : Cannot set processor to %d while CPU_SETSIZE=%d", cpu, CPU_SETSIZE);
exit(EXIT_FAILURE);
}
cpu_set_t cpu_set;
CPU_ZERO(&cpu_set);
CPU_SET(cpu, &cpu_set);
if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set) == -1) {
printf("POP-C++ Warning : Cannot set processor to %d (cpu_set %p)", cpu,(void *)&cpu_set);
exit(EXIT_FAILURE);
}
cpu_set_t cpu_get;
CPU_ZERO(&cpu_get);
if (sched_getaffinity(0, sizeof(cpu_get), &cpu_get) == -1) {
printf("POP-C++ Warning : Unable to sched_getaffinity to (cpu_get) %p", (void *)&cpu_get);
exit(EXIT_FAILURE);
}
if (memcmp(&cpu_get, &cpu_set, sizeof(cpu_set_t))) {
printf("POP-C++ Warning : Unable to run on cpu %d", cpu);
exit(EXIT_FAILURE);
}
#endif
}
| {
"content_hash": "0fc0054310a67c4471932362e5e6f553",
"timestamp": "",
"source": "github",
"line_count": 509,
"max_line_length": 229,
"avg_line_length": 25.49901768172888,
"alnum_prop": 0.619693350797442,
"repo_name": "GaretJax/pop-analysis-suite",
"id": "388cce5bf8a689f90d331d23d61161bd0250367c",
"size": "12979",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pas/conf/suite_template/contrib/popc_1.3.1beta_xdr/lib/system.cc",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "141139"
},
{
"name": "C++",
"bytes": "1096048"
},
{
"name": "JavaScript",
"bytes": "291337"
},
{
"name": "Perl",
"bytes": "73996"
},
{
"name": "Python",
"bytes": "259196"
},
{
"name": "Ruby",
"bytes": "3230"
},
{
"name": "Shell",
"bytes": "245163"
}
],
"symlink_target": ""
} |
package org.andengine.entity.primitive;
import java.util.ArrayList;
import java.util.List;
import org.andengine.opengl.vbo.DrawType;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import org.andengine.opengl.vbo.attribute.VertexBufferObjectAttribute;
import android.util.Log;
/**
*
* @author Rodrigo Castro
* @since 22:10:11 - 28.01.2012
*/
public class Polygon extends Mesh {
// ===========================================================
// Constants
// ===========================================================
private static final float VERTEX_SIZE_DEFAULT_RATIO = 1.f;
// ===========================================================
// Fields
// ===========================================================
protected float[] mVertexX;
protected float[] mVertexY;
protected static EarClippingTriangulator mTriangulator = new EarClippingTriangulator();
// ===========================================================
// Constructors
// ===========================================================
/**
* Uses a default {@link HighPerformanceMeshVertexBufferObject} in {@link DrawType#STATIC} with the {@link VertexBufferObjectAttribute}s: {@link Mesh#VERTEXBUFFEROBJECTATTRIBUTES_DEFAULT}.
*/
public Polygon(final float pX, final float pY, final float[] pVertexX, final float[] pVertexY, final VertexBufferObjectManager pVertexBufferObjectManager) {
this(pX, pY, pVertexX, pVertexY, pVertexBufferObjectManager, DrawType.STATIC);
}
/**
* Uses a default {@link HighPerformanceMeshVertexBufferObject} with the {@link VertexBufferObjectAttribute}s: {@link Mesh#VERTEXBUFFEROBJECTATTRIBUTES_DEFAULT}.
*/
public Polygon(final float pX, final float pY, final float[] pVertexX, float[] pVertexY, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType) {
this(pX, pY, buildVertexList(mTriangulator.computeTriangles(buildListOfVector2(pVertexX, pVertexY))), VERTEX_SIZE_DEFAULT_RATIO, pVertexBufferObjectManager, pDrawType );
assert( mVertexX.length == mVertexY.length );
mVertexX = pVertexX;
mVertexY = pVertexY;
}
/**
* Uses a default {@link HighPerformanceMeshVertexBufferObject} with the {@link VertexBufferObjectAttribute}s: {@link Mesh#VERTEXBUFFEROBJECTATTRIBUTES_DEFAULT}.
*/
public Polygon(final float pX, final float pY, final float[] pBufferData, final float sizeRatio, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType) {
super(pX, pY, (int) ((pBufferData.length / VERTEX_SIZE)* sizeRatio), DrawMode.TRIANGLES,
new HighPerformanceMeshVertexBufferObject(pVertexBufferObjectManager, pBufferData, (int) ((pBufferData.length / VERTEX_SIZE )*sizeRatio), pDrawType, true, Mesh.VERTEXBUFFEROBJECTATTRIBUTES_DEFAULT));
onUpdateVertices();
}
// ===========================================================
// Getter & Setter
// ===========================================================
public float[] getVertexX()
{
return mVertexX;
}
public float[] getVertexY()
{
return mVertexY;
}
/**
*
* @param pVertexX
* @param pVertexY
* @return true if vertices were correctly updated
* false otherwise
*/
public boolean updateVertices( float[] pVertexX, float[] pVertexY )
{
mVertexX = pVertexX;
mVertexY = pVertexY;
assert( mVertexX.length == mVertexY.length );
List<Vector2> verticesVectors = mTriangulator.computeTriangles(buildListOfVector2(pVertexX, pVertexY));
if( verticesVectors.size() == 0 )
{
Log.e("AndEngine", "Error: Polygon - Polygon can't be triangulated. Will not update vertices");
return false;
}
updateVertices(verticesVectors, getBufferData());
onUpdateVertices();
return true;
}
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
// ===========================================================
// Methods
// ===========================================================
protected static List<Vector2> buildListOfVector2(float[] pX, float [] pY )
{
assert(pX.length == pY.length );
ArrayList<Vector2> vectors = new ArrayList<Vector2>( pX.length );
for( int i = 0; i < pX.length; i++ )
{
// TODO avoid using new
Vector2 v = new Vector2( pX[i], pY[i]);
vectors.add(v);
}
return vectors;
}
protected static float[] buildVertexList(List<Vector2> vertices )
{
float[] bufferData = new float[VERTEX_SIZE * vertices.size()];
updateVertices( vertices, bufferData );
return bufferData;
}
protected static void updateVertices(List<Vector2> vertices, float[] pBufferData) {
int i = 0;
for( Vector2 vertex : vertices )
{
pBufferData[(i * Mesh.VERTEX_SIZE) + Mesh.VERTEX_INDEX_X] = vertex.x;
pBufferData[(i * Mesh.VERTEX_SIZE) + Mesh.VERTEX_INDEX_Y] = vertex.y;
i++;
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
| {
"content_hash": "211b276514af286e123342251ebf74a3",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 203,
"avg_line_length": 33.23026315789474,
"alnum_prop": 0.6032468818055831,
"repo_name": "Ullauri/Armada",
"id": "f875e58045ca8be7c4b21493398df06a1fe1f6e2",
"size": "5051",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "andEngine/src/main/java/org/andengine/entity/primitive/Polygon.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "108"
},
{
"name": "C",
"bytes": "8569"
},
{
"name": "C++",
"bytes": "636464"
},
{
"name": "Java",
"bytes": "2808793"
},
{
"name": "Makefile",
"bytes": "1173549"
},
{
"name": "Shell",
"bytes": "739"
}
],
"symlink_target": ""
} |
package com.organic.maynard.outliner;
import com.organic.maynard.outliner.dom.Document;
import com.organic.maynard.outliner.guitree.*;
import com.organic.maynard.outliner.util.preferences.*;
import java.awt.*;
import javax.swing.*;
/**
* @author $Author: maynardd $
* @version $Revision: 1.22 $, $Date: 2004/01/31 00:33:09 $
*/
public class OutlinerDesktopManager extends DefaultDesktopManager {
// Direction Constants
private static final int NORTH = 1;
private static final int NORTHEAST = 2;
private static final int EAST = 3;
private static final int SOUTHEAST = 4;
private static final int SOUTH = 5;
private static final int SOUTHWEST = 6;
private static final int WEST = 7;
private static final int NORTHWEST = 8;
// Minimized Icon Constants
private static final int ICON_WIDTH = 150;
private static final int ICON_HEIGHT = 25;
private boolean isDragging = false;
//JInternalFrame State
private int resizeDirection = 0;
private int startingX = 0;
private int startingWidth = 0;
private int startingY = 0;
private int startingHeight = 0;
public static boolean activationBlock = false;
// The Constructor
public OutlinerDesktopManager() {
super();
}
public boolean isDragging() {
return isDragging;
}
public boolean isMaximized() {
return Preferences.getPreferenceBoolean(Preferences.IS_MAXIMIZED).cur;
}
public void setMaximized(boolean b) {
Preferences.getPreferenceBoolean(Preferences.IS_MAXIMIZED).cur = b;
}
// DesktopManagerInterface
@Override
public void beginResizingFrame(JComponent f, int direction) {
//System.out.println("beginResizingFrame");
resizeDirection = direction;
startingX = f.getLocation().x;
startingWidth = f.getWidth();
startingY = f.getLocation().y;
startingHeight = f.getHeight();
super.beginResizingFrame(f,direction);
}
@Override
public void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) {
//System.out.println("resizingFrame");
// Ensure a minimum size for the window.
if (f instanceof JInternalFrame) {
int minWidth = OutlinerDocument.MIN_WIDTH;
int minHeight = OutlinerDocument.MIN_HEIGHT;
if (newWidth < minWidth) {
newWidth = minWidth;
if ((resizeDirection == NORTHWEST) || (resizeDirection == WEST) || (resizeDirection == SOUTHWEST)) {
newX = (startingX + startingWidth - minWidth);
} else {
newX = f.getLocation().x;
}
}
if (newHeight < minHeight) {
newHeight = minHeight;
if ((resizeDirection == NORTHEAST) || (resizeDirection == NORTH) || (resizeDirection == NORTHWEST)) {
newY = (startingY + startingHeight - minHeight);
} else {
newY = f.getLocation().y;
}
}
}
// Prevent resizing of the frame above or to the left.
if (newY < 0) {
newHeight += newY;
newY = 0;
}
if (newX < 0) {
newWidth += newX;
newX = 0;
}
super.resizeFrame(f,newX,newY,newWidth,newHeight);
updateDesktopSize(false);
}
@Override
public void endResizingFrame(JComponent f) {
//System.out.println("endResizingFrame");
super.endResizingFrame(f);
}
@Override
public void beginDraggingFrame(JComponent f) {
//System.out.println("beginDraggingFrame");
isDragging = true;
super.beginDraggingFrame(f);
}
@Override
public void dragFrame(JComponent f, int newX, int newY) {
//System.out.println("dragFrame");
// Prevent dragging of the frame above the visible area. To the left is ok though.
if (newY < 0) {newY = 0;}
super.dragFrame(f,newX,newY);
updateDesktopSize(false);
}
@Override
public void endDraggingFrame(JComponent f) {
//System.out.println("endDraggingFrame");
isDragging = false;
super.endDraggingFrame(f);
updateDesktopSize(true);
}
@Override
public void activateFrame(JInternalFrame f) {
if (activationBlock) {return;}
//System.out.println("activateFrame " + f.getTitle());
super.activateFrame(f);
if (f instanceof Document) {
Outliner.documents.setMostRecentDocumentTouched((Document) f);
}
// Move the internalframe back so it's visible if it's outside the visible rect.
Rectangle r = Outliner.jsp.getViewport().getViewRect();
Rectangle r2 = f.getBounds();
if (!r.intersects(r2)) {
setBoundsForFrame(f, r.x + 5, r.y + 5, f.getWidth(), f.getHeight());
}
}
@Override
public void deactivateFrame(JInternalFrame f) {
//System.out.println("deactivateFrame");
super.deactivateFrame(f);
}
@Override
public void openFrame(JInternalFrame f) {
//System.out.println("openFrame");
super.openFrame(f);
updateDesktopSize(false);
}
@Override
public void closeFrame(JInternalFrame f) {
//System.out.println("closeFrame");
super.closeFrame(f);
updateDesktopSize(false);
}
@Override
public void iconifyFrame(JInternalFrame f) {
//System.out.println("iconifyFrame");
super.iconifyFrame(f);
f.getDesktopIcon().setSize(ICON_WIDTH,ICON_HEIGHT);
}
@Override
public void deiconifyFrame(JInternalFrame f) {
//System.out.println("deiconifyFrame");
super.deiconifyFrame(f);
updateDesktopSize(false);
}
@Override
public void maximizeFrame(JInternalFrame f) {
//System.out.println("maximizeFrame: " + f.getTitle());
setMaximized(true);
super.maximizeFrame(f);
// Move it to the front since under certain conditions it may not already be there.
f.moveToFront();
// Disable Stack Menu Item
JMenuItem item = (JMenuItem) GUITreeLoader.reg.get(GUITreeComponentRegistry.STACK_MENU_ITEM);
item.setEnabled(false);
// Remove the border
((OutlinerDocument) f).hideBorder();
// Make sure JInternalFrame is sized to the viewport, not the desktop.
Dimension d = new Dimension(Outliner.jsp.getViewport().getWidth(), Outliner.jsp.getViewport().getHeight());
f.setSize(d);
updateDesktopSize(false);
}
@Override
public void minimizeFrame(JInternalFrame f) {
//System.out.println("minimizeFrame: " + f.getTitle());
setMaximized(false);
super.minimizeFrame(f);
// Enable Stack Menu Item
JMenuItem item = (JMenuItem) GUITreeLoader.reg.get(GUITreeComponentRegistry.STACK_MENU_ITEM);
item.setEnabled(true);
// Restore the border
((OutlinerDocument) f).showBorder();
updateDesktopSize(false);
}
@Override
public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) {
//System.out.println("setBoundsForFrame");
if (!(f instanceof JInternalFrame)) {
newWidth = ICON_WIDTH;
newHeight = ICON_HEIGHT;
newX = findNearest(newX,ICON_WIDTH) * ICON_WIDTH;
newY = findNearest(newY,ICON_HEIGHT) * ICON_HEIGHT;
}
super.setBoundsForFrame(f,newX,newY,newWidth,newHeight);
}
// Utility Methods
private int findNearest(int value, int partition) {
return value/partition;
}
private void updateDesktopSize(boolean repaint) {
// This is just flailing to get it to redraw itself.
Outliner.jsp.revalidate();
Outliner.jsp.validate();
Outliner.jsp.getHorizontalScrollBar().repaint();
Outliner.jsp.getVerticalScrollBar().repaint();
if (repaint) {
Outliner.desktop.repaint();
}
}
} | {
"content_hash": "a4168d271d4c5aeba644a96dd706c545",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 109,
"avg_line_length": 26.313868613138688,
"alnum_prop": 0.6941747572815534,
"repo_name": "hashrock/JOutliner",
"id": "74588a8613486eb544e709b59354e86e3ed6a31d",
"size": "8868",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/organic/maynard/outliner/OutlinerDesktopManager.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "4187"
},
{
"name": "Java",
"bytes": "1976350"
}
],
"symlink_target": ""
} |
<div class="commune_descr limited">
<p>
Gujan-Mestras est
une ville géographiquement positionnée dans le département de Gironde en Aquitaine. Elle comptait 17 031 habitants en 2008.</p>
<p>À Gujan-Mestras, le prix moyen à la vente d'un appartement s'évalue à 2 983 € du m² en vente. Le prix moyen d'une maison à l'achat se situe à 3 253 € du m². À la location le prix moyen se situe à 11,5 € du m² par mois.</p>
<p>La ville propose de multiples équipements sportifs, elle dispose, entre autres, de un bassin de natation, un terrain de tennis, un parcours de golf et une boucle de randonnée.</p>
<p>Le parc de logements, à Gujan-Mestras, était réparti en 2011 en 1 415 appartements et 9 554 maisons soit
un marché relativement équilibré.</p>
<p>À Gujan-Mestras le salaire médian par mois par habitant se situe à environ 2 146 € net. Ceci est au dessus de la moyenne nationale.</p>
<p>À coté de Gujan-Mestras sont situées les communes de
<a href="{{VLROOT}}/immobilier/arcachon_33009/">Arcachon</a> située à 6 km, 12 153 habitants,
<a href="{{VLROOT}}/immobilier/lanton_33229/">Lanton</a> à 7 km, 5 866 habitants,
<a href="{{VLROOT}}/immobilier/teich_33527/">Le Teich</a> à 4 km, 6 048 habitants,
<a href="{{VLROOT}}/immobilier/biganos_33051/">Biganos</a> localisée à 7 km, 8 622 habitants,
<a href="{{VLROOT}}/immobilier/audenge_33019/">Audenge</a> localisée à 6 km, 5 539 habitants,
entre autres. De plus, Gujan-Mestras est située à seulement sept km de <a href="{{VLROOT}}/immobilier/teste-de-buch_33529/">La Teste-de-Buch</a>.</p>
<p>
La commune dispose en ce qui concerne l'éducation des jeunes de un collège et un lycée.
S'agissant les plus jeunes, la commune peut se prévaloir de disposer de trois maternelles et cinq écoles primaires.
Gujan-Mestras dispose des équipements éducatifs facilitant une éducation de qualité.
Si vous avez un projet de transaction immobilière à Gujan-Mestras, il est intéressant d' regarder la valeur des équipements éducatifs</p>
</div>
| {
"content_hash": "6fb066a363382a89ec0e65c190fb169f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 250,
"avg_line_length": 95.4090909090909,
"alnum_prop": 0.7527393997141496,
"repo_name": "donaldinou/frontend",
"id": "b3f5a043efb4365e46543eefe29e8b982beaa3c4",
"size": "2151",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Viteloge/CoreBundle/Resources/descriptions/33199.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3073"
},
{
"name": "CSS",
"bytes": "111338"
},
{
"name": "HTML",
"bytes": "58634405"
},
{
"name": "JavaScript",
"bytes": "88564"
},
{
"name": "PHP",
"bytes": "841919"
}
],
"symlink_target": ""
} |
package com.arrow.acn.client.model;
import com.arrow.acs.client.model.AuditableDocumentModelAbstract;
public class GlobalTagModel extends AuditableDocumentModelAbstract<GlobalTagModel> {
private static final long serialVersionUID = -9212539571362347963L;
private String name;
private String tagType;
private String objectType;
@Override
protected GlobalTagModel self() {
return this;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTagType() {
return tagType;
}
public void setTagType(String tagType) {
this.tagType = tagType;
}
public String getObjectType() {
return objectType;
}
public void setObjectType(String objectType) {
this.objectType = objectType;
}
}
| {
"content_hash": "63b5a61be78f10059b4d1f54ed6c3ea1",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 84,
"avg_line_length": 18.452380952380953,
"alnum_prop": 0.7535483870967742,
"repo_name": "arrow-acs/acn-sdk-java",
"id": "8155fd5c92789a648667cdb0460a4396b6802390",
"size": "1268",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "acn-core/src/main/java/com/arrow/acn/client/model/GlobalTagModel.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "407283"
}
],
"symlink_target": ""
} |
namespace Ness
{
namespace Gui
{
GuiManager::GuiManager(Renderer* renderer, const String& resources_path)
: m_renderer(renderer), m_resources_path(resources_path + "/")
{
// create the root container
m_root_container = ness_make_ptr<RootContainer>(this);
// set defaults
m_unit_size = Point(32, 32);
m_default_text_color = Color::BLACK;
m_default_frames_color = Color::WHITE;
m_font_size = 17;
m_default_text_shadow = Color(0.0f, 0.0f, 0.0f, 0.5f);
m_default_text_shadow_offset = Point(1, 1);
// load gui settings file
load_settings();
// pre-load gui font
m_font = m_renderer->resources().get_font(m_resources_path + "font.ttf", m_font_size * 2);
// pre-load all gui textures
m_textures.push_back(m_renderer->resources().get_texture(m_resources_path + "frame_disabled.png"));
m_textures.push_back(m_renderer->resources().get_texture(m_resources_path + "frame_focused.png"));
m_textures.push_back(m_renderer->resources().get_texture(m_resources_path + "frame_unfocused.png"));
m_textures.push_back(m_renderer->resources().get_texture(m_resources_path + "frame_mouse_hover.png"));
m_textures.push_back(m_renderer->resources().get_texture(m_resources_path + "frame_mouse_down.png"));
m_textures.push_back(m_renderer->resources().get_texture(m_resources_path + "button_disabled.png"));
m_textures.push_back(m_renderer->resources().get_texture(m_resources_path + "button_focused.png"));
m_textures.push_back(m_renderer->resources().get_texture(m_resources_path + "button_unfocused.png"));
m_textures.push_back(m_renderer->resources().get_texture(m_resources_path + "button_mouse_hover.png"));
m_textures.push_back(m_renderer->resources().get_texture(m_resources_path + "button_mouse_down.png"));
}
void GuiManager::load_settings()
{
// open data file
std::ifstream infile;
infile.open(m_resources_path + "settings.dat");
if (infile.bad() || infile.eof())
{
throw FileNotFound((m_resources_path + "settings.dat").c_str());
}
// load all gui settings
std::string line;
while (std::getline(infile, line))
{
// ignore comments and empty lines
if (line.length() == 0 || line[0] == '#')
continue;
// split into param name and value
std::string param = line.substr(0, line.find(':'));
std::string value = line.substr(line.find(':') + 1);
// if there is space after the ':', remove it
while ((value[0] == ' ' || value[0] == '\t') && value.length() > 0)
{
value = value.substr(1);
}
// make sure value and param are valid
if (value.length() == 0 || param.length() == 0)
{
throw WrongFormatError(("Invalid key or value loaded in gui settings.dat! line: " + line).c_str());
}
// now parse params
if (param == "default_font_color")
{
m_default_text_color.deserialize(value);
}
else if (param == "default_frames_color")
{
m_default_frames_color.deserialize(value);
}
else if (param == "font_size")
{
m_font_size = atoi(value.c_str());
}
else if (param == "grid_unit_size")
{
m_unit_size.deserialize(value);
}
else if (param == "padding")
{
m_padding.deserialize(value);
}
else if (param == "default_font_shadow_color")
{
m_default_text_shadow.deserialize(value);
}
else if (param == "default_font_shadow_offset")
{
m_default_text_shadow_offset.deserialize(value);
}
else
{
throw WrongFormatError(("Unknown parameter in gui settings.dat! line: " + line).c_str());
}
}
// fix some defaults
if (m_padding == Sizei::ZERO)
m_padding = m_unit_size / 2;
}
ContainerPtr GuiManager::create_container(const Pointi& size_in_units)
{
return m_root_container->create_container(size_in_units);
}
void GuiManager::render()
{
m_root_container->get_node()->render(m_renderer->get_null_camera());
}
bool GuiManager::inject_event(const Event& event)
{
bool ret = false;
// check the type of event called
switch (event.type)
{
// do mouse movement
case SDL_MOUSEMOTION:
ret = m_root_container->handle_mouse_move(m_mouse.position());
break;
case SDL_MOUSEBUTTONDOWN:
ret = m_root_container->handle_mouse_state((EMouseButtons)event.button.button, true, m_mouse.position());
break;
case SDL_MOUSEBUTTONUP:
ret = m_root_container->handle_mouse_state((EMouseButtons)event.button.button, false, m_mouse.position());
break;
}
// update mouse and keyboard
// we use this to remember the last keyboard and mouse state
m_mouse.inject_event(event);
m_keyboard.inject_event(event);
return ret;
}
}
} | {
"content_hash": "89d1b3ad110f9b84aa1b2f7d4a210b4f",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 111,
"avg_line_length": 30.830065359477125,
"alnum_prop": 0.6404494382022472,
"repo_name": "aquafox/debuggame",
"id": "1272a80739a5099ca41d01f000c12434a78f844f",
"size": "4854",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/NessEngine/gui/gui_manager.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "238027"
},
{
"name": "C++",
"bytes": "643346"
},
{
"name": "CMake",
"bytes": "18032"
}
],
"symlink_target": ""
} |
<div class="commune_descr limited">
<p>
Meljac est
un village
localisé dans le département de l'Aveyron en Midi-Pyrénées. On dénombrait 145 habitants en 2008.</p>
<p>Le parc de logements, à Meljac, se décomposait en 2011 en deux appartements et 98 maisons soit
un marché plutôt équilibré.</p>
<p>La commune compte quelques équipements sportifs, elle dispose, entre autres, de une boucle de randonnée.</p>
<p>Si vous envisagez de demenager à Meljac, vous pourrez facilement trouver une maison à vendre. </p>
<p>À coté de Meljac sont localisées les communes de
<a href="{{VLROOT}}/immobilier/ledergues_12127/">Lédergues</a> à 5 km, 699 habitants,
<a href="{{VLROOT}}/immobilier/naucelle_12169/">Naucelle</a> à 9 km, 1 944 habitants,
<a href="{{VLROOT}}/immobilier/ledas-et-penthies_81141/">Lédas-et-Penthiès</a> située à 7 km, 166 habitants,
<a href="{{VLROOT}}/immobilier/centres_12065/">Centrès</a> localisée à 3 km, 553 habitants,
<a href="{{VLROOT}}/immobilier/saint-just-sur-viaur_12235/">Saint-Just-sur-Viaur</a> à 5 km, 208 habitants,
<a href="{{VLROOT}}/immobilier/frayssinhes_46115/">Frayssinhes</a> localisée à 4 km, 195 habitants,
entre autres. De plus, Meljac est située à seulement 25 km de <a href="{{VLROOT}}/immobilier/rodez_12202/">Rodez</a>.</p>
</div>
| {
"content_hash": "9f791abb4d5f756558d1d41dbc8061a5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 127,
"avg_line_length": 73.77777777777777,
"alnum_prop": 0.7326807228915663,
"repo_name": "donaldinou/frontend",
"id": "bb24878e64601af5fb640073090f5fa2a112e2fd",
"size": "1361",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Viteloge/CoreBundle/Resources/descriptions/12144.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3073"
},
{
"name": "CSS",
"bytes": "111338"
},
{
"name": "HTML",
"bytes": "58634405"
},
{
"name": "JavaScript",
"bytes": "88564"
},
{
"name": "PHP",
"bytes": "841919"
}
],
"symlink_target": ""
} |
<?php
namespace ZenAPI;
class WeiboClient extends BaseClient{
/**
*
* @var string
*/
public $access_token;
/**
* Set up the API root URL.
*
* @ignore
*/
public $host = "https://api.weibo.com/2/";
/**
*
* @var string
*/
public $remote_ip = null;
/**
*
* @var string
*/
public $format = 'json';
/**
*
* @param string $access_token
*/
public function __construct($access_token = NULL) {
$this->access_token = $access_token;
}
protected function _additionalHeaders(){
$headers = array();
if ($this->access_token)
$headers[] = "Authorization: OAuth2 ".$this->access_token;
if (isset($this->remote_ip))
$headers[] = "API-RemoteIP: " . $this->remote_ip;
elseif(isset($_SERVER['REMOTE_ADDR']))
$headers[] = "API-RemoteIP: " . $_SERVER['REMOTE_ADDR'];
return $headers;
}
/**
*
* @param string $clientId
*/
public static function createByClientId($clientId){
$instance = new self(null);
$instance->client_id = $clientId;
return $instance;
}
public function realUrl($url){
return $this->host . $url . '.' . $this->format;
}
}
| {
"content_hash": "dbaacebc572640fd1b7352f7f99f11e6",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 61,
"avg_line_length": 17.12121212121212,
"alnum_prop": 0.5876106194690266,
"repo_name": "libern/zenapi",
"id": "753da1be0310ab21d44e22be0086051870088bc2",
"size": "1130",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/WeiboClient.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "PHP",
"bytes": "41431"
}
],
"symlink_target": ""
} |
package org.spongepowered.common.world.gen.builders;
import static com.google.common.base.Preconditions.checkNotNull;
import net.minecraft.block.BlockTallGrass;
import net.minecraft.world.gen.feature.WorldGenTallGrass;
import org.spongepowered.api.data.type.ShrubType;
import org.spongepowered.api.util.weighted.VariableAmount;
import org.spongepowered.api.util.weighted.WeightedObject;
import org.spongepowered.api.util.weighted.WeightedTable;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.extent.Extent;
import org.spongepowered.api.world.gen.populator.Shrub;
import org.spongepowered.api.world.gen.populator.Shrub.Builder;
import java.util.function.Function;
import javax.annotation.Nullable;
public class ShrubBuilder implements Shrub.Builder {
private VariableAmount count;
private WeightedTable<ShrubType> types;
@Nullable private Function<Location<Extent>, ShrubType> override;
public ShrubBuilder() {
reset();
}
@Override
public Builder perChunk(VariableAmount count) {
this.count = checkNotNull(count, "count");
return this;
}
@Override
public Builder types(WeightedTable<ShrubType> types) {
checkNotNull(types);
this.types = types;
return this;
}
@Override
public Builder type(ShrubType type, int weight) {
checkNotNull(type);
this.types.add(new WeightedObject<ShrubType>(type, weight));
return this;
}
@Override
public Builder supplier(@Nullable Function<Location<Extent>, ShrubType> override) {
this.override = override;
return this;
}
@Override
public Builder from(Shrub value) {
WeightedTable<ShrubType> table = new WeightedTable<>();
table.addAll(value.getTypes());
return perChunk(value.getShrubsPerChunk())
.types(table)
.supplier(value.getSupplierOverride().orElse(null));
}
@Override
public Builder reset() {
if (this.types == null) {
this.types = new WeightedTable<>();
} else {
this.types.clear();
}
this.count = VariableAmount.fixed(128);
this.override = null;
return this;
}
@Override
public Shrub build() throws IllegalStateException {
Shrub pop = (Shrub) new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS);
pop.getTypes().clear();
pop.getTypes().addAll(this.types);
pop.setShrubsPerChunk(this.count);
pop.setSupplierOverride(this.override);
return pop;
}
}
| {
"content_hash": "0ea3bf658744cb560d9811d2e244c6f5",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 87,
"avg_line_length": 29.477272727272727,
"alnum_prop": 0.6823438704703161,
"repo_name": "Grinch/SpongeCommon",
"id": "cd784fb180ecd7c1bf931a4f62da6f9cd7ee5383",
"size": "3841",
"binary": false,
"copies": "6",
"ref": "refs/heads/bleeding",
"path": "src/main/java/org/spongepowered/common/world/gen/builders/ShrubBuilder.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "11036834"
},
{
"name": "Shell",
"bytes": "1072"
}
],
"symlink_target": ""
} |
FROM ubuntu:14.04
RUN apt-get update && \
apt-get -y install clamav-daemon && \
freshclam
RUN mkdir -p /var/run/clamav
ADD ./clamd.conf /etc/clamav/clamd.conf
CMD ["clamd", "--config-file=/etc/clamav/clamd.conf"]
| {
"content_hash": "4b955916efc3c7f63151763d218a7ced",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 53,
"avg_line_length": 20.181818181818183,
"alnum_prop": 0.6801801801801802,
"repo_name": "ukwa/docker-clamd",
"id": "041ab39ce785566ddc936062871ae1320e0114d8",
"size": "222",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#include "omxtypes.h"
#include "armOMX.h"
#include "omxVC.h"
#include "armCOMM.h"
#include "armVC.h"
/**
* Function: omxVCM4P10_InterpolateHalfHor_Luma (6.3.5.5.1)
*
* Description:
* This function performs interpolation for two horizontal 1/2-pel positions
* (-1/2,0) and (1/2, 0) - around a full-pel position.
*
* Input Arguments:
*
* pSrc - Pointer to the top-left corner of the block used to interpolate in
* the reconstruction frame plane.
* iSrcStep - Step of the source buffer.
* iDstStep - Step of the destination(interpolation) buffer; must be a
* multiple of iWidth.
* iWidth - Width of the current block; must be equal to either 4, 8, or 16
* iHeight - Height of the current block; must be equal to 4, 8, or 16
*
* Output Arguments:
*
* pDstLeft -Pointer to the interpolation buffer of the left -pel position
* (-1/2, 0)
* If iWidth==4, 4-byte alignment required.
* If iWidth==8, 8-byte alignment required.
* If iWidth==16, 16-byte alignment required.
* pDstRight -Pointer to the interpolation buffer of the right -pel
* position (1/2, 0)
* If iWidth==4, 4-byte alignment required.
* If iWidth==8, 8-byte alignment required.
* If iWidth==16, 16-byte alignment required.
*
* Return Value:
*
* OMX_Sts_NoErr - no error
* OMX_Sts_BadArgErr - bad arguments; returned if any of the following
* conditions are true:
* - at least one of the following pointers is NULL:
* pSrc, pDstLeft, or pDstRight
* - iWidth or iHeight have values other than 4, 8, or 16
* - iWidth==4 but pDstLeft and/or pDstRight is/are not aligned on a 4-byte boundary
* - iWidth==8 but pDstLeft and/or pDstRight is/are not aligned on a 8-byte boundary
* - iWidth==16 but pDstLeft and/or pDstRight is/are not aligned on a 16-byte boundary
* - any alignment restrictions are violated
*
*/
OMXResult omxVCM4P10_InterpolateHalfHor_Luma(
const OMX_U8* pSrc,
OMX_U32 iSrcStep,
OMX_U8* pDstLeft,
OMX_U8* pDstRight,
OMX_U32 iDstStep,
OMX_U32 iWidth,
OMX_U32 iHeight
)
{
OMXResult RetValue;
/* check for argument error */
armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr)
armRetArgErrIf(pDstLeft == NULL, OMX_Sts_BadArgErr)
armRetArgErrIf(pDstRight == NULL, OMX_Sts_BadArgErr)
armRetArgErrIf((iWidth == 4) &&
armNot4ByteAligned(pDstLeft) &&
armNot4ByteAligned(pDstRight), OMX_Sts_BadArgErr)
armRetArgErrIf((iWidth == 8) &&
armNot8ByteAligned(pDstLeft) &&
armNot8ByteAligned(pDstRight), OMX_Sts_BadArgErr)
armRetArgErrIf((iWidth == 16) &&
armNot16ByteAligned(pDstLeft) &&
armNot16ByteAligned(pDstRight), OMX_Sts_BadArgErr)
armRetArgErrIf((iHeight != 16) && (iHeight != 8)&& (iHeight != 4), OMX_Sts_BadArgErr)
armRetArgErrIf((iWidth != 16) && (iWidth != 8)&& (iWidth != 4), OMX_Sts_BadArgErr)
RetValue = armVCM4P10_InterpolateHalfHor_Luma (
pSrc - 1,
iSrcStep,
pDstLeft,
iDstStep,
iWidth,
iHeight);
if (RetValue != OMX_Sts_NoErr)
{
return RetValue;
}
RetValue = armVCM4P10_InterpolateHalfHor_Luma (
pSrc,
iSrcStep,
pDstRight,
iDstStep,
iWidth,
iHeight);
return RetValue;
}
/*****************************************************************************
* END OF FILE
*****************************************************************************/
| {
"content_hash": "f75b7c5a80d8bf33e315380e4ef0ab8a",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 93,
"avg_line_length": 34.86486486486486,
"alnum_prop": 0.5604651162790698,
"repo_name": "AndroidOpenSourceProject/platform_frameworks_av",
"id": "ef0befac2d71676b4f095cb1bc1512ee51f066c0",
"size": "4177",
"binary": false,
"copies": "3",
"ref": "refs/heads/kk-dev",
"path": "media/libstagefright/codecs/on2/h264dec/omxdl/reference/vc/m4p10/src/omxVCM4P10_InterpolateHalfHor_Luma.c",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#include "taichi/codegen/cpu/codegen_cpu.h"
#include "taichi/runtime/program_impls/llvm/llvm_program.h"
#include "taichi/common/core.h"
#include "taichi/util/io.h"
#include "taichi/util/lang_util.h"
#include "taichi/program/program.h"
#include "taichi/ir/ir.h"
#include "taichi/ir/statements.h"
#include "taichi/util/statistics.h"
#include "taichi/ir/transforms.h"
#include "taichi/ir/analysis.h"
#include "taichi/analysis/offline_cache_util.h"
namespace taichi::lang {
namespace {
class TaskCodeGenCPU : public TaskCodeGenLLVM {
public:
using IRVisitor::visit;
TaskCodeGenCPU(Kernel *kernel, IRNode *ir)
: TaskCodeGenLLVM(kernel, ir, nullptr) {
TI_AUTO_PROF
}
void create_offload_range_for(OffloadedStmt *stmt) override {
int step = 1;
// In parallel for-loops reversing the order doesn't make sense.
// However, we may need to support serial offloaded range for's in the
// future, so it still makes sense to reverse the order here.
if (stmt->reversed) {
step = -1;
}
auto *tls_prologue = create_xlogue(stmt->tls_prologue);
// The loop body
llvm::Function *body;
{
auto guard = get_function_creation_guard(
{llvm::PointerType::get(get_runtime_type("RuntimeContext"), 0),
llvm::Type::getInt8PtrTy(*llvm_context),
tlctx->get_data_type<int>()});
auto loop_var = create_entry_block_alloca(PrimitiveType::i32);
loop_vars_llvm[stmt].push_back(loop_var);
builder->CreateStore(get_arg(2), loop_var);
stmt->body->accept(this);
body = guard.body;
}
llvm::Value *epilogue = create_xlogue(stmt->tls_epilogue);
auto [begin, end] = get_range_for_bounds(stmt);
// adaptive block_dim
if (prog->this_thread_config().cpu_block_dim_adaptive) {
int num_items = (stmt->end_value - stmt->begin_value) / std::abs(step);
int num_threads = stmt->num_cpu_threads;
int items_per_thread = std::max(1, num_items / (num_threads * 32));
// keep each task has at least 512 items to amortize scheduler overhead
// also saturate the value to 1024 for better load balancing
stmt->block_dim = std::min(1024, std::max(512, items_per_thread));
}
call("cpu_parallel_range_for", get_arg(0),
tlctx->get_constant(stmt->num_cpu_threads), begin, end,
tlctx->get_constant(step), tlctx->get_constant(stmt->block_dim),
tls_prologue, body, epilogue, tlctx->get_constant(stmt->tls_size));
}
void create_offload_mesh_for(OffloadedStmt *stmt) override {
auto *tls_prologue = create_mesh_xlogue(stmt->tls_prologue);
llvm::Function *body;
{
auto guard = get_function_creation_guard(
{llvm::PointerType::get(get_runtime_type("RuntimeContext"), 0),
llvm::Type::getInt8PtrTy(*llvm_context),
tlctx->get_data_type<int>()});
for (int i = 0; i < stmt->mesh_prologue->size(); i++) {
auto &s = stmt->mesh_prologue->statements[i];
s->accept(this);
}
if (stmt->bls_prologue) {
stmt->bls_prologue->accept(this);
}
auto loop_test_bb =
llvm::BasicBlock::Create(*llvm_context, "loop_test", func);
auto loop_body_bb =
llvm::BasicBlock::Create(*llvm_context, "loop_body", func);
auto func_exit =
llvm::BasicBlock::Create(*llvm_context, "func_exit", func);
auto loop_index =
create_entry_block_alloca(llvm::Type::getInt32Ty(*llvm_context));
builder->CreateStore(tlctx->get_constant(0), loop_index);
builder->CreateBr(loop_test_bb);
{
builder->SetInsertPoint(loop_test_bb);
#ifdef TI_LLVM_15
auto *loop_index_load =
builder->CreateLoad(builder->getInt32Ty(), loop_index);
#else
auto *loop_index_load = builder->CreateLoad(loop_index);
#endif
auto cond = builder->CreateICmp(
llvm::CmpInst::Predicate::ICMP_SLT, loop_index_load,
llvm_val[stmt->owned_num_local.find(stmt->major_from_type)
->second]);
builder->CreateCondBr(cond, loop_body_bb, func_exit);
}
{
builder->SetInsertPoint(loop_body_bb);
loop_vars_llvm[stmt].push_back(loop_index);
for (int i = 0; i < stmt->body->size(); i++) {
auto &s = stmt->body->statements[i];
s->accept(this);
}
#ifdef TI_LLVM_15
auto *loop_index_load =
builder->CreateLoad(builder->getInt32Ty(), loop_index);
#else
auto *loop_index_load = builder->CreateLoad(loop_index);
#endif
builder->CreateStore(
builder->CreateAdd(loop_index_load, tlctx->get_constant(1)),
loop_index);
builder->CreateBr(loop_test_bb);
builder->SetInsertPoint(func_exit);
}
if (stmt->bls_epilogue) {
stmt->bls_epilogue->accept(this);
}
body = guard.body;
}
llvm::Value *epilogue = create_mesh_xlogue(stmt->tls_epilogue);
call("cpu_parallel_mesh_for", get_arg(0),
tlctx->get_constant(stmt->num_cpu_threads),
tlctx->get_constant(stmt->mesh->num_patches),
tlctx->get_constant(stmt->block_dim), tls_prologue, body, epilogue,
tlctx->get_constant(stmt->tls_size));
}
void create_bls_buffer(OffloadedStmt *stmt) {
auto type = llvm::ArrayType::get(llvm::Type::getInt8Ty(*llvm_context),
stmt->bls_size);
bls_buffer = new llvm::GlobalVariable(
*module, type, false, llvm::GlobalValue::ExternalLinkage, nullptr,
"bls_buffer", nullptr, llvm::GlobalVariable::LocalExecTLSModel, 0);
/* module->getOrInsertGlobal("bls_buffer", type);
bls_buffer = module->getNamedGlobal("bls_buffer");
bls_buffer->setAlignment(llvm::MaybeAlign(8));*/ // TODO(changyu): Fix JIT session error: Symbols not found: [ __emutls_get_address ] in python 3.10
// initialize the variable with an undef value to ensure it is added to the
// symbol table
bls_buffer->setInitializer(llvm::UndefValue::get(type));
}
void visit(OffloadedStmt *stmt) override {
stat.add("codegen_offloaded_tasks");
TI_ASSERT(current_offload == nullptr);
current_offload = stmt;
if (stmt->bls_size > 0)
create_bls_buffer(stmt);
using Type = OffloadedStmt::TaskType;
auto offloaded_task_name = init_offloaded_task_function(stmt);
if (prog->this_thread_config().kernel_profiler &&
arch_is_cpu(prog->this_thread_config().arch)) {
call("LLVMRuntime_profiler_start", get_runtime(),
builder->CreateGlobalStringPtr(offloaded_task_name));
}
if (stmt->task_type == Type::serial) {
stmt->body->accept(this);
} else if (stmt->task_type == Type::range_for) {
create_offload_range_for(stmt);
} else if (stmt->task_type == Type::mesh_for) {
create_offload_mesh_for(stmt);
} else if (stmt->task_type == Type::struct_for) {
stmt->block_dim = std::min(stmt->snode->parent->max_num_elements(),
(int64)stmt->block_dim);
create_offload_struct_for(stmt);
} else if (stmt->task_type == Type::listgen) {
emit_list_gen(stmt);
} else if (stmt->task_type == Type::gc) {
emit_gc(stmt);
} else if (stmt->task_type == Type::gc_rc) {
emit_gc_rc();
} else {
TI_NOT_IMPLEMENTED
}
if (prog->this_thread_config().kernel_profiler &&
arch_is_cpu(prog->this_thread_config().arch)) {
llvm::IRBuilderBase::InsertPointGuard guard(*builder);
builder->SetInsertPoint(final_block);
call("LLVMRuntime_profiler_stop", get_runtime());
}
finalize_offloaded_task_function();
offloaded_tasks.push_back(*current_task);
current_task = nullptr;
current_offload = nullptr;
}
void visit(ExternalFuncCallStmt *stmt) override {
if (stmt->type == ExternalFuncCallStmt::BITCODE) {
TaskCodeGenLLVM::visit_call_bitcode(stmt);
} else if (stmt->type == ExternalFuncCallStmt::SHARED_OBJECT) {
TaskCodeGenLLVM::visit_call_shared_object(stmt);
} else {
TI_NOT_IMPLEMENTED
}
}
};
} // namespace
#ifdef TI_WITH_LLVM
// static
std::unique_ptr<TaskCodeGenLLVM> KernelCodeGenCPU::make_codegen_llvm(
Kernel *kernel,
IRNode *ir) {
return std::make_unique<TaskCodeGenCPU>(kernel, ir);
}
FunctionType CPUModuleToFunctionConverter::convert(
const std::string &kernel_name,
const std::vector<LlvmLaunchArgInfo> &args,
LLVMCompiledKernel data) const {
TI_AUTO_PROF;
auto jit_module = tlctx_->create_jit_module(std::move(data.module));
using TaskFunc = int32 (*)(void *);
std::vector<TaskFunc> task_funcs;
task_funcs.reserve(data.tasks.size());
for (auto &task : data.tasks) {
auto *func_ptr = jit_module->lookup_function(task.name);
TI_ASSERT_INFO(func_ptr, "Offloaded datum function {} not found",
task.name);
task_funcs.push_back((TaskFunc)(func_ptr));
}
// Do NOT capture `this`...
return [executor = this->executor_, args, kernel_name,
task_funcs](RuntimeContext &context) {
TI_TRACE("Launching kernel {}", kernel_name);
// For taichi ndarrays, context.args saves pointer to its
// |DeviceAllocation|, CPU backend actually want to use the raw ptr here.
for (int i = 0; i < (int)args.size(); i++) {
if (args[i].is_array &&
context.device_allocation_type[i] !=
RuntimeContext::DevAllocType::kNone &&
context.array_runtime_sizes[i] > 0) {
DeviceAllocation *ptr =
static_cast<DeviceAllocation *>(context.get_arg<void *>(i));
uint64 host_ptr = (uint64)executor->get_ndarray_alloc_info_ptr(*ptr);
context.set_arg(i, host_ptr);
context.set_array_device_allocation_type(
i, RuntimeContext::DevAllocType::kNone);
}
}
for (auto task : task_funcs) {
task(&context);
}
};
}
LLVMCompiledTask KernelCodeGenCPU::compile_task(
std::unique_ptr<llvm::Module> &&module,
OffloadedStmt *stmt) {
TaskCodeGenCPU gen(kernel, stmt);
return gen.run_compilation();
}
#endif // TI_WITH_LLVM
FunctionType KernelCodeGenCPU::compile_to_function() {
TI_AUTO_PROF;
auto *llvm_prog = get_llvm_program(prog);
auto *tlctx = llvm_prog->get_llvm_context(kernel->arch);
CPUModuleToFunctionConverter converter(
tlctx, get_llvm_program(prog)->get_runtime_executor());
return converter.convert(kernel, compile_kernel_to_module());
}
} // namespace taichi::lang
| {
"content_hash": "9f3d97950062f2a36c484677d76db3df",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 152,
"avg_line_length": 35.8259385665529,
"alnum_prop": 0.6331332761741449,
"repo_name": "yuanming-hu/taichi",
"id": "b58b26cd5659babc8099bc025de73678cb464db8",
"size": "10497",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "taichi/codegen/cpu/codegen_cpu.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "66677"
},
{
"name": "C++",
"bytes": "3713898"
},
{
"name": "CMake",
"bytes": "69354"
},
{
"name": "Cuda",
"bytes": "20566"
},
{
"name": "GLSL",
"bytes": "10756"
},
{
"name": "Makefile",
"bytes": "994"
},
{
"name": "PowerShell",
"bytes": "9227"
},
{
"name": "Python",
"bytes": "2209929"
},
{
"name": "Shell",
"bytes": "12216"
}
],
"symlink_target": ""
} |
//===--- SwiftCompletion.cpp ----------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#include "CodeCompletionOrganizer.h"
#include "SwiftASTManager.h"
#include "SwiftLangSupport.h"
#include "SwiftEditorDiagConsumer.h"
#include "SourceKit/Support/Logging.h"
#include "SourceKit/Support/UIdent.h"
#include "swift/AST/ASTPrinter.h"
#include "swift/Frontend/Frontend.h"
#include "swift/Frontend/PrintingDiagnosticConsumer.h"
#include "swift/IDE/CodeCompletionCache.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/MemoryBuffer.h"
using namespace SourceKit;
using namespace swift;
using namespace ide;
using CodeCompletion::SwiftCompletionInfo;
using CodeCompletion::Completion;
using CodeCompletion::CodeCompletionView;
using CodeCompletion::CodeCompletionViewRef;
using CodeCompletion::NameToPopularityMap;
static_assert(swift::ide::CodeCompletionResult::MaxNumBytesToErase == 127,
"custom array implementation for code completion results "
"has this limit hardcoded");
namespace {
struct SwiftToSourceKitCompletionAdapter {
static bool handleResult(SourceKit::CodeCompletionConsumer &consumer,
CodeCompletionResult *result) {
llvm::SmallString<64> name;
{
llvm::raw_svector_ostream OSS(name);
CodeCompletion::CompletionBuilder::getFilterName(
result->getCompletionString(), OSS);
}
llvm::SmallString<64> description;
{
llvm::raw_svector_ostream OSS(description);
// FIXME: The leading punctuation (e.g. "?." in an optional completion)
// should really be part of a structured result description and clients
// can
// decide whether to display it or not. For now just include it in the
// description only in the new code path.
CodeCompletion::CompletionBuilder::getDescription(
result, OSS, /*leadingPunctuation=*/false);
}
Completion extended(*result, name, description);
return handleResult(consumer, &extended, /*leadingPunctuation=*/false,
/*legacyLiteralToKeyword=*/true);
}
static bool handleResult(SourceKit::CodeCompletionConsumer &consumer,
Completion *result, bool leadingPunctuation,
bool legacyLiteralToKeyword);
static void getResultSourceText(const CodeCompletionString *CCStr,
raw_ostream &OS);
static void getResultTypeName(const CodeCompletionString *CCStr,
raw_ostream &OS);
static void getResultAssociatedUSRs(ArrayRef<StringRef> AssocUSRs,
raw_ostream &OS);
};
struct SwiftCodeCompletionConsumer
: public ide::SimpleCachingCodeCompletionConsumer {
using HandlerFunc = std::function<void(
MutableArrayRef<CodeCompletionResult *>, SwiftCompletionInfo &)>;
HandlerFunc handleResultsImpl;
SwiftCompletionInfo swiftContext;
SwiftCodeCompletionConsumer(HandlerFunc handleResultsImpl)
: handleResultsImpl(handleResultsImpl) {}
void setContext(swift::ASTContext *context,
swift::CompilerInvocation *invocation,
swift::ide::CodeCompletionContext *completionContext) {
swiftContext.swiftASTContext = context;
swiftContext.invocation = invocation;
swiftContext.completionContext = completionContext;
}
void clearContext() { swiftContext = SwiftCompletionInfo(); }
void handleResults(MutableArrayRef<CodeCompletionResult *> Results) override {
assert(swiftContext.swiftASTContext);
CodeCompletionContext::sortCompletionResults(Results);
handleResultsImpl(Results, swiftContext);
}
};
} // anonymous namespace
static bool swiftCodeCompleteImpl(SwiftLangSupport &Lang,
llvm::MemoryBuffer *UnresolvedInputFile,
unsigned Offset,
SwiftCodeCompletionConsumer &SwiftConsumer,
ArrayRef<const char *> Args,
std::string &Error) {
// Resolve symlinks for the input file; we resolve them for the input files
// in the arguments as well.
// FIXME: We need the Swift equivalent of Clang's FileEntry.
auto InputFile = llvm::MemoryBuffer::getMemBuffer(
UnresolvedInputFile->getBuffer(),
Lang.resolvePathSymlinks(UnresolvedInputFile->getBufferIdentifier()));
auto origBuffSize = InputFile->getBufferSize();
unsigned CodeCompletionOffset = Offset;
if (CodeCompletionOffset > origBuffSize) {
CodeCompletionOffset = origBuffSize;
}
CompilerInstance CI;
// Display diagnostics to stderr.
PrintingDiagnosticConsumer PrintDiags;
CI.addDiagnosticConsumer(&PrintDiags);
EditorDiagConsumer TraceDiags;
trace::TracedOperation TracedOp(trace::OperationKind::CodeCompletion);
if (TracedOp.enabled()) {
CI.addDiagnosticConsumer(&TraceDiags);
trace::SwiftInvocation SwiftArgs;
trace::initTraceInfo(SwiftArgs, InputFile->getBufferIdentifier(), Args);
TracedOp.setDiagnosticProvider(
[&TraceDiags](SmallVectorImpl<DiagnosticEntryInfo> &diags) {
TraceDiags.getAllDiagnostics(diags);
});
TracedOp.start(SwiftArgs,
{std::make_pair("OriginalOffset", std::to_string(Offset)),
std::make_pair("Offset",
std::to_string(CodeCompletionOffset))});
}
CompilerInvocation Invocation;
bool Failed = Lang.getASTManager().initCompilerInvocation(
Invocation, Args, CI.getDiags(), InputFile->getBufferIdentifier(), Error);
if (Failed) {
return false;
}
if (!Invocation.getFrontendOptions().InputsAndOutputs.hasInputs()) {
Error = "no input filenames specified";
return false;
}
const char *Position = InputFile->getBufferStart() + CodeCompletionOffset;
std::unique_ptr<llvm::WritableMemoryBuffer> NewBuffer =
llvm::WritableMemoryBuffer::getNewUninitMemBuffer(
InputFile->getBufferSize() + 1,
InputFile->getBufferIdentifier());
char *NewBuf = NewBuffer->getBufferStart();
char *NewPos = std::copy(InputFile->getBufferStart(), Position, NewBuf);
*NewPos = '\0';
std::copy(Position, InputFile->getBufferEnd(), NewPos+1);
Invocation.setCodeCompletionPoint(NewBuffer.get(), CodeCompletionOffset);
auto swiftCache = Lang.getCodeCompletionCache(); // Pin the cache.
ide::CodeCompletionContext CompletionContext(swiftCache->getCache());
// Create a factory for code completion callbacks that will feed the
// Consumer.
std::unique_ptr<CodeCompletionCallbacksFactory> CompletionCallbacksFactory(
ide::makeCodeCompletionCallbacksFactory(CompletionContext,
SwiftConsumer));
Invocation.setCodeCompletionFactory(CompletionCallbacksFactory.get());
// FIXME: We need to be passing the buffers from the open documents.
// It is not a huge problem in practice because Xcode auto-saves constantly.
if (CI.setup(Invocation)) {
// FIXME: error?
return true;
}
CloseClangModuleFiles scopedCloseFiles(
*CI.getASTContext().getClangModuleLoader());
SwiftConsumer.setContext(&CI.getASTContext(), &Invocation,
&CompletionContext);
CI.performSema();
SwiftConsumer.clearContext();
return true;
}
void SwiftLangSupport::codeComplete(llvm::MemoryBuffer *UnresolvedInputFile,
unsigned Offset,
SourceKit::CodeCompletionConsumer &SKConsumer,
ArrayRef<const char *> Args) {
SwiftCodeCompletionConsumer SwiftConsumer([&](
MutableArrayRef<CodeCompletionResult *> Results,
SwiftCompletionInfo &info) {
bool hasExpectedType = info.completionContext->HasExpectedTypeRelation;
CodeCompletionContext::sortCompletionResults(Results);
// FIXME: this adhoc filtering should be configurable like it is in the
// codeCompleteOpen path.
for (auto *Result : Results) {
if (Result->getKind() == CodeCompletionResult::Literal) {
switch (Result->getLiteralKind()) {
case CodeCompletionLiteralKind::NilLiteral:
case CodeCompletionLiteralKind::BooleanLiteral:
break;
case CodeCompletionLiteralKind::ImageLiteral:
case CodeCompletionLiteralKind::ColorLiteral:
if (hasExpectedType &&
Result->getExpectedTypeRelation() <
CodeCompletionResult::Convertible)
continue;
break;
default:
continue;
}
}
if (!SwiftToSourceKitCompletionAdapter::handleResult(SKConsumer, Result))
break;
}
});
std::string Error;
if (!swiftCodeCompleteImpl(*this, UnresolvedInputFile, Offset, SwiftConsumer,
Args, Error)) {
SKConsumer.failed(Error);
}
}
static void getResultStructure(
CodeCompletion::SwiftResult *result, bool leadingPunctuation,
CodeCompletionInfo::DescriptionStructure &structure,
std::vector<CodeCompletionInfo::ParameterStructure> ¶meters) {
auto *CCStr = result->getCompletionString();
auto FirstTextChunk = CCStr->getFirstTextChunkIndex(leadingPunctuation);
if (!FirstTextChunk.hasValue())
return;
bool isOperator = result->isOperator();
auto chunks = CCStr->getChunks();
using ChunkKind = CodeCompletionString::Chunk::ChunkKind;
unsigned i = *FirstTextChunk;
unsigned textSize = 0;
// The result name.
for (; i < chunks.size(); ++i) {
auto C = chunks[i];
if (C.is(ChunkKind::TypeAnnotation) ||
C.is(ChunkKind::CallParameterClosureType) ||
C.is(ChunkKind::Whitespace))
continue;
if (C.is(ChunkKind::LeftParen) || C.is(ChunkKind::LeftBracket) ||
C.is(ChunkKind::BraceStmtWithCursor) ||
C.is(ChunkKind::CallParameterBegin))
break;
if (C.is(ChunkKind::Equal))
isOperator = true;
if (C.hasText())
textSize += C.getText().size();
}
structure.baseName.begin = 0;
structure.baseName.end = textSize;
// The parameters.
for (; i < chunks.size(); ++i) {
auto C = chunks[i];
if (C.is(ChunkKind::TypeAnnotation) ||
C.is(ChunkKind::CallParameterClosureType) ||
C.is(ChunkKind::Whitespace))
continue;
if (C.is(ChunkKind::BraceStmtWithCursor))
break;
if (C.is(ChunkKind::ThrowsKeyword) ||
C.is(ChunkKind::RethrowsKeyword)) {
structure.throwsRange.begin = textSize;
structure.throwsRange.end = textSize + C.getText().size();
}
if (C.is(ChunkKind::CallParameterBegin)) {
CodeCompletionInfo::ParameterStructure param;
++i;
bool inName = false;
bool inAfterColon = false;
for (; i < chunks.size(); ++i) {
if (chunks[i].endsPreviousNestedGroup(C.getNestingLevel()))
break;
if (chunks[i].is(ChunkKind::CallParameterClosureType))
continue;
if (isOperator && chunks[i].is(ChunkKind::CallParameterType))
continue;
// Parameter name
if (chunks[i].is(ChunkKind::CallParameterName) ||
chunks[i].is(ChunkKind::CallParameterInternalName)) {
param.name.begin = textSize;
param.isLocalName =
chunks[i].is(ChunkKind::CallParameterInternalName);
inName = true;
}
// Parameter type
if (chunks[i].is(ChunkKind::CallParameterType)) {
unsigned start = textSize;
unsigned prev = i - 1; // if i == 0, prev = ~0u.
// Combine & for inout into the type name.
if (prev != ~0u && chunks[prev].is(ChunkKind::Ampersand)) {
start -= chunks[prev].getText().size();
prev -= 1;
}
// Combine the whitespace after ':' into the type name.
if (prev != ~0u && chunks[prev].is(ChunkKind::CallParameterColon))
start -= 1;
param.afterColon.begin = start;
inAfterColon = true;
if (inName) {
param.name.end = start;
inName = false;
}
}
if (chunks[i].hasText())
textSize += chunks[i].getText().size();
}
// If we had a name with no type following it, finish it now.
if (inName)
param.name.end = textSize;
// Finish the type name.
if (inAfterColon)
param.afterColon.end = textSize;
if (!param.range().empty())
parameters.push_back(std::move(param));
if (i < chunks.size() && chunks[i].hasText())
textSize += chunks[i].getText().size();
}
if (C.hasText())
textSize += C.getText().size();
}
if (!parameters.empty()) {
structure.parameterRange.begin = parameters.front().range().begin;
structure.parameterRange.end = parameters.back().range().end;
}
}
static UIdent KindLiteralArray("source.lang.swift.literal.array");
static UIdent KindLiteralBoolean("source.lang.swift.literal.boolean");
static UIdent KindLiteralColor("source.lang.swift.literal.color");
static UIdent KindLiteralImage("source.lang.swift.literal.image");
static UIdent KindLiteralDictionary("source.lang.swift.literal.dictionary");
static UIdent KindLiteralInteger("source.lang.swift.literal.integer");
static UIdent KindLiteralNil("source.lang.swift.literal.nil");
static UIdent KindLiteralString("source.lang.swift.literal.string");
static UIdent KindLiteralTuple("source.lang.swift.literal.tuple");
static UIdent
getUIDForCodeCompletionLiteralKind(CodeCompletionLiteralKind kind) {
switch (kind) {
case CodeCompletionLiteralKind::ArrayLiteral:
return KindLiteralArray;
case CodeCompletionLiteralKind::BooleanLiteral:
return KindLiteralBoolean;
case CodeCompletionLiteralKind::ColorLiteral:
return KindLiteralColor;
case CodeCompletionLiteralKind::ImageLiteral:
return KindLiteralImage;
case CodeCompletionLiteralKind::DictionaryLiteral:
return KindLiteralDictionary;
case CodeCompletionLiteralKind::IntegerLiteral:
return KindLiteralInteger;
case CodeCompletionLiteralKind::NilLiteral:
return KindLiteralNil;
case CodeCompletionLiteralKind::StringLiteral:
return KindLiteralString;
case CodeCompletionLiteralKind::Tuple:
return KindLiteralTuple;
}
}
static UIdent KeywordUID("source.lang.swift.keyword");
static UIdent KeywordLetUID("source.lang.swift.keyword.let");
static UIdent KeywordVarUID("source.lang.swift.keyword.var");
static UIdent KeywordIfUID("source.lang.swift.keyword.if");
static UIdent KeywordForUID("source.lang.swift.keyword.for");
static UIdent KeywordWhileUID("source.lang.swift.keyword.while");
static UIdent KeywordFuncUID("source.lang.swift.keyword.func");
bool SwiftToSourceKitCompletionAdapter::handleResult(
SourceKit::CodeCompletionConsumer &Consumer, Completion *Result,
bool leadingPunctuation, bool legacyLiteralToKeyword) {
static UIdent KeywordUID("source.lang.swift.keyword");
static UIdent PatternUID("source.lang.swift.pattern");
CodeCompletionInfo Info;
if (Result->hasCustomKind()) {
Info.CustomKind = Result->getCustomKind();
} else if (Result->getKind() == CodeCompletionResult::Keyword) {
Info.Kind = KeywordUID;
} else if (Result->getKind() == CodeCompletionResult::Pattern) {
Info.Kind = PatternUID;
} else if (Result->getKind() == CodeCompletionResult::BuiltinOperator) {
Info.Kind = PatternUID; // FIXME: add a UID for operators
} else if (Result->getKind() == CodeCompletionResult::Declaration) {
Info.Kind = SwiftLangSupport::getUIDForCodeCompletionDeclKind(
Result->getAssociatedDeclKind());
} else if (Result->getKind() == CodeCompletionResult::Literal) {
auto literalKind = Result->getLiteralKind();
if (legacyLiteralToKeyword &&
(literalKind == CodeCompletionLiteralKind::BooleanLiteral ||
literalKind == CodeCompletionLiteralKind::NilLiteral)) {
// Fallback to keywords as appropriate.
Info.Kind = KeywordUID;
} else {
Info.Kind = getUIDForCodeCompletionLiteralKind(literalKind);
}
}
if (Info.Kind.isInvalid() && !Info.CustomKind)
return true;
llvm::SmallString<512> SS;
unsigned DescBegin = SS.size();
{
llvm::raw_svector_ostream ccOS(SS);
CodeCompletion::CompletionBuilder::getDescription(
Result, ccOS, leadingPunctuation);
}
unsigned DescEnd = SS.size();
if (DescBegin == DescEnd) {
LOG_FUNC_SECTION_WARN {
llvm::SmallString<64> LogMessage;
llvm::raw_svector_ostream LogMessageOs(LogMessage);
LogMessageOs << "Code completion result with empty description "
"was ignored: \n";
Result->print(LogMessageOs);
*Log << LogMessage;
}
return true;
}
unsigned TextBegin = SS.size();
{
llvm::raw_svector_ostream ccOS(SS);
getResultSourceText(Result->getCompletionString(), ccOS);
}
unsigned TextEnd = SS.size();
unsigned TypeBegin = SS.size();
{
llvm::raw_svector_ostream ccOS(SS);
getResultTypeName(Result->getCompletionString(), ccOS);
}
unsigned TypeEnd = SS.size();
unsigned USRsBegin = SS.size();
{
llvm::raw_svector_ostream ccOS(SS);
getResultAssociatedUSRs(Result->getAssociatedUSRs(), ccOS);
}
unsigned USRsEnd = SS.size();
Info.Name = Result->getName();
Info.Description = StringRef(SS.begin() + DescBegin, DescEnd - DescBegin);
Info.SourceText = StringRef(SS.begin() + TextBegin, TextEnd - TextBegin);
Info.TypeName = StringRef(SS.begin() + TypeBegin, TypeEnd - TypeBegin);
Info.AssocUSRs = StringRef(SS.begin() + USRsBegin, USRsEnd - USRsBegin);
static UIdent CCCtxNone("source.codecompletion.context.none");
static UIdent CCCtxExpressionSpecific(
"source.codecompletion.context.exprspecific");
static UIdent CCCtxLocal("source.codecompletion.context.local");
static UIdent CCCtxCurrentNominal("source.codecompletion.context.thisclass");
static UIdent CCCtxSuper("source.codecompletion.context.superclass");
static UIdent CCCtxOutsideNominal("source.codecompletion.context.otherclass");
static UIdent CCCtxCurrentModule("source.codecompletion.context.thismodule");
static UIdent CCCtxOtherModule("source.codecompletion.context.othermodule");
switch (Result->getSemanticContext()) {
case SemanticContextKind::None:
Info.SemanticContext = CCCtxNone; break;
case SemanticContextKind::ExpressionSpecific:
Info.SemanticContext = CCCtxExpressionSpecific; break;
case SemanticContextKind::Local:
Info.SemanticContext = CCCtxLocal; break;
case SemanticContextKind::CurrentNominal:
Info.SemanticContext = CCCtxCurrentNominal; break;
case SemanticContextKind::Super:
Info.SemanticContext = CCCtxSuper; break;
case SemanticContextKind::OutsideNominal:
Info.SemanticContext = CCCtxOutsideNominal; break;
case SemanticContextKind::CurrentModule:
Info.SemanticContext = CCCtxCurrentModule; break;
case SemanticContextKind::OtherModule:
Info.SemanticContext = CCCtxOtherModule; break;
}
Info.ModuleName = Result->getModuleName();
Info.DocBrief = Result->getBriefDocComment();
Info.NotRecommended = Result->isNotRecommended();
Info.NumBytesToErase = Result->getNumBytesToErase();
// Extended result values.
Info.ModuleImportDepth = Result->getModuleImportDepth();
// Description structure.
std::vector<CodeCompletionInfo::ParameterStructure> parameters;
CodeCompletionInfo::DescriptionStructure structure;
getResultStructure(Result, leadingPunctuation, structure, parameters);
Info.descriptionStructure = structure;
if (!parameters.empty())
Info.parametersStructure = parameters;
return Consumer.handleResult(Info);
}
static CodeCompletionLiteralKind
getCodeCompletionLiteralKindForUID(UIdent uid) {
if (uid == KindLiteralArray) {
return CodeCompletionLiteralKind::ArrayLiteral;
} else if (uid == KindLiteralBoolean) {
return CodeCompletionLiteralKind::BooleanLiteral;
} else if (uid == KindLiteralColor) {
return CodeCompletionLiteralKind::ColorLiteral;
} else if (uid == KindLiteralImage) {
return CodeCompletionLiteralKind::ImageLiteral;
} else if (uid == KindLiteralDictionary) {
return CodeCompletionLiteralKind::DictionaryLiteral;
} else if (uid == KindLiteralInteger) {
return CodeCompletionLiteralKind::IntegerLiteral;
} else if (uid == KindLiteralNil) {
return CodeCompletionLiteralKind::NilLiteral;
} else if (uid == KindLiteralString) {
return CodeCompletionLiteralKind::StringLiteral;
} else if (uid == KindLiteralTuple) {
return CodeCompletionLiteralKind::Tuple;
} else {
llvm_unreachable("unexpected literal kind");
}
}
static CodeCompletionKeywordKind
getCodeCompletionKeywordKindForUID(UIdent uid) {
#define SWIFT_KEYWORD(kw) \
static UIdent Keyword##kw##UID("source.lang.swift.keyword." #kw); \
if (uid == Keyword##kw##UID) { \
return CodeCompletionKeywordKind::kw_##kw; \
}
#include "swift/Syntax/TokenKinds.def"
// FIXME: should warn about unexpected keyword kind.
return CodeCompletionKeywordKind::None;
}
using ChunkKind = CodeCompletionString::Chunk::ChunkKind;
/// Provide the text for the call parameter, including constructing a typed
/// editor placeholder for it.
static void constructTextForCallParam(
ArrayRef<CodeCompletionString::Chunk> ParamGroup, raw_ostream &OS) {
assert(ParamGroup.front().is(ChunkKind::CallParameterBegin));
for (; !ParamGroup.empty(); ParamGroup = ParamGroup.slice(1)) {
auto &C = ParamGroup.front();
if (C.is(ChunkKind::CallParameterInternalName) ||
C.is(ChunkKind::CallParameterType)) {
break;
}
if (!C.isAnnotation() && C.hasText()) {
OS << C.getText();
}
}
SmallString<32> DisplayString;
SmallString<32> TypeString;
SmallString<32> ExpansionTypeString;
for (auto &C : ParamGroup) {
if (C.isAnnotation() || !C.hasText())
continue;
if (C.is(ChunkKind::CallParameterClosureType)) {
assert(ExpansionTypeString.empty());
ExpansionTypeString = C.getText();
continue;
}
if (C.is(ChunkKind::CallParameterType)) {
assert(TypeString.empty());
TypeString = C.getText();
}
DisplayString += C.getText();
}
StringRef Display = DisplayString.str();
StringRef Type = TypeString.str();
StringRef ExpansionType = ExpansionTypeString.str();
if (ExpansionType.empty())
ExpansionType = Type;
OS << "<#T##" << Display;
if (Display == Type && Display == ExpansionType) {
// Short version, display and type are the same.
} else {
OS << "##" << Type;
if (ExpansionType != Type)
OS << "##" << ExpansionType;
}
OS << "#>";
}
void SwiftToSourceKitCompletionAdapter::getResultSourceText(
const CodeCompletionString *CCStr, raw_ostream &OS) {
auto Chunks = CCStr->getChunks();
for (size_t i = 0; i < Chunks.size(); ++i) {
auto &C = Chunks[i];
if (C.is(ChunkKind::BraceStmtWithCursor)) {
OS << " {\n" << getCodePlaceholder() << "\n}";
continue;
}
if (C.is(ChunkKind::CallParameterBegin)) {
size_t Start = i++;
for (; i < Chunks.size(); ++i) {
if (Chunks[i].endsPreviousNestedGroup(C.getNestingLevel()))
break;
}
constructTextForCallParam(Chunks.slice(Start, i-Start), OS);
--i;
continue;
}
if (!C.isAnnotation() && C.hasText()) {
OS << C.getText();
}
}
}
void SwiftToSourceKitCompletionAdapter::getResultTypeName(
const CodeCompletionString *CCStr, raw_ostream &OS) {
for (auto C : CCStr->getChunks()) {
if (C.getKind() == CodeCompletionString::Chunk::ChunkKind::TypeAnnotation) {
OS << C.getText();
}
}
}
void SwiftToSourceKitCompletionAdapter::getResultAssociatedUSRs(
ArrayRef<StringRef> AssocUSRs, raw_ostream &OS) {
bool First = true;
for (auto USR : AssocUSRs) {
if (!First)
OS << " ";
First = false;
OS << USR;
}
}
//===----------------------------------------------------------------------===//
// CodeCompletion::SessionCache
//===----------------------------------------------------------------------===//
void CodeCompletion::SessionCache::setSortedCompletions(
std::vector<Completion *> &&completions) {
llvm::sys::ScopedLock L(mtx);
sortedCompletions = std::move(completions);
}
ArrayRef<Completion *> CodeCompletion::SessionCache::getSortedCompletions() {
llvm::sys::ScopedLock L(mtx);
return sortedCompletions;
}
llvm::MemoryBuffer *CodeCompletion::SessionCache::getBuffer() {
llvm::sys::ScopedLock L(mtx);
return buffer.get();
}
ArrayRef<std::string> CodeCompletion::SessionCache::getCompilerArgs() {
llvm::sys::ScopedLock L(mtx);
return args;
}
CompletionKind CodeCompletion::SessionCache::getCompletionKind() {
llvm::sys::ScopedLock L(mtx);
return completionKind;
}
bool CodeCompletion::SessionCache::getCompletionHasExpectedTypes() {
llvm::sys::ScopedLock L(mtx);
return completionHasExpectedTypes;
}
bool CodeCompletion::SessionCache::getCompletionMayUseImplicitMemberExpr() {
llvm::sys::ScopedLock L(mtx);
return completionMayUseImplicitMemberExpr;
}
const CodeCompletion::FilterRules &
CodeCompletion::SessionCache::getFilterRules() {
llvm::sys::ScopedLock L(mtx);
return filterRules;
}
//===----------------------------------------------------------------------===//
// CodeCompletion::SessionCacheMap
//===----------------------------------------------------------------------===//
unsigned CodeCompletion::SessionCacheMap::getBufferID(StringRef name) const {
auto pair = nameToBufferMap.insert(std::make_pair(name, nextBufferID));
if (pair.second)
++nextBufferID;
return pair.first->getValue();
}
CodeCompletion::SessionCacheRef
CodeCompletion::SessionCacheMap::get(StringRef name, unsigned offset) const {
llvm::sys::ScopedLock L(mtx);
auto key = std::make_pair(getBufferID(name), offset);
auto I = sessions.find(key);
if (I == sessions.end())
return nullptr;
return I->second;
}
bool CodeCompletion::SessionCacheMap::set(StringRef name, unsigned offset,
CodeCompletion::SessionCacheRef s) {
llvm::sys::ScopedLock L(mtx);
auto key = std::make_pair(getBufferID(name), offset);
return sessions.insert(std::make_pair(key, s)).second;
}
bool CodeCompletion::SessionCacheMap::remove(StringRef name, unsigned offset) {
llvm::sys::ScopedLock L(mtx);
auto key = std::make_pair(getBufferID(name), offset);
return sessions.erase(key);
}
//===----------------------------------------------------------------------===//
// (New) Code completion interface
//===----------------------------------------------------------------------===//
namespace {
class SwiftGroupedCodeCompletionConsumer : public CodeCompletionView::Walker {
GroupedCodeCompletionConsumer &consumer;
public:
SwiftGroupedCodeCompletionConsumer(GroupedCodeCompletionConsumer &consumer)
: consumer(consumer) {}
bool handleResult(Completion *result) override {
return SwiftToSourceKitCompletionAdapter::handleResult(
consumer, result, /*leadingPunctuation=*/true,
/*legacyLiteralToKeyword=*/false);
}
void startGroup(StringRef name) override {
static UIdent GroupUID("source.lang.swift.codecomplete.group");
consumer.startGroup(GroupUID, name);
}
void endGroup() override { consumer.endGroup(); }
};
} // end anonymous namespace
static void translateCodeCompletionOptions(OptionsDictionary &from,
CodeCompletion::Options &to,
StringRef &filterText,
unsigned &resultOffset,
unsigned &maxResults) {
static UIdent KeySortByName("key.codecomplete.sort.byname");
static UIdent KeyUseImportDepth("key.codecomplete.sort.useimportdepth");
static UIdent KeyGroupOverloads("key.codecomplete.group.overloads");
static UIdent KeyGroupStems("key.codecomplete.group.stems");
static UIdent KeyFilterText("key.codecomplete.filtertext");
static UIdent KeyRequestLimit("key.codecomplete.requestlimit");
static UIdent KeyRequestStart("key.codecomplete.requeststart");
static UIdent KeyHideUnderscores("key.codecomplete.hideunderscores");
static UIdent KeyHideLowPriority("key.codecomplete.hidelowpriority");
static UIdent KeyHideByName("key.codecomplete.hidebyname");
static UIdent KeyIncludeExactMatch("key.codecomplete.includeexactmatch");
static UIdent KeyAddInnerResults("key.codecomplete.addinnerresults");
static UIdent KeyAddInnerOperators("key.codecomplete.addinneroperators");
static UIdent KeyAddInitsToTopLevel("key.codecomplete.addinitstotoplevel");
static UIdent KeyCallPatternHeuristics("key.codecomplete.callpatternheuristics");
static UIdent KeyFuzzyMatching("key.codecomplete.fuzzymatching");
static UIdent KeyTopNonLiteral("key.codecomplete.showtopnonliteralresults");
static UIdent KeyContextWeight("key.codecomplete.sort.contextweight");
static UIdent KeyFuzzyWeight("key.codecomplete.sort.fuzzyweight");
static UIdent KeyPopularityBonus("key.codecomplete.sort.popularitybonus");
from.valueForOption(KeySortByName, to.sortByName);
from.valueForOption(KeyUseImportDepth, to.useImportDepth);
from.valueForOption(KeyGroupOverloads, to.groupOverloads);
from.valueForOption(KeyGroupStems, to.groupStems);
from.valueForOption(KeyFilterText, filterText);
from.valueForOption(KeyRequestLimit, maxResults);
from.valueForOption(KeyRequestStart, resultOffset);
unsigned howMuchHiding = 1;
from.valueForOption(KeyHideUnderscores, howMuchHiding);
to.hideUnderscores = howMuchHiding;
to.reallyHideAllUnderscores = howMuchHiding > 1;
from.valueForOption(KeyHideLowPriority, to.hideLowPriority);
from.valueForOption(KeyIncludeExactMatch, to.includeExactMatch);
from.valueForOption(KeyAddInnerResults, to.addInnerResults);
from.valueForOption(KeyAddInnerOperators, to.addInnerOperators);
from.valueForOption(KeyAddInitsToTopLevel, to.addInitsToTopLevel);
from.valueForOption(KeyCallPatternHeuristics, to.callPatternHeuristics);
from.valueForOption(KeyFuzzyMatching, to.fuzzyMatching);
from.valueForOption(KeyContextWeight, to.semanticContextWeight);
from.valueForOption(KeyFuzzyWeight, to.fuzzyMatchWeight);
from.valueForOption(KeyPopularityBonus, to.popularityBonus);
from.valueForOption(KeyHideByName, to.hideByNameStyle);
from.valueForOption(KeyTopNonLiteral, to.showTopNonLiteralResults);
}
/// Canonicalize a name that is in the format of a reference to a function into
/// the name format used internally for filtering.
///
/// Returns true if the name is invalid.
static bool canonicalizeFilterName(const char *origName,
SmallVectorImpl<char> &Result) {
assert(origName);
const char *p = origName;
char curr = '\0';
char prev;
// FIXME: disallow unnamed parameters without underscores `foo(::)`.
while (true) {
prev = curr;
curr = *p++;
switch (curr) {
case '\0':
return false; // Done.
case '_':
// Remove the _ underscore for an unnamed parameter.
if (prev == ':' || prev == '(') {
char next = *p;
if (next == ':' || next == ')')
continue;
}
LLVM_FALLTHROUGH;
default:
Result.push_back(curr);
continue;
}
}
}
static void translateFilterRules(ArrayRef<FilterRule> rawFilterRules,
CodeCompletion::FilterRules &filterRules) {
for (auto &rule : rawFilterRules) {
switch (rule.kind) {
case FilterRule::Everything:
filterRules.hideAll = rule.hide;
break;
case FilterRule::Identifier:
for (auto name : rule.names) {
SmallString<128> canonName;
// Note: name is null-terminated.
if (canonicalizeFilterName(name.data(), canonName))
continue;
filterRules.hideByFilterName[canonName] = rule.hide;
}
break;
case FilterRule::Description:
for (auto name : rule.names) {
filterRules.hideByDescription[name] = rule.hide;
}
break;
case FilterRule::Module:
for (auto name : rule.names) {
filterRules.hideModule[name] = rule.hide;
}
break;
case FilterRule::Keyword:
if (rule.uids.empty())
filterRules.hideAllKeywords = rule.hide;
for (auto uid : rule.uids) {
auto kind = getCodeCompletionKeywordKindForUID(uid);
filterRules.hideKeyword[kind] = rule.hide;
}
break;
case FilterRule::Literal:
if (rule.uids.empty())
filterRules.hideAllValueLiterals = rule.hide;
for (auto uid : rule.uids) {
auto kind = getCodeCompletionLiteralKindForUID(uid);
filterRules.hideValueLiteral[kind] = rule.hide;
}
break;
case FilterRule::CustomCompletion:
if (rule.uids.empty())
filterRules.hideCustomCompletions = rule.hide;
// FIXME: hide individual custom completions
break;
}
}
}
static bool checkInnerResult(CodeCompletionResult *result, bool &hasDot,
bool &hasQDot, bool &hasInit) {
auto chunks = result->getCompletionString()->getChunks();
if (!chunks.empty() &&
chunks[0].is(CodeCompletionString::Chunk::ChunkKind::Dot)) {
hasDot = true;
return true;
} else if (chunks.size() >= 2 &&
chunks[0].is(
CodeCompletionString::Chunk::ChunkKind::QuestionMark) &&
chunks[1].is(CodeCompletionString::Chunk::ChunkKind::Dot)) {
hasQDot = true;
return true;
} else if (result->getKind() ==
CodeCompletion::SwiftResult::ResultKind::Declaration &&
result->getAssociatedDeclKind() ==
CodeCompletionDeclKind::Constructor) {
hasInit = true;
return true;
} else {
return false;
}
}
template <typename Result>
static std::vector<Result *>
filterInnerResults(ArrayRef<Result *> results, bool includeInner,
bool includeInnerOperators,
bool &hasDot, bool &hasQDot, bool &hasInit,
const CodeCompletion::FilterRules &rules) {
std::vector<Result *> topResults;
for (auto *result : results) {
if (!includeInnerOperators && result->isOperator())
continue;
llvm::SmallString<64> filterName;
{
llvm::raw_svector_ostream OSS(filterName);
CodeCompletion::CompletionBuilder::getFilterName(
result->getCompletionString(), OSS);
}
llvm::SmallString<64> description;
{
llvm::raw_svector_ostream OSS(description);
CodeCompletion::CompletionBuilder::getDescription(
result, OSS, /*leadingPunctuation=*/false);
}
if (rules.hideCompletion(result, filterName, description))
continue;
bool inner = checkInnerResult(result, hasDot, hasQDot, hasInit);
if (!inner ||
(includeInner &&
result->getSemanticContext() <= SemanticContextKind::CurrentNominal))
topResults.push_back(result);
}
return topResults;
}
static void transformAndForwardResults(
GroupedCodeCompletionConsumer &consumer, SwiftLangSupport &lang,
CodeCompletion::SessionCacheRef session,
const NameToPopularityMap *nameToPopularity,
CodeCompletion::Options options, unsigned offset, StringRef filterText,
unsigned resultOffset, unsigned maxResults) {
CodeCompletion::CompletionSink innerSink;
Completion *exactMatch = nullptr;
auto buildInnerResult = [&](ArrayRef<CodeCompletionString::Chunk> chunks) {
auto *completionString =
CodeCompletionString::create(innerSink.allocator, chunks);
CodeCompletion::SwiftResult paren(
CodeCompletion::SwiftResult::ResultKind::BuiltinOperator,
SemanticContextKind::ExpressionSpecific,
exactMatch ? exactMatch->getNumBytesToErase() : 0, completionString);
SwiftCompletionInfo info;
std::vector<Completion *> extended =
extendCompletions(&paren, innerSink, info, nameToPopularity, options,
exactMatch, SemanticContextKind::ExpressionSpecific);
assert(extended.size() == 1);
return extended.front();
};
auto buildParen = [&]() {
return buildInnerResult(CodeCompletionString::Chunk::createWithText(
CodeCompletionString::Chunk::ChunkKind::LeftParen, 0, "("));
};
auto buildDot = [&]() {
return buildInnerResult(CodeCompletionString::Chunk::createWithText(
CodeCompletionString::Chunk::ChunkKind::Dot, 0, "."));
};
auto buildQDot = [&]() {
CodeCompletionString::Chunk chunks[2] = {
CodeCompletionString::Chunk::createWithText(
CodeCompletionString::Chunk::ChunkKind::QuestionMark, 0, "?"),
CodeCompletionString::Chunk::createWithText(
CodeCompletionString::Chunk::ChunkKind::Dot, 0, ".")};
return buildInnerResult(chunks);
};
CodeCompletion::CodeCompletionOrganizer organizer(
options, session->getCompletionKind(),
session->getCompletionHasExpectedTypes());
auto &rules = session->getFilterRules();
bool hasEarlyInnerResults =
session->getCompletionKind() == CompletionKind::PostfixExpr;
if (!hasEarlyInnerResults) {
organizer.addCompletionsWithFilter(session->getSortedCompletions(),
filterText, rules, exactMatch);
// Add leading dot?
if (options.addInnerOperators && !rules.hideFilterName(".") &&
session->getCompletionMayUseImplicitMemberExpr()) {
organizer.addCompletionsWithFilter(
buildDot(), filterText, CodeCompletion::FilterRules(), exactMatch);
}
}
if (hasEarlyInnerResults &&
(options.addInnerResults || options.addInnerOperators)) {
bool hasInit = false;
bool hasDot = false;
bool hasQDot = false;
auto completions = session->getSortedCompletions();
auto innerResults =
filterInnerResults(completions, options.addInnerResults,
options.addInnerOperators, hasDot, hasQDot, hasInit,
rules);
if (options.addInnerOperators) {
if (hasInit && !rules.hideFilterName("("))
innerResults.insert(innerResults.begin(), buildParen());
if (hasDot && !rules.hideFilterName("."))
innerResults.insert(innerResults.begin(), buildDot());
if (hasQDot && !rules.hideFilterName("?."))
innerResults.insert(innerResults.begin(), buildQDot());
}
organizer.addCompletionsWithFilter(innerResults, filterText,
CodeCompletion::FilterRules(), exactMatch);
}
organizer.groupAndSort(options);
if ((options.addInnerResults || options.addInnerOperators) &&
exactMatch && exactMatch->getKind() == Completion::Declaration) {
std::vector<Completion *> innerResults;
bool hasDot = false;
bool hasQDot = false;
bool hasInit = false;
SwiftCodeCompletionConsumer swiftConsumer([&](
MutableArrayRef<CodeCompletionResult *> results,
SwiftCompletionInfo &info) {
auto *context = info.completionContext;
if (!context || context->CodeCompletionKind != CompletionKind::PostfixExpr)
return;
auto topResults = filterInnerResults(results, options.addInnerResults,
options.addInnerOperators, hasDot,
hasQDot, hasInit, rules);
// FIXME: Overriding the default to context "None" is a hack so that they
// won't overwhelm other results that also match the filter text.
innerResults = extendCompletions(
topResults, innerSink, info, nameToPopularity, options, exactMatch,
SemanticContextKind::None, SemanticContextKind::None);
});
auto *inputBuf = session->getBuffer();
std::string str = inputBuf->getBuffer().slice(0, offset);
{
llvm::raw_string_ostream OSS(str);
SwiftToSourceKitCompletionAdapter::getResultSourceText(
exactMatch->getCompletionString(), OSS);
}
auto buffer =
llvm::MemoryBuffer::getMemBuffer(str, inputBuf->getBufferIdentifier());
auto args = session->getCompilerArgs();
std::vector<const char *> cargs;
for (auto &arg : args)
cargs.push_back(arg.c_str());
std::string error;
if (!swiftCodeCompleteImpl(lang, buffer.get(), str.size(), swiftConsumer,
cargs, error)) {
consumer.failed(error);
return;
}
if (options.addInnerOperators) {
if (hasInit && !rules.hideFilterName("("))
innerResults.insert(innerResults.begin(), buildParen());
if (hasDot && !rules.hideFilterName("."))
innerResults.insert(innerResults.begin(), buildDot());
if (hasQDot && !rules.hideFilterName("?."))
innerResults.insert(innerResults.begin(), buildQDot());
}
// Add the inner results (and don't filter them).
exactMatch = nullptr; // No longer needed.
organizer.addCompletionsWithFilter(innerResults, filterText,
CodeCompletion::FilterRules(), exactMatch);
CodeCompletion::Options noGroupOpts = options;
noGroupOpts.groupStems = false;
noGroupOpts.groupOverloads = false;
organizer.groupAndSort(noGroupOpts);
}
// Build the final results view.
auto view = organizer.takeResultsView();
CodeCompletion::LimitedResultView limitedResults(*view, resultOffset,
maxResults);
// Forward results to the SourceKit consumer.
SwiftGroupedCodeCompletionConsumer groupedConsumer(consumer);
limitedResults.walk(groupedConsumer);
consumer.setNextRequestStart(limitedResults.getNextOffset());
}
void SwiftLangSupport::codeCompleteOpen(
StringRef name, llvm::MemoryBuffer *inputBuf, unsigned offset,
OptionsDictionary *options, ArrayRef<FilterRule> rawFilterRules,
GroupedCodeCompletionConsumer &consumer, ArrayRef<const char *> args) {
StringRef filterText;
unsigned resultOffset = 0;
unsigned maxResults = 0;
CodeCompletion::Options CCOpts;
if (options)
translateCodeCompletionOptions(*options, CCOpts, filterText, resultOffset,
maxResults);
CodeCompletion::FilterRules filterRules;
translateFilterRules(rawFilterRules, filterRules);
// Set up the code completion consumer to pass results to organizer.
CodeCompletion::CompletionSink sink;
std::vector<Completion *> completions;
NameToPopularityMap *nameToPopularity = nullptr;
// This reference must outlive the uses of nameToPopularity.
auto popularAPIRef = PopularAPI;
if (popularAPIRef) {
nameToPopularity = &popularAPIRef->nameToFactor;
}
CompletionKind completionKind = CompletionKind::None;
bool hasExpectedTypes = false;
bool mayUseImplicitMemberExpr = false;
SwiftCodeCompletionConsumer swiftConsumer(
[&](MutableArrayRef<CodeCompletionResult *> results,
SwiftCompletionInfo &info) {
auto &completionCtx = *info.completionContext;
completionKind = completionCtx.CodeCompletionKind;
hasExpectedTypes = completionCtx.HasExpectedTypeRelation;
mayUseImplicitMemberExpr = completionCtx.MayUseImplicitMemberExpr;
completions =
extendCompletions(results, sink, info, nameToPopularity, CCOpts);
});
// Add any codecomplete.open specific flags.
std::vector<const char *> extendedArgs(args.begin(), args.end());
if (CCOpts.addInitsToTopLevel) {
extendedArgs.push_back("-Xfrontend");
extendedArgs.push_back("-code-complete-inits-in-postfix-expr");
}
if (CCOpts.callPatternHeuristics) {
extendedArgs.push_back("-Xfrontend");
extendedArgs.push_back("-code-complete-call-pattern-heuristics");
}
// Invoke completion.
std::string error;
if (!swiftCodeCompleteImpl(*this, inputBuf, offset, swiftConsumer,
extendedArgs, error)) {
consumer.failed(error);
return;
}
// Add any relevant custom completions.
if (auto custom = CustomCompletions)
addCustomCompletions(sink, completions, custom->customCompletions,
completionKind);
// Pre-sort the completions.
CodeCompletion::CodeCompletionOrganizer::preSortCompletions(completions);
// Store in the session.
using CodeCompletion::SessionCache;
using CodeCompletion::SessionCacheRef;
auto bufferCopy = llvm::MemoryBuffer::getMemBufferCopy(
inputBuf->getBuffer(), inputBuf->getBufferIdentifier());
std::vector<std::string> argsCopy(extendedArgs.begin(), extendedArgs.end());
SessionCacheRef session{new SessionCache(
std::move(sink), std::move(bufferCopy), std::move(argsCopy),
completionKind, hasExpectedTypes, mayUseImplicitMemberExpr,
std::move(filterRules))};
session->setSortedCompletions(std::move(completions));
if (!CCSessions.set(name, offset, session)) {
std::string err;
llvm::raw_string_ostream OS(err);
OS << "codecomplete.open: code completion session for '" << name << "', "
<< offset << " already exists";
consumer.failed(OS.str());
}
transformAndForwardResults(consumer, *this, session, nameToPopularity, CCOpts,
offset, filterText, resultOffset, maxResults);
}
void SwiftLangSupport::codeCompleteClose(
StringRef name, unsigned offset, GroupedCodeCompletionConsumer &consumer) {
if (!CCSessions.remove(name, offset)) {
std::string err;
llvm::raw_string_ostream OS(err);
OS << "codecomplete.close: no code completion session for '" << name
<< "', " << offset;
consumer.failed(OS.str());
}
}
void SwiftLangSupport::codeCompleteUpdate(
StringRef name, unsigned offset, OptionsDictionary *options,
GroupedCodeCompletionConsumer &consumer) {
auto session = CCSessions.get(name, offset);
if (!session) {
std::string err;
llvm::raw_string_ostream OS(err);
OS << "codecomplete.update: no code completion session for '" << name
<< "', " << offset;
consumer.failed(OS.str());
return;
}
StringRef filterText;
unsigned resultOffset = 0;
unsigned maxResults = 0;
// FIXME: consider whether CCOpts has changed since the 'open'.
CodeCompletion::Options CCOpts;
if (options)
translateCodeCompletionOptions(*options, CCOpts, filterText, resultOffset,
maxResults);
NameToPopularityMap *nameToPopularity = nullptr;
// This reference must outlive the uses of nameToPopularity.
auto popularAPIRef = PopularAPI;
if (popularAPIRef) {
nameToPopularity = &popularAPIRef->nameToFactor;
}
transformAndForwardResults(consumer, *this, session, nameToPopularity, CCOpts,
offset, filterText, resultOffset, maxResults);
}
swift::ide::CodeCompletionCache &SwiftCompletionCache::getCache() {
return *inMemory;
}
SwiftCompletionCache::~SwiftCompletionCache() {}
void SwiftLangSupport::codeCompleteCacheOnDisk(StringRef path) {
ThreadSafeRefCntPtr<SwiftCompletionCache> newCache(new SwiftCompletionCache);
newCache->onDisk = llvm::make_unique<ide::OnDiskCodeCompletionCache>(path);
newCache->inMemory =
llvm::make_unique<ide::CodeCompletionCache>(newCache->onDisk.get());
CCCache = newCache; // replace the old cache.
}
void SwiftLangSupport::codeCompleteSetPopularAPI(
ArrayRef<const char *> popularAPI, ArrayRef<const char *> unpopularAPI) {
using Factor = CodeCompletion::PopularityFactor;
ThreadSafeRefCntPtr<SwiftPopularAPI> newPopularAPI(new SwiftPopularAPI);
auto &nameToFactor = newPopularAPI->nameToFactor;
for (unsigned i = 0, n = popularAPI.size(); i < n; ++i) {
SmallString<64> name;
if (canonicalizeFilterName(popularAPI[i], name))
continue;
nameToFactor[name] = Factor(double(n - i) / n);
}
for (unsigned i = 0, n = unpopularAPI.size(); i < n; ++i) {
SmallString<64> name;
if (canonicalizeFilterName(unpopularAPI[i], name))
continue;
nameToFactor[name] = Factor(-double(n - i) / n);
}
PopularAPI = newPopularAPI; // replace the old popular API.
}
void SwiftLangSupport::codeCompleteSetCustom(
ArrayRef<CustomCompletionInfo> completions) {
ThreadSafeRefCntPtr<SwiftCustomCompletions> newCustomCompletions(
new SwiftCustomCompletions);
newCustomCompletions->customCompletions.assign(completions.begin(),
completions.end());
CustomCompletions = newCustomCompletions; // Replace the existing completions.
}
| {
"content_hash": "e61b2b8fb9521363b607192726bed4ac",
"timestamp": "",
"source": "github",
"line_count": 1315,
"max_line_length": 83,
"avg_line_length": 37.24638783269962,
"alnum_prop": 0.6807815594438433,
"repo_name": "jopamer/swift",
"id": "5b9907c0854f50a6e7e4e83499f1344b701baec5",
"size": "48979",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "34"
},
{
"name": "C",
"bytes": "204138"
},
{
"name": "C++",
"bytes": "30094746"
},
{
"name": "CMake",
"bytes": "465457"
},
{
"name": "D",
"bytes": "1107"
},
{
"name": "DTrace",
"bytes": "2438"
},
{
"name": "Emacs Lisp",
"bytes": "57395"
},
{
"name": "LLVM",
"bytes": "67650"
},
{
"name": "Makefile",
"bytes": "1841"
},
{
"name": "Objective-C",
"bytes": "380520"
},
{
"name": "Objective-C++",
"bytes": "233550"
},
{
"name": "Perl",
"bytes": "2211"
},
{
"name": "Python",
"bytes": "1231951"
},
{
"name": "Ruby",
"bytes": "2091"
},
{
"name": "Shell",
"bytes": "207051"
},
{
"name": "Swift",
"bytes": "24666157"
},
{
"name": "Vim script",
"bytes": "15654"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<rootTag>
<Award>
<AwardTitle>NSF East Asia Summer Institutes for US Graduate Students</AwardTitle>
<AwardEffectiveDate>06/01/2007</AwardEffectiveDate>
<AwardExpirationDate>05/31/2008</AwardExpirationDate>
<AwardAmount>4579</AwardAmount>
<AwardInstrument>
<Value>Fellowship</Value>
</AwardInstrument>
<Organization>
<Code>01090000</Code>
<Directorate>
<LongName>Office Of The Director</LongName>
</Directorate>
<Division>
<LongName>Office Of Internatl Science &Engineering</LongName>
</Division>
</Organization>
<ProgramOfficer>
<SignBlockName>Carter Kimsey</SignBlockName>
</ProgramOfficer>
<AbstractNarration>EAPSI 2007<br/>This award will support a U.S. graduate student to conduct summer research in East Asia and/or the Pacific Rim. The research project will provide the student with a first hand research experience, an introduction to science and science policy infrastructure, and an orientation to the culture and language of the location. The primary goals of the East Asia Pacific Summer Institute program are to expose students to science and engineering in the context of a research setting, and to initiate early-career professional relationships that foster future research collaborations with foreign counterparts.</AbstractNarration>
<MinAmdLetterDate>06/14/2007</MinAmdLetterDate>
<MaxAmdLetterDate>06/14/2007</MaxAmdLetterDate>
<ARRAAmount/>
<AwardID>0714429</AwardID>
<Investigator>
<FirstName>Rachel</FirstName>
<LastName>Parker</LastName>
<EmailAddress/>
<StartDate>06/14/2007</StartDate>
<EndDate/>
<RoleCode>Principal Investigator</RoleCode>
</Investigator>
<Institution>
<Name>Parker Rachel A</Name>
<CityName>Santa Barbara</CityName>
<ZipCode>931093904</ZipCode>
<PhoneNumber/>
<StreetAddress/>
<CountryName>United States</CountryName>
<StateName>California</StateName>
<StateCode>CA</StateCode>
</Institution>
<FoaInformation>
<Code>0116000</Code>
<Name>Human Subjects</Name>
</FoaInformation>
</Award>
</rootTag>
| {
"content_hash": "31804d489655dc786cfc965d3f3e691d",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 668,
"avg_line_length": 42.94230769230769,
"alnum_prop": 0.7142857142857143,
"repo_name": "jallen2/Research-Trend",
"id": "821cd296894fc854d0a07041102488cb7c669fe0",
"size": "2233",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CU_Funding/2007/0714429.xml",
"mode": "33261",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="search.css"/>
<script type="text/javascript" src="search.js"></script>
</head>
<body class="SRPage">
<div id="SRIndex">
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRResult" id="SR_gdaccelerometer">
<div class="SREntry">
<a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../interface_g_d_accelerometer.html" target="_parent">GDAccelerometer</a>
</div>
</div>
<div class="SRResult" id="SR_gdaccelerometer_2eh">
<div class="SREntry">
<a id="Item1" onkeydown="return searchResults.Nav(event,1)" onkeypress="return searchResults.Nav(event,1)" onkeyup="return searchResults.Nav(event,1)" class="SRSymbol" href="../_g_d_accelerometer_8h.html" target="_parent">GDAccelerometer.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdaccessibilitymanager">
<div class="SREntry">
<a id="Item2" onkeydown="return searchResults.Nav(event,2)" onkeypress="return searchResults.Nav(event,2)" onkeyup="return searchResults.Nav(event,2)" class="SRSymbol" href="../interface_g_d_accessibility_manager.html" target="_parent">GDAccessibilityManager</a>
</div>
</div>
<div class="SRResult" id="SR_gdaccessibilitymanager_2eh">
<div class="SREntry">
<a id="Item3" onkeydown="return searchResults.Nav(event,3)" onkeypress="return searchResults.Nav(event,3)" onkeyup="return searchResults.Nav(event,3)" class="SRSymbol" href="../_g_d_accessibility_manager_8h.html" target="_parent">GDAccessibilityManager.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdaccessibilitymanagererrorconstant">
<div class="SREntry">
<a id="Item4" onkeydown="return searchResults.Nav(event,4)" onkeypress="return searchResults.Nav(event,4)" onkeyup="return searchResults.Nav(event,4)" class="SRSymbol" href="../_g_d_accessibility_manager_8h.html#a1cf9bc9ec4eecaee07b29bbe26b51447" target="_parent">GDAccessibilityManagerErrorConstant</a>
<span class="SRScope">GDAccessibilityManager.h</span>
</div>
</div>
<div class="SRResult" id="SR_gdaccessibilitynotification">
<div class="SREntry">
<a id="Item5" onkeydown="return searchResults.Nav(event,5)" onkeypress="return searchResults.Nav(event,5)" onkeyup="return searchResults.Nav(event,5)" class="SRSymbol" href="../interface_g_d_accessibility_notification.html" target="_parent">GDAccessibilityNotification</a>
</div>
</div>
<div class="SRResult" id="SR_gdaccessibilitynotification_2eh">
<div class="SREntry">
<a id="Item6" onkeydown="return searchResults.Nav(event,6)" onkeypress="return searchResults.Nav(event,6)" onkeyup="return searchResults.Nav(event,6)" class="SRSymbol" href="../_g_d_accessibility_notification_8h.html" target="_parent">GDAccessibilityNotification.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdaccessibilityobserver">
<div class="SREntry">
<a id="Item7" onkeydown="return searchResults.Nav(event,7)" onkeypress="return searchResults.Nav(event,7)" onkeyup="return searchResults.Nav(event,7)" class="SRSymbol" href="../interface_g_d_accessibility_observer.html" target="_parent">GDAccessibilityObserver</a>
</div>
</div>
<div class="SRResult" id="SR_gdaccessibilityobserver_2eh">
<div class="SREntry">
<a id="Item8" onkeydown="return searchResults.Nav(event,8)" onkeypress="return searchResults.Nav(event,8)" onkeyup="return searchResults.Nav(event,8)" class="SRSymbol" href="../_g_d_accessibility_observer_8h.html" target="_parent">GDAccessibilityObserver.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdaccessibilityoperationresult">
<div class="SREntry">
<a id="Item9" onkeydown="return searchResults.Nav(event,9)" onkeypress="return searchResults.Nav(event,9)" onkeyup="return searchResults.Nav(event,9)" class="SRSymbol" href="../interface_g_d_accessibility_operation_result.html" target="_parent">GDAccessibilityOperationResult</a>
</div>
</div>
<div class="SRResult" id="SR_gdaccessibilityoperationresult_2eh">
<div class="SREntry">
<a id="Item10" onkeydown="return searchResults.Nav(event,10)" onkeypress="return searchResults.Nav(event,10)" onkeyup="return searchResults.Nav(event,10)" class="SRSymbol" href="../_g_d_accessibility_operation_result_8h.html" target="_parent">GDAccessibilityOperationResult.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdasllog">
<div class="SREntry">
<a id="Item11" onkeydown="return searchResults.Nav(event,11)" onkeypress="return searchResults.Nav(event,11)" onkeyup="return searchResults.Nav(event,11)" class="SRSymbol" href="../interface_g_d_a_s_l_log.html" target="_parent">GDASLLog</a>
</div>
</div>
<div class="SRResult" id="SR_gdasllog_2eh">
<div class="SREntry">
<a id="Item12" onkeydown="return searchResults.Nav(event,12)" onkeypress="return searchResults.Nav(event,12)" onkeyup="return searchResults.Nav(event,12)" class="SRSymbol" href="../_g_d_a_s_l_log_8h.html" target="_parent">GDASLLog.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdcallback">
<div class="SREntry">
<a id="Item13" onkeydown="return searchResults.Nav(event,13)" onkeypress="return searchResults.Nav(event,13)" onkeyup="return searchResults.Nav(event,13)" class="SRSymbol" href="../interface_g_d_callback.html" target="_parent">GDCallback</a>
</div>
</div>
<div class="SRResult" id="SR_gdcallback_2eh">
<div class="SREntry">
<a id="Item14" onkeydown="return searchResults.Nav(event,14)" onkeypress="return searchResults.Nav(event,14)" onkeyup="return searchResults.Nav(event,14)" class="SRSymbol" href="../_g_d_callback_8h.html" target="_parent">GDCallback.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdcarbonevent">
<div class="SREntry">
<a id="Item15" onkeydown="return searchResults.Nav(event,15)" onkeypress="return searchResults.Nav(event,15)" onkeyup="return searchResults.Nav(event,15)" class="SRSymbol" href="../interface_g_d_carbon_event.html" target="_parent">GDCarbonEvent</a>
</div>
</div>
<div class="SRResult" id="SR_gdcarbonevent_2eh">
<div class="SREntry">
<a id="Item16" onkeydown="return searchResults.Nav(event,16)" onkeypress="return searchResults.Nav(event,16)" onkeyup="return searchResults.Nav(event,16)" class="SRSymbol" href="../_g_d_carbon_event_8h.html" target="_parent">GDCarbonEvent.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdcarboneventmanager">
<div class="SREntry">
<a id="Item17" onkeydown="return searchResults.Nav(event,17)" onkeypress="return searchResults.Nav(event,17)" onkeyup="return searchResults.Nav(event,17)" class="SRSymbol" href="../interface_g_d_carbon_event_manager.html" target="_parent">GDCarbonEventManager</a>
</div>
</div>
<div class="SRResult" id="SR_gdcarboneventmanager_2eh">
<div class="SREntry">
<a id="Item18" onkeydown="return searchResults.Nav(event,18)" onkeypress="return searchResults.Nav(event,18)" onkeyup="return searchResults.Nav(event,18)" class="SRSymbol" href="../_g_d_carbon_event_manager_8h.html" target="_parent">GDCarbonEventManager.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdcliproxy">
<div class="SREntry">
<a id="Item19" onkeydown="return searchResults.Nav(event,19)" onkeypress="return searchResults.Nav(event,19)" onkeyup="return searchResults.Nav(event,19)" class="SRSymbol" href="../interface_g_d_cli_proxy.html" target="_parent">GDCliProxy</a>
</div>
</div>
<div class="SRResult" id="SR_gdcliproxy_2eh">
<div class="SREntry">
<a id="Item20" onkeydown="return searchResults.Nav(event,20)" onkeypress="return searchResults.Nav(event,20)" onkeyup="return searchResults.Nav(event,20)" class="SRSymbol" href="../_g_d_cli_proxy_8h.html" target="_parent">GDCliProxy.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdcliproxyconnector">
<div class="SREntry">
<a id="Item21" onkeydown="return searchResults.Nav(event,21)" onkeypress="return searchResults.Nav(event,21)" onkeyup="return searchResults.Nav(event,21)" class="SRSymbol" href="../interface_g_d_cli_proxy_connector.html" target="_parent">GDCliProxyConnector</a>
</div>
</div>
<div class="SRResult" id="SR_gdcliproxyconnector_2eh">
<div class="SREntry">
<a id="Item22" onkeydown="return searchResults.Nav(event,22)" onkeypress="return searchResults.Nav(event,22)" onkeyup="return searchResults.Nav(event,22)" class="SRSymbol" href="../_g_d_cli_proxy_connector_8h.html" target="_parent">GDCliProxyConnector.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdcrashreporter">
<div class="SREntry">
<a id="Item23" onkeydown="return searchResults.Nav(event,23)" onkeypress="return searchResults.Nav(event,23)" onkeyup="return searchResults.Nav(event,23)" class="SRSymbol" href="../interface_g_d_crash_reporter.html" target="_parent">GDCrashReporter</a>
</div>
</div>
<div class="SRResult" id="SR_gdcrashreporter_2eh">
<div class="SREntry">
<a id="Item24" onkeydown="return searchResults.Nav(event,24)" onkeypress="return searchResults.Nav(event,24)" onkeyup="return searchResults.Nav(event,24)" class="SRSymbol" href="../_g_d_crash_reporter_8h.html" target="_parent">GDCrashReporter.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdcrashreporterdelegate_2dp">
<div class="SREntry">
<a id="Item25" onkeydown="return searchResults.Nav(event,25)" onkeypress="return searchResults.Nav(event,25)" onkeyup="return searchResults.Nav(event,25)" class="SRSymbol" href="../protocol_g_d_crash_reporter_delegate-p.html" target="_parent">GDCrashReporterDelegate-p</a>
</div>
</div>
<div class="SRResult" id="SR_gdcrashreporterdelegate_2eh">
<div class="SREntry">
<a id="Item26" onkeydown="return searchResults.Nav(event,26)" onkeypress="return searchResults.Nav(event,26)" onkeyup="return searchResults.Nav(event,26)" class="SRSymbol" href="../_g_d_crash_reporter_delegate_8h.html" target="_parent">GDCrashReporterDelegate.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdflog">
<div class="SREntry">
<a id="Item27" onkeydown="return searchResults.Nav(event,27)" onkeypress="return searchResults.Nav(event,27)" onkeyup="return searchResults.Nav(event,27)" class="SRSymbol" href="../_g_d_print_utils_8h.html#ac82b8e41c46b7e7199a9a4ea4e6892e7" target="_parent">gdflog</a>
<span class="SRScope">GDPrintUtils.h</span>
</div>
</div>
<div class="SRResult" id="SR_gdgradientboxview">
<div class="SREntry">
<a id="Item28" onkeydown="return searchResults.Nav(event,28)" onkeypress="return searchResults.Nav(event,28)" onkeyup="return searchResults.Nav(event,28)" class="SRSymbol" href="../interface_g_d_gradient_box_view.html" target="_parent">GDGradientBoxView</a>
</div>
</div>
<div class="SRResult" id="SR_gdgradientboxview_2eh">
<div class="SREntry">
<a id="Item29" onkeydown="return searchResults.Nav(event,29)" onkeypress="return searchResults.Nav(event,29)" onkeyup="return searchResults.Nav(event,29)" class="SRSymbol" href="../_g_d_gradient_box_view_8h.html" target="_parent">GDGradientBoxView.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdkit_2diphone_2eh">
<div class="SREntry">
<a id="Item30" onkeydown="return searchResults.Nav(event,30)" onkeypress="return searchResults.Nav(event,30)" onkeyup="return searchResults.Nav(event,30)" class="SRSymbol" href="../_g_d_kit-i_phone_8h.html" target="_parent">GDKit-iPhone.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdkit_2dmac_2eh">
<div class="SREntry">
<a id="Item31" onkeydown="return searchResults.Nav(event,31)" onkeypress="return searchResults.Nav(event,31)" onkeyup="return searchResults.Nav(event,31)" class="SRSymbol" href="../_g_d_kit-_mac_8h.html" target="_parent">GDKit-Mac.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdkit_2eh">
<div class="SREntry">
<a id="Item32" onkeydown="return searchResults.Nav(event,32)" onkeypress="return searchResults.Nav(event,32)" onkeyup="return searchResults.Nav(event,32)" class="SRSymbol" href="../_g_d_kit_8h.html" target="_parent">GDKit.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdkitibbundle">
<div class="SREntry">
<a id="Item33" onkeydown="return searchResults.Nav(event,33)" onkeypress="return searchResults.Nav(event,33)" onkeyup="return searchResults.Nav(event,33)" class="SRSymbol" href="javascript:searchResults.Toggle('SR_gdkitibbundle')">gdKitIBBundle</a>
<div class="SRChildren">
<a id="Item33_c0" onkeydown="return searchResults.NavChild(event,33,0)" onkeypress="return searchResults.NavChild(event,33,0)" onkeyup="return searchResults.NavChild(event,33,0)" class="SRScope" href="../interface_g_d_scale3_button_cell.html#a24c2c0c1362d3b44147ccd9616695dbf" target="_parent">GDScale3ButtonCell::gdKitIBBundle()</a>
<a id="Item33_c1" onkeydown="return searchResults.NavChild(event,33,1)" onkeypress="return searchResults.NavChild(event,33,1)" onkeyup="return searchResults.NavChild(event,33,1)" class="SRScope" href="../interface_g_d_scale3_view.html#a1b964bf00c019d377ed37600ad306205" target="_parent">GDScale3View::gdKitIBBundle()</a>
<a id="Item33_c2" onkeydown="return searchResults.NavChild(event,33,2)" onkeypress="return searchResults.NavChild(event,33,2)" onkeyup="return searchResults.NavChild(event,33,2)" class="SRScope" href="../interface_g_d_scale9_button_cell.html#a8a79ddf7636ca0320b88bde63bfe9a72" target="_parent">GDScale9ButtonCell::gdKitIBBundle()</a>
<a id="Item33_c3" onkeydown="return searchResults.NavChild(event,33,3)" onkeypress="return searchResults.NavChild(event,33,3)" onkeyup="return searchResults.NavChild(event,33,3)" class="SRScope" href="../interface_g_d_scale9_view.html#afd5c553711ebe121b1cc1c7b40002fb2" target="_parent">GDScale9View::gdKitIBBundle()</a>
<a id="Item33_c4" onkeydown="return searchResults.NavChild(event,33,4)" onkeypress="return searchResults.NavChild(event,33,4)" onkeyup="return searchResults.NavChild(event,33,4)" class="SRScope" href="../interface_g_d_tile_view.html#a782c3aa1592b1fd363f2f9ea92df66d7" target="_parent">GDTileView::gdKitIBBundle()</a>
</div>
</div>
</div>
<div class="SRResult" id="SR_gdlog">
<div class="SREntry">
<a id="Item34" onkeydown="return searchResults.Nav(event,34)" onkeypress="return searchResults.Nav(event,34)" onkeyup="return searchResults.Nav(event,34)" class="SRSymbol" href="../_g_d_print_utils_8h.html#a3a3c5f4173bdafed9ddfed833ce2ea84" target="_parent">gdlog</a>
<span class="SRScope">GDPrintUtils.h</span>
</div>
</div>
<div class="SRResult" id="SR_gdmainmenucontroller">
<div class="SREntry">
<a id="Item35" onkeydown="return searchResults.Nav(event,35)" onkeypress="return searchResults.Nav(event,35)" onkeyup="return searchResults.Nav(event,35)" class="SRSymbol" href="../interface_g_d_main_menu_controller.html" target="_parent">GDMainMenuController</a>
</div>
</div>
<div class="SRResult" id="SR_gdmainmenucontroller_2eh">
<div class="SREntry">
<a id="Item36" onkeydown="return searchResults.Nav(event,36)" onkeypress="return searchResults.Nav(event,36)" onkeyup="return searchResults.Nav(event,36)" class="SRSymbol" href="../_g_d_main_menu_controller_8h.html" target="_parent">GDMainMenuController.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdnstaskoperation">
<div class="SREntry">
<a id="Item37" onkeydown="return searchResults.Nav(event,37)" onkeypress="return searchResults.Nav(event,37)" onkeyup="return searchResults.Nav(event,37)" class="SRSymbol" href="../interface_g_d_n_s_task_operation.html" target="_parent">GDNSTaskOperation</a>
</div>
</div>
<div class="SRResult" id="SR_gdnstaskoperation_2eh">
<div class="SREntry">
<a id="Item38" onkeydown="return searchResults.Nav(event,38)" onkeypress="return searchResults.Nav(event,38)" onkeyup="return searchResults.Nav(event,38)" class="SRSymbol" href="../_g_d_n_s_task_operation_8h.html" target="_parent">GDNSTaskOperation.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdoperation">
<div class="SREntry">
<a id="Item39" onkeydown="return searchResults.Nav(event,39)" onkeypress="return searchResults.Nav(event,39)" onkeyup="return searchResults.Nav(event,39)" class="SRSymbol" href="../interface_g_d_operation.html" target="_parent">GDOperation</a>
</div>
</div>
<div class="SRResult" id="SR_gdoperation_2eh">
<div class="SREntry">
<a id="Item40" onkeydown="return searchResults.Nav(event,40)" onkeypress="return searchResults.Nav(event,40)" onkeyup="return searchResults.Nav(event,40)" class="SRSymbol" href="../_g_d_operation_8h.html" target="_parent">GDOperation.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdoperationscontroller">
<div class="SREntry">
<a id="Item41" onkeydown="return searchResults.Nav(event,41)" onkeypress="return searchResults.Nav(event,41)" onkeyup="return searchResults.Nav(event,41)" class="SRSymbol" href="../interface_g_d_operations_controller.html" target="_parent">GDOperationsController</a>
</div>
</div>
<div class="SRResult" id="SR_gdoperationscontroller_2eh">
<div class="SREntry">
<a id="Item42" onkeydown="return searchResults.Nav(event,42)" onkeypress="return searchResults.Nav(event,42)" onkeyup="return searchResults.Nav(event,42)" class="SRSymbol" href="../_g_d_operations_controller_8h.html" target="_parent">GDOperationsController.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdprintutils_2eh">
<div class="SREntry">
<a id="Item43" onkeydown="return searchResults.Nav(event,43)" onkeypress="return searchResults.Nav(event,43)" onkeyup="return searchResults.Nav(event,43)" class="SRSymbol" href="../_g_d_print_utils_8h.html" target="_parent">GDPrintUtils.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdquartzdisplay">
<div class="SREntry">
<a id="Item44" onkeydown="return searchResults.Nav(event,44)" onkeypress="return searchResults.Nav(event,44)" onkeyup="return searchResults.Nav(event,44)" class="SRSymbol" href="../interface_g_d_quartz_display.html" target="_parent">GDQuartzDisplay</a>
</div>
</div>
<div class="SRResult" id="SR_gdquartzdisplay_2eh">
<div class="SREntry">
<a id="Item45" onkeydown="return searchResults.Nav(event,45)" onkeypress="return searchResults.Nav(event,45)" onkeyup="return searchResults.Nav(event,45)" class="SRSymbol" href="../_g_d_quartz_display_8h.html" target="_parent">GDQuartzDisplay.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdquartzutils_2eh">
<div class="SREntry">
<a id="Item46" onkeydown="return searchResults.Nav(event,46)" onkeypress="return searchResults.Nav(event,46)" onkeyup="return searchResults.Nav(event,46)" class="SRSymbol" href="../_g_d_quartz_utils_8h.html" target="_parent">GDQuartzUtils.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdrelease">
<div class="SREntry">
<a id="Item47" onkeydown="return searchResults.Nav(event,47)" onkeypress="return searchResults.Nav(event,47)" onkeyup="return searchResults.Nav(event,47)" class="SRSymbol" href="../macros_8h.html#a117bee10d874e1f3ae077f522dec71b8" target="_parent">GDRelease</a>
<span class="SRScope">macros.h</span>
</div>
</div>
<div class="SRResult" id="SR_gdscale3button">
<div class="SREntry">
<a id="Item48" onkeydown="return searchResults.Nav(event,48)" onkeypress="return searchResults.Nav(event,48)" onkeyup="return searchResults.Nav(event,48)" class="SRSymbol" href="../interface_g_d_scale3_button.html" target="_parent">GDScale3Button</a>
</div>
</div>
<div class="SRResult" id="SR_gdscale3button_2eh">
<div class="SREntry">
<a id="Item49" onkeydown="return searchResults.Nav(event,49)" onkeypress="return searchResults.Nav(event,49)" onkeyup="return searchResults.Nav(event,49)" class="SRSymbol" href="../_g_d_scale3_button_8h.html" target="_parent">GDScale3Button.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdscale3buttoncell">
<div class="SREntry">
<a id="Item50" onkeydown="return searchResults.Nav(event,50)" onkeypress="return searchResults.Nav(event,50)" onkeyup="return searchResults.Nav(event,50)" class="SRSymbol" href="../interface_g_d_scale3_button_cell.html" target="_parent">GDScale3ButtonCell</a>
</div>
</div>
<div class="SRResult" id="SR_gdscale3buttoncell_2eh">
<div class="SREntry">
<a id="Item51" onkeydown="return searchResults.Nav(event,51)" onkeypress="return searchResults.Nav(event,51)" onkeyup="return searchResults.Nav(event,51)" class="SRSymbol" href="../_g_d_scale3_button_cell_8h.html" target="_parent">GDScale3ButtonCell.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdscale3view">
<div class="SREntry">
<a id="Item52" onkeydown="return searchResults.Nav(event,52)" onkeypress="return searchResults.Nav(event,52)" onkeyup="return searchResults.Nav(event,52)" class="SRSymbol" href="../interface_g_d_scale3_view.html" target="_parent">GDScale3View</a>
</div>
</div>
<div class="SRResult" id="SR_gdscale9button">
<div class="SREntry">
<a id="Item53" onkeydown="return searchResults.Nav(event,53)" onkeypress="return searchResults.Nav(event,53)" onkeyup="return searchResults.Nav(event,53)" class="SRSymbol" href="../interface_g_d_scale9_button.html" target="_parent">GDScale9Button</a>
</div>
</div>
<div class="SRResult" id="SR_gdscale9button_2eh">
<div class="SREntry">
<a id="Item54" onkeydown="return searchResults.Nav(event,54)" onkeypress="return searchResults.Nav(event,54)" onkeyup="return searchResults.Nav(event,54)" class="SRSymbol" href="../_g_d_scale9_button_8h.html" target="_parent">GDScale9Button.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdscale9buttoncell">
<div class="SREntry">
<a id="Item55" onkeydown="return searchResults.Nav(event,55)" onkeypress="return searchResults.Nav(event,55)" onkeyup="return searchResults.Nav(event,55)" class="SRSymbol" href="../interface_g_d_scale9_button_cell.html" target="_parent">GDScale9ButtonCell</a>
</div>
</div>
<div class="SRResult" id="SR_gdscale9buttoncell_2eh">
<div class="SREntry">
<a id="Item56" onkeydown="return searchResults.Nav(event,56)" onkeypress="return searchResults.Nav(event,56)" onkeyup="return searchResults.Nav(event,56)" class="SRSymbol" href="../_g_d_scale9_button_cell_8h.html" target="_parent">GDScale9ButtonCell.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdscale9view">
<div class="SREntry">
<a id="Item57" onkeydown="return searchResults.Nav(event,57)" onkeypress="return searchResults.Nav(event,57)" onkeyup="return searchResults.Nav(event,57)" class="SRSymbol" href="../interface_g_d_scale9_view.html" target="_parent">GDScale9View</a>
</div>
</div>
<div class="SRResult" id="SR_gdscale9view_2eh">
<div class="SREntry">
<a id="Item58" onkeydown="return searchResults.Nav(event,58)" onkeypress="return searchResults.Nav(event,58)" onkeyup="return searchResults.Nav(event,58)" class="SRSymbol" href="../_g_d_scale9_view_8h.html" target="_parent">GDScale9View.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdsoundcontroller">
<div class="SREntry">
<a id="Item59" onkeydown="return searchResults.Nav(event,59)" onkeypress="return searchResults.Nav(event,59)" onkeyup="return searchResults.Nav(event,59)" class="SRSymbol" href="../interface_g_d_sound_controller.html" target="_parent">GDSoundController</a>
</div>
</div>
<div class="SRResult" id="SR_gdsoundcontroller_2eh">
<div class="SREntry">
<a id="Item60" onkeydown="return searchResults.Nav(event,60)" onkeypress="return searchResults.Nav(event,60)" onkeyup="return searchResults.Nav(event,60)" class="SRSymbol" href="../_g_d_sound_controller_8h.html" target="_parent">GDSoundController.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdtileview">
<div class="SREntry">
<a id="Item61" onkeydown="return searchResults.Nav(event,61)" onkeypress="return searchResults.Nav(event,61)" onkeyup="return searchResults.Nav(event,61)" class="SRSymbol" href="../interface_g_d_tile_view.html" target="_parent">GDTileView</a>
</div>
</div>
<div class="SRResult" id="SR_gdtileview_2eh">
<div class="SREntry">
<a id="Item62" onkeydown="return searchResults.Nav(event,62)" onkeypress="return searchResults.Nav(event,62)" onkeyup="return searchResults.Nav(event,62)" class="SRSymbol" href="../_g_d_tile_view_8h.html" target="_parent">GDTileView.h</a>
</div>
</div>
<div class="SRResult" id="SR_gdulimit">
<div class="SREntry">
<a id="Item63" onkeydown="return searchResults.Nav(event,63)" onkeypress="return searchResults.Nav(event,63)" onkeyup="return searchResults.Nav(event,63)" class="SRSymbol" href="../interface_g_d_u_limit.html" target="_parent">GDULimit</a>
</div>
</div>
<div class="SRResult" id="SR_gdulimit_2eh">
<div class="SREntry">
<a id="Item64" onkeydown="return searchResults.Nav(event,64)" onkeypress="return searchResults.Nav(event,64)" onkeyup="return searchResults.Nav(event,64)" class="SRSymbol" href="../_g_d_u_limit_8h.html" target="_parent">GDULimit.h</a>
</div>
</div>
<div class="SRResult" id="SR_getapidisabledoperationresult">
<div class="SREntry">
<a id="Item65" onkeydown="return searchResults.Nav(event,65)" onkeypress="return searchResults.Nav(event,65)" onkeyup="return searchResults.Nav(event,65)" class="SRSymbol" href="../interface_g_d_accessibility_manager.html#aef4b860ce6e68e077e52fa67c7226a44" target="_parent">getAPIDisabledOperationResult</a>
<span class="SRScope">GDAccessibilityManager</span>
</div>
</div>
<div class="SRResult" id="SR_getcannotcreatevalueoperationresult">
<div class="SREntry">
<a id="Item66" onkeydown="return searchResults.Nav(event,66)" onkeypress="return searchResults.Nav(event,66)" onkeyup="return searchResults.Nav(event,66)" class="SRSymbol" href="../interface_g_d_accessibility_manager.html#a22c8eae92829ccbc2baa3a8d7721e466" target="_parent">getCannotCreateValueOperationResult</a>
<span class="SRScope">GDAccessibilityManager</span>
</div>
</div>
<div class="SRResult" id="SR_gradient">
<div class="SREntry">
<a id="Item67" onkeydown="return searchResults.Nav(event,67)" onkeypress="return searchResults.Nav(event,67)" onkeyup="return searchResults.Nav(event,67)" class="SRSymbol" href="../interface_g_d_gradient_box_view.html#a0e6edc2819b9d6c50309b1e974073adf" target="_parent">gradient</a>
<span class="SRScope">GDGradientBoxView</span>
</div>
</div>
<div class="SRResult" id="SR_group">
<div class="SREntry">
<a id="Item68" onkeydown="return searchResults.Nav(event,68)" onkeypress="return searchResults.Nav(event,68)" onkeyup="return searchResults.Nav(event,68)" class="SRSymbol" href="../interface_u_i_table_view_group.html#a6f145b5e6b9ef62694ddffe70e3294b0" target="_parent">group</a>
<span class="SRScope">UITableViewGroup</span>
</div>
</div>
<div class="SRResult" id="SR_groups">
<div class="SREntry">
<a id="Item69" onkeydown="return searchResults.Nav(event,69)" onkeypress="return searchResults.Nav(event,69)" onkeyup="return searchResults.Nav(event,69)" class="SRSymbol" href="../interface_u_i_table_view_data_provider.html#a2188d5572adf43cfebc2dd40beef6431" target="_parent">groups</a>
<span class="SRScope">UITableViewDataProvider</span>
</div>
</div>
<div class="SRResult" id="SR_">
<div class="SREntry">
<a id="Item70" onkeydown="return searchResults.Nav(event,70)" onkeypress="return searchResults.Nav(event,70)" onkeyup="return searchResults.Nav(event,70)" class="SRSymbol" href="../interface_u_i_table_view_data_provider.html#abcfdf9f26aeffc9c6b7cae2347fe8928" target="_parent"></a>
<span class="SRScope">UITableViewDataProvider</span>
</div>
</div>
<div class="SRResult" id="SR_">
<div class="SREntry">
<a id="Item71" onkeydown="return searchResults.Nav(event,71)" onkeypress="return searchResults.Nav(event,71)" onkeyup="return searchResults.Nav(event,71)" class="SRSymbol" href="../interface_u_i_table_view_group.html#ab5a01e603db850fd0c2290e7eecdc269" target="_parent"></a>
<span class="SRScope">UITableViewGroup</span>
</div>
</div>
<div class="SRResult" id="SR_">
<div class="SREntry">
<a id="Item72" onkeydown="return searchResults.Nav(event,72)" onkeypress="return searchResults.Nav(event,72)" onkeyup="return searchResults.Nav(event,72)" class="SRSymbol" href="../interface_g_d_cli_proxy_connector.html#a4a9943173a516e776d4b8c7dfad1e3df" target="_parent"></a>
<span class="SRScope">GDCliProxyConnector</span>
</div>
</div>
<div class="SRResult" id="SR_">
<div class="SREntry">
<a id="Item73" onkeydown="return searchResults.Nav(event,73)" onkeypress="return searchResults.Nav(event,73)" onkeyup="return searchResults.Nav(event,73)" class="SRSymbol" href="../interface_u_i_table_view_group.html#a0b8c6960d9ca8c2dd1565272a34eeb8a" target="_parent"></a>
<span class="SRScope">UITableViewGroup</span>
</div>
</div>
<div class="SRResult" id="SR_">
<div class="SREntry">
<a id="Item74" onkeydown="return searchResults.Nav(event,74)" onkeypress="return searchResults.Nav(event,74)" onkeyup="return searchResults.Nav(event,74)" class="SRSymbol" href="../interface_u_i_table_view_row.html#a6bbb333fdd0a3bc000a06e9b9afbbfed" target="_parent"></a>
<span class="SRScope">UITableViewRow</span>
</div>
</div>
<div class="SRResult" id="SR_">
<div class="SREntry">
<a id="Item75" onkeydown="return searchResults.Nav(event,75)" onkeypress="return searchResults.Nav(event,75)" onkeyup="return searchResults.Nav(event,75)" class="SRSymbol" href="../interface_g_d_callback.html#ae28d4341944ea3135a41d16039bfc6f9" target="_parent"></a>
<span class="SRScope">GDCallback</span>
</div>
</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
<script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults");
searchResults.Search();
--></script>
</div>
</body>
</html>
| {
"content_hash": "8d3ebf169cc55e0ad4b45022e5fc5964",
"timestamp": "",
"source": "github",
"line_count": 422,
"max_line_length": 337,
"avg_line_length": 70.08530805687204,
"alnum_prop": 0.73985664051934,
"repo_name": "wave2future/gdkit",
"id": "f1f1bc8c9ec03d4ee64b84d55e1573922c0ba872",
"size": "29576",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/html/search/all_67.html",
"mode": "33188",
"license": "bsd-2-clause",
"language": [],
"symlink_target": ""
} |
function title_underline {
local len=$1
while [[ $len -gt 0 ]]; do
printf "="
len=$(( len - 1))
done
printf " ===\n"
}
(
if [[ -r data/devstack-plugins-registry.header ]]; then
cat data/devstack-plugins-registry.header
fi
sorted_plugins=$(python3 tools/generate-devstack-plugins-list.py)
# find the length of the name column & pad
name_col_len=$(echo "${sorted_plugins}" | wc -L)
name_col_len=$(( name_col_len + 2 ))
# ====================== ===
# Plugin Name URL
# ====================== ===
# foobar `https://... <https://...>`__
# ...
printf "\n\n"
title_underline ${name_col_len}
printf "%-${name_col_len}s %s\n" "Plugin Name" "URL"
title_underline ${name_col_len}
for plugin in ${sorted_plugins}; do
giturl="https://opendev.org/${plugin}"
gitlink="https://opendev.org/${plugin}"
printf "%-${name_col_len}s %s\n" "${plugin}" "\`${giturl} <${gitlink}>\`__"
done
title_underline ${name_col_len}
printf "\n\n"
if [[ -r data/devstack-plugins-registry.footer ]]; then
cat data/devstack-plugins-registry.footer
fi
) > doc/source/plugin-registry.rst
if [[ -n ${1} ]]; then
cp doc/source/plugin-registry.rst ${1}/doc/source/plugin-registry.rst
fi
| {
"content_hash": "7fbd5dc0d7c00aa49a4d66c15ad59d07",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 79,
"avg_line_length": 25.224489795918366,
"alnum_prop": 0.5849514563106796,
"repo_name": "nawawi/openstack",
"id": "3307943df9b157c948ef2ad84834bc579c7af244",
"size": "2931",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tools/generate-devstack-plugins-list.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Jinja",
"bytes": "1049"
},
{
"name": "Makefile",
"bytes": "2490"
},
{
"name": "Python",
"bytes": "55120"
},
{
"name": "Shell",
"bytes": "865981"
}
],
"symlink_target": ""
} |
from django.contrib.auth.models import AnonymousUser
from django.db import models
from django.template import Engine, RequestContext
from django.test import RequestFactory
from cms.toolbar.toolbar import CMSToolbar
from .conf import settings
from .utils import get_cleaned_text
def get_field_value(obj, name):
fields = name.split('__')
name = fields[0]
try:
obj._meta.get_field(name)
except (AttributeError, models.FieldDoesNotExist):
value = getattr(obj, name, None) or ''
else:
value = getattr(obj, name)
if len(fields) > 1:
remaining = '__'.join(fields[1:])
return get_field_value(value, remaining)
return value
def get_plugin_index_data(base_plugin, request):
searchable_text = []
instance, plugin_type = base_plugin.get_plugin_instance()
if instance is None:
return searchable_text
search_fields = getattr(instance, 'search_fields', [])
if not bool(search_fields):
context = RequestContext(request)
updates = {}
engine = Engine.get_default()
for processor in engine.template_context_processors:
updates.update(processor(context.request))
context.dicts[context._processors_index] = updates
plugin_contents = instance.render_plugin(context=context)
if plugin_contents:
searchable_text = get_cleaned_text(plugin_contents)
else:
values = (get_field_value(instance, field) for field in search_fields)
for value in values:
cleaned_bits = get_cleaned_text(value or '')
searchable_text.extend(cleaned_bits)
return searchable_text
def get_request(language=None):
request_factory = RequestFactory(HTTP_HOST=settings.ALLOWED_HOSTS[0])
request = request_factory.get("/")
request.session = {}
request.LANGUAGE_CODE = language or settings.LANGUAGE_CODE
request.current_page = None
request.user = AnonymousUser()
request.toolbar = CMSToolbar(request)
return request
| {
"content_hash": "b391a10e8723b7cf6db3c478b71b6f84",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 78,
"avg_line_length": 30.71212121212121,
"alnum_prop": 0.6748889985199803,
"repo_name": "AccentDesign/djangocms-site-search",
"id": "ec6fb49d2343018fa3a8090a77971ce7810332fc",
"size": "2051",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "site_search/helpers.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "379"
},
{
"name": "HTML",
"bytes": "6331"
},
{
"name": "Python",
"bytes": "49749"
},
{
"name": "Shell",
"bytes": "96"
}
],
"symlink_target": ""
} |
namespace cc {
GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context, const gfx::RectF& quadVertexRect)
: m_context(context)
, m_quadVerticesVbo(0)
, m_quadElementsVbo(0)
, m_initialized(false)
{
float vertices[] = { quadVertexRect.x(), quadVertexRect.bottom(), 0.0f, 0.0f, 1.0f,
quadVertexRect.x(), quadVertexRect.y(), 0.0f, 0.0f, 0.0f,
quadVertexRect.right(), quadVertexRect.y(), 0.0f, 1.0f, 0.0f,
quadVertexRect.right(), quadVertexRect.bottom(), 0.0f, 1.0f, 1.0f };
struct Vertex {
float a_position[3];
float a_texCoord[2];
float a_index; // index of the vertex, divide by 4 to have the matrix for this quad
};
struct Quad { Vertex v0, v1, v2, v3; };
struct QuadIndex { uint16_t data[6]; };
COMPILE_ASSERT(sizeof(Quad) == 24 * sizeof(float), struct_is_densely_packed);
COMPILE_ASSERT(sizeof(QuadIndex) == 6 * sizeof(uint16_t), struct_is_densely_packed);
Quad quad_list[8];
QuadIndex quad_index_list[8];
for (int i = 0; i < 8; i++) {
Vertex v0 = { quadVertexRect.x() , quadVertexRect.bottom(), 0.0f, 0.0f, 1.0f, i * 4.0f + 0.0f };
Vertex v1 = { quadVertexRect.x() , quadVertexRect.y() , 0.0f, 0.0f, 0.0f, i * 4.0f + 1.0f };
Vertex v2 = { quadVertexRect.right(), quadVertexRect.y() , 0.0f, 1.0f, 0.0f, i * 4.0f + 2.0f };
Vertex v3 = { quadVertexRect.right(), quadVertexRect.bottom(), 0.0f, 1.0f, 1.0f, i * 4.0f + 3.0f };
Quad x = { v0, v1, v2, v3 };
quad_list[i] = x;
QuadIndex y = { 0 + 4 * i, 1 + 4 * i, 2 + 4 * i, 3 + 4 * i, 0 + 4 * i, 2 + 4 * i };
quad_index_list[i] = y;
}
GLC(m_context, m_quadVerticesVbo = m_context->createBuffer());
GLC(m_context, m_quadElementsVbo = m_context->createBuffer());
GLC(m_context, m_quadListVerticesVbo = m_context->createBuffer());
GLC(m_context, m_context->bindBuffer(GL_ARRAY_BUFFER, m_quadVerticesVbo));
GLC(m_context, m_context->bufferData(GL_ARRAY_BUFFER, sizeof(quad_list), quad_list, GL_STATIC_DRAW));
GLC(m_context, m_context->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_quadElementsVbo));
GLC(m_context, m_context->bufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quad_index_list), quad_index_list, GL_STATIC_DRAW));
m_initialized = true;
}
GeometryBinding::~GeometryBinding()
{
GLC(m_context, m_context->deleteBuffer(m_quadVerticesVbo));
GLC(m_context, m_context->deleteBuffer(m_quadElementsVbo));
}
void GeometryBinding::prepareForDraw()
{
GLC(m_context, m_context->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, quadElementsVbo()));
GLC(m_context, m_context->bindBuffer(GL_ARRAY_BUFFER, quadVerticesVbo()));
GLC(m_context, m_context->vertexAttribPointer(positionAttribLocation(), 3, GL_FLOAT, false, 6 * sizeof(float), 0));
GLC(m_context, m_context->vertexAttribPointer(texCoordAttribLocation(), 2, GL_FLOAT, false, 6 * sizeof(float), 3 * sizeof(float)));
GLC(m_context, m_context->vertexAttribPointer(triangleIndexAttribLocation(), 1, GL_FLOAT, false, 6 * sizeof(float), 5 * sizeof(float)));
GLC(m_context, m_context->enableVertexAttribArray(positionAttribLocation()));
GLC(m_context, m_context->enableVertexAttribArray(texCoordAttribLocation()));
GLC(m_context, m_context->enableVertexAttribArray(triangleIndexAttribLocation()));
}
} // namespace cc
| {
"content_hash": "211c46cc57e440453942f99523823031",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 140,
"avg_line_length": 50.38235294117647,
"alnum_prop": 0.642148277875073,
"repo_name": "zcbenz/cefode-chromium",
"id": "e69e537dc72b19ff8cd901354053b6d214607312",
"size": "3834",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cc/geometry_binding.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "853"
},
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "1174304"
},
{
"name": "Awk",
"bytes": "9519"
},
{
"name": "C",
"bytes": "76026099"
},
{
"name": "C#",
"bytes": "1132"
},
{
"name": "C++",
"bytes": "157904700"
},
{
"name": "DOT",
"bytes": "1559"
},
{
"name": "F#",
"bytes": "381"
},
{
"name": "Java",
"bytes": "3225038"
},
{
"name": "JavaScript",
"bytes": "18180217"
},
{
"name": "Logos",
"bytes": "4517"
},
{
"name": "Matlab",
"bytes": "5234"
},
{
"name": "Objective-C",
"bytes": "7139426"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "Perl",
"bytes": "932901"
},
{
"name": "Python",
"bytes": "8654916"
},
{
"name": "R",
"bytes": "262"
},
{
"name": "Ragel in Ruby Host",
"bytes": "3621"
},
{
"name": "Shell",
"bytes": "1533012"
},
{
"name": "Tcl",
"bytes": "277077"
},
{
"name": "XML",
"bytes": "13493"
}
],
"symlink_target": ""
} |
<?php
/**
* Class hello_world3
*
* Object-oriented plugin
*
* HTML for module can be found in /chmp/documentation/Example_modules.html
*
*/
class chmp_plugin_hello_world3 {
private $chmp_plugin_vars,$chmp_plugin_content;
/**
* @var array
*/
private $chmp_plugin_settings;
/**
* @param array $chmp_plugin_vars
* @param string|null $chmp_plugin_content
* @param array $chmp_plugin_settings
*/
function __construct($chmp_plugin_vars, $chmp_plugin_content, $chmp_plugin_settings = array()) {
$this->chmp_plugin_vars = $chmp_plugin_vars;
$this->chmp_plugin_content = $chmp_plugin_content;
$this->chmp_plugin_settings = $chmp_plugin_settings;
}
/**
* Just a test
* @return string
*/
private function test_table() {
extract($this->chmp_plugin_settings);
$out = '<table>
<tr>
<td>Text:</td>
<td>'.$text.'</td>
</tr>
<tr>
<td>Textarea:</td>
<td>'.$textarea.'</td>
</tr>
<tr>
<td>Checkbox:</td>
<td>'.($checkbox == 'true' ? 'Yes':'No').'</td>
</tr>
<tr>
<td>Number:</td>
<td>'.floatval($number).'</td>
</tr>
<tr>
<td>Select:</td>
<td>'.$select.'</td>
</tr>
</table>';
return $out;
}
/**
* THIS IS REQUIRED for all plugins
* Replaces the plugin tag
* @return string
*/
public function show_plugin() {
return $this->test_table();
}
} | {
"content_hash": "2d2eb30a39ffb13348faa66cf9ac9555",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 97,
"avg_line_length": 18.972972972972972,
"alnum_prop": 0.5698005698005698,
"repo_name": "Krillko/chmp",
"id": "5986e4967d8a5fbcb5cbb54738e372643c39d12e",
"size": "1404",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chmp/plugins/chmp_plugin_hello_world3.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "43736"
},
{
"name": "JavaScript",
"bytes": "147235"
},
{
"name": "PHP",
"bytes": "189388"
}
],
"symlink_target": ""
} |
import { Injectable } from '@angular/core';
import { AbstractControl, FormArray, FormGroup } from '@angular/forms';
import { filter } from 'rxjs/operators/filter';
import { Subject } from 'rxjs/Subject';
import * as Ajv from 'ajv';
import * as _ from 'lodash';
import {
hasValue, isArray, isDefined, isEmpty, isObject, isString
} from './shared/validator.functions';
import {
fixTitle, forEach, hasOwn, toTitleCase
} from './shared/utility.functions';
import { JsonPointer } from './shared/jsonpointer.functions';
import {
buildSchemaFromData, buildSchemaFromLayout, removeRecursiveReferences,
resolveSchemaReferences
} from './shared/json-schema.functions';
import {
buildFormGroup, buildFormGroupTemplate, formatFormData, getControl
} from './shared/form-group.functions';
import { buildLayout, getLayoutNode } from './shared/layout.functions';
import { enValidationMessages } from './locale/en-validation-messages';
import { frValidationMessages } from './locale/fr-validation-messages';
export interface TitleMapItem {
name?: string, value?: any, checked?: boolean, group?: string, items?: TitleMapItem[]
};
export interface ErrorMessages {
[control_name: string]: { message: string|Function|Object, code: string }[]
};
@Injectable()
export class JsonSchemaFormService {
JsonFormCompatibility = false;
ReactJsonSchemaFormCompatibility = false;
AngularSchemaFormCompatibility = false;
tpldata: any = {};
ajvOptions: any = { allErrors: true, jsonPointers: true, unknownFormats: 'ignore' };
ajv: any = new Ajv(this.ajvOptions); // AJV: Another JSON Schema Validator
validateFormData: any = null; // Compiled AJV function to validate active form's schema
formValues: any = {}; // Internal form data (may not have correct types)
data: any = {}; // Output form data (formValues, formatted with correct data types)
schema: any = {}; // Internal JSON Schema
layout: any[] = []; // Internal form layout
formGroupTemplate: any = {}; // Template used to create formGroup
formGroup: any = null; // Angular formGroup, which powers the reactive form
framework: any = null; // Active framework component
formOptions: any; // Active options, used to configure the form
validData: any = null; // Valid form data (or null) (=== isValid ? data : null)
isValid: boolean = null; // Is current form data valid?
ajvErrors: any = null; // Ajv errors for current data
validationErrors: any = null; // Any validation errors for current data
dataErrors: any = new Map(); //
formValueSubscription: any = null; // Subscription to formGroup.valueChanges observable (for un- and re-subscribing)
dataChanges: Subject<any> = new Subject(); // Form data observable
isValidChanges: Subject<any> = new Subject(); // isValid observable
validationErrorChanges: Subject<any> = new Subject(); // validationErrors observable
arrayMap: Map<string, number> = new Map(); // Maps arrays in data object and number of tuple values
dataMap: Map<string, any> = new Map(); // Maps paths in form data to schema and formGroup paths
dataRecursiveRefMap: Map<string, string> = new Map(); // Maps recursive reference points in form data
schemaRecursiveRefMap: Map<string, string> = new Map(); // Maps recursive reference points in schema
schemaRefLibrary: any = {}; // Library of schemas for resolving schema $refs
layoutRefLibrary: any = { '': null }; // Library of layout nodes for adding to form
templateRefLibrary: any = {}; // Library of formGroup templates for adding to form
hasRootReference = false; // Does the form include a recursive reference to itself?
language = 'en-US'; // Does the form include a recursive reference to itself?
// Default global form options
defaultFormOptions: any = {
addSubmit: 'auto', // Add a submit button if layout does not have one?
// for addSubmit: true = always, false = never,
// 'auto' = only if layout is undefined (form is built from schema alone)
debug: false, // Show debugging output?
disableInvalidSubmit: true, // Disable submit if form invalid?
formDisabled: false, // Set entire form as disabled? (not editable, and disables outputs)
formReadonly: false, // Set entire form as read only? (not editable, but outputs still enabled)
fieldsRequired: false, // (set automatically) Are there any required fields in the form?
framework: 'no-framework', // The framework to load
loadExternalAssets: false, // Load external css and JavaScript for framework?
pristine: { errors: true, success: true },
supressPropertyTitles: false,
setSchemaDefaults: 'auto', // Set fefault values from schema?
// true = always set (unless overridden by layout default or formValues)
// false = never set
// 'auto' = set in addable components, and everywhere if formValues not set
setLayoutDefaults: 'auto', // Set fefault values from layout?
// true = always set (unless overridden by formValues)
// false = never set
// 'auto' = set in addable components, and everywhere if formValues not set
validateOnRender: 'auto', // Validate fields immediately, before they are touched?
// true = validate all fields immediately
// false = only validate fields after they are touched by user
// 'auto' = validate fields with values immediately, empty fields after they are touched
widgets: {}, // Any custom widgets to load
defautWidgetOptions: { // Default options for form control widgets
listItems: 1, // Number of list items to initially add to arrays with no default value
addable: true, // Allow adding items to an array or $ref point?
orderable: true, // Allow reordering items within an array?
removable: true, // Allow removing items from an array or $ref point?
enableErrorState: true, // Apply 'has-error' class when field fails validation?
// disableErrorState: false, // Don't apply 'has-error' class when field fails validation?
enableSuccessState: true, // Apply 'has-success' class when field validates?
// disableSuccessState: false, // Don't apply 'has-success' class when field validates?
feedback: false, // Show inline feedback icons?
feedbackOnRender: false, // Show errorMessage on Render?
notitle: false, // Hide title?
disabled: false, // Set control as disabled? (not editable, and excluded from output)
readonly: false, // Set control as read only? (not editable, but included in output)
returnEmptyFields: true, // return values for fields that contain no data?
validationMessages: {} // set by setLanguage()
},
};
constructor() {
this.setLanguage(this.language);
}
setLanguage(language: string = 'en-US') {
this.language = language;
const validationMessages = language.slice(0, 2) === 'fr' ?
frValidationMessages : enValidationMessages;
this.defaultFormOptions.defautWidgetOptions.validationMessages =
_.cloneDeep(validationMessages);
}
getData() { return this.data; }
getSchema() { return this.schema; }
getLayout() { return this.layout; }
resetAllValues() {
this.JsonFormCompatibility = false;
this.ReactJsonSchemaFormCompatibility = false;
this.AngularSchemaFormCompatibility = false;
this.tpldata = {};
this.validateFormData = null;
this.formValues = {};
this.schema = {};
this.layout = [];
this.formGroupTemplate = {};
this.formGroup = null;
this.framework = null;
this.data = {};
this.validData = null;
this.isValid = null;
this.validationErrors = null;
this.arrayMap = new Map();
this.dataMap = new Map();
this.dataRecursiveRefMap = new Map();
this.schemaRecursiveRefMap = new Map();
this.layoutRefLibrary = {};
this.schemaRefLibrary = {};
this.templateRefLibrary = {};
this.formOptions = _.cloneDeep(this.defaultFormOptions);
}
/**
* 'buildRemoteError' function
*
* Example errors:
* {
* last_name: [ {
* message: 'Last name must by start with capital letter.',
* code: 'capital_letter'
* } ],
* email: [ {
* message: 'Email must be from example.com domain.',
* code: 'special_domain'
* }, {
* message: 'Email must contain an @ symbol.',
* code: 'at_symbol'
* } ]
* }
* @param {ErrorMessages} errors
*/
buildRemoteError(errors: ErrorMessages) {
forEach(errors, (value, key) => {
if (key in this.formGroup.controls) {
for (const error of value) {
const err = {};
err[error['code']] = error['message'];
this.formGroup.get(key).setErrors(err, { emitEvent: true });
}
}
});
}
validateData(newValue: any, updateSubscriptions = true): void {
// Format raw form data to correct data types
this.data = formatFormData(
newValue, this.dataMap, this.dataRecursiveRefMap,
this.arrayMap, this.formOptions.returnEmptyFields
);
this.isValid = this.validateFormData(this.data);
this.validData = this.isValid ? this.data : null;
const compileErrors = errors => {
const compiledErrors = {};
(errors || []).forEach(error => {
if (!compiledErrors[error.dataPath]) { compiledErrors[error.dataPath] = []; }
compiledErrors[error.dataPath].push(error.message);
});
return compiledErrors;
};
this.ajvErrors = this.validateFormData.errors;
this.validationErrors = compileErrors(this.validateFormData.errors);
if (updateSubscriptions) {
this.dataChanges.next(this.data);
this.isValidChanges.next(this.isValid);
this.validationErrorChanges.next(this.ajvErrors);
}
}
buildFormGroupTemplate(formValues: any = null, setValues = true) {
this.formGroupTemplate = buildFormGroupTemplate(this, formValues, setValues);
}
buildFormGroup() {
this.formGroup = <FormGroup>buildFormGroup(this.formGroupTemplate);
if (this.formGroup) {
this.compileAjvSchema();
this.validateData(this.formGroup.value);
// Set up observables to emit data and validation info when form data changes
if (this.formValueSubscription) { this.formValueSubscription.unsubscribe(); }
this.formValueSubscription = this.formGroup.valueChanges
.subscribe(formValue => this.validateData(formValue));
}
}
buildLayout(widgetLibrary: any) {
this.layout = buildLayout(this, widgetLibrary);
}
setOptions(newOptions: any) {
if (isObject(newOptions)) {
const addOptions = _.cloneDeep(newOptions);
// Backward compatibility for 'defaultOptions' (renamed 'defautWidgetOptions')
if (isObject(addOptions.defaultOptions)) {
Object.assign(this.formOptions.defautWidgetOptions, addOptions.defaultOptions);
delete addOptions.defaultOptions;
}
if (isObject(addOptions.defautWidgetOptions)) {
Object.assign(this.formOptions.defautWidgetOptions, addOptions.defautWidgetOptions);
delete addOptions.defautWidgetOptions;
}
Object.assign(this.formOptions, addOptions);
// convert disableErrorState / disableSuccessState to enable...
const globalDefaults = this.formOptions.defautWidgetOptions;
['ErrorState', 'SuccessState']
.filter(suffix => hasOwn(globalDefaults, 'disable' + suffix))
.forEach(suffix => {
globalDefaults['enable' + suffix] = !globalDefaults['disable' + suffix];
delete globalDefaults['disable' + suffix];
});
}
}
compileAjvSchema() {
if (!this.validateFormData) {
// if 'ui:order' exists in properties, move it to root before compiling with ajv
if (Array.isArray(this.schema.properties['ui:order'])) {
this.schema['ui:order'] = this.schema.properties['ui:order'];
delete this.schema.properties['ui:order'];
}
this.ajv.removeSchema(this.schema);
this.validateFormData = this.ajv.compile(this.schema);
}
}
buildSchemaFromData(data?: any, requireAllFields = false): any {
if (data) { return buildSchemaFromData(data, requireAllFields); }
this.schema = buildSchemaFromData(this.formValues, requireAllFields);
}
buildSchemaFromLayout(layout?: any): any {
if (layout) { return buildSchemaFromLayout(layout); }
this.schema = buildSchemaFromLayout(this.layout);
}
setTpldata(newTpldata: any = {}): void {
this.tpldata = newTpldata;
}
parseText(
text = '', value: any = {}, values: any = {}, key: number|string = null
): string {
if (!text || !/{{.+?}}/.test(text)) { return text; }
return text.replace(/{{(.+?)}}/g, (...a) =>
this.parseExpression(a[1], value, values, key, this.tpldata)
);
}
parseExpression(
expression = '', value: any = {}, values: any = {},
key: number|string = null, tpldata: any = null
) {
if (typeof expression !== 'string') { return ''; }
const index = typeof key === 'number' ? (key + 1) + '' : (key || '');
expression = expression.trim();
if ((expression[0] === "'" || expression[0] === '"') &&
expression[0] === expression[expression.length - 1] &&
expression.slice(1, expression.length - 1).indexOf(expression[0]) === -1
) {
return expression.slice(1, expression.length - 1);
}
if (expression === 'idx' || expression === '$index') { return index; }
if (expression === 'value' && !hasOwn(values, 'value')) { return value; }
if (['"', "'", ' ', '||', '&&', '+'].every(delim => expression.indexOf(delim) === -1)) {
const pointer = JsonPointer.parseObjectPath(expression);
return pointer[0] === 'value' && JsonPointer.has(value, pointer.slice(1)) ?
JsonPointer.get(value, pointer.slice(1)) :
pointer[0] === 'values' && JsonPointer.has(values, pointer.slice(1)) ?
JsonPointer.get(values, pointer.slice(1)) :
pointer[0] === 'tpldata' && JsonPointer.has(tpldata, pointer.slice(1)) ?
JsonPointer.get(tpldata, pointer.slice(1)) :
JsonPointer.has(values, pointer) ? JsonPointer.get(values, pointer) : '';
}
if (expression.indexOf('[idx]') > -1) {
expression = expression.replace(/\[idx\]/g, <string>index);
}
if (expression.indexOf('[$index]') > -1) {
expression = expression.replace(/\[$index\]/g, <string>index);
}
// TODO: Improve expression evaluation by parsing quoted strings first
// let expressionArray = expression.match(/([^"']+|"[^"]+"|'[^']+')/g);
if (expression.indexOf('||') > -1) {
return expression.split('||').reduce((all, term) =>
all || this.parseExpression(term, value, values, key, tpldata), ''
);
}
if (expression.indexOf('&&') > -1) {
return expression.split('&&').reduce((all, term) =>
all && this.parseExpression(term, value, values, key, tpldata), ' '
).trim();
}
if (expression.indexOf('+') > -1) {
return expression.split('+')
.map(term => this.parseExpression(term, value, values, key, tpldata))
.join('');
}
return '';
}
setArrayItemTitle(
parentCtx: any = {}, childNode: any = null, index: number = null
): string {
const parentNode = parentCtx.layoutNode;
const parentValues: any = this.getFormControlValue(parentCtx);
const isArrayItem =
(parentNode.type || '').slice(-5) === 'array' && isArray(parentValues);
const text = JsonPointer.getFirst(
isArrayItem && childNode.type !== '$ref' ? [
[childNode, '/options/legend'],
[childNode, '/options/title'],
[parentNode, '/options/title'],
[parentNode, '/options/legend'],
] : [
[childNode, '/options/title'],
[childNode, '/options/legend'],
[parentNode, '/options/title'],
[parentNode, '/options/legend']
]
);
if (!text) { return text; }
const childValue = isArray(parentValues) && index < parentValues.length ?
parentValues[index] : parentValues;
return this.parseText(text, childValue, parentValues, index);
}
setItemTitle(ctx: any) {
return !ctx.options.title && /^(\d+|-)$/.test(ctx.layoutNode.name) ?
null :
this.parseText(
ctx.options.title || toTitleCase(ctx.layoutNode.name),
this.getFormControlValue(this),
(this.getFormControlGroup(this) || <any>{}).value,
ctx.dataIndex[ctx.dataIndex.length - 1]
);
}
evaluateCondition(layoutNode: any, dataIndex: number[]): boolean {
const arrayIndex = dataIndex && dataIndex[dataIndex.length - 1];
let result = true;
if (hasValue((layoutNode.options || {}).condition)) {
if (typeof layoutNode.options.condition === 'string') {
let pointer = layoutNode.options.condition
if (hasValue(arrayIndex)) {
pointer = pointer.replace('[arrayIndex]', `[${arrayIndex}]`);
}
pointer = JsonPointer.parseObjectPath(pointer);
result = !!JsonPointer.get(this.data, pointer);
if (!result && pointer[0] === 'model') {
result = !!JsonPointer.get({ model: this.data }, pointer);
}
} else if (typeof layoutNode.options.condition === 'function') {
result = layoutNode.options.condition(this.data);
} else if (typeof layoutNode.options.condition.functionBody === 'string') {
try {
const dynFn = new Function(
'model', 'arrayIndices', layoutNode.options.condition.functionBody
);
result = dynFn(this.data, dataIndex);
} catch (e) {
result = true;
console.error("condition functionBody errored out on evaluation: " + layoutNode.options.condition.functionBody);
}
}
}
return result;
}
initializeControl(ctx: any, bind = true): boolean {
if (!isObject(ctx)) { return false; }
if (isEmpty(ctx.options)) {
ctx.options = !isEmpty((ctx.layoutNode || {}).options) ?
ctx.layoutNode.options : _.cloneDeep(this.formOptions);
}
ctx.formControl = this.getFormControl(ctx);
ctx.boundControl = bind && !!ctx.formControl;
if (ctx.formControl) {
ctx.controlName = this.getFormControlName(ctx);
ctx.controlValue = ctx.formControl.value;
ctx.controlDisabled = ctx.formControl.disabled;
ctx.options.errorMessage = ctx.formControl.status === 'VALID' ? null :
this.formatErrors(ctx.formControl.errors, ctx.options.validationMessages);
ctx.options.showErrors = this.formOptions.validateOnRender === true ||
(this.formOptions.validateOnRender === 'auto' && hasValue(ctx.controlValue));
ctx.formControl.statusChanges.subscribe(status =>
ctx.options.errorMessage = status === 'VALID' ? null :
this.formatErrors(ctx.formControl.errors, ctx.options.validationMessages)
);
ctx.formControl.valueChanges.subscribe(value => {
if (!_.isEqual(ctx.controlValue, value)) { ctx.controlValue = value }
});
} else {
ctx.controlName = ctx.layoutNode.name;
ctx.controlValue = ctx.layoutNode.value || null;
const dataPointer = this.getDataPointer(ctx);
if (bind && dataPointer) {
console.error(`warning: control "${dataPointer}" is not bound to the Angular FormGroup.`);
}
}
return ctx.boundControl;
}
formatErrors(errors: any, validationMessages: any = {}): string {
if (isEmpty(errors)) { return null; }
if (!isObject(validationMessages)) { validationMessages = {}; }
const addSpaces = string => string[0].toUpperCase() + (string.slice(1) || '')
.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/_/g, ' ');
const formatError = (error) => typeof error === 'object' ?
Object.keys(error).map(key =>
error[key] === true ? addSpaces(key) :
error[key] === false ? 'Not ' + addSpaces(key) :
addSpaces(key) + ': ' + formatError(error[key])
).join(', ') :
addSpaces(error.toString());
const messages = [];
return Object.keys(errors)
// Hide 'required' error, unless it is the only one
.filter(errorKey => errorKey !== 'required' || Object.keys(errors).length === 1)
.map(errorKey =>
// If validationMessages is a string, return it
typeof validationMessages === 'string' ? validationMessages :
// If custom error message is a function, return function result
typeof validationMessages[errorKey] === 'function' ?
validationMessages[errorKey](errors[errorKey]) :
// If custom error message is a string, replace placeholders and return
typeof validationMessages[errorKey] === 'string' ?
// Does error message have any {{property}} placeholders?
!/{{.+?}}/.test(validationMessages[errorKey]) ?
validationMessages[errorKey] :
// Replace {{property}} placeholders with values
Object.keys(errors[errorKey])
.reduce((errorMessage, errorProperty) => errorMessage.replace(
new RegExp('{{' + errorProperty + '}}', 'g'),
errors[errorKey][errorProperty]
), validationMessages[errorKey]) :
// If no custom error message, return formatted error data instead
addSpaces(errorKey) + ' Error: ' + formatError(errors[errorKey])
).join('<br>');
}
updateValue(ctx: any, value: any): void {
// Set value of current control
ctx.controlValue = value;
if (ctx.boundControl) {
ctx.formControl.setValue(value);
ctx.formControl.markAsDirty();
}
ctx.layoutNode.value = value;
// Set values of any related controls in copyValueTo array
if (isArray(ctx.options.copyValueTo)) {
for (const item of ctx.options.copyValueTo) {
const targetControl = getControl(this.formGroup, item);
if (isObject(targetControl) && typeof targetControl.setValue === 'function') {
targetControl.setValue(value);
targetControl.markAsDirty();
}
}
}
}
updateArrayCheckboxList(ctx: any, checkboxList: TitleMapItem[]): void {
const formArray = <FormArray>this.getFormControl(ctx);
// Remove all existing items
while (formArray.value.length) { formArray.removeAt(0); }
// Re-add an item for each checked box
const refPointer = removeRecursiveReferences(
ctx.layoutNode.dataPointer + '/-', this.dataRecursiveRefMap, this.arrayMap
);
for (const checkboxItem of checkboxList) {
if (checkboxItem.checked) {
const newFormControl = buildFormGroup(this.templateRefLibrary[refPointer]);
newFormControl.setValue(checkboxItem.value);
formArray.push(newFormControl);
}
}
formArray.markAsDirty();
}
getFormControl(ctx: any): AbstractControl {
if (
!ctx.layoutNode || !isDefined(ctx.layoutNode.dataPointer) ||
ctx.layoutNode.type === '$ref'
) { return null; }
return getControl(this.formGroup, this.getDataPointer(ctx));
}
getFormControlValue(ctx: any): AbstractControl {
if (
!ctx.layoutNode || !isDefined(ctx.layoutNode.dataPointer) ||
ctx.layoutNode.type === '$ref'
) { return null; }
const control = getControl(this.formGroup, this.getDataPointer(ctx));
return control ? control.value : null;
}
getFormControlGroup(ctx: any): FormArray | FormGroup {
if (!ctx.layoutNode || !isDefined(ctx.layoutNode.dataPointer)) { return null; }
return getControl(this.formGroup, this.getDataPointer(ctx), true);
}
getFormControlName(ctx: any): string {
if (
!ctx.layoutNode || !isDefined(ctx.layoutNode.dataPointer) || !hasValue(ctx.dataIndex)
) { return null; }
return JsonPointer.toKey(this.getDataPointer(ctx));
}
getLayoutArray(ctx: any): any[] {
return JsonPointer.get(this.layout, this.getLayoutPointer(ctx), 0, -1);
}
getParentNode(ctx: any): any {
return JsonPointer.get(this.layout, this.getLayoutPointer(ctx), 0, -2);
}
getDataPointer(ctx: any): string {
if (
!ctx.layoutNode || !isDefined(ctx.layoutNode.dataPointer) || !hasValue(ctx.dataIndex)
) { return null; }
return JsonPointer.toIndexedPointer(
ctx.layoutNode.dataPointer, ctx.dataIndex, this.arrayMap
);
}
getLayoutPointer(ctx: any): string {
if (!hasValue(ctx.layoutIndex)) { return null; }
return '/' + ctx.layoutIndex.join('/items/');
}
isControlBound(ctx: any): boolean {
if (
!ctx.layoutNode || !isDefined(ctx.layoutNode.dataPointer) || !hasValue(ctx.dataIndex)
) { return false; }
const controlGroup = this.getFormControlGroup(ctx);
const name = this.getFormControlName(ctx);
return controlGroup ? hasOwn(controlGroup.controls, name) : false;
}
addItem(ctx: any, name?: string): boolean {
if (
!ctx.layoutNode || !isDefined(ctx.layoutNode.$ref) ||
!hasValue(ctx.dataIndex) || !hasValue(ctx.layoutIndex)
) { return false; }
// Create a new Angular form control from a template in templateRefLibrary
const newFormGroup = buildFormGroup(this.templateRefLibrary[ctx.layoutNode.$ref]);
// Add the new form control to the parent formArray or formGroup
if (ctx.layoutNode.arrayItem) { // Add new array item to formArray
(<FormArray>this.getFormControlGroup(ctx)).push(newFormGroup);
} else { // Add new $ref item to formGroup
(<FormGroup>this.getFormControlGroup(ctx))
.addControl(name || this.getFormControlName(ctx), newFormGroup);
}
// Copy a new layoutNode from layoutRefLibrary
const newLayoutNode = getLayoutNode(ctx.layoutNode, this);
newLayoutNode.arrayItem = ctx.layoutNode.arrayItem;
if (ctx.layoutNode.arrayItemType) {
newLayoutNode.arrayItemType = ctx.layoutNode.arrayItemType;
} else {
delete newLayoutNode.arrayItemType;
}
if (name) {
newLayoutNode.name = name;
newLayoutNode.dataPointer += '/' + JsonPointer.escape(name);
newLayoutNode.options.title = fixTitle(name);
}
// Add the new layoutNode to the form layout
JsonPointer.insert(this.layout, this.getLayoutPointer(ctx), newLayoutNode);
return true;
}
moveArrayItem(ctx: any, oldIndex: number, newIndex: number): boolean {
if (
!ctx.layoutNode || !isDefined(ctx.layoutNode.dataPointer) ||
!hasValue(ctx.dataIndex) || !hasValue(ctx.layoutIndex) ||
!isDefined(oldIndex) || !isDefined(newIndex) || oldIndex === newIndex
) { return false; }
// Move item in the formArray
const formArray = <FormArray>this.getFormControlGroup(ctx);
const arrayItem = formArray.at(oldIndex);
formArray.removeAt(oldIndex);
formArray.insert(newIndex, arrayItem);
formArray.updateValueAndValidity();
// Move layout item
const layoutArray = this.getLayoutArray(ctx);
layoutArray.splice(newIndex, 0, layoutArray.splice(oldIndex, 1)[0]);
return true;
}
removeItem(ctx: any): boolean {
if (
!ctx.layoutNode || !isDefined(ctx.layoutNode.dataPointer) ||
!hasValue(ctx.dataIndex) || !hasValue(ctx.layoutIndex)
) { return false; }
// Remove the Angular form control from the parent formArray or formGroup
if (ctx.layoutNode.arrayItem) { // Remove array item from formArray
(<FormArray>this.getFormControlGroup(ctx))
.removeAt(ctx.dataIndex[ctx.dataIndex.length - 1]);
} else { // Remove $ref item from formGroup
(<FormGroup>this.getFormControlGroup(ctx))
.removeControl(this.getFormControlName(ctx));
}
// Remove layoutNode from layout
JsonPointer.remove(this.layout, this.getLayoutPointer(ctx));
return true;
}
}
| {
"content_hash": "78e8162564d198e0b740ad06b6219c4d",
"timestamp": "",
"source": "github",
"line_count": 675,
"max_line_length": 122,
"avg_line_length": 40.83111111111111,
"alnum_prop": 0.6566162330829796,
"repo_name": "dschnelldavis/angular2-json-schema-form",
"id": "372f51c2eae52441788770141913ec49490ff181",
"size": "27561",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/lib/src/json-schema-form.service.ts",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1739"
},
{
"name": "HTML",
"bytes": "8231"
},
{
"name": "JavaScript",
"bytes": "11666"
},
{
"name": "TypeScript",
"bytes": "499885"
}
],
"symlink_target": ""
} |
<?php
/**
* A view that accept themes system
*
* @package dinThemePlugin
* @subpackage lib.view
* @author Nicolay N. Zyk <relo.san@gmail.com>
*/
class dinThemeView extends dinHamlView
{
/**
* @var array Layout slots holder
*/
protected $slotHolder = null;
/**
* @var object Template variables holder
*/
protected $varHolder = null;
/**
* @var string Theme name
*/
protected $theme = null;
/**
* @var string Theme path's
*/
protected
$themePath = null,
$layoutPath = null,
$modulePath = null;
/**
* Configures template
*
* @return void
*/
public function configure()
{
$this->configureHaml();
// store our current view
$this->context->set( 'view_instance', $this );
// require our configuration
require( $this->context->getConfigCache()->checkConfig(
'modules/' . $this->moduleName . '/config/view.yml'
) );
require( $this->context->getConfigCache()->checkConfig(
'modules/' . $this->moduleName . '/config/layout.yml'
) );
$this->varHolder = new sfParameterHolder();
$this->slotHolder = array();
// set theme configuration
$this->theme = $theme = sfConfig::get( 'app_view_theme', 'default' );
$app_dir = sfConfig::get( 'sf_app_dir' );
$this->themePath = sfConfig::get( 'theme_' . $theme . '_path', '/themes/' . $theme );
$this->layoutPath = $app_dir . $this->themePath
. sfConfig::get( 'theme_' . $theme . '_layout_path', '/layouts' ) . '/';
$this->modulePath = $app_dir . $this->themePath
. sfConfig::get( 'theme_' . $theme . '_module_path', '/modules') . '/'
. $this->moduleName;
// set template directory
if ( !$this->directory )
{
$this->setDirectory( $this->modulePath );
$this->setDecoratorDirectory( $this->layoutPath );
}
} // dinThemeView::configure()
/**
* Build output
*
* @param string $content Action content
* @return string Output string
*/
protected function decorate( $content )
{
if ( sfConfig::get( 'sf_logging_enabled' ) )
{
$this->dispatcher->notify( new sfEvent(
$this, 'application.log',
array( sprintf( 'Build layout for "%s/%s"', $this->moduleName, $this->actionName ) )
) );
}
// add rendered action to slot
$action = sfConfig::get( 'theme_' . $this->theme . '_action', array() );
$action['order'] = isset( $action['order'] ) ? $action['order'] : 1;
$this->setLayoutSlot( $action['parent'], $action['slot'], $content, $action['order'] );
// build layout
return $this->buildLayout();
} // dinThemeView::decorate()
/**
* Build layout content
*
* @return string Output string
*/
protected function buildLayout()
{
// build components
$components = sfConfig::get( 'theme_' . $this->theme . '_components', array() );
foreach ( $components as $component => $actions )
{
foreach ( $actions as $action => $params )
{
if ( strpos( $action, '.' ) !== false )
{
$action = substr( $action, 0, strpos( $action, '.' ) );
}
$params['vars'] = isset( $params['vars'] ) ? $params['vars'] : array();
$params['order'] = isset( $params['order'] ) ? $params['order'] : 1;
$this->setLayoutSlot(
$params['layout'], $params['slot'],
$this->renderComponent( $component, $action, $params['vars'] ),
$params['order']
);
}
}
// build layouts
$layouts = sfConfig::get( 'theme_' . $this->theme . '_layouts', array() );
foreach( $layouts as $layout => $params )
{
if ( $layout == 'layout' )
{
$base = $params;
continue;
}
$params['order'] = isset( $params['order'] ) ? $params['order'] : 1;
$params['vars'] = isset( $params['vars'] ) ? $params['vars'] : array();
$this->setLayoutSlot(
$params['parent'], $params['slot'],
$this->renderLayout( $this->layoutPath . $layout . $this->extension, $params['vars'] ),
$params['order']
);
}
// build base layout
$base['vars'] = isset( $base['vars'] ) ? $base['vars'] : array();
return $this->renderLayout( $this->layoutPath . 'layout' . $this->extension, $base['vars'] );
} // dinThemeView::buildLayout()
/**
* Rendering component
*
* @param string $moduleName Module name
* @param string $componentName Component name
* @param array $params Component params
* @return string Rendered component content
*/
public function renderComponent( $moduleName, $componentName, $params )
{
$actionName = '_' . $componentName;
$view = new dinThemePartialView( $this->context, $moduleName, $actionName, '' );
$view->setPartialVars( $params );
if ( $retval = $view->getCache() )
{
return $retval;
}
$allVars = $this->callComponent( $moduleName, $componentName, $params );
if ( !is_null( $allVars ) )
{
// render
$view->getAttributeHolder()->add( $allVars );
return $view->render();
}
} // dinThemeView::renderComponent()
/**
* Calling component
*
* @param string $moduleName Module name
* @param string $componentName Component name
* @param array $params Component params
* @return array Component vars
* @throws sfInitializationException If component not exist
*/
protected function callComponent( $moduleName, $componentName, $params = array() )
{
$controller = $this->context->getController();
if ( !$controller->componentExists( $moduleName, $componentName ) )
{
// cannot find component
throw new sfConfigurationException( sprintf(
'The component does not exist: "%s", "%s".', $moduleName, $componentName
) );
}
$componentInstance = $controller->getComponent( $moduleName, $componentName );
$componentInstance->getVarHolder()->add( $params );
// load modules config
require( $this->context->getConfigCache()->checkConfig(
'modules/' . $moduleName . '/config/module.yml'
) );
// dispatch component
$componentToRun = 'execute' . ucfirst( $componentName );
if ( !method_exists( $componentInstance, $componentToRun ) )
{
if ( !method_exists( $componentInstance, 'execute' ) )
{
// component not found
throw new sfInitializationException( sprintf(
'sfComponent initialization failed for module "%s", component "%s".',
$moduleName, $componentName
) );
}
$componentToRun = 'execute';
}
if ( sfConfig::get( 'sf_logging_enabled' ) )
{
$this->context->getEventDispatcher()->notify( new sfEvent( null, 'application.log', array(
sprintf( 'Call "%s->%s()' . '"', $moduleName, $componentToRun )
) ) );
}
// run component
if ( sfConfig::get( 'sf_debug' ) && sfConfig::get( 'sf_logging_enabled' ) )
{
$timer = sfTimerManager::getTimer(
sprintf( 'Component "%s/%s"', $moduleName, $componentName )
);
}
$retval = $componentInstance->$componentToRun( $this->context->getRequest() );
if ( sfConfig::get( 'sf_debug' ) && sfConfig::get( 'sf_logging_enabled' ) )
{
$timer->addTime();
}
return sfView::NONE == $retval ? null : $componentInstance->getVarHolder()->getAll();
} // dinThemeView::callComponent()
/**
* Render layout
*
* @param string $layoutFile Layout filepath
* @param array $params Component params
* @return string Rendered layout content
*/
protected function renderLayout( $layoutFile, $params )
{
$attributeHolder = $this->attributeHolder;
$this->attributeHolder = $this->initializeAttributeHolder( $params );
$this->attributeHolder->set( 'sf_type', 'layout' );
$ret = $this->renderFile( $layoutFile );
$this->attributeHolder = $attributeHolder;
return $ret;
} // dinThemeView::renderLayout()
/**
* Set slot content for layout
*
* @param string $layoutName Layout name
* @param string $slotName Slot name
* @param string $content Rendered content
* @param integer $order Order of slot position [optional]
* @return void
*/
public function setLayoutSlot( $layoutName, $slotName, $content, $order = 1 )
{
$this->slotHolder[$layoutName][$slotName][$order] = $content;
} // dinThemeView::setLayoutSlot()
/**
* Get slot content for layout
*
* @param string $layoutName Layout name
* @param string $slotName Slot name
* @return string Slot content
*/
public function getLayoutSlot( $layoutName, $slotName )
{
if ( isset( $this->slotHolder[$layoutName][$slotName] ) )
{
ksort( $this->slotHolder[$layoutName][$slotName] );
return implode( '', $this->slotHolder[$layoutName][$slotName] );
}
return '';
} // dinThemeView::getLayoutSlot()
} // dinThemeView
//EOF | {
"content_hash": "d22a87ac5926f14d5cac8e368b26e842",
"timestamp": "",
"source": "github",
"line_count": 331,
"max_line_length": 103,
"avg_line_length": 31.522658610271904,
"alnum_prop": 0.5066129959746981,
"repo_name": "relo-san/dinThemePlugin",
"id": "74798ce884b859194f2adbfbb8e5f529e8ad967f",
"size": "10715",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/view/dinThemeView.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "33571"
}
],
"symlink_target": ""
} |
"use strict";
! function(root, factory) {
if ("function" === typeof define && define.amd) {
define(function(require) {
factory(require("devextreme/localization"))
})
} else {
if ("object" === typeof module && module.exports) {
factory(require("devextreme/localization"))
} else {
factory(DevExpress.localization)
}
}
}(this, function(localization) {
localization.loadMessages({
pt: {
Yes: "Sim",
No: "N\xe3o",
Cancel: "Cancelar",
Clear: "Limpar",
Done: "Conclu\xeddo",
Loading: "Carregando ...",
Select: "Selecione ...",
Search: "Pesquisar ...",
Back: "Voltar",
OK: "OK",
"dxCollectionWidget-noDataText": "Sem dados",
"dxDropDownEditor-selectLabel": "Selecione",
"validation-required": "Preenchimento obrigat\xf3rio",
"validation-required-formatted": "{0} \xe9 de preenchimento obrigat\xf3rio",
"validation-numeric": "Valor deve ser um n\xfamero",
"validation-numeric-formatted": "{0} deve ser um n\xfamero",
"validation-range": "Valor est\xe1 fora do intervalo",
"validation-range-formatted": "{0} est\xe1 fora do intervalo",
"validation-stringLength": "O comprimento do valor n\xe3o est\xe1 correto",
"validation-stringLength-formatted": "O comprimento de {0} n\xe3o est\xe1 correto",
"validation-custom": "Valor inv\xe1lido",
"validation-custom-formatted": "{0} \xe9 inv\xe1lido",
"validation-async": "Valor inv\xe1lido",
"validation-async-formatted": "{0} \xe9 inv\xe1lido",
"validation-compare": "Valores n\xe3o coincidem",
"validation-compare-formatted": "{0} n\xe3o coincidem",
"validation-pattern": "Valor n\xe3o corresponde ao padr\xe3o",
"validation-pattern-formatted": "{0} n\xe3o corresponde ao padr\xe3o",
"validation-email": "Email inv\xe1lido",
"validation-email-formatted": "{0} \xe9 inv\xe1lido",
"validation-mask": "Valor inv\xe1lido",
"dxLookup-searchPlaceholder": "N\xfamero m\xednimo de caracteres: {0}",
"dxList-pullingDownText": "Puxar para baixo para recarregar...",
"dxList-pulledDownText": "Soltar para recarregar...",
"dxList-refreshingText": "Recarregando ...",
"dxList-pageLoadingText": "A carregar ...",
"dxList-nextButtonText": "Mais",
"dxList-selectAll": "Selecionar todos",
"dxListEditDecorator-delete": "Eliminar",
"dxListEditDecorator-more": "Mais",
"dxScrollView-pullingDownText": "Puxar para baixo para recarregar...",
"dxScrollView-pulledDownText": "Soltar para recarregar...",
"dxScrollView-refreshingText": "Recarregando ...",
"dxScrollView-reachBottomText": "A carregar ...",
"dxDateBox-simulatedDataPickerTitleTime": "Selecionar hora",
"dxDateBox-simulatedDataPickerTitleDate": "Selecionar data",
"dxDateBox-simulatedDataPickerTitleDateTime": "Selecionar data e hora",
"dxDateBox-validation-datetime": "Valor deve ser uma data ou hora",
"dxFileUploader-selectFile": "Selecionar arquivo",
"dxFileUploader-dropFile": "ou Soltar arquivo aqui",
"dxFileUploader-bytes": "bytes",
"dxFileUploader-kb": "kb",
"dxFileUploader-Mb": "Mb",
"dxFileUploader-Gb": "Gb",
"dxFileUploader-upload": "Upload",
"dxFileUploader-uploaded": "Upload conclu\xeddo",
"dxFileUploader-readyToUpload": "Pronto para upload",
"dxFileUploader-uploadAbortedMessage": "TODO",
"dxFileUploader-uploadFailedMessage": "Upload falhou",
"dxFileUploader-invalidFileExtension": "Tipo de arquivo n\xe3o \xe9 permitido",
"dxFileUploader-invalidMaxFileSize": "O arquivo \xe9 muito grande",
"dxFileUploader-invalidMinFileSize": "O arquivo \xe9 muito pequeno",
"dxRangeSlider-ariaFrom": "De {0}",
"dxRangeSlider-ariaTill": "At\xe9 {0}",
"dxSwitch-switchedOnText": "LIGADO",
"dxSwitch-switchedOffText": "DESLIGADO",
"dxForm-optionalMark": "opcional",
"dxForm-requiredMessage": "{0} \xe9 de preenchimento obrigat\xf3rio",
"dxNumberBox-invalidValueMessage": "Valor deve ser um n\xfamero",
"dxNumberBox-noDataText": "Sem dados",
"dxDataGrid-columnChooserTitle": "Seletor de Colunas",
"dxDataGrid-columnChooserEmptyText": "Arraste uma coluna para at\xe9 aqui para escond\xea-la",
"dxDataGrid-groupContinuesMessage": "Continua na p\xe1gina seguinte",
"dxDataGrid-groupContinuedMessage": "Continua\xe7\xe3o da p\xe1gina anterior",
"dxDataGrid-groupHeaderText": "Agrupar pela coluna",
"dxDataGrid-ungroupHeaderText": "Remover grupo",
"dxDataGrid-ungroupAllText": "Remover todos os grupos",
"dxDataGrid-editingEditRow": "Editar",
"dxDataGrid-editingSaveRowChanges": "Salvar",
"dxDataGrid-editingCancelRowChanges": "Cancelar",
"dxDataGrid-editingDeleteRow": "Eliminar",
"dxDataGrid-editingUndeleteRow": "Recuperar",
"dxDataGrid-editingConfirmDeleteMessage": "Tem certeza que deseja eliminar este registro?",
"dxDataGrid-validationCancelChanges": "Cancelar altera\xe7\xf5es",
"dxDataGrid-groupPanelEmptyText": "Arrastar o cabe\xe7alho de uma coluna para aqui para agrupar por essa coluna",
"dxDataGrid-noDataText": "Sem dados",
"dxDataGrid-searchPanelPlaceholder": "Pesquisar ...",
"dxDataGrid-filterRowShowAllText": "(Todos)",
"dxDataGrid-filterRowResetOperationText": "Limpar",
"dxDataGrid-filterRowOperationEquals": "Igual",
"dxDataGrid-filterRowOperationNotEquals": "Diferente",
"dxDataGrid-filterRowOperationLess": "Menor que",
"dxDataGrid-filterRowOperationLessOrEquals": "Menor que ou igual a",
"dxDataGrid-filterRowOperationGreater": "Maior que",
"dxDataGrid-filterRowOperationGreaterOrEquals": "Maior que ou igual a",
"dxDataGrid-filterRowOperationStartsWith": "Come\xe7a com",
"dxDataGrid-filterRowOperationContains": "Cont\xe9m",
"dxDataGrid-filterRowOperationNotContains": "N\xe3o cont\xe9m",
"dxDataGrid-filterRowOperationEndsWith": "Termina com",
"dxDataGrid-filterRowOperationBetween": "Entre",
"dxDataGrid-filterRowOperationBetweenStartText": "In\xedcio",
"dxDataGrid-filterRowOperationBetweenEndText": "Fim",
"dxDataGrid-applyFilterText": "Aplicar filtro",
"dxDataGrid-trueText": "verdadeiro",
"dxDataGrid-falseText": "falso",
"dxDataGrid-sortingAscendingText": "Ordenar ascendentemente",
"dxDataGrid-sortingDescendingText": "Ordenar descendentemente",
"dxDataGrid-sortingClearText": "Limpar ordena\xe7\xe3o",
"dxDataGrid-editingSaveAllChanges": "Salvar todas as altera\xe7\xf5es",
"dxDataGrid-editingCancelAllChanges": "Descartar altera\xe7\xf5es",
"dxDataGrid-editingAddRow": "Adicionar uma linha",
"dxDataGrid-summaryMin": "M\xedn: {0}",
"dxDataGrid-summaryMinOtherColumn": "M\xedn de {1} \xe9 {0}",
"dxDataGrid-summaryMax": "M\xe1x: {0}",
"dxDataGrid-summaryMaxOtherColumn": "M\xe1x de {1} \xe9 {0}",
"dxDataGrid-summaryAvg": "M\xe9d: {0}",
"dxDataGrid-summaryAvgOtherColumn": "M\xe9dia de {1} \xe9 {0}",
"dxDataGrid-summarySum": "Soma: {0}",
"dxDataGrid-summarySumOtherColumn": "Soma de {1} \xe9 {0}",
"dxDataGrid-summaryCount": "Contagem: {0}",
"dxDataGrid-columnFixingFix": "Fixar",
"dxDataGrid-columnFixingUnfix": "N\xe3o fixar",
"dxDataGrid-columnFixingLeftPosition": "\xc0 esquerda",
"dxDataGrid-columnFixingRightPosition": "\xc0 direita",
"dxDataGrid-exportTo": "Exportar para",
"dxDataGrid-exportToExcel": "Exportar para Excel",
"dxDataGrid-exporting": "Exportar...",
"dxDataGrid-excelFormat": "Planilha Excel",
"dxDataGrid-exportAll": "Exportar todos os dados",
"dxDataGrid-exportSelectedRows": "Exportar linhas selecionadas",
"dxDataGrid-selectedRows": "Linhas selecionadas",
"dxDataGrid-headerFilterEmptyValue": "(Vazio)",
"dxDataGrid-headerFilterOK": "OK",
"dxDataGrid-headerFilterCancel": "Cancelar",
"dxDataGrid-ariaColumn": "Coluna",
"dxDataGrid-ariaValue": "Valor",
"dxDataGrid-ariaFilterCell": "Filtro de c\xe9lula",
"dxDataGrid-ariaCollapse": "Contrair",
"dxDataGrid-ariaExpand": "Expandir",
"dxDataGrid-ariaDataGrid": "Grelha de dados",
"dxDataGrid-ariaSearchInGrid": "Pesquisar na grade de dados",
"dxDataGrid-ariaSelectAll": "Selecionar todos",
"dxDataGrid-ariaSelectRow": "Selecionar linha",
"dxDataGrid-filterBuilderPopupTitle": "Construtor de filtro",
"dxDataGrid-filterPanelCreateFilter": "Criar filtro",
"dxDataGrid-filterPanelClearFilter": "Limpar",
"dxDataGrid-filterPanelFilterEnabledHint": "Habilitar o filtro",
"dxTreeList-ariaTreeList": "Lista em \xe1rvore",
"dxTreeList-editingAddRowToNode": "Adicionar",
"dxPager-infoText": "P\xe1gina {0} de {1} ({2} itens)",
"dxPager-pagesCountText": "de",
"dxPager-pageSizesAllText": "Todos",
"dxPivotGrid-grandTotal": "Grande Total",
"dxPivotGrid-total": "{0} Total",
"dxPivotGrid-fieldChooserTitle": "Seletor de Colunas",
"dxPivotGrid-showFieldChooser": "Mostrar Seletor de Colunas",
"dxPivotGrid-expandAll": "Expandir Tudo",
"dxPivotGrid-collapseAll": "Contrair Tudo",
"dxPivotGrid-sortColumnBySummary": 'Ordenar "{0}" por esta Coluna',
"dxPivotGrid-sortRowBySummary": 'Ordenar "{0}" por esta Linha',
"dxPivotGrid-removeAllSorting": "Remover Todas as Ordena\xe7\xf5es",
"dxPivotGrid-dataNotAvailable": "N/A",
"dxPivotGrid-rowFields": "Campos de Linha",
"dxPivotGrid-columnFields": "Campos de Coluna",
"dxPivotGrid-dataFields": "Campos de Dados",
"dxPivotGrid-filterFields": "Campos de Filtro",
"dxPivotGrid-allFields": "Todos os Campos",
"dxPivotGrid-columnFieldArea": "Arraste os campos de coluna at\xe9 aqui",
"dxPivotGrid-dataFieldArea": "Arraste os campos de dados at\xe9 aqui",
"dxPivotGrid-rowFieldArea": "Arraste os campos de linha at\xe9 aqui",
"dxPivotGrid-filterFieldArea": "Arraste os campos de filtro at\xe9 aqui",
"dxScheduler-editorLabelTitle": "Assunto",
"dxScheduler-editorLabelStartDate": "Data de In\xedcio",
"dxScheduler-editorLabelEndDate": "Data Final",
"dxScheduler-editorLabelDescription": "Descri\xe7\xe3o",
"dxScheduler-editorLabelRecurrence": "Repetir",
"dxScheduler-openAppointment": "Abrir compromisso",
"dxScheduler-recurrenceNever": "Nunca",
"dxScheduler-recurrenceMinutely": "Minutely",
"dxScheduler-recurrenceHourly": "Hourly",
"dxScheduler-recurrenceDaily": "Diariamente",
"dxScheduler-recurrenceWeekly": "Semanalmente",
"dxScheduler-recurrenceMonthly": "Mensalmente",
"dxScheduler-recurrenceYearly": "Anualmente",
"dxScheduler-recurrenceRepeatEvery": "Todos",
"dxScheduler-recurrenceRepeatOn": "Repeat On",
"dxScheduler-recurrenceEnd": "Fim da repeti\xe7\xe3o",
"dxScheduler-recurrenceAfter": "Depois de",
"dxScheduler-recurrenceOn": "A",
"dxScheduler-recurrenceRepeatMinutely": "minuto(s)",
"dxScheduler-recurrenceRepeatHourly": "hora(s)",
"dxScheduler-recurrenceRepeatDaily": "dia(s)",
"dxScheduler-recurrenceRepeatWeekly": "semana(s)",
"dxScheduler-recurrenceRepeatMonthly": "m\xeas(es)",
"dxScheduler-recurrenceRepeatYearly": "ano(s)",
"dxScheduler-switcherDay": "Dia",
"dxScheduler-switcherWeek": "Semana",
"dxScheduler-switcherWorkWeek": "Dias \xfateis",
"dxScheduler-switcherMonth": "M\xeas",
"dxScheduler-switcherTimelineDay": "Linha de tempo Dia",
"dxScheduler-switcherTimelineWeek": "Linha de tempo Semana",
"dxScheduler-switcherTimelineWorkWeek": "Linha de tempo Dias \xfateis",
"dxScheduler-switcherTimelineMonth": "Linha de tempo M\xeas",
"dxScheduler-switcherAgenda": "Agenda",
"dxScheduler-recurrenceRepeatOnDate": "na data",
"dxScheduler-recurrenceRepeatCount": "ocorr\xeancia(s)",
"dxScheduler-allDay": "Todo o dia",
"dxScheduler-confirmRecurrenceEditMessage": "Deseja editar s\xf3 este compromisso ou a s\xe9rie toda?",
"dxScheduler-confirmRecurrenceDeleteMessage": "Deseja eliminar s\xf3 este compromisso ou a s\xe9rie toda?",
"dxScheduler-confirmRecurrenceEditSeries": "Editar s\xe9rie",
"dxScheduler-confirmRecurrenceDeleteSeries": "Eliminar s\xe9rie",
"dxScheduler-confirmRecurrenceEditOccurrence": "Editar compromisso",
"dxScheduler-confirmRecurrenceDeleteOccurrence": "Eliminar compromisso",
"dxScheduler-noTimezoneTitle": "Sem fuso hor\xe1rio",
"dxScheduler-moreAppointments": "{0} mais",
"dxCalendar-todayButtonText": "Hoje",
"dxCalendar-ariaWidgetName": "Calend\xe1rio",
"dxColorView-ariaRed": "Vermelho",
"dxColorView-ariaGreen": "Verde",
"dxColorView-ariaBlue": "Azul",
"dxColorView-ariaAlpha": "Transpar\xeancia",
"dxColorView-ariaHex": "C\xf3digo de cor",
"dxTagBox-selected": "{0} selecionados",
"dxTagBox-allSelected": "Todos selecionados ({0})",
"dxTagBox-moreSelected": "{0} mais",
"vizExport-printingButtonText": "Imprimir",
"vizExport-titleMenuText": "Exportar/Imprimir",
"vizExport-exportButtonText": "{0}-Arquivo",
"dxFilterBuilder-and": "E",
"dxFilterBuilder-or": "OU",
"dxFilterBuilder-notAnd": "N\xc3O E",
"dxFilterBuilder-notOr": "N\xc3O OU",
"dxFilterBuilder-addCondition": "Adicionar condi\xe7\xe3o",
"dxFilterBuilder-addGroup": "Adicionar Grupo",
"dxFilterBuilder-enterValueText": "<preencha com um valor>",
"dxFilterBuilder-filterOperationEquals": "Igual",
"dxFilterBuilder-filterOperationNotEquals": "Diferente",
"dxFilterBuilder-filterOperationLess": "Menor que",
"dxFilterBuilder-filterOperationLessOrEquals": "Menor ou igual que",
"dxFilterBuilder-filterOperationGreater": "Maior que",
"dxFilterBuilder-filterOperationGreaterOrEquals": "Maior ou igual que",
"dxFilterBuilder-filterOperationStartsWith": "Come\xe7a com",
"dxFilterBuilder-filterOperationContains": "Cont\xe9m",
"dxFilterBuilder-filterOperationNotContains": "N\xe3o cont\xe9m",
"dxFilterBuilder-filterOperationEndsWith": "Termina com",
"dxFilterBuilder-filterOperationIsBlank": "\xc9 vazio",
"dxFilterBuilder-filterOperationIsNotBlank": "N\xe3o \xe9 vazio",
"dxFilterBuilder-filterOperationBetween": "Entre",
"dxFilterBuilder-filterOperationAnyOf": "Algum de",
"dxFilterBuilder-filterOperationNoneOf": "Nenhum de",
"dxHtmlEditor-dialogColorCaption": "Alterar cor da fonte",
"dxHtmlEditor-dialogBackgroundCaption": "Alterar cor de plano de fundo",
"dxHtmlEditor-dialogLinkCaption": "Adicionar link",
"dxHtmlEditor-dialogLinkUrlField": "URL",
"dxHtmlEditor-dialogLinkTextField": "Texto",
"dxHtmlEditor-dialogLinkTargetField": "Abrir link em nova janela",
"dxHtmlEditor-dialogImageCaption": "Adicionar imagem",
"dxHtmlEditor-dialogImageUrlField": "URL",
"dxHtmlEditor-dialogImageAltField": "Texto alternativo",
"dxHtmlEditor-dialogImageWidthField": "Largura (px)",
"dxHtmlEditor-dialogImageHeightField": "Altura (px)",
"dxHtmlEditor-dialogInsertTableRowsField": "!TODO",
"dxHtmlEditor-dialogInsertTableColumnsField": "!TODO",
"dxHtmlEditor-dialogInsertTableCaption": "!TODO",
"dxHtmlEditor-heading": "Cabe\xe7alho",
"dxHtmlEditor-normalText": "Texto normal",
"dxFileManager-newDirectoryName": "Pasta sem t\xedtulo",
"dxFileManager-rootDirectoryName": "Arquivos",
"dxFileManager-errorNoAccess": "Acesso negado. Opera\xe7\xe3o n\xe3o p\xf4de ser finalizada.",
"dxFileManager-errorDirectoryExistsFormat": "Pasta '{0}' j\xe1 existe.",
"dxFileManager-errorFileExistsFormat": "Arquivo '{0}' j\xe1 existe.",
"dxFileManager-errorFileNotFoundFormat": "Arquivo '{0}' n\xe3o encontrado.",
"dxFileManager-errorDirectoryNotFoundFormat": "Pasta '{0}' n\xe3o encontrado.",
"dxFileManager-errorWrongFileExtension": "Extens\xe3o de arquivo n\xe3o permitida.",
"dxFileManager-errorMaxFileSizeExceeded": "Arquivo excedeu o tamanho m\xe1ximo permitido.",
"dxFileManager-errorInvalidSymbols": "Nome possui caracteres inv\xe1lidos.",
"dxFileManager-errorDefault": "Erro desconhecido.",
"dxFileManager-errorDirectoryOpenFailed": "A pasta n\xe3o pode ser aberta",
"dxFileManager-commandCreate": "Nova pasta",
"dxFileManager-commandRename": "Renomear",
"dxFileManager-commandMove": "Mover para",
"dxFileManager-commandCopy": "Copiar para",
"dxFileManager-commandDelete": "Excluir",
"dxFileManager-commandDownload": "Baixar",
"dxFileManager-commandUpload": "Enviar arquivos",
"dxFileManager-commandRefresh": "Atualizar",
"dxFileManager-commandThumbnails": "Exibi\xe7\xe3o em \xedcones",
"dxFileManager-commandDetails": "Exibi\xe7\xe3o em lista",
"dxFileManager-commandClearSelection": "Limpar sele\xe7\xe3o",
"dxFileManager-commandShowNavPane": "Exibir/esconder painel de navega\xe7\xe3o",
"dxFileManager-dialogDirectoryChooserMoveTitle": "Mover para",
"dxFileManager-dialogDirectoryChooserMoveButtonText": "Mover",
"dxFileManager-dialogDirectoryChooserCopyTitle": "Copiar para",
"dxFileManager-dialogDirectoryChooserCopyButtonText": "Copiar",
"dxFileManager-dialogRenameItemTitle": "Renomear",
"dxFileManager-dialogRenameItemButtonText": "Salvar",
"dxFileManager-dialogCreateDirectoryTitle": "Nova pasta",
"dxFileManager-dialogCreateDirectoryButtonText": "Criar",
"dxFileManager-dialogDeleteItemTitle": "Excluir",
"dxFileManager-dialogDeleteItemButtonText": "Excluir",
"dxFileManager-dialogDeleteItemSingleItemConfirmation": "Voc\xea tem certeza que quer excluir {0}?",
"dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Voc\xea tem certeza que quer excluir {0} itens?",
"dxFileManager-dialogButtonCancel": "Cancelar",
"dxFileManager-editingCreateSingleItemProcessingMessage": "Criando pasta em {0}",
"dxFileManager-editingCreateSingleItemSuccessMessage": "Pasta criada em {0}",
"dxFileManager-editingCreateSingleItemErrorMessage": "Pasta n\xe3o foi criada",
"dxFileManager-editingCreateCommonErrorMessage": "Pasta n\xe3o foi criada",
"dxFileManager-editingRenameSingleItemProcessingMessage": "Renomeando item em {0}",
"dxFileManager-editingRenameSingleItemSuccessMessage": "Item renomeado em {0}",
"dxFileManager-editingRenameSingleItemErrorMessage": "Item n\xe3o foi renomeado",
"dxFileManager-editingRenameCommonErrorMessage": "Item n\xe3o foi renomeado",
"dxFileManager-editingDeleteSingleItemProcessingMessage": "Excluindo item de {0}",
"dxFileManager-editingDeleteMultipleItemsProcessingMessage": "Excluindo {0} itens de {1}",
"dxFileManager-editingDeleteSingleItemSuccessMessage": "Item exclu\xeddo de {0}",
"dxFileManager-editingDeleteMultipleItemsSuccessMessage": "Exclu\xeddo {0} itens de {1}",
"dxFileManager-editingDeleteSingleItemErrorMessage": "Item n\xe3o foi exclu\xeddo",
"dxFileManager-editingDeleteMultipleItemsErrorMessage": "{0} itens n\xe3o foram exclu\xeddos",
"dxFileManager-editingDeleteCommonErrorMessage": "Alguns itens n\xe3o foram exclu\xeddos",
"dxFileManager-editingMoveSingleItemProcessingMessage": "Movendo item para {0}",
"dxFileManager-editingMoveMultipleItemsProcessingMessage": "Movendo {0} itens para {1}",
"dxFileManager-editingMoveSingleItemSuccessMessage": "Item movido para {0}",
"dxFileManager-editingMoveMultipleItemsSuccessMessage": "{0} itens foram movidos para {1}",
"dxFileManager-editingMoveSingleItemErrorMessage": "Item n\xe3o foi movido",
"dxFileManager-editingMoveMultipleItemsErrorMessage": "{0} itens n\xe3o foram movidos",
"dxFileManager-editingMoveCommonErrorMessage": "Alguns itens n\xe3o foram movidos",
"dxFileManager-editingCopySingleItemProcessingMessage": "Copiando item para {0}",
"dxFileManager-editingCopyMultipleItemsProcessingMessage": "Copiando {0} itens para {1}",
"dxFileManager-editingCopySingleItemSuccessMessage": "Item copiado para {0}",
"dxFileManager-editingCopyMultipleItemsSuccessMessage": "{0} itens foram copiados para {1}",
"dxFileManager-editingCopySingleItemErrorMessage": "Item n\xe3o foi copiado",
"dxFileManager-editingCopyMultipleItemsErrorMessage": "{0} itens n\xe3o foram copiados",
"dxFileManager-editingCopyCommonErrorMessage": "Some items were not copied",
"dxFileManager-editingUploadSingleItemProcessingMessage": "Enviando item para {0}",
"dxFileManager-editingUploadMultipleItemsProcessingMessage": "Enviando {0} itens para {1}",
"dxFileManager-editingUploadSingleItemSuccessMessage": "Item enviado para {0}",
"dxFileManager-editingUploadMultipleItemsSuccessMessage": "{0} itens enviados para {1}",
"dxFileManager-editingUploadSingleItemErrorMessage": "Item n\xe3o foi enviado",
"dxFileManager-editingUploadMultipleItemsErrorMessage": "{0} itens n\xe3o foram enviados",
"dxFileManager-editingUploadCanceledMessage": "Cancelado",
"dxFileManager-listDetailsColumnCaptionName": "Nome",
"dxFileManager-listDetailsColumnCaptionDateModified": "Data de modifica\xe7\xe3o",
"dxFileManager-listDetailsColumnCaptionFileSize": "Tamanho do arquivo",
"dxFileManager-listThumbnailsTooltipTextSize": "Tamanho",
"dxFileManager-listThumbnailsTooltipTextDateModified": "Data de modifica\xe7\xe3o",
"dxFileManager-notificationProgressPanelTitle": "Progresso",
"dxFileManager-notificationProgressPanelEmptyListText": "Nenhuma opera\xe7\xe3o",
"dxFileManager-notificationProgressPanelOperationCanceled": "Cancelado",
"dxDiagram-categoryGeneral": "Geral",
"dxDiagram-categoryFlowchart": "Fluxograma",
"dxDiagram-categoryOrgChart": "Organograma",
"dxDiagram-categoryContainers": "Cont\xeaineres",
"dxDiagram-categoryCustom": "Personalizado",
"dxDiagram-commandExportToSvg": "Exportar para SVG",
"dxDiagram-commandExportToPng": "Exportar para PNG",
"dxDiagram-commandExportToJpg": "Exportar para JPG",
"dxDiagram-commandUndo": "Desfazer",
"dxDiagram-commandRedo": "Refazer",
"dxDiagram-commandFontName": "Nome da fonte",
"dxDiagram-commandFontSize": "Tamanho da fonte",
"dxDiagram-commandBold": "Negrito",
"dxDiagram-commandItalic": "It\xe1lico",
"dxDiagram-commandUnderline": "Sublinhado",
"dxDiagram-commandTextColor": "Cor da fonte",
"dxDiagram-commandLineColor": "Cor da linha",
"dxDiagram-commandLineWidth": "Espessura da linha",
"dxDiagram-commandLineStyle": "Estilo da linha",
"dxDiagram-commandLineStyleSolid": "S\xf3lido",
"dxDiagram-commandLineStyleDotted": "Pontilhado",
"dxDiagram-commandLineStyleDashed": "Tracejado",
"dxDiagram-commandFillColor": "Cor de preenchimento",
"dxDiagram-commandAlignLeft": "Alinhar \xe0 esquerda",
"dxDiagram-commandAlignCenter": "Centralizar horizontalmente",
"dxDiagram-commandAlignRight": "Alinhar \xe0 direita",
"dxDiagram-commandConnectorLineType": "Tipo de conex\xe3o",
"dxDiagram-commandConnectorLineStraight": "Reto",
"dxDiagram-commandConnectorLineOrthogonal": "Ortogonal",
"dxDiagram-commandConnectorLineStart": "Conector de in\xedcio de linha",
"dxDiagram-commandConnectorLineEnd": "Conector de fim de linha",
"dxDiagram-commandConnectorLineNone": "Nenhum",
"dxDiagram-commandConnectorLineArrow": "Flecha",
"dxDiagram-commandFullscreen": "Tela cheia",
"dxDiagram-commandUnits": "Unidades",
"dxDiagram-commandPageSize": "Tamanho da p\xe1gina",
"dxDiagram-commandPageOrientation": "Orienta\xe7\xe3o",
"dxDiagram-commandPageOrientationLandscape": "Paiagem",
"dxDiagram-commandPageOrientationPortrait": "Retrato",
"dxDiagram-commandPageColor": "Cor da p\xe1gina",
"dxDiagram-commandShowGrid": "Mostrar grade",
"dxDiagram-commandSnapToGrid": "Ajustar \xe0 grade",
"dxDiagram-commandGridSize": "Tamanho da grade",
"dxDiagram-commandZoomLevel": "N\xedvel de zoom",
"dxDiagram-commandAutoZoom": "Zoom autom\xe1tico",
"dxDiagram-commandFitToContent": "Ajustar ao conte\xfado",
"dxDiagram-commandFitToWidth": "Ajustar \xe0 largura",
"dxDiagram-commandAutoZoomByContent": "Zoom autom\xe1tico por conte\xfado",
"dxDiagram-commandAutoZoomByWidth": "Zoom autom\xe1tico por largura",
"dxDiagram-commandSimpleView": "Visualiza\xe7\xe3o simples",
"dxDiagram-commandCut": "Cortar",
"dxDiagram-commandCopy": "Copiar",
"dxDiagram-commandPaste": "Colar",
"dxDiagram-commandSelectAll": "Selecionar tudo",
"dxDiagram-commandDelete": "Remover",
"dxDiagram-commandBringToFront": "Trazer para a frente",
"dxDiagram-commandSendToBack": "Enviar para o fundo",
"dxDiagram-commandLock": "Bloquear",
"dxDiagram-commandUnlock": "Desbloquear",
"dxDiagram-commandInsertShapeImage": "Inserir imagem...",
"dxDiagram-commandEditShapeImage": "Alterar imagem...",
"dxDiagram-commandDeleteShapeImage": "Remover imagem",
"dxDiagram-commandLayoutLeftToRight": "Da esquerda para a direita",
"dxDiagram-commandLayoutRightToLeft": "Da direita para a esquerda",
"dxDiagram-commandLayoutTopToBottom": "De cima para baixo",
"dxDiagram-commandLayoutBottomToTop": "De baixo para cima",
"dxDiagram-unitIn": "in",
"dxDiagram-unitCm": "cm",
"dxDiagram-unitPx": "px",
"dxDiagram-dialogButtonOK": "Aceitar",
"dxDiagram-dialogButtonCancel": "Cancelar",
"dxDiagram-dialogInsertShapeImageTitle": "Inserir imagem",
"dxDiagram-dialogEditShapeImageTitle": "Alterar imagem",
"dxDiagram-dialogEditShapeImageSelectButton": "Selecionar imagem",
"dxDiagram-dialogEditShapeImageLabelText": "ou arraste um arquivo aqui",
"dxDiagram-uiExport": "Exportar",
"dxDiagram-uiProperties": "Propriedades",
"dxDiagram-uiSettings": "Configura\xe7\xf5es",
"dxDiagram-uiShowToolbox": "Exibir ferramentas",
"dxDiagram-uiSearch": "Pesquisar",
"dxDiagram-uiStyle": "Estilo",
"dxDiagram-uiLayout": "Leiaute",
"dxDiagram-uiLayoutTree": "\xc1rvores",
"dxDiagram-uiLayoutLayered": "N\xedveis",
"dxDiagram-uiDiagram": "Diagrama",
"dxDiagram-uiText": "Texto",
"dxDiagram-uiObject": "Objeto",
"dxDiagram-uiConnector": "Conector",
"dxDiagram-uiPage": "P\xe1gina",
"dxDiagram-shapeText": "Texto",
"dxDiagram-shapeRectangle": "Ret\xe2ngulo",
"dxDiagram-shapeEllipse": "Elipse",
"dxDiagram-shapeCross": "Cruz",
"dxDiagram-shapeTriangle": "Tri\xe2ngulo",
"dxDiagram-shapeDiamond": "Diamante",
"dxDiagram-shapeHeart": "Cora\xe7\xe3o",
"dxDiagram-shapePentagon": "Pent\xe1gono",
"dxDiagram-shapeHexagon": "Hex\xe1gono",
"dxDiagram-shapeOctagon": "Oct\xf3gono",
"dxDiagram-shapeStar": "Estrela",
"dxDiagram-shapeArrowLeft": "Flecha \xe0 esquerda",
"dxDiagram-shapeArrowUp": "Flecha para cima",
"dxDiagram-shapeArrowRight": "Flecha \xe0 direita",
"dxDiagram-shapeArrowDown": "Flecha para baixo",
"dxDiagram-shapeArrowUpDown": "Flecha para cima e para baixo",
"dxDiagram-shapeArrowLeftRight": "Flecha \xe0 esquerda e direita",
"dxDiagram-shapeProcess": "Processo",
"dxDiagram-shapeDecision": "Decis\xe3o",
"dxDiagram-shapeTerminator": "Exterminador",
"dxDiagram-shapePredefinedProcess": "Processo predefinido",
"dxDiagram-shapeDocument": "Documento",
"dxDiagram-shapeMultipleDocuments": "V\xe1rios documentos",
"dxDiagram-shapeManualInput": "Entrada manual",
"dxDiagram-shapePreparation": "Prepara\xe7\xe3o",
"dxDiagram-shapeData": "Dados",
"dxDiagram-shapeDatabase": "Base de dados",
"dxDiagram-shapeHardDisk": "Disco r\xedgido",
"dxDiagram-shapeInternalStorage": "Mem\xf3ria interna",
"dxDiagram-shapePaperTape": "Fita de papel",
"dxDiagram-shapeManualOperation": "Opera\xe7\xe3o manual",
"dxDiagram-shapeDelay": "Atraso",
"dxDiagram-shapeStoredData": "Dados armazenados",
"dxDiagram-shapeDisplay": "Tela",
"dxDiagram-shapeMerge": "Fus\xe3o",
"dxDiagram-shapeConnector": "Conector",
"dxDiagram-shapeOr": "Ou",
"dxDiagram-shapeSummingJunction": "Jun\xe7\xe3o de soma",
"dxDiagram-shapeContainerDefaultText": "Cont\xeainer",
"dxDiagram-shapeVerticalContainer": "Cont\xeainer vertical",
"dxDiagram-shapeHorizontalContainer": "Cont\xeainer horizontal",
"dxDiagram-shapeCardDefaultText": "Nome",
"dxDiagram-shapeCardWithImageOnLeft": "Cart\xe3o com imagem \xe0 esquerda",
"dxDiagram-shapeCardWithImageOnTop": "Cart\xe3o com imagem na parte superior",
"dxDiagram-shapeCardWithImageOnRight": "Cart\xe3o com imagem \xe0 direita",
"dxGantt-dialogTitle": "T\xedtulo",
"dxGantt-dialogStartTitle": "Iniciar",
"dxGantt-dialogEndTitle": "Encerrar",
"dxGantt-dialogProgressTitle": "Progresso",
"dxGantt-dialogResourcesTitle": "Recursos",
"dxGantt-dialogResourceManagerTitle": "Gerenciador de recursos",
"dxGantt-dialogTaskDetailsTitle": "Detalhes da tarefa",
"dxGantt-dialogEditResourceListHint": "Editar lista de recursos",
"dxGantt-dialogEditNoResources": "Sem recursos",
"dxGantt-dialogButtonAdd": "Adicionar",
"dxGantt-contextMenuNewTask": "Nova tarefa",
"dxGantt-contextMenuNewSubtask": "Nova subtarefa",
"dxGantt-contextMenuDeleteTask": "Excluir tarefa",
"dxGantt-contextMenuDeleteDependency": "Excluir depend\xeancia",
"dxGantt-dialogTaskDeleteConfirmation": "Excluir uma tarefa tamb\xe9m exclui suas depend\xeancias e subtarefas. Voc\xea tem certeza que quer excluir essa tarefa?",
"dxGantt-dialogDependencyDeleteConfirmation": "Voc\xea tem certeza que quer excluir a depend\xeancia desta tarefa?",
"dxGantt-dialogResourcesDeleteConfirmation": "Ao excluir o recurso, ele tamb\xe9m ser\xe1 excluido das tarefas em que est\xe1 atribu\xeddo. Tem certeza que quer excluir estes recursos? Recurso: {0}",
"dxGantt-dialogConstraintCriticalViolationMessage": "A tarefa a ser movida est\xe1 ligada a uma outra tarefa, por uma rela\xe7\xe3o de depend\xeancia. Esta altera\xe7\xe3o conflita com as regras de depend\xeancias. Como voc\xea gostaria de proceder?",
"dxGantt-dialogConstraintViolationMessage": "A tarefa a ser movida est\xe1 ligada a uma outra tarefa, por uma rela\xe7\xe3o de depend\xeancia. Como voc\xea gostaria de proceder?",
"dxGantt-dialogCancelOperationMessage": "Cancelar opera\xe7\xe3o",
"dxGantt-dialogDeleteDependencyMessage": "Excluir a depend\xeancia",
"dxGantt-dialogMoveTaskAndKeepDependencyMessage": "Mover a tarefa e manter a depend\xeancia",
"dxGantt-undo": "Desfazer",
"dxGantt-redo": "Refazer",
"dxGantt-expandAll": "Expandir tudo",
"dxGantt-collapseAll": "Contrair tudo",
"dxGantt-addNewTask": "Nova tarefa",
"dxGantt-deleteSelectedTask": "Excluir tarefas selecionadas",
"dxGantt-zoomIn": "Aumentar zoom",
"dxGantt-zoomOut": "Diminuir zoom",
"dxGantt-fullScreen": "Tela cheia"
}
})
});
| {
"content_hash": "64752cd95c41c3fb79f7970b385f469e",
"timestamp": "",
"source": "github",
"line_count": 533,
"max_line_length": 263,
"avg_line_length": 66.2701688555347,
"alnum_prop": 0.6355246022309042,
"repo_name": "cdnjs/cdnjs",
"id": "bc14be05d5b50fed7f3403428084ed4ed35306f8",
"size": "35578",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ajax/libs/devextreme/20.2.8-build-21167-0311/js/localization/dx.messages.pt.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
/*
Theme Name: HUT SCTV Underscore
Adding support for language written in a Right To Left (RTL) direction is easy -
it's just a matter of overwriting all the horizontal positioning attributes
of your CSS stylesheet in a separate stylesheet file named rtl.css.
https://codex.wordpress.org/Right_to_Left_Language_Support
*/
/*
body {
direction: rtl;
unicode-bidi: embed;
}
*/ | {
"content_hash": "39a859a108a8c9625f02d669812011bc",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 80,
"avg_line_length": 22.294117647058822,
"alnum_prop": 0.7598944591029023,
"repo_name": "scmwebdev/hut.sctv.co.id",
"id": "195001c2a0c3862e5ed98955189e831eccb86586",
"size": "379",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "wp-content/themes/underscore/rtl.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "894"
},
{
"name": "CSS",
"bytes": "2882829"
},
{
"name": "HTML",
"bytes": "1222"
},
{
"name": "JavaScript",
"bytes": "2773556"
},
{
"name": "PHP",
"bytes": "10975313"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>org.apache.skywalking.apm.testcase</groupId>
<artifactId>vertx-web-3.54minus-scenario</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
<test.framework.version>3.5.4</test.framework.version>
</properties>
<name>skywalking-vertx-web-3.54minus-scenario</name>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web</artifactId>
<version>${test.framework.version}</version>
</dependency>
</dependencies>
<build>
<finalName>vertx-web-3.54minus-scenario</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${compiler.version}</source>
<target>${compiler.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assemble</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
<outputDirectory>./target/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
| {
"content_hash": "aa8234b487f583b323038c74a6b37b72",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 108,
"avg_line_length": 39.674157303370784,
"alnum_prop": 0.5553667516284339,
"repo_name": "wu-sheng/sky-walking",
"id": "4f963991e583e2d8ecae6c9a03b8c689b951902f",
"size": "3531",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/plugin/scenarios/vertx-web-3.54minus-scenario/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package org.apache.kafka.streams.integration;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.IntegerSerializer;
import org.apache.kafka.common.serialization.LongDeserializer;
import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.KeyValue;
import org.apache.kafka.streams.StreamsConfig;
import org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster;
import org.apache.kafka.streams.integration.utils.IntegrationTestUtils;
import org.apache.kafka.streams.kstream.KGroupedStream;
import org.apache.kafka.streams.kstream.KStream;
import org.apache.kafka.streams.kstream.KStreamBuilder;
import org.apache.kafka.streams.kstream.KeyValueMapper;
import org.apache.kafka.streams.kstream.Reducer;
import org.apache.kafka.streams.kstream.TimeWindows;
import org.apache.kafka.streams.kstream.Windowed;
import org.apache.kafka.test.MockKeyValueMapper;
import org.apache.kafka.test.TestUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
import kafka.utils.MockTime;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
/**
* Similar to KStreamAggregationIntegrationTest but with dedupping enabled
* by virtue of having a large commit interval
*/
public class KStreamAggregationDedupIntegrationTest {
private static final int NUM_BROKERS = 1;
@ClassRule
public static final EmbeddedKafkaCluster CLUSTER =
new EmbeddedKafkaCluster(NUM_BROKERS);
private final MockTime mockTime = CLUSTER.time;
private static volatile int testNo = 0;
private KStreamBuilder builder;
private Properties streamsConfiguration;
private KafkaStreams kafkaStreams;
private String streamOneInput;
private String outputTopic;
private KGroupedStream<String, String> groupedStream;
private Reducer<String> reducer;
private KStream<Integer, String> stream;
@Before
public void before() {
testNo++;
builder = new KStreamBuilder();
createTopics();
streamsConfiguration = new Properties();
String applicationId = "kgrouped-stream-test-" +
testNo;
streamsConfiguration.put(StreamsConfig.APPLICATION_ID_CONFIG, applicationId);
streamsConfiguration
.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers());
streamsConfiguration.put(StreamsConfig.ZOOKEEPER_CONNECT_CONFIG, CLUSTER.zKConnectString());
streamsConfiguration.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
streamsConfiguration.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory().getPath());
streamsConfiguration.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, 2000);
streamsConfiguration.put(StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, 10 * 1024 * 1024L);
KeyValueMapper<Integer, String, String> mapper = MockKeyValueMapper.<Integer, String>SelectValueMapper();
stream = builder.stream(Serdes.Integer(), Serdes.String(), streamOneInput);
groupedStream = stream
.groupBy(
mapper,
Serdes.String(),
Serdes.String());
reducer = new Reducer<String>() {
@Override
public String apply(String value1, String value2) {
return value1 + ":" + value2;
}
};
}
@After
public void whenShuttingDown() throws IOException {
if (kafkaStreams != null) {
kafkaStreams.close();
}
IntegrationTestUtils.purgeLocalStreamsState(streamsConfiguration);
}
@Test
public void shouldReduce() throws Exception {
produceMessages(System.currentTimeMillis());
groupedStream
.reduce(reducer, "reduce-by-key")
.to(Serdes.String(), Serdes.String(), outputTopic);
startStreams();
produceMessages(System.currentTimeMillis());
List<KeyValue<String, String>> results = receiveMessages(
new StringDeserializer(),
new StringDeserializer()
, 5);
Collections.sort(results, new Comparator<KeyValue<String, String>>() {
@Override
public int compare(KeyValue<String, String> o1, KeyValue<String, String> o2) {
return KStreamAggregationDedupIntegrationTest.compare(o1, o2);
}
});
assertThat(results, is(Arrays.asList(
KeyValue.pair("A", "A:A"),
KeyValue.pair("B", "B:B"),
KeyValue.pair("C", "C:C"),
KeyValue.pair("D", "D:D"),
KeyValue.pair("E", "E:E"))));
}
@SuppressWarnings("unchecked")
private static <K extends Comparable, V extends Comparable> int compare(final KeyValue<K, V> o1,
final KeyValue<K, V> o2) {
final int keyComparison = o1.key.compareTo(o2.key);
if (keyComparison == 0) {
return o1.value.compareTo(o2.value);
}
return keyComparison;
}
@Test
public void shouldReduceWindowed() throws Exception {
long firstBatchTimestamp = System.currentTimeMillis() - 1000;
produceMessages(firstBatchTimestamp);
long secondBatchTimestamp = System.currentTimeMillis();
produceMessages(secondBatchTimestamp);
produceMessages(secondBatchTimestamp);
groupedStream
.reduce(reducer, TimeWindows.of(500L), "reduce-time-windows")
.toStream(new KeyValueMapper<Windowed<String>, String, String>() {
@Override
public String apply(Windowed<String> windowedKey, String value) {
return windowedKey.key() + "@" + windowedKey.window().start();
}
})
.to(Serdes.String(), Serdes.String(), outputTopic);
startStreams();
List<KeyValue<String, String>> windowedOutput = receiveMessages(
new StringDeserializer(),
new StringDeserializer()
, 10);
Comparator<KeyValue<String, String>>
comparator =
new Comparator<KeyValue<String, String>>() {
@Override
public int compare(final KeyValue<String, String> o1,
final KeyValue<String, String> o2) {
return KStreamAggregationDedupIntegrationTest.compare(o1, o2);
}
};
Collections.sort(windowedOutput, comparator);
long firstBatchWindow = firstBatchTimestamp / 500 * 500;
long secondBatchWindow = secondBatchTimestamp / 500 * 500;
assertThat(windowedOutput, is(
Arrays.asList(
new KeyValue<>("A@" + firstBatchWindow, "A"),
new KeyValue<>("A@" + secondBatchWindow, "A:A"),
new KeyValue<>("B@" + firstBatchWindow, "B"),
new KeyValue<>("B@" + secondBatchWindow, "B:B"),
new KeyValue<>("C@" + firstBatchWindow, "C"),
new KeyValue<>("C@" + secondBatchWindow, "C:C"),
new KeyValue<>("D@" + firstBatchWindow, "D"),
new KeyValue<>("D@" + secondBatchWindow, "D:D"),
new KeyValue<>("E@" + firstBatchWindow, "E"),
new KeyValue<>("E@" + secondBatchWindow, "E:E")
)
));
}
@Test
public void shouldGroupByKey() throws Exception {
final long timestamp = mockTime.milliseconds();
produceMessages(timestamp);
produceMessages(timestamp);
stream.groupByKey(Serdes.Integer(), Serdes.String())
.count(TimeWindows.of(500L), "count-windows")
.toStream(new KeyValueMapper<Windowed<Integer>, Long, String>() {
@Override
public String apply(final Windowed<Integer> windowedKey, final Long value) {
return windowedKey.key() + "@" + windowedKey.window().start();
}
}).to(Serdes.String(), Serdes.Long(), outputTopic);
startStreams();
final List<KeyValue<String, Long>> results = receiveMessages(
new StringDeserializer(),
new LongDeserializer()
, 5);
Collections.sort(results, new Comparator<KeyValue<String, Long>>() {
@Override
public int compare(final KeyValue<String, Long> o1, final KeyValue<String, Long> o2) {
return KStreamAggregationDedupIntegrationTest.compare(o1, o2);
}
});
final long window = timestamp / 500 * 500;
assertThat(results, is(Arrays.asList(
KeyValue.pair("1@" + window, 2L),
KeyValue.pair("2@" + window, 2L),
KeyValue.pair("3@" + window, 2L),
KeyValue.pair("4@" + window, 2L),
KeyValue.pair("5@" + window, 2L)
)));
}
private void produceMessages(long timestamp)
throws ExecutionException, InterruptedException {
IntegrationTestUtils.produceKeyValuesSynchronouslyWithTimestamp(
streamOneInput,
Arrays.asList(
new KeyValue<>(1, "A"),
new KeyValue<>(2, "B"),
new KeyValue<>(3, "C"),
new KeyValue<>(4, "D"),
new KeyValue<>(5, "E")),
TestUtils.producerConfig(
CLUSTER.bootstrapServers(),
IntegerSerializer.class,
StringSerializer.class,
new Properties()),
timestamp);
}
private void createTopics() {
streamOneInput = "stream-one-" + testNo;
outputTopic = "output-" + testNo;
CLUSTER.createTopic(streamOneInput, 3, 1);
CLUSTER.createTopic(outputTopic);
}
private void startStreams() {
kafkaStreams = new KafkaStreams(builder, streamsConfiguration);
kafkaStreams.start();
}
private <K, V> List<KeyValue<K, V>> receiveMessages(final Deserializer<K>
keyDeserializer,
final Deserializer<V>
valueDeserializer,
final int numMessages)
throws InterruptedException {
final Properties consumerProperties = new Properties();
consumerProperties
.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers());
consumerProperties.setProperty(ConsumerConfig.GROUP_ID_CONFIG, "kgroupedstream-test-" +
testNo);
consumerProperties.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
consumerProperties.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
keyDeserializer.getClass().getName());
consumerProperties.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
valueDeserializer.getClass().getName());
return IntegrationTestUtils.waitUntilMinKeyValueRecordsReceived(consumerProperties,
outputTopic,
numMessages, 60 * 1000);
}
}
| {
"content_hash": "b26b36dfb223d98f8aa39eea98655f2c",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 113,
"avg_line_length": 39.23076923076923,
"alnum_prop": 0.6249786871270248,
"repo_name": "geeag/kafka",
"id": "d672fd06e020ae4536cd526ccc20e068c8c75a14",
"size": "12518",
"binary": false,
"copies": "3",
"ref": "refs/heads/trunk",
"path": "streams/src/test/java/org/apache/kafka/streams/integration/KStreamAggregationDedupIntegrationTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "22196"
},
{
"name": "HTML",
"bytes": "5443"
},
{
"name": "Java",
"bytes": "5890050"
},
{
"name": "Python",
"bytes": "452869"
},
{
"name": "Scala",
"bytes": "3503598"
},
{
"name": "Shell",
"bytes": "54956"
},
{
"name": "XSLT",
"bytes": "7116"
}
],
"symlink_target": ""
} |
'use strict';
/**
* @class
* Initializes a new instance of the ResourceUsageListResult class.
* @constructor
* Output of check resource usage API.
*
* @member {string} [nextLink] URL to get the next set of custom domain objects
* if there are any.
*
*/
class ResourceUsageListResult extends Array {
constructor() {
super();
}
/**
* Defines the metadata of ResourceUsageListResult
*
* @returns {object} metadata of ResourceUsageListResult
*
*/
mapper() {
return {
required: false,
serializedName: 'ResourceUsageListResult',
type: {
name: 'Composite',
className: 'ResourceUsageListResult',
modelProperties: {
value: {
required: false,
serializedName: '',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'ResourceUsageElementType',
type: {
name: 'Composite',
className: 'ResourceUsage'
}
}
}
},
nextLink: {
required: false,
serializedName: 'nextLink',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = ResourceUsageListResult;
| {
"content_hash": "3e665ec6dc57e70f24c19b0132711dba",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 79,
"avg_line_length": 21.967741935483872,
"alnum_prop": 0.5073421439060205,
"repo_name": "AuxMon/azure-sdk-for-node",
"id": "a3d7098658de95b2a779857061d9e14044479d7e",
"size": "1679",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/services/cdnManagement/lib/models/resourceUsageListResult.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "661"
},
{
"name": "JavaScript",
"bytes": "48689677"
},
{
"name": "Shell",
"bytes": "437"
}
],
"symlink_target": ""
} |
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
# Dump of table fuel_archives
# ------------------------------------------------------------
CREATE TABLE `fuel_archives` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ref_id` int(10) unsigned NOT NULL,
`table_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`data` text COLLATE utf8_unicode_ci NOT NULL,
`version` smallint(5) unsigned NOT NULL,
`version_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`archived_user_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
# Dump of table fuel_blocks
# ------------------------------------------------------------
CREATE TABLE `fuel_blocks` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`view` text COLLATE utf8_unicode_ci NOT NULL,
`language` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'english',
`published` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes',
`date_added` datetime DEFAULT NULL,
`last_modified` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`,`language`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
# Dump of table fuel_categories
# ------------------------------------------------------------
CREATE TABLE `fuel_categories` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL DEFAULT '',
`slug` varchar(100) NOT NULL DEFAULT '',
`context` varchar(100) NOT NULL DEFAULT '',
`precedence` int(11) NOT NULL,
`parent_id` int(11) NOT NULL,
`published` enum('yes','no') NOT NULL DEFAULT 'yes',
PRIMARY KEY (`id`),
UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
# Dump of table fuel_logs
# ------------------------------------------------------------
CREATE TABLE `fuel_logs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`entry_date` datetime NOT NULL,
`user_id` int(11) NOT NULL,
`message` text COLLATE utf8_unicode_ci NOT NULL,
`type` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
# Dump of table fuel_navigation
# ------------------------------------------------------------
CREATE TABLE `fuel_navigation` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`location` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The part of the path after the domain name that you want the link to go to (e.g. comany/about_us)',
`group_id` int(5) unsigned NOT NULL DEFAULT '1',
`nav_key` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The nav key is a friendly ID that you can use for setting the selected state. If left blank, a default value will be set for you.',
`label` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The name you want to appear in the menu',
`parent_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Used for creating menu hierarchies. No value means it is a root level menu item',
`precedence` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The higher the number, the greater the precedence and farther up the list the navigational element will appear',
`attributes` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Extra attributes that can be used for navigation implementation',
`selected` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The pattern to match for the active state. Most likely you leave this field blank',
`hidden` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'no' COMMENT 'A hidden value can be used in rendering the menu. In some areas, the menu item may not want to be displayed',
`language` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'english',
`published` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes' COMMENT 'Determines whether the item is displayed or not',
PRIMARY KEY (`id`),
UNIQUE KEY `group_id_nav_key_language` (`group_id`,`nav_key`,`language`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
# Dump of table fuel_navigation_groups
# ------------------------------------------------------------
CREATE TABLE `fuel_navigation_groups` (
`id` int(3) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`published` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `fuel_navigation_groups` (`id`, `name`, `published`)
VALUES
(1, 'main', 'yes');
# Dump of table fuel_page_variables
# ------------------------------------------------------------
CREATE TABLE `fuel_page_variables` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`page_id` int(10) unsigned NOT NULL,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`scope` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`value` longtext COLLATE utf8_unicode_ci NOT NULL,
`type` enum('string','int','boolean','array') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'string',
`language` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'english',
`active` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes',
PRIMARY KEY (`id`),
UNIQUE KEY `page_id` (`page_id`,`name`,`language`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
# Dump of table fuel_pages
# ------------------------------------------------------------
CREATE TABLE `fuel_pages` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`location` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Add the part of the url after the root of your site (usually after the domain name). For the homepage, just put the word ''home''',
`layout` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'The name of the template to associate with this page',
`published` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes' COMMENT 'A ''yes'' value will display the page and an ''no'' value will give a 404 error message',
`cache` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes' COMMENT 'Cache controls whether the page will pull from the database or from a saved file which is more effeicent. If a page has content that is dynamic, it''s best to set cache to ''no''',
`date_added` datetime DEFAULT NULL,
`last_modified` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`last_modified_by` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `location` (`location`),
KEY `layout` (`layout`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
# Dump of table fuel_permissions
# ------------------------------------------------------------
CREATE TABLE `fuel_permissions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'In most cases, this should be the name of the module (e.g. news)',
`active` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
LOCK TABLES `fuel_permissions` WRITE;
/*!40000 ALTER TABLE `fuel_permissions` DISABLE KEYS */;
INSERT INTO `fuel_permissions` (`id`, `description`, `name`, `active`)
VALUES
(NULL,'Pages','pages','yes'),
(NULL,'Pages: Create','pages/create','yes'),
(NULL,'Pages: Edit','pages/edit','yes'),
(NULL,'Pages: Publish','pages/publish','yes'),
(NULL,'Pages: Delete','pages/delete','yes'),
(NULL,'Blocks','blocks','yes'),
(NULL,'Blocks: Create','blocks/create','yes'),
(NULL,'Blocks: Edit','blocks/edit','yes'),
(NULL,'Blocks: Publish','blocks/publish','yes'),
(NULL,'Blocks: Delete','blocks/delete','yes'),
(NULL,'Navigation','navigation','yes'),
(NULL,'Navigation: Create','navigation/create','yes'),
(NULL,'Navigation: Edit','navigation/edit','yes'),
(NULL,'Navigation: Publish','navigation/publish','yes'),
(NULL,'Navigation: Delete','navigation/delete','yes'),
(NULL,'Categories','categories','yes'),
(NULL,'Categories: Create','categories/create','yes'),
(NULL,'Categories: Edit','categories/edit','yes'),
(NULL,'Categories: Publish','categories/publish','yes'),
(NULL,'Categories: Delete','categories/delete','yes'),
(NULL,'Tags','tags','yes'),
(NULL,'Tags: Create','tags/create','yes'),
(NULL,'Tags: Edit','tags/edit','yes'),
(NULL,'Tags: Publish','tags/publish','yes'),
(NULL,'Tags: Delete','tags/delete','yes'),
(NULL,'Site Variables','sitevariables','yes'),
(NULL,'Assets','assets','yes'),
(NULL,'Site Documentation','site_docs','yes'),
(NULL,'Users','users','yes'),
(NULL,'Permissions','permissions','yes'),
(NULL,'Manage','manage','yes'),
(NULL,'Cache','manage/cache','yes'),
(NULL,'Logs','logs','yes'),
(NULL,'Settings','settings','yes'),
(NULL,'Generate Code','generate','yes');
/*!40000 ALTER TABLE `fuel_permissions` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table fuel_relationships
# ------------------------------------------------------------
CREATE TABLE `fuel_relationships` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`candidate_table` varchar(100) DEFAULT '',
`candidate_key` int(11) NOT NULL,
`foreign_table` varchar(100) DEFAULT NULL,
`foreign_key` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `candidate_table` (`candidate_table`,`candidate_key`),
KEY `foreign_table` (`foreign_table`,`foreign_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
# Dump of table fuel_settings
# ------------------------------------------------------------
CREATE TABLE `fuel_settings` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`module` varchar(50) NOT NULL DEFAULT '',
`key` varchar(50) NOT NULL DEFAULT '',
`value` longtext,
PRIMARY KEY (`id`),
UNIQUE KEY `module` (`module`,`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
# Dump of table fuel_site_variables
# ------------------------------------------------------------
CREATE TABLE `fuel_site_variables` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`value` text COLLATE utf8_unicode_ci NOT NULL,
`scope` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'leave blank if you want the variable to be available to all pages',
`active` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
# Dump of table fuel_tags
# ------------------------------------------------------------
CREATE TABLE `fuel_tags` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`category_id` int(10) unsigned NOT NULL,
`slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`precedence` int(11) NOT NULL,
`published` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes',
PRIMARY KEY (`id`),
UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
# Dump of table fuel_users
# ------------------------------------------------------------
CREATE TABLE `fuel_users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`first_name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`last_name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`language` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`reset_key` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`salt` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`super_admin` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'no',
`active` enum('yes','no') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `fuel_users` (`id`, `user_name`, `password`, `email`, `first_name`, `last_name`, `language`, `reset_key`, `salt`, `super_admin`, `active`)
VALUES
(1, 'admin', 'f4c99eae874755b97610d650be565f1ac42019d1', '', '', '', 'english', '', '429c6e14342dd7a63c510007a1858c26', 'yes', 'yes');
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| {
"content_hash": "1750a5fc8120b184416f4b63ade7e73f",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 263,
"avg_line_length": 45.42465753424658,
"alnum_prop": 0.6596049457177322,
"repo_name": "aa6my/GRR",
"id": "0a2753280c4e195b16b6b1d7867d7f979be3050e",
"size": "13264",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "fuel/install/fuel_schema.sql",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "78792"
},
{
"name": "JavaScript",
"bytes": "503613"
},
{
"name": "PHP",
"bytes": "4199251"
},
{
"name": "Perl",
"bytes": "2594"
},
{
"name": "Shell",
"bytes": "3301"
}
],
"symlink_target": ""
} |
package net.kilger.mockins.instructor;
import net.kilger.mockins.Mockins;
/**
* <p>The "instructor" objects returned by {@link Mockins#instructor(Object)}
* implement this interface.
* (Currently only a marker interface, this will later be used
* for further control of the instructor.)</p>
*/
public interface Instructor {
// currently only marker interface
}
| {
"content_hash": "e803175cc30e3964b9f32bdd87ec2704",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 26.928571428571427,
"alnum_prop": 0.7320954907161804,
"repo_name": "kilgerm/mockins",
"id": "189257f7dba6cea8261d2cbb9d3f1b539be27a1a",
"size": "377",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/net/kilger/mockins/instructor/Instructor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "187075"
}
],
"symlink_target": ""
} |
package com.hoserdude.toboot.service;
import com.hoserdude.toboot.domain.User;
import com.hoserdude.toboot.domainRepository.UserRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.openid.OpenIDAttribute;
import org.springframework.security.openid.OpenIDAuthenticationToken;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserServiceImpl implements UserService {
private static Logger logger = LoggerFactory.getLogger(UserService.class);
@Autowired
private UserRepository userRepository;
@Override
public UserDetails loadUserDetails(OpenIDAuthenticationToken token) throws UsernameNotFoundException {
final List<OpenIDAttribute> attributes = token.getAttributes();
String emailAddress = null;
String fullName = null;
String firstName = null;
String lastName = null;
//Grab their name and email
for (OpenIDAttribute attribute : attributes) {
String name = attribute.getName();
if (name.equals("email")) {
if (attribute.getCount() == 1) {
emailAddress = attribute.getValues().get(0);
}
}
if (name.equals("fullname")) {
if (attribute.getCount() == 1) {
fullName = attribute.getValues().get(0);
}
}
if (name.equals("firstname")) {
if (attribute.getCount() == 1) {
firstName = attribute.getValues().get(0);
}
}
if (name.equals("lastname")) {
if (attribute.getCount() == 1) {
lastName = attribute.getValues().get(0);
}
}
}
if (emailAddress != null) {
User user = userRepository.findByEmail(emailAddress);
if (user == null) {
//Create one
logger.info("Creating new user account for {}", emailAddress);
if (fullName == null) {
if (firstName != null && lastName != null) {
fullName = firstName + " " + lastName;
} else {
fullName = emailAddress;
}
}
user = new User((String)token.getPrincipal(), fullName, emailAddress);
user = userRepository.save(user);
} else {
logger.info("User account exists for {}", emailAddress);
}
return user;
} else {
throw new UsernameNotFoundException("No Email found in Identity Exchange");
}
}
}
| {
"content_hash": "53e6b892d2a2e7c55f9f0d91c3498598",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 106,
"avg_line_length": 38.311688311688314,
"alnum_prop": 0.5786440677966102,
"repo_name": "hoserdude/to-boot",
"id": "a8891584033ecb40076d13db683e87856282c275",
"size": "2950",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/hoserdude/toboot/service/UserServiceImpl.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "45383"
},
{
"name": "Java",
"bytes": "32695"
},
{
"name": "JavaScript",
"bytes": "366128"
}
],
"symlink_target": ""
} |
document.onkeypress=function(event){
console.log('mama mila ramu');
}; | {
"content_hash": "19f312786ed5f99ad96aaf08cede0a2f",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 36,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.7162162162162162,
"repo_name": "MaoCzedun/SearchWidget",
"id": "3f78f776fa6b9f3307f06db17c0f53cc7e5a404d",
"size": "74",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "74"
},
{
"name": "PHP",
"bytes": "2434"
}
],
"symlink_target": ""
} |
/**
* www.TheAIGames.com
* Heads Up Omaha pokerbot
*
* Last update: May 07, 2014
*
* @author Jim van Eeden, Starapple
* @version 1.0
* @License MIT License (http://opensource.org/Licenses/MIT)
*/
package bot;
import java.util.HashMap;
import java.util.Map;
import poker.Card;
import poker.HandHoldem;
import poker.PokerMove;
/**
* Class that parses strings given by the engine and stores values for later use.
*/
public class BotState {
private int round, smallBlind, bigBlind;
private boolean onButton;
private int myStack, opponentStack;
private int pot;
private PokerMove opponentMove;
private int currentBet;
private int amountToCall;
private HandHoldem hand;
private Card[] table;
private Map<String, String> settings = new HashMap<String, String>();
private String myName = "";
private int[] sidepots;
private int timeBank, timePerMove;
private int handsPerLevel;
/**
* Parses the settings for this game
*
* @param key
* : key of the information given
* @param value
* : value to be set for the key
*/
protected void updateSetting(String key, String value) {
settings.put(key, value);
if (key.equals("your_bot")) {
myName = value;
} else if (key.equals("timebank")) { // Maximum amount of time your bot can take for one response
timeBank = Integer.valueOf(value);
} else if (key.equals("time_per_move")) { // The extra amount of time you get per response
timePerMove = Integer.valueOf(value);
} else if (key.equals("hands_per_level")) { // Number of rounds before the blinds are increased
handsPerLevel = Integer.valueOf(value);
} else if (key.equals("starting_stack")) { // Starting stack for each bot
myStack = Integer.valueOf(value);
opponentStack = Integer.valueOf(value);
} else {
System.err.printf("Unknown settings command: %s %s\n", key, value);
}
}
/**
* Parses the match information
*
* @param key
* : key of the information given
* @param value
* : value to be set for the key
*/
protected void updateMatch(String key, String value) {
if (key.equals("round")) { // Round number
round = Integer.valueOf(value);
System.err.println("Round " + round); // printing the round to the output for debugging
resetRoundVariables();
} else if (key.equals("small_blind")) { // Value of the small blind
smallBlind = Integer.valueOf(value);
} else if (key.equals("big_blind")) { // Value of the big blind
bigBlind = Integer.valueOf(value);
} else if (key.equals("on_button")) { // Which bot has the button, onButton is true if it's your bot
onButton = value.equals(myName);
} else if (key.equals("max_win_pot")) { // The size of the current pot
pot = Integer.valueOf(value);
} else if (key.equals("amount_to_call")) { // The amount of the call
amountToCall = Integer.valueOf(value);
} else if (key.equals("table")) { // The cards on the table
table = parseCards(value);
} else {
System.err.printf("Unknown match command: %s %s\n", key, value);
}
}
/**
* Parses the information given about stacks, blinds and moves
*
* @param bot
* : bot that this move belongs to (either you or the opponent)
* @param key
* : key of the information given
* @param amount
* : value to be set for the key
*/
protected void updateMove(String bot, String key, String amount) {
if (bot.equals(myName)) {
if (key.equals("stack")) { // The amount in your starting stack
myStack = Integer.valueOf(amount);
} else if (key.equals("post")) { // The amount you have to pay for the blind
myStack -= Integer.valueOf(amount);
} else if (key.equals("hand")) { // Your cards
Card[] cards = parseCards(amount);
hand = new HandHoldem(cards[0], cards[1]);
} else if (key.equals("wins")) {
// Your winnings, not stored
} else {
// That should be all
}
} else { // assume it's the opponent
if (key.equals("stack")) { // The amount in your opponent's starting stack
opponentStack = Integer.valueOf(amount);
} else if (key.equals("post")) { // The amount your opponent paid for the blind
opponentStack -= Integer.valueOf(amount);
} else if (key.equals("hand")) {
// Hand of the opponent on a showdown, not stored
} else if (key.equals("wins")) {
// Opponent winnings, not stored
} else { // The move your opponent did
opponentMove = new PokerMove(bot, key, Integer.valueOf(amount));
}
}
}
/**
* Parse the input string from the engine to actual Card objects
*
* @param String
* value : input
* @return Card[] : array of Card objects
*/
private Card[] parseCards(String value) {
if (value.endsWith("]")) {
value = value.substring(0, value.length() - 1);
}
if (value.startsWith("[")) {
value = value.substring(1);
}
if (value.length() == 0) {
return new Card[0];
}
String[] parts = value.split(",");
Card[] cards = new Card[parts.length];
for (int i = 0; i < parts.length; ++i) {
cards[i] = Card.getCard(parts[i]);
}
return cards;
}
/**
* Reset all the variables at the start of the round, just to make sure we don't use old values
*/
private void resetRoundVariables() {
smallBlind = 0;
bigBlind = 0;
pot = 0;
opponentMove = null;
amountToCall = 0;
hand = null;
table = new Card[0];
}
public int getRound() {
return round;
}
public int getSmallBlind() {
return smallBlind;
}
public int getBigBlind() {
return bigBlind;
}
public boolean onButton() {
return onButton;
}
public int getmyStack() {
return myStack;
}
public int getOpponentStack() {
return opponentStack;
}
public int getPot() {
return pot;
}
public PokerMove getOpponentAction() {
return opponentMove;
}
public int getCurrentBet() {
return currentBet;
}
public HandHoldem getHand() {
return hand;
}
public Card[] getTable() {
return table;
}
public String getSetting(String key) {
return settings.get(key);
}
public int[] getSidepots() {
return sidepots;
}
public String getMyName() {
return myName;
}
public int getAmountToCall() {
return amountToCall;
}
}
| {
"content_hash": "8f6f87628167a1ee97b17cd5d07e6922",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 101,
"avg_line_length": 27.125506072874494,
"alnum_prop": 0.6013432835820895,
"repo_name": "stilkin/ai-poker",
"id": "738410f83bb9847f60f1afe9cb57cdcfdedf3188",
"size": "6700",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/bot/BotState.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "74273"
}
],
"symlink_target": ""
} |
<?php
declare(strict_types=1);
namespace OpenCFP;
final class WebPath implements PathInterface
{
public function basePath(): string
{
return '/';
}
public function uploadPath(): string
{
return '/uploads/';
}
public function assetsPath(): string
{
return '/assets/';
}
}
| {
"content_hash": "6119ff70df5f5e666462d47a6338c7da",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 44,
"avg_line_length": 13.52,
"alnum_prop": 0.5828402366863905,
"repo_name": "PHPBenelux/opencfp",
"id": "01646553feb9a8a7683e6a9dde52058b8d5b6e66",
"size": "556",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/WebPath.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2899"
},
{
"name": "Dockerfile",
"bytes": "3084"
},
{
"name": "HTML",
"bytes": "81911"
},
{
"name": "JavaScript",
"bytes": "31818"
},
{
"name": "Makefile",
"bytes": "1207"
},
{
"name": "PHP",
"bytes": "879866"
},
{
"name": "Shell",
"bytes": "5710"
}
],
"symlink_target": ""
} |
#ifndef __SCRIPT_INSTANCE_H__
#define __SCRIPT_INSTANCE_H__
#include "foundation/core/refcounted.h"
#include "foundation/util/scriptbind.h"
#include "foundation/util/monoapi.h"
#include "app/scriptfeature/inc/script_fwd_decl.h"
#include "appframework/app_fwd_decl.h"
//#include "app/physXfeature/PhysicsShapeComponent.h"
#include "app/scriptfeature/inc/script_message.h"
namespace Graphic
{
class RenderToTexture;
}
namespace App
{
class RenderComponent;
class CameraComponent;
/*
* instantiate a mono script,use this class to run a script
*/
class ScriptInstance : public Core::RefCounted
{
__DeclareSubClass( App::ScriptInstance, Core::RefCounted );
__ScriptBind
public:
/// constructor
ScriptInstance()
: m_pOwner( NULL )
, m_pArrEntryMethods( NULL )
, m_pMonoObj( NULL )
, m_pDicMethods( NULL )
, m_pMonoScript()
, m_sName()
, m_pDicRegistedMessageHandler( NULL )
, m_Ref(0)
{}
/// destructor
virtual ~ScriptInstance();
/// if this class has been init
bool IsInit( void );
/// Discard this obj
void Discard();
/// if a method had been writed in user's class.
bool IsScriptMethodExist(EEntryMethodIndex methodIndex);
/// get owner actor
Actor* GetOwner( void );
/// initialize this class from a script
bool Init( const TMonoScriptPtr& pMonoScript );
/// set owner actor of this instance
void SetOwner( Actor* pOwner );
/// get mono script
MonoScript* GetMonoScript( void );
/// Call mono method , use mono_runtime_invoke internally.
MonoObject* CallMethod( const char* methodName, void** params );
/// call script function "OnBeginFrame"
void OnBeginFrame( void );
/// call script function "OnFrame"
void OnFrame( void );
/// call script function "OnEndFrame"
void OnEndFrame( void );
/// call script function "OnLoad"
void OnLoad( void );
/// call script function "OnExit"
void OnExit( void );
/// call script function "OnStopped"
void OnStopped( void );
/// call script function "OnResumed"
void OnResumed( void );
/// call script function "OnWillRenderObject"
void OnWillRenderObject( RenderComponent* renderComponent );
/// call script function "OnRenderPostEffect"
bool OnRenderPostEffect(CameraComponent* camera, Graphic::RenderToTexture* source, Graphic::RenderToTexture* destination);
/// get name
const Util::String& GetName() const;
/// set name
void SetName( const Util::String& name );
/// get c# instance
MonoObject* GetMonoInstance();
/// throw the msg to the script side
void HandleMessage( const TScriptMessagePtr& msg );
private:
MonoObject* invokeScript(EEntryMethodIndex methodIndex, void** params = NULL);
Actor* m_pOwner; ///< - owner of this script
TMonoMethodArray* m_pArrEntryMethods; ///< - methods which will be call by engine
TMonoMethodMap* m_pDicMethods; ///< - all method of a script, get from mono script,temp code
MonoObject* m_pMonoObj; ///< - script instance on Mono side
TMonoScriptPtr m_pMonoScript; ///< - mono script which init this class
Util::String m_sName; ///< - name of the script on script side
ScriptMessageHandlerMap* m_pDicRegistedMessageHandler; ///< - pointer to a recored registered message handler map
int m_Ref;
};
// - implement of inline function
inline bool ScriptInstance::IsInit( void )
{
return ( (NULL!=m_pOwner) && (NULL!=m_pMonoObj) );
}
//------------------------------------------------------------------------
inline Actor* ScriptInstance::GetOwner( void )
{
return m_pOwner;
}
//------------------------------------------------------------------------
inline MonoScript* ScriptInstance::GetMonoScript( void )
{
return m_pMonoScript.get();
}
//------------------------------------------------------------------------
inline const Util::String& ScriptInstance::GetName() const
{
return m_sName;
}
//------------------------------------------------------------------------
inline void ScriptInstance::SetName( const Util::String& name )
{
m_sName = name;
}
//------------------------------------------------------------------------
inline MonoObject* ScriptInstance::GetMonoInstance()
{
return m_pMonoObj;
}
//------------------------------------------------------------------------
inline bool ScriptInstance::IsScriptMethodExist(EEntryMethodIndex methodIndex)
{
if ( IsInit() )
{
MonoMethod* pMethod = m_pArrEntryMethods->operator[]( methodIndex );
return NULL != pMethod;
}
return false;
}
//------------------------------------------------------------------------
inline MonoObject* ScriptInstance::invokeScript(EEntryMethodIndex methodIndex, void** params /* = NULL */)
{
if ( IsInit() )
{
MonoMethod* pMethod = m_pArrEntryMethods->operator[]( methodIndex );
if ( pMethod )
{
return Utility_MonoRuntimeInvoke( pMethod, m_pMonoObj, params );
}
}
return NULL;
}
}
#endif // - __SCRIPT_INSTANCE_H__
| {
"content_hash": "0aa459778d3bbab98f9f15224cbaeb38",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 124,
"avg_line_length": 32.23376623376623,
"alnum_prop": 0.6206688154713941,
"repo_name": "EngineDreamer/DreamEngine",
"id": "cf3f1a72701c03fde74bd66f2d2b1d3b4379a2d3",
"size": "6228",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Engine/app/scriptfeature/inc/script_instance.h",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package com.capone.recordvalidation.csv;
import java.util.ArrayList;
import java.util.List;
import org.drools.KnowledgeBase;
import org.drools.runtime.StatefulKnowledgeSession;
import com.capone.processes.ManageDT;
import com.capone.recordvalidation.Record;
public class DataQualityTest {
public static void main(String[] args) {
ManageDT manager = new ManageDT();
manager.loadDT();
KnowledgeBase kb = manager.getKnowledgeBase();
StatefulKnowledgeSession session = kb.newStatefulKnowledgeSession();
// TODO Auto-generated method stub
String fileName = "dataInput1.csv";
System.out.println("\nRead CSV file:");
CsvFileReader myreader = new CsvFileReader();
List<Record> recordList = new ArrayList<Record>();
recordList = myreader.readCsvFile(fileName);
System.out.println("\nRead CSV file: DATA Below:"+recordList);
for (Record record : recordList) {
//System.out.println(record.isValid());
System.out.println(record.toString());
}
for (Record r : recordList) {
session.insert(r);
}
session.fireAllRules();
System.out.println("\nFireAllRules: DATA Below:");
for (Record record : recordList) {
//System.out.println(record.isValid());
System.out.println(record.getMessages());
}
fileName = "dataLoadResult.csv";
System.out.println("Write CSV file:");
CsvFileWriter.writeCsvFile(fileName, recordList);
}
} | {
"content_hash": "377eaf7846968a4a291780aad5c728f3",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 70,
"avg_line_length": 25.363636363636363,
"alnum_prop": 0.7247311827956989,
"repo_name": "anurag-saran/BRMS-DataQuality",
"id": "14d7a54e0bdd6ace3f8fac7aa99e0fed4731bd4f",
"size": "1395",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DataQuality_v2/RecordValidation/src/main/java/com/capone/recordvalidation/csv/DataQualityTest.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "111500"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Join Host"
android:textSize="35dp"
android:id="@+id/textView"
android:layout_gravity="center_horizontal" />
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/hostList"
android:layout_gravity="center_horizontal" />
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="@+id/progressBar1"
android:visibility="invisible" />
</LinearLayout> | {
"content_hash": "2ad02e6b5972eb7a5e6cd712e6d46202",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 72,
"avg_line_length": 34.666666666666664,
"alnum_prop": 0.6673076923076923,
"repo_name": "CAPS-Robotics/FRC-Scouting-app",
"id": "83b187803e5dc0a01a7b6253877b5b538f8957c2",
"size": "1040",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "FIRST-Scouting-App/src/main/res/layout/join_host.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Groovy",
"bytes": "600"
},
{
"name": "Java",
"bytes": "94438"
},
{
"name": "Shell",
"bytes": "2314"
}
],
"symlink_target": ""
} |
layout: default
modal-id: 31
date: 2010-09-15
img: dylangatto.jpg
thumb: dylangatto.sm.jpg
alt: image-alt
project-date: 2017
client: Commission
category: Painting
description: Dylan Dog and Cagliostro the cat. Acrylic painting on board. Private collection.
---
| {
"content_hash": "8f064eb536d6f88ddb51c0391939add6",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 93,
"avg_line_length": 21.833333333333332,
"alnum_prop": 0.7824427480916031,
"repo_name": "AlessiaLenti/alessialenti.github.io",
"id": "86af77df6303936383df3d00d0c01b387a4e7853",
"size": "266",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2010-09-15-Dylan-and-Cagliostro.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8293"
},
{
"name": "HTML",
"bytes": "14229"
},
{
"name": "JavaScript",
"bytes": "43724"
},
{
"name": "PHP",
"bytes": "1224"
}
],
"symlink_target": ""
} |
// Provides control sap.ui.commons.Callout.
sap.ui.define(['jquery.sap.global', './CalloutBase', './library', "./CalloutRenderer"],
function(jQuery, CalloutBase, library, CalloutRenderer) {
"use strict";
/**
* Constructor for a new Callout.
*
* @param {string} [sId] ID for the new control, generated automatically if no ID is given
* @param {object} [mSettings] Initial settings for the new control
*
* @class
* Callout is a small popup with some useful information and links that is shown when a mouse is hovered over a specific view element.
* @extends sap.ui.commons.CalloutBase
*
* @author SAP SE
* @version ${version}
*
* @constructor
* @public
* @deprecated Since version 1.38. Tf you want to achieve a similar behavior, use a <code>sap.m.Popover</code> control and open it next to your control.
* @alias sap.ui.commons.Callout
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var Callout = CalloutBase.extend("sap.ui.commons.Callout", /** @lends sap.ui.commons.Callout.prototype */ { metadata : {
library : "sap.ui.commons",
aggregations : {
/**
* Determines the content of the Callout
*/
content : {type : "sap.ui.core.Control", multiple : true, singularName : "content"}
}
}});
///**
// * This file defines behavior for the Callout control
// */
return Callout;
}, /* bExport= */ true);
| {
"content_hash": "99d0ad16318899963c2eefc757e47314",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 153,
"avg_line_length": 30.382978723404257,
"alnum_prop": 0.680672268907563,
"repo_name": "cschuff/openui5",
"id": "54be8e06e3a95ee1242c38efa520423a30e31ccf",
"size": "1451",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/sap.ui.commons/src/sap/ui/commons/Callout.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2918722"
},
{
"name": "Gherkin",
"bytes": "17198"
},
{
"name": "HTML",
"bytes": "18167339"
},
{
"name": "Java",
"bytes": "84288"
},
{
"name": "JavaScript",
"bytes": "49673115"
}
],
"symlink_target": ""
} |
extern crate proc_macro;
use proc_macro::{TokenStream, TokenTree, Ident, Punct, Spacing, Span};
#[proc_macro]
pub fn make_struct(input: TokenStream) -> TokenStream {
match input.into_iter().next().unwrap() {
TokenTree::Ident(ident) => {
vec![
TokenTree::Ident(Ident::new("struct", Span::call_site())),
TokenTree::Ident(Ident::new_raw(&ident.to_string(), Span::call_site())),
TokenTree::Punct(Punct::new(';', Spacing::Alone))
].into_iter().collect()
}
_ => panic!()
}
}
#[proc_macro]
pub fn make_bad_struct(input: TokenStream) -> TokenStream {
match input.into_iter().next().unwrap() {
TokenTree::Ident(ident) => {
vec![
TokenTree::Ident(Ident::new_raw("struct", Span::call_site())),
TokenTree::Ident(Ident::new(&ident.to_string(), Span::call_site())),
TokenTree::Punct(Punct::new(';', Spacing::Alone))
].into_iter().collect()
}
_ => panic!()
}
}
| {
"content_hash": "7e51148b2814e7aa52beec0e4a698747",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 88,
"avg_line_length": 35.2,
"alnum_prop": 0.5359848484848485,
"repo_name": "graydon/rust",
"id": "9daee21aa17d458aea9794d9eac5a09d57baadb0",
"size": "1123",
"binary": false,
"copies": "18",
"ref": "refs/heads/master",
"path": "src/test/ui/proc-macro/auxiliary/raw-ident.rs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "4990"
},
{
"name": "Assembly",
"bytes": "20064"
},
{
"name": "Awk",
"bytes": "159"
},
{
"name": "Bison",
"bytes": "78848"
},
{
"name": "C",
"bytes": "725899"
},
{
"name": "C++",
"bytes": "55803"
},
{
"name": "CSS",
"bytes": "22181"
},
{
"name": "JavaScript",
"bytes": "36295"
},
{
"name": "LLVM",
"bytes": "1587"
},
{
"name": "Makefile",
"bytes": "227056"
},
{
"name": "Puppet",
"bytes": "16300"
},
{
"name": "Python",
"bytes": "142548"
},
{
"name": "RenderScript",
"bytes": "99815"
},
{
"name": "Rust",
"bytes": "18342682"
},
{
"name": "Shell",
"bytes": "269546"
},
{
"name": "TeX",
"bytes": "57"
}
],
"symlink_target": ""
} |
package io.quarkus.hibernate.orm.panache.deployment.test;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import io.quarkus.test.QuarkusUnitTest;
public class NoConfigTest {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest().setArchiveProducer(
() -> ShrinkWrap.create(JavaArchive.class));
@Test
public void testNoConfig() {
// we should be able to start the application, even with no configuration at all
}
}
| {
"content_hash": "fe7b238e945782057979973569c31929",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 88,
"avg_line_length": 31.1,
"alnum_prop": 0.7540192926045016,
"repo_name": "quarkusio/quarkus",
"id": "8c68c2e4aba8c4f35a4a6d1c604bf3eef6356135",
"size": "622",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "extensions/panache/hibernate-orm-panache/deployment/src/test/java/io/quarkus/hibernate/orm/panache/deployment/test/NoConfigTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "23342"
},
{
"name": "Batchfile",
"bytes": "13096"
},
{
"name": "CSS",
"bytes": "6685"
},
{
"name": "Dockerfile",
"bytes": "459"
},
{
"name": "FreeMarker",
"bytes": "8106"
},
{
"name": "Groovy",
"bytes": "16133"
},
{
"name": "HTML",
"bytes": "1418749"
},
{
"name": "Java",
"bytes": "38584810"
},
{
"name": "JavaScript",
"bytes": "90960"
},
{
"name": "Kotlin",
"bytes": "704351"
},
{
"name": "Mustache",
"bytes": "13191"
},
{
"name": "Scala",
"bytes": "9756"
},
{
"name": "Shell",
"bytes": "71729"
}
],
"symlink_target": ""
} |
package com.pokevian.app.smartfleet.ui.version;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import com.pokevian.app.smartfleet.R;
public class VersionInfoDialogFragment extends DialogFragment {
public static final String TAG = "VersionInfoDialogFragment";
public static VersionInfoDialogFragment newInstance() {
VersionInfoDialogFragment fragment = new VersionInfoDialogFragment();
return fragment;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
PackageInfo pkgInfo = getPackageInfo();
if (pkgInfo != null) {
PackageManager pm = getActivity().getPackageManager();
final Drawable icon = pkgInfo.applicationInfo.loadIcon(pm);
final CharSequence label = pkgInfo.applicationInfo.loadLabel(pm);
final String versionName = pkgInfo.versionName;
return new AlertDialog.Builder(getActivity())
.setIcon(icon)
.setTitle(label)
.setMessage(versionName)
.setPositiveButton(R.string.btn_ok, null)
.create();
} else {
return null;
}
}
private PackageInfo getPackageInfo() {
PackageInfo pkgInfo = null;
try {
PackageManager pm = getActivity().getPackageManager();
pkgInfo = pm.getPackageInfo(getActivity().getPackageName(), 0);
} catch (NameNotFoundException e) {
}
return pkgInfo;
}
}
| {
"content_hash": "d128a85c91e7ff14a23a21148dfe6b7a",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 77,
"avg_line_length": 32.63636363636363,
"alnum_prop": 0.6635097493036212,
"repo_name": "Pokevian/caroolive-app",
"id": "06ab0cfe10dde7fb3eea80a856a6c1362d1ada18",
"size": "2397",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/pokevian/app/smartfleet/ui/version/VersionInfoDialogFragment.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "810"
},
{
"name": "HTML",
"bytes": "627"
},
{
"name": "IDL",
"bytes": "989"
},
{
"name": "Java",
"bytes": "2175122"
}
],
"symlink_target": ""
} |
<?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */
$this->title = 'Sign In';
$fieldOptions1 = [
'options' => ['class' => 'form-group has-feedback'],
'inputTemplate' => "{input}<span class='glyphicon glyphicon-envelope form-control-feedback'></span>"
];
$fieldOptions2 = [
'options' => ['class' => 'form-group has-feedback'],
'inputTemplate' => "{input}<span class='glyphicon glyphicon-lock form-control-feedback'></span>"
];
?>
<div class="login-box">
<div class="login-logo">
<a href="#"><b>BINTAN BATAM</b> TELEKOMUNIKASI</a>
</div>
<!-- /.login-logo -->
<div class="login-box-body">
<p class="login-box-msg">Change Password </p>
<?php $form = ActiveForm::begin(['id' => 'login-form', 'enableClientValidation' => false]); ?>
<div class="hide">
<?= $form
->field($model, 'username', ['inputOptions'=>['value'=>$username,'readonly'=>'readonly']])
->textInput(['placeholder' => $model->getAttributeLabel('username')])
?>
</div>
<?= $form->field($model, 'old_password', $fieldOptions2)->passwordInput()
->label(false)
->passwordInput(['placeholder' => $model->getAttributeLabel('old_password')]) ?>
<?= $form->field($model, 'new_password', $fieldOptions2)->passwordInput()
->label(false)
->passwordInput(['placeholder' => $model->getAttributeLabel('new_password')])
?>
<?= $form->field($model, 'repeat_password', $fieldOptions2)->passwordInput()
->label(false)
->passwordInput(['placeholder' => $model->getAttributeLabel('repeat_password')])
?>
<div class="row">
<div class="col-xs-8">
<?php //$form->field($model, 'rememberMe')->checkbox() ?>
</div>
<!-- /.col -->
<div class="col-xs-4">
<?= Html::submitButton('Sign in', ['class' => 'btn btn-primary btn-block btn-flat', 'name' => 'login-button']) ?>
</div>
<!-- /.col -->
</div>
<?php ActiveForm::end(); ?>
</div>
<!-- /.login-box-body -->
</div><!-- /.login-box -->
| {
"content_hash": "18867f19585149ef10aabc1f88a681ed",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 129,
"avg_line_length": 35.88235294117647,
"alnum_prop": 0.5131147540983606,
"repo_name": "budipratama/admin_lte",
"id": "fd35100b93e79d4ce5da49eabe63aa54b9ddcfc8",
"size": "2440",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "backend/views/site/change-password.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1541"
},
{
"name": "CSS",
"bytes": "582738"
},
{
"name": "JavaScript",
"bytes": "7716725"
},
{
"name": "PHP",
"bytes": "844437"
}
],
"symlink_target": ""
} |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/devtools/artifactregistry/v1beta2/file.proto
package com.google.devtools.artifactregistry.v1beta2;
/**
*
*
* <pre>
* A hash of file content.
* </pre>
*
* Protobuf type {@code google.devtools.artifactregistry.v1beta2.Hash}
*/
public final class Hash extends com.google.protobuf.GeneratedMessageV3
implements
// @@protoc_insertion_point(message_implements:google.devtools.artifactregistry.v1beta2.Hash)
HashOrBuilder {
private static final long serialVersionUID = 0L;
// Use Hash.newBuilder() to construct.
private Hash(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Hash() {
type_ = 0;
value_ = com.google.protobuf.ByteString.EMPTY;
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new Hash();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
return this.unknownFields;
}
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.devtools.artifactregistry.v1beta2.FileProto
.internal_static_google_devtools_artifactregistry_v1beta2_Hash_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.devtools.artifactregistry.v1beta2.FileProto
.internal_static_google_devtools_artifactregistry_v1beta2_Hash_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.devtools.artifactregistry.v1beta2.Hash.class,
com.google.devtools.artifactregistry.v1beta2.Hash.Builder.class);
}
/**
*
*
* <pre>
* The algorithm used to compute the hash.
* </pre>
*
* Protobuf enum {@code google.devtools.artifactregistry.v1beta2.Hash.HashType}
*/
public enum HashType implements com.google.protobuf.ProtocolMessageEnum {
/**
*
*
* <pre>
* Unspecified.
* </pre>
*
* <code>HASH_TYPE_UNSPECIFIED = 0;</code>
*/
HASH_TYPE_UNSPECIFIED(0),
/**
*
*
* <pre>
* SHA256 hash.
* </pre>
*
* <code>SHA256 = 1;</code>
*/
SHA256(1),
/**
*
*
* <pre>
* MD5 hash.
* </pre>
*
* <code>MD5 = 2;</code>
*/
MD5(2),
UNRECOGNIZED(-1),
;
/**
*
*
* <pre>
* Unspecified.
* </pre>
*
* <code>HASH_TYPE_UNSPECIFIED = 0;</code>
*/
public static final int HASH_TYPE_UNSPECIFIED_VALUE = 0;
/**
*
*
* <pre>
* SHA256 hash.
* </pre>
*
* <code>SHA256 = 1;</code>
*/
public static final int SHA256_VALUE = 1;
/**
*
*
* <pre>
* MD5 hash.
* </pre>
*
* <code>MD5 = 2;</code>
*/
public static final int MD5_VALUE = 2;
public final int getNumber() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static HashType valueOf(int value) {
return forNumber(value);
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
*/
public static HashType forNumber(int value) {
switch (value) {
case 0:
return HASH_TYPE_UNSPECIFIED;
case 1:
return SHA256;
case 2:
return MD5;
default:
return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<HashType> internalGetValueMap() {
return internalValueMap;
}
private static final com.google.protobuf.Internal.EnumLiteMap<HashType> internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<HashType>() {
public HashType findValueByNumber(int number) {
return HashType.forNumber(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalStateException(
"Can't get the descriptor of an unrecognized enum value.");
}
return getDescriptor().getValues().get(ordinal());
}
public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
return com.google.devtools.artifactregistry.v1beta2.Hash.getDescriptor()
.getEnumTypes()
.get(0);
}
private static final HashType[] VALUES = values();
public static HashType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
private final int value;
private HashType(int value) {
this.value = value;
}
// @@protoc_insertion_point(enum_scope:google.devtools.artifactregistry.v1beta2.Hash.HashType)
}
public static final int TYPE_FIELD_NUMBER = 1;
private int type_;
/**
*
*
* <pre>
* The algorithm used to compute the hash value.
* </pre>
*
* <code>.google.devtools.artifactregistry.v1beta2.Hash.HashType type = 1;</code>
*
* @return The enum numeric value on the wire for type.
*/
@java.lang.Override
public int getTypeValue() {
return type_;
}
/**
*
*
* <pre>
* The algorithm used to compute the hash value.
* </pre>
*
* <code>.google.devtools.artifactregistry.v1beta2.Hash.HashType type = 1;</code>
*
* @return The type.
*/
@java.lang.Override
public com.google.devtools.artifactregistry.v1beta2.Hash.HashType getType() {
@SuppressWarnings("deprecation")
com.google.devtools.artifactregistry.v1beta2.Hash.HashType result =
com.google.devtools.artifactregistry.v1beta2.Hash.HashType.valueOf(type_);
return result == null
? com.google.devtools.artifactregistry.v1beta2.Hash.HashType.UNRECOGNIZED
: result;
}
public static final int VALUE_FIELD_NUMBER = 2;
private com.google.protobuf.ByteString value_;
/**
*
*
* <pre>
* The hash value.
* </pre>
*
* <code>bytes value = 2;</code>
*
* @return The value.
*/
@java.lang.Override
public com.google.protobuf.ByteString getValue() {
return value_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
if (type_
!= com.google.devtools.artifactregistry.v1beta2.Hash.HashType.HASH_TYPE_UNSPECIFIED
.getNumber()) {
output.writeEnum(1, type_);
}
if (!value_.isEmpty()) {
output.writeBytes(2, value_);
}
getUnknownFields().writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (type_
!= com.google.devtools.artifactregistry.v1beta2.Hash.HashType.HASH_TYPE_UNSPECIFIED
.getNumber()) {
size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, type_);
}
if (!value_.isEmpty()) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, value_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.devtools.artifactregistry.v1beta2.Hash)) {
return super.equals(obj);
}
com.google.devtools.artifactregistry.v1beta2.Hash other =
(com.google.devtools.artifactregistry.v1beta2.Hash) obj;
if (type_ != other.type_) return false;
if (!getValue().equals(other.getValue())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + TYPE_FIELD_NUMBER;
hash = (53 * hash) + type_;
hash = (37 * hash) + VALUE_FIELD_NUMBER;
hash = (53 * hash) + getValue().hashCode();
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseFrom(
java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseFrom(
java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseFrom(
byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseFrom(
java.io.InputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseDelimitedFrom(
java.io.InputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseDelimitedFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseFrom(
com.google.protobuf.CodedInputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.devtools.artifactregistry.v1beta2.Hash parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() {
return newBuilder();
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.devtools.artifactregistry.v1beta2.Hash prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
*
* <pre>
* A hash of file content.
* </pre>
*
* Protobuf type {@code google.devtools.artifactregistry.v1beta2.Hash}
*/
public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
implements
// @@protoc_insertion_point(builder_implements:google.devtools.artifactregistry.v1beta2.Hash)
com.google.devtools.artifactregistry.v1beta2.HashOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.devtools.artifactregistry.v1beta2.FileProto
.internal_static_google_devtools_artifactregistry_v1beta2_Hash_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.devtools.artifactregistry.v1beta2.FileProto
.internal_static_google_devtools_artifactregistry_v1beta2_Hash_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.devtools.artifactregistry.v1beta2.Hash.class,
com.google.devtools.artifactregistry.v1beta2.Hash.Builder.class);
}
// Construct using com.google.devtools.artifactregistry.v1beta2.Hash.newBuilder()
private Builder() {}
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
}
@java.lang.Override
public Builder clear() {
super.clear();
type_ = 0;
value_ = com.google.protobuf.ByteString.EMPTY;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
return com.google.devtools.artifactregistry.v1beta2.FileProto
.internal_static_google_devtools_artifactregistry_v1beta2_Hash_descriptor;
}
@java.lang.Override
public com.google.devtools.artifactregistry.v1beta2.Hash getDefaultInstanceForType() {
return com.google.devtools.artifactregistry.v1beta2.Hash.getDefaultInstance();
}
@java.lang.Override
public com.google.devtools.artifactregistry.v1beta2.Hash build() {
com.google.devtools.artifactregistry.v1beta2.Hash result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.devtools.artifactregistry.v1beta2.Hash buildPartial() {
com.google.devtools.artifactregistry.v1beta2.Hash result =
new com.google.devtools.artifactregistry.v1beta2.Hash(this);
result.type_ = type_;
result.value_ = value_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.devtools.artifactregistry.v1beta2.Hash) {
return mergeFrom((com.google.devtools.artifactregistry.v1beta2.Hash) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.devtools.artifactregistry.v1beta2.Hash other) {
if (other == com.google.devtools.artifactregistry.v1beta2.Hash.getDefaultInstance())
return this;
if (other.type_ != 0) {
setTypeValue(other.getTypeValue());
}
if (other.getValue() != com.google.protobuf.ByteString.EMPTY) {
setValue(other.getValue());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8:
{
type_ = input.readEnum();
break;
} // case 8
case 18:
{
value_ = input.readBytes();
break;
} // case 18
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int type_ = 0;
/**
*
*
* <pre>
* The algorithm used to compute the hash value.
* </pre>
*
* <code>.google.devtools.artifactregistry.v1beta2.Hash.HashType type = 1;</code>
*
* @return The enum numeric value on the wire for type.
*/
@java.lang.Override
public int getTypeValue() {
return type_;
}
/**
*
*
* <pre>
* The algorithm used to compute the hash value.
* </pre>
*
* <code>.google.devtools.artifactregistry.v1beta2.Hash.HashType type = 1;</code>
*
* @param value The enum numeric value on the wire for type to set.
* @return This builder for chaining.
*/
public Builder setTypeValue(int value) {
type_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* The algorithm used to compute the hash value.
* </pre>
*
* <code>.google.devtools.artifactregistry.v1beta2.Hash.HashType type = 1;</code>
*
* @return The type.
*/
@java.lang.Override
public com.google.devtools.artifactregistry.v1beta2.Hash.HashType getType() {
@SuppressWarnings("deprecation")
com.google.devtools.artifactregistry.v1beta2.Hash.HashType result =
com.google.devtools.artifactregistry.v1beta2.Hash.HashType.valueOf(type_);
return result == null
? com.google.devtools.artifactregistry.v1beta2.Hash.HashType.UNRECOGNIZED
: result;
}
/**
*
*
* <pre>
* The algorithm used to compute the hash value.
* </pre>
*
* <code>.google.devtools.artifactregistry.v1beta2.Hash.HashType type = 1;</code>
*
* @param value The type to set.
* @return This builder for chaining.
*/
public Builder setType(com.google.devtools.artifactregistry.v1beta2.Hash.HashType value) {
if (value == null) {
throw new NullPointerException();
}
type_ = value.getNumber();
onChanged();
return this;
}
/**
*
*
* <pre>
* The algorithm used to compute the hash value.
* </pre>
*
* <code>.google.devtools.artifactregistry.v1beta2.Hash.HashType type = 1;</code>
*
* @return This builder for chaining.
*/
public Builder clearType() {
type_ = 0;
onChanged();
return this;
}
private com.google.protobuf.ByteString value_ = com.google.protobuf.ByteString.EMPTY;
/**
*
*
* <pre>
* The hash value.
* </pre>
*
* <code>bytes value = 2;</code>
*
* @return The value.
*/
@java.lang.Override
public com.google.protobuf.ByteString getValue() {
return value_;
}
/**
*
*
* <pre>
* The hash value.
* </pre>
*
* <code>bytes value = 2;</code>
*
* @param value The value to set.
* @return This builder for chaining.
*/
public Builder setValue(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
value_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* The hash value.
* </pre>
*
* <code>bytes value = 2;</code>
*
* @return This builder for chaining.
*/
public Builder clearValue() {
value_ = getDefaultInstance().getValue();
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.devtools.artifactregistry.v1beta2.Hash)
}
// @@protoc_insertion_point(class_scope:google.devtools.artifactregistry.v1beta2.Hash)
private static final com.google.devtools.artifactregistry.v1beta2.Hash DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.devtools.artifactregistry.v1beta2.Hash();
}
public static com.google.devtools.artifactregistry.v1beta2.Hash getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<Hash> PARSER =
new com.google.protobuf.AbstractParser<Hash>() {
@java.lang.Override
public Hash parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser<Hash> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<Hash> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.devtools.artifactregistry.v1beta2.Hash getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| {
"content_hash": "66d9977b227137a8a3438d68c6f8fac2",
"timestamp": "",
"source": "github",
"line_count": 834,
"max_line_length": 100,
"avg_line_length": 29.92086330935252,
"alnum_prop": 0.6561673479201732,
"repo_name": "googleapis/google-cloud-java",
"id": "74c6813ac4a44b571e17f81f2ceaf01010050a47",
"size": "25548",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "java-artifact-registry/proto-google-cloud-artifact-registry-v1beta2/src/main/java/com/google/devtools/artifactregistry/v1beta2/Hash.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "2614"
},
{
"name": "HCL",
"bytes": "28592"
},
{
"name": "Java",
"bytes": "826434232"
},
{
"name": "Jinja",
"bytes": "2292"
},
{
"name": "Python",
"bytes": "200408"
},
{
"name": "Shell",
"bytes": "97954"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<dubbo:application name="zheng-upms-rpc-service"/>
<dubbo:registry address="zookeeper://zkserver:2181"/>
<dubbo:protocol name="dubbo" port="20881"/>
<!--<dubbo:monitor protocol="registry"/>-->
<!-- 系统 -->
<bean id="upmsSystemService" class="com.zheng.upms.rpc.service.impl.UpmsSystemServiceImpl"/>
<dubbo:service interface="com.zheng.upms.rpc.api.UpmsSystemService" ref="upmsSystemService" timeout="10000"/>
<!-- 组织 -->
<bean id="upmsOrganizationService" class="com.zheng.upms.rpc.service.impl.UpmsOrganizationServiceImpl"/>
<dubbo:service interface="com.zheng.upms.rpc.api.UpmsOrganizationService" ref="upmsOrganizationService" timeout="10000"/>
<!-- 用户组织 -->
<bean id="upmsUserOrganizationService" class="com.zheng.upms.rpc.service.impl.UpmsUserOrganizationServiceImpl"/>
<dubbo:service interface="com.zheng.upms.rpc.api.UpmsUserOrganizationService" ref="upmsUserOrganizationService" timeout="10000"/>
<!-- 用户 -->
<bean id="upmsUserService" class="com.zheng.upms.rpc.service.impl.UpmsUserServiceImpl"/>
<dubbo:service interface="com.zheng.upms.rpc.api.UpmsUserService" ref="upmsUserService" timeout="10000"/>
<!-- 角色 -->
<bean id="upmsRoleService" class="com.zheng.upms.rpc.service.impl.UpmsRoleServiceImpl"/>
<dubbo:service interface="com.zheng.upms.rpc.api.UpmsRoleService" ref="upmsRoleService" timeout="10000"/>
<!-- 权限 -->
<bean id="upmsPermissionService" class="com.zheng.upms.rpc.service.impl.UpmsPermissionServiceImpl"/>
<dubbo:service interface="com.zheng.upms.rpc.api.UpmsPermissionService" ref="upmsPermissionService" timeout="10000"/>
<!-- 角色权限 -->
<bean id="upmsRolePermissionService" class="com.zheng.upms.rpc.service.impl.UpmsRolePermissionServiceImpl"/>
<dubbo:service interface="com.zheng.upms.rpc.api.UpmsRolePermissionService" ref="upmsRolePermissionService" timeout="10000"/>
<!-- 用户权限 -->
<bean id="upmsUserPermissionService" class="com.zheng.upms.rpc.service.impl.UpmsUserPermissionServiceImpl"/>
<dubbo:service interface="com.zheng.upms.rpc.api.UpmsUserPermissionService" ref="upmsUserPermissionService" timeout="10000"/>
<!-- 用户角色 -->
<bean id="upmsUserRoleService" class="com.zheng.upms.rpc.service.impl.UpmsUserRoleServiceImpl"/>
<dubbo:service interface="com.zheng.upms.rpc.api.UpmsUserRoleService" ref="upmsUserRoleService" timeout="10000"/>
<!-- 操作日志 -->
<bean id="upmsLogService" class="com.zheng.upms.rpc.service.impl.UpmsLogServiceImpl"/>
<dubbo:service interface="com.zheng.upms.rpc.api.UpmsLogService" ref="upmsLogService" timeout="10000"/>
<!-- 接口服务 -->
<bean id="upmsApiService" class="com.zheng.upms.rpc.service.impl.UpmsApiServiceImpl"/>
<dubbo:service interface="com.zheng.upms.rpc.api.UpmsApiService" ref="upmsApiService" timeout="10000"/>
</beans> | {
"content_hash": "d7b8723c7e8898c0118c915decf68dde",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 133,
"avg_line_length": 53.62903225806452,
"alnum_prop": 0.726015037593985,
"repo_name": "xubaifu/zheng",
"id": "533efe41870d83f2146801342cfecdd0094271d6",
"size": "3393",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "zheng-upms/zheng-upms-rpc-service/src/main/resources/META-INF/spring/applicationContext-dubbo-provider.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "7085"
},
{
"name": "CSS",
"bytes": "540592"
},
{
"name": "HTML",
"bytes": "204423"
},
{
"name": "Java",
"bytes": "1586710"
},
{
"name": "JavaScript",
"bytes": "1055424"
},
{
"name": "Shell",
"bytes": "39516"
}
],
"symlink_target": ""
} |
import discord
from discord.ext import commands
from PIL import Image, ImageDraw, ImageFont
import pathvalidate
import requests
import os
class Welcome:
def __init__(self, bot):
self.bot = bot
async def on_member_join(self, member):
template = Image.open('extras/template.png')
draw = ImageDraw.Draw(template)
user = member.name
server = member.server.name
img_fraction = 0.50
fontsize = 16
member_name = pathvalidate.sanitize_filename(
member.name).replace('(', '').replace(')', '').replace(' ', '')
server_name = pathvalidate.sanitize_filename(
member.server.name).replace('(', '').replace(')', '').replace(' ', '')
if member.avatar_url == "":
member_avatar = requests.get(member.default_avatar_url)
else:
member_avatar = requests.get(member.avatar_url)
with open('extras/{}.png'.format(member_name), 'wb') as f:
for chunk in member_avatar.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
member_avatar = Image.open('extras/{}.png'.format(member_name))
member_avatar = member_avatar.resize((182, 182), Image.ANTIALIAS)
template.paste(member_avatar, (34, 71))
guild_icon = requests.get(member.server.icon_url)
with open('extras/{}.png'.format(server_name), 'wb') as f:
for chunk in guild_icon.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
guild_icon = Image.open('extras/{}.png'.format(server_name))
guild_icon = guild_icon.resize((64, 64), Image.ANTIALIAS)
template.paste(guild_icon, (660, 300))
font = ImageFont.truetype("extras/segoeui.ttf", fontsize)
while font.getsize(user)[0] < img_fraction * template.size[0]:
fontsize += 1
font = ImageFont.truetype("extras/segoeui.ttf", fontsize)
fontsize -= 1
font = ImageFont.truetype("extras/segoeui.ttf", fontsize)
if len(user) < 6:
font = ImageFont.truetype("extras/segoeui.ttf", 58)
draw.text((125, 290), user, (0, 0, 0), font=font)
fontsize = 16
img_fraction = 0.25
font = ImageFont.truetype("extras/segoeui.ttf", fontsize)
while font.getsize(server)[0] < img_fraction * template.size[0]:
fontsize += 1
font = ImageFont.truetype("extras/segoeui.ttf", fontsize)
fontsize -= 1
font = ImageFont.truetype("extras/segoeui.ttf", fontsize)
if len(server) < 6:
font = ImageFont.truetype("extras/segoeui.ttf", 32)
draw.text((540, 255), server, (0, 0, 0), font=font)
template.save('extras/finished.png')
await self.bot.send_file(member.server, 'extras/finished.png')
os.remove('extras/finished.png')
os.remove('extras/{}.png'.format(member_name))
os.remove('extras/{}.png'.format(server_name))
def setup(bot):
bot.add_cog(Welcome(bot))
| {
"content_hash": "18e820f309df1fbef9b7ae380857fc01",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 78,
"avg_line_length": 38.013698630136986,
"alnum_prop": 0.6518918918918919,
"repo_name": "heyitswither/Alpha-Bot",
"id": "fbb502ad90f5d8a4a1230f1afac94cfece1ab232",
"size": "2775",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cogs/test-welcome.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "65999"
}
],
"symlink_target": ""
} |
package gov.nasa.ensemble.common.ui.treemenu;
import gov.nasa.ensemble.common.logging.LogUtil;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
public abstract class IntrospectiveContextualCommandContributor {
private final Object INAPPLICABLE_TOKEN = new String[] {"IntrospectiveMenuContributor found this object was not the applicable type and could not be adapted to it."};
protected boolean isApplicableResult(Object resultOfEnsuringCorrectType) {
return resultOfEnsuringCorrectType != INAPPLICABLE_TOKEN;
}
public final Object ensureCorrectType(Object objectInTree) {
if (objectInTree==null) return INAPPLICABLE_TOKEN;
try {
Class<?> applicableClass = getApplicableClass();
if (objectInTree instanceof IAdaptable) {
Object adaptation = ((IAdaptable) objectInTree).getAdapter(applicableClass);
if (adaptation != null) {
objectInTree = adaptation;
}
}
if (!applicableClass.isInstance(objectInTree)) return INAPPLICABLE_TOKEN;
} catch (NoSuchMethodException e) {
LogUtil.error(e);
return INAPPLICABLE_TOKEN;
}
return objectInTree;
}
public Class<?> getApplicableClass() throws NoSuchMethodException {
return findMethodRevealingApplicableClass().getParameterTypes()[getNumberOfParameterOfTypeT()];
}
private Method findMethodRevealingApplicableClass() throws NoSuchMethodException {
String targetName = getNameOfMethodAcceptingParameterOfTypeT();
List<Method> candidates = new ArrayList<Method>();
for (Method method : getClass().getDeclaredMethods()) {
if (method.getName().equals(targetName)) {
candidates.add(method);
}
}
if (!candidates.isEmpty()) {
return getBestCandidateMethod(candidates);
}
for (Method method : getClass().getMethods()) {
if (method.getName().equals(targetName)) {
candidates.add(method);
}
}
if (!candidates.isEmpty()) {
return getBestCandidateMethod(candidates);
}
throw new NoSuchMethodException("No " + targetName + " method in " + this);
}
private Method getBestCandidateMethod(List<Method> candidates) {
if (candidates.size() == 1) {
return candidates.get(0);
}
int paramIndex = getNumberOfParameterOfTypeT();
Method bestMethod = null;
Class<?> bestClass = null;
for (Method method : candidates) {
Class<?> methodParameterClass = method.getParameterTypes()[paramIndex];
if (bestMethod == null || bestClass == null
|| bestClass.isAssignableFrom(methodParameterClass)) {
bestMethod = method;
bestClass = methodParameterClass;
}
}
return bestMethod;
}
protected abstract String getNameOfMethodAcceptingParameterOfTypeT();
protected abstract int getNumberOfParameterOfTypeT();
}
| {
"content_hash": "6e799ae24191a63458f9933834176533",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 167,
"avg_line_length": 31.689655172413794,
"alnum_prop": 0.745012694958288,
"repo_name": "nasa/OpenSPIFe",
"id": "674857067d20d18bdfa0cb7189283c3d61e51717",
"size": "3637",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gov.nasa.ensemble.common.ui/src/gov/nasa/ensemble/common/ui/treemenu/IntrospectiveContextualCommandContributor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4538"
},
{
"name": "HTML",
"bytes": "705398"
},
{
"name": "Java",
"bytes": "15764637"
},
{
"name": "JavaScript",
"bytes": "2244"
},
{
"name": "Shell",
"bytes": "60188"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.