text
stringlengths
2
1.04M
meta
dict
ACLI IS DEPRECATED ===== Swift is getting more and more a mature language and so the tools that are used in the ecosystem finally have support of it, so please use them. The acli gem is also no longer available for installation from rubygems. [Carthage](https://github.com/Carthage/Carthage) [Cocoapods](http://cocoapods.org) acli ==== a(wesome swift)cli provides convenient download over the command line of swift libraries listed in [matteocrippa/awesome-swift](https://github.com/matteocrippa/awesome-swift) and [wolg/awesome-swift](https://github.com/Wolg/awesome-swift). to a folder on your machine. other 'readme.md' files can be added over .aclirc as 'repository'. the default folder is 'swift_lib' in the executed folder. this can be change in the .aclirc config file as well. installation === ```sudo gem install acli``` usage === ```acli help``` - lists all available commands ```acli list``` - lists all available libraries mentioned ```acli config``` - created .aclirc config file in current folder attention === this is not a replacement for cocoapods or somehow suitable for a production enviroment.
{ "content_hash": "50a23b66eae722babd5c6952790d8cc2", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 448, "avg_line_length": 32.34285714285714, "alnum_prop": 0.7535335689045937, "repo_name": "eugenpirogoff/acli", "id": "e4a5c2442d287bd5f758feb0713aee0a5c522f17", "size": "1132", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "6845" } ], "symlink_target": "" }
'use strict'; /** * "Slash" is a cooldown action that does 125 potency damage to the attacker's * target. If executed after the "flurry of blows" attack it has a combo potency * of 200. * @author Ryan Sandor Richards */ Commands.addCooldown('slash', { cooldownDuration: Commands.GLOBAL_COOLDOWN, initiatesCombat: true, basePotency: 125, comboPotency: 200, combosWith: 'flurry', spCost: 4, run: function (player, target, level, cooldown) { return cooldown.executeAttack(player, target); } });
{ "content_hash": "3b43beef1456f3b4d9618654904e1bbd", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 80, "avg_line_length": 27.263157894736842, "alnum_prop": 0.7084942084942085, "repo_name": "rsandor/Solace", "id": "a0800eb6ec8132bcdf23d6179ff033756f0947d4", "size": "518", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "game/skills/one-handed/cooldowns/slash.js", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "435091" }, { "name": "JavaScript", "bytes": "38500" } ], "symlink_target": "" }
The Challenges repro is a collection of my solutions for some of the online programming challenges. Some of the Class/Method Naming is to be compatible with the online evaluation part of these challenges. I try to use the Folder structure [Site][Challenge] ## Disclaimer Published under the [MIT License](LICENSE).
{ "content_hash": "d90a13a425f1932da7c0a50ffe984a07", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 104, "avg_line_length": 52.666666666666664, "alnum_prop": 0.8006329113924051, "repo_name": "joshimoo/Challenges", "id": "16f2d56cf83bb0d106547dddc3b2fd45d7f0046a", "size": "329", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "502760" }, { "name": "Java", "bytes": "2594" } ], "symlink_target": "" }
module BatchManager module Utils def self.included(base) base.send :include, OverallMethods base.extend OverallMethods end module OverallMethods def batch_name(filename_or_path) if filename_or_path.start_with?(::BatchManager.batch_dir) path = filename_or_path.sub("#{::BatchManager.batch_dir}/", "") else path = filename_or_path end path.sub(".rb", "") end def batch_full_path(filename_or_path) if filename_or_path.start_with?(::BatchManager.batch_dir) path = filename_or_path else path = File.join(::BatchManager.batch_dir, filename_or_path) end path.end_with?(".rb") ? path : path + ".rb" end end end end
{ "content_hash": "8a6649a3d2bada857066f8980a32f14a", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 73, "avg_line_length": 27.464285714285715, "alnum_prop": 0.5903771131339401, "repo_name": "cctiger36/batch_manager", "id": "c1e4a5295be4b531cbf11dce48d1e189668b51d6", "size": "769", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/batch_manager/utils.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5512" }, { "name": "JavaScript", "bytes": "464" }, { "name": "Ruby", "bytes": "31227" } ], "symlink_target": "" }
require('torch') local threads = require 'threads' local cmd = torch.CmdLine() local separators = require('tools.utils.separators') cmd:text("") cmd:text("**detokenize.lua**") cmd:text("") cmd:option('-case_feature', false, [[First feature is case feature]]) cmd:option('-joiner', separators.joiner_marker, [[the joiner marker]]) cmd:option('-nparallel', 1, [[Number of parallel thread to run the tokenization]]) cmd:option('-batchsize', 1000, [[Size of each parallel batch - you should not change except if low memory]]) local opt = cmd:parse(arg) local pool = threads.Threads( opt.nparallel, function() _G.separators = require('tools.utils.separators') _G.tokenizer = require('tools.utils.tokenizer') end ) pool:specific(true) local timer = torch.Timer() local idx = 0 while true do local batches_input = {} local batches_output = {} local cidx = 0 local line for i = 1, opt.nparallel do batches_input[i] = {} for _ = 1, opt.batchsize do line = io.read() if not line then break end cidx = cidx + 1 table.insert(batches_input[i], line) end if not line then break end end if cidx == 0 then break end for i = 1, #batches_input do pool:addjob( i, function() local output = {} for b = 1,#batches_input[i] do local oline local res, err = pcall(function() oline = _G.tokenizer.detokenize(batches_input[i][b], opt) end) table.insert(output, oline) if not res then if string.find(err,"interrupted") then error("interrupted") else error("unicode error in line ".. idx+(i-1)*opt.batchsize+b ..": "..line..'-'..err) end end end return output end, function(output) batches_output[i] = output end) end pool:synchronize() -- output the tokenized and featurized string for i = 1, opt.nparallel do if not batches_output[i] then break end for b = 1, #batches_output[i] do io.write(batches_output[i][b] .. '\n') idx = idx + 1 end end end io.stderr:write(string.format('Detokenization completed in %0.3f seconds - %d sentences\n',timer:time().real,idx))
{ "content_hash": "b723ca1085dfbd0537d0a77b0c3ec774", "timestamp": "", "source": "github", "line_count": 87, "max_line_length": 114, "avg_line_length": 25.839080459770116, "alnum_prop": 0.6152135231316725, "repo_name": "taestone/opennmt_merge", "id": "d486527ee3b9e23f2a5f89ce61c5a1cc1f88148f", "size": "2248", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "tools/detokenize.lua", "mode": "33188", "license": "mit", "language": [ { "name": "Lua", "bytes": "500892" }, { "name": "Perl", "bytes": "6984" }, { "name": "Python", "bytes": "5752" }, { "name": "Shell", "bytes": "4180" } ], "symlink_target": "" }
package kieker.monitoring.sampler.mxbean; import java.lang.management.ClassLoadingMXBean; import java.lang.management.ManagementFactory; import kieker.common.record.IMonitoringRecord; import kieker.common.record.jvm.ClassLoadingRecord; import kieker.monitoring.core.controller.IMonitoringController; import kieker.monitoring.core.signaturePattern.SignatureFactory; /** * A sampler using the MXBean interface to access information about the class loading. * The sampler produces a {@link ClassLoadingRecord} each time the {@code sample} method is called. * * @author Nils Christian Ehmke * * @since 1.10 */ public class ClassLoadingSampler extends AbstractMXBeanSampler { /** * Create a new ClassLoadingSampler. */ public ClassLoadingSampler() { // Empty default constructor } @Override protected IMonitoringRecord[] createNewMonitoringRecords(final long timestamp, final String hostname, final String vmName, final IMonitoringController monitoringCtr) { if (!monitoringCtr.isProbeActivated(SignatureFactory.createJVMClassLoadSignature())) { return new IMonitoringRecord[] {}; } final ClassLoadingMXBean classLoadingBean = ManagementFactory.getClassLoadingMXBean(); return new IMonitoringRecord[] { new ClassLoadingRecord(timestamp, hostname, vmName, classLoadingBean.getTotalLoadedClassCount(), classLoadingBean.getLoadedClassCount(), classLoadingBean.getUnloadedClassCount()), }; } }
{ "content_hash": "7d2fa8ef448b5e3b2e1c262db97f2620", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 131, "avg_line_length": 34.90243902439025, "alnum_prop": 0.8001397624039134, "repo_name": "kieker-monitoring/kieker", "id": "bad05420e18e491c93c43b4aa1eebcab9e32b021", "size": "2207", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "kieker-monitoring/src/kieker/monitoring/sampler/mxbean/ClassLoadingSampler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AMPL", "bytes": "61445" }, { "name": "Batchfile", "bytes": "2946" }, { "name": "CSS", "bytes": "24891" }, { "name": "Groovy", "bytes": "6964" }, { "name": "HTML", "bytes": "74073" }, { "name": "Java", "bytes": "7715993" }, { "name": "Makefile", "bytes": "580" }, { "name": "Python", "bytes": "19950" }, { "name": "R", "bytes": "41" }, { "name": "Roff", "bytes": "9860" }, { "name": "Shell", "bytes": "38916" }, { "name": "TeX", "bytes": "1948" }, { "name": "XSLT", "bytes": "7622" }, { "name": "sed", "bytes": "634" } ], "symlink_target": "" }
using System; using System.Threading.Tasks; using System.Windows; namespace Stylet { /// <summary> /// Is aware of the fact that it has a view /// </summary> public interface IViewAware { /// <summary> /// Gets the view associated with this ViewModel /// </summary> UIElement View { get; } /// <summary> /// Called when the view should be attached. Should set View property. /// </summary> /// <remarks>Separate from the View property so it can be explicitely implemented</remarks> /// <param name="view">View to attach</param> void AttachView(UIElement view); } /// <summary> /// State in which a screen can be /// </summary> public enum ScreenState { /// <summary> /// Deprecated: Screens now start in Deactivated /// </summary> [Obsolete("Screens now start in the Deactivated state")] Initial, /// <summary> /// Screen is active. It is likely being displayed to the user /// </summary> Active, /// <summary> /// Screen is deactivated. It is either new, has been hidden in favour of another Screen, or the entire window has been minimised /// </summary> Deactivated, /// <summary> /// Screen has been closed. It has no associated View, but may yet be displayed again /// </summary> Closed, } /// <summary> /// Has a concept of state, which can be manipulated by its Conductor /// </summary> public interface IScreenState { /// <summary> /// Gets the current state of the Screen /// </summary> ScreenState ScreenState { get; } /// <summary> /// Gets a value indicating whether the current state is ScreenState.Active /// </summary> bool IsActive { get; } /// <summary> /// Raised when the Screen's state changed, for any reason /// </summary> event EventHandler<ScreenStateChangedEventArgs> StateChanged; /// <summary> /// Raised when the object is actually activated /// </summary> event EventHandler<ActivationEventArgs> Activated; /// <summary> /// Raised when the object is actually deactivated /// </summary> event EventHandler<DeactivationEventArgs> Deactivated; /// <summary> /// Raised when the object is actually closed /// </summary> event EventHandler<CloseEventArgs> Closed; /// <summary> /// Activate the object. May not actually cause activation (e.g. if it's already active) /// </summary> void Activate(); /// <summary> /// Deactivate the object. May not actually cause deactivation (e.g. if it's already deactive) /// </summary> void Deactivate(); /// <summary> /// Close the object. May not actually cause closure (e.g. if it's already closed) /// </summary> void Close(); } /// <summary> /// Has a display name. In reality, this is bound to things like Window titles and TabControl tabs /// </summary> public interface IHaveDisplayName { /// <summary> /// Gets or sets the name which should be displayed /// </summary> string DisplayName { get; set; } } /// <summary> /// Acts as a child. Knows about its parent /// </summary> public interface IChild { /// <summary> /// Gets or sets the parent object to this child /// </summary> object Parent { get; set; } } /// <summary> /// Has an opinion on whether it should be closed /// </summary> /// <remarks>If implemented, CanCloseAsync should be called prior to closing the object</remarks> public interface IGuardClose { /// <summary> /// Returns whether or not the object can close, potentially asynchronously /// </summary> /// <returns>A task indicating whether the object can close</returns> Task<bool> CanCloseAsync(); } /// <summary> /// Get the object to request that its parent close it /// </summary> public interface IRequestClose { /// <summary> /// Request that the conductor responsible for this screen close it /// </summary> /// <param name="dialogResult">DialogResult to return, if this is a dialog</param> void RequestClose(bool? dialogResult = null); } /// <summary> /// Generalised 'screen' composing all the behaviours expected of a screen /// </summary> public interface IScreen : IViewAware, IHaveDisplayName, IScreenState, IChild, IGuardClose, IRequestClose { } /// <summary> /// EventArgs associated with the IScreenState.StateChanged event /// </summary> public class ScreenStateChangedEventArgs : EventArgs { /// <summary> /// Gets the state being transitioned to /// </summary> public ScreenState NewState { get; private set; } /// <summary> /// Gets the state being transitioned away from /// </summary> public ScreenState PreviousState { get; private set; } /// <summary> /// Initialises a new instance of the <see cref="ScreenStateChangedEventArgs"/> class /// </summary> /// <param name="newState">State being transitioned to</param> /// <param name="previousState">State being transitioned away from</param> public ScreenStateChangedEventArgs(ScreenState newState, ScreenState previousState) { this.NewState = newState; this.PreviousState = previousState; } } /// <summary> /// EventArgs associated with the IScreenState.Activated event /// </summary> public class ActivationEventArgs : EventArgs { /// <summary> /// Gets a value indicating whether this is the first time this Screen has been activated, ever /// </summary> public bool IsInitialActivate { get; private set; } /// <summary> /// Gets the state being transitioned away from /// </summary> public ScreenState PreviousState { get; private set; } /// <summary> /// Initialises a new instance of the <see cref="ActivationEventArgs"/> class /// </summary> /// <param name="previousState">State being transitioned away from</param> /// <param name="isInitialActivate">True if this is the first time this screen has ever been activated</param> public ActivationEventArgs(ScreenState previousState, bool isInitialActivate) { this.IsInitialActivate = isInitialActivate; this.PreviousState = previousState; } } /// <summary> /// EventArgs associated with the IScreenState.Deactivated event /// </summary> public class DeactivationEventArgs : EventArgs { /// <summary> /// Gets the state being transitioned away from /// </summary> public ScreenState PreviousState { get; private set; } /// <summary> /// Initialises a new instance of the <see cref="DeactivationEventArgs"/> class /// </summary> /// <param name="previousState">State being transitioned away from</param> public DeactivationEventArgs(ScreenState previousState) { this.PreviousState = previousState; } } /// <summary> /// EventArgs associated with the IScreenState.Closed event /// </summary> public class CloseEventArgs : EventArgs { /// <summary> /// Gets the state being transitioned away from /// </summary> public ScreenState PreviousState { get; private set; } /// <summary> /// Initialises a new instance of the <see cref="CloseEventArgs"/> class /// </summary> /// <param name="previousState">State being transitioned away from</param> public CloseEventArgs(ScreenState previousState) { this.PreviousState = previousState; } } }
{ "content_hash": "331aebcac19b9a446d99a89bdc6249e7", "timestamp": "", "source": "github", "line_count": 250, "max_line_length": 137, "avg_line_length": 32.92, "alnum_prop": 0.5961117861482381, "repo_name": "canton7/Stylet", "id": "2c743d7873f474d98bcfaf7ee4681a49f9589918", "size": "8232", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Stylet/IScreen.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "727379" }, { "name": "PowerShell", "bytes": "12575" }, { "name": "Ruby", "bytes": "3107" } ], "symlink_target": "" }
<?php namespace Google\Cloud\Vision\Tests\Snippet\Annotation\Web; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Core\Testing\TestHelpers; use Google\Cloud\Vision\Annotation\Web\WebEntity; use Google\Cloud\Vision\Connection\ConnectionInterface; use Google\Cloud\Vision\VisionClient; use Prophecy\Argument; /** * @group vision */ class WebEntityTest extends SnippetTestCase { private $info; private $entity; public function set_up() { $this->info = [ 'entityId' => 'foo', 'score' => 0.1, 'description' => 'bar' ]; $this->entity = new WebEntity($this->info); } public function testClass() { $snippet = $this->snippetFromClass(WebEntity::class); $connection = $this->prophesize(ConnectionInterface::class); $connection->annotate(Argument::any()) ->willReturn([ 'responses' => [ [ 'webDetection' => [ 'webEntities' => [ [] ] ] ] ] ]); $vision = TestHelpers::stub(VisionClient::class); $vision->___setProperty('connection', $connection->reveal()); $snippet->addLocal('vision', $vision); $snippet->replace( "__DIR__ . '/assets/eiffel-tower.jpg'", "'php://temp'" ); $snippet->replace( '$vision = new VisionClient();', '' ); $res = $snippet->invoke('firstEntity'); $this->assertInstanceOf(WebEntity::class, $res->returnVal()); } public function testEntityId() { $snippet = $this->snippetFromMagicMethod(WebEntity::class, 'entityId'); $snippet->addLocal('entity', $this->entity); $res = $snippet->invoke('id'); $this->assertEquals($this->info['entityId'], $res->returnVal()); } public function testScore() { $snippet = $this->snippetFromMagicMethod(WebEntity::class, 'score'); $snippet->addLocal('entity', $this->entity); $res = $snippet->invoke('score'); $this->assertEquals($this->info['score'], $res->returnVal()); } public function testDescription() { $snippet = $this->snippetFromMagicMethod(WebEntity::class, 'description'); $snippet->addLocal('entity', $this->entity); $res = $snippet->invoke('description'); $this->assertEquals($this->info['description'], $res->returnVal()); } }
{ "content_hash": "4fe3e80ba5ef38eb5cb0c064a86b335f", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 82, "avg_line_length": 28.204301075268816, "alnum_prop": 0.5413648494090736, "repo_name": "googleapis/google-cloud-php", "id": "45e95d1a0b8d31bb5fe75cf00c81c6a81601d5bf", "size": "3218", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "Vision/tests/Snippet/Annotation/Web/WebEntityTest.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "3333" }, { "name": "PHP", "bytes": "47981731" }, { "name": "Python", "bytes": "413107" }, { "name": "Shell", "bytes": "8171" } ], "symlink_target": "" }
package uk.co.flax.biosolr.pruning; import java.util.Collection; import java.util.Comparator; import java.util.Set; import java.util.TreeSet; import java.util.stream.Collectors; import uk.co.flax.biosolr.TreeFacetField; /** * A simple {@link Pruner} implementation, which attempts to strip off the * least significant parent nodes, returning child nodes which either have * content themselves, or have direct children with content. * * @author mlp */ public class SimplePruner implements Pruner { /** * The default number of child nodes with content required for a parent * node to be considered "relevant". */ public static final int MIN_CHILD_COUNT = 3; /** * The parameter used to pass the child count into the component. */ public static final String CHILD_COUNT_PARAM = "childCount"; private final int minChildCount; public SimplePruner(int minChildCount) { this.minChildCount = minChildCount; } @Override public Collection<TreeFacetField> prune(Collection<TreeFacetField> unprunedTrees) { // Prune the trees Collection<TreeFacetField> pruned = stripNonRelevantTrees(unprunedTrees); // Now loop through the top-level nodes, making sure none of the entries // are included in another entry's children pruned = deduplicateTrees(pruned); return pruned; } /** * De-duplicate a collection of top-level trees by checking whether a top-level * node exists in the children of any of the other nodes, and removing it if so. * @param trees the collection of top-level facet trees. * @return the de-duplicated collection. */ private Collection<TreeFacetField> deduplicateTrees(Collection<TreeFacetField> trees) { return trees.stream().filter(t -> !isFacetInChildren(t, 0, trees)).collect(Collectors.toList()); } /** * Check whether a particular facet exists in the children of any other facets * in a collection. * @param facet the facet to check for. * @param level the current level in the hierarchy, starting from 0. * @param trees the collection of trees to check through. * @return <code>true</code> if the facet is found in the child lists. */ private boolean isFacetInChildren(TreeFacetField facet, int level, Collection<TreeFacetField> trees) { boolean retVal = false; if (trees != null) { for (TreeFacetField tree : trees) { if ((level != 0 && tree.equals(facet)) || (isFacetInChildren(facet, level + 1, tree.getHierarchy()))) { retVal = true; break; } } } return retVal; } /** * Prune a collection of facet trees, in order to remove nodes which are * unlikely to be relevant. "Relevant" is defined here to be either * entries with direct hits, or entries with a pre-defined number of * child nodes with direct hits. This can remove several top-level * layers from the tree which don't have direct hits. * @param unprunedTrees the trees which need pruning. * @return a sorted list of pruned trees. */ private Collection<TreeFacetField> stripNonRelevantTrees(Collection<TreeFacetField> unprunedTrees) { // Use a sorted set so the trees come out in count-descending order Set<TreeFacetField> pruned = new TreeSet<>(Comparator.reverseOrder()); for (TreeFacetField tff : unprunedTrees) { if (tff.getCount() > 0) { // Relevant - entry has direct hits pruned.add(tff); } else if (checkChildCounts(tff)) { // Relevant - entry has a number of children with direct hits pruned.add(tff); } else if (tff.hasChildren()) { // Not relevant at this level - recurse through children pruned.addAll(stripNonRelevantTrees(tff.getHierarchy())); } } return pruned; } /** * Check whether the given tree has enough children with direct hits to * be included in the pruned tree. * @param tree the facet tree. * @return <code>true</code> if the tree has enough children to be * included. */ private boolean checkChildCounts(TreeFacetField tree) { long hitCount = 0; if (tree.hasChildren()) { hitCount = tree.getHierarchy().stream().filter(t -> t.getCount() > 0).count(); } return hitCount >= minChildCount; } }
{ "content_hash": "e74479eb2b8045dc00d5380480f77679", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 107, "avg_line_length": 31.807692307692307, "alnum_prop": 0.712938331318017, "repo_name": "flaxsearch/BioSolr", "id": "3311a136cfdadb1ad397a3409b75234395716f7f", "size": "4755", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ontology/solr-facet-tree/src/main/java/uk/co/flax/biosolr/pruning/SimplePruner.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "171" }, { "name": "CSS", "bytes": "2048" }, { "name": "HTML", "bytes": "22112" }, { "name": "Java", "bytes": "1209225" }, { "name": "JavaScript", "bytes": "20754" }, { "name": "Python", "bytes": "1881" }, { "name": "Shell", "bytes": "3023" } ], "symlink_target": "" }
package me.calebjones.spacelaunchnow.content.data.next; import android.content.Context; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.concurrent.TimeUnit; import androidx.annotation.UiThread; import io.realm.Realm; import io.realm.RealmResults; import io.realm.Sort; import me.calebjones.spacelaunchnow.common.content.data.Callbacks; import me.calebjones.spacelaunchnow.common.prefs.SwitchPreferences; import me.calebjones.spacelaunchnow.common.content.util.FilterBuilder; import me.calebjones.spacelaunchnow.common.content.util.QueryBuilder; import me.calebjones.spacelaunchnow.data.models.Constants; import me.calebjones.spacelaunchnow.data.models.Result; import me.calebjones.spacelaunchnow.data.models.UpdateRecord; import me.calebjones.spacelaunchnow.data.models.main.Launch; import me.calebjones.spacelaunchnow.data.networking.DataClient; import me.calebjones.spacelaunchnow.data.networking.error.ErrorUtil; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import timber.log.Timber; /** * Responsible for retrieving data from the Realm cache. */ public class NextLaunchDataRepository { private NextLaunchDataLoader dataLoader; private Realm realm; private final Context context; public NextLaunchDataRepository(Context context, Realm realm) { this.context = context; this.dataLoader = new NextLaunchDataLoader(context); this.realm = realm; } @UiThread public void getNextUpcomingLaunches(int count, boolean forceRefresh, Callbacks.NextLaunchesCallback nextLaunchesCallback){ RealmResults<UpdateRecord> records = realm.where(UpdateRecord.class) .equalTo("type", Constants.ACTION_GET_UP_LAUNCHES_ALL) .or() .equalTo("type", Constants.ACTION_GET_UP_LAUNCHES) .or() .equalTo("type", Constants.ACTION_GET_NEXT_LAUNCHES) .sort("date", Sort.DESCENDING) .findAll(); // Start loading data from the network if needed // It will put all data into Realm if (records != null && records.size() > 0) { UpdateRecord record = records.first(); Date currentDate = new Date(); Date lastUpdateDate = record.getDate(); long timeSinceUpdate = currentDate.getTime() - lastUpdateDate.getTime(); long timeMaxUpdate = TimeUnit.MINUTES.toMillis(10); Timber.d("Time since last upcoming launches sync %s", timeSinceUpdate); if (timeSinceUpdate > timeMaxUpdate || forceRefresh) { Timber.d("%s greater then %s - updating library data.", timeSinceUpdate, timeMaxUpdate); if (!forceRefresh) { nextLaunchesCallback.onLaunchesLoaded(QueryBuilder.buildUpcomingSwitchQuery(context, realm, false)); } if (forceRefresh) { RealmResults<Launch> launches = realm.where(Launch.class).findAll(); realm.executeTransaction(realm -> launches.deleteAllFromRealm()); } getNextUpcomingLaunchesFromNetwork(count, nextLaunchesCallback); } else { nextLaunchesCallback.onLaunchesLoaded(QueryBuilder.buildUpcomingSwitchQuery(context, realm, false)); } } else { getNextUpcomingLaunchesFromNetwork(count, nextLaunchesCallback); } } private void getNextUpcomingLaunchesFromNetwork(int count, Callbacks.NextLaunchesCallback callback){ String locationIds = null; String lspIds = null; SwitchPreferences switchPreferences = SwitchPreferences.getInstance(context); if (!switchPreferences.getAllSwitch()) { lspIds = FilterBuilder.getLSPIds(context); locationIds = FilterBuilder.getLocationIds(context); } callback.onNetworkStateChanged(true); dataLoader.getNextUpcomingLaunches(count, locationIds, lspIds, new Callbacks.NextNetworkCallback() { @Override public void onSuccess() { callback.onNetworkStateChanged(false); RealmResults<Launch> launches = QueryBuilder.buildUpcomingSwitchQuery(context, realm, false); callback.onLaunchesLoaded(launches); } @Override public void onNetworkFailure(int code) { callback.onNetworkStateChanged(false); callback.onError("Unable to load launch data.", null); } @Override public void onFailure(Throwable throwable) { callback.onNetworkStateChanged(false); callback.onError("An error has occurred! Uh oh.", throwable); } }); } }
{ "content_hash": "8b42a3888fedff736f733d057f9eb8d3", "timestamp": "", "source": "github", "line_count": 121, "max_line_length": 126, "avg_line_length": 39.88429752066116, "alnum_prop": 0.6715706589307916, "repo_name": "ItsCalebJones/SpaceLaunchNow", "id": "8029c9ebcda388a64a714f0d0fd50e012a02e7b5", "size": "4826", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "mobile/src/main/java/me/calebjones/spacelaunchnow/content/data/next/NextLaunchDataRepository.java", "mode": "33188", "license": "mit", "language": [ { "name": "IDL", "bytes": "6468" }, { "name": "Java", "bytes": "931097" } ], "symlink_target": "" }
EditAddressDialog::EditAddressDialog(Mode mode, QWidget *parent) : QDialog(parent), ui(new Ui::EditAddressDialog), mapper(0), mode(mode), model(0) { ui->setupUi(this); GUIUtil::setupAddressWidget(ui->addressEdit, this); switch(mode) { case NewReceivingAddress: setWindowTitle(tr("New receiving address")); ui->addressEdit->setEnabled(false); break; case NewSendingAddress: setWindowTitle(tr("New sending address")); break; case EditReceivingAddress: setWindowTitle(tr("Edit receiving address")); ui->addressEdit->setDisabled(true); break; case EditSendingAddress: setWindowTitle(tr("Edit sending address")); break; } mapper = new QDataWidgetMapper(this); mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); } EditAddressDialog::~EditAddressDialog() { delete ui; } void EditAddressDialog::setModel(AddressTableModel *model) { this->model = model; mapper->setModel(model); mapper->addMapping(ui->labelEdit, AddressTableModel::Label); mapper->addMapping(ui->addressEdit, AddressTableModel::Address); } void EditAddressDialog::loadRow(int row) { mapper->setCurrentIndex(row); } bool EditAddressDialog::saveCurrentRow() { if(!model) return false; switch(mode) { case NewReceivingAddress: case NewSendingAddress: address = model->addRow( mode == NewSendingAddress ? AddressTableModel::Send : AddressTableModel::Receive, ui->labelEdit->text(), ui->addressEdit->text()); break; case EditReceivingAddress: case EditSendingAddress: if(mapper->submit()) { address = ui->addressEdit->text(); } break; } return !address.isEmpty(); } void EditAddressDialog::accept() { if(!model) return; if(!saveCurrentRow()) { switch(model->getEditStatus()) { case AddressTableModel::DUPLICATE_ADDRESS: QMessageBox::warning(this, windowTitle(), tr("The entered address \"%1\" is already in the address book.").arg(ui->addressEdit->text()), QMessageBox::Ok, QMessageBox::Ok); break; case AddressTableModel::INVALID_ADDRESS: QMessageBox::warning(this, windowTitle(), tr("The entered address \"%1\" is not a valid BeerCoin address.").arg(ui->addressEdit->text()), QMessageBox::Ok, QMessageBox::Ok); return; case AddressTableModel::WALLET_UNLOCK_FAILURE: QMessageBox::critical(this, windowTitle(), tr("Could not unlock wallet."), QMessageBox::Ok, QMessageBox::Ok); return; case AddressTableModel::KEY_GENERATION_FAILURE: QMessageBox::critical(this, windowTitle(), tr("New key generation failed."), QMessageBox::Ok, QMessageBox::Ok); return; case AddressTableModel::OK: // Failed with unknown reason. Just reject. break; } return; } QDialog::accept(); } QString EditAddressDialog::getAddress() const { return address; } void EditAddressDialog::setAddress(const QString &address) { this->address = address; ui->addressEdit->setText(address); }
{ "content_hash": "2cda7823951c80e79f12dcd99512548f", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 111, "avg_line_length": 28.283333333333335, "alnum_prop": 0.6137301119622864, "repo_name": "digiwhite/BEER-BeerCoin-Ver-642-Original", "id": "2e0e6099d96402ae178db37c3f140001b8e84fd0", "size": "3565", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "src/qt/editaddressdialog.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "78622" }, { "name": "C++", "bytes": "1377848" }, { "name": "IDL", "bytes": "12269" }, { "name": "Objective-C++", "bytes": "2463" }, { "name": "Python", "bytes": "18144" }, { "name": "Shell", "bytes": "1144" }, { "name": "TypeScript", "bytes": "3810608" } ], "symlink_target": "" }
require 'rails_helper' RSpec.describe Api::TrucksController, type: :controller do before(:each) do |data| @user = User.create(username: "localhost", password: "password", role: "admin") @truck = Truck.create(name: "test Truck", licence: "DOG4U") @token = JsonWebToken.encode({id: @user.id}) @user.update(role: "agent") if data.metadata[:set_agent] end it "requires authentication" do get :index expect(response.status).to eq(401) end describe "GET #index" do before(:each) do request.headers.merge('Authorization' => "token #{@token}") get :index end it "returns http success" do expect(response.status).to eq(200) end it "returns a list of all trucks" do expect(json.length).to eq(Truck.count) end end describe "GET #show" do before(:each) do request.headers.merge('Authorization' => "token #{@token}") get :show, params: {id: @truck.id} end it "returns http success" do expect(response.status).to eq(200) end it "returns id" do expect(json["id"]).to eq(@truck.id) end it "returns name" do expect(json["name"]).to eq(@truck.name) end it "returns licence" do expect(json["licence"]).to eq(@truck.licence) end end describe "POST #create" do before(:each) do |data| @truck_count = Truck.count request.headers.merge('Authorization' => "token #{@token}") post :create, params: {truck: {name: "new truck", licence: "CAT4U"}} unless data.metadata[:skip_before] end it "returns http create" do expect(response.status).to eq(201) end it "creates a new truck" do expect(Truck.count).to_not eq(@truck_count) new_truck = Truck.last expect(new_truck.name).to eq("new truck") expect(new_truck.licence).to eq("CAT4U") end it "requires manager permissions", set_agent: true do expect(response.status).to eq(403) end end describe "PUT/PATCH #update" do before(:each) do request.headers.merge('Authorization' => "token #{@token}") put :update, params: {id: @truck.id, truck: {name: "new truck"}} end it "returns http accepted" do expect(response.status).to eq(202) end it "updates the truck" do @truck.reload expect(@truck.name).to eq("new truck") end it "requires manager permissions", set_agent: true do expect(response.status).to eq(403) end end describe "DELETE #destroy" do before(:each) do |data| request.headers.merge('Authorization' => "token #{@token}") delete :destroy, params: {id: @truck.id} end it "returns http no content" do expect(response.status).to eq(204) end it "destroys the truck" do expect(Truck.find_by(id: @truck.id)).to eq(nil) end it "requires manager permissions", set_agent: true do expect(response.status).to eq(403) end end end
{ "content_hash": "657f08f527414e4eacd69eea0b10b1be", "timestamp": "", "source": "github", "line_count": 128, "max_line_length": 109, "avg_line_length": 23.2421875, "alnum_prop": 0.6211764705882353, "repo_name": "PCGeekBrain/TruckTrack", "id": "72fc2711dd9e672d193ab41c392b3977c980223f", "size": "2975", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/controllers/api/trucks_controller_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4656" }, { "name": "HTML", "bytes": "2585" }, { "name": "JavaScript", "bytes": "49165" }, { "name": "Ruby", "bytes": "83140" } ], "symlink_target": "" }
(function($) { zeit.cms.declare_namespace('zeit.workflow.publish'); zeit.workflow.publish.Publisher = gocept.Class.extend({ construct: function(worklist) { var self = this; self.worklist = $('#' + worklist).find('li').toArray(); self.work(null); }, work: function(result) { var self = this; var action = self.worklist.shift(); self.busy(action); var override_result = action.getAttribute('cms:context'); if (override_result) { result = override_result; } var method = self[action.getAttribute('action')]; var params = []; for (var i = 0; i < action.attributes.length - 1; i++) { attr = action.attributes[i]; if (attr.name.indexOf('cms:param') == 0) params.push(attr); } params.sort(function(a, b) { return a.name.localeCompare(b.name); }); params = params.map(function(x) { return x.value; }); params.unshift(result); var d = method.apply(self, params); d.addCallbacks( function(result) { self.done(action); self.work(result); }, function(error) { self.error(action, error); throw error; }); }, checkin: function(context, params) { var self = this; if (isUndefinedOrNull(params)) { params = ''; } if (isUndefinedOrNull(context)) { context = window.context_url; } return self._redirect_step( context + '/@@checkin?redirect=False' + params); }, start_job: function(context, action, objectlog) { var self = this; if (isNull(context)) { context = window.context_url; } console.log(context, action, objectlog); var d = MochiKit.Async.loadJSONDoc(context + '/@@' + action); d.addCallbacks(function(job) { if (job.error) { throw new Error('Kann nicht veröffentlichen: ' + job.errors); } return MochiKit.Async.callLater( 1, function() { return self.poll_until_complete(context, job, objectlog); }); }, function(err) { zeit.cms.log_error(err); return err; }); d.addCallback(function(result) { return context; }); return d; }, poll_until_complete: function(context, job, objectlog) { var self = this; var d = MochiKit.Async.loadJSONDoc( context + '/@@job-status', {'job': job}); // status is defined in celery.result.AsyncResult.state d.addCallback(function(status) { if (status == 'SUCCESS' || status == 'FAILURE') { return self.check_job_error(context, job, objectlog); } // XXX check for error cases as well. return MochiKit.Async.callLater( 1, bind(self.poll_until_complete, self), context, job, objectlog); }); d.addErrback(function(err) { zeit.cms.log_error(err); return err; }); return d; }, check_job_error: function(context, job, objectlog) { var self = this; if (isUndefinedOrNull(objectlog)) { objectlog = 'False'; } var d = MochiKit.Async.doSimpleXMLHttpRequest( context + '/@@flash-job-errors', {'job': job, 'objectlog': objectlog}); d.addErrback(function(err) { zeit.cms.log_error(err); return err; }); return d; }, checkout: function(context) { var self = this; var d = self._redirect_step(context + '/@@checkout?redirect=False'); d.addCallback(function(result) { return result + '/@@edit.html'; }); return d; }, reload: function(context) { var self = this; if (isUndefinedOrNull(context)) { context = window.context_url; } document.location = context; // return a deferred which is never fired. This keeps the entry busy // until the page is reloaded. return new MochiKit.Async.Deferred(); }, _redirect_step: function(url) { var self = this; var d = MochiKit.Async.doSimpleXMLHttpRequest(url); d.addCallbacks( function(result) { return result.responseText; }, function(err) { zeit.cms.log_error(err); return err; }); return d; }, busy: function(element) { $(element).addClass('busy'); }, done: function(element) { $(element).removeClass('busy'); $(element).addClass('done'); }, error: function(element, error) { var message = error.message; if (error.req) { message = error.req.responseText; } element = $(element); element.removeClass('busy'); element.addClass('error'); element.append('<p>' + message + '</p>'); }, close: function(context) { zeit.cms.current_lightbox.close(); } }); }(jQuery));
{ "content_hash": "92e25c72b9719f0a390e39cc8efed87b", "timestamp": "", "source": "github", "line_count": 171, "max_line_length": 77, "avg_line_length": 30.789473684210527, "alnum_prop": 0.5207977207977208, "repo_name": "ZeitOnline/zeit.cms", "id": "1006eb06298ce6626cb7b91431781a8bfed3802f", "size": "5266", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/zeit/workflow/browser/resources/publish.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "45467" }, { "name": "HTML", "bytes": "10561" }, { "name": "JavaScript", "bytes": "152481" }, { "name": "Python", "bytes": "920274" }, { "name": "Shell", "bytes": "374" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in Contr. Gray Herb. 104:79. 1934 #### Original name null ### Remarks null
{ "content_hash": "6eb360c8069965c1619a62c4999faa5a", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 12.307692307692308, "alnum_prop": 0.69375, "repo_name": "mdoering/backbone", "id": "4833eae58099a1ee8e187d518ee34bd2a906be40", "size": "224", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Bromeliaceae/Neoregelia/Neoregelia spectabilis/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
from greetings import greet def test_greet_the_world(): assert greet("world") == "Hello, world!"
{ "content_hash": "5ac8d2d1f528f6babc44bf745f09d2d6", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 44, "avg_line_length": 20.6, "alnum_prop": 0.6796116504854369, "repo_name": "PPPoSD-2017/greetings", "id": "68dea7cdf284a80805f2b1258b5706a7b275eb44", "size": "103", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/test_greet.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "1048" } ], "symlink_target": "" }
package christophedelory.playlist.smil; import java.io.InputStream; import java.io.StringReader; import org.apache.commons.logging.Log; import christophedelory.content.type.ContentType; import christophedelory.io.IOUtils; import christophedelory.player.PlayerSupport; import christophedelory.playlist.AbstractPlaylistComponent; import christophedelory.playlist.Media; import christophedelory.playlist.Parallel; import christophedelory.playlist.Playlist; import christophedelory.playlist.Sequence; import christophedelory.playlist.SpecificPlaylist; import christophedelory.playlist.SpecificPlaylistProvider; import christophedelory.xml.XmlSerializer; /** * The W3C SMIL playlist XML format. * An XML recommendation of the World Wide Web Consortium that includes playlist features. * @version $Revision: 90 $ * @author Christophe Delory */ public class SmilProvider implements SpecificPlaylistProvider { /** * A list of compatible content types. */ private static final ContentType[] FILETYPES = { new ContentType(new String[] { ".smil", ".smi" }, new String[] { "application/smil+xml", "application/smil" }, new PlayerSupport[] { new PlayerSupport(PlayerSupport.Player.MEDIA_PLAYER_CLASSIC, false, null), new PlayerSupport(PlayerSupport.Player.QUICKTIME, true, null), new PlayerSupport(PlayerSupport.Player.REALPLAYER, false, null), }, "Synchronized Multimedia Integration Language (SMIL)"), }; @Override public String getId() { return "smil"; } @Override public ContentType[] getContentTypes() { return FILETYPES.clone(); } @Override public SpecificPlaylist readFrom(final InputStream in, final String encoding, final Log logger) throws Exception { String enc = encoding; if (enc == null) { enc = "UTF-8"; } String str = IOUtils.toString(in, enc); // May throw IOException. Throws NullPointerException if in is null. // Replace all occurrences of a single '&' with "&amp;" (or leave this construct as is). // First replace blindly all '&' to its corresponding character reference. str = str.replace("&", "&amp;"); // Then restore any existing character reference. str = str.replaceAll("&amp;([a-zA-Z0-9#]+;)", "&$1"); // Shall not throw PatternSyntaxException. // Unmarshal the SMIL playlist. final XmlSerializer serializer = XmlSerializer.getMapping("christophedelory/playlist/smil"); // May throw Exception. serializer.getUnmarshaller().setIgnoreExtraElements(true); // Many SMIL elements are not implemented yet. final StringReader reader = new StringReader(str); final SpecificPlaylist ret = (SpecificPlaylist) serializer.unmarshal(reader); // May throw Exception. ret.setProvider(this); return ret; } @Override public SpecificPlaylist toSpecificPlaylist(final Playlist playlist) throws Exception { final Smil ret = new Smil(); ret.setProvider(this); final Body body = new Body(); body.setRepeatCount(Float.valueOf((float) playlist.getRootSequence().getRepeatCount())); ret.setBody(body); final AbstractPlaylistComponent[] components = playlist.getRootSequence().getComponents(); for (AbstractPlaylistComponent component : components) { addToPlaylist(body, component); } return ret; } /** * Adds the specified generic playlist component, and all its childs if any, to the input time container. * @param timingElement the parent time container. Shall not be <code>null</code>. * @param component the generic playlist component to handle. Shall not be <code>null</code>. * @throws NullPointerException if <code>timingElement</code> is <code>null</code>. * @throws NullPointerException if <code>component</code> is <code>null</code>. */ private void addToPlaylist(final AbstractTimingElement timingElement, final AbstractPlaylistComponent component) { if (component instanceof Sequence) { final Sequence sequence = (Sequence) component; final SequentialTimingElement seq = new SequentialTimingElement(); seq.setRepeatCount(Float.valueOf((float) sequence.getRepeatCount())); timingElement.addSmilElement(seq); final AbstractPlaylistComponent[] components = sequence.getComponents(); for (AbstractPlaylistComponent c : components) { addToPlaylist(seq, c); } } else if (component instanceof Parallel) { final Parallel parallel = (Parallel) component; final ParallelTimingElement par = new ParallelTimingElement(); par.setRepeatCount(Float.valueOf((float) parallel.getRepeatCount())); timingElement.addSmilElement(par); final AbstractPlaylistComponent[] components = parallel.getComponents(); for (AbstractPlaylistComponent c : components) { addToPlaylist(par, c); } } else if (component instanceof Media) { final Media media = (Media) component; final Reference ref = new Reference(); if (media.getSource() != null) { ref.setSource(media.getSource().toString()); ref.setType(media.getSource().getType()); // May be null. } ref.setDuration(media.getDuration()); ref.setRepeatCount(Float.valueOf((float) media.getRepeatCount())); timingElement.addSmilElement(ref); } } }
{ "content_hash": "714497441e22caf71acedefa81273e1c", "timestamp": "", "source": "github", "line_count": 159, "max_line_length": 124, "avg_line_length": 38.270440251572325, "alnum_prop": 0.6277732128184059, "repo_name": "LizzyProject/Lizzy", "id": "b3422551d517070a1af38eec7ba98ff8ba971ba6", "size": "7448", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/java/christophedelory/playlist/smil/SmilProvider.java", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "HTML", "bytes": "54110" }, { "name": "Java", "bytes": "1230431" }, { "name": "Python", "bytes": "89" }, { "name": "Shell", "bytes": "1921" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <servico xmlns="http://servicos.gov.br/v3/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://servicos.gov.br/v3/schema ../servico.xsd"> <nome>Consulta Situação do Requerimento de Benefício Previdenciário</nome> <sigla/> <nomes-populares/> <descricao>Permite acompanhar o andamento dos processos de concessão inicial de benefícios junto ao INSS. * [Telefone](undefined): Ligue 135 para mais informações</descricao> <gratuito/> <solicitantes/> <tempo-total-estimado> <descricao/> </tempo-total-estimado> <etapas> <etapa> <titulo/> <descricao/> <documentos> <default/> </documentos> <custos> <default/> </custos> <canais-de-prestacao> <default> <canal-de-prestacao tipo="web"> <descricao>http://agencia.previdencia.gov.br/e-aps/servico/154</descricao> </canal-de-prestacao> </default> </canais-de-prestacao> </etapa> </etapas> <orgao id="http://estruturaorganizacional.dados.gov.br/id/unidade-organizacional/1930"/> <segmentos-da-sociedade> <item>Cidadãos</item> </segmentos-da-sociedade> <areas-de-interesse> <item>Previdência Social</item> </areas-de-interesse> <palavras-chave/> <legislacoes/> </servico>
{ "content_hash": "dcfcf5e4c9c015479c7f61ed592abf71", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 173, "avg_line_length": 36.45238095238095, "alnum_prop": 0.5871979098628347, "repo_name": "nitaibezerra/cartas-de-servico", "id": "931496192551daa3fae0d09de396a9af07fee64b", "size": "1541", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "cartas-servico/v3/servicos/consulta-situacao-do-requerimento-de-beneficio-previdenciario.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Shell", "bytes": "826" } ], "symlink_target": "" }
DOUBTFUL #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "b02def7dddd6c5035f0883f386890bba", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "17408821fdf9b54b3a69c23d6ecd0c30e5f647a6", "size": "203", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Rosales/Rosaceae/Amygdalus/Amygdalus urartu/Amygdalus urartu grossheimii/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" level="3" version="1" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" comp:required="true"> <model id="complexified"> <listOfCompartments> <compartment id="comp" spatialDimensions="3" size="1" constant="true"> <comp:listOfReplacedElements> <comp:replacedElement comp:idRef="comp" comp:submodelRef="A"/> <comp:replacedElement comp:portRef="comp_port" comp:submodelRef="B"/> </comp:listOfReplacedElements> </compartment> </listOfCompartments> <listOfSpecies> <species id="S" compartment="comp" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"> <comp:listOfReplacedElements> <comp:replacedElement comp:idRef="S" comp:submodelRef="A"/> </comp:listOfReplacedElements> <comp:replacedBy comp:portRef="S_port" comp:submodelRef="B"/> </species> <species id="D" compartment="comp" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"> <comp:listOfReplacedElements> <comp:replacedElement comp:idRef="D" comp:submodelRef="A"/> </comp:listOfReplacedElements> <comp:replacedBy comp:portRef="D_port" comp:submodelRef="B"/> </species> </listOfSpecies> <listOfReactions> <reaction id="J0" reversible="true" fast="false"> <listOfReactants> <speciesReference species="S" stoichiometry="1" constant="true"/> </listOfReactants> <comp:listOfReplacedElements> <comp:replacedElement comp:submodelRef="B" comp:deletion="oldrxn"/> </comp:listOfReplacedElements> <comp:replacedBy comp:portRef="J0_port" comp:submodelRef="A"/> </reaction> <reaction id="J1" reversible="true" fast="false"> <listOfProducts> <speciesReference species="D" stoichiometry="1" constant="true"/> </listOfProducts> <comp:listOfReplacedElements> <comp:replacedElement comp:submodelRef="B" comp:deletion="oldrxn"/> </comp:listOfReplacedElements> <comp:replacedBy comp:portRef="J1_port" comp:submodelRef="A"/> </reaction> </listOfReactions> <comp:listOfSubmodels> <comp:submodel comp:id="A" comp:modelRef="enzyme"/> <comp:submodel comp:id="B" comp:modelRef="simple"> <comp:listOfDeletions> <comp:deletion comp:portRef="J0_port" comp:id="oldrxn"/> </comp:listOfDeletions> </comp:submodel> </comp:listOfSubmodels> </model> <comp:listOfModelDefinitions> <comp:modelDefinition id="enzyme" name="enzyme"> <listOfCompartments> <compartment id="comp" spatialDimensions="3" size="1" constant="true"/> </listOfCompartments> <listOfSpecies> <species id="S" compartment="comp" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/> <species id="E" compartment="comp" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/> <species id="D" compartment="comp" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/> <species id="ES" compartment="comp" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/> </listOfSpecies> <listOfReactions> <reaction id="J0" reversible="true" fast="false"> <listOfReactants> <speciesReference species="S" stoichiometry="1" constant="true"/> <speciesReference species="E" stoichiometry="1" constant="true"/> </listOfReactants> <listOfProducts> <speciesReference species="ES" stoichiometry="1" constant="true"/> </listOfProducts> </reaction> <reaction id="J1" reversible="true" fast="false"> <listOfReactants> <speciesReference species="ES" stoichiometry="1" constant="true"/> </listOfReactants> <listOfProducts> <speciesReference species="E" stoichiometry="1" constant="true"/> <speciesReference species="D" stoichiometry="1" constant="true"/> </listOfProducts> </reaction> </listOfReactions> <comp:listOfPorts> <comp:port comp:idRef="E" comp:id="E_port"/> <comp:port comp:idRef="ES" comp:id="ES_port"/> <comp:port comp:idRef="J0" comp:id="J0_port"/> <comp:port comp:idRef="J1" comp:id="J1_port"/> </comp:listOfPorts> </comp:modelDefinition> <comp:modelDefinition id="simple"> <listOfCompartments> <compartment id="comp" spatialDimensions="3" size="1" constant="true"/> </listOfCompartments> <listOfSpecies> <species id="S" compartment="comp" initialConcentration="5" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/> <species id="D" compartment="comp" initialConcentration="10" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/> </listOfSpecies> <listOfReactions> <reaction id="J0" reversible="true" fast="false"> <listOfReactants> <speciesReference species="S" stoichiometry="1" constant="true"/> </listOfReactants> <listOfProducts> <speciesReference species="D" stoichiometry="1" constant="true"/> </listOfProducts> </reaction> </listOfReactions> <comp:listOfPorts> <comp:port comp:idRef="S" comp:id="S_port"/> <comp:port comp:idRef="D" comp:id="D_port"/> <comp:port comp:idRef="comp" comp:id="comp_port"/> <comp:port comp:idRef="J0" comp:id="J0_port"/> </comp:listOfPorts> </comp:modelDefinition> </comp:listOfModelDefinitions> </sbml>
{ "content_hash": "522b7f550337c43fbe3d986a2c6b8918", "timestamp": "", "source": "github", "line_count": 128, "max_line_length": 98, "avg_line_length": 47.625, "alnum_prop": 0.6110564304461942, "repo_name": "mgaldzic/antimony", "id": "0caf2ff588cfd791d99c524d4d207d78f952968b", "size": "6096", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/test/test-data/from-libsbml/eg-replacement.xml", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "107863" }, { "name": "C++", "bytes": "828602" }, { "name": "IDL", "bytes": "3128" }, { "name": "Perl", "bytes": "206" }, { "name": "Python", "bytes": "158935" } ], "symlink_target": "" }
require 'rails_helper' describe PresenceType, type: :model do it_behaves_like 'DropDownListable' it_behaves_like 'Localizable' end
{ "content_hash": "5c12f4b24704525d9e20d9774a9a6e4c", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 38, "avg_line_length": 22.666666666666668, "alnum_prop": 0.7720588235294118, "repo_name": "steveoro/goggles_core", "id": "a6d4f8163a4bf51c17f85bc663a90fe3bde26229", "size": "167", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/models/presence_type_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "674" }, { "name": "HTML", "bytes": "3787" }, { "name": "JavaScript", "bytes": "1252" }, { "name": "Ruby", "bytes": "2366031" }, { "name": "Shell", "bytes": "30" } ], "symlink_target": "" }
package com.hashedin.dashboard.report; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.springframework.core.io.Resource; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; public class ReportManager { private final Map<String, Report> reports; public ReportManager(InputStream in) throws IOException, SAXException, ParserConfigurationException { this.reports = loadReports(in); } public ReportManager(Resource resource) throws IOException, SAXException, ParserConfigurationException { InputStream in = resource.getInputStream(); if (in == null) { throw new IllegalArgumentException("Resource " + resource + " does not return a valid InputStream"); } this.reports = loadReports(in); } public String getQueryString(String reportId, String queryId) { Report query = getReport(reportId); return query.getQueryString(queryId); } public Report getReport(String id) { if (reports.containsKey(id)) { return reports.get(id); } throw new ReportNotFoundException(id); } Map<String, Report> loadReports(InputStream in) throws IOException, SAXException, ParserConfigurationException { Map<String, Report> reports = new HashMap<String, Report>(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(in); NodeList reportNodes = doc.getElementsByTagName("report"); for (int i = 0; i < reportNodes.getLength(); i++) { Element reportNode = (Element) reportNodes.item(i); String id = reportNode.getAttribute("id"); String reportType = getTagValue("type", reportNode); Map<String, String> queryMap = getQueries(reportNode); List<Column> columns; NodeList columnNodes = reportNode.getElementsByTagName("column"); if (columnNodes != null) { columns = new ArrayList<Column>(); for (int j = 0; j < columnNodes.getLength(); j++) { Element columnNode = (Element) columnNodes.item(j); String label = getTagValue("label", columnNode); String type = getTagValue("type", columnNode); Column column = new Column(label, type); columns.add(column); } } else { columns = Collections.emptyList(); } if ((id != null) && !queryMap.isEmpty()) { Report query = new Report(id, reportType, queryMap, columns); reports.put(id, query); } } return Collections.unmodifiableMap(reports); } private Map<String, String> getQueries(Element queryNode) { Map<String, String> queriesById = new HashMap<String, String>(); NodeList nodes = queryNode.getElementsByTagName("query"); for (int i = 0; i < nodes.getLength(); i++) { Element q = (Element) nodes.item(i); String id = q.getAttribute("id"); String queryString = q.getTextContent(); if ((id != null) && (queryString != null)) { id = id.trim(); queryString = queryString.trim(); queriesById.put(id, queryString); } } return queriesById; } private static String getTagValue(String tagName, Element eElement) { NodeList nlList = eElement.getElementsByTagName(tagName).item(0).getChildNodes(); Node nValue = nlList.item(0); return nValue.getNodeValue(); } }
{ "content_hash": "f289e17b3ed3fb91845dffc1221b3681", "timestamp": "", "source": "github", "line_count": 126, "max_line_length": 114, "avg_line_length": 33.46031746031746, "alnum_prop": 0.6098197343453511, "repo_name": "anuragjain67/ReportFramework", "id": "a009ff5aec27b8fa4aa7b24830b7436c1f69826b", "size": "4216", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/hashedin/dashboard/report/ReportManager.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "181" }, { "name": "Java", "bytes": "40307" } ], "symlink_target": "" }
using RaraAvis.nCubed.EventSourcing.Core.Events; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RaraAvis.nCubed.EventSourcing.Test.FakeObjects.Events { public class FakeFailedEvent : IVersionedEvent { public FakeFailedEvent() { } public Guid SourceId { get; set; } public int Version { get; set; } } }
{ "content_hash": "37dbc078eed7510ce28d5b8c78663319", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 63, "avg_line_length": 18.85185185185185, "alnum_prop": 0.593320235756385, "repo_name": "josuuribe/nCubed", "id": "ff1d9f36f8c2b3bc81df002aa0f11e5c2019f332", "size": "511", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "EventSourcing.Test/FakeObjects/Events/FakeFailedEvent.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "520745" }, { "name": "Smalltalk", "bytes": "85274" } ], "symlink_target": "" }
<?php use pho\Expectation\Matcher\PrefixMatcher; use pho\Expectation\Matcher\MatcherInterface; describe('PrefixMatcher', function() { it('implements the MatcherInterface', function() { $matcher = new PrefixMatcher('test'); if (!($matcher instanceof MatcherInterface)) { throw new \Exception('Does not implement MatcherInterface'); } }); context('match', function() { it('returns true if the subject contains the prefix', function() { $matcher = new PrefixMatcher('test'); if (!$matcher->match('test123')) { throw new \Exception('Does not return true'); } }); it('returns false if the subject does not contain the prefix', function() { $matcher = new PrefixMatcher('test'); if ($matcher->match('TEST123')) { throw new \Exception('Does not return false'); } }); }); context('getFailureMessage', function() { it('lists the expected prefix', function() { $matcher = new PrefixMatcher('test'); $matcher->match('TEST123'); $expected = 'Expected "TEST123" to start with "test"'; if ($expected !== $matcher->getFailureMessage()) { throw new \Exception('Did not return expected failure message'); } }); it('lists the expected prefix with negated logic', function() { $matcher = new PrefixMatcher('test'); $matcher->match('test123'); $expected = 'Expected "test123" not to start with "test"'; if ($expected !== $matcher->getFailureMessage(true)) { throw new \Exception('Did not return expected failure message'); } }); }); });
{ "content_hash": "4703651703e23ce63cf2ad40033c3adc", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 83, "avg_line_length": 33.48148148148148, "alnum_prop": 0.5575221238938053, "repo_name": "danielstjules/pho", "id": "0545a5a1c743d005fae6077abbe9bcc403d5a42f", "size": "1808", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "spec/Expectation/Matcher/PrefixMatcherSpec.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "221917" } ], "symlink_target": "" }
struct convolution_output_context { size_t input_channels; size_t output_channels; struct nnp_size input_size; struct nnp_padding input_padding; struct nnp_size kernel_size; struct nnp_size output_size; struct nnp_size output_subsampling; const float* input_pointer; const float* kernel_pointer; const float* bias; float* output_pointer; }; static void compute_convolution_output( const struct convolution_output_context context[restrict static 1], size_t sample, size_t output_channel) { const size_t input_channels = context->input_channels; const size_t output_channels = context->output_channels; const struct nnp_size input_size = context->input_size; const struct nnp_padding input_padding = context->input_padding; const struct nnp_size kernel_size = context->kernel_size; const struct nnp_size output_size = context->output_size; const struct nnp_size output_subsampling = context->output_subsampling; const float (*input)[input_channels][input_size.height][input_size.width] = (const float(*)[input_channels][input_size.height][input_size.width]) context->input_pointer; const float (*kernel)[input_channels][kernel_size.height][kernel_size.width] = (const float(*)[input_channels][kernel_size.height][kernel_size.width]) context->kernel_pointer; float (*output)[output_channels][output_size.height][output_size.width] = (float(*)[output_channels][output_size.height][output_size.width]) context->output_pointer; for (size_t y = 0; y < output_size.height; y++) { for (size_t x = 0; x < output_size.width; x++) { double v = 0.0; for (size_t input_channel = 0; input_channel < input_channels; input_channel++) { for (size_t i = 0; i < kernel_size.height; i++) { const size_t s = y * output_subsampling.height + i - input_padding.top; if (s < input_size.height) { for (size_t j = 0; j < kernel_size.width; j++) { const size_t t = x * output_subsampling.width + j - input_padding.left; if (t < input_size.width) { v += input[sample][input_channel][s][t] * kernel[output_channel][input_channel][i][j]; } } } } } output[sample][output_channel][y][x] = v + context->bias[output_channel]; } } } void nnp_convolution_output__reference( size_t batch_size, size_t input_channels, size_t output_channels, struct nnp_size input_size, struct nnp_padding input_padding, struct nnp_size kernel_size, struct nnp_size output_subsampling, const float input_pointer[], const float kernel_pointer[], const float bias[], float output_pointer[], pthreadpool_t threadpool) { const struct nnp_size output_size = { .width = (input_padding.left + input_size.width + input_padding.right - kernel_size.width) / output_subsampling.width + 1, .height = (input_padding.top + input_size.height + input_padding.bottom - kernel_size.height) / output_subsampling.height + 1 }; struct convolution_output_context convolution_output_context = { .input_channels = input_channels, .output_channels = output_channels, .input_size = input_size, .input_padding = input_padding, .kernel_size = kernel_size, .output_size = output_size, .output_subsampling = output_subsampling, .input_pointer = input_pointer, .kernel_pointer = kernel_pointer, .bias = bias, .output_pointer = output_pointer }; pthreadpool_compute_2d(threadpool, (pthreadpool_function_2d_t) compute_convolution_output, &convolution_output_context, batch_size, output_channels); }
{ "content_hash": "b80a779fd0eb143940ebabc6a7cba352", "timestamp": "", "source": "github", "line_count": 91, "max_line_length": 127, "avg_line_length": 38.714285714285715, "alnum_prop": 0.6994039171160943, "repo_name": "microblink/NNPACK", "id": "8fc2875c219e13e6bd187c577bd547ea2dc0c2b6", "size": "3574", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/ref/convolution-output.c", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Assembly", "bytes": "24528" }, { "name": "C", "bytes": "986149" }, { "name": "C++", "bytes": "447707" }, { "name": "CMake", "bytes": "45379" }, { "name": "HTML", "bytes": "16382" }, { "name": "Objective-C", "bytes": "731" }, { "name": "Python", "bytes": "239028" } ], "symlink_target": "" }
import os from oslo.serialization import jsonutils as json from daisy.common import client as base_client from daisy.common import exception from daisy import i18n _ = i18n._ class CacheClient(base_client.BaseClient): DEFAULT_PORT = 9292 DEFAULT_DOC_ROOT = '/v1' def delete_cached_image(self, image_id): """ Delete a specified image from the cache """ self.do_request("DELETE", "/cached_images/%s" % image_id) return True def get_cached_images(self, **kwargs): """ Returns a list of images stored in the image cache. """ res = self.do_request("GET", "/cached_images") data = json.loads(res.read())['cached_images'] return data def get_queued_images(self, **kwargs): """ Returns a list of images queued for caching """ res = self.do_request("GET", "/queued_images") data = json.loads(res.read())['queued_images'] return data def delete_all_cached_images(self): """ Delete all cached images """ res = self.do_request("DELETE", "/cached_images") data = json.loads(res.read()) num_deleted = data['num_deleted'] return num_deleted def queue_image_for_caching(self, image_id): """ Queue an image for prefetching into cache """ self.do_request("PUT", "/queued_images/%s" % image_id) return True def delete_queued_image(self, image_id): """ Delete a specified image from the cache queue """ self.do_request("DELETE", "/queued_images/%s" % image_id) return True def delete_all_queued_images(self): """ Delete all queued images """ res = self.do_request("DELETE", "/queued_images") data = json.loads(res.read()) num_deleted = data['num_deleted'] return num_deleted def get_client(host, port=None, timeout=None, use_ssl=False, username=None, password=None, tenant=None, auth_url=None, auth_strategy=None, auth_token=None, region=None, is_silent_upload=False, insecure=False): """ Returns a new client Glance client object based on common kwargs. If an option isn't specified falls back to common environment variable defaults. """ if auth_url or os.getenv('OS_AUTH_URL'): force_strategy = 'keystone' else: force_strategy = None creds = { 'username': username or os.getenv('OS_AUTH_USER', os.getenv('OS_USERNAME')), 'password': password or os.getenv('OS_AUTH_KEY', os.getenv('OS_PASSWORD')), 'tenant': tenant or os.getenv('OS_AUTH_TENANT', os.getenv('OS_TENANT_NAME')), 'auth_url': auth_url or os.getenv('OS_AUTH_URL'), 'strategy': force_strategy or auth_strategy or os.getenv('OS_AUTH_STRATEGY', 'noauth'), 'region': region or os.getenv('OS_REGION_NAME'), } if creds['strategy'] == 'keystone' and not creds['auth_url']: msg = _("--os_auth_url option or OS_AUTH_URL environment variable " "required when keystone authentication strategy is enabled\n") raise exception.ClientConfigurationError(msg) return CacheClient( host=host, port=port, timeout=timeout, use_ssl=use_ssl, auth_token=auth_token or os.getenv('OS_TOKEN'), creds=creds, insecure=insecure)
{ "content_hash": "170723030a1aa446c91e233f51a18f5b", "timestamp": "", "source": "github", "line_count": 118, "max_line_length": 78, "avg_line_length": 30.04237288135593, "alnum_prop": 0.5847672778561354, "repo_name": "OpenDaisy/daisy-api", "id": "f3c2a2828f9486b83ad288693fddb4893698d581", "size": "4181", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "daisy/image_cache/client.py", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "1475450" }, { "name": "Shell", "bytes": "7860" } ], "symlink_target": "" }
struct PatternRow; struct Song; struct IPlayer; struct Color; struct Pattern; struct TrackEditorState; class TrackEditor: public ColumnEditor { protected: IPlayer& mPlayer; Song& mSong; bool mTriggerNotes; bool mAddMacroEffect; int getColumnFlagsFromModifier(int mod) const; void killCurrentTrack(); void findCurrentUnusedTrack(); void copyCurrentTrack(); void pasteCurrentTrack(); void copyCurrentBlock(); void pasteCurrentBlock(); void setEditSkip(int skip); void setBlockStartToCurrentRow(); void setBlockEndToCurrentRow(); protected: virtual Pattern& getCurrentPattern(int track) = 0; virtual PatternRow& getCurrentPatternRow() = 0; virtual PatternRow& getPatternRow(int track, int row) = 0; virtual void changeColumn(int d); void playRow(); void insertRow(bool allTracks, int flags); void deleteRow(bool allTracks, int flags); void emptyRow(bool allTracks, int flags); void setBlockStart(int row); void setBlockEnd(int row); void copyBlock(int track); void pasteBlock(int track); void copyTrack(int track); void pasteTrack(int track); void killTrack(int track); virtual void findUnusedTrack(int track) = 0; void renderPatternRow(Renderer& renderer, const SDL_Rect& area, const PatternRow& row, const Color& color, int columnFlags = -1); public: TrackEditor(EditorState& editorState, TrackEditorState& trackEditorState, IPlayer& player, Song& song, int tracks); virtual ~TrackEditor(); void setTriggerNotes(bool state); void setAddMacroEffect(bool state); virtual bool onEvent(SDL_Event& event); virtual void onDraw(Renderer& renderer, const SDL_Rect& area); };
{ "content_hash": "5dd50a7ecc1510801cae7ac613e308a5", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 130, "avg_line_length": 26.9, "alnum_prop": 0.7726146220570013, "repo_name": "kometbomb/prototracker", "id": "9583c42dfa1a10e3ca915f23ea6daef0c9d22892", "size": "1655", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "src/TrackEditor.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "3164" }, { "name": "C++", "bytes": "265741" }, { "name": "JavaScript", "bytes": "813" }, { "name": "Makefile", "bytes": "195" } ], "symlink_target": "" }
#ifndef __itkPathToPathFilter_h #define __itkPathToPathFilter_h #include "itkPathSource.h" namespace itk { /** \class PathToPathFilter * \brief Base class for filters that take a path as input and produce a path as output. * * PathToPathFilter is the base class for all process objects that output * path data and require path data as input. Specifically, this class * defines the SetInput() method for defining the input to a filter. * * \ingroup PathFilters * \ingroup ITK-Path */ template< class TInputPath, class TOutputPath > class ITK_EXPORT PathToPathFilter:public PathSource< TOutputPath > { public: /** Standard class typedefs. */ typedef PathToPathFilter Self; typedef PathSource< TOutputPath > Superclass; typedef SmartPointer< Self > Pointer; typedef SmartPointer< const Self > ConstPointer; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Run-time type information (and related methods). */ itkTypeMacro(PathToPathFilter, PathSource); /** Some convenient typedefs. */ typedef TInputPath InputPathType; typedef typename InputPathType::Pointer InputPathPointer; typedef typename InputPathType::ConstPointer InputPathConstPointer; /** Set/Get the path input of this process object. */ virtual void SetInput(const InputPathType *path); virtual void SetInput(unsigned int, const TInputPath *path); const InputPathType * GetInput(void); const InputPathType * GetInput(unsigned int idx); protected: PathToPathFilter(); ~PathToPathFilter() {} virtual void PrintSelf(std::ostream & os, Indent indent) const; /** What is the input requested region that is required to produce the output * requested region? Up till and including now, the base assumption is that * the largest possible region will be requested of the input. If this method * is overridden, the new method should call its superclass' implementation as * its first step. * * \sa ProcessObject::GenerateInputRequestedRegion() */ virtual void GenerateInputRequestedRegion(); private: PathToPathFilter(const Self &); //purposely not implemented void operator=(const Self &); //purposely not implemented }; } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkPathToPathFilter.txx" #endif #endif
{ "content_hash": "da862c8a482008d8ad0de848d372e599", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 88, "avg_line_length": 31.36, "alnum_prop": 0.735969387755102, "repo_name": "CapeDrew/DITK", "id": "e8db58d8ed2b3033e0ce3a6efa580e2f49671282", "size": "3127", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "Modules/Filtering/Path/include/itkPathToPathFilter.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "35698104" }, { "name": "C#", "bytes": "1714" }, { "name": "C++", "bytes": "17545759" }, { "name": "Common Lisp", "bytes": "5433" }, { "name": "FORTRAN", "bytes": "1720073" }, { "name": "Java", "bytes": "59334" }, { "name": "Objective-C", "bytes": "6591" }, { "name": "Perl", "bytes": "17899" }, { "name": "Python", "bytes": "891843" }, { "name": "Ruby", "bytes": "296" }, { "name": "Shell", "bytes": "33144" }, { "name": "Tcl", "bytes": "133547" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "5a1792e0cc1bc5b9466748661a5cbc59", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "eef57cff9f7ed6b1cda596e54f2a8efe7877adde", "size": "193", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Elymus/Elymus trachycaulus/ Syn. Agropyron richardsonii ciliatum/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
module AdminBrokenLinksReportingHelper def govspeak_with_links(*links) "Some content with links: ##{build_links(links).join(' ')}" end def build_links(links) links.each_with_index.map { |link, i| "[Link #{i}](#{link})" } end end World(AdminBrokenLinksReportingHelper)
{ "content_hash": "48cd4e38ce50bf766cf41f916a53d233", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 66, "avg_line_length": 26, "alnum_prop": 0.6958041958041958, "repo_name": "alphagov/whitehall", "id": "3ffc3049cd4003a60d15a164bd3181c1bbd180f4", "size": "286", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "features/support/admin_broken_links_reporting_helper.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "3039" }, { "name": "Gherkin", "bytes": "82444" }, { "name": "HTML", "bytes": "695467" }, { "name": "JavaScript", "bytes": "250602" }, { "name": "Procfile", "bytes": "117" }, { "name": "Ruby", "bytes": "5239261" }, { "name": "SCSS", "bytes": "180354" }, { "name": "Shell", "bytes": "3870" } ], "symlink_target": "" }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\widgets\MaskedInput; /* @var $this yii\web\View */ /* @var $model \frontend\modules\doctors\models\Doctors */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="doctors-form"> <?php $form = ActiveForm::begin(); ?> <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'number')->textInput() ?> <?= $form->field($model, 'description')->textarea(['rows' => 6]) ?> <?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'price_initial')->textInput()->hint('Сумма в рублях') ?> <?= $form->field($model, 'price_secondary')->textInput()->hint('Сумма в рублях') ?> <?= $form->field($model, 'start_time')->widget(MaskedInput::className(),[ 'mask' => '99:99', ])->hint('время в формате чч:мм'); ?> <?= $form->field($model, 'end_time')->widget(MaskedInput::className(),[ 'mask' => '99:99', ])->hint('время в формате чч:мм'); ?> <div class="form-group"> <?= Html::submitButton($model->isNewRecord ? 'Добавить' : 'Изменить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> </div> <?php ActiveForm::end(); ?> </div>
{ "content_hash": "bf17b1e73457ec5f42228f5b25c41888", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 154, "avg_line_length": 30.785714285714285, "alnum_prop": 0.568445475638051, "repo_name": "kvazarum/prereg", "id": "5344dbd3f3e05ffaa22e6ca51896a7c4bc9e9b47", "size": "1367", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "frontend/modules/doctors/views/default/_form.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "726" }, { "name": "CSS", "bytes": "2728" }, { "name": "JavaScript", "bytes": "20068" }, { "name": "PHP", "bytes": "347939" } ], "symlink_target": "" }
<div class="archive-wrap"> <h3>Latest {{ page.categories | first | replace: '-',' ' | capitalize }}</h3> <ul class="th-grid"> {% capture category_name %}{{ page.categories | first }}{% endcapture %} {% for post in site.categories.[category_name] limit:4 %} <li><a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}"> <img src="{{ site.url }}/images/{{ post.image.thumb }}" alt=""></a></li> {% endfor %} </ul> </div><!-- /.archive-wrap -->
{ "content_hash": "08395c8823bd14889e1495aefb51c082", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 80, "avg_line_length": 47.1, "alnum_prop": 0.5583864118895966, "repo_name": "ramesh-yadav/ramesh-yadav.github.io", "id": "6f2e26336036443306976b6d0a7723ca189cc3b9", "size": "471", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "_includes/latest-posts-grid.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "46366" }, { "name": "HTML", "bytes": "25651" } ], "symlink_target": "" }
<?php namespace FileMarshal\Exceptions; /** * exception for an upload error * @package FileMarshal */ class UploadErrPartial extends \Exception { /** * the exception coce */ protected $code = UPLOAD_ERR_PARTIAL; /** * the exception message */ protected $message = "UPLOAD_ERR_PARTIAL: The uploaded file was only partially uploaded"; }
{ "content_hash": "a79c155ee23c2a7d70638a4ca550a200", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 90, "avg_line_length": 17.65, "alnum_prop": 0.7025495750708215, "repo_name": "henderjon/filemarshal", "id": "fcf0d520644990a20c43dd966a14ccdd7c576717", "size": "353", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Exceptions/UploadErrPartial.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "PHP", "bytes": "13274" } ], "symlink_target": "" }
""" __graph_StateMachineElement.py___________________________________________________________ Automatically generated graphical appearance ---> MODIFY DIRECTLY WITH CAUTION _________________________________________________________________________________________ """ import tkFont from graphEntity import * from GraphicalForm import * from ATOM3Constraint import * class graph_StateMachineElement(graphEntity): def __init__(self, x, y, semObject = None): self.semanticObject = semObject self.sizeX, self.sizeY = 172, 82 graphEntity.__init__(self, x, y) self.ChangesAtRunTime = 0 self.constraintList = [] if self.semanticObject: atribs = self.semanticObject.attributesToDraw() else: atribs = None self.graphForms = [] self.imageDict = self.getImageDict() def DrawObject(self, drawing, showGG = 0): self.dc = drawing if showGG and self.semanticObject: self.drawGGLabel(drawing) h = drawing.create_oval(self.translate([189.0, 62.0, 189.0, 62.0]), tags = (self.tag, 'connector'), outline = '', fill = '' ) self.connectors.append( h ) h = drawing.create_rectangle(self.translate([20.0, 20.0, 190.0, 100.0]), tags = self.tag, stipple = '', width = 1, outline = 'black', fill = 'moccasin') self.gf4 = GraphicalForm(drawing, h, "gf4") self.graphForms.append(self.gf4) font = tkFont.Font( family='Arial', size=12, weight='normal', slant='roman', underline=0) h = drawing.create_text(self.translate([134.0, 37.0, 134.0, 12.0])[:2], tags = self.tag, font=font, fill = 'grey45', anchor = 'center', text = '', width = '0', justify= 'left', stipple='' ) self.gf30 = GraphicalForm(drawing, h, 'gf30', fontObject=font) self.graphForms.append(self.gf30) font = tkFont.Font( family='Arial', size=12, weight='normal', slant='roman', underline=0) h = drawing.create_text(self.translate([100.0, 40.0, 100.0, 12.0])[:2], tags = self.tag, font=font, fill = 'black', anchor = 'center', text = 'StateMachineElement', width = '0', justify= 'left', stipple='' ) self.gf31 = GraphicalForm(drawing, h, 'gf31', fontObject=font) self.graphForms.append(self.gf31) if self.semanticObject: drawText = self.semanticObject.name.toString() else: drawText = "<name>" font = tkFont.Font( family='Helvetica', size=12, weight='normal', slant='roman', underline=0) h = drawing.create_text(self.translate([72.0, 66.0, 72.0, 12.0])[:2], tags = self.tag, font=font, fill = 'black', anchor = 'center', text = drawText, width = '0', justify= 'left', stipple='' ) self.attr_display["name"] = h self.gf32 = GraphicalForm(drawing, h, 'gf32', fontObject=font) self.graphForms.append(self.gf32) def postCondition( self, actionID, * params): return None def preCondition( self, actionID, * params): return None def getImageDict( self ): imageDict = dict() return imageDict new_class = graph_StateMachineElement
{ "content_hash": "de8a5a667452bbce03a332e6a21f0a67", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 215, "avg_line_length": 45.97014925373134, "alnum_prop": 0.6038961038961039, "repo_name": "levilucio/SyVOLT", "id": "9da2e04b691b0d51c343ac38612412c40e3265fd", "size": "3080", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "UMLRT2Kiltera_MM/graph_StateMachineElement.py", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "166159" }, { "name": "Python", "bytes": "34207588" }, { "name": "Shell", "bytes": "1118" } ], "symlink_target": "" }
@interface LoveDonateRecordViewController : WifeButlerLoadingTableViewController @property (nonatomic,strong) MyDonateUserModel * usermodel; @end
{ "content_hash": "ad5fafbf3e256bb2fac6fc0b014f7649", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 80, "avg_line_length": 29.6, "alnum_prop": 0.8581081081081081, "repo_name": "lizhuangzi/WifeButler", "id": "b153f02990dafcb04e36c247f05cf02489e422a9", "size": "381", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "WifeButler_8_10 2/WifeButler/Classes/Home/Controllers/爱心捐赠/LoveDonateRecordViewController.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "825" }, { "name": "Objective-C", "bytes": "2929049" }, { "name": "Objective-C++", "bytes": "11688" }, { "name": "Ruby", "bytes": "467" }, { "name": "Shell", "bytes": "9515" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <meta name="collection" content="exclude"> <!-- Generated by javadoc (build 1.5.0-rc) on Wed Aug 11 07:28:41 PDT 2004 --> <TITLE> Uses of Class java.awt.geom.AffineTransform (Java 2 Platform SE 5.0) </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { parent.document.title="Uses of Class java.awt.geom.AffineTransform (Java 2 Platform SE 5.0)"; } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> <b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Standard&nbsp;Ed. 5.0</b></EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?java/awt/geom//class-useAffineTransform.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="AffineTransform.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>java.awt.geom.AffineTransform</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#java.awt"><B>java.awt</B></A></TD> <TD>Contains all of the classes for creating user interfaces and for painting graphics and images.&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#java.awt.font"><B>java.awt.font</B></A></TD> <TD>Provides classes and interface relating to fonts.&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#java.awt.geom"><B>java.awt.geom</B></A></TD> <TD>Provides the Java 2D classes for defining and performing operations on objects related to two-dimensional geometry.&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#java.awt.image"><B>java.awt.image</B></A></TD> <TD>Provides classes for creating and modifying images.&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#java.awt.image.renderable"><B>java.awt.image.renderable</B></A></TD> <TD>Provides classes and interfaces for producing rendering-independent images.&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="java.awt"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A> in <A HREF="../../../../java/awt/package-summary.html">java.awt</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../java/awt/package-summary.html">java.awt</A> that return <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>GraphicsConfiguration.</B><B><A HREF="../../../../java/awt/GraphicsConfiguration.html#getDefaultTransform()">getDefaultTransform</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the default <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom"><CODE>AffineTransform</CODE></A> for this <code>GraphicsConfiguration</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>GraphicsConfiguration.</B><B><A HREF="../../../../java/awt/GraphicsConfiguration.html#getNormalizingTransform()">getNormalizingTransform</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a <code>AffineTransform</code> that can be concatenated with the default <code>AffineTransform</code> of a <code>GraphicsConfiguration</code> so that 72 units in user space equals 1 inch in device space.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>Graphics2D.</B><B><A HREF="../../../../java/awt/Graphics2D.html#getTransform()">getTransform</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a copy of the current <code>Transform</code> in the <code>Graphics2D</code> context.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>Font.</B><B><A HREF="../../../../java/awt/Font.html#getTransform()">getTransform</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a copy of the transform associated with this <code>Font</code>.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../java/awt/package-summary.html">java.awt</A> with parameters of type <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/PaintContext.html" title="interface in java.awt">PaintContext</A></CODE></FONT></TD> <TD><CODE><B>TexturePaint.</B><B><A HREF="../../../../java/awt/TexturePaint.html#createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints)">createContext</A></B>(<A HREF="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</A>&nbsp;cm, <A HREF="../../../../java/awt/Rectangle.html" title="class in java.awt">Rectangle</A>&nbsp;deviceBounds, <A HREF="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</A>&nbsp;userBounds, <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;xform, <A HREF="../../../../java/awt/RenderingHints.html" title="class in java.awt">RenderingHints</A>&nbsp;hints)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates and returns a context used to generate the color pattern.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/PaintContext.html" title="interface in java.awt">PaintContext</A></CODE></FONT></TD> <TD><CODE><B>GradientPaint.</B><B><A HREF="../../../../java/awt/GradientPaint.html#createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints)">createContext</A></B>(<A HREF="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</A>&nbsp;cm, <A HREF="../../../../java/awt/Rectangle.html" title="class in java.awt">Rectangle</A>&nbsp;deviceBounds, <A HREF="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</A>&nbsp;userBounds, <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;xform, <A HREF="../../../../java/awt/RenderingHints.html" title="class in java.awt">RenderingHints</A>&nbsp;hints)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates and returns a context used to generate the color pattern.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/PaintContext.html" title="interface in java.awt">PaintContext</A></CODE></FONT></TD> <TD><CODE><B>SystemColor.</B><B><A HREF="../../../../java/awt/SystemColor.html#createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints)">createContext</A></B>(<A HREF="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</A>&nbsp;cm, <A HREF="../../../../java/awt/Rectangle.html" title="class in java.awt">Rectangle</A>&nbsp;r, <A HREF="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</A>&nbsp;r2d, <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;xform, <A HREF="../../../../java/awt/RenderingHints.html" title="class in java.awt">RenderingHints</A>&nbsp;hints)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates and returns a <code>PaintContext</code> used to generate a solid color pattern.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/PaintContext.html" title="interface in java.awt">PaintContext</A></CODE></FONT></TD> <TD><CODE><B>Paint.</B><B><A HREF="../../../../java/awt/Paint.html#createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints)">createContext</A></B>(<A HREF="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</A>&nbsp;cm, <A HREF="../../../../java/awt/Rectangle.html" title="class in java.awt">Rectangle</A>&nbsp;deviceBounds, <A HREF="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</A>&nbsp;userBounds, <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;xform, <A HREF="../../../../java/awt/RenderingHints.html" title="class in java.awt">RenderingHints</A>&nbsp;hints)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates and returns a <A HREF="../../../../java/awt/PaintContext.html" title="interface in java.awt"><CODE>PaintContext</CODE></A> used to generate the color pattern.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/PaintContext.html" title="interface in java.awt">PaintContext</A></CODE></FONT></TD> <TD><CODE><B>Color.</B><B><A HREF="../../../../java/awt/Color.html#createContext(java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints)">createContext</A></B>(<A HREF="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</A>&nbsp;cm, <A HREF="../../../../java/awt/Rectangle.html" title="class in java.awt">Rectangle</A>&nbsp;r, <A HREF="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</A>&nbsp;r2d, <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;xform, <A HREF="../../../../java/awt/RenderingHints.html" title="class in java.awt">RenderingHints</A>&nbsp;hints)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates and returns a <A HREF="../../../../java/awt/PaintContext.html" title="interface in java.awt"><CODE>PaintContext</CODE></A> used to generate a solid color pattern.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/Font.html" title="class in java.awt">Font</A></CODE></FONT></TD> <TD><CODE><B>Font.</B><B><A HREF="../../../../java/awt/Font.html#deriveFont(java.awt.geom.AffineTransform)">deriveFont</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;trans)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new <code>Font</code> object by replicating the current <code>Font</code> object and applying a new transform to it.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/Font.html" title="class in java.awt">Font</A></CODE></FONT></TD> <TD><CODE><B>Font.</B><B><A HREF="../../../../java/awt/Font.html#deriveFont(int, java.awt.geom.AffineTransform)">deriveFont</A></B>(int&nbsp;style, <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;trans)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new <code>Font</code> object by replicating this <code>Font</code> object and applying a new style and transform.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;boolean</CODE></FONT></TD> <TD><CODE><B>Graphics2D.</B><B><A HREF="../../../../java/awt/Graphics2D.html#drawImage(java.awt.Image, java.awt.geom.AffineTransform, java.awt.image.ImageObserver)">drawImage</A></B>(<A HREF="../../../../java/awt/Image.html" title="class in java.awt">Image</A>&nbsp;img, <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;xform, <A HREF="../../../../java/awt/image/ImageObserver.html" title="interface in java.awt.image">ImageObserver</A>&nbsp;obs)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Renders an image, applying a transform from image space into user space before drawing.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;void</CODE></FONT></TD> <TD><CODE><B>Graphics2D.</B><B><A HREF="../../../../java/awt/Graphics2D.html#drawRenderableImage(java.awt.image.renderable.RenderableImage, java.awt.geom.AffineTransform)">drawRenderableImage</A></B>(<A HREF="../../../../java/awt/image/renderable/RenderableImage.html" title="interface in java.awt.image.renderable">RenderableImage</A>&nbsp;img, <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;xform)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Renders a <A HREF="../../../../java/awt/image/renderable/RenderableImage.html" title="interface in java.awt.image.renderable"><CODE>RenderableImage</CODE></A>, applying a transform from image space into user space before drawing.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;void</CODE></FONT></TD> <TD><CODE><B>Graphics2D.</B><B><A HREF="../../../../java/awt/Graphics2D.html#drawRenderedImage(java.awt.image.RenderedImage, java.awt.geom.AffineTransform)">drawRenderedImage</A></B>(<A HREF="../../../../java/awt/image/RenderedImage.html" title="interface in java.awt.image">RenderedImage</A>&nbsp;img, <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;xform)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Renders a <A HREF="../../../../java/awt/image/RenderedImage.html" title="interface in java.awt.image"><CODE>RenderedImage</CODE></A>, applying a transform from image space into user space before drawing.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Polygon.</B><B><A HREF="../../../../java/awt/Polygon.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator object that iterates along the boundary of this <code>Polygon</code> and provides access to the geometry of the outline of this <code>Polygon</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Shape.</B><B><A HREF="../../../../java/awt/Shape.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator object that iterates along the <code>Shape</code> boundary and provides access to the geometry of the <code>Shape</code> outline.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Polygon.</B><B><A HREF="../../../../java/awt/Polygon.html#getPathIterator(java.awt.geom.AffineTransform, double)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at, double&nbsp;flatness)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator object that iterates along the boundary of the <code>Shape</code> and provides access to the geometry of the outline of the <code>Shape</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Shape.</B><B><A HREF="../../../../java/awt/Shape.html#getPathIterator(java.awt.geom.AffineTransform, double)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at, double&nbsp;flatness)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator object that iterates along the <code>Shape</code> boundary and provides access to a flattened view of the <code>Shape</code> outline geometry.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;void</CODE></FONT></TD> <TD><CODE><B>Graphics2D.</B><B><A HREF="../../../../java/awt/Graphics2D.html#setTransform(java.awt.geom.AffineTransform)">setTransform</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;Tx)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Overwrites the Transform in the <code>Graphics2D</code> context.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;void</CODE></FONT></TD> <TD><CODE><B>Graphics2D.</B><B><A HREF="../../../../java/awt/Graphics2D.html#transform(java.awt.geom.AffineTransform)">transform</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;Tx)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Composes an <code>AffineTransform</code> object with the <code>Transform</code> in this <code>Graphics2D</code> according to the rule last-specified-first-applied.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="java.awt.font"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A> in <A HREF="../../../../java/awt/font/package-summary.html">java.awt.font</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../java/awt/font/package-summary.html">java.awt.font</A> that return <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>GlyphVector.</B><B><A HREF="../../../../java/awt/font/GlyphVector.html#getGlyphTransform(int)">getGlyphTransform</A></B>(int&nbsp;glyphIndex)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the transform of the specified glyph within this <code>GlyphVector</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>FontRenderContext.</B><B><A HREF="../../../../java/awt/font/FontRenderContext.html#getTransform()">getTransform</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the transform that is used to scale typographical points to pixels in this <code>FontRenderContext</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>TransformAttribute.</B><B><A HREF="../../../../java/awt/font/TransformAttribute.html#getTransform()">getTransform</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a copy of the wrapped transform.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../java/awt/font/package-summary.html">java.awt.font</A> with parameters of type <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/Shape.html" title="interface in java.awt">Shape</A></CODE></FONT></TD> <TD><CODE><B>TextLayout.</B><B><A HREF="../../../../java/awt/font/TextLayout.html#getOutline(java.awt.geom.AffineTransform)">getOutline</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;tx)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a <code>Shape</code> representing the outline of this <code>TextLayout</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>abstract &nbsp;void</CODE></FONT></TD> <TD><CODE><B>GlyphVector.</B><B><A HREF="../../../../java/awt/font/GlyphVector.html#setGlyphTransform(int, java.awt.geom.AffineTransform)">setGlyphTransform</A></B>(int&nbsp;glyphIndex, <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;newTX)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the transform of the specified glyph within this <code>GlyphVector</code>.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Constructors in <A HREF="../../../../java/awt/font/package-summary.html">java.awt.font</A> with parameters of type <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../java/awt/font/FontRenderContext.html#FontRenderContext(java.awt.geom.AffineTransform, boolean, boolean)">FontRenderContext</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;tx, boolean&nbsp;isAntiAliased, boolean&nbsp;usesFractionalMetrics)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a <code>FontRenderContext</code> object from an optional <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom"><CODE>AffineTransform</CODE></A> and two <code>boolean</code> values that determine if the newly constructed object has anti-aliasing or fractional metrics.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../java/awt/font/TransformAttribute.html#TransformAttribute(java.awt.geom.AffineTransform)">TransformAttribute</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;transform)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wraps the specified transform.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="java.awt.geom"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A> in <A HREF="../../../../java/awt/geom/package-summary.html">java.awt.geom</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../java/awt/geom/package-summary.html">java.awt.geom</A> that return <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>AffineTransform.</B><B><A HREF="../../../../java/awt/geom/AffineTransform.html#createInverse()">createInverse</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an <code>AffineTransform</code> object representing the inverse transformation.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>AffineTransform.</B><B><A HREF="../../../../java/awt/geom/AffineTransform.html#getRotateInstance(double)">getRotateInstance</A></B>(double&nbsp;theta)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a transform representing a rotation transformation.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>AffineTransform.</B><B><A HREF="../../../../java/awt/geom/AffineTransform.html#getRotateInstance(double, double, double)">getRotateInstance</A></B>(double&nbsp;theta, double&nbsp;x, double&nbsp;y)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a transform that rotates coordinates around an anchor point.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>AffineTransform.</B><B><A HREF="../../../../java/awt/geom/AffineTransform.html#getScaleInstance(double, double)">getScaleInstance</A></B>(double&nbsp;sx, double&nbsp;sy)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a transform representing a scaling transformation.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>AffineTransform.</B><B><A HREF="../../../../java/awt/geom/AffineTransform.html#getShearInstance(double, double)">getShearInstance</A></B>(double&nbsp;shx, double&nbsp;shy)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a transform representing a shearing transformation.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>AffineTransform.</B><B><A HREF="../../../../java/awt/geom/AffineTransform.html#getTranslateInstance(double, double)">getTranslateInstance</A></B>(double&nbsp;tx, double&nbsp;ty)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a transform representing a translation transformation.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../java/awt/geom/package-summary.html">java.awt.geom</A> with parameters of type <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>AffineTransform.</B><B><A HREF="../../../../java/awt/geom/AffineTransform.html#concatenate(java.awt.geom.AffineTransform)">concatenate</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;Tx)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Concatenates an <code>AffineTransform</code> <code>Tx</code> to this <code>AffineTransform</code> Cx in the most commonly useful way to provide a new user space that is mapped to the former user space by <code>Tx</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/Area.html" title="class in java.awt.geom">Area</A></CODE></FONT></TD> <TD><CODE><B>Area.</B><B><A HREF="../../../../java/awt/geom/Area.html#createTransformedArea(java.awt.geom.AffineTransform)">createTransformedArea</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;t)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new <code>Area</code> object that contains the same geometry as this <code>Area</code> transformed by the specified <code>AffineTransform</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/Shape.html" title="interface in java.awt">Shape</A></CODE></FONT></TD> <TD><CODE><B>GeneralPath.</B><B><A HREF="../../../../java/awt/geom/GeneralPath.html#createTransformedShape(java.awt.geom.AffineTransform)">createTransformedShape</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a new transformed <code>Shape</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>RoundRectangle2D.</B><B><A HREF="../../../../java/awt/geom/RoundRectangle2D.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iteration object that defines the boundary of this <code>RoundRectangle2D</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>QuadCurve2D.</B><B><A HREF="../../../../java/awt/geom/QuadCurve2D.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iteration object that defines the boundary of the shape of this <code>QuadCurve2D</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Ellipse2D.</B><B><A HREF="../../../../java/awt/geom/Ellipse2D.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iteration object that defines the boundary of this <code>Ellipse2D</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>CubicCurve2D.</B><B><A HREF="../../../../java/awt/geom/CubicCurve2D.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iteration object that defines the boundary of the shape.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Area.</B><B><A HREF="../../../../java/awt/geom/Area.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom"><CODE>PathIterator</CODE></A> for the outline of this <code>Area</code> object.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Arc2D.</B><B><A HREF="../../../../java/awt/geom/Arc2D.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iteration object that defines the boundary of the arc.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>GeneralPath.</B><B><A HREF="../../../../java/awt/geom/GeneralPath.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a <code>PathIterator</code> object that iterates along the boundary of this <code>Shape</code> and provides access to the geometry of the outline of this <code>Shape</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Line2D.</B><B><A HREF="../../../../java/awt/geom/Line2D.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iteration object that defines the boundary of this <code>Line2D</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Rectangle2D.</B><B><A HREF="../../../../java/awt/geom/Rectangle2D.html#getPathIterator(java.awt.geom.AffineTransform)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iteration object that defines the boundary of this <code>Rectangle2D</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>QuadCurve2D.</B><B><A HREF="../../../../java/awt/geom/QuadCurve2D.html#getPathIterator(java.awt.geom.AffineTransform, double)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at, double&nbsp;flatness)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iteration object that defines the boundary of the flattened shape of this <code>QuadCurve2D</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>CubicCurve2D.</B><B><A HREF="../../../../java/awt/geom/CubicCurve2D.html#getPathIterator(java.awt.geom.AffineTransform, double)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at, double&nbsp;flatness)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return an iteration object that defines the boundary of the flattened shape.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Area.</B><B><A HREF="../../../../java/awt/geom/Area.html#getPathIterator(java.awt.geom.AffineTransform, double)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at, double&nbsp;flatness)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <code>PathIterator</code> for the flattened outline of this <code>Area</code> object.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>GeneralPath.</B><B><A HREF="../../../../java/awt/geom/GeneralPath.html#getPathIterator(java.awt.geom.AffineTransform, double)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at, double&nbsp;flatness)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a <code>PathIterator</code> object that iterates along the boundary of the flattened <code>Shape</code> and provides access to the geometry of the outline of the <code>Shape</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Line2D.</B><B><A HREF="../../../../java/awt/geom/Line2D.html#getPathIterator(java.awt.geom.AffineTransform, double)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at, double&nbsp;flatness)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iteration object that defines the boundary of this flattened <code>Line2D</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>RectangularShape.</B><B><A HREF="../../../../java/awt/geom/RectangularShape.html#getPathIterator(java.awt.geom.AffineTransform, double)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at, double&nbsp;flatness)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator object that iterates along the <code>Shape</code> object's boundary and provides access to a flattened view of the outline of the <code>Shape</code> object's geometry.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/PathIterator.html" title="interface in java.awt.geom">PathIterator</A></CODE></FONT></TD> <TD><CODE><B>Rectangle2D.</B><B><A HREF="../../../../java/awt/geom/Rectangle2D.html#getPathIterator(java.awt.geom.AffineTransform, double)">getPathIterator</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at, double&nbsp;flatness)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iteration object that defines the boundary of the flattened <code>Rectangle2D</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>AffineTransform.</B><B><A HREF="../../../../java/awt/geom/AffineTransform.html#preConcatenate(java.awt.geom.AffineTransform)">preConcatenate</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;Tx)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Concatenates an <code>AffineTransform</code> <code>Tx</code> to this <code>AffineTransform</code> Cx in a less commonly used way such that <code>Tx</code> modifies the coordinate transformation relative to the absolute pixel space rather than relative to the existing user space.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>AffineTransform.</B><B><A HREF="../../../../java/awt/geom/AffineTransform.html#setTransform(java.awt.geom.AffineTransform)">setTransform</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;Tx)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets this transform to a copy of the transform in the specified <code>AffineTransform</code> object.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>Area.</B><B><A HREF="../../../../java/awt/geom/Area.html#transform(java.awt.geom.AffineTransform)">transform</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;t)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Transforms the geometry of this <code>Area</code> using the specified <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom"><CODE>AffineTransform</CODE></A>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>GeneralPath.</B><B><A HREF="../../../../java/awt/geom/GeneralPath.html#transform(java.awt.geom.AffineTransform)">transform</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;at)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Transforms the geometry of this path using the specified <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom"><CODE>AffineTransform</CODE></A>.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Constructors in <A HREF="../../../../java/awt/geom/package-summary.html">java.awt.geom</A> with parameters of type <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../java/awt/geom/AffineTransform.html#AffineTransform(java.awt.geom.AffineTransform)">AffineTransform</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;Tx)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new <code>AffineTransform</code> that is a copy of the specified <code>AffineTransform</code> object.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="java.awt.image"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A> in <A HREF="../../../../java/awt/image/package-summary.html">java.awt.image</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../java/awt/image/package-summary.html">java.awt.image</A> that return <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>AffineTransformOp.</B><B><A HREF="../../../../java/awt/image/AffineTransformOp.html#getTransform()">getTransform</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the affine transform used by this transform operation.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Constructors in <A HREF="../../../../java/awt/image/package-summary.html">java.awt.image</A> with parameters of type <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../java/awt/image/AffineTransformOp.html#AffineTransformOp(java.awt.geom.AffineTransform, int)">AffineTransformOp</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;xform, int&nbsp;interpolationType)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs an <CODE>AffineTransformOp</CODE> given an affine transform and the interpolation type.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../java/awt/image/AffineTransformOp.html#AffineTransformOp(java.awt.geom.AffineTransform, java.awt.RenderingHints)">AffineTransformOp</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;xform, <A HREF="../../../../java/awt/RenderingHints.html" title="class in java.awt">RenderingHints</A>&nbsp;hints)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs an <CODE>AffineTransformOp</CODE> given an affine transform.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="java.awt.image.renderable"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A> in <A HREF="../../../../java/awt/image/renderable/package-summary.html">java.awt.image.renderable</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../java/awt/image/renderable/package-summary.html">java.awt.image.renderable</A> that return <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></CODE></FONT></TD> <TD><CODE><B>RenderContext.</B><B><A HREF="../../../../java/awt/image/renderable/RenderContext.html#getTransform()">getTransform</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the current user-to-device AffineTransform.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../java/awt/image/renderable/package-summary.html">java.awt.image.renderable</A> with parameters of type <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>RenderContext.</B><B><A HREF="../../../../java/awt/image/renderable/RenderContext.html#concatenateTransform(java.awt.geom.AffineTransform)">concatenateTransform</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;modTransform)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Modifies the current user-to-device transform by appending another transform.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>RenderContext.</B><B><A HREF="../../../../java/awt/image/renderable/RenderContext.html#concetenateTransform(java.awt.geom.AffineTransform)">concetenateTransform</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;modTransform)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>replaced by <code>concatenateTransform(AffineTransform)</code>.</I></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>RenderContext.</B><B><A HREF="../../../../java/awt/image/renderable/RenderContext.html#preConcatenateTransform(java.awt.geom.AffineTransform)">preConcatenateTransform</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;modTransform)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Modifies the current user-to-device transform by prepending another transform.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>RenderContext.</B><B><A HREF="../../../../java/awt/image/renderable/RenderContext.html#preConcetenateTransform(java.awt.geom.AffineTransform)">preConcetenateTransform</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;modTransform)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>replaced by <code>preConcatenateTransform(AffineTransform)</code>.</I></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>RenderContext.</B><B><A HREF="../../../../java/awt/image/renderable/RenderContext.html#setTransform(java.awt.geom.AffineTransform)">setTransform</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;newTransform)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the current user-to-device AffineTransform contained in the RenderContext to a given transform.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Constructors in <A HREF="../../../../java/awt/image/renderable/package-summary.html">java.awt.image.renderable</A> with parameters of type <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../java/awt/image/renderable/RenderContext.html#RenderContext(java.awt.geom.AffineTransform)">RenderContext</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;usr2dev)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a RenderContext with a given transform.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../java/awt/image/renderable/RenderContext.html#RenderContext(java.awt.geom.AffineTransform, java.awt.RenderingHints)">RenderContext</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;usr2dev, <A HREF="../../../../java/awt/RenderingHints.html" title="class in java.awt">RenderingHints</A>&nbsp;hints)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a RenderContext with a given transform and rendering hints.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../java/awt/image/renderable/RenderContext.html#RenderContext(java.awt.geom.AffineTransform, java.awt.Shape)">RenderContext</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;usr2dev, <A HREF="../../../../java/awt/Shape.html" title="interface in java.awt">Shape</A>&nbsp;aoi)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a RenderContext with a given transform and area of interest.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../java/awt/image/renderable/RenderContext.html#RenderContext(java.awt.geom.AffineTransform, java.awt.Shape, java.awt.RenderingHints)">RenderContext</A></B>(<A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom">AffineTransform</A>&nbsp;usr2dev, <A HREF="../../../../java/awt/Shape.html" title="interface in java.awt">Shape</A>&nbsp;aoi, <A HREF="../../../../java/awt/RenderingHints.html" title="class in java.awt">RenderingHints</A>&nbsp;hints)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a RenderContext with a given transform.</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> <b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Standard&nbsp;Ed. 5.0</b></EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?java/awt/geom//class-useAffineTransform.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="AffineTransform.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="../../../../../relnotes/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Copyright &#169; 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to <a href="../../../../../relnotes/license.html">license terms</a>. Also see the <a href="http://java.sun.com/docs/redist.html">documentation redistribution policy</a>.</font> <!-- Start SiteCatalyst code --> <script language="JavaScript" src="http://www.oracle.com/ocom/groups/systemobject/@mktg_admin/documents/systemobject/s_code_download.js"></script> <script language="JavaScript" src="http://www.oracle.com/ocom/groups/systemobject/@mktg_admin/documents/systemobject/s_code.js"></script> <!-- ********** DO NOT ALTER ANYTHING BELOW THIS LINE ! *********** --> <!-- Below code will send the info to Omniture server --> <script language="javascript">var s_code=s.t();if(s_code)document.write(s_code)</script> <!-- End SiteCatalyst code --> </body> </HTML>
{ "content_hash": "32fdcea8eb5f9415720011dfb29bdc69", "timestamp": "", "source": "github", "line_count": 993, "max_line_length": 695, "avg_line_length": 66.10473313192347, "alnum_prop": 0.671551750403705, "repo_name": "Smolations/more-dash-docsets", "id": "85a078ffdd735b92830406a7dcfd92fd6e79edca", "size": "65642", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docsets/Java 5.docset/Contents/Resources/Documents/java/awt/geom/class-use/AffineTransform.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1456655" }, { "name": "Emacs Lisp", "bytes": "3680" }, { "name": "JavaScript", "bytes": "139712" }, { "name": "Puppet", "bytes": "15851" }, { "name": "Ruby", "bytes": "66500" }, { "name": "Shell", "bytes": "11437" } ], "symlink_target": "" }
package org.arakhne.afc.vmutil.file; import java.net.URL; import java.net.URLStreamHandler; import java.net.URLStreamHandlerFactory; import org.arakhne.afc.vmutil.URISchemeType; /** * This class defines a factory for <code>URL</code> stream * "resource" and "file" protocol handlers. * * <p>It is used by the <code>URL</code> class to create a * <code>URLStreamHandler</code> for a "resource" protocol. * * <p>To use this factory, invoke the following code only ONCE time: * <code>URL.setURLStreamHandlerFactory(new FileResourceURLStreamHandlerFactory());</code>. * * @author $Author: sgalland$ * @version $FullVersion$ * @mavengroupid $GroupId$ * @mavenartifactid $ArtifactId$ * @since 6.0 * @see URLStreamHandlerFactory * @see URL#setURLStreamHandlerFactory(URLStreamHandlerFactory) * @deprecated since 17.0, see {@link HandlerProvider}. */ @Deprecated(forRemoval = true, since = "17.0") public class HandlerFactory implements URLStreamHandlerFactory { @Override public URLStreamHandler createURLStreamHandler(String protocol) { if (URISchemeType.FILE.isScheme(protocol)) { return new Handler(); } // Force the default factory to retreive stream handler. return null; } }
{ "content_hash": "25410d5483e8d774a6aedbf326e778d5", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 91, "avg_line_length": 29.095238095238095, "alnum_prop": 0.7405891980360065, "repo_name": "gallandarakhneorg/afc", "id": "01e8907ac1245843d6197fc58dcfe31623cb728f", "size": "2140", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "core/vmutils/src/main/java/org/arakhne/afc/vmutil/file/HandlerFactory.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "62" }, { "name": "HTML", "bytes": "35" }, { "name": "Java", "bytes": "15844113" }, { "name": "MATLAB", "bytes": "3002" }, { "name": "Perl", "bytes": "637" }, { "name": "Shell", "bytes": "4656" }, { "name": "Visual Basic .NET", "bytes": "50562" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Web.Mvc; using Nop.Admin.Models.Orders; using Nop.Core; using Nop.Core.Domain.Customers; using Nop.Core.Domain.Localization; using Nop.Core.Domain.Orders; using Nop.Services.Customers; using Nop.Services.Helpers; using Nop.Services.Localization; using Nop.Services.Logging; using Nop.Services.Messages; using Nop.Services.Orders; using Nop.Services.Security; using Nop.Web.Framework.Controllers; using Nop.Web.Framework.Kendoui; namespace Nop.Admin.Controllers { public partial class ReturnRequestController : BaseAdminController { #region Fields private readonly IOrderService _orderService; private readonly IDateTimeHelper _dateTimeHelper; private readonly ICustomerService _customerService; private readonly ILocalizationService _localizationService; private readonly IWorkContext _workContext; private readonly IWorkflowMessageService _workflowMessageService; private readonly LocalizationSettings _localizationSettings; private readonly ICustomerActivityService _customerActivityService; private readonly IPermissionService _permissionService; #endregion Fields #region Constructors public ReturnRequestController(IOrderService orderService, ICustomerService customerService, IDateTimeHelper dateTimeHelper, ILocalizationService localizationService, IWorkContext workContext, IWorkflowMessageService workflowMessageService, LocalizationSettings localizationSettings, ICustomerActivityService customerActivityService, IPermissionService permissionService) { this._orderService = orderService; this._customerService = customerService; this._dateTimeHelper = dateTimeHelper; this._localizationService = localizationService; this._workContext = workContext; this._workflowMessageService = workflowMessageService; this._localizationSettings = localizationSettings; this._customerActivityService = customerActivityService; this._permissionService = permissionService; } #endregion #region Utilities [NonAction] protected virtual bool PrepareReturnRequestModel(ReturnRequestModel model, ReturnRequest returnRequest, bool excludeProperties) { if (model == null) throw new ArgumentNullException("model"); if (returnRequest == null) throw new ArgumentNullException("returnRequest"); var orderItem = _orderService.GetOrderItemById(returnRequest.OrderItemId); if (orderItem == null) return false; model.Id = returnRequest.Id; model.ProductId = orderItem.ProductId; model.ProductName = orderItem.Product.Name; model.OrderId = orderItem.OrderId; model.CustomerId = returnRequest.CustomerId; var customer = returnRequest.Customer; model.CustomerInfo = customer.IsRegistered() ? customer.Email : _localizationService.GetResource("Admin.Customers.Guest"); model.Quantity = returnRequest.Quantity; model.ReturnRequestStatusStr = returnRequest.ReturnRequestStatus.GetLocalizedEnum(_localizationService, _workContext); model.CreatedOn = _dateTimeHelper.ConvertToUserTime(returnRequest.CreatedOnUtc, DateTimeKind.Utc); if (!excludeProperties) { model.ReasonForReturn = returnRequest.ReasonForReturn; model.RequestedAction = returnRequest.RequestedAction; model.CustomerComments = returnRequest.CustomerComments; model.StaffNotes = returnRequest.StaffNotes; model.ReturnRequestStatusId = returnRequest.ReturnRequestStatusId; } //model is successfully prepared return true; } #endregion #region Methods //list public ActionResult Index() { return RedirectToAction("List"); } public ActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageReturnRequests)) return AccessDeniedView(); return View(); } [HttpPost] public ActionResult List(DataSourceRequest command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageReturnRequests)) return AccessDeniedView(); var returnRequests = _orderService.SearchReturnRequests(0, 0, 0, null, command.Page - 1, command.PageSize); var returnRequestModels = new List<ReturnRequestModel>(); foreach (var rr in returnRequests) { var m = new ReturnRequestModel(); if (PrepareReturnRequestModel(m, rr, false)) returnRequestModels.Add(m); } var gridModel = new DataSourceResult { Data = returnRequestModels, Total = returnRequests.TotalCount, }; return Json(gridModel); } //edit public ActionResult Edit(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageReturnRequests)) return AccessDeniedView(); var returnRequest = _orderService.GetReturnRequestById(id); if (returnRequest == null) //No return request found with the specified id return RedirectToAction("List"); var model = new ReturnRequestModel(); PrepareReturnRequestModel(model, returnRequest, false); return View(model); } [HttpPost, ParameterBasedOnFormName("save-continue", "continueEditing")] [FormValueRequired("save", "save-continue")] public ActionResult Edit(ReturnRequestModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageReturnRequests)) return AccessDeniedView(); var returnRequest = _orderService.GetReturnRequestById(model.Id); if (returnRequest == null) //No return request found with the specified id return RedirectToAction("List"); if (ModelState.IsValid) { returnRequest.ReasonForReturn = model.ReasonForReturn; returnRequest.RequestedAction = model.RequestedAction; returnRequest.CustomerComments = model.CustomerComments; returnRequest.StaffNotes = model.StaffNotes; returnRequest.ReturnRequestStatusId = model.ReturnRequestStatusId; returnRequest.UpdatedOnUtc = DateTime.UtcNow; _customerService.UpdateCustomer(returnRequest.Customer); //activity log _customerActivityService.InsertActivity("EditReturnRequest", _localizationService.GetResource("ActivityLog.EditReturnRequest"), returnRequest.Id); SuccessNotification(_localizationService.GetResource("Admin.ReturnRequests.Updated")); return continueEditing ? RedirectToAction("Edit", returnRequest.Id) : RedirectToAction("List"); } //If we got this far, something failed, redisplay form PrepareReturnRequestModel(model, returnRequest, true); return View(model); } [HttpPost, ActionName("Edit")] [FormValueRequired("notify-customer")] public ActionResult NotifyCustomer(ReturnRequestModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageReturnRequests)) return AccessDeniedView(); var returnRequest = _orderService.GetReturnRequestById(model.Id); if (returnRequest == null) //No return request found with the specified id return RedirectToAction("List"); //var customer = returnRequest.Customer; var orderItem = _orderService.GetOrderItemById(returnRequest.OrderItemId); int queuedEmailId = _workflowMessageService.SendReturnRequestStatusChangedCustomerNotification(returnRequest, orderItem, _localizationSettings.DefaultAdminLanguageId); if (queuedEmailId > 0) SuccessNotification(_localizationService.GetResource("Admin.ReturnRequests.Notified")); return RedirectToAction("Edit", returnRequest.Id); } //delete [HttpPost] public ActionResult Delete(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageReturnRequests)) return AccessDeniedView(); var returnRequest = _orderService.GetReturnRequestById(id); if (returnRequest == null) //No return request found with the specified id return RedirectToAction("List"); _orderService.DeleteReturnRequest(returnRequest); //activity log _customerActivityService.InsertActivity("DeleteReturnRequest", _localizationService.GetResource("ActivityLog.DeleteReturnRequest"), returnRequest.Id); SuccessNotification(_localizationService.GetResource("Admin.ReturnRequests.Deleted")); return RedirectToAction("List"); } #endregion } }
{ "content_hash": "79ff32c30700990f7e0e1954246fdd50", "timestamp": "", "source": "github", "line_count": 231, "max_line_length": 179, "avg_line_length": 41.55411255411256, "alnum_prop": 0.6561100114595271, "repo_name": "shanalikhan/NopCommerce_POS", "id": "ae701f9614104840770ead0a0b5765fb0bf7bd0c", "size": "9602", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "Presentation/Nop.Web/Administration/Controllers/ReturnRequestController.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "98" }, { "name": "C#", "bytes": "11500197" }, { "name": "CSS", "bytes": "417378" }, { "name": "JavaScript", "bytes": "598460" } ], "symlink_target": "" }
Ext.require([ 'OPF.prometheus.wizard.AbstractWizard', 'OPF.prometheus.wizard.workflow.model.ActivityFieldModel', 'OPF.prometheus.wizard.workflow.model.ProcessEntityModel', 'OPF.prometheus.wizard.workflow.model.ActivityActionModel', 'OPF.prometheus.wizard.workflow.ManageActorsComponent', 'OPF.prometheus.wizard.workflow.ManageStatusesComponent', 'OPF.prometheus.wizard.workflow.ManageActivityComponent' ]); Ext.define('OPF.prometheus.wizard.workflow.ProcessWizard', { extend: 'OPF.prometheus.wizard.AbstractWizard', alias: 'widget.prometheus.wizard.process-wizard', statics: { id: 'workflowWizard' }, id: null, title: 'Create a workflow', iconCls: 'add-process-icon', height: 750, constructor: function(id, cfg) { cfg = cfg || {}; OPF.prometheus.wizard.workflow.ProcessWizard.superclass.constructor.call(this, Ext.apply({ id: id }, cfg)); }, initComponent: function() { var me = this; this.workflowNameField = Ext.create('OPF.core.component.form.Text', { labelAlign: 'top', fieldLabel: 'Name', name: 'name', anchor: '100%', disabled: true, emptyText: 'name of process' }); this.parentDomainStore = Ext.create('Ext.data.Store', { autoLoad: true, model: 'OPF.console.domain.model.DomainModel', proxy: { type: 'ajax', url: OPF.Cfg.restUrl('/registry/domains/by-lookup/' + this.packageLookup), reader: { type: 'json', root: 'data' } } }); this.parentDomainCombo = Ext.create('OPF.core.component.form.ComboBox', { name: 'parentId', labelAlign: 'top', fieldLabel: 'Select Domain', anchor: '100%', editable: false, store: this.parentDomainStore, queryMode: 'local', displayField: 'name', valueField: 'id', emptyText: 'select parent domain of process', listeners: { select: function(combo, records, eOpts) { me.workflowNameField.setDisabled(records.length == 0); } }, listConfig: { cls: 'x-wizards-boundlist' } }); this.processDescriptionField = Ext.create('OPF.core.component.form.TextArea', { name: 'description', labelAlign: 'top', fieldLabel: 'Description', emptyText: 'description of process', anchor: '100%', height: 250 }); this.form = Ext.create('Ext.form.Panel', { layout: 'anchor', border: false, bodyPadding: 10, items: [ this.parentDomainCombo, this.workflowNameField, this.processDescriptionField ], dockedItems: [ { xtype: 'toolbar', dock: 'bottom', ui: 'footer', items: [ '->', { xtype: 'button', ui: 'blue', width: 250, height: 60, text: 'Next', formBind: true, handler: function() { me.goToSelectFieldsPanel(); } } ] } ], listeners: { afterrender: function(form) { me.validator = new OPF.core.validation.FormValidator(form, 'OPF.process.Process', me.messagePanel, { useBaseUrl: false }); me.workflowNameField.customValidator = function(value) { var msg = null; if (me.lastNotUniqueName != value) { if (OPF.isNotBlank(value)) { me.checkUniqueEntityNameTask.delay(250); } } else { msg = 'Name is not unique.'; } return msg; }; } } }); this.rootEntityStore = Ext.create('Ext.data.Store', { autoLoad: true, model: 'OPF.prometheus.wizard.workflow.model.ProcessEntityModel', proxy: { type: 'ajax', url: OPF.Cfg.restUrl('/registry/entities/by-lookup/' + this.packageLookup), reader: { type: 'json', root: 'data' } } }); this.rootEntityCombo = Ext.create('OPF.core.component.form.ComboBox', { labelAlign: 'top', fieldLabel: 'Attach Process To', anchor: '100%', editable: false, store: this.rootEntityStore, queryMode: 'local', displayField: 'name', valueField: 'id', allowBlank: false, listeners: { change: function(combo) { me.entityFieldsStore.removeAll(); me.loadEntityFields(); } }, listConfig: { cls: 'x-wizards-boundlist' } }); this.processTypeField = Ext.create('Ext.form.RadioGroup', { layout:'column', labelAlign: 'top', fieldLabel: 'Does the workflow create new data or use existing data?', items: [ { columnWidth: .5, checked: true, boxLabel: 'Uses Existing Data Record', name: 'processType', inputValue: 'RELATIONAL' }, { columnWidth: .5, boxLabel: 'Creates New Data Record', name: 'processType', inputValue: 'CREATABLE' } ] }); this.entityFieldsStore = Ext.create('Ext.data.Store', { model: 'OPF.prometheus.wizard.workflow.model.ActivityFieldModel', proxy: { type: 'memory', reader: { type: 'json' }, writer: { type: 'json' } } }); // // this.entityFieldsGrid = Ext.create('Ext.grid.Panel', { // anchor: '100%', // padding: '5 10 20 10', // store: this.entityFieldsStore, // cls: 'grid-panel', // height: 300, // columns: [ // { // xtype: 'gridcolumn', // dataIndex: 'name', // text: 'Name', // sortable: false, // renderer: 'htmlEncode', // width: 200, // menuDisabled: true // }, // { // xtype: 'gridcolumn', // dataIndex: 'description', // text: 'Description', // sortable: false, // renderer: 'htmlEncode', // flex: 1, // menuDisabled: true // }, // { // xtype: 'checkcolumn', // dataIndex: 'track', // text: 'Track', // textAlign: 'center', // sortable: false, // width: 65, // menuDisabled: true // } // ] // }); this.activityFormCombo = Ext.create('OPF.core.component.form.ComboBox', { labelAlign: 'top', fieldLabel: 'Type', name: 'activityForm', anchor: '100%', editable: false, store: Ext.create('Ext.data.Store', { fields: ['type', 'name'], data : [ {type: 'CUSTOM', name: 'Custom Step'}, {type: 'FORM', name: 'Form Step'} ] }), queryMode: 'local', displayField: 'name', valueField: 'type', value: 'CUSTOM', listeners: { change: function(combo, value) { me.activityEntityFieldsGrid.setVisible(value == 'FORM'); } }, listConfig: { cls: 'x-wizards-boundlist' } }); this.activityNameField = Ext.create('OPF.core.component.form.Text', { labelAlign: 'top', fieldLabel: 'Name', name: 'name', anchor: '100%', emptyText: 'name of step', allowBlank: false, validator: function(val) { var errorMessage = null; if (OPF.isNotEmpty(val)) { var updatedNode = this.ownerCt.getRecord(); var rootNode = me.actionActivityTree.getRootNode(); Ext.each(rootNode.childNodes, function(activityNode) { if (activityNode.get('name') == val && !(updatedNode && updatedNode.id == activityNode.id)) { errorMessage = 'Activity name is not unique.'; return false; } return true; }); } return errorMessage; } }); this.activityDescriptionField = Ext.create('OPF.core.component.form.TextArea', { labelAlign: 'top', fieldLabel: 'Description', name: 'description', anchor: '100%', emptyText: 'step description' }); this.activityActorField = Ext.create('OPF.prometheus.wizard.workflow.ManageActorsComponent', this.parentDomainCombo, { labelAlign: 'top', fieldLabel: 'Actor', anchor: '100%', name: 'actor' }); this.activityEntityFieldsStore = Ext.create('Ext.data.Store', { model: 'OPF.prometheus.wizard.workflow.model.ActivityFieldModel', proxy: { type: 'memory', reader: { type: 'json' }, writer: { type: 'json' } } }); this.activityEntityFieldsGrid = Ext.create('Ext.grid.Panel', { title: 'Activity Entity Fields:', anchor: '100%', store: this.activityEntityFieldsStore, cls: 'grid-panel', height: 330, hidden: true, columns: [ { xtype: 'gridcolumn', dataIndex: 'name', text: 'Name', sortable: false, renderer: 'htmlEncode', width: 200, menuDisabled: true }, { xtype: 'gridcolumn', dataIndex: 'description', text: 'Description', sortable: false, renderer: 'htmlEncode', flex: 1, menuDisabled: true }, { xtype: 'checkcolumn', dataIndex: 'track', text: 'Track', textAlign: 'center', sortable: false, width: 65, menuDisabled: true } ] }); this.activityForm = Ext.create('Ext.form.Panel', { title: 'Add Step', ui: 'blue', layout: 'anchor', border: false, bodyPadding: 15, autoScroll: true, items: [ this.activityFormCombo, this.activityNameField, this.activityDescriptionField, this.activityActorField, this.activityEntityFieldsGrid ], dockedItems: [ { xtype: 'toolbar', dock: 'bottom', ui: 'footer', items: [ '->', { xtype: 'button', ui: 'blue', width: 150, height: 60, text: 'Save', formBind: true, handler: function() { me.saveActivity(); } }, { xtype: 'button', ui: 'grey', width: 150, height: 60, text: 'Cancel', handler: function() { me.showEmptyCard(); } } ] } ] }); this.actionNameField = Ext.create('OPF.core.component.form.Text', { labelAlign: 'top', fieldLabel: 'Name', name: 'name', anchor: '100%', emptyText: 'name of action', allowBlank: false, validator: function(val) { var errorMessage = null; var updatedNode = this.ownerCt.getRecord(); var parentActivity = updatedNode.parentNode; if (OPF.isNotEmpty(val) && OPF.isNotEmpty(parentActivity)) { Ext.each(parentActivity.childNodes, function(actionNode) { if ((!updatedNode && actionNode.get('name') == val) || (updatedNode && actionNode.get('name') == val && actionNode.id != updatedNode.id)) { errorMessage = 'Action name is not unique.'; return false; } return true; }); } return errorMessage; } }); this.actionDescriptionField = Ext.create('OPF.core.component.form.TextArea', { labelAlign: 'top', fieldLabel: 'Description', name: 'description', anchor: '100%', emptyText: 'action description' }); this.actionActivityPanel = Ext.create('OPF.prometheus.wizard.workflow.ManageActivityComponent', { name: 'toActivity', labelAlign: 'top', fieldLabel: 'Next Step' }); this.actionStatusField = Ext.create('OPF.prometheus.wizard.workflow.ManageStatusesComponent', { labelAlign: 'top', fieldLabel: 'Status', anchor: '100%', name: 'status' }); this.actionForm = Ext.create('Ext.form.Panel', { border: false, layout: 'anchor', bodyPadding: 15, ui: 'blue', title: 'Add Action', items: [ // { // xtype: 'container', // html: '<h2>Add Action</h2>' // }, this.actionNameField, this.actionDescriptionField, this.actionActivityPanel, this.actionStatusField ], dockedItems: [ { xtype: 'toolbar', dock: 'bottom', ui: 'footer', items: [ '->', { xtype: 'button', ui: 'blue', width: 150, height: 60, text: 'Save', formBind: true, handler: function() { me.saveAction(); } }, { xtype: 'button', ui: 'grey', width: 150, height: 60, text: 'Cancel', handler: function () { me.showEmptyCard(); } } ] } ] }); this.activityActionStore = Ext.create('Ext.data.TreeStore', { model: 'OPF.prometheus.wizard.workflow.model.ActivityActionModel', root: { text: 'root', rendered: false, expanded: true, children: [ { name: 'Start', text: 'Start', description: 'The very first step.', activityForm: 'CUSTOM', activityOrder: 'START', editable: false, expanded: true, allowDrag: true, children: [ { name: 'Move to Next Step', text: 'Start Workflow', description: 'Do initial workflow step', isActivity: false, activityOrder: null, children: [], allowDrag: false, isNew: false }, { name: 'Finish Process', text: 'Finish Process', description: 'Final workflow step', isActivity: false, activityOrder: null, children: [], allowDrag: false, isNew: false } ], isActivity: true, isNew: false }, { name: 'Custom Step', text: 'Custom Step', description: 'Custom step...', activityForm: 'CUSTOM', activityOrder: 'MIDDLE', editable: false, expanded: true, allowDrag: true, children: [ { name: 'Custom Action', text: 'Custom Action', description: 'Custom workflow step', isActivity: false, activityOrder: null, children: [], allowDrag: false, isNew: false } ], isActivity: true, isNew: false }, { name: 'End', text: 'End', description: 'Final step.', activityForm: 'CUSTOM', activityOrder: 'END', editable: false, expanded: true, allowDrag: true, children: [], isActivity: true, isNew: false } ] }, folderSort: true }); this.activityActionRowToolbar = Ext.create('OPF.core.component.grid.RowToolbarGridPlugin', { buttons: [ { name: 'addAction', iconCls: 'add-btn', tooltip: 'Add Action' }, { name: 'edit' }, { name: 'delete' } ], showBtnWidth: 25, showBtnHeight: 30, addActionFn: function(btn, e, options) { var record = options[1]; me.showActionForm(null, record); }, editFn: function(btn, e, options) { var record = options[1]; var isActivity = record.get('isActivity'); if (isActivity) { me.showActivityForm(record); } else { me.showActionForm(record, null); } }, deleteFn: function(btn, e, options) { var record = options[1]; var isActivity = record.get('isActivity'); if (isActivity) { me.deleteActivity(record); } else { me.deleteAction(record); } }, showFn: function(btn, e) { var rowSize = this.rowElement.getSize(); this.rowCmp.setWidth(rowSize.width); this.showRowToolbarButton.hide(); this.editRecordButton.show(); var activityOrder = this.currentRecord.get('activityOrder'); if (activityOrder != 'START' && activityOrder != 'END') { this.deleteRecordButton.show(); } var isActivity = this.currentRecord.get('isActivity'); if (isActivity && activityOrder != 'END') { this.addActionRecordButton.show(); } }, scope: this }); this.actionActivityTree = Ext.create('Ext.tree.Panel', { store: this.activityActionStore, displayField: 'name', rootVisible: false, width: 320, viewConfig: { plugins: [ { ptype: 'treeviewdragdrop', enableDrag: true, enableDrop: true, appendOnly: true, ddGroup: 'actionActivityGroup' }, this.activityActionRowToolbar ] }, dockedItems: [ { xtype: 'toolbar', ui: 'left-grid', dock: 'top', border: false, cls: 'blue-bg', items: [ { ui: 'add-entity', width: 60, height: 60, tooltip: 'Add Step', handler: function() { me.showActivityForm(); } } ] } ] }); var rootNode = this.actionActivityTree.getRootNode(); rootNode.childNodes[0].childNodes[0].set('toActivity', rootNode.childNodes[1]); rootNode.childNodes[0].childNodes[0].set('status', this.actionStatusField.getDefaultIntermediateStatus()); var finalStatus = this.actionStatusField.getFinalStatus(); rootNode.childNodes[0].childNodes[1].set('toActivity', rootNode.childNodes[2]); rootNode.childNodes[0].childNodes[1].set('status', finalStatus); rootNode.childNodes[1].childNodes[0].set('toActivity', rootNode.childNodes[2]); rootNode.childNodes[1].childNodes[0].set('status', finalStatus); this.activityMessagePanel = Ext.ComponentMgr.create({ xtype: 'notice-container', border: true }); this.activityPanelWrapper = Ext.create('Ext.container.Container', { layout: 'card', flex: 1, items: [ { xtype: 'panel', ui: 'blue', border: false, title: 'Information', bodyPadding: 10, items: [ this.activityMessagePanel, { xtype: 'container', html: '<p>Some instructions how to add/edit/delete actions and steps.</p>' } ], dockedItems: [ { xtype: 'toolbar', dock: 'bottom', ui: 'footer', items: [ '->', { xtype: 'button', ui: 'blue', width: 250, height: 60, text: 'Next', formBind: true, handler: function() { me.goToDeployPanel(); } } ] } ] }, this.activityForm, this.actionForm ] }); this.items = [ { title: '1. Name & Description', layout: 'fit', items: [ this.form ], nextFrameFn: function() { me.goToSelectFieldsPanel(); } }, { title: '2. Attach Data', layout: 'fit', items: { xtype: 'panel', border: false, padding: 10, layout: 'anchor', items: [ this.rootEntityCombo, this.processTypeField // { // xtype: 'container', // html: '<div class="x-form-item-label">Track Fields</div>', // padding: '0 10 0 10' // }, // this.entityFieldsGrid ], dockedItems: [ { xtype: 'toolbar', dock: 'bottom', ui: 'footer', items: [ '->', { xtype: 'button', ui: 'blue', width: 250, height: 60, text: 'Next', formBind: true, handler: function() { me.goToActionsPanel(); } } ] } ] }, prevFrameFn: function() { me.goToNameAndDescriptionPanel(); }, nextFrameFn: function() { me.goToActionsPanel(); } }, { title: '3. Define Steps', layout: { type: 'hbox', align: 'stretch' }, items: [ { xtype: 'panel', border: false, layout: 'fit', items: this.actionActivityTree }, this.activityPanelWrapper ], prevFrameFn: function() { me.goToSelectFieldsPanel(); }, nextFrameFn: function() { me.goToDeployPanel(); } }, { title: '4. Deploy Changes', yesFn: function() { me.createWorkflow(true); }, noFn: function() { me.createWorkflow(false); }, prevFrameFn: function() { me.goToActionsPanel(); } } ]; this.messagePanel = Ext.ComponentMgr.create({ xtype: 'notice-container', border: true, form: this.form }); this.form.insert(0, this.messagePanel); this.lastNotUniqueName = null; this.checkUniqueEntityNameTask = new Ext.util.DelayedTask(function(){ var name = me.workflowNameField.getValue(); var parentDomain = me.parentDomainCombo.findRecordByValue(me.parentDomainCombo.getValue()); if (OPF.isNotBlank(name) && parentDomain != null) { var path = parentDomain.get('lookup'); var url = OPF.Cfg.restUrl('/registry/check/' + path + '/PROCESS', false); url = OPF.Cfg.addParameterToURL(url, 'name', name); Ext.Ajax.request({ url: url, method: 'GET', success: function (response) { if (me.workflowNameField) { var resp = Ext.decode(response.responseText); if (resp.success) { var activeErrors = me.workflowNameField.activeErrors; if (activeErrors && activeErrors.length == 0) { me.workflowNameField.clearInvalid(); } } else { me.workflowNameField.markInvalid(resp.message); me.lastNotUniqueName = name; } } }, failure: function () { Ext.Msg.alert('Error', 'Connection error!'); } }); } }); this.callParent(arguments); }, goToNameAndDescriptionPanel: function() { var layout = this.getCardPanelLayout(); layout.setActiveItem(0); }, goToSelectFieldsPanel: function() { if (this.isNameAndDescriptionPanelValid()) { var layout = this.getCardPanelLayout(); layout.setActiveItem(1); } else if (OPF.isEmpty(this.parentDomainCombo.getValue())){ this.messagePanel.showError(OPF.core.validation.MessageLevel.ERROR, 'Parent has not been selected.'); } else { this.messagePanel.showError(OPF.core.validation.MessageLevel.ERROR, 'Workflow Name is not specified.'); } }, goToActionsPanel: function() { if (this.isAttachDataPanelValid()) { var layout = this.getCardPanelLayout(); layout.setActiveItem(2); } }, goToDeployPanel: function() { if (this.isDefineStepsPanelValid()) { var layout = this.getCardPanelLayout(); layout.setActiveItem(3); } }, isNameAndDescriptionPanelValid: function() { var parentId = this.parentDomainCombo.getValue(); var workflowName = this.workflowNameField.getValue(); return OPF.isNotEmpty(parentId) && OPF.isNotBlank(workflowName) && this.lastNotUniqueName != workflowName; }, isAttachDataPanelValid: function() { return this.rootEntityCombo.validate() && this.isNameAndDescriptionPanelValid(); }, isDefineStepsPanelValid: function() { return this.isActionActivitiesPanelValid() && this.isAttachDataPanelValid(); }, validateForm: function(executeFn, scope) { var parentId = this.parentDomainCombo.getValue(); if (OPF.isNotEmpty(parentId) && Ext.isNumeric(parentId) && this.isActionActivitiesPanelValid()) { if (this.form.getForm().isValid()) { executeFn(scope); } } else { this.messagePanel.showError(OPF.core.validation.MessageLevel.ERROR, 'Parent has not been selected.'); } }, isActionActivitiesPanelValid: function() { var rootNode = this.actionActivityTree.getRootNode(); var startActivityInPlace = false; var finalActivityInPlace = false; var endStatusInPlace = false; var me = this; var activityErrorMessage = []; var activities = rootNode.childNodes; Ext.each(activities, function(activity) { var activityName = activity.get('name'); var actor = activity.get('actor'); if (OPF.isBlank(activityName) || OPF.isEmpty(actor) || actor == "") { activityErrorMessage.push({ level: OPF.core.validation.MessageLevel.ERROR, msg: 'For activity \'' + activityName + '\' has not defined an actor' }); } if (activity.get('activityOrder') == 'START') { startActivityInPlace |= true; } if (activity.get('activityOrder') == 'END') { finalActivityInPlace |= true; } var actions = activity.childNodes; Ext.each(actions, function(action) { var actionName = action.get('name'); var toActivityNode = action.get('toActivity'); if (OPF.isBlank(actionName) ) { activityErrorMessage.push({ level: OPF.core.validation.MessageLevel.ERROR, msg: 'The action has empty name for the activity \'' + activityName + '\'' }); } else if (!toActivityNode) { activityErrorMessage.push({ level: OPF.core.validation.MessageLevel.ERROR, msg: 'For action \'' + actionName + '\' has not defined \'To activity\' for activity \'' + activityName + '\'' }); } else { var status = action.get('status'); if (OPF.isEmpty(status)) { activityErrorMessage.push({ level: OPF.core.validation.MessageLevel.ERROR, msg: 'For action \'' + actionName + '\' has not defined status for the activity \'' + activityName + '\'' }); } else if (me.actionStatusField.isFinalStatus(status)) { if (toActivityNode.get('activityOrder') == 'END') { endStatusInPlace = true; } } } }); }); if (!startActivityInPlace) { activityErrorMessage.push({ level: OPF.core.validation.MessageLevel.ERROR, msg: 'Has not defined START activity for workflow' }); } if (!finalActivityInPlace) { activityErrorMessage.push({ level: OPF.core.validation.MessageLevel.ERROR, msg: 'Has not defined END activity for workflow' }); } if (!endStatusInPlace) { activityErrorMessage.push({ level: OPF.core.validation.MessageLevel.ERROR, msg: 'Has not find action which moved to END activity' }); } var isValid = activityErrorMessage.length == 0; if (isValid) { this.activityMessagePanel.cleanActiveErrors(); } else { this.activityMessagePanel.setNoticeContainer(activityErrorMessage); } return isValid && startActivityInPlace && finalActivityInPlace && endStatusInPlace; }, showActivityForm: function(record) { var fields; this.activityEntityFieldsStore.removeAll(); if (record) { this.activityForm.setTitle('Edit Step'); this.activityForm.loadRecord(record); if (OPF.isEmpty(this.activityActorField.getValue())) { this.activityActorField.validate(); } var actor = record.get('actor'); this.activityActorField.setValue(actor); fields = record.activityFields().getRange(); if (fields.length == 0) { OPF.StoreHelper.copyRecords(this.entityFieldsStore, this.activityEntityFieldsStore); } else { this.activityEntityFieldsStore.loadRecords(fields); } } else { this.activityForm.setTitle('Add Step'); this.activityForm.getForm().reset(true); OPF.StoreHelper.copyRecords(this.entityFieldsStore, this.activityEntityFieldsStore); } this.activityPanelWrapper.getLayout().setActiveItem(1); }, showActionForm: function(record, activityNode) { if (record) { this.actionForm.setTitle('Edit Action'); this.actionForm.loadRecord(record); } else { this.actionForm.setTitle('Add Action'); record = OPF.ModelHelper.createModelFromData('OPF.prometheus.wizard.workflow.model.ActivityActionModel', { editable: false, expanded: false, allowDrag: false, children: [], isActivity: false, isNew: true }); record.parentNode = activityNode; this.actionForm.getForm().reset(true); this.actionForm.loadRecord(record); } this.activityPanelWrapper.getLayout().setActiveItem(2); }, deleteActivity: function(record) { var rootNode = this.activityActionStore.getRootNode(); var activities = rootNode.childNodes; Ext.each(activities, function(activity) { var actions = activity.childNodes; Ext.each(actions, function(action) { var toActivityNode = action.get('toActivity'); if (toActivityNode == record) { action.set('toActivity', null); } }); }); record.remove(); this.showEmptyCard(); }, deleteAction: function(record) { record.remove(); this.showEmptyCard(); }, showEmptyCard: function() { this.actionActivityTree.selModel.deselectAll(true); this.activityPanelWrapper.getLayout().setActiveItem(0); this.activityMessagePanel.cleanActiveErrors(); }, saveActivity: function () { var me = this; var form = this.activityForm.getForm(); if (form.isValid()) { var record = form.getRecord(); var values = form.getValues(); if (record) { record.set(values); record.set('actor', this.activityActorField.getValue()); record.activityFields().removeAll(); var activityForm = record.get('activityForm'); if (activityForm == 'FORM') { record.activityFields().add(this.activityEntityFieldsStore.getRange()); } record.commit(); } else { var recordData = Ext.apply(values, { editable: false, expanded: true, allowDrag: true, children: [], isActivity: true, activityOrder: 'MIDDLE' }); record = OPF.ModelHelper.createModelFromData('OPF.prometheus.wizard.workflow.model.ActivityActionModel', recordData); record.set('actor', this.activityActorField.getValue()); record.activityFields().add(this.activityEntityFieldsStore.getRange()); var rootNode = me.actionActivityTree.getRootNode(); rootNode.appendChild(record); } me.showEmptyCard(); } }, saveAction: function () { var me = this; var form = this.actionForm.getForm(); if (form.isValid()) { var record = form.getRecord(); var values = form.getValues(); var isNew = record.get('isNew'); record.set(values); record.set('status', this.actionStatusField.getValue()); record.set('toActivity', this.actionActivityPanel.getValue()); record.set('isNew', false); record.commit(); if (isNew) { record.parentNode.appendChild(record); } me.showEmptyCard(); } }, deleteActivityAction: function(btn, e, options) { var grid = options[0]; var record = options[1]; var rootNode = me.actionActivityTree.getRootNode(); }, createWorkflow: function(isDeploy) { var me = this; var workflowName = this.workflowNameField.getValue(); var rootEntityId = this.rootEntityCombo.getValue(); var parentDomainId = this.parentDomainCombo.getValue(); var parentDomain = this.parentDomainCombo.findRecord('id', parentDomainId); var processType = this.processTypeField.getValue().processType; var entity = { id: rootEntityId }; var processFields = []; // var fieldModels = this.entityFieldsStore.getRange(); // if (fieldModels != null && fieldModels.length > 0) { // Ext.each(fieldModels, function(fieldModel) { // if (fieldModel.get('track')) { // var field = { // id: fieldModel.get('id') // }; // var processField = { // name: fieldModel.get('name'), // field: field, // registryNodeType: entity // }; // processFields.push(processField); // } // }); // } var process = { name: workflowName, path: parentDomain.get('lookup'), parentId: parentDomainId, processFields: processFields, processType: processType, entity: entity }; var rootNode = this.actionActivityTree.getRootNode(); process.activities = []; Ext.each(rootNode.childNodes, function(activityNode, index) { var activity = { name: activityNode.get('name'), description: activityNode.get('description'), activityOrder: activityNode.get('activityOrder'), activityForm: activityNode.get('activityForm') }; activity.fields = []; var entityFields = activityNode.activityFields().getRange(); Ext.each(entityFields, function(entityField) { var isTracked = entityField.get('track'); if (isTracked) { var fieldType = entityField.get('fieldType'); var activityField; if (fieldType == 'ENTITY') { activityField = { relationship: { id: entityField.get('relationshipId') } }; } else { activityField = { field: { id: entityField.get('fieldId') } }; } activity.fields.push(activityField); } }); activity.activityActions = []; Ext.each(activityNode.childNodes, function(actionNode) { var activityFrom = { name: activityNode.get('name') }; var toActivityNode = actionNode.get('toActivity'); var activityTo = { name: toActivityNode.get('name') }; var statusModel = actionNode.get('status'); var status = { name: statusModel.get('name'), description: statusModel.get('description') }; var action = { name: actionNode.get('name'), description: actionNode.get('description'), status: status, activityFrom: activityFrom, activityTo: activityTo }; activity.activityActions.push(action); }); var actorModel = activityNode.get('actor'); var actorId = actorModel.get('id'); if (OPF.isEmpty(actorId)) { activity.actor = { name: actorModel.get('name'), description: actorModel.get('description'), userActors: actorModel.get('userActors') }; } else { activity.actor = { id: actorId }; } process.activities.push(activity); }); this.getEl().mask(); Ext.Ajax.request({ url: OPF.Cfg.restUrl('/process/workflow'), method: 'POST', jsonData: {"data": process}, success: function (response, action) { var responseData = Ext.decode(response.responseText); OPF.Msg.setAlert(true, responseData.message); if (responseData.success) { document.location.reload(true); } else { Ext.Msg.alert('Error', responseData.message); } me.getEl().unmask(); me.close(); }, failure: function (response) { me.getEl().unmask(); OPF.Msg.setAlert(false, response.message); } }); }, loadEntityFields: function() { var me = this; var entityId = this.rootEntityCombo.getValue(); Ext.Ajax.request({ url: OPF.Cfg.restUrl('/registry/entity-fields/' + entityId), method: 'GET', success: function (response, action) { var json = Ext.decode(response.responseText); if (json.success && OPF.isNotEmpty(json.data) && Ext.isArray(json.data) && json.data.length > 0) { var entity = json.data[0]; var fields = OPF.isEmpty(entity.children) ? [] : entity.children; Ext.each(fields, function(field) { var fieldId = null; var fieldType = null; var relationshipId = null; if (field.type == 'FIELD') { fieldId = field.realId; fieldType = field.parameters.fieldType; } else { fieldType = field.type; var relationshipIds = field.parameters.relationshipIds; if (relationshipIds && relationshipIds.length > 0) { relationshipId = relationshipIds[0]; } } var activityFieldModel = OPF.ModelHelper.createModelFromData('OPF.prometheus.wizard.workflow.model.ActivityFieldModel', { name: field.name, description: field.description, displayName: OPF.ifBlank(field.parameters.displayName, field.name), fieldType: fieldType, fieldId: fieldId, relationshipId: relationshipId, track: false }); me.entityFieldsStore.add(activityFieldModel); }); } else { Ext.Msg.alert('Error', json.message); } }, failure: function(response) { Ext.Msg.alert('Error', response.message); } }); } });
{ "content_hash": "6448545c344324b6f6884d97f30c47af", "timestamp": "", "source": "github", "line_count": 1346, "max_line_length": 145, "avg_line_length": 36.914561664190195, "alnum_prop": 0.42248475456356793, "repo_name": "firejack-open/Firejack-Platform", "id": "41920033aff0fc79803fb1fc8b01224ee688d92e", "size": "50494", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "platform/src/main/webapp/js/net/firejack/platform/prometheus/wizard/workflow/ProcessWizard.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ActionScript", "bytes": "4068" }, { "name": "CSS", "bytes": "5861839" }, { "name": "Java", "bytes": "8816378" }, { "name": "JavaScript", "bytes": "37310201" }, { "name": "Python", "bytes": "7764" }, { "name": "Ruby", "bytes": "11804" }, { "name": "Shell", "bytes": "38753" } ], "symlink_target": "" }
/** * Worker process and utils for working with the worker remotely. * * Main entry point for the worker is {@link alluxio.worker.AlluxioWorker#main(String[])} * which gets started by the alluxio start scripts. The {@link alluxio.worker.AlluxioWorkerService} * spins up the different RPC services (thrift, data) which are mostly wrappers around * {@link alluxio.worker.block.BlockWorker}. * * <h1>Services</h1> * * <h2>Thrift</h2> * * The thrift service is mostly responsible for metadata operations (with a few operations that * effect the worker's cached memory). * * <h3>Cache Block</h3> * * Move's user generated blocks to the alluxio data directory. This operation expects that the * caller is a local (to the node) caller, and that the input are under the user directories. * * Implementation can be found at {@link alluxio.worker.block.BlockWorker#commitBlock(long, long)} * * <h3>Lock / Unlock</h3> * * Alluxio supports caching blocks to local disk (client side). When this happens, a lock is given * to the client to protect it from the remote block changing. * * Implementation can be found at {@link alluxio.worker.block.BlockWorker#lockBlock(long, long)} and * {@link alluxio.worker.block.BlockWorker#unlockBlock(long, long)}. * * <h2>Data</h2> * * This service is the main interaction between users and reading blocks. Currently this service * only supports reading blocks (writing is to local disk). * * There are two different implementations of this layer: * {@link alluxio.worker.netty.NettyDataServer} and {@link alluxio.worker.nio.NIODataServer}; netty * is the default. To support both, a {@link alluxio.worker.DataServer} interface is used that just * defines how to start/stop, and get port details; to start, object init is used. * * The current read protocol is defined in {@link alluxio.worker.DataServerMessage}. This has two * different types: read {@link alluxio.worker.DataServerMessage#createBlockRequestMessage} and * write {@link alluxio.worker.DataServerMessage#createBlockResponseMessage}. Side note, the netty * implementation does not use this class, but has defined two classes for the read and write case: * {@link alluxio.network.protocol.RPCBlockReadRequest}, * {@link alluxio.network.protocol.RPCBlockReadResponse}; theses classes are network compatible. */ package alluxio.worker;
{ "content_hash": "f4be764d38fbfc3057a63a8fd9b3152e", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 100, "avg_line_length": 47.42, "alnum_prop": 0.7545339519190215, "repo_name": "bit-zyl/Alluxio-Nvdimm", "id": "358496acf336af90b8d9bb911a59f1706b60abd5", "size": "2883", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "core/server/src/main/java/alluxio/worker/package-info.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "1166" }, { "name": "Java", "bytes": "4952054" }, { "name": "JavaScript", "bytes": "1091" }, { "name": "Protocol Buffer", "bytes": "6314" }, { "name": "Python", "bytes": "11471" }, { "name": "Roff", "bytes": "5796" }, { "name": "Ruby", "bytes": "22857" }, { "name": "Shell", "bytes": "104086" }, { "name": "Thrift", "bytes": "24618" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>quarkus-extensions-parent</artifactId> <groupId>io.quarkus</groupId> <version>999-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>quarkus-transaction-annotations-parent</artifactId> <name>Quarkus - Transaction Annotations</name> <packaging>pom</packaging> <modules> <module>runtime</module> </modules> </project>
{ "content_hash": "65cb85cc9f87051b9cbdec7f81ef4467", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 109, "avg_line_length": 38.8421052631579, "alnum_prop": 0.6612466124661247, "repo_name": "quarkusio/quarkus", "id": "3c7e56d7ac0667911eeeb318582a445c72e50149", "size": "738", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "extensions/transaction-annotations/pom.xml", "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": "" }
(function() { 'use strict'; angular.module('presence', []) .directive('presence', function($presence, types) { function getTypeNames(param) { if (!param) { return types.getAllTypeNames(); } else { return param.split(' '); } } return { restrict: 'A', link: function(scope, element, attrs) { angular.forEach(getTypeNames(attrs.presence), function(typeName) { var type = types.get(typeName); element.on(type.events, function(event) { event = event.originalEvent || event; // use originalEvent if available if (event.type === 'mousemove' && event.movementX === 0 && event.movementY === 0) { return; // Fix for Chrome desktop notifications, triggering mousemove event. } $presence.registerAction(type.name); }); }); } }; }) .factory('types', function() { return { MOUSE: { name: 'MOUSE', events: 'click mousedown mouseup mousemove' }, KEYBOARD: { name: 'KEYBOARD', events: 'keypress keydown keyup' }, TOUCH: { name: 'TOUCH', events: 'touchstart touchmove touchend touchenter touchleave touchcancel'}, getAllTypeNames: function() { return ['MOUSE', 'KEYBOARD', 'TOUCH']; }, get: function(type) { type = type.toUpperCase(); if (this[type]) { return this[type]; } throw new Error("Unknown type for monitoring presence: " + type); } }; }) .factory('$presence', function ($timeout, $log, orderByFilter, types) { var entryState = {}, states, initialStateId = 0, currentStateId, timer, callbacksStateLeave = {}, callbacksStateEnter = {}, callbacksStateChange = []; function init(statesInput, startDelayed) { function objectify() { angular.forEach(statesInput, function(state, key) { if (!angular.isObject(state)) { statesInput[key] = state = { enter: state }; } state.name = key; state.enter = state.enter || 0; }); return statesInput; } function sortStates() { var statesArray = []; angular.forEach(statesInput, function(state) { statesArray.push(state); }); return orderByFilter(statesArray, "enter"); } function extendStates() { angular.forEach(states, function(state, id) { state.id = id; state.onEnter = function(fn) { onStateEnter(id, fn); }; state.onLeave = function(fn) { onStateLeave(id, fn); }; state.activate = function() { changeState(id); }; }); } function extendStatesInput() { statesInput.onChange = function(fn) { onStateChange(fn); }; statesInput.getCurrent = function() { return getCurrentState(); }; } function initInternalStructures() { angular.forEach(states, function(state, id) { function setEntryState(type) { if (state.accept.toUpperCase().indexOf(type) === -1) { entryState[type] = id+1; } } if (state.initial === true) { initialStateId = id; } if (state.accept) { angular.forEach(types.getAllTypeNames(), setEntryState); } }); } statesInput = objectify(); states = sortStates(); extendStates(); extendStatesInput(); initInternalStructures(); if (!startDelayed) { changeState(initialStateId); } return statesInput; } function changeState(newStateId) { var oldStateId = currentStateId; if (!states[newStateId]) { throw new Error("Unknown stateId: " + newStateId); } if (states[oldStateId]) { states[oldStateId].leftOn = new Date(); states[oldStateId].active = false; } states[newStateId].active = true; states[newStateId].enteredOn = new Date(); states[newStateId].enteredFrom = states[oldStateId] ? states[oldStateId].name : undefined; currentStateId = newStateId; $timeout(function() { notify(callbacksStateLeave[oldStateId]); notify(callbacksStateEnter[newStateId]); notify(callbacksStateChange); }); restartTimer(); } function changeStateToNext() { changeState(currentStateId + 1); } function notify(callbacks) { if (callbacks) { for (var i = 0; i < callbacks.length; i++) { callbacks[i](states[currentStateId]); } } } function restartTimer() { $timeout.cancel(timer); if (states[currentStateId+1]) { timer = $timeout(changeStateToNext, states[currentStateId+1].enter - states[currentStateId].enter); } } function registerAction(type) { if (!states) { return; } var targetStateId = entryState[type] || 0; if (targetStateId < currentStateId) { changeState(targetStateId); } else if (targetStateId === currentStateId) { restartTimer(); } } function onStateChange(fn) { callbacksStateChange.push(fn); } function onStateEnter(state, fn) { (callbacksStateEnter[state] || (callbacksStateEnter[state] = [])).push(fn); } function onStateLeave(state, fn) { (callbacksStateLeave[state] || (callbacksStateLeave[state] = [])).push(fn); } function getCurrentState() { return states[currentStateId]; } function isActive() { return timer !== undefined; } function start(initialState) { if (isActive()) { $log.info("$presence timer already started"); return; } if (initialState && initialState.id) { changeState(initialState.id); } else { changeState(initialStateId); } } return { init: init, registerAction: registerAction, start: start, isActive: isActive, changeState: changeState }; }); }());
{ "content_hash": "f8cd1fdd095bf6abac2c2e5aae86b60e", "timestamp": "", "source": "github", "line_count": 233, "max_line_length": 107, "avg_line_length": 26.721030042918454, "alnum_prop": 0.5570189527786701, "repo_name": "katebe/angular-presence", "id": "47daf8734b7d315e92e33adbda18708a3dfb06b4", "size": "6226", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/angular-presence.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "658" } ], "symlink_target": "" }
require 'set' module Music module Composition class Key include Music::Composition::OrderedPitchClasses attr_reader :tonic_pc, :pitch_classes # @param [Fixnum] tonic_pc The pitch class of the primary tone of the key. # @param [Enumerable] related_pcs Pitch classes of the chord that goes along with the tonic. def initialize tonic_pc, related_pcs = [] @tonic_pc = tonic_pc @pitch_classes = ([tonic_pc] + related_pcs).to_pc_ary.uniq end def to_normal_form NormalForm.new(@pitch_classes) end def to_prime_form PrimeForm.new(@pitch_classes) end def major? to_normal_form == NormalForm.new([tonic_pc, tonic_pc + 4, tonic_pc + 7]) end def minor? to_normal_form == NormalForm.new([tonic_pc, tonic_pc + 3, tonic_pc + 7]) end def to_s tonic_str = PitchClass.to_s(tonic_pc) if major? key_type_str = "maj" elsif minor? key_type_str = "min" else key_type_str = "?" end return "#{tonic_str} #{key_type_str}" end end end end
{ "content_hash": "599f12fc6967fc2f150d93067f4653ab", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 94, "avg_line_length": 20.836734693877553, "alnum_prop": 0.6493633692458374, "repo_name": "jamestunnell/music-composition", "id": "f165bd872d39039397331eaba19a87d964f6c05e", "size": "1021", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/music-composition/key.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "41064" } ], "symlink_target": "" }
'use strict'; import _ from 'lodash'; import { Comment, Element, SubElement } from './elementtree'; import { copy_xml, xsl } from './utils'; import Generator from './index'; import { FoProperty, StyleName } from './styles'; export function generate_custom(root: Element, conf: Generator) { const link_raw = ` <xsl:template match="*[contains(@class,' topic/xref ')]" name="topic.xref"> <fo:inline> <xsl:call-template name="commonattributes"/> </fo:inline> <xsl:variable name="destination" select="opentopic-func:getDestinationId(@href)"/> <xsl:variable name="element" select="key('key_anchor',$destination)[1]"/> <xsl:variable name="referenceTitle"> <xsl:apply-templates select="." mode="insertReferenceTitle"> <xsl:with-param name="href" select="@href"/> <xsl:with-param name="titlePrefix" select="''"/> <xsl:with-param name="destination" select="$destination"/> <xsl:with-param name="element" select="$element"/> </xsl:apply-templates> </xsl:variable> <fo:basic-link xsl:use-attribute-sets="xref"> <xsl:call-template name="buildBasicLinkDestination"> <xsl:with-param name="scope" select="@scope"/> <xsl:with-param name="format" select="@format"/> <xsl:with-param name="href" select="@href"/> </xsl:call-template> <xsl:choose> <xsl:when test="not(@scope = 'external' or @format = 'html') and not($referenceTitle = '')"> <xsl:copy-of select="$referenceTitle"/> </xsl:when> <xsl:when test="not(@scope = 'external' or @format = 'html')"> <xsl:call-template name="insertPageNumberCitation"> <xsl:with-param name="isTitleEmpty" select=\"true()\"/> <xsl:with-param name="destination" select="$destination"/> <xsl:with-param name="element" select="$element"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="exists(*[not(contains(@class,' topic/desc '))] | text()) and exists(processing-instruction('ditaot')[. = 'usertext'])"> <xsl:apply-templates select="*[not(contains(@class,' topic/desc '))] | text()"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="e:format-link-url(@href)"/> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </fo:basic-link> <xsl:if test="not(@scope = 'external' or @format = 'html') and not($referenceTitle = '') and not($element[contains(@class, ' topic/fn ')])"> <xsl:if test="not(processing-instruction('ditaot')[. = 'usertext'])"> <xsl:call-template name="insertPageNumberCitation"> <xsl:with-param name="destination" select="$destination"/> <xsl:with-param name="element" select="$element"/> </xsl:call-template> </xsl:if> </xsl:if> <xsl:if test="@scope = 'external' and exists(processing-instruction('ditaot')[. = 'usertext'])"> <xsl:text> at </xsl:text> <xsl:value-of select="e:format-link-url(@href)"/> </xsl:if> </xsl:template> <xsl:function name="e:format-link-url"> <xsl:param name="href"/> <xsl:variable name="h" select="if (starts-with($href, 'http://')) then substring($href, 8) else $href"/> <xsl:value-of select="if (contains($h, '/') and substring-after($h, '/') = '') then substring($h, 0, string-length($h)) else $h"/> </xsl:function> `; if ( _.has(conf.style.link, 'link-url') && conf.style.link['link-url'] === true ) { root.append(Comment('link')); copy_xml(root, link_raw); } } export function generate_custom_attr(root: Element, conf: Generator) { // related link description const linkShortdescAttrs = conf.attribute_set( root, StyleName.BODY, 'link__shortdesc', [FoProperty.SPACE_AFTER] ); SubElement(linkShortdescAttrs, xsl('attribute'), { name: 'start-indent', }).text = 'from-parent(start-indent) + 15pt'; }
{ "content_hash": "1e981b90ad7f4f56f99f535ca2ac4641", "timestamp": "", "source": "github", "line_count": 96, "max_line_length": 144, "avg_line_length": 41.927083333333336, "alnum_prop": 0.6027329192546584, "repo_name": "jelovirt/pdf-generator", "id": "bf07b8939854322b65e0ef41b7152b3b9eb3bf8c", "size": "4025", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/generator/links.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "2125" }, { "name": "Java", "bytes": "20640" }, { "name": "JavaScript", "bytes": "14086" }, { "name": "SCSS", "bytes": "11781" }, { "name": "Shell", "bytes": "693" }, { "name": "TypeScript", "bytes": "280494" }, { "name": "XSLT", "bytes": "185426" } ], "symlink_target": "" }
#include "pch.h" #include "trekmdl.h" #include "trekctrls.h" const int c_iClusterHasNoRipcord = 0; const int c_iClusterHasStationRipcord = 1; const int c_iClusterHasShipRipcord = 2; const Color c_rgColorNeutral(0.5f, 0.5f, 0.5f); static void GetClusterOwners(IclusterIGC* pcluster, SideID& sideOwner, SideID& sideSecondaryOwner) { assert (c_cSidesMax == 6); int nStations[c_cSidesMax] = {0, 0, 0, 0, 0, 0}; // count the stations by side for (StationLinkIGC* psl = pcluster->GetStations()->first(); (psl != NULL); psl = psl->next()) { if (!psl->data()->GetStationType()->HasCapability(c_sabmPedestal)) nStations[psl->data()->GetSide()->GetObjectID()]++; } // the owner is the one with the most stations int nStationsOwner = 0; int nStationsSecondaryOwner = 0; sideOwner = NA; sideSecondaryOwner = NA; SideID sideID; for (sideID = 0; sideID < c_cSidesMax; sideID++) { if (nStations[sideID] > nStationsOwner) { // demote the current top owner sideSecondaryOwner = sideOwner; nStationsSecondaryOwner = nStationsOwner; // track the new top owner sideOwner = sideID; nStationsOwner = nStations[sideID]; } else if (nStations[sideID] > nStationsSecondaryOwner) { sideSecondaryOwner = sideID; nStationsSecondaryOwner = nStations[sideID]; } } } static int GetClusterPopulation(IclusterIGC* pcluster, IsideIGC* pside) { int n = 0; SectorID sectorID = pcluster->GetObjectID(); for (ShipLinkIGC* psl = pside->GetShips()->first(); (psl != NULL); psl = psl->next()) { IshipIGC* pship = psl->data(); if (pship->GetSide() == pside) { PlayerInfo* ppi = (PlayerInfo*)(pship->GetPrivateData()); if (trekClient.m_fm.IsConnected()) { if (ppi && (ppi->LastSeenSector() == sectorID) && (ppi->StatusIsCurrent())) { if (ppi->LastSeenState() != c_ssObserver && ppi->LastSeenState() != c_ssTurret) { IhullTypeIGC* pht = trekClient.GetCore()->GetHullType(ppi->LastSeenShipType()); if (pht != NULL && !(pht->GetCapabilities() & c_habmLifepod)) n++; } } } else { if (pship->GetCluster() == pcluster) n++; } } } return n; } ////////////////////////////////////////////////////////////////////////////// // // SectorInfoPane // ////////////////////////////////////////////////////////////////////////////// struct StoredIcon { Surface* psurfaceIcon; IsideIGC* pside; int count; int sortOrder; StoredIcon(void) : count(1) { } }; typedef Slist_utl<StoredIcon> IconList; typedef Slink_utl<StoredIcon> IconLink; static void AddIcon(IObject* psurfaceIcon, IsideIGC* pside, int sortOrder, int sideID, IconList* picons) { for (IconLink* pil = picons->first(); (pil != NULL); pil = pil->next()) { if ((pil->data().psurfaceIcon == (Surface*)psurfaceIcon) && (pil->data().pside == pside)) //ALLYTD? VISIBILITY change this if we want allied assets shown in the sector info pane { pil->data().count++; return; } } IconLink* p = new IconLink; p->data().psurfaceIcon = (Surface*)psurfaceIcon; p->data().pside = pside; //Hash in the side ID p->data().sortOrder = sortOrder += ((int)sideID) * 0x10000; { //Walk the list till we find the proper spot for (IconLink* pil = picons->first(); (pil != NULL); pil = pil->next()) { if (sortOrder < pil->data().sortOrder) { pil->txen(p); return; } } } picons->last(p); } class SectorInfoPane : public Image { private: TRef<Image> m_pimageBkgnd; TRef<Image> m_pimageSmallBkgnd; TRef<Image> m_pimageLargeBkgnd; TRef<Image> m_pimageExpand; TRef<IclusterIGC> m_pClusterSel; TRef<IclusterIGC> m_pClusterMouseOver; TRef<Surface> m_pprobeIcon; public: SectorInfoPane() { m_pimageSmallBkgnd = GetModeler()->LoadImage("consectorinfobmp", true); m_pimageLargeBkgnd = GetModeler()->LoadImage("conesectorinfobmp", true); m_pimageExpand = GetModeler()->LoadImage("consectorexpandbmp", true); m_pimageBkgnd = m_pimageSmallBkgnd; m_pprobeIcon = (Surface *)trekClient.LoadRadarIcon("probe"); } void CalcBounds() { m_bounds = m_pimageBkgnd->GetBounds(); } void ClearCluster(void) { m_pClusterSel = NULL; m_pClusterMouseOver = NULL; } void SelectCluster(IclusterIGC* pClusterSel) { m_pClusterSel = pClusterSel; Changed(); } void SelectMouseOverCluster(IclusterIGC* pClusterMouseOver) { m_pClusterMouseOver = pClusterMouseOver; Changed(); } MouseResult HitTest(IInputProvider* pprovider, const Point& point, bool bCaptured) { Surface* psurfaceBackground = m_pimageBkgnd->GetSurface(); Surface* psurfaceExpand = m_pimageExpand->GetSurface(); WinPoint pntButton = psurfaceBackground->GetSize() - psurfaceExpand->GetSize(); pntButton = pntButton - WinPoint(16, 4); if (point.X() > pntButton.X() && point.Y() > pntButton.Y() && point.X() < psurfaceBackground->GetSize().X() && point.Y() < psurfaceBackground->GetSize().Y()) { return MouseResultHit(); } return m_pimageBkgnd->HitTest(pprovider, point, bCaptured); } WinPoint GetButtonOffset() { Surface* psurfaceBackground = m_pimageBkgnd->GetSurface(); Surface* psurfaceExpand = m_pimageExpand->GetSurface(); WinPoint pntButton = psurfaceBackground->GetSize() - psurfaceExpand->GetSize(); return pntButton - WinPoint(16, 4); } MouseResult Button(IInputProvider* pprovider, const Point& point, int button, bool bCaptured, bool bInside, bool bDown) { if (button == 0 && !bDown) { WinPoint pntButton = GetButtonOffset(); if (point.X() > pntButton.X() && point.Y() > pntButton.Y()) { if (m_pimageBkgnd == m_pimageSmallBkgnd) { m_pimageBkgnd = m_pimageLargeBkgnd; } else { m_pimageBkgnd = m_pimageSmallBkgnd; } Changed(); } } return MouseResult(); } /* void DrawStationIconsOfClass(Context* pcontext, IclusterIGC* pcluster, Point& ptNext, StationClassID classID) { const StationListIGC* stationList = pcluster->GetStations(); for (StationLinkIGC* stationLink = (stationList ? stationList->first() : NULL); stationLink; stationLink=stationLink->next()) { IstationIGC* pstation = stationLink->data(); // if this station is in the correct class of station if (pstation->GetBaseStationType()->GetClassID() == classID) { // draw this station icon Surface* psurfaceIcon = (Surface*)(pstation->GetIcon()); if (ptNext.X() < GetButtonOffset().X()) { pcontext->DrawImage3D(psurfaceIcon, pstation->GetSide()->GetColor(), false, ptNext); ptNext += Point(psurfaceIcon->GetSize().X(), 0); } } } } void DrawStationIcons(Context* pcontext, IclusterIGC* pcluster, const Point& ptStations) { Point ptNext = ptStations; // draw the station icons in order of importance DrawStationIconsOfClass(pcontext, pcluster, ptNext, c_scStarbase); DrawStationIconsOfClass(pcontext, pcluster, ptNext, c_scGarrison); DrawStationIconsOfClass(pcontext, pcluster, ptNext, c_scShipyard); DrawStationIconsOfClass(pcontext, pcluster, ptNext, c_scRipcord); DrawStationIconsOfClass(pcontext, pcluster, ptNext, c_scResearch); DrawStationIconsOfClass(pcontext, pcluster, ptNext, c_scOrdinance); DrawStationIconsOfClass(pcontext, pcluster, ptNext, c_scElectronics); DrawStationIconsOfClass(pcontext, pcluster, ptNext, c_scMining); } */ void DrawAsteroidIcons(Context* pcontext, IEngineFont* pfont, IclusterIGC* pcluster, const Point& ptAsteroids) { Point ptNext = ptAsteroids; // Count the asteroids TMap<AsteroidAbilityBitMask, int> mapSpecialAsteroids; TMap<AsteroidAbilityBitMask, Surface*> mapSpecialAsteroidIcons; for (AsteroidLinkIGC* asteroidLink = pcluster->GetAsteroids()->first(); asteroidLink != NULL; asteroidLink = asteroidLink->next()) { AsteroidAbilityBitMask aabm = asteroidLink->data()->GetCapabilities(); // if this asteroid has any special capabilities besides being buildable if ((aabm & ~c_aabmBuildable) != 0) { // let it stand up and be counted. int nCount = 0; mapSpecialAsteroids.Find(aabm, nCount); mapSpecialAsteroids.Set(aabm, nCount+1); mapSpecialAsteroidIcons.Set(aabm, (Surface*)asteroidLink->data()->GetIcon()); } } // draw the asteroids TMap<AsteroidAbilityBitMask, int>::Iterator iterCount(mapSpecialAsteroids); TMap<AsteroidAbilityBitMask, Surface*>::Iterator iterIcon(mapSpecialAsteroidIcons); while (!iterCount.End()) { pcontext->DrawImage3D(iterIcon.Value(), Color::White(), false, ptNext); pcontext->DrawString( pfont, Color::White(), ptNext + Point(iterIcon.Value()->GetSize().X() + 4, 0), ZString(iterCount.Value()) ); ptNext = ptNext - Point(0, iterIcon.Value()->GetSize().Y()); iterCount.Next(); iterIcon.Next(); } //Xynth #129 7/2010 Number of probes in sector int probeCount = 0; for (ProbeLinkIGC* ppl = pcluster->GetProbes()->first(); (ppl != NULL); ppl = ppl->next()) { IprobeIGC* pprobe = ppl->data(); if (pprobe->GetSide() == trekClient.GetShip()->GetSide() && (pprobe->GetProbeType()->GetCapabilities() == 0 || pprobe->GetProbeType()->GetCapabilities() >= c_eabmRescue)) //Imago 8/10 probeCount++; } //Imago 8/10 pcontext->DrawImage3D(m_pprobeIcon, trekClient.GetSide()->GetColor(), false, ptNext); pcontext->DrawString( pfont, Color::White(), ptNext + Point(m_pprobeIcon->GetSize().X() + 4, 0), ZString(probeCount) ); } float GetHeliumInCluster(IclusterIGC* pcluster) { float fOre = 0; IsideIGC* psideMine = trekClient.GetShip()->GetSide(); for (AsteroidLinkIGC* asteriodLink = pcluster->GetAsteroids()->first(); asteriodLink != NULL; asteriodLink = asteriodLink->next()) { AsteroidAbilityBitMask aabm = asteriodLink->data()->GetCapabilities(); // if we can mine helium at this asteroid if ((aabm & c_aabmMineHe3) != 0) { // count it. //Xynth #100 7/2010 //fOre += asteriodLink->data()->GetOre(); fOre += asteriodLink->data()->GetOreSeenBySide(psideMine); } } return fOre; } //Xynth #104 7/2010 Returns true if at least one He3 is eyed bool HeliumAsteroidVisibileInCluster(IclusterIGC* pcluster) { bool HeSpotted = false; IsideIGC* psideMine = trekClient.GetShip()->GetSide(); for (AsteroidLinkIGC* asteriodLink = pcluster->GetAsteroids()->first(); asteriodLink != NULL; asteriodLink = asteriodLink->next()) { AsteroidAbilityBitMask aabm = asteriodLink->data()->GetCapabilities(); // if we can mine helium at this asteroid if ((aabm & c_aabmMineHe3) != 0) { if (asteriodLink->data()->GetAsteroidCurrentEye(psideMine)) HeSpotted = true; } } return HeSpotted; } //End #104 function void Render(Context* pcontext) { pcontext->SetBlendMode(BlendModeSourceAlpha); //Imago 7/15/09 // draw the background Surface* psurfaceBackground = m_pimageBkgnd->GetSurface(); pcontext->DrawImage(psurfaceBackground); // set font TRef<IEngineFont> pfont = TrekResources::SmallFont(); // draw the resize button Surface* psurfaceExpand = m_pimageExpand->GetSurface(); pcontext->DrawImage(psurfaceExpand, false, Point::Cast(psurfaceBackground->GetSize() - psurfaceExpand->GetSize() - WinPoint(16, 4))); if (m_pClusterSel) { const int xBorder = 4; float yTop = m_pimageBkgnd->GetBounds().GetRect().YSize(); Point ptSectorName(xBorder + 20, yTop - 13); Point ptStations(xBorder, yTop - 26); // draw sectorname pcontext->DrawString( pfont, Color::White(), ptSectorName, ZString(m_pClusterSel->GetName()) + " Sector" ); // draw station icons c_cSidesMax { IconList icons; IsideIGC* psideMe = trekClient.GetSide(); { for (StationLinkIGC* psl = m_pClusterSel->GetStations()->first(); (psl != NULL); psl = psl->next()) { if (!psl->data()->GetStationType()->HasCapability(c_sabmPedestal)) { IsideIGC* pside = psl->data()->GetSide(); AddIcon(psl->data()->GetIcon(), pside, NA, (pside == psideMe) ? (c_cSidesMax * 2) : (c_cSidesMax + pside->GetObjectID()), &icons); //ALLYTD? VISIBILITY Y change this if we want allied assets shown in the sector info pane } } } { SectorID sid = m_pClusterSel->GetObjectID(); for (ShipLinkIGC* psl = trekClient.m_pCoreIGC->GetShips()->first(); (psl != NULL); psl = psl->next()) { PlayerInfo* ppi = (PlayerInfo*)(psl->data()->GetPrivateData()); if (ppi && ppi->StatusIsCurrent() && (ppi->LastSeenState() == c_ssFlying) && (ppi->LastSeenSector() == sid)) { HullID hid = ppi->LastSeenShipType(); IhullTypeIGC* pht = trekClient.m_pCoreIGC->GetHullType(hid); if (pht) { IsideIGC* pside = psl->data()->GetSide(); AddIcon(pht->GetIcon(), pside, hid, (pside == psideMe) ? c_cSidesMax : pside->GetObjectID(), &icons); //ALLYTD? VISIBLITY } } } } { Point ptNext = ptStations; for (IconLink* pil = icons.first(); (pil != NULL); pil = pil->next()) { if (ptNext.X() < GetButtonOffset().X()) { const Color& color = pil->data().pside->GetColor(); pcontext->DrawImage3D(pil->data().psurfaceIcon, color, false, ptNext); ptNext += Point(pil->data().psurfaceIcon->GetSize().X(), 0); if (pil->data().count > 1) { TRef<IEngineFont> pfont = TrekResources::SmallFont(); ZString strCount = pil->data().count; WinPoint pt = pfont->GetTextExtent(strCount); pcontext->DrawString(pfont, Color::White(), ptNext + Point(0, (pil->data().psurfaceIcon->GetSize().Y() - pt.Y())/2), strCount); ptNext += Point(pt.X() + 2, 0); } } } } } //DrawStationIcons(pcontext, m_pClusterSel, ptStations); if (m_pimageBkgnd == m_pimageLargeBkgnd) { const int xSecondColumn = m_pimageSmallBkgnd->GetBounds().GetRect().XSize() + xBorder - 15; Point ptHelium(xSecondColumn, yTop - 45); Point ptAsteroids(xSecondColumn, yTop - 60); //Xynth #104 7/2010 //Function not reliable for this purpose Color color; //if (HeliumAsteroidVisibileInCluster(m_pClusterSel)) color = Color::White(); //else // color = Color::Gray(); // draw the helium count pcontext->DrawString( pfont, color, //Xynth #104 7/2010 Color::White(), ptHelium, "He3: " + ZString(int(GetHeliumInCluster(m_pClusterSel))) ); // draw asteroids DrawAsteroidIcons(pcontext, pfont, m_pClusterSel, ptAsteroids); } if (m_pClusterMouseOver) { assert(m_pClusterMouseOver == m_pClusterSel); // draw the cluster warning AssetMask am = m_pClusterMouseOver->GetClusterSite()->GetClusterAssetMask(); ClusterWarning cw = GetClusterWarning(am, trekClient.MyMission()->GetMissionParams().bInvulnerableStations); if (cw > c_cwNoThreat) { pcontext->DrawString( pfont, Color::White(), Point(0,0), GetClusterWarningText(cw) ); } } } } }; TRef<IObject> SectorInfoPaneFactory::Apply(ObjectStack& stack) { TRef<SectorInfoPane> psectorinfo = new SectorInfoPane(); return (Value*)psectorinfo; } ////////////////////////////////////////////////////////////////////////////// // // SectorMapPane // ////////////////////////////////////////////////////////////////////////////// class SectorMapPane : public Image, public IEventSink, public TrekClientEventSink { private: TRef<Image> m_pimageSectorEmpty; TRef<Image> m_pimageOwnerHighlight; TRef<Image> m_pimageSecondaryOwnerHighlight; TRef<Image> m_pimageBkgnd; TRef<Image> m_pimageSectorHighlight; TRef<Image> m_pimageSectorTargetHighlight; TRef<Image> m_pimageSectorSel; TRef<Image> m_pimageSectorPickable; TRef<Image> m_pimageSectorPickTarget; TRef<Image> m_pimageSectorPickableStation; TRef<Image> m_pimageSectorPickStationTarget; TRef<Image> m_pimageSectorQueued; TRef<Image> m_pimageCapitalWarning; TRef<Image> m_pimageSectorEnemy; TRef<Image> m_pimageSectorMiner; TRef<Image> m_pimageSectorWarning; TRef<Image> m_pimageBomberWarning; TRef<Image> m_pimageSectorCombat; TRef<IclusterIGC> m_pClusterSel; TRef<IEventSink> m_peventSinkTimer; TRef<SectorInfoPane> m_pSectorInfoPane; float m_xMin; float m_xMax; float m_yMin; float m_yMax; float m_xClusterMin; float m_xClusterMax; float m_yClusterMin; float m_yClusterMax; bool m_bVisible; int m_nMaskModeActive; float m_xDrag; float m_yDrag; bool m_bDragging; bool m_bHovering; bool m_bCanDrag; Point m_pointLastDrag; WinRect m_rectMap; bool m_bFlashFrame; public: enum { c_nXBorder = 4, c_nYBorder = 4 }; SectorMapPane(SectorInfoPane* pSectorInfoPane, Number* pvalueMode, int nMaskModeActive) : Image(pvalueMode), m_nMaskModeActive(nMaskModeActive), m_pSectorInfoPane(pSectorInfoPane), m_bVisible(false), m_xDrag(0), m_yDrag(0), m_bDragging(false), m_bHovering(false), m_bCanDrag(false), m_bFlashFrame(true) { pvalueMode->Update(); Modeler* pmodeler = GetModeler(); // BUILD_DX9 //m_pimageBkgnd = pmodeler->LoadImage("sectormapbkgndbmp", true); //imago 7/15/09 m_pimageBkgnd = pmodeler->LoadImage("sectormapbkgndbmp", false); // BUILD_DX9 m_pimageSectorHighlight = pmodeler->LoadImage("sectorhighlightbmp", true); m_pimageSectorTargetHighlight = pmodeler->LoadImage("sectortargetbmp", true); m_pimageSectorSel = pmodeler->LoadImage("sectorselbmp", true); m_peventSinkTimer = IEventSink::CreateDelegate(this); //GetWindow()->GetTimer()->AddSink(m_peventSinkTimer, 1.0f); m_rectMap = WinRect::Cast(m_pimageBkgnd->GetBounds().GetRect()); m_pimageSectorEmpty = pmodeler->LoadImage("sectoremptybmp", true); m_pimageOwnerHighlight = pmodeler->LoadImage("sectorownerbmp", true); m_pimageSecondaryOwnerHighlight = pmodeler->LoadImage("sectorinvaderbmp", true); m_pimageSectorPickable = pmodeler->LoadImage("sectorripcordbmp", true); m_pimageSectorPickTarget = pmodeler->LoadImage("sectorripcordtargetbmp", true); m_pimageSectorPickableStation = pmodeler->LoadImage("sectorripcordstationbmp", true); m_pimageSectorPickStationTarget = pmodeler->LoadImage("sectorripcordstationtargetbmp", true); m_pimageSectorQueued = pmodeler->LoadImage("sectorqueuedbmp", true); m_pimageCapitalWarning = pmodeler->LoadImage("sectorcapitalbmp", true); m_pimageSectorCombat = pmodeler->LoadImage("sectorcombatbmp", true); m_pimageSectorWarning = pmodeler->LoadImage("sectorwarningbmp", true); m_pimageBomberWarning = pmodeler->LoadImage("sectorbomberbmp", true); m_pimageSectorMiner = pmodeler->LoadImage("sectorminerbmp", true); m_pimageSectorEnemy = pmodeler->LoadImage("sectorenemybmp", true); } ~SectorMapPane() { SetVisible(false); } void CalcBounds() { m_bounds = m_pimageBkgnd->GetBounds(); } MouseResult HitTest(IInputProvider* pprovider, const Point& point, bool bCaptured) { return m_pimageBkgnd->HitTest(pprovider, point, bCaptured); } // <NKM> // Don't belive this is called? - comment out and just declare it - see if // we get unresolved symbol. // void OnSessionLost(char * szReason, Time lastUpdate, Time now); // { // SetVisible(false); // //Clear the selected cluster without sending the advise // m_pClusterSel = NULL; // m_pSectorInfoPane->ClearCluster(); // } void OnDelPlayer(MissionInfo* pMissionInfo, SideID sideID, PlayerInfo* pPlayerInfo, QuitSideReason reason, const char* szMessageParam) { if (pPlayerInfo == trekClient.GetPlayerInfo()) { SetVisible(false); //Clear the selected cluster without sending the advise m_pClusterSel = NULL; m_pSectorInfoPane->ClearCluster(); } } void SelectCluster(IclusterIGC* pClusterSel) { if (pClusterSel == NULL) { IstationIGC* pstation = trekClient.GetShip()->GetStation(); if (pstation) pClusterSel = pstation->GetCluster(); } if (pClusterSel != m_pClusterSel) { m_pClusterSel = pClusterSel; ZAssert(m_pSectorInfoPane); m_pSectorInfoPane->SelectCluster(pClusterSel); Changed(); } } void SetVisible(bool bVisible) { if (m_bVisible != bVisible) { m_bVisible = bVisible; if (bVisible) { GetWindow()->GetTimer()->AddSink(m_peventSinkTimer, 0.2f); SelectCluster(trekClient.GetChatCluster()); m_pSectorInfoPane->SelectMouseOverCluster(NULL); } else { m_pClusterSel = NULL; ZAssert(m_pSectorInfoPane); m_pSectorInfoPane->SelectCluster(NULL); m_pSectorInfoPane->SelectMouseOverCluster(NULL); GetWindow()->GetTimer()->RemoveSink(m_peventSinkTimer); } } } bool OnEvent(IEventSource* pevent) { Changed(); const int cDivisor = 2; static int nTick = 0; ++nTick; if (nTick == cDivisor) { m_bFlashFrame = !m_bFlashFrame; nTick = 0; } return true; } void CalculateScreenMinAndMax() { // map the sector data bool bFirstCluster = true; const ClusterListIGC* clusters = trekClient.m_pCoreIGC->GetClusters(); for (ClusterLinkIGC* cLink = clusters->first(); cLink != NULL; cLink = cLink->next()) { IclusterIGC* pCluster = cLink->data(); if (pCluster->GetModels()->n() != 0) { float x = pCluster->GetScreenX(); float y = pCluster->GetScreenY(); if (bFirstCluster) { bFirstCluster = false; m_xClusterMin = m_xClusterMax = x; m_yClusterMin = m_yClusterMax = y; } else { if (x < m_xClusterMin) m_xClusterMin = x; else if (x > m_xClusterMax) m_xClusterMax = x; if (y < m_yClusterMin) m_yClusterMin = y; else if (y > m_yClusterMax) m_yClusterMax = y; } } } const float c_bfr = 0.1f * max(0.0001, max(m_xClusterMax - m_xClusterMin, m_yClusterMax - m_yClusterMin)); m_xClusterMin -= c_bfr; m_xClusterMax += c_bfr; m_yClusterMin -= c_bfr; m_yClusterMax += c_bfr; // figure out the minimum and maximum screen coordinates m_xMin = m_xClusterMin; m_xMax = m_xClusterMax; m_yMin = m_yClusterMin; m_yMax = m_yClusterMax; float fDesiredAspectRatio = float(m_rectMap.XSize() - 2*c_nXBorder)/(m_rectMap.YSize() - 2*c_nYBorder); // scale it so that a map with height 2 will fit exactly const float fMapmakerHeight = 2.2f; // 10% fudge factor const float fMaxHeight = fMapmakerHeight; const float fMaxWidth = fMaxHeight * fDesiredAspectRatio; // if the map is bigger than we want to display, clip the view to the max size if (m_xMax - m_xMin > fMaxWidth || m_yMax - m_yMin > fMaxHeight) { m_bCanDrag = true; m_xMax = m_xMin + min(m_xMax - m_xMin, fMaxWidth); m_yMax = m_yMin + min(m_yMax - m_yMin, fMaxHeight); } else { m_bCanDrag = false; } //Preserve the aspect ratio float fAspectRatio = (m_xMax - m_xMin) / (m_yMax - m_yMin); if (fAspectRatio < fDesiredAspectRatio) { // grow the X size to correct the aspect ratio float fXGrowth = (fDesiredAspectRatio / fAspectRatio - 1) * (m_xMax - m_xMin); m_xMax += fXGrowth / 2; m_xMin -= fXGrowth / 2; } else if (fAspectRatio > fDesiredAspectRatio) { // grow the Y size to correct the aspect ratio float fYGrowth = (fAspectRatio / fDesiredAspectRatio - 1) * (m_yMax - m_yMin); m_yMax += fYGrowth / 2; m_yMin -= fYGrowth / 2; } // translate by the current drag offset m_xMin += m_xDrag; m_xMax += m_xDrag; m_yMin += m_yDrag; m_yMax += m_yDrag; } int ClusterHasFriendlyRipcord(IclusterIGC* pcluster, IsideIGC* pside, const ClusterListIGC& clustersRipcord) { const StationListIGC* stationList = pcluster->GetStations(); for (StationLinkIGC* stationLink = stationList->first(); stationLink; stationLink=stationLink->next()) { IstationIGC* pstation = stationLink->data(); if (pstation->GetStationType()->HasCapability(c_sabmRipcord) && ( (pstation->GetSide() == pside) || (pstation->GetSide()->AlliedSides(pside,pstation->GetSide()) && trekClient.MyMission()->GetMissionParams().bAllowAlliedRip) ) ) //ALLY allow rip to allies 7/7/09 imago { return c_iClusterHasStationRipcord; } } float ripcordSpeed; { IshipIGC* pss = trekClient.GetShip()->GetSourceShip(); if (pss->GetBaseHullType()) ripcordSpeed = pss->GetHullType()->GetRipcordSpeed(); else ripcordSpeed = -1.0f; } for (ProbeLinkIGC* ppl = pcluster->GetProbes()->first(); (ppl != NULL); ppl = ppl->next()) { IprobeIGC* pprobe = ppl->data(); if ( ( (pprobe->GetSide() == pside) || (pprobe->GetSide()->AlliedSides(pside,pprobe->GetSide()) && trekClient.MyMission()->GetMissionParams().bAllowAlliedRip) ) && pprobe->GetCanRipcord(ripcordSpeed)) //ALLY allow rip to ally TP via. sector map imago 7/9/09 return c_iClusterHasStationRipcord; } return clustersRipcord.find(pcluster) != NULL ? c_iClusterHasShipRipcord : c_iClusterHasNoRipcord; } IstationIGC* FindFriendlyStation(IclusterIGC* pcluster, IsideIGC* pside) { const StationListIGC* stationList = pcluster->GetStations(); for (StationLinkIGC* stationLink = stationList->first(); stationLink; stationLink=stationLink->next()) { IstationIGC* pstation = stationLink->data(); if (pstation->GetStationType()->HasCapability(c_sabmRestart) && (pstation->GetSide() == pside)) //|| (pstation->GetSide()->AlliedSides(pside,pstation->GetSide()) && trekClient.MyMission()->GetMissionParams().bAllowAlliedRip)) ) //ALLY rip 7/9/09 imago { return pstation; } } return NULL; } bool HasBuildableAsteroid(IclusterIGC* pcluster, AsteroidAbilityBitMask aabm1, AsteroidAbilityBitMask aabm2) { AsteroidAbilityBitMask aabm = (aabm1 != 0) ? aabm1 : aabm2; if ((aabm & ~c_aabmBuildable) != 0) { aabm &= ~c_aabmBuildable; for (AsteroidLinkIGC* pal = pcluster->GetAsteroids()->first(); (pal != NULL); pal = pal->next()) { if (pal->data()->HasCapability(aabm)) return true; } } else if (aabm == c_aabmBuildable) { for (AsteroidLinkIGC* pal = pcluster->GetAsteroids()->first(); (pal != NULL); pal = pal->next()) { if (pal->data()->HasCapability(aabm)) return true; } } return false; } bool HasCommandTarget(IclusterIGC* pCluster, Command cmd) { ImodelIGC* ptarget = trekClient.GetShip()->GetCommandTarget(cmd); if (ptarget) { if (ptarget->GetCluster() == pCluster) return true; else if (ptarget->GetObjectType() == OT_ship) { IshipIGC* pship = (IshipIGC*)ptarget; PlayerInfo* ppi = (PlayerInfo*)(pship->GetPrivateData()); if (ppi->LastSeenSector() == pCluster->GetObjectID()) return true; } } return false; } void Render(Context* pcontext) { pcontext->SetShadeMode(ShadeModeFlat); pcontext->SetBlendMode(BlendModeSourceAlpha); //imago 7/15/09 Rect rectClip = m_bounds.GetRect(); rectClip.Expand(-1); pcontext->Clip(rectClip); CalculateScreenMinAndMax(); // draw the background pcontext->DrawImage(m_pimageBkgnd->GetSurface()); // draw all the connecting lines for warps { const WarpListIGC* warps = trekClient.m_pCoreIGC->GetWarps(); TVector<VertexL> vertices(warps->n(), 0); TVector<WORD> indices(warps->n(), 0); for (WarpLinkIGC* warpLink = warps->first(); warpLink != NULL; warpLink = warpLink->next()) { IwarpIGC* pWarp = warpLink->data(); IwarpIGC* pwarpDestination = pWarp->GetDestination(); if (trekClient.MyMission()->GetMissionParams().bAllowAlliedViz && pwarpDestination == NULL) { //ally VISIBILITY 7/11/09 imago continue; } else { assert (pwarpDestination != NULL); } if (pWarp->GetObjectID() > pwarpDestination->GetObjectID()) { Color colorWarp = 0.5f * Color::White(); WinPoint point1 = GetClusterPoint(pWarp->GetCluster()); WinPoint point2 = GetClusterPoint(pwarpDestination->GetCluster()); indices.PushEnd(vertices.GetCount()); vertices.PushEnd(VertexL(Vector(point1.x, point1.y, 0), colorWarp)); indices.PushEnd(vertices.GetCount()); vertices.PushEnd(VertexL(Vector(point2.x, point2.y, 0), colorWarp)); } } if (vertices.GetCount() != 0) { pcontext->SetLineWidth(1.0f); pcontext->DrawLines(vertices, indices); } } ImodelIGC* pmodelRipcord = trekClient.GetShip()->GetRipcordModel(); IclusterIGC* pclusterRipcord; IsideIGC* pside = trekClient.GetSide(); ClusterListIGC clustersRipcord; if (pmodelRipcord) { { IshipIGC* pshipSource = trekClient.GetShip()->GetSourceShip(); IhullTypeIGC* phtSource = pshipSource->GetBaseHullType(); HullAbilityBitMask habm = (phtSource && phtSource->HasCapability(c_habmCanLtRipcord)) ? (c_habmIsRipcordTarget | c_habmIsLtRipcordTarget) : c_habmIsRipcordTarget; if (trekClient.MyMission()->GetMissionParams().bAllowAlliedRip) { for (ShipLinkIGC* psl = trekClient.m_pCoreIGC->GetShips()->first(); (psl != NULL); psl = psl->next()) //ALLY RIPCORD 7/10/09 { IshipIGC* pship = psl->data(); if (pship != pshipSource && pship->GetSide()->AlliedSides(pside,pship->GetSide())) { IclusterIGC* pc = trekClient.GetRipcordCluster(pship, habm); if (pc) clustersRipcord.last(pc); } } } else { for (ShipLinkIGC* psl = pside->GetShips()->first(); (psl != NULL); psl = psl->next()) //not ally ripcord { IshipIGC* pship = psl->data(); if (pship != pshipSource) { IclusterIGC* pc = trekClient.GetRipcordCluster(pship, habm); if (pc) clustersRipcord.last(pc); } } } } pclusterRipcord = pmodelRipcord->GetCluster(); if ((pclusterRipcord == NULL) && (pmodelRipcord->GetObjectType() == OT_ship)) { PlayerInfo* ppi = (PlayerInfo*)(((IshipIGC*)pmodelRipcord)->GetPrivateData()); if (ppi->StatusIsCurrent()) pclusterRipcord = trekClient.m_pCoreIGC->GetCluster(ppi->LastSeenSector()); } } // draw the data for each sector const ClusterListIGC* clusters = trekClient.m_pCoreIGC->GetClusters(); for (ClusterLinkIGC* cLink = clusters->first(); cLink != NULL; cLink = cLink->next()) { IclusterIGC* pCluster = cLink->data(); if (pCluster->GetModels()->n() != 0) { Point xy = Point::Cast(GetClusterPoint(pCluster)); // draw the sector outline Xynth #208 Draw in flashing Cyan if highlighted if (pCluster->GetHighlight() && !m_bFlashFrame) pcontext->DrawImage3D(m_pimageSectorEmpty->GetSurface(), Color::Cyan(), true, xy); else pcontext->DrawImage3D(m_pimageSectorEmpty->GetSurface(), Color::White(), true, xy); // color it by the owner(s), if any SideID sideOwner; SideID sideSecondaryOwner; GetClusterOwners(pCluster, sideOwner, sideSecondaryOwner); // draw the conflict state AssetMask am = pCluster->GetClusterSite()->GetClusterAssetMask(); ClusterWarning warn = GetClusterWarning(am, trekClient.MyMission()->GetMissionParams().bInvulnerableStations); if (warn >= c_cwStationThreatened) { if (m_bFlashFrame) pcontext->DrawImage3D(m_pimageSectorWarning->GetSurface(), Color::White(), true, xy); } else if (warn >= c_cwCapitalInCluster) { if (m_bFlashFrame) pcontext->DrawImage3D(m_pimageCapitalWarning->GetSurface(), Color::White(), true, xy); } else if (warn >= c_cwBomberInCluster) { if (m_bFlashFrame) pcontext->DrawImage3D(m_pimageBomberWarning->GetSurface(), Color::White(), true, xy); } else if (warn >= c_cwMinerThreatened) { if (m_bFlashFrame) pcontext->DrawImage3D(m_pimageSectorMiner->GetSurface(), Color::White(), true, xy); } else if (warn >= c_cwCombatInCluster) { if (m_bFlashFrame) pcontext->DrawImage3D(m_pimageSectorCombat->GetSurface(), Color::White(), true, xy); } /* else if (warn >= c_cwEnemyMinerInCluster) { pcontext->DrawImage3D(m_pimageSectorMiner->GetSurface(), Color::White(), true, xy); } else if (warn > c_cwNoThreat) { pcontext->DrawImage3D(m_pimageSectorEnemy->GetSurface(), Color::White(), true, xy); } */ // highlight it if it is ours if (trekClient.GetChatCluster() == pCluster) pcontext->DrawImage3D(m_pimageSectorHighlight->GetSurface(), Color::White(), true, xy); else if (m_pClusterSel == pCluster) pcontext->DrawImage3D(m_pimageSectorSel->GetSurface(), Color::White(), true, xy); // highlight it if it contains our current or queued command target bool bHasCurrentCommand = HasCommandTarget(pCluster, c_cmdAccepted); bool bHasQueuedCommand = HasCommandTarget(pCluster, c_cmdQueued); if (bHasCurrentCommand) pcontext->DrawImage3D(m_pimageSectorTargetHighlight->GetSurface(), Color::White(), true, xy); else if (bHasQueuedCommand) pcontext->DrawImage3D(m_pimageSectorQueued->GetSurface(), Color::White(), true, xy); // overlay the ripcord info if we are ripcording if (pmodelRipcord) { if (pmodelRipcord->GetObjectType() == OT_ship) { if (pCluster == pclusterRipcord) { if (m_bFlashFrame) pcontext->DrawImage3D(m_pimageSectorPickTarget->GetSurface(), Color::White(), true, xy); else pcontext->DrawImage3D(m_pimageSectorPickable->GetSurface(), Color::White(), true, xy); } else { int cfr = ClusterHasFriendlyRipcord(pCluster, pside, clustersRipcord); if (cfr != c_iClusterHasNoRipcord) { pcontext->DrawImage3D(cfr == c_iClusterHasStationRipcord ? m_pimageSectorPickableStation->GetSurface() : m_pimageSectorPickable->GetSurface(), Color::White(), true, xy); } } } else { if (pCluster == pclusterRipcord) { if (m_bFlashFrame) pcontext->DrawImage3D(m_pimageSectorPickStationTarget->GetSurface(), Color::White(), true, xy); else pcontext->DrawImage3D(m_pimageSectorPickableStation->GetSurface(), Color::White(), true, xy); } else { int cfr = ClusterHasFriendlyRipcord(pCluster, pside, clustersRipcord); if (cfr != c_iClusterHasNoRipcord) { pcontext->DrawImage3D(cfr == c_iClusterHasStationRipcord ? m_pimageSectorPickableStation->GetSurface() : m_pimageSectorPickable->GetSurface(), Color::White(), true, xy); } } } } else if (GetWindow()->GetOverlayFlags() & ofTeleportPane) { IstationIGC* pstation = trekClient.GetShip()->GetStation(); if (pstation && (pstation->GetCluster() != pCluster) && (FindFriendlyStation(pCluster, pside) != NULL)) { pcontext->DrawImage3D(m_pimageSectorPickable->GetSurface(), Color::White(), true, xy); } } else if (HasBuildableAsteroid(pCluster, GetWindow()->GetCommandAsteroid(), GetWindow()->GetInvestAsteroid())) { pcontext->DrawImage3D(m_pimageSectorPickable->GetSurface(), Color::White(), true, xy); } if (sideOwner != NA) { pcontext->DrawImage3D( m_pimageOwnerHighlight->GetSurface(), trekClient.GetCore()->GetSide(sideOwner)->GetColor(), true, xy ); } if (sideSecondaryOwner != NA) { pcontext->DrawImage3D( m_pimageSecondaryOwnerHighlight->GetSurface(), trekClient.GetCore()->GetSide(sideSecondaryOwner)->GetColor(), true, xy ); } if (pCluster->GetHighlight() && !m_bFlashFrame) //Xynth #208 8/2010 { //Color center of circle cyan for highlight effect pcontext->DrawImage3D( m_pimageSecondaryOwnerHighlight->GetSurface(), Color::Cyan(), true, xy ); } // draw the dots for the ships { int vnSidePopCount[c_cSidesMax]; int nSidesPresent = 0; // count the population and sides in the sector { for (SideLinkIGC* psl = trekClient.m_pCoreIGC->GetSides()->first(); (psl != NULL); psl = psl->next()) { SideID sideID = psl->data()->GetObjectID(); vnSidePopCount[sideID] = GetClusterPopulation(pCluster, psl->data()); if (vnSidePopCount[sideID] != 0) ++nSidesPresent; } } // draw the rows of dots if (nSidesPresent > 0) { const int nDotHeight = 2; const int nDotWidth = 2; const int nShipWidth = 1; const int nDotPitch = 1; const int nRowPitch = 1; const int nMaxPop = 7; int nY = xy.Y() - (nSidesPresent * (nDotHeight + nDotPitch) - nRowPitch)/2; for (SideLinkIGC* psl = trekClient.m_pCoreIGC->GetSides()->first(); (psl != NULL); psl = psl->next()) { int nPopulation = min(nMaxPop, vnSidePopCount[psl->data()->GetObjectID()]); int nX = xy.X() + 6; if (nPopulation > 0) { while (nPopulation > 0) { int nDotPopulation = min(nPopulation, nDotWidth/nShipWidth); pcontext->FillRect( WinRect( nX, nY, nX + nDotPopulation * nShipWidth, nY + nDotHeight ), psl->data()->GetColor() ); nX += nDotWidth + nDotPitch; nPopulation -= nDotPopulation; } nY += nDotHeight + nRowPitch; } } } } /* // draw the bars for the ships { int nX = xy.X() + 6; int nMaxPlayers = 32; const int nMaxBarHeight = 8; const int nBarWidth = (trekClient.m_pCoreIGC->GetSides()->n() > 2) ? 1 : 2; for (SideLinkIGC* psl = trekClient.m_pCoreIGC->GetSides()->first(); (psl != NULL); psl = psl->next()) { IsideIGC* pside = psl->data(); SideID sideID = pside->GetObjectID(); int nPopulation = GetClusterPopulation(pCluster, pside); if (nPopulation > 0) { // draw bars for ships int nBarHeight = min(min(nPopulation, nMaxBarHeight), max(1, (int)((nMaxBarHeight - 1) * log((float)nPopulation)/log((float)nMaxPlayers))+ 1)); pcontext->FillRect( WinRect( nX, xy.Y() - nMaxBarHeight/2, nX + nBarWidth, xy.Y() - nMaxBarHeight/2 + nBarHeight ), pside->GetColor() ); nX += nBarWidth + 1; } } } */ } } } private: WinPoint GetClusterPoint(IclusterIGC* pcluster) { WinPoint pt = WinPoint( (int)(m_rectMap.XMin() + ((pcluster->GetScreenX() - m_xMin)/(m_xMax - m_xMin))*(m_rectMap.XSize() - 2*c_nXBorder) + c_nXBorder), (int)(m_rectMap.YMin() + ((pcluster->GetScreenY() - m_yMin)/(m_yMax - m_yMin))*(m_rectMap.YSize() - 2*c_nYBorder) + c_nYBorder) ); return pt; } IclusterIGC* GetClusterAtPoint(const Point& point) { const ClusterListIGC* clusters = trekClient.m_pCoreIGC->GetClusters(); IclusterIGC* pClusterFound = NULL; int nMinDistance = 15; for (ClusterLinkIGC* cLink = clusters->first(); cLink != NULL; cLink = cLink->next()) { IclusterIGC* pCluster = cLink->data(); // if we know about this cluster... if (pCluster->GetModels()->n() != 0) { WinPoint xy = GetClusterPoint(pCluster); Point pointSector((float)xy.X(), (float)xy.Y()); Point offset = point - pointSector; int nDistance = sqrt(offset.LengthSquared()); if (nDistance < nMinDistance) { pClusterFound = pCluster; nMinDistance = nDistance; } } } return pClusterFound; } void AttemptTeleportTo(IclusterIGC* pcluster) { // try teleporting to that station IstationIGC* pstation = FindFriendlyStation(pcluster, trekClient.GetSide()); if (NULL == trekClient.GetShip()->GetStation()) { // race condition? } else if (trekClient.GetShip()->GetStation()->GetCluster() == pcluster) { trekClient.PostText(false, "You are already in this cluster."); trekClient.PlaySoundEffect(errorSound); } else if (pstation == NULL) { trekClient.PostText(false, "You do not have an appropriate station in this cluster."); trekClient.PlaySoundEffect(errorSound); } else if (trekClient.GetShip()->GetParentShip() != NULL) { trekClient.DisembarkAndTeleport(pstation); GetWindow()->TurnOffOverlayFlags(ofTeleportPane); } else { trekClient.SetMessageType(BaseClient::c_mtGuaranteed); BEGIN_PFM_CREATE(trekClient.m_fm, pfmDocked, C, DOCKED) END_PFM_CREATE pfmDocked->stationID = pstation->GetObjectID(); trekClient.StartLockDown( "Teleporting to " + ZString(pstation->GetName()) + "....", BaseClient::lockdownTeleporting); GetWindow()->TurnOffOverlayFlags(ofTeleportPane); } } void ChildChanged(Value* pvalue, Value* pvalueNew) { ZAssert(NULL == pvalueNew); ZAssert(GetChild(0) == pvalue); pvalue->Update(); if (trekClient.GetShip()->GetCluster() || trekClient.GetShip()->GetStation()) SetVisible((((int)Number::Cast(pvalue)->GetValue()) & m_nMaskModeActive) != 0); } const char* GetClusterCursor() { if (trekClient.GetShip()->fRipcordActive() || (GetWindow()->GetOverlayFlags() & ofTeleportPane)) return AWF_CURSOR_DEFAULT; else if (GetWindow()->GetConsoleImage()->GetConsoleData()->IsComposingCommand() || trekClient.GetShip()->GetCluster() != NULL) return "goto"; else return AWF_CURSOR_DEFAULT; } void MouseMove(IInputProvider* pprovider, const Point& point, bool bCaptured, bool bInside) { if (bCaptured) { ZAssert(m_bDragging && m_bCanDrag); float fScale = (m_xMax - m_xMin)/m_rectMap.XSize(); float fDeltaX = fScale * (m_pointLastDrag.X() - point.X()); float fDeltaY = fScale * (m_pointLastDrag.Y() - point.Y()); // make sure we don't drag the map off of the screen m_xDrag = max(min((m_xClusterMax - m_xClusterMin) - (m_xMax - m_xMin), m_xDrag + fDeltaX), 0); m_yDrag = max(min((m_yClusterMax - m_yClusterMin) - (m_yMax - m_yMin), m_yDrag + fDeltaY), 0); m_pointLastDrag = point; GetWindow()->SetCursor(AWF_CURSOR_DRAG); Changed(); } else { IclusterIGC* pClusterFound = GetClusterAtPoint(point); m_pSectorInfoPane->SelectMouseOverCluster(pClusterFound); if (pClusterFound) { m_bHovering = true; if (m_pClusterSel != pClusterFound) trekClient.PlaySoundEffect(mouseoverSound); SelectCluster(pClusterFound); GetWindow()->SetCursor(GetClusterCursor()); /* AssetMask am = pClusterFound->GetClusterSite()->GetClusterAssetMask(); ClusterWarning cw = GetClusterWarning(am, trekClient.MyMission()->GetMissionParams().bInvulnerableStations); trekClient.PostText(false, GetClusterWarningText(cw)); */ } else { m_bHovering = false; SelectCluster(trekClient.GetChatCluster()); if (m_bCanDrag) { GetWindow()->SetCursor(AWF_CURSOR_DRAG); } else { GetWindow()->SetCursor(AWF_CURSOR_DEFAULT); } } } Changed(); } virtual void MouseLeave(IInputProvider* pprovider) { m_bHovering = false; SelectCluster(trekClient.GetChatCluster()); m_pSectorInfoPane->SelectMouseOverCluster(NULL); if (!m_bDragging) GetWindow()->SetCursor(AWF_CURSOR_DEFAULT); Changed(); } MouseResult Button(IInputProvider* pprovider, const Point& point, int button, bool bCaptured, bool bInside, bool bDown) { IclusterIGC* pClusterFound = GetClusterAtPoint(point); if (bDown) { if (((GetKeyState(VK_CONTROL) & 0x8000) !=0) && (1 == button)) //Xynth #208 8/2010 Ctrl-Right click to highlight { if (pClusterFound) { if (trekClient.GetPlayerInfo()->IsTeamLeader()) { //commanders toggle and forward to team pClusterFound->SetHighlight(!pClusterFound->GetHighlight()); bool newHighlight; newHighlight = pClusterFound->GetHighlight(); trekClient.SetMessageType(BaseClient::c_mtGuaranteed); BEGIN_PFM_CREATE(trekClient.m_fm, pfmhighlight, CS, HIGHLIGHT_CLUSTER) END_PFM_CREATE pfmhighlight->clusterID = pClusterFound->GetObjectID(); pfmhighlight->highlight = newHighlight; } else pClusterFound->SetHighlight(false); //Only let players turn off highlight } } else if (0 == button) { // mmf 11/08 Don't allow pilots in a turret to do any of this (as in the below, namely changing viewed cluster). // This addresses (until a better fix) the bug of eyeing enemy ships when in base, in a turret, and // bomber pilot swtiches viewed sector // added && (trekClient.GetShip()->GetParentShip() == NULL) //TheRock 4-1-2010 reverted, fixed on the server side. if (pClusterFound) { trekClient.PlaySoundEffect(mouseclickSound); SelectCluster(pClusterFound); // if we are ripcording, set the target ripcord cluster if (trekClient.GetShip()->fRipcordActive() && !trekClient.GetShip()->GetAutopilot()) { trekClient.RequestRipcord(trekClient.GetShip(), pClusterFound); } // if we are teleporting, try to teleport to a station in // the selected station. else if (GetWindow()->GetOverlayFlags() & ofTeleportPane) { AttemptTeleportTo(pClusterFound); } else { // if we are in a station, change the view cluster if (trekClient.GetShip()->GetCluster() == NULL) { ZAssert(trekClient.GetShip()->GetStation() != NULL); trekClient.RequestViewCluster(pClusterFound); GetWindow()->SetViewMode(TrekWindow::vmCommand); } else if (pClusterFound == trekClient.GetShip()->GetCluster()) { // do nothing - users find anything else confusing. } else if (true)//!TrekWindow::CommandCamera(GetWindow()->GetCameraMode())) { // give the player a command to goto that sector DataBuoyIGC db; db.position = Vector(0, 0, 0); db.clusterID = pClusterFound->GetObjectID(); db.type = c_buoyCluster; IbuoyIGC* b = (IbuoyIGC*)(trekClient.m_pCoreIGC->CreateObject(trekClient.m_now, OT_buoy, &db, sizeof(db))); assert (b); b->AddConsumer(); trekClient.SendChat(trekClient.GetShip(), CHAT_INDIVIDUAL, trekClient.GetShipID(), NA, NULL, c_cidGoto, OT_buoy, b->GetObjectID(), b); b->ReleaseConsumer(); b->Release(); } } } else if (m_bCanDrag) { // start a drag m_bDragging = true; m_pointLastDrag = point; GetWindow()->SetCursor(AWF_CURSOR_DRAG); Changed(); return MouseResultCapture(); } } else if (1 == button && pClusterFound) { // let the console handle this trekClient.PlaySoundEffect(mouseclickSound); TrekWindow* pWindow = GetWindow (); pWindow->GetConsoleImage()->GetConsoleData()->PickCluster(pClusterFound, button); pWindow->GetInput ()->SetFocus (false); } } else { if (m_bDragging && 0 == button) { m_bDragging = false; if (pClusterFound) { GetWindow()->SetCursor(GetClusterCursor()); } else if (!bInside) { GetWindow()->SetCursor(AWF_CURSOR_DEFAULT); } else { GetWindow()->SetCursor(AWF_CURSOR_DRAG); } Changed(); return MouseResultRelease(); } } Changed(); return MouseResult(); } void OnClusterChanged(IclusterIGC* pcluster) { if (!m_bHovering) { SelectCluster(pcluster); } } }; TRef<IObject> SectorMapPaneFactory::Apply(ObjectStack& stack) { TRef<SectorInfoPane> pinfoPane; CastTo(pinfoPane, (Pane*)(IObject*)stack.Pop()); TRef<Number> pnumberMode; CastTo(pnumberMode, (IObject*)stack.Pop()); TRef<Number> pnumberMaskModeActive; CastTo(pnumberMaskModeActive, (IObject*)stack.Pop()); TRef<Image> psectormap = new SectorMapPane(pinfoPane, pnumberMode, (int)pnumberMaskModeActive->GetValue()); return (Value*)psectormap; }
{ "content_hash": "ee7c9d881635b89044874893168b2c6a", "timestamp": "", "source": "github", "line_count": 1643, "max_line_length": 214, "avg_line_length": 37.778454047474135, "alnum_prop": 0.5003544385371355, "repo_name": "AllegianceZone/Allegiance", "id": "d9a79516bf7a189a893720ff5934bfe83ee05b91", "size": "62070", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/WinTrek/sectormap.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "26927" }, { "name": "Batchfile", "bytes": "20387" }, { "name": "C", "bytes": "3213698" }, { "name": "C++", "bytes": "11383849" }, { "name": "CSS", "bytes": "1905" }, { "name": "HTML", "bytes": "369500" }, { "name": "JavaScript", "bytes": "125561" }, { "name": "Makefile", "bytes": "9519" }, { "name": "Objective-C", "bytes": "41562" }, { "name": "Perl", "bytes": "3074" }, { "name": "PigLatin", "bytes": "250645" }, { "name": "Roff", "bytes": "5275" }, { "name": "Visual Basic", "bytes": "7253" }, { "name": "XSLT", "bytes": "19495" } ], "symlink_target": "" }
title: Send category: send mailchimp: true description: Upload a list and schedule your email. order: 5 ---
{ "content_hash": "917a924b89a4b777bbf6614bcd7032d9", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 51, "avg_line_length": 18, "alnum_prop": 0.7592592592592593, "repo_name": "fordhamumc/email-docs", "id": "c4cd9b9aec31d676287a9ed150249e20ef3c9b1b", "size": "112", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/send.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "17787" }, { "name": "HTML", "bytes": "9551" }, { "name": "JavaScript", "bytes": "16658" }, { "name": "Ruby", "bytes": "2378" } ], "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> <title>StarVista : What We Do : Adults : Counseling Center : What services do we provide?</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="http://cdn.firespring.com/cache/core.1381239597.css" type="text/css" charset="UTF-8" /> <link rel="stylesheet" href="http://cdn.firespring.com/designs/pacific/css/stylesheet.css" type="text/css" charset="UTF-8" /> <link rel="stylesheet" href="http://cdn.firespring.com/designs/pacific/subdesigns/3320/css/stylesheet.css" type="text/css" charset="UTF-8" /> <script src="http://cdn.firespring.com/core/js/jquery-1.6.1.min.js" type="text/javascript"></script> <!--[if lte IE 7]> <style> .tagline { position:relative; top:40px; } </style> <![endif]--> </head> <body id="internal"> <!--[if lt IE 7]> <div class="ie6 oldie"> <![endif]--> <!--[if IE 7]> <div class="ie7 oldie"> <![endif]--> <!--[if IE 8]> <div class="ie8 oldie"> <![endif]--> <!--[if IE 9]> <div class="ie9 oldie"> <![endif]--> <div id="wrap"> <div id="t_nav"> <ul class="content_collection_items spacing_default"> <li id="item3600609"> <div class="collection_item_label"> <a href="http://www.star-vista.org/contact.html" >Contact Us</a> </div> </li> <li class="Alt" id="item3600610"> <div class="collection_item_label"> <a href="http://www.star-vista.org/sitemap.html" >Search Our Site</a> </div> </li> </ul> </div> <div class="logo"> <a href="http://www.star-vista.org/" ><img src="http://cdn.firespring.com/images/2fa72c42-a273-4ba6-8eb8-7e184fa825f1.png" id="logo" alt="StarVista" width="345" height="126" /></a> <p class="tagline" style="line-height:126px;"> <em>formerly Youth and Family Enrichment Services</em></p> </div><!-- end .logo --> <div class="nav"> <ul> <li class=""><a href="http://www.star-vista.org/welcome.html">Home</a></li><li class=""><a href="http://www.star-vista.org/who_we_are/">Who We Are</a></li><li class="active"><a href="http://www.star-vista.org/what_we_do/">What We Do</a></li><li class=""><a href="http://www.star-vista.org/what_you_can_do/">What You Can Do</a></li><li class=""><a href="http://www.star-vista.org/news_events/">What&#039;s New</a></li><li class=""><a href="http://www.star-vista.org/work_with_us/">Work With Us</a></li><li class=""><a href="http://www.star-vista.org/client_successes/">Client Successes</a></li><li class=""><a href="http://www.star-vista.org/contact.html">Contact Us</a></li> </ul> </div><!-- end .nav --> <div id="spotlight" style="width:800px; height:160px; overflow:hidden;"> <!-- Custom Masthead ---> <div class="content_image_box align_image_default" style="width: 810px;"> <p class="content_image"> <img src="http://cdn.firespring.com/images/e9f57b22-3713-4608-a57e-742ada788add.jpg" width="800" height="107" alt="" border="0" /></p> </div> </div> <div id="content"> <div id="sidebar"> <!-- *V SIDEBAR CONTENT HERE V --> <h3>In This Section</h3> <ul><li class=""><a href="http://www.star-vista.org/what_we_do/adult_services/counseling_center/">StarVista Counseling Center </a></li><li class="selected"><a href="http://www.star-vista.org/what_we_do/adult_services/counseling_center/counselingcenterservices.html">What services do we provide?</a></li><li class=""><a href="http://www.star-vista.org/what_we_do/adult_services/counseling_center/counselingcenterappointments.html">How to schedule an appointment?</a></li><li class=""><a href="http://www.star-vista.org/what_we_do/adult_services/counseling_center/counselingcenterstaff.html">Who are we? </a></li></ul><hr class="clear"/> <!-- ^ SIDEBAR CONTENT ENDS HERE ^ --> </div><!-- end #sidebar --> <div id="maincontent"> <h3>Services we provide: </h3> <ul> <li>Individual Counseling for adults, adolescents, and children</li> <li>Family Counseling</li> <li>Couples Counseling</li> <li>Group Counseling/Support Groups</li> <li>Services may be provided in English or Spanish. Ask about services in other languages</li> </ul> <div class="content_image_wrapper"><div class="content_image_box align_image_center" style="width: 260px;"> <p class="content_image"> <img src="http://cdn.firespring.com/images/e12d792a-4aab-4c45-b79a-034c537229dd.jpg" width="250" height="138" alt="" border="0" /></p> </div> </div> </div> <!-- end #maincontent --> <hr class="clear"/> </div><!-- end #content --> <div id="footer"> <div id="rights"> <p class="copyright"> <a href="http://www.star-vista.org/copyright.html">Copyright</a> &copy; 2013<br/> <a href="http://www.star-vista.org/privacy_policy.html">Privacy Policy</a> </p> </div> <div id="contact"> <p> StarVista<br/> 610 Elm Street, Suite 212 &bull;&nbsp;San Carlos, CA 94070 <br/> Phone (650) 591-9623 <a href="mailto:[email protected]"><br/>[email protected]</a> </p> </div> </div><!-- end #footer --> </div> <div id="shadow">&nbsp;</div> <!-- end #wrap --> <!--[if IE 6]><script type="text/javascript" src="http://cdn.firespring.com/designs/pacific/js/jquery.pngFix.pack.js"></script><![endif]--> <script src="http://cdn.firespring.com/cache/core.1381239597.js" type="text/javascript"></script> <script type="text/javascript"> var firespring = { log: function(){ return; }, goal: function(){ return; }}; var firespring_site_id = 66449511; (function() { var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = ( document.location.protocol == 'https:' ? 'https://analytics.firespring.com/js' : 'http://analytics.firespring.com/js' ); ( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s ); })(); </script> <noscript><p><img alt="Firespring Analytics" width="1" height="1" src="http://analytics.firespring.com/66449511ns.gif" /></p></noscript> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1394851-12'],['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <!--[if lt IE 7]> </div> <![endif]--> <!--[if IE 7]> </div> <![endif]--> <!--[if IE 8]> </div> <![endif]--> <!--[if IE 9]> </div> <![endif]--> </body> </html>
{ "content_hash": "8568ed2ed01aef0a2025aa6fdcb7a6d3", "timestamp": "", "source": "github", "line_count": 206, "max_line_length": 685, "avg_line_length": 33.04368932038835, "alnum_prop": 0.6343469957396798, "repo_name": "v6/swag", "id": "7648a2af3d245b3d28417937b60b90f08e381d5f", "size": "6807", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "folio/files (wget -r)/NOT_OWNED_BY_ME_OR_COVERED_BY_LICENSE/star-vista.org (backup copy from 20131016)/what_we_do/adult_services/counseling_center/counselingcenterservices.html", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
namespace remoting { namespace protocol { namespace { // 32-bit BGRA is 4 bytes per pixel. const int kBytesPerPixel = 4; bool CursorShapeIsValid(const CursorShapeInfo& cursor_shape) { if (!cursor_shape.has_data() || !cursor_shape.has_width() || !cursor_shape.has_height() || !cursor_shape.has_hotspot_x() || !cursor_shape.has_hotspot_y()) { LOG(ERROR) << "Cursor shape is missing required fields."; return false; } int width = cursor_shape.width(); int height = cursor_shape.height(); // Verify that |width| and |height| are within sane limits. Otherwise integer // overflow can occur while calculating |cursor_total_bytes| below. if (width < 0 || width > (SHRT_MAX / 2) || height < 0 || height > (SHRT_MAX / 2)) { LOG(ERROR) << "Cursor dimensions are out of bounds for SetCursor: " << width << "x" << height; return false; } uint32_t cursor_total_bytes = width * height * kBytesPerPixel; if (cursor_shape.data().size() < cursor_total_bytes) { LOG(ERROR) << "Expected " << cursor_total_bytes << " bytes for a " << width << "x" << height << " cursor. Only received " << cursor_shape.data().size() << " bytes"; return false; } return true; } } // namespace ClientControlDispatcher::ClientControlDispatcher() : ChannelDispatcherBase(kControlChannelName) {} ClientControlDispatcher::~ClientControlDispatcher() = default; void ClientControlDispatcher::InjectClipboardEvent( const ClipboardEvent& event) { ControlMessage message; message.mutable_clipboard_event()->CopyFrom(event); message_pipe()->Send(&message, {}); } void ClientControlDispatcher::NotifyClientResolution( const ClientResolution& resolution) { ControlMessage message; message.mutable_client_resolution()->CopyFrom(resolution); message_pipe()->Send(&message, {}); } void ClientControlDispatcher::ControlVideo(const VideoControl& video_control) { ControlMessage message; message.mutable_video_control()->CopyFrom(video_control); message_pipe()->Send(&message, {}); } void ClientControlDispatcher::ControlAudio(const AudioControl& audio_control) { ControlMessage message; message.mutable_audio_control()->CopyFrom(audio_control); message_pipe()->Send(&message, {}); } void ClientControlDispatcher::SetCapabilities( const Capabilities& capabilities) { ControlMessage message; message.mutable_capabilities()->CopyFrom(capabilities); message_pipe()->Send(&message, {}); } void ClientControlDispatcher::RequestPairing( const PairingRequest& pairing_request) { ControlMessage message; message.mutable_pairing_request()->CopyFrom(pairing_request); message_pipe()->Send(&message, {}); } void ClientControlDispatcher::DeliverClientMessage( const ExtensionMessage& message) { ControlMessage control_message; control_message.mutable_extension_message()->CopyFrom(message); message_pipe()->Send(&control_message, {}); } void ClientControlDispatcher::SelectDesktopDisplay( const SelectDesktopDisplayRequest& select_display) { ControlMessage message; message.mutable_select_display()->CopyFrom(select_display); message_pipe()->Send(&message, {}); } void ClientControlDispatcher::ControlPeerConnection( const protocol::PeerConnectionParameters& parameters) { ControlMessage message; message.mutable_peer_connection_parameters()->CopyFrom(parameters); message_pipe()->Send(&message, {}); } void ClientControlDispatcher::OnIncomingMessage( std::unique_ptr<CompoundBuffer> buffer) { DCHECK(client_stub_); DCHECK(clipboard_stub_); std::unique_ptr<ControlMessage> message = ParseMessage<ControlMessage>(buffer.get()); if (!message) return; if (message->has_clipboard_event()) { clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); } else if (message->has_capabilities()) { client_stub_->SetCapabilities(message->capabilities()); } else if (message->has_cursor_shape()) { if (CursorShapeIsValid(message->cursor_shape())) client_stub_->SetCursorShape(message->cursor_shape()); } else if (message->has_pairing_response()) { client_stub_->SetPairingResponse(message->pairing_response()); } else if (message->has_extension_message()) { client_stub_->DeliverHostMessage(message->extension_message()); } else if (message->has_video_layout()) { client_stub_->SetVideoLayout(message->video_layout()); } else { LOG(WARNING) << "Unknown control message received."; } } } // namespace protocol } // namespace remoting
{ "content_hash": "598e5193f80903a8c777fd60496d5d0c", "timestamp": "", "source": "github", "line_count": 138, "max_line_length": 79, "avg_line_length": 33.08695652173913, "alnum_prop": 0.7045554095488392, "repo_name": "ric2b/Vivaldi-browser", "id": "6341cee155a1e24b5c76c5347acb057302061a4a", "size": "5215", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "chromium/remoting/protocol/client_control_dispatcher.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
In the interest of fostering an open and welcoming environment, we as contributors and maintainers of LuaRocks pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer at [email protected]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/
{ "content_hash": "7432ee3f8eabf6fe6c7cab450014e10d", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 446, "avg_line_length": 74.02380952380952, "alnum_prop": 0.822129302026375, "repo_name": "tarantool/luarocks", "id": "ba748396539d927928efd8bf03f0ca250d443715", "size": "3152", "binary": false, "copies": "3", "ref": "refs/heads/luarocks-3.1.3-tarantool", "path": "CODE_OF_CONDUCT.md", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "39265" }, { "name": "C", "bytes": "40954" }, { "name": "C++", "bytes": "191" }, { "name": "Lua", "bytes": "927818" }, { "name": "Makefile", "bytes": "6192" }, { "name": "Shell", "bytes": "14262" } ], "symlink_target": "" }
package org.apache.s4.core.util; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; import org.apache.s4.comm.topology.ZNRecord; /** * Container for application parameters, with facilities to write and read the configuration from ZooKeeper. * <p> * Can be constructed through a builder pattern. */ public class AppConfig { public static final String NAMED_PARAMETERS = "namedParams"; public static final String APP_CLASS = "appClass"; public static final String APP_NAME = "appName"; public static final String APP_URI = "S4R_URI"; public static final String MODULES_CLASSES = "modulesClasses"; public static final String MODULES_URIS = "modulesURIs"; String appName; String appClassName; List<String> customModulesNames = Collections.emptyList(); List<String> customModulesURIs = Collections.emptyList(); Map<String, String> namedParameters = Collections.emptyMap(); String appURI; private AppConfig() { } public AppConfig(ZNRecord znRecord) { appName = znRecord.getSimpleField(APP_NAME); appClassName = znRecord.getSimpleField(APP_CLASS); appURI = znRecord.getSimpleField(APP_URI); customModulesNames = znRecord.getListField(MODULES_CLASSES); customModulesURIs = znRecord.getListField(MODULES_URIS); namedParameters = znRecord.getMapField(NAMED_PARAMETERS); } public AppConfig(String appName, String appClassName, String appURI, List<String> customModulesNames, List<String> customModulesURIs, Map<String, String> namedParameters) { super(); this.appName = appName; this.appClassName = appClassName; this.appURI = appURI; this.customModulesNames = customModulesNames; this.customModulesURIs = customModulesURIs; this.namedParameters = namedParameters; } public String getAppName() { return appName; } public String getAppClassName() { return appClassName; } public String getAppURI() { return appURI; } public List<String> getCustomModulesNames() { return customModulesNames; } public List<String> getCustomModulesURIs() { return customModulesURIs; } public Map<String, String> getNamedParameters() { return namedParameters; } public String getNamedParametersAsString() { if (namedParameters == null || namedParameters.isEmpty()) { return ""; } StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> param : namedParameters.entrySet()) { sb.append(param.getKey() + "=" + param.getValue() + ","); } return sb.toString(); } public ZNRecord asZNRecord(String id) { ZNRecord record = new ZNRecord(id); if (appClassName != null) { record.putSimpleField(APP_CLASS, appClassName); } if (appName != null) { record.putSimpleField(APP_NAME, appName); } if (appURI != null) { record.putSimpleField(APP_URI, appURI); } if (customModulesNames != null) { record.putListField(MODULES_CLASSES, customModulesNames); } if (customModulesURIs != null) { record.putListField(MODULES_URIS, customModulesURIs); } if (namedParameters != null) { record.putMapField(NAMED_PARAMETERS, namedParameters); } return record; } @Override public String toString() { return "app name: [" + appName + "] \n " + "app class: [" + appClassName + "] \n" + "app URI : [" + appURI + "] \n" + "modules classes : [" + customModulesNames == null ? "" : (Arrays.toString(customModulesNames.toArray(new String[] {}))) + " \n" + "modules URIs [" + customModulesURIs == null ? "" : (Arrays.toString(customModulesURIs.toArray(new String[] {}))) + "]"; } public static class Builder { AppConfig config; public Builder() { this.config = new AppConfig(); } public Builder appName(String appName) { config.appName = appName; return this; } public Builder appClassName(String appClassName) { config.appClassName = appClassName; return this; } public Builder appURI(String appURI) { config.appURI = appURI; return this; } public Builder customModulesNames(List<String> customModulesNames) { if (customModulesNames != null) { config.customModulesNames = customModulesNames; } return this; } public Builder customModulesURIs(List<String> customModulesURIs) { if (customModulesURIs != null) { config.customModulesURIs = customModulesURIs; } return this; } public Builder namedParameters(Map<String, String> namedParameters) { if (namedParameters != null) { config.namedParameters = namedParameters; } return this; } public AppConfig build() { return config; } } }
{ "content_hash": "29d800cb529a2003de35fdfecf13475d", "timestamp": "", "source": "github", "line_count": 171, "max_line_length": 114, "avg_line_length": 31.327485380116958, "alnum_prop": 0.6074295314541721, "repo_name": "coolwuxing/DynamicS4", "id": "6c28d7a1d81a313234472d2bd15ee7758385597d", "size": "6163", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "subprojects/s4-core/src/main/java/org/apache/s4/core/util/AppConfig.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "18633" }, { "name": "Groovy", "bytes": "69295" }, { "name": "Java", "bytes": "834648" }, { "name": "Ruby", "bytes": "2120" }, { "name": "Shell", "bytes": "13513" } ], "symlink_target": "" }
using System; using System.IO; using System.Threading; namespace Kudu.Core.Infrastructure { /// <summary> /// The <see cref="ProgressWriter"/> class takes two <see cref="TextWriter"/> instances (output and error) /// and acts as a write-through of data. However, if nothing is written to these two writers for a given amount /// of time then the <see cref="ProgressWriter"/> goes into "idle" mode which causes a sequence of "." to /// be written until new data is written to the output or error. /// </summary> internal class ProgressWriter : IDisposable { private static readonly TimeSpan _defaultIdlingStart = TimeSpan.FromSeconds(5); private static readonly TimeSpan _defaultIdlingDelay = TimeSpan.FromSeconds(1); private readonly Timer _timer; private readonly TextWriter _output; private readonly TextWriter _error; private TimeSpan _idlingStart; private TimeSpan _idlingDelay; private object _thisLock = new object(); private bool _idling; private bool disposed; /// <summary> /// Creates a new <see cref="ProgressWriter"/> instance defaulting to Console.Out and Console.Error and with /// default idling start and delay times. /// </summary> public ProgressWriter() : this(Console.Out, Console.Error) { } /// <summary> /// Creates a new <see cref="ProgressWriter"/> instance. /// </summary> /// <param name="output">The output writer. The idle character (".") is always written to this writer. Writer is not disposed.</param> /// <param name="error">The error writer. Writer is not disposed.</param> /// <param name="idlingStart">The amount of time until the writers are consider to be idling.</param> /// <param name="idlingDelay">The amount of time between each idle character (".") written while idling.</param> public ProgressWriter(TextWriter output, TextWriter error, TimeSpan? idlingStart = null, TimeSpan? idlingDelay = null) { if (output == null) { throw new ArgumentNullException("output"); } if (error == null) { throw new ArgumentNullException("error"); } _output = output; _error = error; _idlingStart = idlingStart != null ? idlingStart.Value : _defaultIdlingStart; _idlingDelay = idlingDelay != null ? idlingDelay.Value : _defaultIdlingDelay; // Set timer to fire first time we go idle _timer = new Timer(IdleWriter, null, _idlingStart, Timeout.InfiniteTimeSpan); } public void WriteOutLine(string value) { lock (_thisLock) { OnBeforeWrite(); _output.WriteLine(value); } } public void WriteErrorLine(string value) { lock (_thisLock) { OnBeforeWrite(); _error.WriteLine(value); } } private void OnBeforeWrite() { if (!disposed) { if (_idling) { _idling = false; // Go back to not writing progress and print a new line before we start to write new content _output.WriteLine(); } // Set next timer to fire when we would go idle _timer.Change(_idlingStart, Timeout.InfiniteTimeSpan); } } private void IdleWriter(object state) { lock (_thisLock) { if (!disposed) { _idling = true; // Write progress _output.Write("."); // Set next timer to fire when we write the next idle progress _timer.Change(_idlingDelay, Timeout.InfiniteTimeSpan); } } } public void Dispose() { lock (_thisLock) { if (_idling) { _output.WriteLine(); } disposed = true; } if (_timer != null) { _timer.Dispose(); } } } }
{ "content_hash": "d2478f75abb1db84f7c1699c2cbe59f7", "timestamp": "", "source": "github", "line_count": 134, "max_line_length": 142, "avg_line_length": 33.26865671641791, "alnum_prop": 0.5278151637505608, "repo_name": "EricSten-MSFT/kudu", "id": "ae25c087990bcf412d964c617d0746a26a67bd26", "size": "4460", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Kudu.Core/Infrastructure/ProgressWriter.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "99" }, { "name": "Batchfile", "bytes": "13164" }, { "name": "C#", "bytes": "2881495" }, { "name": "CSS", "bytes": "13551" }, { "name": "HTML", "bytes": "1569" }, { "name": "JavaScript", "bytes": "256629" }, { "name": "PowerShell", "bytes": "70053" }, { "name": "Python", "bytes": "2495" }, { "name": "Shell", "bytes": "75" }, { "name": "Smalltalk", "bytes": "3" } ], "symlink_target": "" }
package pull import ( "sync" "time" "github.com/hyperledger/fabric/gossip/comm" "github.com/hyperledger/fabric/gossip/common" "github.com/hyperledger/fabric/gossip/discovery" "github.com/hyperledger/fabric/gossip/gossip/algo" "github.com/hyperledger/fabric/gossip/util" proto "github.com/hyperledger/fabric/protos/gossip" "github.com/op/go-logging" ) // Constants go here. const ( HelloMsgType PullMsgType = iota DigestMsgType RequestMsgType ResponseMsgType ) // PullMsgType defines the type of a message that is sent to the PullStore type PullMsgType int // MessageHook defines a function that will run after a certain pull message is received type MessageHook func(itemIDs []string, items []*proto.SignedGossipMessage, msg proto.ReceivedMessage) // Sender sends messages to remote peers type Sender interface { // Send sends a message to a list of remote peers Send(msg *proto.SignedGossipMessage, peers ...*comm.RemotePeer) } // MembershipService obtains membership information of alive peers type MembershipService interface { // GetMembership returns the membership of GetMembership() []discovery.NetworkMember } // PullConfig defines the configuration of the pull mediator type PullConfig struct { ID string PullInterval time.Duration // Duration between pull invocations PeerCountToSelect int // Number of peers to initiate pull with Tag proto.GossipMessage_Tag Channel common.ChainID MsgType proto.PullMsgType } // Mediator is a component wrap a PullEngine and provides the methods // it needs to perform pull synchronization. // The specialization of a pull mediator to a certain type of message is // done by the configuration, a IdentifierExtractor, IdentifierExtractor // given at construction, and also hooks that can be registered for each // type of pullMsgType (hello, digest, req, res). type Mediator interface { // Stop stop the Mediator Stop() // RegisterMsgHook registers a message hook to a specific type of pull message RegisterMsgHook(PullMsgType, MessageHook) // Add adds a GossipMessage to the Mediator Add(*proto.SignedGossipMessage) // Remove removes a GossipMessage from the Mediator Remove(*proto.SignedGossipMessage) // HandleMessage handles a message from some remote peer HandleMessage(msg proto.ReceivedMessage) } // pullMediatorImpl is an implementation of Mediator type pullMediatorImpl struct { sync.RWMutex Sender msgType2Hook map[PullMsgType][]MessageHook idExtractor proto.IdentifierExtractor msgCons proto.MsgConsumer config PullConfig logger *logging.Logger itemID2Msg map[string]*proto.SignedGossipMessage memBvc MembershipService engine *algo.PullEngine } // NewPullMediator returns a new Mediator func NewPullMediator(config PullConfig, sndr Sender, memSvc MembershipService, idExtractor proto.IdentifierExtractor, msgCons proto.MsgConsumer) Mediator { p := &pullMediatorImpl{ msgCons: msgCons, msgType2Hook: make(map[PullMsgType][]MessageHook), idExtractor: idExtractor, config: config, logger: util.GetLogger(util.LoggingPullModule, config.ID), itemID2Msg: make(map[string]*proto.SignedGossipMessage), memBvc: memSvc, Sender: sndr, } p.engine = algo.NewPullEngine(p, config.PullInterval) return p } func (p *pullMediatorImpl) HandleMessage(m proto.ReceivedMessage) { if m.GetGossipMessage() == nil || !m.GetGossipMessage().IsPullMsg() { return } msg := m.GetGossipMessage() msgType := msg.GetPullMsgType() if msgType != p.config.MsgType { return } p.logger.Debug(msg) itemIDs := []string{} items := []*proto.SignedGossipMessage{} var pullMsgType PullMsgType if helloMsg := msg.GetHello(); helloMsg != nil { pullMsgType = HelloMsgType p.engine.OnHello(helloMsg.Nonce, m) } if digest := msg.GetDataDig(); digest != nil { itemIDs = digest.Digests pullMsgType = DigestMsgType p.engine.OnDigest(digest.Digests, digest.Nonce, m) } if req := msg.GetDataReq(); req != nil { itemIDs = req.Digests pullMsgType = RequestMsgType p.engine.OnReq(req.Digests, req.Nonce, m) } if res := msg.GetDataUpdate(); res != nil { itemIDs = make([]string, len(res.Data)) items = make([]*proto.SignedGossipMessage, len(res.Data)) pullMsgType = ResponseMsgType for i, pulledMsg := range res.Data { msg, err := pulledMsg.ToGossipMessage() if err != nil { p.logger.Warning("Data update contains an invalid message:", err) return } p.msgCons(msg) itemIDs[i] = p.idExtractor(msg) items[i] = msg p.Lock() p.itemID2Msg[itemIDs[i]] = msg p.Unlock() } p.engine.OnRes(itemIDs, res.Nonce) } // Invoke hooks for relevant message type for _, h := range p.hooksByMsgType(pullMsgType) { h(itemIDs, items, m) } } func (p *pullMediatorImpl) Stop() { p.engine.Stop() } // RegisterMsgHook registers a message hook to a specific type of pull message func (p *pullMediatorImpl) RegisterMsgHook(pullMsgType PullMsgType, hook MessageHook) { p.Lock() defer p.Unlock() p.msgType2Hook[pullMsgType] = append(p.msgType2Hook[pullMsgType], hook) } // Add adds a GossipMessage to the store func (p *pullMediatorImpl) Add(msg *proto.SignedGossipMessage) { p.Lock() defer p.Unlock() itemID := p.idExtractor(msg) p.itemID2Msg[itemID] = msg p.engine.Add(itemID) } // Remove removes a GossipMessage from the store func (p *pullMediatorImpl) Remove(msg *proto.SignedGossipMessage) { p.Lock() defer p.Unlock() itemID := p.idExtractor(msg) delete(p.itemID2Msg, itemID) p.engine.Remove(itemID) } // SelectPeers returns a slice of peers which the engine will initiate the protocol with func (p *pullMediatorImpl) SelectPeers() []string { remotePeers := SelectEndpoints(p.config.PeerCountToSelect, p.memBvc.GetMembership()) endpoints := make([]string, len(remotePeers)) for i, peer := range remotePeers { endpoints[i] = peer.Endpoint } return endpoints } // Hello sends a hello message to initiate the protocol // and returns an NONCE that is expected to be returned // in the digest message. func (p *pullMediatorImpl) Hello(dest string, nonce uint64) { helloMsg := &proto.GossipMessage{ Channel: p.config.Channel, Tag: p.config.Tag, Content: &proto.GossipMessage_Hello{ Hello: &proto.GossipHello{ Nonce: nonce, Metadata: nil, MsgType: p.config.MsgType, }, }, } p.logger.Debug("Sending hello to", dest) p.Send(helloMsg.NoopSign(), p.peersWithEndpoints(dest)...) } // SendDigest sends a digest to a remote PullEngine. // The context parameter specifies the remote engine to send to. func (p *pullMediatorImpl) SendDigest(digest []string, nonce uint64, context interface{}) { digMsg := &proto.GossipMessage{ Channel: p.config.Channel, Tag: p.config.Tag, Nonce: 0, Content: &proto.GossipMessage_DataDig{ DataDig: &proto.DataDigest{ MsgType: p.config.MsgType, Nonce: nonce, Digests: digest, }, }, } p.logger.Debug("Sending digest", digMsg.GetDataDig().Digests) context.(proto.ReceivedMessage).Respond(digMsg) } // SendReq sends an array of items to a certain remote PullEngine identified // by a string func (p *pullMediatorImpl) SendReq(dest string, items []string, nonce uint64) { req := &proto.GossipMessage{ Channel: p.config.Channel, Tag: p.config.Tag, Nonce: 0, Content: &proto.GossipMessage_DataReq{ DataReq: &proto.DataRequest{ MsgType: p.config.MsgType, Nonce: nonce, Digests: items, }, }, } p.logger.Debug("Sending", req, "to", dest) p.Send(req.NoopSign(), p.peersWithEndpoints(dest)...) } // SendRes sends an array of items to a remote PullEngine identified by a context. func (p *pullMediatorImpl) SendRes(items []string, context interface{}, nonce uint64) { items2return := []*proto.Envelope{} p.RLock() defer p.RUnlock() for _, item := range items { if msg, exists := p.itemID2Msg[item]; exists { items2return = append(items2return, msg.Envelope) } } returnedUpdate := &proto.GossipMessage{ Channel: p.config.Channel, Tag: p.config.Tag, Nonce: 0, Content: &proto.GossipMessage_DataUpdate{ DataUpdate: &proto.DataUpdate{ MsgType: p.config.MsgType, Nonce: nonce, Data: items2return, }, }, } p.logger.Debug("Sending", returnedUpdate, "to") context.(proto.ReceivedMessage).Respond(returnedUpdate) } func (p *pullMediatorImpl) peersWithEndpoints(endpoints ...string) []*comm.RemotePeer { peers := []*comm.RemotePeer{} for _, member := range p.memBvc.GetMembership() { for _, endpoint := range endpoints { if member.PreferredEndpoint() == endpoint { peers = append(peers, &comm.RemotePeer{Endpoint: member.PreferredEndpoint(), PKIID: member.PKIid}) } } } return peers } func (p *pullMediatorImpl) hooksByMsgType(msgType PullMsgType) []MessageHook { p.RLock() defer p.RUnlock() returnedHooks := []MessageHook{} for _, h := range p.msgType2Hook[msgType] { returnedHooks = append(returnedHooks, h) } return returnedHooks } // SelectEndpoints select k peers from peerPool and returns them. func SelectEndpoints(k int, peerPool []discovery.NetworkMember) []*comm.RemotePeer { if len(peerPool) < k { k = len(peerPool) } indices := util.GetRandomIndices(k, len(peerPool)-1) endpoints := make([]*comm.RemotePeer, len(indices)) for i, j := range indices { endpoints[i] = &comm.RemotePeer{Endpoint: peerPool[j].PreferredEndpoint(), PKIID: peerPool[j].PKIid} } return endpoints }
{ "content_hash": "812344f1399bfb25ccbe8ee435f57c48", "timestamp": "", "source": "github", "line_count": 323, "max_line_length": 155, "avg_line_length": 29.41795665634675, "alnum_prop": 0.7211113449800042, "repo_name": "bmos299/fabric", "id": "612202a1c5d50df22427b1e0c0b9915c42e05cb3", "size": "10077", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "gossip/gossip/pull/pullstore.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "845" }, { "name": "Gherkin", "bytes": "28704" }, { "name": "Go", "bytes": "3511469" }, { "name": "HTML", "bytes": "6057" }, { "name": "Java", "bytes": "71703" }, { "name": "JavaScript", "bytes": "35739" }, { "name": "Makefile", "bytes": "14793" }, { "name": "Protocol Buffer", "bytes": "86395" }, { "name": "Python", "bytes": "178971" }, { "name": "Ruby", "bytes": "3441" }, { "name": "Shell", "bytes": "49281" } ], "symlink_target": "" }
package org.ovirt.engine.core.dao; import java.util.List; import org.ovirt.engine.core.common.businessentities.ExternalStatus; import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.common.businessentities.VdsDynamic; import org.ovirt.engine.core.compat.Guid; /** * <code>VdsDynamicDao</code> defines a type that performs CRUD operations on instances of {@link VdsDynamic}. * * */ public interface VdsDynamicDao extends GenericDao<VdsDynamic, Guid>, StatusAwareDao<Guid, VDSStatus>, ExternalStatusAwareDao<Guid, ExternalStatus>, MassOperationsDao<VdsDynamic, Guid>, CheckedUpdate<VdsDynamic> { /** * Update entity net_config_dirty field * @param id - entity id * @param netConfigDirty - a new value of field */ void updateNetConfigDirty(Guid id, Boolean netConfigDirty); /** * This method will update the controlled_by_pm_policy flag in DB. * @param id - id or record to be updated * @param controlledByPmPolicy - a new value for the flag */ void updateVdsDynamicPowerManagementPolicyFlag(Guid id, boolean controlledByPmPolicy); void updateCpuFlags(Guid id, String cpuFlags); /** * Retrieves all host ids of hosts that are in given status * @return list of host ids */ List<Guid> getIdsOfHostsWithStatus(VDSStatus status); /** * Updates the updateAvaiable flag of the given host * * @param id * the ID of the updates host * @param updateAvailable * the new value to be updated */ void updateUpdateAvailable(Guid id, boolean updateAvailable); /** * Updates the status and the reasons (maintenance and non-operational) for the given host * * @param host * the host to be updated */ void updateStatusAndReasons(VdsDynamic host); }
{ "content_hash": "987ab83400f8b10588e96db314fb288a", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 212, "avg_line_length": 33.410714285714285, "alnum_prop": 0.6964190272581507, "repo_name": "OpenUniversity/ovirt-engine", "id": "fed829b83d2eb0493d0cd188b414a61f24c0199a", "size": "1871", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsDynamicDao.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AspectJ", "bytes": "8958" }, { "name": "CSS", "bytes": "60941" }, { "name": "Groff", "bytes": "7443" }, { "name": "HTML", "bytes": "16218" }, { "name": "Java", "bytes": "33662996" }, { "name": "JavaScript", "bytes": "1034" }, { "name": "Makefile", "bytes": "22589" }, { "name": "PLSQL", "bytes": "257864" }, { "name": "PLpgSQL", "bytes": "78999" }, { "name": "Python", "bytes": "903984" }, { "name": "SQLPL", "bytes": "203816" }, { "name": "Shell", "bytes": "153157" }, { "name": "XSLT", "bytes": "54683" } ], "symlink_target": "" }
 #include <aws/ec2/model/EnableVolumeIORequest.h> #include <aws/core/utils/StringUtils.h> #include <aws/core/utils/memory/stl/AWSStringStream.h> using namespace Aws::EC2::Model; using namespace Aws::Utils; EnableVolumeIORequest::EnableVolumeIORequest() : m_dryRun(false), m_dryRunHasBeenSet(false), m_volumeIdHasBeenSet(false) { } Aws::String EnableVolumeIORequest::SerializePayload() const { Aws::StringStream ss; ss << "Action=EnableVolumeIO&"; if(m_dryRunHasBeenSet) { ss << "DryRun=" << std::boolalpha << m_dryRun << "&"; } if(m_volumeIdHasBeenSet) { ss << "VolumeId=" << StringUtils::URLEncode(m_volumeId.c_str()) << "&"; } ss << "Version=2016-11-15"; return ss.str(); } void EnableVolumeIORequest::DumpBodyToUrl(Aws::Http::URI& uri ) const { uri.SetQueryString(SerializePayload()); }
{ "content_hash": "d5718c8e571a02ea8e9bd6e2b0a28f34", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 75, "avg_line_length": 21.615384615384617, "alnum_prop": 0.6868327402135231, "repo_name": "cedral/aws-sdk-cpp", "id": "6daa59419f3bbf44db8c491a16f907abc576ef4f", "size": "962", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "aws-cpp-sdk-ec2/source/model/EnableVolumeIORequest.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "294220" }, { "name": "C++", "bytes": "428637022" }, { "name": "CMake", "bytes": "862025" }, { "name": "Dockerfile", "bytes": "11688" }, { "name": "HTML", "bytes": "7904" }, { "name": "Java", "bytes": "352201" }, { "name": "Python", "bytes": "106761" }, { "name": "Shell", "bytes": "10891" } ], "symlink_target": "" }
@charset "UTF-8"; /* * CSS TOGGLE SWITCH * * Ionuț Colceriu - ghinda.net * https://github.com/ghinda/css-toggle-switch * */ /* supported values are px, rem-calc, em-calc */ /* imports */ /* Functions */ /* Shared */ /* Hide by default */ .switch-toggle a, .switch-light span span { display: none; } /* We can't test for a specific feature, * so we only target browsers with support for media queries. */ @media only screen { /* Checkbox */ .switch-light { position: relative; display: block; /* simulate default browser focus outlines on the switch, * when the inputs are focused. */ } .switch-light::after { clear: both; content: ""; display: table; } .switch-light *, .switch-light *:before, .switch-light *:after { box-sizing: border-box; } .switch-light a { display: block; -webkit-transition: all 0.2s ease-out; -moz-transition: all 0.2s ease-out; transition: all 0.2s ease-out; } .switch-light label, .switch-light > span { /* breathing room for bootstrap/foundation classes. */ line-height: 2em; vertical-align: middle; } .switch-light input:focus ~ span a, .switch-light input:focus + label { outline-width: 2px; outline-style: solid; outline-color: Highlight; /* Chrome/Opera gets its native focus styles. */ } } @media only screen and (-webkit-min-device-pixel-ratio: 0) { .switch-light input:focus ~ span a, .switch-light input:focus + label { outline-color: -webkit-focus-ring-color; outline-style: auto; } } @media only screen { /* don't hide the input from screen-readers and keyboard access */ .switch-light input { position: absolute; opacity: 0; z-index: 3; } .switch-light input:checked ~ span a { right: 0%; } /* inherit from label */ .switch-light strong { font-weight: inherit; } .switch-light > span { position: relative; overflow: hidden; display: block; min-height: 2em; /* overwrite 3rd party classes padding * eg. bootstrap .well */ padding: 0; text-align: left; } .switch-light span span { position: relative; z-index: 2; display: block; float: left; width: 50%; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .switch-light a { position: absolute; right: 50%; top: 0; z-index: 1; display: block; width: 50%; height: 100%; padding: 0; } /* Radio Switch */ .switch-toggle { position: relative; display: block; /* simulate default browser focus outlines on the switch, * when the inputs are focused. */ /* For callout panels in foundation */ padding: 0 !important; /* 2 items */ /* 3 items */ /* 4 items */ /* 5 items */ /* 6 items */ } .switch-toggle::after { clear: both; content: ""; display: table; } .switch-toggle *, .switch-toggle *:before, .switch-toggle *:after { box-sizing: border-box; } .switch-toggle a { display: block; -webkit-transition: all 0.2s ease-out; -moz-transition: all 0.2s ease-out; transition: all 0.2s ease-out; } .switch-toggle label, .switch-toggle > span { /* breathing room for bootstrap/foundation classes. */ line-height: 2em; vertical-align: middle; } .switch-toggle input:focus ~ span a, .switch-toggle input:focus + label { outline-width: 2px; outline-style: solid; outline-color: Highlight; /* Chrome/Opera gets its native focus styles. */ } } @media only screen and (-webkit-min-device-pixel-ratio: 0) { .switch-toggle input:focus ~ span a, .switch-toggle input:focus + label { outline-color: -webkit-focus-ring-color; outline-style: auto; } } @media only screen { .switch-toggle input { position: absolute; left: 0; opacity: 0; } .switch-toggle input + label { position: relative; z-index: 2; display: block; float: left; padding: 0 8px; margin: 0; text-align: center; } .switch-toggle a { position: absolute; top: 0; left: 0; padding: 0; z-index: 1; width: 10px; height: 100%; } .switch-toggle label:nth-child(2):nth-last-child(4), .switch-toggle label:nth-child(2):nth-last-child(4) ~ label, .switch-toggle label:nth-child(2):nth-last-child(4) ~ a { width: 50%; } .switch-toggle label:nth-child(2):nth-last-child(4) ~ input:checked:nth-child(3) + label ~ a { left: 50%; } .switch-toggle label:nth-child(2):nth-last-child(6), .switch-toggle label:nth-child(2):nth-last-child(6) ~ label, .switch-toggle label:nth-child(2):nth-last-child(6) ~ a { width: 33.33%; } .switch-toggle label:nth-child(2):nth-last-child(6) ~ input:checked:nth-child(3) + label ~ a { left: 33.33%; } .switch-toggle label:nth-child(2):nth-last-child(6) ~ input:checked:nth-child(5) + label ~ a { left: 66.66%; } .switch-toggle label:nth-child(2):nth-last-child(8), .switch-toggle label:nth-child(2):nth-last-child(8) ~ label, .switch-toggle label:nth-child(2):nth-last-child(8) ~ a { width: 25%; } .switch-toggle label:nth-child(2):nth-last-child(8) ~ input:checked:nth-child(3) + label ~ a { left: 25%; } .switch-toggle label:nth-child(2):nth-last-child(8) ~ input:checked:nth-child(5) + label ~ a { left: 50%; } .switch-toggle label:nth-child(2):nth-last-child(8) ~ input:checked:nth-child(7) + label ~ a { left: 75%; } .switch-toggle label:nth-child(2):nth-last-child(10), .switch-toggle label:nth-child(2):nth-last-child(10) ~ label, .switch-toggle label:nth-child(2):nth-last-child(10) ~ a { width: 20%; } .switch-toggle label:nth-child(2):nth-last-child(10) ~ input:checked:nth-child(3) + label ~ a { left: 20%; } .switch-toggle label:nth-child(2):nth-last-child(10) ~ input:checked:nth-child(5) + label ~ a { left: 40%; } .switch-toggle label:nth-child(2):nth-last-child(10) ~ input:checked:nth-child(7) + label ~ a { left: 60%; } .switch-toggle label:nth-child(2):nth-last-child(10) ~ input:checked:nth-child(9) + label ~ a { left: 80%; } .switch-toggle label:nth-child(2):nth-last-child(12), .switch-toggle label:nth-child(2):nth-last-child(12) ~ label, .switch-toggle label:nth-child(2):nth-last-child(12) ~ a { width: 16.6%; } .switch-toggle label:nth-child(2):nth-last-child(12) ~ input:checked:nth-child(3) + label ~ a { left: 16.6%; } .switch-toggle label:nth-child(2):nth-last-child(12) ~ input:checked:nth-child(5) + label ~ a { left: 33.2%; } .switch-toggle label:nth-child(2):nth-last-child(12) ~ input:checked:nth-child(7) + label ~ a { left: 49.8%; } .switch-toggle label:nth-child(2):nth-last-child(12) ~ input:checked:nth-child(9) + label ~ a { left: 66.4%; } .switch-toggle label:nth-child(2):nth-last-child(12) ~ input:checked:nth-child(11) + label ~ a { left: 83%; } /* Candy Theme * Based on the "Sort Switches / Toggles (PSD)" by Ormal Clarck * http://www.premiumpixels.com/freebies/sort-switches-toggles-psd/ */ .switch-toggle.switch-candy, .switch-light.switch-candy > span { background-color: #2d3035; border-radius: 3px; box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.2); } .switch-light.switch-candy span span, .switch-light.switch-candy input:checked ~ span span:first-child, .switch-toggle.switch-candy label { color: #fff; font-weight: bold; text-align: center; text-shadow: 1px 1px 1px #191b1e; } .switch-light.switch-candy input ~ span span:first-child, .switch-light.switch-candy input:checked ~ span span:nth-child(2), .switch-candy input:checked + label { color: #333; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } .switch-candy a { border: 1px solid #333; border-radius: 3px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.45); background-color: #70c66b; background-image: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.2), transparent); background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), transparent); } .switch-candy-blue a { background-color: #38a3d4; } .switch-candy-yellow a { background-color: #f5e560; } /* iOS Theme */ .switch-ios.switch-light span span { color: #888b92; } .switch-ios.switch-light a { left: 0; top: 0; width: 32px; height: 32px; background-color: #fff; border-radius: 100%; border: 4px solid #D8D9DB; -webkit-transition: all 0.2s ease-out; -moz-transition: all 0.2s ease-out; transition: all 0.2s ease-out; } .switch-ios.switch-light > span { display: block; width: 100%; height: 32px; background-color: #D8D9DB; border-radius: 28px; -webkit-transition: all 0.4s ease-out; -moz-transition: all 0.4s ease-out; transition: all 0.4s ease-out; } .switch-ios.switch-light > span span { position: absolute; top: 0; left: 0; width: 100%; opacity: 0; line-height: 30px; vertical-align: middle; -webkit-transition: all 0.2s ease-out; -moz-transition: all 0.2s ease-out; transition: all 0.2s ease-out; } .switch-ios.switch-light > span span:first-of-type { opacity: 1; padding-left: 30px; } .switch-ios.switch-light > span span:last-of-type { padding-right: 30px; } .switch-ios.switch-light input:checked ~ span a { left: 100%; border-color: #4BD865; margin-left: -32px; } .switch-ios.switch-light input:checked ~ span { border-color: #4BD865; box-shadow: inset 0 0 0 30px #4BD865; } .switch-ios.switch-light input:checked ~ span span:first-of-type { opacity: 0; } .switch-ios.switch-light input:checked ~ span span:last-of-type { opacity: 1; color: #fff; } .switch-ios.switch-toggle { background-color: #D8D9DB; border-radius: 30px; box-shadow: inset rgba(0, 0, 0, 0.1) 0 1px 0; } .switch-ios.switch-toggle a { background-color: #4BD865; border: 2px solid #D8D9DB; border-radius: 28px; -webkit-transition: all 0.12s ease-out; -moz-transition: all 0.12s ease-out; transition: all 0.12s ease-out; } .switch-ios.switch-toggle label { height: 2.4em; color: #888b92; line-height: 2.4em; vertical-align: middle; } .switch-ios input:checked + label { color: #3e4043; } /* Holo Theme */ .switch-toggle.switch-holo, .switch-light.switch-holo > span { background-color: #464747; border-radius: 1px; box-shadow: inset rgba(0, 0, 0, 0.1) 0 1px 0; color: #fff; text-transform: uppercase; } .switch-holo label { color: #fff; } .switch-holo > span span { opacity: 0; -webkit-transition: all 0.1s; -moz-transition: all 0.1s; transition: all 0.1s; } .switch-holo > span span:first-of-type { opacity: 1; } .switch-holo > span span, .switch-holo label { font-size: 85%; line-height: 34.5px; } .switch-holo a { background-color: #666; border-radius: 1px; box-shadow: inset rgba(255, 255, 255, 0.2) 0 1px 0, inset rgba(0, 0, 0, 0.3) 0 -1px 0; } /* Selected ON switch-light */ .switch-holo.switch-light input:checked ~ span a { background-color: #0E88B1; } .switch-holo.switch-light input:checked ~ span span:first-of-type { opacity: 0; } .switch-holo.switch-light input:checked ~ span span:last-of-type { opacity: 1; } /* Material Theme */ /* switch-light */ .switch-light.switch-material a { top: -3px; width: 28px; height: 28px; border-radius: 50%; background: #fafafa; box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 2px -2px rgba(0, 0, 0, 0.2), 0 2px 4px 0 rgba(0, 0, 0, 0.12); -webkit-transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1); -moz-transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1); transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1); } .switch-material.switch-light { overflow: visible; } .switch-material.switch-light::after { clear: both; content: ""; display: table; } .switch-material.switch-light > span { overflow: visible; position: relative; top: 3px; width: 52px; height: 24px; min-height: auto; border-radius: 16px; background: rgba(0, 0, 0, 0.26); } .switch-material.switch-light span span { position: absolute; clip: rect(0 0 0 0); } .switch-material.switch-light input:checked ~ span a { right: 0; background: #3f51b5; box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.14), 0 3px 3px -2px rgba(0, 0, 0, 0.2), 0 1px 6px 0 rgba(0, 0, 0, 0.12); } .switch-material.switch-light input:checked ~ span { background: rgba(63, 81, 181, 0.5); } /* switch-toggle */ .switch-toggle.switch-material { overflow: visible; } .switch-toggle.switch-material::after { clear: both; content: ""; display: table; } .switch-toggle.switch-material a { top: 48%; width: 6px !important; height: 6px; margin-left: 4px; background: #3f51b5; border-radius: 100%; -webkit-transform: translateY(-50%); -moz-transform: translateY(-50%); -ms-transform: translateY(-50%); -o-transform: translateY(-50%); transform: translateY(-50%); -webkit-transition: -webkit-transform 0.4s ease-in; -moz-transition: -moz-transform 0.4s ease-in; transition: transform 0.4s ease-in; } .switch-toggle.switch-material label { color: rgba(0, 0, 0, 0.54); font-size: 1em; } .switch-toggle.switch-material label:before { content: ''; position: absolute; top: 48%; left: 0; display: block; width: 14px; height: 14px; border-radius: 100%; border: 2px solid rgba(0, 0, 0, 0.54); -webkit-transform: translateY(-50%); -moz-transform: translateY(-50%); -ms-transform: translateY(-50%); -o-transform: translateY(-50%); transform: translateY(-50%); } .switch-toggle.switch-material input:checked + label:before { border-color: #3f51b5; } /* ripple */ .switch-light.switch-material > span:before, .switch-light.switch-material > span:after, .switch-toggle.switch-material label:after { content: ''; position: absolute; top: 0; left: 0; z-index: 3; display: block; width: 64px; height: 64px; border-radius: 100%; background: #3f51b5; opacity: .4; margin-left: -20px; margin-top: -20px; -webkit-transform: scale(0); -moz-transform: scale(0); -ms-transform: scale(0); -o-transform: scale(0); transform: scale(0); -webkit-transition: opacity 0.4s ease-in; -moz-transition: opacity 0.4s ease-in; transition: opacity 0.4s ease-in; } .switch-light.switch-material > span:after { left: auto; right: 0; margin-left: 0; margin-right: -20px; } .switch-toggle.switch-material label:after { width: 52px; height: 52px; margin-top: -12px; } @-webkit-keyframes materialRipple { 0% { -webkit-transform: scale(0); } 20% { -webkit-transform: scale(1); } 100% { opacity: 0; -webkit-transform: scale(1); } } @-moz-keyframes materialRipple { 0% { -moz-transform: scale(0); } 20% { -moz-transform: scale(1); } 100% { opacity: 0; -moz-transform: scale(1); } } @keyframes materialRipple { 0% { -webkit-transform: scale(0); -moz-transform: scale(0); -ms-transform: scale(0); -o-transform: scale(0); transform: scale(0); } 20% { -webkit-transform: scale(1); -moz-transform: scale(1); -ms-transform: scale(1); -o-transform: scale(1); transform: scale(1); } 100% { opacity: 0; -webkit-transform: scale(1); -moz-transform: scale(1); -ms-transform: scale(1); -o-transform: scale(1); transform: scale(1); } } .switch-material.switch-light input:not(:checked) ~ span:after, .switch-material.switch-light input:checked ~ span:before, .switch-toggle.switch-material input:checked + label:after { -webkit-animation: materialRipple 0.4s ease-in; -moz-animation: materialRipple 0.4s ease-in; animation: materialRipple 0.4s ease-in; } /* trick to prevent the default checked ripple animation from showing * when the page loads. * the ripples are hidden by default, and shown only when the input is focused. */ .switch-light.switch-material.switch-light input ~ span:before, .switch-light.switch-material.switch-light input ~ span:after, .switch-material.switch-toggle input + label:after { visibility: hidden; } .switch-light.switch-material.switch-light input:focus:checked ~ span:before, .switch-light.switch-material.switch-light input:focus:not(:checked) ~ span:after, .switch-material.switch-toggle input:focus:checked + label:after { visibility: visible; } } /* Bugfix for older Webkit, including mobile Webkit. Adapted from * http://css-tricks.com/webkit-sibling-bug/ */ @media only screen and (-webkit-max-device-pixel-ratio: 2) and (max-device-width: 1280px) { .switch-light, .switch-toggle { -webkit-animation: webkitSiblingBugfix infinite 1s; } } @-webkit-keyframes webkitSiblingBugfix { from { -webkit-transform: translate3d(0, 0, 0); } to { -webkit-transform: translate3d(0, 0, 0); } } /*# sourceMappingURL=toggle-switch-px.css.map */
{ "content_hash": "b4c64bb29e291fd98d38ed4b7a950816", "timestamp": "", "source": "github", "line_count": 555, "max_line_length": 118, "avg_line_length": 31.897297297297296, "alnum_prop": 0.6197819578602497, "repo_name": "stljeff1/jw-grav", "id": "52de3edc4d8f6a8400a4a4d28dbc62bfeb779f44", "size": "17704", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "web-assets/scss/css-toggle-switch/toggle-switch-px.css", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "659929" }, { "name": "HTML", "bytes": "70553" }, { "name": "JavaScript", "bytes": "5808" }, { "name": "PHP", "bytes": "86" }, { "name": "Shell", "bytes": "41" } ], "symlink_target": "" }
Human, creative act that builds something of value. It is the pursuit of opportunity regardless of resources at hand. Requires vision and passion, commitment to lead and willingness to take calculated risks. * Entrepreneurship = Creativity + Innovation * New concept and/or new business required * No need to be the best, just be different * Not a way of going against competitors, but around them Constructive thinking: 70% creative thinking, 30% critical thinking. Broaden limits of perception, realise flexibility of perception. **Challenge assumptions**. Sources of new business ideas: * New twist to old business, Improve/substitute existing products * Be aware of everything * Recognise a need/trends * Combine Industries ### Business Model 1. Who does the company **serve** 2. What does the company **provide** 3. How does the company **make money** 4. How differentiates and sustains competitiveness 5. How it provides its product/service ### Process of Innovation 1. Screening ideas in search of opportunities 2. Assess the windows of opportunity 3. Develop product specifications and product process 4. Estimate initial costs for the new venture 5. Estimate the degree of risk for the venture ### Resources * Tangible: Physical resources * Intangible: e.g. brand name, knowledge * Organizational capability ### Value Value = Benefits / Price. Customers look for benefits, not features! ### Conceptual Skill The ability to think creatively about, analyze and understand complicated and abstract ideas. Top level business managers need to be able to look at their company as a holistic entity, to see the interrelationships between its divisions, and to understand how the firm fits into and affects its overall environment. ### Porters 5 Forces Model * Threat of new entrants (Patents, capital requirements, cost, brand equity) * Threat of substitute products or services (e.g. tap water substitutes softdrinks) * Bargaining power of customers (*Market of Outputs*, High when many alternatives are present) * Bargaining power of suppliers (*Market of Inputs*) * Intensity of competitive rivalry (Advertising expenses, advantage through innovation) ### Competitive Advantage Superiority by an organization when it can provide the same value at a lower price or when it can charge more money for greater value through differentiation. ## Management * Getting work done through others with a minimum of effort, waste or expense (Efficiency) * Effectiveness: accomplish tasks that help fulfull organizational objectives ### Management Functions 1. Planning: Determining goals and a means for achieving them 2. Organizing: Where decisions will be made, who will do what jobs and tasks 3. Leading: Inspiring and motivating workers to work hard 4. Controlling: Monitor progress toward goal achievement and taking corrective action #### Top Managers * CEO, COO, CFO, CIO * Overall direction of organization, create context for change * Develop employees' commitment and organizational culture * Monitor business environment #### Middle Managers * Plant manager, regional manager, divisional manager * Set objectives consistent with top management * Implement subunit strategies for achieving objectives, coordinate and like groups #### First-Line Managers * Office manager, shift supervisor, department manager * Train and supervise performance of employees, encourage, monitor and reward performance * Teach entry-level employees #### Team Leaders * Facilitate team activites toward a goal * Manage internal and external relationships ### Manegerial Roles * Interpersonal * Figurehead (ceremonial duties) * Leader (Motivate and encourage) * Laison (Deal with people outside their units) * Informational * Monitor environment * Disseminator (share information with subordinates) * Spokesperson (share information with outside of the company) * Decisional Roles * Entrepreneur (adapt themselves and subordinates to change) * Disturbance handler * Resource allocator #### Management Skills * **Technical Skills**: Important for Team Leaders and First-Line Managers * **Human Skills**: Important for everyone! * **Conceptual Skills**: Especially important for Top and Middle Manangers * **Motivation to Manage**: Especially important for Top and Middle Managers ### Mistakes * Insensitive to others, cold, aloof and arrogant * Betray trust, thinking of next job, playing politics * Specific performance problems with business * Overmanaging: unable to delegate or build a team * Unable to staff effectively, think strategically * Unable to adapt to boss with different style * Overdependent on advocate or mentor ## Organizational Environment & Culture ### External Environments * Environmental Change (Stable -> Dynamic -> Stable (Punctuated **Equilibrium Theory**)) * Environmental Complexity (Simple, Complex) * Resource Scarcity * Uncertainty (predictability of external changes and trends) #### General Environments * Sociocultural Trends (Demographic characteristics, behaviour and attitudes of people) * Technology * Economy (growing, shrinking) * Political/legal trends (decisions regulating business behavior) #### Specific Environments * Cosutomers (Reactive customer monitoring) * Competitors (Competitice analysis) * Suppliers (Dependence. Opportunistic behavior/relationship behavior) * Industry regulations (Consumer Product Safety, Department of Labor, Environmental Protection) * Advocacy groups (Media advocacy, product boycott) ### Organisational Culture * Organization's vision, values, norms, systems, symbols, language, assumptions, beliefs, and habits * Way of thinking and feeling * To succeed: * Consistency * Clear Mission * Employee Involvement * Adaptability * Sustaining a culture: * Selection (Hire individuals who will fit in with the culture) * Perform cultural audit/surveys, perform socialization through stories * Senior executives embody the culture * Changing a culture: * Incrementally get people to follow the culture or get them out * Make people understand the need for change, give training and rewards * Adapt mission, vision and create values ### Ethics & Social Responsibility Ethics: Learning what is the right thing, and then doing the right thing. However, definitions of *right* vary. Social Responsibility: Role of businesses in helping to cultivate and maintain highly ethical practices in society and and the natural environment through self-regulation in their business model. ##### Implementation: * Cost-benefit analysis featuring public image of the firm * Engagement plan with defined budget (scales prorammes importance) * Accounting, auditing and reporting ## Managing Teams ### Autonomy Degree to which workers have the discretion, freedom and independence to decide how and when to accomplish their jobs. (Higher for more self-designed teams) Self-managed teams have **leadership within the team**, team member **roles are interchangeable**, they have a **flexible task design** and are usually **multiskilled**. ### Social Loafing When people exert less effort to achieve a goal when they work in a group. * Increase identifiability of group members for greater motivation * Make members feel their ideas being valued and essential to the success * Set goals ### Cross-functional Team Group of people with different functional expertise working towards a common goal. * Greater scope of information * Less unidirectional, better communications * Greater range of users (information has to be understandable for all) ### Virtual Team Group that works distributed across time, space and organizational boundaries. ### Project Team Members of usually different groups joined and assigned to activites for the same project. ### Work Team Characteristics * Team Norms: Informally agreed-on standards that regulate behavior * Team cohesiveness: Attraction and motivation of members towards staying in a team * Team size: Large groups make it hard to get to know one another, small groups may lack diversity and knowledge * Team conflict * Cognitive conflict: Members disagree because of different expertise * Affective conflict: Results in hostility, anger, resentment and distrust * Good fight: coomon goal, work with information, inject humor, balance of power * Stages of team development (Forming, Storming, Norming, Performing, De-Norming, De-Storming, De-Forming) ### Team Compensation * Skill-based pay (pay for learning additional skills) * Gainsharing (company share financial value of performance gain with workers) * Nonfinancial rewards (vacation, Tshirt, awards) ## Managing HR Systems * Attracting Qualified Employees (Recruiting, Selection) * Developing Qualified Employees (Training, Performance Appraisal) * Keeping Qualified Employess (Compenstation, Separation) ### Employment Laws #### Disparate Treatment US Civil Rights Act prohibits treating employees different because of membership in a protected class (race, color, religion, pregnancy, age). #### Adverse Impact Measures the effect an employment practice has on a protected class in regards of hiring, promotion or others. #### The 80% Rule Compare % of hiring rates amongst men and women. If smaller is less than 80% of bigger, there might be a discrimination problem. ### Sexual Harassment * Quid pro quo harassment * Hostile work environment * Respond immediately, clear sexual harassment policy * Establish clear reporting procedures * Be aware of local and state laws and enforcement ### Recruiting * Job description: basic tasks, duties, responsibilities * Job specification: qualifications needed * Internal Recruiting: Developing pool of qualified job applicants from people who already work within the company * External Recruiting: Developing pool of qualified job applicants from outside the company * Applications Forms: May only ask for job-related information * Background checks: Verify accuary of information applicants provide about themselves * Employment reference * Selection tests: Specific ability tests, cignitive ability tests, biographical data, work sample tests, assessment centers * **Staffing**: Selection and Training of individuals for specific job functions #### Interviews * Unstructured (Interviwer can ask whatever he wants, hard to compare) * Structured (Fixed set of questions) * Situational questions (hypothetical situation) * Behavioral questions (what did applicants do in previous jobs) * Background questions (experience, education) * Job-knowledge questions * Semistructured (Mixed approach) ### Performance Appraisal The process of appraising how well employee are doing their jobs. * Objective performance measures (output, sales) * Subjective performance measures (judge or assess) * 360 degree feedback (feedback from the boss, subordinates, peers and coworkers, and employee himself) ### Compensation Financial and nonfinancial rewards that organizations give employees in exchange for their work. * Pay-lavel decisions (above or below current market wages) * Pay-variability decisions: Piecework, commission, profit sharing, stock options * Hierarchical pay structure * Compressed pay structure ### Employment Separation Loss of an employee for any reason. * Involuntary separation * Firering not as the first option, always fired in private * Provide clear reasons * Avoid laying off employees with critical skills/knowledge * Voluntary separation * Downsizing: planned elimination of jobs * Early retirement incentive programm (financial benefit for retireing early) * Functional turnover: The good people are staying * Dysfunctional turnover: The good people are leaving ## Motivation The set of forces that initiates, directs and makes people persist in their efforts to accomplish a goal. Job Performance = Motivation * Ability * Situational Constraints ### Need Satisfaction * Needs: the physical or psychological requirements that must be met to ensure survival and well-being * People are motivated by unmet needs * Maslow: Needs are arranged in a **hierarchy** from low to high * Alderfer: People can be motivated by **more than one need at a time** * McClelland: Degree which needs motivate varies between persons * Relative importants of needs may change over time * Difficult to predict which higher-order needs will motivate employees' behavior ### Rewards * **Extrinsic** Rewards: Tangible and visible to others, don't motivate very strong * **Intrinsic** Rewards: Natural rewards associated with performing a task ### Equity Theory People will be motivated at work when they **perceive** that they are being treated fairly. Stresses the importance of perceptions. * Inputs: What the employee gives (time, loyalty, skill) * Outcomes: Positive and negative consequences (salary, praise, thanks) * Referents: People and positions to compare yourself to * Underrewarded * Overredwarded #### Reacting to Inequity * Decreasing or withholding inputs * Increasing outcomes * Rationalize or distort inputs to outcomes * Changing the referent * Employees may leave ### Expectancy People will be motivated to the extent to which they believe that their efforts lead to good performance and that good performance will be rewarded attractively. Motivation = Velence * Expectancy * Instrumentality * Systematically gather information about what employees want from their jobs * Link rewards to individual performance in a clear way ### Reinforcement Theory * Positive reinforcement: add reward to increase behavior * Negative reinforcement: remove punishment to increase behavior * Positive punishment: Add punishment to decrease behavior * Negative punishment: remove reward to decrease behavior Extinction: using reinforcement until behavior is not shown anymore. ### Goal-Setting Theory People will be motivated to the extent that they accept specific, challenging goals and receive feedback that indicate their progress. * Goal specificity * Goal difficulty * Goal acceptance * Performance feedback ## Leadership Opne eprson influencing another to willingly work toward a predetermined objective. Effective: a balance of traits and skills, leadership styles or beavhiors right for a particular situation. * Planning: Choose appropriate goals and courses of action to achieve them * Organizing: Establish task and authority relationships * Leading: Motivate, coordinate and energize individuals to work together * Controlling: Establish accurate measuring and monitoring systems to evaluate the organization * Leaders: Vision and direction, align employees, inspire and motivate * Managers: Plan and budget, organize, control ### Foundation * **Power** (position and individual power) * **Traits** (unchanging characteristics that predispose a particular way) * **Behaviour** (the leadership style chosen) ### Individual Power * **Position Power** * Legitimate power (derived from job position) * Reward power (control of rewards and benefits) * Coercive power (dependent on fear, suppression) * Information power * **Personal Power** * Rational persuasion * Referent power (aquired from being will liked or respected) * Expert power (ability to influence based on expertise) ### Providing a Vision * Mission Statement * Thinking like a leader (Identify what is happening, Account for what is happening, Formulate Leader Actions) ### Leadership styles * Fiedler's Contingency Leadership Styles. Contingecy factors: * Leader-Member realtion: good/poor * Task Structure: high/low * Position Power: strong/weak * Hersey & Blanchard's Situational Leadership Styles: most effective style defpends on the extent to which followers require guidance, direction and emotional support 1. **Telling** * High task, low relationship focus * Provide specific instructions and closely supervises performance * Good for early stage of work employee 2. **Selling** * High task, high relationship focus * Explain directions and praise appropriate behaviour * Good for improving abilities but failing drive epmloyee 3. **Participating** * Low task, high relationship focus * Make decisions together * Good for high ability but lacking drive 4. **Delegating** * Low task, low relationship focus * Turn over task accmomplishment to follower * Good for both high level of ability and drive ## Change ### Sources and Effects of Change * Usually factors outside the company * Required for survival * Changes implemented under crisis are highly risky ### Resisting Change * Lack of information or honest disagreement over the facts concerning change * Personal and emotional fear of loss of job, relationships, and/or status * Personality traits: poor self-image, low tolerance for ambiguity and risk * Change creates competing commitments ### Adapting to Change (Kurt Lewin) 1. **Unfreezing** (Explain, reduce forces for status quo, present problem or event to get people recognize need for change) 2. **Moving** (Train, schedule, actually altering the behaviors, values and attitudes) 3. **Refreezing** (Reward, prevent return to old system by instituting new procedures) ### Areas of Change * Firm's strategy * Technological Change (the way products are created and marketed) * Structural Change (organization structure) * Cultural Change (Change basic values amployees share) ### Manager's Rule * **Transactional** Role (for **routine task**) * Focus on the task at hand * Apply leadership stles based on tasks and relationship orientations * **Transformational** Role (for **managing change**) * Focus on company's mission, strategies, change * Lead through inspiration and commitment ## Misc. ### Reverse Mentoring Typically younger employees that are more knowing of a particular field mentor typically older superiors or collegues. Effectiveness: * Communication culture in company * Willigness of older to learn * Subject of mentoring (technolgoy) ### Realistic Job Previews Early stage of personell selection, provide information on both positive and negative aspects of the job. Employee enters contract with their eyes open, knowing not only what the organization will provide but also what is expected from him. RJPs prevent a high turnover rate for new hires. ### Reliability & Validity * Reliability: Producing stable and consistent resulst. * Validity: How well a test measures what it is purported to measure. ### Dimensions of Service Quality * Reliability: Perform promised service dependably and accurately * Responsiveness: Willingness to help customers promptly * Assurance: Ability to convey trust and confidence (being polite and showing respect) * Empathy: Ability to be approachable (being a good listener) * Tangibles: Physical facilities (cleanliness) ### Perceived Service Quality * Word of mouth * Personal needs -> Expected Service * Past Experience * Service Quality -> Perceived Service ### Service Recovery Framework 1. Service Failure Occurs -> Service Recovery Expectations * Severity of Failure * Perceived Service Quality * Customer Loyalty * Service Guaranty 2. Provider Aware of Failure -> Service Recovery * Psychological: empathy * Tangible: fair fix, value add * Speed of Recovery 3. Fair Restitution -> Follow up Service Recovery * Psychological: apology, show interest * Tangible: give small token
{ "content_hash": "0981eaf9e5d3169d0a3110ee77708fda", "timestamp": "", "source": "github", "line_count": 461, "max_line_length": 315, "avg_line_length": 41.78741865509761, "alnum_prop": 0.7898151993355482, "repo_name": "iStefo/uni", "id": "12faba8dd1083d601c5df6ef3134cecf94050a7f", "size": "19313", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "hrm/exam.md", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package com.guokm.tibetanroot.activity; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.chanven.lib.cptr.PtrClassicFrameLayout; import com.chanven.lib.cptr.PtrDefaultHandler; import com.chanven.lib.cptr.PtrFrameLayout; import com.chanven.lib.cptr.loadmore.OnLoadMoreListener; import com.guokm.tibetanroot.R; import com.guokm.tibetanroot.adapter.TopicsItemAdapter; import com.guokm.tibetanroot.domain.Collection; import com.guokm.tibetanroot.domain.Topic; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import butterknife.OnItemClick; public class CollectionActivity extends BaseActivity { @BindView(R.id.back_button) Button back_button; @BindView(R.id.title_text) TextView title_text; @BindView(R.id.freshtime_tv) TextView freshtimeTv; @BindView(R.id.search_button) Button search_button; @BindView(R.id.title) RelativeLayout titleLayout; @BindView(R.id.message_lv) ListView messageLv; private List<Collection> itemList= new ArrayList<Collection>(); private PtrClassicFrameLayout ptrFrame_message; /* private RelativeLayout titleLayout; private Button back_button; private TextView title_text; private Button search_button;*/ int page=0; Handler handler=new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_message); ButterKnife.bind(this); initView(); ; } private void initView() { // getData(page); /* titleLayout = (RelativeLayout) findViewById(R.id.title); back_button = (Button) titleLayout.findViewById(R.id.back_button); title_text = (TextView) titleLayout.findViewById(R.id.title_text); search_button = (Button) titleLayout.findViewById(R.id.search_button);*/ title_text.setText("我的收藏"); back_button.setVisibility(View.VISIBLE); search_button.setVisibility(View.GONE); final TopicsItemAdapter adapter=new TopicsItemAdapter(this,itemList); messageLv.setAdapter(adapter); ptrFrame_message = (PtrClassicFrameLayout) findViewById(R.id.message_list_view_frame); ptrFrame_message.setAutoLoadMoreEnable(true);//自动下载下一页,不用点击"记载下一页的条目" ptrFrame_message.postDelayed(new Runnable() {//自动刷新 @Override public void run() { ptrFrame_message.autoRefresh(true); } }, 150); ptrFrame_message.setPtrHandler(new PtrDefaultHandler() { @Override public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) { return PtrDefaultHandler.checkContentCanBePulledDown(frame, content, header); } @Override public void onRefreshBegin(PtrFrameLayout frame) { //该方法中访问请求第一次数据的接口返回的数据(可能是第一页数据) handler.postDelayed(new Runnable() { @Override public void run() { page = 0; itemList.clear(); getData(page); adapter.notifyDataSetChanged(); ptrFrame_message.refreshComplete(); page++; if (!ptrFrame_message.isLoadMoreEnable()) { ptrFrame_message.setLoadMoreEnable(true); } } }, 1500); } }); ptrFrame_message.setOnLoadMoreListener(new OnLoadMoreListener() { @Override public void loadMore() { //该方法请求第二/三/四。。。 的数据,来展示下一页。----后台分页数据加载 handler.postDelayed(new Runnable() { @Override public void run() { getData(page); // itemList.add(new String(" ListView item - add " + page)); adapter.notifyDataSetChanged(); ptrFrame_message.loadMoreComplete(true); Toast.makeText(CollectionActivity.this, "第"+page+"页加载完毕", Toast.LENGTH_SHORT) .show(); if (page == 1) { //当为第五页时,停止加载更多 //set load more disable ptrFrame_message.setLoadMoreEnable(false); Toast.makeText(CollectionActivity.this, "已经全部加载完毕", Toast.LENGTH_SHORT) .show(); } page++; } }, 1000); } }); } @OnItemClick(R.id.message_lv) void OnItemClick(AdapterView<?> adapterView, View view, int position, long l){ //listview item的点击事件 // Intent intent=new Intent(TopicActivity.this,MessageDetailActivity.class); // Bundle bundle=new Bundle(); // bundle.putString("title",itemList.get(position).getTitle()); // intent.putExtras(bundle); // startActivity(intent); // Toast.makeText(MessageActivity.this,itemList.get(position).toString(),Toast.LENGTH_SHORT).show(); } @OnClick(R.id.back_button) void onClickaa(View view) { //返回键点击事件 this.finish(); } /** * 造假数据 */ public void getData(int page){ for (int i=1;i<21;i++){ itemList.add(new Collection("郭大大","我是"+i+"只徐达灰会挥发"+page,"imageurl")); } } }
{ "content_hash": "036ea34ba95cf1982546c3f635bf2051", "timestamp": "", "source": "github", "line_count": 167, "max_line_length": 107, "avg_line_length": 35.221556886227546, "alnum_prop": 0.5936756205372322, "repo_name": "guokmTest/TibetanRoot", "id": "48ad914536b7f7b9e4afd17311d48c9b742e6de7", "size": "6172", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/guokm/tibetanroot/activity/CollectionActivity.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "151048" } ], "symlink_target": "" }
/****************************************************************************** * * Module Name: aslxref - Namespace cross-reference * *****************************************************************************/ /* * Copyright (C) 2000 - 2013, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions, and the following disclaimer, * without modification. * 2. Redistributions in binary form must reproduce at minimum a disclaimer * substantially similar to the "NO WARRANTY" disclaimer below * ("Disclaimer") and any redistribution must be conditioned upon * including a substantially similar Disclaimer requirement for further * binary redistribution. * 3. Neither the names of the above-listed copyright holders nor the names * of any contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * NO WARRANTY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. */ #include "aslcompiler.h" #include "aslcompiler.y.h" #include "acparser.h" #include "amlcode.h" #include "acnamesp.h" #include "acdispat.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslxref") /* Local prototypes */ static ACPI_STATUS XfNamespaceLocateBegin ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context); static ACPI_STATUS XfNamespaceLocateEnd ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context); static BOOLEAN XfObjectExists ( char *Name); static ACPI_STATUS XfCompareOneNamespaceObject ( ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue); static void XfCheckFieldRange ( ACPI_PARSE_OBJECT *Op, UINT32 RegionBitLength, UINT32 FieldBitOffset, UINT32 FieldBitLength, UINT32 AccessBitWidth); /******************************************************************************* * * FUNCTION: XfCrossReferenceNamespace * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Perform a cross reference check of the parse tree against the * namespace. Every named referenced within the parse tree * should be get resolved with a namespace lookup. If not, the * original reference in the ASL code is invalid -- i.e., refers * to a non-existent object. * * NOTE: The ASL "External" operator causes the name to be inserted into the * namespace so that references to the external name will be resolved * correctly here. * ******************************************************************************/ ACPI_STATUS XfCrossReferenceNamespace ( void) { ACPI_WALK_STATE *WalkState; DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n"); /* * Create a new walk state for use when looking up names * within the namespace (Passed as context to the callbacks) */ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); if (!WalkState) { return (AE_NO_MEMORY); } /* Walk the entire parse tree */ TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, XfNamespaceLocateBegin, XfNamespaceLocateEnd, WalkState); return (AE_OK); } /******************************************************************************* * * FUNCTION: XfObjectExists * * PARAMETERS: Name - 4 char ACPI name * * RETURN: TRUE if name exists in namespace * * DESCRIPTION: Walk the namespace to find an object * ******************************************************************************/ static BOOLEAN XfObjectExists ( char *Name) { ACPI_STATUS Status; /* Walk entire namespace from the supplied root */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, XfCompareOneNamespaceObject, NULL, Name, NULL); if (Status == AE_CTRL_TRUE) { /* At least one instance of the name was found */ return (TRUE); } return (FALSE); } /******************************************************************************* * * FUNCTION: XfCompareOneNamespaceObject * * PARAMETERS: ACPI_WALK_CALLBACK * * RETURN: Status * * DESCRIPTION: Compare name of one object. * ******************************************************************************/ static ACPI_STATUS XfCompareOneNamespaceObject ( ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue) { ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; /* Simply check the name */ if (*((UINT32 *) (Context)) == Node->Name.Integer) { /* Abort walk if we found one instance */ return (AE_CTRL_TRUE); } return (AE_OK); } /******************************************************************************* * * FUNCTION: XfCheckFieldRange * * PARAMETERS: RegionBitLength - Length of entire parent region * FieldBitOffset - Start of the field unit (within region) * FieldBitLength - Entire length of field unit * AccessBitWidth - Access width of the field unit * * RETURN: None * * DESCRIPTION: Check one field unit to make sure it fits in the parent * op region. * * Note: AccessBitWidth must be either 8,16,32, or 64 * ******************************************************************************/ static void XfCheckFieldRange ( ACPI_PARSE_OBJECT *Op, UINT32 RegionBitLength, UINT32 FieldBitOffset, UINT32 FieldBitLength, UINT32 AccessBitWidth) { UINT32 FieldEndBitOffset; /* * Check each field unit against the region size. The entire * field unit (start offset plus length) must fit within the * region. */ FieldEndBitOffset = FieldBitOffset + FieldBitLength; if (FieldEndBitOffset > RegionBitLength) { /* Field definition itself is beyond the end-of-region */ AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL); return; } /* * Now check that the field plus AccessWidth doesn't go beyond * the end-of-region. Assumes AccessBitWidth is a power of 2 */ FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth); if (FieldEndBitOffset > RegionBitLength) { /* Field definition combined with the access is beyond EOR */ AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL); } } /******************************************************************************* * * FUNCTION: XfNamespaceLocateBegin * * PARAMETERS: ASL_WALK_CALLBACK * * RETURN: Status * * DESCRIPTION: Descending callback used during cross-reference. For named * object references, attempt to locate the name in the * namespace. * * NOTE: ASL references to named fields within resource descriptors are * resolved to integer values here. Therefore, this step is an * important part of the code generation. We don't know that the * name refers to a resource descriptor until now. * ******************************************************************************/ static ACPI_STATUS XfNamespaceLocateBegin ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) { ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_OBJECT_TYPE ObjectType; char *Path; UINT8 PassedArgs; ACPI_PARSE_OBJECT *NextOp; ACPI_PARSE_OBJECT *OwningOp; ACPI_PARSE_OBJECT *SpaceIdOp; UINT32 MinimumLength; UINT32 Offset; UINT32 FieldBitLength; UINT32 TagBitLength; UINT8 Message = 0; const ACPI_OPCODE_INFO *OpInfo; UINT32 Flags; ACPI_FUNCTION_TRACE_PTR (XfNamespaceLocateBegin, Op); /* * If this node is the actual declaration of a name * [such as the XXXX name in "Method (XXXX)"], * we are not interested in it here. We only care about names that are * references to other objects within the namespace and the parent objects * of name declarations */ if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) { return_ACPI_STATUS (AE_OK); } /* We are only interested in opcodes that have an associated name */ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); if ((!(OpInfo->Flags & AML_NAMED)) && (!(OpInfo->Flags & AML_CREATE)) && (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) { return_ACPI_STATUS (AE_OK); } /* * One special case: CondRefOf operator - we don't care if the name exists * or not at this point, just ignore it, the point of the operator is to * determine if the name exists at runtime. */ if ((Op->Asl.Parent) && (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) { return_ACPI_STATUS (AE_OK); } /* * We must enable the "search-to-root" for single NameSegs, but * we have to be very careful about opening up scopes */ Flags = ACPI_NS_SEARCH_PARENT; if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) { /* * These are name references, do not push the scope stack * for them. */ Flags |= ACPI_NS_DONT_OPEN_SCOPE; } /* Get the NamePath from the appropriate place */ if (OpInfo->Flags & AML_NAMED) { /* For nearly all NAMED operators, the name reference is the first child */ Path = Op->Asl.Child->Asl.Value.String; if (Op->Asl.AmlOpcode == AML_ALIAS_OP) { /* * ALIAS is the only oddball opcode, the name declaration * (alias name) is the second operand */ Path = Op->Asl.Child->Asl.Next->Asl.Value.String; } } else if (OpInfo->Flags & AML_CREATE) { /* Name must appear as the last parameter */ NextOp = Op->Asl.Child; while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) { NextOp = NextOp->Asl.Next; } Path = NextOp->Asl.Value.String; } else { Path = Op->Asl.Value.String; } ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Type=%s\n", AcpiUtGetTypeName (ObjectType))); /* * Lookup the name in the namespace. Name must exist at this point, or it * is an invalid reference. * * The namespace is also used as a lookup table for references to resource * descriptors and the fields within them. */ Gbl_NsLookupCount++; Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node)); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) { /* * We didn't find the name reference by path -- we can qualify this * a little better before we print an error message */ if (strlen (Path) == ACPI_NAME_SIZE) { /* A simple, one-segment ACPI name */ if (XfObjectExists (Path)) { /* * There exists such a name, but we couldn't get to it * from this scope */ AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op, Op->Asl.ExternalName); } else { /* The name doesn't exist, period */ AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName); } } else { /* Check for a fully qualified path */ if (Path[0] == AML_ROOT_PREFIX) { /* Gave full path, the object does not exist */ AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName); } else { /* * We can't tell whether it doesn't exist or just * can't be reached. */ AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, Op->Asl.ExternalName); } } Status = AE_OK; } return_ACPI_STATUS (Status); } /* Check for a reference vs. name declaration */ if (!(OpInfo->Flags & AML_NAMED) && !(OpInfo->Flags & AML_CREATE)) { /* This node has been referenced, mark it for reference check */ Node->Flags |= ANOBJ_IS_REFERENCED; } /* Attempt to optimize the NamePath */ OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node); /* * 1) Dereference an alias (A name reference that is an alias) * Aliases are not nested, the alias always points to the final object */ if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) && (Node->Type == ACPI_TYPE_LOCAL_ALIAS)) { /* This node points back to the original PARSEOP_ALIAS */ NextOp = Node->Op; /* The first child is the alias target op */ NextOp = NextOp->Asl.Child; /* That in turn points back to original target alias node */ if (NextOp->Asl.Node) { Node = NextOp->Asl.Node; } /* Else - forward reference to alias, will be resolved later */ } /* 2) Check for a reference to a resource descriptor */ if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) || (Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) { /* * This was a reference to a field within a resource descriptor. * Extract the associated field offset (either a bit or byte * offset depending on the field type) and change the named * reference into an integer for AML code generation */ Offset = Node->Value; TagBitLength = Node->Length; /* * If a field is being created, generate the length (in bits) of * the field. Note: Opcodes other than CreateXxxField and Index * can come through here. For other opcodes, we just need to * convert the resource tag reference to an integer offset. */ switch (Op->Asl.Parent->Asl.AmlOpcode) { case AML_CREATE_FIELD_OP: /* Variable "Length" field, in bits */ /* * We know the length operand is an integer constant because * we know that it contains a reference to a resource * descriptor tag. */ FieldBitLength = (UINT32) Op->Asl.Next->Asl.Value.Integer; break; case AML_CREATE_BIT_FIELD_OP: FieldBitLength = 1; break; case AML_CREATE_BYTE_FIELD_OP: case AML_INDEX_OP: FieldBitLength = 8; break; case AML_CREATE_WORD_FIELD_OP: FieldBitLength = 16; break; case AML_CREATE_DWORD_FIELD_OP: FieldBitLength = 32; break; case AML_CREATE_QWORD_FIELD_OP: FieldBitLength = 64; break; default: FieldBitLength = 0; break; } /* Check the field length against the length of the resource tag */ if (FieldBitLength) { if (TagBitLength < FieldBitLength) { Message = ASL_MSG_TAG_SMALLER; } else if (TagBitLength > FieldBitLength) { Message = ASL_MSG_TAG_LARGER; } if (Message) { snprintf (MsgBuffer, sizeof(MsgBuffer), "Size mismatch, Tag: %u bit%s, Field: %u bit%s", TagBitLength, (TagBitLength > 1) ? "s" : "", FieldBitLength, (FieldBitLength > 1) ? "s" : ""); AslError (ASL_WARNING, Message, Op, MsgBuffer); } } /* Convert the BitOffset to a ByteOffset for certain opcodes */ switch (Op->Asl.Parent->Asl.AmlOpcode) { case AML_CREATE_BYTE_FIELD_OP: case AML_CREATE_WORD_FIELD_OP: case AML_CREATE_DWORD_FIELD_OP: case AML_CREATE_QWORD_FIELD_OP: case AML_INDEX_OP: Offset = ACPI_DIV_8 (Offset); break; default: break; } /* Now convert this node to an integer whose value is the field offset */ Op->Asl.AmlLength = 0; Op->Asl.ParseOpcode = PARSEOP_INTEGER; Op->Asl.Value.Integer = (UINT64) Offset; Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; OpcGenerateAmlOpcode (Op); } /* 3) Check for a method invocation */ else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) && (Node->Type == ACPI_TYPE_METHOD) && (Op->Asl.Parent) && (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD)) || (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) { /* * A reference to a method within one of these opcodes is not an * invocation of the method, it is simply a reference to the method. */ if ((Op->Asl.Parent) && ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) || (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) || (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE))) { return_ACPI_STATUS (AE_OK); } /* * There are two types of method invocation: * 1) Invocation with arguments -- the parser recognizes this * as a METHODCALL. * 2) Invocation with no arguments --the parser cannot determine that * this is a method invocation, therefore we have to figure it out * here. */ if (Node->Type != ACPI_TYPE_METHOD) { snprintf (MsgBuffer, sizeof(MsgBuffer), "%s is a %s", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer); return_ACPI_STATUS (AE_OK); } /* Save the method node in the caller's op */ Op->Asl.Node = Node; if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF) { return_ACPI_STATUS (AE_OK); } /* * This is a method invocation, with or without arguments. * Count the number of arguments, each appears as a child * under the parent node */ Op->Asl.ParseOpcode = PARSEOP_METHODCALL; UtSetParseOpName (Op); PassedArgs = 0; NextOp = Op->Asl.Child; while (NextOp) { PassedArgs++; NextOp = NextOp->Asl.Next; } if (Node->Value != ASL_EXTERNAL_METHOD) { /* * Check the parsed arguments with the number expected by the * method declaration itself */ if (PassedArgs != Node->Value) { snprintf (MsgBuffer, sizeof(MsgBuffer), "%s requires %u", Op->Asl.ExternalName, Node->Value); if (PassedArgs < Node->Value) { AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer); } else { AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer); } } } } /* 4) Check for an ASL Field definition */ else if ((Op->Asl.Parent) && ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) || (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD))) { /* * Offset checking for fields. If the parent operation region has a * constant length (known at compile time), we can check fields * defined in that region against the region length. This will catch * fields and field units that cannot possibly fit within the region. * * Note: Index fields do not directly reference an operation region, * thus they are not included in this check. */ if (Op == Op->Asl.Parent->Asl.Child) { /* * This is the first child of the field node, which is * the name of the region. Get the parse node for the * region -- which contains the length of the region. */ OwningOp = Node->Op; Op->Asl.Parent->Asl.ExtraValue = ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer); /* Examine the field access width */ switch ((UINT8) Op->Asl.Parent->Asl.Value.Integer) { case AML_FIELD_ACCESS_ANY: case AML_FIELD_ACCESS_BYTE: case AML_FIELD_ACCESS_BUFFER: default: MinimumLength = 1; break; case AML_FIELD_ACCESS_WORD: MinimumLength = 2; break; case AML_FIELD_ACCESS_DWORD: MinimumLength = 4; break; case AML_FIELD_ACCESS_QWORD: MinimumLength = 8; break; } /* * Is the region at least as big as the access width? * Note: DataTableRegions have 0 length */ if (((UINT32) OwningOp->Asl.Value.Integer) && ((UINT32) OwningOp->Asl.Value.Integer < MinimumLength)) { AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL); } /* * Check EC/CMOS/SMBUS fields to make sure that the correct * access type is used (BYTE for EC/CMOS, BUFFER for SMBUS) */ SpaceIdOp = OwningOp->Asl.Child->Asl.Next; switch ((UINT32) SpaceIdOp->Asl.Value.Integer) { case ACPI_ADR_SPACE_EC: case ACPI_ADR_SPACE_CMOS: case ACPI_ADR_SPACE_GPIO: if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE) { AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL); } break; case ACPI_ADR_SPACE_SMBUS: case ACPI_ADR_SPACE_IPMI: case ACPI_ADR_SPACE_GSBUS: if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER) { AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL); } break; default: /* Nothing to do for other address spaces */ break; } } else { /* * This is one element of the field list. Check to make sure * that it does not go beyond the end of the parent operation region. * * In the code below: * Op->Asl.Parent->Asl.ExtraValue - Region Length (bits) * Op->Asl.ExtraValue - Field start offset (bits) * Op->Asl.Child->Asl.Value.Integer32 - Field length (bits) * Op->Asl.Child->Asl.ExtraValue - Field access width (bits) */ if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child) { XfCheckFieldRange (Op, Op->Asl.Parent->Asl.ExtraValue, Op->Asl.ExtraValue, (UINT32) Op->Asl.Child->Asl.Value.Integer, Op->Asl.Child->Asl.ExtraValue); } } } Op->Asl.Node = Node; return_ACPI_STATUS (Status); } /******************************************************************************* * * FUNCTION: XfNamespaceLocateEnd * * PARAMETERS: ASL_WALK_CALLBACK * * RETURN: Status * * DESCRIPTION: Ascending callback used during cross reference. We only * need to worry about scope management here. * ******************************************************************************/ static ACPI_STATUS XfNamespaceLocateEnd ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) { ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; const ACPI_OPCODE_INFO *OpInfo; ACPI_FUNCTION_TRACE (XfNamespaceLocateEnd); /* We are only interested in opcodes that have an associated name */ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); if (!(OpInfo->Flags & AML_NAMED)) { return_ACPI_STATUS (AE_OK); } /* Not interested in name references, we did not open a scope for them */ if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) { return_ACPI_STATUS (AE_OK); } /* Pop the scope stack if necessary */ if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode))) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%s: Popping scope for Op %p\n", AcpiUtGetTypeName (OpInfo->ObjectType), Op)); (void) AcpiDsScopeStackPop (WalkState); } return_ACPI_STATUS (AE_OK); }
{ "content_hash": "419824223c95f10b78362b78be93151a", "timestamp": "", "source": "github", "line_count": 886, "max_line_length": 106, "avg_line_length": 31.279909706546274, "alnum_prop": 0.5296961824348705, "repo_name": "execunix/vinos", "id": "349c8f92b6348d77cdabb59d9954930fce2e3565", "size": "27714", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sys/external/bsd/acpica/dist/compiler/aslxref.c", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
#import "ZXAztecToken.h" @interface ZXAztecSimpleToken : ZXAztecToken - (id)initWithPrevious:(ZXAztecToken *)previous value:(int)value bitCount:(int)bitCount; @end
{ "content_hash": "03b6c90c0bf98cbd1ff1ce37a0269978", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 88, "avg_line_length": 19.77777777777778, "alnum_prop": 0.7359550561797753, "repo_name": "hgl888/TeamTalk", "id": "1b10664cf535fbb584377e8a5bca896ceb06f0d4", "size": "789", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ios/ZXing/aztec/encoder/ZXAztecSimpleToken.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "954" }, { "name": "C", "bytes": "6876692" }, { "name": "C++", "bytes": "6166474" }, { "name": "CMake", "bytes": "18145" }, { "name": "CSS", "bytes": "130576" }, { "name": "GLSL", "bytes": "122436" }, { "name": "Groff", "bytes": "3850" }, { "name": "HTML", "bytes": "31811" }, { "name": "Java", "bytes": "1838380" }, { "name": "JavaScript", "bytes": "240007" }, { "name": "M4", "bytes": "1876" }, { "name": "Makefile", "bytes": "219138" }, { "name": "Matlab", "bytes": "4296" }, { "name": "Objective-C", "bytes": "21065461" }, { "name": "Objective-C++", "bytes": "90309" }, { "name": "PHP", "bytes": "1387624" }, { "name": "Protocol Buffer", "bytes": "401345" }, { "name": "Python", "bytes": "92019" }, { "name": "Ruby", "bytes": "8845" }, { "name": "Shell", "bytes": "82354" } ], "symlink_target": "" }
Lightweight simple translation module with dynamic json storage. Supports plain vanilla node.js apps and should work with any framework (like _express_, _restify_ and probably more) that exposes an `app.use()` method passing in `res` and `req` objects. Uses common __('...') syntax in app and templates. Stores language files in json files compatible to [webtranslateit](http://webtranslateit.com/) json format. Adds new strings on-the-fly when first used in your app. No extra parsing needed. [![Linux/OSX Build][travis-image]][travis-url] [![Windows Build][appveyor-image]][appveyor-url] [![NPM version][npm-image]][npm-url] [![Dependency Status][dependency-image]][dependency-url] [![Test Coverage][coveralls-image]][coveralls-url] ## Install ```sh npm install i18n --save ``` ## Test ```sh npm test ``` ## Load ```js // load modules var express = require('express'), i18n = require("i18n"); ``` ## Configure Minimal example, just setup two locales and a project specific directory ```js i18n.configure({ locales:['en', 'de'], directory: __dirname + '/locales' }); ``` now you are ready to use a global `i18n.__('Hello')`. ## Example usage in global scope In your cli, when not registered to a specific object: ```js var greeting = i18n.__('Hello'); ``` > **Global** assumes you share a common state of localization in any time and any part of your app. This is usually fine in cli-style scripts. When serving responses to http requests you'll need to make sure that scope is __NOT__ shared globally but attached to your request object. ## Example usage in express.js In an express app, you might use i18n.init to gather language settings of your visitors and also bind your helpers to response object honoring request objects locale, ie: ```js // Configuration app.configure(function() { [...] // default: using 'accept-language' header to guess language settings app.use(i18n.init); [...] }); ``` in your apps methods: ```js app.get('/de', function(req, res){ var greeting = res.__('Hello'); }); ``` in your templates (depending on your template engine) ```ejs <%= __('Hello') %> ${__('Hello')} ``` ## Examples for common setups See [tested examples](https://github.com/mashpie/i18n-node/tree/master/examples) inside `/examples` for some inspiration in node 4.x / 5.x or browse these gists: > PLEASE NOTE: Those gist examples worked until node 0.12.x only * [plain node.js + http](https://gist.github.com/mashpie/5188567) * [plain node.js + restify](https://gist.github.com/mashpie/5694251) * [express 3 + cookie](https://gist.github.com/mashpie/5124626) * [express 3 + hbs 2 (+ cookie)](https://gist.github.com/mashpie/5246334) * [express 3 + mustache (+ cookie)](https://gist.github.com/mashpie/5247373) * [express 4 + cookie](https://gist.github.com/mashpie/08e5a0ee764f7b6b1355) For serving the same static files with different language url, you could: ```js app.use(express.static(__dirname + '/www')); app.use('/en', express.static(__dirname + '/www')); app.use('/de', express.static(__dirname + '/www')); ``` ## API The api is subject of incremental development. That means, it should not change nor remove any aspect of the current api but new features and options will get added that don't break compatibility backwards within a major version. ### i18n.configure() You should configure your application once to bootstrap all aspects of `i18n`. You should not configure i18n in each loop when used in an http based scenario. During configuration, `i18n` reads all known locales into memory and prepares to keep that superfast object in sync with your files in filesystem as configured ```js i18n.configure({ locales:['en', 'de'], directory: __dirname + '/locales' }); ``` **Since 0.7.0** you may even omit the `locales` setting and just configure a `directory`. `i18n` will read all files within that directory and detect all given locales by their filenames. ```js i18n.configure({ directory: __dirname + '/locales' }); ``` #### list of all configuration options ```js i18n.configure({ // setup some locales - other locales default to en silently locales:['en', 'de'], // fall back from Dutch to German fallbacks:{'nl': 'de'}, // you may alter a site wide default locale defaultLocale: 'de', // sets a custom cookie name to parse locale settings from - defaults to NULL cookie: 'yourcookiename', // query parameter to switch locale (ie. /home?lang=ch) - defaults to NULL queryParameter: 'lang', // where to store json files - defaults to './locales' relative to modules directory directory: './mylocales', // controll mode on directory creation - defaults to NULL which defaults to umask of process user. Setting has no effect on win. directoryPermissions: '755', // watch for changes in json files to reload locale on updates - defaults to false autoReload: true, // whether to write new locale information to disk - defaults to true updateFiles: false, // what to use as the indentation unit - defaults to "\t" indent: "\t", // setting extension of json files - defaults to '.json' (you might want to set this to '.js' according to webtranslateit) extension: '.js', // setting prefix of json files name - default to none '' (in case you use different locale files naming scheme (webapp-en.json), rather then just en.json) prefix: 'webapp-', // enable object notation objectNotation: false, // setting of log level DEBUG - default to require('debug')('i18n:debug') logDebugFn: function (msg) { console.log('debug', msg); }, // setting of log level WARN - default to require('debug')('i18n:warn') logWarnFn: function (msg) { console.log('warn', msg); }, // setting of log level ERROR - default to require('debug')('i18n:error') logErrorFn: function (msg) { console.log('error', msg); } // object or [obj1, obj2] to bind the i18n api and current locale to - defaults to null register: global }); ``` The locale itself is gathered directly from the browser by header, cookie or query parameter depending on your setup. In case of cookie you will also need to enable cookies for your application. For express this done by adding `app.use(express.cookieParser())`). Now use the same cookie name when setting it in the user preferred language, like here: ```js res.cookie('yourcookiename', 'de', { maxAge: 900000, httpOnly: true }); ``` After this and until the cookie expires, `i18n.init()` will get the value of the cookie to set that language instead of default for every page. #### Some words on `register` option Esp. when used in a cli like scriptyou won't use any `i18n.init()` to guess language settings from your user. Thus `i18n` won't bind itself to any `res` or `req` object and will work like a static module. ```js var anyObject = {}; i18n.configure({ locales: ['en', 'de'], register: anyObject }); anyObject.setLocale('de'); anyObject.__('Hallo'); // --> Hallo` ``` Cli usage is a special use case, as we won't need to maintain any transaction / concurrency aware setting of locale, so you could even choose to bind `i18n` to _global_ scope of node: ```js i18n.configure({ locales: ['en', 'de'], register: global }); i18n.setLocale('de'); __('Hello'); // --> Hallo` ``` ### i18n.init() When used as middleware in frameworks like express to setup the current environment for each loop. In contrast to configure the `i18n.init()` should be called within each request-response-cycle. ```js var app = express(); app.use(cookieParser()); app.use(i18n.init); ``` When i18n is used like this, the `i18n.init()` tries to 1. guess the language of a visitor by it's browser settings, cookie or query parameter 2. set that language in any of the "usual" objects provided by the framework Express would call `i18n.init(req, res, next)`, which is "classic" and adopted by many frameworks. Thus `i18n` will attach it's api to that schema: ```js { req: { locals: {}, res: { locals: {}, } } } ``` and add it's extra attributes and methods, like so: ```js { req: { locals: { locale: "de", __: [function], __n: [function], [...] }, res: { locals: { locale: "de", __: [function], __n: [function], [...] }, locale: "de", __: [function], __n: [function], [...] }, locale: "de", __: [function], __n: [function], [...] } } ``` Now each _local_ object (ie. res.locals) is setup with _it's own "private"_ locale and methods to get the appropriate translation from the _global_ catalog. ### i18n.__() Translates a single phrase and adds it to locales if unknown. Returns translated parsed and substituted string. ```js // template and global (this.locale == 'de') __('Hello'); // Hallo __('Hello %s', 'Marcus'); // Hallo Marcus __('Hello {{name}}', { name: 'Marcus' }); // Hallo Marcus // scoped via req object (req.locale == 'de') req.__('Hello'); // Hallo req.__('Hello %s', 'Marcus'); // Hallo Marcus req.__('Hello {{name}}', { name: 'Marcus' }); // Hallo Marcus // scoped via res object (res.locale == 'de') res.__('Hello'); // Hallo res.__('Hello %s', 'Marcus'); // Hallo Marcus res.__('Hello {{name}}', { name: 'Marcus' }); // Hallo Marcus // passing specific locale __({phrase: 'Hello', locale: 'fr'}); // Salut __({phrase: 'Hello %s', locale: 'fr'}, 'Marcus'); // Salut Marcus __({phrase: 'Hello {{name}}', locale: 'fr'}, { name: 'Marcus' }); // Salut Marcus ``` ### i18n.__n() Plurals translation of a single phrase. Singular and plural forms will get added to locales if unknown. Returns translated parsed and substituted string based on `count` parameter. ```js // template and global (this.locale == 'de') __n("%s cat", "%s cats", 1); // 1 Katze __n("%s cat", "%s cats", 3); // 3 Katzen // scoped via req object (req.locale == 'de') req.__n("%s cat", "%s cats", 1); // 1 Katze req.__n("%s cat", "%s cats", 3); // 3 Katzen // scoped via res object (res.locale == 'de') res.__n("%s cat", "%s cats", 1); // 1 Katze res.__n("%s cat", "%s cats", 3); // 3 Katzen // passing specific locale __n({singular: "%s cat", plural: "%s cats", locale: "fr"}, 1); // 1 chat __n({singular: "%s cat", plural: "%s cats", locale: "fr"}, 3); // 3 chat __n({singular: "%s cat", plural: "%s cats", locale: "fr", count: 1}); // 1 chat __n({singular: "%s cat", plural: "%s cats", locale: "fr", count: 3}); // 3 chat ``` ### i18n.__l() Returns a list of translations for a given phrase in each language. ```js i18n.__l('Hello'); // --> [ 'Hallo', 'Hello' ] ``` This will be usefull when setting up localized routes for example (kudos to @xpepermint, #150): ```js // this will match routes // EN --> /:locale/products/:id? // ES --> /:locale/productos/:id? app.get( __l('/:locale/products/:id?'), function (req, res) { // guess what you might use req.params.locale for? }); ``` > i18n.__ln() to get plurals will come up in another release... ### i18n.__h() Returns a hashed list of translations for a given phrase in each language. ```js i18n.__h('Hello'); // --> [ { de: 'Hallo' }, { en: 'Hello' } ] ``` > i18n.__hn() to get plurals will come up in another release... ### i18n.setLocale() Setting the current locale (ie.: `en`) globally or in current scope. ```js setLocale('de'); setLocale(req, 'de'); req.setLocale('de'); ``` Use setLocale to change any initial locale that was set in `i18n.init()`. You get more control on how when and which objects get setup with a given locale. Locale values are inherited within the given schema like in `i18n.init()` Let's see some examples: ```js i18n.setLocale(req, 'ar'); // --> req: مرحبا res: مرحبا res.locals: مرحبا i18n.setLocale(res, 'ar'); // --> req: Hallo res: مرحبا res.locals: مرحبا i18n.setLocale(res.locals, 'ar'); // --> req: Hallo res: Hallo res.locals: مرحبا ``` You'll get even more controll when passing an array of objects: ```js i18n.setLocale([req, res.locals], req.params.lang); // --> req: مرحبا res: Hallo res.locals: مرحبا ``` or disable inheritance by passing true as third parameter: ```js i18n.setLocale(res, 'ar', true); // --> req: Hallo res: مرحبا res.locals: Hallo ``` ### i18n.getLocale() Getting the current locale (ie.: `en`) from current scope or globally. ```js getLocale(); // --> de getLocale(req); // --> de req.getLocale(); // --> de ``` ### i18n.getCatalog() Returns a whole catalog optionally based on current scope and locale. ```js getCatalog(); // returns all locales getCatalog('de'); // returns just 'de' getCatalog(req); // returns current locale of req getCatalog(req, 'de'); // returns just 'de' req.getCatalog(); // returns current locale of req req.getCatalog('de'); // returns just 'de' ``` ## Attaching helpers for template engines In general i18n has to be attached to the response object to let it's public api get accessible in your templates and methods. As of **0.4.0** i18n tries to do so internally via `i18n.init`, as if you were doing it in `app.configure` on your own: ```js app.use(function(req, res, next) { // express helper for natively supported engines res.locals.__ = res.__ = function() { return i18n.__.apply(req, arguments); }; [...] next(); }); ``` Different engines need different implementations, so yours might miss or not work with the current default helpers. This one showing an example for mustache in express: ```js // register helper as a locals function wrapped as mustache expects app.use(function (req, res, next) { // mustache helper res.locals.__ = function () { return function (text, render) { return i18n.__.apply(req, arguments); }; }; [...] next(); }); ``` You could still setup your own implementation. Please refer to Examples below, post an issue or contribute your setup. ## Output formats As inspired by gettext there is currently support for sprintf-style expressions. You can also use mustache syntax for named parameters. ### sprintf support ```js var greeting = __('Hello %s, how are you today?', 'Marcus'); ``` this puts *Hello Marcus, how are you today?*. You might add endless arguments and even nest it. ```js var greeting = __('Hello %s, how are you today? How was your %s.', 'Marcus', __('weekend')); ``` which puts *Hello Marcus, how are you today? How was your weekend.* You might need to have repeated references to the same argument, which can be done with sprintf. ```js var example = __('%1$s, %1$s, %1$s', 'repeat'); ``` which puts ``` repeat, repeat, repeat ``` In some cases the argument order will need to be switched for different locales. The arguments can be strings, floats, numbers, etc. ```js var example = __('%2$d then %1$s then %3$.2f', 'First', 2, 333.333); ``` which puts ``` 2 then First then 333.33 ``` ### mustache support You may also use [mustache](http://mustache.github.io/) syntax for your message strings. To pass named parameters to your message, just provide an object as the last parameter. You can still pass unnamed parameters by adding additional arguments. ```js var greeting = __('Hello {{name}}, how are you today?', { name: 'Marcus' }); ``` this puts *Hello Marcus, how are you today?*. You might also combine it with sprintf arguments... ```js var greeting = __('Hello {{name}}, how was your %s.', __('weekend'), { name: 'Marcus' }); ``` and even nest it... ```js var greeting = __( __('Hello {{name}}, how was your %s?', { name: 'Marcus' }), __('weekend') ); ``` which both put *Hello Marcus, how was your weekend.* ### variable support you might even use dynamic variables as they get interpreted on the fly. Better make sure no user input finds it's way to that point as they all get added to the `en.js` file if not yet existing. ```js var greetings = ['Hi', 'Hello', 'Howdy']; for (var i=0; i < greetings.length; i++) { console.log( __(greetings[i]) ); }; ``` which puts ``` Hi Hello Howdy ``` ### basic plural support two different plural forms are supported as response to `count`: ```js var singular = __n('%s cat', '%s cats', 1); var plural = __n('%s cat', '%s cats', 3); ``` this puts **1 cat** or **3 cats** and again these could get nested: ```js var singular = __n('There is one monkey in the %%s', 'There are %d monkeys in the %%s', 1, 'tree'); var plural = __n('There is one monkey in the %%s', 'There are %d monkeys in the %%s', 3, 'tree'); ``` putting *There is one monkey in the tree* or *There are 3 monkeys in the tree* ## Storage > Will get modular support for different storage engines, currently just json files are stored in filesystem. ### json file the above will automatically generate a `en.json` by default inside `./locales/` which looks like ```json { "Hello": "Hello", "Hello %s, how are you today?": "Hello %s, how are you today?", "weekend": "weekend", "Hello %s, how are you today? How was your %s.": "Hello %s, how are you today? How was your %s.", "Hi": "Hi", "Howdy": "Howdy", "%s cat": { "one": "%s cat", "other": "%s cats" }, "There is one monkey in the %%s": { "one": "There is one monkey in the %%s", "other": "There are %d monkeys in the %%s" }, "tree": "tree" } ``` that file can be edited or just uploaded to [webtranslateit](http://docs.webtranslateit.com/file_formats/) for any kind of collaborative translation workflow: ```json { "Hello": "Hallo", "Hello %s, how are you today?": "Hallo %s, wie geht es dir heute?", "weekend": "Wochenende", "Hello %s, how are you today? How was your %s.": "Hallo %s, wie geht es dir heute? Wie war dein %s.", "Hi": "Hi", "Howdy": "Hallöchen", "%s cat": { "one": "%s Katze", "other": "%s Katzen" }, "There is one monkey in the %%s": { "one": "Im %%s sitzt ein Affe", "other": "Im %%s sitzen %d Affen" }, "tree": "Baum" } ``` ## Logging & Debugging Logging any kind of output is moved to [debug](https://github.com/visionmedia/debug) module. To let i18n output anything run your app with `DEBUG` env set like so: ```sh $ DEBUG=i18n:* node app.js ``` i18n exposes three log-levels: * i18n:debug * i18n:warn * i18n:error if you only want to get errors and warnings reported start your node server like so: ```sh $ DEBUG=i18n:warn,i18n:error node app.js ``` Combine those settings with you existing application if any of you other modules or libs also uses __debug__ ## Using custom logger You can configure i18n to use a custom logger. For example attach some simple `console`-logging: ```js i18n.configure({ ... // setting of log level DEBUG - default to require('debug')('i18n:debug') logDebugFn: function (msg) { console.log('debug', msg); }, // setting of log level WARN - default to require('debug')('i18n:warn') logWarnFn: function (msg) { console.log('warn', msg); }, // setting of log level ERROR - default to require('debug')('i18n:error') logErrorFn: function (msg) { console.log('error', msg); } }); ``` ## Object notation In addition to the traditional, linear translation lists, i18n also supports hierarchical translation catalogs. To enable this feature, be sure to set `objectNotation` to `true` in your `configure()` call. **Note**: If you can't or don't want to use `.` as a delimiter, set `objectNotation` to any other delimiter you like. Instead of calling `__("Hello")` you might call `__("greeting.formal")` to retrieve a formal greeting from a translation document like this one: ```js "greeting": { "formal": "Hello", "informal": "Hi", "placeholder": { "formal": "Hello %s", "informal": "Hi %s" } } ``` In the document, the translation terms, which include placeholders, are nested inside the "greeting" translation. They can be accessed and used in the same way, like so `__('greeting.placeholder.informal', 'Marcus')`. ### Pluralization Object notation also supports pluralization. When making use of it, the "one" and "other" entries are used implicitly for an object in the translation document. For example, consider the following document: ```js "cat": { "one": "Katze", "other": "Katzen" } ``` When accessing these, you would use `__n("cat", "cat", 3)` to tell i18n to use both the singular and plural form of the "cat" entry. Naturally, you could also access these members explicitly with `__("cat.one")` and `__("cat.other")`. ### Defaults When starting a project from scratch, your translation documents will probably be empty. i18n takes care of filling your translation documents for you. Whenever you use an unknown object, it is added to the translation documents. By default, when using object notation, the provided string literal will be inserted and returned as the default string. As an example, this is what the "greeting" object shown earlier would look like by default: ```js "greeting": { "formal": "greeting.formal", "informal": "greeting.informal" } ``` In case you would prefer to have a default string automatically inserted and returned, you can provide that default string by appending it to your object literal, delimited by a `:`. For example: ```js __("greeting.formal:Hello") __("greeting.placeholder.informal:Hi %s") ``` [![NPM](https://nodei.co/npm/i18n.svg?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/i18n/) ## Changelog * 0.7.0: * __improved__: `i18n.setLocale()` and `i18n.init()` refactored to comply with most common use cases, much better test coverage and docs * __new__: options: `autoReload`, `directoryPermissions`, `register`, `queryParameter`, read locales from filenames with empty `locales` option (#134) * __fixed__: typos, missing and wrong docs, issues related to `i18n.setLocale()` * 0.6.0: * __improved__: Accept-Language header parsing to ICU, delimiters with object notation, jshint, package.json, README; * __new__: prefix for locale files, `i18n.getLocales()`, custom logger, fallback[s]; * __fixed__: typos, badges, plural (numbers), `i18n.setLocale()` for `req` _and_ `res` * 0.5.0: feature release; added {{mustache}} parsing by #85, added "object.notation" by #110, fixed buggy req.__() implementation by #111 and closed 13 issues * 0.4.1: stable release; merged/closed: #57, #60, #67 typo fixes; added more examples and new features: #53, #65, #66 - and some more api reference * 0.4.0: stable release; closed: #22, #24, #4, #10, #54; added examples, clarified concurrency usage in different template engines, added `i18n.getCatalog` * 0.3.9: express.js usage, named api, jscoverage + more test, refactored configure, closed: #51, #20, #16, #49 * 0.3.8: fixed: #44, #49; merged: #47, #45, #50; added: #33; updated: README * 0.3.7: tests by mocha.js, added `this.locale` to `__` and `__n` * 0.3.6: travisCI, writeFileSync, devDependencies, jslint, MIT, fixed: #29, #9, merged: #25, #30, #43 * 0.3.5: fixed some issues, prepared refactoring, prepared publishing to npm finally * 0.3.4: merged pull request #13 from Fuitad/master and updated README * 0.3.3: merged pull request from codders/master and modified for backward compatibility. Usage and tests pending * 0.3.2: merged pull request #7 from carlptr/master and added tests, modified fswrite to do sync writes * 0.3.0: added configure and init with express support (calling guessLanguage() via 'accept-language') * 0.2.0: added plurals * 0.1.0: added tests * 0.0.1: start ## Licensed under MIT Copyright (c) 2011-2016 Marcus Spiegel <[email protected]> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. [npm-image]: https://badge.fury.io/js/i18n.svg [npm-url]: https://www.npmjs.com/package/i18n [travis-image]: https://travis-ci.org/mashpie/i18n-node.svg?branch=master [travis-url]: https://travis-ci.org/mashpie/i18n-node [appveyor-image]: https://ci.appveyor.com/api/projects/status/677snewuop7u5xtl?svg=true [appveyor-url]: https://ci.appveyor.com/project/mashpie/i18n-node [coveralls-image]: https://coveralls.io/repos/github/mashpie/i18n-node/badge.svg?branch=master [coveralls-url]: https://coveralls.io/github/mashpie/i18n-node?branch=master [dependency-image]: https://img.shields.io/gemnasium/mashpie/i18n-node.svg [dependency-url]: https://gemnasium.com/mashpie/i18n-node
{ "content_hash": "55d88862ed6715bddcb4598d4beefc27", "timestamp": "", "source": "github", "line_count": 787, "max_line_length": 319, "avg_line_length": 32.325285895806864, "alnum_prop": 0.6730345911949686, "repo_name": "EDDYMENS/temp", "id": "763c9576dd7b6ff6928e7079464596492dacf050", "size": "25494", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "node_modules/i18n/README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2324" }, { "name": "HTML", "bytes": "2540" }, { "name": "JavaScript", "bytes": "6356" } ], "symlink_target": "" }
package main.gmaps; import java.io.IOException; import main.GeneratorTernPluginHelper; import org.xml.sax.SAXException; public class GenerateAll { public static void main(String[] args) throws IOException, SAXException { // https://developers.google.com/maps/documentation/javascript/3.exp/reference // => 3.exp (3.21) GeneratorTernPluginHelper .generatePackage( "gmaps", "3.21", "3.exp", "https://developers.google.com/maps/documentation/javascript/3.exp/reference", "gmaps.json", GenerateAll.class); // https://developers.google.com/maps/documentation/javascript/reference // => Release (3.20) GeneratorTernPluginHelper .generatePackage( "gmaps", "3.20", "3.ref", "https://developers.google.com/maps/documentation/javascript/reference", "gmaps.json", GenerateAll.class); // https://developers.google.com/maps/documentation/javascript/3.19/reference // => Frozen (3.19) GeneratorTernPluginHelper .generatePackage( "gmaps", "3.19", "3.frozen", "https://developers.google.com/maps/documentation/javascript/3.19/reference", "gmaps.json", GenerateAll.class); } }
{ "content_hash": "da8f587d6e135a6d6dafe146b3b0d2bb", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 84, "avg_line_length": 30.675, "alnum_prop": 0.6650366748166259, "repo_name": "angelozerr/tern.googleapi", "id": "689c1ec0e4c96bd37d00292422c867b249b1e4d2", "size": "1227", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/gmaps/GenerateAll.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "17087" }, { "name": "HTML", "bytes": "4635491" }, { "name": "Java", "bytes": "151357" }, { "name": "JavaScript", "bytes": "2306553" } ], "symlink_target": "" }
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Simplification; using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace CodeCracker.CSharp.Usage { [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(DisposableVariableNotDisposedCodeFixProvider)), Shared] public class DisposableVariableNotDisposedCodeFixProvider : CodeFixProvider { public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create(DiagnosticId.DisposableVariableNotDisposed.ToDiagnosticId()); public readonly static string MessageFormat = "Dispose object: '{0}'"; public sealed override FixAllProvider GetFixAllProvider() => DisposableVariableNotDisposedFixAllProvider.Instance; public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); var title = string.Format(MessageFormat, diagnostic.Properties["typeName"]); context.RegisterCodeFix(CodeAction.Create(title, c => CreateUsingAsync(context.Document, diagnostic, c), nameof(DisposableVariableNotDisposedCodeFixProvider)), diagnostic); return Task.FromResult(0); } private static async Task<Document> CreateUsingAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken) { var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var diagnosticSpan = diagnostic.Location.SourceSpan; var objectCreation = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<ObjectCreationExpressionSyntax>().FirstOrDefault(); var semanticModel = await document.GetSemanticModelAsync(cancellationToken); var newRoot = CreateUsing(root, objectCreation, semanticModel); var newDocument = document.WithSyntaxRoot(newRoot); return newDocument; } public static SyntaxNode CreateUsing(SyntaxNode root, ObjectCreationExpressionSyntax objectCreation, SemanticModel semanticModel) { SyntaxNode newRoot; if (objectCreation.Parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) { var assignmentExpression = (AssignmentExpressionSyntax)objectCreation.Parent; var statement = assignmentExpression.Parent as ExpressionStatementSyntax; var identitySymbol = (ILocalSymbol)semanticModel.GetSymbolInfo(assignmentExpression.Left).Symbol; newRoot = UsedOutsideParentBlock(semanticModel, statement, identitySymbol) ? CreateRootAddingDisposeToEndOfMethod(root, statement, identitySymbol) : CreateRootWithUsing(root, statement, u => u.WithExpression(assignmentExpression)); } else if (objectCreation.Parent.IsKind(SyntaxKind.EqualsValueClause) && objectCreation.Parent.Parent.IsKind(SyntaxKind.VariableDeclarator)) { var variableDeclarator = (VariableDeclaratorSyntax)objectCreation.Parent.Parent; var variableDeclaration = (VariableDeclarationSyntax)variableDeclarator.Parent; var statement = (LocalDeclarationStatementSyntax)variableDeclaration.Parent; newRoot = CreateRootWithUsing(root, statement, u => u.WithDeclaration(variableDeclaration)); } else { newRoot = CreateRootWithUsing(root, (ExpressionStatementSyntax)objectCreation.Parent, u => u.WithExpression(objectCreation)); } return newRoot; } private static SyntaxNode CreateRootAddingDisposeToEndOfMethod(SyntaxNode root, ExpressionStatementSyntax statement, ILocalSymbol identitySymbol) { var method = statement.FirstAncestorOrSelf<MethodDeclarationSyntax>(); var newDispose = ImplementsDisposableExplicitly(identitySymbol.Type) ? SyntaxFactory.ExpressionStatement(SyntaxFactory.InvocationExpression( SyntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, SyntaxFactory.ParenthesizedExpression(SyntaxFactory.CastExpression(SyntaxFactory.ParseName("System.IDisposable").WithAdditionalAnnotations(Simplifier.Annotation), SyntaxFactory.IdentifierName(identitySymbol.Name))), SyntaxFactory.IdentifierName("Dispose")))) : SyntaxFactory.ParseStatement($"{identitySymbol.Name}.Dispose();"); newDispose = newDispose.WithAdditionalAnnotations(Formatter.Annotation); var last = method.Body.Statements.Last(); var newRoot = root.InsertNodesAfter(method.Body.Statements.Last(), new[] { newDispose }); return newRoot; } private static SyntaxNode CreateRootWithUsing(SyntaxNode root, StatementSyntax statement, Func<UsingStatementSyntax, UsingStatementSyntax> updateUsing) { var statementsForUsing = GetChildStatementsAfter(statement); var statementsToReplace = new List<StatementSyntax> { statement }; statementsToReplace.AddRange(statementsForUsing); var block = SyntaxFactory.Block(statementsForUsing); var usingStatement = updateUsing?.Invoke(CreateUsingStatement(statement, block)); var newRoot = root.ReplaceNodes(statementsToReplace, (node, _) => node.Equals(statement) ? usingStatement : null); return newRoot; } private static UsingStatementSyntax CreateUsingStatement(StatementSyntax statement, BlockSyntax block) { return SyntaxFactory.UsingStatement(block) .WithLeadingTrivia(statement.GetLeadingTrivia()) .WithTrailingTrivia(statement.GetTrailingTrivia()) .WithAdditionalAnnotations(Formatter.Annotation); } private static bool ImplementsDisposableExplicitly(ITypeSymbol type) { return type.GetMembers().Any(m => m.Name == "System.IDisposable.Dispose"); } private static bool UsedOutsideParentBlock(SemanticModel semanticModel, StatementSyntax expressionStatement, ISymbol identitySymbol) { var block = expressionStatement.FirstAncestorOrSelf<BlockSyntax>(); var method = expressionStatement.FirstAncestorOrSelf<MethodDeclarationSyntax>(); var methodBlock = method.Body; if (methodBlock.Equals(block)) return false; var collectionOfStatementsAfter = GetStatementsInBlocksAfter(block); foreach (var allStatementsAfterBlock in collectionOfStatementsAfter) { if (!allStatementsAfterBlock.Any()) continue; var dataFlowAnalysis = semanticModel.AnalyzeDataFlow(allStatementsAfterBlock.First(), allStatementsAfterBlock.Last()); if (!dataFlowAnalysis.Succeeded) continue; var isUsed = dataFlowAnalysis.ReadInside.Contains(identitySymbol) || dataFlowAnalysis.WrittenInside.Contains(identitySymbol); if (isUsed) return true; } return false; } private static List<List<StatementSyntax>> GetStatementsInBlocksAfter(StatementSyntax node) { var collectionOfStatements = new List<List<StatementSyntax>>(); var method = node.FirstAncestorOrSelf<MethodDeclarationSyntax>(); if (method?.Body == null) return collectionOfStatements; var currentBlock = node.FirstAncestorOfType<BlockSyntax>(); while (currentBlock != null) { var statements = new List<StatementSyntax>(); foreach (var statement in currentBlock.Statements) if (statement.SpanStart > node.SpanStart) statements.Add(statement); if (statements.Any()) collectionOfStatements.Add(statements); if (method.Body.Equals(currentBlock)) break; currentBlock = currentBlock.FirstAncestorOfType<BlockSyntax>(); } return collectionOfStatements; } private static IList<StatementSyntax> GetChildStatementsAfter(StatementSyntax node) { var block = node.FirstAncestorOrSelf<BlockSyntax>(); var statements = block.Statements.Where(s => s.SpanStart > node.SpanStart).ToList(); return statements; } } }
{ "content_hash": "f6b395f439de2ffe3cf16358f4b608c7", "timestamp": "", "source": "github", "line_count": 156, "max_line_length": 235, "avg_line_length": 56.71153846153846, "alnum_prop": 0.6948118006103764, "repo_name": "dlsteuer/code-cracker", "id": "f090a316bf84ef613ea2dd173b1e7c64a31ce58c", "size": "8849", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "src/CSharp/CodeCracker/Usage/DisposableVariableNotDisposedCodeFixProvider.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "1271735" }, { "name": "PowerShell", "bytes": "25681" }, { "name": "Visual Basic", "bytes": "366311" } ], "symlink_target": "" }
import { fromJS, Repeat, OrderedMap } from 'immutable'; import { CHANGE_ACTIVE_LAYOUT, RESET_TRADES, REMOVE_TRADE, REMOVE_PERSONAL_DATA, UPDATE_TRADE_ERROR, CLEAR_TRADE_ERROR, } from '../../_constants/ActionTypes'; const defaultError = new OrderedMap({ durationError: undefined, barrierError: undefined, stakeError: undefined, proposalError: undefined, contractForError: undefined, purchaseError: undefined, }); const initialState = fromJS([defaultError]); export default (state = initialState, action) => { switch (action.type) { case CHANGE_ACTIVE_LAYOUT: { const oldTradesCount = state.size; const newTradesCount = action.tradesCount; const countDiff = newTradesCount - oldTradesCount; if (countDiff > 0) { const additionalError = Repeat(fromJS(defaultError), countDiff); // eslint-disable-line new-cap return state.concat(additionalError); } if (countDiff < 0) { return state.take(newTradesCount); } return state; } case RESET_TRADES: { return initialState; } case REMOVE_TRADE: { if (!state.get(action.index)) { return state; } return state.remove(action.index); } case REMOVE_PERSONAL_DATA: { return initialState; } case UPDATE_TRADE_ERROR: { const { index, errorID, error } = action; return state.setIn([index, errorID], error); } case CLEAR_TRADE_ERROR: { const { index } = action; return state.set(index, fromJS({})); } default: return state; } };
{ "content_hash": "0eab70cb9e282db5fe71a09685aa242f", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 113, "avg_line_length": 28.919354838709676, "alnum_prop": 0.5660903513664249, "repo_name": "nuruddeensalihu/binary-next-gen", "id": "88f91fc9a86d23cfdfbe918f7b44d6be82641bf9", "size": "1793", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/_reducers/trades/TradesErrorReducer.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "63393" }, { "name": "HTML", "bytes": "8774" }, { "name": "JavaScript", "bytes": "942343" }, { "name": "Shell", "bytes": "408" } ], "symlink_target": "" }
namespace { // Some drivers are bugged and don't track the current HDC/HGLRC properly // In order to deactivate successfully, we need to track it ourselves as well sf::ThreadLocalPtr<sf::priv::WglContext> currentContext(NULL); } namespace sf { namespace priv { //////////////////////////////////////////////////////////// void ensureExtensionsInit(HDC deviceContext) { static bool initialized = false; if (!initialized) { initialized = true; // We don't check the return value since the extension // flags are cleared even if loading fails sfwgl_LoadFunctions(deviceContext); } } //////////////////////////////////////////////////////////// String getErrorString(DWORD errorCode) { PTCHAR buffer; if (FormatMessage(FORMAT_MESSAGE_MAX_WIDTH_MASK | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorCode, 0, reinterpret_cast<LPTSTR>(&buffer), 256, NULL) != 0) { String errMsg(buffer); LocalFree(buffer); return errMsg; } std::ostringstream ss; ss << "Error " << errorCode; return String(ss.str()); } //////////////////////////////////////////////////////////// WglContext::WglContext(WglContext* shared) : m_window (NULL), m_pbuffer (NULL), m_deviceContext(NULL), m_context (NULL), m_ownsWindow (false) { // TODO: Delegate to the other constructor in C++11 // Save the creation settings m_settings = ContextSettings(); // Create the rendering surface (window or pbuffer if supported) createSurface(shared, 1, 1, VideoMode::getDesktopMode().bitsPerPixel); // Create the context createContext(shared); } //////////////////////////////////////////////////////////// WglContext::WglContext(WglContext* shared, const ContextSettings& settings, const WindowImpl* owner, unsigned int bitsPerPixel) : m_window (NULL), m_pbuffer (NULL), m_deviceContext(NULL), m_context (NULL), m_ownsWindow (false) { // Save the creation settings m_settings = settings; // Create the rendering surface from the owner window createSurface(owner->getSystemHandle(), bitsPerPixel); // Create the context createContext(shared); } //////////////////////////////////////////////////////////// WglContext::WglContext(WglContext* shared, const ContextSettings& settings, unsigned int width, unsigned int height) : m_window (NULL), m_pbuffer (NULL), m_deviceContext(NULL), m_context (NULL), m_ownsWindow (false) { // Save the creation settings m_settings = settings; // Create the rendering surface (window or pbuffer if supported) createSurface(shared, width, height, VideoMode::getDesktopMode().bitsPerPixel); // Create the context createContext(shared); } //////////////////////////////////////////////////////////// WglContext::~WglContext() { // Notify unshared OpenGL resources of context destruction cleanupUnsharedResources(); // Destroy the OpenGL context if (m_context) { if (currentContext == this) { if (wglMakeCurrent(m_deviceContext, NULL) == TRUE) currentContext = NULL; } wglDeleteContext(m_context); } // Destroy the device context if (m_deviceContext) { if (m_pbuffer) { wglReleasePbufferDCARB(m_pbuffer, m_deviceContext); wglDestroyPbufferARB(m_pbuffer); } else { ReleaseDC(m_window, m_deviceContext); } } // Destroy the window if we own it if (m_window && m_ownsWindow) DestroyWindow(m_window); } //////////////////////////////////////////////////////////// GlFunctionPointer WglContext::getFunction(const char* name) { GlFunctionPointer address = reinterpret_cast<GlFunctionPointer>(wglGetProcAddress(reinterpret_cast<LPCSTR>(name))); if (address) { // Test whether the returned value is a valid error code ptrdiff_t errorCode = reinterpret_cast<ptrdiff_t>(address); if ((errorCode != -1) && (errorCode != 1) && (errorCode != 2) && (errorCode != 3)) return address; } static HMODULE module = NULL; if (!module) module = GetModuleHandleA("OpenGL32.dll"); if (module) return reinterpret_cast<GlFunctionPointer>(GetProcAddress(module, reinterpret_cast<LPCSTR>(name))); return 0; } //////////////////////////////////////////////////////////// bool WglContext::makeCurrent(bool current) { if (!m_deviceContext || !m_context) return false; if (wglMakeCurrent(m_deviceContext, current ? m_context : NULL) == FALSE) { err() << "Failed to " << (current ? "activate" : "deactivate") << " OpenGL context: " << getErrorString(GetLastError()).toAnsiString() << std::endl; return false; } currentContext = (current ? this : NULL); return true; } //////////////////////////////////////////////////////////// void WglContext::display() { if (m_deviceContext && m_context) SwapBuffers(m_deviceContext); } //////////////////////////////////////////////////////////// void WglContext::setVerticalSyncEnabled(bool enabled) { // Make sure that extensions are initialized ensureExtensionsInit(m_deviceContext); if (sfwgl_ext_EXT_swap_control == sfwgl_LOAD_SUCCEEDED) { if (wglSwapIntervalEXT(enabled ? 1 : 0) == FALSE) err() << "Setting vertical sync failed: " << getErrorString(GetLastError()).toAnsiString() << std::endl; } else { static bool warned = false; if (!warned) { // wglSwapIntervalEXT not supported err() << "Setting vertical sync not supported" << std::endl; warned = true; } } } //////////////////////////////////////////////////////////// int WglContext::selectBestPixelFormat(HDC deviceContext, unsigned int bitsPerPixel, const ContextSettings& settings, bool pbuffer) { // Let's find a suitable pixel format -- first try with wglChoosePixelFormatARB int bestFormat = 0; if (sfwgl_ext_ARB_pixel_format == sfwgl_LOAD_SUCCEEDED) { // Define the basic attributes we want for our window int intAttributes[] = { WGL_DRAW_TO_WINDOW_ARB, GL_TRUE, WGL_SUPPORT_OPENGL_ARB, GL_TRUE, WGL_DOUBLE_BUFFER_ARB, GL_TRUE, WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB, 0, 0 }; // Let's check how many formats are supporting our requirements int formats[512]; UINT nbFormats; bool isValid = wglChoosePixelFormatARB(deviceContext, intAttributes, NULL, 512, formats, &nbFormats) != FALSE; if (!isValid) err() << "Failed to enumerate pixel formats: " << getErrorString(GetLastError()).toAnsiString() << std::endl; // Get the best format among the returned ones if (isValid && (nbFormats > 0)) { int bestScore = 0x7FFFFFFF; for (UINT i = 0; i < nbFormats; ++i) { // Extract the components of the current format int values[7]; const int attributes[] = { WGL_RED_BITS_ARB, WGL_GREEN_BITS_ARB, WGL_BLUE_BITS_ARB, WGL_ALPHA_BITS_ARB, WGL_DEPTH_BITS_ARB, WGL_STENCIL_BITS_ARB, WGL_ACCELERATION_ARB }; if (wglGetPixelFormatAttribivARB(deviceContext, formats[i], PFD_MAIN_PLANE, 7, attributes, values) == FALSE) { err() << "Failed to retrieve pixel format information: " << getErrorString(GetLastError()).toAnsiString() << std::endl; break; } int sampleValues[2] = {0, 0}; if (sfwgl_ext_ARB_multisample == sfwgl_LOAD_SUCCEEDED) { const int sampleAttributes[] = { WGL_SAMPLE_BUFFERS_ARB, WGL_SAMPLES_ARB }; if (wglGetPixelFormatAttribivARB(deviceContext, formats[i], PFD_MAIN_PLANE, 2, sampleAttributes, sampleValues) == FALSE) { err() << "Failed to retrieve pixel format multisampling information: " << getErrorString(GetLastError()).toAnsiString() << std::endl; break; } } int sRgbCapableValue = 0; if ((sfwgl_ext_ARB_framebuffer_sRGB == sfwgl_LOAD_SUCCEEDED) || (sfwgl_ext_EXT_framebuffer_sRGB == sfwgl_LOAD_SUCCEEDED)) { const int sRgbCapableAttribute = WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB; if (wglGetPixelFormatAttribivARB(deviceContext, formats[i], PFD_MAIN_PLANE, 1, &sRgbCapableAttribute, &sRgbCapableValue) == FALSE) { err() << "Failed to retrieve pixel format sRGB capability information: " << getErrorString(GetLastError()).toAnsiString() << std::endl; break; } } if (pbuffer) { const int pbufferAttributes[] = { WGL_DRAW_TO_PBUFFER_ARB }; int pbufferValue = 0; if (wglGetPixelFormatAttribivARB(deviceContext, formats[i], PFD_MAIN_PLANE, 1, pbufferAttributes, &pbufferValue) == FALSE) { err() << "Failed to retrieve pixel format pbuffer information: " << getErrorString(GetLastError()).toAnsiString() << std::endl; break; } if (pbufferValue != GL_TRUE) continue; } // Evaluate the current configuration int color = values[0] + values[1] + values[2] + values[3]; int score = evaluateFormat(bitsPerPixel, settings, color, values[4], values[5], sampleValues[0] ? sampleValues[1] : 0, values[6] == WGL_FULL_ACCELERATION_ARB, sRgbCapableValue == TRUE); // Keep it if it's better than the current best if (score < bestScore) { bestScore = score; bestFormat = formats[i]; } } } } // ChoosePixelFormat doesn't support pbuffers if (pbuffer) return bestFormat; // Find a pixel format with ChoosePixelFormat, if wglChoosePixelFormatARB is not supported if (bestFormat == 0) { // Setup a pixel format descriptor from the rendering settings PIXELFORMATDESCRIPTOR descriptor; ZeroMemory(&descriptor, sizeof(descriptor)); descriptor.nSize = sizeof(descriptor); descriptor.nVersion = 1; descriptor.iLayerType = PFD_MAIN_PLANE; descriptor.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; descriptor.iPixelType = PFD_TYPE_RGBA; descriptor.cColorBits = static_cast<BYTE>(bitsPerPixel); descriptor.cDepthBits = static_cast<BYTE>(settings.depthBits); descriptor.cStencilBits = static_cast<BYTE>(settings.stencilBits); descriptor.cAlphaBits = bitsPerPixel == 32 ? 8 : 0; // Get the pixel format that best matches our requirements bestFormat = ChoosePixelFormat(deviceContext, &descriptor); } return bestFormat; } //////////////////////////////////////////////////////////// void WglContext::setDevicePixelFormat(unsigned int bitsPerPixel) { int bestFormat = selectBestPixelFormat(m_deviceContext, bitsPerPixel, m_settings); if (bestFormat == 0) { err() << "Failed to find a suitable pixel format for device context: " << getErrorString(GetLastError()).toAnsiString() << std::endl << "Cannot create OpenGL context" << std::endl; return; } // Extract the depth and stencil bits from the chosen format PIXELFORMATDESCRIPTOR actualFormat; actualFormat.nSize = sizeof(actualFormat); actualFormat.nVersion = 1; DescribePixelFormat(m_deviceContext, bestFormat, sizeof(actualFormat), &actualFormat); // Set the chosen pixel format if (SetPixelFormat(m_deviceContext, bestFormat, &actualFormat) == FALSE) { err() << "Failed to set pixel format for device context: " << getErrorString(GetLastError()).toAnsiString() << std::endl << "Cannot create OpenGL context" << std::endl; return; } } //////////////////////////////////////////////////////////// void WglContext::updateSettingsFromPixelFormat() { int format = GetPixelFormat(m_deviceContext); if (format == 0) { err() << "Failed to get selected pixel format: " << getErrorString(GetLastError()).toAnsiString() << std::endl; return; } PIXELFORMATDESCRIPTOR actualFormat; actualFormat.nSize = sizeof(actualFormat); actualFormat.nVersion = 1; if (DescribePixelFormat(m_deviceContext, format, sizeof(actualFormat), &actualFormat) == 0) { err() << "Failed to retrieve pixel format information: " << getErrorString(GetLastError()).toAnsiString() << std::endl; return; } if (sfwgl_ext_ARB_pixel_format == sfwgl_LOAD_SUCCEEDED) { const int attributes[] = {WGL_DEPTH_BITS_ARB, WGL_STENCIL_BITS_ARB}; int values[2]; if (wglGetPixelFormatAttribivARB(m_deviceContext, format, PFD_MAIN_PLANE, 2, attributes, values) == TRUE) { m_settings.depthBits = values[0]; m_settings.stencilBits = values[1]; } else { err() << "Failed to retrieve pixel format information: " << getErrorString(GetLastError()).toAnsiString() << std::endl; m_settings.depthBits = actualFormat.cDepthBits; m_settings.stencilBits = actualFormat.cStencilBits; } if (sfwgl_ext_ARB_multisample == sfwgl_LOAD_SUCCEEDED) { const int sampleAttributes[] = {WGL_SAMPLE_BUFFERS_ARB, WGL_SAMPLES_ARB}; int sampleValues[2]; if (wglGetPixelFormatAttribivARB(m_deviceContext, format, PFD_MAIN_PLANE, 2, sampleAttributes, sampleValues) == TRUE) { m_settings.antialiasingLevel = sampleValues[0] ? sampleValues[1] : 0; } else { err() << "Failed to retrieve pixel format multisampling information: " << getErrorString(GetLastError()).toAnsiString() << std::endl; m_settings.antialiasingLevel = 0; } } else { m_settings.antialiasingLevel = 0; } if ((sfwgl_ext_ARB_framebuffer_sRGB == sfwgl_LOAD_SUCCEEDED) || (sfwgl_ext_EXT_framebuffer_sRGB == sfwgl_LOAD_SUCCEEDED)) { const int sRgbCapableAttribute = WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB; int sRgbCapableValue = 0; if (wglGetPixelFormatAttribivARB(m_deviceContext, format, PFD_MAIN_PLANE, 1, &sRgbCapableAttribute, &sRgbCapableValue) == TRUE) { m_settings.sRgbCapable = (sRgbCapableValue == TRUE); } else { err() << "Failed to retrieve pixel format sRGB capability information: " << getErrorString(GetLastError()).toAnsiString() << std::endl; m_settings.sRgbCapable = false; } } else { m_settings.sRgbCapable = false; } } else { m_settings.depthBits = actualFormat.cDepthBits; m_settings.stencilBits = actualFormat.cStencilBits; m_settings.antialiasingLevel = 0; } } //////////////////////////////////////////////////////////// void WglContext::createSurface(WglContext* shared, unsigned int width, unsigned int height, unsigned int bitsPerPixel) { // Check if the shared context already exists and pbuffers are supported if (shared && shared->m_deviceContext && (sfwgl_ext_ARB_pbuffer == sfwgl_LOAD_SUCCEEDED)) { int bestFormat = selectBestPixelFormat(shared->m_deviceContext, bitsPerPixel, m_settings, true); if (bestFormat > 0) { int attributes[] = {0, 0}; m_pbuffer = wglCreatePbufferARB(shared->m_deviceContext, bestFormat, width, height, attributes); if (m_pbuffer) { m_window = shared->m_window; m_deviceContext = wglGetPbufferDCARB(m_pbuffer); if (!m_deviceContext) { err() << "Failed to retrieve pixel buffer device context: " << getErrorString(GetLastError()).toAnsiString() << std::endl; wglDestroyPbufferARB(m_pbuffer); m_pbuffer = NULL; } } else { err() << "Failed to create pixel buffer: " << getErrorString(GetLastError()).toAnsiString() << std::endl; } } } // If pbuffers are not available we use a hidden window as the off-screen surface to draw to if (!m_deviceContext) { // We can't create a memory DC, the resulting context wouldn't be compatible // with other contexts and thus wglShareLists would always fail // Create the hidden window m_window = CreateWindowA("STATIC", "", WS_POPUP | WS_DISABLED, 0, 0, width, height, NULL, NULL, GetModuleHandle(NULL), NULL); ShowWindow(m_window, SW_HIDE); m_deviceContext = GetDC(m_window); m_ownsWindow = true; // Set the pixel format of the device context setDevicePixelFormat(bitsPerPixel); } // Update context settings from the selected pixel format updateSettingsFromPixelFormat(); } //////////////////////////////////////////////////////////// void WglContext::createSurface(HWND window, unsigned int bitsPerPixel) { m_window = window; m_deviceContext = GetDC(window); // Set the pixel format of the device context setDevicePixelFormat(bitsPerPixel); // Update context settings from the selected pixel format updateSettingsFromPixelFormat(); } //////////////////////////////////////////////////////////// void WglContext::createContext(WglContext* shared) { // We can't create an OpenGL context if we don't have a DC if (!m_deviceContext) return; // Get a working copy of the context settings ContextSettings settings = m_settings; // Get the context to share display lists with HGLRC sharedContext = shared ? shared->m_context : NULL; // Create the OpenGL context -- first try using wglCreateContextAttribsARB while (!m_context && m_settings.majorVersion) { if (sfwgl_ext_ARB_create_context == sfwgl_LOAD_SUCCEEDED) { std::vector<int> attributes; // Check if the user requested a specific context version (anything > 1.1) if ((m_settings.majorVersion > 1) || ((m_settings.majorVersion == 1) && (m_settings.minorVersion > 1))) { attributes.push_back(WGL_CONTEXT_MAJOR_VERSION_ARB); attributes.push_back(m_settings.majorVersion); attributes.push_back(WGL_CONTEXT_MINOR_VERSION_ARB); attributes.push_back(m_settings.minorVersion); } // Check if setting the profile is supported if (sfwgl_ext_ARB_create_context_profile == sfwgl_LOAD_SUCCEEDED) { int profile = (m_settings.attributeFlags & ContextSettings::Core) ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; int debug = (m_settings.attributeFlags & ContextSettings::Debug) ? WGL_CONTEXT_DEBUG_BIT_ARB : 0; attributes.push_back(WGL_CONTEXT_PROFILE_MASK_ARB); attributes.push_back(profile); attributes.push_back(WGL_CONTEXT_FLAGS_ARB); attributes.push_back(debug); } else { if ((m_settings.attributeFlags & ContextSettings::Core) || (m_settings.attributeFlags & ContextSettings::Debug)) err() << "Selecting a profile during context creation is not supported," << "disabling comptibility and debug" << std::endl; m_settings.attributeFlags = ContextSettings::Default; } // Append the terminating 0 attributes.push_back(0); attributes.push_back(0); if (sharedContext) { static Mutex mutex; Lock lock(mutex); if (currentContext == shared) { if (wglMakeCurrent(shared->m_deviceContext, NULL) == FALSE) { err() << "Failed to deactivate shared context before sharing: " << getErrorString(GetLastError()).toAnsiString() << std::endl; return; } currentContext = NULL; } } // Create the context m_context = wglCreateContextAttribsARB(m_deviceContext, sharedContext, &attributes[0]); } else { // If wglCreateContextAttribsARB is not supported, there is no need to keep trying break; } // If we couldn't create the context, first try disabling flags, // then lower the version number and try again -- stop at 0.0 // Invalid version numbers will be generated by this algorithm (like 3.9), but we really don't care if (!m_context) { if (m_settings.attributeFlags != ContextSettings::Default) { m_settings.attributeFlags = ContextSettings::Default; } else if (m_settings.minorVersion > 0) { // If the minor version is not 0, we decrease it and try again m_settings.minorVersion--; m_settings.attributeFlags = settings.attributeFlags; } else { // If the minor version is 0, we decrease the major version m_settings.majorVersion--; m_settings.minorVersion = 9; m_settings.attributeFlags = settings.attributeFlags; } } } // If wglCreateContextAttribsARB failed, use wglCreateContext if (!m_context) { // set the context version to 1.1 (arbitrary) and disable flags m_settings.majorVersion = 1; m_settings.minorVersion = 1; m_settings.attributeFlags = ContextSettings::Default; m_context = wglCreateContext(m_deviceContext); if (!m_context) { err() << "Failed to create an OpenGL context for this window: " << getErrorString(GetLastError()).toAnsiString() << std::endl; return; } // Share this context with others if (sharedContext) { // wglShareLists doesn't seem to be thread-safe static Mutex mutex; Lock lock(mutex); if (currentContext == shared) { if (wglMakeCurrent(shared->m_deviceContext, NULL) == FALSE) { err() << "Failed to deactivate shared context before sharing: " << getErrorString(GetLastError()).toAnsiString() << std::endl; return; } currentContext = NULL; } if (wglShareLists(sharedContext, m_context) == FALSE) err() << "Failed to share the OpenGL context: " << getErrorString(GetLastError()).toAnsiString() << std::endl; } } // If we are the shared context, initialize extensions now // This enables us to re-create the shared context using extensions if we need to if (!shared && m_context) { makeCurrent(true); ensureExtensionsInit(m_deviceContext); makeCurrent(false); } } } // namespace priv } // namespace sf
{ "content_hash": "5663ab22d1c63579466656b55b2f4a49", "timestamp": "", "source": "github", "line_count": 700, "max_line_length": 218, "avg_line_length": 34.96142857142857, "alnum_prop": 0.5619662485187757, "repo_name": "Senryoku/NESen", "id": "57516032963e68819a76c13c21beff456b7edd31", "size": "26118", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ext/SFML/src/SFML/Window/Win32/WglContext.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "281852" }, { "name": "C++", "bytes": "5415227" }, { "name": "CMake", "bytes": "156791" }, { "name": "CSS", "bytes": "24796" }, { "name": "GLSL", "bytes": "6244" }, { "name": "HTML", "bytes": "470" }, { "name": "Makefile", "bytes": "6131" }, { "name": "Objective-C", "bytes": "68983" }, { "name": "Objective-C++", "bytes": "218754" }, { "name": "Rich Text Format", "bytes": "420" }, { "name": "Shell", "bytes": "6155" } ], "symlink_target": "" }
import functools import numpy as np from scipy.stats import norm as ndist import regreg.api as rr from selection.tests.instance import gaussian_instance from selection.learning.utils import (partial_model_inference, pivot_plot, lee_inference) from selection.learning.core import normal_sampler, keras_fit def simulate(n=200, p=100, s=10, signal=(0.5, 1), sigma=2, alpha=0.1, B=8000): # description of statistical problem X, y, truth = gaussian_instance(n=n, p=p, s=s, equicorrelated=False, rho=0.5, sigma=sigma, signal=signal, random_signs=True, scale=False)[:3] dispersion = sigma**2 S = X.T.dot(y) covS = dispersion * X.T.dot(X) smooth_sampler = normal_sampler(S, covS) def meta_algorithm(XTX, XTXi, lam, sampler): p = XTX.shape[0] success = np.zeros(p) loss = rr.quadratic_loss((p,), Q=XTX) pen = rr.l1norm(p, lagrange=lam) scale = 0. noisy_S = sampler(scale=scale) loss.quadratic = rr.identity_quadratic(0, 0, -noisy_S, 0) problem = rr.simple_problem(loss, pen) soln = problem.solve(max_its=100, tol=1.e-10) success += soln != 0 return tuple(sorted(np.nonzero(success)[0])) XTX = X.T.dot(X) XTXi = np.linalg.inv(XTX) resid = y - X.dot(XTXi.dot(X.T.dot(y))) dispersion = np.linalg.norm(resid)**2 / (n-p) lam = 4. * np.sqrt(n) selection_algorithm = functools.partial(meta_algorithm, XTX, XTXi, lam) # run selection algorithm df = partial_model_inference(X, y, truth, selection_algorithm, smooth_sampler, fit_probability=keras_fit, fit_args={'epochs':30, 'sizes':[100]*5, 'dropout':0., 'activation':'relu'}, success_params=(1, 1), B=B, alpha=alpha) lee_df = lee_inference(X, y, lam, dispersion, truth, alpha=alpha) return pd.merge(df, lee_df, on='variable') if __name__ == "__main__": import statsmodels.api as sm import matplotlib.pyplot as plt import pandas as pd U = np.linspace(0, 1, 101) plt.clf() for i in range(500): df = simulate() csvfile = 'lee_multi.csv' outbase = csvfile[:-4] if df is not None and i > 0: try: # concatenate to disk df = pd.concat([df, pd.read_csv(csvfile)]) except FileNotFoundError: pass df.to_csv(csvfile, index=False) if len(df['pivot']) > 0: pivot_ax, length_ax = pivot_plot(df, outbase) # pivot_ax.plot(U, sm.distributions.ECDF(df['lee_pivot'][~np.isnan(df['lee_pivot'])])(U), 'g', label='Lee', linewidth=3) pivot_ax.figure.savefig(outbase + '.pdf') length_ax.scatter(df['naive_length'], df['lee_length']) length_ax.figure.savefig(outbase + '_lengths.pdf')
{ "content_hash": "77158e0a48355b2fe9ec2c4f35f647e8", "timestamp": "", "source": "github", "line_count": 108, "max_line_length": 136, "avg_line_length": 33.425925925925924, "alnum_prop": 0.4700831024930748, "repo_name": "selective-inference/selective-inference", "id": "d81ff4cb1b3a0dc7afba52483bf38fb021dd9ad8", "size": "3610", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "doc/learning_examples/multi_target/lee_multi.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "269" }, { "name": "C++", "bytes": "13148" }, { "name": "Python", "bytes": "572490" }, { "name": "R", "bytes": "11134" }, { "name": "TeX", "bytes": "3355" } ], "symlink_target": "" }
- lightweight - flexible - super-fast
{ "content_hash": "ee54849525bc8950210c098dc10a90bb", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 13, "avg_line_length": 12.666666666666666, "alnum_prop": 0.7368421052631579, "repo_name": "ryanlfoster/Felix", "id": "abb01323889608d4222177b549e7cc73288deb5e", "size": "38", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "content/features-left.md", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "57bcf3cb575a3ff86c7139ff1d1edc32", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "27379899b555fcdfe7b2e63e2c40ae14666d74c0", "size": "178", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Ranunculales/Papaveraceae/Corydalis/Corydalis bokuensis/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<h3 class='helptitle ui-widget-header ui-corner-all'>Brief description:</h3> The status page displays information about the current status of the rig client including the overall status, exerciser details and session details. <h3 class='helptitle ui-widget-header ui-corner-all'>Overall status:</h3> The overall status of the rig client can be one of four different states. These are: <ul> <li><span class='bold'>Not registered</span> - When the rig client starts up it registers itself with the configured scheduling server. If this fails, the 'Not registered' state is shown and the rig client is 'dark' from the rest of the remote laboratory system so cannot have users assigned to it. In this state the rig client will periodically attempt to register itself with the scheduling server. If the rig should be registered, some remedial steps are: <ol> <li>Check the rig logs. This should show the cause of failing registration.</li> <li>Check the scheduling server is running.</li> <li>Check the configured scheduling server computer hostname and port are correct (these are the configuration property <span class='code'> Scheduling_Server_Address</span> and <span class='code'> Scheduling_Server_Port</span> for scheduling server hostname and port respectively). <div class='ui-state ui-state-highlight ui-corner-all helphint'> <span class='ui-icon ui-icon-info helphinticon'> </span> <span class='bold'>HINT:</span> Try using the configured scheduling server address with a web browser. If the address is correct the scheduling server administrative interface login should be displayed. For example, if the configured hostname is 'eng047151.eng.uts.edu.au' and the port is 8080, enter 'http://eng047151.eng.uts.edu.au:8080'. The following should be displayed: <div style='text-align:center'> <img src='/img/ss_login.png' alt='Login' /> </div> If this is not displayed either the address is incorrect or there is a problem with the network. </div></li> <li>Check there aren't any firewalls blocking access to the scheduling server. If the computer is Linux, check iptables or if the computer is Windows, check the Windows firewall.</li> <li>Check the rig client name is unqiue. If another rig client has registered with the same name, the rig client will fail scheduling server registration.</li> </ol></li> <li><span class='bold'>Online</span> - In this state the rig client is registered with the scheduling server, all exerciser tests have succeeded and the rig is ready to have users assigned to it.</li> <li><span class='bold'>Offline</span> - In this state the rig client is registered with the rig client but is offline because of some problem. When the rig is offline the reason is also displayed and the logs should have messages stating the problem. The causes of the rig being offline are: <ul> <li>One or more exericiser tests has failed. The 'Exerciser details' panel will show the test that has failed and its reason. To put the rig back offline, resolve the issue causing the tests to fail.</li> <li>The action failure threshold has been exceeded. When an action (such as the '<span class='code'>RemoteDesktopAccessAction</span>' fails, a counter is incremented. When the counter exceeds the action fail threshold, the rig is taken offline. The root cause of the action failure should then be investigated. To put the rig client back online either use the 'Clear Maintenance' button on the 'Main' page. <div class='ui-state ui-state-highlight ui-corner-all helphint'> <span class='ui-icon ui-icon-info helphinticon'> </span> <span class='bold'>HINT:</span> The action fail threshold can be configured using the '<span class='code'>Action_Failure_Threshold </span>' configuration property. </div></li> </ul></li> <li><span class='bold'>In use</span> - The rig is currently being used by a user.</li> </ul> <h3 class='helptitle ui-widget-header ui-corner-all'>Exerciser details:</h3> The exerciser details panel lists all the currently running rig client tests and their states. If a test is offline, the test failure reason is shown. <div class='ui-state ui-state-highlight ui-corner-all helphint'> <span class='ui-icon ui-icon-info helphinticon'> </span> <span class='bold'>HINT:</span>To 'fix' an exerciser test which has put the rig offline, resolve the underlying failure reason and wait till it runs again. </div> <h3 class='helptitle ui-widget-header ui-corner-all'>Session details:</h3> The session details panel lists the currently assigned users to the rig. The types of users who may be in session are: <ul> <li><span class='bold'>Master</span> - The master user is the person initially assigned to the rig by the scheduling server. They 'control' the session and when they leave, either by choice or when the session expires, the session is terminated and all other users are removed.</li> <li><span class='bold'>Slave Active</span> - Slave user who is subsequently assigned to the rig session who <em>should</em> be able to perform control much the same as the master user. </li> <li><span class='bold'>Slave Passive</span> - Slave user who is subsequently assigned to the rig session who <em>should not</em> be able to perform control on the rig. Typically thsese users should be passive session observers.</li> </ul>
{ "content_hash": "09c74a18bf5c4bbc9a572632a5c07355", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 76, "avg_line_length": 54.11, "alnum_prop": 0.7479209018665681, "repo_name": "sahara-labs/rig-client", "id": "d14e5e3f448a94ba84d06acead66a5923f770f08", "size": "5411", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "META-INF/web/doc/Status.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "116618" }, { "name": "CSS", "bytes": "22731" }, { "name": "Java", "bytes": "2385958" }, { "name": "JavaScript", "bytes": "37851" }, { "name": "Shell", "bytes": "1929" } ], "symlink_target": "" }
<?php namespace Application\Application\Command\Doctrine\Company\Warehouse; use Application\Application\Command\Doctrine\AbstractCommand; use Application\Application\Command\Doctrine\AbstractCommandHandler; use Application\Application\Command\Options\UpdateEntityCmdOptions; use Application\Application\Command\Options\UpdateMemberCmdOptions; use Application\Application\Service\SharedServiceFactory; use Application\Domain\Shared\Command\CommandInterface; use Application\Infrastructure\Persistence\Domain\Doctrine\CompanyQueryRepositoryImpl; use Inventory\Domain\Warehouse\BaseWarehouse; use Inventory\Domain\Warehouse\Location\BaseLocation; use Webmozart\Assert\Assert; /** * * @author Nguyen Mau Tri - [email protected] * */ class LockWarehouseCmdHandler extends AbstractCommandHandler { /** * * {@inheritdoc} * @see \Application\Domain\Shared\Command\CommandHandlerInterface::run() */ public function run(CommandInterface $cmd) { /** * * @var UpdateMemberCmdOptions $options ; * @var AbstractCommand $cmd ; */ Assert::isInstanceOf($cmd, AbstractCommand::class); Assert::isInstanceOf($cmd->getOptions(), UpdateEntityCmdOptions::class); $options = $cmd->getOptions(); try { $rep = new CompanyQueryRepositoryImpl($cmd->getDoctrineEM()); $companyEntity = $rep->getById($options->getCompanyVO() ->getId()); /** * * @var BaseWarehouse $rootEntity ; * @var BaseLocation $localEntity ; */ $rootEntity = $options->getRootEntity(); $snapshot = $rootEntity->makeSnapshot(); $sharedService = SharedServiceFactory::createForCompany($cmd->getDoctrineEM()); $rootEntity->lockWarehouse($companyEntity, $options, $sharedService); $this->setOutput($snapshot); // important; $m = sprintf("[OK] WH #%s locked!", $snapshot->getId()); $cmd->addSuccess($m); // event dispatch // ================ if ($cmd->getEventBus() !== null) { $cmd->getEventBus()->dispatch($rootEntity->getRecordedEvents()); } // ================ } catch (\Exception $e) { $cmd->addError($e->getMessage()); throw new \RuntimeException($e->getMessage()); } } }
{ "content_hash": "f6636106ab49647c2b1097288953b528", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 91, "avg_line_length": 34.958333333333336, "alnum_prop": 0.6054827175208581, "repo_name": "ngmautri/nhungttk", "id": "72de08dddce688229551d96f5f741be0379750cd", "size": "2517", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "module/Application/src/Application/Application/Command/Doctrine/Company/Warehouse/LockWarehouseCmdHandler.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "363" }, { "name": "CSS", "bytes": "132055" }, { "name": "HTML", "bytes": "9152608" }, { "name": "Hack", "bytes": "15061" }, { "name": "JavaScript", "bytes": "1259151" }, { "name": "Less", "bytes": "78481" }, { "name": "PHP", "bytes": "18771001" }, { "name": "SCSS", "bytes": "79489" } ], "symlink_target": "" }
namespace android_webview { class ScopedAllowGL { public: ScopedAllowGL(); ~ScopedAllowGL(); static bool IsAllowed(); private: static base::LazyInstance<base::ThreadLocalBoolean> allow_gl; DISALLOW_COPY_AND_ASSIGN(ScopedAllowGL); }; class DeferredGpuCommandService : public gpu::InProcessCommandBuffer::Service, public base::RefCountedThreadSafe<DeferredGpuCommandService> { public: static void SetInstance(); static DeferredGpuCommandService* GetInstance(); void ScheduleTask(const base::Closure& task) override; void ScheduleIdleWork(const base::Closure& task) override; bool UseVirtualizedGLContexts() override; scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache() override; void RunTasks(); // If |is_idle| is false, this will only run older idle tasks. void PerformIdleWork(bool is_idle); // Flush the idle queue until it is empty. This is different from // PerformIdleWork(is_idle = true), which does not run any newly scheduled // idle tasks during the idle run. void PerformAllIdleWork(); void AddRef() const override; void Release() const override; protected: ~DeferredGpuCommandService() override; friend class base::RefCountedThreadSafe<DeferredGpuCommandService>; private: friend class ScopedAllowGL; static void RequestProcessGL(bool for_idle); DeferredGpuCommandService(); size_t IdleQueueSize(); base::Lock tasks_lock_; std::queue<base::Closure> tasks_; std::queue<std::pair<base::Time, base::Closure> > idle_tasks_; scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; DISALLOW_COPY_AND_ASSIGN(DeferredGpuCommandService); }; } // namespace android_webview #endif // ANDROID_WEBVIEW_BROWSER_DEFERRED_GPU_COMMAND_SERVICE_H_
{ "content_hash": "f02eff0a5b92e746b45b890212dc93b4", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 76, "avg_line_length": 29.21311475409836, "alnum_prop": 0.7519640852974186, "repo_name": "TheTypoMaster/chromium-crosswalk", "id": "b0e8756e72989b028f82958b0eff3e6b90bdc1b2", "size": "2319", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "android_webview/browser/deferred_gpu_command_service.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "AppleScript", "bytes": "6973" }, { "name": "Arduino", "bytes": "464" }, { "name": "Assembly", "bytes": "37073" }, { "name": "Batchfile", "bytes": "8451" }, { "name": "C", "bytes": "9417055" }, { "name": "C++", "bytes": "240920124" }, { "name": "CSS", "bytes": "938860" }, { "name": "DM", "bytes": "60" }, { "name": "Groff", "bytes": "2494" }, { "name": "HTML", "bytes": "27258381" }, { "name": "Java", "bytes": "14580273" }, { "name": "JavaScript", "bytes": "20507007" }, { "name": "Makefile", "bytes": "70992" }, { "name": "Objective-C", "bytes": "1742904" }, { "name": "Objective-C++", "bytes": "9967587" }, { "name": "PHP", "bytes": "97817" }, { "name": "PLpgSQL", "bytes": "178732" }, { "name": "Perl", "bytes": "63937" }, { "name": "Protocol Buffer", "bytes": "480579" }, { "name": "Python", "bytes": "8519074" }, { "name": "Shell", "bytes": "482077" }, { "name": "Standard ML", "bytes": "5034" }, { "name": "XSLT", "bytes": "418" }, { "name": "nesC", "bytes": "18347" } ], "symlink_target": "" }
/* * This file is part of the Heritrix web crawler (crawler.archive.org). * * Licensed to the Internet Archive (IA) by one or more individual * contributors. * * The IA licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.archive.net.s3; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; /** * Handler for Amazon S3 URLs of the form * * s3://id:secret@bucket/key * * @author jlee */ public class Handler extends URLStreamHandler { public URLConnection openConnection(URL url) { return new S3URLConnection(url); } }
{ "content_hash": "a36c075846f4ae2ed45f4994d5996f9b", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 76, "avg_line_length": 31.166666666666668, "alnum_prop": 0.7228163992869875, "repo_name": "searchtechnologies/heritrix-connector", "id": "d00642cd1f9eb1249b1ee5ae38c27ea3551daeae", "size": "1122", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "engine-3.1.1/commons/src/main/java/org/archive/net/s3/Handler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "3838" }, { "name": "HTML", "bytes": "129148" }, { "name": "Java", "bytes": "3979351" }, { "name": "JavaScript", "bytes": "132852" }, { "name": "PostScript", "bytes": "12552" }, { "name": "XSLT", "bytes": "19409" } ], "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"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.spark</groupId> <artifactId>spark-parent_2.12</artifactId> <version>3.3.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <!-- Ganglia integration is not included by default due to LGPL-licensed code --> <artifactId>spark-ganglia-lgpl_2.12</artifactId> <packaging>jar</packaging> <name>Spark Ganglia Integration</name> <properties> <sbt.project.name>ganglia-lgpl</sbt.project.name> </properties> <dependencies> <dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-core_${scala.binary.version}</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>info.ganglia.gmetric4j</groupId> <artifactId>gmetric4j</artifactId> <version>1.0.10</version> </dependency> </dependencies> </project>
{ "content_hash": "afa333b2e6d2a72c41ca1e8b0a34da4e", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 204, "avg_line_length": 40.5625, "alnum_prop": 0.7205957883923986, "repo_name": "jiangxb1987/spark", "id": "52994d9ffedee2f788f874010f24edaab3a6033c", "size": "1947", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "external/spark-ganglia-lgpl/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "50024" }, { "name": "Batchfile", "bytes": "31352" }, { "name": "C", "bytes": "1493" }, { "name": "CSS", "bytes": "26836" }, { "name": "Dockerfile", "bytes": "9014" }, { "name": "HTML", "bytes": "41387" }, { "name": "HiveQL", "bytes": "1890736" }, { "name": "Java", "bytes": "4123643" }, { "name": "JavaScript", "bytes": "203741" }, { "name": "Makefile", "bytes": "7776" }, { "name": "PLpgSQL", "bytes": "380679" }, { "name": "PowerShell", "bytes": "3865" }, { "name": "Python", "bytes": "3130521" }, { "name": "R", "bytes": "1186948" }, { "name": "Roff", "bytes": "21950" }, { "name": "SQLPL", "bytes": "9325" }, { "name": "Scala", "bytes": "31707827" }, { "name": "Shell", "bytes": "203944" }, { "name": "TSQL", "bytes": "466993" }, { "name": "Thrift", "bytes": "67584" }, { "name": "q", "bytes": "79845" } ], "symlink_target": "" }
FROM balenalib/bananapi-m1-plus-debian:bookworm-run # remove several traces of debian python RUN apt-get purge -y python.* # http://bugs.python.org/issue19846 # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 # install python dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ netbase \ && rm -rf /var/lib/apt/lists/* # key 63C7CC90: public key "Simon McVittie <[email protected]>" imported # key 3372DCFA: public key "Donald Stufft (dstufft) <[email protected]>" imported RUN gpg --batch --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \ && gpg --batch --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \ && gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059 ENV PYTHON_VERSION 3.7.12 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" ENV PYTHON_PIP_VERSION 21.3.1 ENV SETUPTOOLS_VERSION 60.5.4 RUN set -x \ && buildDeps=' \ curl \ ' \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-armv7hf-libffi3.3.tar.gz" \ && echo "d8d0dd3457e8491022d8e736860f4dd747a0a8bb93a3b1319fe9d2610b0006b0 Python-$PYTHON_VERSION.linux-armv7hf-libffi3.3.tar.gz" | sha256sum -c - \ && tar -xzf "Python-$PYTHON_VERSION.linux-armv7hf-libffi3.3.tar.gz" --strip-components=1 \ && rm -rf "Python-$PYTHON_VERSION.linux-armv7hf-libffi3.3.tar.gz" \ && ldconfig \ && if [ ! -e /usr/local/bin/pip3 ]; then : \ && curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \ && echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \ && python3 get-pip.py \ && rm get-pip.py \ ; fi \ && pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \ && find /usr/local \ \( -type d -a -name test -o -name tests \) \ -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ -exec rm -rf '{}' + \ && cd / \ && rm -rf /usr/src/python ~/.cache # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ && ln -sf pip3 pip \ && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -sf idle3 idle \ && ln -sf pydoc3 pydoc \ && ln -sf python3 python \ && ln -sf python3-config python-config # set PYTHONPATH to point to dist-packages ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH 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/[email protected]" \ && echo "Running test-stack@python" \ && chmod +x [email protected] \ && bash [email protected] \ && rm -rf [email protected] 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: ARM v7 \nOS: Debian Bookworm \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.7.12, Pip v21.3.1, Setuptools v60.5.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": "a7cf46a2eeb7e5d689c08099b2ccb46b", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 711, "avg_line_length": 52.30769230769231, "alnum_prop": 0.707843137254902, "repo_name": "resin-io-library/base-images", "id": "eb222d926e313ecb708ff58d5c32f325611e7ca0", "size": "4101", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "balena-base-images/python/bananapi-m1-plus/debian/bookworm/3.7.12/run/Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "71234697" }, { "name": "JavaScript", "bytes": "13096" }, { "name": "Shell", "bytes": "12051936" }, { "name": "Smarty", "bytes": "59789" } ], "symlink_target": "" }
I started this challenge on *insert date here*. I completed this challenge on *insert date here*. ## Log --- ### **Day 1:** *insert date here* Today **I did**: **I learned:** **Link:** *insert link to todays work here* ## *README* *You can remove this section once you get started. For each day, simply copy the format above (or use your own if you want) to record your progress. Remember...this process is to benefit YOU to help you retain your knowledge longer.*
{ "content_hash": "0a3e87c396e00d054cd17b99951b01ea", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 235, "avg_line_length": 34, "alnum_prop": 0.6974789915966386, "repo_name": "Staxed/30Days30Sites-Main", "id": "cad986205e4d14666233a3d3d208f28ff2bac84a", "size": "507", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "log.md", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
\documentclass[a4paper,12pt]{article} \usepackage{ucs} %для использования юникода \usepackage[T2A]{fontenc} %поддержка кириллицы в ЛаТеХ \addtolength{\hoffset}{-1.7mm} % горизонтальное смещение всего текста как целого \usepackage[utf8]{inputenc} %По умолчанию кодировка KOI8 для *nix-систем \usepackage[english,russian]{babel} %определение языков в документе \usepackage{amssymb,amsmath,amsfonts,latexsym,mathtext} %расширенные наборы % математических символов \usepackage{cite} %"умные" библиографические ссылки %(сортировка и сжатие) \usepackage{indentfirst} %делать отступ в начале параграфа \usepackage{enumerate} %создание и автоматическая нумерация списков \usepackage{tabularx} %продвинутые таблицы %\usepackage{showkeys} %раскомментируйте, чтобы в документе были видны %ссылки на литературу, рисунки и таблицы \usepackage[labelsep=period]{caption} %заменить умолчальное разделение ':' на '.' % в подписях к рисункам и таблицам %\usepackage[onehalfspacing]{setspace} %"умное" расстояние между строк - установить % 1.5 интервала от нормального, эквивалентно \renewcommand{\baselinestretch}{1.24} \usepackage{graphicx} %разрешить включение PostScript-графики \graphicspath{{Images/}} %относительный путь к каталогу с рисунками,это может быть мягкая ссылка \usepackage{listingsutf8} \lstset{columns=fixed,language=C++,% basicstyle=\scriptsize,breaklines=\true,inputencoding=cp1251} \RequirePackage{caption} \DeclareCaptionLabelSeparator{defffis}{ -- } \captionsetup{justification=centering,labelsep=defffis} \usepackage{geometry} %способ ручной установки полей \geometry{top=2cm} %поле сверху \geometry{bottom=2cm} %поле снизу \geometry{left=2cm} %поле справа \geometry{right=1cm} %поле слева \usepackage[colorlinks,linkcolor=blue]{hyperref}%гиперссылки в тексте \newcommand{\tocsecindent}{\hspace{7mm}}% отступ для введения \makeatletter \bibliographystyle{unsrt} %Стиль библиографических ссылок БибТеХа - нумеровать %в порядке упоминания в тексте \renewcommand{\@biblabel}[1]{#1.} \makeatother \begin{document} %Титулный лист \input{TitleList} \setcounter{page}{2} % начать нумерацию с номера три \renewcommand{\figurename}{Рисунок} \newpage \input{Task} \input{Description} \input{Listing} \end{document}
{ "content_hash": "d8929858df6747ea2c0c95d39d3e9986", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 96, "avg_line_length": 33.492537313432834, "alnum_prop": 0.7932263814616756, "repo_name": "djbelyak/OOPLab-Tree", "id": "4ace14b9da74c04c6a9c5226abc8c0a4a40fa4f6", "size": "3056", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/Report.tex", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "1258" }, { "name": "TeX", "bytes": "21596" } ], "symlink_target": "" }
locator ======= The locator gives semantic meaning to files on the filesystem. It does this with a set of "rules" that describes how each file path should be interpreted. In addition it groups files into "bundles". (Each bundle is usually an NPM module, but not always.) The locator doesn't _interpret_ the semantic meaning of the files. It is up to the user to understand and use the semantic meanings associated with the files. [![Build Status](https://travis-ci.org/yahoo/locator.png?branch=master)](https://travis-ci.org/yahoo/locator) ## Goals & Design * provide an abstraction over filesystem paths * set of "rules" (regexps basically) that determine the semantic meaning of each file * files that match a rule (and thus have semantic meaning) are called "resources" * built-in handling of "selectors", for resources that have multiple versions * organize files in bundles * bundles are usually NPM modules * ...but can be something else, if an NPM module delivers multiple child bundles * bundles are recursively walked, since they are often organized in a tree structure on disk * bundles can have different types * for example, a mojito application bundle is walked differently (uses a different ruleset) than a mojito mojit bundle * each bundle can declare its type in its `package.json` (for those bundles that are NPM modules) * each bundle can also describe the type of child bundles found at certain paths (for e.g. mojito application that has mojit bundles at a certain place) * configurable * the behavior of the locator should be configurable, which should include * ...defining new rulesets, for new bundle types * ...general runtime behavior configuration of returned values * ...etc ## Installation Install using npm: ```shell $ npm install locator ``` ## Example: Mojito Application In your app's `package.json`: ```javascript { "dependencies": { ... "mojito": "*", ... }, "locator": { "rulesets": "mojito/locator-rulesets" } } ``` ## Example: Defining Your Own Semantics In your app's `package.json`: ```javascript { "locator": { "rulesets": "locator-rulesets" } } ``` A new `locator-rulesets.js` file which defines how to add semantic meaning to filesystem paths: ```javascript module.exports = { // nameKey defaults to 1 // selectorKey has no default. selector is only used if selectorKey is given main: { // we can use this to skip files _skip: [ /^tests?\b/i ], // where to find configuration files configs: { regex: /^configs\/([a-z_\-\/]+)\.(json|js)$/i }, // where to find templates templates: { regex: /^templates\/([a-z_\-\/]+)(\.([\w_\-]+))?\.[^\.\/]+\.html$/i, // We use "selectors" because we might use different templates based // on different circumstances. selectorKey: 3 }, // where to find CSS files css: { regex: /^public\/css\/([a-z_\-\/]+)\.css$/i } } }; ``` Then, in your `app.js` (or wherever makes sense to you) you can do something like: ```javascript var Locator = require('locator'); locator = new Locator(); var resources = locator.parseBundle(__dirname); // access your "configs/foo.json" configuration file ... resources.configs.foo ... // access all your templates Object.keys(resources.templates).forEach(function (templateName) { var templateResource = resources.templates[templateName]; ... }); ``` ## Example: Defining Your Own Bundle Name In your app's `package.json`: ```javascript { "name": "usually-a-long-name-for-npm" "locator": { "name": "foo" } } ``` By default, locator will select the name of the bundle from the `package.json->name` entry, but you should be able to specify a custom name by adding a `name` entry under the `locator` entry in package.json. This will help to decouple the name of the package from the urls that you will use to fetch those scripts from the client side. ## License This software is free to use under the Yahoo! Inc. BSD license. See the [LICENSE file][] for license text and copyright information. [LICENSE file]: https://github.com/yahoo/locator/blob/master/LICENSE.txt ## Contribute See the [CONTRIBUTING.md file][] for information on contributing back to Locator. [CONTRIBUTING.md file]: https://github.com/yahoo/locator/blob/master/CONTRIBUTING.md
{ "content_hash": "d8bafee3a94605458c85ec1293f3c0c3", "timestamp": "", "source": "github", "line_count": 144, "max_line_length": 335, "avg_line_length": 31.493055555555557, "alnum_prop": 0.6712238147739802, "repo_name": "yahoo/locator", "id": "52ce8c44f793180c56bcace260418602a09d602b", "size": "4535", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "JavaScript", "bytes": "69865" } ], "symlink_target": "" }
> NOTE : The short forms used in this encoding doc are as follows : > C : constant (value is the constant specified) > V : variable (value is the address where variable V is located) > Arr[C] => V (since, the final value is address(Arr) + C, viz a variable). Note that V will be used instead of Arr[C] throughout the document. > Arr[V] : array indexed by variable V (I should probably write how the variable stuff work here... and also how the doc is structured) ##1. SET instruction The SET instruction is of the form ``` SET x, y ``` where **x** (operand-1) can be either **V or Arr[v]** whereas **y** (operand-2) can be either **C, V, Arr[v]**. The general function of this instruction is to set variable values. (In some cases it is also used to create variables) There are many possible ways a **SET** instruction can be used based on how we choose **x** and **y** There are three possible opcodes (as given below) that handle all conditions of x, y. > OPCODE used : 0x10 (16) to 0x12 (18) ###1.a ```SET V, C``` This is a 32 bit instruction. This instruction is the case when operand-1 is a **V or A[c]** and opernad-2 is a **constant (max 16 bit)**. **opcode** ```c 0x10 (16) ``` **operation** ``` Sets the value of variable V to the 16 bit int value C. If V has not been previously defined, it creates and assigns. ``` **encoding format** (each value separated by a comma takes one byte) ```c OPCODE, VARIABLE, CONST-hi, CONST-lo Byte3 : 0001-0000 : (OPCODE - Fixed) Byte2 : VARIABLE : (address of the variable V) Byte1 : CONST-hi : (MS-byte of constant C) Byte0 : CONST-lo : (LS-byte of constant C) ``` **Example** ``` coming soon :) ``` ###1.b ```SET V1, V2``` This is a 32 bit instruction. This instruction is the case when operand-1 and operand-2 are either **V** (or Arr[c]) **opcode** ```c 0x11 (17) ``` **operation** ``` Sets the value of variable V1 to the value of variable V2. If V1 has not been previously defined, it creates and assigns. (give some more explanation? or put that in the examples? - I think in example is better) ``` **encoding format** (each value separated by a comma takes one byte) ```c OPCODE, VARIABLE, unused, VARIABLE Byte3 : OPCODE : 0001-0001 (OPCODE - Fixed) Byte2 : VARIABLE : (address of the variable V1) Byte1 : unused : (unused) Byte0 : VARIABLE : (address of the variable V2) ``` **Example** ``` coming soon :) ``` ###1.c ```SET x, y``` This is a **64 bit** instruction. This instruction is the case when either **x** (operand-1) or **y** (operand-2) is of the form **Arr[v]**. The possible forms of instructions : ``` SET V1, Arr[V2] SET Arr[V], 280 SET Arr[V1], V2 SET Arr[V1], Arr[V2] ``` **opcode** ```c 0x12 (18) ``` **operation** ``` Sets the value of variable "x" to the value of "y" If "x" is a variable (not Arr[v]) and has not been previously defined, it creates and assigns. If "x" is of type Arr[v], and Arr has not been defined, it is an error. ``` **encoding format** (each value separated by a comma takes one byte) ``` OPCODE, OP_type , OP1.b, OP1.a unused, unused , OP2.b, OP2.a (OP1 : x, OP2 : y) Byte3 : OPCODE : 0001-0010 (OPCODE - Fixed) Byte2 : OP_type : (operand type - since the operands can be of any type, this indicates what the operands are) Byte1 : OP1.b : (reserved for operator 1, actual value depends on OP_decider) Byte0 : OP1.a : (reserved for operator 1, actual value depends on OP_decider) Byte4 : OP2.b : (reserved for operator 2, actual value depends on OP_decider) Byte5 : OP2.a : (reserved for operator 2, actual value depends on OP_decider) Byte6 : unused : unused Byte7 : unused : unused OP_Type (8 bits) 00 00 - 0000 \ / \ / \ / x y unused bit 7,6 : type of operand x bit 5,4 : type of operand y bit encoding that indicate what the corresponding operators are : (and what they represent in the encoding in each case) 00 => C (Constant) OP.a : Const-lo OP.b : Const-hi 01 => V (Variable) OP.a : Variable address of V OP.b : unused 10 => Arr[V] OP.a : Variable address of V OP.b : Array address of Arr. (add a simple example here) ``` **Example** ``` coming soon :) ``` ##2. SET RES[] instruction This instruction is of the form ``` SET RES[x], y ``` Where **RES** is a reserved array variable such as **DIO, PWM, COM, TMR, AIO**; **x** can be either **C or V** where as **y** (operand-2) can be either **C, V, Arr[v]**. This behaves like a regular SET instruction, but has been given special opcodes as : * These instruction use reserved arrays * They are used often, so giving exclusive byte code makes execution faster on the PRU * Normally these sort of instructions will take 64bits; whereas here all take only 32bits Hence these inst are not compiled as a part of normal **SET** instruction. > OPCODE used : 0x01 (1) to 0xFF (15) ###2.a ```SET DIO[x], y``` This is a 32 bit instruction. Here **x** and **y** can be either a Constant (C) or Vriable(V). The possible forms of the instruction : ``` SET DIO[C], C SET DIO[C], V SET DIO[V], C SET DIO[V], V ``` **opcode** ```c 0x01 (01) ``` **operation** ``` Sets the specified digital output to either high or low (see more in the examples) ``` **encoding format** ``` OPCODE, OP_type, OP1, OP2 Byte3 : OPCODE : 0000-0001 (OPCODE - Fixed) Byte2 : OP_type : (operand type - this indicates what type the operands are) Byte1 : OP1 : (not exactly operand1, but rather 'x' in DIO[x]) Byte0 : OP2 : (operand2, (i.e.) "y")) Note : actual value of OP1 and OP2 will depend on type of "x" and "y". and the type information is encoded in OP_type as given below. OP_type (making sense of the 8 bits) 0 0 00-0000 | | \ / x y unused bit 7 - type of "x" bit 6 - type of "y" semantics 0 => type is constant C 1 => type is Variable V (add a simple example here) ``` **Example** ``` coming soon :) ``` ###2.b ```SET DIO[C], Arr[V]``` This is a 32 bit instruction. Here first operand is **DIO** indexed by a Constant (C) and the second operand is a variable indexed Array (Arr[v]). **opcode** ```c 0x02 (02) ``` **operation** ``` Sets the specified digital output to either high or low (see more in the examples) ``` **encoding format** ``` OPCODE, CONST, Arr, VARIABLE Byte3 : OPCODE : 0000-0010 (OPCODE - Fixed) Byte2 : CONST : CONSTANT value C Byte1 : Arr : Array address Byte0 : VARIABLE : address of variable V (add a simple example here) ``` **Example** ``` coming soon :) ``` ###2.c ```SET DIO[V1], Arr[V2]``` This is a 32 bit instruction. Here first operand is **DIO** indexed by a Variable (V1) and the second operand is a variable indexed Array (Arr[v2]). **opcode** ```c 0x03 (03) ``` **operation** ``` Sets the specified digital output to either high or low (see more in the examples) ``` **encoding format** ``` OPCODE, VARIABLE, Arr, VARIABLE Byte3 : OPCODE : 0000-0010 (OPCODE - Fixed) Byte2 : VARIABLE : address of variable V1 Byte1 : Arr : Array address Byte0 : VARIABLE : the array index value - variable value V2 (add a simple example here) ``` **Example** ``` coming soon :) ``` ###2.d ```SET PWM[x], y``` This is a 32 bit instruction. Here **x** and **y** can be either a Constant (C) or Vriable(V). The possible forms of the instruction : ``` SET PWM[C], C SET PWM[C], V SET PWM[V], C SET PWM[V], V ``` **opcode** ```c 0x04 (04) ``` **operation** ``` Sets the specified PWM output to the mentioned value (see more in the examples) ``` **encoding format** ``` Same as 2.a (change only opcode) ``` **Example** ``` coming soon :) - or see 2.a again? ``` ###2.e ```SET PWM[C], Arr[V]``` This is a 32 bit instruction. Here first operand is **DIO** indexed by a Constant (C) and the second operand is a variable indexed Array (Arr[v]). **opcode** ```c 0x05 (05) ``` **operation** ``` Sets the specified PWM output to the mentioned value (see more in the examples) ``` **encoding format** ``` same as 2.a ``` **Example** ``` coming soon :) ``` ###2.f ```SET PWM[V1], Arr[V2]``` This is a 32 bit instruction. Here first operand is **DIO** indexed by a Variable (V1) and the second operand is a variable indexed Array (Arr[v2]). **opcode** ```c 0x06 (06) ``` **operation** ``` Sets the specified PWM output to the mentioned value (see more in the examples) ``` **encoding format** ``` same as 2.a ``` **Example** ``` coming soon :) ``` ###2.x AIO, TMR, COM Instructions > Just like DIO & PWM, the above mentioned instructions have 3 opcodes for each of the following instruction type * SET RES[C], C/V * SET RES[C], Arr[V] * SET RES[V], Arr[V] **Only** things that change are the **operation** and **OPCODE**. (encoding and examples are more or less the same) ####Operation ``` AIO : Sets the value of the anolog output COM : Writes the value to the indexed com port. TMR : Sets the timer value ``` ####OPCODE ``` AIO : 0x07, 0x08, 0x09 COM : 0x0A, 0x0B, 0x0C TMR : 0x0D, 0x0E, 0x0F ``` ##3. IF instruction This instruction is of the form ``` IF ( x <cond> y ) GOTO z ``` Where **x** (first operand), **y** (second operand), **z** (third operand) can be any of C, V, Arr[V]. Here <cond> is a relational operator such as '>', '<', '==', '!=' etc. There is no different cases for this instruction, rather one **64 bit** instruction which handles all possible variable types internally. **opcode** ```python The **OPCODE** starts from 0x20 (0b0010-0000) and ends at 0x2F (0b0010-1111). How this works is this instruction reserves the "0b0010-xxxx" instruction space. The last 4 bits takes its value based upon <cond>. The mapping is as shown below. cond_code = { '==' : 0b0000, '!=' : 0b0001, '>=' : 0b0010, '<=' : 0b0011, '>' : 0b0100, '<' : 0b0101 } ``` **operation** ``` The comparision is carried out between "x" and "y", if the result is true, then the IP (inst pointer) jumps to the inst number specified by "x" ``` **encoding** ``` OPCODE, OP_type, OP1.b, OP1.a OP3.b , OP3.a, OP2.b, OP2.a (x : OP1, y: OP2, z : OP3) Byte3 : OPCODE : 0001-0010 (OPCODE - Fixed) Byte2 : OP_type : (operand type - since the operands can be of any type, this indicates what the operands are) Byte1 : OP1.b : (reserved for operator 1, actual value depends on OP_decider) Byte0 : OP1.a : (reserved for operator 1, actual value depends on OP_decider) Byte4 : OP2.b : (reserved for operator 2, actual value depends on OP_decider) Byte5 : OP2.a : (reserved for operator 2, actual value depends on OP_decider) Byte6 : OP3.a : (reserved for operator 3, actual value depends on OP_decider) Byte7 : OP3.b : (reserved for operator 3, actual value depends on OP_decider) Note : actual value of OP1 and OP2 will depend on type of "x" and "y". and the type information is encoded in OP_type as given below. OP_type (making sense of the 8 bits) 00 00 - 00 00 \ / \ / \ /\ / x y z unused bit 7,6 : type of operand x bit 5,4 : type of operand y bit 3,2 : type of operand z bit encoding that indicate what types the corresponding operators are : (and how they are placed in the byte encoding in each case) 00 => C (Constant) OP.a : Const OP.b : unused 01 => V (Variable) OP.a : Variable address of V OP.b : unused 10 => Arr[V] OP.a : Variable address of V OP.b : Array address of Arr. (add a simple example here) ``` **Example** ``` coming soon :) ``` ##4. WAIT instruction This instruction is of the form ``` WAIT x ``` where **x** (the only operand) can be of type **C or V or Arr[v]** This is a 32 bit instruction. **opcode** ```c 0x14 (20) ``` **operation** ``` Executing this command will pause the execution of the running script for "x" mili seconds. (The wait is non blocking - more about this later) ``` **encoding** ``` OPCODE, OP_type, OP.b, OP.a since the operand can be any of three types, the OP_type will tell us the type of "x" in the instruction. The OP_type is encoded as follows 00 00 - 0000 \/ \ / x unused bit value to type of OP ("x") mapping : 00 => OP is of type 'C' OP.a = Const OP.b = unused 01 => OP is of type 'V' OP.a = VARIABLE OP.b = unused 10 => OP is of type Arr[V] OP.a = VARIABLE OP.b = ARR ``` **examples** ``` coming soon :) ``` ##5. GOTO instruction This instruction is of the form ``` GOTO x ``` where **x** (the only operand) can be of type **C or V or Arr[v]** This is a 32 bit instruction. **opcode** ```c 0x15 (21) ``` **operation** ``` Executing this command will cause the IP (instruction pointer) to jump to instruction number "x" ``` **encoding** ``` OPCODE, OP_type, OP.b, OP.a since the operand can be any of three types, the OP_type will tell us the type of "x" in the instruction. The OP_type is encoded as follows 00 00 - 0000 \/ \ / x unused bit value to type of OP ("x") mapping : 00 => OP is of type 'C' OP.a = Const OP.b = unused 01 => OP is of type 'V' OP.a = VARIABLE OP.b = unused 10 => OP is of type Arr[V] OP.a = VARIABLE OP.b = ARR ``` **examples** ``` coming soon :) ``` ##6. GET instruction This instruction is of the form ``` GET x ``` where **x** (the only operand) can be of type **C or V or Arr[v]** This is a 32 bit instruction. **opcode** ```c 0x16 (22) ``` **operation** ``` Executing this command will return the value of "x" ``` **encoding** ``` OPCODE, OP_type, OP.b, OP.a since the operand can be any of three types, the OP_type will tell us the type of "x" in the instruction. The OP_type is encoded as follows 00 00 - 0000 \/ \ / x unused bit value to type of OP ("x") mapping : 00 => OP is of type 'C' OP.a = Const OP.b = unused 01 => OP is of type 'V' OP.a = VARIABLE OP.b = unused 10 => OP is of type Arr[V] OP.a = VARIABLE OP.b = ARR ``` **examples** ``` coming soon :) ``` ##7. ARITHMETIC and BIT instructions This instruction is of the form ``` INS x, y ``` where **INS** is a arithmetic or bitwise operation command; **x** (operand1) and **y** (operand2) can be of type **C or V or Arr[v]** There are **32 bit** and **64 bit** variations for each instruction. **opcode** > Each **INST** uses 2 opcodes (one for 32 bit encoding, another for 64 bit) based on what the **x**, **y** values are. opcode starts from 48 (0011-0000), ends at 79 (0100-1111). Bit excoding is done based on this map containing **INST** to the LS nibble value of the corresponding OPCODE. ```python opcode_dict = { #These inst own the (0011-XXXX) address space 'ADD' : 48, 'SUB' : 50, 'MUL' : 52, 'DIV' : 54, 'MOD' : 56, #These inst own the (0100-XXXX) address space 'BSL' : 64, 'BSR' : 66, 'AND' : 68, 'OR' : 70, 'NOT' : 72 } ``` ###7.a ADD V, y This is a 32 bit instruction where **y** can be a variable or constant. **opcode** ```c 0x30 (48) ``` **operation** ``` Executing this command will add y to V and return the new value of V ``` **encoding** ``` OPCODE, OP_type, VARIABLE, OP Byte3 : OPCODE : 0011-0000 (OPCODE - Fixed) Byte2 : OP_type : (operand type - since the operands can be of any type, this indicates what the operands are) Byte1 : VARIABLE : (the address of variable V) Byte0 : OP : (reserved for operator 1, actual value depends on OP_decider) since the operand can be C or V, the OP_type will tell us the type of "y" in the instruction. The OP_type (8bits) is encoded as follows : 1000 - 0000 | y if bit 6 == 0 type(y) = C OP -> C if bit 6 == 1 type(y) = VARIABLE OP -> address of variable "y" ``` **examples** ``` coming soon :) ``` ###7.b ADD x, y This is a **64 bit** instruction where either **x** or **y** is of type Arr[V] Note that **x** can't be of type C, while **y** can be of any type. **opcode** ```c 0x31 (49) ``` **operation** ``` Executing this command will add y to x and return the new value of x ``` **encoding** ``` OPCODE, OP_type , OP1.b, OP1.a unused, unused , OP2.b, OP2.a (OP1 : x, OP2 : y) Byte3 : OPCODE : 0011-0001 (OPCODE - Fixed) Byte2 : OP_type : (operand type - since the operands can be of any type, this indicates what the operands are) Byte1 : OP1.b : (reserved for operator 1, actual value depends on OP_decider) Byte0 : OP1.a : (reserved for operator 1, actual value depends on OP_decider) Byte4 : OP2.b : (reserved for operator 2, actual value depends on OP_decider) Byte5 : OP2.a : (reserved for operator 2, actual value depends on OP_decider) Byte6 : unused : unused Byte7 : unused : unused OP_Type (8 bits) 00 00 - 0000 \ / \ / \ / x y unused bit 7,6 : type of operand x bit 5,4 : type of operand y bit encoding that indicate what the corresponding operators are : (and what they represent in the encoding in each case) 00 => C (Constant) OP.a : Const-lo OP.b : Const-hi 01 => V (Variable) OP.a : Variable address of V OP.b : unused 10 => Arr[V] OP.a : Variable address of V OP.b : Array address of Arr. (add a simple example here) ``` **examples** ``` coming soon :) ``` ###7.x SUB, MUL, DIV, OR, AND, BSL/R, NOT instructions These instructions are similar to **ADD** discussed above. Each have two versions - 32bit and 64 bit version. The opcode for the 32 bit version has been mentioned at the begining of section 7, the OPCODE for 64 bit is opcode for 32 bit + 1 The encoding pattern is the same, only thing that changes is the pattern **operation** ``` SUB x, y : x = x - y, return x MUL x, y : x = x * y, return x DIV x, y : x = x / y, return x AND x, y : x = x & y, return x OR x, y : x = x | y, return x BSL x, y : x = x >> y, return x BSR x, y : x = x << y, return x NOT x, y : x = ~y, return x ``` ##8. HALT instruction Simple instruction with no operands **opcode** ```c 0x7F (127) ``` **operation** ``` Executing this instruction halts an ongoing BotSpeak script in the PRU. If no script is running, this instruction does nothing. ``` **encoding** ``` OPCODE, unused, unused, unused Byte3 : OPCODE : 0111-1111 (fixed) Byte2-0 : unused : unused ``` **examples** ``` coming soon ``` ##9. ABORT, DEBUG, RUN, (END)SCRIPT instructions These instructions are known as **control instructions**. They are not run on the PRU, rather are interpreted on the Linux side. (userspace python lib for now, may later be moved to the kernel) **opcode** ```c None - it is not compiled, rather the compiler framework itself interprets the cmd and does the needful. ``` **operation** ``` ABORT : kills the current script, all variables and arrays defined are freed. DEBUG : streams the PRU Speak variables and state to the userspace. SCRIPT : marks the starting of a script. ENDSCRIPT : marks the ending of a script. RUN : runs the most recently defined script. ``` **encoding** ``` NO enccoding ``` **examples** ``` coming soon ```
{ "content_hash": "dfc193853fb7e7cbfe8ad5b61f45d94b", "timestamp": "", "source": "github", "line_count": 869, "max_line_length": 193, "avg_line_length": 21.80897583429229, "alnum_prop": 0.6442591810890671, "repo_name": "deepakkarki/pruspeak", "id": "a073e15458682be6ba3e912135d8f1d6d9bfb347", "size": "18973", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/userspace_lib/README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "557" }, { "name": "Batchfile", "bytes": "1463" }, { "name": "C", "bytes": "117044" }, { "name": "Makefile", "bytes": "1488" }, { "name": "Python", "bytes": "44467" }, { "name": "Shell", "bytes": "595" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (C) 2016 Hurence ([email protected]) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <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"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.hurence.logisland</groupId> <artifactId>logisland-plugins</artifactId> <version>0.10.0-SNAPSHOT</version> </parent> <artifactId>logisland-common-processors-plugin</artifactId> <packaging>jar</packaging> <dependencies> <dependency> <groupId>com.hurence.logisland</groupId> <artifactId>logisland-api</artifactId> </dependency> <dependency> <groupId>com.hurence.logisland</groupId> <artifactId>logisland-utils</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-math3</artifactId> </dependency> <dependency> <groupId>org.apache.avro</groupId> <artifactId>avro</artifactId> </dependency> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-email</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </dependency> </dependencies> </project>
{ "content_hash": "191707483190a65d7a3fa4b381233acb", "timestamp": "", "source": "github", "line_count": 87, "max_line_length": 204, "avg_line_length": 35.758620689655174, "alnum_prop": 0.6136290581806493, "repo_name": "MiniPlayer/log-island", "id": "52e63ca191c32d831920ffbf2ed310c23aa4499f", "size": "3111", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "logisland-plugins/logisland-common-processors-plugin/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "3163" }, { "name": "HTML", "bytes": "32441" }, { "name": "Java", "bytes": "2489666" }, { "name": "JavaScript", "bytes": "32790" }, { "name": "Makefile", "bytes": "6774" }, { "name": "Python", "bytes": "4205508" }, { "name": "Roff", "bytes": "3242333" }, { "name": "Scala", "bytes": "274678" }, { "name": "Shell", "bytes": "31034" } ], "symlink_target": "" }
/** * This code was auto-generated by a Codezu. * * Changes to this file may cause incorrect behavior and will be lost if * the code is regenerated. */ package com.mozu.api.contracts.productruntime; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.joda.time.DateTime; import java.io.IOException; import java.lang.ClassNotFoundException; /** * Validates the attribute configured for the customer in the storefront against the attribute configured in . */ @JsonIgnoreProperties(ignoreUnknown = true) public class AttributeValidation implements Serializable { // Default Serial Version UID private static final long serialVersionUID = 1L; protected DateTime maxDateValue; public DateTime getMaxDateValue() { return this.maxDateValue; } public void setMaxDateValue(DateTime maxDateValue) { this.maxDateValue = maxDateValue; } protected double maxNumericValue; public double getMaxNumericValue() { return this.maxNumericValue; } public void setMaxNumericValue(double maxNumericValue) { this.maxNumericValue = maxNumericValue; } protected Integer maxStringLength; public Integer getMaxStringLength() { return this.maxStringLength; } public void setMaxStringLength(Integer maxStringLength) { this.maxStringLength = maxStringLength; } protected DateTime minDateValue; public DateTime getMinDateValue() { return this.minDateValue; } public void setMinDateValue(DateTime minDateValue) { this.minDateValue = minDateValue; } protected double minNumericValue; public double getMinNumericValue() { return this.minNumericValue; } public void setMinNumericValue(double minNumericValue) { this.minNumericValue = minNumericValue; } protected Integer minStringLength; public Integer getMinStringLength() { return this.minStringLength; } public void setMinStringLength(Integer minStringLength) { this.minStringLength = minStringLength; } protected String regularExpression; public String getRegularExpression() { return this.regularExpression; } public void setRegularExpression(String regularExpression) { this.regularExpression = regularExpression; } }
{ "content_hash": "3ce97dbc6758c5d558e4eb3fcdc58674", "timestamp": "", "source": "github", "line_count": 95, "max_line_length": 110, "avg_line_length": 23.810526315789474, "alnum_prop": 0.7612732095490716, "repo_name": "Mozu/mozu-java", "id": "3683aad4e1286e20f23b6a19727bf3d8d5fd2eba", "size": "2262", "binary": false, "copies": "2", "ref": "refs/heads/develop", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/contracts/productruntime/AttributeValidation.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "102" }, { "name": "Java", "bytes": "16379616" } ], "symlink_target": "" }
<?php class LinearTest extends PHPUnit_Framework_TestCase { public function include_file(){ ob_start(); include(__DIR__ . '/../src/linear.php'); return ob_get_clean(); } public function testDummy() { $output = $this->include_file(); $this->assertEquals("", $output, "Parameter tidak diset, harus mengeluarkan string kosong"); } }
{ "content_hash": "dd374ebbb91ee266892e68095144af8a", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 100, "avg_line_length": 26.066666666666666, "alnum_prop": 0.5959079283887468, "repo_name": "akhdani/academy-php-intro", "id": "840788ddad7e7791d2cde8e6353ae1a7ed5e28c1", "size": "391", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/linear.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "10599" } ], "symlink_target": "" }
<html lang="en"> <head> <title>Types In Python - Debugging with GDB</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Debugging with GDB"> <meta name="generator" content="makeinfo 4.11"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Python-API.html#Python-API" title="Python API"> <link rel="prev" href="Values-From-Inferior.html#Values-From-Inferior" title="Values From Inferior"> <link rel="next" href="Pretty-Printing-API.html#Pretty-Printing-API" title="Pretty Printing API"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- Copyright (C) 1988-2013 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being ``Free Software'' and ``Free Software Needs Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,'' and with the Back-Cover Texts as in (a) below. (a) The FSF's Back-Cover Text is: ``You are free to copy and modify this GNU Manual. Buying copies from GNU Press supports the FSF in developing GNU and promoting software freedom.''--> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <p> <a name="Types-In-Python"></a> Next:&nbsp;<a rel="next" accesskey="n" href="Pretty-Printing-API.html#Pretty-Printing-API">Pretty Printing API</a>, Previous:&nbsp;<a rel="previous" accesskey="p" href="Values-From-Inferior.html#Values-From-Inferior">Values From Inferior</a>, Up:&nbsp;<a rel="up" accesskey="u" href="Python-API.html#Python-API">Python API</a> <hr> </div> <h5 class="subsubsection">23.2.2.4 Types In Python</h5> <p><a name="index-types-in-Python-1786"></a><a name="index-Python_002c-working-with-types-1787"></a> <a name="index-gdb_002eType-1788"></a><span class="sc">gdb</span> represents types from the inferior using the class <code>gdb.Type</code>. <p>The following type-related functions are available in the <code>gdb</code> module: <p><a name="index-gdb_002elookup_005ftype-1789"></a> <div class="defun"> &mdash; Function: <b>gdb.lookup_type</b> (<var>name </var><span class="roman">[</span><var>, block</var><span class="roman">]</span>)<var><a name="index-gdb_002elookup_005ftype-1790"></a></var><br> <blockquote><p>This function looks up a type by name. <var>name</var> is the name of the type to look up. It must be a string. <p>If <var>block</var> is given, then <var>name</var> is looked up in that scope. Otherwise, it is searched for globally. <p>Ordinarily, this function will return an instance of <code>gdb.Type</code>. If the named type cannot be found, it will throw an exception. </p></blockquote></div> <p>If the type is a structure or class type, or an enum type, the fields of that type can be accessed using the Python <dfn>dictionary syntax</dfn>. For example, if <code>some_type</code> is a <code>gdb.Type</code> instance holding a structure type, you can access its <code>foo</code> field with: <pre class="smallexample"> bar = some_type['foo'] </pre> <p><code>bar</code> will be a <code>gdb.Field</code> object; see below under the description of the <code>Type.fields</code> method for a description of the <code>gdb.Field</code> class. <p>An instance of <code>Type</code> has the following attributes: <div class="defun"> &mdash; Variable: <b>Type.code</b><var><a name="index-Type_002ecode-1791"></a></var><br> <blockquote><p>The type code for this type. The type code will be one of the <code>TYPE_CODE_</code> constants defined below. </p></blockquote></div> <div class="defun"> &mdash; Variable: <b>Type.sizeof</b><var><a name="index-Type_002esizeof-1792"></a></var><br> <blockquote><p>The size of this type, in target <code>char</code> units. Usually, a target's <code>char</code> type will be an 8-bit byte. However, on some unusual platforms, this type may have a different size. </p></blockquote></div> <div class="defun"> &mdash; Variable: <b>Type.tag</b><var><a name="index-Type_002etag-1793"></a></var><br> <blockquote><p>The tag name for this type. The tag name is the name after <code>struct</code>, <code>union</code>, or <code>enum</code> in C and C<tt>++</tt>; not all languages have this concept. If this type has no tag name, then <code>None</code> is returned. </p></blockquote></div> <p>The following methods are provided: <div class="defun"> &mdash; Function: <b>Type.fields</b> ()<var><a name="index-Type_002efields-1794"></a></var><br> <blockquote><p>For structure and union types, this method returns the fields. Range types have two fields, the minimum and maximum values. Enum types have one field per enum constant. Function and method types have one field per parameter. The base types of C<tt>++</tt> classes are also represented as fields. If the type has no fields, or does not fit into one of these categories, an empty sequence will be returned. <p>Each field is a <code>gdb.Field</code> object, with some pre-defined attributes: <dl> <dt><code>bitpos</code><dd>This attribute is not available for <code>static</code> fields (as in C<tt>++</tt> or Java). For non-<code>static</code> fields, the value is the bit position of the field. For <code>enum</code> fields, the value is the enumeration member's integer representation. <br><dt><code>name</code><dd>The name of the field, or <code>None</code> for anonymous fields. <br><dt><code>artificial</code><dd>This is <code>True</code> if the field is artificial, usually meaning that it was provided by the compiler and not the user. This attribute is always provided, and is <code>False</code> if the field is not artificial. <br><dt><code>is_base_class</code><dd>This is <code>True</code> if the field represents a base class of a C<tt>++</tt> structure. This attribute is always provided, and is <code>False</code> if the field is not a base class of the type that is the argument of <code>fields</code>, or if that type was not a C<tt>++</tt> class. <br><dt><code>bitsize</code><dd>If the field is packed, or is a bitfield, then this will have a non-zero value, which is the size of the field in bits. Otherwise, this will be zero; in this case the field's size is given by its type. <br><dt><code>type</code><dd>The type of the field. This is usually an instance of <code>Type</code>, but it can be <code>None</code> in some situations. </dl> </p></blockquote></div> <div class="defun"> &mdash; Function: <b>Type.array</b> (<var>n1 </var><span class="roman">[</span><var>, n2</var><span class="roman">]</span>)<var><a name="index-Type_002earray-1795"></a></var><br> <blockquote><p>Return a new <code>gdb.Type</code> object which represents an array of this type. If one argument is given, it is the inclusive upper bound of the array; in this case the lower bound is zero. If two arguments are given, the first argument is the lower bound of the array, and the second argument is the upper bound of the array. An array's length must not be negative, but the bounds can be. </p></blockquote></div> <div class="defun"> &mdash; Function: <b>Type.vector</b> (<var>n1 </var><span class="roman">[</span><var>, n2</var><span class="roman">]</span>)<var><a name="index-Type_002evector-1796"></a></var><br> <blockquote><p>Return a new <code>gdb.Type</code> object which represents a vector of this type. If one argument is given, it is the inclusive upper bound of the vector; in this case the lower bound is zero. If two arguments are given, the first argument is the lower bound of the vector, and the second argument is the upper bound of the vector. A vector's length must not be negative, but the bounds can be. <p>The difference between an <code>array</code> and a <code>vector</code> is that arrays behave like in C: when used in expressions they decay to a pointer to the first element whereas vectors are treated as first class values. </p></blockquote></div> <div class="defun"> &mdash; Function: <b>Type.const</b> ()<var><a name="index-Type_002econst-1797"></a></var><br> <blockquote><p>Return a new <code>gdb.Type</code> object which represents a <code>const</code>-qualified variant of this type. </p></blockquote></div> <div class="defun"> &mdash; Function: <b>Type.volatile</b> ()<var><a name="index-Type_002evolatile-1798"></a></var><br> <blockquote><p>Return a new <code>gdb.Type</code> object which represents a <code>volatile</code>-qualified variant of this type. </p></blockquote></div> <div class="defun"> &mdash; Function: <b>Type.unqualified</b> ()<var><a name="index-Type_002eunqualified-1799"></a></var><br> <blockquote><p>Return a new <code>gdb.Type</code> object which represents an unqualified variant of this type. That is, the result is neither <code>const</code> nor <code>volatile</code>. </p></blockquote></div> <div class="defun"> &mdash; Function: <b>Type.range</b> ()<var><a name="index-Type_002erange-1800"></a></var><br> <blockquote><p>Return a Python <code>Tuple</code> object that contains two elements: the low bound of the argument type and the high bound of that type. If the type does not have a range, <span class="sc">gdb</span> will raise a <code>gdb.error</code> exception (see <a href="Exception-Handling.html#Exception-Handling">Exception Handling</a>). </p></blockquote></div> <div class="defun"> &mdash; Function: <b>Type.reference</b> ()<var><a name="index-Type_002ereference-1801"></a></var><br> <blockquote><p>Return a new <code>gdb.Type</code> object which represents a reference to this type. </p></blockquote></div> <div class="defun"> &mdash; Function: <b>Type.pointer</b> ()<var><a name="index-Type_002epointer-1802"></a></var><br> <blockquote><p>Return a new <code>gdb.Type</code> object which represents a pointer to this type. </p></blockquote></div> <div class="defun"> &mdash; Function: <b>Type.strip_typedefs</b> ()<var><a name="index-Type_002estrip_005ftypedefs-1803"></a></var><br> <blockquote><p>Return a new <code>gdb.Type</code> that represents the real type, after removing all layers of typedefs. </p></blockquote></div> <div class="defun"> &mdash; Function: <b>Type.target</b> ()<var><a name="index-Type_002etarget-1804"></a></var><br> <blockquote><p>Return a new <code>gdb.Type</code> object which represents the target type of this type. <p>For a pointer type, the target type is the type of the pointed-to object. For an array type (meaning C-like arrays), the target type is the type of the elements of the array. For a function or method type, the target type is the type of the return value. For a complex type, the target type is the type of the elements. For a typedef, the target type is the aliased type. <p>If the type does not have a target, this method will throw an exception. </p></blockquote></div> <div class="defun"> &mdash; Function: <b>Type.template_argument</b> (<var>n </var><span class="roman">[</span><var>, block</var><span class="roman">]</span>)<var><a name="index-Type_002etemplate_005fargument-1805"></a></var><br> <blockquote><p>If this <code>gdb.Type</code> is an instantiation of a template, this will return a new <code>gdb.Type</code> which represents the type of the <var>n</var>th template argument. <p>If this <code>gdb.Type</code> is not a template type, this will throw an exception. Ordinarily, only C<tt>++</tt> code will have template types. <p>If <var>block</var> is given, then <var>name</var> is looked up in that scope. Otherwise, it is searched for globally. </p></blockquote></div> <p>Each type has a code, which indicates what category this type falls into. The available type categories are represented by constants defined in the <code>gdb</code> module: <a name="index-TYPE_005fCODE_005fPTR-1806"></a> <a name="index-gdb_002eTYPE_005fCODE_005fPTR-1807"></a> <dl><dt><code>gdb.TYPE_CODE_PTR</code><dd>The type is a pointer. <p><a name="index-TYPE_005fCODE_005fARRAY-1808"></a><a name="index-gdb_002eTYPE_005fCODE_005fARRAY-1809"></a><br><dt><code>gdb.TYPE_CODE_ARRAY</code><dd>The type is an array. <p><a name="index-TYPE_005fCODE_005fSTRUCT-1810"></a><a name="index-gdb_002eTYPE_005fCODE_005fSTRUCT-1811"></a><br><dt><code>gdb.TYPE_CODE_STRUCT</code><dd>The type is a structure. <p><a name="index-TYPE_005fCODE_005fUNION-1812"></a><a name="index-gdb_002eTYPE_005fCODE_005fUNION-1813"></a><br><dt><code>gdb.TYPE_CODE_UNION</code><dd>The type is a union. <p><a name="index-TYPE_005fCODE_005fENUM-1814"></a><a name="index-gdb_002eTYPE_005fCODE_005fENUM-1815"></a><br><dt><code>gdb.TYPE_CODE_ENUM</code><dd>The type is an enum. <p><a name="index-TYPE_005fCODE_005fFLAGS-1816"></a><a name="index-gdb_002eTYPE_005fCODE_005fFLAGS-1817"></a><br><dt><code>gdb.TYPE_CODE_FLAGS</code><dd>A bit flags type, used for things such as status registers. <p><a name="index-TYPE_005fCODE_005fFUNC-1818"></a><a name="index-gdb_002eTYPE_005fCODE_005fFUNC-1819"></a><br><dt><code>gdb.TYPE_CODE_FUNC</code><dd>The type is a function. <p><a name="index-TYPE_005fCODE_005fINT-1820"></a><a name="index-gdb_002eTYPE_005fCODE_005fINT-1821"></a><br><dt><code>gdb.TYPE_CODE_INT</code><dd>The type is an integer type. <p><a name="index-TYPE_005fCODE_005fFLT-1822"></a><a name="index-gdb_002eTYPE_005fCODE_005fFLT-1823"></a><br><dt><code>gdb.TYPE_CODE_FLT</code><dd>A floating point type. <p><a name="index-TYPE_005fCODE_005fVOID-1824"></a><a name="index-gdb_002eTYPE_005fCODE_005fVOID-1825"></a><br><dt><code>gdb.TYPE_CODE_VOID</code><dd>The special type <code>void</code>. <p><a name="index-TYPE_005fCODE_005fSET-1826"></a><a name="index-gdb_002eTYPE_005fCODE_005fSET-1827"></a><br><dt><code>gdb.TYPE_CODE_SET</code><dd>A Pascal set type. <p><a name="index-TYPE_005fCODE_005fRANGE-1828"></a><a name="index-gdb_002eTYPE_005fCODE_005fRANGE-1829"></a><br><dt><code>gdb.TYPE_CODE_RANGE</code><dd>A range type, that is, an integer type with bounds. <p><a name="index-TYPE_005fCODE_005fSTRING-1830"></a><a name="index-gdb_002eTYPE_005fCODE_005fSTRING-1831"></a><br><dt><code>gdb.TYPE_CODE_STRING</code><dd>A string type. Note that this is only used for certain languages with language-defined string types; C strings are not represented this way. <p><a name="index-TYPE_005fCODE_005fBITSTRING-1832"></a><a name="index-gdb_002eTYPE_005fCODE_005fBITSTRING-1833"></a><br><dt><code>gdb.TYPE_CODE_BITSTRING</code><dd>A string of bits. It is deprecated. <p><a name="index-TYPE_005fCODE_005fERROR-1834"></a><a name="index-gdb_002eTYPE_005fCODE_005fERROR-1835"></a><br><dt><code>gdb.TYPE_CODE_ERROR</code><dd>An unknown or erroneous type. <p><a name="index-TYPE_005fCODE_005fMETHOD-1836"></a><a name="index-gdb_002eTYPE_005fCODE_005fMETHOD-1837"></a><br><dt><code>gdb.TYPE_CODE_METHOD</code><dd>A method type, as found in C<tt>++</tt> or Java. <p><a name="index-TYPE_005fCODE_005fMETHODPTR-1838"></a><a name="index-gdb_002eTYPE_005fCODE_005fMETHODPTR-1839"></a><br><dt><code>gdb.TYPE_CODE_METHODPTR</code><dd>A pointer-to-member-function. <p><a name="index-TYPE_005fCODE_005fMEMBERPTR-1840"></a><a name="index-gdb_002eTYPE_005fCODE_005fMEMBERPTR-1841"></a><br><dt><code>gdb.TYPE_CODE_MEMBERPTR</code><dd>A pointer-to-member. <p><a name="index-TYPE_005fCODE_005fREF-1842"></a><a name="index-gdb_002eTYPE_005fCODE_005fREF-1843"></a><br><dt><code>gdb.TYPE_CODE_REF</code><dd>A reference type. <p><a name="index-TYPE_005fCODE_005fCHAR-1844"></a><a name="index-gdb_002eTYPE_005fCODE_005fCHAR-1845"></a><br><dt><code>gdb.TYPE_CODE_CHAR</code><dd>A character type. <p><a name="index-TYPE_005fCODE_005fBOOL-1846"></a><a name="index-gdb_002eTYPE_005fCODE_005fBOOL-1847"></a><br><dt><code>gdb.TYPE_CODE_BOOL</code><dd>A boolean type. <p><a name="index-TYPE_005fCODE_005fCOMPLEX-1848"></a><a name="index-gdb_002eTYPE_005fCODE_005fCOMPLEX-1849"></a><br><dt><code>gdb.TYPE_CODE_COMPLEX</code><dd>A complex float type. <p><a name="index-TYPE_005fCODE_005fTYPEDEF-1850"></a><a name="index-gdb_002eTYPE_005fCODE_005fTYPEDEF-1851"></a><br><dt><code>gdb.TYPE_CODE_TYPEDEF</code><dd>A typedef to some other type. <p><a name="index-TYPE_005fCODE_005fNAMESPACE-1852"></a><a name="index-gdb_002eTYPE_005fCODE_005fNAMESPACE-1853"></a><br><dt><code>gdb.TYPE_CODE_NAMESPACE</code><dd>A C<tt>++</tt> namespace. <p><a name="index-TYPE_005fCODE_005fDECFLOAT-1854"></a><a name="index-gdb_002eTYPE_005fCODE_005fDECFLOAT-1855"></a><br><dt><code>gdb.TYPE_CODE_DECFLOAT</code><dd>A decimal floating point type. <p><a name="index-TYPE_005fCODE_005fINTERNAL_005fFUNCTION-1856"></a><a name="index-gdb_002eTYPE_005fCODE_005fINTERNAL_005fFUNCTION-1857"></a><br><dt><code>gdb.TYPE_CODE_INTERNAL_FUNCTION</code><dd>A function internal to <span class="sc">gdb</span>. This is the type used to represent convenience functions. </dl> <p>Further support for types is provided in the <code>gdb.types</code> Python module (see <a href="gdb_002etypes.html#gdb_002etypes">gdb.types</a>). </body></html>
{ "content_hash": "44c8d08f557c78288660094d4cc8ea17", "timestamp": "", "source": "github", "line_count": 307, "max_line_length": 289, "avg_line_length": 57.8371335504886, "alnum_prop": 0.7083802658256364, "repo_name": "marduino/stm32Proj", "id": "e9020feb31af8dc925a35112c5538da6c3049e18", "size": "17756", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tools/armgcc/share/doc/gcc-arm-none-eabi/html/gdb/Types-In-Python.html", "mode": "33261", "license": "mit", "language": [ { "name": "Assembly", "bytes": "23333" }, { "name": "C", "bytes": "4470437" }, { "name": "C++", "bytes": "655791" }, { "name": "HTML", "bytes": "109" }, { "name": "Makefile", "bytes": "10291" } ], "symlink_target": "" }
bool g_fDrawLines = FALSE; //========================================================= // FBoxVisible - a more accurate ( and slower ) version // of FVisible. // // !!!UNDONE - make this CAI_BaseNPC? //========================================================= bool FBoxVisible( CBaseEntity *pLooker, CBaseEntity *pTarget, Vector &vecTargetOrigin, float flSize ) { // don't look through water if ((pLooker->GetWaterLevel() != 3 && pTarget->GetWaterLevel() == 3) || (pLooker->GetWaterLevel() == 3 && pTarget->GetWaterLevel() == 0)) return FALSE; trace_t tr; Vector vecLookerOrigin = pLooker->EyePosition();//look through the NPC's 'eyes' for (int i = 0; i < 5; i++) { Vector vecTarget = pTarget->GetAbsOrigin(); vecTarget.x += random->RandomFloat( pTarget->WorldAlignMins().x + flSize, pTarget->WorldAlignMaxs().x - flSize); vecTarget.y += random->RandomFloat( pTarget->WorldAlignMins().y + flSize, pTarget->WorldAlignMaxs().y - flSize); vecTarget.z += random->RandomFloat( pTarget->WorldAlignMins().z + flSize, pTarget->WorldAlignMaxs().z - flSize); UTIL_TraceLine(vecLookerOrigin, vecTarget, MASK_BLOCKLOS, pLooker, COLLISION_GROUP_NONE, &tr); if (tr.fraction == 1.0) { vecTargetOrigin = vecTarget; return TRUE;// line of sight is valid. } } return FALSE;// Line of sight is not established } //----------------------------------------------------------------------------- // Purpose: Returns the correct toss velocity to throw a given object at a point. // Like the other version of VecCheckToss, but allows you to filter for any // number of entities to ignore. // Input : pEntity - The object doing the throwing. Is *NOT* automatically included in the // filter below. // pFilter - A trace filter of entities to ignore in the object's collision sweeps. // It is recommended to include at least the thrower. // vecSpot1 - The point from which the object is being thrown. // vecSpot2 - The point TO which the object is being thrown. // flHeightMaxRatio - A scale factor indicating the maximum ratio of height // to total throw distance, measured from the higher of the two endpoints to // the apex. -1 indicates that there is no maximum. // flGravityAdj - Scale factor for gravity - should match the gravity scale // that the object will use in midair. // bRandomize - when true, introduces a little fudge to the throw // Output : Velocity to throw the object with. //----------------------------------------------------------------------------- Vector VecCheckToss( CBaseEntity *pEntity, ITraceFilter *pFilter, Vector vecSpot1, Vector vecSpot2, float flHeightMaxRatio, float flGravityAdj, bool bRandomize, Vector *vecMins, Vector *vecMaxs ) { trace_t tr; Vector vecMidPoint;// halfway point between Spot1 and Spot2 Vector vecApex;// highest point Vector vecScale; Vector vecTossVel; Vector vecTemp; float flGravity = GetCurrentGravity() * flGravityAdj; if (vecSpot2.z - vecSpot1.z > 500) { // to high, fail return vec3_origin; } Vector forward, right; AngleVectors( pEntity->GetLocalAngles(), &forward, &right, NULL ); if (bRandomize) { // toss a little bit to the left or right, not right down on the enemy's bean (head). vecSpot2 += right * ( random->RandomFloat(-8,8) + random->RandomFloat(-16,16) ); vecSpot2 += forward * ( random->RandomFloat(-8,8) + random->RandomFloat(-16,16) ); } // calculate the midpoint and apex of the 'triangle' // UNDONE: normalize any Z position differences between spot1 and spot2 so that triangle is always RIGHT // get a rough idea of how high it can be thrown vecMidPoint = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5; UTIL_TraceLine(vecMidPoint, vecMidPoint + Vector(0,0,TOSS_HEIGHT_MAX), MASK_SOLID_BRUSHONLY, pFilter, &tr); vecMidPoint = tr.endpos; if( tr.fraction != 1.0 ) { // (subtract 15 so the object doesn't hit the ceiling) vecMidPoint.z -= 15; } if (flHeightMaxRatio != -1) { // But don't throw so high that it looks silly. Maximize the height of the // throw above the highest of the two endpoints to a ratio of the throw length. float flHeightMax = flHeightMaxRatio * (vecSpot2 - vecSpot1).Length(); float flHighestEndZ = MAX(vecSpot1.z, vecSpot2.z); if ((vecMidPoint.z - flHighestEndZ) > flHeightMax) { vecMidPoint.z = flHighestEndZ + flHeightMax; } } if (vecMidPoint.z < vecSpot1.z || vecMidPoint.z < vecSpot2.z) { // Not enough space, fail return vec3_origin; } // How high should the object travel to reach the apex float distance1 = (vecMidPoint.z - vecSpot1.z); float distance2 = (vecMidPoint.z - vecSpot2.z); // How long will it take for the object to travel this distance float time1 = sqrt( distance1 / (0.5 * flGravity) ); float time2 = sqrt( distance2 / (0.5 * flGravity) ); if (time1 < 0.1) { // too close return vec3_origin; } // how hard to throw sideways to get there in time. vecTossVel = (vecSpot2 - vecSpot1) / (time1 + time2); // how hard upwards to reach the apex at the right time. vecTossVel.z = flGravity * time1; // find the apex vecApex = vecSpot1 + vecTossVel * time1; vecApex.z = vecMidPoint.z; // JAY: Repro behavior from HL1 -- toss check went through gratings UTIL_TraceLine(vecSpot1, vecApex, (MASK_SOLID&(~CONTENTS_GRATE)), pFilter, &tr); if (tr.fraction != 1.0) { // fail! return vec3_origin; } // UNDONE: either ignore NPCs or change it to not care if we hit our enemy UTIL_TraceLine(vecSpot2, vecApex, (MASK_SOLID_BRUSHONLY&(~CONTENTS_GRATE)), pFilter, &tr); if (tr.fraction != 1.0) { // fail! return vec3_origin; } if ( vecMins && vecMaxs ) { // Check to ensure the entity's hull can travel the first half of the grenade throw UTIL_TraceHull( vecSpot1, vecApex, *vecMins, *vecMaxs, (MASK_SOLID&(~CONTENTS_GRATE)), pFilter, &tr); if ( tr.fraction < 1.0 ) return vec3_origin; } return vecTossVel; } //----------------------------------------------------------------------------- // Purpose: Returns the correct toss velocity to throw a given object at a point. // Input : pEntity - The entity that is throwing the object. // vecSpot1 - The point from which the object is being thrown. // vecSpot2 - The point TO which the object is being thrown. // flHeightMaxRatio - A scale factor indicating the maximum ratio of height // to total throw distance, measured from the higher of the two endpoints to // the apex. -1 indicates that there is no maximum. // flGravityAdj - Scale factor for gravity - should match the gravity scale // that the object will use in midair. // bRandomize - when true, introduces a little fudge to the throw // Output : Velocity to throw the object with. //----------------------------------------------------------------------------- Vector VecCheckToss( CBaseEntity *pEntity, Vector vecSpot1, Vector vecSpot2, float flHeightMaxRatio, float flGravityAdj, bool bRandomize, Vector *vecMins, Vector *vecMaxs ) { // construct a filter and call through to the other version of this function. CTraceFilterSimple traceFilter( pEntity, COLLISION_GROUP_NONE ); return VecCheckToss( pEntity, &traceFilter, vecSpot1, vecSpot2, flHeightMaxRatio, flGravityAdj, bRandomize, vecMins, vecMaxs ); } // // VecCheckThrow - returns the velocity vector at which an object should be thrown from vecspot1 to hit vecspot2. // returns vec3_origin if throw is not feasible. // Vector VecCheckThrow ( CBaseEntity *pEdict, const Vector &vecSpot1, Vector vecSpot2, float flSpeed, float flGravityAdj, Vector *vecMins, Vector *vecMaxs ) { float flGravity = GetCurrentGravity() * flGravityAdj; Vector vecGrenadeVel = (vecSpot2 - vecSpot1); // throw at a constant time float time = vecGrenadeVel.Length( ) / flSpeed; vecGrenadeVel = vecGrenadeVel * (1.0 / time); // adjust upward toss to compensate for gravity loss vecGrenadeVel.z += flGravity * time * 0.5; Vector vecApex = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5; vecApex.z += 0.5 * flGravity * (time * 0.5) * (time * 0.5); trace_t tr; UTIL_TraceLine(vecSpot1, vecApex, MASK_SOLID, pEdict, COLLISION_GROUP_NONE, &tr); if (tr.fraction != 1.0) { // fail! //NDebugOverlay::Line( vecSpot1, vecApex, 255, 0, 0, true, 5.0 ); return vec3_origin; } //NDebugOverlay::Line( vecSpot1, vecApex, 0, 255, 0, true, 5.0 ); UTIL_TraceLine(vecSpot2, vecApex, MASK_SOLID_BRUSHONLY, pEdict, COLLISION_GROUP_NONE, &tr); if (tr.fraction != 1.0) { // fail! //NDebugOverlay::Line( vecApex, vecSpot2, 255, 0, 0, true, 5.0 ); return vec3_origin; } //NDebugOverlay::Line( vecApex, vecSpot2, 0, 255, 0, true, 5.0 ); if ( vecMins && vecMaxs ) { // Check to ensure the entity's hull can travel the first half of the grenade throw UTIL_TraceHull( vecSpot1, vecApex, *vecMins, *vecMaxs, MASK_SOLID, pEdict, COLLISION_GROUP_NONE, &tr); if ( tr.fraction < 1.0 ) { //NDebugOverlay::SweptBox( vecSpot1, tr.endpos, *vecMins, *vecMaxs, vec3_angle, 255, 0, 0, 64, 5.0 ); return vec3_origin; } } //NDebugOverlay::SweptBox( vecSpot1, vecApex, *vecMins, *vecMaxs, vec3_angle, 0, 255, 0, 64, 5.0 ); return vecGrenadeVel; }
{ "content_hash": "187df897746201e7d0853160db575ff7", "timestamp": "", "source": "github", "line_count": 245, "max_line_length": 195, "avg_line_length": 37.3795918367347, "alnum_prop": 0.666302686176021, "repo_name": "agiantwhale/TF2Hack", "id": "52dffc8e6fb01206ba3f0c4ae9a93791c35051e9", "size": "9928", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "GameHook/SDK/game/server/h_ai.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "238" }, { "name": "C", "bytes": "5701562" }, { "name": "C++", "bytes": "31354043" }, { "name": "Objective-C", "bytes": "332033" }, { "name": "Perl", "bytes": "2002" }, { "name": "Shell", "bytes": "8513" } ], "symlink_target": "" }
<div class="navbar navbar-default"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-backlog"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#"><?php echo lang('comun_sprints'); ?></a> </div> <div class="collapse navbar-collapse" id="bs-backlog"> <ul class="nav navbar-nav"> <li> <a class="btn btn-redirected" data-content="sprintsillos" href="<?php echo site_url("$controller_name/nuevo/-1/".$proyecto); ?>"> <i class="fa fa-lg fa-fw fa-plus"></i> <span><?php echo lang($controller_name.'_new'); ?></span> </a> </li> </ul> <form class="navbar-form navbar-right" role="form"> <div class="form-group"> <input type="text" class="form-control" placeholder="TAREAS MOSTRADAS"> </div> </form> </div> </div> </div> <article class="master"> <div class="row"> <div class="col-lg-6"> <div id="sprintsillos"> </div> <div id="sprints-content"> <?php foreach ($items as $key => $value) { $data['info']=(array)$value; $this -> load -> view('sprints/block',$data); } ?> </div> </div> <div class="col-lg-6"> <div class="box"> <div class="box-header"> <h3 class="box-title"><?php echo lang('comun_backlog') ?> <small><?php echo lang('comun_backlog_desc'); ?></small> </h3> <div class="box-tools pull-right"> <div class="btn-group"> </div> </div> </div> <div class="box-body"> <ul class="todo-list" id="backlog-content"> <?php foreach ($actividades as $key => $value) { $data['info']=$value; $this->load->view('backlog/block_actividad',$data); } ?> </ul> </div> </div> </div> </div> </article> <script type="text/javascript"> function inicializar_block_sprints(){ $(".sprint-backlog").sortable({ connectWith:"#backlog-content", handle: ".handle", helper:'clone', update:function(event, ui){ $.post('<?php echo site_url("actividades/asignar_a_sprint"); ?>', { sprint:$(this).attr('sprint'), items : $(this).sortable('toArray')}, function(data){ //Hacer algo }); } }); $("#backlog-content").sortable({ connectWith: ".sprint-backlog", handle: ".handle", update:function(event, ui){ $.post('<?php echo site_url("actividades/asignar_a_sprint"); ?>', { sprint:$(this).attr('sprint'), items : $(this).sortable('toArray')}, function(data){ //Hacer algo }); } }); $("div.calendario").each(function(){ $item = $(this); $item.datepicker({startDate:$item.attr('startDate'), endDate:$item.attr('endDate'), language:"es"}); }); $("[data-widget='collapse']").click(function() { //Find the box parent var box = $(this).parents(".box").first(); //Find the body and the footer var bf = box.find(".box-body, .box-footer"); if (!box.hasClass("collapsed-box")) { box.addClass("collapsed-box"); //Convert minus into plus $(this).children(".fa-minus").removeClass("fa-minus").addClass("fa-plus"); bf.slideUp(); } else { box.removeClass("collapsed-box"); //Convert plus into minus $(this).children(".fa-plus").removeClass("fa-plus").addClass("fa-minus"); bf.slideDown(); } }); } $(document).ready(function() { inicializar_block_sprints(); }); // end document.ready
{ "content_hash": "8fab5b8bf91dbf5bbaed6b7f017fd811", "timestamp": "", "source": "github", "line_count": 128, "max_line_length": 144, "avg_line_length": 36.046875, "alnum_prop": 0.46142175986129175, "repo_name": "dexterx17/planning", "id": "626d166d4a38c6b701074a2eeda154d06ac4a75c", "size": "4614", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application/views/sprints/manage.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "432" }, { "name": "CSS", "bytes": "316719" }, { "name": "HTML", "bytes": "1607927" }, { "name": "JavaScript", "bytes": "1302389" }, { "name": "PHP", "bytes": "2151110" }, { "name": "Shell", "bytes": "1231" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "acfd057b5583d7cc283bfb52e60edace", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "7127ded179440fa6e45002f1e014cebdcce5f62e", "size": "176", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Protozoa/Ciliophora/Hypotrichea/Euplotida/Euplotidae/Euplotes/Euplotes palustris/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<p><b>TABLE OF INTERACTIONS WITH</b></p> <p><b>PRISTINAMYCIN</b></p> <p><b>From the French ANSM drug interactions document of </b></p> <p><b>September 2016, pp. 181-182</b></p> <table cellspacing="0" cellpadding="0" border="1"> <tbody> <tr> <td valign="top"><p><b>PRISTINAMYCIN</b></p> <p><b>RxNorm: 66958</b></p> <p><b>ATC: J01FG01</b></p></td> <td valign="top"><p><b>VITAMIN K ANTAGONISTS</b></p> <p><b>CLASS CODE: </b></p> <p><b>B01AA-001</b></p></td> <td valign="top"><p>Increase of the effect of the vitamin K antagonist and of the risk of hemorrhage </p></td> <td valign="top"><p><b>Precaution for use</b></p> <p>More frequent testing of the INR. Possible adjustment of the dosage of the vitamin K antagonist during the treatment with the pristinamycin and after it is stopped</p></td> </tr> <tr> <td valign="top"><p><b>PRISTINAMYCIN</b></p> <p><b>RxNorm: 66958</b></p> <p><b>ATC: J01FG01</b></p></td> <td valign="top"><p><b>COLCHICINE</b></p> <p><b>RxNorm: 2683 </b></p> <p><b>ATC: M04AC01</b></p></td> <td valign="top"><p>Increase of the undesirable effects of the colchicine with potentially fatal consequences</p></td> <td valign="top"><p><b>CONTRAINDICATION</b></p> </td> </tr> <tr> <td valign="top"><p><b>PRISTINAMYCIN</b></p> <p><b>RxNorm: 66958</b></p> <p><b>ATC: J01FG01</b></p></td> <td valign="top"><p><b>IMMUNOSUPPRESSANTS</b></p> <p><b>CLASS CODE: </b></p> <p><b>L04A</b></p></td> <td valign="top"><p>Increase of the blood concentrations of the immunosuppressant due to inhibition of its hepatic metabolism</p></td> <td valign="top"><p><b>Precaution for use</b></p> <p>Blood concentration dosage of the immunosuppressant, testing of the renal function and adjustment of its dosage during the administration of the medications together and after it is stopped<b>.</b></p></td> </tr> </tbody> </table>
{ "content_hash": "b71880084cca21d9d8aba720235bd4b0", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 209, "avg_line_length": 29.78125, "alnum_prop": 0.6348373557187827, "repo_name": "glilly/osdi", "id": "03989e50012be22f45c06d6a5d84e17f52a96520", "size": "1906", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "eng_sept2016/sept2016_tables_html/430-PRISTINAMYCIN.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "4008323" }, { "name": "Perl", "bytes": "37370" }, { "name": "Shell", "bytes": "213" } ], "symlink_target": "" }
/*************************************************************************/ /* core_bind.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #ifndef CORE_BIND_H #define CORE_BIND_H #include "image.h" #include "io/compression.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/dir_access.h" #include "os/file_access.h" #include "os/os.h" #include "os/semaphore.h" #include "os/thread.h" class _ResourceLoader : public Object { GDCLASS(_ResourceLoader, Object); protected: static void _bind_methods(); static _ResourceLoader *singleton; public: static _ResourceLoader *get_singleton() { return singleton; } Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_type_hint = ""); RES load(const String &p_path, const String &p_type_hint = "", bool p_no_cache = false); PoolVector<String> get_recognized_extensions_for_type(const String &p_type); void set_abort_on_missing_resources(bool p_abort); PoolStringArray get_dependencies(const String &p_path); bool has(const String &p_path); _ResourceLoader(); }; class _ResourceSaver : public Object { GDCLASS(_ResourceSaver, Object); protected: static void _bind_methods(); static _ResourceSaver *singleton; public: enum SaverFlags { FLAG_RELATIVE_PATHS = 1, FLAG_BUNDLE_RESOURCES = 2, FLAG_CHANGE_PATH = 4, FLAG_OMIT_EDITOR_PROPERTIES = 8, FLAG_SAVE_BIG_ENDIAN = 16, FLAG_COMPRESS = 32, }; static _ResourceSaver *get_singleton() { return singleton; } Error save(const String &p_path, const RES &p_resource, uint32_t p_flags); PoolVector<String> get_recognized_extensions(const RES &p_resource); _ResourceSaver(); }; VARIANT_ENUM_CAST(_ResourceSaver::SaverFlags); class MainLoop; class _OS : public Object { GDCLASS(_OS, Object); protected: static void _bind_methods(); static _OS *singleton; public: enum PowerState { POWERSTATE_UNKNOWN, /**< cannot determine power status */ POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ POWERSTATE_CHARGING, /**< Plugged in, charging battery */ POWERSTATE_CHARGED /**< Plugged in, battery charged */ }; enum Weekday { DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY, DAY_FRIDAY, DAY_SATURDAY }; enum Month { /// Start at 1 to follow Windows SYSTEMTIME structure /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx MONTH_JANUARY = 1, MONTH_FEBRUARY, MONTH_MARCH, MONTH_APRIL, MONTH_MAY, MONTH_JUNE, MONTH_JULY, MONTH_AUGUST, MONTH_SEPTEMBER, MONTH_OCTOBER, MONTH_NOVEMBER, MONTH_DECEMBER }; Point2 get_mouse_position() const; void set_window_title(const String &p_title); int get_mouse_button_state() const; void set_clipboard(const String &p_text); String get_clipboard() const; void set_video_mode(const Size2 &p_size, bool p_fullscreen, bool p_resizeable, int p_screen = 0); Size2 get_video_mode(int p_screen = 0) const; bool is_video_mode_fullscreen(int p_screen = 0) const; bool is_video_mode_resizable(int p_screen = 0) const; Array get_fullscreen_mode_list(int p_screen = 0) const; virtual int get_video_driver_count() const; virtual String get_video_driver_name(int p_driver) const; virtual int get_audio_driver_count() const; virtual String get_audio_driver_name(int p_driver) const; virtual PoolStringArray get_connected_midi_inputs(); virtual int get_screen_count() const; virtual int get_current_screen() const; virtual void set_current_screen(int p_screen); virtual Point2 get_screen_position(int p_screen = -1) const; virtual Size2 get_screen_size(int p_screen = -1) const; virtual int get_screen_dpi(int p_screen = -1) const; virtual Point2 get_window_position() const; virtual void set_window_position(const Point2 &p_position); virtual Size2 get_window_size() const; virtual Size2 get_real_window_size() const; virtual Rect2 get_window_safe_area() const; virtual void set_window_size(const Size2 &p_size); virtual void set_window_fullscreen(bool p_enabled); virtual bool is_window_fullscreen() const; virtual void set_window_resizable(bool p_enabled); virtual bool is_window_resizable() const; virtual void set_window_minimized(bool p_enabled); virtual bool is_window_minimized() const; virtual void set_window_maximized(bool p_enabled); virtual bool is_window_maximized() const; virtual void set_window_always_on_top(bool p_enabled); virtual bool is_window_always_on_top() const; virtual void request_attention(); virtual void center_window(); virtual void set_borderless_window(bool p_borderless); virtual bool get_borderless_window() const; virtual bool get_window_per_pixel_transparency_enabled() const; virtual void set_window_per_pixel_transparency_enabled(bool p_enabled); virtual void set_ime_active(const bool p_active); virtual void set_ime_position(const Point2 &p_pos); Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track); bool native_video_is_playing(); void native_video_pause(); void native_video_unpause(); void native_video_stop(); void set_low_processor_usage_mode(bool p_enabled); bool is_in_low_processor_usage_mode() const; String get_executable_path() const; int execute(const String &p_path, const Vector<String> &p_arguments, bool p_blocking, Array p_output = Array()); Error kill(int p_pid); Error shell_open(String p_uri); int get_process_id() const; bool has_environment(const String &p_var) const; String get_environment(const String &p_var) const; String get_name() const; Vector<String> get_cmdline_args(); String get_locale() const; String get_latin_keyboard_variant() const; String get_model_name() const; void dump_memory_to_file(const String &p_file); void dump_resources_to_file(const String &p_file); bool has_virtual_keyboard() const; void show_virtual_keyboard(const String &p_existing_text = ""); void hide_virtual_keyboard(); int get_virtual_keyboard_height(); void print_resources_in_use(bool p_short = false); void print_all_resources(const String &p_to_file); void print_all_textures_by_size(); void print_resources_by_type(const Vector<String> &p_types); bool has_touchscreen_ui_hint() const; bool is_debug_build() const; String get_unique_id() const; String get_scancode_string(uint32_t p_code) const; bool is_scancode_unicode(uint32_t p_unicode) const; int find_scancode_from_string(const String &p_code) const; /* struct Date { int year; Month month; int day; Weekday weekday; bool dst; }; struct Time { int hour; int min; int sec; }; */ void set_use_file_access_save_and_swap(bool p_enable); void set_icon(const Ref<Image> &p_icon); int get_exit_code() const; void set_exit_code(int p_code); Dictionary get_date(bool utc) const; Dictionary get_time(bool utc) const; Dictionary get_datetime(bool utc) const; Dictionary get_datetime_from_unix_time(uint64_t unix_time_val) const; uint64_t get_unix_time_from_datetime(Dictionary datetime) const; Dictionary get_time_zone_info() const; uint64_t get_unix_time() const; uint64_t get_system_time_secs() const; int get_static_memory_usage() const; int get_static_memory_peak_usage() const; int get_dynamic_memory_usage() const; void delay_usec(uint32_t p_usec) const; void delay_msec(uint32_t p_msec) const; uint32_t get_ticks_msec() const; uint64_t get_ticks_usec() const; uint32_t get_splash_tick_msec() const; bool can_use_threads() const; bool can_draw() const; bool is_userfs_persistent() const; bool is_stdout_verbose() const; int get_processor_count() const; enum SystemDir { SYSTEM_DIR_DESKTOP, SYSTEM_DIR_DCIM, SYSTEM_DIR_DOCUMENTS, SYSTEM_DIR_DOWNLOADS, SYSTEM_DIR_MOVIES, SYSTEM_DIR_MUSIC, SYSTEM_DIR_PICTURES, SYSTEM_DIR_RINGTONES, }; enum ScreenOrientation { SCREEN_ORIENTATION_LANDSCAPE, SCREEN_ORIENTATION_PORTRAIT, SCREEN_ORIENTATION_REVERSE_LANDSCAPE, SCREEN_ORIENTATION_REVERSE_PORTRAIT, SCREEN_ORIENTATION_SENSOR_LANDSCAPE, SCREEN_ORIENTATION_SENSOR_PORTRAIT, SCREEN_ORIENTATION_SENSOR, }; String get_system_dir(SystemDir p_dir) const; String get_user_data_dir() const; void alert(const String &p_alert, const String &p_title = "ALERT!"); void set_screen_orientation(ScreenOrientation p_orientation); ScreenOrientation get_screen_orientation() const; void set_keep_screen_on(bool p_enabled); bool is_keep_screen_on() const; bool is_ok_left_and_cancel_right() const; Error set_thread_name(const String &p_name); void set_use_vsync(bool p_enable); bool is_vsync_enabled() const; PowerState get_power_state(); int get_power_seconds_left(); int get_power_percent_left(); bool has_feature(const String &p_feature) const; static _OS *get_singleton() { return singleton; } _OS(); }; VARIANT_ENUM_CAST(_OS::PowerState); VARIANT_ENUM_CAST(_OS::Weekday); VARIANT_ENUM_CAST(_OS::Month); VARIANT_ENUM_CAST(_OS::SystemDir); VARIANT_ENUM_CAST(_OS::ScreenOrientation); class _Geometry : public Object { GDCLASS(_Geometry, Object); static _Geometry *singleton; protected: static void _bind_methods(); public: static _Geometry *get_singleton(); PoolVector<Plane> build_box_planes(const Vector3 &p_extents); PoolVector<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z); PoolVector<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z); Variant segment_intersects_segment_2d(const Vector2 &p_from_a, const Vector2 &p_to_a, const Vector2 &p_from_b, const Vector2 &p_to_b); Variant line_intersects_line_2d(const Vector2 &p_from_a, const Vector2 &p_dir_a, const Vector2 &p_from_b, const Vector2 &p_dir_b); PoolVector<Vector2> get_closest_points_between_segments_2d(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2); PoolVector<Vector3> get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2); Vector2 get_closest_point_to_segment_2d(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b); Vector3 get_closest_point_to_segment(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b); Vector2 get_closest_point_to_segment_uncapped_2d(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b); Vector3 get_closest_point_to_segment_uncapped(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b); Variant ray_intersects_triangle(const Vector3 &p_from, const Vector3 &p_dir, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2); Variant segment_intersects_triangle(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2); bool point_is_inside_triangle(const Vector2 &s, const Vector2 &a, const Vector2 &b, const Vector2 &c) const; PoolVector<Vector3> segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius); PoolVector<Vector3> segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, float p_height, float p_radius); PoolVector<Vector3> segment_intersects_convex(const Vector3 &p_from, const Vector3 &p_to, const Vector<Plane> &p_planes); real_t segment_intersects_circle(const Vector2 &p_from, const Vector2 &p_to, const Vector2 &p_circle_pos, real_t p_circle_radius); int get_uv84_normal_bit(const Vector3 &p_vector); Vector<int> triangulate_polygon(const Vector<Vector2> &p_polygon); Vector<Point2> convex_hull_2d(const Vector<Point2> &p_points); Vector<Vector3> clip_polygon(const Vector<Vector3> &p_points, const Plane &p_plane); Dictionary make_atlas(const Vector<Size2> &p_rects); _Geometry(); }; class _File : public Reference { GDCLASS(_File, Reference); FileAccess *f; bool eswap; protected: static void _bind_methods(); public: enum ModeFlags { READ = 1, WRITE = 2, READ_WRITE = 3, WRITE_READ = 7, }; enum CompressionMode { COMPRESSION_FASTLZ = Compression::MODE_FASTLZ, COMPRESSION_DEFLATE = Compression::MODE_DEFLATE, COMPRESSION_ZSTD = Compression::MODE_ZSTD, COMPRESSION_GZIP = Compression::MODE_GZIP }; Error open_encrypted(const String &p_path, int p_mode_flags, const Vector<uint8_t> &p_key); Error open_encrypted_pass(const String &p_path, int p_mode_flags, const String &p_pass); Error open_compressed(const String &p_path, int p_mode_flags, int p_compress_mode = 0); Error open(const String &p_path, int p_mode_flags); ///< open a file void close(); ///< close a file bool is_open() const; ///< true when file is open String get_path() const; /// returns the path for the current open file String get_path_absolute() const; /// returns the absolute path for the current open file void seek(int64_t p_position); ///< seek to a given position void seek_end(int64_t p_position = 0); ///< seek from the end of file int64_t get_position() const; ///< get position in the file int64_t get_len() const; ///< get size of the file bool eof_reached() const; ///< reading passed EOF uint8_t get_8() const; ///< get a byte uint16_t get_16() const; ///< get 16 bits uint uint32_t get_32() const; ///< get 32 bits uint uint64_t get_64() const; ///< get 64 bits uint float get_float() const; double get_double() const; real_t get_real() const; Variant get_var() const; PoolVector<uint8_t> get_buffer(int p_length) const; ///< get an array of bytes String get_line() const; String get_as_text() const; String get_md5(const String &p_path) const; String get_sha256(const String &p_path) const; /**< use this for files WRITTEN in _big_ endian machines (ie, amiga/mac) * It's not about the current CPU type but file formats. * this flags get reset to false (little endian) on each open */ void set_endian_swap(bool p_swap); bool get_endian_swap(); Error get_error() const; ///< get last error void store_8(uint8_t p_dest); ///< store a byte void store_16(uint16_t p_dest); ///< store 16 bits uint void store_32(uint32_t p_dest); ///< store 32 bits uint void store_64(uint64_t p_dest); ///< store 64 bits uint void store_float(float p_dest); void store_double(double p_dest); void store_real(real_t p_real); void store_string(const String &p_string); void store_line(const String &p_string); virtual void store_pascal_string(const String &p_string); virtual String get_pascal_string(); Vector<String> get_csv_line(String delim = ",") const; void store_buffer(const PoolVector<uint8_t> &p_buffer); ///< store an array of bytes void store_var(const Variant &p_var); bool file_exists(const String &p_name) const; ///< return true if a file exists uint64_t get_modified_time(const String &p_file) const; _File(); virtual ~_File(); }; VARIANT_ENUM_CAST(_File::ModeFlags); VARIANT_ENUM_CAST(_File::CompressionMode); class _Directory : public Reference { GDCLASS(_Directory, Reference); DirAccess *d; protected: static void _bind_methods(); public: Error open(const String &p_path); Error list_dir_begin(bool p_skip_navigational = false, bool p_skip_hidden = false); ///< This starts dir listing String get_next(); bool current_is_dir() const; void list_dir_end(); ///< int get_drive_count(); String get_drive(int p_drive); int get_current_drive(); Error change_dir(String p_dir); ///< can be relative or absolute, return false on success String get_current_dir(); ///< return current dir location Error make_dir(String p_dir); Error make_dir_recursive(String p_dir); bool file_exists(String p_file); bool dir_exists(String p_dir); int get_space_left(); Error copy(String p_from, String p_to); Error rename(String p_from, String p_to); Error remove(String p_name); _Directory(); virtual ~_Directory(); private: bool _list_skip_navigational; bool _list_skip_hidden; }; class _Marshalls : public Reference { GDCLASS(_Marshalls, Reference); static _Marshalls *singleton; protected: static void _bind_methods(); public: static _Marshalls *get_singleton(); String variant_to_base64(const Variant &p_var); Variant base64_to_variant(const String &p_str); String raw_to_base64(const PoolVector<uint8_t> &p_arr); PoolVector<uint8_t> base64_to_raw(const String &p_str); String utf8_to_base64(const String &p_str); String base64_to_utf8(const String &p_str); _Marshalls() { singleton = this; } ~_Marshalls() { singleton = NULL; } }; class _Mutex : public Reference { GDCLASS(_Mutex, Reference); Mutex *mutex; static void _bind_methods(); public: void lock(); Error try_lock(); void unlock(); _Mutex(); ~_Mutex(); }; class _Semaphore : public Reference { GDCLASS(_Semaphore, Reference); Semaphore *semaphore; static void _bind_methods(); public: Error wait(); Error post(); _Semaphore(); ~_Semaphore(); }; class _Thread : public Reference { GDCLASS(_Thread, Reference); protected: Variant ret; Variant userdata; volatile bool active; Object *target_instance; StringName target_method; Thread *thread; static void _bind_methods(); static void _start_func(void *ud); public: enum Priority { PRIORITY_LOW, PRIORITY_NORMAL, PRIORITY_HIGH }; Error start(Object *p_instance, const StringName &p_method, const Variant &p_userdata = Variant(), int p_priority = PRIORITY_NORMAL); String get_id() const; bool is_active() const; Variant wait_to_finish(); _Thread(); ~_Thread(); }; VARIANT_ENUM_CAST(_Thread::Priority); class _ClassDB : public Object { GDCLASS(_ClassDB, Object) protected: static void _bind_methods(); public: PoolStringArray get_class_list() const; PoolStringArray get_inheriters_from_class(const StringName &p_class) const; StringName get_parent_class(const StringName &p_class) const; bool class_exists(const StringName &p_class) const; bool is_parent_class(const StringName &p_class, const StringName &p_inherits) const; bool can_instance(const StringName &p_class) const; Variant instance(const StringName &p_class) const; bool has_signal(StringName p_class, StringName p_signal) const; Dictionary get_signal(StringName p_class, StringName p_signal) const; Array get_signal_list(StringName p_class, bool p_no_inheritance = false) const; Array get_property_list(StringName p_class, bool p_no_inheritance = false) const; Variant get_property(Object *p_object, const StringName &p_property) const; Error set_property(Object *p_object, const StringName &p_property, const Variant &p_value) const; bool has_method(StringName p_class, StringName p_method, bool p_no_inheritance = false) const; Array get_method_list(StringName p_class, bool p_no_inheritance = false) const; PoolStringArray get_integer_constant_list(const StringName &p_class, bool p_no_inheritance = false) const; bool has_integer_constant(const StringName &p_class, const StringName &p_name) const; int get_integer_constant(const StringName &p_class, const StringName &p_name) const; StringName get_category(const StringName &p_node) const; bool is_class_enabled(StringName p_class) const; _ClassDB(); ~_ClassDB(); }; class _Engine : public Object { GDCLASS(_Engine, Object); protected: static void _bind_methods(); static _Engine *singleton; public: static _Engine *get_singleton() { return singleton; } void set_iterations_per_second(int p_ips); int get_iterations_per_second() const; void set_physics_jitter_fix(float p_threshold); float get_physics_jitter_fix() const; void set_target_fps(int p_fps); int get_target_fps() const; float get_frames_per_second() const; int get_frames_drawn(); void set_time_scale(float p_scale); float get_time_scale(); MainLoop *get_main_loop() const; Dictionary get_version_info() const; Dictionary get_author_info() const; Array get_copyright_info() const; Dictionary get_donor_info() const; Dictionary get_license_info() const; String get_license_text() const; bool is_in_physics_frame() const; bool has_singleton(const String &p_name) const; Object *get_singleton_object(const String &p_name) const; void set_editor_hint(bool p_enabled); bool is_editor_hint() const; _Engine(); }; class _JSON; class JSONParseResult : public Reference { GDCLASS(JSONParseResult, Reference) friend class _JSON; Error error; String error_string; int error_line; Variant result; protected: static void _bind_methods(); public: void set_error(Error p_error); Error get_error() const; void set_error_string(const String &p_error_string); String get_error_string() const; void set_error_line(int p_error_line); int get_error_line() const; void set_result(const Variant &p_result); Variant get_result() const; }; class _JSON : public Object { GDCLASS(_JSON, Object) protected: static void _bind_methods(); static _JSON *singleton; public: static _JSON *get_singleton() { return singleton; } String print(const Variant &p_value, const String &p_indent = "", bool p_sort_keys = false); Ref<JSONParseResult> parse(const String &p_json); _JSON(); }; #endif // CORE_BIND_H
{ "content_hash": "87138ac7e8bede8971e66a62587fdaff", "timestamp": "", "source": "github", "line_count": 759, "max_line_length": 144, "avg_line_length": 30.47957839262187, "alnum_prop": 0.6981066828045301, "repo_name": "RandomShaper/godot", "id": "1729c2377907321b88bb862329387009fbfe29d9", "size": "23134", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "core/bind/core_bind.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "50004" }, { "name": "C#", "bytes": "210398" }, { "name": "C++", "bytes": "21200242" }, { "name": "GLSL", "bytes": "1271" }, { "name": "Java", "bytes": "493677" }, { "name": "JavaScript", "bytes": "15889" }, { "name": "Makefile", "bytes": "451" }, { "name": "Objective-C", "bytes": "2645" }, { "name": "Objective-C++", "bytes": "185290" }, { "name": "Python", "bytes": "332071" }, { "name": "Shell", "bytes": "20062" } ], "symlink_target": "" }
use compose_yml::v2 as dc; use std::collections::btree_map; use std::collections::BTreeMap; use std::io::{self, BufRead}; use std::str::FromStr; use crate::errors::*; /// This is typically used to incorporate image tags for specific builds /// generated by a continuous integration system (such as [Go][GoCD]). /// /// The on-disk format is a text file with one tagged image name per line: /// /// ```txt /// example.com/app1:30 /// example.com/app2:57 /// alpine:4.3 /// ``` /// /// The tags from this file will be used as default tags for these images. /// So for example, `example.com/app1` would default to /// `example.com/app1:30`, and `alpine` would default to `alpine:4.3`. /// /// [GoCD]: https://www.go.cd/ #[derive(Debug)] pub struct DefaultTags { /// Our default tags. All the `Image` keys should have a tag of `None`, /// and the values should have a tag of `Some(...)`. tags: BTreeMap<dc::Image, dc::Image>, } impl DefaultTags { /// Read in tag defaults from a stream. pub fn read<R>(r: R) -> Result<Self> where R: io::Read, { let mut tags = BTreeMap::new(); let reader = io::BufReader::new(r); for line_result in reader.lines() { let line = line_result?; let image = dc::Image::from_str(&line)?; if let (key, Some(_)) = (image.without_version(), image.version.as_ref()) { match tags.entry(key.to_owned()) { btree_map::Entry::Vacant(vacant) => { vacant.insert(image.to_owned()); } btree_map::Entry::Occupied(occupied) => { if occupied.get() != &image { return Err(err!("Conflicting versions for {}", &key)); } } } } else { return Err(err!("Default image must have tag: {}", &image)); } } Ok(DefaultTags { tags }) } /// Default the `tag` field of `image` if necessary, returning the old /// image if possible. pub fn default_for(&self, image: &dc::Image) -> dc::Image { if image.version.is_some() { // Already tagged, so assume the user knows what they're doing. image.to_owned() } else if let Some(default) = self.tags.get(image) { debug!("Defaulting {} to {}", image, &default); default.to_owned() } else { // If we have a list of default tags, but it doesn't // include all the images we use, then we consider that // mildy alarming. Note that we do show warnings by // default. warn!("Could not find default tag for {}", image); image.to_owned() } } } #[test] fn defaults_tags_using_data_from_file() { let file = "example.com/app1:30 alpine:4.3 busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf "; let cursor = io::Cursor::new(file); let default_tags = DefaultTags::read(cursor).unwrap(); assert_eq!( default_tags.default_for(&dc::Image::new("alpine").unwrap()), dc::Image::new("alpine:4.3").unwrap() ); assert_eq!( default_tags.default_for(&dc::Image::new("alpine:4.2").unwrap()), dc::Image::new("alpine:4.2").unwrap() ); assert_eq!( default_tags.default_for(&dc::Image::new("busybox").unwrap()), dc::Image::new("busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf").unwrap() ); // TODO LOW: I'm not sure how we should actually handle `latest`. // Should it default? assert_eq!( default_tags.default_for(&dc::Image::new("alpine:latest").unwrap()), dc::Image::new("alpine:latest").unwrap() ); }
{ "content_hash": "f76c23e1440dd20cdcfe519dfad35616", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 114, "avg_line_length": 35.77570093457944, "alnum_prop": 0.5666144200626959, "repo_name": "faradayio/cage", "id": "5d5cd99feaafd87d16cecf19c55dd1aef1c3c7bd", "size": "3923", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/default_tags.rs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "217" }, { "name": "Rust", "bytes": "268842" }, { "name": "Shell", "bytes": "2061" } ], "symlink_target": "" }
namespace MindEngine.Core.Content.Texture { using System.Collections.Generic; using Component; public class MMTextureManager : MMCompositeComponent, IMMTextureManager { #region Font public MMImage this[string index] => this.Image[index]; private Dictionary<string, MMImage> Image { get; set; } = new Dictionary<string, MMImage>(); #endregion #region Constructors public MMTextureManager(MMEngine engine) : base(engine) { } #endregion #region Load and Unload protected override void LoadContent() { } /// <summary> /// Release all references to the fonts. /// </summary> protected override void UnloadContent() { this.DisposeImage(); this.Image.Clear(); } #endregion Load and Unload #region Operations public void Add(MMImageAsset imageAsset) { if (!this.Image.ContainsKey(imageAsset.Name)) { this.Image.Add(imageAsset.Name, imageAsset.ToImage()); } } public void Remove(MMImageAsset imageAsset) { if (this.Image.ContainsKey(imageAsset.Name)) { this.Image.Remove(imageAsset.Name); } } #endregion #region IDisposable private bool IsDisposed { get; set; } protected override void Dispose(bool disposing) { try { if (disposing) { if (!this.IsDisposed) { this.UnloadContent(); } this.IsDisposed = true; } } catch { // Ignored } finally { base.Dispose(disposing); } } private void DisposeImage() { foreach (var image in this.Image.Values) { image.Dispose(); } } #endregion } }
{ "content_hash": "fb048649b4ad8abca7890d0b235ac1ab", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 100, "avg_line_length": 21.712871287128714, "alnum_prop": 0.47104423164614684, "repo_name": "Lywx/MindEngine", "id": "c8ccffd162c4baf368d1e628046defb635e40052", "size": "2193", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "MindEngine/Core/Content/Texture/MMTextureManager.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "897819" } ], "symlink_target": "" }
<!DOCTYPE html><html><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <meta name="description"> <meta name="keywords" content="static content generator,static site generator,static site,HTML,web development,.NET,C#,Razor,Markdown,YAML"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="shortcut icon" href="/appveyor-api-client/assets/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="/appveyor-api-client/assets/img/favicon.ico" type="image/x-icon"> <title>Docs - API - BaseClient.GetHttp&lt;T&gt;(string) Method</title> <link href="/appveyor-api-client/assets/css/mermaid.css" rel="stylesheet"> <link href="/appveyor-api-client/assets/css/highlight.css" rel="stylesheet"> <link href="/appveyor-api-client/assets/css/bootstrap/bootstrap.css" rel="stylesheet"> <link href="/appveyor-api-client/assets/css/adminlte/AdminLTE.css" rel="stylesheet"> <link href="/appveyor-api-client/assets/css/theme/theme.css" rel="stylesheet"> <link href="//fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,400i,700,700i" rel="stylesheet"> <link href="/appveyor-api-client/assets/css/font-awesome.min.css" rel="stylesheet" type="text/css"> <link href="/appveyor-api-client/assets/css/override.css" rel="stylesheet"> <script src="/appveyor-api-client/assets/js/jquery-2.2.3.min.js"></script> <script src="/appveyor-api-client/assets/js/bootstrap.min.js"></script> <script src="/appveyor-api-client/assets/js/app.min.js"></script> <script src="/appveyor-api-client/assets/js/highlight.pack.js"></script> <script src="/appveyor-api-client/assets/js/jquery.slimscroll.min.js"></script> <script src="/appveyor-api-client/assets/js/jquery.sticky-kit.min.js"></script> <script src="/appveyor-api-client/assets/js/mermaid.min.js"></script> <!--[if lt IE 9]> <script src="/appveyor-api-client/assets/js/html5shiv.min.js"></script> <script src="/appveyor-api-client/assets/js/respond.min.js"></script> <![endif]--> </head> <body class="hold-transition wyam layout-boxed "> <div class="top-banner"></div> <div class="wrapper with-container"> <!-- Header --> <header class="main-header"> <a href="/appveyor-api-client/" class="logo"> <span>Docs</span> </a> <nav class="navbar navbar-static-top" role="navigation"> <!-- Sidebar toggle button--> <a href="#" class="sidebar-toggle visible-xs-block" data-toggle="offcanvas" role="button"> <span class="sr-only">Toggle side menu</span> <i class="fa fa-chevron-circle-right"></i> </a> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse"> <span class="sr-only">Toggle side menu</span> <i class="fa fa-chevron-circle-down"></i> </button> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse pull-left" id="navbar-collapse"> <ul class="nav navbar-nav"> <li class="active"><a href="/appveyor-api-client/api">API</a></li> </ul> </div> <!-- /.navbar-collapse --> <!-- Navbar Right Menu --> </nav> </header> <!-- Left side column. contains the logo and sidebar --> <aside class="main-sidebar "> <section class="infobar" data-spy="affix" data-offset-top="60" data-offset-bottom="200"> <div id="infobar-headings"><h6>On This Page</h6><p><a href="#Syntax">Syntax</a></p> <p><a href="#TypeParameters">Type Parameters</a></p> <p><a href="#Parameters">Parameters</a></p> <p><a href="#ReturnValue">Return Value</a></p> <hr class="infobar-hidden"> </div> </section> <section class="sidebar"> <script src="/appveyor-api-client/assets/js/lunr.min.js"></script> <script src="/appveyor-api-client/assets/js/searchIndex.js"></script> <div class="sidebar-form"> <div class="input-group"> <input type="text" name="search" id="search" class="form-control" placeholder="Search Types..."> <span class="input-group-btn"> <button class="btn btn-flat"><i class="fa fa-search"></i></button> </span> </div> </div> <div id="search-results"> </div> <script> function runSearch(query){ $("#search-results").empty(); if( query.length < 2 ){ return; } var results = searchModule.search("*" + query + "*"); var listHtml = "<ul class='sidebar-menu'>"; listHtml += "<li class='header'>Type Results</li>"; if(results.length == 0 ){ listHtml += "<li>No results found</li>"; } else { for(var i = 0; i < results.length; ++i){ var res = results[i]; listHtml += "<li><a href='" + res.url + "'>" + res.title + "</a></li>"; } } listHtml += "</ul>"; $("#search-results").append(listHtml); } $(document).ready(function(){ $("#search").on('input propertychange paste', function() { runSearch($("#search").val()); }); }); </script> <hr> <ul class="sidebar-menu"> <li class="header">Namespace</li> <li><a href="/appveyor-api-client/api/AppVeyorClient.Clients">AppVeyorClient<wbr>.Clients</a></li> <li class="header">Type</li> <li><a href="/appveyor-api-client/api/AppVeyorClient.Clients/BaseClient">BaseClient</a></li> <li role="separator" class="divider"></li> <li class="header">Constructors</li> <li><a href="/appveyor-api-client/api/AppVeyorClient.Clients/BaseClient/53B3C1C6">BaseClient<wbr>(ILogger<wbr>&lt;BaseClient&gt;<wbr>, <wbr>string, <wbr>string)<wbr></a></li> <li class="header">Field Members</li> <li><a href="/appveyor-api-client/api/AppVeyorClient.Clients/BaseClient/FF31AF38">_client</a></li> <li><a href="/appveyor-api-client/api/AppVeyorClient.Clients/BaseClient/59269567">_logger</a></li> <li class="header">Property Members</li> <li><a href="/appveyor-api-client/api/AppVeyorClient.Clients/BaseClient/085FF492">Logger</a></li> <li class="header">Method Members</li> <li><a href="/appveyor-api-client/api/AppVeyorClient.Clients/BaseClient/AC091E5A">DeleteHttp<wbr>(string)<wbr></a></li> <li class="selected"><a href="/appveyor-api-client/api/AppVeyorClient.Clients/BaseClient/A9ABEF6C">GetHttp<wbr>&lt;T&gt;<wbr><wbr>(string)<wbr></a></li> <li><a href="/appveyor-api-client/api/AppVeyorClient.Clients/BaseClient/1030E35B">PostHttp<wbr>&lt;T&gt;<wbr><wbr>(string, <wbr>object)<wbr></a></li> </ul> </section> </aside> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <section class="content-header"> <h3><a href="/appveyor-api-client/api/AppVeyorClient.Clients/BaseClient">BaseClient</a>.</h3> <h1>GetHttp<wbr>&lt;T&gt;<wbr><wbr>(string)<wbr> <small>Method</small></h1> </section> <section class="content"> <div class="panel panel-default"> <div class="panel-body"> <dl class="dl-horizontal"> <dt>Namespace</dt> <dd><a href="/appveyor-api-client/api/AppVeyorClient.Clients">AppVeyorClient<wbr>.Clients</a></dd> <dt>Containing Type</dt> <dd><a href="/appveyor-api-client/api/AppVeyorClient.Clients/BaseClient">BaseClient</a></dd> </dl> </div> </div> <h1 id="Syntax">Syntax</h1> <pre><code>protected Task&lt;ApiResponse&lt;T&gt;&gt; GetHttp&lt;T&gt;(string url)</code></pre> <h1 id="TypeParameters">Type Parameters</h1> <div class="box"> <div class="box-body no-padding table-responsive"> <table class="table table-striped table-hover two-cols"> <thead> <tr> <th>Name</th> <th>Description</th> </tr> </thead> <tbody><tr id="typeparam-T"> <td>T</td> <td></td> </tr> </tbody></table> </div> </div> <h1 id="Parameters">Parameters</h1> <div class="box"> <div class="box-body no-padding table-responsive"> <table class="table table-striped table-hover three-cols"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody><tr> <td>url</td> <td>string</td> <td></td> </tr> </tbody></table> </div> </div> <h1 id="ReturnValue">Return Value</h1> <div class="box"> <div class="box-body no-padding table-responsive"> <table class="table table-striped table-hover two-cols"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody><tr> <td>Task<wbr>&lt;ApiResponse<wbr>&lt;T&gt;<wbr>&gt;<wbr></td> <td></td> </tr> </tbody></table> </div> </div> </section> </div> <!-- Footer --> <footer class="main-footer"> </footer> </div> <div class="wrapper bottom-wrapper"> <footer class="bottom-footer"> Generated by <a href="https://wyam.io">Wyam</a> </footer> </div> <a href="javascript:" id="return-to-top"><i class="fa fa-chevron-up"></i></a> <script> // Close the sidebar if we select an anchor link $(".main-sidebar a[href^='#']:not('.expand')").click(function(){ $(document.body).removeClass('sidebar-open'); }); $(document).load(function() { mermaid.initialize( { flowchart: { htmlLabels: false, useMaxWidth:false } }); mermaid.init(undefined, ".mermaid") $('svg').addClass('img-responsive'); $('pre code').each(function(i, block) { hljs.highlightBlock(block); }); }); hljs.initHighlightingOnLoad(); // Back to top $(window).scroll(function() { if ($(this).scrollTop() >= 200) { // If page is scrolled more than 50px $('#return-to-top').fadeIn(1000); // Fade in the arrow } else { $('#return-to-top').fadeOut(1000); // Else fade out the arrow } }); $('#return-to-top').click(function() { // When arrow is clicked $('body,html').animate({ scrollTop : 0 // Scroll to top of body }, 500); }); </script> </body></html>
{ "content_hash": "1e84c9198339f501d38ba91f849b3ebf", "timestamp": "", "source": "github", "line_count": 296, "max_line_length": 178, "avg_line_length": 40.304054054054056, "alnum_prop": 0.5229673093042749, "repo_name": "antunesl/appveyor-api-client", "id": "8021a84eedaa10a77fe23fef3f5d073fbd9c20e6", "size": "11932", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/api/AppVeyorClient.Clients/BaseClient/A9ABEF6C.html", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "176063" } ], "symlink_target": "" }
extern "Java" { namespace gnu { namespace java { namespace security { namespace jce { namespace sig { class RSAKeyFactory; } } } } } namespace java { namespace security { class Key; class PrivateKey; class PublicKey; namespace spec { class KeySpec; } } } } class gnu::java::security::jce::sig::RSAKeyFactory : public ::java::security::KeyFactorySpi { public: RSAKeyFactory(); public: // actually protected virtual ::java::security::PublicKey * engineGeneratePublic(::java::security::spec::KeySpec *); virtual ::java::security::PrivateKey * engineGeneratePrivate(::java::security::spec::KeySpec *); virtual ::java::security::spec::KeySpec * engineGetKeySpec(::java::security::Key *, ::java::lang::Class *); virtual ::java::security::Key * engineTranslateKey(::java::security::Key *); public: static ::java::lang::Class class$; }; #endif // __gnu_java_security_jce_sig_RSAKeyFactory__
{ "content_hash": "9b2dc98d3030d8e9fa2a9594b349b59f", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 109, "avg_line_length": 22.333333333333332, "alnum_prop": 0.5970149253731343, "repo_name": "the-linix-project/linix-kernel-source", "id": "8c10a0a125bd7427d9c069d2e709a5e9f5c1a434", "size": "1302", "binary": false, "copies": "160", "ref": "refs/heads/master", "path": "gccsrc/gcc-4.7.2/libjava/gnu/java/security/jce/sig/RSAKeyFactory.h", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Ada", "bytes": "38139979" }, { "name": "Assembly", "bytes": "3723477" }, { "name": "Awk", "bytes": "83739" }, { "name": "C", "bytes": "103607293" }, { "name": "C#", "bytes": "55726" }, { "name": "C++", "bytes": "38577421" }, { "name": "CLIPS", "bytes": "6933" }, { "name": "CSS", "bytes": "32588" }, { "name": "Emacs Lisp", "bytes": "13451" }, { "name": "FORTRAN", "bytes": "4294984" }, { "name": "GAP", "bytes": "13089" }, { "name": "Go", "bytes": "11277335" }, { "name": "Haskell", "bytes": "2415" }, { "name": "Java", "bytes": "45298678" }, { "name": "JavaScript", "bytes": "6265" }, { "name": "Matlab", "bytes": "56" }, { "name": "OCaml", "bytes": "148372" }, { "name": "Objective-C", "bytes": "995127" }, { "name": "Objective-C++", "bytes": "436045" }, { "name": "PHP", "bytes": "12361" }, { "name": "Pascal", "bytes": "40318" }, { "name": "Perl", "bytes": "358808" }, { "name": "Python", "bytes": "60178" }, { "name": "SAS", "bytes": "1711" }, { "name": "Scilab", "bytes": "258457" }, { "name": "Shell", "bytes": "2610907" }, { "name": "Tcl", "bytes": "17983" }, { "name": "TeX", "bytes": "1455571" }, { "name": "XSLT", "bytes": "156419" } ], "symlink_target": "" }
<?php // require_once 'Zend/Cloud/AbstractFactory.php'; /** * Class implementing working with Azure queries in a structured way * * TODO Look into preventing a query injection attack. * * @category Zend * @package Zend_Cloud * @subpackage DocumentService * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Cloud_DocumentService_Factory extends Zend_Cloud_AbstractFactory { const DOCUMENT_ADAPTER_KEY = 'document_adapter'; /** * @var string Interface which adapter must implement to be considered valid */ protected static $_adapterInterface = 'Zend_Cloud_DocumentService_Adapter'; /** * Constructor * * @return void */ private function __construct() { // private ctor - should not be used } /** * Retrieve an adapter instance * * @param array $options * @return void */ public static function getAdapter($options = array()) { $adapter = parent::_getAdapter(self::DOCUMENT_ADAPTER_KEY, $options); if (!$adapter) { // require_once 'Zend/Cloud/DocumentService/Exception.php'; throw new Zend_Cloud_DocumentService_Exception( 'Class must be specified using the \'' . self::DOCUMENT_ADAPTER_KEY . '\' key' ); } elseif (!$adapter instanceof self::$_adapterInterface) { // require_once 'Zend/Cloud/DocumentService/Exception.php'; throw new Zend_Cloud_DocumentService_Exception( 'Adapter must implement \'' . self::$_adapterInterface . '\'' ); } return $adapter; } }
{ "content_hash": "3a92233cbbf4ecf0489e847326aa4f34", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 87, "avg_line_length": 30.033898305084747, "alnum_prop": 0.6145598194130926, "repo_name": "mazelab/zendframework1-min", "id": "7581ef13788e3901e59c8a9a3b38d783ab6f0bac", "size": "2474", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "library/Zend/Cloud/DocumentService/Factory.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "PHP", "bytes": "15776188" }, { "name": "PowerShell", "bytes": "1028" }, { "name": "Shell", "bytes": "3945" } ], "symlink_target": "" }
<?php namespace dlaser\UsuarioBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Security\Core\User\UserInterface; /** * dlaser\UsuarioBundle\Entity\Usuario * * @ORM\Table(name="usuario") * @ORM\Entity */ class Usuario implements UserInterface, \Serializable { /** * Método requerido por la interfaz UserInterface */ function equals(\Symfony\Component\Security\Core\User\UserInterface $usuario) { return $this->getCc() == $usuario->getCc(); } /** * Método requerido por la interfaz UserInterface */ function eraseCredentials() { } /** * Método requerido por la interfaz UserInterface */ function getRoles() { return array($this->getPerfil()); } /** * Método requerido por la interfaz UserInterface */ function getSalt() { return null; } /** * Método requerido por la interfaz UserInterface */ function getUsername() { return $this->getNombre(); } /** * @var integer $id * * @ORM\Column(name="id", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ private $id; /** * @var integer $cc * @ORM\Column(name="cc", type="integer", nullable=false) * @Assert\NotBlank(message="El valor ingresado no puede estar vacio.") * @Assert\Max(limit = "9999999999999", message = "El valor cc no puede ser mayor de {{ limit }}",invalidMessage = "El valor ingresado debe ser un número válido") * */ private $cc; /** * @var string $nombre * @ORM\Column(name="nombre", type="string", length=60, nullable=false) * @Assert\NotBlank(message="El valor ingresado no puede estar vacio.") * @Assert\MaxLength(limit=60, message="El valor nombre debe tener como maximo {{ limit }} caracteres.") * */ private $nombre; /** * @var string $apellido * @ORM\Column(name="apellido", type="string", length=60, nullable=false) * @Assert\NotBlank(message="El valor ingresado no puede estar vacio.") * @Assert\MaxLength(limit=60, message="El valor apellido debe tener como maximo {{ limit }} caracteres.") * */ private $apellido; /** * @var string $perfil * @ORM\Column(name="perfil", type="string", length=13, nullable=false) * @Assert\NotBlank(message="El valor ingresado no puede estar vacio.") * @Assert\MaxLength(limit=13, message="El valor perfil debe tener como maximo {{ limit }} caracteres.") * */ private $perfil; /** * @var string $telefono * @ORM\Column(name="telefono", type="string", length=11, nullable=false) * @Assert\NotBlank(message="El valor ingresado no puede estar vacio.") * @Assert\Max(limit = "99999999999", message = "El valor telefono no puede ser mayor de {{ limit }}",invalidMessage = "El valor ingresado debe ser un número válido") * */ private $telefono; /** * @var string $direccion * * @ORM\Column(name="direccion", type="string", length=60, nullable=true) * @Assert\MaxLength(limit=60, message="El valor direccion debe tener como maximo {{ limit }} caracteres.") */ private $direccion; /** * @var string $tp * @ORM\Column(name="tp", type="string", length=11, nullable=true) * @Assert\MaxLength(limit=11, message="El valor tp debe tener como maximo {{ limit }} caracteres.") * */ private $tp; /** * @var string $especialidad * @ORM\Column(name="especialidad", type="string", length=30, nullable=true) * @Assert\MaxLength(limit=30, message="El valor especialidad debe tener como maximo {{ limit }} caracteres.") * */ private $especialidad; /** * @var string $password * @ORM\Column(name="password", type="string", length=255, nullable=false) * @Assert\MaxLength(limit=255, message="El valor password debe tener como maximo {{ limit }} caracteres.") * */ private $password; /** * @var string $email * @ORM\Column(name="email", type="string", length=200, nullable=true) * @Assert\NotBlank(message="El valor ingresado no puede estar vacio.") * @Assert\MaxLength(limit=200, message="El valor password debe tener como maximo {{ limit }} caracteres.") * */ private $email; /** * @var string $firma * * @ORM\Column(name="firma", type="string", length=255, nullable=true) */ private $firma; /** * @var Cie * * @ORM\ManyToMany(targetEntity="dlaser\HcBundle\Entity\Cie") * @ORM\JoinTable(name="cie_usuario", * joinColumns={ * @ORM\JoinColumn(name="usuario_id", referencedColumnName="id") * }, * inverseJoinColumns={ * @ORM\JoinColumn(name="cie_id", referencedColumnName="id") * } * ) */ private $cie; /** * @var Examen * * @ORM\ManyToMany(targetEntity="dlaser\HcBundle\Entity\Examen") * @ORM\JoinTable(name="examen_usuario", * joinColumns={ * @ORM\JoinColumn(name="usuario_id", referencedColumnName="id") * }, * inverseJoinColumns={ * @ORM\JoinColumn(name="examen_id", referencedColumnName="id") * } * ) */ private $examen; /** * @var Sede * * @ORM\ManyToMany(targetEntity="dlaser\ParametrizarBundle\Entity\Sede", mappedBy="usuario") */ private $sede; public function __construct() { $this->cie = new \Doctrine\Common\Collections\ArrayCollection(); $this->examen = new \Doctrine\Common\Collections\ArrayCollection(); $this->sede = new \Doctrine\Common\Collections\ArrayCollection(); } public function __toString() { return $this->getNombre()." ".$this->getApellido(); } public function serialize() { return serialize($this->getId()); } public function unserialize($data) { $this->id = unserialize($data); } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set cc * * @param integer $cc */ public function setCc($cc) { $this->cc = $cc; } /** * Get cc * * @return integer */ public function getCc() { return $this->cc; } /** * Set nombre * * @param string $nombre */ public function setNombre($nombre) { $this->nombre = $nombre; } /** * Get nombre * * @return string */ public function getNombre() { return $this->nombre; } /** * Set apellido * * @param string $apellido */ public function setApellido($apellido) { $this->apellido = $apellido; } /** * Get apellido * * @return string */ public function getApellido() { return $this->apellido; } /** * Set perfil * * @param string $perfil */ public function setPerfil($perfil) { $this->perfil = $perfil; } /** * Get perfil * * @return string */ public function getPerfil() { return $this->perfil; } /** * Set telefono * * @param string $telefono */ public function setTelefono($telefono) { $this->telefono = $telefono; } /** * Get telefono * * @return string */ public function getTelefono() { return $this->telefono; } /** * Set direccion * * @param string $direccion */ public function setDireccion($direccion) { $this->direccion = $direccion; } /** * Get direccion * * @return string */ public function getDireccion() { return $this->direccion; } /** * Set tp * * @param string $tp */ public function setTp($tp) { $this->tp = $tp; } /** * Get tp * * @return string */ public function getTp() { return $this->tp; } /** * Set especialidad * * @param string $especialidad */ public function setEspecialidad($especialidad) { $this->especialidad = $especialidad; } /** * Get especialidad * * @return string */ public function getEspecialidad() { return $this->especialidad; } /** * Set password * * @param string $password */ public function setPassword($password) { $this->password = $password; } /** * Get password * * @return string */ public function getPassword() { return $this->password; } /** * Set email * * @param string $email */ public function setEmail($email) { $this->email = $email; } /** * Get email * * @return string */ public function getEmail() { return $this->email; } /** * Set firma * * @param string $firma */ public function setFirma($firma) { $this->firma = $firma; } /** * Get firma * * @return string */ public function getFirma() { return $this->firma; } /** * Add cie * * @param dlaser\HcBundle\Entity\Cie $cie */ public function addCie(\dlaser\HcBundle\Entity\Cie $cie) { if (!$this->hasCie($cie)) { $this->cie[] = $cie; return true; } return false; } public function hasCie(\dlaser\HcBundle\Entity\Cie $cie) { foreach ($this->cie as $value) { if ($value->getId() == $cie->getId()) { return true; } } return false; } /** * Get cie * * @return dlaser\HcBundle\Entity\Cie */ public function getCie() { return $this->cie; } /** * Add examen * * @param dlaser\HcBundle\Entity\Examen $examen */ public function addExamen(\dlaser\HcBundle\Entity\Examen $examen) { if (!$this->hasExamen($examen)) { $this->examen[] = $examen; return true; } return false; } public function hasExamen(\dlaser\HcBundle\Entity\Examen $examen) { foreach ($this->examen as $value) { if ($value->getId() == $examen->getId()) { return true; } } return false; } /** * Get examen * * @return dlaser\HcBundle\Entity\Examen */ public function getExamen() { return $this->examen; } /** * Add sede * * @param dlaser\ParametrizarBundle\Entity\Sede $sede */ public function addSede(\dlaser\ParametrizarBundle\Entity\Sede $sede) { if (!$this->hasSede($sede)) { $this->sede[] = $sede; return true; } return false; } public function hasSede(\dlaser\ParametrizarBundle\Entity\Sede $sede) { foreach ($this->sede as $value) { if ($value->getId() == $sede->getId()) { return true; } } return false; } /** * Get sede * * @return Doctrine\Common\Collections\Collection $sede */ public function getSede() { return $this->sede; } }
{ "content_hash": "cf483fded4acf177f0c5925f9f714bef", "timestamp": "", "source": "github", "line_count": 557, "max_line_length": 170, "avg_line_length": 20.870736086175942, "alnum_prop": 0.539010752688172, "repo_name": "hbocanegra/dlaser", "id": "368a9cd0be264fdfe223cb316c81de2edef87f55", "size": "11634", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/dlaser/UsuarioBundle/Entity/Usuario.php", "mode": "33261", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "176" }, { "name": "CSS", "bytes": "52366" }, { "name": "HTML", "bytes": "386634" }, { "name": "JavaScript", "bytes": "29433" }, { "name": "PHP", "bytes": "514899" } ], "symlink_target": "" }
 #pragma once #include <aws/codecommit/CodeCommit_EXPORTS.h> #include <aws/codecommit/CodeCommitRequest.h> #include <aws/core/utils/memory/stl/AWSString.h> namespace Aws { namespace CodeCommit { namespace Model { /** * <p>Represents the input of an update repository description operation.</p> */ class AWS_CODECOMMIT_API UpdateRepositoryNameRequest : public CodeCommitRequest { public: UpdateRepositoryNameRequest(); Aws::String SerializePayload() const override; Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; /** * <p>The existing name of the repository.</p> */ inline const Aws::String& GetOldName() const{ return m_oldName; } /** * <p>The existing name of the repository.</p> */ inline void SetOldName(const Aws::String& value) { m_oldNameHasBeenSet = true; m_oldName = value; } /** * <p>The existing name of the repository.</p> */ inline void SetOldName(Aws::String&& value) { m_oldNameHasBeenSet = true; m_oldName = value; } /** * <p>The existing name of the repository.</p> */ inline void SetOldName(const char* value) { m_oldNameHasBeenSet = true; m_oldName.assign(value); } /** * <p>The existing name of the repository.</p> */ inline UpdateRepositoryNameRequest& WithOldName(const Aws::String& value) { SetOldName(value); return *this;} /** * <p>The existing name of the repository.</p> */ inline UpdateRepositoryNameRequest& WithOldName(Aws::String&& value) { SetOldName(value); return *this;} /** * <p>The existing name of the repository.</p> */ inline UpdateRepositoryNameRequest& WithOldName(const char* value) { SetOldName(value); return *this;} /** * <p>The new name for the repository.</p> */ inline const Aws::String& GetNewName() const{ return m_newName; } /** * <p>The new name for the repository.</p> */ inline void SetNewName(const Aws::String& value) { m_newNameHasBeenSet = true; m_newName = value; } /** * <p>The new name for the repository.</p> */ inline void SetNewName(Aws::String&& value) { m_newNameHasBeenSet = true; m_newName = value; } /** * <p>The new name for the repository.</p> */ inline void SetNewName(const char* value) { m_newNameHasBeenSet = true; m_newName.assign(value); } /** * <p>The new name for the repository.</p> */ inline UpdateRepositoryNameRequest& WithNewName(const Aws::String& value) { SetNewName(value); return *this;} /** * <p>The new name for the repository.</p> */ inline UpdateRepositoryNameRequest& WithNewName(Aws::String&& value) { SetNewName(value); return *this;} /** * <p>The new name for the repository.</p> */ inline UpdateRepositoryNameRequest& WithNewName(const char* value) { SetNewName(value); return *this;} private: Aws::String m_oldName; bool m_oldNameHasBeenSet; Aws::String m_newName; bool m_newNameHasBeenSet; }; } // namespace Model } // namespace CodeCommit } // namespace Aws
{ "content_hash": "b97fb6fab66392d03c72f061c8d2c600", "timestamp": "", "source": "github", "line_count": 104, "max_line_length": 113, "avg_line_length": 29.865384615384617, "alnum_prop": 0.6532517707662588, "repo_name": "ambasta/aws-sdk-cpp", "id": "7d96920048fdb5a1e01246d3771cccc028366ff5", "size": "3679", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aws-cpp-sdk-codecommit/include/aws/codecommit/model/UpdateRepositoryNameRequest.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "2305" }, { "name": "C++", "bytes": "74273816" }, { "name": "CMake", "bytes": "412257" }, { "name": "Java", "bytes": "229873" }, { "name": "Python", "bytes": "62933" } ], "symlink_target": "" }
/** * @file * Implement a http client to request mock data to use the * web part with the local workbench * * Author: Olivier Carpentier */ import { ISPList, ISPListItem } from './ISPList'; /** * @class * Defines a http client to request mock data to use the web part with the local workbench */ export default class MockHttpClient { /** * @var * Mock SharePoint list sample */ private static _lists: ISPList[] = [{ Title: 'Mock List', Id: '1', BaseTemplate: '109' }]; /** * @var * Mock SharePoint list item sample */ private static _items: ISPListItem[] = [ { "ID": "1", "Title": "Pic 1", "Description": "", "File": { "Name": "1.jpg", "ServerRelativeUrl": "/Images/1.jpg" } } ]; /** * @function * Mock get SharePoint list request */ public static getLists(restUrl: string, options?: any): Promise<ISPList[]> { return new Promise<ISPList[]>((resolve) => { resolve(MockHttpClient._lists); }); } /** * @function * Mock get SharePoint list items request */ public static getListsItems(restUrl: string, options?: any): Promise<ISPListItem[]> { return new Promise<ISPListItem[]>((resolve) => { resolve(MockHttpClient._items); }); } }
{ "content_hash": "f68de3e62ae3ce4120be96a692a1a78d", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 123, "avg_line_length": 26.612244897959183, "alnum_prop": 0.5858895705521472, "repo_name": "jcoleman-pcprofessional/sp-dev-fx-webparts", "id": "5e8ce73f5c859e67237fa2a8f2f0c979be4cf5be", "size": "1304", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "samples/jquery-photopile/src/webparts/photopileWebPart/MockHttpClient.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5291" }, { "name": "JavaScript", "bytes": "879" }, { "name": "TypeScript", "bytes": "15442" } ], "symlink_target": "" }
ACCEPTED #### According to Index Fungorum #### Published in Rabenhorst's Kryptogamen-Flora, Pilze - Die Flechtenparasiten 2(8): 106 (1930) #### Original name Mollisia collematis Boud. ### Remarks null
{ "content_hash": "ef866ece16b435e0e967e4a9bd1c3dd2", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 78, "avg_line_length": 15.692307692307692, "alnum_prop": 0.7303921568627451, "repo_name": "mdoering/backbone", "id": "b1219f23b8a6a9d291fce3d18f3aa760e5a2f6e9", "size": "264", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Ascomycota/Leotiomycetes/Helotiales/Hyaloscyphaceae/Pezizella/Pezizella collematis/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
from django.views.generic import TemplateView class ExampleView(TemplateView): def get_context_data(self, **kwargs): context = super(self, ExampleView).get_context_data(**kwargs) # context['form'] = form
{ "content_hash": "23a0ad311960bbcaa08d822b93208860", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 69, "avg_line_length": 32.142857142857146, "alnum_prop": 0.6977777777777778, "repo_name": "un33k/django-dropzone", "id": "6ef3f13806e13274a081f2615f307af504365fd0", "size": "225", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "example_project/example_project/views.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "23336" }, { "name": "HTML", "bytes": "1864" }, { "name": "JavaScript", "bytes": "116273" }, { "name": "Python", "bytes": "11638" } ], "symlink_target": "" }
package com.github.pedrovgs.problem6 import com.github.pedrovgs.time.Time /** * The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 * The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025 * * Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640. * * Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. * * @author Pedro Vicente Gómez Sánchez */ object SumSquareDifference { def main(args: Array[String]) = { Time.measure(println("The difference between the sum of the squares of the first one hundred natural numbers and the " + "square of the sum is: " + getSumSquareDifference((1 to 100).toList))) } /** * * Calculates the difference between the sum of the squares of a range and the square of the sum of that range. * * @param range to evaluate * @return */ def getSumSquareDifference(range: List[Int]): Int = { def square(a: Int) = a * a val sum = range.sum square(sum) - range.map(n => square(n)).sum } }
{ "content_hash": "ddf9a4f4e848e4aa62b942e6676393f7", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 135, "avg_line_length": 30.666666666666668, "alnum_prop": 0.677257525083612, "repo_name": "pedrovgs/ProjectEuler", "id": "805d11646eb1ed825891d25724f7eb75b70013ec", "size": "1813", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/scala/com/github/pedrovgs/problem6/SumSquareDifference.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Scala", "bytes": "65679" } ], "symlink_target": "" }
package org.apache.falcon.entity.parser; import org.apache.commons.lang3.StringUtils; import org.apache.falcon.FalconException; import org.apache.falcon.catalog.CatalogServiceFactory; import org.apache.falcon.entity.CatalogStorage; import org.apache.falcon.entity.ClusterHelper; import org.apache.falcon.entity.EntityUtil; import org.apache.falcon.entity.FeedHelper; import org.apache.falcon.entity.FileSystemStorage; import org.apache.falcon.entity.Storage; import org.apache.falcon.entity.store.ConfigurationStore; import org.apache.falcon.entity.v0.Entity; import org.apache.falcon.entity.v0.EntityGraph; import org.apache.falcon.entity.v0.EntityType; import org.apache.falcon.entity.v0.Frequency; import org.apache.falcon.entity.v0.feed.ACL; import org.apache.falcon.entity.v0.feed.Extract; import org.apache.falcon.entity.v0.feed.ExtractMethod; import org.apache.falcon.entity.v0.feed.Feed; import org.apache.falcon.entity.v0.feed.Cluster; import org.apache.falcon.entity.v0.feed.ClusterType; import org.apache.falcon.entity.v0.feed.Location; import org.apache.falcon.entity.v0.feed.LocationType; import org.apache.falcon.entity.v0.feed.MergeType; import org.apache.falcon.entity.v0.feed.Properties; import org.apache.falcon.entity.v0.feed.Property; import org.apache.falcon.entity.v0.feed.Sla; import org.apache.falcon.entity.v0.process.Input; import org.apache.falcon.entity.v0.process.Output; import org.apache.falcon.entity.v0.process.Process; import org.apache.falcon.expression.ExpressionHelper; import org.apache.falcon.group.FeedGroup; import org.apache.falcon.group.FeedGroupMap; import org.apache.falcon.service.LifecyclePolicyMap; import org.apache.falcon.util.DateUtil; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.authorize.AuthorizationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Date; import java.util.List; import java.util.Map; import java.util.HashSet; import java.util.Set; import java.util.TimeZone; /** * Parser that parses feed entity definition. */ public class FeedEntityParser extends EntityParser<Feed> { private static final Logger LOG = LoggerFactory.getLogger(FeedEntityParser.class); public FeedEntityParser() { super(EntityType.FEED); } @Override public void validate(Feed feed) throws FalconException { if (feed.getTimezone() == null) { feed.setTimezone(TimeZone.getTimeZone("UTC")); } if (feed.getClusters() == null) { throw new ValidationException("Feed should have at least one cluster"); } validateLifecycle(feed); validateACL(feed); for (Cluster cluster : feed.getClusters().getClusters()) { validateEntityExists(EntityType.CLUSTER, cluster.getName()); // Optinal end_date if (cluster.getValidity().getEnd() == null) { cluster.getValidity().setEnd(DateUtil.NEVER); } validateClusterValidity(cluster.getValidity().getStart(), cluster.getValidity().getEnd(), cluster.getName()); validateClusterHasRegistry(feed, cluster); validateFeedCutOffPeriod(feed, cluster); if (FeedHelper.isImportEnabled(cluster)) { validateEntityExists(EntityType.DATASOURCE, FeedHelper.getImportDatasourceName(cluster)); validateFeedExtractionType(feed, cluster); validateFeedImportArgs(cluster); validateFeedImportFieldExcludes(cluster); } } validateFeedStorage(feed); validateFeedPath(feed); validateFeedPartitionExpression(feed); validateFeedGroups(feed); validateFeedSLA(feed); validateProperties(feed); // Seems like a good enough entity object for a new one // But is this an update ? Feed oldFeed = ConfigurationStore.get().get(EntityType.FEED, feed.getName()); if (oldFeed == null) { return; // Not an update case } // Is actually an update. Need to iterate over all the processes // depending on this feed and see if they are valid with the new // feed reference EntityGraph graph = EntityGraph.get(); Set<Entity> referenced = graph.getDependents(oldFeed); Set<Process> processes = findProcesses(referenced); if (processes.isEmpty()) { return; } ensureValidityFor(feed, processes); } private void validateLifecycle(Feed feed) throws FalconException { LifecyclePolicyMap map = LifecyclePolicyMap.get(); for (Cluster cluster : feed.getClusters().getClusters()) { if (FeedHelper.isLifecycleEnabled(feed, cluster.getName())) { if (FeedHelper.getRetentionStage(feed, cluster.getName()) == null) { throw new ValidationException("Retention is a mandatory stage, didn't find it for cluster: " + cluster.getName()); } validateRetentionFrequency(feed, cluster.getName()); for (String policyName : FeedHelper.getPolicies(feed, cluster.getName())) { map.get(policyName).validate(feed, cluster.getName()); } } } } private void validateRetentionFrequency(Feed feed, String clusterName) throws FalconException { Frequency retentionFrequency = FeedHelper.getLifecycleRetentionFrequency(feed, clusterName); Frequency feedFrequency = feed.getFrequency(); if (DateUtil.getFrequencyInMillis(retentionFrequency) < DateUtil.getFrequencyInMillis(feedFrequency)) { throw new ValidationException("Retention can not be more frequent than data availability."); } } private Set<Process> findProcesses(Set<Entity> referenced) { Set<Process> processes = new HashSet<Process>(); for (Entity entity : referenced) { if (entity.getEntityType() == EntityType.PROCESS) { processes.add((Process) entity); } } return processes; } private void validateFeedSLA(Feed feed) throws FalconException { for (Cluster cluster : feed.getClusters().getClusters()) { Sla clusterSla = FeedHelper.getSLA(cluster, feed); if (clusterSla != null) { Frequency slaLowExpression = clusterSla.getSlaLow(); ExpressionHelper evaluator = ExpressionHelper.get(); ExpressionHelper.setReferenceDate(new Date()); Date slaLow = new Date(evaluator.evaluate(slaLowExpression.toString(), Long.class)); Frequency slaHighExpression = clusterSla.getSlaHigh(); Date slaHigh = new Date(evaluator.evaluate(slaHighExpression.toString(), Long.class)); if (slaLow.after(slaHigh)) { throw new ValidationException("slaLow of Feed: " + slaLowExpression + "is greater than slaHigh: " + slaHighExpression + " for cluster: " + cluster.getName() ); } // test that slaHigh is less than retention Frequency retentionExpression = cluster.getRetention().getLimit(); Date retention = new Date(evaluator.evaluate(retentionExpression.toString(), Long.class)); if (slaHigh.after(retention)) { throw new ValidationException("slaHigh of Feed: " + slaHighExpression + " is greater than retention of the feed: " + retentionExpression + " for cluster: " + cluster.getName() ); } } } } private void validateFeedGroups(Feed feed) throws FalconException { String[] groupNames = feed.getGroups() != null ? feed.getGroups().split(",") : new String[]{}; final Storage storage = FeedHelper.createStorage(feed); String defaultPath = storage.getUriTemplate(LocationType.DATA); for (Cluster cluster : feed.getClusters().getClusters()) { final String uriTemplate = FeedHelper.createStorage(cluster, feed).getUriTemplate(LocationType.DATA); if (!FeedGroup.getDatePattern(uriTemplate).equals( FeedGroup.getDatePattern(defaultPath))) { throw new ValidationException("Feeds default path pattern: " + storage.getUriTemplate(LocationType.DATA) + ", does not match with cluster: " + cluster.getName() + " path pattern: " + uriTemplate); } } for (String groupName : groupNames) { FeedGroup group = FeedGroupMap.get().getGroupsMapping().get(groupName); if (group != null && !group.canContainFeed(feed)) { throw new ValidationException( "Feed " + feed.getName() + "'s frequency: " + feed.getFrequency().toString() + ", path pattern: " + storage + " does not match with group: " + group.getName() + "'s frequency: " + group.getFrequency() + ", date pattern: " + group.getDatePattern()); } } } private void ensureValidityFor(Feed newFeed, Set<Process> processes) throws FalconException { for (Process process : processes) { try { ensureValidityFor(newFeed, process); } catch (FalconException e) { throw new ValidationException( "Process " + process.getName() + " is not compatible " + "with changes to feed " + newFeed.getName(), e); } } } private void ensureValidityFor(Feed newFeed, Process process) throws FalconException { for (org.apache.falcon.entity.v0.process.Cluster cluster : process.getClusters().getClusters()) { String clusterName = cluster.getName(); if (process.getInputs() != null) { for (Input input : process.getInputs().getInputs()) { if (!input.getFeed().equals(newFeed.getName())) { continue; } CrossEntityValidations.validateFeedDefinedForCluster(newFeed, clusterName); CrossEntityValidations.validateFeedRetentionPeriod(input.getStart(), newFeed, clusterName); CrossEntityValidations.validateInstanceRange(process, input, newFeed); validateInputPartition(newFeed, input); } } if (process.getOutputs() != null) { for (Output output : process.getOutputs().getOutputs()) { if (!output.getFeed().equals(newFeed.getName())) { continue; } CrossEntityValidations.validateFeedDefinedForCluster(newFeed, clusterName); CrossEntityValidations.validateInstance(process, output, newFeed); } } LOG.debug("Verified and found {} to be valid for new definition of {}", process.getName(), newFeed.getName()); } } private void validateInputPartition(Feed newFeed, Input input) throws FalconException { if (input.getPartition() == null) { return; } final Storage.TYPE baseFeedStorageType = FeedHelper.getStorageType(newFeed); if (baseFeedStorageType == Storage.TYPE.FILESYSTEM) { CrossEntityValidations.validateInputPartition(input, newFeed); } else if (baseFeedStorageType == Storage.TYPE.TABLE) { throw new ValidationException("Input partitions are not supported for table storage: " + input.getName()); } } private void validateClusterValidity(Date start, Date end, String clusterName) throws FalconException { try { if (start.after(end)) { throw new ValidationException("Feed start time: " + start + " cannot be after feed end time: " + end + " for cluster: " + clusterName); } } catch (ValidationException e) { throw new ValidationException(e); } catch (Exception e) { throw new FalconException(e); } } private void validateFeedCutOffPeriod(Feed feed, Cluster cluster) throws FalconException { ExpressionHelper evaluator = ExpressionHelper.get(); String feedRetention = cluster.getRetention().getLimit().toString(); long retentionPeriod = evaluator.evaluate(feedRetention, Long.class); if (feed.getLateArrival() == null) { LOG.debug("Feed's late arrival cut-off not set"); return; } String feedCutoff = feed.getLateArrival().getCutOff().toString(); long feedCutOffPeriod = evaluator.evaluate(feedCutoff, Long.class); if (retentionPeriod < feedCutOffPeriod) { throw new ValidationException( "Feed's retention limit: " + feedRetention + " of referenced cluster " + cluster.getName() + " should be more than feed's late arrival cut-off period: " + feedCutoff + " for feed: " + feed.getName()); } } private void validateFeedPartitionExpression(Feed feed) throws FalconException { int numSourceClusters = 0, numTrgClusters = 0; Set<String> clusters = new HashSet<String>(); for (Cluster cl : feed.getClusters().getClusters()) { if (!clusters.add(cl.getName())) { throw new ValidationException("Cluster: " + cl.getName() + " is defined more than once for feed: " + feed.getName()); } if (cl.getType() == ClusterType.SOURCE) { numSourceClusters++; } else if (cl.getType() == ClusterType.TARGET) { numTrgClusters++; } } if (numTrgClusters >= 1 && numSourceClusters == 0) { throw new ValidationException("Feed: " + feed.getName() + " should have atleast one source cluster defined"); } int feedParts = feed.getPartitions() != null ? feed.getPartitions().getPartitions().size() : 0; for (Cluster cluster : feed.getClusters().getClusters()) { if (cluster.getType() == ClusterType.SOURCE && numSourceClusters > 1 && numTrgClusters >= 1) { String part = FeedHelper.normalizePartitionExpression(cluster.getPartition()); if (StringUtils.split(part, '/').length == 0) { throw new ValidationException( "Partition expression has to be specified for cluster " + cluster.getName() + " as there are more than one source clusters"); } validateClusterExpDefined(cluster); } else if (cluster.getType() == ClusterType.TARGET) { for (Cluster src : feed.getClusters().getClusters()) { if (src.getType() == ClusterType.SOURCE) { String part = FeedHelper.normalizePartitionExpression(src.getPartition(), cluster.getPartition()); int numParts = StringUtils.split(part, '/').length; if (numParts > feedParts) { throw new ValidationException( "Partition for " + src.getName() + " and " + cluster.getName() + "clusters is more than the number of partitions defined in feed"); } } } if (numTrgClusters > 1 && numSourceClusters >= 1) { validateClusterExpDefined(cluster); } } } } private void validateClusterExpDefined(Cluster cl) throws FalconException { if (cl.getPartition() == null) { return; } org.apache.falcon.entity.v0.cluster.Cluster cluster = EntityUtil.getEntity(EntityType.CLUSTER, cl.getName()); String part = FeedHelper.normalizePartitionExpression(cl.getPartition()); if (FeedHelper.evaluateClusterExp(cluster, part).equals(part)) { throw new ValidationException( "Alteast one of the partition tags has to be a cluster expression for cluster " + cl.getName()); } } /** * Ensure table is already defined in the catalog registry. * Does not matter for FileSystem storage. */ private void validateFeedStorage(Feed feed) throws FalconException { final Storage.TYPE baseFeedStorageType = FeedHelper.getStorageType(feed); validateMultipleSourcesExist(feed, baseFeedStorageType); validateUniformStorageType(feed, baseFeedStorageType); validatePartitions(feed, baseFeedStorageType); validateStorageExists(feed); } private void validateMultipleSourcesExist(Feed feed, Storage.TYPE baseFeedStorageType) throws FalconException { if (baseFeedStorageType == Storage.TYPE.FILESYSTEM) { return; } // validate that there is only one source cluster int numberOfSourceClusters = 0; for (Cluster cluster : feed.getClusters().getClusters()) { if (cluster.getType() == ClusterType.SOURCE) { numberOfSourceClusters++; } } if (numberOfSourceClusters > 1) { throw new ValidationException("Multiple sources are not supported for feed with table storage: " + feed.getName()); } } private void validateUniformStorageType(Feed feed, Storage.TYPE feedStorageType) throws FalconException { for (Cluster cluster : feed.getClusters().getClusters()) { Storage.TYPE feedClusterStorageType = FeedHelper.getStorageType(feed, cluster); if (feedStorageType != feedClusterStorageType) { throw new ValidationException("The storage type is not uniform for cluster: " + cluster.getName()); } } } private void validateClusterHasRegistry(Feed feed, Cluster cluster) throws FalconException { Storage.TYPE feedClusterStorageType = FeedHelper.getStorageType(feed, cluster); if (feedClusterStorageType != Storage.TYPE.TABLE) { return; } org.apache.falcon.entity.v0.cluster.Cluster clusterEntity = EntityUtil.getEntity(EntityType.CLUSTER, cluster.getName()); if (ClusterHelper.getRegistryEndPoint(clusterEntity) == null) { throw new ValidationException("Cluster should have registry interface defined: " + clusterEntity.getName()); } } private void validatePartitions(Feed feed, Storage.TYPE storageType) throws FalconException { if (storageType == Storage.TYPE.TABLE && feed.getPartitions() != null) { throw new ValidationException("Partitions are not supported for feeds with table storage. " + "It should be defined as part of the table URI. " + feed.getName()); } } private void validateStorageExists(Feed feed) throws FalconException { StringBuilder buffer = new StringBuilder(); for (Cluster cluster : feed.getClusters().getClusters()) { org.apache.falcon.entity.v0.cluster.Cluster clusterEntity = EntityUtil.getEntity(EntityType.CLUSTER, cluster.getName()); if (!EntityUtil.responsibleFor(clusterEntity.getColo())) { continue; } final Storage storage = FeedHelper.createStorage(cluster, feed); // this is only true for table, filesystem always returns true if (storage.getType() == Storage.TYPE.FILESYSTEM) { continue; } CatalogStorage catalogStorage = (CatalogStorage) storage; Configuration clusterConf = ClusterHelper.getConfiguration(clusterEntity); if (!CatalogServiceFactory.getCatalogService().tableExists( clusterConf, catalogStorage.getCatalogUrl(), catalogStorage.getDatabase(), catalogStorage.getTable())) { buffer.append("Table [") .append(catalogStorage.getTable()) .append("] does not exist for feed: ") .append(feed.getName()) .append(" in cluster: ") .append(cluster.getName()); } } if (buffer.length() > 0) { throw new ValidationException(buffer.toString()); } } /** * Validate ACL if authorization is enabled. * * @param feed Feed entity * @throws ValidationException */ protected void validateACL(Feed feed) throws FalconException { if (isAuthorizationDisabled) { return; } final ACL feedACL = feed.getACL(); validateACLOwnerAndGroup(feedACL); try { authorize(feed.getName(), feedACL); } catch (AuthorizationException e) { throw new ValidationException(e); } for (Cluster cluster : feed.getClusters().getClusters()) { org.apache.falcon.entity.v0.cluster.Cluster clusterEntity = EntityUtil.getEntity(EntityType.CLUSTER, cluster.getName()); if (!EntityUtil.responsibleFor(clusterEntity.getColo())) { continue; } final Storage storage = FeedHelper.createStorage(cluster, feed); try { storage.validateACL(feedACL); } catch(FalconException e) { throw new ValidationException(e); } } } protected void validateProperties(Feed feed) throws ValidationException { Properties properties = feed.getProperties(); if (properties == null) { return; // feed has no properties to validate. } List<Property> propertyList = feed.getProperties().getProperties(); HashSet<String> propertyKeys = new HashSet<String>(); for (Property prop : propertyList) { if (StringUtils.isBlank(prop.getName())) { throw new ValidationException("Property name and value cannot be empty for Feed : " + feed.getName()); } if (!propertyKeys.add(prop.getName())) { throw new ValidationException("Multiple properties with same name found for Feed : " + feed.getName()); } } } /** * Validate if FileSystem based feed contains location type data. * * @param feed Feed entity * @throws FalconException */ private void validateFeedPath(Feed feed) throws FalconException { if (FeedHelper.getStorageType(feed) == Storage.TYPE.TABLE) { return; } for (Cluster cluster : feed.getClusters().getClusters()) { List<Location> locations = FeedHelper.getLocations(cluster, feed); Location dataLocation = FileSystemStorage.getLocation(locations, LocationType.DATA); if (dataLocation == null) { throw new ValidationException(feed.getName() + " is a FileSystem based feed " + "but it doesn't contain location type - data in cluster " + cluster.getName()); } } } /** * Validate extraction and merge type combination. Currently supported combo: * * ExtractionType = FULL and MergeType = SNAPSHOT. * ExtractionType = INCREMENTAL and MergeType = APPEND. * * @param feed Feed entity * @param cluster Cluster referenced in the Feed definition * @throws FalconException */ private void validateFeedExtractionType(Feed feed, Cluster cluster) throws FalconException { Extract extract = cluster.getImport().getSource().getExtract(); if (ExtractMethod.FULL == extract.getType()) { if ((MergeType.SNAPSHOT != extract.getMergepolicy()) || (extract.getDeltacolumn() != null)) { throw new ValidationException(String.format("Feed %s is using FULL " + "extract method but specifies either a superfluous " + "deltacolumn or a mergepolicy other than snapshot", feed.getName())); } } else { throw new ValidationException(String.format("Feed %s is using unsupported " + "extraction mechanism %s", feed.getName(), extract.getType().value())); } } /** * Validate improt arguments. * @param feedCluster Cluster referenced in the feed */ private void validateFeedImportArgs(Cluster feedCluster) throws FalconException { Map<String, String> args = FeedHelper.getImportArguments(feedCluster); int numMappers = 1; if (args.containsKey("--num-mappers")) { numMappers = Integer.parseInt(args.get("--num-mappers")); } if ((numMappers > 1) && (!args.containsKey("--split-by"))) { throw new ValidationException(String.format("Feed import expects " + "--split-by column when --num-mappers > 1")); } } private void validateFeedImportFieldExcludes(Cluster feedCluster) throws FalconException { if (FeedHelper.isFieldExcludes(feedCluster)) { throw new ValidationException(String.format("Field excludes are not supported " + "currently in Feed import policy")); } } }
{ "content_hash": "78f4d6c8d6f6a81676ae08d01b6578c7", "timestamp": "", "source": "github", "line_count": 600, "max_line_length": 120, "avg_line_length": 43.49666666666667, "alnum_prop": 0.6050272051498199, "repo_name": "baishuo/falcon_search", "id": "0b48e66107d0969adbb9bf9dd111176e92a4edde", "size": "26904", "binary": false, "copies": "1", "ref": "refs/heads/20151216-FalconClient", "path": "common/src/main/java/org/apache/falcon/entity/parser/FeedEntityParser.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "119841" }, { "name": "HTML", "bytes": "224589" }, { "name": "Java", "bytes": "6407575" }, { "name": "JavaScript", "bytes": "743058" }, { "name": "Perl", "bytes": "19690" }, { "name": "PigLatin", "bytes": "7131" }, { "name": "Shell", "bytes": "26984" }, { "name": "XSLT", "bytes": "16792" } ], "symlink_target": "" }
#ifndef WEBRTC_API_DATACHANNEL_H_ #define WEBRTC_API_DATACHANNEL_H_ #include <deque> #include <set> #include <string> #include "webrtc/api/datachannelinterface.h" #include "webrtc/api/proxy.h" #include "webrtc/base/messagehandler.h" #include "webrtc/base/scoped_ref_ptr.h" #include "webrtc/base/sigslot.h" #include "webrtc/media/base/mediachannel.h" #include "webrtc/pc/channel.h" namespace webrtc { class DataChannel; class DataChannelProviderInterface { public: // Sends the data to the transport. virtual bool SendData(const cricket::SendDataParams& params, const rtc::CopyOnWriteBuffer& payload, cricket::SendDataResult* result) = 0; // Connects to the transport signals. virtual bool ConnectDataChannel(DataChannel* data_channel) = 0; // Disconnects from the transport signals. virtual void DisconnectDataChannel(DataChannel* data_channel) = 0; // Adds the data channel SID to the transport for SCTP. virtual void AddSctpDataStream(int sid) = 0; // Removes the data channel SID from the transport for SCTP. virtual void RemoveSctpDataStream(int sid) = 0; // Returns true if the transport channel is ready to send data. virtual bool ReadyToSendData() const = 0; protected: virtual ~DataChannelProviderInterface() {} }; struct InternalDataChannelInit : public DataChannelInit { enum OpenHandshakeRole { kOpener, kAcker, kNone }; // The default role is kOpener because the default |negotiated| is false. InternalDataChannelInit() : open_handshake_role(kOpener) {} explicit InternalDataChannelInit(const DataChannelInit& base) : DataChannelInit(base), open_handshake_role(kOpener) { // If the channel is externally negotiated, do not send the OPEN message. if (base.negotiated) { open_handshake_role = kNone; } } OpenHandshakeRole open_handshake_role; }; // Helper class to allocate unique IDs for SCTP DataChannels class SctpSidAllocator { public: // Gets the first unused odd/even id based on the DTLS role. If |role| is // SSL_CLIENT, the allocated id starts from 0 and takes even numbers; // otherwise, the id starts from 1 and takes odd numbers. // Returns false if no id can be allocated. bool AllocateSid(rtc::SSLRole role, int* sid); // Attempts to reserve a specific sid. Returns false if it's unavailable. bool ReserveSid(int sid); // Indicates that |sid| isn't in use any more, and is thus available again. void ReleaseSid(int sid); private: // Checks if |sid| is available to be assigned to a new SCTP data channel. bool IsSidAvailable(int sid) const; std::set<int> used_sids_; }; // DataChannel is a an implementation of the DataChannelInterface based on // libjingle's data engine. It provides an implementation of unreliable or // reliabledata channels. Currently this class is specifically designed to use // both RtpDataEngine and SctpDataEngine. // DataChannel states: // kConnecting: The channel has been created the transport might not yet be // ready. // kOpen: The channel have a local SSRC set by a call to UpdateSendSsrc // and a remote SSRC set by call to UpdateReceiveSsrc and the transport // has been writable once. // kClosing: DataChannelInterface::Close has been called or UpdateReceiveSsrc // has been called with SSRC==0 // kClosed: Both UpdateReceiveSsrc and UpdateSendSsrc has been called with // SSRC==0. class DataChannel : public DataChannelInterface, public sigslot::has_slots<>, public rtc::MessageHandler { public: static rtc::scoped_refptr<DataChannel> Create( DataChannelProviderInterface* provider, cricket::DataChannelType dct, const std::string& label, const InternalDataChannelInit& config); virtual void RegisterObserver(DataChannelObserver* observer); virtual void UnregisterObserver(); virtual std::string label() const { return label_; } virtual bool reliable() const; virtual bool ordered() const { return config_.ordered; } virtual uint16_t maxRetransmitTime() const { return config_.maxRetransmitTime; } virtual uint16_t maxRetransmits() const { return config_.maxRetransmits; } virtual std::string protocol() const { return config_.protocol; } virtual bool negotiated() const { return config_.negotiated; } virtual int id() const { return config_.id; } virtual uint64_t buffered_amount() const; virtual void Close(); virtual DataState state() const { return state_; } virtual uint32_t messages_sent() const { return messages_sent_; } virtual uint64_t bytes_sent() const { return bytes_sent_; } virtual uint32_t messages_received() const { return messages_received_; } virtual uint64_t bytes_received() const { return bytes_received_; } virtual bool Send(const DataBuffer& buffer); // rtc::MessageHandler override. virtual void OnMessage(rtc::Message* msg); // Called when the channel's ready to use. That can happen when the // underlying DataMediaChannel becomes ready, or when this channel is a new // stream on an existing DataMediaChannel, and we've finished negotiation. void OnChannelReady(bool writable); // Sigslots from cricket::DataChannel void OnDataReceived(cricket::DataChannel* channel, const cricket::ReceiveDataParams& params, const rtc::CopyOnWriteBuffer& payload); void OnStreamClosedRemotely(uint32_t sid); // The remote peer request that this channel should be closed. void RemotePeerRequestClose(); // The following methods are for SCTP only. // Sets the SCTP sid and adds to transport layer if not set yet. Should only // be called once. void SetSctpSid(int sid); // Called when the transport channel is created. // Only needs to be called for SCTP data channels. void OnTransportChannelCreated(); // Called when the transport channel is destroyed. // This method makes sure the DataChannel is disconnected and changes state // to kClosed. void OnTransportChannelDestroyed(); // The following methods are for RTP only. // Set the SSRC this channel should use to send data on the // underlying data engine. |send_ssrc| == 0 means that the channel is no // longer part of the session negotiation. void SetSendSsrc(uint32_t send_ssrc); // Set the SSRC this channel should use to receive data from the // underlying data engine. void SetReceiveSsrc(uint32_t receive_ssrc); cricket::DataChannelType data_channel_type() const { return data_channel_type_; } // Emitted when state transitions to kClosed. // In the case of SCTP channels, this signal can be used to tell when the // channel's sid is free. sigslot::signal1<DataChannel*> SignalClosed; protected: DataChannel(DataChannelProviderInterface* client, cricket::DataChannelType dct, const std::string& label); virtual ~DataChannel(); private: // A packet queue which tracks the total queued bytes. Queued packets are // owned by this class. class PacketQueue { public: PacketQueue(); ~PacketQueue(); size_t byte_count() const { return byte_count_; } bool Empty() const; DataBuffer* Front(); void Pop(); void Push(DataBuffer* packet); void Clear(); void Swap(PacketQueue* other); private: std::deque<DataBuffer*> packets_; size_t byte_count_; }; // The OPEN(_ACK) signaling state. enum HandshakeState { kHandshakeInit, kHandshakeShouldSendOpen, kHandshakeShouldSendAck, kHandshakeWaitingForAck, kHandshakeReady }; bool Init(const InternalDataChannelInit& config); void DoClose(); void UpdateState(); void SetState(DataState state); void DisconnectFromProvider(); void DeliverQueuedReceivedData(); void SendQueuedDataMessages(); bool SendDataMessage(const DataBuffer& buffer, bool queue_if_blocked); bool QueueSendDataMessage(const DataBuffer& buffer); void SendQueuedControlMessages(); void QueueControlMessage(const rtc::CopyOnWriteBuffer& buffer); bool SendControlMessage(const rtc::CopyOnWriteBuffer& buffer); std::string label_; InternalDataChannelInit config_; DataChannelObserver* observer_; DataState state_; uint32_t messages_sent_; uint64_t bytes_sent_; uint32_t messages_received_; uint64_t bytes_received_; cricket::DataChannelType data_channel_type_; DataChannelProviderInterface* provider_; HandshakeState handshake_state_; bool connected_to_provider_; bool send_ssrc_set_; bool receive_ssrc_set_; bool writable_; uint32_t send_ssrc_; uint32_t receive_ssrc_; // Control messages that always have to get sent out before any queued // data. PacketQueue queued_control_data_; PacketQueue queued_received_data_; PacketQueue queued_send_data_; }; // Define proxy for DataChannelInterface. BEGIN_SIGNALING_PROXY_MAP(DataChannel) PROXY_METHOD1(void, RegisterObserver, DataChannelObserver*) PROXY_METHOD0(void, UnregisterObserver) PROXY_CONSTMETHOD0(std::string, label) PROXY_CONSTMETHOD0(bool, reliable) PROXY_CONSTMETHOD0(bool, ordered) PROXY_CONSTMETHOD0(uint16_t, maxRetransmitTime) PROXY_CONSTMETHOD0(uint16_t, maxRetransmits) PROXY_CONSTMETHOD0(std::string, protocol) PROXY_CONSTMETHOD0(bool, negotiated) PROXY_CONSTMETHOD0(int, id) PROXY_CONSTMETHOD0(DataState, state) PROXY_CONSTMETHOD0(uint32_t, messages_sent) PROXY_CONSTMETHOD0(uint64_t, bytes_sent) PROXY_CONSTMETHOD0(uint32_t, messages_received) PROXY_CONSTMETHOD0(uint64_t, bytes_received) PROXY_CONSTMETHOD0(uint64_t, buffered_amount) PROXY_METHOD0(void, Close) PROXY_METHOD1(bool, Send, const DataBuffer&) END_SIGNALING_PROXY() } // namespace webrtc #endif // WEBRTC_API_DATACHANNEL_H_
{ "content_hash": "bde7064e480e744cd47d2f1e7f1d0f0a", "timestamp": "", "source": "github", "line_count": 288, "max_line_length": 78, "avg_line_length": 34.00694444444444, "alnum_prop": 0.7267714927506637, "repo_name": "ssaroha/node-webrtc", "id": "7d7f6c75df7a4fbe65c37b65b71a86e71e007c4f", "size": "10202", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "third_party/webrtc/include/webrtc/api/datachannel.h", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Batchfile", "bytes": "6179" }, { "name": "C", "bytes": "2679" }, { "name": "C++", "bytes": "54327" }, { "name": "HTML", "bytes": "434" }, { "name": "JavaScript", "bytes": "42707" }, { "name": "Python", "bytes": "3835" } ], "symlink_target": "" }
namespace Diadoc { namespace Api { namespace Proto { namespace Departments { // Internal implementation detail -- do not call these. void protobuf_AddDesc_Departments_2fDepartment_2eproto(); void protobuf_AssignDesc_Departments_2fDepartment_2eproto(); void protobuf_ShutdownFile_Departments_2fDepartment_2eproto(); class Department; // =================================================================== class Department : public ::google::protobuf::Message { public: Department(); virtual ~Department(); Department(const Department& from); inline Department& operator=(const Department& from) { CopyFrom(from); return *this; } inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { return _unknown_fields_; } inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { return &_unknown_fields_; } static const ::google::protobuf::Descriptor* descriptor(); static const Department& default_instance(); void Swap(Department* other); // implements Message ---------------------------------------------- Department* New() const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); void CopyFrom(const Department& from); void MergeFrom(const Department& from); void Clear(); bool IsInitialized() const; int ByteSize() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // required string Id = 1; inline bool has_id() const; inline void clear_id(); static const int kIdFieldNumber = 1; inline const ::std::string& id() const; inline void set_id(const ::std::string& value); inline void set_id(const char* value); inline void set_id(const char* value, size_t size); inline ::std::string* mutable_id(); inline ::std::string* release_id(); inline void set_allocated_id(::std::string* id); // optional string ParentDepartmentId = 2; inline bool has_parentdepartmentid() const; inline void clear_parentdepartmentid(); static const int kParentDepartmentIdFieldNumber = 2; inline const ::std::string& parentdepartmentid() const; inline void set_parentdepartmentid(const ::std::string& value); inline void set_parentdepartmentid(const char* value); inline void set_parentdepartmentid(const char* value, size_t size); inline ::std::string* mutable_parentdepartmentid(); inline ::std::string* release_parentdepartmentid(); inline void set_allocated_parentdepartmentid(::std::string* parentdepartmentid); // required string Name = 3; inline bool has_name() const; inline void clear_name(); static const int kNameFieldNumber = 3; inline const ::std::string& name() const; inline void set_name(const ::std::string& value); inline void set_name(const char* value); inline void set_name(const char* value, size_t size); inline ::std::string* mutable_name(); inline ::std::string* release_name(); inline void set_allocated_name(::std::string* name); // required string Abbreviation = 4; inline bool has_abbreviation() const; inline void clear_abbreviation(); static const int kAbbreviationFieldNumber = 4; inline const ::std::string& abbreviation() const; inline void set_abbreviation(const ::std::string& value); inline void set_abbreviation(const char* value); inline void set_abbreviation(const char* value, size_t size); inline ::std::string* mutable_abbreviation(); inline ::std::string* release_abbreviation(); inline void set_allocated_abbreviation(::std::string* abbreviation); // optional string Kpp = 5; inline bool has_kpp() const; inline void clear_kpp(); static const int kKppFieldNumber = 5; inline const ::std::string& kpp() const; inline void set_kpp(const ::std::string& value); inline void set_kpp(const char* value); inline void set_kpp(const char* value, size_t size); inline ::std::string* mutable_kpp(); inline ::std::string* release_kpp(); inline void set_allocated_kpp(::std::string* kpp); // optional .Diadoc.Api.Proto.Address Address = 6; inline bool has_address() const; inline void clear_address(); static const int kAddressFieldNumber = 6; inline const ::Diadoc::Api::Proto::Address& address() const; inline ::Diadoc::Api::Proto::Address* mutable_address(); inline ::Diadoc::Api::Proto::Address* release_address(); inline void set_allocated_address(::Diadoc::Api::Proto::Address* address); // required .Diadoc.Api.Proto.Departments.Routing Routing = 7; inline bool has_routing() const; inline void clear_routing(); static const int kRoutingFieldNumber = 7; inline const ::Diadoc::Api::Proto::Departments::Routing& routing() const; inline ::Diadoc::Api::Proto::Departments::Routing* mutable_routing(); inline ::Diadoc::Api::Proto::Departments::Routing* release_routing(); inline void set_allocated_routing(::Diadoc::Api::Proto::Departments::Routing* routing); // required .Diadoc.Api.Proto.Timestamp CreationTimestamp = 8; inline bool has_creationtimestamp() const; inline void clear_creationtimestamp(); static const int kCreationTimestampFieldNumber = 8; inline const ::Diadoc::Api::Proto::Timestamp& creationtimestamp() const; inline ::Diadoc::Api::Proto::Timestamp* mutable_creationtimestamp(); inline ::Diadoc::Api::Proto::Timestamp* release_creationtimestamp(); inline void set_allocated_creationtimestamp(::Diadoc::Api::Proto::Timestamp* creationtimestamp); // @@protoc_insertion_point(class_scope:Diadoc.Api.Proto.Departments.Department) private: inline void set_has_id(); inline void clear_has_id(); inline void set_has_parentdepartmentid(); inline void clear_has_parentdepartmentid(); inline void set_has_name(); inline void clear_has_name(); inline void set_has_abbreviation(); inline void clear_has_abbreviation(); inline void set_has_kpp(); inline void clear_has_kpp(); inline void set_has_address(); inline void clear_has_address(); inline void set_has_routing(); inline void clear_has_routing(); inline void set_has_creationtimestamp(); inline void clear_has_creationtimestamp(); ::google::protobuf::UnknownFieldSet _unknown_fields_; ::google::protobuf::uint32 _has_bits_[1]; mutable int _cached_size_; ::std::string* id_; ::std::string* parentdepartmentid_; ::std::string* name_; ::std::string* abbreviation_; ::std::string* kpp_; ::Diadoc::Api::Proto::Address* address_; ::Diadoc::Api::Proto::Departments::Routing* routing_; ::Diadoc::Api::Proto::Timestamp* creationtimestamp_; friend void protobuf_AddDesc_Departments_2fDepartment_2eproto(); friend void protobuf_AssignDesc_Departments_2fDepartment_2eproto(); friend void protobuf_ShutdownFile_Departments_2fDepartment_2eproto(); void InitAsDefaultInstance(); static Department* default_instance_; }; // =================================================================== // =================================================================== // Department // required string Id = 1; inline bool Department::has_id() const { return (_has_bits_[0] & 0x00000001u) != 0; } inline void Department::set_has_id() { _has_bits_[0] |= 0x00000001u; } inline void Department::clear_has_id() { _has_bits_[0] &= ~0x00000001u; } inline void Department::clear_id() { if (id_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { id_->clear(); } clear_has_id(); } inline const ::std::string& Department::id() const { // @@protoc_insertion_point(field_get:Diadoc.Api.Proto.Departments.Department.Id) return *id_; } inline void Department::set_id(const ::std::string& value) { set_has_id(); if (id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { id_ = new ::std::string; } id_->assign(value); // @@protoc_insertion_point(field_set:Diadoc.Api.Proto.Departments.Department.Id) } inline void Department::set_id(const char* value) { set_has_id(); if (id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { id_ = new ::std::string; } id_->assign(value); // @@protoc_insertion_point(field_set_char:Diadoc.Api.Proto.Departments.Department.Id) } inline void Department::set_id(const char* value, size_t size) { set_has_id(); if (id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { id_ = new ::std::string; } id_->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:Diadoc.Api.Proto.Departments.Department.Id) } inline ::std::string* Department::mutable_id() { set_has_id(); if (id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { id_ = new ::std::string; } // @@protoc_insertion_point(field_mutable:Diadoc.Api.Proto.Departments.Department.Id) return id_; } inline ::std::string* Department::release_id() { clear_has_id(); if (id_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = id_; id_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void Department::set_allocated_id(::std::string* id) { if (id_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete id_; } if (id) { set_has_id(); id_ = id; } else { clear_has_id(); id_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } // @@protoc_insertion_point(field_set_allocated:Diadoc.Api.Proto.Departments.Department.Id) } // optional string ParentDepartmentId = 2; inline bool Department::has_parentdepartmentid() const { return (_has_bits_[0] & 0x00000002u) != 0; } inline void Department::set_has_parentdepartmentid() { _has_bits_[0] |= 0x00000002u; } inline void Department::clear_has_parentdepartmentid() { _has_bits_[0] &= ~0x00000002u; } inline void Department::clear_parentdepartmentid() { if (parentdepartmentid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { parentdepartmentid_->clear(); } clear_has_parentdepartmentid(); } inline const ::std::string& Department::parentdepartmentid() const { // @@protoc_insertion_point(field_get:Diadoc.Api.Proto.Departments.Department.ParentDepartmentId) return *parentdepartmentid_; } inline void Department::set_parentdepartmentid(const ::std::string& value) { set_has_parentdepartmentid(); if (parentdepartmentid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { parentdepartmentid_ = new ::std::string; } parentdepartmentid_->assign(value); // @@protoc_insertion_point(field_set:Diadoc.Api.Proto.Departments.Department.ParentDepartmentId) } inline void Department::set_parentdepartmentid(const char* value) { set_has_parentdepartmentid(); if (parentdepartmentid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { parentdepartmentid_ = new ::std::string; } parentdepartmentid_->assign(value); // @@protoc_insertion_point(field_set_char:Diadoc.Api.Proto.Departments.Department.ParentDepartmentId) } inline void Department::set_parentdepartmentid(const char* value, size_t size) { set_has_parentdepartmentid(); if (parentdepartmentid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { parentdepartmentid_ = new ::std::string; } parentdepartmentid_->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:Diadoc.Api.Proto.Departments.Department.ParentDepartmentId) } inline ::std::string* Department::mutable_parentdepartmentid() { set_has_parentdepartmentid(); if (parentdepartmentid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { parentdepartmentid_ = new ::std::string; } // @@protoc_insertion_point(field_mutable:Diadoc.Api.Proto.Departments.Department.ParentDepartmentId) return parentdepartmentid_; } inline ::std::string* Department::release_parentdepartmentid() { clear_has_parentdepartmentid(); if (parentdepartmentid_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = parentdepartmentid_; parentdepartmentid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void Department::set_allocated_parentdepartmentid(::std::string* parentdepartmentid) { if (parentdepartmentid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete parentdepartmentid_; } if (parentdepartmentid) { set_has_parentdepartmentid(); parentdepartmentid_ = parentdepartmentid; } else { clear_has_parentdepartmentid(); parentdepartmentid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } // @@protoc_insertion_point(field_set_allocated:Diadoc.Api.Proto.Departments.Department.ParentDepartmentId) } // required string Name = 3; inline bool Department::has_name() const { return (_has_bits_[0] & 0x00000004u) != 0; } inline void Department::set_has_name() { _has_bits_[0] |= 0x00000004u; } inline void Department::clear_has_name() { _has_bits_[0] &= ~0x00000004u; } inline void Department::clear_name() { if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_->clear(); } clear_has_name(); } inline const ::std::string& Department::name() const { // @@protoc_insertion_point(field_get:Diadoc.Api.Proto.Departments.Department.Name) return *name_; } inline void Department::set_name(const ::std::string& value) { set_has_name(); if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); // @@protoc_insertion_point(field_set:Diadoc.Api.Proto.Departments.Department.Name) } inline void Department::set_name(const char* value) { set_has_name(); if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(value); // @@protoc_insertion_point(field_set_char:Diadoc.Api.Proto.Departments.Department.Name) } inline void Department::set_name(const char* value, size_t size) { set_has_name(); if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } name_->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:Diadoc.Api.Proto.Departments.Department.Name) } inline ::std::string* Department::mutable_name() { set_has_name(); if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { name_ = new ::std::string; } // @@protoc_insertion_point(field_mutable:Diadoc.Api.Proto.Departments.Department.Name) return name_; } inline ::std::string* Department::release_name() { clear_has_name(); if (name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = name_; name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void Department::set_allocated_name(::std::string* name) { if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete name_; } if (name) { set_has_name(); name_ = name; } else { clear_has_name(); name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } // @@protoc_insertion_point(field_set_allocated:Diadoc.Api.Proto.Departments.Department.Name) } // required string Abbreviation = 4; inline bool Department::has_abbreviation() const { return (_has_bits_[0] & 0x00000008u) != 0; } inline void Department::set_has_abbreviation() { _has_bits_[0] |= 0x00000008u; } inline void Department::clear_has_abbreviation() { _has_bits_[0] &= ~0x00000008u; } inline void Department::clear_abbreviation() { if (abbreviation_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { abbreviation_->clear(); } clear_has_abbreviation(); } inline const ::std::string& Department::abbreviation() const { // @@protoc_insertion_point(field_get:Diadoc.Api.Proto.Departments.Department.Abbreviation) return *abbreviation_; } inline void Department::set_abbreviation(const ::std::string& value) { set_has_abbreviation(); if (abbreviation_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { abbreviation_ = new ::std::string; } abbreviation_->assign(value); // @@protoc_insertion_point(field_set:Diadoc.Api.Proto.Departments.Department.Abbreviation) } inline void Department::set_abbreviation(const char* value) { set_has_abbreviation(); if (abbreviation_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { abbreviation_ = new ::std::string; } abbreviation_->assign(value); // @@protoc_insertion_point(field_set_char:Diadoc.Api.Proto.Departments.Department.Abbreviation) } inline void Department::set_abbreviation(const char* value, size_t size) { set_has_abbreviation(); if (abbreviation_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { abbreviation_ = new ::std::string; } abbreviation_->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:Diadoc.Api.Proto.Departments.Department.Abbreviation) } inline ::std::string* Department::mutable_abbreviation() { set_has_abbreviation(); if (abbreviation_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { abbreviation_ = new ::std::string; } // @@protoc_insertion_point(field_mutable:Diadoc.Api.Proto.Departments.Department.Abbreviation) return abbreviation_; } inline ::std::string* Department::release_abbreviation() { clear_has_abbreviation(); if (abbreviation_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = abbreviation_; abbreviation_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void Department::set_allocated_abbreviation(::std::string* abbreviation) { if (abbreviation_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete abbreviation_; } if (abbreviation) { set_has_abbreviation(); abbreviation_ = abbreviation; } else { clear_has_abbreviation(); abbreviation_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } // @@protoc_insertion_point(field_set_allocated:Diadoc.Api.Proto.Departments.Department.Abbreviation) } // optional string Kpp = 5; inline bool Department::has_kpp() const { return (_has_bits_[0] & 0x00000010u) != 0; } inline void Department::set_has_kpp() { _has_bits_[0] |= 0x00000010u; } inline void Department::clear_has_kpp() { _has_bits_[0] &= ~0x00000010u; } inline void Department::clear_kpp() { if (kpp_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { kpp_->clear(); } clear_has_kpp(); } inline const ::std::string& Department::kpp() const { // @@protoc_insertion_point(field_get:Diadoc.Api.Proto.Departments.Department.Kpp) return *kpp_; } inline void Department::set_kpp(const ::std::string& value) { set_has_kpp(); if (kpp_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { kpp_ = new ::std::string; } kpp_->assign(value); // @@protoc_insertion_point(field_set:Diadoc.Api.Proto.Departments.Department.Kpp) } inline void Department::set_kpp(const char* value) { set_has_kpp(); if (kpp_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { kpp_ = new ::std::string; } kpp_->assign(value); // @@protoc_insertion_point(field_set_char:Diadoc.Api.Proto.Departments.Department.Kpp) } inline void Department::set_kpp(const char* value, size_t size) { set_has_kpp(); if (kpp_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { kpp_ = new ::std::string; } kpp_->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:Diadoc.Api.Proto.Departments.Department.Kpp) } inline ::std::string* Department::mutable_kpp() { set_has_kpp(); if (kpp_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { kpp_ = new ::std::string; } // @@protoc_insertion_point(field_mutable:Diadoc.Api.Proto.Departments.Department.Kpp) return kpp_; } inline ::std::string* Department::release_kpp() { clear_has_kpp(); if (kpp_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { return NULL; } else { ::std::string* temp = kpp_; kpp_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); return temp; } } inline void Department::set_allocated_kpp(::std::string* kpp) { if (kpp_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { delete kpp_; } if (kpp) { set_has_kpp(); kpp_ = kpp; } else { clear_has_kpp(); kpp_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } // @@protoc_insertion_point(field_set_allocated:Diadoc.Api.Proto.Departments.Department.Kpp) } // optional .Diadoc.Api.Proto.Address Address = 6; inline bool Department::has_address() const { return (_has_bits_[0] & 0x00000020u) != 0; } inline void Department::set_has_address() { _has_bits_[0] |= 0x00000020u; } inline void Department::clear_has_address() { _has_bits_[0] &= ~0x00000020u; } inline void Department::clear_address() { if (address_ != NULL) address_->::Diadoc::Api::Proto::Address::Clear(); clear_has_address(); } inline const ::Diadoc::Api::Proto::Address& Department::address() const { // @@protoc_insertion_point(field_get:Diadoc.Api.Proto.Departments.Department.Address) return address_ != NULL ? *address_ : *default_instance_->address_; } inline ::Diadoc::Api::Proto::Address* Department::mutable_address() { set_has_address(); if (address_ == NULL) address_ = new ::Diadoc::Api::Proto::Address; // @@protoc_insertion_point(field_mutable:Diadoc.Api.Proto.Departments.Department.Address) return address_; } inline ::Diadoc::Api::Proto::Address* Department::release_address() { clear_has_address(); ::Diadoc::Api::Proto::Address* temp = address_; address_ = NULL; return temp; } inline void Department::set_allocated_address(::Diadoc::Api::Proto::Address* address) { delete address_; address_ = address; if (address) { set_has_address(); } else { clear_has_address(); } // @@protoc_insertion_point(field_set_allocated:Diadoc.Api.Proto.Departments.Department.Address) } // required .Diadoc.Api.Proto.Departments.Routing Routing = 7; inline bool Department::has_routing() const { return (_has_bits_[0] & 0x00000040u) != 0; } inline void Department::set_has_routing() { _has_bits_[0] |= 0x00000040u; } inline void Department::clear_has_routing() { _has_bits_[0] &= ~0x00000040u; } inline void Department::clear_routing() { if (routing_ != NULL) routing_->::Diadoc::Api::Proto::Departments::Routing::Clear(); clear_has_routing(); } inline const ::Diadoc::Api::Proto::Departments::Routing& Department::routing() const { // @@protoc_insertion_point(field_get:Diadoc.Api.Proto.Departments.Department.Routing) return routing_ != NULL ? *routing_ : *default_instance_->routing_; } inline ::Diadoc::Api::Proto::Departments::Routing* Department::mutable_routing() { set_has_routing(); if (routing_ == NULL) routing_ = new ::Diadoc::Api::Proto::Departments::Routing; // @@protoc_insertion_point(field_mutable:Diadoc.Api.Proto.Departments.Department.Routing) return routing_; } inline ::Diadoc::Api::Proto::Departments::Routing* Department::release_routing() { clear_has_routing(); ::Diadoc::Api::Proto::Departments::Routing* temp = routing_; routing_ = NULL; return temp; } inline void Department::set_allocated_routing(::Diadoc::Api::Proto::Departments::Routing* routing) { delete routing_; routing_ = routing; if (routing) { set_has_routing(); } else { clear_has_routing(); } // @@protoc_insertion_point(field_set_allocated:Diadoc.Api.Proto.Departments.Department.Routing) } // required .Diadoc.Api.Proto.Timestamp CreationTimestamp = 8; inline bool Department::has_creationtimestamp() const { return (_has_bits_[0] & 0x00000080u) != 0; } inline void Department::set_has_creationtimestamp() { _has_bits_[0] |= 0x00000080u; } inline void Department::clear_has_creationtimestamp() { _has_bits_[0] &= ~0x00000080u; } inline void Department::clear_creationtimestamp() { if (creationtimestamp_ != NULL) creationtimestamp_->::Diadoc::Api::Proto::Timestamp::Clear(); clear_has_creationtimestamp(); } inline const ::Diadoc::Api::Proto::Timestamp& Department::creationtimestamp() const { // @@protoc_insertion_point(field_get:Diadoc.Api.Proto.Departments.Department.CreationTimestamp) return creationtimestamp_ != NULL ? *creationtimestamp_ : *default_instance_->creationtimestamp_; } inline ::Diadoc::Api::Proto::Timestamp* Department::mutable_creationtimestamp() { set_has_creationtimestamp(); if (creationtimestamp_ == NULL) creationtimestamp_ = new ::Diadoc::Api::Proto::Timestamp; // @@protoc_insertion_point(field_mutable:Diadoc.Api.Proto.Departments.Department.CreationTimestamp) return creationtimestamp_; } inline ::Diadoc::Api::Proto::Timestamp* Department::release_creationtimestamp() { clear_has_creationtimestamp(); ::Diadoc::Api::Proto::Timestamp* temp = creationtimestamp_; creationtimestamp_ = NULL; return temp; } inline void Department::set_allocated_creationtimestamp(::Diadoc::Api::Proto::Timestamp* creationtimestamp) { delete creationtimestamp_; creationtimestamp_ = creationtimestamp; if (creationtimestamp) { set_has_creationtimestamp(); } else { clear_has_creationtimestamp(); } // @@protoc_insertion_point(field_set_allocated:Diadoc.Api.Proto.Departments.Department.CreationTimestamp) } // @@protoc_insertion_point(namespace_scope) } // namespace Departments } // namespace Proto } // namespace Api } // namespace Diadoc #ifndef SWIG namespace google { namespace protobuf { } // namespace google } // namespace protobuf #endif // SWIG // @@protoc_insertion_point(global_scope) #endif // PROTOBUF_Departments_2fDepartment_2eproto__INCLUDED
{ "content_hash": "977214e4e0b1aa08da77953273d80302", "timestamp": "", "source": "github", "line_count": 722, "max_line_length": 116, "avg_line_length": 37.23684210526316, "alnum_prop": 0.696113074204947, "repo_name": "diadoc/diadocsdk-cpp", "id": "5d608d5f8542fdffed6120761af4ee8f05059a84", "size": "27972", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/protos/Departments/Department.pb.h", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "502" }, { "name": "C", "bytes": "2303" }, { "name": "C#", "bytes": "6466" }, { "name": "C++", "bytes": "167392" }, { "name": "CMake", "bytes": "2696" }, { "name": "PowerShell", "bytes": "6887" }, { "name": "Shell", "bytes": "1724" } ], "symlink_target": "" }
local view = { origin = Vector(0, 0, 0), angles = Angle(0, 0, 0), fov = 90, znear = 1 } hook.Add("CalcView", "rp_deathPOV", function(ply, origin, angles, fov) -- Entity:Alive() is being slow as hell, we might actually see ourselves from third person for frame or two if not GAMEMODE.Config.deathpov or ply:Health() > 0 then return end local Ragdoll = ply:GetRagdollEntity() if not IsValid(Ragdoll) then return end local head = Ragdoll:LookupAttachment("eyes") head = Ragdoll:GetAttachment(head) if not head or not head.Pos then return end if not Ragdoll.BonesRattled then Ragdoll.BonesRattled = true Ragdoll:InvalidateBoneCache() Ragdoll:SetupBones() local matrix for bone = 0, (Ragdoll:GetBoneCount() or 1) do if Ragdoll:GetBoneName(bone):lower():find("head") then matrix = Ragdoll:GetBoneMatrix(bone) break end end if IsValid(matrix) then matrix:SetScale(Vector(0, 0, 0)) end end view.origin = head.Pos + head.Ang:Up() * 8 view.angles = head.Ang return view end)
{ "content_hash": "6923e212edcb991055ad01ac4ae2aa66", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 108, "avg_line_length": 23.813953488372093, "alnum_prop": 0.703125, "repo_name": "cardentity/DarkRP", "id": "8aa07118bdcb31845c423a0d7119935afb57ff12", "size": "1024", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "gamemode/modules/deathpov/cl_init.lua", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }