code
stringlengths
5
1.04M
repo_name
stringlengths
7
108
path
stringlengths
6
299
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
5
1.04M
package es.litesolutions.cache; import com.intersys.cache.Dataholder; import com.intersys.classes.CharacterStream; import com.intersys.classes.FileBinaryStream; import com.intersys.classes.GlobalCharacterStream; import com.intersys.objects.CacheException; import com.intersys.objects.Database; import com.intersys.objects.StringHolder; import es.litesolutions.cache.db.CacheDb; import es.litesolutions.cache.db.CacheQueryProvider; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.sql.Connection; import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; /** * A wrapper class for the necessary methods run by this program * * <p>This program takes a {@link CacheDb} as an argument (instead of a plain * {@link Database}) since the former's {@link CacheDb#query(CacheQueryProvider) * query method} is needed.</p> */ public class CacheRunner extends Runner { private static final String CRLF = "\r\n"; private final CacheDb cacheDb; final Database db; public CacheRunner(final Connection connection) throws CacheException { super(connection); this.cacheDb = new CacheDb(connection); this.db = cacheDb.getDatabase(); } @Override public void importStream(final Path path) throws CacheException, IOException { final CharacterStream stream = new GlobalCharacterStream(db); loadContent(stream, path); /* * Arguments for class "%SYSTEM.OBJ", class method "LoadStream" */ final Dataholder[] arguments = new Dataholder[8]; /* * Arguments ByRef * * Indices start at 1, not 0 * * FIXME: in fact, they are unused... */ final int[] byRefArgs = new int[2]; // Arg 3: error log final StringHolder errorlog = new StringHolder(""); byRefArgs[0] = 3; // Arg 4: list of loaded items final StringHolder loadedlist = new StringHolder(""); byRefArgs[1] = 4; /* * Fill arguments */ // arg 1: stream arguments[0] = Dataholder.create(stream); // arg 2: qspec; we want to ensure that compile works, at least arguments[1] = new Dataholder("d"); // arg 3: errorlog arguments[2] = Dataholder.create(errorlog.value); // arg 4: loadedlist arguments[3] = Dataholder.create(loadedlist.value); // arg 5: listonly; no arguments[4] = Dataholder.create(Boolean.FALSE); // arg 6: selecteditems; nothing arguments[5] = Dataholder.create(null); // arg 7: displayname. For logging... arguments[6] = Dataholder.create("IMPORT"); // arg 8: charset. Default is empty string, we'll assume UTF-8. arguments[7] = new Dataholder((String) null); // Now, make the call final Dataholder[] result = db.runClassMethod( LOADSTREAM_CLASSNAME, LOADSTREAM_METHODNAME, byRefArgs, arguments, Database.RET_PRIM ); /* * The result normally has three members: * * - first is the status; and we need to do that: */ db.parseStatus(result[0]); /* * - others are ByRef arguments */ // FIXME: not filled correctly... No idea if this is a bug with // InterSystems jars or not. See the README for more details. // errorlog.set(result[1].getString()); // System.out.println("errorlog: " + errorlog.getValue()); // // loadedlist.set(result[2].getString()); // System.out.println("loadedlist: " + loadedlist.getValue()); } @Override public Set<String> importFile(final Path path, final boolean includeSys) throws CacheException, IOException { System.out.printf("Import from '%s'\n", path); final String tempFileName = createRemoteTemporaryFileName("xml"); final Database db = cacheDb.getDatabase(); final FileBinaryStream stream = new FileBinaryStream(db); stream._filenameSet(tempFileName); Files.copy(path, stream.getOutputStream()); final String remoteFileName = stream._filenameGet(); /* * Arguments for class "%SYSTEM.OBJ", class method "Load" */ final Dataholder[] arguments = new Dataholder[9]; /* * Arguments ByRef * * Indices start at 1, not 0 */ final int[] byRefArgs = new int[3]; // Arg 3: error log final StringHolder errorlog = new StringHolder(""); byRefArgs[0] = 3; // Arg 4: list of loaded items final StringHolder loadedlist = new StringHolder(""); byRefArgs[1] = 4; // Arg 9: description (?) final StringHolder description = new StringHolder(""); byRefArgs[2] = 9; /* * Fill arguments */ // arg 1: file name arguments[0] = Dataholder.create(remoteFileName); // arg 2: qspec; we want to ensure that compile works, at least arguments[1] = new Dataholder("d"); // arg 3: errorlog arguments[2] = Dataholder.create(errorlog.value); // arg 4: loadedlist arguments[3] = Dataholder.create(loadedlist.value); // arg 5: listonly; no arguments[4] = Dataholder.create(Boolean.FALSE); // arg 6: selecteditems; nothing arguments[5] = Dataholder.create(null); // arg 7: displayname. For logging... arguments[6] = Dataholder.create(null); // arg 8: charset. We force UTF-8. arguments[7] = new Dataholder("UTF8"); // arg 9: description (?) arguments[8] = Dataholder.create(description.value); try { // Now, make the call final Dataholder[] result = db.runClassMethod( LOADFILE_CLASSNAME, LOADFILE_METHODNAME, byRefArgs, arguments, Database.RET_PRIM ); /* * The result normally has three members: * * - first is the status; and we need to do that: */ db.parseStatus(result[0]); /* * - others are ByRef arguments */ // TODO // errorlog.set(result[1].getString()); // System.out.println("errorlog: " + errorlog.getValue()); loadedlist.set(result[2].getString()); } catch (Exception ex) { System.out.println("Error loading file: " + ex.getLocalizedMessage()); return Collections.emptySet(); } Predicate<String> predicate = FILES; if (!includeSys) predicate = predicate.and(SYSEXCLUDE); final String value = (String) loadedlist.getValue(); /* * It can happen if we have nothing imported... */ if (value == null) return Collections.emptySet(); final Set<String> set = COMMA.splitAsStream(value) .filter(predicate) // .map(s -> s.substring(0, s.length() - 4)) .collect(Collectors.toCollection(HashSet::new)); return Collections.unmodifiableSet(set); } @Override public void writeClassContent(final String itemName, final Path path) throws CacheException, IOException { final String tempFileName = createRemoteTemporaryFileName("txt"); int versionMajor = 2016; int versionMinor = 2; try { versionMajor = connection.getMetaData().getDatabaseMajorVersion(); versionMinor = connection.getMetaData().getDatabaseMinorVersion(); } catch (Exception e) { } if (versionMajor < 2016 || (versionMajor == 2016 && versionMinor < 2)) { if (itemName.toLowerCase().endsWith("cls")) { System.out.printf("Export '%s' to '%s'\n", itemName, path); String className = itemName.substring(0, itemName.length() - 4); final int[] byRefs = new int[0]; final Dataholder[] arguments = new Dataholder[3]; arguments[0] = new Dataholder((String) null); arguments[1] = new Dataholder(className); arguments[2] = new Dataholder(tempFileName); final Dataholder[] res = db.runClassMethod( "%Compiler.UDL.TextServices", "GetTextAsFile", byRefs, arguments, Database.RET_PRIM ); db.parseStatus(res[0]); } } else { System.out.printf("Export '%s' to '%s'\n", itemName, path); final int[] byRefs = new int[0]; final Dataholder[] arguments = new Dataholder[2]; arguments[0] = new Dataholder(itemName); arguments[1] = new Dataholder(tempFileName); final Dataholder[] res = db.runClassMethod( WRITECLASSCONTENT_CLASSNAME, WRITECLASSCONTENT_METHODNAME, byRefs, arguments, Database.RET_PRIM ); db.parseStatus(res[0]); } final FileBinaryStream stream = new FileBinaryStream(db); stream._filenameSet(tempFileName); Files.copy(stream.getInputStream(), path); stream._clear(); } private String createRemoteTemporaryFileName(String fileExt) throws CacheException { final Dataholder[] args = { new Dataholder(fileExt) }; final Dataholder res = cacheDb.getDatabase() .runClassMethod(FILE_CLASSNAME, FILE_METHODNAME, args, 0); return res.getString(); } }
litesolutions/cachedb-import
src/main/java/es/litesolutions/cache/CacheRunner.java
Java
apache-2.0
10,031
package com.ctrip.xpipe.redis.meta.server.keeper.elect; import com.ctrip.xpipe.api.lifecycle.Releasable; import com.ctrip.xpipe.api.lifecycle.TopElement; import com.ctrip.xpipe.api.observer.Observer; import com.ctrip.xpipe.codec.JsonCodec; import com.ctrip.xpipe.redis.core.entity.ClusterMeta; import com.ctrip.xpipe.redis.core.entity.KeeperMeta; import com.ctrip.xpipe.redis.core.entity.ShardMeta; import com.ctrip.xpipe.redis.core.meta.MetaZkConfig; import com.ctrip.xpipe.redis.core.meta.comparator.ClusterMetaComparator; import com.ctrip.xpipe.redis.meta.server.keeper.KeeperActiveElectAlgorithm; import com.ctrip.xpipe.redis.meta.server.keeper.KeeperActiveElectAlgorithmManager; import com.ctrip.xpipe.redis.meta.server.keeper.KeeperElectorManager; import com.ctrip.xpipe.redis.meta.server.keeper.impl.AbstractCurrentMetaObserver; import com.ctrip.xpipe.utils.XpipeThreadFactory; import com.ctrip.xpipe.zk.ZkClient; import com.ctrip.xpipe.zk.ZkUtils; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.recipes.cache.ChildData; import org.apache.curator.framework.recipes.cache.PathChildrenCache; import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent; import org.apache.curator.framework.recipes.cache.PathChildrenCacheListener; import org.apache.curator.framework.recipes.locks.LockInternals; import org.apache.curator.framework.recipes.locks.LockInternalsSorter; import org.apache.curator.framework.recipes.locks.StandardLockInternalsDriver; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; /** * @author wenchao.meng * * Jul 7, 2016 */ @Component public class DefaultKeeperElectorManager extends AbstractCurrentMetaObserver implements KeeperElectorManager, Observer, TopElement{ public static final int FIRST_PATH_CHILDREN_CACHE_SLEEP_MILLI = 50; @Autowired private ZkClient zkClient; @Autowired private KeeperActiveElectAlgorithmManager keeperActiveElectAlgorithmManager; private void observeLeader(final ClusterMeta cluster) { logger.info("[observeLeader]{}", cluster.getId()); for (final ShardMeta shard : cluster.getShards().values()) { observerShardLeader(cluster.getId(), shard.getId()); } } protected void observerShardLeader(final String clusterId, final String shardId) { logger.info("[observerShardLeader]{}, {}", clusterId, shardId); final String leaderLatchPath = MetaZkConfig.getKeeperLeaderLatchPath(clusterId, shardId); final CuratorFramework client = zkClient.get(); if(currentMetaManager.watchIfNotWatched(clusterId, shardId)){ try { logger.info("[observerShardLeader][add PathChildrenCache]{}, {}", clusterId, shardId); PathChildrenCache pathChildrenCache = new PathChildrenCache(client, leaderLatchPath, true, XpipeThreadFactory.create(String.format("PathChildrenCache:%s-%s", clusterId, shardId))); pathChildrenCache.getListenable().addListener(new PathChildrenCacheListener() { private AtomicBoolean isFirst = new AtomicBoolean(true); @Override public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception { if(isFirst.get()){ isFirst.set(false); try { logger.info("[childEvent][first sleep]{}", FIRST_PATH_CHILDREN_CACHE_SLEEP_MILLI); TimeUnit.MILLISECONDS.sleep(FIRST_PATH_CHILDREN_CACHE_SLEEP_MILLI); }catch (Exception e){ logger.error("[childEvent]", e); } } logger.info("[childEvent]{}, {}, {}, {}", clusterId, shardId, event.getType(), ZkUtils.toString(event.getData())); updateShardLeader(leaderLatchPath, pathChildrenCache.getCurrentData(), clusterId, shardId); } }); currentMetaManager.addResource(clusterId, shardId, new Releasable() { @Override public void release() throws Exception { try{ logger.info("[release][release children cache]{}, {}", clusterId, shardId); pathChildrenCache.close(); }catch (Exception e){ logger.error(String.format("[release][release children cache]%s, %s", clusterId, shardId), e); } } }); pathChildrenCache.start(); } catch (Exception e) { logger.error("[observerShardLeader]" + clusterId + " " + shardId, e); } }else{ logger.warn("[observerShardLeader][already watched]{}, {}", clusterId, shardId); } } private LockInternalsSorter sorter = new LockInternalsSorter() { @Override public String fixForSorting(String str, String lockName) { return StandardLockInternalsDriver.standardFixForSorting(str, lockName); } }; protected void updateShardLeader(String leaderLatchPath, List<ChildData> childrenData, String clusterId, String shardId){ List<String> childrenPaths = new LinkedList<>(); childrenData.forEach(childData -> childrenPaths.add(childData.getPath())); logger.info("[updateShardLeader]{}, {}, {}", clusterId, shardId, childrenPaths); List<String> sortedChildren = LockInternals.getSortedChildren("latch-", sorter, childrenPaths); List<KeeperMeta> survivalKeepers = new ArrayList<>(childrenData.size()); for(String path : sortedChildren){ for(ChildData childData : childrenData){ if(path.equals(childData.getPath())){ String data = new String(childData.getData()); KeeperMeta keeper = JsonCodec.INSTANCE.decode(data, KeeperMeta.class); survivalKeepers.add(keeper); break; } } } if(survivalKeepers.size() != childrenData.size()){ throw new IllegalStateException(String.format("[children data not equal with survival keepers]%s, %s", childrenData, survivalKeepers)); } KeeperActiveElectAlgorithm klea = keeperActiveElectAlgorithmManager.get(clusterId, shardId); KeeperMeta activeKeeper = klea.select(clusterId, shardId, survivalKeepers); currentMetaManager.setSurviveKeepers(clusterId, shardId, survivalKeepers, activeKeeper); } @Override protected void handleClusterModified(ClusterMetaComparator comparator) { String clusterId = comparator.getCurrent().getId(); for(ShardMeta shardMeta : comparator.getAdded()){ try { observerShardLeader(clusterId, shardMeta.getId()); } catch (Exception e) { logger.error("[handleClusterModified]" + clusterId + "," + shardMeta.getId(), e); } } } @Override protected void handleClusterAdd(ClusterMeta clusterMeta) { try { observeLeader(clusterMeta); } catch (Exception e) { logger.error("[handleClusterAdd]" + clusterMeta.getId(), e); } } @Override protected void handleClusterDeleted(ClusterMeta clusterMeta) { //nothing to do } public void setKeeperActiveElectAlgorithmManager( KeeperActiveElectAlgorithmManager keeperActiveElectAlgorithmManager) { this.keeperActiveElectAlgorithmManager = keeperActiveElectAlgorithmManager; } }
Yiiinsh/x-pipe
redis/redis-meta/src/main/java/com/ctrip/xpipe/redis/meta/server/keeper/elect/DefaultKeeperElectorManager.java
Java
apache-2.0
7,235
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.daemon.impl; import com.intellij.codeHighlighting.Pass; import com.intellij.codeInsight.daemon.GutterMark; import com.intellij.codeInsight.daemon.HighlightDisplayKey; import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInsight.intention.IntentionManager; import com.intellij.codeInspection.*; import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper; import com.intellij.codeInspection.ex.InspectionToolWrapper; import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; import com.intellij.lang.ASTNode; import com.intellij.lang.annotation.Annotation; import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.lang.annotation.ProblemGroup; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.HighlighterColors; import com.intellij.openapi.editor.RangeMarker; import com.intellij.openapi.editor.colors.*; import com.intellij.openapi.editor.ex.RangeHighlighterEx; import com.intellij.openapi.editor.markup.GutterIconRenderer; import com.intellij.openapi.editor.markup.RangeHighlighter; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.util.*; import com.intellij.openapi.util.text.StringUtil; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.util.ArrayUtil; import com.intellij.util.BitUtil; import com.intellij.util.containers.ContainerUtil; import com.intellij.xml.util.XmlStringUtil; import org.intellij.lang.annotations.MagicConstant; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; import java.util.*; import java.util.List; public class HighlightInfo implements Segment { private static final Logger LOG = Logger.getInstance(HighlightInfo.class); // optimization: if tooltip contains this marker object, then it replaced with description field in getTooltip() private static final String DESCRIPTION_PLACEHOLDER = "\u0000"; private static final byte BIJECTIVE_MASK = 0x1; private static final byte HAS_HINT_MASK = 0x2; private static final byte FROM_INJECTION_MASK = 0x4; private static final byte AFTER_END_OF_LINE_MASK = 0x8; private static final byte FILE_LEVEL_ANNOTATION_MASK = 0x10; private static final byte NEEDS_UPDATE_ON_TYPING_MASK = 0x20; @MagicConstant(intValues = { BIJECTIVE_MASK, HAS_HINT_MASK, FROM_INJECTION_MASK, AFTER_END_OF_LINE_MASK, FILE_LEVEL_ANNOTATION_MASK, NEEDS_UPDATE_ON_TYPING_MASK}) private @interface FlagConstant { } public final TextAttributes forcedTextAttributes; public final TextAttributesKey forcedTextAttributesKey; @NotNull public final HighlightInfoType type; public final int startOffset; public final int endOffset; public List<Pair<IntentionActionDescriptor, TextRange>> quickFixActionRanges; public List<Pair<IntentionActionDescriptor, RangeMarker>> quickFixActionMarkers; private final String description; private final String toolTip; @NotNull private final HighlightSeverity severity; private final GutterMark gutterIconRenderer; private final ProblemGroup myProblemGroup; private final String inspectionToolId; private int group; private int fixStartOffset; private int fixEndOffset; /** * @see FlagConstant for allowed values */ private volatile byte myFlags; final int navigationShift; JComponent fileLevelComponent; @Nullable("null means it the same as highlighter") RangeMarker fixMarker; volatile RangeHighlighterEx highlighter; // modified in EDT only PsiElement psiElement; protected HighlightInfo(@Nullable TextAttributes forcedTextAttributes, @Nullable TextAttributesKey forcedTextAttributesKey, @NotNull HighlightInfoType type, int startOffset, int endOffset, @Nullable String escapedDescription, @Nullable String escapedToolTip, @NotNull HighlightSeverity severity, boolean afterEndOfLine, @Nullable Boolean needsUpdateOnTyping, boolean isFileLevelAnnotation, int navigationShift, ProblemGroup problemGroup, @Nullable String inspectionToolId, GutterMark gutterIconRenderer, int group) { if (startOffset < 0 || startOffset > endOffset) { LOG.error("Incorrect highlightInfo bounds. description="+escapedDescription+"; startOffset="+startOffset+"; endOffset="+endOffset+";type="+type); } this.forcedTextAttributes = forcedTextAttributes; this.forcedTextAttributesKey = forcedTextAttributesKey; this.type = type; this.startOffset = startOffset; this.endOffset = endOffset; fixStartOffset = startOffset; fixEndOffset = endOffset; description = escapedDescription; // optimization: do not retain extra memory if can recompute toolTip = encodeTooltip(escapedToolTip, escapedDescription); this.severity = severity; setFlag(AFTER_END_OF_LINE_MASK, afterEndOfLine); setFlag(NEEDS_UPDATE_ON_TYPING_MASK, calcNeedUpdateOnTyping(needsUpdateOnTyping, type)); setFlag(FILE_LEVEL_ANNOTATION_MASK, isFileLevelAnnotation); this.navigationShift = navigationShift; myProblemGroup = problemGroup; this.gutterIconRenderer = gutterIconRenderer; this.inspectionToolId = inspectionToolId; this.group = group; } /** * Returns the HighlightInfo instance from which the given range highlighter was created, or null if there isn't any. */ @Nullable public static HighlightInfo fromRangeHighlighter(@NotNull RangeHighlighter highlighter) { Object errorStripeTooltip = highlighter.getErrorStripeTooltip(); return errorStripeTooltip instanceof HighlightInfo ? (HighlightInfo)errorStripeTooltip : null; } @NotNull ProperTextRange getFixTextRange() { return new ProperTextRange(fixStartOffset, fixEndOffset); } void setFromInjection(boolean fromInjection) { setFlag(FROM_INJECTION_MASK, fromInjection); } @Nullable public String getToolTip() { String toolTip = this.toolTip; String description = this.description; if (toolTip == null || description == null || !toolTip.contains(DESCRIPTION_PLACEHOLDER)) return toolTip; String decoded = StringUtil.replace(toolTip, DESCRIPTION_PLACEHOLDER, XmlStringUtil.escapeString(description)); return XmlStringUtil.wrapInHtml(decoded); } /** * Encodes \p tooltip so that substrings equal to a \p description * are replaced with the special placeholder to reduce size of the * tooltip. If encoding takes place, <html></html> tags are * stripped of the tooltip. * * @param tooltip - html text * @param description - plain text (not escaped) * * @return encoded tooltip (stripped html text with one or more placeholder characters) * or tooltip without changes. */ private static String encodeTooltip(String tooltip, String description) { if (tooltip == null || description == null || description.isEmpty()) return tooltip; String encoded = StringUtil.replace(tooltip, XmlStringUtil.escapeString(description), DESCRIPTION_PLACEHOLDER); //noinspection StringEquality if (encoded == tooltip) { return tooltip; } if (encoded.equals(DESCRIPTION_PLACEHOLDER)) encoded = DESCRIPTION_PLACEHOLDER; return XmlStringUtil.stripHtml(encoded); } public String getDescription() { return description; } @Nullable public String getInspectionToolId() { return inspectionToolId; } private boolean isFlagSet(@FlagConstant byte mask) { return BitUtil.isSet(myFlags, mask); } private void setFlag(@FlagConstant byte mask, boolean value) { myFlags = BitUtil.set(myFlags, mask, value); } boolean isFileLevelAnnotation() { return isFlagSet(FILE_LEVEL_ANNOTATION_MASK); } boolean isBijective() { return isFlagSet(BIJECTIVE_MASK); } void setBijective(boolean bijective) { setFlag(BIJECTIVE_MASK, bijective); } @NotNull public HighlightSeverity getSeverity() { return severity; } public RangeHighlighterEx getHighlighter() { return highlighter; } /** * Modified only in EDT. */ public void setHighlighter(@Nullable RangeHighlighterEx highlighter) { ApplicationManager.getApplication().assertIsDispatchThread(); this.highlighter = highlighter; } public boolean isAfterEndOfLine() { return isFlagSet(AFTER_END_OF_LINE_MASK); } @Nullable public TextAttributes getTextAttributes(@Nullable PsiElement element, @Nullable EditorColorsScheme editorColorsScheme) { if (forcedTextAttributes != null) { return forcedTextAttributes; } EditorColorsScheme colorsScheme = getColorsScheme(editorColorsScheme); if (forcedTextAttributesKey != null) { return colorsScheme.getAttributes(forcedTextAttributesKey); } return getAttributesByType(element, type, colorsScheme); } public static TextAttributes getAttributesByType(@Nullable PsiElement element, @NotNull HighlightInfoType type, @NotNull TextAttributesScheme colorsScheme) { SeverityRegistrar severityRegistrar = SeverityRegistrar.getSeverityRegistrar(element != null ? element.getProject() : null); TextAttributes textAttributes = severityRegistrar.getTextAttributesBySeverity(type.getSeverity(element)); if (textAttributes != null) return textAttributes; TextAttributesKey key = type.getAttributesKey(); return colorsScheme.getAttributes(key); } @Nullable @SuppressWarnings("deprecation") Color getErrorStripeMarkColor(@NotNull PsiElement element, @Nullable("when null, a global scheme will be used") EditorColorsScheme colorsScheme) { if (forcedTextAttributes != null) { return forcedTextAttributes.getErrorStripeColor(); } EditorColorsScheme scheme = getColorsScheme(colorsScheme); if (forcedTextAttributesKey != null) { TextAttributes forcedTextAttributes = scheme.getAttributes(forcedTextAttributesKey); if (forcedTextAttributes != null) { Color errorStripeColor = forcedTextAttributes.getErrorStripeColor(); // let's copy above behaviour of forcedTextAttributes stripe color, but I'm not sure the behaviour is correct in general if (errorStripeColor != null) { return errorStripeColor; } } } if (getSeverity() == HighlightSeverity.ERROR) { return scheme.getAttributes(CodeInsightColors.ERRORS_ATTRIBUTES).getErrorStripeColor(); } if (getSeverity() == HighlightSeverity.WARNING) { return scheme.getAttributes(CodeInsightColors.WARNINGS_ATTRIBUTES).getErrorStripeColor(); } if (getSeverity() == HighlightSeverity.INFO){ return scheme.getAttributes(CodeInsightColors.INFO_ATTRIBUTES).getErrorStripeColor(); } if (getSeverity() == HighlightSeverity.WEAK_WARNING){ return scheme.getAttributes(CodeInsightColors.WEAK_WARNING_ATTRIBUTES).getErrorStripeColor(); } if (getSeverity() == HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING) { return scheme.getAttributes(CodeInsightColors.GENERIC_SERVER_ERROR_OR_WARNING).getErrorStripeColor(); } TextAttributes attributes = getAttributesByType(element, type, scheme); return attributes == null ? null : attributes.getErrorStripeColor(); } @NotNull private static EditorColorsScheme getColorsScheme(@Nullable EditorColorsScheme customScheme) { return customScheme != null ? customScheme : EditorColorsManager.getInstance().getGlobalScheme(); } @Nullable private static String htmlEscapeToolTip(@Nullable String unescapedTooltip) { return unescapedTooltip == null ? null : XmlStringUtil.wrapInHtml(XmlStringUtil.escapeString(unescapedTooltip)); } boolean needUpdateOnTyping() { return isFlagSet(NEEDS_UPDATE_ON_TYPING_MASK); } private static boolean calcNeedUpdateOnTyping(@Nullable Boolean needsUpdateOnTyping, HighlightInfoType type) { if (needsUpdateOnTyping != null) { return needsUpdateOnTyping.booleanValue(); } if (type instanceof HighlightInfoType.UpdateOnTypingSuppressible) { return ((HighlightInfoType.UpdateOnTypingSuppressible)type).needsUpdateOnTyping(); } return true; } @Override public boolean equals(Object obj) { if (obj == this) return true; if (!(obj instanceof HighlightInfo)) return false; HighlightInfo info = (HighlightInfo)obj; return info.getSeverity() == getSeverity() && info.startOffset == startOffset && info.endOffset == endOffset && Comparing.equal(info.type, type) && Comparing.equal(info.gutterIconRenderer, gutterIconRenderer) && Comparing.equal(info.forcedTextAttributes, forcedTextAttributes) && Comparing.equal(info.forcedTextAttributesKey, forcedTextAttributesKey) && Comparing.strEqual(info.getDescription(), getDescription()); } protected boolean equalsByActualOffset(@NotNull HighlightInfo info) { if (info == this) return true; return info.getSeverity() == getSeverity() && info.getActualStartOffset() == getActualStartOffset() && info.getActualEndOffset() == getActualEndOffset() && Comparing.equal(info.type, type) && Comparing.equal(info.gutterIconRenderer, gutterIconRenderer) && Comparing.equal(info.forcedTextAttributes, forcedTextAttributes) && Comparing.equal(info.forcedTextAttributesKey, forcedTextAttributesKey) && Comparing.strEqual(info.getDescription(), getDescription()); } @Override public int hashCode() { return startOffset; } @Override public String toString() { String s = "HighlightInfo(" + startOffset + "," + endOffset+")"; if (getActualStartOffset() != startOffset || getActualEndOffset() != endOffset) { s += "; actual: (" + getActualStartOffset() + "," + getActualEndOffset() + ")"; } if (highlighter != null) s += " text='" + getText() + "'"; if (getDescription() != null) s+= ", description='" + getDescription() + "'"; s += " severity=" + getSeverity(); s += " group=" + getGroup(); if (quickFixActionRanges != null) { s+= "; quickFixes: "+quickFixActionRanges; } if (gutterIconRenderer != null) { s += "; gutter: " + gutterIconRenderer; } return s; } @NotNull public static Builder newHighlightInfo(@NotNull HighlightInfoType type) { return new B(type); } void setGroup(int group) { this.group = group; } public interface Builder { // only one 'range' call allowed @NotNull Builder range(@NotNull TextRange textRange); @NotNull Builder range(@NotNull ASTNode node); @NotNull Builder range(@NotNull PsiElement element); @NotNull Builder range(@NotNull PsiElement element, @NotNull TextRange rangeInElement); @NotNull Builder range(@NotNull PsiElement element, int start, int end); @NotNull Builder range(int start, int end); @NotNull Builder gutterIconRenderer(@NotNull GutterIconRenderer gutterIconRenderer); @NotNull Builder problemGroup(@NotNull ProblemGroup problemGroup); @NotNull Builder inspectionToolId(@NotNull String inspectionTool); // only one allowed @NotNull Builder description(@NotNull String description); @NotNull Builder descriptionAndTooltip(@NotNull String description); // only one allowed @NotNull Builder textAttributes(@NotNull TextAttributes attributes); @NotNull Builder textAttributes(@NotNull TextAttributesKey attributesKey); // only one allowed @NotNull Builder unescapedToolTip(@NotNull String unescapedToolTip); @NotNull Builder escapedToolTip(@NotNull String escapedToolTip); @NotNull Builder endOfLine(); @NotNull Builder needsUpdateOnTyping(boolean update); @NotNull Builder severity(@NotNull HighlightSeverity severity); @NotNull Builder fileLevelAnnotation(); @NotNull Builder navigationShift(int navigationShift); @NotNull Builder group(int group); @Nullable("null means filtered out") HighlightInfo create(); @NotNull HighlightInfo createUnconditionally(); } private static boolean isAcceptedByFilters(@NotNull HighlightInfo info, @Nullable PsiElement psiElement) { PsiFile file = psiElement == null ? null : psiElement.getContainingFile(); for (HighlightInfoFilter filter : HighlightInfoFilter.EXTENSION_POINT_NAME.getExtensions()) { if (!filter.accept(info, file)) { return false; } } info.psiElement = psiElement; return true; } private static class B implements Builder { private Boolean myNeedsUpdateOnTyping; private TextAttributes forcedTextAttributes; private TextAttributesKey forcedTextAttributesKey; private final HighlightInfoType type; private int startOffset = -1; private int endOffset = -1; private String escapedDescription; private String escapedToolTip; private HighlightSeverity severity; private boolean isAfterEndOfLine; private boolean isFileLevelAnnotation; private int navigationShift; private GutterIconRenderer gutterIconRenderer; private ProblemGroup problemGroup; private String inspectionToolId; private PsiElement psiElement; private int group; private B(@NotNull HighlightInfoType type) { this.type = type; } @NotNull @Override public Builder gutterIconRenderer(@NotNull GutterIconRenderer gutterIconRenderer) { assert this.gutterIconRenderer == null : "gutterIconRenderer already set"; this.gutterIconRenderer = gutterIconRenderer; return this; } @NotNull @Override public Builder problemGroup(@NotNull ProblemGroup problemGroup) { assert this.problemGroup == null : "problemGroup already set"; this.problemGroup = problemGroup; return this; } @NotNull @Override public Builder inspectionToolId(@NotNull String inspectionToolId) { assert this.inspectionToolId == null : "inspectionToolId already set"; this.inspectionToolId = inspectionToolId; return this; } @NotNull @Override public Builder description(@NotNull String description) { assert escapedDescription == null : "description already set"; escapedDescription = description; return this; } @NotNull @Override public Builder descriptionAndTooltip(@NotNull String description) { return description(description).unescapedToolTip(description); } @NotNull @Override public Builder textAttributes(@NotNull TextAttributes attributes) { assert forcedTextAttributes == null : "textAttributes already set"; forcedTextAttributes = attributes; return this; } @NotNull @Override public Builder textAttributes(@NotNull TextAttributesKey attributesKey) { assert forcedTextAttributesKey == null : "textAttributesKey already set"; forcedTextAttributesKey = attributesKey; return this; } @NotNull @Override public Builder unescapedToolTip(@NotNull String unescapedToolTip) { assert escapedToolTip == null : "Tooltip was already set"; escapedToolTip = htmlEscapeToolTip(unescapedToolTip); return this; } @NotNull @Override public Builder escapedToolTip(@NotNull String escapedToolTip) { assert this.escapedToolTip == null : "Tooltip was already set"; this.escapedToolTip = escapedToolTip; return this; } @NotNull @Override public Builder range(int start, int end) { assert startOffset == -1 && endOffset == -1 : "Offsets already set"; startOffset = start; endOffset = end; return this; } @NotNull @Override public Builder range(@NotNull TextRange textRange) { assert startOffset == -1 && endOffset == -1 : "Offsets already set"; startOffset = textRange.getStartOffset(); endOffset = textRange.getEndOffset(); return this; } @NotNull @Override public Builder range(@NotNull ASTNode node) { return range(node.getPsi()); } @NotNull @Override public Builder range(@NotNull PsiElement element) { assert psiElement == null : " psiElement already set"; psiElement = element; return range(element.getTextRange()); } @NotNull @Override public Builder range(@NotNull PsiElement element, @NotNull TextRange rangeInElement) { TextRange absoluteRange = rangeInElement.shiftRight(element.getTextRange().getStartOffset()); return range(element, absoluteRange.getStartOffset(), absoluteRange.getEndOffset()); } @NotNull @Override public Builder range(@NotNull PsiElement element, int start, int end) { assert psiElement == null : " psiElement already set"; psiElement = element; return range(start, end); } @NotNull @Override public Builder endOfLine() { isAfterEndOfLine = true; return this; } @NotNull @Override public Builder needsUpdateOnTyping(boolean update) { assert myNeedsUpdateOnTyping == null : " needsUpdateOnTyping already set"; myNeedsUpdateOnTyping = update; return this; } @NotNull @Override public Builder severity(@NotNull HighlightSeverity severity) { assert this.severity == null : " severity already set"; this.severity = severity; return this; } @NotNull @Override public Builder fileLevelAnnotation() { isFileLevelAnnotation = true; return this; } @NotNull @Override public Builder navigationShift(int navigationShift) { this.navigationShift = navigationShift; return this; } @NotNull @Override public Builder group(int group) { this.group = group; return this; } @Nullable @Override public HighlightInfo create() { HighlightInfo info = createUnconditionally(); LOG.assertTrue(psiElement != null || severity == HighlightInfoType.SYMBOL_TYPE_SEVERITY || severity == HighlightInfoType.INJECTED_FRAGMENT_SEVERITY || ArrayUtil.find(HighlightSeverity.DEFAULT_SEVERITIES, severity) != -1, "Custom type requires not-null element to detect its text attributes"); if (!isAcceptedByFilters(info, psiElement)) return null; return info; } @NotNull @Override public HighlightInfo createUnconditionally() { if (severity == null) { severity = type.getSeverity(psiElement); } return new HighlightInfo(forcedTextAttributes, forcedTextAttributesKey, type, startOffset, endOffset, escapedDescription, escapedToolTip, severity, isAfterEndOfLine, myNeedsUpdateOnTyping, isFileLevelAnnotation, navigationShift, problemGroup, inspectionToolId, gutterIconRenderer, group); } } public GutterMark getGutterIconRenderer() { return gutterIconRenderer; } @Nullable public ProblemGroup getProblemGroup() { return myProblemGroup; } @NotNull public static HighlightInfo fromAnnotation(@NotNull Annotation annotation) { return fromAnnotation(annotation, false); } @NotNull static HighlightInfo fromAnnotation(@NotNull Annotation annotation, boolean batchMode) { TextAttributes forcedAttributes = annotation.getEnforcedTextAttributes(); TextAttributesKey key = annotation.getTextAttributes(); TextAttributesKey forcedAttributesKey = forcedAttributes == null && key != HighlighterColors.NO_HIGHLIGHTING ? key : null; HighlightInfo info = new HighlightInfo( forcedAttributes, forcedAttributesKey, convertType(annotation), annotation.getStartOffset(), annotation.getEndOffset(), annotation.getMessage(), annotation.getTooltip(), annotation.getSeverity(), annotation.isAfterEndOfLine(), annotation.needsUpdateOnTyping(), annotation.isFileLevelAnnotation(), 0, annotation.getProblemGroup(), null, annotation.getGutterIconRenderer(), Pass.UPDATE_ALL); List<? extends Annotation.QuickFixInfo> fixes = batchMode ? annotation.getBatchFixes() : annotation.getQuickFixes(); if (fixes != null) { for (Annotation.QuickFixInfo quickFixInfo : fixes) { TextRange range = quickFixInfo.textRange; HighlightDisplayKey k = quickFixInfo.key != null ? quickFixInfo.key : HighlightDisplayKey.find(ANNOTATOR_INSPECTION_SHORT_NAME); info.registerFix(quickFixInfo.quickFix, null, HighlightDisplayKey.getDisplayNameByKey(k), range, k); } } return info; } private static final String ANNOTATOR_INSPECTION_SHORT_NAME = "Annotator"; @NotNull private static HighlightInfoType convertType(@NotNull Annotation annotation) { ProblemHighlightType type = annotation.getHighlightType(); HighlightSeverity severity = annotation.getSeverity(); return toHighlightInfoType(type, severity); } @NotNull private static HighlightInfoType toHighlightInfoType(ProblemHighlightType problemHighlightType, @NotNull HighlightSeverity severity) { if (problemHighlightType == ProblemHighlightType.LIKE_UNUSED_SYMBOL) return HighlightInfoType.UNUSED_SYMBOL; if (problemHighlightType == ProblemHighlightType.LIKE_UNKNOWN_SYMBOL) return HighlightInfoType.WRONG_REF; if (problemHighlightType == ProblemHighlightType.LIKE_DEPRECATED) return HighlightInfoType.DEPRECATED; if (problemHighlightType == ProblemHighlightType.LIKE_MARKED_FOR_REMOVAL) return HighlightInfoType.MARKED_FOR_REMOVAL; return convertSeverity(severity); } @NotNull public static HighlightInfoType convertSeverity(@NotNull HighlightSeverity severity) { //noinspection deprecation return severity == HighlightSeverity.ERROR? HighlightInfoType.ERROR : severity == HighlightSeverity.WARNING ? HighlightInfoType.WARNING : severity == HighlightSeverity.INFO ? HighlightInfoType.INFO : severity == HighlightSeverity.WEAK_WARNING ? HighlightInfoType.WEAK_WARNING : severity ==HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING ? HighlightInfoType.GENERIC_WARNINGS_OR_ERRORS_FROM_SERVER : HighlightInfoType.INFORMATION; } @NotNull public static ProblemHighlightType convertType(@NotNull HighlightInfoType infoType) { if (infoType == HighlightInfoType.ERROR || infoType == HighlightInfoType.WRONG_REF) return ProblemHighlightType.ERROR; if (infoType == HighlightInfoType.WARNING) return ProblemHighlightType.WARNING; if (infoType == HighlightInfoType.INFORMATION) return ProblemHighlightType.INFORMATION; return ProblemHighlightType.WEAK_WARNING; } @NotNull public static ProblemHighlightType convertSeverityToProblemHighlight(@NotNull HighlightSeverity severity) { //noinspection deprecation return severity == HighlightSeverity.ERROR ? ProblemHighlightType.ERROR : severity == HighlightSeverity.WARNING ? ProblemHighlightType.WARNING : severity == HighlightSeverity.INFO ? ProblemHighlightType.INFO : severity == HighlightSeverity.WEAK_WARNING ? ProblemHighlightType.WEAK_WARNING : ProblemHighlightType.INFORMATION; } public boolean hasHint() { return isFlagSet(HAS_HINT_MASK); } void setHint(boolean hasHint) { setFlag(HAS_HINT_MASK, hasHint); } public int getActualStartOffset() { RangeHighlighterEx h = highlighter; return h == null || !h.isValid() ? startOffset : h.getStartOffset(); } public int getActualEndOffset() { RangeHighlighterEx h = highlighter; return h == null || !h.isValid() ? endOffset : h.getEndOffset(); } public static class IntentionActionDescriptor { private final IntentionAction myAction; private volatile List<IntentionAction> myOptions; private volatile HighlightDisplayKey myKey; private final ProblemGroup myProblemGroup; private final HighlightSeverity mySeverity; private final String myDisplayName; private final Icon myIcon; private Boolean myCanCleanup; IntentionActionDescriptor(@NotNull IntentionAction action, List<IntentionAction> options, String displayName) { this(action, options, displayName, null); } public IntentionActionDescriptor(@NotNull IntentionAction action, Icon icon) { this(action, null, null, icon); } IntentionActionDescriptor(@NotNull IntentionAction action, @Nullable List<IntentionAction> options, @Nullable String displayName, @Nullable Icon icon) { this(action, options, displayName, icon, null, null, null); } public IntentionActionDescriptor(@NotNull IntentionAction action, @Nullable List<IntentionAction> options, @Nullable String displayName, @Nullable Icon icon, @Nullable HighlightDisplayKey key, @Nullable ProblemGroup problemGroup, @Nullable HighlightSeverity severity) { myAction = action; myOptions = options; myDisplayName = displayName; myIcon = icon; myKey = key; myProblemGroup = problemGroup; mySeverity = severity; } @NotNull public IntentionAction getAction() { return myAction; } boolean isError() { return mySeverity == null || mySeverity.compareTo(HighlightSeverity.ERROR) >= 0; } boolean isInformation() { return HighlightSeverity.INFORMATION.equals(mySeverity); } boolean canCleanup(@NotNull PsiElement element) { if (myCanCleanup == null) { InspectionProfile profile = InspectionProjectProfileManager.getInstance(element.getProject()).getCurrentProfile(); HighlightDisplayKey key = myKey; if (key == null) { myCanCleanup = false; } else { InspectionToolWrapper toolWrapper = profile.getInspectionTool(key.toString(), element); myCanCleanup = toolWrapper != null && toolWrapper.isCleanupTool(); } } return myCanCleanup; } @Nullable public List<IntentionAction> getOptions(@NotNull PsiElement element, @Nullable Editor editor) { if (editor != null && Boolean.FALSE.equals(editor.getUserData(IntentionManager.SHOW_INTENTION_OPTIONS_KEY))) { return null; } List<IntentionAction> options = myOptions; HighlightDisplayKey key = myKey; if (myProblemGroup != null) { String problemName = myProblemGroup.getProblemName(); HighlightDisplayKey problemGroupKey = problemName != null ? HighlightDisplayKey.findById(problemName) : null; if (problemGroupKey != null) { key = problemGroupKey; } } if (options != null || key == null) { return options; } IntentionManager intentionManager = IntentionManager.getInstance(); List<IntentionAction> newOptions = intentionManager.getStandardIntentionOptions(key, element); InspectionProfile profile = InspectionProjectProfileManager.getInstance(element.getProject()).getCurrentProfile(); InspectionToolWrapper toolWrapper = profile.getInspectionTool(key.toString(), element); if (!(toolWrapper instanceof LocalInspectionToolWrapper)) { HighlightDisplayKey idKey = HighlightDisplayKey.findById(key.toString()); if (idKey != null) { toolWrapper = profile.getInspectionTool(idKey.toString(), element); } } if (toolWrapper != null) { myCanCleanup = toolWrapper.isCleanupTool(); IntentionAction fixAllIntention = intentionManager.createFixAllIntention(toolWrapper, myAction); InspectionProfileEntry wrappedTool = toolWrapper instanceof LocalInspectionToolWrapper ? ((LocalInspectionToolWrapper)toolWrapper).getTool() : ((GlobalInspectionToolWrapper)toolWrapper).getTool(); if (wrappedTool instanceof DefaultHighlightVisitorBasedInspection.AnnotatorBasedInspection) { List<IntentionAction> actions = Collections.emptyList(); if (myProblemGroup instanceof SuppressableProblemGroup) { actions = Arrays.asList(((SuppressableProblemGroup)myProblemGroup).getSuppressActions(element)); } if (fixAllIntention != null) { if (actions.isEmpty()) { return Collections.singletonList(fixAllIntention); } else { actions = new ArrayList<>(actions); actions.add(fixAllIntention); } } return actions; } ContainerUtil.addIfNotNull(newOptions, fixAllIntention); if (wrappedTool instanceof CustomSuppressableInspectionTool) { IntentionAction[] suppressActions = ((CustomSuppressableInspectionTool)wrappedTool).getSuppressActions(element); if (suppressActions != null) { ContainerUtil.addAll(newOptions, suppressActions); } } else { SuppressQuickFix[] suppressFixes = wrappedTool.getBatchSuppressActions(element); if (suppressFixes.length > 0) { newOptions.addAll(ContainerUtil.map(suppressFixes, SuppressIntentionActionFromFix::convertBatchToSuppressIntentionAction)); } } } if (myProblemGroup instanceof SuppressableProblemGroup) { IntentionAction[] suppressActions = ((SuppressableProblemGroup)myProblemGroup).getSuppressActions(element); ContainerUtil.addAll(newOptions, suppressActions); } //noinspection SynchronizeOnThis synchronized (this) { options = myOptions; if (options == null) { myOptions = options = newOptions; } myKey = null; } return options; } @Nullable public String getDisplayName() { return myDisplayName; } @Override public String toString() { String text = getAction().getText(); return "descriptor: " + (text.isEmpty() ? getAction().getClass() : text); } @Nullable public Icon getIcon() { return myIcon; } @Override public boolean equals(Object obj) { return obj instanceof IntentionActionDescriptor && myAction.equals(((IntentionActionDescriptor)obj).myAction); } } @Override public int getStartOffset() { return getActualStartOffset(); } @Override public int getEndOffset() { return getActualEndOffset(); } int getGroup() { return group; } boolean isFromInjection() { return isFlagSet(FROM_INJECTION_MASK); } @NotNull public String getText() { if (isFileLevelAnnotation()) return ""; RangeHighlighterEx highlighter = this.highlighter; if (highlighter == null) { throw new RuntimeException("info not applied yet"); } if (!highlighter.isValid()) return ""; return highlighter.getDocument().getText(TextRange.create(highlighter)); } public void registerFix(@Nullable IntentionAction action, @Nullable List<IntentionAction> options, @Nullable String displayName, @Nullable TextRange fixRange, @Nullable HighlightDisplayKey key) { if (action == null) return; if (fixRange == null) fixRange = new TextRange(startOffset, endOffset); if (quickFixActionRanges == null) { quickFixActionRanges = ContainerUtil.createLockFreeCopyOnWriteList(); } IntentionActionDescriptor desc = new IntentionActionDescriptor(action, options, displayName, null, key, getProblemGroup(), getSeverity()); quickFixActionRanges.add(Pair.create(desc, fixRange)); fixStartOffset = Math.min (fixStartOffset, fixRange.getStartOffset()); fixEndOffset = Math.max (fixEndOffset, fixRange.getEndOffset()); if (action instanceof HintAction) { setHint(true); } } public void unregisterQuickFix(@NotNull Condition<? super IntentionAction> condition) { if (quickFixActionRanges != null) { quickFixActionRanges.removeIf(pair -> condition.value(pair.first.getAction())); } } }
leafclick/intellij-community
platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java
Java
apache-2.0
36,999
/* * Copyright 2011 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.google.sampling.experiential.android.lib; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpGet; import org.apache.http.cookie.Cookie; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.cookie.BasicClientCookie; import android.accounts.Account; import android.accounts.AccountManager; import android.accounts.AccountManagerFuture; import android.accounts.AuthenticatorException; import android.accounts.OperationCanceledException; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Bundle; import android.util.Log; /** * Class that manages authorizing user against a Google.com account, and then * authorizing them against the Paco AppEngine app. * * */ public class GoogleAccountLoginHelper { public static final String AUTH_TOKEN_PREFERENCE = "PREFS_AUTH"; public static final String AUTH_TOKEN_PREFERENCE_NAME_KEY = "name"; public static final String AUTH_TOKEN_PREFERENCE_EXPIRE_KEY = "expiration"; /** Which hosted domain the server will accept logins for */ private static final String HOSTED_DOMAIN = "google.com"; private static String DESIRED_SUFFIX = "@" + HOSTED_DOMAIN; /** Account type when querying AccountManager for google accounts */ private static final String GOOGLE_ACCOUNT_TYPE = "com.google"; /** Service to use when requesting a token for GAE */ private static final String GAE_SERVICE = "ah"; private static final String PACO_SERVER_URL = "https://pacoexample.appspot.com/"; private Activity context; private SharedPreferences authTokenPreferences; /** * Create an instance. * * @param context Context that has access to Authentication Shared Preferences. */ public GoogleAccountLoginHelper(Activity context) { this.context = context; authTokenPreferences = this.context.getSharedPreferences(AUTH_TOKEN_PREFERENCE, Context.MODE_PRIVATE); } /** * @return */ public synchronized boolean isAuthorized() { return isPacoAuthCookieSetAndValid() /*|| authorize()*/; } /** * Validates Paco AppEngine server cookie. * * @return whether or not the Paco Appengine server cookie exists and is valid. */ private boolean isPacoAuthCookieSetAndValid() { String key = authTokenPreferences.getString(AUTH_TOKEN_PREFERENCE_NAME_KEY, null); String expiry = authTokenPreferences.getString(AUTH_TOKEN_PREFERENCE_EXPIRE_KEY, null); return isPacoAuthCookieSetAndValid(key, expiry); } private boolean isPacoAuthCookieSetAndValid(String key, String expiry) { if (key == null || expiry == null) { return false; } try { Date expirationDate = new SimpleDateFormat(Constants.DATE_TIME_FORMAT).parse(expiry); return expirationDate.after(new Date()); } catch (ParseException e) { return false; } } /** * Retrieve the stored Paco appengine server login cookie. * * @return Cookie */ public synchronized Cookie retrievePacoAuthCookie() { String name = authTokenPreferences.getString(AUTH_TOKEN_PREFERENCE_NAME_KEY, null); String expiry = authTokenPreferences.getString(AUTH_TOKEN_PREFERENCE_EXPIRE_KEY, null); if (!isPacoAuthCookieSetAndValid(name, expiry)) { throw new IllegalStateException("Invalid Auth Cookie! Send back to login!"); } try { Date expirationDate = new SimpleDateFormat(Constants.DATE_TIME_FORMAT).parse(expiry); return new MyCookie(name, authTokenPreferences.getString("value", ""), expirationDate, authTokenPreferences.getString("domain", "google.com"), authTokenPreferences.getString("path", "/"), authTokenPreferences.getInt("version", 0)); } catch (ParseException e) { // this should never happen. throw new IllegalStateException("Unparseable date in Auth Cookie! Send back to login!"); } } /** * Authorize against a Google.com account in order to login to the paco server which * is protected by a google.com login at the moment. * * @return boolean whether authorization succeeded. * @throws OperationCanceledException * @throws AuthenticatorException * @throws IOException */ public synchronized boolean authorize() { AccountManager accountManager = AccountManager.get(context); Account account = getGoogleAccount(accountManager, DESIRED_SUFFIX); if (account == null) { Log.d(Constants.TAG, "No Google.com account in accounts list."); return false; } // String authToken = accountManager.blockingGetAuthToken(account, // GAE_SERVICE, false); try { String googleAuthToken = getGoogleAuthToken(accountManager, account); if (googleAuthToken == null) { return false; } return loginToPacoService(googleAuthToken); } catch (OperationCanceledException e) { Log.d(Constants.TAG, "Exception getting GoogleAuthToken. ", e); } catch (AuthenticatorException e) { Log.d(Constants.TAG, "Exception getting GoogleAuthToken. ", e); } catch (IOException e) { Log.d(Constants.TAG, "Exception getting GoogleAuthToken. ", e); } return false; } private boolean loginToPacoService(String authToken) { HttpGet httpget = new HttpGet(PACO_SERVER_URL + "_ah/login?auth=" + authToken + "&continue=" + PACO_SERVER_URL); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpResponse response; try { response = httpclient.execute(httpget); Log.i(Constants.TAG, "Appspot.com Login Response: " + response.getStatusLine()); // TODO (bobevans): Deal with other responses (redirect, fail, captcha, etc.) List<Cookie> cookies = httpclient.getCookieStore().getCookies(); if (cookies.size() == 0) { Log.d(Constants.TAG, "No cookies in httpclient!"); return false; } storePacoAuthCookie(cookies.get(0)); return true; } catch (ClientProtocolException e1) { Log.e(Constants.TAG, "in service login", e1); } catch (IOException e1) { Log.e(Constants.TAG, "in service login", e1); } return false; } /** * Store a new Paco AppEngine server cookie. * This will only be used publicly when the other communications with the Paco server send us * back a new cookie instead of the existing cookie. * * @param authCookie Cookie from logging into Paco AppEngine instance. */ public synchronized void storePacoAuthCookie(Cookie authCookie) { Editor editor = authTokenPreferences.edit(); editor.putString("comment", authCookie.getComment()); editor.putString("commentURL", authCookie.getCommentURL()); editor.putString("domain", authCookie.getDomain()); editor.putString("name", authCookie.getName()); editor.putString("path", authCookie.getPath()); editor.putString("value", authCookie.getValue()); SimpleDateFormat df = new SimpleDateFormat(Constants.DATE_TIME_FORMAT); editor.putString("expiration", df.format(authCookie.getExpiryDate())); if (authCookie.getPorts() != null) { editor.putString("ports",stringify(authCookie.getPorts())); } editor.putInt("version", authCookie.getVersion()); editor.commit(); } private String getGoogleAuthToken(AccountManager accountManager, Account account) throws OperationCanceledException, IOException, AuthenticatorException { String authToken = getNewAuthToken(accountManager, account); accountManager.invalidateAuthToken("ah", authToken); // There is a bug. Workaround: invalidate the old token, then re-retrieve. authToken = getNewAuthToken(accountManager, account); return authToken; } private String getNewAuthToken(AccountManager accountManager, Account account) throws OperationCanceledException, IOException, AuthenticatorException { AccountManagerFuture<Bundle> accountManagerFuture = accountManager.getAuthToken(account, "ah", null, context, null, null); Bundle authTokenBundle = accountManagerFuture.getResult(); return authTokenBundle.get(AccountManager.KEY_AUTHTOKEN).toString(); } private Account getGoogleAccount(AccountManager accountManager, String desiredSuffix) { for (Account account : accountManager.getAccountsByType(GOOGLE_ACCOUNT_TYPE)) { if (account.name.endsWith(desiredSuffix)) { return account; } } return null; } /** * Creates a GoogleAccountLoginHelper that will return authorization in a state you like. * * @param context * @param authorized * @return */ public static GoogleAccountLoginHelper createMockLoginHelper(final Activity context, final boolean authorized) { return new GoogleAccountLoginHelper(context) { @Override public synchronized boolean isAuthorized() { return authorized; } }; } private static String stringify(int[] ports) { StringBuilder portStr = new StringBuilder(); boolean first = true; for (int i = 0; i < ports.length; i++) { if (first) { first = false; } else { portStr.append(","); } portStr.append(ports[i]); } return portStr.toString(); } /** * We cannot set properties on the BasicClientCookie from Apache httpclient. * This class allows us to access those private methods to recreate our stored cookie. * * */ public static class MyCookie extends BasicClientCookie { public MyCookie(String name, String value, Date expirationDate, String domain, String path, int version) { super(name, value); setExpiryDate(expirationDate); setDomain(domain); setPath(path); setVersion(version); } } }
BobEvans/omgpaco
PacoAndroidLib/src/com/google/sampling/experiential/android/lib/GoogleAccountLoginHelper.java
Java
apache-2.0
10,618
package com.honghei.gank.api; import com.honghei.gank.bean.zhihunews.NewsDetailBean; import com.honghei.gank.bean.zhihunews.ZhihuNewsBefore; import com.honghei.gank.bean.zhihunews.ZhihuNewsLatest; import retrofit2.http.GET; import retrofit2.http.Path; import rx.Observable; /** * Created by Honghei on 2017/3/7. * get Zhihu with retrofit */ public interface ZhihuApi { @GET("news/latest") Observable<ZhihuNewsLatest> getLatestNews(); @GET("news/before/{time}") Observable<ZhihuNewsBefore> getBeforetNews(@Path("time") String time); @GET("news/{id}") Observable<NewsDetailBean> getDetailNews(@Path("id") String id); }
Honghei/gank
app/src/main/java/com/honghei/gank/api/ZhihuApi.java
Java
apache-2.0
650
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hdfs; import java.io.File; import java.io.IOException; import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.Collection; import java.nio.channels.FileChannel; import java.util.Random; import java.io.RandomAccessFile; import javax.security.auth.login.LoginException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.net.*; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.FSConstants.DatanodeReportType; import org.apache.hadoop.hdfs.server.common.HdfsConstants.StartupOption; import org.apache.hadoop.hdfs.server.datanode.DataNode; import org.apache.hadoop.hdfs.server.datanode.FSDatasetInterface; import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset; import org.apache.hadoop.hdfs.server.namenode.FSNamesystem; import org.apache.hadoop.hdfs.server.namenode.NameNode; import org.apache.hadoop.hdfs.tools.DFSAdmin; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.security.*; import org.apache.hadoop.util.ToolRunner; /** * This class creates a single-process DFS cluster for junit testing. * The data directories for non-simulated DFS are under the testing directory. * For simulated data nodes, no underlying fs storage is used. */ public class MiniDFSCluster { public class DataNodeProperties { DataNode datanode; Configuration conf; String[] dnArgs; DataNodeProperties(DataNode node, Configuration conf, String[] args) { this.datanode = node; this.conf = conf; this.dnArgs = args; } } private Configuration conf; private NameNode nameNode; private int numDataNodes; private ArrayList<DataNodeProperties> dataNodes = new ArrayList<DataNodeProperties>(); private File base_dir; private File data_dir; /** * This null constructor is used only when wishing to start a data node cluster * without a name node (ie when the name node is started elsewhere). */ public MiniDFSCluster() { } /** * Modify the config and start up the servers with the given operation. * Servers will be started on free ports. * <p> * The caller must manage the creation of NameNode and DataNode directories * and have already set dfs.name.dir and dfs.data.dir in the given conf. * * @param conf the base configuration to use in starting the servers. This * will be modified as necessary. * @param numDataNodes Number of DataNodes to start; may be zero * @param nameNodeOperation the operation with which to start the servers. If null * or StartupOption.FORMAT, then StartupOption.REGULAR will be used. */ public MiniDFSCluster(Configuration conf, int numDataNodes, StartupOption nameNodeOperation) throws IOException { this(0, conf, numDataNodes, false, false, false, nameNodeOperation, null, null, null); } /** * Modify the config and start up the servers. The rpc and info ports for * servers are guaranteed to use free ports. * <p> * NameNode and DataNode directory creation and configuration will be * managed by this class. * * @param conf the base configuration to use in starting the servers. This * will be modified as necessary. * @param numDataNodes Number of DataNodes to start; may be zero * @param format if true, format the NameNode and DataNodes before starting up * @param racks array of strings indicating the rack that each DataNode is on */ public MiniDFSCluster(Configuration conf, int numDataNodes, boolean format, String[] racks) throws IOException { this(0, conf, numDataNodes, format, true, true, null, racks, null, null); } /** * Modify the config and start up the servers. The rpc and info ports for * servers are guaranteed to use free ports. * <p> * NameNode and DataNode directory creation and configuration will be * managed by this class. * * @param conf the base configuration to use in starting the servers. This * will be modified as necessary. * @param numDataNodes Number of DataNodes to start; may be zero * @param format if true, format the NameNode and DataNodes before starting up * @param racks array of strings indicating the rack that each DataNode is on * @param hosts array of strings indicating the hostname for each DataNode */ public MiniDFSCluster(Configuration conf, int numDataNodes, boolean format, String[] racks, String[] hosts) throws IOException { this(0, conf, numDataNodes, format, true, true, null, racks, hosts, null); } /** * NOTE: if possible, the other constructors that don't have nameNode port * parameter should be used as they will ensure that the servers use free ports. * <p> * Modify the config and start up the servers. * * @param nameNodePort suggestion for which rpc port to use. caller should * use getNameNodePort() to get the actual port used. * @param conf the base configuration to use in starting the servers. This * will be modified as necessary. * @param numDataNodes Number of DataNodes to start; may be zero * @param format if true, format the NameNode and DataNodes before starting up * @param manageDfsDirs if true, the data directories for servers will be * created and dfs.name.dir and dfs.data.dir will be set in the conf * @param operation the operation with which to start the servers. If null * or StartupOption.FORMAT, then StartupOption.REGULAR will be used. * @param racks array of strings indicating the rack that each DataNode is on */ public MiniDFSCluster(int nameNodePort, Configuration conf, int numDataNodes, boolean format, boolean manageDfsDirs, StartupOption operation, String[] racks) throws IOException { this(nameNodePort, conf, numDataNodes, format, manageDfsDirs, manageDfsDirs, operation, racks, null, null); } /** * NOTE: if possible, the other constructors that don't have nameNode port * parameter should be used as they will ensure that the servers use free ports. * <p> * Modify the config and start up the servers. * * @param nameNodePort suggestion for which rpc port to use. caller should * use getNameNodePort() to get the actual port used. * @param conf the base configuration to use in starting the servers. This * will be modified as necessary. * @param numDataNodes Number of DataNodes to start; may be zero * @param format if true, format the NameNode and DataNodes before starting up * @param manageDfsDirs if true, the data directories for servers will be * created and dfs.name.dir and dfs.data.dir will be set in the conf * @param operation the operation with which to start the servers. If null * or StartupOption.FORMAT, then StartupOption.REGULAR will be used. * @param racks array of strings indicating the rack that each DataNode is on * @param simulatedCapacities array of capacities of the simulated data nodes */ public MiniDFSCluster(int nameNodePort, Configuration conf, int numDataNodes, boolean format, boolean manageDfsDirs, StartupOption operation, String[] racks, long[] simulatedCapacities) throws IOException { this(nameNodePort, conf, numDataNodes, format, manageDfsDirs, manageDfsDirs, operation, racks, null, simulatedCapacities); } /** * NOTE: if possible, the other constructors that don't have nameNode port * parameter should be used as they will ensure that the servers use free ports. * <p> * Modify the config and start up the servers. * * @param nameNodePort suggestion for which rpc port to use. caller should * use getNameNodePort() to get the actual port used. * @param conf the base configuration to use in starting the servers. This * will be modified as necessary. * @param numDataNodes Number of DataNodes to start; may be zero * @param format if true, format the NameNode and DataNodes before starting up * @param manageNameDfsDirs if true, the data directories for servers will be * created and dfs.name.dir and dfs.data.dir will be set in the conf * @param manageDataDfsDirs if true, the data directories for datanodes will * be created and dfs.data.dir set to same in the conf * @param operation the operation with which to start the servers. If null * or StartupOption.FORMAT, then StartupOption.REGULAR will be used. * @param racks array of strings indicating the rack that each DataNode is on * @param hosts array of strings indicating the hostnames of each DataNode * @param simulatedCapacities array of capacities of the simulated data nodes */ public MiniDFSCluster(int nameNodePort, Configuration conf, int numDataNodes, boolean format, boolean manageNameDfsDirs, boolean manageDataDfsDirs, StartupOption operation, String[] racks, String hosts[], long[] simulatedCapacities) throws IOException { this.conf = conf; try { UserGroupInformation.setCurrentUser(UnixUserGroupInformation.login(conf)); } catch (LoginException e) { IOException ioe = new IOException(); ioe.initCause(e); throw ioe; } base_dir = getBaseDir(); data_dir = new File(base_dir, "data"); // Setup the NameNode configuration FileSystem.setDefaultUri(conf, "hdfs://localhost:"+ Integer.toString(nameNodePort)); conf.set("dfs.http.address", "127.0.0.1:0"); if (manageNameDfsDirs) { conf.set("dfs.name.dir", new File(base_dir, "name1").getPath()+","+ new File(base_dir, "name2").getPath()); conf.set("fs.checkpoint.dir", new File(base_dir, "namesecondary1"). getPath()+"," + new File(base_dir, "namesecondary2").getPath()); } int replication = conf.getInt("dfs.replication", 3); conf.setInt("dfs.replication", Math.min(replication, numDataNodes)); conf.setInt("dfs.safemode.extension", 0); conf.setInt("dfs.namenode.decommission.interval", 3); // 3 second // Set a small delay on blockReceived in the minicluster to approximate // a real cluster a little better and suss out bugs. conf.setInt("dfs.datanode.artificialBlockReceivedDelay", 5); // Format and clean out DataNode directories if (format) { if (data_dir.exists() && !FileUtil.fullyDelete(data_dir)) { throw new IOException("Cannot remove data directory: " + data_dir); } NameNode.format(conf); } // Start the NameNode String[] args = (operation == null || operation == StartupOption.FORMAT || operation == StartupOption.REGULAR) ? new String[] {} : new String[] {operation.getName()}; conf.setClass("topology.node.switch.mapping.impl", StaticMapping.class, DNSToSwitchMapping.class); nameNode = NameNode.createNameNode(args, conf); // Start the DataNodes startDataNodes(conf, numDataNodes, manageDataDfsDirs, operation, racks, hosts, simulatedCapacities); waitClusterUp(); } /** * wait for the cluster to get out of * safemode. */ public void waitClusterUp() { if (numDataNodes > 0) { while (!isClusterUp()) { try { System.err.println("Waiting for the Mini HDFS Cluster to start..."); Thread.sleep(1000); } catch (InterruptedException e) { } } } } /** * Modify the config and start up additional DataNodes. The info port for * DataNodes is guaranteed to use a free port. * * Data nodes can run with the name node in the mini cluster or * a real name node. For example, running with a real name node is useful * when running simulated data nodes with a real name node. * If minicluster's name node is null assume that the conf has been * set with the right address:port of the name node. * * @param conf the base configuration to use in starting the DataNodes. This * will be modified as necessary. * @param numDataNodes Number of DataNodes to start; may be zero * @param manageDfsDirs if true, the data directories for DataNodes will be * created and dfs.data.dir will be set in the conf * @param operation the operation with which to start the DataNodes. If null * or StartupOption.FORMAT, then StartupOption.REGULAR will be used. * @param racks array of strings indicating the rack that each DataNode is on * @param hosts array of strings indicating the hostnames for each DataNode * @param simulatedCapacities array of capacities of the simulated data nodes * * @throws IllegalStateException if NameNode has been shutdown */ public synchronized void startDataNodes(Configuration conf, int numDataNodes, boolean manageDfsDirs, StartupOption operation, String[] racks, String[] hosts, long[] simulatedCapacities) throws IOException { int curDatanodesNum = dataNodes.size(); // for mincluster's the default initialDelay for BRs is 0 if (conf.get("dfs.blockreport.initialDelay") == null) { conf.setLong("dfs.blockreport.initialDelay", 0); } // If minicluster's name node is null assume that the conf has been // set with the right address:port of the name node. // if (nameNode != null) { // set conf from the name node InetSocketAddress nnAddr = nameNode.getNameNodeAddress(); int nameNodePort = nnAddr.getPort(); FileSystem.setDefaultUri(conf, "hdfs://"+ nnAddr.getHostName() + ":" + Integer.toString(nameNodePort)); } if (racks != null && numDataNodes > racks.length ) { throw new IllegalArgumentException( "The length of racks [" + racks.length + "] is less than the number of datanodes [" + numDataNodes + "]."); } if (hosts != null && numDataNodes > hosts.length ) { throw new IllegalArgumentException( "The length of hosts [" + hosts.length + "] is less than the number of datanodes [" + numDataNodes + "]."); } //Generate some hostnames if required if (racks != null && hosts == null) { System.out.println("Generating host names for datanodes"); hosts = new String[numDataNodes]; for (int i = curDatanodesNum; i < curDatanodesNum + numDataNodes; i++) { hosts[i - curDatanodesNum] = "host" + i + ".foo.com"; } } if (simulatedCapacities != null && numDataNodes > simulatedCapacities.length) { throw new IllegalArgumentException( "The length of simulatedCapacities [" + simulatedCapacities.length + "] is less than the number of datanodes [" + numDataNodes + "]."); } // Set up the right ports for the datanodes conf.set("dfs.datanode.address", "127.0.0.1:0"); conf.set("dfs.datanode.http.address", "127.0.0.1:0"); conf.set("dfs.datanode.ipc.address", "127.0.0.1:0"); String [] dnArgs = (operation == null || operation != StartupOption.ROLLBACK) ? null : new String[] {operation.getName()}; for (int i = curDatanodesNum; i < curDatanodesNum+numDataNodes; i++) { Configuration dnConf = new Configuration(conf); if (manageDfsDirs) { File dir1 = new File(data_dir, "data"+(2*i+1)); File dir2 = new File(data_dir, "data"+(2*i+2)); dir1.mkdirs(); dir2.mkdirs(); if (!dir1.isDirectory() || !dir2.isDirectory()) { throw new IOException("Mkdirs failed to create directory for DataNode " + i + ": " + dir1 + " or " + dir2); } dnConf.set("dfs.data.dir", dir1.getPath() + "," + dir2.getPath()); } if (simulatedCapacities != null) { dnConf.setBoolean("dfs.datanode.simulateddatastorage", true); dnConf.setLong(SimulatedFSDataset.CONFIG_PROPERTY_CAPACITY, simulatedCapacities[i-curDatanodesNum]); } System.out.println("Starting DataNode " + i + " with dfs.data.dir: " + dnConf.get("dfs.data.dir")); if (hosts != null) { dnConf.set("slave.host.name", hosts[i - curDatanodesNum]); System.out.println("Starting DataNode " + i + " with hostname set to: " + dnConf.get("slave.host.name")); } if (racks != null) { String name = hosts[i - curDatanodesNum]; System.out.println("Adding node with hostname : " + name + " to rack "+ racks[i-curDatanodesNum]); StaticMapping.addNodeToRack(name, racks[i-curDatanodesNum]); } Configuration newconf = new Configuration(dnConf); // save config if (hosts != null) { NetUtils.addStaticResolution(hosts[i - curDatanodesNum], "localhost"); } DataNode dn = DataNode.instantiateDataNode(dnArgs, dnConf); //since the HDFS does things based on IP:port, we need to add the mapping //for IP:port to rackId String ipAddr = dn.getSelfAddr().getAddress().getHostAddress(); if (racks != null) { int port = dn.getSelfAddr().getPort(); System.out.println("Adding node with IP:port : " + ipAddr + ":" + port+ " to rack " + racks[i-curDatanodesNum]); StaticMapping.addNodeToRack(ipAddr + ":" + port, racks[i-curDatanodesNum]); } DataNode.runDatanodeDaemon(dn); dataNodes.add(new DataNodeProperties(dn, newconf, dnArgs)); } curDatanodesNum += numDataNodes; this.numDataNodes += numDataNodes; waitActive(); } /** * Modify the config and start up the DataNodes. The info port for * DataNodes is guaranteed to use a free port. * * @param conf the base configuration to use in starting the DataNodes. This * will be modified as necessary. * @param numDataNodes Number of DataNodes to start; may be zero * @param manageDfsDirs if true, the data directories for DataNodes will be * created and dfs.data.dir will be set in the conf * @param operation the operation with which to start the DataNodes. If null * or StartupOption.FORMAT, then StartupOption.REGULAR will be used. * @param racks array of strings indicating the rack that each DataNode is on * * @throws IllegalStateException if NameNode has been shutdown */ public void startDataNodes(Configuration conf, int numDataNodes, boolean manageDfsDirs, StartupOption operation, String[] racks ) throws IOException { startDataNodes( conf, numDataNodes, manageDfsDirs, operation, racks, null, null); } /** * Modify the config and start up additional DataNodes. The info port for * DataNodes is guaranteed to use a free port. * * Data nodes can run with the name node in the mini cluster or * a real name node. For example, running with a real name node is useful * when running simulated data nodes with a real name node. * If minicluster's name node is null assume that the conf has been * set with the right address:port of the name node. * * @param conf the base configuration to use in starting the DataNodes. This * will be modified as necessary. * @param numDataNodes Number of DataNodes to start; may be zero * @param manageDfsDirs if true, the data directories for DataNodes will be * created and dfs.data.dir will be set in the conf * @param operation the operation with which to start the DataNodes. If null * or StartupOption.FORMAT, then StartupOption.REGULAR will be used. * @param racks array of strings indicating the rack that each DataNode is on * @param simulatedCapacities array of capacities of the simulated data nodes * * @throws IllegalStateException if NameNode has been shutdown */ public void startDataNodes(Configuration conf, int numDataNodes, boolean manageDfsDirs, StartupOption operation, String[] racks, long[] simulatedCapacities) throws IOException { startDataNodes(conf, numDataNodes, manageDfsDirs, operation, racks, null, simulatedCapacities); } /** * If the NameNode is running, attempt to finalize a previous upgrade. * When this method return, the NameNode should be finalized, but * DataNodes may not be since that occurs asynchronously. * * @throws IllegalStateException if the Namenode is not running. */ public void finalizeCluster(Configuration conf) throws Exception { if (nameNode == null) { throw new IllegalStateException("Attempting to finalize " + "Namenode but it is not running"); } ToolRunner.run(new DFSAdmin(conf), new String[] {"-finalizeUpgrade"}); } /** * Gets the started NameNode. May be null. */ public NameNode getNameNode() { return nameNode; } /** * Gets a list of the started DataNodes. May be empty. */ public ArrayList<DataNode> getDataNodes() { ArrayList<DataNode> list = new ArrayList<DataNode>(); for (int i = 0; i < dataNodes.size(); i++) { DataNode node = dataNodes.get(i).datanode; list.add(node); } return list; } /** @return the datanode having the ipc server listen port */ public DataNode getDataNode(int ipcPort) { for(DataNode dn : getDataNodes()) { if (dn.ipcServer.getListenerAddress().getPort() == ipcPort) { return dn; } } return null; } /** * Gets the rpc port used by the NameNode, because the caller * supplied port is not necessarily the actual port used. */ public int getNameNodePort() { return nameNode.getNameNodeAddress().getPort(); } /** * Shut down the servers that are up. */ public void shutdown() { System.out.println("Shutting down the Mini HDFS Cluster"); shutdownDataNodes(); if (nameNode != null) { nameNode.stop(); nameNode.join(); nameNode = null; } } /** * Shutdown all DataNodes started by this class. The NameNode * is left running so that new DataNodes may be started. */ public void shutdownDataNodes() { for (int i = dataNodes.size()-1; i >= 0; i--) { System.out.println("Shutting down DataNode " + i); DataNode dn = dataNodes.remove(i).datanode; dn.shutdown(); numDataNodes--; } } /* * Corrupt a block on all datanode */ void corruptBlockOnDataNodes(String blockName) throws Exception{ for (int i=0; i < dataNodes.size(); i++) corruptBlockOnDataNode(i,blockName); } /* * Corrupt a block on a particular datanode */ boolean corruptBlockOnDataNode(int i, String blockName) throws Exception { Random random = new Random(); boolean corrupted = false; File dataDir = new File(System.getProperty("test.build.data", "build/test/data"), "dfs/data"); if (i < 0 || i >= dataNodes.size()) return false; for (int dn = i*2; dn < i*2+2; dn++) { File blockFile = new File(dataDir, "data" + (dn+1) + "/current/" + blockName); System.out.println("Corrupting for: " + blockFile); if (blockFile.exists()) { // Corrupt replica by writing random bytes into replica RandomAccessFile raFile = new RandomAccessFile(blockFile, "rw"); FileChannel channel = raFile.getChannel(); String badString = "BADBAD"; int rand = random.nextInt((int)channel.size()/2); raFile.seek(rand); raFile.write(badString.getBytes()); raFile.close(); } corrupted = true; } return corrupted; } /* * Shutdown a particular datanode */ public DataNodeProperties stopDataNode(int i) { if (i < 0 || i >= dataNodes.size()) { return null; } DataNodeProperties dnprop = dataNodes.remove(i); DataNode dn = dnprop.datanode; System.out.println("MiniDFSCluster Stopping DataNode " + dn.dnRegistration.getName() + " from a total of " + (dataNodes.size() + 1) + " datanodes."); dn.shutdown(); numDataNodes--; return dnprop; } /** * Restart a datanode * @param dnprop datanode's property * @return true if restarting is successful * @throws IOException */ public synchronized boolean restartDataNode(DataNodeProperties dnprop) throws IOException { Configuration conf = dnprop.conf; String[] args = dnprop.dnArgs; Configuration newconf = new Configuration(conf); // save cloned config dataNodes.add(new DataNodeProperties( DataNode.createDataNode(args, conf), newconf, args)); numDataNodes++; return true; } /* * Restart a particular datanode */ public synchronized boolean restartDataNode(int i) throws IOException { DataNodeProperties dnprop = stopDataNode(i); if (dnprop == null) { return false; } else { return restartDataNode(dnprop); } } /* * Restart all datanodes */ public synchronized boolean restartDataNodes() throws IOException { for (int i = dataNodes.size()-1; i >= 0; i--) { System.out.println("Restarting DataNode " + i); if (!restartDataNode(i)) return false; } return true; } /* * Shutdown a datanode by name. */ public synchronized DataNodeProperties stopDataNode(String name) { int i; for (i = 0; i < dataNodes.size(); i++) { DataNode dn = dataNodes.get(i).datanode; if (dn.dnRegistration.getName().equals(name)) { break; } } return stopDataNode(i); } /** * Returns true if the NameNode is running and is out of Safe Mode. */ public boolean isClusterUp() { if (nameNode == null) { return false; } long[] sizes = nameNode.getStats(); boolean isUp = false; synchronized (this) { isUp = (!nameNode.isInSafeMode() && sizes[0] != 0); } return isUp; } /** * Returns true if there is at least one DataNode running. */ public boolean isDataNodeUp() { if (dataNodes == null || dataNodes.size() == 0) { return false; } return true; } /** * Get a client handle to the DFS cluster. */ public FileSystem getFileSystem() throws IOException { return FileSystem.get(conf); } /** * Get the directories where the namenode stores its image. */ public Collection<File> getNameDirs() { return FSNamesystem.getNamespaceDirs(conf); } /** * Get the directories where the namenode stores its edits. */ public Collection<File> getNameEditsDirs() { return FSNamesystem.getNamespaceEditsDirs(conf); } /** * Wait until the cluster is active and running. */ public void waitActive() throws IOException { waitActive(true); } /** * Wait until the cluster is active. * @param waitHeartbeats if true, will wait until all DNs have heartbeat */ public void waitActive(boolean waitHeartbeats) throws IOException { if (nameNode == null) { return; } InetSocketAddress addr = new InetSocketAddress("localhost", getNameNodePort()); DFSClient client = new DFSClient(addr, conf); // make sure all datanodes are alive and sent heartbeat while (shouldWait(client.datanodeReport(DatanodeReportType.LIVE), waitHeartbeats)) { try { Thread.sleep(100); } catch (InterruptedException e) { } } client.close(); } private synchronized boolean shouldWait(DatanodeInfo[] dnInfo, boolean waitHeartbeats) { if (dnInfo.length != numDataNodes) { return true; } // If we don't need heartbeats, we're done. if (!waitHeartbeats) { return false; } // make sure all datanodes have sent first heartbeat to namenode, // using (capacity == 0) as proxy. for (DatanodeInfo dn : dnInfo) { if (dn.getCapacity() == 0) { return true; } } return false; } /** * Wait for the given datanode to heartbeat once. */ public void waitForDNHeartbeat(int dnIndex, long timeoutMillis) throws IOException, InterruptedException { DataNode dn = getDataNodes().get(dnIndex); InetSocketAddress addr = new InetSocketAddress("localhost", getNameNodePort()); DFSClient client = new DFSClient(addr, conf); long startTime = System.currentTimeMillis(); while (System.currentTimeMillis() < startTime + timeoutMillis) { DatanodeInfo report[] = client.datanodeReport(DatanodeReportType.LIVE); for (DatanodeInfo thisReport : report) { if (thisReport.getStorageID().equals( dn.dnRegistration.getStorageID())) { if (thisReport.getLastUpdate() > startTime) return; } } Thread.sleep(500); } } public void formatDataNodeDirs() throws IOException { base_dir = new File(System.getProperty("test.build.data", "build/test/data"), "dfs/"); data_dir = new File(base_dir, "data"); if (data_dir.exists() && !FileUtil.fullyDelete(data_dir)) { throw new IOException("Cannot remove data directory: " + data_dir); } } /** * * @param dataNodeIndex - data node whose block report is desired - the index is same as for getDataNodes() * @return the block report for the specified data node */ public Block[] getBlockReport(int dataNodeIndex) { if (dataNodeIndex < 0 || dataNodeIndex > dataNodes.size()) { throw new IndexOutOfBoundsException(); } return dataNodes.get(dataNodeIndex).datanode.getFSDataset().getBlockReport(); } /** * * @return block reports from all data nodes * Block[] is indexed in the same order as the list of datanodes returned by getDataNodes() */ public Block[][] getAllBlockReports() { int numDataNodes = dataNodes.size(); Block[][] result = new Block[numDataNodes][]; for (int i = 0; i < numDataNodes; ++i) { result[i] = getBlockReport(i); } return result; } /** * This method is valid only if the data nodes have simulated data * @param dataNodeIndex - data node i which to inject - the index is same as for getDataNodes() * @param blocksToInject - the blocks * @throws IOException * if not simulatedFSDataset * if any of blocks already exist in the data node * */ public void injectBlocks(int dataNodeIndex, Block[] blocksToInject) throws IOException { if (dataNodeIndex < 0 || dataNodeIndex > dataNodes.size()) { throw new IndexOutOfBoundsException(); } FSDatasetInterface dataSet = dataNodes.get(dataNodeIndex).datanode.getFSDataset(); if (!(dataSet instanceof SimulatedFSDataset)) { throw new IOException("injectBlocks is valid only for SimilatedFSDataset"); } SimulatedFSDataset sdataset = (SimulatedFSDataset) dataSet; sdataset.injectBlocks(blocksToInject); dataNodes.get(dataNodeIndex).datanode.scheduleBlockReport(0); } /** * This method is valid only if the data nodes have simulated data * @param blocksToInject - blocksToInject[] is indexed in the same order as the list * of datanodes returned by getDataNodes() * @throws IOException * if not simulatedFSDataset * if any of blocks already exist in the data nodes * Note the rest of the blocks are not injected. */ public void injectBlocks(Block[][] blocksToInject) throws IOException { if (blocksToInject.length > dataNodes.size()) { throw new IndexOutOfBoundsException(); } for (int i = 0; i < blocksToInject.length; ++i) { injectBlocks(i, blocksToInject[i]); } } /** * Set the softLimit and hardLimit of client lease periods */ void setLeasePeriod(long soft, long hard) { nameNode.namesystem.leaseManager.setLeasePeriod(soft, hard); nameNode.namesystem.lmthread.interrupt(); } /** * Returns the current set of datanodes */ DataNode[] listDataNodes() { DataNode[] list = new DataNode[dataNodes.size()]; for (int i = 0; i < dataNodes.size(); i++) { list[i] = dataNodes.get(i).datanode; } return list; } /** * Access to the data directory used for Datanodes * @throws IOException */ public String getDataDirectory() { return data_dir.getAbsolutePath(); } public static File getBaseDir() { return new File(System.getProperty( "test.build.data", "build/test/data"), "dfs/"); } }
ryanobjc/hadoop-cloudera
src/test/org/apache/hadoop/hdfs/MiniDFSCluster.java
Java
apache-2.0
34,652
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.twilmes.sql.gremlin.adapter.converter.ast.nodes.operator; import org.apache.calcite.sql.SqlKind; import org.apache.calcite.sql.SqlPostfixOperator; import org.apache.tinkerpop.gremlin.process.traversal.Order; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.twilmes.sql.gremlin.adapter.converter.SqlMetadata; import org.twilmes.sql.gremlin.adapter.converter.SqlTraversalEngine; import org.twilmes.sql.gremlin.adapter.converter.ast.nodes.GremlinSqlNode; import org.twilmes.sql.gremlin.adapter.converter.ast.nodes.operands.GremlinSqlIdentifier; import org.twilmes.sql.gremlin.adapter.converter.ast.nodes.operator.logic.GremlinSqlNumericLiteral; import java.sql.SQLException; import java.util.List; /** * This module is a GremlinSql equivalent of Calcite's SqlPostFixOperator. * * @author Lyndon Bauto ([email protected]) */ public class GremlinSqlPostFixOperator extends GremlinSqlOperator { private static final Logger LOGGER = LoggerFactory.getLogger(GremlinSqlAsOperator.class); private final SqlPostfixOperator sqlPostfixOperator; private final SqlMetadata sqlMetadata; private final List<GremlinSqlNode> sqlOperands; public GremlinSqlPostFixOperator(final SqlPostfixOperator sqlPostfixOperator, final List<GremlinSqlNode> gremlinSqlNodes, final SqlMetadata sqlMetadata) { super(sqlPostfixOperator, gremlinSqlNodes, sqlMetadata); this.sqlPostfixOperator = sqlPostfixOperator; this.sqlMetadata = sqlMetadata; this.sqlOperands = gremlinSqlNodes; } public Order getOrder() throws SQLException { if (sqlPostfixOperator.kind.equals(SqlKind.DESCENDING)) { return Order.desc; } throw new SQLException("Error, no appropriate order for GremlinSqlPostFixOperator of " + sqlPostfixOperator.kind.sql + "."); } @Override protected void appendTraversal(final GraphTraversal<?, ?> graphTraversal) throws SQLException { if (sqlOperands.get(0) instanceof GremlinSqlBasicCall) { ((GremlinSqlBasicCall) sqlOperands.get(0)).generateTraversal(graphTraversal); } else if (!(sqlOperands.get(0) instanceof GremlinSqlIdentifier) && !(sqlOperands.get(0) instanceof GremlinSqlNumericLiteral)) { throw new SQLException( "Error: expected operand to be GremlinSqlBasicCall or GremlinSqlIdentifier in GremlinSqlOperator."); } if (sqlOperands.size() == 1) { if (sqlOperands.get(0) instanceof GremlinSqlIdentifier) { SqlTraversalEngine .applySqlIdentifier((GremlinSqlIdentifier) sqlOperands.get(0), sqlMetadata, graphTraversal); } } if (sqlOperands.size() == 2 && sqlOperands.get(0) instanceof GremlinSqlIdentifier) { SqlTraversalEngine.applySqlIdentifier((GremlinSqlIdentifier) sqlOperands.get(0), sqlMetadata, graphTraversal); } } }
twilmes/sql-gremlin
src/main/java/org/twilmes/sql/gremlin/adapter/converter/ast/nodes/operator/GremlinSqlPostFixOperator.java
Java
apache-2.0
3,860
package com.planet_ink.coffee_mud.Abilities.Common; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.Common.CraftingSkill.CraftParms; import com.planet_ink.coffee_mud.Abilities.Common.CraftingSkill.CraftingActivity; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.Session.InputCallback; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.ListingLibrary; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2000-2014 Bo Zimmerman 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. */ @SuppressWarnings({"unchecked","rawtypes"}) public class JewelMaking extends EnhancedCraftingSkill implements ItemCraftor, MendingSkill { @Override public String ID() { return "JewelMaking"; } private final static String localizedName = CMLib.lang()._("Jewel Making"); @Override public String name() { return localizedName; } private static final String[] triggerStrings =_i(new String[] {"JEWEL","JEWELMAKING"}); @Override public String[] triggerStrings(){return triggerStrings;} @Override public String supportedResourceString(){return "GLASS|PRECIOUS|SAND";} @Override public String parametersFormat(){ return "ITEM_NAME\tITEM_LEVEL\tBUILD_TIME_TICKS\tMATERIALS_REQUIRED\tITEM_BASE_VALUE\t" +"ITEM_CLASS_ID\tSTATUE||CODED_WEAR_LOCATION\tN_A\tBASE_ARMOR_AMOUNT\tOPTIONAL_RESOURCE_OR_MATERIAL\tCODED_SPELL_LIST";} //protected static final int RCP_FINALNAME=0; //protected static final int RCP_LEVEL=1; //protected static final int RCP_TICKS=2; protected static final int RCP_WOOD=3; protected static final int RCP_VALUE=4; protected static final int RCP_CLASSTYPE=5; protected static final int RCP_MISCTYPE=6; //private static final int RCP_CAPACITY=7; protected static final int RCP_ARMORDMG=8; protected static final int RCP_EXTRAREQ=9; protected static final int RCP_SPELL=10; protected Vector beingDone=null; @Override public boolean tick(Tickable ticking, int tickID) { if((affected!=null)&&(affected instanceof MOB)&&(tickID==Tickable.TICKID_MOB)) { final MOB mob=(MOB)affected; if(fireRequired) { if((buildingI==null) ||(getRequiredFire(mob,0)==null)) { messedUp=true; unInvoke(); } } } return super.tick(ticking,tickID); } @Override public String parametersFile(){ return "jewelmaking.txt";} @Override protected List<List<String>> loadRecipes(){return super.loadRecipes(parametersFile());} @Override protected boolean doLearnRecipe(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { fireRequired=false; return super.doLearnRecipe( mob, commands, givenTarget, auto, asLevel ); } @Override public void unInvoke() { if(canBeUninvoked()) { if((affected!=null)&&(affected instanceof MOB)) { final MOB mob=(MOB)affected; if((buildingI!=null)&&(!aborted)) { if((beingDone!=null)&&(beingDone.size()>=2)) { if(messedUp) commonEmote(mob,"<S-NAME> mess(es) up "+verb+"."); else { final Item I=(Item)beingDone.elementAt(1); buildingI.setBaseValue(buildingI.baseGoldValue()+(I.baseGoldValue()*2)); buildingI.setDescription(buildingI.description()+" "+(String)beingDone.elementAt(0)); } beingDone=null; } else if(messedUp) { if(activity == CraftingActivity.MENDING) messedUpCrafting(mob); else if(activity == CraftingActivity.LEARNING) { commonEmote(mob,"<S-NAME> fail(s) to learn how to make "+buildingI.name()+"."); buildingI.destroy(); } else if(activity == CraftingActivity.REFITTING) commonEmote(mob,"<S-NAME> mess(es) up refitting "+buildingI.name()+"."); else commonEmote(mob,"<S-NAME> mess(es) up "+verb+"."); } else { if(activity == CraftingActivity.MENDING) buildingI.setUsesRemaining(100); else if(activity==CraftingActivity.LEARNING) { deconstructRecipeInto( buildingI, recipeHolder ); buildingI.destroy(); } else if(activity == CraftingActivity.REFITTING) { buildingI.basePhyStats().setHeight(0); buildingI.recoverPhyStats(); } else dropAWinner(mob,buildingI); } } buildingI=null; activity = CraftingActivity.CRAFTING; } } super.unInvoke(); } @Override public boolean mayICraft(final Item I) { if(I==null) return false; if(!super.mayBeCrafted(I)) return false; if(CMLib.flags().isDeadlyOrMaliciousEffect(I)) return false; if((I.material()&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_PRECIOUS) { if(I instanceof Rideable) { final Rideable R=(Rideable)I; final int rideType=R.rideBasis(); switch(rideType) { case Rideable.RIDEABLE_LADDER: case Rideable.RIDEABLE_SLEEP: case Rideable.RIDEABLE_SIT: case Rideable.RIDEABLE_TABLE: return true; default: return false; } } else if(I instanceof Armor) { if(I.fitsOn(Wearable.WORN_EARS) ||I.fitsOn(Wearable.WORN_EYES) ||I.fitsOn(Wearable.WORN_HEAD) ||I.fitsOn(Wearable.WORN_NECK) ||I.fitsOn(Wearable.WORN_FEET) ||I.fitsOn(Wearable.WORN_LEFT_FINGER) ||I.fitsOn(Wearable.WORN_RIGHT_FINGER) ||I.fitsOn(Wearable.WORN_LEFT_WRIST) ||I.fitsOn(Wearable.WORN_RIGHT_WRIST)) return true; return (isANativeItem(I.Name())); } if(I.rawProperLocationBitmap()==Wearable.WORN_HELD) return true; return true; } else if((I instanceof Armor) &&(((I.material()&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_METAL) ||((I.material()&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_MITHRIL))) { final Armor A=(Armor)I; if((CMath.bset(A.getLayerAttributes(), Armor.LAYERMASK_SEETHROUGH)) &&(A.basePhyStats().armor()<3)) return true; if((A.basePhyStats().armor()<2) &&(I.fitsOn(Wearable.WORN_EARS) ||I.fitsOn(Wearable.WORN_EYES) ||I.fitsOn(Wearable.WORN_HEAD) ||I.fitsOn(Wearable.WORN_NECK) ||I.fitsOn(Wearable.WORN_FEET) ||I.fitsOn(Wearable.WORN_LEFT_FINGER) ||I.fitsOn(Wearable.WORN_RIGHT_FINGER) ||I.fitsOn(Wearable.WORN_LEFT_WRIST) ||I.fitsOn(Wearable.WORN_RIGHT_WRIST))) return true; return (isANativeItem(I.Name())); } return (isANativeItem(I.Name())); } @Override public boolean supportsMending(Physical I){ return canMend(null,I,true);} @Override protected boolean canMend(MOB mob, Environmental E, boolean quiet) { if(!super.canMend(mob,E,quiet)) return false; if((!(E instanceof Item)) ||(!mayICraft((Item)E))) { if(!quiet) commonTell(mob,_("That's not an jewelworked item.")); return false; } return true; } @Override public String getDecodedComponentsDescription(final MOB mob, final List<String> recipe) { return super.getComponentDescription( mob, recipe, RCP_WOOD ); } @Override public boolean invoke(final MOB mob, Vector commands, Physical givenTarget, final boolean auto, final int asLevel) { final Vector originalCommands=(Vector)commands.clone(); if(super.checkStop(mob, commands)) return true; fireRequired=true; final CraftParms parsedVars=super.parseAutoGenerate(auto,givenTarget,commands); givenTarget=parsedVars.givenTarget; final PairVector<Integer,Integer> enhancedTypes=enhancedTypes(mob,commands); randomRecipeFix(mob,addRecipes(mob,loadRecipes()),commands,parsedVars.autoGenerate); if(commands.size()==0) { commonTell(mob,_("Make what? Enter \"jewel list\" for a list. You may also enter jewel encrust <gem name> <item name>, jewel mount <gem name> <item name>, jewel refit <item name>, jewel learn <item>, jewel scan, jewel mend <item name>, or jewel stop to cancel.")); return false; } if((!auto) &&(commands.size()>0) &&(((String)commands.firstElement()).equalsIgnoreCase("bundle"))) { bundling=true; if(super.invoke(mob,commands,givenTarget,auto,asLevel)) return super.bundle(mob,commands); return false; } final List<List<String>> recipes=addRecipes(mob,loadRecipes()); final String str=(String)commands.elementAt(0); String startStr=null; fireRequired=true; bundling=false; int duration=4; String misctype=""; if(str.equalsIgnoreCase("list")) { String mask=CMParms.combine(commands,1); boolean allFlag=false; if(mask.equalsIgnoreCase("all")) { allFlag=true; mask=""; } int toggler=1; final int toggleTop=2; final StringBuffer buf=new StringBuffer(""); final int[] cols={ ListingLibrary.ColFixer.fixColWidth(27,mob.session()), ListingLibrary.ColFixer.fixColWidth(3,mob.session()), ListingLibrary.ColFixer.fixColWidth(5,mob.session()) }; for(int r=0;r<toggleTop;r++) buf.append((r>0?" ":"")+CMStrings.padRight(_("Item"),cols[0])+" "+CMStrings.padRight(_("Lvl"),cols[1])+" "+CMStrings.padRight(_("Metal"),cols[2])); buf.append("\n\r"); for(int r=0;r<recipes.size();r++) { final List<String> V=recipes.get(r); if(V.size()>0) { final String item=replacePercent(V.get(RCP_FINALNAME),""); final int level=CMath.s_int(V.get(RCP_LEVEL)); final String wood=getComponentDescription(mob,V,RCP_WOOD); if(wood.length()>5) { if(toggler>1) buf.append("\n\r"); toggler=toggleTop; } if(((level<=xlevel(mob))||allFlag) &&((mask.length()==0)||mask.equalsIgnoreCase("all")||CMLib.english().containsString(item,mask))) { buf.append(CMStrings.padRight(item,cols[0])+" "+CMStrings.padRight(""+level,cols[1])+" "+CMStrings.padRightPreserve(""+wood,cols[2])+((toggler!=toggleTop)?" ":"\n\r")); if(++toggler>toggleTop) toggler=1; } } } commonTell(mob,buf.toString()); enhanceList(mob); return true; } else if((commands.firstElement() instanceof String)&&(((String)commands.firstElement())).equalsIgnoreCase("learn")) { return doLearnRecipe(mob, commands, givenTarget, auto, asLevel); } else if((str.equalsIgnoreCase("encrust"))||(str.equalsIgnoreCase("mount"))) { final String word=str.toLowerCase(); if(commands.size()<3) { commonTell(mob,_("@x1 what jewel onto what item?",CMStrings.capitalizeAndLower(word))); return false; } final Item fire=getRequiredFire(mob,parsedVars.autoGenerate); buildingI=null; activity = CraftingActivity.CRAFTING; aborted=false; messedUp=false; if(fire==null) return false; final String jewel=(String)commands.elementAt(1); final String rest=CMParms.combine(commands,2); final Environmental jewelE=mob.location().fetchFromMOBRoomFavorsItems(mob,null,jewel,Wearable.FILTER_UNWORNONLY); final Environmental thangE=mob.location().fetchFromMOBRoomFavorsItems(mob,null,rest,Wearable.FILTER_UNWORNONLY); if((jewelE==null)||(!CMLib.flags().canBeSeenBy(jewelE,mob))) { commonTell(mob,_("You don't see any '@x1' here.",jewel)); return false; } if((thangE==null)||(!CMLib.flags().canBeSeenBy(thangE,mob))) { commonTell(mob,_("You don't see any '@x1' here.",rest)); return false; } if((!(jewelE instanceof RawMaterial))||(!(jewelE instanceof Item)) ||(((((Item)jewelE).material()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_PRECIOUS) &&((((Item)jewelE).material()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_GLASS))) { commonTell(mob,_("A @x1 is not suitable to @x2 on anything.",jewelE.name(),word)); return false; } final Item jewelI=(Item)CMLib.materials().unbundle((Item)jewelE,1,null); if(jewelI==null) { commonTell(mob,_("@x1 is not pure enough to be @x2ed with. You will need to use a gathered one.",jewelE.name(),word)); return false; } if((!(thangE instanceof Item)) ||(!thangE.isGeneric()) ||(((((Item)thangE).material()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_CLOTH) &&((((Item)thangE).material()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_METAL) &&((((Item)thangE).material()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_MITHRIL) &&((((Item)thangE).material()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_SYNTHETIC) &&((((Item)thangE).material()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_ROCK) &&((((Item)thangE).material()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_WOODEN) &&((((Item)thangE).material()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_LEATHER))) { commonTell(mob,_("A @x1 is not suitable to be @x2ed on.",thangE.name(),word)); return false; } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; buildingI=(Item)thangE; beingDone=new Vector(); String materialName=RawMaterial.CODES.NAME(jewelI.material()).toLowerCase(); if(word.equals("encrust")) { beingDone.addElement(CMStrings.capitalizeAndLower(buildingI.name())+" is encrusted with bits of "+materialName+"."); startStr=_("<S-NAME> start(s) encrusting @x1 with @x2.",buildingI.name(),materialName); displayText=_("You are encrusting @x1 with @x2",buildingI.name(),materialName); verb=_("encrusting @x1 with bits of @x2",buildingI.name(),materialName); } else { materialName=CMLib.english().startWithAorAn(materialName).toLowerCase(); beingDone.addElement(CMStrings.capitalizeAndLower(buildingI.name())+" has "+materialName+" mounted on it."); startStr=_("<S-NAME> start(s) mounting @x1 onto @x2.",materialName,buildingI.name()); displayText=_("You are mounting @x1 onto @x2",materialName,buildingI.name()); verb=_("mounting @x1 onto @x2",materialName,buildingI.name()); } beingDone.addElement(jewelI); messedUp=!proficiencyCheck(mob,0,auto); duration=10; final CMMsg msg=CMClass.getMsg(mob,null,this,getActivityMessageType(),startStr); if(mob.location().okMessage(mob,msg)) { jewelI.destroy(); mob.location().send(mob,msg); beneficialAffect(mob,mob,asLevel,duration); return true; } return false; } if(str.equalsIgnoreCase("scan")) return publicScan(mob,commands); else if(str.equalsIgnoreCase("mend")) { buildingI=null; activity = CraftingActivity.CRAFTING; messedUp=false; final Item fire=getRequiredFire(mob,parsedVars.autoGenerate); if(fire==null) return false; final Vector newCommands=CMParms.parse(CMParms.combine(commands,1)); buildingI=getTarget(mob,mob.location(),givenTarget,newCommands,Wearable.FILTER_UNWORNONLY); if(!canMend(mob, buildingI,false)) return false; activity = CraftingActivity.MENDING; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; startStr=_("<S-NAME> start(s) mending @x1.",buildingI.name()); displayText=_("You are mending @x1",buildingI.name()); verb=_("mending @x1",buildingI.name()); } else if(str.equalsIgnoreCase("refit")) { buildingI=null; activity = CraftingActivity.CRAFTING; messedUp=false; final Item fire=getRequiredFire(mob,parsedVars.autoGenerate); if(fire==null) return false; final Vector newCommands=CMParms.parse(CMParms.combine(commands,1)); buildingI=getTarget(mob,mob.location(),givenTarget,newCommands,Wearable.FILTER_UNWORNONLY); if(buildingI==null) return false; if(!mayICraft(mob,buildingI)) return false; if(buildingI.phyStats().height()==0) { commonTell(mob,_("@x1 is already the right size.",buildingI.name(mob))); return false; } activity = CraftingActivity.REFITTING; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; startStr=_("<S-NAME> start(s) refitting @x1.",buildingI.name()); displayText=_("You are refitting @x1",buildingI.name()); verb=_("refitting @x1",buildingI.name()); } else { beingDone=null; buildingI=null; activity = CraftingActivity.CRAFTING; aborted=false; messedUp=false; String statue=null; if((commands.size()>1)&&((String)commands.lastElement()).startsWith("STATUE=")) { statue=(((String)commands.lastElement()).substring(7)).trim(); if(statue.length()==0) statue=null; else commands.removeElementAt(commands.size()-1); } int amount=-1; if((commands.size()>1)&&(CMath.isNumber((String)commands.lastElement()))) { amount=CMath.s_int((String)commands.lastElement()); commands.removeElementAt(commands.size()-1); } final String recipeName=CMParms.combine(commands,0); List<String> foundRecipe=null; final List<List<String>> matches=matchingRecipeNames(recipes,recipeName,true); for(int r=0;r<matches.size();r++) { final List<String> V=matches.get(r); if(V.size()>0) { final int level=CMath.s_int(V.get(RCP_LEVEL)); if((parsedVars.autoGenerate>0)||(level<=xlevel(mob))) { foundRecipe=V; break; } } } if(foundRecipe==null) { commonTell(mob,_("You don't know how to make a '@x1'. Try \"jewel list\" for a list.",recipeName)); return false; } misctype=foundRecipe.get(RCP_MISCTYPE); bundling=misctype.equalsIgnoreCase("BUNDLE"); if(!bundling) { final Item fire=getRequiredFire(mob,parsedVars.autoGenerate); if(fire==null) return false; } else fireRequired=false; final String woodRequiredStr = foundRecipe.get(RCP_WOOD); final List<Object> componentsFoundList=getAbilityComponents(mob, woodRequiredStr, "make "+CMLib.english().startWithAorAn(recipeName),parsedVars.autoGenerate); if(componentsFoundList==null) return false; int woodRequired=CMath.s_int(woodRequiredStr); woodRequired=adjustWoodRequired(woodRequired,mob); if(amount>woodRequired) woodRequired=amount; final String otherRequired=foundRecipe.get(RCP_EXTRAREQ); final int[] pm={RawMaterial.MATERIAL_MITHRIL,RawMaterial.MATERIAL_METAL}; final int[][] data=fetchFoundResourceData(mob, woodRequired,"metal",pm, otherRequired.length()>0?1:0,otherRequired,null, false, parsedVars.autoGenerate, enhancedTypes); if(data==null) return false; fixDataForComponents(data,componentsFoundList); woodRequired=data[0][FOUND_AMT]; final Session session=mob.session(); if((misctype.equalsIgnoreCase("statue")) &&(session!=null) &&((statue==null)||(statue.trim().length()==0))) { final Ability me=this; final Physical target=givenTarget; session.prompt(new InputCallback(InputCallback.Type.PROMPT,"",0) { @Override public void showPrompt() {session.promptPrint(_("What is this item a representation of?\n\r: "));} @Override public void timedOut() {} @Override public void callBack() { final String of=this.input; if((of.trim().length()==0)||(of.indexOf('<')>=0)) return; final Vector newCommands=(Vector)originalCommands.clone(); newCommands.add("STATUE="+of); me.invoke(mob, newCommands, target, auto, asLevel); } }); return false; } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final int lostValue=parsedVars.autoGenerate>0?0: CMLib.materials().destroyResourcesValue(mob.location(),woodRequired,data[0][FOUND_CODE],data[1][FOUND_CODE],null) +CMLib.ableMapper().destroyAbilityComponents(componentsFoundList); buildingI=CMClass.getItem(foundRecipe.get(RCP_CLASSTYPE)); if(buildingI==null) { commonTell(mob,_("There's no such thing as a @x1!!!",foundRecipe.get(RCP_CLASSTYPE))); return false; } duration=getDuration(CMath.s_int(foundRecipe.get(RCP_TICKS)),mob,CMath.s_int(foundRecipe.get(RCP_LEVEL)),4); String itemName=null; if((otherRequired.length()>0)&&(otherRequired.equalsIgnoreCase("PRECIOUS"))) itemName=replacePercent(foundRecipe.get(RCP_FINALNAME),RawMaterial.CODES.NAME((data[1][FOUND_CODE]))).toLowerCase(); else itemName=replacePercent(foundRecipe.get(RCP_FINALNAME),RawMaterial.CODES.NAME(data[0][FOUND_CODE])).toLowerCase(); if(bundling) itemName="a "+woodRequired+"# "+itemName; else itemName=CMLib.english().startWithAorAn(itemName); buildingI.setName(itemName); startStr=_("<S-NAME> start(s) making @x1.",buildingI.name()); displayText=_("You are making @x1",buildingI.name()); verb=_("making @x1",buildingI.name()); playSound="tinktinktink.wav"; buildingI.setDisplayText(_("@x1 lies here",itemName)); if((data[1][FOUND_CODE]>0) &&(((data[0][FOUND_CODE]&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_METAL) ||((data[0][FOUND_CODE]&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_MITHRIL)) &&(((data[1][FOUND_CODE]&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_PRECIOUS))) buildingI.setDescription(_("@x1 made of @x2.",itemName,RawMaterial.CODES.NAME(data[0][FOUND_CODE]).toLowerCase())); else buildingI.setDescription(itemName+". "); buildingI.basePhyStats().setWeight(getStandardWeight(woodRequired,bundling)); buildingI.setBaseValue(CMath.s_int(foundRecipe.get(RCP_VALUE))+(woodRequired*(RawMaterial.CODES.VALUE(data[0][FOUND_CODE])))); buildingI.setSecretIdentity(getBrand(mob)); if(data[1][FOUND_CODE]==0) buildingI.setMaterial(data[0][FOUND_CODE]); else { buildingI.setMaterial(data[1][FOUND_CODE]); buildingI.setBaseValue(buildingI.baseGoldValue()+RawMaterial.CODES.VALUE(data[1][FOUND_CODE])); } buildingI.basePhyStats().setLevel(CMath.s_int(foundRecipe.get(RCP_LEVEL))); //int capacity=CMath.s_int((String)foundRecipe.get(RCP_CAPACITY)); final int armordmg=CMath.s_int(foundRecipe.get(RCP_ARMORDMG)); final String spell=(foundRecipe.size()>RCP_SPELL)?foundRecipe.get(RCP_SPELL).trim():""; addSpells(buildingI,spell); if((buildingI instanceof Armor)&&(!(buildingI instanceof FalseLimb))) { ((Armor)buildingI).basePhyStats().setArmor(0); if(armordmg!=0) ((Armor)buildingI).basePhyStats().setArmor(armordmg); setWearLocation(buildingI,misctype,0); } if((misctype.equalsIgnoreCase("statue")) &&(statue!=null) &&(statue.trim().length()>0)) { buildingI.setName(_("@x1 of @x2",itemName,statue.trim())); buildingI.setDisplayText(_("@x1 of @x2 is here",itemName,statue.trim())); buildingI.setDescription(_("@x1 of @x2. ",itemName,statue.trim())); } if(bundling) buildingI.setBaseValue(lostValue); buildingI.recoverPhyStats(); buildingI.text(); buildingI.recoverPhyStats(); } messedUp=!proficiencyCheck(mob,0,auto); if(bundling) { messedUp=false; duration=1; verb=_("bundling @x1",RawMaterial.CODES.NAME(buildingI.material()).toLowerCase()); startStr=_("<S-NAME> start(s) @x1.",verb); displayText=_("You are @x1",verb); } if(parsedVars.autoGenerate>0) { commands.addElement(buildingI); return true; } final CMMsg msg=CMClass.getMsg(mob,buildingI,getActivityMessageType(),startStr); if(mob.location().okMessage(mob,msg)) { mob.location().send(mob,msg); buildingI=(Item)msg.target(); beneficialAffect(mob,mob,asLevel,duration); enhanceItem(mob,buildingI,enhancedTypes); return true; } else if(bundling) { messedUp=false; aborted=false; unInvoke(); } return false; } }
vjanmey/EpicMudfia
com/planet_ink/coffee_mud/Abilities/Common/JewelMaking.java
Java
apache-2.0
24,239
/* * Licensed to the Sakai Foundation (SF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The SF 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.sakaiproject.kernel.api; /** * A Component Activator activates the component within the Kernel. During * activation, the component activator should register any services with the * kernel. Some components may perform de-activation depending on their * dependencies. The ComponentActivator is invoked by the component manager * that understands dependencies and the component specification. */ public interface ComponentActivator { /** * Activate the component in the context of the suppled kernel. * * @param kernel * the kernel context in which to perform the activation. * @throws ComponentActivatorException * */ void activate(Kernel kernel) throws ComponentActivatorException; /** * De-activate the component. */ void deactivate(); }
sakai-mirror/k2
agnostic/shared/src/main/java/org/sakaiproject/kernel/api/ComponentActivator.java
Java
apache-2.0
1,598
package org.jacpfx.particle; /** * Created by Andy Moncsek on 20.08.15. */ public class Vector2D { public double x; public double y; public Vector2D(double x, double y) { this.x = x; this.y = y; } public double magnitude() { return (double) Math.sqrt(x * x + y * y); } public void add(Vector2D v) { x += v.x; y += v.y; } public void add(double x, double y, double z) { this.x += x; this.y += y; } public void multiply(double n) { x *= n; y *= n; } public void div(double n) { x /= n; y /= n; } public void normalize() { double m = magnitude(); if (m != 0 && m != 1) { div(m); } } public void limit(double max) { if (magnitude() > max) { normalize(); multiply(max); } } public double angle() { double angle = (double) Math.atan2(-y, x); return -1 * angle; } static public Vector2D subtract(Vector2D v1, Vector2D v2) { return new Vector2D(v1.x - v2.x, v1.y - v2.y); } }
amoAHCP/JavaOne2015JavaFXPitfalls
JavaFXPitfalls/src/main/java/org/jacpfx/particle/Vector2D.java
Java
apache-2.0
1,158
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.elasticsearch.index.fielddata.plain; import org.apache.lucene.index.LeafReaderContext; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.fielddata.*; import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource.Nested; import org.elasticsearch.index.mapper.FieldMapper; import org.elasticsearch.index.mapper.FieldMapper.Names; import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.search.MultiValueMode; import org.elasticsearch.indices.breaker.CircuitBreakerService; /** * A field data implementation that forbids loading and will throw an {@link IllegalStateException} if you try to load * {@link AtomicFieldData} instances. */ public final class DisabledIndexFieldData extends AbstractIndexFieldData<AtomicFieldData> { public static class Builder implements IndexFieldData.Builder { @Override public IndexFieldData<AtomicFieldData> build(Index index, @IndexSettings Settings indexSettings, FieldMapper<?> mapper, IndexFieldDataCache cache, CircuitBreakerService breakerService, MapperService mapperService) { // Ignore Circuit Breaker return new DisabledIndexFieldData(index, indexSettings, mapper.names(), mapper.fieldDataType(), cache); } } public DisabledIndexFieldData(Index index, Settings indexSettings, Names fieldNames, FieldDataType fieldDataType, IndexFieldDataCache cache) { super(index, indexSettings, fieldNames, fieldDataType, cache); } @Override public AtomicFieldData loadDirect(LeafReaderContext context) throws Exception { throw fail(); } @Override public IndexFieldData.XFieldComparatorSource comparatorSource(Object missingValue, MultiValueMode sortMode, Nested nested) { throw fail(); } private IllegalStateException fail() { return new IllegalStateException("Field data loading is forbidden on " + getFieldNames().name()); } }
vrkansagara/elasticsearch
src/main/java/org/elasticsearch/index/fielddata/plain/DisabledIndexFieldData.java
Java
apache-2.0
2,916
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.drill.exec.planner.sql.handlers; import lombok.extern.slf4j.Slf4j; import org.apache.calcite.sql.SqlLiteral; import org.apache.calcite.sql.SqlNode; import org.apache.commons.lang3.StringUtils; import org.apache.drill.common.exceptions.UserException; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.alias.AliasRegistry; import org.apache.drill.exec.alias.Aliases; import org.apache.drill.exec.physical.PhysicalPlan; import org.apache.drill.exec.planner.sql.DirectPlan; import org.apache.drill.exec.planner.sql.parser.SqlDropAlias; import org.apache.drill.exec.work.foreman.ForemanSetupException; import java.io.IOException; import java.util.Locale; /** * Handler for handling DROP ALIAS statements. */ @Slf4j public class DropAliasHandler extends BaseAliasHandler { public DropAliasHandler(SqlHandlerConfig config) { super(config); } @Override public PhysicalPlan getPlan(SqlNode sqlNode) throws ForemanSetupException, IOException { checkAliasesEnabled(); SqlDropAlias node = unwrap(sqlNode, SqlDropAlias.class); String alias = SchemaPath.getCompoundPath(node.getAlias().names.toArray(new String[0])).toExpr(); String aliasTarget = ((SqlLiteral) node.getAliasKind()).toValue(); AliasRegistry aliasRegistry = getAliasRegistry(aliasTarget); Aliases aliases = getAliases(node, aliasRegistry); boolean checkIfExists = ((SqlLiteral) node.getIfExists()).booleanValue(); boolean removed = aliases.remove(alias); if (!removed && !checkIfExists) { throw UserException.validationError() .message("No alias found with given name [%s]", alias) .build(logger); } String message = removed ? String.format("%s alias '%s' dropped successfully", StringUtils.capitalize(aliasTarget.toLowerCase(Locale.ROOT)), alias) : String.format("No %s alias found with given name [%s]", aliasTarget.toLowerCase(Locale.ROOT), alias); return DirectPlan.createDirectPlan(context, removed, message); } private Aliases getAliases(SqlDropAlias dropAlias, AliasRegistry aliasRegistry) { boolean isPublicAlias = ((SqlLiteral) dropAlias.getIsPublic()).booleanValue(); return isPublicAlias ? getPublicAliases(dropAlias, aliasRegistry) : getUserAliases(dropAlias, aliasRegistry); } private Aliases getUserAliases(SqlDropAlias dropAlias, AliasRegistry aliasRegistry) { if (!context.isImpersonationEnabled()) { throw UserException.validationError() .message("Cannot drop user alias when user impersonation is disabled") .build(logger); } String userName = resolveUserName(dropAlias.getUser()); return aliasRegistry.getUserAliases(userName); } private Aliases getPublicAliases(SqlDropAlias dropAlias, AliasRegistry aliasRegistry) { if (dropAlias.getUser() != null) { throw UserException.validationError() .message("Cannot drop public alias for specific user") .build(logger); } checkAdminPrivileges(context.getOptions()); return aliasRegistry.getPublicAliases(); } }
vvysotskyi/drill
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DropAliasHandler.java
Java
apache-2.0
3,894
package com.thaiopensource.xml.dtd.om; public class TokenizedDatatype extends Datatype { private final String typeName; public TokenizedDatatype (final String typeName) { this.typeName = typeName; } @Override public int getType () { return TOKENIZED; } public String getTypeName () { return typeName; } @Override public void accept (final DatatypeVisitor visitor) throws Exception { visitor.tokenizedDatatype (typeName); } }
lsimons/phloc-schematron-standalone
phloc-schematron/jing/src/main/java/com/thaiopensource/xml/dtd/om/TokenizedDatatype.java
Java
apache-2.0
476
package mx.fiscoflex.contabilidad.web.empresa; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller public class EmpresaController { @RequestMapping(value = "empresa", method = RequestMethod.GET) public String empresas() { return "empresa"; } }
fiscoflex/erp
fiscoflex-web/src/main/java/mx/fiscoflex/contabilidad/web/empresa/EmpresaController.java
Java
apache-2.0
391
/* * Copyright (c) 2014. Real Time Genomics Limited. * * 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. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * 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 MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.rtg.vcf; import java.io.File; import java.io.IOException; import java.io.LineNumberReader; import java.util.HashMap; import java.util.Map; import com.rtg.util.diagnostic.NoTalkbackSlimException; import com.rtg.util.io.FileUtils; import com.rtg.vcf.header.VcfHeader; /** * An annotator allowing for sample names to be changed. */ public class VcfSampleNameRelabeller implements VcfAnnotator { private final Map<String, String> mSampleNameMap; /** * Construct a new annotator for relabelling samples. * @param sampleNameMap mapping of old sample names to new sample names */ public VcfSampleNameRelabeller(final Map<String, String> sampleNameMap) { mSampleNameMap = sampleNameMap; } @Override public void updateHeader(final VcfHeader header) { for (final Map.Entry<String, String> e : mSampleNameMap.entrySet()) { header.relabelSample(e.getKey(), e.getValue()); } } @Override public void annotate(final VcfRecord rec) { // Actual records do not change as a result of sample name relabelling } /** * Create an instance backed by a file. * @param relabelFile file containing pairs of old names and new names * @return annotator for relabelling samples * @throws IOException if an I/O error occurs. */ public static VcfSampleNameRelabeller create(final File relabelFile) throws IOException { final HashMap<String, String> map = new HashMap<>(); try (final LineNumberReader r = new LineNumberReader(FileUtils.createReader(relabelFile, false))) { String line; while ((line = r.readLine()) != null) { if (line.length() > 0) { final String[] parts = line.trim().split("\\s+"); if (parts.length != 2) { throw new NoTalkbackSlimException("Expected: old-name new-name on line " + r.getLineNumber() + " of " + relabelFile.getPath() + "\nSaw: " + line); } map.put(parts[0], parts[1]); } } } return new VcfSampleNameRelabeller(map); } }
RealTimeGenomics/rtg-tools
src/com/rtg/vcf/VcfSampleNameRelabeller.java
Java
bsd-2-clause
3,421
/* * This file is released under terms of BSD license * See LICENSE file for more information * @author Mikhail Zhigun */ package claw.tests; import java.nio.file.Path; import java.util.Arrays; import claw.utils.BasicTestCase; public class OpenMPTest extends BasicTestCase { InputParams createParams(String name) { final String relpath = "openmp/" + name; final Path resDir = RES_DIR.resolve(relpath); final Path workingDir = WORKING_DIR.resolve(relpath); InputParams p = new InputParams(name, resDir, workingDir); p.setInputDirName(""); p.setRefDirName(""); p.setOutputDirName(""); p.setCompare(false); p.setDebugClawfc(false); return p; } void run(String name) throws Exception { InputParams inParams = createParams(name); run(inParams); } public void test_primitive1() throws Exception { InputParams inParams = createParams("primitive1"); inParams.setClawFlags(Arrays.asList("--target=gpu", "--directive=openmp")); run(inParams); } }
clementval/claw-compiler
tests_runner/src/claw/tests/OpenMPTest.java
Java
bsd-2-clause
1,102
/* * Copyright (c) 2016, pal * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package com.sandflow.smpte.mxf; import java.net.URI; import java.nio.channels.SeekableByteChannel; import java.nio.file.Files; import java.nio.file.Paths; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import junit.framework.TestCase; /** * * @author pal */ public class MXFFilesTest extends TestCase { public MXFFilesTest(String testName) { super(testName); } public void testSeekFooterPartition() throws Exception { /* get the sample files */ URI uri = ClassLoader.getSystemResource("resources/sample-files/audio1.mxf").toURI(); assertNotNull(uri); SeekableByteChannel faf = Files.newByteChannel(Paths.get(uri)); assertEquals(0x6258, MXFFiles.seekFooterPartition(faf)); } public void testSeekFooterPartitionOpenIncompleteHeader() throws Exception { /* get the sample files */ URI uri = ClassLoader.getSystemResource("resources/sample-files/open-incomplete-header.mxf").toURI(); assertNotNull(uri); SeekableByteChannel faf = Files.newByteChannel(Paths.get(uri)); assertEquals(0x8df1f, MXFFiles.seekFooterPartition(faf)); } public void testSeekHeaderPartition() throws Exception { /* get the sample files */ URI uri = ClassLoader.getSystemResource("resources/sample-files/audio1.mxf").toURI(); assertNotNull(uri); SeekableByteChannel faf = Files.newByteChannel(Paths.get(uri)); assertEquals(0, MXFFiles.seekHeaderPartition(faf)); } }
ethanchan747/regxmllib
regxmllib/src/test/java/com/sandflow/smpte/mxf/MXFFilesTest.java
Java
bsd-2-clause
2,931
/* * Copyright (c) 2016, Kevin Phoenix * 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. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package in.twizmwaz.cardinal.match; import com.google.common.collect.ImmutableCollection; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import in.twizmwaz.cardinal.event.match.MatchChangeStateEvent; import in.twizmwaz.cardinal.module.repository.LoadedMap; import in.twizmwaz.cardinal.module.team.SinglePlayerContainer; import in.twizmwaz.cardinal.module.team.Team; import in.twizmwaz.cardinal.playercontainer.CompetitorContainer; import in.twizmwaz.cardinal.playercontainer.PlayerContainer; import lombok.Getter; import lombok.NonNull; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.entity.Player; import java.util.Iterator; import java.util.Set; import java.util.UUID; @Getter public final class Match implements PlayerContainer { private static int matchCounter = -1; @Getter private final MatchThread matchThread; private final UUID uuid; private final LoadedMap map; private final World world; private final Set<Player> players; private final Set<CompetitorContainer> competitors; private final int matchNumber; private MatchState state; /** * Creates a new Match. * * @param matchThread The {@link MatchThread} that this match will occur on. * @param uuid The unique id of this match. * @param map The {@link LoadedMap} this match will occur on. */ public Match(@NonNull MatchThread matchThread, @NonNull UUID uuid, @NonNull LoadedMap map, @NonNull World world) { this.matchThread = matchThread; this.uuid = uuid; this.map = map; this.world = world; players = Sets.newHashSet(); competitors = Sets.newHashSet(); this.matchNumber = matchCounter++; state = MatchState.WAITING; } public boolean isRunning() { return state.equals(MatchState.PLAYING); } /** * Sets the match state. * * @param state The state to try and set. * @return The final match state. */ public MatchState setMatchState(MatchState state) { MatchChangeStateEvent event = new MatchChangeStateEvent(this, state); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { return this.state; } else { this.state = state; return state; } } /** * Checks if any of the player containers in the match are teams, determining if a match is FFA or not. * * @return If the match is a free-for-all. */ public boolean isFfa() { for (CompetitorContainer container : competitors) { if (container instanceof Team) { return false; } } return true; } @Override public ImmutableCollection<Player> getPlayers() { return ImmutableSet.copyOf(players); } @Override public boolean hasPlayer(@NonNull Player player) { return players.contains(player); } @Override public void addPlayer(@NonNull Player player) { players.add(player); if (isFfa()) { competitors.add(SinglePlayerContainer.of(player)); } } @Override public void removePlayer(@NonNull Player player) { CompetitorContainer container = getPlayingContainer(player); players.remove(player); if (isFfa()) { competitors.remove(container); } else { container.removePlayer(player); } } @Override public Iterator<Player> iterator() { return players.iterator(); } /** * Gets the {@link CompetitorContainer} of a player in the match. * * @param player The player. * @return The container of the player. */ public CompetitorContainer getPlayingContainer(@NonNull Player player) { if (!players.contains(player)) { throw new IllegalArgumentException("Cannot get CompetitorContainer of player not in match"); } else { for (CompetitorContainer container : competitors) { if (container.hasPlayer(player)) { return container; } } throw new IllegalStateException("Player is in match but is missing a CompetitorContainer."); } } }
CardinalDevelopment/Cardinal
src/main/java/in/twizmwaz/cardinal/match/Match.java
Java
bsd-2-clause
5,364
/* * Copyright (c) 2009-2010 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'jMonkeyEngine' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.jme3.asset; /** * Implementing the asset interface allows use of smart asset management. */ public interface Asset { public void setKey(AssetKey key); public AssetKey getKey(); }
chototsu/MikuMikuStudio
engine/src/core/com/jme3/asset/Asset.java
Java
bsd-2-clause
1,781
package mightypork.utils.math.constraints.num.caching; import mightypork.utils.math.constraints.num.Num; public class NumDigest { public final double value; public NumDigest(Num num) { this.value = num.value(); } @Override public String toString() { return String.format("Num(%.1f)", value); } }
MightyPork/mightyutils
src/mightypork/utils/math/constraints/num/caching/NumDigest.java
Java
bsd-2-clause
322
package com.olimpotec.busaoapp.action; import android.content.Context; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.widget.ImageView; import android.widget.TextView; import android.widget.ScrollView; import android.widget.RelativeLayout; import android.widget.PopupWindow.OnDismissListener; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup; import java.util.List; import java.util.ArrayList; import com.olimpotec.busaoapp.R; import com.olimpotec.busaoapp.helper.LogHelper; public class QuickAction extends PopupWindows implements OnDismissListener { private View mRootView; private ImageView mArrowUp; private ImageView mArrowDown; private LayoutInflater mInflater; private ViewGroup mTrack; private ScrollView mScroller; private OnActionItemClickListener mItemClickListener; private OnDismissListener mDismissListener; private List<ActionItem> actionItems = new ArrayList<ActionItem>(); private boolean mDidAction; private int mChildPos; private int mInsertPos; private int mAnimStyle; private int mOrientation; private int rootWidth=0; public static final int HORIZONTAL = 0; public static final int VERTICAL = 1; public static final int ANIM_GROW_FROM_LEFT = 1; public static final int ANIM_GROW_FROM_RIGHT = 2; public static final int ANIM_GROW_FROM_CENTER = 3; public static final int ANIM_REFLECT = 4; public static final int ANIM_AUTO = 5; /** * Constructor for default vertical layout * * @param context Context */ public QuickAction(Context context) { this(context, VERTICAL); } /** * Constructor allowing orientation override * * @param context Context * @param orientation Layout orientation, can be vartical or horizontal */ public QuickAction(Context context, int orientation) { super(context); mOrientation = orientation; mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (mOrientation == HORIZONTAL) { setRootViewId(R.layout.popup_horizontal); } else { setRootViewId(R.layout.popup_vertical); } mAnimStyle = ANIM_AUTO; mChildPos = 0; } /** * Get action item at an index * * @param index Index of item (position from callback) * * @return Action Item at the position */ public ActionItem getActionItem(int index) { return actionItems.get(index); } /** * Set root view. * * @param id Layout resource id */ public void setRootViewId(int id) { mRootView = (ViewGroup) mInflater.inflate(id, null); mTrack = (ViewGroup) mRootView.findViewById(R.id.tracks); mArrowDown = (ImageView) mRootView.findViewById(R.id.arrow_down); mArrowUp = (ImageView) mRootView.findViewById(R.id.arrow_up); mScroller = (ScrollView) mRootView.findViewById(R.id.scroller); //This was previously defined on show() method, moved here to prevent force close that occured //when tapping fastly on a view to show quickaction dialog. //Thanx to zammbi (github.com/zammbi) mRootView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); setContentView(mRootView); } /** * Set animation style * * @param mAnimStyle animation style, default is set to ANIM_AUTO */ public void setAnimStyle(int mAnimStyle) { this.mAnimStyle = mAnimStyle; } /** * Set listener for action item clicked. * * @param listener Listener */ public void setOnActionItemClickListener(OnActionItemClickListener listener) { mItemClickListener = listener; } /** * Add action item * * @param action {@link ActionItem} */ public void addActionItem(ActionItem action) { actionItems.add(action); String title = action.getTitle(); Drawable icon = action.getIcon(); int color = action.getColor(); View container; if (mOrientation == HORIZONTAL) { container = mInflater.inflate(R.layout.action_item_horizontal, null); } else { container = mInflater.inflate(R.layout.action_item_vertical, null); } ImageView img = (ImageView) container.findViewById(R.id.iv_icon); TextView text = (TextView) container.findViewById(R.id.tv_title); if (icon != null) { img.setImageDrawable(icon); } else { img.setVisibility(View.GONE); } if (title != null) { text.setText(title); } else { text.setVisibility(View.GONE); } if(color != -1) text.setTextColor(color); LogHelper.debug(this, "Color: "+color); final int pos = mChildPos; final int actionId = action.getActionId(); container.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mItemClickListener != null) { mItemClickListener.onItemClick(QuickAction.this, pos, actionId); } if (!getActionItem(pos).isSticky()) { mDidAction = true; dismiss(); } } }); container.setFocusable(true); container.setClickable(true); if (mOrientation == HORIZONTAL && mChildPos != 0) { View separator = mInflater.inflate(R.layout.horiz_separator, null); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT); separator.setLayoutParams(params); separator.setPadding(5, 0, 5, 0); mTrack.addView(separator, mInsertPos); mInsertPos++; } mTrack.addView(container, mInsertPos); mChildPos++; mInsertPos++; } /** * Show quickaction popup. Popup is automatically positioned, on top or bottom of anchor view. * */ public void show (View anchor) { preShow(); int xPos, yPos, arrowPos; mDidAction = false; int[] location = new int[2]; anchor.getLocationOnScreen(location); Rect anchorRect = new Rect(location[0], location[1], location[0] + anchor.getWidth(), location[1] + anchor.getHeight()); //mRootView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); mRootView.measure(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); int rootHeight = mRootView.getMeasuredHeight(); if (rootWidth == 0) { rootWidth = mRootView.getMeasuredWidth(); } int screenWidth = mWindowManager.getDefaultDisplay().getWidth(); int screenHeight = mWindowManager.getDefaultDisplay().getHeight(); //automatically get X coord of popup (top left) if ((anchorRect.left + rootWidth) > screenWidth) { xPos = anchorRect.left - (rootWidth-anchor.getWidth()); xPos = (xPos < 0) ? 0 : xPos; arrowPos = anchorRect.centerX()-xPos; } else { if (anchor.getWidth() > rootWidth) { xPos = anchorRect.centerX() - (rootWidth/2); } else { xPos = anchorRect.left; } arrowPos = anchorRect.centerX()-xPos; } int dyTop = anchorRect.top; int dyBottom = screenHeight - anchorRect.bottom; boolean onTop = (dyTop > dyBottom) ? true : false; if (onTop) { if (rootHeight > dyTop) { yPos = 15; LayoutParams l = mScroller.getLayoutParams(); l.height = dyTop - anchor.getHeight(); } else { yPos = anchorRect.top - rootHeight; } } else { yPos = anchorRect.bottom; if (rootHeight > dyBottom) { LayoutParams l = mScroller.getLayoutParams(); l.height = dyBottom; } } showArrow(((onTop) ? R.id.arrow_down : R.id.arrow_up), arrowPos); setAnimationStyle(screenWidth, anchorRect.centerX(), onTop); mWindow.showAtLocation(anchor, Gravity.NO_GRAVITY, xPos, yPos); } /** * Set animation style * * @param screenWidth screen width * @param requestedX distance from left edge * @param onTop flag to indicate where the popup should be displayed. Set TRUE if displayed on top of anchor view * and vice versa */ private void setAnimationStyle(int screenWidth, int requestedX, boolean onTop) { int arrowPos = requestedX - mArrowUp.getMeasuredWidth()/2; switch (mAnimStyle) { case ANIM_GROW_FROM_LEFT: mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Left : R.style.Animations_PopDownMenu_Left); break; case ANIM_GROW_FROM_RIGHT: mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Right : R.style.Animations_PopDownMenu_Right); break; case ANIM_GROW_FROM_CENTER: mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Center : R.style.Animations_PopDownMenu_Center); break; case ANIM_REFLECT: mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Reflect : R.style.Animations_PopDownMenu_Reflect); break; case ANIM_AUTO: if (arrowPos <= screenWidth/4) { mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Left : R.style.Animations_PopDownMenu_Left); } else if (arrowPos > screenWidth/4 && arrowPos < 3 * (screenWidth/4)) { mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Center : R.style.Animations_PopDownMenu_Center); } else { mWindow.setAnimationStyle((onTop) ? R.style.Animations_PopUpMenu_Right : R.style.Animations_PopDownMenu_Right); } break; } } /** * Show arrow * * @param whichArrow arrow type resource id * @param requestedX distance from left screen */ private void showArrow(int whichArrow, int requestedX) { final View showArrow = (whichArrow == R.id.arrow_up) ? mArrowUp : mArrowDown; final View hideArrow = (whichArrow == R.id.arrow_up) ? mArrowDown : mArrowUp; final int arrowWidth = mArrowUp.getMeasuredWidth(); showArrow.setVisibility(View.VISIBLE); ViewGroup.MarginLayoutParams param = (ViewGroup.MarginLayoutParams)showArrow.getLayoutParams(); param.leftMargin = requestedX - arrowWidth / 2; hideArrow.setVisibility(View.INVISIBLE); } /** * Set listener for window dismissed. This listener will only be fired if the quicakction dialog is dismissed * by clicking outside the dialog or clicking on sticky item. */ public void setOnDismissListener(QuickAction.OnDismissListener listener) { setOnDismissListener(this); mDismissListener = listener; } @Override public void onDismiss() { if (!mDidAction && mDismissListener != null) { mDismissListener.onDismiss(); } } /** * Listener for item click * */ public interface OnActionItemClickListener { public abstract void onItemClick(QuickAction source, int pos, int actionId); } /** * Listener for window dismiss * */ public interface OnDismissListener { public abstract void onDismiss(); } }
olimpotec/busaoapp
mobile/android/src/com/olimpotec/busaoapp/action/QuickAction.java
Java
bsd-2-clause
11,104
package test; import java.io.IOException; import java.sql.Date; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import model.CsvParser; import model.IParser; import model.Item; /** * @author MPI * @version 20.04.2014/1.1 */ public class CsvParserTest { public static void main(String[] args) { IParser p = new CsvParser(); try { SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); java.util.Date parsed = (java.util.Date) format.parse("20140320"); java.sql.Date minDate = new java.sql.Date(parsed.getTime()); ArrayList<Item> r = p.parseSpad("bcpp_data.csv", minDate); for(int i = 0; i< r.size(); i++){ System.out.println(r.get(i).toString()); } } catch (IOException | ParseException e) { e.printStackTrace(); } } }
mpi77/stix
src/test/CsvParserTest.java
Java
bsd-2-clause
816
/* * Copyright (c) 2016, asmateus * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package tank; /** * * @author asmateus */ public interface Descriptor { public void translate(Object o); }
asmateus/battle-city-game
src/tank/Descriptor.java
Java
bsd-2-clause
1,479
package cn.com.newcapec.citycard.common.po.base; import java.lang.Comparable; import java.io.Serializable; /** * This is an object that contains data related to the ADDRESS_NET_SITE table. * Do not modify this class because it will be overwritten if the configuration file * related to this class is modified. * * @hibernate.class * table="ADDRESS_NET_SITE" */ public abstract class BaseAddressNetSite implements Comparable, Serializable { public static String REF = "AddressNetSite"; public static String PROP_PHONE = "phone"; public static String PROP_NETID_P = "netidP"; public static String PROP_NETJP = "netjp"; public static String PROP_FAX = "fax"; public static String PROP_NETTYPE = "nettype"; public static String PROP_NETNAME = "netname"; public static String PROP_LIKEMAN = "likeman"; public static String PROP_EDIT_PERSON = "editPerson"; public static String PROP_NETID = "netid"; public static String PROP_VER = "ver"; public static String PROP_EDIT_DATE = "editDate"; public static String PROP_ADDRESS = "address"; public static String PROP_NETSTATUS = "netstatus"; public static String PROP_ID = "id"; public static String PROP_NETKIND = "netkind"; // constructors public BaseAddressNetSite () { initialize(); } /** * Constructor for primary key */ public BaseAddressNetSite (java.lang.String id) { this.setId(id); initialize(); } /** * Constructor for required fields */ public BaseAddressNetSite ( java.lang.String id, java.lang.String netid, java.lang.String netname, java.lang.String netstatus, java.lang.String nettype, java.lang.Integer ver, java.lang.String netidP, java.lang.String netkind, java.lang.String editPerson, java.util.Date editDate) { this.setId(id); this.setNetid(netid); this.setNetname(netname); this.setNetstatus(netstatus); this.setNettype(nettype); this.setVer(ver); this.setNetidP(netidP); this.setNetkind(netkind); this.setEditPerson(editPerson); this.setEditDate(editDate); initialize(); } protected void initialize () {} private int hashCode = Integer.MIN_VALUE; // primary key private java.lang.String id; // fields private java.lang.String netid; private java.lang.String netname; private java.lang.String netjp; private java.lang.String netstatus; private java.lang.String nettype; private java.lang.String likeman; private java.lang.String phone; private java.lang.String address; private java.lang.String fax; private java.lang.Integer ver; private java.lang.String netidP; private java.lang.String netkind; private java.lang.String editPerson; private java.util.Date editDate; /** * Return the unique identifier of this class * @hibernate.id * generator-class="uuid.hex" * column="ID" */ public java.lang.String getId () { return id; } /** * Set the unique identifier of this class * @param id the new ID */ public void setId (java.lang.String id) { this.id = id; this.hashCode = Integer.MIN_VALUE; } /** * Return the value associated with the column: NETID */ public java.lang.String getNetid () { return netid; } /** * Set the value related to the column: NETID * @param netid the NETID value */ public void setNetid (java.lang.String netid) { this.netid = netid; } /** * Return the value associated with the column: NETNAME */ public java.lang.String getNetname () { return netname; } /** * Set the value related to the column: NETNAME * @param netname the NETNAME value */ public void setNetname (java.lang.String netname) { this.netname = netname; } /** * Return the value associated with the column: NETJP */ public java.lang.String getNetjp () { return netjp; } /** * Set the value related to the column: NETJP * @param netjp the NETJP value */ public void setNetjp (java.lang.String netjp) { this.netjp = netjp; } /** * Return the value associated with the column: NETSTATUS */ public java.lang.String getNetstatus () { return netstatus; } /** * Set the value related to the column: NETSTATUS * @param netstatus the NETSTATUS value */ public void setNetstatus (java.lang.String netstatus) { this.netstatus = netstatus; } /** * Return the value associated with the column: NETTYPE */ public java.lang.String getNettype () { return nettype; } /** * Set the value related to the column: NETTYPE * @param nettype the NETTYPE value */ public void setNettype (java.lang.String nettype) { this.nettype = nettype; } /** * Return the value associated with the column: LIKEMAN */ public java.lang.String getLikeman () { return likeman; } /** * Set the value related to the column: LIKEMAN * @param likeman the LIKEMAN value */ public void setLikeman (java.lang.String likeman) { this.likeman = likeman; } /** * Return the value associated with the column: PHONE */ public java.lang.String getPhone () { return phone; } /** * Set the value related to the column: PHONE * @param phone the PHONE value */ public void setPhone (java.lang.String phone) { this.phone = phone; } /** * Return the value associated with the column: ADDRESS */ public java.lang.String getAddress () { return address; } /** * Set the value related to the column: ADDRESS * @param address the ADDRESS value */ public void setAddress (java.lang.String address) { this.address = address; } /** * Return the value associated with the column: FAX */ public java.lang.String getFax () { return fax; } /** * Set the value related to the column: FAX * @param fax the FAX value */ public void setFax (java.lang.String fax) { this.fax = fax; } /** * Return the value associated with the column: VER */ public java.lang.Integer getVer () { return ver; } /** * Set the value related to the column: VER * @param ver the VER value */ public void setVer (java.lang.Integer ver) { this.ver = ver; } /** * Return the value associated with the column: NETID_P */ public java.lang.String getNetidP () { return netidP; } /** * Set the value related to the column: NETID_P * @param netidP the NETID_P value */ public void setNetidP (java.lang.String netidP) { this.netidP = netidP; } /** * Return the value associated with the column: NETKIND */ public java.lang.String getNetkind () { return netkind; } /** * Set the value related to the column: NETKIND * @param netkind the NETKIND value */ public void setNetkind (java.lang.String netkind) { this.netkind = netkind; } /** * Return the value associated with the column: EDIT_PERSON */ public java.lang.String getEditPerson () { return editPerson; } /** * Set the value related to the column: EDIT_PERSON * @param editPerson the EDIT_PERSON value */ public void setEditPerson (java.lang.String editPerson) { this.editPerson = editPerson; } /** * Return the value associated with the column: EDIT_DATE */ public java.util.Date getEditDate () { return editDate; } /** * Set the value related to the column: EDIT_DATE * @param editDate the EDIT_DATE value */ public void setEditDate (java.util.Date editDate) { this.editDate = editDate; } public boolean equals (Object obj) { if (null == obj) return false; if (!(obj instanceof cn.com.newcapec.citycard.common.po.AddressNetSite)) return false; else { cn.com.newcapec.citycard.common.po.AddressNetSite addressNetSite = (cn.com.newcapec.citycard.common.po.AddressNetSite) obj; if (null == this.getId() || null == addressNetSite.getId()) return false; else return (this.getId().equals(addressNetSite.getId())); } } public int hashCode () { if (Integer.MIN_VALUE == this.hashCode) { if (null == this.getId()) return super.hashCode(); else { String hashStr = this.getClass().getName() + ":" + this.getId().hashCode(); this.hashCode = hashStr.hashCode(); } } return this.hashCode; } public int compareTo (Object obj) { if (obj.hashCode() > hashCode()) return 1; else if (obj.hashCode() < hashCode()) return -1; else return 0; } public String toString () { return super.toString(); } }
zhangjunfang/eclipse-dir
eCardCity2.0/0.card/src/cn/com/newcapec/citycard/common/po/base/BaseAddressNetSite.java
Java
bsd-2-clause
8,251
package net.herit.iot.onem2m.incse.manager.dao; import net.herit.iot.message.onem2m.OneM2mRequest.RESULT_CONT; import net.herit.iot.message.onem2m.OneM2mResponse.RESPONSE_STATUS; import net.herit.iot.onem2m.core.convertor.ConvertorFactory; import net.herit.iot.onem2m.core.convertor.DaoJSONConvertor; import net.herit.iot.onem2m.core.util.OneM2MException; import net.herit.iot.onem2m.incse.context.OneM2mContext; import net.herit.iot.onem2m.incse.facility.OneM2mUtil; import net.herit.iot.onem2m.incse.manager.dao.DAOInterface; import net.herit.iot.onem2m.incse.manager.dao.ResourceDAO; import net.herit.iot.onem2m.resource.Reboot; import net.herit.iot.onem2m.resource.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MgmtRebootDAO extends ResourceDAO implements DAOInterface { private Logger log = LoggerFactory.getLogger(MgmtRebootDAO.class); public MgmtRebootDAO(OneM2mContext context) { super(context); } @Override public String resourceToJson(Resource res) throws OneM2MException { try { DaoJSONConvertor<Reboot> jc = (DaoJSONConvertor<Reboot>)ConvertorFactory.getDaoJSONConvertor(Reboot.class, Reboot.SCHEMA_LOCATION); return jc.marshal((Reboot)res); } catch (Exception e) { log.debug("Handled exception", e); throw new OneM2MException(RESPONSE_STATUS.INTERNAL_SERVER_ERROR, "Json generation error:"+res.toString()); } } @Override public void create(Resource resource) throws OneM2MException { super.create(resource); } @Override public void update(Resource resource) throws OneM2MException { super.update(resource); } @Override public void delete(String id) throws OneM2MException { String resourceID = (String)this.getAttribute(OneM2mUtil.isUri(id) ? URI_KEY : RESID_KEY, id, RESID_KEY); deleteChild(resourceID); deleteDocument(OneM2mUtil.isUri(id) ? URI_KEY : RESID_KEY, id); } @Override public Resource retrieve(String id, RESULT_CONT rc) throws OneM2MException { return retrieve(OneM2mUtil.isUri(id) ? URI_KEY : RESID_KEY, id, (DaoJSONConvertor<Reboot>)ConvertorFactory.getDaoJSONConvertor(Reboot.class, Reboot.SCHEMA_LOCATION), rc); } }
iotoasis/SI
si-onem2m-src/IITP_IoT_2_7/src/main/java/net/herit/iot/onem2m/incse/manager/dao/MgmtRebootDAO.java
Java
bsd-2-clause
2,189
package vicnode.daris.femur.upload; import java.io.File; import java.util.Arrays; import arc.mf.client.ServerClient; import vicnode.daris.femur.upload.ArcUtil.ArcType; public class FemurUpload { public static final String PROJECT_CID = "1128.1.1"; private static String createDerivedDataset(String[] args) throws Throwable { String pid = null; String inputCid = null; String name = null; String description = null; String type = null; String ctype = null; String lctype = null; ArcType atype = null; String specimenType = null; String imageType = null; String filename = null; String[] tags = null; String input = System.getProperty("user.dir"); String source = StringUtil.substringAfter(input, "/Femur/"); if (source == null) { System.err.println("Failed to parse source from '" + input + "'."); System.exit(1); } boolean recursive = false; boolean fillin = false; for (int i = 0; i < args.length;) { if ("--pid".equals(args[i])) { pid = args[i + 1]; i += 2; } else if ("--input-cid".equals(args[i])) { inputCid = args[i + 1]; i += 2; if ("null".equalsIgnoreCase(inputCid)) { inputCid = null; } } else if ("--name".equals(args[i])) { name = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--description".equals(args[i])) { description = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--type".equals(args[i])) { type = args[i + 1]; i += 2; } else if ("--ctype".equals(args[i])) { ctype = args[i + 1]; i += 2; } else if ("--lctype".equals(args[i])) { lctype = args[i + 1]; i += 2; } else if ("--atype".equals(args[i])) { atype = ArcType.valueOf(args[i + 1].toLowerCase()); i += 2; } else if ("--specimen-type".equals(args[i])) { specimenType = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--image-type".equals(args[i])) { imageType = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--tags".equals(args[i])) { tags = StringUtil.trimDoubleQuotes(args[i + 1]).split(","); i += 2; } else if ("--filename".equals(args[i])) { filename = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--recursive".equals(args[i])) { recursive = true; i++; } else if ("--fillin".equals(args[i])) { fillin = true; i++; } else { System.err.println("Error: unexpected argument: " + args[i]); i++; } } if (pid == null) { System.err.println("Error: missing argument --pid"); printUsage("create", "derivation"); System.exit(1); } File f = new File(input); if (!f.exists()) { System.err.println("Error: " + input + " does not exist."); printUsage("create", "derivation"); System.exit(1); } ServerClient.Connection cxn = Server.connect(); try { String datasetCid = DatasetUtil.findDatasetBySource(cxn, pid, source); if (datasetCid != null) { System.out.println("dataset " + datasetCid + " created from " + source + " already exists."); } else { datasetCid = DatasetUtil.createDerivedDataset(cxn, pid, inputCid == null ? null : new String[] { inputCid }, name, description, type, ctype, lctype, filename, source, tags, specimenType, imageType, f, recursive, atype, fillin); } return datasetCid; } finally { Server.disconnect(); } } private static String createPrimaryDataset(String[] args) throws Throwable { String pid = null; String name = null; String description = null; String type = null; String ctype = null; String lctype = null; ArcType atype = null; String specimenType = null; String imageType = null; String filename = null; String[] tags = null; String input = System.getProperty("user.dir"); String source = StringUtil.substringAfter(input, "/Femur/"); if (source == null) { System.err.println("Failed to parse source from '" + input + "'."); System.exit(1); } boolean recursive = false; boolean fillin = false; for (int i = 0; i < args.length;) { if ("--pid".equals(args[i])) { pid = args[i + 1]; i += 2; } else if ("--name".equals(args[i])) { name = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--description".equals(args[i])) { description = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--type".equals(args[i])) { type = args[i + 1]; i += 2; } else if ("--ctype".equals(args[i])) { ctype = args[i + 1]; i += 2; } else if ("--lctype".equals(args[i])) { lctype = args[i + 1]; i += 2; } else if ("--atype".equals(args[i])) { atype = ArcType.valueOf(args[i + 1].toLowerCase()); i += 2; } else if ("--specimen-type".equals(args[i])) { specimenType = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--image-type".equals(args[i])) { imageType = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--tags".equals(args[i])) { tags = StringUtil.trimDoubleQuotes(args[i + 1]).split(","); i += 2; } else if ("--filename".equals(args[i])) { filename = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--recursive".equals(args[i])) { recursive = true; i++; } else if ("--fillin".equals(args[i])) { fillin = true; i++; } else { System.err.println("Error: unexpected argument: " + args[i]); i++; } } if (pid == null) { System.err.println("Error: missing argument --pid"); printUsage("create", "primary"); System.exit(1); } File f = new File(input); if (!f.exists()) { System.err.println("Error: " + input + " does not exist."); printUsage("create", "primary"); System.exit(1); } ServerClient.Connection cxn = Server.connect(); try { String datasetCid = DatasetUtil.findDatasetBySource(cxn, pid, source); if (datasetCid != null) { System.out.println("dataset " + datasetCid + " created from " + source + " already exists."); } else { datasetCid = DatasetUtil.createPrimaryDataset(cxn, pid, name, description, type, ctype, lctype, filename, source, tags, specimenType, imageType, f, recursive, atype, fillin); } return datasetCid; } finally { Server.disconnect(); } } private static String createStudy(String[] args) throws Throwable { String specimenNo = null; String name = null; String description = null; String step = null; String studyType = null; String[] tags = null; boolean checkExistence = false; for (int i = 0; i < args.length;) { if ("--specimen-no".equals(args[i])) { specimenNo = args[i + 1]; i += 2; } else if ("--name".equals(args[i])) { name = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--description".equals(args[i])) { description = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--step".equals(args[i])) { step = args[i + 1]; i += 2; } else if ("--study-type".equals(args[i])) { studyType = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--tags".equals(args[i])) { tags = StringUtil.trimDoubleQuotes(args[i + 1]).split(","); i += 2; } else if ("--check-existence".equals(args[i])) { checkExistence = true; i++; } else { System.err.println( "Unexpected argument: " + args[i] + ". Ignored."); i++; } } if (specimenNo == null) { System.err.println("Error: missing argument --specimen-no."); printUsage("create", "study"); System.exit(1); } String exMethodId = PROJECT_CID + "." + specimenNo + ".1"; if (step == null && studyType == null) { System.err.println( "Error: missing arguments. Either --step or --type must be specified."); printUsage("create", "study"); System.exit(1); } MasterSpreadsheet.SubjectRecord record = LocalFileSystem .getMasterSpreadsheet().getRecord(Integer.parseInt(specimenNo)); if (record == null) { throw new Exception("No record found for specimen number: " + specimenNo + " in master spreadsheet."); } ServerClient.Connection cxn = Server.connect(); try { String studyCid; if (checkExistence) { studyCid = StudyUtil.findOrCreateStudy(cxn, exMethodId, step, name, description, record, tags); } else { studyCid = StudyUtil.createStudy(cxn, exMethodId, step, name, description, record, tags); } return studyCid; } finally { Server.disconnect(); } } public static void main(String[] args) throws Throwable { if (args == null || args.length < 2) { printUsage(null, null); System.exit(1); } String action = args[0]; String objectType = args[1]; if ("create".equalsIgnoreCase(action)) { if ("study".equalsIgnoreCase(objectType)) { String cid = createStudy( Arrays.copyOfRange(args, 2, args.length)); System.out.println("Created study: " + cid); } else if ("primary".equalsIgnoreCase(objectType)) { String cid = createPrimaryDataset( Arrays.copyOfRange(args, 2, args.length)); System.out.println("Created primary dataset: " + cid); } else if ("derivation".equalsIgnoreCase(objectType)) { String cid = createDerivedDataset( Arrays.copyOfRange(args, 2, args.length)); System.out.println("Created derivated dataset: " + cid); } else { System.err.println("Error: invalid object type: " + objectType); printUsage("create", null); System.exit(1); } } else if ("update".equalsIgnoreCase(action)) { if ("study".equalsIgnoreCase(objectType)) { updateStudy(Arrays.copyOfRange(args, 2, args.length)); } else if ("primary".equalsIgnoreCase(objectType)) { updatePrimaryDataset(Arrays.copyOfRange(args, 2, args.length)); } else if ("derivation".equalsIgnoreCase(objectType)) { updateDerivedDataset(Arrays.copyOfRange(args, 2, args.length)); } else { System.err.println("Error: invalid object type: " + objectType); printUsage("update", null); System.exit(1); } } else { System.err.println("Error: invalid action: " + action); printUsage(null, null); System.exit(1); } } private static void printUsage(String action, String objectType) { if (action == null) { System.out.println( "Usage: <create|update> <study|primary|derivation> [options]"); return; } if (objectType == null) { System.out.println("Usage: " + action + " <study|primary|derivation> [options]"); return; } System.out .println("Usage: " + action + " " + objectType + " [options]"); System.out.println("Options:"); if ("create".equalsIgnoreCase(action)) { if ("study".equalsIgnoreCase(objectType)) { System.out.println( " --specimen-no <number> The specimen number of the subject."); System.out.println( " --name <name> The name of the study."); System.out.println( " --description <description> The description of the study."); System.out.println( " --step <step> The method step of the study."); System.out.println( " --study-type <type> The study type."); System.out.println( " --tags <tag1,tag2> The tags for the study. Separated with comma."); System.out.println( " --check-existence If given it will check for existing study and ignore if the study with the same name exists."); } else if ("primary".equalsIgnoreCase(objectType)) { System.out.println( " --pid <study-cid> The citeable id of the parent study."); System.out.println( " --name <name> The name of the dataset."); System.out.println( " --description <description> The description of the dataset."); System.out.println( " --type <type> The mime type of the dataset."); System.out.println( " --ctype <type> The content mime type of the dataset."); System.out.println( " --lctype <type> The logical content mime type of the dataset."); System.out.println( " --specimen-type <specimen-type> The femur specimen type of the dataset."); System.out.println( " --image-type <image-type> The femur image type of the dataset."); System.out.println( " --filename <filename> The name for the content file."); System.out.println( " --tags <tag1,tag2> The tags for the dataset. Separated with comma."); System.out.println( " --atype <archive-type> The content archive type. Must be aar or zip."); System.out.println( " --recursive If specified, include the input directory recursively."); System.out.println( " --fillin If specified, fill in the cid gap when creating dataset."); } else if ("derivation".equalsIgnoreCase(objectType)) { System.out.println( " --pid <study-cid> The citeable id of the parent study."); System.out.println( " --input-cid <cid> The citeable id of the input dataset."); System.out.println( " --name <name> The name of the dataset."); System.out.println( " --description <description> The description of the dataset."); System.out.println( " --type <type> The mime type of the dataset."); System.out.println( " --ctype <type> The content mime type of the dataset."); System.out.println( " --lctype <type> The logical content mime type of the dataset."); System.out.println( " --specimen-type <specimen-type> The femur specimen type of the dataset."); System.out.println( " --image-type <image-type> The femur image type of the dataset."); System.out.println( " --filename <filename> The name for the content file."); System.out.println( " --tags <tag1,tag2> The tags for the dataset. Separated with comma."); System.out.println( " --atype <archive-type> The content archive type. Must be aar or zip."); System.out.println( " --recursive If specified, include the input directory recursively."); System.out.println( " --fillin If specified, fill in the cid gap when creating dataset."); } } if ("update".equalsIgnoreCase(action)) { if ("study".equalsIgnoreCase(objectType)) { System.out.println( " --cid <cid> The citeable id of the dataset."); System.out.println( " --name <name> The name of the dataset."); System.out.println( " --description <description> The description of the dataset."); System.out.println( " --tags <tag1,tag2> The tags for the dataset. Separated with comma."); } else if ("primary".equalsIgnoreCase(objectType)) { System.out.println( " --cid <cid> The citeable id of the dataset."); System.out.println( " --name <name> The name of the dataset."); System.out.println( " --description <description> The description of the dataset."); System.out.println( " --type <type> The mime type of the dataset."); System.out.println( " --specimen-type <specimen-type> The femur specimen type of the dataset."); System.out.println( " --image-type <image-type> The femur image type of the dataset."); System.out.println( " --filename <filename> The name for the content file."); System.out.println( " --tags <tag1,tag2> The tags for the dataset. Separated with comma."); } else if ("derivation".equalsIgnoreCase(objectType)) { System.out.println( " --cid <cid> The citeable id of the dataset."); System.out.println( " --name <name> The name of the dataset."); System.out.println( " --description <description> The description of the dataset."); System.out.println( " --type <type> The mime type of the dataset."); System.out.println( " --specimen-type <specimen-type> The femur specimen type of the dataset."); System.out.println( " --image-type <image-type> The femur image type of the dataset."); System.out.println( " --filename <filename> The name for the content file."); System.out.println( " --tags <tag1,tag2> The tags for the dataset. Separated with comma."); } } } private static void updateDerivedDataset(String[] args) throws Throwable { String input = System.getProperty("user.dir"); String source = StringUtil.substringAfter(input, "/Femur/"); if (source == null) { System.err.println("Failed to parse source from '" + input + "'."); System.exit(1); } String cid = null; String name = null; String description = null; String type = null; String specimenType = null; String imageType = null; String filename = null; String[] tags = null; for (int i = 0; i < args.length;) { if ("--cid".equals(args[i])) { cid = args[i + 1]; i += 2; } else if ("--name".equals(args[i])) { name = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(name)) { name = null; } i += 2; } else if ("--description".equals(args[i])) { description = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(description)) { description = null; } i += 2; } else if ("--type".equals(args[i])) { type = args[i + 1]; if ("null".equalsIgnoreCase(type)) { type = null; } i += 2; } else if ("--specimen-type".equals(args[i])) { specimenType = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(specimenType)) { specimenType = null; } i += 2; } else if ("--image-type".equals(args[i])) { imageType = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(imageType)) { imageType = null; } i += 2; } else if ("--tags".equals(args[i])) { String t = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(t)) { tags = null; } else { tags = t.split(","); } i += 2; } else if ("--filename".equals(args[i])) { filename = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(filename)) { filename = null; } i += 2; } else { System.err.println("Error: unexpected argument: " + args[i]); i++; } } if (cid == null) { System.err.println("Error: missing argument --cid"); printUsage("update", "primary"); System.exit(1); } ServerClient.Connection cxn = Server.connect(); try { DatasetUtil.updateDerivedDataset(cxn, cid, name, description, type, filename, source, tags, specimenType, imageType); } finally { Server.disconnect(); } } private static void updatePrimaryDataset(String[] args) throws Throwable { String input = System.getProperty("user.dir"); String source = StringUtil.substringAfter(input, "/Femur/"); if (source == null) { System.err.println("Failed to parse source from '" + input + "'."); System.exit(1); } String cid = null; String name = null; String description = null; String type = null; String specimenType = null; String imageType = null; String filename = null; String[] tags = null; for (int i = 0; i < args.length;) { if ("--cid".equals(args[i])) { cid = args[i + 1]; i += 2; } else if ("--name".equals(args[i])) { name = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(name)) { name = null; } i += 2; } else if ("--description".equals(args[i])) { description = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(description)) { description = null; } i += 2; } else if ("--type".equals(args[i])) { type = args[i + 1]; if ("null".equalsIgnoreCase(type)) { type = null; } i += 2; } else if ("--specimen-type".equals(args[i])) { specimenType = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(specimenType)) { specimenType = null; } i += 2; } else if ("--image-type".equals(args[i])) { imageType = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(imageType)) { imageType = null; } i += 2; } else if ("--tags".equals(args[i])) { String t = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(t)) { tags = null; } else { tags = t.split(","); } i += 2; } else if ("--filename".equals(args[i])) { filename = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(filename)) { filename = null; } i += 2; } else { System.err.println("Error: unexpected argument: " + args[i]); i++; } } if (cid == null) { System.err.println("Error: missing argument --cid"); printUsage("update", "primary"); System.exit(1); } ServerClient.Connection cxn = Server.connect(); try { DatasetUtil.updatePrimaryDataset(cxn, cid, name, description, type, filename, source, tags, specimenType, imageType); } finally { Server.disconnect(); } } private static void updateStudy(String[] args) throws Throwable { String cid = null; String name = null; String description = null; String[] tags = null; for (int i = 0; i < args.length;) { if ("--cid".equals(args[i])) { cid = args[i + 1]; i += 2; } else if ("--name".equals(args[i])) { name = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--description".equals(args[i])) { description = StringUtil.trimDoubleQuotes(args[i + 1]); i += 2; } else if ("--tags".equals(args[i])) { String t = StringUtil.trimDoubleQuotes(args[i + 1]); if ("null".equalsIgnoreCase(t)) { tags = null; } else { tags = t.split(","); } i += 2; } else { System.err.println( "Unexpected argument: " + args[i] + ". Ignored."); i++; } } if (cid == null) { System.err.println("Error: missing argument --cid."); printUsage("update", "study"); System.exit(1); } String specimenNo = CidUtil.getLastPart(CidUtil.getParentCid(cid, 2)); MasterSpreadsheet.SubjectRecord record = LocalFileSystem .getMasterSpreadsheet().getRecord(Integer.parseInt(specimenNo)); if (record == null) { throw new Exception("No record found for specimen number: " + specimenNo + " in master spreadsheet."); } ServerClient.Connection cxn = Server.connect(); try { StudyUtil.updateStudy(cxn, cid, name, description, record, tags); } finally { Server.disconnect(); } } }
uom-daris/daris-femur-upload
src/main/java/vicnode/daris/femur/upload/FemurUpload.java
Java
bsd-2-clause
30,144
/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 3.0.7 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ package rhcad.touchvg.core; public class touchvgJNI { public final static native float _MGZERO_get(); public final static native float _M_E_get(); public final static native float _M_LOG2E_get(); public final static native float _M_LOG10E_get(); public final static native float _M_LN2_get(); public final static native float _M_LN10_get(); public final static native float _M_PI_get(); public final static native float _M_PI_2_get(); public final static native float _M_PI_4_get(); public final static native float _M_1_PI_get(); public final static native float _M_2_PI_get(); public final static native float _M_2_SQRTPI_get(); public final static native float _M_SQRT2_get(); public final static native float _M_SQRT1_2_get(); public final static native float _M_2PI_get(); public final static native float _M_PI_3_get(); public final static native float _M_PI_6_get(); public final static native float _M_D2R_get(); public final static native float _M_R2D_get(); public final static native float _M_1_SQRPI_get(); public final static native float _FLT_MIN_get(); public final static native float _FLT_MAX_get(); public final static native long Tol_gTol(); public final static native long Tol_minTol(); public final static native long new_Tol__SWIG_0(); public final static native long new_Tol__SWIG_1(float jarg1, float jarg2); public final static native long new_Tol__SWIG_2(float jarg1); public final static native float Tol_equalPoint(long jarg1, Tol jarg1_); public final static native float Tol_equalVector(long jarg1, Tol jarg1_); public final static native void Tol_setEqualPoint(long jarg1, Tol jarg1_, float jarg2); public final static native void Tol_setEqualVector(long jarg1, Tol jarg1_, float jarg2); public final static native void delete_Tol(long jarg1); public final static native void Vector2d_x_set(long jarg1, Vector2d jarg1_, float jarg2); public final static native float Vector2d_x_get(long jarg1, Vector2d jarg1_); public final static native void Vector2d_y_set(long jarg1, Vector2d jarg1_, float jarg2); public final static native float Vector2d_y_get(long jarg1, Vector2d jarg1_); public final static native long Vector2d_kIdentity(); public final static native long Vector2d_kXAxis(); public final static native long Vector2d_kYAxis(); public final static native long new_Vector2d__SWIG_0(); public final static native long new_Vector2d__SWIG_1(float jarg1, float jarg2); public final static native long new_Vector2d__SWIG_2(long jarg1, Vector2d jarg1_); public final static native long Vector2d_transform(long jarg1, Vector2d jarg1_, long jarg2, Matrix2d jarg2_); public final static native long Vector2d_add(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Vector2d_subtract(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Vector2d_negate(long jarg1, Vector2d jarg1_); public final static native long Vector2d_perpVector(long jarg1, Vector2d jarg1_); public final static native long Vector2d_scaleBy__SWIG_0(long jarg1, Vector2d jarg1_, float jarg2, float jarg3); public final static native long Vector2d_scaleBy__SWIG_1(long jarg1, Vector2d jarg1_, float jarg2); public final static native float Vector2d_dotProduct(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native float Vector2d_crossProduct(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native float Vector2d_angle(long jarg1, Vector2d jarg1_); public final static native float Vector2d_angle2(long jarg1, Vector2d jarg1_); public final static native float Vector2d_angleTo(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native float Vector2d_angleTo2(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native float Vector2d_length(long jarg1, Vector2d jarg1_); public final static native float Vector2d_lengthSquare(long jarg1, Vector2d jarg1_); public final static native long Vector2d_unitVector(long jarg1, Vector2d jarg1_); public final static native boolean Vector2d_normalize__SWIG_0(long jarg1, Vector2d jarg1_, long jarg2, Tol jarg2_); public final static native boolean Vector2d_normalize__SWIG_1(long jarg1, Vector2d jarg1_); public final static native boolean Vector2d_isUnitVector__SWIG_0(long jarg1, Vector2d jarg1_, long jarg2, Tol jarg2_); public final static native boolean Vector2d_isUnitVector__SWIG_1(long jarg1, Vector2d jarg1_); public final static native boolean Vector2d_isZeroVector__SWIG_0(long jarg1, Vector2d jarg1_, long jarg2, Tol jarg2_); public final static native boolean Vector2d_isZeroVector__SWIG_1(long jarg1, Vector2d jarg1_); public final static native boolean Vector2d_isDegenerate(long jarg1, Vector2d jarg1_); public final static native boolean Vector2d_isEqualTo__SWIG_0(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Tol jarg3_); public final static native boolean Vector2d_isEqualTo__SWIG_1(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Vector2d_set__SWIG_0(long jarg1, Vector2d jarg1_, float jarg2, float jarg3); public final static native long Vector2d_set__SWIG_1(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Vector2d_setAngleLength(long jarg1, Vector2d jarg1_, float jarg2, float jarg3); public final static native long Vector2d_angledVector(float jarg1, float jarg2); public final static native long Vector2d_setLength(long jarg1, Vector2d jarg1_, float jarg2); public final static native long Vector2d_scaledVector(long jarg1, Vector2d jarg1_, float jarg2); public final static native boolean Vector2d_isRightOf(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native boolean Vector2d_isLeftOf(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native boolean Vector2d_isParallelTo__SWIG_0(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Tol jarg3_); public final static native boolean Vector2d_isParallelTo__SWIG_1(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native boolean Vector2d_isCodirectionalTo__SWIG_0(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Tol jarg3_); public final static native boolean Vector2d_isCodirectionalTo__SWIG_1(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native boolean Vector2d_isOppositeTo__SWIG_0(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Tol jarg3_); public final static native boolean Vector2d_isOppositeTo__SWIG_1(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native boolean Vector2d_isPerpendicularTo__SWIG_0(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Tol jarg3_); public final static native boolean Vector2d_isPerpendicularTo__SWIG_1(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native float Vector2d_distanceToVector(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native float Vector2d_projectScaleToVector(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_); public final static native float Vector2d_projectResolveVector(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Vector2d jarg3_, long jarg4, Vector2d jarg4_); public final static native boolean Vector2d_resolveVector__SWIG_0(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Vector2d jarg3_, long jarg4, Vector2d jarg4_); public final static native boolean Vector2d_resolveVector__SWIG_1(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Vector2d jarg3_); public final static native void delete_Vector2d(long jarg1); public final static native void Point2d_x_set(long jarg1, Point2d jarg1_, float jarg2); public final static native float Point2d_x_get(long jarg1, Point2d jarg1_); public final static native void Point2d_y_set(long jarg1, Point2d jarg1_, float jarg2); public final static native float Point2d_y_get(long jarg1, Point2d jarg1_); public final static native long Point2d_kInvalid(); public final static native long Point2d_kOrigin(); public final static native long new_Point2d__SWIG_0(); public final static native long new_Point2d__SWIG_1(float jarg1, float jarg2); public final static native long new_Point2d__SWIG_2(long jarg1, Point2d jarg1_); public final static native long Point2d_transform(long jarg1, Point2d jarg1_, long jarg2, Matrix2d jarg2_); public final static native long Point2d_scaleBy__SWIG_0(long jarg1, Point2d jarg1_, float jarg2, float jarg3); public final static native long Point2d_scaleBy__SWIG_1(long jarg1, Point2d jarg1_, float jarg2); public final static native void Point2d_offset__SWIG_0(long jarg1, Point2d jarg1_, float jarg2, float jarg3); public final static native void Point2d_offset__SWIG_1(long jarg1, Point2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Point2d_add(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_); public final static native long Point2d_subtract__SWIG_0(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_); public final static native long Point2d_subtract__SWIG_1(long jarg1, Point2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Point2d_negate(long jarg1, Point2d jarg1_); public final static native long Point2d_asVector(long jarg1, Point2d jarg1_); public final static native float Point2d_length(long jarg1, Point2d jarg1_); public final static native float Point2d_distanceTo(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_); public final static native float Point2d_distanceSquare(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_); public final static native boolean Point2d_isEqualTo__SWIG_0(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Tol jarg3_); public final static native boolean Point2d_isEqualTo__SWIG_1(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_); public final static native boolean Point2d_isDegenerate(long jarg1, Point2d jarg1_); public final static native long Point2d_set__SWIG_0(long jarg1, Point2d jarg1_, float jarg2, float jarg3); public final static native long Point2d_set__SWIG_1(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_); public final static native long Point2d_polarPoint(long jarg1, Point2d jarg1_, float jarg2, float jarg3); public final static native long Point2d_rulerPoint__SWIG_0(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, float jarg3); public final static native long Point2d_rulerPoint__SWIG_1(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, float jarg3, float jarg4); public final static native void delete_Point2d(long jarg1); public final static native void Matrix2d_m11_set(long jarg1, Matrix2d jarg1_, float jarg2); public final static native float Matrix2d_m11_get(long jarg1, Matrix2d jarg1_); public final static native void Matrix2d_m12_set(long jarg1, Matrix2d jarg1_, float jarg2); public final static native float Matrix2d_m12_get(long jarg1, Matrix2d jarg1_); public final static native void Matrix2d_m21_set(long jarg1, Matrix2d jarg1_, float jarg2); public final static native float Matrix2d_m21_get(long jarg1, Matrix2d jarg1_); public final static native void Matrix2d_m22_set(long jarg1, Matrix2d jarg1_, float jarg2); public final static native float Matrix2d_m22_get(long jarg1, Matrix2d jarg1_); public final static native void Matrix2d_dx_set(long jarg1, Matrix2d jarg1_, float jarg2); public final static native float Matrix2d_dx_get(long jarg1, Matrix2d jarg1_); public final static native void Matrix2d_dy_set(long jarg1, Matrix2d jarg1_, float jarg2); public final static native float Matrix2d_dy_get(long jarg1, Matrix2d jarg1_); public final static native long Matrix2d_kIdentity(); public final static native long new_Matrix2d__SWIG_0(); public final static native long new_Matrix2d__SWIG_1(long jarg1, Matrix2d jarg1_); public final static native long new_Matrix2d__SWIG_2(float jarg1, float jarg2, float jarg3, float jarg4, float jarg5, float jarg6); public final static native long new_Matrix2d__SWIG_3(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Point2d jarg3_); public final static native long Matrix2d_scaleBy__SWIG_0(long jarg1, Matrix2d jarg1_, float jarg2, float jarg3); public final static native long Matrix2d_scaleBy__SWIG_1(long jarg1, Matrix2d jarg1_, float jarg2); public final static native long Matrix2d_preMultBy(long jarg1, Matrix2d jarg1_, long jarg2, Matrix2d jarg2_); public final static native long Matrix2d_postMultBy(long jarg1, Matrix2d jarg1_, long jarg2, Matrix2d jarg2_); public final static native long Matrix2d_setToProduct(long jarg1, Matrix2d jarg1_, long jarg2, Matrix2d jarg2_, long jarg3, Matrix2d jarg3_); public final static native void Matrix2d_transformPoints(long jarg1, Matrix2d jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native void Matrix2d_transformVectors(long jarg1, Matrix2d jarg1_, int jarg2, long jarg3, Vector2d jarg3_); public final static native float Matrix2d_det(long jarg1, Matrix2d jarg1_); public final static native boolean Matrix2d_invert(long jarg1, Matrix2d jarg1_); public final static native long Matrix2d_inverse(long jarg1, Matrix2d jarg1_); public final static native boolean Matrix2d_isInvertible(long jarg1, Matrix2d jarg1_); public final static native float Matrix2d_scale(long jarg1, Matrix2d jarg1_); public final static native float Matrix2d_scaleX(long jarg1, Matrix2d jarg1_); public final static native float Matrix2d_scaleY(long jarg1, Matrix2d jarg1_); public final static native float Matrix2d_angle(long jarg1, Matrix2d jarg1_); public final static native boolean Matrix2d_isEqualTo__SWIG_0(long jarg1, Matrix2d jarg1_, long jarg2, Matrix2d jarg2_, long jarg3, Tol jarg3_); public final static native boolean Matrix2d_isEqualTo__SWIG_1(long jarg1, Matrix2d jarg1_, long jarg2, Matrix2d jarg2_); public final static native boolean Matrix2d_isIdentity(long jarg1, Matrix2d jarg1_); public final static native boolean Matrix2d_isOrtho(long jarg1, Matrix2d jarg1_); public final static native boolean Matrix2d_hasMirror(long jarg1, Matrix2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Matrix2d_setCoordSystem(long jarg1, Matrix2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Vector2d jarg3_, long jarg4, Point2d jarg4_); public final static native void Matrix2d_getCoordSystem(long jarg1, Matrix2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Vector2d jarg3_, long jarg4, Point2d jarg4_); public final static native long Matrix2d_coordSystem__SWIG_0(long jarg1, Vector2d jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Point2d jarg3_); public final static native long Matrix2d_coordSystem__SWIG_1(long jarg1, Point2d jarg1_, float jarg2, float jarg3, float jarg4); public final static native long Matrix2d_coordSystem__SWIG_2(long jarg1, Point2d jarg1_, float jarg2, float jarg3); public final static native long Matrix2d_coordSystem__SWIG_3(long jarg1, Point2d jarg1_, float jarg2); public final static native long Matrix2d_setToIdentity(long jarg1, Matrix2d jarg1_); public final static native long Matrix2d_set(long jarg1, Matrix2d jarg1_, float jarg2, float jarg3, float jarg4, float jarg5, float jarg6, float jarg7); public final static native long Matrix2d_setToTranslation(long jarg1, Matrix2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Matrix2d_setToRotation__SWIG_0(long jarg1, Matrix2d jarg1_, float jarg2, long jarg3, Point2d jarg3_); public final static native long Matrix2d_setToRotation__SWIG_1(long jarg1, Matrix2d jarg1_, float jarg2); public final static native long Matrix2d_setToScaling__SWIG_0(long jarg1, Matrix2d jarg1_, float jarg2, long jarg3, Point2d jarg3_); public final static native long Matrix2d_setToScaling__SWIG_1(long jarg1, Matrix2d jarg1_, float jarg2); public final static native long Matrix2d_setToScaling__SWIG_2(long jarg1, Matrix2d jarg1_, float jarg2, float jarg3, long jarg4, Point2d jarg4_); public final static native long Matrix2d_setToScaling__SWIG_3(long jarg1, Matrix2d jarg1_, float jarg2, float jarg3); public final static native long Matrix2d_setToMirroring__SWIG_0(long jarg1, Matrix2d jarg1_, long jarg2, Point2d jarg2_); public final static native long Matrix2d_setToMirroring__SWIG_1(long jarg1, Matrix2d jarg1_); public final static native long Matrix2d_setToMirroring__SWIG_2(long jarg1, Matrix2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Vector2d jarg3_); public final static native long Matrix2d_setToShearing__SWIG_0(long jarg1, Matrix2d jarg1_, float jarg2, float jarg3, long jarg4, Point2d jarg4_); public final static native long Matrix2d_setToShearing__SWIG_1(long jarg1, Matrix2d jarg1_, float jarg2, float jarg3); public final static native long Matrix2d_translation(long jarg1, Vector2d jarg1_); public final static native long Matrix2d_rotation__SWIG_0(float jarg1, long jarg2, Point2d jarg2_); public final static native long Matrix2d_rotation__SWIG_1(float jarg1); public final static native long Matrix2d_scaling__SWIG_0(float jarg1, long jarg2, Point2d jarg2_); public final static native long Matrix2d_scaling__SWIG_1(float jarg1); public final static native long Matrix2d_scaling__SWIG_2(float jarg1, float jarg2, long jarg3, Point2d jarg3_); public final static native long Matrix2d_scaling__SWIG_3(float jarg1, float jarg2); public final static native long Matrix2d_mirroring__SWIG_0(long jarg1, Point2d jarg1_); public final static native long Matrix2d_mirroring__SWIG_1(); public final static native long Matrix2d_mirroring__SWIG_2(long jarg1, Point2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Matrix2d_shearing__SWIG_0(float jarg1, float jarg2, long jarg3, Point2d jarg3_); public final static native long Matrix2d_shearing__SWIG_1(float jarg1, float jarg2); public final static native long Matrix2d_transformWith2P(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native void delete_Matrix2d(long jarg1); public final static native void RECT_2D_left_set(long jarg1, RECT_2D jarg1_, float jarg2); public final static native float RECT_2D_left_get(long jarg1, RECT_2D jarg1_); public final static native void RECT_2D_top_set(long jarg1, RECT_2D jarg1_, float jarg2); public final static native float RECT_2D_top_get(long jarg1, RECT_2D jarg1_); public final static native void RECT_2D_right_set(long jarg1, RECT_2D jarg1_, float jarg2); public final static native float RECT_2D_right_get(long jarg1, RECT_2D jarg1_); public final static native void RECT_2D_bottom_set(long jarg1, RECT_2D jarg1_, float jarg2); public final static native float RECT_2D_bottom_get(long jarg1, RECT_2D jarg1_); public final static native long new_RECT_2D(); public final static native float RECT_2D_width(long jarg1, RECT_2D jarg1_); public final static native float RECT_2D_height(long jarg1, RECT_2D jarg1_); public final static native void delete_RECT_2D(long jarg1); public final static native void Box2d_xmin_set(long jarg1, Box2d jarg1_, float jarg2); public final static native float Box2d_xmin_get(long jarg1, Box2d jarg1_); public final static native void Box2d_ymin_set(long jarg1, Box2d jarg1_, float jarg2); public final static native float Box2d_ymin_get(long jarg1, Box2d jarg1_); public final static native void Box2d_xmax_set(long jarg1, Box2d jarg1_, float jarg2); public final static native float Box2d_xmax_get(long jarg1, Box2d jarg1_); public final static native void Box2d_ymax_set(long jarg1, Box2d jarg1_, float jarg2); public final static native float Box2d_ymax_get(long jarg1, Box2d jarg1_); public final static native long Box2d_kIdentity(); public final static native long new_Box2d__SWIG_0(); public final static native long new_Box2d__SWIG_1(long jarg1, Box2d jarg1_, boolean jarg2); public final static native long new_Box2d__SWIG_2(long jarg1, Box2d jarg1_); public final static native long new_Box2d__SWIG_3(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_); public final static native long new_Box2d__SWIG_4(float jarg1, float jarg2, float jarg3, float jarg4, boolean jarg5); public final static native long new_Box2d__SWIG_5(float jarg1, float jarg2, float jarg3, float jarg4); public final static native long new_Box2d__SWIG_6(long jarg1, RECT_2D jarg1_, boolean jarg2); public final static native long new_Box2d__SWIG_7(long jarg1, RECT_2D jarg1_); public final static native long new_Box2d__SWIG_8(int jarg1, int jarg2, int jarg3, int jarg4, boolean jarg5); public final static native long new_Box2d__SWIG_9(int jarg1, int jarg2, int jarg3, int jarg4); public final static native long new_Box2d__SWIG_10(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native long new_Box2d__SWIG_11(int jarg1, long jarg2, Point2d jarg2_); public final static native long new_Box2d__SWIG_12(long jarg1, Point2d jarg1_, float jarg2, float jarg3); public final static native long new_Box2d__SWIG_13(float jarg1, float jarg2); public final static native void Box2d_get__SWIG_0(long jarg1, Box2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native long Box2d_get__SWIG_1(long jarg1, Box2d jarg1_, long jarg2, RECT_2D jarg2_); public final static native long Box2d_set__SWIG_0(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_, boolean jarg3); public final static native long Box2d_set__SWIG_1(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_); public final static native long Box2d_set__SWIG_2(long jarg1, Box2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native long Box2d_set__SWIG_3(long jarg1, Box2d jarg1_, float jarg2, float jarg3, float jarg4, float jarg5); public final static native long Box2d_set__SWIG_4(long jarg1, Box2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, long jarg5, Point2d jarg5_); public final static native long Box2d_set__SWIG_5(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native long Box2d_set__SWIG_6(long jarg1, Box2d jarg1_, long jarg2, Point2d jarg2_, float jarg3, float jarg4); public final static native float Box2d_width(long jarg1, Box2d jarg1_); public final static native float Box2d_height(long jarg1, Box2d jarg1_); public final static native long Box2d_size(long jarg1, Box2d jarg1_); public final static native long Box2d_center(long jarg1, Box2d jarg1_); public final static native long Box2d_leftTop(long jarg1, Box2d jarg1_); public final static native long Box2d_rightTop(long jarg1, Box2d jarg1_); public final static native long Box2d_leftBottom(long jarg1, Box2d jarg1_); public final static native long Box2d_rightBottom(long jarg1, Box2d jarg1_); public final static native long Box2d_normalize(long jarg1, Box2d jarg1_); public final static native long Box2d_swapTopBottom(long jarg1, Box2d jarg1_); public final static native long Box2d_empty(long jarg1, Box2d jarg1_); public final static native boolean Box2d_isNormalized(long jarg1, Box2d jarg1_); public final static native boolean Box2d_isNull(long jarg1, Box2d jarg1_); public final static native boolean Box2d_isEmpty__SWIG_0(long jarg1, Box2d jarg1_, long jarg2, Tol jarg2_, boolean jarg3); public final static native boolean Box2d_isEmpty__SWIG_1(long jarg1, Box2d jarg1_, long jarg2, Tol jarg2_); public final static native boolean Box2d_isEmpty__SWIG_2(long jarg1, Box2d jarg1_); public final static native boolean Box2d_isEmptyMinus__SWIG_0(long jarg1, Box2d jarg1_, long jarg2, Tol jarg2_); public final static native boolean Box2d_isEmptyMinus__SWIG_1(long jarg1, Box2d jarg1_); public final static native boolean Box2d_contains__SWIG_0(long jarg1, Box2d jarg1_, long jarg2, Point2d jarg2_); public final static native boolean Box2d_contains__SWIG_1(long jarg1, Box2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Tol jarg3_); public final static native boolean Box2d_contains__SWIG_2(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_); public final static native boolean Box2d_contains__SWIG_3(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_, long jarg3, Tol jarg3_); public final static native long Box2d_inflate__SWIG_0(long jarg1, Box2d jarg1_, float jarg2); public final static native long Box2d_inflate__SWIG_1(long jarg1, Box2d jarg1_, float jarg2, float jarg3); public final static native long Box2d_inflate__SWIG_2(long jarg1, Box2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Box2d_inflate__SWIG_3(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_); public final static native long Box2d_inflate__SWIG_4(long jarg1, Box2d jarg1_, float jarg2, float jarg3, float jarg4, float jarg5); public final static native long Box2d_deflate__SWIG_0(long jarg1, Box2d jarg1_, float jarg2); public final static native long Box2d_deflate__SWIG_1(long jarg1, Box2d jarg1_, float jarg2, float jarg3); public final static native long Box2d_deflate__SWIG_2(long jarg1, Box2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Box2d_deflate__SWIG_3(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_); public final static native long Box2d_deflate__SWIG_4(long jarg1, Box2d jarg1_, float jarg2, float jarg3, float jarg4, float jarg5); public final static native long Box2d_offset__SWIG_0(long jarg1, Box2d jarg1_, float jarg2, float jarg3); public final static native long Box2d_offset__SWIG_1(long jarg1, Box2d jarg1_, long jarg2, Vector2d jarg2_); public final static native long Box2d_scaleBy__SWIG_0(long jarg1, Box2d jarg1_, float jarg2, float jarg3); public final static native long Box2d_scaleBy__SWIG_1(long jarg1, Box2d jarg1_, float jarg2); public final static native boolean Box2d_isIntersect(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_); public final static native long Box2d_intersectWith__SWIG_0(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_, long jarg3, Box2d jarg3_); public final static native long Box2d_intersectWith__SWIG_1(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_); public final static native long Box2d_unionWith__SWIG_0(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_, long jarg3, Box2d jarg3_); public final static native long Box2d_unionWith__SWIG_1(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_); public final static native long Box2d_unionWith__SWIG_2(long jarg1, Box2d jarg1_, float jarg2, float jarg3); public final static native long Box2d_unionWith__SWIG_3(long jarg1, Box2d jarg1_, long jarg2, Point2d jarg2_); public final static native long Box2d_offset__SWIG_2(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_); public final static native boolean Box2d_isEqualTo__SWIG_0(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_, long jarg3, Tol jarg3_); public final static native boolean Box2d_isEqualTo__SWIG_1(long jarg1, Box2d jarg1_, long jarg2, Box2d jarg2_); public final static native void delete_Box2d(long jarg1); public final static native float mgbase_toRange(float jarg1, float jarg2, float jarg3); public final static native float mgbase_to0_2PI(float jarg1); public final static native float mgbase_toPI(float jarg1); public final static native float mgbase_deg2Rad(float jarg1); public final static native float mgbase_rad2Deg(float jarg1); public final static native float mgbase_dms2Deg(float jarg1); public final static native float mgbase_deg2Dms(float jarg1); public final static native float mgbase_getMidAngle(float jarg1, float jarg2); public final static native float mgbase_getMidAngle2(float jarg1, float jarg2); public final static native float mgbase_getDiffAngle(float jarg1, float jarg2); public final static native int mgbase_getGcd(int jarg1, int jarg2); public final static native float mgbase_roundReal(float jarg1, int jarg2); public final static native long new_mgbase(); public final static native void delete_mgbase(long jarg1); public final static native void mgcurv_fitBezier(long jarg1, Point2d jarg1_, float jarg2, long jarg3, Point2d jarg3_); public final static native void mgcurv_bezierTanget(long jarg1, Point2d jarg1_, float jarg2, long jarg3, Point2d jarg3_); public final static native void mgcurv_splitBezier(long jarg1, Point2d jarg1_, float jarg2, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean mgcurv_bezierIsStraight(long jarg1, Point2d jarg1_); public final static native float mgcurv_lengthOfBezier(long jarg1, Point2d jarg1_); public final static native float mgcurv_bezierPointLengthFromStart(long jarg1, Point2d jarg1_, float jarg2); public final static native void mgcurv_bezier4P(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, long jarg5, Point2d jarg5_, long jarg6, Point2d jarg6_); public final static native int mgcurv_fitCurve(int jarg1, long jarg2, Point2d jarg2_, long jarg3, Vector2d jarg3_, int jarg4, long jarg5, Point2d jarg5_, float jarg6); public final static native void mgcurv_quadBezierToCubic(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_); public final static native void mgcurv_ellipse90ToBezier(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native void mgcurv_ellipseToBezier(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, float jarg3, float jarg4); public final static native void mgcurv_roundRectToBeziers(long jarg1, Point2d jarg1_, long jarg2, Box2d jarg2_, float jarg3, float jarg4); public final static native int mgcurv_arcToBezier(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, float jarg3, float jarg4, float jarg5, float jarg6); public final static native int mgcurv_crossTwoCircles(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, float jarg4, long jarg5, Point2d jarg5_, float jarg6); public final static native int mgcurv_crossLineCircle__SWIG_0(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, long jarg5, Point2d jarg5_, float jarg6, boolean jarg7); public final static native int mgcurv_crossLineCircle__SWIG_1(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, long jarg5, Point2d jarg5_, float jarg6); public final static native boolean mgcurv_cubicSplines__SWIG_0(int jarg1, long jarg2, Point2d jarg2_, long jarg3, Vector2d jarg3_, int jarg4, float jarg5); public final static native boolean mgcurv_cubicSplines__SWIG_1(int jarg1, long jarg2, Point2d jarg2_, long jarg3, Vector2d jarg3_, int jarg4); public final static native boolean mgcurv_cubicSplines__SWIG_2(int jarg1, long jarg2, Point2d jarg2_, long jarg3, Vector2d jarg3_); public final static native void mgcurv_fitCubicSpline(int jarg1, long jarg2, Point2d jarg2_, long jarg3, Vector2d jarg3_, int jarg4, float jarg5, long jarg6, Point2d jarg6_); public final static native void mgcurv_cubicSplineToBezier__SWIG_0(int jarg1, long jarg2, Point2d jarg2_, long jarg3, Vector2d jarg3_, int jarg4, long jarg5, Point2d jarg5_, boolean jarg6); public final static native void mgcurv_cubicSplineToBezier__SWIG_1(int jarg1, long jarg2, Point2d jarg2_, long jarg3, Vector2d jarg3_, int jarg4, long jarg5, Point2d jarg5_); public final static native int mgcurv_bsplinesToBeziers(long jarg1, Point2d jarg1_, int jarg2, long jarg3, Point2d jarg3_, boolean jarg4); public final static native long new_mgcurv(); public final static native void delete_mgcurv(long jarg1); public final static native boolean mglnrel_isLeft(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean mglnrel_isLeft2(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Tol jarg4_); public final static native boolean mglnrel_isLeftOn(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean mglnrel_isLeftOn2(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Tol jarg4_); public final static native boolean mglnrel_isColinear(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean mglnrel_isColinear2(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Tol jarg4_); public final static native boolean mglnrel_isIntersectProp(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean mglnrel_isBetweenLine(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean mglnrel_isProjectBetweenLine(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean mglnrel_isProjectBetweenRayline(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean mglnrel_isBetweenLine2(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Tol jarg4_); public final static native boolean mglnrel_isBetweenLine3__SWIG_0(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean mglnrel_isBetweenLine3__SWIG_1(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean mglnrel_isIntersect(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native float mglnrel_ptToBeeline(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native float mglnrel_ptToBeeline2(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native float mglnrel_ptToLine(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean mglnrel_crossLineAbc__SWIG_0(float jarg1, float jarg2, float jarg3, float jarg4, float jarg5, float jarg6, long jarg7, Point2d jarg7_, long jarg8, Tol jarg8_); public final static native boolean mglnrel_crossLineAbc__SWIG_1(float jarg1, float jarg2, float jarg3, float jarg4, float jarg5, float jarg6, long jarg7, Point2d jarg7_); public final static native boolean mglnrel_cross2Line__SWIG_0(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, long jarg5, Point2d jarg5_, long jarg6, Tol jarg6_); public final static native boolean mglnrel_cross2Line__SWIG_1(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, long jarg5, Point2d jarg5_); public final static native boolean mglnrel_clipLine(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Box2d jarg3_); public final static native long new_mglnrel(); public final static native void delete_mglnrel(long jarg1); public final static native float mgnear_nearestOnBezier(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native long mgnear_bezierBox1(long jarg1, Point2d jarg1_); public final static native long mgnear_bezierBox4(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native void mgnear_beziersBox__SWIG_0(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_, boolean jarg4); public final static native void mgnear_beziersBox__SWIG_1(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean mgnear_beziersIntersectBox__SWIG_0(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_, boolean jarg4); public final static native boolean mgnear_beziersIntersectBox__SWIG_1(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native void mgnear_cubicSplinesBox__SWIG_0(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_, long jarg4, Vector2d jarg4_, boolean jarg5, boolean jarg6); public final static native void mgnear_cubicSplinesBox__SWIG_1(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_, long jarg4, Vector2d jarg4_, boolean jarg5); public final static native void mgnear_cubicSplinesBox__SWIG_2(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_, long jarg4, Vector2d jarg4_); public final static native boolean mgnear_cubicSplinesIntersectBox__SWIG_0(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_, long jarg4, Vector2d jarg4_, boolean jarg5, boolean jarg6); public final static native boolean mgnear_cubicSplinesIntersectBox__SWIG_1(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_, long jarg4, Vector2d jarg4_, boolean jarg5); public final static native boolean mgnear_cubicSplinesIntersectBox__SWIG_2(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_, long jarg4, Vector2d jarg4_); public final static native void mgnear_getRectHandle(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native void mgnear_moveRectHandle__SWIG_0(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_, boolean jarg4); public final static native void mgnear_moveRectHandle__SWIG_1(long jarg1, Box2d jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native long new_mgnear(); public final static native void delete_mgnear(long jarg1); public final static native void delete_GiCanvas(long jarg1); public final static native void GiCanvas_setPen(long jarg1, GiCanvas jarg1_, int jarg2, float jarg3, int jarg4, float jarg5, float jarg6); public final static native void GiCanvas_setBrush(long jarg1, GiCanvas jarg1_, int jarg2, int jarg3); public final static native void GiCanvas_clearRect(long jarg1, GiCanvas jarg1_, float jarg2, float jarg3, float jarg4, float jarg5); public final static native void GiCanvas_drawRect(long jarg1, GiCanvas jarg1_, float jarg2, float jarg3, float jarg4, float jarg5, boolean jarg6, boolean jarg7); public final static native void GiCanvas_drawLine(long jarg1, GiCanvas jarg1_, float jarg2, float jarg3, float jarg4, float jarg5); public final static native void GiCanvas_drawEllipse(long jarg1, GiCanvas jarg1_, float jarg2, float jarg3, float jarg4, float jarg5, boolean jarg6, boolean jarg7); public final static native void GiCanvas_beginPath(long jarg1, GiCanvas jarg1_); public final static native void GiCanvas_moveTo(long jarg1, GiCanvas jarg1_, float jarg2, float jarg3); public final static native void GiCanvas_lineTo(long jarg1, GiCanvas jarg1_, float jarg2, float jarg3); public final static native void GiCanvas_bezierTo(long jarg1, GiCanvas jarg1_, float jarg2, float jarg3, float jarg4, float jarg5, float jarg6, float jarg7); public final static native void GiCanvas_quadTo(long jarg1, GiCanvas jarg1_, float jarg2, float jarg3, float jarg4, float jarg5); public final static native void GiCanvas_closePath(long jarg1, GiCanvas jarg1_); public final static native void GiCanvas_drawPath(long jarg1, GiCanvas jarg1_, boolean jarg2, boolean jarg3); public final static native void GiCanvas_saveClip(long jarg1, GiCanvas jarg1_); public final static native void GiCanvas_restoreClip(long jarg1, GiCanvas jarg1_); public final static native boolean GiCanvas_clipRect(long jarg1, GiCanvas jarg1_, float jarg2, float jarg3, float jarg4, float jarg5); public final static native boolean GiCanvas_clipPath(long jarg1, GiCanvas jarg1_); public final static native boolean GiCanvas_drawHandle(long jarg1, GiCanvas jarg1_, float jarg2, float jarg3, int jarg4, float jarg5); public final static native boolean GiCanvas_drawBitmap(long jarg1, GiCanvas jarg1_, String jarg2, float jarg3, float jarg4, float jarg5, float jarg6, float jarg7); public final static native float GiCanvas_drawTextAt(long jarg1, GiCanvas jarg1_, String jarg2, float jarg3, float jarg4, float jarg5, int jarg6, float jarg7); public final static native boolean GiCanvas_beginShape(long jarg1, GiCanvas jarg1_, int jarg2, int jarg3, int jarg4, float jarg5, float jarg6, float jarg7, float jarg8); public final static native boolean GiCanvas_beginShapeSwigExplicitGiCanvas(long jarg1, GiCanvas jarg1_, int jarg2, int jarg3, int jarg4, float jarg5, float jarg6, float jarg7, float jarg8); public final static native void GiCanvas_endShape(long jarg1, GiCanvas jarg1_, int jarg2, int jarg3, float jarg4, float jarg5); public final static native void GiCanvas_endShapeSwigExplicitGiCanvas(long jarg1, GiCanvas jarg1_, int jarg2, int jarg3, float jarg4, float jarg5); public final static native long new_GiCanvas(); public final static native void GiCanvas_director_connect(GiCanvas obj, long cptr, boolean mem_own, boolean weak_global); public final static native void GiCanvas_change_ownership(GiCanvas obj, long cptr, boolean take_or_release); public final static native void GiColor_r_set(long jarg1, GiColor jarg1_, short jarg2); public final static native short GiColor_r_get(long jarg1, GiColor jarg1_); public final static native void GiColor_g_set(long jarg1, GiColor jarg1_, short jarg2); public final static native short GiColor_g_get(long jarg1, GiColor jarg1_); public final static native void GiColor_b_set(long jarg1, GiColor jarg1_, short jarg2); public final static native short GiColor_b_get(long jarg1, GiColor jarg1_); public final static native void GiColor_a_set(long jarg1, GiColor jarg1_, short jarg2); public final static native short GiColor_a_get(long jarg1, GiColor jarg1_); public final static native long new_GiColor__SWIG_0(); public final static native long new_GiColor__SWIG_1(int jarg1, int jarg2, int jarg3, int jarg4); public final static native long new_GiColor__SWIG_2(int jarg1, int jarg2, int jarg3); public final static native long new_GiColor__SWIG_3(long jarg1, GiColor jarg1_); public final static native long new_GiColor__SWIG_4(int jarg1, boolean jarg2); public final static native long new_GiColor__SWIG_5(int jarg1); public final static native long GiColor_White(); public final static native long GiColor_Black(); public final static native long GiColor_Blue(); public final static native long GiColor_Red(); public final static native long GiColor_Green(); public final static native long GiColor_Invalid(); public final static native int GiColor_getARGB(long jarg1, GiColor jarg1_); public final static native void GiColor_setARGB(long jarg1, GiColor jarg1_, int jarg2); public final static native void GiColor_set__SWIG_0(long jarg1, GiColor jarg1_, int jarg2, int jarg3, int jarg4); public final static native void GiColor_set__SWIG_1(long jarg1, GiColor jarg1_, int jarg2, int jarg3, int jarg4, int jarg5); public final static native long GiColor_withAlpha(long jarg1, GiColor jarg1_, int jarg2); public final static native boolean GiColor_isInvalid(long jarg1, GiColor jarg1_); public final static native boolean GiColor_equals(long jarg1, GiColor jarg1_, long jarg2, GiColor jarg2_); public final static native void delete_GiColor(long jarg1); public final static native long new_GiContext__SWIG_0(); public final static native long new_GiContext__SWIG_1(float jarg1, long jarg2, GiColor jarg2_, int jarg3, long jarg4, GiColor jarg4_, boolean jarg5); public final static native long new_GiContext__SWIG_2(float jarg1, long jarg2, GiColor jarg2_, int jarg3, long jarg4, GiColor jarg4_); public final static native long new_GiContext__SWIG_3(float jarg1, long jarg2, GiColor jarg2_, int jarg3); public final static native long new_GiContext__SWIG_4(float jarg1, long jarg2, GiColor jarg2_); public final static native long new_GiContext__SWIG_5(float jarg1); public final static native long new_GiContext__SWIG_6(long jarg1, GiContext jarg1_); public final static native long GiContext_copy__SWIG_0(long jarg1, GiContext jarg1_, long jarg2, GiContext jarg2_, int jarg3); public final static native long GiContext_copy__SWIG_1(long jarg1, GiContext jarg1_, long jarg2, GiContext jarg2_); public final static native boolean GiContext_equals(long jarg1, GiContext jarg1_, long jarg2, GiContext jarg2_); public final static native int GiContext_getLineStyle(long jarg1, GiContext jarg1_); public final static native int GiContext_getLineStyleEx(long jarg1, GiContext jarg1_); public final static native void GiContext_setLineStyle__SWIG_0(long jarg1, GiContext jarg1_, int jarg2, boolean jarg3); public final static native void GiContext_setLineStyle__SWIG_1(long jarg1, GiContext jarg1_, int jarg2); public final static native float GiContext_getLineWidth(long jarg1, GiContext jarg1_); public final static native float GiContext_getExtraWidth(long jarg1, GiContext jarg1_); public final static native boolean GiContext_isAutoScale(long jarg1, GiContext jarg1_); public final static native void GiContext_setLineWidth(long jarg1, GiContext jarg1_, float jarg2, boolean jarg3); public final static native void GiContext_setExtraWidth(long jarg1, GiContext jarg1_, float jarg2); public final static native boolean GiContext_isNullLine(long jarg1, GiContext jarg1_); public final static native void GiContext_setNullLine(long jarg1, GiContext jarg1_); public final static native long GiContext_getLineColor(long jarg1, GiContext jarg1_); public final static native void GiContext_setLineColor__SWIG_0(long jarg1, GiContext jarg1_, long jarg2, GiColor jarg2_); public final static native void GiContext_setLineColor__SWIG_1(long jarg1, GiContext jarg1_, int jarg2, int jarg3, int jarg4); public final static native void GiContext_setLineColor__SWIG_2(long jarg1, GiContext jarg1_, int jarg2, int jarg3, int jarg4, int jarg5); public final static native int GiContext_getLineARGB(long jarg1, GiContext jarg1_); public final static native void GiContext_setLineARGB(long jarg1, GiContext jarg1_, int jarg2); public final static native int GiContext_getLineAlpha(long jarg1, GiContext jarg1_); public final static native void GiContext_setLineAlpha(long jarg1, GiContext jarg1_, int jarg2); public final static native boolean GiContext_hasFillColor(long jarg1, GiContext jarg1_); public final static native void GiContext_setNoFillColor(long jarg1, GiContext jarg1_); public final static native long GiContext_getFillColor(long jarg1, GiContext jarg1_); public final static native void GiContext_setFillColor__SWIG_0(long jarg1, GiContext jarg1_, long jarg2, GiColor jarg2_); public final static native void GiContext_setFillColor__SWIG_1(long jarg1, GiContext jarg1_, int jarg2, int jarg3, int jarg4); public final static native void GiContext_setFillColor__SWIG_2(long jarg1, GiContext jarg1_, int jarg2, int jarg3, int jarg4, int jarg5); public final static native int GiContext_getFillARGB(long jarg1, GiContext jarg1_); public final static native void GiContext_setFillARGB(long jarg1, GiContext jarg1_, int jarg2); public final static native int GiContext_getFillAlpha(long jarg1, GiContext jarg1_); public final static native void GiContext_setFillAlpha(long jarg1, GiContext jarg1_, int jarg2); public final static native boolean GiContext_hasArrayHead(long jarg1, GiContext jarg1_); public final static native int GiContext_getStartArrayHead(long jarg1, GiContext jarg1_); public final static native void GiContext_setStartArrayHead(long jarg1, GiContext jarg1_, int jarg2); public final static native int GiContext_getEndArrayHead(long jarg1, GiContext jarg1_); public final static native void GiContext_setEndArrayHead(long jarg1, GiContext jarg1_, int jarg2); public final static native void delete_GiContext(long jarg1); public final static native long new_GiTransform__SWIG_0(boolean jarg1); public final static native long new_GiTransform__SWIG_1(); public final static native long new_GiTransform__SWIG_2(long jarg1, GiTransform jarg1_); public final static native void delete_GiTransform(long jarg1); public final static native long GiTransform_copy(long jarg1, GiTransform jarg1_, long jarg2, GiTransform jarg2_); public final static native float GiTransform_getDpiX(long jarg1, GiTransform jarg1_); public final static native float GiTransform_getDpiY(long jarg1, GiTransform jarg1_); public final static native int GiTransform_getWidth(long jarg1, GiTransform jarg1_); public final static native int GiTransform_getHeight(long jarg1, GiTransform jarg1_); public final static native long GiTransform_getCenterW(long jarg1, GiTransform jarg1_); public final static native float GiTransform_getViewScale(long jarg1, GiTransform jarg1_); public final static native float GiTransform_getWorldToDisplayX__SWIG_0(long jarg1, GiTransform jarg1_, boolean jarg2); public final static native float GiTransform_getWorldToDisplayX__SWIG_1(long jarg1, GiTransform jarg1_); public final static native float GiTransform_getWorldToDisplayY__SWIG_0(long jarg1, GiTransform jarg1_, boolean jarg2); public final static native float GiTransform_getWorldToDisplayY__SWIG_1(long jarg1, GiTransform jarg1_); public final static native float GiTransform_displayToModel__SWIG_0(long jarg1, GiTransform jarg1_, float jarg2, boolean jarg3); public final static native float GiTransform_displayToModel__SWIG_1(long jarg1, GiTransform jarg1_, float jarg2); public final static native long GiTransform_modelToWorld(long jarg1, GiTransform jarg1_); public final static native long GiTransform_worldToModel(long jarg1, GiTransform jarg1_); public final static native long GiTransform_displayToWorld(long jarg1, GiTransform jarg1_); public final static native long GiTransform_worldToDisplay(long jarg1, GiTransform jarg1_); public final static native long GiTransform_displayToModel__SWIG_2(long jarg1, GiTransform jarg1_); public final static native long GiTransform_modelToDisplay(long jarg1, GiTransform jarg1_); public final static native boolean GiTransform_setWndSize(long jarg1, GiTransform jarg1_, int jarg2, int jarg3); public final static native void GiTransform_setResolution__SWIG_0(long jarg1, GiTransform jarg1_, float jarg2, float jarg3); public final static native void GiTransform_setResolution__SWIG_1(long jarg1, GiTransform jarg1_, float jarg2); public final static native boolean GiTransform_setModelTransform(long jarg1, GiTransform jarg1_, long jarg2, Matrix2d jarg2_); public final static native long GiTransform_getWndRectW(long jarg1, GiTransform jarg1_); public final static native long GiTransform_getWndRectM(long jarg1, GiTransform jarg1_); public final static native long GiTransform_getWndRect(long jarg1, GiTransform jarg1_); public final static native float GiTransform_getMinViewScale(long jarg1, GiTransform jarg1_); public final static native float GiTransform_getMaxViewScale(long jarg1, GiTransform jarg1_); public final static native long GiTransform_getWorldLimits(long jarg1, GiTransform jarg1_); public final static native void GiTransform_setViewScaleRange(long jarg1, GiTransform jarg1_, float jarg2, float jarg3); public final static native long GiTransform_setWorldLimits(long jarg1, GiTransform jarg1_, long jarg2, Box2d jarg2_); public final static native boolean GiTransform_zoomWnd__SWIG_0(long jarg1, GiTransform jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, boolean jarg4); public final static native boolean GiTransform_zoomWnd__SWIG_1(long jarg1, GiTransform jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean GiTransform_zoomTo__SWIG_0(long jarg1, GiTransform jarg1_, long jarg2, Box2d jarg2_, long jarg3, RECT_2D jarg3_, boolean jarg4); public final static native boolean GiTransform_zoomTo__SWIG_1(long jarg1, GiTransform jarg1_, long jarg2, Box2d jarg2_, long jarg3, RECT_2D jarg3_); public final static native boolean GiTransform_zoomTo__SWIG_2(long jarg1, GiTransform jarg1_, long jarg2, Box2d jarg2_); public final static native boolean GiTransform_zoomTo__SWIG_3(long jarg1, GiTransform jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, boolean jarg4); public final static native boolean GiTransform_zoomTo__SWIG_4(long jarg1, GiTransform jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean GiTransform_zoomTo__SWIG_5(long jarg1, GiTransform jarg1_, long jarg2, Point2d jarg2_); public final static native boolean GiTransform_zoomPan__SWIG_0(long jarg1, GiTransform jarg1_, float jarg2, float jarg3, boolean jarg4); public final static native boolean GiTransform_zoomPan__SWIG_1(long jarg1, GiTransform jarg1_, float jarg2, float jarg3); public final static native boolean GiTransform_zoomByFactor__SWIG_0(long jarg1, GiTransform jarg1_, float jarg2, long jarg3, Point2d jarg3_, boolean jarg4); public final static native boolean GiTransform_zoomByFactor__SWIG_1(long jarg1, GiTransform jarg1_, float jarg2, long jarg3, Point2d jarg3_); public final static native boolean GiTransform_zoomByFactor__SWIG_2(long jarg1, GiTransform jarg1_, float jarg2); public final static native boolean GiTransform_zoomScale__SWIG_0(long jarg1, GiTransform jarg1_, float jarg2, long jarg3, Point2d jarg3_, boolean jarg4); public final static native boolean GiTransform_zoomScale__SWIG_1(long jarg1, GiTransform jarg1_, float jarg2, long jarg3, Point2d jarg3_); public final static native boolean GiTransform_zoomScale__SWIG_2(long jarg1, GiTransform jarg1_, float jarg2); public final static native boolean GiTransform_zoom(long jarg1, GiTransform jarg1_, long jarg2, Point2d jarg2_, float jarg3); public final static native boolean GiTransform_enableZoom(long jarg1, GiTransform jarg1_, boolean jarg2); public final static native float GiTransform_getZoomValue(long jarg1, GiTransform jarg1_, long jarg2, Point2d jarg2_); public final static native int GiTransform_getZoomTimes(long jarg1, GiTransform jarg1_); public final static native long new_GiSaveModelTransform(long jarg1, GiTransform jarg1_, long jarg2, Matrix2d jarg2_); public final static native void delete_GiSaveModelTransform(long jarg1); public final static native long new_MgPath__SWIG_0(); public final static native long new_MgPath__SWIG_1(long jarg1, MgPath jarg1_); public final static native long new_MgPath__SWIG_2(int jarg1, long jarg2, Point2d jarg2_, String jarg3); public final static native long new_MgPath__SWIG_3(String jarg1); public final static native void delete_MgPath(long jarg1); public final static native long MgPath_copy(long jarg1, MgPath jarg1_, long jarg2, MgPath jarg2_); public final static native long MgPath_append(long jarg1, MgPath jarg1_, long jarg2, MgPath jarg2_); public final static native long MgPath_addSVGPath(long jarg1, MgPath jarg1_, String jarg2); public final static native long MgPath_reverse(long jarg1, MgPath jarg1_); public final static native boolean MgPath_genericRoundLines__SWIG_0(long jarg1, MgPath jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4, boolean jarg5); public final static native boolean MgPath_genericRoundLines__SWIG_1(long jarg1, MgPath jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native int MgPath_getCount(long jarg1, MgPath jarg1_); public final static native int MgPath_getSubPathCount(long jarg1, MgPath jarg1_); public final static native long MgPath_getStartPoint(long jarg1, MgPath jarg1_); public final static native long MgPath_getStartTangent(long jarg1, MgPath jarg1_); public final static native long MgPath_getEndPoint(long jarg1, MgPath jarg1_); public final static native long MgPath_getEndTangent(long jarg1, MgPath jarg1_); public final static native boolean MgPath_isLine(long jarg1, MgPath jarg1_); public final static native boolean MgPath_isLines(long jarg1, MgPath jarg1_); public final static native boolean MgPath_isCurve(long jarg1, MgPath jarg1_); public final static native boolean MgPath_isClosed(long jarg1, MgPath jarg1_); public final static native float MgPath_getLength(long jarg1, MgPath jarg1_); public final static native int MgPath_getNodeType(long jarg1, MgPath jarg1_, int jarg2); public final static native long MgPath_getPoint(long jarg1, MgPath jarg1_, int jarg2); public final static native void MgPath_setPoint(long jarg1, MgPath jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native void MgPath_clear(long jarg1, MgPath jarg1_); public final static native void MgPath_transform(long jarg1, MgPath jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgPath_startFigure(long jarg1, MgPath jarg1_); public final static native boolean MgPath_moveTo__SWIG_0(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, boolean jarg3); public final static native boolean MgPath_moveTo__SWIG_1(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_); public final static native boolean MgPath_lineTo__SWIG_0(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, boolean jarg3); public final static native boolean MgPath_lineTo__SWIG_1(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_); public final static native boolean MgPath_horzTo__SWIG_0(long jarg1, MgPath jarg1_, float jarg2, boolean jarg3); public final static native boolean MgPath_horzTo__SWIG_1(long jarg1, MgPath jarg1_, float jarg2); public final static native boolean MgPath_vertTo__SWIG_0(long jarg1, MgPath jarg1_, float jarg2, boolean jarg3); public final static native boolean MgPath_vertTo__SWIG_1(long jarg1, MgPath jarg1_, float jarg2); public final static native boolean MgPath_linesTo__SWIG_0(long jarg1, MgPath jarg1_, int jarg2, long jarg3, Point2d jarg3_, boolean jarg4); public final static native boolean MgPath_linesTo__SWIG_1(long jarg1, MgPath jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgPath_beziersTo__SWIG_0(long jarg1, MgPath jarg1_, int jarg2, long jarg3, Point2d jarg3_, boolean jarg4, boolean jarg5); public final static native boolean MgPath_beziersTo__SWIG_1(long jarg1, MgPath jarg1_, int jarg2, long jarg3, Point2d jarg3_, boolean jarg4); public final static native boolean MgPath_beziersTo__SWIG_2(long jarg1, MgPath jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgPath_bezierTo__SWIG_0(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, boolean jarg5); public final static native boolean MgPath_bezierTo__SWIG_1(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean MgPath_smoothBezierTo__SWIG_0(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, boolean jarg4); public final static native boolean MgPath_smoothBezierTo__SWIG_1(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean MgPath_quadsTo__SWIG_0(long jarg1, MgPath jarg1_, int jarg2, long jarg3, Point2d jarg3_, boolean jarg4); public final static native boolean MgPath_quadsTo__SWIG_1(long jarg1, MgPath jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgPath_quadTo__SWIG_0(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, boolean jarg4); public final static native boolean MgPath_quadTo__SWIG_1(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean MgPath_smoothQuadTo__SWIG_0(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, boolean jarg3); public final static native boolean MgPath_smoothQuadTo__SWIG_1(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_); public final static native boolean MgPath_arcTo__SWIG_0(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, boolean jarg3); public final static native boolean MgPath_arcTo__SWIG_1(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_); public final static native boolean MgPath_arcTo__SWIG_2(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, boolean jarg4); public final static native boolean MgPath_arcTo__SWIG_3(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean MgPath_closeFigure(long jarg1, MgPath jarg1_); public final static native boolean MgPath_trimStart(long jarg1, MgPath jarg1_, long jarg2, Point2d jarg2_, float jarg3); public final static native boolean MgPath_crossWithPath(long jarg1, MgPath jarg1_, long jarg2, MgPath jarg2_, long jarg3, Box2d jarg3_, long jarg4, Point2d jarg4_); public final static native long new_GiGraphics__SWIG_0(); public final static native long new_GiGraphics__SWIG_1(long jarg1, GiTransform jarg1_, boolean jarg2); public final static native long new_GiGraphics__SWIG_2(long jarg1, GiTransform jarg1_); public final static native long new_GiGraphics__SWIG_3(long jarg1, GiGraphics jarg1_); public final static native void delete_GiGraphics(long jarg1); public final static native long GiGraphics_fromHandle(int jarg1); public final static native int GiGraphics_toHandle(long jarg1, GiGraphics jarg1_); public final static native void GiGraphics_copy(long jarg1, GiGraphics jarg1_, long jarg2, GiGraphics jarg2_); public final static native long GiGraphics_xf(long jarg1, GiGraphics jarg1_); public final static native boolean GiGraphics_isDrawing(long jarg1, GiGraphics jarg1_); public final static native boolean GiGraphics_isPrint(long jarg1, GiGraphics jarg1_); public final static native boolean GiGraphics_isStopping(long jarg1, GiGraphics jarg1_); public final static native void GiGraphics_stopDrawing__SWIG_0(long jarg1, GiGraphics jarg1_, boolean jarg2); public final static native void GiGraphics_stopDrawing__SWIG_1(long jarg1, GiGraphics jarg1_); public final static native long GiGraphics_getClipModel(long jarg1, GiGraphics jarg1_); public final static native long GiGraphics_getClipWorld(long jarg1, GiGraphics jarg1_); public final static native long GiGraphics_getClipBox(long jarg1, GiGraphics jarg1_, long jarg2, RECT_2D jarg2_); public final static native boolean GiGraphics_setClipBox(long jarg1, GiGraphics jarg1_, long jarg2, RECT_2D jarg2_); public final static native boolean GiGraphics_setClipWorld(long jarg1, GiGraphics jarg1_, long jarg2, Box2d jarg2_); public final static native boolean GiGraphics_isGrayMode(long jarg1, GiGraphics jarg1_); public final static native void GiGraphics_setGrayMode(long jarg1, GiGraphics jarg1_, boolean jarg2); public final static native long GiGraphics_getBkColor(long jarg1, GiGraphics jarg1_); public final static native long GiGraphics_setBkColor(long jarg1, GiGraphics jarg1_, long jarg2, GiColor jarg2_); public final static native long GiGraphics_calcPenColor(long jarg1, GiGraphics jarg1_, long jarg2, GiColor jarg2_); public final static native float GiGraphics_calcPenWidth(long jarg1, GiGraphics jarg1_, float jarg2, boolean jarg3); public final static native void GiGraphics_setMaxPenWidth__SWIG_0(long jarg1, GiGraphics jarg1_, float jarg2, float jarg3); public final static native void GiGraphics_setMaxPenWidth__SWIG_1(long jarg1, GiGraphics jarg1_, float jarg2); public final static native void GiGraphics_setPenWidthFactor(float jarg1); public final static native boolean GiGraphics_setPhaseEnabled(long jarg1, GiGraphics jarg1_, boolean jarg2); public final static native boolean GiGraphics_drawLine__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, boolean jarg5); public final static native boolean GiGraphics_drawLine__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean GiGraphics_drawRayline__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, boolean jarg5); public final static native boolean GiGraphics_drawRayline__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean GiGraphics_drawBeeline__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, boolean jarg5); public final static native boolean GiGraphics_drawBeeline__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean GiGraphics_drawLines__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, boolean jarg5); public final static native boolean GiGraphics_drawLines__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_); public final static native boolean GiGraphics_drawBeziers__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, boolean jarg5, boolean jarg6); public final static native boolean GiGraphics_drawBeziers__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, boolean jarg5); public final static native boolean GiGraphics_drawBeziers__SWIG_2(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_); public final static native boolean GiGraphics_drawBeziers__SWIG_3(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, long jarg5, Vector2d jarg5_, boolean jarg6, boolean jarg7); public final static native boolean GiGraphics_drawBeziers__SWIG_4(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, long jarg5, Vector2d jarg5_, boolean jarg6); public final static native boolean GiGraphics_drawBeziers__SWIG_5(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, long jarg5, Vector2d jarg5_); public final static native boolean GiGraphics_drawArc__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, float jarg4, float jarg5, float jarg6, float jarg7, boolean jarg8); public final static native boolean GiGraphics_drawArc__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, float jarg4, float jarg5, float jarg6, float jarg7); public final static native boolean GiGraphics_drawArc3P__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, long jarg5, Point2d jarg5_, boolean jarg6); public final static native boolean GiGraphics_drawArc3P__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, long jarg5, Point2d jarg5_); public final static native boolean GiGraphics_drawPolygon__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, boolean jarg5); public final static native boolean GiGraphics_drawPolygon__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_); public final static native boolean GiGraphics_drawCircle__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, float jarg4, boolean jarg5); public final static native boolean GiGraphics_drawCircle__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean GiGraphics_drawEllipse__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, float jarg4, float jarg5, boolean jarg6); public final static native boolean GiGraphics_drawEllipse__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, float jarg4, float jarg5); public final static native boolean GiGraphics_drawEllipse__SWIG_2(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Box2d jarg3_, boolean jarg4); public final static native boolean GiGraphics_drawEllipse__SWIG_3(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Box2d jarg3_); public final static native boolean GiGraphics_drawPie__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, float jarg4, float jarg5, float jarg6, float jarg7, boolean jarg8); public final static native boolean GiGraphics_drawPie__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Point2d jarg3_, float jarg4, float jarg5, float jarg6, float jarg7); public final static native boolean GiGraphics_drawRect__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Box2d jarg3_, boolean jarg4); public final static native boolean GiGraphics_drawRect__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Box2d jarg3_); public final static native boolean GiGraphics_drawRoundRect__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Box2d jarg3_, float jarg4, float jarg5, boolean jarg6); public final static native boolean GiGraphics_drawRoundRect__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Box2d jarg3_, float jarg4, float jarg5); public final static native boolean GiGraphics_drawRoundRect__SWIG_2(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, Box2d jarg3_, float jarg4); public final static native boolean GiGraphics_drawHermiteSplines__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, long jarg5, Vector2d jarg5_, boolean jarg6, boolean jarg7); public final static native boolean GiGraphics_drawHermiteSplines__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, long jarg5, Vector2d jarg5_, boolean jarg6); public final static native boolean GiGraphics_drawHermiteSplines__SWIG_2(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, long jarg5, Vector2d jarg5_); public final static native boolean GiGraphics_drawBSplines__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, boolean jarg5, boolean jarg6); public final static native boolean GiGraphics_drawBSplines__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, boolean jarg5); public final static native boolean GiGraphics_drawBSplines__SWIG_2(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_); public final static native boolean GiGraphics_drawQuadSplines__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, boolean jarg5, boolean jarg6); public final static native boolean GiGraphics_drawQuadSplines__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_, boolean jarg5); public final static native boolean GiGraphics_drawQuadSplines__SWIG_2(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, int jarg3, long jarg4, Point2d jarg4_); public final static native boolean GiGraphics_drawPath__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, MgPath jarg3_, boolean jarg4, boolean jarg5); public final static native boolean GiGraphics_drawPath__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiContext jarg2_, long jarg3, MgPath jarg3_, boolean jarg4); public final static native boolean GiGraphics_drawHandle__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, Point2d jarg2_, int jarg3, float jarg4, boolean jarg5); public final static native boolean GiGraphics_drawHandle__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, Point2d jarg2_, int jarg3, float jarg4); public final static native boolean GiGraphics_drawHandle__SWIG_2(long jarg1, GiGraphics jarg1_, long jarg2, Point2d jarg2_, int jarg3); public final static native float GiGraphics_drawTextAt__SWIG_0(long jarg1, GiGraphics jarg1_, int jarg2, String jarg3, long jarg4, Point2d jarg4_, float jarg5, int jarg6, float jarg7); public final static native float GiGraphics_drawTextAt__SWIG_1(long jarg1, GiGraphics jarg1_, int jarg2, String jarg3, long jarg4, Point2d jarg4_, float jarg5, int jarg6); public final static native float GiGraphics_drawTextAt__SWIG_2(long jarg1, GiGraphics jarg1_, int jarg2, String jarg3, long jarg4, Point2d jarg4_, float jarg5); public final static native boolean GiGraphics_beginPaint__SWIG_0(long jarg1, GiGraphics jarg1_, long jarg2, GiCanvas jarg2_, long jarg3, RECT_2D jarg3_); public final static native boolean GiGraphics_beginPaint__SWIG_1(long jarg1, GiGraphics jarg1_, long jarg2, GiCanvas jarg2_); public final static native void GiGraphics_endPaint(long jarg1, GiGraphics jarg1_); public final static native long new_GiSaveClipBox(long jarg1, GiGraphics jarg1_, long jarg2, Box2d jarg2_); public final static native void delete_GiSaveClipBox(long jarg1); public final static native boolean GiSaveClipBox_succeed(long jarg1, GiSaveClipBox jarg1_); public final static native void delete_Ints(long jarg1); public final static native long new_Ints__SWIG_0(int jarg1); public final static native long new_Ints__SWIG_1(); public final static native void Ints_setSize(long jarg1, Ints jarg1_, int jarg2); public final static native long new_Ints__SWIG_2(int jarg1, int jarg2); public final static native long new_Ints__SWIG_3(int jarg1, int jarg2, int jarg3, int jarg4); public final static native int Ints_count(long jarg1, Ints jarg1_); public final static native int Ints_get(long jarg1, Ints jarg1_, int jarg2); public final static native void Ints_set__SWIG_0(long jarg1, Ints jarg1_, int jarg2, int jarg3); public final static native void Ints_set__SWIG_1(long jarg1, Ints jarg1_, int jarg2, int jarg3, int jarg4); public final static native void delete_Longs(long jarg1); public final static native long new_Longs__SWIG_0(int jarg1); public final static native long new_Longs__SWIG_1(); public final static native void Longs_setSize(long jarg1, Longs jarg1_, int jarg2); public final static native long new_Longs__SWIG_2(int jarg1, int jarg2); public final static native long new_Longs__SWIG_3(int jarg1, int jarg2, int jarg3, int jarg4); public final static native int Longs_count(long jarg1, Longs jarg1_); public final static native int Longs_get(long jarg1, Longs jarg1_, int jarg2); public final static native void Longs_set__SWIG_0(long jarg1, Longs jarg1_, int jarg2, int jarg3); public final static native void Longs_set__SWIG_1(long jarg1, Longs jarg1_, int jarg2, int jarg3, int jarg4); public final static native void delete_Floats(long jarg1); public final static native long new_Floats__SWIG_0(int jarg1); public final static native long new_Floats__SWIG_1(); public final static native void Floats_setSize(long jarg1, Floats jarg1_, int jarg2); public final static native long new_Floats__SWIG_2(float jarg1, float jarg2); public final static native long new_Floats__SWIG_3(float jarg1, float jarg2, float jarg3, float jarg4); public final static native int Floats_count(long jarg1, Floats jarg1_); public final static native float Floats_get(long jarg1, Floats jarg1_, int jarg2); public final static native void Floats_set__SWIG_0(long jarg1, Floats jarg1_, int jarg2, float jarg3); public final static native void Floats_set__SWIG_1(long jarg1, Floats jarg1_, int jarg2, float jarg3, float jarg4); public final static native void delete_Chars(long jarg1); public final static native long new_Chars__SWIG_0(int jarg1); public final static native long new_Chars__SWIG_1(); public final static native void Chars_setSize(long jarg1, Chars jarg1_, int jarg2); public final static native long new_Chars__SWIG_2(char jarg1, char jarg2); public final static native long new_Chars__SWIG_3(char jarg1, char jarg2, char jarg3, char jarg4); public final static native int Chars_count(long jarg1, Chars jarg1_); public final static native char Chars_get(long jarg1, Chars jarg1_, int jarg2); public final static native void Chars_set__SWIG_0(long jarg1, Chars jarg1_, int jarg2, char jarg3); public final static native void Chars_set__SWIG_1(long jarg1, Chars jarg1_, int jarg2, char jarg3, char jarg4); public final static native void delete_ConstShapes(long jarg1); public final static native long new_ConstShapes__SWIG_0(int jarg1); public final static native long new_ConstShapes__SWIG_1(); public final static native void ConstShapes_setSize(long jarg1, ConstShapes jarg1_, int jarg2); public final static native long new_ConstShapes__SWIG_2(long jarg1, MgShape jarg1_, long jarg2, MgShape jarg2_); public final static native long new_ConstShapes__SWIG_3(long jarg1, MgShape jarg1_, long jarg2, MgShape jarg2_, long jarg3, MgShape jarg3_, long jarg4, MgShape jarg4_); public final static native int ConstShapes_count(long jarg1, ConstShapes jarg1_); public final static native long ConstShapes_get(long jarg1, ConstShapes jarg1_, int jarg2); public final static native void ConstShapes_set__SWIG_0(long jarg1, ConstShapes jarg1_, int jarg2, long jarg3, MgShape jarg3_); public final static native void ConstShapes_set__SWIG_1(long jarg1, ConstShapes jarg1_, int jarg2, long jarg3, MgShape jarg3_, long jarg4, MgShape jarg4_); public final static native void delete_Shapes(long jarg1); public final static native long new_Shapes__SWIG_0(int jarg1); public final static native long new_Shapes__SWIG_1(); public final static native void Shapes_setSize(long jarg1, Shapes jarg1_, int jarg2); public final static native long new_Shapes__SWIG_2(long jarg1, MgShape jarg1_, long jarg2, MgShape jarg2_); public final static native long new_Shapes__SWIG_3(long jarg1, MgShape jarg1_, long jarg2, MgShape jarg2_, long jarg3, MgShape jarg3_, long jarg4, MgShape jarg4_); public final static native int Shapes_count(long jarg1, Shapes jarg1_); public final static native long Shapes_get(long jarg1, Shapes jarg1_, int jarg2); public final static native void Shapes_set__SWIG_0(long jarg1, Shapes jarg1_, int jarg2, long jarg3, MgShape jarg3_); public final static native void Shapes_set__SWIG_1(long jarg1, Shapes jarg1_, int jarg2, long jarg3, MgShape jarg3_, long jarg4, MgShape jarg4_); public final static native void delete_MgStorage(long jarg1); public final static native boolean MgStorage_readNode(long jarg1, MgStorage jarg1_, String jarg2, int jarg3, boolean jarg4); public final static native boolean MgStorage_writeNode(long jarg1, MgStorage jarg1_, String jarg2, int jarg3, boolean jarg4); public final static native boolean MgStorage_readBool(long jarg1, MgStorage jarg1_, String jarg2, boolean jarg3); public final static native float MgStorage_readFloat(long jarg1, MgStorage jarg1_, String jarg2, float jarg3); public final static native double MgStorage_readDouble(long jarg1, MgStorage jarg1_, String jarg2, double jarg3); public final static native void MgStorage_writeBool(long jarg1, MgStorage jarg1_, String jarg2, boolean jarg3); public final static native void MgStorage_writeFloat(long jarg1, MgStorage jarg1_, String jarg2, float jarg3); public final static native void MgStorage_writeDouble(long jarg1, MgStorage jarg1_, String jarg2, double jarg3); public final static native void MgStorage_writeString(long jarg1, MgStorage jarg1_, String jarg2, String jarg3); public final static native int MgStorage_readFloatArray(long jarg1, MgStorage jarg1_, String jarg2); public final static native int MgStorage_readIntArray(long jarg1, MgStorage jarg1_, String jarg2); public final static native int MgStorage_readString(long jarg1, MgStorage jarg1_, String jarg2); public final static native int MgStorage_readInt(long jarg1, MgStorage jarg1_, String jarg2, int jarg3); public final static native void MgStorage_writeInt(long jarg1, MgStorage jarg1_, String jarg2, int jarg3); public final static native void MgStorage_writeUInt(long jarg1, MgStorage jarg1_, String jarg2, int jarg3); public final static native boolean MgStorage_setError(long jarg1, MgStorage jarg1_, String jarg2); public final static native long new_MgJsonFile(String jarg1, boolean jarg2); public final static native void delete_MgJsonFile(long jarg1); public final static native boolean MgJsonFile_opened(long jarg1, MgJsonFile jarg1_); public final static native void MgJsonFile_close(long jarg1, MgJsonFile jarg1_); public final static native long new_MgJsonStorage(); public final static native void delete_MgJsonStorage(long jarg1); public final static native long MgJsonStorage_storageForRead__SWIG_0(long jarg1, MgJsonStorage jarg1_, String jarg2); public final static native long MgJsonStorage_storageForWrite(long jarg1, MgJsonStorage jarg1_); public final static native long MgJsonStorage_storageForRead__SWIG_1(long jarg1, MgJsonStorage jarg1_, long jarg2, MgJsonFile jarg2_); public final static native boolean MgJsonStorage_save__SWIG_0(long jarg1, MgJsonStorage jarg1_, long jarg2, MgJsonFile jarg2_, boolean jarg3); public final static native boolean MgJsonStorage_save__SWIG_1(long jarg1, MgJsonStorage jarg1_, long jarg2, MgJsonFile jarg2_); public final static native String MgJsonStorage_stringify__SWIG_0(long jarg1, MgJsonStorage jarg1_, boolean jarg2); public final static native String MgJsonStorage_stringify__SWIG_1(long jarg1, MgJsonStorage jarg1_); public final static native void MgJsonStorage_clear(long jarg1, MgJsonStorage jarg1_); public final static native String MgJsonStorage_getParseError(long jarg1, MgJsonStorage jarg1_); public final static native void MgJsonStorage_setArrayMode(long jarg1, MgJsonStorage jarg1_, boolean jarg2); public final static native void MgJsonStorage_saveNumberAsString(long jarg1, MgJsonStorage jarg1_, boolean jarg2); public final static native boolean MgJsonStorage_toUTF8(String jarg1, String jarg2); public final static native boolean MgJsonStorage_toUTF16(String jarg1, String jarg2); public final static native long MgObject_clone(long jarg1, MgObject jarg1_); public final static native void MgObject_copy(long jarg1, MgObject jarg1_, long jarg2, MgObject jarg2_); public final static native void MgObject_release(long jarg1, MgObject jarg1_); public final static native void MgObject_addRef(long jarg1, MgObject jarg1_); public final static native boolean MgObject_equals(long jarg1, MgObject jarg1_, long jarg2, MgObject jarg2_); public final static native int MgObject_getType(long jarg1, MgObject jarg1_); public final static native boolean MgObject_isKindOf(long jarg1, MgObject jarg1_, int jarg2); public final static native long new_MgObject(); public final static native void MgObject_director_connect(MgObject obj, long cptr, boolean mem_own, boolean weak_global); public final static native void MgObject_change_ownership(MgObject obj, long cptr, boolean take_or_release); public final static native void MgHitResult_nearpt_set(long jarg1, MgHitResult jarg1_, long jarg2, Point2d jarg2_); public final static native long MgHitResult_nearpt_get(long jarg1, MgHitResult jarg1_); public final static native void MgHitResult_segment_set(long jarg1, MgHitResult jarg1_, int jarg2); public final static native int MgHitResult_segment_get(long jarg1, MgHitResult jarg1_); public final static native void MgHitResult_inside_set(long jarg1, MgHitResult jarg1_, boolean jarg2); public final static native boolean MgHitResult_inside_get(long jarg1, MgHitResult jarg1_); public final static native void MgHitResult_contained_set(long jarg1, MgHitResult jarg1_, boolean jarg2); public final static native boolean MgHitResult_contained_get(long jarg1, MgHitResult jarg1_); public final static native void MgHitResult_dist_set(long jarg1, MgHitResult jarg1_, float jarg2); public final static native float MgHitResult_dist_get(long jarg1, MgHitResult jarg1_); public final static native void MgHitResult_mask_set(long jarg1, MgHitResult jarg1_, int jarg2); public final static native int MgHitResult_mask_get(long jarg1, MgHitResult jarg1_); public final static native void MgHitResult_ignoreHandle_set(long jarg1, MgHitResult jarg1_, int jarg2); public final static native int MgHitResult_ignoreHandle_get(long jarg1, MgHitResult jarg1_); public final static native long new_MgHitResult(); public final static native boolean MgHitResult_snapVertexEnabled(long jarg1, MgHitResult jarg1_); public final static native boolean MgHitResult_snapEdgeEnabled(long jarg1, MgHitResult jarg1_); public final static native void MgHitResult_disnableSnapVertex(long jarg1, MgHitResult jarg1_); public final static native void MgHitResult_disnableSnapEdge(long jarg1, MgHitResult jarg1_); public final static native void delete_MgHitResult(long jarg1); public final static native long new_MgBaseShape(); public final static native void delete_MgBaseShape(long jarg1); public final static native int MgBaseShape_Type(); public final static native long MgBaseShape_minTol(); public final static native int MgBaseShape_toHandle(long jarg1, MgBaseShape jarg1_); public final static native long MgBaseShape_cloneShape(long jarg1, MgBaseShape jarg1_); public final static native long MgBaseShape_getExtent(long jarg1, MgBaseShape jarg1_); public final static native long MgBaseShape_getExtentSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_); public final static native int MgBaseShape_getChangeCount(long jarg1, MgBaseShape jarg1_); public final static native int MgBaseShape_getChangeCountSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_); public final static native void MgBaseShape_resetChangeCount(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native void MgBaseShape_resetChangeCountSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native void MgBaseShape_afterChanged(long jarg1, MgBaseShape jarg1_); public final static native void MgBaseShape_afterChangedSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_); public final static native void MgBaseShape_update(long jarg1, MgBaseShape jarg1_); public final static native void MgBaseShape_updateSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_); public final static native void MgBaseShape_transform(long jarg1, MgBaseShape jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgBaseShape_transformSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgBaseShape_clear(long jarg1, MgBaseShape jarg1_); public final static native void MgBaseShape_clearSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_); public final static native void MgBaseShape_clearCachedData(long jarg1, MgBaseShape jarg1_); public final static native void MgBaseShape_clearCachedDataSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_); public final static native int MgBaseShape_getPointCount(long jarg1, MgBaseShape jarg1_); public final static native long MgBaseShape_getPoint(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native void MgBaseShape_setPoint(long jarg1, MgBaseShape jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgBaseShape_isClosed(long jarg1, MgBaseShape jarg1_); public final static native boolean MgBaseShape_isClosedSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_); public final static native boolean MgBaseShape_isCurve(long jarg1, MgBaseShape jarg1_); public final static native boolean MgBaseShape_isCurveSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_); public final static native float MgBaseShape_hitTest(long jarg1, MgBaseShape jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native float MgBaseShape_hitTest2(long jarg1, MgBaseShape jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, Point2d jarg4_); public final static native boolean MgBaseShape_hitTestBox(long jarg1, MgBaseShape jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgBaseShape_hitTestBoxSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgBaseShape_draw(long jarg1, MgBaseShape jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native boolean MgBaseShape_drawSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native boolean MgBaseShape_draw2(long jarg1, MgBaseShape jarg1_, long jarg2, MgObject jarg2_, int jarg3, long jarg4, GiGraphics jarg4_, long jarg5, GiContext jarg5_, int jarg6); public final static native boolean MgBaseShape_draw2SwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, long jarg2, MgObject jarg2_, int jarg3, long jarg4, GiGraphics jarg4_, long jarg5, GiContext jarg5_, int jarg6); public final static native void MgBaseShape_output(long jarg1, MgBaseShape jarg1_, long jarg2, MgPath jarg2_); public final static native long MgBaseShape_getPath(long jarg1, MgBaseShape jarg1_); public final static native boolean MgBaseShape_save(long jarg1, MgBaseShape jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgBaseShape_saveSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgBaseShape_load(long jarg1, MgBaseShape jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native boolean MgBaseShape_loadSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgBaseShape_getHandleCount(long jarg1, MgBaseShape jarg1_); public final static native int MgBaseShape_getHandleCountSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_); public final static native long MgBaseShape_getHandlePoint(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native long MgBaseShape_getHandlePointSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native boolean MgBaseShape_setHandlePoint(long jarg1, MgBaseShape jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgBaseShape_setHandlePointSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgBaseShape_isHandleFixed(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native boolean MgBaseShape_isHandleFixedSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native int MgBaseShape_getHandleType(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native int MgBaseShape_getHandleTypeSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native boolean MgBaseShape_offset(long jarg1, MgBaseShape jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native boolean MgBaseShape_offsetSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native boolean MgBaseShape_getFlag(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native void MgBaseShape_setFlag(long jarg1, MgBaseShape jarg1_, int jarg2, boolean jarg3); public final static native void MgBaseShape_setFlagSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, int jarg2, boolean jarg3); public final static native void MgBaseShape_copy(long jarg1, MgBaseShape jarg1_, long jarg2, MgObject jarg2_); public final static native void MgBaseShape_copySwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, long jarg2, MgObject jarg2_); public final static native boolean MgBaseShape_equals(long jarg1, MgBaseShape jarg1_, long jarg2, MgObject jarg2_); public final static native boolean MgBaseShape_equalsSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, long jarg2, MgObject jarg2_); public final static native boolean MgBaseShape_isKindOf(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native boolean MgBaseShape_isKindOfSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, int jarg2); public final static native void MgBaseShape_addRef(long jarg1, MgBaseShape jarg1_); public final static native void MgBaseShape_addRefSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_); public final static native void MgBaseShape_setExtent(long jarg1, MgBaseShape jarg1_, long jarg2, Box2d jarg2_); public final static native void MgBaseShape_setOwner(long jarg1, MgBaseShape jarg1_, long jarg2, MgObject jarg2_); public final static native void MgBaseShape_setOwnerSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_, long jarg2, MgObject jarg2_); public final static native int MgBaseShape_getSubType(long jarg1, MgBaseShape jarg1_); public final static native int MgBaseShape_getSubTypeSwigExplicitMgBaseShape(long jarg1, MgBaseShape jarg1_); public final static native boolean MgBaseShape_isVisible(long jarg1, MgBaseShape jarg1_); public final static native boolean MgBaseShape_isLocked(long jarg1, MgBaseShape jarg1_); public final static native float MgBaseShape_linesHit(int jarg1, long jarg2, Point2d jarg2_, boolean jarg3, long jarg4, Point2d jarg4_, float jarg5, long jarg6, MgHitResult jarg6_); public final static native void MgBaseShape_director_connect(MgBaseShape obj, long cptr, boolean mem_own, boolean weak_global); public final static native void MgBaseShape_change_ownership(MgBaseShape obj, long cptr, boolean take_or_release); public final static native int MgBaseRect_Type(); public final static native long MgBaseRect_getCenter(long jarg1, MgBaseRect jarg1_); public final static native long MgBaseRect_getRect(long jarg1, MgBaseRect jarg1_); public final static native float MgBaseRect_getWidth(long jarg1, MgBaseRect jarg1_); public final static native float MgBaseRect_getHeight(long jarg1, MgBaseRect jarg1_); public final static native float MgBaseRect_getDiagonalLength(long jarg1, MgBaseRect jarg1_); public final static native float MgBaseRect_getAngle(long jarg1, MgBaseRect jarg1_); public final static native boolean MgBaseRect_isEmpty(long jarg1, MgBaseRect jarg1_, float jarg2); public final static native boolean MgBaseRect_isOrtho(long jarg1, MgBaseRect jarg1_); public final static native void MgBaseRect_setRect2P(long jarg1, MgBaseRect jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native void MgBaseRect_setRectWithAngle(long jarg1, MgBaseRect jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, float jarg4, long jarg5, Point2d jarg5_); public final static native void MgBaseRect_setRect4P(long jarg1, MgBaseRect jarg1_, long jarg2, Point2d jarg2_); public final static native boolean MgBaseRect_transformWith2P(long jarg1, MgBaseRect jarg1_, long jarg2, Point2d jarg2_, int jarg3, long jarg4, Point2d jarg4_, int jarg5); public final static native void MgBaseRect_setCenter(long jarg1, MgBaseRect jarg1_, long jarg2, Point2d jarg2_); public final static native void MgBaseRect_setSquare(long jarg1, MgBaseRect jarg1_, boolean jarg2); public final static native long new_MgBaseRect(); public final static native void delete_MgBaseRect(long jarg1); public final static native void MgBaseRect_director_connect(MgBaseRect obj, long cptr, boolean mem_own, boolean weak_global); public final static native void MgBaseRect_change_ownership(MgBaseRect obj, long cptr, boolean take_or_release); public final static native long new_MgRect(); public final static native void delete_MgRect(long jarg1); public final static native long MgRect_create(); public final static native int MgRect_Type(); public final static native long MgRect_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgRect_fromHandle(int jarg1); public final static native long MgRect_clone(long jarg1, MgRect jarg1_); public final static native void MgRect_copy(long jarg1, MgRect jarg1_, long jarg2, MgObject jarg2_); public final static native void MgRect_release(long jarg1, MgRect jarg1_); public final static native boolean MgRect_equals(long jarg1, MgRect jarg1_, long jarg2, MgObject jarg2_); public final static native int MgRect_getType(long jarg1, MgRect jarg1_); public final static native boolean MgRect_isKindOf(long jarg1, MgRect jarg1_, int jarg2); public final static native long MgRect_getExtent(long jarg1, MgRect jarg1_); public final static native void MgRect_update(long jarg1, MgRect jarg1_); public final static native void MgRect_transform(long jarg1, MgRect jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgRect_clear(long jarg1, MgRect jarg1_); public final static native void MgRect_clearCachedData(long jarg1, MgRect jarg1_); public final static native int MgRect_getPointCount(long jarg1, MgRect jarg1_); public final static native long MgRect_getPoint(long jarg1, MgRect jarg1_, int jarg2); public final static native void MgRect_setPoint(long jarg1, MgRect jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgRect_isClosed(long jarg1, MgRect jarg1_); public final static native boolean MgRect_hitTestBox(long jarg1, MgRect jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgRect_draw(long jarg1, MgRect jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgRect_output(long jarg1, MgRect jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgRect_save(long jarg1, MgRect jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgRect_load(long jarg1, MgRect jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgRect_getHandleCount(long jarg1, MgRect jarg1_); public final static native long MgRect_getHandlePoint(long jarg1, MgRect jarg1_, int jarg2); public final static native boolean MgRect_setHandlePoint(long jarg1, MgRect jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgRect_isHandleFixed(long jarg1, MgRect jarg1_, int jarg2); public final static native int MgRect_getHandleType(long jarg1, MgRect jarg1_, int jarg2); public final static native boolean MgRect_offset(long jarg1, MgRect jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgRect_hitTest(long jarg1, MgRect jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native int MgBaseLines_Type(); public final static native void MgBaseLines_setClosed(long jarg1, MgBaseLines jarg1_, boolean jarg2); public final static native long MgBaseLines_endPoint(long jarg1, MgBaseLines jarg1_); public final static native boolean MgBaseLines_resize(long jarg1, MgBaseLines jarg1_, int jarg2); public final static native boolean MgBaseLines_resizeSwigExplicitMgBaseLines(long jarg1, MgBaseLines jarg1_, int jarg2); public final static native boolean MgBaseLines_addPoint(long jarg1, MgBaseLines jarg1_, long jarg2, Point2d jarg2_); public final static native boolean MgBaseLines_addPointSwigExplicitMgBaseLines(long jarg1, MgBaseLines jarg1_, long jarg2, Point2d jarg2_); public final static native boolean MgBaseLines_insertPoint(long jarg1, MgBaseLines jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgBaseLines_insertPointSwigExplicitMgBaseLines(long jarg1, MgBaseLines jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgBaseLines_removePoint(long jarg1, MgBaseLines jarg1_, int jarg2); public final static native boolean MgBaseLines_removePointSwigExplicitMgBaseLines(long jarg1, MgBaseLines jarg1_, int jarg2); public final static native int MgBaseLines_maxEdgeIndex(long jarg1, MgBaseLines jarg1_); public final static native boolean MgBaseLines_isIncrementFrom(long jarg1, MgBaseLines jarg1_, long jarg2, MgBaseLines jarg2_); public final static native long new_MgBaseLines(); public final static native void MgBaseLines_director_connect(MgBaseLines obj, long cptr, boolean mem_own, boolean weak_global); public final static native void MgBaseLines_change_ownership(MgBaseLines obj, long cptr, boolean take_or_release); public final static native long new_MgLines(); public final static native void delete_MgLines(long jarg1); public final static native long MgLines_create(); public final static native int MgLines_Type(); public final static native long MgLines_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgLines_fromHandle(int jarg1); public final static native long MgLines_clone(long jarg1, MgLines jarg1_); public final static native void MgLines_copy(long jarg1, MgLines jarg1_, long jarg2, MgObject jarg2_); public final static native void MgLines_release(long jarg1, MgLines jarg1_); public final static native boolean MgLines_equals(long jarg1, MgLines jarg1_, long jarg2, MgObject jarg2_); public final static native int MgLines_getType(long jarg1, MgLines jarg1_); public final static native boolean MgLines_isKindOf(long jarg1, MgLines jarg1_, int jarg2); public final static native long MgLines_getExtent(long jarg1, MgLines jarg1_); public final static native void MgLines_update(long jarg1, MgLines jarg1_); public final static native void MgLines_transform(long jarg1, MgLines jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgLines_clear(long jarg1, MgLines jarg1_); public final static native void MgLines_clearCachedData(long jarg1, MgLines jarg1_); public final static native int MgLines_getPointCount(long jarg1, MgLines jarg1_); public final static native long MgLines_getPoint(long jarg1, MgLines jarg1_, int jarg2); public final static native void MgLines_setPoint(long jarg1, MgLines jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgLines_isClosed(long jarg1, MgLines jarg1_); public final static native boolean MgLines_hitTestBox(long jarg1, MgLines jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgLines_draw(long jarg1, MgLines jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgLines_output(long jarg1, MgLines jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgLines_save(long jarg1, MgLines jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgLines_load(long jarg1, MgLines jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgLines_getHandleCount(long jarg1, MgLines jarg1_); public final static native long MgLines_getHandlePoint(long jarg1, MgLines jarg1_, int jarg2); public final static native boolean MgLines_setHandlePoint(long jarg1, MgLines jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgLines_isHandleFixed(long jarg1, MgLines jarg1_, int jarg2); public final static native int MgLines_getHandleType(long jarg1, MgLines jarg1_, int jarg2); public final static native boolean MgLines_offset(long jarg1, MgLines jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgLines_hitTest(long jarg1, MgLines jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native long new_MgCoreShapeFactory(); public final static native void delete_MgCoreShapeFactory(long jarg1); public final static native long MgCoreShapeFactory_createShape(long jarg1, MgCoreShapeFactory jarg1_, int jarg2); public final static native long new_MgArc(); public final static native void delete_MgArc(long jarg1); public final static native long MgArc_create(); public final static native int MgArc_Type(); public final static native long MgArc_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgArc_fromHandle(int jarg1); public final static native long MgArc_clone(long jarg1, MgArc jarg1_); public final static native void MgArc_copy(long jarg1, MgArc jarg1_, long jarg2, MgObject jarg2_); public final static native void MgArc_release(long jarg1, MgArc jarg1_); public final static native boolean MgArc_equals(long jarg1, MgArc jarg1_, long jarg2, MgObject jarg2_); public final static native int MgArc_getType(long jarg1, MgArc jarg1_); public final static native boolean MgArc_isKindOf(long jarg1, MgArc jarg1_, int jarg2); public final static native long MgArc_getExtent(long jarg1, MgArc jarg1_); public final static native void MgArc_update(long jarg1, MgArc jarg1_); public final static native void MgArc_transform(long jarg1, MgArc jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgArc_clear(long jarg1, MgArc jarg1_); public final static native void MgArc_clearCachedData(long jarg1, MgArc jarg1_); public final static native int MgArc_getPointCount(long jarg1, MgArc jarg1_); public final static native long MgArc_getPoint(long jarg1, MgArc jarg1_, int jarg2); public final static native void MgArc_setPoint(long jarg1, MgArc jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgArc_isClosed(long jarg1, MgArc jarg1_); public final static native boolean MgArc_hitTestBox(long jarg1, MgArc jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgArc_draw(long jarg1, MgArc jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgArc_output(long jarg1, MgArc jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgArc_save(long jarg1, MgArc jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgArc_load(long jarg1, MgArc jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgArc_getHandleCount(long jarg1, MgArc jarg1_); public final static native long MgArc_getHandlePoint(long jarg1, MgArc jarg1_, int jarg2); public final static native boolean MgArc_setHandlePoint(long jarg1, MgArc jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgArc_isHandleFixed(long jarg1, MgArc jarg1_, int jarg2); public final static native int MgArc_getHandleType(long jarg1, MgArc jarg1_, int jarg2); public final static native boolean MgArc_offset(long jarg1, MgArc jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgArc_hitTest(long jarg1, MgArc jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native long MgArc_getCenter(long jarg1, MgArc jarg1_); public final static native long MgArc_getStartPoint(long jarg1, MgArc jarg1_); public final static native long MgArc_getEndPoint(long jarg1, MgArc jarg1_); public final static native long MgArc_getMidPoint(long jarg1, MgArc jarg1_); public final static native float MgArc_getRadius(long jarg1, MgArc jarg1_); public final static native float MgArc_getStartAngle(long jarg1, MgArc jarg1_); public final static native float MgArc_getEndAngle(long jarg1, MgArc jarg1_); public final static native float MgArc_getSweepAngle(long jarg1, MgArc jarg1_); public final static native long MgArc_getStartTangent(long jarg1, MgArc jarg1_); public final static native long MgArc_getEndTangent(long jarg1, MgArc jarg1_); public final static native boolean MgArc_setStartMidEnd(long jarg1, MgArc jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean MgArc_setCenterStartEnd__SWIG_0(long jarg1, MgArc jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean MgArc_setCenterStartEnd__SWIG_1(long jarg1, MgArc jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean MgArc_setTanStartEnd(long jarg1, MgArc jarg1_, long jarg2, Vector2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean MgArc_setCenterRadius(long jarg1, MgArc jarg1_, long jarg2, Point2d jarg2_, float jarg3, float jarg4, float jarg5); public final static native void MgArc_setSubType(long jarg1, MgArc jarg1_, int jarg2); public final static native long new_MgDiamond(); public final static native void delete_MgDiamond(long jarg1); public final static native long MgDiamond_create(); public final static native int MgDiamond_Type(); public final static native long MgDiamond_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgDiamond_fromHandle(int jarg1); public final static native long MgDiamond_clone(long jarg1, MgDiamond jarg1_); public final static native void MgDiamond_copy(long jarg1, MgDiamond jarg1_, long jarg2, MgObject jarg2_); public final static native void MgDiamond_release(long jarg1, MgDiamond jarg1_); public final static native boolean MgDiamond_equals(long jarg1, MgDiamond jarg1_, long jarg2, MgObject jarg2_); public final static native int MgDiamond_getType(long jarg1, MgDiamond jarg1_); public final static native boolean MgDiamond_isKindOf(long jarg1, MgDiamond jarg1_, int jarg2); public final static native long MgDiamond_getExtent(long jarg1, MgDiamond jarg1_); public final static native void MgDiamond_update(long jarg1, MgDiamond jarg1_); public final static native void MgDiamond_transform(long jarg1, MgDiamond jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgDiamond_clear(long jarg1, MgDiamond jarg1_); public final static native void MgDiamond_clearCachedData(long jarg1, MgDiamond jarg1_); public final static native int MgDiamond_getPointCount(long jarg1, MgDiamond jarg1_); public final static native long MgDiamond_getPoint(long jarg1, MgDiamond jarg1_, int jarg2); public final static native void MgDiamond_setPoint(long jarg1, MgDiamond jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgDiamond_isClosed(long jarg1, MgDiamond jarg1_); public final static native boolean MgDiamond_hitTestBox(long jarg1, MgDiamond jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgDiamond_draw(long jarg1, MgDiamond jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgDiamond_output(long jarg1, MgDiamond jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgDiamond_save(long jarg1, MgDiamond jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgDiamond_load(long jarg1, MgDiamond jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgDiamond_getHandleCount(long jarg1, MgDiamond jarg1_); public final static native long MgDiamond_getHandlePoint(long jarg1, MgDiamond jarg1_, int jarg2); public final static native boolean MgDiamond_setHandlePoint(long jarg1, MgDiamond jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgDiamond_isHandleFixed(long jarg1, MgDiamond jarg1_, int jarg2); public final static native int MgDiamond_getHandleType(long jarg1, MgDiamond jarg1_, int jarg2); public final static native boolean MgDiamond_offset(long jarg1, MgDiamond jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgDiamond_hitTest(long jarg1, MgDiamond jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native long new_MgDot(); public final static native void delete_MgDot(long jarg1); public final static native long MgDot_create(); public final static native int MgDot_Type(); public final static native long MgDot_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgDot_fromHandle(int jarg1); public final static native long MgDot_clone(long jarg1, MgDot jarg1_); public final static native void MgDot_copy(long jarg1, MgDot jarg1_, long jarg2, MgObject jarg2_); public final static native void MgDot_release(long jarg1, MgDot jarg1_); public final static native boolean MgDot_equals(long jarg1, MgDot jarg1_, long jarg2, MgObject jarg2_); public final static native int MgDot_getType(long jarg1, MgDot jarg1_); public final static native boolean MgDot_isKindOf(long jarg1, MgDot jarg1_, int jarg2); public final static native long MgDot_getExtent(long jarg1, MgDot jarg1_); public final static native void MgDot_update(long jarg1, MgDot jarg1_); public final static native void MgDot_transform(long jarg1, MgDot jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgDot_clear(long jarg1, MgDot jarg1_); public final static native void MgDot_clearCachedData(long jarg1, MgDot jarg1_); public final static native int MgDot_getPointCount(long jarg1, MgDot jarg1_); public final static native long MgDot_getPoint(long jarg1, MgDot jarg1_, int jarg2); public final static native void MgDot_setPoint(long jarg1, MgDot jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgDot_isClosed(long jarg1, MgDot jarg1_); public final static native boolean MgDot_hitTestBox(long jarg1, MgDot jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgDot_draw(long jarg1, MgDot jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgDot_output(long jarg1, MgDot jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgDot_save(long jarg1, MgDot jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgDot_load(long jarg1, MgDot jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgDot_getHandleCount(long jarg1, MgDot jarg1_); public final static native long MgDot_getHandlePoint(long jarg1, MgDot jarg1_, int jarg2); public final static native boolean MgDot_setHandlePoint(long jarg1, MgDot jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgDot_isHandleFixed(long jarg1, MgDot jarg1_, int jarg2); public final static native int MgDot_getHandleType(long jarg1, MgDot jarg1_, int jarg2); public final static native boolean MgDot_offset(long jarg1, MgDot jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgDot_hitTest(long jarg1, MgDot jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native int MgDot_getPointType(long jarg1, MgDot jarg1_); public final static native void MgDot_setPointType(long jarg1, MgDot jarg1_, int jarg2); public final static native long new_MgEllipse(); public final static native void delete_MgEllipse(long jarg1); public final static native long MgEllipse_create(); public final static native int MgEllipse_Type(); public final static native long MgEllipse_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgEllipse_fromHandle(int jarg1); public final static native long MgEllipse_clone(long jarg1, MgEllipse jarg1_); public final static native void MgEllipse_copy(long jarg1, MgEllipse jarg1_, long jarg2, MgObject jarg2_); public final static native void MgEllipse_release(long jarg1, MgEllipse jarg1_); public final static native boolean MgEllipse_equals(long jarg1, MgEllipse jarg1_, long jarg2, MgObject jarg2_); public final static native int MgEllipse_getType(long jarg1, MgEllipse jarg1_); public final static native boolean MgEllipse_isKindOf(long jarg1, MgEllipse jarg1_, int jarg2); public final static native long MgEllipse_getExtent(long jarg1, MgEllipse jarg1_); public final static native void MgEllipse_update(long jarg1, MgEllipse jarg1_); public final static native void MgEllipse_transform(long jarg1, MgEllipse jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgEllipse_clear(long jarg1, MgEllipse jarg1_); public final static native void MgEllipse_clearCachedData(long jarg1, MgEllipse jarg1_); public final static native int MgEllipse_getPointCount(long jarg1, MgEllipse jarg1_); public final static native long MgEllipse_getPoint(long jarg1, MgEllipse jarg1_, int jarg2); public final static native void MgEllipse_setPoint(long jarg1, MgEllipse jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgEllipse_isClosed(long jarg1, MgEllipse jarg1_); public final static native boolean MgEllipse_hitTestBox(long jarg1, MgEllipse jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgEllipse_draw(long jarg1, MgEllipse jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgEllipse_output(long jarg1, MgEllipse jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgEllipse_save(long jarg1, MgEllipse jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgEllipse_load(long jarg1, MgEllipse jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgEllipse_getHandleCount(long jarg1, MgEllipse jarg1_); public final static native long MgEllipse_getHandlePoint(long jarg1, MgEllipse jarg1_, int jarg2); public final static native boolean MgEllipse_setHandlePoint(long jarg1, MgEllipse jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgEllipse_isHandleFixed(long jarg1, MgEllipse jarg1_, int jarg2); public final static native int MgEllipse_getHandleType(long jarg1, MgEllipse jarg1_, int jarg2); public final static native boolean MgEllipse_offset(long jarg1, MgEllipse jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgEllipse_hitTest(long jarg1, MgEllipse jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native float MgEllipse_getRadiusX(long jarg1, MgEllipse jarg1_); public final static native float MgEllipse_getRadiusY(long jarg1, MgEllipse jarg1_); public final static native void MgEllipse_setRadius__SWIG_0(long jarg1, MgEllipse jarg1_, float jarg2, float jarg3); public final static native void MgEllipse_setRadius__SWIG_1(long jarg1, MgEllipse jarg1_, float jarg2); public final static native boolean MgEllipse_setCircle(long jarg1, MgEllipse jarg1_, long jarg2, Point2d jarg2_, float jarg3); public final static native boolean MgEllipse_setCircle2P(long jarg1, MgEllipse jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native boolean MgEllipse_setCircle3P(long jarg1, MgEllipse jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_); public final static native boolean MgEllipse_isCircle__SWIG_0(long jarg1, MgEllipse jarg1_); public final static native boolean MgEllipse_isCircle__SWIG_1(long jarg1, MgBaseShape jarg1_); public final static native int MgEllipse_crossCircle__SWIG_0(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, MgBaseShape jarg3_, long jarg4, MgBaseShape jarg4_, long jarg5, Point2d jarg5_); public final static native int MgEllipse_crossCircle__SWIG_1(long jarg1, Point2d jarg1_, long jarg2, Point2d jarg2_, long jarg3, MgBaseShape jarg3_); public final static native long new_MgGrid(); public final static native void delete_MgGrid(long jarg1); public final static native long MgGrid_create(); public final static native int MgGrid_Type(); public final static native long MgGrid_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgGrid_fromHandle(int jarg1); public final static native long MgGrid_clone(long jarg1, MgGrid jarg1_); public final static native void MgGrid_copy(long jarg1, MgGrid jarg1_, long jarg2, MgObject jarg2_); public final static native void MgGrid_release(long jarg1, MgGrid jarg1_); public final static native boolean MgGrid_equals(long jarg1, MgGrid jarg1_, long jarg2, MgObject jarg2_); public final static native int MgGrid_getType(long jarg1, MgGrid jarg1_); public final static native boolean MgGrid_isKindOf(long jarg1, MgGrid jarg1_, int jarg2); public final static native long MgGrid_getExtent(long jarg1, MgGrid jarg1_); public final static native void MgGrid_update(long jarg1, MgGrid jarg1_); public final static native void MgGrid_transform(long jarg1, MgGrid jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgGrid_clear(long jarg1, MgGrid jarg1_); public final static native void MgGrid_clearCachedData(long jarg1, MgGrid jarg1_); public final static native int MgGrid_getPointCount(long jarg1, MgGrid jarg1_); public final static native long MgGrid_getPoint(long jarg1, MgGrid jarg1_, int jarg2); public final static native void MgGrid_setPoint(long jarg1, MgGrid jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgGrid_isClosed(long jarg1, MgGrid jarg1_); public final static native boolean MgGrid_hitTestBox(long jarg1, MgGrid jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgGrid_draw(long jarg1, MgGrid jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgGrid_output(long jarg1, MgGrid jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgGrid_save(long jarg1, MgGrid jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgGrid_load(long jarg1, MgGrid jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgGrid_getHandleCount(long jarg1, MgGrid jarg1_); public final static native long MgGrid_getHandlePoint(long jarg1, MgGrid jarg1_, int jarg2); public final static native boolean MgGrid_setHandlePoint(long jarg1, MgGrid jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgGrid_isHandleFixed(long jarg1, MgGrid jarg1_, int jarg2); public final static native int MgGrid_getHandleType(long jarg1, MgGrid jarg1_, int jarg2); public final static native boolean MgGrid_offset(long jarg1, MgGrid jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgGrid_hitTest(long jarg1, MgGrid jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native int MgGrid_snap(long jarg1, MgGrid jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native long MgGrid_getCellSize(long jarg1, MgGrid jarg1_); public final static native boolean MgGrid_isValid(long jarg1, MgGrid jarg1_, float jarg2); public final static native long new_MgLine(); public final static native void delete_MgLine(long jarg1); public final static native long MgLine_create(); public final static native int MgLine_Type(); public final static native long MgLine_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgLine_fromHandle(int jarg1); public final static native long MgLine_clone(long jarg1, MgLine jarg1_); public final static native void MgLine_copy(long jarg1, MgLine jarg1_, long jarg2, MgObject jarg2_); public final static native void MgLine_release(long jarg1, MgLine jarg1_); public final static native boolean MgLine_equals(long jarg1, MgLine jarg1_, long jarg2, MgObject jarg2_); public final static native int MgLine_getType(long jarg1, MgLine jarg1_); public final static native boolean MgLine_isKindOf(long jarg1, MgLine jarg1_, int jarg2); public final static native long MgLine_getExtent(long jarg1, MgLine jarg1_); public final static native void MgLine_update(long jarg1, MgLine jarg1_); public final static native void MgLine_transform(long jarg1, MgLine jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgLine_clear(long jarg1, MgLine jarg1_); public final static native void MgLine_clearCachedData(long jarg1, MgLine jarg1_); public final static native int MgLine_getPointCount(long jarg1, MgLine jarg1_); public final static native long MgLine_getPoint(long jarg1, MgLine jarg1_, int jarg2); public final static native void MgLine_setPoint(long jarg1, MgLine jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgLine_isClosed(long jarg1, MgLine jarg1_); public final static native boolean MgLine_hitTestBox(long jarg1, MgLine jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgLine_draw(long jarg1, MgLine jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgLine_output(long jarg1, MgLine jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgLine_save(long jarg1, MgLine jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgLine_load(long jarg1, MgLine jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgLine_getHandleCount(long jarg1, MgLine jarg1_); public final static native long MgLine_getHandlePoint(long jarg1, MgLine jarg1_, int jarg2); public final static native boolean MgLine_setHandlePoint(long jarg1, MgLine jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgLine_isHandleFixed(long jarg1, MgLine jarg1_, int jarg2); public final static native int MgLine_getHandleType(long jarg1, MgLine jarg1_, int jarg2); public final static native boolean MgLine_offset(long jarg1, MgLine jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgLine_hitTest(long jarg1, MgLine jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native long MgLine_startPoint(long jarg1, MgLine jarg1_); public final static native long MgLine_endPoint(long jarg1, MgLine jarg1_); public final static native long MgLine_center(long jarg1, MgLine jarg1_); public final static native float MgLine_length(long jarg1, MgLine jarg1_); public final static native float MgLine_angle(long jarg1, MgLine jarg1_); public final static native void MgLine_setStartPoint(long jarg1, MgLine jarg1_, long jarg2, Point2d jarg2_); public final static native void MgLine_setEndPoint(long jarg1, MgLine jarg1_, long jarg2, Point2d jarg2_); public final static native void MgLine_setRayline(long jarg1, MgLine jarg1_, boolean jarg2); public final static native void MgLine_setBeeline(long jarg1, MgLine jarg1_, boolean jarg2); public final static native boolean MgLine_isRayline(long jarg1, MgLine jarg1_); public final static native boolean MgLine_isBeeline(long jarg1, MgLine jarg1_); public final static native long new_MgParallel(); public final static native void delete_MgParallel(long jarg1); public final static native long MgParallel_create(); public final static native int MgParallel_Type(); public final static native long MgParallel_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgParallel_fromHandle(int jarg1); public final static native long MgParallel_clone(long jarg1, MgParallel jarg1_); public final static native void MgParallel_copy(long jarg1, MgParallel jarg1_, long jarg2, MgObject jarg2_); public final static native void MgParallel_release(long jarg1, MgParallel jarg1_); public final static native boolean MgParallel_equals(long jarg1, MgParallel jarg1_, long jarg2, MgObject jarg2_); public final static native int MgParallel_getType(long jarg1, MgParallel jarg1_); public final static native boolean MgParallel_isKindOf(long jarg1, MgParallel jarg1_, int jarg2); public final static native long MgParallel_getExtent(long jarg1, MgParallel jarg1_); public final static native void MgParallel_update(long jarg1, MgParallel jarg1_); public final static native void MgParallel_transform(long jarg1, MgParallel jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgParallel_clear(long jarg1, MgParallel jarg1_); public final static native void MgParallel_clearCachedData(long jarg1, MgParallel jarg1_); public final static native int MgParallel_getPointCount(long jarg1, MgParallel jarg1_); public final static native long MgParallel_getPoint(long jarg1, MgParallel jarg1_, int jarg2); public final static native void MgParallel_setPoint(long jarg1, MgParallel jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgParallel_isClosed(long jarg1, MgParallel jarg1_); public final static native boolean MgParallel_hitTestBox(long jarg1, MgParallel jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgParallel_draw(long jarg1, MgParallel jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgParallel_output(long jarg1, MgParallel jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgParallel_save(long jarg1, MgParallel jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgParallel_load(long jarg1, MgParallel jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgParallel_getHandleCount(long jarg1, MgParallel jarg1_); public final static native long MgParallel_getHandlePoint(long jarg1, MgParallel jarg1_, int jarg2); public final static native boolean MgParallel_setHandlePoint(long jarg1, MgParallel jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgParallel_isHandleFixed(long jarg1, MgParallel jarg1_, int jarg2); public final static native int MgParallel_getHandleType(long jarg1, MgParallel jarg1_, int jarg2); public final static native boolean MgParallel_offset(long jarg1, MgParallel jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgParallel_hitTest(long jarg1, MgParallel jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native long MgParallel_getCenter(long jarg1, MgParallel jarg1_); public final static native long MgParallel_getRect(long jarg1, MgParallel jarg1_); public final static native float MgParallel_getWidth(long jarg1, MgParallel jarg1_); public final static native float MgParallel_getHeight(long jarg1, MgParallel jarg1_); public final static native float MgParallel_angle(long jarg1, MgParallel jarg1_); public final static native boolean MgParallel_isEmpty(long jarg1, MgParallel jarg1_, float jarg2); public final static native long new_MgPathShape(); public final static native void delete_MgPathShape(long jarg1); public final static native long MgPathShape_create(); public final static native int MgPathShape_Type(); public final static native long MgPathShape_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgPathShape_fromHandle(int jarg1); public final static native long MgPathShape_clone(long jarg1, MgPathShape jarg1_); public final static native void MgPathShape_copy(long jarg1, MgPathShape jarg1_, long jarg2, MgObject jarg2_); public final static native void MgPathShape_release(long jarg1, MgPathShape jarg1_); public final static native boolean MgPathShape_equals(long jarg1, MgPathShape jarg1_, long jarg2, MgObject jarg2_); public final static native int MgPathShape_getType(long jarg1, MgPathShape jarg1_); public final static native boolean MgPathShape_isKindOf(long jarg1, MgPathShape jarg1_, int jarg2); public final static native long MgPathShape_getExtent(long jarg1, MgPathShape jarg1_); public final static native void MgPathShape_update(long jarg1, MgPathShape jarg1_); public final static native void MgPathShape_transform(long jarg1, MgPathShape jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgPathShape_clear(long jarg1, MgPathShape jarg1_); public final static native void MgPathShape_clearCachedData(long jarg1, MgPathShape jarg1_); public final static native int MgPathShape_getPointCount(long jarg1, MgPathShape jarg1_); public final static native long MgPathShape_getPoint(long jarg1, MgPathShape jarg1_, int jarg2); public final static native void MgPathShape_setPoint(long jarg1, MgPathShape jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgPathShape_isClosed(long jarg1, MgPathShape jarg1_); public final static native boolean MgPathShape_hitTestBox(long jarg1, MgPathShape jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgPathShape_draw(long jarg1, MgPathShape jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgPathShape_output(long jarg1, MgPathShape jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgPathShape_save(long jarg1, MgPathShape jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgPathShape_load(long jarg1, MgPathShape jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgPathShape_getHandleCount(long jarg1, MgPathShape jarg1_); public final static native long MgPathShape_getHandlePoint(long jarg1, MgPathShape jarg1_, int jarg2); public final static native boolean MgPathShape_setHandlePoint(long jarg1, MgPathShape jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgPathShape_isHandleFixed(long jarg1, MgPathShape jarg1_, int jarg2); public final static native int MgPathShape_getHandleType(long jarg1, MgPathShape jarg1_, int jarg2); public final static native boolean MgPathShape_offset(long jarg1, MgPathShape jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgPathShape_hitTest(long jarg1, MgPathShape jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native long MgPathShape_pathc(long jarg1, MgPathShape jarg1_); public final static native long MgPathShape_path(long jarg1, MgPathShape jarg1_); public final static native boolean MgPathShape_importSVGPath(long jarg1, MgPathShape jarg1_, String jarg2); public final static native int MgPathShape_exportSVGPath__SWIG_0(long jarg1, MgPathShape jarg1_, String jarg2, int jarg3); public final static native int MgPathShape_exportSVGPath__SWIG_1(long jarg1, MgPath jarg1_, String jarg2, int jarg3); public final static native long new_MgRoundRect(); public final static native void delete_MgRoundRect(long jarg1); public final static native long MgRoundRect_create(); public final static native int MgRoundRect_Type(); public final static native long MgRoundRect_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgRoundRect_fromHandle(int jarg1); public final static native long MgRoundRect_clone(long jarg1, MgRoundRect jarg1_); public final static native void MgRoundRect_copy(long jarg1, MgRoundRect jarg1_, long jarg2, MgObject jarg2_); public final static native void MgRoundRect_release(long jarg1, MgRoundRect jarg1_); public final static native boolean MgRoundRect_equals(long jarg1, MgRoundRect jarg1_, long jarg2, MgObject jarg2_); public final static native int MgRoundRect_getType(long jarg1, MgRoundRect jarg1_); public final static native boolean MgRoundRect_isKindOf(long jarg1, MgRoundRect jarg1_, int jarg2); public final static native long MgRoundRect_getExtent(long jarg1, MgRoundRect jarg1_); public final static native void MgRoundRect_update(long jarg1, MgRoundRect jarg1_); public final static native void MgRoundRect_transform(long jarg1, MgRoundRect jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgRoundRect_clear(long jarg1, MgRoundRect jarg1_); public final static native void MgRoundRect_clearCachedData(long jarg1, MgRoundRect jarg1_); public final static native int MgRoundRect_getPointCount(long jarg1, MgRoundRect jarg1_); public final static native long MgRoundRect_getPoint(long jarg1, MgRoundRect jarg1_, int jarg2); public final static native void MgRoundRect_setPoint(long jarg1, MgRoundRect jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgRoundRect_isClosed(long jarg1, MgRoundRect jarg1_); public final static native boolean MgRoundRect_hitTestBox(long jarg1, MgRoundRect jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgRoundRect_draw(long jarg1, MgRoundRect jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgRoundRect_output(long jarg1, MgRoundRect jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgRoundRect_save(long jarg1, MgRoundRect jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgRoundRect_load(long jarg1, MgRoundRect jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgRoundRect_getHandleCount(long jarg1, MgRoundRect jarg1_); public final static native long MgRoundRect_getHandlePoint(long jarg1, MgRoundRect jarg1_, int jarg2); public final static native boolean MgRoundRect_setHandlePoint(long jarg1, MgRoundRect jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgRoundRect_isHandleFixed(long jarg1, MgRoundRect jarg1_, int jarg2); public final static native int MgRoundRect_getHandleType(long jarg1, MgRoundRect jarg1_, int jarg2); public final static native boolean MgRoundRect_offset(long jarg1, MgRoundRect jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgRoundRect_hitTest(long jarg1, MgRoundRect jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native float MgRoundRect_getRadiusX(long jarg1, MgRoundRect jarg1_); public final static native float MgRoundRect_getRadiusY(long jarg1, MgRoundRect jarg1_); public final static native void MgRoundRect_setRadius__SWIG_0(long jarg1, MgRoundRect jarg1_, float jarg2, float jarg3); public final static native void MgRoundRect_setRadius__SWIG_1(long jarg1, MgRoundRect jarg1_, float jarg2); public final static native long new_MgSplines(); public final static native void delete_MgSplines(long jarg1); public final static native long MgSplines_create(); public final static native int MgSplines_Type(); public final static native long MgSplines_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgSplines_fromHandle(int jarg1); public final static native long MgSplines_clone(long jarg1, MgSplines jarg1_); public final static native void MgSplines_copy(long jarg1, MgSplines jarg1_, long jarg2, MgObject jarg2_); public final static native void MgSplines_release(long jarg1, MgSplines jarg1_); public final static native boolean MgSplines_equals(long jarg1, MgSplines jarg1_, long jarg2, MgObject jarg2_); public final static native int MgSplines_getType(long jarg1, MgSplines jarg1_); public final static native boolean MgSplines_isKindOf(long jarg1, MgSplines jarg1_, int jarg2); public final static native long MgSplines_getExtent(long jarg1, MgSplines jarg1_); public final static native void MgSplines_update(long jarg1, MgSplines jarg1_); public final static native void MgSplines_transform(long jarg1, MgSplines jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgSplines_clear(long jarg1, MgSplines jarg1_); public final static native void MgSplines_clearCachedData(long jarg1, MgSplines jarg1_); public final static native int MgSplines_getPointCount(long jarg1, MgSplines jarg1_); public final static native long MgSplines_getPoint(long jarg1, MgSplines jarg1_, int jarg2); public final static native void MgSplines_setPoint(long jarg1, MgSplines jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgSplines_isClosed(long jarg1, MgSplines jarg1_); public final static native boolean MgSplines_hitTestBox(long jarg1, MgSplines jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgSplines_draw(long jarg1, MgSplines jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgSplines_output(long jarg1, MgSplines jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgSplines_save(long jarg1, MgSplines jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgSplines_load(long jarg1, MgSplines jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgSplines_getHandleCount(long jarg1, MgSplines jarg1_); public final static native long MgSplines_getHandlePoint(long jarg1, MgSplines jarg1_, int jarg2); public final static native boolean MgSplines_setHandlePoint(long jarg1, MgSplines jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgSplines_isHandleFixed(long jarg1, MgSplines jarg1_, int jarg2); public final static native int MgSplines_getHandleType(long jarg1, MgSplines jarg1_, int jarg2); public final static native boolean MgSplines_offset(long jarg1, MgSplines jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgSplines_hitTest(long jarg1, MgSplines jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native boolean MgSplines_smooth(long jarg1, MgSplines jarg1_, long jarg2, Matrix2d jarg2_, float jarg3); public final static native int MgSplines_smoothForPoints(long jarg1, MgSplines jarg1_, int jarg2, long jarg3, Point2d jarg3_, long jarg4, Matrix2d jarg4_, float jarg5); public final static native void MgSplines_clearVectors(long jarg1, MgSplines jarg1_); public final static native int MgShape_Type(); public final static native long MgShape_fromHandle(int jarg1); public final static native int MgShape_toHandle(long jarg1, MgShape jarg1_); public final static native long MgShape_cloneShape(long jarg1, MgShape jarg1_); public final static native long MgShape_context(long jarg1, MgShape jarg1_); public final static native void MgShape_setContext__SWIG_0(long jarg1, MgShape jarg1_, long jarg2, GiContext jarg2_, int jarg3); public final static native void MgShape_setContext__SWIG_1(long jarg1, MgShape jarg1_, long jarg2, GiContext jarg2_); public final static native long MgShape_shape(long jarg1, MgShape jarg1_); public final static native long MgShape_shapec(long jarg1, MgShape jarg1_); public final static native boolean MgShape_hasFillColor(long jarg1, MgShape jarg1_); public final static native boolean MgShape_draw(long jarg1, MgShape jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native boolean MgShape_save(long jarg1, MgShape jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgShape_load(long jarg1, MgShape jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgShape_getID(long jarg1, MgShape jarg1_); public final static native long MgShape_getParent(long jarg1, MgShape jarg1_); public final static native void MgShape_setParent(long jarg1, MgShape jarg1_, long jarg2, MgShapes jarg2_, int jarg3); public final static native int MgShape_getTag(long jarg1, MgShape jarg1_); public final static native void MgShape_setTag(long jarg1, MgShape jarg1_, int jarg2); public final static native void MgShape_copy(long jarg1, MgShape jarg1_, long jarg2, MgObject jarg2_); public final static native boolean MgShape_equals(long jarg1, MgShape jarg1_, long jarg2, MgObject jarg2_); public final static native boolean MgShape_isKindOf(long jarg1, MgShape jarg1_, int jarg2); public final static native boolean MgShape_drawShape(long jarg1, MgShapes jarg1_, long jarg2, MgBaseShape jarg2_, int jarg3, long jarg4, GiGraphics jarg4_, long jarg5, GiContext jarg5_, int jarg6); public final static native int MgShape_getPointCount(long jarg1, MgShape jarg1_); public final static native long MgShape_getPoint(long jarg1, MgShape jarg1_, int jarg2); public final static native int MgShape_getHandleCount(long jarg1, MgShape jarg1_); public final static native long MgShape_getHandlePoint(long jarg1, MgShape jarg1_, int jarg2); public final static native int MgShape_getHandleType(long jarg1, MgShape jarg1_, int jarg2); public final static native void delete_MgShapeFactory(long jarg1); public final static native long MgShapeFactory_createShape(long jarg1, MgShapeFactory jarg1_, int jarg2); public final static native int MgShapes_Type(); public final static native long MgShapes_cloneShapes(long jarg1, MgShapes jarg1_); public final static native long MgShapes_shallowCopy(long jarg1, MgShapes jarg1_); public final static native long MgShapes_create__SWIG_0(long jarg1, MgObject jarg1_, int jarg2); public final static native long MgShapes_create__SWIG_1(long jarg1, MgObject jarg1_); public final static native long MgShapes_create__SWIG_2(); public final static native int MgShapes_getShapeCount(long jarg1, MgShapes jarg1_); public final static native int MgShapes_getShapeCountByTypeOrTag(long jarg1, MgShapes jarg1_, int jarg2, int jarg3); public final static native int MgShapes_getShapeIndex(long jarg1, MgShapes jarg1_, int jarg2); public final static native long MgShapes_getShapeAtIndex(long jarg1, MgShapes jarg1_, int jarg2); public final static native long MgShapes_getHeadShape(long jarg1, MgShapes jarg1_); public final static native long MgShapes_getLastShape(long jarg1, MgShapes jarg1_); public final static native long MgShapes_findShape(long jarg1, MgShapes jarg1_, int jarg2); public final static native long MgShapes_findShapeByTag(long jarg1, MgShapes jarg1_, int jarg2); public final static native long MgShapes_findShapeByType(long jarg1, MgShapes jarg1_, int jarg2); public final static native long MgShapes_findShapeByTypeAndTag(long jarg1, MgShapes jarg1_, int jarg2, int jarg3); public final static native long MgShapes_getExtent(long jarg1, MgShapes jarg1_); public final static native long MgShapes_hitTest(long jarg1, MgShapes jarg1_, long jarg2, Box2d jarg2_, long jarg3, MgHitResult jarg3_); public final static native int MgShapes_draw__SWIG_0(long jarg1, MgShapes jarg1_, long jarg2, GiGraphics jarg2_, long jarg3, GiContext jarg3_); public final static native int MgShapes_draw__SWIG_1(long jarg1, MgShapes jarg1_, long jarg2, GiGraphics jarg2_); public final static native boolean MgShapes_save__SWIG_0(long jarg1, MgShapes jarg1_, long jarg2, MgStorage jarg2_, int jarg3); public final static native boolean MgShapes_save__SWIG_1(long jarg1, MgShapes jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgShapes_saveShape(long jarg1, MgShapes jarg1_, long jarg2, MgStorage jarg2_, long jarg3, MgShape jarg3_, int jarg4); public final static native int MgShapes_load__SWIG_0(long jarg1, MgShapes jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_, boolean jarg4); public final static native int MgShapes_load__SWIG_1(long jarg1, MgShapes jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native void MgShapes_setNewShapeID(long jarg1, MgShapes jarg1_, int jarg2); public final static native void MgShapes_clear(long jarg1, MgShapes jarg1_); public final static native void MgShapes_clearCachedData(long jarg1, MgShapes jarg1_); public final static native int MgShapes_copyShapes__SWIG_0(long jarg1, MgShapes jarg1_, long jarg2, MgShapes jarg2_, boolean jarg3, boolean jarg4); public final static native int MgShapes_copyShapes__SWIG_1(long jarg1, MgShapes jarg1_, long jarg2, MgShapes jarg2_, boolean jarg3); public final static native int MgShapes_copyShapes__SWIG_2(long jarg1, MgShapes jarg1_, long jarg2, MgShapes jarg2_); public final static native long MgShapes_addShape(long jarg1, MgShapes jarg1_, long jarg2, MgShape jarg2_); public final static native boolean MgShapes_addShapeDirect__SWIG_0(long jarg1, MgShapes jarg1_, long jarg2, MgShape jarg2_, boolean jarg3); public final static native boolean MgShapes_addShapeDirect__SWIG_1(long jarg1, MgShapes jarg1_, long jarg2, MgShape jarg2_); public final static native boolean MgShapes_updateShape__SWIG_0(long jarg1, MgShapes jarg1_, long jarg2, MgShape jarg2_, boolean jarg3); public final static native boolean MgShapes_updateShape__SWIG_1(long jarg1, MgShapes jarg1_, long jarg2, MgShape jarg2_); public final static native long MgShapes_cloneShape(long jarg1, MgShapes jarg1_, int jarg2); public final static native void MgShapes_transform(long jarg1, MgShapes jarg1_, long jarg2, Matrix2d jarg2_); public final static native boolean MgShapes_removeShape(long jarg1, MgShapes jarg1_, int jarg2); public final static native boolean MgShapes_moveShapeTo(long jarg1, MgShapes jarg1_, int jarg2, long jarg3, MgShapes jarg3_); public final static native void MgShapes_copyShapesTo(long jarg1, MgShapes jarg1_, long jarg2, MgShapes jarg2_); public final static native boolean MgShapes_bringToFront(long jarg1, MgShapes jarg1_, int jarg2); public final static native boolean MgShapes_bringToBack(long jarg1, MgShapes jarg1_, int jarg2); public final static native boolean MgShapes_bringToIndex(long jarg1, MgShapes jarg1_, int jarg2, int jarg3); public final static native long MgShapes_getParentShape(long jarg1, MgShape jarg1_); public final static native long MgShapes_getOwner(long jarg1, MgShapes jarg1_); public final static native int MgShapes_getIndex(long jarg1, MgShapes jarg1_); public final static native long MgShapes_fromHandle(int jarg1); public final static native int MgShapes_toHandle(long jarg1, MgShapes jarg1_); public final static native long MgShapes_clone(long jarg1, MgShapes jarg1_); public final static native void MgShapes_copy(long jarg1, MgShapes jarg1_, long jarg2, MgObject jarg2_); public final static native void MgShapes_release(long jarg1, MgShapes jarg1_); public final static native void MgShapes_addRef(long jarg1, MgShapes jarg1_); public final static native boolean MgShapes_equals(long jarg1, MgShapes jarg1_, long jarg2, MgObject jarg2_); public final static native int MgShapes_getType(long jarg1, MgShapes jarg1_); public final static native boolean MgShapes_isKindOf(long jarg1, MgShapes jarg1_, int jarg2); public final static native long new_MgShapeIterator(long jarg1, MgShapes jarg1_); public final static native void delete_MgShapeIterator(long jarg1); public final static native boolean MgShapeIterator_hasNext(long jarg1, MgShapeIterator jarg1_); public final static native long MgShapeIterator_getNext(long jarg1, MgShapeIterator jarg1_); public final static native long MgShapeIterator_shapes(long jarg1, MgShapeIterator jarg1_); public final static native int MgComposite_Type(); public final static native int MgComposite_getShapeCount(long jarg1, MgComposite jarg1_); public final static native long MgComposite_shapes(long jarg1, MgComposite jarg1_); public final static native long MgComposite_getOwnerShape(long jarg1, MgComposite jarg1_); public final static native boolean MgComposite_canOffsetShapeAlone(long jarg1, MgComposite jarg1_, long jarg2, MgShape jarg2_); public final static native boolean MgComposite_canOffsetShapeAloneSwigExplicitMgComposite(long jarg1, MgComposite jarg1_, long jarg2, MgShape jarg2_); public final static native long new_MgComposite(); public final static native void MgComposite_director_connect(MgComposite obj, long cptr, boolean mem_own, boolean weak_global); public final static native void MgComposite_change_ownership(MgComposite obj, long cptr, boolean take_or_release); public final static native long new_MgGroup(); public final static native void delete_MgGroup(long jarg1); public final static native long MgGroup_create(); public final static native int MgGroup_Type(); public final static native long MgGroup_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgGroup_fromHandle(int jarg1); public final static native long MgGroup_clone(long jarg1, MgGroup jarg1_); public final static native void MgGroup_copy(long jarg1, MgGroup jarg1_, long jarg2, MgObject jarg2_); public final static native void MgGroup_release(long jarg1, MgGroup jarg1_); public final static native boolean MgGroup_equals(long jarg1, MgGroup jarg1_, long jarg2, MgObject jarg2_); public final static native int MgGroup_getType(long jarg1, MgGroup jarg1_); public final static native boolean MgGroup_isKindOf(long jarg1, MgGroup jarg1_, int jarg2); public final static native long MgGroup_getExtent(long jarg1, MgGroup jarg1_); public final static native void MgGroup_update(long jarg1, MgGroup jarg1_); public final static native void MgGroup_transform(long jarg1, MgGroup jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgGroup_clear(long jarg1, MgGroup jarg1_); public final static native void MgGroup_clearCachedData(long jarg1, MgGroup jarg1_); public final static native int MgGroup_getPointCount(long jarg1, MgGroup jarg1_); public final static native long MgGroup_getPoint(long jarg1, MgGroup jarg1_, int jarg2); public final static native void MgGroup_setPoint(long jarg1, MgGroup jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgGroup_isClosed(long jarg1, MgGroup jarg1_); public final static native boolean MgGroup_hitTestBox(long jarg1, MgGroup jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgGroup_draw(long jarg1, MgGroup jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgGroup_output(long jarg1, MgGroup jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgGroup_save(long jarg1, MgGroup jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgGroup_load(long jarg1, MgGroup jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgGroup_getHandleCount(long jarg1, MgGroup jarg1_); public final static native long MgGroup_getHandlePoint(long jarg1, MgGroup jarg1_, int jarg2); public final static native boolean MgGroup_setHandlePoint(long jarg1, MgGroup jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgGroup_isHandleFixed(long jarg1, MgGroup jarg1_, int jarg2); public final static native int MgGroup_getHandleType(long jarg1, MgGroup jarg1_, int jarg2); public final static native boolean MgGroup_offset(long jarg1, MgGroup jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgGroup_hitTest(long jarg1, MgGroup jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native boolean MgGroup_addShapeToGroup(long jarg1, MgGroup jarg1_, long jarg2, MgShape jarg2_); public final static native long MgGroup_getInsertionPoint(long jarg1, MgGroup jarg1_); public final static native void MgGroup_setInsertionPoint(long jarg1, MgGroup jarg1_, long jarg2, Point2d jarg2_); public final static native boolean MgGroup_hasInsertionPoint(long jarg1, MgGroup jarg1_); public final static native long MgGroup_getCenterPoint(long jarg1, MgGroup jarg1_); public final static native void MgGroup_setName(long jarg1, MgGroup jarg1_, String jarg2); public final static native long MgGroup_findGroup(long jarg1, MgShapes jarg1_, String jarg2); public final static native long new_MgImageShape(); public final static native void delete_MgImageShape(long jarg1); public final static native long MgImageShape_create(); public final static native int MgImageShape_Type(); public final static native long MgImageShape_cast(long jarg1, MgBaseShape jarg1_); public final static native long MgImageShape_fromHandle(int jarg1); public final static native long MgImageShape_clone(long jarg1, MgImageShape jarg1_); public final static native void MgImageShape_copy(long jarg1, MgImageShape jarg1_, long jarg2, MgObject jarg2_); public final static native void MgImageShape_release(long jarg1, MgImageShape jarg1_); public final static native boolean MgImageShape_equals(long jarg1, MgImageShape jarg1_, long jarg2, MgObject jarg2_); public final static native int MgImageShape_getType(long jarg1, MgImageShape jarg1_); public final static native boolean MgImageShape_isKindOf(long jarg1, MgImageShape jarg1_, int jarg2); public final static native long MgImageShape_getExtent(long jarg1, MgImageShape jarg1_); public final static native void MgImageShape_update(long jarg1, MgImageShape jarg1_); public final static native void MgImageShape_transform(long jarg1, MgImageShape jarg1_, long jarg2, Matrix2d jarg2_); public final static native void MgImageShape_clear(long jarg1, MgImageShape jarg1_); public final static native void MgImageShape_clearCachedData(long jarg1, MgImageShape jarg1_); public final static native int MgImageShape_getPointCount(long jarg1, MgImageShape jarg1_); public final static native long MgImageShape_getPoint(long jarg1, MgImageShape jarg1_, int jarg2); public final static native void MgImageShape_setPoint(long jarg1, MgImageShape jarg1_, int jarg2, long jarg3, Point2d jarg3_); public final static native boolean MgImageShape_isClosed(long jarg1, MgImageShape jarg1_); public final static native boolean MgImageShape_hitTestBox(long jarg1, MgImageShape jarg1_, long jarg2, Box2d jarg2_); public final static native boolean MgImageShape_draw(long jarg1, MgImageShape jarg1_, int jarg2, long jarg3, GiGraphics jarg3_, long jarg4, GiContext jarg4_, int jarg5); public final static native void MgImageShape_output(long jarg1, MgImageShape jarg1_, long jarg2, MgPath jarg2_); public final static native boolean MgImageShape_save(long jarg1, MgImageShape jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgImageShape_load(long jarg1, MgImageShape jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_); public final static native int MgImageShape_getHandleCount(long jarg1, MgImageShape jarg1_); public final static native long MgImageShape_getHandlePoint(long jarg1, MgImageShape jarg1_, int jarg2); public final static native boolean MgImageShape_setHandlePoint(long jarg1, MgImageShape jarg1_, int jarg2, long jarg3, Point2d jarg3_, float jarg4); public final static native boolean MgImageShape_isHandleFixed(long jarg1, MgImageShape jarg1_, int jarg2); public final static native int MgImageShape_getHandleType(long jarg1, MgImageShape jarg1_, int jarg2); public final static native boolean MgImageShape_offset(long jarg1, MgImageShape jarg1_, long jarg2, Vector2d jarg2_, int jarg3); public final static native float MgImageShape_hitTest(long jarg1, MgImageShape jarg1_, long jarg2, Point2d jarg2_, float jarg3, long jarg4, MgHitResult jarg4_); public final static native void MgImageShape_setName(long jarg1, MgImageShape jarg1_, String jarg2); public final static native long MgImageShape_getImageSize(long jarg1, MgImageShape jarg1_); public final static native void MgImageShape_setImageSize(long jarg1, MgImageShape jarg1_, long jarg2, Vector2d jarg2_); public final static native long MgImageShape_findShapeByImageID(long jarg1, MgShapes jarg1_, String jarg2); public final static native void delete_MgActionDispatcher(long jarg1); public final static native boolean MgActionDispatcher_showInSelect(long jarg1, MgActionDispatcher jarg1_, long jarg2, MgMotion jarg2_, int jarg3, long jarg4, MgShape jarg4_, long jarg5, Box2d jarg5_); public final static native boolean MgActionDispatcher_showInDrawing(long jarg1, MgActionDispatcher jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean MgActionDispatcher_doAction(long jarg1, MgActionDispatcher jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native void delete_MgSnap(long jarg1); public final static native void MgSnap_clearSnap(long jarg1, MgSnap jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgSnap_drawSnap(long jarg1, MgSnap jarg1_, long jarg2, MgMotion jarg2_, long jarg3, GiGraphics jarg3_); public final static native boolean MgSnap_drawPerpMark(long jarg1, MgSnap jarg1_, long jarg2, GiGraphics jarg2_, long jarg3, GiContext jarg3_, long jarg4, Point2d jarg4_, long jarg5, Point2d jarg5_, long jarg6, Point2d jarg6_, long jarg7, Point2d jarg7_, float jarg8); public final static native int MgSnap_getSnapOptions(long jarg1, MgSnap jarg1_, long jarg2, MgView jarg2_); public final static native void MgSnap_setSnapOptions(long jarg1, MgSnap jarg1_, long jarg2, MgView jarg2_, int jarg3); public final static native int MgSnap_getSnappedType(long jarg1, MgSnap jarg1_); public final static native int MgSnap_getSnappedPoint__SWIG_0(long jarg1, MgSnap jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_); public final static native int MgSnap_getSnappedPoint__SWIG_1(long jarg1, MgSnap jarg1_, long jarg2, Point2d jarg2_, long jarg3, Point2d jarg3_, long jarg4, Point2d jarg4_, long jarg5, Point2d jarg5_); public final static native void MgSnap_setIgnoreStartPoint(long jarg1, MgSnap jarg1_, long jarg2, Point2d jarg2_); public final static native long MgSnap_snapPoint(long jarg1, MgSnap jarg1_, long jarg2, MgMotion jarg2_, long jarg3, Point2d jarg3_); public final static native void delete_MgSelection(long jarg1); public final static native int MgSelection_getSelection(long jarg1, MgSelection jarg1_, long jarg2, MgView jarg2_, long jarg3, ConstShapes jarg3_); public final static native int MgSelection_getSelectionForChange(long jarg1, MgSelection jarg1_, long jarg2, MgView jarg2_, long jarg3, Shapes jarg3_); public final static native int MgSelection_getSelectionCount(long jarg1, MgSelection jarg1_, long jarg2, MgView jarg2_); public final static native int MgSelection_getSelectState(long jarg1, MgSelection jarg1_, long jarg2, MgView jarg2_); public final static native int MgSelection_getSelectType(long jarg1, MgSelection jarg1_, long jarg2, MgView jarg2_); public final static native int MgSelection_getSelectedHandle(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native int MgSelection_getSelectedShapeHandle(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgSelection_selectAll(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgSelection_deleteSelection(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgSelection_cloneSelection(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgSelection_groupSelection(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgSelection_ungroupSelection(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native void MgSelection_resetSelection(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgSelection_addSelection(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native boolean MgSelection_deleteVertex(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgSelection_insertVertex(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgSelection_switchClosed(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgSelection_isFixedLength(long jarg1, MgSelection jarg1_, long jarg2, MgView jarg2_); public final static native boolean MgSelection_setFixedLength(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_, boolean jarg3); public final static native boolean MgSelection_isLocked(long jarg1, MgSelection jarg1_, long jarg2, MgView jarg2_); public final static native boolean MgSelection_setLocked(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_, boolean jarg3); public final static native boolean MgSelection_isEditMode(long jarg1, MgSelection jarg1_, long jarg2, MgView jarg2_); public final static native boolean MgSelection_setEditMode(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_, boolean jarg3); public final static native boolean MgSelection_overturnPolygon(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native long MgSelection_getBoundingBox(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgSelection_isSelectedByType(long jarg1, MgSelection jarg1_, long jarg2, MgView jarg2_, int jarg3); public final static native boolean MgSelection_applyTransform(long jarg1, MgSelection jarg1_, long jarg2, MgMotion jarg2_, long jarg3, Matrix2d jarg3_); public final static native void delete_MgView(long jarg1); public final static native long MgView_fromHandle(int jarg1); public final static native int MgView_toHandle(long jarg1, MgView jarg1_); public final static native long MgView_motion(long jarg1, MgView jarg1_); public final static native long MgView_cmds(long jarg1, MgView jarg1_); public final static native long MgView_xform(long jarg1, MgView jarg1_); public final static native long MgView_doc(long jarg1, MgView jarg1_); public final static native long MgView_shapes(long jarg1, MgView jarg1_); public final static native long MgView_context(long jarg1, MgView jarg1_); public final static native long MgView_modelTransform(long jarg1, MgView jarg1_); public final static native long MgView_getShapeFactory(long jarg1, MgView jarg1_); public final static native long MgView_createShapeCtx__SWIG_0(long jarg1, MgView jarg1_, int jarg2, long jarg3, GiContext jarg3_); public final static native long MgView_createShapeCtx__SWIG_1(long jarg1, MgView jarg1_, int jarg2); public final static native long MgView_getSnap(long jarg1, MgView jarg1_); public final static native long MgView_getAction(long jarg1, MgView jarg1_); public final static native long MgView_getCmdSubject(long jarg1, MgView jarg1_); public final static native long MgView_getSelection(long jarg1, MgView jarg1_); public final static native boolean MgView_setCurrentShapes(long jarg1, MgView jarg1_, long jarg2, MgShapes jarg2_); public final static native boolean MgView_toSelectCommand(long jarg1, MgView jarg1_); public final static native int MgView_getNewShapeID(long jarg1, MgView jarg1_); public final static native void MgView_setNewShapeID(long jarg1, MgView jarg1_, int jarg2); public final static native long MgView_getCommand(long jarg1, MgView jarg1_); public final static native long MgView_findCommand(long jarg1, MgView jarg1_, String jarg2); public final static native boolean MgView_setCommand__SWIG_0(long jarg1, MgView jarg1_, String jarg2, String jarg3); public final static native boolean MgView_setCommand__SWIG_1(long jarg1, MgView jarg1_, String jarg2); public final static native boolean MgView_isReadOnly(long jarg1, MgView jarg1_); public final static native boolean MgView_isCommand(long jarg1, MgView jarg1_, String jarg2); public final static native void MgView_regenAll(long jarg1, MgView jarg1_, boolean jarg2); public final static native void MgView_regenAppend__SWIG_0(long jarg1, MgView jarg1_, int jarg2, int jarg3); public final static native void MgView_regenAppend__SWIG_1(long jarg1, MgView jarg1_, int jarg2); public final static native void MgView_redraw__SWIG_0(long jarg1, MgView jarg1_, boolean jarg2); public final static native void MgView_redraw__SWIG_1(long jarg1, MgView jarg1_); public final static native boolean MgView_useFinger(long jarg1, MgView jarg1_); public final static native void MgView_commandChanged(long jarg1, MgView jarg1_); public final static native void MgView_selectionChanged(long jarg1, MgView jarg1_); public final static native void MgView_dynamicChanged(long jarg1, MgView jarg1_); public final static native boolean MgView_shapeWillAdded(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_); public final static native void MgView_shapeAdded(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_); public final static native boolean MgView_shapeWillDeleted(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_); public final static native int MgView_removeShape(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_); public final static native boolean MgView_shapeCanRotated(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_); public final static native boolean MgView_shapeCanTransform(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_); public final static native boolean MgView_shapeCanUnlock(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_); public final static native boolean MgView_shapeCanUngroup(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_); public final static native boolean MgView_shapeCanMovedHandle(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_, int jarg3); public final static native void MgView_shapeMoved(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_, int jarg3); public final static native boolean MgView_shapeWillChanged(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_, long jarg3, MgShape jarg3_); public final static native void MgView_shapeChanged(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_); public final static native boolean MgView_shapeDblClick(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_); public final static native boolean MgView_shapeClicked(long jarg1, MgView jarg1_, long jarg2, MgShape jarg2_, float jarg3, float jarg4); public final static native void MgView_showMessage(long jarg1, MgView jarg1_, String jarg2); public final static native void MgView_getLocalizedString(long jarg1, MgView jarg1_, String jarg2, long jarg3, MgStringCallback jarg3_); public final static native boolean MgView_isContextActionsVisible(long jarg1, MgView jarg1_); public final static native void MgView_hideContextActions(long jarg1, MgView jarg1_); public final static native boolean MgView_getOptionBool(long jarg1, MgView jarg1_, String jarg2, boolean jarg3); public final static native int MgView_getOptionInt(long jarg1, MgView jarg1_, String jarg2, int jarg3); public final static native float MgView_getOptionFloat(long jarg1, MgView jarg1_, String jarg2, float jarg3); public final static native void MgView_setOptionBool(long jarg1, MgView jarg1_, String jarg2, boolean jarg3); public final static native void MgView_setOptionInt(long jarg1, MgView jarg1_, String jarg2, int jarg3); public final static native void MgView_setOptionFloat(long jarg1, MgView jarg1_, String jarg2, float jarg3); public final static native void MgView_setOptionString(long jarg1, MgView jarg1_, String jarg2, String jarg3); public final static native void MgMotion_view_set(long jarg1, MgMotion jarg1_, long jarg2, MgView jarg2_); public final static native long MgMotion_view_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_gestureType_set(long jarg1, MgMotion jarg1_, int jarg2); public final static native int MgMotion_gestureType_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_gestureState_set(long jarg1, MgMotion jarg1_, int jarg2); public final static native int MgMotion_gestureState_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_pressDrag_set(long jarg1, MgMotion jarg1_, boolean jarg2); public final static native boolean MgMotion_pressDrag_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_switchGesture_set(long jarg1, MgMotion jarg1_, boolean jarg2); public final static native boolean MgMotion_switchGesture_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_velocity_set(long jarg1, MgMotion jarg1_, long jarg2, Vector2d jarg2_); public final static native long MgMotion_velocity_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_startPt_set(long jarg1, MgMotion jarg1_, long jarg2, Point2d jarg2_); public final static native long MgMotion_startPt_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_startPtM_set(long jarg1, MgMotion jarg1_, long jarg2, Point2d jarg2_); public final static native long MgMotion_startPtM_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_lastPt_set(long jarg1, MgMotion jarg1_, long jarg2, Point2d jarg2_); public final static native long MgMotion_lastPt_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_lastPtM_set(long jarg1, MgMotion jarg1_, long jarg2, Point2d jarg2_); public final static native long MgMotion_lastPtM_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_point_set(long jarg1, MgMotion jarg1_, long jarg2, Point2d jarg2_); public final static native long MgMotion_point_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_pointM_set(long jarg1, MgMotion jarg1_, long jarg2, Point2d jarg2_); public final static native long MgMotion_pointM_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_startPt2_set(long jarg1, MgMotion jarg1_, long jarg2, Point2d jarg2_); public final static native long MgMotion_startPt2_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_startPt2M_set(long jarg1, MgMotion jarg1_, long jarg2, Point2d jarg2_); public final static native long MgMotion_startPt2M_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_point2_set(long jarg1, MgMotion jarg1_, long jarg2, Point2d jarg2_); public final static native long MgMotion_point2_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_point2M_set(long jarg1, MgMotion jarg1_, long jarg2, Point2d jarg2_); public final static native long MgMotion_point2M_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_d2mgs_set(long jarg1, MgMotion jarg1_, float jarg2); public final static native float MgMotion_d2mgs_get(long jarg1, MgMotion jarg1_); public final static native void MgMotion_d2m_set(long jarg1, MgMotion jarg1_, float jarg2); public final static native float MgMotion_d2m_get(long jarg1, MgMotion jarg1_); public final static native long new_MgMotion(); public final static native boolean MgMotion_dragging(long jarg1, MgMotion jarg1_); public final static native long MgMotion_cmds(long jarg1, MgMotion jarg1_); public final static native long MgMotion_startCenterM(long jarg1, MgMotion jarg1_); public final static native long MgMotion_centerM(long jarg1, MgMotion jarg1_); public final static native float MgMotion_startDistanceM(long jarg1, MgMotion jarg1_); public final static native float MgMotion_distanceM(long jarg1, MgMotion jarg1_); public final static native float MgMotion_displayMmToModel__SWIG_0(long jarg1, MgMotion jarg1_, float jarg2, long jarg3, GiGraphics jarg3_); public final static native float MgMotion_displayMmToModel__SWIG_1(long jarg1, MgMotion jarg1_, float jarg2); public final static native float MgMotion_displayMmToModel__SWIG_2(long jarg1, MgMotion jarg1_, String jarg2, float jarg3); public final static native long MgMotion_displayMmToModelBox__SWIG_0(long jarg1, MgMotion jarg1_, float jarg2); public final static native long MgMotion_displayMmToModelBox__SWIG_1(long jarg1, MgMotion jarg1_, String jarg2, float jarg3); public final static native void delete_MgMotion(long jarg1); public final static native long new_MgCommand(String jarg1); public final static native void delete_MgCommand(long jarg1); public final static native void MgCommand_release(long jarg1, MgCommand jarg1_); public final static native boolean MgCommand_cancel(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_cancelSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_initialize(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgStorage jarg3_); public final static native boolean MgCommand_initializeSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgStorage jarg3_); public final static native boolean MgCommand_backStep(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_backStepSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_draw(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_, long jarg3, GiGraphics jarg3_); public final static native boolean MgCommand_gatherShapes(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShapes jarg3_); public final static native boolean MgCommand_gatherShapesSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShapes jarg3_); public final static native boolean MgCommand_click(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_clickSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_doubleClick(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_doubleClickSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_longPress(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_longPressSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_touchBegan(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_touchBeganSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_touchMoved(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_touchMovedSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_touchEnded(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_touchEndedSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_mouseHover(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_mouseHoverSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_twoFingersMove(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_twoFingersMoveSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommand_isDrawingCommand(long jarg1, MgCommand jarg1_); public final static native boolean MgCommand_isDrawingCommandSwigExplicitMgCommand(long jarg1, MgCommand jarg1_); public final static native boolean MgCommand_isFloatingCommand(long jarg1, MgCommand jarg1_); public final static native boolean MgCommand_isFloatingCommandSwigExplicitMgCommand(long jarg1, MgCommand jarg1_); public final static native boolean MgCommand_doContextAction(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native boolean MgCommand_doContextActionSwigExplicitMgCommand(long jarg1, MgCommand jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native void MgCommand_director_connect(MgCommand obj, long cptr, boolean mem_own, boolean weak_global); public final static native void MgCommand_change_ownership(MgCommand obj, long cptr, boolean take_or_release); public final static native void delete_CmdObserver(long jarg1); public final static native void CmdObserver_onDocLoaded(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, boolean jarg3); public final static native void CmdObserver_onEnterSelectCommand(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_); public final static native void CmdObserver_onUnloadCommands(long jarg1, CmdObserver jarg1_, long jarg2, MgCmdManager jarg2_); public final static native boolean CmdObserver_selectActionsNeedHided(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_); public final static native int CmdObserver_addShapeActions(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, Ints jarg3_, int jarg4, long jarg5, MgShape jarg5_); public final static native boolean CmdObserver_doAction(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native boolean CmdObserver_doEndAction(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native void CmdObserver_drawInShapeCommand(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgCommand jarg3_, long jarg4, GiGraphics jarg4_); public final static native void CmdObserver_drawInSelectCommand(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, int jarg4, long jarg5, GiGraphics jarg5_); public final static native void CmdObserver_onSelectionChanged(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean CmdObserver_onShapeWillAdded(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native void CmdObserver_onShapeAdded(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserver_onShapeWillDeleted(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native int CmdObserver_onShapeDeleted(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserver_onShapeCanRotated(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserver_onShapeCanTransform(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserver_onShapeCanUnlock(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserver_onShapeCanUngroup(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserver_onShapeCanMovedHandle(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, int jarg4); public final static native void CmdObserver_onShapeMoved(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, int jarg4); public final static native boolean CmdObserver_onShapeWillChanged(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, long jarg4, MgShape jarg4_); public final static native void CmdObserver_onShapeChanged(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native long CmdObserver_createShape(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native long CmdObserver_createCommand(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, String jarg3); public final static native boolean CmdObserver_onPreGesture(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_); public final static native void CmdObserver_onPostGesture(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_); public final static native void CmdObserver_onPointSnapped(long jarg1, CmdObserver jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native long new_CmdObserverDefault(); public final static native void delete_CmdObserverDefault(long jarg1); public final static native void CmdObserverDefault_onDocLoaded(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, boolean jarg3); public final static native void CmdObserverDefault_onDocLoadedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, boolean jarg3); public final static native void CmdObserverDefault_onEnterSelectCommand(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_); public final static native void CmdObserverDefault_onEnterSelectCommandSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_); public final static native void CmdObserverDefault_onUnloadCommands(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgCmdManager jarg2_); public final static native void CmdObserverDefault_onUnloadCommandsSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgCmdManager jarg2_); public final static native boolean CmdObserverDefault_selectActionsNeedHided(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean CmdObserverDefault_selectActionsNeedHidedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean CmdObserverDefault_doAction(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native boolean CmdObserverDefault_doActionSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native boolean CmdObserverDefault_doEndAction(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native boolean CmdObserverDefault_doEndActionSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native void CmdObserverDefault_drawInShapeCommand(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgCommand jarg3_, long jarg4, GiGraphics jarg4_); public final static native void CmdObserverDefault_drawInShapeCommandSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgCommand jarg3_, long jarg4, GiGraphics jarg4_); public final static native void CmdObserverDefault_drawInSelectCommand(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, int jarg4, long jarg5, GiGraphics jarg5_); public final static native void CmdObserverDefault_drawInSelectCommandSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, int jarg4, long jarg5, GiGraphics jarg5_); public final static native void CmdObserverDefault_onSelectionChanged(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_); public final static native void CmdObserverDefault_onSelectionChangedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean CmdObserverDefault_onShapeWillAdded(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeWillAddedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native void CmdObserverDefault_onShapeAdded(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native void CmdObserverDefault_onShapeAddedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeWillDeleted(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeWillDeletedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native int CmdObserverDefault_onShapeDeleted(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native int CmdObserverDefault_onShapeDeletedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeCanRotated(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeCanRotatedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeCanTransform(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeCanTransformSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeCanUnlock(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeCanUnlockSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeCanUngroup(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeCanUngroupSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native boolean CmdObserverDefault_onShapeCanMovedHandle(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, int jarg4); public final static native boolean CmdObserverDefault_onShapeCanMovedHandleSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, int jarg4); public final static native void CmdObserverDefault_onShapeMoved(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, int jarg4); public final static native void CmdObserverDefault_onShapeMovedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, int jarg4); public final static native boolean CmdObserverDefault_onShapeWillChanged(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, long jarg4, MgShape jarg4_); public final static native boolean CmdObserverDefault_onShapeWillChangedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_, long jarg4, MgShape jarg4_); public final static native void CmdObserverDefault_onShapeChanged(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native void CmdObserverDefault_onShapeChangedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native long CmdObserverDefault_createShape(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native long CmdObserverDefault_createShapeSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native long CmdObserverDefault_createCommand(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, String jarg3); public final static native long CmdObserverDefault_createCommandSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, String jarg3); public final static native int CmdObserverDefault_addShapeActions(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, Ints jarg3_, int jarg4, long jarg5, MgShape jarg5_); public final static native int CmdObserverDefault_addShapeActionsSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, Ints jarg3_, int jarg4, long jarg5, MgShape jarg5_); public final static native boolean CmdObserverDefault_onPreGesture(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean CmdObserverDefault_onPreGestureSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_); public final static native void CmdObserverDefault_onPostGesture(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_); public final static native void CmdObserverDefault_onPostGestureSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_); public final static native void CmdObserverDefault_onPointSnapped(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native void CmdObserverDefault_onPointSnappedSwigExplicitCmdObserverDefault(long jarg1, CmdObserverDefault jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native void CmdObserverDefault_director_connect(CmdObserverDefault obj, long cptr, boolean mem_own, boolean weak_global); public final static native void CmdObserverDefault_change_ownership(CmdObserverDefault obj, long cptr, boolean take_or_release); public final static native void CmdSubject_registerObserver(long jarg1, CmdSubject jarg1_, long jarg2, CmdObserver jarg2_); public final static native void CmdSubject_unregisterObserver(long jarg1, CmdSubject jarg1_, long jarg2, CmdObserver jarg2_); public final static native boolean CmdSubject_registerNamedObserver(long jarg1, CmdSubject jarg1_, String jarg2, long jarg3, CmdObserver jarg3_); public final static native long CmdSubject_findNamedObserver(long jarg1, CmdSubject jarg1_, String jarg2); public final static native void delete_CmdSubject(long jarg1); public final static native long new_MgCommandDraw(String jarg1); public final static native void delete_MgCommandDraw(long jarg1); public final static native long MgCommandDraw_addShape__SWIG_0(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShape jarg3_); public final static native long MgCommandDraw_addShape__SWIG_1(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_touchBeganStep(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_touchMovedStep(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_touchEndedStep(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native int MgCommandDraw_getShapeType(long jarg1, MgCommandDraw jarg1_); public final static native int MgCommandDraw_getShapeTypeSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_); public final static native void MgCommandDraw_ignoreStartPoint(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native int MgCommandDraw_getSnappedType(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native long MgCommandDraw_getLastSnappedPoint(); public final static native long MgCommandDraw_getLastSnappedOriginPoint(); public final static native int MgCommandDraw_getMaxStep(long jarg1, MgCommandDraw jarg1_); public final static native int MgCommandDraw_getMaxStepSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_); public final static native void MgCommandDraw_setStepPoint(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, int jarg3, long jarg4, Point2d jarg4_); public final static native void MgCommandDraw_setStepPointSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, int jarg3, long jarg4, Point2d jarg4_); public final static native boolean MgCommandDraw_isStepPointAccepted(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, Point2d jarg3_); public final static native boolean MgCommandDraw_isStepPointAcceptedSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, Point2d jarg3_); public final static native int MgCommandDraw_snapOptionsForStep(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native int MgCommandDraw_snapOptionsForStepSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native boolean MgCommandDraw_initialize(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgStorage jarg3_); public final static native boolean MgCommandDraw_initializeSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgStorage jarg3_); public final static native boolean MgCommandDraw_backStep(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_backStepSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_cancel(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_cancelSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_draw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, GiGraphics jarg3_); public final static native boolean MgCommandDraw_drawSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, GiGraphics jarg3_); public final static native boolean MgCommandDraw_gatherShapes(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShapes jarg3_); public final static native boolean MgCommandDraw_gatherShapesSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgShapes jarg3_); public final static native boolean MgCommandDraw_touchBegan(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_touchBeganSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_touchMoved(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_touchMovedSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_touchEnded(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_touchEndedSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_click(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_clickSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_longPress(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_longPressSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_mouseHover(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCommandDraw_mouseHoverSwigExplicitMgCommandDraw(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native int MgCommandDraw_getStep(long jarg1, MgCommandDraw jarg1_); public final static native long MgCommandDraw_dynshape(long jarg1, MgCommandDraw jarg1_); public final static native void MgCommandDraw_setStep(long jarg1, MgCommandDraw jarg1_, int jarg2); public final static native long MgCommandDraw_snapPointWidhOptions__SWIG_0(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, int jarg3, boolean jarg4); public final static native long MgCommandDraw_snapPointWidhOptions__SWIG_1(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native long MgCommandDraw_snapPoint__SWIG_0(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, boolean jarg3); public final static native long MgCommandDraw_snapPoint__SWIG_1(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_); public final static native long MgCommandDraw_snapPoint__SWIG_2(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, Point2d jarg3_, boolean jarg4); public final static native long MgCommandDraw_snapPoint__SWIG_3(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, Point2d jarg3_); public final static native long MgCommandDraw_snapPoint__SWIG_4(long jarg1, MgCommandDraw jarg1_, long jarg2, MgMotion jarg2_, long jarg3, Point2d jarg3_, boolean jarg4, int jarg5); public final static native void MgCommandDraw_director_connect(MgCommandDraw obj, long cptr, boolean mem_own, boolean weak_global); public final static native void MgCommandDraw_change_ownership(MgCommandDraw obj, long cptr, boolean take_or_release); public final static native long new_MgCmdArc3P__SWIG_0(String jarg1); public final static native long new_MgCmdArc3P__SWIG_1(); public final static native void MgCmdArc3P_release(long jarg1, MgCmdArc3P jarg1_); public final static native boolean MgCmdArc3P_touchBegan(long jarg1, MgCmdArc3P jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCmdArc3P_touchMoved(long jarg1, MgCmdArc3P jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCmdArc3P_touchEnded(long jarg1, MgCmdArc3P jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCmdArc3P_initialize(long jarg1, MgCmdArc3P jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgStorage jarg3_); public final static native boolean MgCmdArc3P_draw(long jarg1, MgCmdArc3P jarg1_, long jarg2, MgMotion jarg2_, long jarg3, GiGraphics jarg3_); public final static native void delete_MgCmdArc3P(long jarg1); public final static native long new_MgCmdArcCSE__SWIG_0(String jarg1); public final static native long new_MgCmdArcCSE__SWIG_1(); public final static native void MgCmdArcCSE_release(long jarg1, MgCmdArcCSE jarg1_); public final static native boolean MgCmdArcCSE_draw(long jarg1, MgCmdArcCSE jarg1_, long jarg2, MgMotion jarg2_, long jarg3, GiGraphics jarg3_); public final static native void delete_MgCmdArcCSE(long jarg1); public final static native long new_MgCmdSector__SWIG_0(String jarg1); public final static native long new_MgCmdSector__SWIG_1(); public final static native boolean MgCmdSector_initialize(long jarg1, MgCmdSector jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgStorage jarg3_); public final static native void delete_MgCmdSector(long jarg1); public final static native long new_MgCmdCompass__SWIG_0(String jarg1); public final static native long new_MgCmdCompass__SWIG_1(); public final static native void MgCmdCompass_release(long jarg1, MgCmdCompass jarg1_); public final static native boolean MgCmdCompass_initialize(long jarg1, MgCmdCompass jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgStorage jarg3_); public final static native boolean MgCmdCompass_draw(long jarg1, MgCmdCompass jarg1_, long jarg2, MgMotion jarg2_, long jarg3, GiGraphics jarg3_); public final static native boolean MgCmdCompass_click(long jarg1, MgCmdCompass jarg1_, long jarg2, MgMotion jarg2_); public final static native void delete_MgCmdCompass(long jarg1); public final static native long new_MgCmdArcTan__SWIG_0(String jarg1); public final static native long new_MgCmdArcTan__SWIG_1(); public final static native void MgCmdArcTan_release(long jarg1, MgCmdArcTan jarg1_); public final static native void delete_MgCmdArcTan(long jarg1); public final static native long new_MgCmdDrawRect__SWIG_0(String jarg1); public final static native long new_MgCmdDrawRect__SWIG_1(); public final static native void MgCmdDrawRect_release(long jarg1, MgCmdDrawRect jarg1_); public final static native void MgCmdDrawRect_releaseSwigExplicitMgCmdDrawRect(long jarg1, MgCmdDrawRect jarg1_); public final static native boolean MgCmdDrawRect_initialize(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgStorage jarg3_); public final static native boolean MgCmdDrawRect_initializeSwigExplicitMgCmdDrawRect(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_, long jarg3, MgStorage jarg3_); public final static native boolean MgCmdDrawRect_backStep(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCmdDrawRect_backStepSwigExplicitMgCmdDrawRect(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCmdDrawRect_touchBegan(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCmdDrawRect_touchBeganSwigExplicitMgCmdDrawRect(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCmdDrawRect_touchMoved(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCmdDrawRect_touchMovedSwigExplicitMgCmdDrawRect(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCmdDrawRect_touchEnded(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCmdDrawRect_touchEndedSwigExplicitMgCmdDrawRect(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_); public final static native void MgCmdDrawRect_addRectShape(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_); public final static native void MgCmdDrawRect_addRectShapeSwigExplicitMgCmdDrawRect(long jarg1, MgCmdDrawRect jarg1_, long jarg2, MgMotion jarg2_); public final static native void delete_MgCmdDrawRect(long jarg1); public final static native void MgCmdDrawRect_director_connect(MgCmdDrawRect obj, long cptr, boolean mem_own, boolean weak_global); public final static native void MgCmdDrawRect_change_ownership(MgCmdDrawRect obj, long cptr, boolean take_or_release); public final static native void delete_MgCmdManager(long jarg1); public final static native void MgCmdManager_release(long jarg1, MgCmdManager jarg1_); public final static native long MgCmdManager_getCommand(long jarg1, MgCmdManager jarg1_); public final static native long MgCmdManager_findCommand(long jarg1, MgCmdManager jarg1_, String jarg2); public final static native boolean MgCmdManager_setCommand(long jarg1, MgCmdManager jarg1_, long jarg2, MgMotion jarg2_, String jarg3, long jarg4, MgStorage jarg4_); public final static native boolean MgCmdManager_switchCommand(long jarg1, MgCmdManager jarg1_, long jarg2, MgMotion jarg2_); public final static native boolean MgCmdManager_cancel(long jarg1, MgCmdManager jarg1_, long jarg2, MgMotion jarg2_); public final static native void MgCmdManager_unloadCommands(long jarg1, MgCmdManager jarg1_); public final static native int MgCmdManager_getNewShapeID(long jarg1, MgCmdManager jarg1_); public final static native void MgCmdManager_setNewShapeID(long jarg1, MgCmdManager jarg1_, int jarg2); public final static native float MgCmdManager_displayMmToModel__SWIG_0(long jarg1, MgCmdManager jarg1_, float jarg2, long jarg3, GiGraphics jarg3_); public final static native float MgCmdManager_displayMmToModel__SWIG_1(long jarg1, MgCmdManager jarg1_, float jarg2, long jarg3, MgMotion jarg3_); public final static native boolean MgCmdManager_dynamicChangeEnded(long jarg1, MgCmdManager jarg1_, long jarg2, MgView jarg2_, boolean jarg3); public final static native long MgCmdManager_getSelection(long jarg1, MgCmdManager jarg1_); public final static native long MgCmdManager_getActionDispatcher(long jarg1, MgCmdManager jarg1_); public final static native boolean MgCmdManager_doContextAction(long jarg1, MgCmdManager jarg1_, long jarg2, MgMotion jarg2_, int jarg3); public final static native long MgCmdManager_getSnap(long jarg1, MgCmdManager jarg1_); public final static native long MgCmdManager_getCmdSubject(long jarg1, MgCmdManager jarg1_); public final static native long MgCmdManager_addImageShape__SWIG_0(long jarg1, MgCmdManager jarg1_, long jarg2, MgMotion jarg2_, String jarg3, float jarg4, float jarg5); public final static native long MgCmdManager_addImageShape__SWIG_1(long jarg1, MgCmdManager jarg1_, long jarg2, MgMotion jarg2_, String jarg3, float jarg4, float jarg5, float jarg6, float jarg7, int jarg8); public final static native void MgCmdManager_getBoundingBox(long jarg1, MgCmdManager jarg1_, long jarg2, Box2d jarg2_, long jarg3, MgMotion jarg3_); public final static native long MgCmdManagerFactory_create(); public final static native long new_MgCmdManagerFactory(); public final static native void delete_MgCmdManagerFactory(long jarg1); public final static native int MgLayer_Type(); public final static native long MgLayer_cloneLayer(long jarg1, MgLayer jarg1_); public final static native long MgLayer_create(long jarg1, MgShapeDoc jarg1_, int jarg2); public final static native long MgLayer_doc(long jarg1, MgLayer jarg1_); public final static native boolean MgLayer_isHided(long jarg1, MgLayer jarg1_); public final static native void MgLayer_setHided(long jarg1, MgLayer jarg1_, boolean jarg2); public final static native boolean MgLayer_isLocked(long jarg1, MgLayer jarg1_); public final static native void MgLayer_setLocked(long jarg1, MgLayer jarg1_, boolean jarg2); public final static native long MgLayer_clone(long jarg1, MgLayer jarg1_); public final static native void MgLayer_copy(long jarg1, MgLayer jarg1_, long jarg2, MgObject jarg2_); public final static native void MgLayer_release(long jarg1, MgLayer jarg1_); public final static native boolean MgLayer_equals(long jarg1, MgLayer jarg1_, long jarg2, MgObject jarg2_); public final static native int MgLayer_getType(long jarg1, MgLayer jarg1_); public final static native boolean MgLayer_isKindOf(long jarg1, MgLayer jarg1_, int jarg2); public final static native int MgShapeDoc_Type(); public final static native long MgShapeDoc_cloneDoc(long jarg1, MgShapeDoc jarg1_); public final static native long MgShapeDoc_shallowCopy(long jarg1, MgShapeDoc jarg1_); public final static native int MgShapeDoc_copyShapes(long jarg1, MgShapeDoc jarg1_, long jarg2, MgShapeDoc jarg2_, boolean jarg3); public final static native long MgShapeDoc_createDoc(); public final static native boolean MgShapeDoc_save(long jarg1, MgShapeDoc jarg1_, long jarg2, MgStorage jarg2_, int jarg3); public final static native boolean MgShapeDoc_saveAll(long jarg1, MgShapeDoc jarg1_, long jarg2, MgStorage jarg2_, long jarg3, GiTransform jarg3_); public final static native boolean MgShapeDoc_load(long jarg1, MgShapeDoc jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_, boolean jarg4); public final static native boolean MgShapeDoc_loadAll(long jarg1, MgShapeDoc jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgStorage jarg3_, long jarg4, GiTransform jarg4_); public final static native void MgShapeDoc_clear(long jarg1, MgShapeDoc jarg1_); public final static native void MgShapeDoc_clearCachedData(long jarg1, MgShapeDoc jarg1_); public final static native int MgShapeDoc_draw(long jarg1, MgShapeDoc jarg1_, long jarg2, GiGraphics jarg2_); public final static native int MgShapeDoc_dyndraw(long jarg1, MgShapeDoc jarg1_, int jarg2, long jarg3, GiGraphics jarg3_); public final static native long MgShapeDoc_getExtent(long jarg1, MgShapeDoc jarg1_); public final static native int MgShapeDoc_getShapeCount(long jarg1, MgShapeDoc jarg1_); public final static native long MgShapeDoc_findShape(long jarg1, MgShapeDoc jarg1_, int jarg2); public final static native long MgShapeDoc_getLastShape(long jarg1, MgShapeDoc jarg1_); public final static native long MgShapeDoc_getCurrentShapes(long jarg1, MgShapeDoc jarg1_); public final static native boolean MgShapeDoc_setCurrentShapes(long jarg1, MgShapeDoc jarg1_, long jarg2, MgShapes jarg2_); public final static native long MgShapeDoc_getCurrentLayer(long jarg1, MgShapeDoc jarg1_); public final static native boolean MgShapeDoc_switchLayer(long jarg1, MgShapeDoc jarg1_, int jarg2); public final static native int MgShapeDoc_getLayerCount(long jarg1, MgShapeDoc jarg1_); public final static native long MgShapeDoc_context(long jarg1, MgShapeDoc jarg1_); public final static native long MgShapeDoc_modelTransform(long jarg1, MgShapeDoc jarg1_); public final static native long MgShapeDoc_getPageRectW(long jarg1, MgShapeDoc jarg1_); public final static native float MgShapeDoc_getViewScale(long jarg1, MgShapeDoc jarg1_); public final static native void MgShapeDoc_setPageRectW__SWIG_0(long jarg1, MgShapeDoc jarg1_, long jarg2, Box2d jarg2_, float jarg3, boolean jarg4); public final static native void MgShapeDoc_setPageRectW__SWIG_1(long jarg1, MgShapeDoc jarg1_, long jarg2, Box2d jarg2_, float jarg3); public final static native boolean MgShapeDoc_zoomToInitial(long jarg1, MgShapeDoc jarg1_, long jarg2, GiTransform jarg2_); public final static native boolean MgShapeDoc_isReadOnly(long jarg1, MgShapeDoc jarg1_); public final static native void MgShapeDoc_setReadOnly(long jarg1, MgShapeDoc jarg1_, boolean jarg2); public final static native long MgShapeDoc_fromHandle(int jarg1); public final static native int MgShapeDoc_toHandle(long jarg1, MgShapeDoc jarg1_); public final static native long MgShapeDoc_clone(long jarg1, MgShapeDoc jarg1_); public final static native void MgShapeDoc_copy(long jarg1, MgShapeDoc jarg1_, long jarg2, MgObject jarg2_); public final static native void MgShapeDoc_release(long jarg1, MgShapeDoc jarg1_); public final static native void MgShapeDoc_addRef(long jarg1, MgShapeDoc jarg1_); public final static native boolean MgShapeDoc_equals(long jarg1, MgShapeDoc jarg1_, long jarg2, MgObject jarg2_); public final static native int MgShapeDoc_getType(long jarg1, MgShapeDoc jarg1_); public final static native boolean MgShapeDoc_isKindOf(long jarg1, MgShapeDoc jarg1_, int jarg2); public final static native void delete_GiView(long jarg1); public final static native void GiView_regenAll(long jarg1, GiView jarg1_, boolean jarg2); public final static native void GiView_regenAllSwigExplicitGiView(long jarg1, GiView jarg1_, boolean jarg2); public final static native void GiView_regenAppend(long jarg1, GiView jarg1_, int jarg2, int jarg3); public final static native void GiView_regenAppendSwigExplicitGiView(long jarg1, GiView jarg1_, int jarg2, int jarg3); public final static native void GiView_redraw(long jarg1, GiView jarg1_, boolean jarg2); public final static native void GiView_redrawSwigExplicitGiView(long jarg1, GiView jarg1_, boolean jarg2); public final static native boolean GiView_useFinger(long jarg1, GiView jarg1_); public final static native boolean GiView_useFingerSwigExplicitGiView(long jarg1, GiView jarg1_); public final static native boolean GiView_isContextActionsVisible(long jarg1, GiView jarg1_); public final static native boolean GiView_isContextActionsVisibleSwigExplicitGiView(long jarg1, GiView jarg1_); public final static native boolean GiView_showContextActions(long jarg1, GiView jarg1_, long jarg2, Ints jarg2_, long jarg3, Floats jarg3_, float jarg4, float jarg5, float jarg6, float jarg7); public final static native boolean GiView_showContextActionsSwigExplicitGiView(long jarg1, GiView jarg1_, long jarg2, Ints jarg2_, long jarg3, Floats jarg3_, float jarg4, float jarg5, float jarg6, float jarg7); public final static native void GiView_hideContextActions(long jarg1, GiView jarg1_); public final static native void GiView_hideContextActionsSwigExplicitGiView(long jarg1, GiView jarg1_); public final static native void GiView_commandChanged(long jarg1, GiView jarg1_); public final static native void GiView_commandChangedSwigExplicitGiView(long jarg1, GiView jarg1_); public final static native void GiView_selectionChanged(long jarg1, GiView jarg1_); public final static native void GiView_selectionChangedSwigExplicitGiView(long jarg1, GiView jarg1_); public final static native void GiView_contentChanged(long jarg1, GiView jarg1_); public final static native void GiView_contentChangedSwigExplicitGiView(long jarg1, GiView jarg1_); public final static native void GiView_dynamicChanged(long jarg1, GiView jarg1_); public final static native void GiView_dynamicChangedSwigExplicitGiView(long jarg1, GiView jarg1_); public final static native void GiView_zoomChanged(long jarg1, GiView jarg1_); public final static native void GiView_zoomChangedSwigExplicitGiView(long jarg1, GiView jarg1_); public final static native void GiView_viewChanged(long jarg1, GiView jarg1_, long jarg2, GiView jarg2_); public final static native void GiView_viewChangedSwigExplicitGiView(long jarg1, GiView jarg1_, long jarg2, GiView jarg2_); public final static native void GiView_shapeWillDelete(long jarg1, GiView jarg1_, int jarg2); public final static native void GiView_shapeWillDeleteSwigExplicitGiView(long jarg1, GiView jarg1_, int jarg2); public final static native void GiView_shapeDeleted(long jarg1, GiView jarg1_, int jarg2); public final static native void GiView_shapeDeletedSwigExplicitGiView(long jarg1, GiView jarg1_, int jarg2); public final static native boolean GiView_shapeDblClick(long jarg1, GiView jarg1_, int jarg2, int jarg3, int jarg4); public final static native boolean GiView_shapeDblClickSwigExplicitGiView(long jarg1, GiView jarg1_, int jarg2, int jarg3, int jarg4); public final static native boolean GiView_shapeClicked(long jarg1, GiView jarg1_, int jarg2, int jarg3, int jarg4, float jarg5, float jarg6); public final static native boolean GiView_shapeClickedSwigExplicitGiView(long jarg1, GiView jarg1_, int jarg2, int jarg3, int jarg4, float jarg5, float jarg6); public final static native void GiView_showMessage(long jarg1, GiView jarg1_, String jarg2); public final static native void GiView_showMessageSwigExplicitGiView(long jarg1, GiView jarg1_, String jarg2); public final static native void GiView_getLocalizedString(long jarg1, GiView jarg1_, String jarg2, long jarg3, MgStringCallback jarg3_); public final static native void GiView_getLocalizedStringSwigExplicitGiView(long jarg1, GiView jarg1_, String jarg2, long jarg3, MgStringCallback jarg3_); public final static native long new_GiView(); public final static native void GiView_director_connect(GiView obj, long cptr, boolean mem_own, boolean weak_global); public final static native void GiView_change_ownership(GiView obj, long cptr, boolean take_or_release); public final static native void delete_MgStringCallback(long jarg1); public final static native void MgStringCallback_onGetString(long jarg1, MgStringCallback jarg1_, String jarg2); public final static native long new_MgStringCallback(); public final static native void MgStringCallback_director_connect(MgStringCallback obj, long cptr, boolean mem_own, boolean weak_global); public final static native void MgStringCallback_change_ownership(MgStringCallback obj, long cptr, boolean take_or_release); public final static native void delete_MgFindImageCallback(long jarg1); public final static native void MgFindImageCallback_onFindImage(long jarg1, MgFindImageCallback jarg1_, int jarg2, String jarg3); public final static native long new_MgFindImageCallback(); public final static native void MgFindImageCallback_director_connect(MgFindImageCallback obj, long cptr, boolean mem_own, boolean weak_global); public final static native void MgFindImageCallback_change_ownership(MgFindImageCallback obj, long cptr, boolean take_or_release); public final static native void delete_MgCoreView(long jarg1); public final static native long MgCoreView_fromHandle(int jarg1); public final static native int MgCoreView_toHandle(long jarg1, MgCoreView jarg1_); public final static native void MgCoreView_release(long jarg1, MgCoreView jarg1_); public final static native void MgCoreView_addRef(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_viewDataHandle(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_viewAdapterHandle(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_backDoc(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_backShapes(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_acquireFrontDoc__SWIG_0(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_acquireFrontDoc__SWIG_1(long jarg1, MgCoreView jarg1_, int jarg2); public final static native void MgCoreView_releaseDoc(int jarg1); public final static native int MgCoreView_acquireDynamicShapes(long jarg1, MgCoreView jarg1_); public final static native void MgCoreView_releaseShapes(int jarg1); public final static native boolean MgCoreView_isDrawing(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_isZooming(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_isStopping(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_stopDrawing__SWIG_0(long jarg1, MgCoreView jarg1_, boolean jarg2); public final static native int MgCoreView_stopDrawing__SWIG_1(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_isUndoRecording(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_isRecording(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_isPlaying(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_isPaused(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getRecordTick(long jarg1, MgCoreView jarg1_, boolean jarg2, int jarg3); public final static native boolean MgCoreView_isUndoLoading(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_canUndo(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_canRedo(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getRedoIndex(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getRedoCount(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getPlayingTick(long jarg1, MgCoreView jarg1_, int jarg2); public final static native int MgCoreView_getFrameTick(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getFrameFlags(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getFrameIndex(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_isPressDragging(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_isDrawingCommand(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_isCommand(long jarg1, MgCoreView jarg1_, String jarg2); public final static native void MgCoreView_getCommand(long jarg1, MgCoreView jarg1_, long jarg2, MgStringCallback jarg2_); public final static native boolean MgCoreView_setCommand__SWIG_0(long jarg1, MgCoreView jarg1_, String jarg2, String jarg3); public final static native boolean MgCoreView_setCommand__SWIG_1(long jarg1, MgCoreView jarg1_, String jarg2); public final static native boolean MgCoreView_switchCommand(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_doContextAction(long jarg1, MgCoreView jarg1_, int jarg2); public final static native void MgCoreView_clearCachedData(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_addShapesForTest__SWIG_0(long jarg1, MgCoreView jarg1_, int jarg2); public final static native int MgCoreView_addShapesForTest__SWIG_1(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getShapeCount__SWIG_0(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getShapeCount__SWIG_1(long jarg1, MgCoreView jarg1_, int jarg2); public final static native int MgCoreView_getUnlockedShapeCount__SWIG_0(long jarg1, MgCoreView jarg1_, int jarg2); public final static native int MgCoreView_getUnlockedShapeCount__SWIG_1(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getVisibleShapeCount__SWIG_0(long jarg1, MgCoreView jarg1_, int jarg2); public final static native int MgCoreView_getVisibleShapeCount__SWIG_1(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getChangeCount(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getDrawCount(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getSelectedShapeCount(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getSelectedShapeType(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getSelectedShapeID(long jarg1, MgCoreView jarg1_); public final static native int MgCoreView_getSelectedHandle(long jarg1, MgCoreView jarg1_); public final static native void MgCoreView_getSelectedShapeIDs(long jarg1, MgCoreView jarg1_, long jarg2, Ints jarg2_); public final static native void MgCoreView_setSelectedShapeIDs(long jarg1, MgCoreView jarg1_, long jarg2, Ints jarg2_); public final static native void MgCoreView_clear(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_loadFromFile__SWIG_0(long jarg1, MgCoreView jarg1_, String jarg2, boolean jarg3); public final static native boolean MgCoreView_loadFromFile__SWIG_1(long jarg1, MgCoreView jarg1_, String jarg2); public final static native boolean MgCoreView_saveToFile__SWIG_0(long jarg1, MgCoreView jarg1_, int jarg2, String jarg3, boolean jarg4); public final static native boolean MgCoreView_saveToFile__SWIG_1(long jarg1, MgCoreView jarg1_, int jarg2, String jarg3); public final static native boolean MgCoreView_saveToFile__SWIG_2(long jarg1, MgCoreView jarg1_, String jarg2, boolean jarg3); public final static native boolean MgCoreView_saveToFile__SWIG_3(long jarg1, MgCoreView jarg1_, String jarg2); public final static native boolean MgCoreView_loadShapes__SWIG_0(long jarg1, MgCoreView jarg1_, long jarg2, MgStorage jarg2_, boolean jarg3); public final static native boolean MgCoreView_loadShapes__SWIG_1(long jarg1, MgCoreView jarg1_, long jarg2, MgStorage jarg2_); public final static native boolean MgCoreView_saveShapes__SWIG_0(long jarg1, MgCoreView jarg1_, int jarg2, long jarg3, MgStorage jarg3_); public final static native boolean MgCoreView_saveShapes__SWIG_1(long jarg1, MgCoreView jarg1_, long jarg2, MgStorage jarg2_); public final static native void MgCoreView_getContent__SWIG_0(long jarg1, MgCoreView jarg1_, int jarg2, long jarg3, MgStringCallback jarg3_); public final static native void MgCoreView_getContent__SWIG_1(long jarg1, MgCoreView jarg1_, long jarg2, MgStringCallback jarg2_); public final static native void MgCoreView_freeContent(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_setContent__SWIG_0(long jarg1, MgCoreView jarg1_, String jarg2, boolean jarg3); public final static native boolean MgCoreView_setContent__SWIG_1(long jarg1, MgCoreView jarg1_, String jarg2); public final static native boolean MgCoreView_zoomToInitial(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_zoomToExtent__SWIG_0(long jarg1, MgCoreView jarg1_, float jarg2); public final static native boolean MgCoreView_zoomToExtent__SWIG_1(long jarg1, MgCoreView jarg1_); public final static native boolean MgCoreView_zoomToModel__SWIG_0(long jarg1, MgCoreView jarg1_, float jarg2, float jarg3, float jarg4, float jarg5, float jarg6); public final static native boolean MgCoreView_zoomToModel__SWIG_1(long jarg1, MgCoreView jarg1_, float jarg2, float jarg3, float jarg4, float jarg5); public final static native boolean MgCoreView_zoomPan__SWIG_0(long jarg1, MgCoreView jarg1_, float jarg2, float jarg3, boolean jarg4); public final static native boolean MgCoreView_zoomPan__SWIG_1(long jarg1, MgCoreView jarg1_, float jarg2, float jarg3); public final static native long MgCoreView_getContext(long jarg1, MgCoreView jarg1_, boolean jarg2); public final static native void MgCoreView_setContext__SWIG_0(long jarg1, MgCoreView jarg1_, int jarg2); public final static native boolean MgCoreView_getShapeFlag(long jarg1, MgCoreView jarg1_, int jarg2, int jarg3); public final static native boolean MgCoreView_setShapeFlag(long jarg1, MgCoreView jarg1_, int jarg2, int jarg3, boolean jarg4); public final static native void MgCoreView_setContext__SWIG_1(long jarg1, MgCoreView jarg1_, long jarg2, GiContext jarg2_, int jarg3, int jarg4); public final static native void MgCoreView_setContextEditing(long jarg1, MgCoreView jarg1_, boolean jarg2); public final static native int MgCoreView_addImageShape__SWIG_0(long jarg1, MgCoreView jarg1_, String jarg2, float jarg3, float jarg4); public final static native int MgCoreView_addImageShape__SWIG_1(long jarg1, MgCoreView jarg1_, String jarg2, float jarg3, float jarg4, float jarg5, float jarg6, int jarg7); public final static native boolean MgCoreView_hasImageShape(long jarg1, MgCoreView jarg1_, int jarg2); public final static native boolean MgCoreView_getImageSize(long jarg1, MgCoreView jarg1_, long jarg2, Floats jarg2_, int jarg3); public final static native int MgCoreView_findShapeByImageID(long jarg1, MgCoreView jarg1_, int jarg2, String jarg3); public final static native int MgCoreView_findShapeByTag(long jarg1, MgCoreView jarg1_, int jarg2, int jarg3); public final static native int MgCoreView_traverseImageShapes(long jarg1, MgCoreView jarg1_, int jarg2, long jarg3, MgFindImageCallback jarg3_); public final static native boolean MgCoreView_getViewModelBox(long jarg1, MgCoreView jarg1_, long jarg2, Floats jarg2_); public final static native boolean MgCoreView_getModelBox__SWIG_0(long jarg1, MgCoreView jarg1_, long jarg2, Floats jarg2_); public final static native boolean MgCoreView_getModelBox__SWIG_1(long jarg1, MgCoreView jarg1_, long jarg2, Floats jarg2_, int jarg3); public final static native boolean MgCoreView_getHandlePoint(long jarg1, MgCoreView jarg1_, long jarg2, Floats jarg2_, int jarg3, int jarg4); public final static native boolean MgCoreView_getDisplayExtent__SWIG_0(long jarg1, MgCoreView jarg1_, long jarg2, Floats jarg2_); public final static native boolean MgCoreView_getDisplayExtent__SWIG_1(long jarg1, MgCoreView jarg1_, int jarg2, int jarg3, long jarg4, Floats jarg4_); public final static native boolean MgCoreView_getBoundingBox__SWIG_0(long jarg1, MgCoreView jarg1_, long jarg2, Floats jarg2_); public final static native boolean MgCoreView_getBoundingBox__SWIG_1(long jarg1, MgCoreView jarg1_, long jarg2, Floats jarg2_, int jarg3); public final static native boolean MgCoreView_getBoundingBox__SWIG_2(long jarg1, MgCoreView jarg1_, int jarg2, int jarg3, long jarg4, Floats jarg4_, int jarg5); public final static native boolean MgCoreView_displayToModel(long jarg1, MgCoreView jarg1_, long jarg2, Floats jarg2_); public final static native int MgCoreView_importSVGPath(long jarg1, MgCoreView jarg1_, int jarg2, int jarg3, String jarg4); public final static native int MgCoreView_exportSVGPath(long jarg1, MgCoreView jarg1_, int jarg2, int jarg3, String jarg4, int jarg5); public final static native boolean MgCoreView_exportSVGPath2(long jarg1, MgCoreView jarg1_, long jarg2, MgStringCallback jarg2_, int jarg3, int jarg4); public final static native void delete_MgOptionCallback(long jarg1); public final static native void MgOptionCallback_onGetOptionBool(long jarg1, MgOptionCallback jarg1_, String jarg2, boolean jarg3); public final static native void MgOptionCallback_onGetOptionInt(long jarg1, MgOptionCallback jarg1_, String jarg2, int jarg3); public final static native void MgOptionCallback_onGetOptionFloat(long jarg1, MgOptionCallback jarg1_, String jarg2, float jarg3); public final static native void MgOptionCallback_onGetOptionString(long jarg1, MgOptionCallback jarg1_, String jarg2, String jarg3); public final static native long new_MgOptionCallback(); public final static native void MgOptionCallback_director_connect(MgOptionCallback obj, long cptr, boolean mem_own, boolean weak_global); public final static native void MgOptionCallback_change_ownership(MgOptionCallback obj, long cptr, boolean take_or_release); public final static native long new_MgRegenLocker(long jarg1, MgView jarg1_); public final static native void delete_MgRegenLocker(long jarg1); public final static native long GiCoreView_createView__SWIG_0(long jarg1, GiView jarg1_, int jarg2); public final static native long GiCoreView_createView__SWIG_1(long jarg1, GiView jarg1_); public final static native long GiCoreView_createMagnifierView(long jarg1, GiView jarg1_, long jarg2, GiCoreView jarg2_, long jarg3, GiView jarg3_); public final static native void GiCoreView_destoryView(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_); public final static native int GiCoreView_acquireGraphics(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_); public final static native void GiCoreView_releaseGraphics(long jarg1, GiCoreView jarg1_, int jarg2); public final static native int GiCoreView_acquireFrontDocs(long jarg1, GiCoreView jarg1_, long jarg2, Longs jarg2_); public final static native void GiCoreView_releaseDocs(long jarg1, Longs jarg1_); public final static native int GiCoreView_getSkipDrawIds(long jarg1, GiCoreView jarg1_, long jarg2, Ints jarg2_); public final static native int GiCoreView_acquireDynamicShapesArray(long jarg1, GiCoreView jarg1_, long jarg2, Longs jarg2_); public final static native void GiCoreView_releaseShapesArray(long jarg1, Longs jarg1_); public final static native int GiCoreView_drawAll__SWIG_0(long jarg1, GiCoreView jarg1_, int jarg2, int jarg3, long jarg4, GiCanvas jarg4_); public final static native int GiCoreView_drawAll__SWIG_1(long jarg1, GiCoreView jarg1_, long jarg2, Longs jarg2_, int jarg3, long jarg4, GiCanvas jarg4_); public final static native int GiCoreView_drawAll__SWIG_2(long jarg1, GiCoreView jarg1_, long jarg2, Longs jarg2_, int jarg3, long jarg4, GiCanvas jarg4_, long jarg5, Ints jarg5_); public final static native int GiCoreView_drawAppend__SWIG_0(long jarg1, GiCoreView jarg1_, int jarg2, int jarg3, long jarg4, GiCanvas jarg4_, int jarg5); public final static native int GiCoreView_dynDraw__SWIG_0(long jarg1, GiCoreView jarg1_, int jarg2, int jarg3, long jarg4, GiCanvas jarg4_); public final static native int GiCoreView_dynDraw__SWIG_1(long jarg1, GiCoreView jarg1_, long jarg2, Longs jarg2_, int jarg3, long jarg4, GiCanvas jarg4_); public final static native int GiCoreView_drawAll__SWIG_3(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, long jarg3, GiCanvas jarg3_); public final static native int GiCoreView_drawAppend__SWIG_1(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, long jarg3, GiCanvas jarg3_, int jarg4); public final static native int GiCoreView_dynDraw__SWIG_2(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, long jarg3, GiCanvas jarg3_); public final static native int GiCoreView_setBkColor(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, int jarg3); public final static native void GiCoreView_setScreenDpi__SWIG_0(int jarg1, float jarg2); public final static native void GiCoreView_setScreenDpi__SWIG_1(int jarg1); public final static native void GiCoreView_onSize(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, int jarg3, int jarg4); public final static native void GiCoreView_setViewScaleRange(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, float jarg3, float jarg4); public final static native void GiCoreView_setPenWidthRange(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, float jarg3, float jarg4); public final static native void GiCoreView_setGestureVelocity(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, float jarg3, float jarg4); public final static native boolean GiCoreView_onGesture__SWIG_0(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, int jarg3, int jarg4, float jarg5, float jarg6, boolean jarg7); public final static native boolean GiCoreView_onGesture__SWIG_1(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, int jarg3, int jarg4, float jarg5, float jarg6); public final static native boolean GiCoreView_twoFingersMove__SWIG_0(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, int jarg3, float jarg4, float jarg5, float jarg6, float jarg7, boolean jarg8); public final static native boolean GiCoreView_twoFingersMove__SWIG_1(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, int jarg3, float jarg4, float jarg5, float jarg6, float jarg7); public final static native boolean GiCoreView_submitBackDoc(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, boolean jarg3); public final static native boolean GiCoreView_submitDynamicShapes(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_); public final static native float GiCoreView_calcPenWidth(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, float jarg3); public final static native int GiCoreView_getGestureType(long jarg1, GiCoreView jarg1_); public final static native int GiCoreView_getGestureState(long jarg1, GiCoreView jarg1_); public final static native int GiCoreView_getVersion(); public final static native boolean GiCoreView_isZoomEnabled(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_); public final static native void GiCoreView_setZoomEnabled(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, boolean jarg3); public final static native int GiCoreView_exportSVG__SWIG_0(long jarg1, GiCoreView jarg1_, int jarg2, int jarg3, String jarg4); public final static native int GiCoreView_exportSVG__SWIG_1(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_, String jarg3); public final static native boolean GiCoreView_startRecord__SWIG_0(long jarg1, GiCoreView jarg1_, String jarg2, int jarg3, boolean jarg4, int jarg5, long jarg6, MgStringCallback jarg6_); public final static native boolean GiCoreView_startRecord__SWIG_1(long jarg1, GiCoreView jarg1_, String jarg2, int jarg3, boolean jarg4, int jarg5); public final static native void GiCoreView_stopRecord(long jarg1, GiCoreView jarg1_, boolean jarg2); public final static native boolean GiCoreView_recordShapes__SWIG_0(long jarg1, GiCoreView jarg1_, boolean jarg2, int jarg3, int jarg4, int jarg5, int jarg6); public final static native boolean GiCoreView_recordShapes__SWIG_1(long jarg1, GiCoreView jarg1_, boolean jarg2, int jarg3, int jarg4, int jarg5, int jarg6, long jarg7, Longs jarg7_, long jarg8, MgStringCallback jarg8_); public final static native boolean GiCoreView_recordShapes__SWIG_2(long jarg1, GiCoreView jarg1_, boolean jarg2, int jarg3, int jarg4, int jarg5, int jarg6, long jarg7, Longs jarg7_); public final static native boolean GiCoreView_undo(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_); public final static native boolean GiCoreView_redo(long jarg1, GiCoreView jarg1_, long jarg2, GiView jarg2_); public final static native boolean GiCoreView_onPause(long jarg1, GiCoreView jarg1_, int jarg2); public final static native boolean GiCoreView_onResume(long jarg1, GiCoreView jarg1_, int jarg2); public final static native boolean GiCoreView_restoreRecord(long jarg1, GiCoreView jarg1_, int jarg2, String jarg3, int jarg4, int jarg5, int jarg6, int jarg7, int jarg8, int jarg9); public final static native void GiCoreView_traverseOptions(long jarg1, GiCoreView jarg1_, long jarg2, MgOptionCallback jarg2_); public final static native void GiCoreView_setOptionBool(long jarg1, GiCoreView jarg1_, String jarg2, boolean jarg3); public final static native void GiCoreView_setOptionInt(long jarg1, GiCoreView jarg1_, String jarg2, int jarg3); public final static native void GiCoreView_setOptionFloat(long jarg1, GiCoreView jarg1_, String jarg2, float jarg3); public final static native void GiCoreView_setOptionString(long jarg1, GiCoreView jarg1_, String jarg2, String jarg3); public final static native void TestCanvas_initRand(); public final static native int TestCanvas_randInt(int jarg1, int jarg2); public final static native float TestCanvas_randFloat(float jarg1, float jarg2); public final static native void TestCanvas_test__SWIG_0(long jarg1, GiCanvas jarg1_, int jarg2, int jarg3, boolean jarg4); public final static native void TestCanvas_test__SWIG_1(long jarg1, GiCanvas jarg1_, int jarg2, int jarg3); public final static native void TestCanvas_test__SWIG_2(long jarg1, GiCanvas jarg1_, int jarg2); public final static native void TestCanvas_testRect(long jarg1, GiCanvas jarg1_, int jarg2); public final static native void TestCanvas_testLine(long jarg1, GiCanvas jarg1_, int jarg2); public final static native void TestCanvas_testEllipse(long jarg1, GiCanvas jarg1_, int jarg2); public final static native void TestCanvas_testQuadBezier(long jarg1, GiCanvas jarg1_, int jarg2); public final static native void TestCanvas_testCubicBezier(long jarg1, GiCanvas jarg1_, int jarg2); public final static native void TestCanvas_testPolygon(long jarg1, GiCanvas jarg1_, int jarg2); public final static native void TestCanvas_testClipPath(long jarg1, GiCanvas jarg1_, int jarg2); public final static native void TestCanvas_testHandle(long jarg1, GiCanvas jarg1_, int jarg2); public final static native void TestCanvas_testDynCurves(long jarg1, GiCanvas jarg1_); public final static native void TestCanvas_testTextAt(long jarg1, GiCanvas jarg1_, int jarg2); public final static native void TestCanvas_testRotateText(long jarg1, GiCanvas jarg1_, int jarg2); public final static native long new_TestCanvas(); public final static native void delete_TestCanvas(long jarg1); public final static native long GiPlaying_fromHandle(int jarg1); public final static native int GiPlaying_toHandle(long jarg1, GiPlaying jarg1_); public final static native long GiPlaying_create__SWIG_0(long jarg1, MgCoreView jarg1_, int jarg2, boolean jarg3); public final static native long GiPlaying_create__SWIG_1(long jarg1, MgCoreView jarg1_, int jarg2); public final static native void GiPlaying_release(long jarg1, GiPlaying jarg1_, long jarg2, MgCoreView jarg2_); public final static native void GiPlaying_clear(long jarg1, GiPlaying jarg1_); public final static native int GiPlaying_getTag(long jarg1, GiPlaying jarg1_); public final static native int GiPlaying_acquireFrontDoc(long jarg1, GiPlaying jarg1_); public final static native void GiPlaying_releaseDoc(int jarg1); public final static native long GiPlaying_getBackDoc(long jarg1, GiPlaying jarg1_); public final static native void GiPlaying_submitBackDoc(long jarg1, GiPlaying jarg1_); public final static native int GiPlaying_acquireFrontShapes(long jarg1, GiPlaying jarg1_); public final static native void GiPlaying_releaseShapes(int jarg1); public final static native int GiPlaying_getBackShapesHandle(long jarg1, GiPlaying jarg1_, boolean jarg2); public final static native long GiPlaying_getBackShapes(long jarg1, GiPlaying jarg1_, boolean jarg2); public final static native void GiPlaying_submitBackShapes(long jarg1, GiPlaying jarg1_); public final static native void GiPlaying_stop(long jarg1, GiPlaying jarg1_); public final static native boolean GiPlaying_isStopping(long jarg1, GiPlaying jarg1_); public final static native void GiPlayShapes_playing_set(long jarg1, GiPlayShapes jarg1_, long jarg2, GiPlaying jarg2_); public final static native long GiPlayShapes_playing_get(long jarg1, GiPlayShapes jarg1_); public final static native void GiPlayShapes_player_set(long jarg1, GiPlayShapes jarg1_, long jarg2, MgRecordShapes jarg2_); public final static native long GiPlayShapes_player_get(long jarg1, GiPlayShapes jarg1_); public final static native long new_GiPlayShapes(); public final static native void delete_GiPlayShapes(long jarg1); public final static native void GiCoreViewData_drawing_set(long jarg1, GiCoreViewData jarg1_, long jarg2, GiPlaying jarg2_); public final static native long GiCoreViewData_drawing_get(long jarg1, GiCoreViewData jarg1_); public final static native void GiCoreViewData_backDoc_set(long jarg1, GiCoreViewData jarg1_, long jarg2, MgShapeDoc jarg2_); public final static native long GiCoreViewData_backDoc_get(long jarg1, GiCoreViewData jarg1_); public final static native void GiCoreViewData_play_set(long jarg1, GiCoreViewData jarg1_, long jarg2, GiPlayShapes jarg2_); public final static native long GiCoreViewData_play_get(long jarg1, GiCoreViewData jarg1_); public final static native void GiCoreViewData_submitBackXform(long jarg1, GiCoreViewData jarg1_); public final static native long GiCoreViewData_fromHandle(int jarg1); public final static native void delete_GiCoreViewData(long jarg1); public final static native long GiCoreViewData_recorder(long jarg1, GiCoreViewData jarg1_, boolean jarg2); public final static native void GiCoreViewData_setRecorder(long jarg1, GiCoreViewData jarg1_, boolean jarg2, long jarg3, MgRecordShapes jarg3_); public final static native int GiCoreViewData_getPlayingCount(long jarg1, GiCoreViewData jarg1_); public final static native int GiCoreViewData_acquireFrontDoc(long jarg1, GiCoreViewData jarg1_, int jarg2); public final static native int GiCoreViewData_acquireFrontShapes(long jarg1, GiCoreViewData jarg1_, int jarg2); public final static native void GiCoreViewData_addPlaying(long jarg1, GiCoreViewData jarg1_, long jarg2, GiPlaying jarg2_); public final static native void GiCoreViewData_removePlaying(long jarg1, GiCoreViewData jarg1_, long jarg2, GiPlaying jarg2_); public final static native long new_MgRecordShapes(String jarg1, long jarg2, MgShapeDoc jarg2_, boolean jarg3, int jarg4); public final static native void delete_MgRecordShapes(long jarg1); public final static native int MgRecordShapes_getCurrentTick(long jarg1, MgRecordShapes jarg1_, int jarg2); public final static native boolean MgRecordShapes_isLoading(long jarg1, MgRecordShapes jarg1_); public final static native void MgRecordShapes_setLoading(long jarg1, MgRecordShapes jarg1_, boolean jarg2); public final static native boolean MgRecordShapes_onResume(long jarg1, MgRecordShapes jarg1_, int jarg2); public final static native void MgRecordShapes_restore(long jarg1, MgRecordShapes jarg1_, int jarg2, int jarg3, int jarg4, int jarg5); public final static native void MgRecordShapes_stopRecordIndex(long jarg1, MgRecordShapes jarg1_); public final static native boolean MgRecordShapes_isPlaying(long jarg1, MgRecordShapes jarg1_); public final static native int MgRecordShapes_getFileTick(long jarg1, MgRecordShapes jarg1_); public final static native int MgRecordShapes_getFileFlags(long jarg1, MgRecordShapes jarg1_); public final static native int MgRecordShapes_getFileCount(long jarg1, MgRecordShapes jarg1_); public final static native boolean MgRecordShapes_applyFirstFile__SWIG_0(long jarg1, MgRecordShapes jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgShapeDoc jarg3_); public final static native boolean MgRecordShapes_applyFirstFile__SWIG_1(long jarg1, MgRecordShapes jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgShapeDoc jarg3_, String jarg4); public final static native int MgRecordShapes_applyRedoFile(long jarg1, MgRecordShapes jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgShapeDoc jarg3_, long jarg4, MgShapes jarg4_, int jarg5); public final static native int MgRecordShapes_applyUndoFile(long jarg1, MgRecordShapes jarg1_, long jarg2, MgShapeFactory jarg2_, long jarg3, MgShapeDoc jarg3_, long jarg4, MgShapes jarg4_, int jarg5, int jarg6); public final static native long MgBaseShape_SWIGUpcast(long jarg1); public final static native long MgBaseRect_SWIGUpcast(long jarg1); public final static native long MgRect_SWIGUpcast(long jarg1); public final static native long MgBaseLines_SWIGUpcast(long jarg1); public final static native long MgLines_SWIGUpcast(long jarg1); public final static native long MgArc_SWIGUpcast(long jarg1); public final static native long MgDiamond_SWIGUpcast(long jarg1); public final static native long MgDot_SWIGUpcast(long jarg1); public final static native long MgEllipse_SWIGUpcast(long jarg1); public final static native long MgGrid_SWIGUpcast(long jarg1); public final static native long MgLine_SWIGUpcast(long jarg1); public final static native long MgParallel_SWIGUpcast(long jarg1); public final static native long MgPathShape_SWIGUpcast(long jarg1); public final static native long MgRoundRect_SWIGUpcast(long jarg1); public final static native long MgSplines_SWIGUpcast(long jarg1); public final static native long MgShape_SWIGUpcast(long jarg1); public final static native long MgShapes_SWIGUpcast(long jarg1); public final static native long MgComposite_SWIGUpcast(long jarg1); public final static native long MgGroup_SWIGUpcast(long jarg1); public final static native long MgImageShape_SWIGUpcast(long jarg1); public final static native long CmdObserverDefault_SWIGUpcast(long jarg1); public final static native long CmdSubject_SWIGUpcast(long jarg1); public final static native long MgCommandDraw_SWIGUpcast(long jarg1); public final static native long MgCmdArc3P_SWIGUpcast(long jarg1); public final static native long MgCmdArcCSE_SWIGUpcast(long jarg1); public final static native long MgCmdSector_SWIGUpcast(long jarg1); public final static native long MgCmdCompass_SWIGUpcast(long jarg1); public final static native long MgCmdArcTan_SWIGUpcast(long jarg1); public final static native long MgCmdDrawRect_SWIGUpcast(long jarg1); public final static native long MgLayer_SWIGUpcast(long jarg1); public final static native long MgShapeDoc_SWIGUpcast(long jarg1); public final static native long GiCoreView_SWIGUpcast(long jarg1); public final static native long GiCoreViewData_SWIGUpcast(long jarg1); public static void SwigDirector_GiCanvas_setPen(GiCanvas jself, int argb, float width, int style, float phase, float orgw) { jself.setPen(argb, width, style, phase, orgw); } public static void SwigDirector_GiCanvas_setBrush(GiCanvas jself, int argb, int style) { jself.setBrush(argb, style); } public static void SwigDirector_GiCanvas_clearRect(GiCanvas jself, float x, float y, float w, float h) { jself.clearRect(x, y, w, h); } public static void SwigDirector_GiCanvas_drawRect(GiCanvas jself, float x, float y, float w, float h, boolean stroke, boolean fill) { jself.drawRect(x, y, w, h, stroke, fill); } public static void SwigDirector_GiCanvas_drawLine(GiCanvas jself, float x1, float y1, float x2, float y2) { jself.drawLine(x1, y1, x2, y2); } public static void SwigDirector_GiCanvas_drawEllipse(GiCanvas jself, float x, float y, float w, float h, boolean stroke, boolean fill) { jself.drawEllipse(x, y, w, h, stroke, fill); } public static void SwigDirector_GiCanvas_beginPath(GiCanvas jself) { jself.beginPath(); } public static void SwigDirector_GiCanvas_moveTo(GiCanvas jself, float x, float y) { jself.moveTo(x, y); } public static void SwigDirector_GiCanvas_lineTo(GiCanvas jself, float x, float y) { jself.lineTo(x, y); } public static void SwigDirector_GiCanvas_bezierTo(GiCanvas jself, float c1x, float c1y, float c2x, float c2y, float x, float y) { jself.bezierTo(c1x, c1y, c2x, c2y, x, y); } public static void SwigDirector_GiCanvas_quadTo(GiCanvas jself, float cpx, float cpy, float x, float y) { jself.quadTo(cpx, cpy, x, y); } public static void SwigDirector_GiCanvas_closePath(GiCanvas jself) { jself.closePath(); } public static void SwigDirector_GiCanvas_drawPath(GiCanvas jself, boolean stroke, boolean fill) { jself.drawPath(stroke, fill); } public static void SwigDirector_GiCanvas_saveClip(GiCanvas jself) { jself.saveClip(); } public static void SwigDirector_GiCanvas_restoreClip(GiCanvas jself) { jself.restoreClip(); } public static boolean SwigDirector_GiCanvas_clipRect(GiCanvas jself, float x, float y, float w, float h) { return jself.clipRect(x, y, w, h); } public static boolean SwigDirector_GiCanvas_clipPath(GiCanvas jself) { return jself.clipPath(); } public static boolean SwigDirector_GiCanvas_drawHandle(GiCanvas jself, float x, float y, int type, float angle) { return jself.drawHandle(x, y, type, angle); } public static boolean SwigDirector_GiCanvas_drawBitmap(GiCanvas jself, String name, float xc, float yc, float w, float h, float angle) { return jself.drawBitmap(name, xc, yc, w, h, angle); } public static float SwigDirector_GiCanvas_drawTextAt(GiCanvas jself, String text, float x, float y, float h, int align, float angle) { return jself.drawTextAt(text, x, y, h, align, angle); } public static boolean SwigDirector_GiCanvas_beginShape(GiCanvas jself, int type, int sid, int version, float x, float y, float w, float h) { return jself.beginShape(type, sid, version, x, y, w, h); } public static void SwigDirector_GiCanvas_endShape(GiCanvas jself, int type, int sid, float x, float y) { jself.endShape(type, sid, x, y); } public static long SwigDirector_MgObject_clone(MgObject jself) { return MgObject.getCPtr(jself.clone()); } public static void SwigDirector_MgObject_copy(MgObject jself, long src) { jself.copy(new MgObject(src, false)); } public static void SwigDirector_MgObject_release(MgObject jself) { jself.release(); } public static void SwigDirector_MgObject_addRef(MgObject jself) { jself.addRef(); } public static boolean SwigDirector_MgObject_equals(MgObject jself, long src) { return jself.equals(new MgObject(src, false)); } public static int SwigDirector_MgObject_getType(MgObject jself) { return jself.getType(); } public static boolean SwigDirector_MgObject_isKindOf(MgObject jself, int type) { return jself.isKindOf(type); } public static long SwigDirector_MgBaseShape_clone(MgBaseShape jself) { return MgObject.getCPtr(jself.clone()); } public static void SwigDirector_MgBaseShape_copy(MgBaseShape jself, long src) { jself.copy(new MgObject(src, false)); } public static void SwigDirector_MgBaseShape_release(MgBaseShape jself) { jself.release(); } public static void SwigDirector_MgBaseShape_addRef(MgBaseShape jself) { jself.addRef(); } public static boolean SwigDirector_MgBaseShape_equals(MgBaseShape jself, long src) { return jself.equals(new MgObject(src, false)); } public static int SwigDirector_MgBaseShape_getType(MgBaseShape jself) { return jself.getType(); } public static boolean SwigDirector_MgBaseShape_isKindOf(MgBaseShape jself, int type) { return jself.isKindOf(type); } public static long SwigDirector_MgBaseShape_getExtent(MgBaseShape jself) { return Box2d.getCPtr(jself.getExtent()); } public static int SwigDirector_MgBaseShape_getChangeCount(MgBaseShape jself) { return jself.getChangeCount(); } public static void SwigDirector_MgBaseShape_resetChangeCount(MgBaseShape jself, int count) { jself.resetChangeCount(count); } public static void SwigDirector_MgBaseShape_afterChanged(MgBaseShape jself) { jself.afterChanged(); } public static void SwigDirector_MgBaseShape_update(MgBaseShape jself) { jself.update(); } public static void SwigDirector_MgBaseShape_transform(MgBaseShape jself, long mat) { jself.transform(new Matrix2d(mat, false)); } public static void SwigDirector_MgBaseShape_clear(MgBaseShape jself) { jself.clear(); } public static void SwigDirector_MgBaseShape_clearCachedData(MgBaseShape jself) { jself.clearCachedData(); } public static int SwigDirector_MgBaseShape_getPointCount(MgBaseShape jself) { return jself.getPointCount(); } public static long SwigDirector_MgBaseShape_getPoint(MgBaseShape jself, int index) { return Point2d.getCPtr(jself.getPoint(index)); } public static void SwigDirector_MgBaseShape_setPoint(MgBaseShape jself, int index, long pt) { jself.setPoint(index, new Point2d(pt, false)); } public static boolean SwigDirector_MgBaseShape_isClosed(MgBaseShape jself) { return jself.isClosed(); } public static boolean SwigDirector_MgBaseShape_isCurve(MgBaseShape jself) { return jself.isCurve(); } public static float SwigDirector_MgBaseShape_hitTest(MgBaseShape jself, long pt, float tol, long res) { return jself.hitTest(new Point2d(pt, false), tol, new MgHitResult(res, false)); } public static boolean SwigDirector_MgBaseShape_hitTestBox(MgBaseShape jself, long rect) { return jself.hitTestBox(new Box2d(rect, false)); } public static boolean SwigDirector_MgBaseShape_draw(MgBaseShape jself, int mode, long gs, long ctx, int segment) { return jself.draw(mode, new GiGraphics(gs, false), new GiContext(ctx, false), segment); } public static boolean SwigDirector_MgBaseShape_draw2(MgBaseShape jself, long owner, int mode, long gs, long ctx, int segment) { return jself.draw2((owner == 0) ? null : new MgObject(owner, false), mode, new GiGraphics(gs, false), new GiContext(ctx, false), segment); } public static void SwigDirector_MgBaseShape_output(MgBaseShape jself, long path) { jself.output(new MgPath(path, false)); } public static boolean SwigDirector_MgBaseShape_save(MgBaseShape jself, long s) { return jself.save((s == 0) ? null : new MgStorage(s, false)); } public static boolean SwigDirector_MgBaseShape_load(MgBaseShape jself, long factory, long s) { return jself.load((factory == 0) ? null : new MgShapeFactory(factory, false), (s == 0) ? null : new MgStorage(s, false)); } public static int SwigDirector_MgBaseShape_getHandleCount(MgBaseShape jself) { return jself.getHandleCount(); } public static long SwigDirector_MgBaseShape_getHandlePoint(MgBaseShape jself, int index) { return Point2d.getCPtr(jself.getHandlePoint(index)); } public static boolean SwigDirector_MgBaseShape_setHandlePoint(MgBaseShape jself, int index, long pt, float tol) { return jself.setHandlePoint(index, new Point2d(pt, false), tol); } public static boolean SwigDirector_MgBaseShape_isHandleFixed(MgBaseShape jself, int index) { return jself.isHandleFixed(index); } public static int SwigDirector_MgBaseShape_getHandleType(MgBaseShape jself, int index) { return jself.getHandleType(index); } public static boolean SwigDirector_MgBaseShape_offset(MgBaseShape jself, long vec, int segment) { return jself.offset(new Vector2d(vec, false), segment); } public static void SwigDirector_MgBaseShape_setFlag(MgBaseShape jself, int bit, boolean on) { jself.setFlag(MgShapeBit.swigToEnum(bit), on); } public static void SwigDirector_MgBaseShape_setOwner(MgBaseShape jself, long owner) { jself.setOwner((owner == 0) ? null : new MgObject(owner, false)); } public static int SwigDirector_MgBaseShape_getSubType(MgBaseShape jself) { return jself.getSubType(); } public static long SwigDirector_MgBaseRect_clone(MgBaseRect jself) { return MgObject.getCPtr(jself.clone()); } public static void SwigDirector_MgBaseRect_copy(MgBaseRect jself, long src) { jself.copy(new MgObject(src, false)); } public static void SwigDirector_MgBaseRect_release(MgBaseRect jself) { jself.release(); } public static void SwigDirector_MgBaseRect_addRef(MgBaseRect jself) { jself.addRef(); } public static boolean SwigDirector_MgBaseRect_equals(MgBaseRect jself, long src) { return jself.equals(new MgObject(src, false)); } public static int SwigDirector_MgBaseRect_getType(MgBaseRect jself) { return jself.getType(); } public static boolean SwigDirector_MgBaseRect_isKindOf(MgBaseRect jself, int type) { return jself.isKindOf(type); } public static long SwigDirector_MgBaseRect_getExtent(MgBaseRect jself) { return Box2d.getCPtr(jself.getExtent()); } public static int SwigDirector_MgBaseRect_getChangeCount(MgBaseRect jself) { return jself.getChangeCount(); } public static void SwigDirector_MgBaseRect_resetChangeCount(MgBaseRect jself, int count) { jself.resetChangeCount(count); } public static void SwigDirector_MgBaseRect_afterChanged(MgBaseRect jself) { jself.afterChanged(); } public static void SwigDirector_MgBaseRect_update(MgBaseRect jself) { jself.update(); } public static void SwigDirector_MgBaseRect_transform(MgBaseRect jself, long mat) { jself.transform(new Matrix2d(mat, false)); } public static void SwigDirector_MgBaseRect_clear(MgBaseRect jself) { jself.clear(); } public static void SwigDirector_MgBaseRect_clearCachedData(MgBaseRect jself) { jself.clearCachedData(); } public static int SwigDirector_MgBaseRect_getPointCount(MgBaseRect jself) { return jself.getPointCount(); } public static long SwigDirector_MgBaseRect_getPoint(MgBaseRect jself, int index) { return Point2d.getCPtr(jself.getPoint(index)); } public static void SwigDirector_MgBaseRect_setPoint(MgBaseRect jself, int index, long pt) { jself.setPoint(index, new Point2d(pt, false)); } public static boolean SwigDirector_MgBaseRect_isClosed(MgBaseRect jself) { return jself.isClosed(); } public static boolean SwigDirector_MgBaseRect_isCurve(MgBaseRect jself) { return jself.isCurve(); } public static float SwigDirector_MgBaseRect_hitTest(MgBaseRect jself, long pt, float tol, long res) { return jself.hitTest(new Point2d(pt, false), tol, new MgHitResult(res, false)); } public static boolean SwigDirector_MgBaseRect_hitTestBox(MgBaseRect jself, long rect) { return jself.hitTestBox(new Box2d(rect, false)); } public static boolean SwigDirector_MgBaseRect_draw(MgBaseRect jself, int mode, long gs, long ctx, int segment) { return jself.draw(mode, new GiGraphics(gs, false), new GiContext(ctx, false), segment); } public static boolean SwigDirector_MgBaseRect_draw2(MgBaseRect jself, long owner, int mode, long gs, long ctx, int segment) { return jself.draw2((owner == 0) ? null : new MgObject(owner, false), mode, new GiGraphics(gs, false), new GiContext(ctx, false), segment); } public static void SwigDirector_MgBaseRect_output(MgBaseRect jself, long path) { jself.output(new MgPath(path, false)); } public static boolean SwigDirector_MgBaseRect_save(MgBaseRect jself, long s) { return jself.save((s == 0) ? null : new MgStorage(s, false)); } public static boolean SwigDirector_MgBaseRect_load(MgBaseRect jself, long factory, long s) { return jself.load((factory == 0) ? null : new MgShapeFactory(factory, false), (s == 0) ? null : new MgStorage(s, false)); } public static int SwigDirector_MgBaseRect_getHandleCount(MgBaseRect jself) { return jself.getHandleCount(); } public static long SwigDirector_MgBaseRect_getHandlePoint(MgBaseRect jself, int index) { return Point2d.getCPtr(jself.getHandlePoint(index)); } public static boolean SwigDirector_MgBaseRect_setHandlePoint(MgBaseRect jself, int index, long pt, float tol) { return jself.setHandlePoint(index, new Point2d(pt, false), tol); } public static boolean SwigDirector_MgBaseRect_isHandleFixed(MgBaseRect jself, int index) { return jself.isHandleFixed(index); } public static int SwigDirector_MgBaseRect_getHandleType(MgBaseRect jself, int index) { return jself.getHandleType(index); } public static boolean SwigDirector_MgBaseRect_offset(MgBaseRect jself, long vec, int segment) { return jself.offset(new Vector2d(vec, false), segment); } public static void SwigDirector_MgBaseRect_setFlag(MgBaseRect jself, int bit, boolean on) { jself.setFlag(MgShapeBit.swigToEnum(bit), on); } public static void SwigDirector_MgBaseRect_setOwner(MgBaseRect jself, long owner) { jself.setOwner((owner == 0) ? null : new MgObject(owner, false)); } public static int SwigDirector_MgBaseRect_getSubType(MgBaseRect jself) { return jself.getSubType(); } public static long SwigDirector_MgBaseLines_clone(MgBaseLines jself) { return MgObject.getCPtr(jself.clone()); } public static void SwigDirector_MgBaseLines_copy(MgBaseLines jself, long src) { jself.copy(new MgObject(src, false)); } public static void SwigDirector_MgBaseLines_release(MgBaseLines jself) { jself.release(); } public static void SwigDirector_MgBaseLines_addRef(MgBaseLines jself) { jself.addRef(); } public static boolean SwigDirector_MgBaseLines_equals(MgBaseLines jself, long src) { return jself.equals(new MgObject(src, false)); } public static int SwigDirector_MgBaseLines_getType(MgBaseLines jself) { return jself.getType(); } public static boolean SwigDirector_MgBaseLines_isKindOf(MgBaseLines jself, int type) { return jself.isKindOf(type); } public static long SwigDirector_MgBaseLines_getExtent(MgBaseLines jself) { return Box2d.getCPtr(jself.getExtent()); } public static int SwigDirector_MgBaseLines_getChangeCount(MgBaseLines jself) { return jself.getChangeCount(); } public static void SwigDirector_MgBaseLines_resetChangeCount(MgBaseLines jself, int count) { jself.resetChangeCount(count); } public static void SwigDirector_MgBaseLines_afterChanged(MgBaseLines jself) { jself.afterChanged(); } public static void SwigDirector_MgBaseLines_update(MgBaseLines jself) { jself.update(); } public static void SwigDirector_MgBaseLines_transform(MgBaseLines jself, long mat) { jself.transform(new Matrix2d(mat, false)); } public static void SwigDirector_MgBaseLines_clear(MgBaseLines jself) { jself.clear(); } public static void SwigDirector_MgBaseLines_clearCachedData(MgBaseLines jself) { jself.clearCachedData(); } public static int SwigDirector_MgBaseLines_getPointCount(MgBaseLines jself) { return jself.getPointCount(); } public static long SwigDirector_MgBaseLines_getPoint(MgBaseLines jself, int index) { return Point2d.getCPtr(jself.getPoint(index)); } public static void SwigDirector_MgBaseLines_setPoint(MgBaseLines jself, int index, long pt) { jself.setPoint(index, new Point2d(pt, false)); } public static boolean SwigDirector_MgBaseLines_isClosed(MgBaseLines jself) { return jself.isClosed(); } public static boolean SwigDirector_MgBaseLines_isCurve(MgBaseLines jself) { return jself.isCurve(); } public static float SwigDirector_MgBaseLines_hitTest(MgBaseLines jself, long pt, float tol, long res) { return jself.hitTest(new Point2d(pt, false), tol, new MgHitResult(res, false)); } public static boolean SwigDirector_MgBaseLines_hitTestBox(MgBaseLines jself, long rect) { return jself.hitTestBox(new Box2d(rect, false)); } public static boolean SwigDirector_MgBaseLines_draw(MgBaseLines jself, int mode, long gs, long ctx, int segment) { return jself.draw(mode, new GiGraphics(gs, false), new GiContext(ctx, false), segment); } public static boolean SwigDirector_MgBaseLines_draw2(MgBaseLines jself, long owner, int mode, long gs, long ctx, int segment) { return jself.draw2((owner == 0) ? null : new MgObject(owner, false), mode, new GiGraphics(gs, false), new GiContext(ctx, false), segment); } public static void SwigDirector_MgBaseLines_output(MgBaseLines jself, long path) { jself.output(new MgPath(path, false)); } public static boolean SwigDirector_MgBaseLines_save(MgBaseLines jself, long s) { return jself.save((s == 0) ? null : new MgStorage(s, false)); } public static boolean SwigDirector_MgBaseLines_load(MgBaseLines jself, long factory, long s) { return jself.load((factory == 0) ? null : new MgShapeFactory(factory, false), (s == 0) ? null : new MgStorage(s, false)); } public static int SwigDirector_MgBaseLines_getHandleCount(MgBaseLines jself) { return jself.getHandleCount(); } public static long SwigDirector_MgBaseLines_getHandlePoint(MgBaseLines jself, int index) { return Point2d.getCPtr(jself.getHandlePoint(index)); } public static boolean SwigDirector_MgBaseLines_setHandlePoint(MgBaseLines jself, int index, long pt, float tol) { return jself.setHandlePoint(index, new Point2d(pt, false), tol); } public static boolean SwigDirector_MgBaseLines_isHandleFixed(MgBaseLines jself, int index) { return jself.isHandleFixed(index); } public static int SwigDirector_MgBaseLines_getHandleType(MgBaseLines jself, int index) { return jself.getHandleType(index); } public static boolean SwigDirector_MgBaseLines_offset(MgBaseLines jself, long vec, int segment) { return jself.offset(new Vector2d(vec, false), segment); } public static void SwigDirector_MgBaseLines_setFlag(MgBaseLines jself, int bit, boolean on) { jself.setFlag(MgShapeBit.swigToEnum(bit), on); } public static void SwigDirector_MgBaseLines_setOwner(MgBaseLines jself, long owner) { jself.setOwner((owner == 0) ? null : new MgObject(owner, false)); } public static int SwigDirector_MgBaseLines_getSubType(MgBaseLines jself) { return jself.getSubType(); } public static boolean SwigDirector_MgBaseLines_resize(MgBaseLines jself, int count) { return jself.resize(count); } public static boolean SwigDirector_MgBaseLines_addPoint(MgBaseLines jself, long pt) { return jself.addPoint(new Point2d(pt, false)); } public static boolean SwigDirector_MgBaseLines_insertPoint(MgBaseLines jself, int segment, long pt) { return jself.insertPoint(segment, new Point2d(pt, false)); } public static boolean SwigDirector_MgBaseLines_removePoint(MgBaseLines jself, int index) { return jself.removePoint(index); } public static long SwigDirector_MgComposite_clone(MgComposite jself) { return MgObject.getCPtr(jself.clone()); } public static void SwigDirector_MgComposite_copy(MgComposite jself, long src) { jself.copy(new MgObject(src, false)); } public static void SwigDirector_MgComposite_release(MgComposite jself) { jself.release(); } public static void SwigDirector_MgComposite_addRef(MgComposite jself) { jself.addRef(); } public static boolean SwigDirector_MgComposite_equals(MgComposite jself, long src) { return jself.equals(new MgObject(src, false)); } public static int SwigDirector_MgComposite_getType(MgComposite jself) { return jself.getType(); } public static boolean SwigDirector_MgComposite_isKindOf(MgComposite jself, int type) { return jself.isKindOf(type); } public static long SwigDirector_MgComposite_getExtent(MgComposite jself) { return Box2d.getCPtr(jself.getExtent()); } public static int SwigDirector_MgComposite_getChangeCount(MgComposite jself) { return jself.getChangeCount(); } public static void SwigDirector_MgComposite_resetChangeCount(MgComposite jself, int count) { jself.resetChangeCount(count); } public static void SwigDirector_MgComposite_afterChanged(MgComposite jself) { jself.afterChanged(); } public static void SwigDirector_MgComposite_update(MgComposite jself) { jself.update(); } public static void SwigDirector_MgComposite_transform(MgComposite jself, long mat) { jself.transform(new Matrix2d(mat, false)); } public static void SwigDirector_MgComposite_clear(MgComposite jself) { jself.clear(); } public static void SwigDirector_MgComposite_clearCachedData(MgComposite jself) { jself.clearCachedData(); } public static int SwigDirector_MgComposite_getPointCount(MgComposite jself) { return jself.getPointCount(); } public static long SwigDirector_MgComposite_getPoint(MgComposite jself, int index) { return Point2d.getCPtr(jself.getPoint(index)); } public static void SwigDirector_MgComposite_setPoint(MgComposite jself, int index, long pt) { jself.setPoint(index, new Point2d(pt, false)); } public static boolean SwigDirector_MgComposite_isClosed(MgComposite jself) { return jself.isClosed(); } public static boolean SwigDirector_MgComposite_isCurve(MgComposite jself) { return jself.isCurve(); } public static float SwigDirector_MgComposite_hitTest(MgComposite jself, long pt, float tol, long res) { return jself.hitTest(new Point2d(pt, false), tol, new MgHitResult(res, false)); } public static boolean SwigDirector_MgComposite_hitTestBox(MgComposite jself, long rect) { return jself.hitTestBox(new Box2d(rect, false)); } public static boolean SwigDirector_MgComposite_draw(MgComposite jself, int mode, long gs, long ctx, int segment) { return jself.draw(mode, new GiGraphics(gs, false), new GiContext(ctx, false), segment); } public static boolean SwigDirector_MgComposite_draw2(MgComposite jself, long owner, int mode, long gs, long ctx, int segment) { return jself.draw2((owner == 0) ? null : new MgObject(owner, false), mode, new GiGraphics(gs, false), new GiContext(ctx, false), segment); } public static void SwigDirector_MgComposite_output(MgComposite jself, long path) { jself.output(new MgPath(path, false)); } public static boolean SwigDirector_MgComposite_save(MgComposite jself, long s) { return jself.save((s == 0) ? null : new MgStorage(s, false)); } public static boolean SwigDirector_MgComposite_load(MgComposite jself, long factory, long s) { return jself.load((factory == 0) ? null : new MgShapeFactory(factory, false), (s == 0) ? null : new MgStorage(s, false)); } public static int SwigDirector_MgComposite_getHandleCount(MgComposite jself) { return jself.getHandleCount(); } public static long SwigDirector_MgComposite_getHandlePoint(MgComposite jself, int index) { return Point2d.getCPtr(jself.getHandlePoint(index)); } public static boolean SwigDirector_MgComposite_setHandlePoint(MgComposite jself, int index, long pt, float tol) { return jself.setHandlePoint(index, new Point2d(pt, false), tol); } public static boolean SwigDirector_MgComposite_isHandleFixed(MgComposite jself, int index) { return jself.isHandleFixed(index); } public static int SwigDirector_MgComposite_getHandleType(MgComposite jself, int index) { return jself.getHandleType(index); } public static boolean SwigDirector_MgComposite_offset(MgComposite jself, long vec, int segment) { return jself.offset(new Vector2d(vec, false), segment); } public static void SwigDirector_MgComposite_setFlag(MgComposite jself, int bit, boolean on) { jself.setFlag(MgShapeBit.swigToEnum(bit), on); } public static void SwigDirector_MgComposite_setOwner(MgComposite jself, long owner) { jself.setOwner((owner == 0) ? null : new MgObject(owner, false)); } public static int SwigDirector_MgComposite_getSubType(MgComposite jself) { return jself.getSubType(); } public static boolean SwigDirector_MgComposite_canOffsetShapeAlone(MgComposite jself, long shape) { return jself.canOffsetShapeAlone((shape == 0) ? null : new MgShape(shape, false)); } public static void SwigDirector_MgCommand_release(MgCommand jself) { jself.release(); } public static boolean SwigDirector_MgCommand_cancel(MgCommand jself, long sender) { return jself.cancel((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommand_initialize(MgCommand jself, long sender, long s) { return jself.initialize((sender == 0) ? null : new MgMotion(sender, false), (s == 0) ? null : new MgStorage(s, false)); } public static boolean SwigDirector_MgCommand_backStep(MgCommand jself, long sender) { return jself.backStep((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommand_draw(MgCommand jself, long sender, long gs) { return jself.draw((sender == 0) ? null : new MgMotion(sender, false), (gs == 0) ? null : new GiGraphics(gs, false)); } public static boolean SwigDirector_MgCommand_gatherShapes(MgCommand jself, long sender, long shapes) { return jself.gatherShapes((sender == 0) ? null : new MgMotion(sender, false), (shapes == 0) ? null : new MgShapes(shapes, false)); } public static boolean SwigDirector_MgCommand_click(MgCommand jself, long sender) { return jself.click((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommand_doubleClick(MgCommand jself, long sender) { return jself.doubleClick((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommand_longPress(MgCommand jself, long sender) { return jself.longPress((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommand_touchBegan(MgCommand jself, long sender) { return jself.touchBegan((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommand_touchMoved(MgCommand jself, long sender) { return jself.touchMoved((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommand_touchEnded(MgCommand jself, long sender) { return jself.touchEnded((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommand_mouseHover(MgCommand jself, long sender) { return jself.mouseHover((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommand_twoFingersMove(MgCommand jself, long sender) { return jself.twoFingersMove((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommand_isDrawingCommand(MgCommand jself) { return jself.isDrawingCommand(); } public static boolean SwigDirector_MgCommand_isFloatingCommand(MgCommand jself) { return jself.isFloatingCommand(); } public static boolean SwigDirector_MgCommand_doContextAction(MgCommand jself, long sender, int action) { return jself.doContextAction((sender == 0) ? null : new MgMotion(sender, false), action); } public static void SwigDirector_CmdObserverDefault_onDocLoaded(CmdObserverDefault jself, long sender, boolean forUndo) { jself.onDocLoaded((sender == 0) ? null : new MgMotion(sender, false), forUndo); } public static void SwigDirector_CmdObserverDefault_onEnterSelectCommand(CmdObserverDefault jself, long sender) { jself.onEnterSelectCommand((sender == 0) ? null : new MgMotion(sender, false)); } public static void SwigDirector_CmdObserverDefault_onUnloadCommands(CmdObserverDefault jself, long sender) { jself.onUnloadCommands((sender == 0) ? null : new MgCmdManager(sender, false)); } public static boolean SwigDirector_CmdObserverDefault_selectActionsNeedHided(CmdObserverDefault jself, long sender) { return jself.selectActionsNeedHided((sender == 0) ? null : new MgMotion(sender, false)); } public static int SwigDirector_CmdObserverDefault_addShapeActions(CmdObserverDefault jself, long sender, long actions, int n, long sp) { return jself.addShapeActions((sender == 0) ? null : new MgMotion(sender, false), new Ints(actions, false), n, (sp == 0) ? null : new MgShape(sp, false)); } public static boolean SwigDirector_CmdObserverDefault_doAction(CmdObserverDefault jself, long sender, int action) { return jself.doAction((sender == 0) ? null : new MgMotion(sender, false), action); } public static boolean SwigDirector_CmdObserverDefault_doEndAction(CmdObserverDefault jself, long sender, int action) { return jself.doEndAction((sender == 0) ? null : new MgMotion(sender, false), action); } public static void SwigDirector_CmdObserverDefault_drawInShapeCommand(CmdObserverDefault jself, long sender, long cmd, long gs) { jself.drawInShapeCommand((sender == 0) ? null : new MgMotion(sender, false), (cmd == 0) ? null : new MgCommand(cmd, false), (gs == 0) ? null : new GiGraphics(gs, false)); } public static void SwigDirector_CmdObserverDefault_drawInSelectCommand(CmdObserverDefault jself, long sender, long sp, int handleIndex, long gs) { jself.drawInSelectCommand((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false), handleIndex, (gs == 0) ? null : new GiGraphics(gs, false)); } public static void SwigDirector_CmdObserverDefault_onSelectionChanged(CmdObserverDefault jself, long sender) { jself.onSelectionChanged((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_CmdObserverDefault_onShapeWillAdded(CmdObserverDefault jself, long sender, long sp) { return jself.onShapeWillAdded((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false)); } public static void SwigDirector_CmdObserverDefault_onShapeAdded(CmdObserverDefault jself, long sender, long sp) { jself.onShapeAdded((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false)); } public static boolean SwigDirector_CmdObserverDefault_onShapeWillDeleted(CmdObserverDefault jself, long sender, long sp) { return jself.onShapeWillDeleted((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false)); } public static int SwigDirector_CmdObserverDefault_onShapeDeleted(CmdObserverDefault jself, long sender, long sp) { return jself.onShapeDeleted((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false)); } public static boolean SwigDirector_CmdObserverDefault_onShapeCanRotated(CmdObserverDefault jself, long sender, long sp) { return jself.onShapeCanRotated((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false)); } public static boolean SwigDirector_CmdObserverDefault_onShapeCanTransform(CmdObserverDefault jself, long sender, long sp) { return jself.onShapeCanTransform((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false)); } public static boolean SwigDirector_CmdObserverDefault_onShapeCanUnlock(CmdObserverDefault jself, long sender, long sp) { return jself.onShapeCanUnlock((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false)); } public static boolean SwigDirector_CmdObserverDefault_onShapeCanUngroup(CmdObserverDefault jself, long sender, long sp) { return jself.onShapeCanUngroup((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false)); } public static boolean SwigDirector_CmdObserverDefault_onShapeCanMovedHandle(CmdObserverDefault jself, long sender, long sp, int index) { return jself.onShapeCanMovedHandle((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false), index); } public static void SwigDirector_CmdObserverDefault_onShapeMoved(CmdObserverDefault jself, long sender, long sp, int segment) { jself.onShapeMoved((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false), segment); } public static boolean SwigDirector_CmdObserverDefault_onShapeWillChanged(CmdObserverDefault jself, long sender, long sp, long oldsp) { return jself.onShapeWillChanged((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false), (oldsp == 0) ? null : new MgShape(oldsp, false)); } public static void SwigDirector_CmdObserverDefault_onShapeChanged(CmdObserverDefault jself, long sender, long shape) { jself.onShapeChanged((sender == 0) ? null : new MgMotion(sender, false), (shape == 0) ? null : new MgShape(shape, false)); } public static long SwigDirector_CmdObserverDefault_createShape(CmdObserverDefault jself, long sender, int type) { return MgBaseShape.getCPtr(jself.createShape((sender == 0) ? null : new MgMotion(sender, false), type)); } public static long SwigDirector_CmdObserverDefault_createCommand(CmdObserverDefault jself, long sender, String name) { return MgCommand.getCPtr(jself.createCommand((sender == 0) ? null : new MgMotion(sender, false), name)); } public static boolean SwigDirector_CmdObserverDefault_onPreGesture(CmdObserverDefault jself, long sender) { return jself.onPreGesture((sender == 0) ? null : new MgMotion(sender, false)); } public static void SwigDirector_CmdObserverDefault_onPostGesture(CmdObserverDefault jself, long sender) { jself.onPostGesture((sender == 0) ? null : new MgMotion(sender, false)); } public static void SwigDirector_CmdObserverDefault_onPointSnapped(CmdObserverDefault jself, long sender, long sp) { jself.onPointSnapped((sender == 0) ? null : new MgMotion(sender, false), (sp == 0) ? null : new MgShape(sp, false)); } public static void SwigDirector_MgCommandDraw_release(MgCommandDraw jself) { jself.release(); } public static boolean SwigDirector_MgCommandDraw_cancel(MgCommandDraw jself, long sender) { return jself.cancel((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommandDraw_initialize(MgCommandDraw jself, long sender, long s) { return jself.initialize((sender == 0) ? null : new MgMotion(sender, false), (s == 0) ? null : new MgStorage(s, false)); } public static boolean SwigDirector_MgCommandDraw_backStep(MgCommandDraw jself, long sender) { return jself.backStep((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommandDraw_draw(MgCommandDraw jself, long sender, long gs) { return jself.draw((sender == 0) ? null : new MgMotion(sender, false), (gs == 0) ? null : new GiGraphics(gs, false)); } public static boolean SwigDirector_MgCommandDraw_gatherShapes(MgCommandDraw jself, long sender, long shapes) { return jself.gatherShapes((sender == 0) ? null : new MgMotion(sender, false), (shapes == 0) ? null : new MgShapes(shapes, false)); } public static boolean SwigDirector_MgCommandDraw_click(MgCommandDraw jself, long sender) { return jself.click((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommandDraw_doubleClick(MgCommandDraw jself, long sender) { return jself.doubleClick((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommandDraw_longPress(MgCommandDraw jself, long sender) { return jself.longPress((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommandDraw_touchBegan(MgCommandDraw jself, long sender) { return jself.touchBegan((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommandDraw_touchMoved(MgCommandDraw jself, long sender) { return jself.touchMoved((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommandDraw_touchEnded(MgCommandDraw jself, long sender) { return jself.touchEnded((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommandDraw_mouseHover(MgCommandDraw jself, long sender) { return jself.mouseHover((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommandDraw_twoFingersMove(MgCommandDraw jself, long sender) { return jself.twoFingersMove((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCommandDraw_isDrawingCommand(MgCommandDraw jself) { return jself.isDrawingCommand(); } public static boolean SwigDirector_MgCommandDraw_isFloatingCommand(MgCommandDraw jself) { return jself.isFloatingCommand(); } public static boolean SwigDirector_MgCommandDraw_doContextAction(MgCommandDraw jself, long sender, int action) { return jself.doContextAction((sender == 0) ? null : new MgMotion(sender, false), action); } public static int SwigDirector_MgCommandDraw_getShapeType(MgCommandDraw jself) { return jself.getShapeType(); } public static int SwigDirector_MgCommandDraw_getMaxStep(MgCommandDraw jself) { return jself.getMaxStep(); } public static void SwigDirector_MgCommandDraw_setStepPoint(MgCommandDraw jself, long sender, int step, long pt) { jself.setStepPoint((sender == 0) ? null : new MgMotion(sender, false), step, new Point2d(pt, false)); } public static boolean SwigDirector_MgCommandDraw_isStepPointAccepted(MgCommandDraw jself, long sender, long pt) { return jself.isStepPointAccepted((sender == 0) ? null : new MgMotion(sender, false), new Point2d(pt, false)); } public static int SwigDirector_MgCommandDraw_snapOptionsForStep(MgCommandDraw jself, long sender, int step) { return jself.snapOptionsForStep((sender == 0) ? null : new MgMotion(sender, false), step); } public static void SwigDirector_MgCmdDrawRect_release(MgCmdDrawRect jself) { jself.release(); } public static boolean SwigDirector_MgCmdDrawRect_cancel(MgCmdDrawRect jself, long sender) { return jself.cancel((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCmdDrawRect_initialize(MgCmdDrawRect jself, long sender, long s) { return jself.initialize((sender == 0) ? null : new MgMotion(sender, false), (s == 0) ? null : new MgStorage(s, false)); } public static boolean SwigDirector_MgCmdDrawRect_backStep(MgCmdDrawRect jself, long sender) { return jself.backStep((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCmdDrawRect_draw(MgCmdDrawRect jself, long sender, long gs) { return jself.draw((sender == 0) ? null : new MgMotion(sender, false), (gs == 0) ? null : new GiGraphics(gs, false)); } public static boolean SwigDirector_MgCmdDrawRect_gatherShapes(MgCmdDrawRect jself, long sender, long shapes) { return jself.gatherShapes((sender == 0) ? null : new MgMotion(sender, false), (shapes == 0) ? null : new MgShapes(shapes, false)); } public static boolean SwigDirector_MgCmdDrawRect_click(MgCmdDrawRect jself, long sender) { return jself.click((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCmdDrawRect_doubleClick(MgCmdDrawRect jself, long sender) { return jself.doubleClick((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCmdDrawRect_longPress(MgCmdDrawRect jself, long sender) { return jself.longPress((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCmdDrawRect_touchBegan(MgCmdDrawRect jself, long sender) { return jself.touchBegan((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCmdDrawRect_touchMoved(MgCmdDrawRect jself, long sender) { return jself.touchMoved((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCmdDrawRect_touchEnded(MgCmdDrawRect jself, long sender) { return jself.touchEnded((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCmdDrawRect_mouseHover(MgCmdDrawRect jself, long sender) { return jself.mouseHover((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCmdDrawRect_twoFingersMove(MgCmdDrawRect jself, long sender) { return jself.twoFingersMove((sender == 0) ? null : new MgMotion(sender, false)); } public static boolean SwigDirector_MgCmdDrawRect_isDrawingCommand(MgCmdDrawRect jself) { return jself.isDrawingCommand(); } public static boolean SwigDirector_MgCmdDrawRect_isFloatingCommand(MgCmdDrawRect jself) { return jself.isFloatingCommand(); } public static boolean SwigDirector_MgCmdDrawRect_doContextAction(MgCmdDrawRect jself, long sender, int action) { return jself.doContextAction((sender == 0) ? null : new MgMotion(sender, false), action); } public static int SwigDirector_MgCmdDrawRect_getShapeType(MgCmdDrawRect jself) { return jself.getShapeType(); } public static int SwigDirector_MgCmdDrawRect_getMaxStep(MgCmdDrawRect jself) { return jself.getMaxStep(); } public static void SwigDirector_MgCmdDrawRect_setStepPoint(MgCmdDrawRect jself, long sender, int step, long pt) { jself.setStepPoint((sender == 0) ? null : new MgMotion(sender, false), step, new Point2d(pt, false)); } public static boolean SwigDirector_MgCmdDrawRect_isStepPointAccepted(MgCmdDrawRect jself, long sender, long pt) { return jself.isStepPointAccepted((sender == 0) ? null : new MgMotion(sender, false), new Point2d(pt, false)); } public static int SwigDirector_MgCmdDrawRect_snapOptionsForStep(MgCmdDrawRect jself, long sender, int step) { return jself.snapOptionsForStep((sender == 0) ? null : new MgMotion(sender, false), step); } public static void SwigDirector_MgCmdDrawRect_addRectShape(MgCmdDrawRect jself, long sender) { jself.addRectShape((sender == 0) ? null : new MgMotion(sender, false)); } public static void SwigDirector_GiView_regenAll(GiView jself, boolean changed) { jself.regenAll(changed); } public static void SwigDirector_GiView_regenAppend(GiView jself, int sid, int playh) { jself.regenAppend(sid, playh); } public static void SwigDirector_GiView_redraw(GiView jself, boolean changed) { jself.redraw(changed); } public static boolean SwigDirector_GiView_useFinger(GiView jself) { return jself.useFinger(); } public static boolean SwigDirector_GiView_isContextActionsVisible(GiView jself) { return jself.isContextActionsVisible(); } public static boolean SwigDirector_GiView_showContextActions(GiView jself, long actions, long buttonXY, float x, float y, float w, float h) { return jself.showContextActions(new Ints(actions, false), new Floats(buttonXY, false), x, y, w, h); } public static void SwigDirector_GiView_hideContextActions(GiView jself) { jself.hideContextActions(); } public static void SwigDirector_GiView_commandChanged(GiView jself) { jself.commandChanged(); } public static void SwigDirector_GiView_selectionChanged(GiView jself) { jself.selectionChanged(); } public static void SwigDirector_GiView_contentChanged(GiView jself) { jself.contentChanged(); } public static void SwigDirector_GiView_dynamicChanged(GiView jself) { jself.dynamicChanged(); } public static void SwigDirector_GiView_zoomChanged(GiView jself) { jself.zoomChanged(); } public static void SwigDirector_GiView_viewChanged(GiView jself, long oldview) { jself.viewChanged((oldview == 0) ? null : new GiView(oldview, false)); } public static void SwigDirector_GiView_shapeWillDelete(GiView jself, int sid) { jself.shapeWillDelete(sid); } public static void SwigDirector_GiView_shapeDeleted(GiView jself, int sid) { jself.shapeDeleted(sid); } public static boolean SwigDirector_GiView_shapeDblClick(GiView jself, int type, int sid, int tag) { return jself.shapeDblClick(type, sid, tag); } public static boolean SwigDirector_GiView_shapeClicked(GiView jself, int type, int sid, int tag, float x, float y) { return jself.shapeClicked(type, sid, tag, x, y); } public static void SwigDirector_GiView_showMessage(GiView jself, String text) { jself.showMessage(text); } public static void SwigDirector_GiView_getLocalizedString(GiView jself, String name, long c) { jself.getLocalizedString(name, (c == 0) ? null : new MgStringCallback(c, false)); } public static void SwigDirector_MgStringCallback_onGetString(MgStringCallback jself, String text) { jself.onGetString(text); } public static void SwigDirector_MgFindImageCallback_onFindImage(MgFindImageCallback jself, int sid, String name) { jself.onFindImage(sid, name); } public static void SwigDirector_MgOptionCallback_onGetOptionBool(MgOptionCallback jself, String name, boolean value) { jself.onGetOptionBool(name, value); } public static void SwigDirector_MgOptionCallback_onGetOptionInt(MgOptionCallback jself, String name, int value) { jself.onGetOptionInt(name, value); } public static void SwigDirector_MgOptionCallback_onGetOptionFloat(MgOptionCallback jself, String name, float value) { jself.onGetOptionFloat(name, value); } public static void SwigDirector_MgOptionCallback_onGetOptionString(MgOptionCallback jself, String name, String text) { jself.onGetOptionString(name, text); } private final static native void swig_module_init(); static { swig_module_init(); } }
aw691190716/vgandroid
TouchVG/src/rhcad/touchvg/core/touchvgJNI.java
Java
bsd-2-clause
301,098
package com.jmatio.types; import java.util.Arrays; public class MLChar extends MLArray implements GenericArrayCreator<Character> { Character[] chars; /** * Creates the 1 x {@link String#length()} {@link MLChar} from the given * String. * * @param name the {@link MLArray} name * @param value the String */ public MLChar(String name, String value ) { this( name, new int[] { 1, value.length() } , MLArray.mxCHAR_CLASS, 0); set(value); } /** * Create the {@link MLChar} from array of {@link String}s. * * @param name the {@link MLArray} name * @param values the array of {@link String}s */ public MLChar(String name, String[] values ) { this( name, new int[] { values.length, values.length > 0 ? getMaxLength(values) : 0} , MLArray.mxCHAR_CLASS, 0); for ( int i = 0; i < values.length; i++ ) { set( values[i], i ); } } /** * Returns the maximum {@link String} length of array of {@link String}s. * @param values the array of {@link String}s * @return the maximum {@link String} length of array of {@link String}s */ private static int getMaxLength( String[] values ) { int result = 0; for ( int i = 0, curr = 0; i < values.length; i++ ) { if ( ( curr = values[i].length() ) > result ) { result = curr; } } return result; } /** * Added method to allow initialization of a char array representing * an array of strings. * * @param name * @param values * @param maxlen */ public MLChar(String name, String[] values, int maxlen) { this( name, new int[] { values.length, maxlen }, MLArray.mxCHAR_CLASS, 0 ); int idx = 0; for (String v : values) { set(v, idx); idx++; } } public MLChar(String name, int[] dims, int type, int attributes) { super(name, dims, type, attributes); chars = createArray(getM(), getN()); } public Character[] createArray(int m, int n) { return new Character[m*n]; } public void setChar(char ch, int index) { chars[index] = ch; } /** * Populates the {@link MLChar} with the {@link String} value. * @param value the String value */ public void set(String value) { char[] cha = value.toCharArray(); for ( int i = 0; i < getN() && i < value.length(); i++ ) { setChar(cha[i], i); } } /** * Set one row, specifying the row. * * @param value * @param idx */ public void set(String value, int idx) { int rowOffset = getM(); for ( int i = 0; i < getN(); i++ ) { if ( i < value.length()) { setChar( value.charAt(i), idx + (rowOffset * i)); } else { setChar(' ', idx + (rowOffset * i)); } } } public Character getChar(int m, int n) { return chars[getIndex(m,n)]; } public Character[] exportChar() { return chars; } @Override public boolean equals(Object o) { if ( o instanceof MLChar ) { return Arrays.equals( chars, ((MLChar)o).chars ); } return super.equals( o ); } /** * Gets the m-th character matrix's row as <code>String</code>. * * @param m - row number * @return - <code>String</code> */ public String getString( int m ) { StringBuffer charbuff = new StringBuffer(); for (int n = 0; n < getN(); n++) { charbuff.append(getChar(m, n)); } return charbuff.toString().trim(); } public String contentToString() { StringBuffer sb = new StringBuffer(); sb.append(name + " = \n"); for ( int m = 0; m < getM(); m++ ) { sb.append("\t"); StringBuffer charbuff = new StringBuffer(); charbuff.append("'"); for ( int n = 0; n < getN(); n++ ) { charbuff.append( getChar(m,n) ); } charbuff.append("'"); sb.append(charbuff); sb.append("\n"); } return sb.toString(); } }
hydrosolutions/model_RRMDA_Themi
java/resources/JMatIO-041212/src/com/jmatio/types/MLChar.java
Java
bsd-2-clause
4,696
package com.bkav.training.week2new.session2_2; public class Shape { private String color; private boolean filled; public Shape() { this.color = "red"; this.filled = true; } public Shape(String color, boolean filled) { this.color = color; this.filled = filled; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public boolean isFilled() { return filled; } public void setFilled(boolean filled) { this.filled = filled; } @Override public String toString() { return "Shape [color=" + color + ", filled=" + filled + "]"; } }
anhtrungbk55/JavaTraining
Documents/workspace/JavaTraining/src/com/bkav/training/week2new/session2_2/Shape.java
Java
bsd-2-clause
622
/* Copyright (c) 2013-2015, Dźmitry Laŭčuk 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. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package afc.ant.modular; import java.util.List; /** * <p>Indicates that a loop is detected in dependencies between the {@link Module modules} * involved. In other words, there is a module in the given modules that depends upon * itself. Circular dependencies do not allow a dependency resolver to determine * an order in which modules could be processes so that each module is processed * after all its dependee modules are processed.</p> * * @author D&#378;mitry La&#365;&#269;uk * * @see SerialDependencyResolver * @see ParallelDependencyResolver */ public class CyclicDependenciesDetectedException extends Exception { private final List<Module> loop; /** * <p>Creates an instance of {@code CyclicDependenciesDetectedException} and * initialises it with the given module list that form a dependency loop. The modules * passed are expected to be in the order they are placed in this loop. * The first and the last elements of this list are not expected to be the same * module. For instance, if the modules {@code A}, {@code B}, {@code C} are in * a dependency loop {@code A->B->C->} then the list {@code [A, B, C]} should * be passed.</p> * * <p>The exception message is composed basing on the given modules.</p> * * <p>Ownership over the given list is taken by the instance created. It should * not be modified after the exception is created.</p> * * @param loop the list of modules that form the dependency loop. It must not be * {@code null}. * * @throws NullPointerException if <em>loop</em> is {@code null}. */ public CyclicDependenciesDetectedException(final List<Module> loop) { super(errorMessage(loop)); this.loop = loop; } /** * <p>Returns the list of the modules that form the dependency loop this exception * is associated with. The list returned is mutable. It is never {@code null}.</p> * * @return the list of the modules that form the dependency loop. */ public List<Module> getLoop() { return loop; } private static String errorMessage(final List<Module> loop) { final StringBuilder buf = new StringBuilder("Cyclic dependencies detected: ["); if (!loop.isEmpty()) { buf.append("->"); for (final Module module : loop) { buf.append(module.getPath()).append("->"); } } buf.append("]."); return buf.toString(); } }
dzidzitop/ant_modular
src/java/afc/ant/modular/CyclicDependenciesDetectedException.java
Java
bsd-2-clause
3,918
// Copyright (c) 2003-present, Jodd Team (http://jodd.org) // 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. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. package jodd.json.fixtures.mock.superhero; import java.util.Arrays; import java.util.List; public class Villian { private String name; private Hero nemesis; private SecretLair lair; private List<SuperPower> powers; protected Villian() { } public Villian(String name, Hero nemesis, SecretLair lair, SuperPower... powers) { this.name = name; this.nemesis = nemesis; this.lair = lair; this.powers = Arrays.asList(powers); } public String getName() { return name; } private void setName(String name) { this.name = name; } public Hero getNemesis() { return nemesis; } protected void setNemesis(Hero nemesis) { this.nemesis = nemesis; } public SecretLair getLair() { return lair; } protected void setLair(SecretLair lair) { this.lair = lair; } public List<SuperPower> getPowers() { return powers; } protected void setPowers(List<SuperPower> powers) { this.powers = powers; } }
vilmospapp/jodd
jodd-json/src/test/java/jodd/json/fixtures/mock/superhero/Villian.java
Java
bsd-2-clause
2,315
package org.md2k.autosense; /* * Copyright (c) 2015, The University of Memphis, MD2K Center * - Syed Monowar Hossain <[email protected]> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ public class Constants { public static final String SERVICE_NAME = "org.md2k.autosense.antradio.connection.ServiceAutoSenses"; public static final boolean LOG_TEXT =false; public static final String INTENT_STOP = "stop"; public static final String INTENT_RECEIVED_DATA = "received_data"; }
MD2Korg/mCerebrum-AutoSense
autosense/src/main/java/org/md2k/autosense/Constants.java
Java
bsd-2-clause
1,776
// // $Id$ // // Getdown - application installer, patcher and launcher // Copyright (C) 2004-2010 Three Rings Design, Inc. // http://code.google.com/p/getdown/ // // 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. // 2. Redistributions in binary form must reproduce the above copyright notice, this list of // conditions and the following disclaimer in the documentation and/or other materials provided // with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.threerings.getdown.data; /** * System property constants associated with Getdown. */ public class Properties { /** This property will be set to "true" on the application when it is being run by getdown. */ public static final String GETDOWN = "com.threerings.getdown"; /** If accepting connections from the launched application, this property * will be set to the connection server port. */ public static final String CONNECT_PORT = "com.threerings.getdown.connectPort"; }
makkus/getdown
src/main/java/com/threerings/getdown/data/Properties.java
Java
bsd-2-clause
1,916
/* * Copyright (c) 2018, Marshall <https://github.com/marshdevs> * Copyright (c) 2018, Adam <[email protected]> * 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. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package net.runelite.client.plugins.achievementdiary.diaries; import net.runelite.api.Quest; import net.runelite.api.Skill; import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; import net.runelite.client.plugins.achievementdiary.OrRequirement; import net.runelite.client.plugins.achievementdiary.QuestRequirement; import net.runelite.client.plugins.achievementdiary.SkillRequirement; public class WildernessDiaryRequirement extends GenericDiaryRequirement { public WildernessDiaryRequirement() { // EASY add("Cast Low Alchemy at the Fountain of Rune.", new SkillRequirement(Skill.MAGIC, 21)); add("Kill an Earth Warrior in the Wilderness beneath Edgeville.", new SkillRequirement(Skill.AGILITY, 15)); add("Mine some Iron ore in the Wilderness.", new SkillRequirement(Skill.MINING, 15)); add("Have the Mage of Zamorak teleport you to the Abyss.", new QuestRequirement(Quest.ENTER_THE_ABYSS)); // MEDIUM add("Mine some Mithril ore in the wilderness.", new SkillRequirement(Skill.MINING, 55)); add("Chop some yew logs from a fallen Ent.", new SkillRequirement(Skill.WOODCUTTING, 61)); add("Enter the Wilderness Godwars Dungeon.", new OrRequirement( new SkillRequirement(Skill.AGILITY, 60), new SkillRequirement(Skill.STRENGTH, 60) ) ); add("Complete a lap of the Wilderness Agility course.", new SkillRequirement(Skill.AGILITY, 52)); add("Charge an Earth Orb.", new SkillRequirement(Skill.MAGIC, 60)); add("Kill a Bloodveld in the Wilderness Godwars Dungeon.", new SkillRequirement(Skill.SLAYER, 50)); add("Smith a Golden helmet in the Resource Area.", new SkillRequirement(Skill.SMITHING, 50), new QuestRequirement(Quest.BETWEEN_A_ROCK, true)); // HARD add("Cast one of the 3 God spells against another player in the Wilderness.", new SkillRequirement(Skill.MAGIC, 60), new QuestRequirement(Quest.MAGE_ARENA_I)); add("Charge an Air Orb.", new SkillRequirement(Skill.MAGIC, 66)); add("Catch a Black Salamander in the Wilderness.", new SkillRequirement(Skill.HUNTER, 67)); add("Smith an Adamant scimitar in the Resource Area.", new SkillRequirement(Skill.SMITHING, 75)); add("Take the agility shortcut from Trollheim into the Wilderness.", new SkillRequirement(Skill.AGILITY, 64), new QuestRequirement(Quest.DEATH_PLATEAU)); add("Kill a Spiritual warrior in the Wilderness Godwars Dungeon.", new SkillRequirement(Skill.SLAYER, 68)); add("Fish some Raw Lava Eel in the Wilderness.", new SkillRequirement(Skill.FISHING, 53)); // ELITE add("Teleport to Ghorrock.", new SkillRequirement(Skill.MAGIC, 96), new QuestRequirement(Quest.DESERT_TREASURE)); add("Fish and Cook a Dark Crab in the Resource Area.", new SkillRequirement(Skill.FISHING, 85), new SkillRequirement(Skill.COOKING, 90)); add("Smith a rune scimitar from scratch in the Resource Area.", new SkillRequirement(Skill.MINING, 85), new SkillRequirement(Skill.SMITHING, 90)); add("Steal from the Rogues' chest.", new SkillRequirement(Skill.THIEVING, 84)); add("Slay a spiritual mage inside the wilderness Godwars Dungeon.", new SkillRequirement(Skill.SLAYER, 83), new OrRequirement( new SkillRequirement(Skill.AGILITY, 60), new SkillRequirement(Skill.STRENGTH, 60) ) ); add("Cut and burn some magic logs in the Resource Area.", new SkillRequirement(Skill.WOODCUTTING, 75), new SkillRequirement(Skill.FIREMAKING, 75)); } }
runelite/runelite
runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/WildernessDiaryRequirement.java
Java
bsd-2-clause
4,927
package org.giweet.step; import java.util.Arrays; import org.giweet.step.tokenizer.DefaultCharacterAnalyzer; import org.giweet.step.tokenizer.QuoteTailNotFoundException; import org.giweet.step.tokenizer.StepDeclarationCharAnalyzer; import org.giweet.step.tokenizer.StepTokenizer; public abstract class StepDeclaration implements Comparable<StepDeclaration> { private final String value; private final StepToken[] tokens; public StepDeclaration(String value) throws QuoteTailNotFoundException { this.value = value; // FIXME should be passed as argument this.tokens = new StepTokenizer(new StepDeclarationCharAnalyzer(new DefaultCharacterAnalyzer())).tokenize(value); } public String getValue() { return value; } public abstract boolean isOfType(StepType type); public StepToken[] getTokens() { return tokens; } public StepToken[] trimTokens() { int startIndex = 0; int endIndex = tokens.length; if (endIndex > 0 && tokens[0].isWhitespace()) { startIndex++; } if (tokens.length > startIndex && tokens[endIndex - 1].isWhitespace()) { endIndex--; } StepToken[] trimTokens = tokens; if (endIndex - startIndex != tokens.length) { trimTokens = Arrays.copyOfRange(tokens, startIndex, endIndex); } return trimTokens; } @Override public int compareTo(StepDeclaration stepDeclaration) { StepToken [] otherTrimTokens = stepDeclaration.trimTokens(); StepToken [] trimTokens = trimTokens(); int result = 0; int nbTokens = Math.min(trimTokens.length, otherTrimTokens.length); for (int i = 0 ; i < nbTokens && result == 0 ; i++) { result = trimTokens[i].compareTo(otherTrimTokens[i]); } if (result == 0) { result = trimTokens.length - otherTrimTokens.length; if (nbTokens > 0 && trimTokens[nbTokens - 1].isDynamic()) { result = -result; } } if (result != 0) { result = result < 0 ? -1 : 1; } return result; } @Override public String toString() { return value; } }
spoonless/giweet
src/main/java/org/giweet/step/StepDeclaration.java
Java
bsd-2-clause
1,975
/** * 系统名称 :城市一卡通综合管理平台 * 开发组织 :城市一卡通事业部 * 版权所属 :新开普电子股份有限公司 * (C) Copyright Corporation 2014 All Rights Reserved. * 本内容仅限于郑州新开普电子股份有限公司内部使用,版权保护,未经过授权拷贝使用将追究法律责任 */ package cn.newcapec.foundation.ecardcity.makecard.controller; import java.util.List; import java.util.Map; import net.sf.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import cn.newcapec.foundation.ecardcity.makecard.biz.ConsumeCardService; import cn.newcapec.foundation.ecardcity.makecard.biz.QueryCustInfoService; import cn.newcapec.foundation.ecardcity.makecard.biz.SellCardService; import cn.newcapec.foundation.ecardcity.makecard.model.CardType; import cn.newcapec.foundation.ecardcity.makecard.util.CardCodeConstant; import cn.newcapec.foundation.ecardcity.makecard.util.CardTipConstant; import cn.newcapec.framework.core.exception.asserts.Assert; import cn.newcapec.framework.core.exception.asserts.AssertObject; import cn.newcapec.framework.core.handler.MultiViewResource; import cn.newcapec.framework.core.rest.Msg; /** * 消费卡-售卡视图控制展示 * * @author wulimo * */ @Controller @Scope("prototype") @RequestMapping(value = "/querycustinfo") @SuppressWarnings("all") public class QueryCustInfoController extends MultiViewResource { @Autowired private ConsumeCardService consumeCardService; @Autowired private QueryCustInfoService queryCustInfoService; @Autowired private SellCardService sellCardService; /** * 进入客户信息查询界面 * * @return */ @RequestMapping(value = "queryCustInfo") public String sellCardUI(ModelMap modelMap) { return getUrl("makecard.consumecard.queryCustInfoUI"); } /** * 读卡查询 * * @return */ @RequestMapping(value = "readCardQuery", method = RequestMethod.POST) @ResponseBody public Msg readCardQuery() { return doExpAssert(new AssertObject() { @Override public void AssertMethod(Msg msg) { // 判断传递参数是否为null JSONObject param = getJsonObject(); Assert.isTrue(null != param, CardTipConstant.TIP_QUERYCUST_FAULT); if (getJsonObject().containsKey("userId")) { } else { // 获取当前用户信息 String userId = "1"; // userId=request.getSession().getAttribute("userId").toString(); param.put("userId", userId); } List custList = queryCustInfoService.readCardQuery(param); if (null != custList && custList.size() > 0) { msg.setMsg(CardTipConstant.TIP_IS_OK); msg.setSuccess(true); msg.setData(custList); } else { msg.setMsg(CardTipConstant.TIP_QUERYCUST_NORS); msg.setSuccess(false); } } }); } /** * 模糊查询 * * @return */ @RequestMapping(value = "searchCustList", method = RequestMethod.POST) @ResponseBody public Msg searchCustList() { return doExpAssert(new AssertObject() { @Override public void AssertMethod(Msg msg) { // 判断传递参数是否为null JSONObject param = getJsonObject(); Assert.isTrue(null != param, CardTipConstant.TIP_QUERYCUST_FAULT); if (getJsonObject().containsKey("userId")) { } else { // 获取当前用户信息 String userId = "1"; // userId=request.getSession().getAttribute("userId").toString(); param.put("userId", userId); } Map map = queryCustInfoService.searchCustList(param); msg.setSuccess(true); msg.setData(map); } }); } /** * 查看详情 * * @return */ @RequestMapping(value = "showCustDetail", method = RequestMethod.POST) @ResponseBody public ModelAndView showCustDetail(ModelMap modelMap) { // 判断传递参数是否为null JSONObject param = getJsonObject(); Assert.isTrue(null != param, CardTipConstant.TIP_QUERYCUST_FAULT); if (getJsonObject().containsKey("userId")) { } else { // 获取当前用户信息 String userId = "1"; // userId=request.getSession().getAttribute("userId").toString(); param.put("userId", userId); } Map map = queryCustInfoService.getCustDetail(param); List<CardType> cardTypes = sellCardService.getSellCardTypes(); modelMap.put("countrys", sellCardService .getDictListByCode(CardCodeConstant.CODE_DICT_COUNTRY)); modelMap.put("nations", sellCardService .getDictListByCode(CardCodeConstant.CODE_DICT_NATION)); modelMap.put("certificatetypes", sellCardService .getDictListByCode(CardCodeConstant.CODE_DICT_CERTIFICATETYPE)); modelMap.put("cardTypes", cardTypes); modelMap.put("obj", map); return toView(getUrl("makecard.consumecard.custDetailUI"), modelMap); } }
zhangjunfang/eclipse-dir
eCardCity2.0/ecardcity-makecard/src/main/java/cn/newcapec/foundation/ecardcity/makecard/controller/QueryCustInfoController.java
Java
bsd-2-clause
5,110
package com.blazeloader.api.world.gen; import java.util.Random; import com.blazeloader.api.block.fluid.Fluid; import net.minecraft.block.Block; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenLakes; public class WorldGenLakeCustomFluid<T extends Block & Fluid> extends WorldGenLakes implements IChunkGenerator { private final T block; public WorldGenLakeCustomFluid(T blockIn) { super(blockIn); block = blockIn; } public boolean generate(World w, Random rand, BlockPos position) { if (!super.generate(w, rand, position)) { return false; } for (position = position.add(-8, 0, -8); position.getY() > 5 && w.isAirBlock(position); position = position.down()); position = position.down(4); for (int k2 = 0; k2 < 16; ++k2) { for (int l3 = 0; l3 < 16; ++l3) { int l4 = 4; if (w.canBlockFreezeWater(position.add(k2, l4, l3))) { w.setBlockState(position.add(k2, l4, l3), block.getFrozenState(), 2); } } } return true; } public void populateChunk(Chunk chunk, IChunkProvider primary, net.minecraft.world.gen.IChunkGenerator secondary, int chunkX, int chunkZ, Random seed) { BlockPos blockpos = new BlockPos(chunkX * 16, 0, chunkZ * 16); seed.setSeed(chunk.getWorld().getSeed()); long k = seed.nextLong() / 2L * 2L + 1L; long l = seed.nextLong() / 2L * 2L + 1L; seed.setSeed((long)chunkX * k + (long)chunkZ * l ^ chunk.getWorld().getSeed()); generate(chunk.getWorld(), seed, blockpos.add(seed.nextInt(16) + 8, seed.nextInt(256), seed.nextInt(16) + 8)); } }
BlazeLoader/BlazeLoader
src/main/com/blazeloader/api/world/gen/WorldGenLakeCustomFluid.java
Java
bsd-2-clause
1,840
/* * $Id$ * * Copyright (c) 2018, Simsilica, LLC * 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. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.simsilica.bullet; import java.util.Objects; import com.google.common.base.MoreObjects; import com.jme3.math.*; import com.simsilica.es.EntityComponent; import com.simsilica.mathd.*; /** * Represents the initial physical position of an entity. * * @author Paul Speed */ public class SpawnPosition implements EntityComponent { private Vector3f location; private Quaternion orientation; protected SpawnPosition() { } public SpawnPosition( double x, double y, double z ) { this(new Vector3f((float)x, (float)y, (float)z), new Quaternion()); } public SpawnPosition( double x, double y, double z, Quatd orientation ) { this(new Vector3f((float)x, (float)y, (float)z), orientation.toQuaternion()); } public SpawnPosition( Vector3f location ) { this(location, new Quaternion()); } public SpawnPosition( Vec3d location, double facing ) { this(location.toVector3f(), facing); } public SpawnPosition( Vec3d location, Quatd orientation ) { this(location.toVector3f(), orientation.toQuaternion()); } public SpawnPosition( Vector3f location, double facing ) { this(location, new Quaternion().fromAngles(0, (float)facing, 0)); } public SpawnPosition( Vector3f location, Quaternion orientation ) { this.location = location; this.orientation = orientation; } public Vector3f getLocation() { return location; } public Quaternion getOrientation() { return orientation; } @Override public String toString() { return MoreObjects.toStringHelper(getClass().getSimpleName()) .omitNullValues() .add("location", location) .add("orientation", orientation) .toString(); } }
Simsilica/SiO2
extensions/bullet/src/main/java/com/simsilica/bullet/SpawnPosition.java
Java
bsd-3-clause
3,595
/* by Casey Durfee <[email protected]> version 0.5 (Sep. 19, 2005) * this feed provides the last n bibs cataloged in the system. * Problem is that it includes bibs with no items attached such as * fast-add records. * there is no simple way to filter those out. it's on the todo list. 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.spl.feed; import javax.servlet.http.HttpServletRequest; import org.spl.RSSConf; import org.spl.RSSServlet; import org.spl.utils.RSSDBUtils; public class RecentlyAddedFeed extends GenericRSSFeed { String feedType = "recentlyadded"; RSSDBUtils dbUtils; public RecentlyAddedFeed( HttpServletRequest req ) { super( req ); dbUtils = RSSServlet.getRSSDBUtils(); } public String determineQuery(){ //String ret = ""; String numItems = req.getParameter("num"); if( numItems == null ) { numItems = "20"; } int iNumItems = Integer.parseInt( numItems ); if( iNumItems > RSSConf.getMaxItemsInFeed() ) { iNumItems = RSSConf.getMaxItemsInFeed(); } //System.err.println("iNumItems = " + iNumItems ); // the keys need to be web escaped or you get an error message. String selectedkeys = dbUtils.getRecentlyCreatedBibs( "" + iNumItems ).replaceAll(",", "%2B"); //System.err.println( "selectedkeys => " + selectedkeys ); //csdebug String uri = RSSConf.getBibNumbersURI(); String ret = "selectedkeys=" + selectedkeys + "&uri=" + uri + "&npp=" + iNumItems; return ret; } public String getFeedType() { return "recentlyadded"; } }
jrochkind/hip_rss
src/main/java/org/spl/feed/RecentlyAddedFeed.java
Java
bsd-3-clause
2,595
/******************************************************************************* * Caleydo - Visualization for Molecular Biology - http://caleydo.org * Copyright (c) The Caleydo Team. All rights reserved. * Licensed under the new BSD license, available at http://caleydo.org/license ******************************************************************************/ package org.caleydo.view.pathway; import org.caleydo.core.util.color.Color; import org.caleydo.core.view.opengl.camera.ViewFrustum; import org.caleydo.core.view.opengl.renderstyle.GeneralRenderStyle; public class PathwayRenderStyle extends GeneralRenderStyle { public static final int neighborhoodNodeColorArraysize = 4; public static final int ENZYME_NODE_PIXEL_WIDTH = 46; public static final int ENZYME_NODE_PIXEL_HEIGHT = 17; public static final int COMPOUND_NODE_PIXEL_WIDTH = 8; public static final int COMPOUND_NODE_PIXEL_HEIGHT = 8; public static final float Z_OFFSET = 0.01f; public static final Color ENZYME_NODE_COLOR = new Color(0.3f, 0.3f, 0.3f, 1); public static final Color COMPOUND_NODE_COLOR = new Color(0.3f, 0.3f, 0.3f, 1); public static final Color PATHWAY_NODE_COLOR = new Color(0.7f, 0.7f, 1f, 1); public static final float[] PATH_COLOR = new float[] { 1, 1, 1, 0.0f }; public static final float[] STD_DEV_COLOR = new float[] { 49f / 255f, 163f / 255, 84f / 255, 1f }; public static final int STD_DEV_BAR_PIXEL_WIDTH = 6; public static final int STD_DEV_BAR_PIXEL_HEIGHT = 6; public enum NodeShape { RECTANGULAR, ROUND, ROUNDRECTANGULAR } protected NodeShape enzymeNodeShape; protected NodeShape compoundNodeShape; protected NodeShape pathwayNodeShape; public PathwayRenderStyle(ViewFrustum viewFrustum) { super(viewFrustum); init(); } /** * Constructor. Initializes the pathway render style. TODO: load pathway style from XML file. */ private void init() { // TODO: use float[] constants for colors enzymeNodeShape = NodeShape.RECTANGULAR; compoundNodeShape = NodeShape.ROUND; pathwayNodeShape = NodeShape.ROUNDRECTANGULAR; } public NodeShape getCompoundNodeShape() { return compoundNodeShape; } public NodeShape getEnzymeNodeShape() { return enzymeNodeShape; } public NodeShape getPathwayNodeShape() { return pathwayNodeShape; } }
Caleydo/caleydo
org.caleydo.view.pathway/src/org/caleydo/view/pathway/PathwayRenderStyle.java
Java
bsd-3-clause
2,295
package com.krishagni.catissueplus.core.administrative.domain.factory; import com.krishagni.catissueplus.core.common.errors.ErrorCode; public enum DistributionOrderErrorCode implements ErrorCode { NOT_FOUND, DP_REQUIRED, DUP_NAME, NAME_REQUIRED, INVALID_STATUS, INVALID_CREATION_DATE, INVALID_EXECUTION_DATE, INVALID_QUANTITY, STATUS_CHANGE_NOT_ALLOWED, ALREADY_EXECUTED, DUPLICATE_SPECIMENS, INVALID_SPECIMEN_STATUS, NO_SPECIMENS_TO_DIST, INVALID_SPECIMENS_FOR_DP, REQUESTER_DOES_NOT_BELONG_DP_INST, RECV_SITE_DOES_NOT_BELONG_DP_INST; @Override public String code() { return "DIST_ORDER_" + this.name(); } }
asamgir/openspecimen
WEB-INF/src/com/krishagni/catissueplus/core/administrative/domain/factory/DistributionOrderErrorCode.java
Java
bsd-3-clause
668
/* * $Id$ * * Copyright 2006, The jCoderZ.org Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the jCoderZ.org Project nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.jcoderz.phoenix.sqlparser; /** * @author Albrecht Messner */ public abstract class SqlStatement { private String mAnnotation; /** * @param annotation the annotation to set */ public void setAnnotation (String annotation) { mAnnotation = annotation; } /** * @return Returns the annotation. */ public String getAnnotation () { return mAnnotation; } }
jCoderZ/fawkez-old
src/java/org/jcoderz/phoenix/sqlparser/SqlStatement.java
Java
bsd-3-clause
2,038
/** * Copyright (c) 2009-2018, rultor.com * 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. 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. 3) Neither the name of the rultor.com nor * the names of its contributors may be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.rultor.agents.github; import com.jcabi.github.Repo; import com.jcabi.github.mock.MkGithub; import com.rultor.spi.Talk; import java.io.IOException; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; import org.xembly.Directives; /** * Tests for {@link Stars}. * * @author Krzysztof Krason ([email protected]) * @version $Id$ */ public final class StarsTest { /** * Stars can star a new repo. * @throws java.io.IOException In case of error */ @Test public void starsNewRepo() throws IOException { final MkGithub github = new MkGithub(); final Repo repo = github.randomRepo(); final Talk talk = this.talk(repo); new Stars(github).execute(talk); MatcherAssert.assertThat( repo.stars().starred(), Matchers.is(true) ); } /** * Stars should leave already starred repo. * @throws java.io.IOException In case of error */ @Test public void leavesStarredRepo() throws IOException { final MkGithub github = new MkGithub(); final Repo repo = github.randomRepo(); final Talk talk = this.talk(repo); repo.stars().star(); new Stars(github).execute(talk); MatcherAssert.assertThat( repo.stars().starred(), Matchers.is(true) ); } /** * Create a test talk. * @param repo Repo to use * @return Test Talk. * @throws IOException In case of error. */ private Talk talk(final Repo repo) throws IOException { final Talk talk = new Talk.InFile(); talk.modify( new Directives().xpath("/talk") .add("wire").add("href").set("#").up() .add("github-repo").set(repo.coordinates().toString()).up() ); return talk; } }
krzyk/rultor
src/test/java/com/rultor/agents/github/StarsTest.java
Java
bsd-3-clause
3,443
/** * Copyright (c) 2002-2008, Simone Bordet * All rights reserved. * * This software is distributable under the BSD license. * See the terms of the BSD license in the documentation provided with this software. */ package foxtrot; import java.security.AccessControlContext; import java.security.AccessController; import javax.swing.SwingUtilities; /** * A time-consuming task to be executed in the Worker Thread that may throw checked exceptions. <br /> * Users must implement the {@link #run} method with the time-consuming code, and not worry about * exceptions, for example: * <pre> * Task task = new Task() * { * public Object run() throws InterruptedException * { * Thread.sleep(10000); * return null; * } * }; * </pre> * Exceptions and Errors thrown by the <tt>run()</tt> method will be rethrown automatically by * {@link Worker#post(Task)} or by {@link ConcurrentWorker#post(Task)} * * @version $Revision: 259 $ * @see Worker * @see ConcurrentWorker */ public abstract class Task { private Object result; private Throwable throwable; private boolean completed; private AccessControlContext securityContext; /** * Creates a new Task. */ protected Task() { securityContext = AccessController.getContext(); } /** * The method to implement with time-consuming code. * It should NOT be synchronized or synchronize on this Task instance, otherwise the AWT Event Dispatch Thread * cannot efficiently test when this Task is completed. */ public abstract Object run() throws Exception; /** * Returns the result of this Task operation, as set by {@link #setResult}. * If an exception or an error is thrown by {@link #run}, it is rethrown here. * Synchronized since the variables are accessed from 2 threads * Accessed from the AWT Event Dispatch Thread. * * @see #setResult * @see #setThrowable */ protected final synchronized Object getResultOrThrow() throws Exception { Throwable t = getThrowable(); if (t != null) { if (t instanceof Exception) throw (Exception)t; else throw (Error)t; } return getResult(); } /** * Returns the result of this Task operation, as set by {@link #setResult}. * Synchronized since the variable is accessed from 2 threads * Accessed from the AWT Event Dispatch Thread. * * @see #getResultOrThrow */ private final synchronized Object getResult() { return result; } /** * Sets the result of this Task operation, as returned by the {@link #run} method. * Synchronized since the variable is accessed from 2 threads * Accessed from the worker thread. * Package protected, used by {@link AbstractWorkerThread} * * @see #getResultOrThrow * @see #getResult */ final synchronized void setResult(Object result) { this.result = result; } /** * Returns the throwable as set by {@link #setThrowable}. * Synchronized since the variable is accessed from 2 threads * Accessed from the AWT Event Dispatch Thread. */ final synchronized Throwable getThrowable() { return throwable; } /** * Sets the throwable eventually thrown by the {@link #run} method. * Synchronized since the variable is accessed from 2 threads * Accessed from the worker thread. * Package protected, used by {@link AbstractWorkerThread} * * @see #getThrowable */ final synchronized void setThrowable(Throwable x) { throwable = x; } /** * Returns whether the execution of this Task has been completed or not. */ public final synchronized boolean isCompleted() { // Synchronized since the variable is accessed from 2 threads // Accessed from the AWT Event Dispatch Thread. return completed; } /** * Sets the completion status of this Task. * Synchronized since the variable is accessed from 2 threads. * Accessed from the worker thread and from the AWT Event Dispatch Thread. * Package protected, used by {@link AbstractWorkerThread} * * @see #isCompleted */ final synchronized void setCompleted(boolean value) { completed = value; if (value) notifyAll(); } /** * Returns the protection domain stack at the moment of instantiation of this Task. * Synchronized since the variable is accessed from 2 threads * Accessed from the worker thread. * Package protected, used by {@link AbstractWorkerThread} * * @see #Task */ final synchronized AccessControlContext getSecurityContext() { return securityContext; } /** * Resets the internal status of this Task, that can be therefore be reused. * Synchronized since the variables are accessed from 2 threads * Accessed from the AWT Event Dispatch Thread. * Package protected, used by Worker * * @see #isCompleted */ final synchronized void reset() { setResult(null); setThrowable(null); setCompleted(false); } /** * Callback invoked from the worker thread to perform some operation just after the Task * has been {@link #isCompleted completed}. */ void postRun() { // Needed in case that no events are posted on the AWT Event Queue // via the normal mechanisms (mouse movements, key typing, etc): // the AWT Event Queue is waiting in EventQueue.getNextEvent(), // posting this one will wake it up and allow the event pump to // finish its job and release control to the original pump SwingUtilities.invokeLater(new Runnable() { public final void run() { if (AbstractWorker.debug) System.out.println("[Task] Run completed for task " + Task.this); } }); } }
rrr6399/foxtrot
src/foxtrot/Task.java
Java
bsd-3-clause
6,092
package org.jscsi.target.connection.stage.fullfeature; import static org.jscsi.target.storage.IStorageModule.VIRTUAL_BLOCK_SIZE; import java.io.IOException; import java.nio.ByteBuffer; import org.jscsi.exception.InternetSCSIException; import org.jscsi.parser.BasicHeaderSegment; import org.jscsi.parser.ProtocolDataUnit; import org.jscsi.parser.scsi.SCSICommandParser; import org.jscsi.parser.scsi.SCSIResponseParser.ServiceResponse; import org.jscsi.parser.scsi.SCSIStatus; import org.jscsi.target.connection.TargetPduFactory; import org.jscsi.target.connection.phase.TargetFullFeaturePhase; import org.jscsi.target.scsi.ScsiResponseDataSegment; import org.jscsi.target.scsi.cdb.Read10Cdb; import org.jscsi.target.scsi.cdb.Read6Cdb; import org.jscsi.target.scsi.cdb.ReadCdb; import org.jscsi.target.scsi.cdb.ScsiOperationCode; import org.jscsi.target.settings.SettingsException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A stage for processing <code>READ (6)</code> and <code>READ (10)</code> SCSI commands. * * @author Andreas Ergenzinger */ public class ReadStage extends ReadOrWriteStage { private static final Logger LOGGER = LoggerFactory.getLogger(ReadStage.class); public ReadStage (final TargetFullFeaturePhase targetFullFeaturePhase) { super(targetFullFeaturePhase); } @Override public void execute (ProtocolDataUnit pdu) throws IOException , InterruptedException , InternetSCSIException , SettingsException { // get relevant variables ... // ... from settings final boolean immediateData = settings.getImmediateData(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("immediateData = " + immediateData); LOGGER.debug("maxRecvDataSegmentLength = " + settings.getMaxRecvDataSegmentLength()); } // ... and from the PDU BasicHeaderSegment bhs = pdu.getBasicHeaderSegment(); SCSICommandParser parser = (SCSICommandParser) bhs.getParser(); final int initiatorTaskTag = bhs.getInitiatorTaskTag(); // get the Read(6) or Read(10) CDB ReadCdb cdb; final ScsiOperationCode scsiOpCode = ScsiOperationCode.valueOf(parser.getCDB().get(0)); if (scsiOpCode == ScsiOperationCode.READ_10)// most likely option first cdb = new Read10Cdb(parser.getCDB()); else if (scsiOpCode == ScsiOperationCode.READ_6) cdb = new Read6Cdb(parser.getCDB()); else { // anything else wouldn't be good (programmer error) // close connection throw new InternetSCSIException("wrong SCSI Operation Code " + scsiOpCode + " in ReadStage"); } // check if requested blocks are out of bounds checkOverAndUnderflow(cdb); // check illegal field pointers if (cdb.getIllegalFieldPointers() != null) { // the command must fail LOGGER.debug("illegal field in Read CDB"); // create and send error PDU and leave stage final ProtocolDataUnit responsePdu = createFixedFormatErrorPdu(cdb.getIllegalFieldPointers(),// senseKeySpecificData initiatorTaskTag, parser.getExpectedDataTransferLength()); connection.sendPdu(responsePdu); return; } final int totalTransferLength = VIRTUAL_BLOCK_SIZE * cdb.getTransferLength(); final long storageOffset = VIRTUAL_BLOCK_SIZE * cdb.getLogicalBlockAddress(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("cdb.getLogicalBlockAddress() = " + cdb.getLogicalBlockAddress()); LOGGER.debug("blockSize = " + VIRTUAL_BLOCK_SIZE); LOGGER.debug("totalTransferLength = " + totalTransferLength); LOGGER.debug("expectedDataSegmentLength = " + parser.getExpectedDataTransferLength()); } // *** start sending *** // initialize counters and data segment buffer int bytesSent = 0; int dataSequenceNumber = 0; byte[] dataSegmentArray = null; ByteBuffer dataSegment = null; ProtocolDataUnit responsePdu; // *** send up to last but one Data-In PDU *** // (with DataSegmentSize == MaxRecvDataSegmentLength) if (bytesSent < totalTransferLength - settings.getMaxRecvDataSegmentLength()) { /* * Initialize dataSegmentArray and dataSegment with MaxRecvDataSegmentLength bytes. */ dataSegmentArray = connection.getDataInArray(settings.getMaxRecvDataSegmentLength()); dataSegment = ByteBuffer.wrap(dataSegmentArray); } while (bytesSent < totalTransferLength - settings.getMaxRecvDataSegmentLength()) { // get data and prepare data segment session.getStorageModule().read(dataSegmentArray, storageOffset + bytesSent); // create and send PDU responsePdu = TargetPduFactory.createDataInPdu(false,// finalFlag, // not the last // PDU with // data payload // in the // sequence false,// acknowledgeFlag, ErrorRecoveryLevel == 0, so we // never do that false,// residualOverflowFlag false,// residualUnderflowFlag false,// statusFlag SCSIStatus.GOOD,// status, actually reserved i.e. 0x0 0L,// logicalUnitNumber, reserved initiatorTaskTag, 0xffffffff,// targetTransferTag dataSequenceNumber,// dataSequenceNumber bytesSent,// bufferOffset 0,// residualCount dataSegment); connection.sendPdu(responsePdu); // increment counters ++dataSequenceNumber; bytesSent += settings.getMaxRecvDataSegmentLength(); } /* * If ImmediateData=Yes has been negotiated, then a phase collapse has to take place, i.e. the status is sent in * the last Data-In PDU. Otherwise a separate SCSI Response PDU must follow. */ // *** send last Data-In PDU *** // get data and prepare data segment final int bytesRemaining = totalTransferLength - bytesSent; dataSegmentArray = connection.getDataInArray(bytesRemaining); session.getStorageModule().read(dataSegmentArray, storageOffset + bytesSent); dataSegment = ByteBuffer.wrap(dataSegmentArray); // create and send PDU (with or without status) responsePdu = TargetPduFactory.createDataInPdu(true,// finalFlag, last // PDU in the // sequence with // data payload false,// acknowledgeFlag, ErrorRecoveryLevel == 0, so we never // do that false,// residualOverflowFlag false,// residualUnderflowFlag immediateData,// statusFlag SCSIStatus.GOOD,// status, or not (reserved if no status) 0L,// logicalUnitNumber, reserved initiatorTaskTag, 0xffffffff,// targetTransferTag dataSequenceNumber,// dataSequenceNumber bytesSent,// bufferOffset 0,// residualCount dataSegment); LOGGER.debug("sending last Data-In PDU"); connection.sendPdu(responsePdu); // send SCSI Response PDU? if (!immediateData) { responsePdu = TargetPduFactory.createSCSIResponsePdu(false,// bidirectionalReadResidualOverflow false,// bidirectionalReadResidualUnderflow false,// residualOverflow false,// residualUnderflow ServiceResponse.COMMAND_COMPLETED_AT_TARGET,// response SCSIStatus.GOOD,// status initiatorTaskTag,// initiatorTaskTag 0,// snackTag, reserved 0,// expectedDataSequenceNumber, reserved 0,// bidirectionalReadResidualCount 0,// residualCount ScsiResponseDataSegment.EMPTY_DATA_SEGMENT);// empty // ScsiResponseDataSegment LOGGER.debug("sending SCSI Response PDU"); connection.sendPdu(responsePdu); } } }
andrewgaul/jSCSI
bundles/target/src/main/java/org/jscsi/target/connection/stage/fullfeature/ReadStage.java
Java
bsd-3-clause
9,052
/* Copyright (C) 2005-2011 Fabio Riccardi */ /* Copyright (C) 2016 Marinna Cole */ /* Copyright (C) 2016 Masahiro Kitagawa */ package com.lightcrafts.ui.crop; import com.lightcrafts.mediax.jai.Interpolation; import com.lightcrafts.mediax.jai.RenderedOp; import com.lightcrafts.mediax.jai.operator.RotateDescriptor; import com.lightcrafts.model.CropBounds; import com.lightcrafts.platform.Platform; import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.event.MouseInputListener; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.awt.geom.*; import java.awt.geom.Ellipse2D.Double; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import java.util.LinkedList; import java.util.List; import java.lang.*; // This is a translucent white overlay in the shape of the complement of // a rectangle that can be dragged, turned, and resized with the mouse. // // It works in screen coordinates (no AffineTransform). class CropOverlay extends JComponent implements MouseInputListener, MouseWheelListener { private final static Stroke RectStroke = new BasicStroke(20f); private final static Color RectColor = new Color(0, 0, 0, 128); private final static Color GridColor = new Color(100, 100, 100, 128); private final static Color RectBorderColor = Color.white; // Basic crop cursor: private final static Cursor CropCursor; // Drag-the-crop cursors: private final static Cursor MoveCursor; private final static Cursor MovingCursor; // Rotate cursor: private final static Cursor RotateCursor; private final static Cursor RotatingCursor; // Hot point coordinates for all the cursors: private final static ResourceBundle HotPointResources = ResourceBundle.getBundle("com/lightcrafts/ui/crop/resources/HotPoints"); static { CropCursor = getCursor("crop_cursor"); MoveCursor = getCursor("move_curve"); // Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR); // getCursor("move_curve"); MovingCursor = getCursor("moving_curve"); RotateCursor = getCursor("rotate"); RotatingCursor = getCursor("rotating"); } private final static int MinDragDistance = 10; private CropBounds crop; // the crop bounds, in screen coordinates private Rectangle2D underlayRect; // underlay bounds, in screen coordinates private AspectConstraint constraint; // the aspect ratio constraint // The number of grid lines (isRotateOnly == false) // The spacing between grid lines (isRotateOnly == true) private static int GridCount = 3; private static int GridSpacing = 30; // Rotation poll position normalized with underlayRect private Point2D relativePoll; private Cursor cursor; private Point dragStart; private boolean isRotating; private double rotateAngleStart; private Point rotateMouseStart; private double rotateWidthLimit; private double rotateHeightLimit; private boolean isRotateConstrained; // never moved or adjusted private boolean isMoving; private Point2D moveCenterStart; private Point moveMouseStart; private boolean adjustingNorth; private boolean adjustingSouth; private boolean adjustingEast; private boolean adjustingWest; private boolean hasHighlight; private boolean isRotateOnly; // only allow rotations enum GridStyle { THIRD, TRIANGLE, GOLDEN, FIBONACCI, DIAGONAL} static GridStyle CropGridStyle = GridStyle.THIRD; static int GridOrientation = 0; // The members carried here are for painting different grid pattern private Point2D ul; private Point2D ur; private Point2D ll; private Point2D lr; private Point2D center; private double Width; private double Height; private double DiagonalDistance; private double RotateAngle; private double DiagonalAngle; CropOverlay(boolean isRotateOnly) { this.isRotateOnly = isRotateOnly; cursor = isRotateOnly ? RotateCursor : CropCursor; setCursor(cursor); addMouseListener(this); addMouseMotionListener(this); addMouseWheelListener(this); addRotateKeyListener(); } CropBounds getCrop() { return crop; } // Accept a CropBounds that may violate constraints, mutate it into a // constrained CropBounds, and apply it. void setCropWithConstraints(CropBounds newCrop) { newCrop = constraint.adjust(newCrop); newCrop = UnderlayConstraints.sizeToUnderlay( newCrop, underlayRect, Integer.MAX_VALUE, Integer.MAX_VALUE ); if (UnderlayConstraints.underlayContains(newCrop, underlayRect)) { setCrop(newCrop); } } void setCrop(CropBounds newCrop) { if ((newCrop == null) || newCrop.isAngleOnly()) { double angle = 0; if (newCrop != null) { angle = newCrop.getAngle(); } newCrop = new CropBounds(underlayRect, angle); } crop = newCrop; repaint(); } void setUnderlayRect(Rectangle bounds) { underlayRect = bounds; } void setAspectConstraint(AspectConstraint constraint) { this.constraint = constraint; if (crop != null) { CropBounds newCrop = constraint.adjust(crop); newCrop = UnderlayConstraints.translateToUnderlay(newCrop, underlayRect); // The crop may be null, if the constraints could not be enforced // within the bounds of the image. setCrop(newCrop); } } void modeEntered() { // At mode start, take a look at the current underlay and the current // crop, and decide whether rotate drag gestures should use the // underlay dimensions or the initial crop dimensions as the limit // for resizing during rotation. updateRotateConstraints(); } Dimension2D getRotateLimitDimensions() { return new RotateLimitDimension(rotateWidthLimit, rotateHeightLimit); } void setRotateLimitDimensions(Dimension2D limit) { rotateWidthLimit = limit.getWidth(); rotateHeightLimit = limit.getHeight(); } // See modeEntered() and mousePressed(). private void updateRotateConstraints() { isRotateConstrained = UnderlayConstraints.isRotateDefinedCrop(crop, underlayRect); rotateWidthLimit = isRotateConstrained ? underlayRect.getWidth() : crop.getWidth(); rotateHeightLimit = isRotateConstrained ? underlayRect.getHeight() : crop.getHeight(); } protected void paintComponent(Graphics graphics) { Shape shape = getCropAsShape(); if (shape != null) { Graphics2D g = (Graphics2D) graphics; Color oldColor = g.getColor(); Stroke oldStroke = g.getStroke(); RenderingHints oldHints = g.getRenderingHints(); g.setColor(RectColor); g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ); Area complement = new Area(getBounds()); complement.subtract(new Area(shape)); g.fill(complement); g.setColor(GridColor); g.setStroke(new BasicStroke(3)); paintGrid(g); Stroke borderStroke = new BasicStroke(hasHighlight ? 2f : 1f); g.setColor(RectBorderColor); g.setStroke(borderStroke); g.draw(shape); g.setStroke(oldStroke); g.setColor(oldColor); g.setRenderingHints(oldHints); } } private void paintGrid(Graphics2D g) { ul = crop.getUpperLeft(); ur = crop.getUpperRight(); ll = crop.getLowerLeft(); lr = crop.getLowerRight(); center = crop.getCenter(); if (isRotateOnly) { paintRotateGrid(g); } else { paintCropGrid(g); } } protected void changeOrientation() { GridOrientation++; GridOrientation %= 4; repaint(); } private void paintCropGrid(Graphics2D g) { Width = crop.getWidth(); Height = crop.getHeight(); DiagonalDistance = Math.sqrt(Height*Height+Width*Width); RotateAngle = crop.getAngle(); DiagonalAngle = Math.atan(Height/Width); switch (CropGridStyle) { case THIRD: paintGridThird(g); break; case TRIANGLE: paintGridTriangle(g); break; case GOLDEN: paintGridGolden(g); break; case FIBONACCI: paintGridFibonacci(g); break; case DIAGONAL: paintGridDiagonal(g); break; } } private void paintGridThird(Graphics2D g) { for (int x=1; x<GridCount; x++) { Point2D p = new Point2D.Double( (x * ul.getX() + (GridCount - x) * lr.getX()) / GridCount, (x * ul.getY() + (GridCount - x) * lr.getY()) / GridCount ); Line2D hLine = new Line2D.Double(ul, ur); hLine = getSegmentThroughPoint(hLine, p); g.draw(hLine); Line2D vLine = new Line2D.Double(ul, ll); vLine = getSegmentThroughPoint(vLine, p); g.draw(vLine); } } private void paintGridTriangle(Graphics2D g) { // Determine the shortest distance between the cornor to diagonal line // d = | (Xp-X1) * (Y2-Y1) - (Yp-Y1) * (X2-X1) | / Diagonal_Length final double d = Math.abs( (lr.getX() - ll.getX()) * (ur.getY() - ll.getY()) - (lr.getY() - ll.getY()) * (ur.getX()-ll.getX())) / DiagonalDistance; if ( (GridOrientation % 2) == 0 ) { g.draw( new Line2D.Double(ur.getX(), ur.getY(), ll.getX(), ll.getY()) ); g.draw( new Line2D.Double(lr.getX() - d * Math.sin(DiagonalAngle-RotateAngle), lr.getY() - d * Math.cos(DiagonalAngle-RotateAngle), lr.getX(), lr.getY()) ); g.draw( new Line2D.Double(ul.getX() + d * Math.sin(DiagonalAngle-RotateAngle), ul.getY() + d * Math.cos(DiagonalAngle-RotateAngle), ul.getX(), ul.getY()) ); } else { g.draw( new Line2D.Double(ul.getX(), ul.getY(), lr.getX(), lr.getY()) ); g.draw( new Line2D.Double(ur.getX() - d * Math.sin(DiagonalAngle+RotateAngle), ur.getY() + d * Math.cos(DiagonalAngle+RotateAngle), ur.getX(), ur.getY()) ); g.draw( new Line2D.Double(ll.getX() + d * Math.sin(DiagonalAngle+RotateAngle), ll.getY() - d * Math.cos(DiagonalAngle+RotateAngle), ll.getX(), ll.getY()) ); } } private void paintGridGolden(Graphics2D g) { final double GoldenUnitX = Width / 2.618; final double GoldenUnitY = Height / 2.618; Line2D hLine = new Line2D.Double(ul, ur); Line2D vLine = new Line2D.Double(ul, ll); // 0.118 the ratio of golden to center point => 0.5 - 1/2.618 = 0.118 Point2D p = new Point2D.Double( center.getX() - 0.118 * DiagonalDistance * Math.cos(DiagonalAngle+RotateAngle), center.getY() - 0.118 * DiagonalDistance * Math.sin(DiagonalAngle+RotateAngle) ); hLine = getSegmentThroughPoint(hLine, p); g.draw(hLine); vLine = getSegmentThroughPoint(vLine, p); g.draw(vLine); p = new Point2D.Double( center.getX() + 0.118 * DiagonalDistance * Math.cos(DiagonalAngle+RotateAngle), center.getY() + 0.118 * DiagonalDistance * Math.sin(DiagonalAngle+RotateAngle) ); hLine = getSegmentThroughPoint(hLine, p); g.draw(hLine); vLine = getSegmentThroughPoint(vLine, p); g.draw(vLine); } private void paintGridFibonacci(Graphics2D g) { g.rotate(RotateAngle, center.getX(), center.getY()); double angle; double arcWidth = Width / 1.618; double arcHeight = Height; switch (GridOrientation) { case 0: { angle = 180; Point2D Center = new Point2D.Double(center.getX()+0.118*Width, center.getY()+Height/2); g.drawArc( (int)( Center.getX() - arcWidth), (int)( Center.getY() - arcHeight), (int)arcWidth*2, (int)arcHeight*2, (int)angle, -90 ); for(int i=0; i<10; i++) { angle -= 90; arcWidth = arcWidth / 1.618; arcHeight = arcHeight / 1.618; Center.setLocation( Center.getX() + Math.sin( Math.toRadians( 90 - angle ) ) * arcWidth / 1.618 , Center.getY() - Math.sin( Math.toRadians( 180 - angle ) ) * arcHeight / 1.618 ); g.drawArc( (int)( Center.getX() - arcWidth), (int)( Center.getY() - arcHeight), (int)arcWidth*2, (int)arcHeight*2, (int)angle, -90 ); } } break; case 1: { angle = 180; Point2D Center = new Point2D.Double(center.getX()+0.118*Width, center.getY()-Height/2); g.drawArc( (int)( Center.getX() - arcWidth), (int)( Center.getY() - arcHeight), (int)arcWidth*2, (int)arcHeight*2, (int)angle, 90 ); for(int i=0; i<10; i++) { angle += 90; arcWidth = arcWidth / 1.618; arcHeight = arcHeight / 1.618; Center.setLocation( Center.getX() - Math.sin( Math.toRadians( -90 + angle ) ) * arcWidth / 1.618 , Center.getY() + Math.sin( Math.toRadians( -180 + angle ) ) * arcHeight / 1.618 ); g.drawArc( (int)( Center.getX() - arcWidth), (int)( Center.getY() - arcHeight), (int)arcWidth*2, (int)arcHeight*2, (int)angle, 90 ); } } break; case 2: { angle = 0; Point2D Center = new Point2D.Double(center.getX()-0.118*Width, center.getY()+Height/2); g.drawArc( (int)( Center.getX() - arcWidth), (int)( Center.getY() - arcHeight), (int)arcWidth*2, (int)arcHeight*2, (int)angle, 90 ); for(int i=0; i<10; i++) { angle += 90; arcWidth = arcWidth / 1.618; arcHeight = arcHeight / 1.618; Center.setLocation( Center.getX() + Math.sin( Math.toRadians( 90 + angle ) ) * arcWidth / 1.618 , Center.getY() - Math.sin( Math.toRadians( 0 + angle ) ) * arcHeight / 1.618 ); g.drawArc( (int)( Center.getX() - arcWidth), (int)( Center.getY() - arcHeight), (int)arcWidth*2, (int)arcHeight*2, (int)angle, 90 ); } } break; case 3: { angle = 0; Point2D Center = new Point2D.Double(center.getX()-0.118*Width, center.getY()-Height/2); g.drawArc( (int)( Center.getX() - arcWidth), (int)( Center.getY() - arcHeight), (int)arcWidth*2, (int)arcHeight*2, (int)angle, -90 ); for(int i=0; i<10; i++) { angle -= 90; arcWidth = arcWidth / 1.618; arcHeight = arcHeight / 1.618; Center.setLocation( Center.getX() + Math.sin( Math.toRadians( 90 - angle ) ) * arcWidth / 1.618 , Center.getY() + Math.sin( Math.toRadians( 0 - angle ) ) * arcHeight / 1.618 ); g.drawArc( (int)( Center.getX() - arcWidth), (int)( Center.getY() - arcHeight), (int)arcWidth*2, (int)arcHeight*2, (int)angle, -90 ); } } break; } g.rotate(-1*RotateAngle, center.getX(), center.getY()); } private void paintGridDiagonal(Graphics2D g) { boolean ShorterSide = (Width > Height ) ? true : false; if (ShorterSide) { g.draw( new Line2D.Double(ul.getX(), ul.getY(), ll.getX()+Height*Math.cos(-1*RotateAngle), ll.getY()-Height*Math.sin(-1*RotateAngle)) ); g.draw( new Line2D.Double(ur.getX(), ur.getY(), lr.getX()-Height*Math.cos(-1*RotateAngle), lr.getY()+Height*Math.sin(-1*RotateAngle)) ); g.draw( new Line2D.Double(ll.getX(), ll.getY(), ul.getX()+Height*Math.cos(-1*RotateAngle), ul.getY()-Height*Math.sin(-1*RotateAngle)) ); g.draw( new Line2D.Double(lr.getX(), lr.getY(), ur.getX()-Height*Math.cos(-1*RotateAngle), ur.getY()+Height*Math.sin(-1*RotateAngle)) ); } else { g.draw( new Line2D.Double(ul.getX(), ul.getY(), ur.getX()+Width*Math.sin(-1*RotateAngle), ur.getY()+Width*Math.cos(-1*RotateAngle)) ); g.draw( new Line2D.Double(ur.getX(), ur.getY(), ul.getX()+Width*Math.sin(-1*RotateAngle), ul.getY()+Width*Math.cos(-1*RotateAngle)) ); g.draw( new Line2D.Double(ll.getX(), ll.getY(), lr.getX()-Width*Math.sin(-1*RotateAngle), lr.getY()-Width*Math.cos(-1*RotateAngle)) ); g.draw( new Line2D.Double(lr.getX(), lr.getY(), ll.getX()-Width*Math.sin(-1*RotateAngle), ll.getY()-Width*Math.cos(-1*RotateAngle)) ); } } private void paintRotateGrid(Graphics2D g) { Point2D midLeft = getMidPoint(ul, ll); Point2D midTop = getMidPoint(ul, ur); Point2D midRight = getMidPoint(ur, lr); Point2D midBottom = getMidPoint(ll, lr); Line2D hMidLine = new Line2D.Double(midLeft, midRight); Line2D vMidLine = new Line2D.Double(midTop, midBottom); Point2D poll = updatePoll(); Line2D hPollLine = getSegmentThroughPoint(hMidLine, poll); Line2D vPollLine = getSegmentThroughPoint(vMidLine, poll); Point2D hMidPoint = getMidPoint(hPollLine.getP1(), hPollLine.getP2()); Point2D vMidPoint = getMidPoint(vPollLine.getP1(), vPollLine.getP2()); List<Point2D> upPts = getPointsBetween(hMidPoint, midTop, GridSpacing); List<Point2D> downPts = getPointsBetween(hMidPoint, midBottom, GridSpacing); List<Point2D> rightPts = getPointsBetween(vMidPoint, midRight, GridSpacing); List<Point2D> leftPts = getPointsBetween(vMidPoint, midLeft, GridSpacing); if (isInRect(poll)) { g.draw(hPollLine); g.draw(vPollLine); final double r = GridSpacing / 3; g.draw(new Ellipse2D.Double(poll.getX() - r, poll.getY() - r, 2 * r, 2 * r)); } paintLines(g, hMidLine, upPts); paintLines(g, hMidLine, downPts); paintLines(g, vMidLine, rightPts); paintLines(g, vMidLine, leftPts); } private void paintLines(Graphics2D g, Line2D refLine, List<Point2D> Pts) { //boolean isFirstLine = true; for (Point2D p : Pts) { if (! isInRect(p)) continue; /* // When painting all these lines, we take care not to paint the center // lines twice, which would make them appear darker than the other // lines because of the compositing. if (isFirstLine) { isFirstLine = false; continue; } */ Line2D line = getSegmentThroughPoint(refLine, p); g.draw(line); } } public void mouseClicked(MouseEvent e) { Point p = e.getPoint(); if (isInRect(p)) { if (isRotateOnly) { setPoll(p); return; } // Cycle through different overlays when the crop hasn't been rotated. Does it make sense to expand this for the rotated case? switch (CropGridStyle) { case THIRD: CropGridStyle = GridStyle.TRIANGLE; break; case TRIANGLE: CropGridStyle = GridStyle.GOLDEN; break; case GOLDEN: CropGridStyle = GridStyle.FIBONACCI; break; case FIBONACCI: CropGridStyle = GridStyle.DIAGONAL; break; case DIAGONAL: CropGridStyle = GridStyle.THIRD; break; } } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { return; } Point p = e.getPoint(); if (isRotateOnly) { if (crop == null) { setCrop(new CropBounds(underlayRect)); } isRotating = true; rotateAngleStart = crop.getAngle(); rotateMouseStart = p; } else { if (isOnRect(p)) { if (isOnNorth(p)) { adjustingNorth = true; } if (isOnSouth(p)) { adjustingSouth = true; } if (isOnEast(p)) { adjustingEast = true; } if (isOnWest(p)) { adjustingWest = true; } updateRotateConstraints(); } else if (isInRect(p)) { if (hasRotateModifier(e)) { isRotating = true; rotateAngleStart = crop.getAngle(); rotateMouseStart = p; } else { isMoving = true; moveMouseStart = p; moveCenterStart = crop.getCenter(); } updateRotateConstraints(); } else if (crop != null && (! crop.isAngleOnly())) { isRotating = true; rotateAngleStart = crop.getAngle(); rotateMouseStart = p; } else { if (hasRotateModifier(e)) { setCrop(new CropBounds(underlayRect)); isRotating = true; rotateAngleStart = crop.getAngle(); rotateMouseStart = p; } else { if (! underlayRect.contains(p)) { // Use the closest point inside the underlay instead. Point2D closest = getClosestUnderlayPoint(p); p = new Point( (int) Math.round(closest.getX()), (int) Math.round(closest.getY()) ); } dragStart = p; } } } updateCursor(e); } public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { return; } isMoving = false; isRotating = false; dragStart = null; rotateMouseStart = null; moveMouseStart = null; moveCenterStart = null; adjustingNorth = false; adjustingSouth = false; adjustingEast = false; adjustingWest = false; updateCursor(e); repaint(); } public void mouseDragged(MouseEvent e) { updateHighlight(e); Point p = e.getPoint(); // Backup the current crop, so we can back out changes if it turns // out they exceed the underlay constraint. CropBounds oldCrop = crop; if ((dragStart != null) && ((Math.abs(dragStart.x - p.x) < MinDragDistance) || (Math.abs(dragStart.y - p.y) < MinDragDistance))) { return; } if (dragStart != null) { if (! underlayRect.contains(p)) { return; } double x = Math.min(p.x, dragStart.x); double y = Math.min(p.y, dragStart.y); double w = Math.abs(p.x - dragStart.x); double h = Math.abs(p.y - dragStart.y); Rectangle2D rect = new Rectangle2D.Double(x, y, w, h); CropBounds newCrop = new CropBounds(rect); setCrop(newCrop); if (isOnNorth(p)) { adjustingNorth = true; } else { adjustingSouth = true; } if (isOnWest(p)) { adjustingWest = true; } else { adjustingEast = true; } dragStart = null; } else if (isMoving) { int dx = p.x - moveMouseStart.x; int dy = p.y - moveMouseStart.y; Point2D.Double center = new Point2D.Double( moveCenterStart.getX() + dx, moveCenterStart.getY() + dy ); double width = crop.getWidth(); double height = crop.getHeight(); double angle = crop.getAngle(); CropBounds newCrop = new CropBounds(center, width, height, angle); newCrop = UnderlayConstraints.translateToUnderlay(newCrop, underlayRect); if (newCrop != null) { setCrop(newCrop); } } else if (isRotating) { Point2D poll = updatePoll(); Line2D start = new Line2D.Double(poll, rotateMouseStart); Line2D end = new Line2D.Double(poll, p); double startAngle = Math.atan2( start.getY2() - start.getY1(), start.getX2() - start.getX1() ); double endAngle = Math.atan2( end.getY2() - end.getY1(), end.getX2() - end.getX1() ); double angle = rotateAngleStart + endAngle - startAngle; CropBounds newCrop = new CropBounds(crop, angle); updateRotateConstraints(); newCrop = UnderlayConstraints.sizeToUnderlay( newCrop, underlayRect, rotateWidthLimit, rotateHeightLimit ); if (newCrop != null) { setCrop(newCrop); } return; } else if ((crop != null) && (! crop.isAngleOnly())) { // This MouseEvent is a regular mid-drag event. // If an edge is adjusting, then preserve the opposite edge. if (isEdgeAdjusting()) { if (adjustingNorth) { setNorth(p); crop = constraint.adjustWidth(crop); if (constraint.isNoConstraint()) { crop = UnderlayConstraints.adjustNorthToUnderlay(crop, underlayRect); } else { crop = UnderlayConstraints.adjustNorthWithConstraint(crop, underlayRect); } } else if (adjustingSouth) { setSouth(p); crop = constraint.adjustWidth(crop); if (constraint.isNoConstraint()) { crop = UnderlayConstraints.adjustSouthToUnderlay(crop, underlayRect); } else { crop = UnderlayConstraints.adjustSouthWithConstraint(crop, underlayRect); } } if (adjustingEast) { setEast(p); crop = constraint.adjustHeight(crop); if (constraint.isNoConstraint()) { crop = UnderlayConstraints.adjustEastToUnderlay(crop, underlayRect); } else { crop = UnderlayConstraints.adjustEastWithConstraint(crop, underlayRect); } } else if (adjustingWest) { setWest(p); crop = constraint.adjustHeight(crop); if (constraint.isNoConstraint()) { crop = UnderlayConstraints.adjustWestToUnderlay(crop, underlayRect); } else { crop = UnderlayConstraints.adjustWestWithConstraint(crop, underlayRect); } } if (! UnderlayConstraints.underlayContains(crop, underlayRect)) { setCrop(oldCrop); } updateRotateConstraints(); } // If a corner is adjusting, then preserve the opposite corner. else if (isCornerAdjusting()) { p = projectOntoUnderlay(p); Point2D center = crop.getCenter(); Point2D ul = crop.getUpperLeft(); Point2D ur = crop.getUpperRight(); Point2D ll = crop.getLowerLeft(); Point2D lr = crop.getLowerRight(); if (adjustingSouth) { setSouth(p); if (adjustingWest) { setWest(p); Line2D diag = new Line2D.Double(center, ll); if (diag.relativeCCW(p) > 0) { crop = constraint.adjustBottom(crop); } else { crop = constraint.adjustLeft(crop); } crop = UnderlayConstraints.adjustSouthWestToUnderlay( crop, underlayRect ); } else { setEast(p); Line2D diag = new Line2D.Double(center, lr); if (diag.relativeCCW(p) > 0) { crop = constraint.adjustBottom(crop); } else { crop = constraint.adjustRight(crop); } crop = UnderlayConstraints.adjustSouthEastToUnderlay( crop, underlayRect ); } } else { setNorth(p); if (adjustingEast) { setEast(p); Line2D diag = new Line2D.Double(center, ur); if (diag.relativeCCW(p) > 0) { crop = constraint.adjustTop(crop); } else { crop = constraint.adjustRight(crop); } crop = UnderlayConstraints.adjustNorthEastToUnderlay( crop, underlayRect ); } else { setWest(p); Line2D diag = new Line2D.Double(center, ul); if (diag.relativeCCW(p) > 0) { crop = constraint.adjustTop(crop); } else { crop = constraint.adjustLeft(crop); } crop = UnderlayConstraints.adjustNorthWestToUnderlay( crop, underlayRect ); } updateRotateConstraints(); } } } if (! UnderlayConstraints.underlayContains(crop, underlayRect)) { setCrop(oldCrop); } } private Point projectOntoUnderlay(Point p) { Point q = (Point) p.clone(); Rectangle under = underlayRect.getBounds(); final int outcode = underlayRect.outcode( p ); if ( (outcode & Rectangle2D.OUT_TOP) != 0 ) { q = new Point(q.x, under.y); } if ( (outcode & Rectangle2D.OUT_LEFT) != 0 ) { q = new Point(under.x, q.y); } if ( (outcode & Rectangle2D.OUT_BOTTOM) != 0 ) { q = new Point(q.x, under.y + under.height); } if ( (outcode & Rectangle2D.OUT_RIGHT) != 0 ) { q = new Point(under.x + under.width, q.y); } return q; } public void mouseMoved(MouseEvent e) { updateCursor(e); updateHighlight(e); } public void mouseWheelMoved(MouseWheelEvent e) { int count = e.getWheelRotation(); rotateAngleStart = crop.getAngle(); double deg = rotateAngleStart * 180 / Math.PI; deg = Math.round(100 * deg) * 0.01d; final double STEPS_PER_DEG = 50; double angle = Math.round(STEPS_PER_DEG * deg + count) / STEPS_PER_DEG * Math.PI / 180; CropBounds newCrop = new CropBounds(crop, angle); updateRotateConstraints(); newCrop = UnderlayConstraints.sizeToUnderlay( newCrop, underlayRect, rotateWidthLimit, rotateHeightLimit ); if (newCrop != null) setCrop(newCrop); } private boolean isEdgeAdjusting() { return ( (adjustingNorth && ! (adjustingEast || adjustingWest)) || (adjustingSouth && ! (adjustingEast || adjustingWest)) || (adjustingEast && ! (adjustingNorth || adjustingSouth)) || (adjustingWest && ! (adjustingNorth || adjustingSouth)) ); } private boolean isCornerAdjusting() { return ( (adjustingNorth && (adjustingEast || adjustingWest)) || (adjustingSouth && (adjustingEast || adjustingWest)) || (adjustingEast && (adjustingNorth || adjustingSouth)) || (adjustingWest && (adjustingNorth || adjustingSouth)) ); } private void updateCursor(MouseEvent e) { Cursor newCursor = getCursor(e); if (cursor != newCursor) { cursor = newCursor; setCursor(cursor); } } private void updateHighlight(MouseEvent e) { Point p = e.getPoint(); boolean hadHighlight = hasHighlight; hasHighlight = isAdjusting() || isInRect(p) || isOnRect(p); if (hadHighlight != hasHighlight) { repaint(); } } private Cursor getCursor(MouseEvent e) { if ((crop == null) || crop.isAngleOnly()) { if (hasRotateModifier(e) || isRotateOnly) { return RotateCursor; } else { return CropCursor; } } Point p = e.getPoint(); if (! isRotateOnly) { double angle = crop.getAngle(); if (isOnNorth(p)) { if (isOnEast(p)) { return getResizeCursor(- Math.PI / 4 + angle); } if (isOnWest(p)) { return getResizeCursor(- 3 * Math.PI / 4 + angle); } return getResizeCursor(- Math.PI / 2 + angle); } if (isOnSouth(p)) { if (isOnEast(p)) { return getResizeCursor(+ Math.PI / 4 + angle); } if (isOnWest(p)) { return getResizeCursor(+ 3 * Math.PI / 4 + angle); } return getResizeCursor(+ Math.PI / 2 + angle); } if (isOnEast(p)) { return getResizeCursor(+ angle); } if (isOnWest(p)) { return getResizeCursor(+ Math.PI + angle); } if (isInRect(p)) { if (isRotating) { return RotatingCursor; } else if (isMoving) { return MovingCursor; } else if ( hasRotateModifier(e) ) { return RotateCursor; } else { return MoveCursor; } } } if ((crop != null) || isRotateOnly) { if (isRotating) { return RotatingCursor; } else { return RotateCursor; } } return CropCursor; } boolean isAdjusting() { return adjustingNorth || adjustingSouth || adjustingEast || adjustingWest || isRotating || isMoving; } boolean isInRect(Point2D p) { Shape shape = getCropAsShape(); return (shape != null) && shape.contains(p); } boolean isOnRect(Point p) { Shape shape = getCropAsShape(); if (shape == null) { return false; } Shape thickRect = createThickShape(shape); return thickRect.contains(p); } private void setNorth(Point p) { Line2D north = getNorthLine(); north = getSegmentThroughPoint(north, p); Point2D center = crop.getCenter(); if (north.relativeCCW(center) != -1) { return; } Point2D ul = north.getP1(); Point2D ur = north.getP2(); Point2D ll = crop.getLowerLeft(); Point2D lr = crop.getLowerRight(); CropBounds newCrop = new CropBounds(ul, ur, ll, lr); setCrop(newCrop); } private void setSouth(Point p) { Line2D south = getSouthLine(); south = getSegmentThroughPoint(south, p); Point2D center = crop.getCenter(); if (south.relativeCCW(center) != -1) { return; } Point2D ul = crop.getUpperLeft(); Point2D ur = crop.getUpperRight(); Point2D ll = south.getP2(); Point2D lr = south.getP1(); CropBounds newCrop = new CropBounds(ul, ur, ll, lr); setCrop(newCrop); } private void setEast(Point p) { Line2D east = getEastLine(); east = getSegmentThroughPoint(east, p); Point2D center = crop.getCenter(); if (east.relativeCCW(center) != -1) { return; } Point2D ul = crop.getUpperLeft(); Point2D ur = east.getP1(); Point2D ll = crop.getLowerLeft(); Point2D lr = east.getP2(); CropBounds newCrop = new CropBounds(ul, ur, ll, lr); setCrop(newCrop); } private void setWest(Point p) { Line2D west = getWestLine(); west = getSegmentThroughPoint(west, p); Point2D center = crop.getCenter(); if (west.relativeCCW(center) != -1) { return; } Point2D ul = west.getP2(); Point2D ur = crop.getUpperRight(); Point2D ll = west.getP1(); Point2D lr = crop.getLowerRight(); CropBounds newCrop = new CropBounds(ul, ur, ll, lr); setCrop(newCrop); } private Line2D getNorthLine() { return new Line2D.Double(crop.getUpperLeft(), crop.getUpperRight()); } private Line2D getEastLine() { return new Line2D.Double(crop.getUpperRight(), crop.getLowerRight()); } private Line2D getSouthLine() { return new Line2D.Double(crop.getLowerRight(), crop.getLowerLeft()); } private Line2D getWestLine() { return new Line2D.Double(crop.getLowerLeft(), crop.getUpperLeft()); } private boolean isOnNorth(Point p) { if (crop == null) { return false; } return createThickShape(getNorthLine()).contains(p); } private boolean isOnSouth(Point p) { if (crop == null) { return false; } return createThickShape(getSouthLine()).contains(p); } private boolean isOnEast(Point p) { if (crop == null) { return false; } return createThickShape(getEastLine()).contains(p); } private boolean isOnWest(Point p) { if (crop == null) { return false; } return createThickShape(getWestLine()).contains(p); } private Point2D getClosestUnderlayPoint(Point2D p) { if (underlayRect.contains(p)) { return p; } if (p.getX() < underlayRect.getMinX()) { p = new Point2D.Double(underlayRect.getMinX(), p.getY()); } if (p.getY() < underlayRect.getMinY()) { p = new Point2D.Double(p.getX(), underlayRect.getMinY()); } if (p.getX() > underlayRect.getMaxX()) { p = new Point2D.Double(underlayRect.getMaxX(), p.getY()); } if (p.getY() > underlayRect.getMaxY()) { p = new Point2D.Double(p.getX(), underlayRect.getMaxY()); } return p; } // // Repaint this overlay when the CropBounds udpates, marking dirty as // // little of the component as possible to minimize thrash painting of // // the underlay. // private void repaint(CropBounds oldCrop, CropBounds newCrop) { // Shape oldShape = getCropAsShape(oldCrop); // Shape newShape = getCropAsShape(newCrop); // if ((oldShape == null) || (newShape == null)) { // repaint(); // return; // } // Rectangle oldRect = oldShape.getBounds(); // Rectangle newRect = newShape.getBounds(); // if (! newRect.intersects(oldRect)) { // repaint(oldRect); // repaint(newRect); // return; // } // Area xor = new Area(oldShape); // xor.exclusiveOr(new Area(newShape)); // // Set<Shape> shapes = getConnectedComponents(xor); // for (Shape shape : shapes) { // Rectangle rect = shape.getBounds(); // repaint(rect); // } // } // Compute a line segment parallel to the given segment and translated so // that the line constructed from the new segment by extrapolation passes // through the given point. private static Line2D getSegmentThroughPoint(Line2D seg, Point2D p) { Point2D p1 = seg.getP1(); Point2D p2 = seg.getP2(); double angle = Math.atan2(p2.getY() - p1.getY(), p2.getX() - p1.getX()); angle += Math.PI / 2; double distance = seg.ptLineDist(p); int ccw = seg.relativeCCW(p); distance *= - ccw; double dx = distance * Math.cos(angle); double dy = distance * Math.sin(angle); p1 = new Point2D.Double(p1.getX() + dx, p1.getY() + dy); p2 = new Point2D.Double(p2.getX() + dx, p2.getY() + dy); return new Line2D.Double(p1, p2); } private static Point2D getMidPoint(Point2D p, Point2D q) { return new Point2D.Double( (p.getX() + q.getX()) / 2, (p.getY() + q.getY()) / 2 ); } private static List<Point2D> getPointsBetween( Point2D start, Point2D end, double spacing ) { double angle = Math.atan2( end.getY() - start.getY(), end.getX() - start.getX() ); double dist = start.distance(end); int nPts = (int) Math.floor(dist / spacing); LinkedList<Point2D> points = new LinkedList<Point2D>(); Point2D p = start; for (int n=0; n<=nPts; n++) { points.add(p); p = new Point2D.Double( p.getX() + spacing * Math.cos(angle), p.getY() + spacing * Math.sin(angle) ); } return points; } private Shape getCropAsShape() { if ((crop == null) || crop.isAngleOnly()) { return null; } Point2D ul = crop.getUpperLeft(); Point2D ur = crop.getUpperRight(); Point2D ll = crop.getLowerLeft(); Point2D lr = crop.getLowerRight(); GeneralPath path = new GeneralPath(); path.moveTo((float) ul.getX(), (float) ul.getY()); path.lineTo((float) ur.getX(), (float) ur.getY()); path.lineTo((float) lr.getX(), (float) lr.getY()); path.lineTo((float) ll.getX(), (float) ll.getY()); path.closePath(); return path; } private static Shape createThickShape(Shape shape) { return RectStroke.createStrokedShape(shape); } // // Return a Set of Shapes, comprising the connected components of // // a given Shape. Used for the optimized repaint() method. // private static Set<Shape> getConnectedComponents(Shape shape) { // PathIterator i = shape.getPathIterator(new AffineTransform()); // HashSet<Shape> components = new HashSet<Shape>(); // if (i.isDone()) { // return components; // } // float[] pts = new float[6]; // GeneralPath component = new GeneralPath(); // int type = i.currentSegment(pts); // assert type == PathIterator.SEG_MOVETO; // component.moveTo(pts[0], pts[1]); // i.next(); // while (! i.isDone()) { // type = i.currentSegment(pts); // if (type == PathIterator.SEG_MOVETO) { // components.add(component); // component = new GeneralPath(); // component.moveTo(pts[0], pts[1]); // } // else if (type == PathIterator.SEG_LINETO) { // component.lineTo(pts[0], pts[1]); // } // else if (type == PathIterator.SEG_QUADTO) { // component.quadTo(pts[0], pts[1], pts[2], pts[3]); // } // else if (type == PathIterator.SEG_CUBICTO) { // component.curveTo( // pts[0], pts[1], pts[2], pts[3], pts[4], pts[5] // ); // } // else if (type == PathIterator.SEG_CLOSE) { // component.closePath(); // } // i.next(); // } // components.add(component); // // return components; // } // Access one of the predefined cursors from resources. private static Cursor getCursor(String name) { try { String path = "resources/" + name + ".png"; URL url = CropOverlay.class.getResource(path); BufferedImage image = ImageIO.read(url); int x = Integer.parseInt(HotPointResources.getString(name + "X")); int y = Integer.parseInt(HotPointResources.getString(name + "Y")); Point hot = new Point(x, y); Toolkit toolkit = Toolkit.getDefaultToolkit(); Cursor cursor = toolkit.createCustomCursor(image, hot, name); return cursor; } catch (IOException e) { e.printStackTrace(); return null; } } private static double RecentCursorAngle; private static Cursor RecentCursor; // Custom-render a new resize cursor that looks right for resizing an edge // at the given angle. private static Cursor getResizeCursor(double angle) { // Don't thrash the cursor rendering: if the requested angle matches // the most recent angle within roundoff, then send back the recent // cursor. if (Platform.getType() == Platform.Windows) { int cursorType = Cursor.DEFAULT_CURSOR; double a = Math.PI/4; if (Math.abs(angle) < a) cursorType = Cursor.E_RESIZE_CURSOR; if (Math.abs(angle - Math.PI/4) < a) cursorType = Cursor.SE_RESIZE_CURSOR; if (Math.abs(angle - Math.PI/2) < a) cursorType = Cursor.S_RESIZE_CURSOR; if (Math.abs(angle - 3 * Math.PI/4) < a) cursorType = Cursor.SW_RESIZE_CURSOR; if (Math.abs(angle - Math.PI) < a) cursorType = Cursor.W_RESIZE_CURSOR; if (Math.abs(angle + 3 * Math.PI/4) < a) cursorType = Cursor.NW_RESIZE_CURSOR; if (Math.abs(angle + Math.PI/2) < a) cursorType = Cursor.N_RESIZE_CURSOR; if (Math.abs(angle + Math.PI/4) < a) cursorType = Cursor.NE_RESIZE_CURSOR; return Cursor.getPredefinedCursor(cursorType); } double diff = Math.abs(angle - RecentCursorAngle); if ((diff < 0.001) && (RecentCursor != null)) { return RecentCursor; } try { String path = "resources/resize.png"; URL url = CropOverlay.class.getResource(path); RenderedImage resourceImage = ImageIO.read(url); int cx = resourceImage.getWidth() / 2; int cy = resourceImage.getHeight() / 2; RenderedOp rotatedImage = RotateDescriptor.create( resourceImage, (float) cx, (float) cy, (float) angle, Interpolation.getInstance(Interpolation.INTERP_BICUBIC), null, null ); Point hot = new Point(cx, cy); Toolkit toolkit = Toolkit.getDefaultToolkit(); BufferedImage buffer = rotatedImage.getAsBufferedImage(); Cursor cursor = toolkit.createCustomCursor(buffer, hot, "resize"); RecentCursorAngle = angle; RecentCursor = cursor; return cursor; } catch (IOException e) { e.printStackTrace(); return null; } } private static boolean hasRotateModifier(MouseEvent event) { Platform.Type type = Platform.getType(); switch (type) { case MacOSX: return event.isMetaDown(); default: return event.isControlDown(); } } private void addRotateKeyListener() { KeyboardFocusManager focus = KeyboardFocusManager.getCurrentKeyboardFocusManager(); focus.addKeyEventPostProcessor(rotateKeyProcessor); } public void dispose() { KeyboardFocusManager focus = KeyboardFocusManager.getCurrentKeyboardFocusManager(); focus.removeKeyEventPostProcessor(rotateKeyProcessor); } // Listen for keystrokes so we can detect when the user presses and // releases the modifier key that allows rotation from inside the crop // bounds, so we can update the cursor. private KeyEventPostProcessor rotateKeyProcessor = new KeyEventPostProcessor() { int RotateKeyCode = Platform.getType().equals( Platform.Type.MacOSX ) ? KeyEvent.VK_META : KeyEvent.VK_CONTROL; int RotateModifierMask = Platform.getType().equals( Platform.Type.MacOSX ) ? MouseEvent.META_DOWN_MASK : MouseEvent.CTRL_DOWN_MASK; public boolean postProcessKeyEvent(KeyEvent e) { if (e.getKeyCode() == RotateKeyCode) { boolean isPressed = e.getID() == KeyEvent.KEY_PRESSED; boolean isReleased = e.getID() == KeyEvent.KEY_RELEASED; if (isPressed || isReleased) { PointerInfo pointer = MouseInfo.getPointerInfo(); Point p = pointer.getLocation(); SwingUtilities.convertPointFromScreen( p, CropOverlay.this ); MouseEvent syntheticEvent = new MouseEvent( CropOverlay.this, 0, 0, isPressed ? RotateModifierMask : 0, p.x, p.y, 0, false ); updateCursor(syntheticEvent); } } return false; // these key events have other interpretations } }; private Point2D updatePoll() { if (relativePoll == null) { Point2D p = crop.getCenter(); setPoll(p); return p; } return new Point2D.Double( relativePoll.getX() * underlayRect.getWidth() + underlayRect.getX(), relativePoll.getY() * underlayRect.getHeight() + underlayRect.getY()); } private void setPoll(Point2D p) { if (p == null) { p = crop.getCenter(); } relativePoll = new Point2D.Double( (p.getX() - underlayRect.getX()) / underlayRect.getWidth(), (p.getY() - underlayRect.getY()) / underlayRect.getHeight()); } }
MarinnaCole/LightZone
lightcrafts/src/com/lightcrafts/ui/crop/CropOverlay.java
Java
bsd-3-clause
53,474
/*L * Copyright Duke Comprehensive Cancer Center * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/catrip/LICENSE.txt for details. */ package gov.nih.nci.ctom.domain; import java.sql.Date; /** * @version 1.0 * @created 20-Jun-2006 8:25:13 AM */ public class StudyTimePoint { private int courseNumber; private Date courseStartDate; private Date courseStopDate; /** * Values include: Baseline, Screening, Run-in, Treatment, Follow-Up, etc. * * NOTE: When pre-study or medical history information is collected -- the epoch * would be "Pre-Study"; relevant attributes in Activity, Observation and * Assessment will be defaulted accordingly. */ private String epochName; private int id; private String visitName; //private Activity activity; public StudyTimePoint(){ } public int getCourseNumber() { return courseNumber; } public void setCourseNumber(int courseNumber) { this.courseNumber = courseNumber; } public Date getCourseStartDate() { return courseStartDate; } public void setCourseStartDate(Date courseStartDate) { this.courseStartDate = courseStartDate; } public Date getCourseStopDate() { return courseStopDate; } public void setCourseStopDate(Date courseStopDate) { this.courseStopDate = courseStopDate; } public String getEpochName() { return epochName; } public void setEpochName(String epochName) { this.epochName = epochName; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getVisitName() { return visitName; } public void setVisitName(String visitName) { this.visitName = visitName; } }
NCIP/catrip
codebase/projects/ctom/src/gov/nih/nci/ctom/domain/StudyTimePoint.java
Java
bsd-3-clause
1,684
package edu.wpi.rail.jrosbridge.messages.std; import javax.json.Json; import javax.json.JsonObject; import edu.wpi.rail.jrosbridge.messages.Message; /** * The std_msgs/Int32 message. * * @author Russell Toris -- [email protected] * @version April 1, 2014 */ public class Int32 extends Message { /** * The name of the data field for the message. */ public static final java.lang.String FIELD_DATA = "data"; /** * The message type. */ public static final java.lang.String TYPE = "std_msgs/Int32"; private final int data; /** * Create a new Int32 with a default of 0. */ public Int32() { this(0); } /** * Create a new Int32 with the given data value. * * @param data * The data value of the int. */ public Int32(int data) { // build the JSON object super(Json.createObjectBuilder().add(Int32.FIELD_DATA, data).build(), Int32.TYPE); this.data = data; } /** * Get the data value of this int. * * @return The data value of this int. */ public int getData() { return this.data; } /** * Create a clone of this Int32. */ @Override public Int32 clone() { return new Int32(this.data); } /** * Create a new Int32 based on the given JSON string. Any missing values * will be set to their defaults. * * @param jsonString * The JSON string to parse. * @return A Int32 message based on the given JSON string. */ public static Int32 fromJsonString(java.lang.String jsonString) { // convert to a message return Int32.fromMessage(new Message(jsonString)); } /** * Create a new Int32 based on the given Message. Any missing values will be * set to their defaults. * * @param m * The Message to parse. * @return A Int32 message based on the given Message. */ public static Int32 fromMessage(Message m) { // get it from the JSON object return Int32.fromJsonObject(m.toJsonObject()); } /** * Create a new Int32 based on the given JSON object. Any missing values * will be set to their defaults. * * @param jsonObject * The JSON object to parse. * @return A Int32 message based on the given JSON object. */ public static Int32 fromJsonObject(JsonObject jsonObject) { // check the fields int data = jsonObject.containsKey(Int32.FIELD_DATA) ? jsonObject .getInt(Int32.FIELD_DATA) : 0; return new Int32(data); } }
kbendick/jrosbridge
src/main/java/edu/wpi/rail/jrosbridge/messages/std/Int32.java
Java
bsd-3-clause
2,390
package org.cagrid.gaards.websso.authentication; import gov.nih.nci.cagrid.opensaml.SAMLAssertion; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.cagrid.gaards.websso.authentication.helper.AuthenticationServiceHelper; import org.cagrid.gaards.websso.authentication.helper.DorianHelper; import org.cagrid.gaards.websso.authentication.helper.GridCredentialDelegator; import org.cagrid.gaards.websso.authentication.helper.ProxyValidator; import org.cagrid.gaards.websso.authentication.helper.SAMLToAttributeMapper; import org.cagrid.gaards.websso.beans.DelegatedApplicationInformation; import org.cagrid.gaards.websso.beans.DorianInformation; import org.cagrid.gaards.websso.beans.WebSSOServerInformation; import org.cagrid.gaards.websso.exception.AuthenticationConfigurationException; import org.cagrid.gaards.websso.utils.WebSSOConstants; import org.cagrid.gaards.websso.utils.WebSSOProperties; import org.globus.gsi.GlobusCredential; import org.globus.gsi.GlobusCredentialException; import org.jasig.cas.authentication.Authentication; import org.jasig.cas.authentication.AuthenticationManager; import org.jasig.cas.authentication.MutableAuthentication; import org.jasig.cas.authentication.handler.AuthenticationException; import org.jasig.cas.authentication.principal.Credentials; import org.jasig.cas.authentication.principal.Principal; import org.jasig.cas.authentication.principal.SimplePrincipal; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.Assert; @Service public class CaGridAuthenticationManager implements AuthenticationManager { private final Log log = LogFactory.getLog(getClass()); private WebSSOProperties webSSOProperties = null; private AuthenticationServiceHelper authenticationServiceHelper; private DorianHelper dorianHelper = null; private ProxyValidator proxyValidator=null; private SAMLToAttributeMapper samlToAttributeMapper=null; private GridCredentialDelegator gridCredentialDelegator=null; private List<String> hostIdentities = null; public CaGridAuthenticationManager() { } @Autowired public CaGridAuthenticationManager( AuthenticationServiceHelper authenticationServiceHelper, DorianHelper dorianHelper, GridCredentialDelegator gridCredentialDelegator, ProxyValidator proxyValidator, SAMLToAttributeMapper samlToAttributeMapper, WebSSOProperties webSSOProperties) { super(); this.authenticationServiceHelper = authenticationServiceHelper; this.dorianHelper = dorianHelper; this.gridCredentialDelegator = gridCredentialDelegator; this.proxyValidator = proxyValidator; this.samlToAttributeMapper = samlToAttributeMapper; this.webSSOProperties = webSSOProperties; } /** * Authenticate the user credentials and retrieve samlAssertion for authentication Service * Obtain the GlobusCredential for the Authenticated User from Dorian * Validate the Proxy or GlobusCredential * Delegate the Globus Credentials * Adding the serialized Delegated Credentials Reference and Grid Identity to the attributes map * Create the Principal from the grid identity * Create a new Authentication Object using the Principal */ @SuppressWarnings("unchecked") public Authentication authenticate(Credentials credentials) throws AuthenticationException { if (null == webSSOProperties) { throw new AuthenticationConfigurationException( "Error Initializing Authentication Manager properties"); } UsernamePasswordAuthenticationServiceURLCredentials userNameCredentials=(UsernamePasswordAuthenticationServiceURLCredentials)credentials; SAMLAssertion samlAssertion = authenticationServiceHelper.authenticate( userNameCredentials.getAuthenticationServiceURL(),userNameCredentials.getCredential()); DorianInformation dorianInformation = this.getDorianInformation(userNameCredentials.getDorianName()); GlobusCredential globusCredential = dorianHelper.obtainProxy(samlAssertion, dorianInformation); proxyValidator.validate(globusCredential); String serializedDelegatedCredentialReference = gridCredentialDelegator .delegateGridCredential(globusCredential, this.getHostIdentities()); Map<String, Object> attributesMap = (Map<String, Object>)samlToAttributeMapper.convertSAMLtoHashMap(samlAssertion); attributesMap.put(WebSSOConstants.CAGRID_SSO_DELEGATION_SERVICE_EPR, serializedDelegatedCredentialReference); attributesMap.put(WebSSOConstants.CAGRID_SSO_GRID_IDENTITY, globusCredential.getIdentity()); String principal = this.constructPrincipal(attributesMap); Principal p = new SimplePrincipal(principal,attributesMap); MutableAuthentication mutableAuthentication = new MutableAuthentication(p); return mutableAuthentication; } private DorianInformation getDorianInformation( String dorianName) throws AuthenticationConfigurationException { Assert.notNull(dorianName,"dorian service Name cannot be empty"); List<DorianInformation> dorians = webSSOProperties.getDoriansInformation(); DorianInformation dorianInformation = null; for (DorianInformation tempDorianInformation : dorians) { if (dorianName.equals(tempDorianInformation.getDisplayName())) { dorianInformation = tempDorianInformation; break; } } if(dorianName==null){ throw new AuthenticationConfigurationException("no matching dorian name "+dorianName+" found in websso-properties.xml"); } return dorianInformation; } private List<String> getHostIdentities() throws AuthenticationConfigurationException { if (null == hostIdentities) { List<DelegatedApplicationInformation> delegatedApplicationInformationList = webSSOProperties .getDelegatedApplicationInformationList(); if (delegatedApplicationInformationList.size() == 0) throw new AuthenticationConfigurationException("None Host Identities configured for Delegation "); hostIdentities = new ArrayList<String>(); for (DelegatedApplicationInformation delegatedApplicationInformation : delegatedApplicationInformationList){ hostIdentities.add(delegatedApplicationInformation.getHostIdentity()); } hostIdentities = addWebSSOServerHostIdentity(hostIdentities, webSSOProperties.getWebSSOServerInformation()); } return hostIdentities; } private String constructPrincipal(Map<String, Object> attributeMap) { String principalName = new String(); Set<String> keySet = attributeMap.keySet(); for (String key : keySet) { String value = (String)attributeMap.get(key); principalName = principalName.concat(key + WebSSOConstants.KEY_VALUE_PAIR_DELIMITER + value + WebSSOConstants.ATTRIBUTE_DELIMITER); } principalName = principalName.substring(0, principalName.lastIndexOf(WebSSOConstants.ATTRIBUTE_DELIMITER)); return principalName; } private List<String> addWebSSOServerHostIdentity( List<String> hostIdentities, WebSSOServerInformation webSSOServerInformation) throws AuthenticationConfigurationException { try { GlobusCredential globusCredential = new GlobusCredential( webSSOServerInformation .getHostCredentialCertificateFilePath(), webSSOServerInformation.getHostCredentialKeyFilePath()); hostIdentities.add(globusCredential.getIdentity()); } catch (GlobusCredentialException e) { log.error(e); throw new AuthenticationConfigurationException( "Unable to create the WebSSO Host Credentials using the configuration provided: " + e.getMessage(), e); } return hostIdentities; } }
NCIP/cagrid
cagrid/Software/core/caGrid/projects/websso/src/java/org/cagrid/gaards/websso/authentication/CaGridAuthenticationManager.java
Java
bsd-3-clause
7,642
package com.github.dandelion.gua.core.tracker.send; import com.github.dandelion.gua.core.field.ContentInformationField; public class PageviewSection extends SendSubSection<PageviewSection> { PageviewSection(SendSection parent) { super(parent); } public PageviewSection overrideLocation(String location) { set(ContentInformationField.location, location); return this; } public PageviewSection overridePage(String page) { set(ContentInformationField.page, page); return this; } public PageviewSection overrideTitle(String title) { set(ContentInformationField.title, title); return this; } }
dandelion/dandelion-gua
gua-core/src/main/java/com/github/dandelion/gua/core/tracker/send/PageviewSection.java
Java
bsd-3-clause
682
package org.jbehave.core.steps; import java.util.List; import java.util.Map; import org.jbehave.core.annotations.*; import org.jbehave.core.model.Lifecycle; import org.jbehave.core.model.Meta; import org.jbehave.core.model.Scenario; import org.jbehave.core.model.Story; /** * Represents the strategy for the collection of executable {@link Step}s from a * story or scenario matching a list of {@link CandidateSteps}. It also collects the * steps to run at before/after stages. */ public interface StepCollector { enum Stage { BEFORE, AFTER } /** * Collects all of the {@link BeforeStories} or {@link AfterStories} steps to execute. * * @param candidateSteps * @param stage the {@link Stage} of execution * @return A List of executable {@link Step}s */ List<Step> collectBeforeOrAfterStoriesSteps(List<CandidateSteps> candidateSteps, Stage stage); /** * Collects all of the {@link BeforeStory} or {@link AfterStory} steps to execute. * * @param candidateSteps the {@link CandidateSteps}. * @param story the {@link Story}. * @param stage the {@link Stage} of execution * @param givenStory whether {@link Story} is a given story * @return A List of executable {@link Step}s */ List<Step> collectBeforeOrAfterStorySteps(List<CandidateSteps> candidateSteps, Story story, Stage stage, boolean givenStory); /** * Collects all of the {@link BeforeScenario} or {@link AfterScenario} steps to execute. * * * @param candidateSteps the {@link CandidateSteps}. * @param storyAndScenarioMeta the story and scenario {@link Meta} parameters * @param type the ScenarioType * @return A List of executable {@link Step}s */ List<Step> collectBeforeOrAfterScenarioSteps(List<CandidateSteps> candidateSteps, Meta storyAndScenarioMeta, Stage stage, ScenarioType type); /** * Collects all lifecycle steps to execute for default scope * * @param candidateSteps the {@link CandidateSteps}. * @param lifecycle the {@link Lifecycle} * @param storyAndScenarioMeta the story and scenario {@link Meta} parameters * @param stage the {@link Stage} of execution * @return A List of executable {@link Step}s */ List<Step> collectLifecycleSteps(List<CandidateSteps> candidateSteps, Lifecycle lifecycle, Meta storyAndScenarioMeta, Stage stage); /** * Collects all lifecycle steps to execute * * @param candidateSteps the {@link CandidateSteps}. * @param lifecycle the {@link Lifecycle} * @param storyAndScenarioMeta the story and scenario {@link Meta} parameters * @param stage the {@link Stage} of execution * @param scope the {@link Scope} of the lifecycle steps * @return A List of executable {@link Step}s */ List<Step> collectLifecycleSteps(List<CandidateSteps> candidateSteps, Lifecycle lifecycle, Meta storyAndScenarioMeta, Stage stage, Scope scope); /** * Collects all of the {@link Step}s to execute for a scenario. * * @param candidateSteps the {@link CandidateSteps}. * @param scenario the {@link Scenario}. * @param parameters the parameters. * @return A List of executable {@link Step}s */ List<Step> collectScenarioSteps(List<CandidateSteps> candidateSteps, Scenario scenario, Map<String, String> parameters); /** * Collects all of the {@link Step}s to execute for a scenario. * * @param candidateSteps the {@link CandidateSteps}. * @param scenario the {@link Scenario}. * @param parameters the parameters. * @param stepMonitor the {@link StepMonitor}. * @return A List of executable {@link Step}s */ List<Step> collectScenarioSteps(List<CandidateSteps> candidateSteps, Scenario scenario, Map<String, String> parameters, StepMonitor stepMonitor); }
gmandnepr/jbehave-core
jbehave-core/src/main/java/org/jbehave/core/steps/StepCollector.java
Java
bsd-3-clause
3,897
/*L * Copyright HealthCare IT, Inc. * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/edct-analytics/LICENSE.txt for details. */ package com.healthcit.analytics.servlet; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import com.google.visualization.datasource.Capabilities; import com.google.visualization.datasource.DataSourceServlet; import com.google.visualization.datasource.base.DataSourceException; import com.google.visualization.datasource.datatable.DataTable; import com.google.visualization.datasource.query.Query; import com.healthcit.analytics.businessdelegates.DataTableManager; import com.healthcit.analytics.utils.CAHopeDataSourceUtils; import com.healthcit.analytics.utils.Constants; /** * This servlet is a Google Visualization API-compatible datasource * which integrates with CouchDB and, hence, * may be used to feed CouchDB data to Google Visualizations * in the caHope Analytics application. * * (For more information on the Google Visualization Java API, see: * http://code.google.com/apis/visualization/documentation/dev/dsl_get_started.html) * * To access CouchDB data from the caHope Analytics application, * an HTTP GET request is issued for this servlet * with request parameters * that are compatible with the Google Visualizations API. * * For example, the following URI * returns a DataTable with the age, ethnicity, cancertype, drinking status and smoking status * of the first 100 patients in the database: * * /<servlet_context>?tq=select patientid,age,ethnicity,cancertype,drinkstatus,smokestatus&start=1&end=100 * * In addition, there are custom request parameters that have been added: * -viewName: the CouchDB view used as the datasource (optional; defaults to GetDocByOwnerAndForm) * -document: whether or not the CouchDB resultset consists of CouchDB documents (or customized objects emitted by the view) * -orderedColumnNames: a list of columnNames. Required when a SELECT query is provided. * (This might seem redundant, as the column names are already specified in the query * either via the standard "tq" parameter or by setting the query in the javascript. * However, it appears that the order of columns in the request is not preserved in the query object; * they appear to be stored in a collection that does not preserve order. * Adding this parameter helps to resolve this problem.) * -the STANDARD CouchDB request parameters, such as key, include_docs, group, group_level, startkey, endkey, etc... * * For example, the following Javascript code will return a DataTable with columns formname,question and answer * and CouchDB key=["760b0db5-39e8-4921-bec2-6e98bc6af587","d5fff3c4-dd06-34c1-9bec-0ca8b55d291e"]: * * var query = new google.visualization.Query('http://localhost:8080/<application context>/caHopeDS?key=["760b0db5-39e8-4921-bec2-6e98bc6af587","d5fff3c4-dd06-34c1-9bec-0ca8b55d291e"]&document=true&orderedColumnNames=formname,question,answer'); * query.setQuery('select formName,question,answer'); * query.send(handleQueryResponse); * * @author Oawofolu * */ public class CAHopeDataSourceServlet extends DataSourceServlet { private static final Logger log = Logger.getLogger( CAHopeDataSourceServlet.class ); private static final long serialVersionUID = -9185119323890025699L; /** * Generates the dataTable. */ @Override public DataTable generateDataTable(Query query, HttpServletRequest request) throws DataSourceException { log.debug( "In CAHopeDataSourceServlet" ); // validate the query CAHopeDataSourceUtils.validateQuery( query, request ); // determine whether or not the resultSet from CouchDB consists of documents // (if not, then the resultSet consists of a custom set of objects emitted by the CouchDB view) boolean emitsDocuments = StringUtils.equalsIgnoreCase( request.getParameter(Constants.DOCUMENT ), "true" ); // get a mapping of columns to data types (and other metadata, as needed) List<Map<String, Object>> columnDataArray = CAHopeDataSourceUtils.getColumnData( request ); // return the datatable DataTable table = DataTableManager.getDataTable(query, request, columnDataArray, emitsDocuments); return table; } /** * Specifies the capabilities supported by this datasource. */ @Override public Capabilities getCapabilities() { return Capabilities.SELECT; } /** * When isRestrictedAccessMode returns true, access to this webservice * is limited to requests from the same domain. * (This is a security measure which prevents cross domain scripting attacks.) * However, we set this to false for testing purposes. */ @Override protected boolean isRestrictedAccessMode() { return false; } }
NCIP/edct-analytics
src/main/java/com/healthcit/analytics/servlet/CAHopeDataSourceServlet.java
Java
bsd-3-clause
5,022
/* Copyright (c) 2000-2004 jMock.org */ package test.jmock.core; public class DummyThrowable extends Throwable { private static final long serialVersionUID = 1L; public DummyThrowable() { super(); } public DummyThrowable( String message ) { super(message); } }
al3xandru/testng-jmock
core/src/test/jmock/core/DummyThrowable.java
Java
bsd-3-clause
303
/******************************************************************************* * Caleydo - Visualization for Molecular Biology - http://caleydo.org * Copyright (c) The Caleydo Team. All rights reserved. * Licensed under the new BSD license, available at http://caleydo.org/license *******************************************************************************/ package demo.handler; import generic.GenericView; import generic.ImportSpec; import generic.ImportWizard; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; /** * @author Samuel Gratzl * */ public class ShowWizardHandler extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { ImportSpec spec = new ImportWizard().call(); showView(spec, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()); return null; } public static void showView(ImportSpec spec, IWorkbenchPage page) { if (spec == null) return; GenericView.lastSpec = spec; try { page.showView("lineup.demo.generic", System.currentTimeMillis() + "", IWorkbenchPage.VIEW_ACTIVATE); } catch (PartInitException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Caleydo/org.caleydo.vis.lineup.demos
src/main/java/demo/handler/ShowWizardHandler.java
Java
bsd-3-clause
1,422
/* Copyright (c) 2013 OpenPlans. All rights reserved. * This code is licensed under the BSD New License, available at the root * application directory. */ package org.geogit.remote; import java.io.File; import java.io.FileNotFoundException; import java.net.URISyntaxException; import java.net.URL; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Stack; import org.geogit.api.CommitBuilder; import org.geogit.api.IniRepositoryFilter; import org.geogit.api.ObjectId; import org.geogit.api.Ref; import org.geogit.api.RepositoryFilter; import org.geogit.api.RevCommit; import org.geogit.api.RevObject; import org.geogit.api.RevObject.TYPE; import org.geogit.api.RevTree; import org.geogit.api.plumbing.FindCommonAncestor; import org.geogit.api.plumbing.ResolveGeogitDir; import org.geogit.api.plumbing.ResolveTreeish; import org.geogit.api.plumbing.WriteTree; import org.geogit.api.plumbing.diff.DiffEntry; import org.geogit.api.porcelain.ConfigOp; import org.geogit.api.porcelain.ConfigOp.ConfigAction; import org.geogit.api.porcelain.SynchronizationException; import org.geogit.api.porcelain.SynchronizationException.StatusCode; import org.geogit.repository.Repository; import org.geogit.storage.GraphDatabase; import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.base.Suppliers; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; /** * Abstract base implementation for mapped (sparse) clone. */ public abstract class AbstractMappedRemoteRepo implements IRemoteRepo { public static String PLACEHOLDER_COMMIT_MESSAGE = "Placeholder Sparse Commit"; protected Repository localRepository; protected RepositoryFilter filter; /** * Constructs a new {@code AbstractMappedRemoteRepo} with the provided reference repository. * * @param localRepository the local repository. */ public AbstractMappedRemoteRepo(Repository localRepository) { this.localRepository = localRepository; Optional<Map<String, String>> filterResult = localRepository.command(ConfigOp.class) .setAction(ConfigAction.CONFIG_GET).setName("sparse.filter").call(); Preconditions.checkState(filterResult.isPresent(), "No filter found for sparse clone."); String filterFile = filterResult.get().get("sparse.filter"); Preconditions.checkState(filterFile != null, "No filter found for sparse clone."); try { URL envHome = localRepository.command(ResolveGeogitDir.class).call(); if (envHome == null) { throw new IllegalStateException("Not inside a geogit directory"); } if (!"file".equals(envHome.getProtocol())) { throw new UnsupportedOperationException( "Sparse clone works only against file system repositories. " + "Repository location: " + envHome.toExternalForm()); } File repoDir; try { repoDir = new File(envHome.toURI()); } catch (URISyntaxException e) { throw Throwables.propagate(e); } File newFilterFile = new File(repoDir, filterFile); filter = new IniRepositoryFilter(newFilterFile.getAbsolutePath()); } catch (FileNotFoundException e) { Throwables.propagate(e); } } /** * CommitTraverser for gathering all of the commits that I need to fetch. */ protected class FetchCommitGatherer extends CommitTraverser { RepositoryWrapper source; Repository destination; public FetchCommitGatherer(RepositoryWrapper source, Repository destination) { this.source = source; this.destination = destination; } @Override protected Evaluation evaluate(CommitNode commitNode) { if (destination.getGraphDatabase().exists(commitNode.getObjectId())) { return Evaluation.EXCLUDE_AND_PRUNE; } return Evaluation.INCLUDE_AND_CONTINUE; } @Override protected ImmutableList<ObjectId> getParentsInternal(ObjectId commitId) { return source.getParents(commitId); } @Override protected boolean existsInDestination(ObjectId commitId) { return destination.getGraphDatabase().exists(commitId); } }; /** * CommitTraverser for gathering all of the commits that I need to push. */ protected class PushCommitGatherer extends CommitTraverser { Repository source; public PushCommitGatherer(Repository source) { this.source = source; } @Override protected Evaluation evaluate(CommitNode commitNode) { if (!source.getGraphDatabase().getMapping(commitNode.getObjectId()) .equals(ObjectId.NULL)) { return Evaluation.EXCLUDE_AND_PRUNE; } return Evaluation.INCLUDE_AND_CONTINUE; } @Override protected ImmutableList<ObjectId> getParentsInternal(ObjectId commitId) { return source.getGraphDatabase().getParents(commitId); } @Override protected boolean existsInDestination(ObjectId commitId) { // If the commit has not been mapped, it hasn't been pushed to the remote yet return !source.getGraphDatabase().getMapping(commitId).equals(ObjectId.NULL); } }; /** * @return the {@link RepositoryWrapper} for this remote */ protected abstract RepositoryWrapper getRemoteWrapper(); /** * Fetch all new objects from the specified {@link Ref} from the remote. * * @param ref the remote ref that points to new commit data * @param fetchLimit the maximum depth to fetch, note, a sparse clone cannot be a shallow clone */ public void fetchNewData(Ref ref, Optional<Integer> fetchLimit) { Preconditions.checkState(!fetchLimit.isPresent(), "A sparse clone cannot be shallow."); FetchCommitGatherer gatherer = new FetchCommitGatherer(getRemoteWrapper(), localRepository); try { gatherer.traverse(ref.getObjectId()); Stack<ObjectId> needed = gatherer.commits; while (!needed.empty()) { ObjectId commitId = needed.pop(); // If the last commit is empty, add it anyways to preserve parentage of new commits. boolean allowEmpty = needed.isEmpty(); fetchSparseCommit(commitId, allowEmpty); } } catch (Exception e) { Throwables.propagate(e); } finally { } } /** * This function takes all of the changes introduced by the specified commit and filters them * based on the repository filter. It then uses the filtered results to construct a new commit * that is the descendant of commits that the original's parents are mapped to. * * @param commitId the commit id of the original, non-sparse commit * @param allowEmpty allow the function to create an empty sparse commit */ protected void fetchSparseCommit(ObjectId commitId, boolean allowEmpty) { Optional<RevObject> object = getObject(commitId); if (object.isPresent() && object.get().getType().equals(TYPE.COMMIT)) { RevCommit commit = (RevCommit) object.get(); FilteredDiffIterator changes = getFilteredChanges(commit); localRepository.getGraphDatabase().put(commit.getId(), commit.getParentIds()); RevTree rootTree = RevTree.EMPTY; if (commit.getParentIds().size() > 0) { // Map this commit to the last "sparse" commit in my ancestry ObjectId mappedCommit = localRepository.getGraphDatabase().getMapping( commit.getParentIds().get(0)); localRepository.getGraphDatabase().map(commit.getId(), mappedCommit); Optional<ObjectId> treeId = localRepository.command(ResolveTreeish.class) .setTreeish(mappedCommit).call(); if (treeId.isPresent() && !treeId.get().equals(ObjectId.NULL)) { rootTree = localRepository.getTree(treeId.get()); } } else { localRepository.getGraphDatabase().map(commit.getId(), ObjectId.NULL); } if (changes.hasNext()) { // Create new commit ObjectId newTreeId = localRepository.command(WriteTree.class) .setOldRoot(Suppliers.ofInstance(rootTree)) .setDiffSupplier(Suppliers.ofInstance((Iterator<DiffEntry>) changes)) .call(); CommitBuilder builder = new CommitBuilder(commit); List<ObjectId> newParents = new LinkedList<ObjectId>(); for (ObjectId parentCommitId : commit.getParentIds()) { newParents.add(localRepository.getGraphDatabase().getMapping(parentCommitId)); } builder.setParentIds(newParents); builder.setTreeId(newTreeId); RevCommit mapped = builder.build(); localRepository.getObjectDatabase().put(mapped); if (changes.wasFiltered()) { localRepository.getGraphDatabase().setProperty(mapped.getId(), GraphDatabase.SPARSE_FLAG, "true"); } localRepository.getGraphDatabase().map(mapped.getId(), commit.getId()); // Replace the old mapping with the new commit Id. localRepository.getGraphDatabase().map(commit.getId(), mapped.getId()); } else if (allowEmpty) { CommitBuilder builder = new CommitBuilder(commit); List<ObjectId> newParents = new LinkedList<ObjectId>(); for (ObjectId parentCommitId : commit.getParentIds()) { newParents.add(localRepository.getGraphDatabase().getMapping(parentCommitId)); } builder.setParentIds(newParents); builder.setTreeId(rootTree.getId()); builder.setMessage(PLACEHOLDER_COMMIT_MESSAGE); RevCommit mapped = builder.build(); localRepository.getObjectDatabase().put(mapped); localRepository.getGraphDatabase().setProperty(mapped.getId(), GraphDatabase.SPARSE_FLAG, "true"); localRepository.getGraphDatabase().map(mapped.getId(), commit.getId()); // Replace the old mapping with the new commit Id. localRepository.getGraphDatabase().map(commit.getId(), mapped.getId()); } else { // Mark the mapped commit as sparse, since it wont have these changes localRepository.getGraphDatabase().setProperty( localRepository.getGraphDatabase().getMapping(commit.getId()), GraphDatabase.SPARSE_FLAG, "true"); } } } /** * Retrieves an object with the specified id from the remote. * * @param objectId the object to get * @return the fetched object */ protected abstract Optional<RevObject> getObject(ObjectId objectId); /** * Gets all of the changes from the target commit that should be applied to the sparse clone. * * @param commit the commit to get changes from * @return an iterator for changes that match the repository filter */ protected abstract FilteredDiffIterator getFilteredChanges(RevCommit commit); /** * Push all new objects from the specified {@link Ref} to the remote. * * @param ref the local ref that points to new commit data */ @Override public void pushNewData(Ref ref) throws SynchronizationException { pushNewData(ref, ref.getName()); } /** * Push all new objects from the specified {@link Ref} to the given refspec. * * @param ref the local ref that points to new commit data * @param refspec the refspec to push to */ @Override public void pushNewData(Ref ref, String refspec) throws SynchronizationException { Optional<Ref> remoteRef = getRemoteRef(refspec); checkPush(ref, remoteRef); beginPush(); PushCommitGatherer gatherer = new PushCommitGatherer(localRepository); try { gatherer.traverse(ref.getObjectId()); Stack<ObjectId> needed = gatherer.commits; while (!needed.isEmpty()) { ObjectId commitToPush = needed.pop(); pushSparseCommit(commitToPush); } ObjectId newCommitId = localRepository.getGraphDatabase().getMapping(ref.getObjectId()); ObjectId originalRemoteRefValue = ObjectId.NULL; if (remoteRef.isPresent()) { originalRemoteRefValue = remoteRef.get().getObjectId(); } endPush(refspec, newCommitId, originalRemoteRefValue.toString()); } catch (Exception e) { Throwables.propagate(e); } finally { } } /** * Gets the remote ref that matches the provided ref spec. * * @param refspec the refspec to parse * @return the matching {@link Ref} or {@link Optional#absent()} if the ref could not be found */ protected abstract Optional<Ref> getRemoteRef(String refspec); /** * Perform pre-push actions. */ protected void beginPush() { // do nothing } /** * Perform post-push actions, this includes verification that the remote wasn't changed while we * were pushing. * * @param refspec the refspec that we are pushing to * @param newCommitId the new commit id * @param originalRefValue the original value of the ref before pushing */ protected void endPush(String refspec, ObjectId newCommitId, String originalRefValue) { updateRemoteRef(refspec, newCommitId, false); } /** * Updates the remote ref that matches the given refspec. * * @param refspec the ref to update * @param commitId the new value of the ref * @param delete if true, the remote ref will be deleted * @return the updated ref */ protected abstract Ref updateRemoteRef(String refspec, ObjectId commitId, boolean delete); /** * Pushes a sparse commit to a remote repository and updates all mappings. * * @param commitId the commit to push */ protected abstract void pushSparseCommit(ObjectId commitId); /** * Determine if it is safe to push to the remote repository. * * @param ref the ref to push * @param remoteRef the ref to push to * @throws SynchronizationException */ protected void checkPush(Ref ref, Optional<Ref> remoteRef) throws SynchronizationException { if (remoteRef.isPresent()) { ObjectId mappedId = localRepository.getGraphDatabase().getMapping( remoteRef.get().getObjectId()); if (mappedId.equals(ref.getObjectId())) { // The branches are equal, no need to push. throw new SynchronizationException(StatusCode.NOTHING_TO_PUSH); } else if (localRepository.blobExists(mappedId)) { RevCommit leftCommit = localRepository.getCommit(mappedId); RevCommit rightCommit = localRepository.getCommit(ref.getObjectId()); Optional<RevCommit> ancestor = localRepository.command(FindCommonAncestor.class) .setLeft(leftCommit).setRight(rightCommit).call(); if (!ancestor.isPresent()) { // There is no common ancestor, a push will overwrite history throw new SynchronizationException(StatusCode.REMOTE_HAS_CHANGES); } else if (ancestor.get().getId().equals(ref.getObjectId())) { // My last commit is the common ancestor, the remote already has my data. throw new SynchronizationException(StatusCode.NOTHING_TO_PUSH); } else if (!ancestor.get().getId().equals(mappedId)) { // The remote branch's latest commit is not my ancestor, a push will cause a // loss of history. throw new SynchronizationException(StatusCode.REMOTE_HAS_CHANGES); } } else { // The remote has data that I do not, a push will cause this data to be lost. throw new SynchronizationException(StatusCode.REMOTE_HAS_CHANGES); } } } }
state-hiu/GeoGit
src/core/src/main/java/org/geogit/remote/AbstractMappedRemoteRepo.java
Java
bsd-3-clause
16,956
package org.datagr4m.viewer.mouse; import java.awt.Point; import java.awt.geom.Point2D; import org.datagr4m.viewer.IDisplay; import org.datagr4m.viewer.IView; import org.datagr4m.viewer.renderer.IRenderer; public class DefaultMouseViewController extends AbstractMouseViewController{ public DefaultMouseViewController(IDisplay display, IView view) { super(display, view); } @Override public boolean onLeftClick(IRenderer renderer, Point2D screen, Point2D layout) { return false; } @Override public boolean onMouseDragged(Point before, Point now) { return false; } @Override public boolean onMouseRelease() { return false; } @Override public boolean onMouseMoved(IRenderer renderer, Point2D mousePoint) { return false; } @Override public void onKeyPressed(char c, int code){ } @Override public boolean onDoubleClick(IRenderer renderer, Point2D screen, Point2D layout) { return false; } @Override public boolean onRightClick(IRenderer renderer, Point2D screen, Point2D layout) { return false; } @Override public boolean onPopupQueryClick(IRenderer renderer, Point2D screen, Point2D layout) { return false; } }
datagr4m/org.datagr4m
datagr4m-viewer/src/main/java/org/datagr4m/viewer/mouse/DefaultMouseViewController.java
Java
bsd-3-clause
1,308
/*L * Copyright Ekagra Software Technologies Ltd. * Copyright SAIC, SAIC-Frederick * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/cacore-sdk/LICENSE.txt for details. */ package test.xsd; import gov.nih.nci.cacoresdk.domain.other.primarykey.IntegerPrimitiveKey; import org.jdom.Document; public class IntegerPrimitiveKeyXSDTest extends SDKXSDTestBase { private Document doc = null; public static String getTestCaseName() { return "IntegerPrimitiveKey XSD Test Case"; } protected void setUp() throws Exception { super.setUp(); String schemaFileName = "gov.nih.nci.cacoresdk.domain.other.primarykey.xsd"; doc = getDocument( schemaFileName); } public Document getDoc() { return doc; } /** * Uses xpath to query XSD * Verifies that common XSD elements are present * * @throws Exception */ public void testCommonSchemaElements() throws Exception { validateCommonSchemaElements(); } /** * Verifies that the 'element' and 'complexType' elements * corresponding to the Class are present in the XSD * Verifies that the Class attributes are present in the XSD * * @throws Exception */ public void testClassElement1() throws Exception { Class targetClass = IntegerPrimitiveKey.class; validateClassElements(targetClass); validateAttributeElement(targetClass, "id", "integer"); validateAttributeElement(targetClass, "name", "string"); } }
NCIP/cacore-sdk
sdk-toolkit/iso-example-project/junit/src/test/xsd/IntegerPrimitiveKeyXSDTest.java
Java
bsd-3-clause
1,528
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.techhounds.commands.auton; import com.techhounds.OI; import com.techhounds.commands.auton.options.DoNothing; import com.techhounds.commands.auton.options.MoveIntoZone; import com.techhounds.commands.auton.options.OneBallAutonCheezy; import com.techhounds.commands.auton.options.TwoBallAuton; import edu.wpi.first.wpilibj.command.Command; import edu.wpi.first.wpilibj.command.CommandGroup; import edu.wpi.first.wpilibj.command.WaitCommand; /** * * @author Atif Niyaz */ public class AutonChooser extends CommandGroup { public static final String [] AUTON_CHOICES = new String [] {"2 Ball Auton", "1 Ball Auton Cheezy", "Only Move Into Zone", "Do Nothing"}; public static Command getSelected() { Command [] choices = new Command [] { new TwoBallAuton(), new OneBallAutonCheezy(), new MoveIntoZone(), new DoNothing() }; return choices[OI.getInstance().getAutonChoice()]; } }
frc868/2014-robot-iri
src/com/techhounds/commands/auton/AutonChooser.java
Java
bsd-3-clause
1,221
/* Copyright (c) 2013 OpenPlans. All rights reserved. * This code is licensed under the BSD New License, available at the root * application directory. */ package org.geogit.api.plumbing; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; import javax.annotation.Nullable; import org.geogit.api.AbstractGeoGitOp; import org.geogit.api.Node; import org.geogit.api.NodeRef; import org.geogit.api.ObjectId; import org.geogit.api.Ref; import org.geogit.api.RevObject.TYPE; import org.geogit.api.RevTree; import org.geogit.api.RevTreeBuilder; import org.geogit.api.plumbing.LsTreeOp.Strategy; import org.geogit.api.plumbing.diff.DiffEntry; import org.geogit.api.plumbing.diff.MutableTree; import org.geogit.api.plumbing.diff.TreeDifference; import org.geogit.api.porcelain.CommitOp; import org.geogit.storage.ObjectDatabase; import org.geogit.storage.StagingDatabase; import org.opengis.util.ProgressListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.google.inject.Inject; /** * Creates a new root tree in the {@link ObjectDatabase object database} from the current index, * based on the current {@code HEAD} and returns the new root tree id. * <p> * <b>Note</b> this is a performance improvement replacement for {@link WriteTree} but so far is * only used by {@link CommitOp}, as it doesn't have a proper replacement for * {@link WriteTree#setDiffSupplier(Supplier)} yet, as used by the remote, REST, and WEB APIs. * <p> * This command creates a tree object using the current index. The id of the new root tree object is * returned. No {@link Ref ref} is updated as a result of this operation, so the resulting root tree * is "orphan". It's up to the calling code to update any needed reference. * * The index must be in a fully merged state. * * Conceptually, write-tree sync()s the current index contents into a set of tree objects on the * {@link ObjectDatabase}. In order to have that match what is actually in your directory right now, * you need to have done a {@link UpdateIndex} phase before you did the write-tree. * * @see TreeDifference * @see MutableTree * @see DeepMove */ public class WriteTree2 extends AbstractGeoGitOp<ObjectId> { private static final Logger LOGGER = LoggerFactory.getLogger(WriteTree2.class); private ObjectDatabase repositoryDatabase; private Supplier<RevTree> oldRoot; private final List<String> pathFilters = Lists.newLinkedList(); // to be used when implementing a replacement for the current WriteTree2.setDiffSupplier() // private Supplier<Iterator<DiffEntry>> diffSupplier = null; /** * Creates a new {@code WriteTree} operation using the specified parameters. * * @param repositoryDatabase the object database to use */ @Inject public WriteTree2(ObjectDatabase repositoryDatabase) { this.repositoryDatabase = repositoryDatabase; } /** * @param oldRoot a supplier for the old root tree * @return {@code this} */ public WriteTree2 setOldRoot(Supplier<RevTree> oldRoot) { this.oldRoot = oldRoot; return this; } /** * * @param pathFilter the pathfilter to pass on to the index * @return {@code this} */ public WriteTree2 addPathFilter(String pathFilter) { if (pathFilter != null) { this.pathFilters.add(pathFilter); } return this; } public WriteTree2 setPathFilter(@Nullable List<String> pathFilters) { this.pathFilters.clear(); if (pathFilters != null) { this.pathFilters.addAll(pathFilters); } return this; } /** * Executes the write tree operation. * * @return the new root tree id, the current HEAD tree id if there are no differences between * the index and the HEAD, or {@code null} if the operation has been cancelled (as * indicated by the {@link #getProgressListener() progress listener}. */ @Override public ObjectId call() { final ProgressListener progress = getProgressListener(); TreeDifference treeDifference = computeTreeDifference(); if (treeDifference.areEqual()) { MutableTree leftTree = treeDifference.getLeftTree(); Node leftNode = leftTree.getNode(); ObjectId leftOid = leftNode.getObjectId(); return leftOid; } final MutableTree oldLeftTree = treeDifference.getLeftTree().clone(); Preconditions.checkState(oldLeftTree.equals(treeDifference.getLeftTree())); // handle renames before new and deleted trees for the computation of new and deleted to be // accurate Set<String> ignoreList = Sets.newHashSet(); handleRenames(treeDifference, ignoreList); handlePureMetadataChanges(treeDifference, ignoreList); handleNewTrees(treeDifference, ignoreList); handleDeletedTrees(treeDifference, ignoreList); handleRemainingDifferences(treeDifference, ignoreList); progress.complete(); MutableTree newLeftTree = treeDifference.getLeftTree(); final RevTree newRoot = newLeftTree.build(getIndex().getDatabase(), repositoryDatabase); ObjectId newRootId = newRoot.getId(); return newRootId; } private void handlePureMetadataChanges(TreeDifference treeDifference, Set<String> ignoreList) { Map<NodeRef, NodeRef> pureMetadataChanges = treeDifference.findPureMetadataChanges(); for (Map.Entry<NodeRef, NodeRef> e : pureMetadataChanges.entrySet()) { NodeRef newValue = e.getValue(); String treePath = newValue.path(); if (ignoreList.contains(treePath)) { continue; } ignoreList.add(treePath); if (!filterMatchesOrIsParent(treePath)) { continue;// filter doesn't apply to the changed tree } deepMove(newValue.getMetadataId()); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.setChild(newValue.getParentPath(), newValue.getNode()); } } private void handleDeletedTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> deletes = treeDifference.findDeletes(); for (NodeRef ref : deletes) { String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!filterMatchesOrIsParent(path)) { if (filterApplies(path, treeDifference.getRightTree())) { // can't optimize RevTree newTree = applyChanges(ref, null); Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId()); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { MutableTree leftTree = treeDifference.getLeftTree(); leftTree.removeChild(path); } } } private void handleNewTrees(TreeDifference treeDifference, Set<String> ignoreList) { SortedSet<NodeRef> newTrees = treeDifference.findNewTrees(); for (NodeRef ref : newTrees) { final String path = ref.path(); if (ignoreList.contains(path)) { continue; } ignoreList.add(path); if (!filterMatchesOrIsParent(path)) { MutableTree rightTree = treeDifference.getRightTree(); if (filterApplies(path, rightTree)) { // can't optimize RevTree newTree = applyChanges(null, ref); Node newNode = Node.tree(ref.name(), newTree.getId(), ref.getMetadataId()); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.forceChild(ref.getParentPath(), newNode); } } else { LOGGER.trace("Creating new tree {}", path); deepMove(ref.getNode()); MutableTree leftTree = treeDifference.getLeftTree(); String parentPath = ref.getParentPath(); Node node = ref.getNode(); leftTree.setChild(parentPath, node); } } } /** * A renamed tree is recognized by checking if a tree on the right points to the same object * that a tree on the left that doesn't exist anymore on the right. * <p> * Left entries are the original ones, and right entries are the new ones. * </p> * * @param treeDifference * @param ignoreList */ private void handleRenames(TreeDifference treeDifference, Set<String> ignoreList) { final SortedMap<NodeRef, NodeRef> renames = treeDifference.findRenames(); for (Map.Entry<NodeRef, NodeRef> e : renames.entrySet()) { NodeRef oldValue = e.getKey(); NodeRef newValue = e.getValue(); String newPath = newValue.path(); if (ignoreList.contains(newPath)) { continue; } ignoreList.add(newPath); if (!filterMatchesOrIsParent(newPath)) { continue;// filter doesn't apply to the renamed tree as a whole } LOGGER.trace("Handling rename of {} as {}", oldValue.path(), newPath); MutableTree leftTree = treeDifference.getLeftTree(); leftTree.removeChild(oldValue.path()); leftTree.setChild(newValue.getParentPath(), newValue.getNode()); } } private void handleRemainingDifferences(TreeDifference treeDifference, Set<String> ignoreList) { // old/new refs to trees that have changed and apply to the pathFilters, deepest paths first final SortedMap<NodeRef, NodeRef> changedTrees = treeDifference.findChanges(); final SortedMap<NodeRef, NodeRef> filteredChangedTrees = changedTrees;// filterChanges(changedTrees); for (Map.Entry<NodeRef, NodeRef> changedTreeRefs : filteredChangedTrees.entrySet()) { NodeRef leftTreeRef = changedTreeRefs.getKey(); NodeRef rightTreeRef = changedTreeRefs.getValue(); String newPath = rightTreeRef.path(); if (ignoreList.contains(newPath)) { continue; } if (!filterApplies(newPath, treeDifference.getRightTree())) { continue; } ignoreList.add(newPath); RevTree tree = applyChanges(leftTreeRef, rightTreeRef); Node newTreeNode = Node.create(rightTreeRef.name(), tree.getId(), rightTreeRef.getMetadataId(), TYPE.TREE); MutableTree leftRoot = treeDifference.getLeftTree(); String parentPath = rightTreeRef.getParentPath(); leftRoot.setChild(parentPath, newTreeNode); } } private RevTree applyChanges(@Nullable final NodeRef leftTreeRef, @Nullable final NodeRef rightTreeRef) { Preconditions.checkArgument(leftTreeRef != null || rightTreeRef != null, "either left or right tree shall be non null"); final String treePath = rightTreeRef == null ? leftTreeRef.path() : rightTreeRef.path(); final List<String> strippedPathFilters = stripParentAndFiltersThatDontApply( this.pathFilters, treePath); // find the diffs that apply to the path filters final ObjectId leftTreeId = leftTreeRef == null ? ObjectId.NULL : leftTreeRef.objectId(); final ObjectId rightTreeId = rightTreeRef == null ? ObjectId.NULL : rightTreeRef.objectId(); Supplier<Iterator<DiffEntry>> diffs = command(DiffTree.class).setRecursive(false) .setReportTrees(false).setOldTree(leftTreeId).setNewTree(rightTreeId) .setFilter(strippedPathFilters); // move new blobs from the index to the repository (note: this could be parallelized) Supplier<Iterator<Node>> nodesToMove = asNodeSupplierOfNewContents(diffs, strippedPathFilters); command(DeepMove.class).setObjects(nodesToMove).call(); final StagingDatabase stagingDatabase = getIndex().getDatabase(); final RevTree currentLeftTree = leftTreeId.isNull() ? RevTree.EMPTY : stagingDatabase .getTree(leftTreeId); final RevTreeBuilder builder = currentLeftTree.builder(repositoryDatabase); Iterator<DiffEntry> iterator = diffs.get(); if (!strippedPathFilters.isEmpty()) { final Set<String> expected = Sets.newHashSet(strippedPathFilters); iterator = Iterators.filter(iterator, new Predicate<DiffEntry>() { @Override public boolean apply(DiffEntry input) { boolean applies; if (input.isDelete()) { applies = expected.contains(input.oldName()); } else { applies = expected.contains(input.newName()); } return applies; } }); } for (; iterator.hasNext();) { final DiffEntry diff = iterator.next(); if (diff.isDelete()) { builder.remove(diff.oldName()); } else { NodeRef newObject = diff.getNewObject(); Node node = newObject.getNode(); builder.put(node); } } final RevTree newTree = builder.build(); repositoryDatabase.put(newTree); return newTree; } private boolean filterMatchesOrIsParent(final String treePath) { if (pathFilters.isEmpty()) { return true; } for (String filter : pathFilters) { if (filter.equals(treePath)) { return true; } boolean treeIsChildOfFilter = NodeRef.isChild(filter, treePath); if (treeIsChildOfFilter) { return true; } } return false; } /** * Determines if any of the {@link #setPathFilter(List) path filters} apply to the given * {@code treePath}. * <p> * That is, whether the changes to the tree given by {@code treePath} should be processes. * <p> * A path filter applies to the given tree path if: * <ul> * <li>There are no filters at all * <li>A filter and the path are the same * <li>A filter is a child of the tree path (e.g. {@code filter = "roads/roads.0" and path = * "roads"}) * <li>A filter is a parent of the tree given by {@code treePath} and addresses a tree instead * of a feature (e.g. {@code filter = "roads" and path = "roads/highways"}, but <b>not</b> if * {@code filter = "roads/roads.0" and path = "roads/highways"} where {@code roads/roads.0} is * not a tree as given by the tree structure in {@code rightTree} and hence may address a * feature that's a direct child of {@code roads} instead) * </ul> * * @param treePath a path to a tree in {@code rightTree} * @param rightTree the trees at the right side of the comparison, used to determine if a filter * addresses a parent tree. * @return {@code true} if the changes in the tree given by {@code treePath} should be processed * because any of the filters will match the changes on it */ private boolean filterApplies(final String treePath, MutableTree rightTree) { if (pathFilters.isEmpty()) { return true; } final Set<String> childTrees = rightTree.getChildrenAsMap().keySet(); for (String filter : pathFilters) { if (filter.equals(treePath)) { return true; } boolean filterIsChildOfTree = NodeRef.isDirectChild(treePath, filter); if (filterIsChildOfTree) { return true; } boolean filterIsParentOfTree = filterMatchesOrIsParent(treePath); boolean filterIsTree = childTrees.contains(filter); if (filterIsParentOfTree && filterIsTree) { return true; } } return false; } /** * @return a new list out of the filters in pathFilters that apply to the given path (are equal * or a parent of), with their own parents stripped to that they apply directly to the * node names in the tree */ private List<String> stripParentAndFiltersThatDontApply(List<String> pathFilters, final String treePath) { List<String> parentsStripped = Lists.newArrayListWithCapacity(pathFilters.size()); for (String filter : pathFilters) { if (filter.equals(treePath)) { continue;// include all diffs in the tree addressed by treePath } boolean pathIsChildOfFilter = NodeRef.isChild(filter, treePath); if (pathIsChildOfFilter) { continue;// include all diffs in this path } boolean filterIsChildOfTree = NodeRef.isChild(treePath, filter); if (filterIsChildOfTree) { String filterFromPath = NodeRef.removeParent(treePath, filter); parentsStripped.add(filterFromPath); } } return parentsStripped; } /** * Transforms a {@code Supplier<DiffEntry>} to a {@code Supplier<Node>} with the * {@link DiffEntry#getNewObject() new nodes} of entries that represent changes or additions. * * @param strippedPathFilters */ private Supplier<Iterator<Node>> asNodeSupplierOfNewContents( final Supplier<Iterator<DiffEntry>> supplier, final List<String> strippedPathFilters) { final Function<DiffEntry, Node> newNodes = new Function<DiffEntry, Node>() { @Override public Node apply(DiffEntry diffEntry) { return diffEntry.getNewObject().getNode(); } }; // filters DiffEntries that are not to be moved from index to objects (i.e. DELETE entries) final Predicate<DiffEntry> movableFilter = new Predicate<DiffEntry>() { final Set<String> expected = Sets.newHashSet(strippedPathFilters); @Override public boolean apply(DiffEntry e) { if (DiffEntry.ChangeType.REMOVED.equals(e.changeType())) { return false; } if (!expected.isEmpty() && !expected.contains(e.newPath())) { return false; } return true; } }; return Suppliers.compose(new Function<Iterator<DiffEntry>, Iterator<Node>>() { @Override public Iterator<Node> apply(Iterator<DiffEntry> input) { Iterator<DiffEntry> onlyChanges = Iterators.filter(input, movableFilter); Iterator<Node> movableNodes = Iterators.transform(onlyChanges, newNodes); return movableNodes; } }, supplier); } private TreeDifference computeTreeDifference() { final String rightTreeish = Ref.STAGE_HEAD; final ObjectId rootTreeId = resolveRootTreeId(); final ObjectId stageRootId = getIndex().getTree().getId(); final Supplier<Iterator<NodeRef>> leftTreeRefs; final Supplier<Iterator<NodeRef>> rightTreeRefs; if (rootTreeId.isNull()) { Iterator<NodeRef> empty = Iterators.emptyIterator(); leftTreeRefs = Suppliers.ofInstance(empty); } else { leftTreeRefs = command(LsTreeOp.class).setReference(rootTreeId.toString()).setStrategy( Strategy.DEPTHFIRST_ONLY_TREES); } rightTreeRefs = command(LsTreeOp.class).setReference(rightTreeish).setStrategy( Strategy.DEPTHFIRST_ONLY_TREES); MutableTree leftTree = MutableTree.createFromRefs(rootTreeId, leftTreeRefs); MutableTree rightTree = MutableTree.createFromRefs(stageRootId, rightTreeRefs); TreeDifference treeDifference = TreeDifference.create(leftTree, rightTree); return treeDifference; } @Nullable private NodeRef findTree(ObjectId objectId, Map<String, NodeRef> treeEntries) { for (NodeRef ref : treeEntries.values()) { if (objectId.equals(ref.objectId())) { return ref; } } return null; } private void deepMove(ObjectId object) { Supplier<ObjectId> objectRef = Suppliers.ofInstance(object); command(DeepMove.class).setObject(objectRef).setToIndex(false).call(); } private void deepMove(Node ref) { Supplier<Node> objectRef = Suppliers.ofInstance(ref); command(DeepMove.class).setObjectRef(objectRef).setToIndex(false).call(); } /** * @return the resolved root tree id */ private ObjectId resolveRootTreeId() { if (oldRoot != null) { RevTree rootTree = oldRoot.get(); return rootTree.getId(); } ObjectId targetTreeId = command(ResolveTreeish.class).setTreeish(Ref.HEAD).call().get(); return targetTreeId; } }
state-hiu/GeoGit
src/core/src/main/java/org/geogit/api/plumbing/WriteTree2.java
Java
bsd-3-clause
21,844
package za.org.grassroot.webapp.controller.rest.livewire; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import za.org.grassroot.core.domain.User; import za.org.grassroot.core.domain.geo.GeoLocation; import za.org.grassroot.core.domain.livewire.LiveWireAlert; import za.org.grassroot.core.domain.media.MediaFileRecord; import za.org.grassroot.core.domain.media.MediaFunction; import za.org.grassroot.core.enums.LiveWireAlertDestType; import za.org.grassroot.core.enums.LiveWireAlertType; import za.org.grassroot.core.enums.LocationSource; import za.org.grassroot.core.enums.UserInterfaceType; import za.org.grassroot.core.repository.MembershipRepository; import za.org.grassroot.integration.authentication.JwtService; import za.org.grassroot.integration.storage.StorageBroker; import za.org.grassroot.services.group.GroupBroker; import za.org.grassroot.services.livewire.DataSubscriberBroker; import za.org.grassroot.services.livewire.LiveWireAlertBroker; import za.org.grassroot.services.task.EventBroker; import za.org.grassroot.services.user.UserManagementService; import za.org.grassroot.webapp.controller.rest.BaseRestController; import za.org.grassroot.webapp.controller.rest.Grassroot2RestController; import za.org.grassroot.webapp.controller.rest.home.PublicLiveWireDTO; import za.org.grassroot.webapp.enums.RestMessage; import za.org.grassroot.webapp.model.rest.wrappers.ResponseWrapper; import za.org.grassroot.webapp.util.RestUtil; import javax.servlet.http.HttpServletRequest; import java.util.Set; @RestController @Grassroot2RestController @Slf4j @RequestMapping(value = "/v2/api/livewire") @Api("/v2/api/livewire") public class LiveWireController extends BaseRestController{ private final UserManagementService userManagementService; private final GroupBroker groupBroker; private final EventBroker eventBroker; private final StorageBroker storageBroker; private final LiveWireAlertBroker liveWireAlertBroker; private final DataSubscriberBroker subscriberBroker; private MembershipRepository membershipRepository; // for the alerts, in future may refactor to be more elegant @Autowired public LiveWireController(UserManagementService userManagementService, GroupBroker groupBroker, EventBroker eventBroker, StorageBroker storageBroker, LiveWireAlertBroker liveWireAlertBroker, DataSubscriberBroker subscriberBroker, JwtService jwtService) { super(jwtService,userManagementService); this.userManagementService = userManagementService; this.groupBroker = groupBroker; this.eventBroker = eventBroker; this.storageBroker = storageBroker; this.liveWireAlertBroker = liveWireAlertBroker; this.subscriberBroker = subscriberBroker; } @Autowired public void setMembershipRepository(MembershipRepository membershipRepository) { this.membershipRepository = membershipRepository; } @PreAuthorize("hasRole('ROLE_LIVEWIRE_USER')") @RequestMapping(value = "/list/subscriber", method = RequestMethod.GET) public Page<PublicLiveWireDTO> fetchLiveWireAlertsForSubscribers(Pageable pageable) { return liveWireAlertBroker.fetchReleasedAlerts(pageable).map(alert -> new PublicLiveWireDTO(alert, true, true, membershipRepository)); } @PreAuthorize("hasRole('ROLE_FULL_USER')") @RequestMapping(value = "/create/{userUid}", method = RequestMethod.POST) public ResponseEntity<ResponseWrapper> createLiveWireAlert(@RequestParam String headline, @RequestParam(required = false) String description, @RequestParam LiveWireAlertType type, @RequestParam(required = false) String groupUid, @RequestParam(required = false) String taskUid, @RequestParam boolean addLocation, @RequestParam(required = false) Double latitude, @RequestParam(required = false) Double longitude, @RequestParam(required = false) LiveWireAlertDestType destType, @RequestParam(required = false) String destUid, @RequestParam(required = false) Set<String> mediaFileKeys, @RequestParam(required = false) Set<String> mediaRecordIds, @RequestParam(required = false) String contactName, @RequestParam(required = false) String contactNumber, @PathVariable String userUid, HttpServletRequest request) { User creatingUser = userManagementService.load(getUserIdFromRequest(request)); log.info("Creating a new LiveWire alert, alert type = {}, dest type = {}, has location? : {}, has media files? : {} or record IDs: {}", type, destType, addLocation, mediaFileKeys, mediaRecordIds); LiveWireAlert.Builder builder = LiveWireAlert.newBuilder(); builder.creatingUser(creatingUser) .contactUser(creatingUser) .headline(headline) .description(description) .contactName(contactName) .contactNumber(contactNumber) .type(type); if (LiveWireAlertType.INSTANT.equals(type)) { builder.group(groupBroker.load(groupUid)); } else if (LiveWireAlertType.MEETING.equals(type)) { log.info("Public meeting alert, for meeting: {}", eventBroker.loadMeeting(taskUid)); builder.meeting(eventBroker.loadMeeting(taskUid)); } if (addLocation) { builder.location(new GeoLocation(latitude, longitude), LocationSource.convertFromInterface(UserInterfaceType.ANDROID)); } if (destType == null) { builder.destType(LiveWireAlertDestType.PUBLIC_LIST); } else { builder.destType(destType); if (!StringUtils.isEmpty(destUid)) { builder.destSubscriber(subscriberBroker.load(destUid)); } } log.info("About to fetch media files? : {}", mediaFileKeys != null && !mediaFileKeys.isEmpty()); if (mediaFileKeys != null && !mediaFileKeys.isEmpty()) { Set<MediaFileRecord> records = storageBroker.retrieveMediaRecordsForFunction(MediaFunction.LIVEWIRE_MEDIA, mediaFileKeys); builder.addMediaFiles(records); } log.info("About to try by media record id? : {}", mediaRecordIds != null && mediaRecordIds.isEmpty()); if (mediaRecordIds != null && !mediaRecordIds.isEmpty()) { Set<MediaFileRecord> idRecords = storageBroker.retrieveRecordsById(mediaRecordIds); log.info("Found records by ID: {}", idRecords); builder.addMediaFiles(idRecords); } return RestUtil.okayResponseWithData(RestMessage.LIVEWIRE_ALERT_CREATED, liveWireAlertBroker.createAsComplete(userUid, builder)); } @PreAuthorize("hasRole('ROLE_LIVEWIRE_USER')") @RequestMapping(value = "/user/blocked",method = RequestMethod.GET) public ResponseEntity<Boolean> isUserBlocked(HttpServletRequest httpServletRequest){ log.info("Check if user is blocked or not --->>"); return ResponseEntity.ok(liveWireAlertBroker.isUserBlocked(getUserIdFromRequest(httpServletRequest))); } }
grassrootza/grassroot-platform
grassroot-webapp/src/main/java/za/org/grassroot/webapp/controller/rest/livewire/LiveWireController.java
Java
bsd-3-clause
8,460
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package edu.wpi.first.wpilibj.templates.commands; import edu.wpi.first.wpilibj.command.CommandGroup; import edu.wpi.first.wpilibj.command.WaitForChildren; /** * * @author Brinton */ public class ClimbNextRung extends CommandGroup { public ClimbNextRung() { //1.Extend top pulley to 45 inches while maintaining rod angle of 80 // degreesto horizon. Then pause addSequential(new TopPulleyExtend(45f,80f,1f,.1f)); addSequential(new TopPulleyExtend(45f,60f,.8f,.2f)); addSequential(new TopPulleyClimb(42f,-.3f,.1f)); addSequential(new TopPulleyClimb(26f,-.9f,.1f)); addSequential(new TopPulleyCreep(-.15f)); addSequential(new LeftSetPawl(false)); addSequential(new RightSetPawl(false)); addSequential(new SidePulleysExtend(36f,36f,80f,80f,.9f,.9f,.5f,.5f)); addSequential (new LeftSetPawl(true)); addSequential (new RightSetPawl(true)); addSequential(new SidePulleysClimb(false,6.5f,6.5f,.1f,.1f,-.8f,-.7f)); // addParallel(new TopPulleySetLength(45f,.1f,1)); // addParallel(new TopRodAngleFree(80f,45f)); //addSequential (new WaitForChildren()); //addSequential (new TopPause()); // resume when apprppriate // 2.Lower the top rod to 60 degrees relative to horizon to hook rung // and pause //addSequential(new TopRodAngleFree(60f,45f)); // addSequential(new TopPause()); // // 3. Retract top tape to 26 inches // // addParallel (new TopPulleySetLength(26f,.1f,-1)); // addParallel (new TopRodFollowTape(false, 26)); // addSequential (new WaitForChildren()); // // 4. Unlock pawls on sides while creeping center tape. // Issue: since the top pulley does not have a pawl // it will need to hold its position while the sidepulleys disengage // from the the lower rung, extend and grab the upper rung. // The solution is a "CreepTape" command that retracts the pulley // at a fraction of its maximum voltage. This // parameter fractional speed, // are a guess. We will need to tune it. // during the CreepTape commands, we do not adjust the angle of the tape. // because the tapelength should not change enough to matter. // addParallel (new TopPulleyCreep(-.15f)); // addSequential(new LeftSetPawl(false)); addSequential(new RightSetPawl(false)); // // 5.Extend the side tapes to reach the next rung // at an angle that will allow them to hook the rung. // Hold position with the center tape while they do this. // addSequential(new SidePulleysExtend(36f,36f,80f,80f,.9f,.9f,.5f,.5f)); // // 6. Now lower the side rods to hook the rung. // addSequential(new SidePulleysExtend(36f,36f,60f,60f,.9f,.9f,.5f,.5f)); // 7..Pause sides // addSequential (new SidePause()); // resume when ready // // 8. Lock side pawls and retract the side tapes to 20 inches, // maintaining angle. Creep for 2 seconds to hold // position till the pawls lock // addSequential (new LeftSetPawl(true)); addSequential (new RightSetPawl(true)); addSequential (new SidePulleysClimb(false,20f,20f,-.8f,-.7f,.5f,.5f)); // // 9. Lift up center rod angle // addParallel(new TopPulleySetLength(28f,.1f,.5f)); addParallel(new TopRodAngleFree(85f,28f)); // // 10. Retract sidetapes to 6.5 inch // // addSequential(new SidePulleysClimb(false,6.5f,6.5f,.1f,.1f,-.8f,-.7f)); } }
olliethewonderdog/climbingrobot3
src/edu/wpi/first/wpilibj/templates/commands/ClimbNextRung.java
Java
bsd-3-clause
3,887
package com.mastercard.api.partnerwallet.domain.common; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar; /** * <p>Java class for ConnectionHistory complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ConnectionHistory"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="MerchantInfo" type="{}MerchantInfo"/> * &lt;element name="TimeStamp" type="{http://www.w3.org/2001/XMLSchema}dateTime"/> * &lt;element name="activityString" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="ExtensionPoint" type="{}ExtensionPoint" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ConnectionHistory", propOrder = { "merchantInfo", "timeStamp", "activityString", "extensionPoint" }) public class ConnectionHistory { @XmlElement(name = "MerchantInfo", required = true) protected MerchantInfo merchantInfo; @XmlElement(name = "TimeStamp", required = true) @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar timeStamp; @XmlElement(required = true) protected String activityString; @XmlElement(name = "ExtensionPoint") protected ExtensionPoint extensionPoint; /** * Gets the value of the merchantInfo property. * * @return * possible object is * {@link MerchantInfo } * */ public MerchantInfo getMerchantInfo() { return merchantInfo; } /** * Sets the value of the merchantInfo property. * * @param value * allowed object is * {@link MerchantInfo } * */ public void setMerchantInfo(MerchantInfo value) { this.merchantInfo = value; } /** * Gets the value of the timeStamp property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getTimeStamp() { return timeStamp; } /** * Sets the value of the timeStamp property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setTimeStamp(XMLGregorianCalendar value) { this.timeStamp = value; } /** * Gets the value of the activityString property. * * @return * possible object is * {@link String } * */ public String getActivityString() { return activityString; } /** * Sets the value of the activityString property. * * @param value * allowed object is * {@link String } * */ public void setActivityString(String value) { this.activityString = value; } /** * Gets the value of the extensionPoint property. * * @return * possible object is * {@link ExtensionPoint } * */ public ExtensionPoint getExtensionPoint() { return extensionPoint; } /** * Sets the value of the extensionPoint property. * * @param value * allowed object is * {@link ExtensionPoint } * */ public void setExtensionPoint(ExtensionPoint value) { this.extensionPoint = value; } }
thgriefers/mastercard-api-java
src/main/java/com/mastercard/api/partnerwallet/domain/common/ConnectionHistory.java
Java
bsd-3-clause
3,803
/* Copyright (c) 2017, Henrique Abdalla <https://github.com/AquariusPower><https://sourceforge.net/u/teike/profile/> 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. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.github.devconslejme.projman; /** * @author Henrique Abdalla <https://github.com/AquariusPower><https://sourceforge.net/u/teike/profile/> */ public class TestBasicCodeToCopyFrom extends SimpleApplicationAndStateAbs { public static void main(String[] args) { TestBasicCodeToCopyFrom test = new TestBasicCodeToCopyFrom(); test.start(); } @Override public void simpleInitApp() { //TODO com.github.devconslejme.misc.TODO.PkgCfgI.i().configure(); initTest(); } @Override public void update(float tpf) { throw new UnsupportedOperationException("method not implemented"); } /** * public so can be called from devcons user cmds */ @Override public void initTest() { super.initTest(); throw new UnsupportedOperationException("method not implemented yet"); } }
AquariusPower/DevConsLeJME
Tests/src/main/java/com/github/devconslejme/projman/TestBasicCodeToCopyFrom.java
Java
bsd-3-clause
2,406
package com.compositesw.services.system.admin.resource; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for updateXSLTProcedureResponse complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="updateXSLTProcedureResponse"> * &lt;complexContent> * &lt;extension base="{http://www.compositesw.com/services/system/admin/resource}resourcesResponse"> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "updateXSLTProcedureResponse") public class UpdateXSLTProcedureResponse extends ResourcesResponse { }
dvbu-test/PDTool
CISAdminApi7.0.0/src/com/compositesw/services/system/admin/resource/UpdateXSLTProcedureResponse.java
Java
bsd-3-clause
820
/******************************************************************************* * Copyright (c) 2009-2012, University of Manchester * * Licensed under the New BSD License. * Please see LICENSE file that is distributed with the source code ******************************************************************************/ package uk.ac.manchester.cs.owl.semspreadsheets.ui.action; import java.awt.event.ActionEvent; import uk.ac.manchester.cs.owl.semspreadsheets.model.Range; import uk.ac.manchester.cs.owl.semspreadsheets.model.WorkbookManager; import uk.ac.manchester.cs.owl.semspreadsheets.ui.WorkbookFrame; /** * @author Stuart Owen * @author Matthew Horridge */ @SuppressWarnings("serial") public class InsertOntologyValuesAction extends SpreadSheetAction { public InsertOntologyValuesAction(WorkbookManager workbookManager, WorkbookFrame workbookFrame) { super("Ontology values", workbookManager, workbookFrame); } /** * Invoked when an action occurs. */ public void actionPerformed(ActionEvent e) { Range range = getSpreadSheetManager().getSelectionModel().getSelectedRange(); if(range == null) { return; } if(!range.isCellSelection()) { return; } getSpreadSheetFrame().repaint(); } }
Tokebluff/RightField
src/main/java/uk/ac/manchester/cs/owl/semspreadsheets/ui/action/InsertOntologyValuesAction.java
Java
bsd-3-clause
1,315
/** ------------------------------------------------------------ * MailService.java * * Big Cyber City * * @author wbruschi [ Dec 20, 2008 ] * ------------------------------------------------------------ */ package com.bigcybercity.service; /** * Controls the handling of internal mail */ public interface MailService { public void sendEmail(String to, String subject, String body); public void sendCommentEmail(long userId); public void sendMessageEmail(long userId); public void sendFriendReqEmail(long userId); public void sendPassword(String email); }
brewski82/Big-Cyber-City
src/com/bigcybercity/service/MailService.java
Java
bsd-3-clause
585
package com.github.mlk.junit.rules.helpers.dynamodb; import static java.util.Collections.singleton; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.amazonaws.services.dynamodbv2.document.DynamoDB; import com.amazonaws.services.dynamodbv2.document.Table; import com.amazonaws.services.dynamodbv2.model.AttributeDefinition; import com.amazonaws.services.dynamodbv2.model.CreateTableRequest; import com.amazonaws.services.dynamodbv2.model.KeySchemaElement; import com.amazonaws.services.dynamodbv2.model.KeyType; import com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput; import com.amazonaws.services.dynamodbv2.model.ScalarAttributeType; import com.amazonaws.services.dynamodbv2.model.TableDescription; import com.github.mlk.junit.dynamo.DynamoDBClientWithStubbedWaiter; import com.github.mlk.junit.rules.LocalDynamoDbRule; import java.util.ArrayList; import java.util.List; import org.junit.Rule; import org.junit.Test; public class DynamoDBClientWithStubbedWaiterTest { @Rule public LocalDynamoDbRule dynamoDbRule = new LocalDynamoDbRule(); @Test public void waiterMethodsShouldWorkWithWrapper() throws InterruptedException { DynamoDBClientWithStubbedWaiter subject = new DynamoDBClientWithStubbedWaiter( dynamoDbRule.getClient()); DynamoDB db = new DynamoDB(subject); AttributeDefinition id = new AttributeDefinition("id", ScalarAttributeType.S); List<KeySchemaElement> keySchema = new ArrayList<>(); keySchema.add( new KeySchemaElement() .withAttributeName(id.getAttributeName()) .withKeyType(KeyType.HASH) ); ProvisionedThroughput provisionedThroughput = new ProvisionedThroughput(); provisionedThroughput.setReadCapacityUnits(10L); provisionedThroughput.setWriteCapacityUnits(10L); CreateTableRequest request = new CreateTableRequest() .withTableName("test_table") .withKeySchema(keySchema) .withAttributeDefinitions(singleton(id)) .withProvisionedThroughput(provisionedThroughput); Table result = db.createTable(request); TableDescription description = result.waitForActive(); assertThat(description.getTableName(), is("test_table")); } }
mlk/AssortmentOfJUnitRules
src/test/java/com/github/mlk/junit/rules/helpers/dynamodb/DynamoDBClientWithStubbedWaiterTest.java
Java
bsd-3-clause
2,257
package io.github.vshchukin.projecteuler; public class Problem14LongestCollatz { private static final int LIMIT = 1_000_000; /** * with memoization */ public static void main(String[] args) { final int[] collatzCache = new int[LIMIT]; collatzCache[2] = 2; collatzCache[1] = 1; int maxNumber = 2; int maxCollatzLength = 2; for (int i = 3; i < collatzCache.length; i++) { long j = i; int iCollatzLength = 0; while (j >= LIMIT || collatzCache[(int) j] == 0) { if ((j & 1) == 0) { j >>= 1; } else { j = 3 * j + 1; } iCollatzLength++; } collatzCache[i] = iCollatzLength + collatzCache[(int) j]; maxCollatzLength = Math.max(maxCollatzLength, collatzCache[i]); if (maxCollatzLength == collatzCache[i]) { maxNumber = i; } } System.out.printf("Number is %d\n", maxNumber); System.out.printf("Sequence length is %d\n", collatzCache[maxNumber]); } }
vshchukin/coding-challenges
src/main/java/io/github/vshchukin/projecteuler/Problem14LongestCollatz.java
Java
bsd-3-clause
1,158
package robot; import edu.wpi.first.wpilibj.Jaguar; import edu.wpi.first.wpilibj.SpeedController; import robot.util.control.XboxController; public class Hydraulics implements RobotComponent { private XboxController controller; private SpeedController motor1; private double value; public void init() { controller = new XboxController(1); motor1 = new Jaguar(5); } public void teleop() { if(controller.getButton(XboxController.X)) { motor1.set(0); } else { motor1.set(controller.getAxis(XboxController.TRIGGERS)/4); } } public void auton() { } public void test() { } }
PrecociouslyDigital/rewrite
src/robot/Hydraulics.java
Java
bsd-3-clause
714
package com.alexrnl.jseries.request.shows; import com.alexrnl.jseries.request.APIAddresses; import com.alexrnl.jseries.request.Request; import com.alexrnl.jseries.request.Verb; import com.alexrnl.jseries.request.parameters.Id; /** * Request which retrieves the favorite shows of a member.<br /> * @author Alex */ public class ShowFavorites extends Request { /** * Constructor #1.<br /> * @param memberId * the id of the member to retrieve favorite (<code>null</code> for the logged member). */ public ShowFavorites (final Integer memberId) { super(Verb.GET, APIAddresses.SHOWS_FAVORITES); if (memberId != null) { addParameter(new Id(memberId)); } } /** * Constructor #2.<br /> * Default constructor, request the show of the logged member. */ public ShowFavorites () { this(null); } }
AlexRNL/jSeries
src/main/java/com/alexrnl/jseries/request/shows/ShowFavorites.java
Java
bsd-3-clause
833
/* * Copyright (c) 2014, Victor Nazarov <[email protected]> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Victor Nazarov nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.github.sviperll.multitasking; /** * This class represents TaskDefinition that behaves the same as a TaskDefinition passed to the constructor * but performes additinal cleanup when cleanup method is called. * <p> * When #cleanup method runs instance of this class calls #cleanup method of original task * and than calls Runnable closingAction passed to the constructor */ class AdditionalCleanupActionTask implements TaskDefinition { private final TaskDefinition task; private final Runnable closingAction; /** * * @param task original task to base behaviour on * @param closingAction aditional action to perform when instance is closed */ public AdditionalCleanupActionTask(TaskDefinition task, Runnable closingAction) { this.task = task; this.closingAction = closingAction; } /** * Calls #perform method of the original task @see TaskDefinition#perform */ @Override public void perform() { task.perform(); } /** * Calls #signalKill method of the original task @see TaskDefinition#signalKill */ @Override public void signalKill() { task.signalKill(); } /** * Calls #cleanup method of the original task (@see TaskDefinition#cleanup) * and than calls additional closingAction */ @Override public void cleanup() { try { task.cleanup(); } finally { closingAction.run(); } } }
sviperll/multitasking4j
src/main/java/com/github/sviperll/multitasking/AdditionalCleanupActionTask.java
Java
bsd-3-clause
3,105
/***************************************************************************** * Copyright (C) PicoContainer Organization. All rights reserved. * * ------------------------------------------------------------------------- * * The software in this package is published under the terms of the BSD * * style license a copy of which has been included with this distribution in * * the LICENSE.txt file. * * * * Original code by * *****************************************************************************/ package org.picocontainer.alternatives; import org.picocontainer.defaults.ComponentAdapterFactory; /** * @author Aslak Helles&oslash;y * @see org.picocontainer.gems.HotSwappingComponentAdapterFactory for a more feature-rich version of the class * @since 1.1 * @deprecated since 1.2, moved to package {@link org.picocontainer.defaults} */ public class ImplementationHidingComponentAdapterFactory extends org.picocontainer.defaults.ImplementationHidingComponentAdapterFactory { /** * @deprecated since 1.2, moved to package {@link org.picocontainer.defaults} */ ImplementationHidingComponentAdapterFactory() { super(); } /** * @deprecated since 1.2, moved to package {@link org.picocontainer.defaults} */ public ImplementationHidingComponentAdapterFactory(ComponentAdapterFactory delegate, boolean strict) { super(delegate, strict); } /** * @deprecated since 1.2, moved to package {@link org.picocontainer.defaults} */ public ImplementationHidingComponentAdapterFactory(ComponentAdapterFactory delegate) { super(delegate); } }
picocontainer/PicoContainer1
container/src/java/org/picocontainer/alternatives/ImplementationHidingComponentAdapterFactory.java
Java
bsd-3-clause
1,847
/** * MOTECH PLATFORM OPENSOURCE LICENSE AGREEMENT * * Copyright (c) 2010-11 The Trustees of Columbia University in the City of * New York and Grameen Foundation USA. 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. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of Grameen Foundation USA, Columbia University, or * their respective contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY GRAMEEN FOUNDATION USA, COLUMBIA UNIVERSITY * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRAMEEN FOUNDATION * USA, COLUMBIA UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.motechproject.server.service; import junit.framework.TestCase; import org.easymock.Capture; import org.motechproject.server.model.ExpectedObs; import org.motechproject.server.service.impl.ExpectedObsSchedule; import org.motechproject.server.svc.RegistrarBean; import org.motechproject.server.util.MotechConstants; import org.openmrs.Encounter; import org.openmrs.Obs; import org.openmrs.Patient; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.util.*; import static org.easymock.EasyMock.*; public class BCGScheduleTest extends TestCase { ApplicationContext ctx; RegistrarBean registrarBean; ExpectedObsSchedule bcgSchedule; ExpectedCareEvent bcgEvent; @Override protected void setUp() throws Exception { ctx = new ClassPathXmlApplicationContext(new String[] { "test-common-program-beans.xml", "services/child-bcg-service.xml" }); bcgSchedule = (ExpectedObsSchedule) ctx.getBean("childBCGSchedule"); bcgEvent = bcgSchedule.getEvents().get(0); // EasyMock setup in Spring config registrarBean = (RegistrarBean) ctx.getBean("registrarBean"); } @Override protected void tearDown() throws Exception { ctx = null; bcgSchedule = null; bcgEvent = null; registrarBean = null; } public void testCreateExpected() { Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.MONTH, -2); // age is 2 months Patient patient = new Patient(); patient.setBirthdate(calendar.getTime()); patient.setDateCreated(calendar.getTime()); Capture<Date> minDateCapture = new Capture<Date>(); Capture<Date> dueDateCapture = new Capture<Date>(); Capture<Date> lateDateCapture = new Capture<Date>(); Capture<Date> maxDateCapture = new Capture<Date>(); List<Obs> obsList = new ArrayList<Obs>(); List<ExpectedObs> expectedObsList = new ArrayList<ExpectedObs>(); expect( registrarBean.getObs(patient, bcgSchedule.getConceptName(), bcgSchedule.getValueConceptName(), patient .getBirthdate())).andReturn(obsList); expect(registrarBean.getExpectedObs(patient, bcgSchedule.getName())) .andReturn(expectedObsList); expect( registrarBean.createExpectedObs(eq(patient), eq(bcgSchedule .getConceptName()), eq(bcgSchedule .getValueConceptName()), eq(bcgEvent.getNumber()), capture(minDateCapture), capture(dueDateCapture), capture(lateDateCapture), capture(maxDateCapture), eq(bcgEvent.getName()), eq(bcgSchedule.getName()))) .andReturn(new ExpectedObs()); calendar.set(2010, 03, 10); expect(registrarBean.getChildRegistrationDate()).andReturn(calendar.getTime()); calendar.set(2011, 03, 10); Encounter encounter = new Encounter(); encounter.setEncounterDatetime(calendar.getTime()); expect(registrarBean.getEncounters(patient, MotechConstants.ENCOUNTER_TYPE_PATIENTREGVISIT, patient.getBirthdate())).andReturn(Arrays.asList(encounter)); replay(registrarBean); bcgSchedule.updateSchedule(patient, date); verify(registrarBean); Date minDate = minDateCapture.getValue(); Date dueDate = dueDateCapture.getValue(); Date lateDate = lateDateCapture.getValue(); Date maxDate = maxDateCapture.getValue(); assertNotNull("Min date is null", minDate); assertNotNull("Due date is null", dueDate); assertNotNull("Late date is null", lateDate); assertNotNull("Max date is null", maxDate); assertEquals("Due date not equal min date", minDate, dueDate); assertTrue("Late date is not after due date", lateDate.after(dueDate)); assertTrue("Max date is not after late date", maxDate.after(lateDate)); } public void testUpdateExpected() { Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.MONTH, -2); // age is 2 months Patient patient = new Patient(); patient.setBirthdate(calendar.getTime()); patient.setDateCreated(calendar.getTime()); Capture<ExpectedObs> expectedObsCapture = new Capture<ExpectedObs>(); List<Obs> obsList = new ArrayList<Obs>(); List<ExpectedObs> expectedObsList = new ArrayList<ExpectedObs>(); ExpectedObs expectedObs = new ExpectedObs(); expectedObs.setId(1L); expectedObs.setName(bcgEvent.getName()); expectedObsList.add(expectedObs); expect( registrarBean.getObs(patient, bcgSchedule.getConceptName(), bcgSchedule.getValueConceptName(), patient .getBirthdate())).andReturn(obsList); expect(registrarBean.getExpectedObs(patient, bcgSchedule.getName())) .andReturn(expectedObsList); expect(registrarBean.saveExpectedObs(capture(expectedObsCapture))) .andReturn(new ExpectedObs()); calendar.set(2010, 03, 10); expect(registrarBean.getChildRegistrationDate()).andReturn(calendar.getTime()); calendar.set(2011, 03, 10); Encounter encounter = new Encounter(); encounter.setEncounterDatetime(calendar.getTime()); expect(registrarBean.getEncounters(patient, MotechConstants.ENCOUNTER_TYPE_PATIENTREGVISIT, patient.getBirthdate())).andReturn(Arrays.asList(encounter)); replay(registrarBean); bcgSchedule.updateSchedule(patient, date); verify(registrarBean); ExpectedObs capturedExpectedObs = expectedObsCapture.getValue(); assertNotNull("Expected Obs min date is null", capturedExpectedObs .getMinObsDatetime()); assertNotNull("Expected Obs due date is null", capturedExpectedObs .getDueObsDatetime()); assertNotNull("Expected Obs late date is null", capturedExpectedObs .getLateObsDatetime()); assertNotNull("Expected Obs max date is null", capturedExpectedObs .getMaxObsDatetime()); assertEquals(Boolean.FALSE, capturedExpectedObs.getVoided()); } public void testSatisfyExpected() { Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.MONTH, -2); // age is 2 months Patient patient = new Patient(); patient.setBirthdate(calendar.getTime()); patient.setDateCreated(calendar.getTime()); Capture<ExpectedObs> expectedObsCapture = new Capture<ExpectedObs>(); List<Obs> obsList = new ArrayList<Obs>(); Obs obs = new Obs(); obs.setObsDatetime(date); obsList.add(obs); List<ExpectedObs> expectedObsList = new ArrayList<ExpectedObs>(); ExpectedObs expectedObs = new ExpectedObs(); expectedObs.setId(2L); expectedObs.setName(bcgEvent.getName()); expectedObsList.add(expectedObs); expect( registrarBean.getObs(patient, bcgSchedule.getConceptName(), bcgSchedule.getValueConceptName(), patient .getBirthdate())).andReturn(obsList); expect(registrarBean.getExpectedObs(patient, bcgSchedule.getName())) .andReturn(expectedObsList); expect(registrarBean.saveExpectedObs(capture(expectedObsCapture))) .andReturn(new ExpectedObs()); calendar.set(2010, 03, 10); expect(registrarBean.getChildRegistrationDate()).andReturn(calendar.getTime()); calendar.set(2011, 03, 10); Encounter encounter = new Encounter(); encounter.setEncounterDatetime(calendar.getTime()); expect(registrarBean.getEncounters(patient, MotechConstants.ENCOUNTER_TYPE_PATIENTREGVISIT, patient.getBirthdate())).andReturn(Arrays.asList(encounter)); replay(registrarBean); bcgSchedule.updateSchedule(patient, date); verify(registrarBean); ExpectedObs capturedExpectedObs = expectedObsCapture.getValue(); assertEquals(Boolean.TRUE, capturedExpectedObs.getVoided()); assertEquals(obs, capturedExpectedObs.getObs()); } public void testRemoveExpected() { Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.YEAR, -2); // age is 2 years Patient patient = new Patient(); patient.setBirthdate(calendar.getTime()); Capture<ExpectedObs> expectedObsCapture = new Capture<ExpectedObs>(); List<Obs> obsList = new ArrayList<Obs>(); Obs obs = new Obs(); obs.setObsDatetime(date); obsList.add(obs); List<ExpectedObs> expectedObsList = new ArrayList<ExpectedObs>(); ExpectedObs expectedObs = new ExpectedObs(); expectedObs.setName(bcgEvent.getName()); expectedObsList.add(expectedObs); expect(registrarBean.getExpectedObs(patient, bcgSchedule.getName())) .andReturn(expectedObsList); expect(registrarBean.saveExpectedObs(capture(expectedObsCapture))) .andReturn(new ExpectedObs()); replay(registrarBean); bcgSchedule.updateSchedule(patient, date); verify(registrarBean); ExpectedObs capturedExpectedObs = expectedObsCapture.getValue(); assertEquals(Boolean.TRUE, capturedExpectedObs.getVoided()); } public void testNoAction() { Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.YEAR, -2); // age is 2 years Patient patient = new Patient(); patient.setBirthdate(calendar.getTime()); List<Obs> obsList = new ArrayList<Obs>(); Obs obs = new Obs(); obs.setObsDatetime(date); obsList.add(obs); List<ExpectedObs> expectedObsList = new ArrayList<ExpectedObs>(); expect(registrarBean.getExpectedObs(patient, bcgSchedule.getName())) .andReturn(expectedObsList); replay(registrarBean); bcgSchedule.updateSchedule(patient, date); verify(registrarBean); } }
motech/MOTECH-Ghana
motech-server-core/src/test/java/org/motechproject/server/service/BCGScheduleTest.java
Java
bsd-3-clause
11,508
package com.thedeanda.ajaxproxy.ui.windows; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; public class WindowListListenerCleanup implements WindowListener { private WindowListListener listener; public WindowListListenerCleanup(WindowListListener listener) { this.listener = listener; } @Override public void windowOpened(WindowEvent e) { } @Override public void windowClosing(WindowEvent e) { Windows.get().removeListener(listener); } @Override public void windowClosed(WindowEvent e) { } @Override public void windowIconified(WindowEvent e) { } @Override public void windowDeiconified(WindowEvent e) { } @Override public void windowActivated(WindowEvent e) { } @Override public void windowDeactivated(WindowEvent e) { } }
mdeanda/ajaxproxy
src/main/java/com/thedeanda/ajaxproxy/ui/windows/WindowListListenerCleanup.java
Java
bsd-3-clause
791
package net.minidev.ovh.api.supply; /** * Request status */ public enum OvhStatus { error("error"), ok("ok"), pending("pending"); final String value; OvhStatus(String s) { this.value = s; } public String toString() { return this.value; } }
UrielCh/ovh-java-sdk
ovh-java-sdk-supplymondialRelay/src/main/java/net/minidev/ovh/api/supply/OvhStatus.java
Java
bsd-3-clause
258
/* * $Id$ */ /* Copyright (c) 2000-2010 Board of Trustees of Leland Stanford Jr. University, all rights reserved. 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 STANFORD UNIVERSITY 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. Except as contained in this notice, the name of Stanford University shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Stanford University. */ package org.lockss.plugin.springer; import org.lockss.util.*; import org.lockss.daemon.*; import org.lockss.extractor.*; import org.lockss.plugin.*; import org.lockss.plugin.clockss.SourceXmlMetadataExtractorFactory; import org.lockss.plugin.clockss.SourceXmlSchemaHelper; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Implements a FileMetadataExtractor for Springer Source Content * * Files used to write this class include: * ~/2010/ftp_PUB_10-05-17_06-11-02.zip/JOU=11864/VOL=2008.9/ISU=2-3/ART=2008_64/11864_2008_Article.xml.Meta */ public class SpringerSourceMetadataExtractorFactory extends SourceXmlMetadataExtractorFactory { static Logger log = Logger.getLogger(SpringerSourceMetadataExtractorFactory.class); private static SourceXmlSchemaHelper journalHelper = null; private static SourceXmlSchemaHelper booksHelper = null; public FileMetadataExtractor createFileMetadataExtractor(MetadataTarget target, String contentType) throws PluginException { return new SpringerSourceMetadataExtractor(); } public static class SpringerSourceMetadataExtractor extends SourceXmlMetadataExtractor { /* * The top node for all schema will be <Publisher> * It's the second node that will determine the type - either * /Publisher/Series or /Publisher/Book for a book chapter *and * /Publisher/Journal for a journal article */ @Override protected SourceXmlSchemaHelper setUpSchema(CachedUrl cu, Document xmlDoc) { //look at the top node of the Document to identify the schema Element top_element = xmlDoc.getDocumentElement(); String element_name = top_element.getNodeName(); NodeList elementChildren = top_element.getChildNodes(); if ("Publisher".equals(element_name) && elementChildren != null) { // look at each child until we either run out of children or // find one of "Series", "Book" or "Journal" for (int j = 0; j < elementChildren.getLength(); j++) { Node cnode = elementChildren.item(j); String nodeName = cnode.getNodeName(); if ("Book".equals(nodeName) || "Series".equals(nodeName)) { if (booksHelper == null) { booksHelper = new SpringerBookSourceSchemaHelper(); } return booksHelper; } else if ("Journal".equals(nodeName)) { if(journalHelper == null) { journalHelper = new SpringerJournalSourceSchemaHelper(); } return journalHelper; } } } // if we return null this will throw and the whole AU indexing will fail... // which is excessive. Just log a problem, use the journal helper and keep going log.warning("The xml didn't match expected schema: " + cu.getUrl()); if(journalHelper == null) { journalHelper = new SpringerJournalSourceSchemaHelper(); } return journalHelper; } @Override protected SourceXmlSchemaHelper setUpSchema(CachedUrl cu) { throw new ShouldNotHappenException("This version of the schema setup cannot be used for this plugin"); } private Map<String, String> journalTitleMap; // 5/15/18 - don't think it's still used, but adapting to work with all layouts just in case // http://clockss-ingest.lockss.org/sourcefiles/springer-released/2012/ftp_PUB_11-11-17_06-38-38.zip!/JOU=00238/VOL=2011.34/ISU=6/ART=476/BodyRef/PDF/238_2010_Article_476.pdf // http://clockss-ingest.lockss.org/sourcefiles/springer-released/2018_1/ftp_PUB.....zip!/JOU=xxx // http://clockss-staged.clockss.org/sourcefiles/springer-delivered/2018/HD1_9/JOU_foo.zip!/JOU=xxx private Pattern JOURNAL_ID_PATTERN = Pattern.compile("/springer-[^/]+/[^/]+(?:/HD[^/]+)?/[^/]+/JOU=([0-9]+)/.+"); public SpringerSourceMetadataExtractor() { journalTitleMap = new HashMap<String, String>(); } /** * * TODO: This is legacy and I don't think it sticks around between * XML files so there wouldnt' be any way to keep track of jid-issn-title * information from extraction to extraction * without creating an ArticleMetadataExtractor and storing it between * emits... * This may have worked back before this was partially integrated with * the framework - * * Get the journal ID from from the article metadata. If not set, gets * journal id from the URL and adds it to the article metadata. * * @param url the URL of the article * @param am the article metadata of the article * @return the journalID or null if not available */ // extract journal id from cached url. // if not found (url is opaque), then assign a default value. private String getJournalId(String url, ArticleMetadata am) { String journalId = am.get(MetadataField.FIELD_PROPRIETARY_IDENTIFIER); log.debug3("getJournalId() propid journalId: " + journalId); if (StringUtil.isNullString(journalId)) { // http://clockss-ingest.lockss.org/sourcefiles/springer-released/2012/ftp_PUB_11-11-17_06-38-38.zip!/JOU=00238/VOL=2011.34/ISU=6/ART=476/BodyRef/PDF/238_2010_Article_476.pdf Matcher mat = JOURNAL_ID_PATTERN.matcher(url); if (mat.find()) { journalId = mat.group(1); log.debug3("journalId: " + journalId); am.put(MetadataField.FIELD_PROPRIETARY_IDENTIFIER, journalId); } } log.debug3("getJournalIdl() journalId: " + journalId); return (journalId); } /** * Get the journal title for the specified ArticleMetadata. If not set, * looks up cached value using issn, eissn, or journalID. If not cached, * creates one from the issn, eissn or journalID. Adds journalID to * the article metadata if not present. * * @param url the URL of the article * @param am the article metadata of the article * @return the journal title or null if not available */ private String getJournalTitle(String url, ArticleMetadata am) { String journalTitle = am.get(MetadataField.FIELD_PUBLICATION_TITLE); String journalId = getJournalId(url, am); String issn = am.get(MetadataField.FIELD_ISSN); String eissn = am.get(MetadataField.FIELD_EISSN); // journal has title -- cache using issn, eissn, and journalID // in case journal title is missing from later records if (!StringUtil.isNullString(journalTitle)) { if (!StringUtil.isNullString(issn)) { journalTitleMap.put(issn, journalTitle); } if (!StringUtil.isNullString(eissn)) { journalTitleMap.put(eissn, journalTitle); } if (!StringUtil.isNullString(journalId)) { journalTitleMap.put(journalId, journalTitle); } return journalTitle; } // journal has no title -- find it using issn, eissn, and jouranalID, // or generate a title using one of these properties otherwise String genTitle = null; // generated title fron issn, eissn or journalID try { // try ISSN as key if (!StringUtil.isNullString(issn)) { // use cached journal title for journalId journalTitle = journalTitleMap.get(issn); if (!StringUtil.isNullString(journalTitle)) { return journalTitle; } if (genTitle == null) { // generate title with issn for preference genTitle = "UNKNOWN_TITLE/issn=" + issn; } } // try eissn as key if (!StringUtil.isNullString(eissn)) { // use cached journal title for journalId journalTitle = journalTitleMap.get(eissn); if (!StringUtil.isNullString(journalTitle)) { return journalTitle; } if (genTitle == null) { // generate title with eissn if issn not available genTitle = "UNKNOWN_TITLE/eissn=" + eissn; } } // try journalId as key if (!StringUtil.isNullString(journalId)) { // use cached journal title for journalId journalTitle = journalTitleMap.get(journalId); if (!StringUtil.isNullString(journalTitle)) { return journalTitle; } if (genTitle == null) { // generate title with journalID if issn and eissn not available genTitle = "UNKNOWN_TITLE/journalId=" + journalId; } } } finally { if (StringUtil.isNullString(journalTitle)) { journalTitle = genTitle; } if (!StringUtil.isNullString(journalTitle)) { am.put(MetadataField.FIELD_PUBLICATION_TITLE, journalTitle); } log.debug3("getJournalTitle() journalTitle: " + journalTitle); } return journalTitle; } /** * Post-cook process after extraction and cooking.... */ @Override protected void postCookProcess(SourceXmlSchemaHelper schemaHelper, CachedUrl cu, ArticleMetadata thisAM) { log.debug3("postEmitProcess for cu: " + cu); // hardwire publisher for board report (look at imprints later) thisAM.put(MetadataField.FIELD_PUBLISHER, "Springer"); if (schemaHelper == journalHelper ) { // emit only if journal title exists, otherwise report site error // TODO: legacy - I'm pretty sure this is useless, but to minimize // instability as I add in books, I will leave it in for journals. String journalTitle = getJournalTitle(cu.getUrl(), thisAM); if (!StringUtil.isNullString(journalTitle)) { log.debug3("found or created a journal title"); } else { log.siteError("Missing journal title: " + cu.getUrl()); } } else { // we are a book String subT = thisAM.getRaw(SpringerBookSourceSchemaHelper.bookSubTitle); if (subT != null) { StringBuilder title_br = new StringBuilder(thisAM.get(MetadataField.FIELD_PUBLICATION_TITLE)); title_br.append(": "); title_br.append(subT); thisAM.replace(MetadataField.FIELD_PUBLICATION_TITLE, title_br.toString()); } subT = thisAM.getRaw(SpringerBookSourceSchemaHelper.chapterSubTitle); if (subT != null) { StringBuilder title_br = new StringBuilder(thisAM.get(MetadataField.FIELD_ARTICLE_TITLE)); title_br.append(": "); title_br.append(subT); thisAM.replace(MetadataField.FIELD_ARTICLE_TITLE, title_br.toString()); } if (thisAM.get(MetadataField.FIELD_AUTHOR) == null) { // too many option... try a book level info... and if not, then just move on String othergroup = thisAM.getRaw(SpringerBookSourceSchemaHelper.bookAuthorAu); if (othergroup == null) { othergroup = thisAM.getRaw(SpringerBookSourceSchemaHelper.bookAuthorEd);} if (othergroup == null) { othergroup = thisAM.getRaw(SpringerBookSourceSchemaHelper.bookAuthorCo);} if (othergroup != null) { thisAM.put(MetadataField.FIELD_AUTHOR, othergroup); } } } } /* In this case, the filename is the same as the xml filename but * in the BodyRef/PDF/ subdirectory */ @Override protected List<String> getFilenamesAssociatedWithRecord(SourceXmlSchemaHelper helper, CachedUrl cu, ArticleMetadata oneAM) { /* * Returning null indicates that we do not need to check for existence * of the pdf that maps to this metadata. * This is because our article iterator actually started by finding the PDF * and from that calculated the XML. So we already know the PDF exists * and will get set to the ACCESS_URL and FULL_TEXT_PDF */ return null; /* String xml_url = cu.getUrl(); String cuBase = FilenameUtils.getFullPath(xml_url); String filenameValue = FilenameUtils.getBaseName(xml_url); ArrayList<String> returnList = new ArrayList<String>(); log.debug3("looking for filename of: " + cuBase + "BodyRef/PDF/" + filenameValue + ".pdf"); returnList.add(cuBase + "BodyRef/PDF/" + filenameValue + ".pdf"); return returnList; */ } } // SpringerSourceMetadataExtractor } // SpringerSourceMetadataExtractorFactory
lockss/lockss-daemon
plugins/src/org/lockss/plugin/springer/SpringerSourceMetadataExtractorFactory.java
Java
bsd-3-clause
14,007
package mypackage; import org.apache.log4j.Logger; import org.apache.log4j.BasicConfigurator; public class HW { static Logger logger = Logger.getLogger(HW.class); public static void main(String [] args) { BasicConfigurator.configure(); logger.info("Hello World"); } }
moio/tetra
spec/data/ant-super-simple-code/src/mypackage/HW.java
Java
bsd-3-clause
303
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.pesegato.MonkeySheet; import com.jme3.app.Application; import com.jme3.app.state.BaseAppState; /** * * @author Pesegato */ public class MSTimerAppState extends BaseAppState{ @Override protected void initialize(Application app) { } @Override protected void cleanup(Application app) { } @Override protected void onEnable() { } @Override protected void onDisable() { } }
Pesegato/MonkeySheet
src/main/java/com/pesegato/MonkeySheet/MSTimerAppState.java
Java
bsd-3-clause
641
/* * Copyright (c) 2002-2007, Marc Prud'hommeaux. All rights reserved. * * This software is distributable under the BSD license. See the terms of the * BSD license in the documentation provided with this software. */ package jline; import jline.internal.Log; import java.io.IOException; import java.io.InputStream; /** * Provides support for {@link Terminal} instances. * * @author <a href="mailto:[email protected]">Jason Dillon</a> * @since 2.0 */ public abstract class TerminalSupport implements Terminal { public static String DEFAULT_KEYBINDINGS_PROPERTIES = "keybindings.properties"; public static final int DEFAULT_WIDTH = 80; public static final int DEFAULT_HEIGHT = 24; private Thread shutdownHook; private boolean supported; private boolean echoEnabled; private boolean ansiSupported; protected TerminalSupport(final boolean supported) { this.supported = supported; } public void init() throws Exception { installShutdownHook(new RestoreHook()); } public void restore() throws Exception { TerminalFactory.resetIf(this); removeShutdownHook(); } public void reset() throws Exception { restore(); init(); } protected void installShutdownHook(final Thread hook) { assert hook != null; if (shutdownHook != null) { throw new IllegalStateException("Shutdown hook already installed"); } try { Runtime.getRuntime().addShutdownHook(hook); shutdownHook = hook; } catch (AbstractMethodError e) { // JDK 1.3+ only method. Bummer. Log.trace("Failed to register shutdown hook: ", e); } } protected void removeShutdownHook() { if (shutdownHook != null) { try { Runtime.getRuntime().removeShutdownHook(shutdownHook); } catch (AbstractMethodError e) { // JDK 1.3+ only method. Bummer. Log.trace("Failed to remove shutdown hook: ", e); } catch (IllegalStateException e) { // The VM is shutting down, not a big deal; ignore } shutdownHook = null; } } public final boolean isSupported() { return supported; } public synchronized boolean isAnsiSupported() { return ansiSupported; } protected synchronized void setAnsiSupported(final boolean supported) { this.ansiSupported = supported; Log.debug("Ansi supported: ", supported); } public int getWidth() { return DEFAULT_WIDTH; } public int getHeight() { return DEFAULT_HEIGHT; } public synchronized boolean isEchoEnabled() { return echoEnabled; } public synchronized void setEchoEnabled(final boolean enabled) { this.echoEnabled = enabled; Log.debug("Echo enabled: ", enabled); } public int readCharacter(final InputStream in) throws IOException { return in.read(); } public int readVirtualKey(final InputStream in) throws IOException { return readCharacter(in); } public InputStream getDefaultBindings() { return TerminalSupport.class.getResourceAsStream(DEFAULT_KEYBINDINGS_PROPERTIES); } // // RestoreHook // protected class RestoreHook extends Thread { public void start() { try { restore(); } catch (Exception e) { Log.trace("Failed to restore: ", e); } } } }
gnodet/test
src/main/java/jline/TerminalSupport.java
Java
bsd-3-clause
3,654
/** * NormalizedAtomicExpression.java * --------------------------------- * Copyright (c) 2016 * RESOLVE Software Research Group * School of Computing * Clemson University * All rights reserved. * --------------------------------- * This file is subject to the terms and conditions defined in * file 'LICENSE.txt', which is part of this source code package. */ package edu.clemson.cs.r2jt.congruenceclassprover; import java.util.*; // todo: create array impl and compare. /** * Created by mike on 4/4/2014. */ public class NormalizedAtomicExpression { private final int[] m_expression; private int m_classConstant; private int arity; // number of arguments private final Registry m_registry; private Map<String, Integer> m_opMmap; private Set<Integer> m_opIdSet; private Map<String, Integer> m_argMmap; public NormalizedAtomicExpression(Registry registry, int[] intArray) { m_registry = registry; arity = intArray.length - 1; if (!m_registry.isCommutative(intArray[0])) { m_expression = intArray; } else { int[] ord = new int[arity]; for (int i = 1; i < intArray.length; ++i) { ord[i - 1] = intArray[i]; } Arrays.sort(ord); int[] ne = new int[intArray.length]; ne[0] = intArray[0]; for (int i = 0; i < ord.length; ++i) { ne[i + 1] = ord[i]; } m_expression = ne; } m_classConstant = -1; } protected int getArity() { return arity; } protected Registry getRegistry() { return m_registry; } protected Set<Integer> getOpIds() { if (m_opIdSet != null) { return m_opIdSet; } m_opIdSet = new HashSet<Integer>(); for (int i = 0; i < m_expression.length; ++i) { m_opIdSet.add(m_expression[i]); } int r = readRoot(); m_opIdSet.add(r); return m_opIdSet; } protected Map<String, Integer> getOperatorsAsStrings(boolean justArguments) { if (justArguments && m_argMmap != null) { return new HashMap<String, Integer>(m_argMmap); } if (!justArguments && m_opMmap != null) { return new HashMap<String, Integer>(m_opMmap); } m_argMmap = new HashMap<String, Integer>(); for (int i = 1; i < m_expression.length; ++i) { String curOp = readSymbol(i); if (m_argMmap.containsKey(curOp)) { m_argMmap.put(curOp, m_argMmap.get(curOp) + 1); } else m_argMmap.put(curOp, 1); } m_opMmap = new HashMap<String, Integer>(m_argMmap); String fSym = readSymbol(0); String rSym = m_registry.getSymbolForIndex(readRoot()); if (m_opMmap.containsKey(fSym)) { m_opMmap.put(fSym, m_opMmap.get(fSym) + 1); } else { m_opMmap.put(fSym, 1); } if (m_opMmap.containsKey(rSym)) { m_opMmap.put(rSym, m_opMmap.get(rSym) + 1); } else { m_opMmap.put(rSym, 1); } if (justArguments) { return new HashMap<String, Integer>(m_argMmap); } else { return new HashMap<String, Integer>(m_opMmap); } } public int readPosition(int position) { return m_expression[position]; } public String readSymbol(int position) { return m_registry.getSymbolForIndex(m_expression[position]); } // return array contains 'n' if sint is an arg used at position 'n', 0 denotes operator, -1 denotes cong class public int[] getPositionsFor(int sint) { int[] rArray = new int[arity + 2]; int count = 0; for (int i = 0; i <= arity; ++i) { if (m_expression[i] == sint) { rArray[count++] = i; } } if (readRoot() == sint) rArray[count++] = -1; return Arrays.copyOf(rArray, count); } // -1 meaning wildcard. public int[] rootedLiterals(Map<String, String> overMap, Registry vc_Reg) { int[] rArray = new int[m_expression.length + 1]; for (int i = 0; i <= m_expression.length; ++i) { int expI = (i < m_expression.length) ? m_expression[i] : m_classConstant; String k = m_registry.getSymbolForIndex(expI); String v = (overMap.containsKey(k)) ? overMap.get(k) : k; if (v.equals("")) { rArray[i] = -1; } else if (!vc_Reg.m_symbolToIndex.containsKey(v)) { return null; } else { rArray[i] = vc_Reg.getIndexForSymbol(v); } } return rArray; } // "" meaning mapped. public String[] unMappedWildcards(Map<String, String> overMap) { String[] rArray = new String[m_expression.length + 1]; for (int i = 0; i < m_expression.length; ++i) { String ks = m_registry.getSymbolForIndex(m_expression[i]); if (overMap.containsKey(ks) && overMap.get(ks).equals("")) { rArray[i] = ks; } else rArray[i] = ""; } String ks = m_registry.getSymbolForIndex(m_classConstant); if (overMap.containsKey(ks) && overMap.get(ks).equals("")) { rArray[m_expression.length] = ks; } else rArray[m_expression.length] = ""; return rArray; } public NormalizedAtomicExpression replaceOperator(int orig, int repl) { if (orig == repl) return this; if (!getOpIds().contains(orig)) { return this; } int[] na = new int[m_expression.length]; boolean changed = false; for (int i = 0; i < m_expression.length; ++i) { if (m_expression[i] == orig) { na[i] = repl; changed = true; } else na[i] = m_expression[i]; } if (readRoot() == orig) { writeToRoot(repl); } NormalizedAtomicExpression rNa = this; if (changed) { rNa = new NormalizedAtomicExpression(m_registry, na); rNa.writeToRoot(readRoot()); } assert (changed == (rNa != this)); assert changed == (rNa.hashCode() != hashCode()); return rNa; } protected void writeToRoot(int root) { m_opMmap = null; m_opIdSet = null; m_classConstant = root; } protected int readRoot() { return m_classConstant; } public NormalizedAtomicExpression rootOps() { int[] roots = new int[arity + 1]; for (int i = 0; i < roots.length; ++i) { roots[i] = m_registry.findAndCompress(m_expression[i]); } NormalizedAtomicExpression rn = new NormalizedAtomicExpression(m_registry, roots); return rn; } public boolean hasVarOps() { boolean isVar = false; for (int i = 0; i < m_expression.length; ++i) { String s = readSymbol(i); if (s.startsWith("¢v")) { isVar = true; break; } Registry.Usage us = m_registry.getUsage(s); if (us == Registry.Usage.FORALL || us == Registry.Usage.HASARGS_FORALL) { isVar = true; break; } } return isVar; } public String toString() { String r; String funcSymbol = readSymbol(0); String args = ""; for (int i = 1; i < m_expression.length; ++i) { args += readSymbol(i) + ","; } if (args.length() != 0) { args = args.substring(0, args.length() - 1); } args = "(" + args + ")"; r = funcSymbol + args; // if there is a root int root = readRoot(); if (root >= 0) { r += "=" + m_registry.getSymbolForIndex(root); } return r; } @Override public int hashCode() { return Arrays.hashCode(m_expression); } public boolean equals(Object o) { if (o instanceof NormalizedAtomicExpression) { NormalizedAtomicExpression other = (NormalizedAtomicExpression) o; if (Arrays.equals(m_expression, other.m_expression) && other.m_registry == m_registry) return true; } return false; } public int numberOfQuants() { int c = 0; for (String k : getOperatorsAsStrings(false).keySet()) { if (m_registry.getUsage(k).equals(Registry.Usage.FORALL) || m_registry.getUsage(k).equals( Registry.Usage.HASARGS_FORALL) || m_registry.getUsage(k).equals(Registry.Usage.CREATED)) { c++; } } return c; } public static class numQuantsComparator implements Comparator<NormalizedAtomicExpression> { public int compare(NormalizedAtomicExpression nae1, NormalizedAtomicExpression nae2) { return nae1.numberOfQuants() - nae2.numberOfQuants(); } } }
mikekab/RESOLVE
src/main/java/edu/clemson/cs/r2jt/congruenceclassprover/NormalizedAtomicExpression.java
Java
bsd-3-clause
9,441
package net.hearthstats.game.ocr; import net.sourceforge.tess4j.TessAPI; import java.awt.image.BufferedImage; /** * OCR for reading card names in a deck. */ public class DeckCardOcr extends OcrBase { @Override protected BufferedImage crop(BufferedImage image, int iteration) { return image; } @Override protected String parseString(String ocrResult, int iteration) { // Ignore empty or very small strings, they're too small to be a real card if (ocrResult == null || ocrResult.length() <= 3) { return ""; } else { return ocrResult.trim(); } } @Override protected boolean tryProcessingAgain(String ocrResult, int iteration) { // Only try processing the card name once return false; } @Override protected BufferedImage filter(BufferedImage image, int iteration) throws OcrException { int width = image.getWidth(); int height = image.getHeight(); int bigWidth = width * 2; int bigHeight = height * 2; BufferedImage newImage = new BufferedImage(bigWidth, bigHeight, BufferedImage.TYPE_INT_RGB); newImage.createGraphics(); // Extract only the black & white parts of the image, removing any coloured parts. This results in just the // card name being left... all of the background *should* magically disappear. // First pass: identifies which pixels are coloured, which are black & white short[][] levelArray = new short[width][height]; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { // Get the individual components of this pixel int inputRgba = image.getRGB(x, y); int red = (inputRgba >> 16) & 0xFF; int green = (inputRgba >> 8) & 0xFF; int blue = (inputRgba >> 0) & 0xFF; // If the pixel is coloured, exclude it if (Math.abs(red - green) > 1 || Math.abs(red - blue) > 1 || Math.abs(green - blue) > 1) { levelArray[x][y] = -1; } else { levelArray[x][y] = (short) red; // (255 - red); } } } // Second pass: draws a new image in black & white that excludes all the background for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { short level; // If any of the neighbouring pixels is excluded, then exclude this pixel too - this avoids orphaned pixels if (levelArray[x][y] == -1 // this pixel is excluded || (x > 0 && levelArray[x-1][y] == -1) // left pixel is excluded || (x + 1 < width && levelArray[x+1][y] == -1) // right pixel is excluded || (y > 0 && levelArray[x][y-1] == -1) // top pixel is excluded || (y + 1 < height && levelArray[x][y+1] == -1) // bottom pixel is excluded ) { level = 255; } else { level = (short) (255 - levelArray[x][y]); } int outputRgba = ((255 & 0xFF) << 24) | ((level & 0xFF) << 16) | ((level & 0xFF) << 8) | ((level & 0xFF) << 0); int x2 = x << 1; int y2 = y << 1; newImage.setRGB(x2, y2, outputRgba); newImage.setRGB(x2 + 1, y2, outputRgba); newImage.setRGB(x2, y2 + 1, outputRgba); newImage.setRGB(x2 + 1, y2 + 1, outputRgba); } } return newImage; } @Override protected String getFilename() { return null; } @Override protected int getTesseractPageSegMode(int iteration) { return TessAPI.TessPageSegMode.PSM_SINGLE_LINE; } }
HearthStats/HearthStats.net-Uploader
companion/src/main/java/net/hearthstats/game/ocr/DeckCardOcr.java
Java
bsd-3-clause
3,520
package com.cyosp.mpa.api.rest.common.exception; /** * Created by CYOSP on 2017-08-01. */ public class VersionNotSupportedException extends Exception { }
cyosp/mpa-server
src/main/java/com/cyosp/mpa/api/rest/common/exception/VersionNotSupportedException.java
Java
bsd-3-clause
157
package apps.threedinteraction.calculator; import synergynetframework.jme.cursorsystem.elements.threed.ControlPointRotateTranslateScale; import apps.threedinteraction.button.ButtonNode; import apps.threedinteraction.button.KeyListener; import apps.threedmanipulation.ThreeDManipulation; import com.jme.math.FastMath; import com.jme.math.Quaternion; import com.jme.math.Vector3f; import com.jme.scene.Node; /** * The Class CalculatorNode. */ public class CalculatorNode extends Node { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 2429175967783608868L; /** The display node. */ protected DisplayNode displayNode; /** The left number. */ protected String leftNumber = ""; /** The operator. */ protected String operator = ""; /** The right number. */ protected String rightNumber = ""; /** The text string. */ protected String textString = ""; /** * Instantiates a new calculator node. * * @param name * the name */ public CalculatorNode(String name) { super(name); init(); } /** * Clear. */ private void clear() { textString = ""; displayNode.setText(textString); leftNumber = textString; rightNumber = ""; operator = ""; } /** * Inits the. */ protected void init() { float width = 20f; float length = 30f; float height = 2f; float buttonWidth = 4f; float buttonLength = 4f; float buttonHeight = 2f; ControllerBodyNode bn = new ControllerBodyNode("Body" + name, width / 2, length / 2, height / 2, 0.1f, ThreeDManipulation.class.getResource("calculator/body.png")); this.attachChild(bn); float buttonZ = bn.getLocalTranslation().z + height; float horizontalSpace = (width - (buttonWidth * 4)) / 7; float verticalSpace = (length - (buttonLength * 1.5f) - (buttonLength * 4f)) / 9f; final DisplayNode dn = new DisplayNode("Display" + name, (width * 0.9f) / 2, (length * 7) / 60, height * 1.5f, 0.1f, ThreeDManipulation.class.getResource("calculator/body.png")); dn.setLocalTranslation( 0, ((8.5f * verticalSpace) + (4 * buttonLength) + (buttonLength / 2)) - (length / 2), bn.getLocalTranslation().z + 0.5f); this.attachChild(dn); displayNode = dn; Quaternion tq = new Quaternion(); tq.fromAngleAxis(FastMath.PI / 12f, new Vector3f(1, 0, 0)); dn.setLocalRotation(tq); dn.updateGeometricState(0f, false); // row 1 ButtonNode buttonNode0 = new ButtonNode( "0" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class.getResource("calculator/button0.png")); buttonNode0.setLocalTranslation( ((2 * horizontalSpace) + (buttonWidth / 2)) - (width / 2), ((2 * verticalSpace) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNode0.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "0"; dn.setText(textString); if (operator.equals("")) { leftNumber = leftNumber + "0"; } else { rightNumber = rightNumber + "0"; } } }); this.attachChild(buttonNode0); ButtonNode buttonNodeDot = new ButtonNode( "." + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class .getResource("calculator/buttondot.png")); buttonNodeDot.setLocalTranslation( ((3 * horizontalSpace) + buttonWidth + (buttonWidth / 2)) - (width / 2), ((2 * verticalSpace) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNodeDot.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "."; dn.setText(textString); if (operator.equals("")) { leftNumber = leftNumber + "."; } else { rightNumber = rightNumber + "."; } } }); this.attachChild(buttonNodeDot); ButtonNode buttonNodeResult = new ButtonNode( "=" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class .getResource("calculator/buttonresult.png")); buttonNodeResult.setLocalTranslation(((4 * horizontalSpace) + (2 * buttonWidth) + (buttonWidth / 2)) - (width / 2), ((2 * verticalSpace) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNodeResult.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { if (leftNumber.equals("")) { clear(); return; } if (rightNumber.equals("")) { clear(); return; } if (operator.equals("")) { clear(); return; } double left = 0; double right = 0; double result = 0; if (isFloat(leftNumber) || isInteger(leftNumber)) { left = Double.parseDouble(leftNumber); } else { clear(); return; } if (isFloat(rightNumber) || isInteger(rightNumber)) { right = Double.parseDouble(rightNumber); } else { clear(); return; } if (operator.equals("+")) { result = left + right; } else if (operator.equals("-")) { result = left - right; } else if (operator.equals("*")) { result = left * right; } else if (operator.equals("/")) { if (right == 0) { clear(); return; } result = left / right; } result = Math.round(result * 100); result = result / 100; clear(); textString = "" + result; leftNumber = textString; dn.setText(textString); } }); this.attachChild(buttonNodeResult); ButtonNode buttonNodeDivide = new ButtonNode( "/" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class .getResource("calculator/buttondivide.png")); buttonNodeDivide.setLocalTranslation(((5 * horizontalSpace) + (3 * buttonWidth) + (buttonWidth / 2)) - (width / 2), ((2 * verticalSpace) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNodeDivide.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "/"; dn.setText(textString); operator = "/"; } }); this.attachChild(buttonNodeDivide); // row 2 ButtonNode buttonNode1 = new ButtonNode( "1" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class.getResource("calculator/button1.png")); buttonNode1.setLocalTranslation( ((2 * horizontalSpace) + (buttonWidth / 2)) - (width / 2), ((3 * verticalSpace) + buttonLength + (buttonLength / 2)) - (length / 2), buttonZ); buttonNode1.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "1"; dn.setText(textString); if (operator.equals("")) { leftNumber = leftNumber + "1"; } else { rightNumber = rightNumber + "1"; } } }); this.attachChild(buttonNode1); ButtonNode buttonNode2 = new ButtonNode( "2" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class.getResource("calculator/button2.png")); buttonNode2.setLocalTranslation( ((3 * horizontalSpace) + buttonWidth + (buttonWidth / 2)) - (width / 2), ((3 * verticalSpace) + buttonLength + (buttonLength / 2)) - (length / 2), buttonZ); buttonNode2.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "2"; dn.setText(textString); if (operator.equals("")) { leftNumber = leftNumber + "2"; } else { rightNumber = rightNumber + "2"; } } }); this.attachChild(buttonNode2); ButtonNode buttonNode3 = new ButtonNode( "3" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class.getResource("calculator/button3.png")); buttonNode3.setLocalTranslation(((4 * horizontalSpace) + (2 * buttonWidth) + (buttonWidth / 2)) - (width / 2), ((3 * verticalSpace) + buttonLength + (buttonLength / 2)) - (length / 2), buttonZ); buttonNode3.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "3"; dn.setText(textString); if (operator.equals("")) { leftNumber = leftNumber + "3"; } else { rightNumber = rightNumber + "3"; } } }); this.attachChild(buttonNode3); ButtonNode buttonNodeMultiply = new ButtonNode( "*" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class .getResource("calculator/buttonmultiply.png")); buttonNodeMultiply.setLocalTranslation(((5 * horizontalSpace) + (3 * buttonWidth) + (buttonWidth / 2)) - (width / 2), ((3 * verticalSpace) + buttonLength + (buttonLength / 2)) - (length / 2), buttonZ); buttonNodeMultiply.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "*"; dn.setText(textString); operator = "*"; } }); this.attachChild(buttonNodeMultiply); // row 3 ButtonNode buttonNode4 = new ButtonNode( "4" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class.getResource("calculator/button4.png")); buttonNode4.setLocalTranslation( ((2 * horizontalSpace) + (buttonWidth / 2)) - (width / 2), ((4 * verticalSpace) + (2 * buttonLength) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNode4.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "4"; dn.setText(textString); if (operator.equals("")) { leftNumber = leftNumber + "4"; } else { rightNumber = rightNumber + "4"; } } }); this.attachChild(buttonNode4); ButtonNode buttonNode5 = new ButtonNode( "5" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class.getResource("calculator/button5.png")); buttonNode5.setLocalTranslation( ((3 * horizontalSpace) + buttonWidth + (buttonWidth / 2)) - (width / 2), ((4 * verticalSpace) + (2 * buttonLength) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNode5.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "5"; dn.setText(textString); if (operator.equals("")) { leftNumber = leftNumber + "5"; } else { rightNumber = rightNumber + "5"; } } }); this.attachChild(buttonNode5); ButtonNode buttonNode6 = new ButtonNode( "6" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class.getResource("calculator/button6.png")); buttonNode6.setLocalTranslation(((4 * horizontalSpace) + (2 * buttonWidth) + (buttonWidth / 2)) - (width / 2), ((4 * verticalSpace) + (2 * buttonLength) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNode6.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "6"; dn.setText(textString); if (operator.equals("")) { leftNumber = leftNumber + "6"; } else { rightNumber = rightNumber + "6"; } } }); this.attachChild(buttonNode6); ButtonNode buttonNodeSubstract = new ButtonNode( "-" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class .getResource("calculator/buttonsubstract.png")); buttonNodeSubstract.setLocalTranslation(((5 * horizontalSpace) + (3 * buttonWidth) + (buttonWidth / 2)) - (width / 2), ((4 * verticalSpace) + (2 * buttonLength) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNodeSubstract.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "-"; dn.setText(textString); if (!leftNumber.equals("")) { operator = "-"; } else { leftNumber = leftNumber + "-"; } } }); this.attachChild(buttonNodeSubstract); // row 4 ButtonNode buttonNode7 = new ButtonNode( "7" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class.getResource("calculator/button7.png")); buttonNode7.setLocalTranslation( ((2 * horizontalSpace) + (buttonWidth / 2)) - (width / 2), ((5 * verticalSpace) + (3 * buttonLength) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNode7.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "7"; dn.setText(textString); if (operator.equals("")) { leftNumber = leftNumber + "7"; } else { rightNumber = rightNumber + "7"; } } }); this.attachChild(buttonNode7); ButtonNode buttonNode8 = new ButtonNode( "8" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class.getResource("calculator/button8.png")); buttonNode8.setLocalTranslation( ((3 * horizontalSpace) + buttonWidth + (buttonWidth / 2)) - (width / 2), ((5 * verticalSpace) + (3 * buttonLength) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNode8.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "8"; dn.setText(textString); if (operator.equals("")) { leftNumber = leftNumber + "8"; } else { rightNumber = rightNumber + "8"; } } }); this.attachChild(buttonNode8); ButtonNode buttonNode9 = new ButtonNode( "9" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class.getResource("calculator/button9.png")); buttonNode9.setLocalTranslation(((4 * horizontalSpace) + (2 * buttonWidth) + (buttonWidth / 2)) - (width / 2), ((5 * verticalSpace) + (3 * buttonLength) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNode9.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "9"; dn.setText(textString); if (operator.equals("")) { leftNumber = leftNumber + "9"; } else { rightNumber = rightNumber + "9"; } } }); this.attachChild(buttonNode9); ButtonNode buttonNodePlus = new ButtonNode( "+" + name, buttonWidth / 2, buttonLength / 2, buttonHeight / 2, 0.05f, ThreeDManipulation.class.getResource("calculator/buttonBg.png"), ThreeDManipulation.class .getResource("calculator/buttonplus.png")); buttonNodePlus.setLocalTranslation(((5 * horizontalSpace) + (3 * buttonWidth) + (buttonWidth / 2)) - (width / 2), ((5 * verticalSpace) + (3 * buttonLength) + (buttonLength / 2)) - (length / 2), buttonZ); buttonNodePlus.addKeyListener(new KeyListener() { @Override public void keyPressed(String key) { textString += "+"; dn.setText(textString); operator = "+"; } }); this.attachChild(buttonNodePlus); ControlPointRotateTranslateScale cprts = new ControlPointRotateTranslateScale( dn.getDisplayQuad(), this); cprts.setPickMeOnly(true); } /** * Checks if is float. * * @param number * the number * @return true, if is float */ private boolean isFloat(String number) { try { Double.parseDouble(number); } catch (NumberFormatException e) { return false; } return true; } /** * Checks if is integer. * * @param number * the number * @return true, if is integer */ private boolean isInteger(String number) { try { Integer.parseInt(number); } catch (NumberFormatException e) { return false; } return true; } }
synergynet/synergynet2.5
synergynet2.5/src/main/java/apps/threedinteraction/calculator/CalculatorNode.java
Java
bsd-3-clause
17,343
package net.minidev.ovh.api.hosting.web.freedom; /** * Available status for freedoms */ public enum OvhStatusEnum { blockedByCustomer("blockedByCustomer"), blockedBySystem("blockedBySystem"), ok("ok"), preset("preset"); final String value; OvhStatusEnum(String s) { this.value = s; } public String toString() { return this.value; } }
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/hosting/web/freedom/OvhStatusEnum.java
Java
bsd-3-clause
353
// RobotBuilder Version: 1.5 // // This file was generated by RobotBuilder. It contains sections of // code that are automatically generated and assigned by robotbuilder. // These sections will be updated in the future when you export to // Java from RobotBuilder. Do not put any code or make any change in // the blocks indicating autogenerated code or it will be lost on an // update. Deleting the comments indicating the section will prevent // it from being updated in the future. package org.usfirst.frc3467.Robot2015.subsystems; import org.usfirst.frc3467.Robot2015.OI; import org.usfirst.frc3467.Robot2015.RobotMap; import org.usfirst.frc3467.Robot2015.commands.*; import edu.wpi.first.wpilibj.*; import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; /** * */ @SuppressWarnings("unused") public class DriveBase extends Subsystem { // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS static SpeedController speedController1 = RobotMap.driveBaseSpeedController1; static SpeedController speedController2 = RobotMap.driveBaseSpeedController2; static SpeedController speedController3 = RobotMap.driveBaseSpeedController3; static SpeedController speedController4 = RobotMap.driveBaseSpeedController4; static RobotDrive robotDrive41 = RobotMap.driveBaseRobotDrive41; static Gyro gyro1 = RobotMap.driveBaseGyro1; // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS // Put methods for controlling this subsystem // here. Call these from Commands. public void initDefaultCommand() { // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND // Set the default command for a subsystem here. //setDefaultCommand(new MySpecialCommand()); } public static void driveRobotOrientedMecanumJames(){ RobotMap.driveBaseRobotDrive41.mecanumDrive_Cartesian(-((OI.stick1.getX())+(OI.stick2.getX()))/2, ((OI.stick1.getY())+(OI.stick2.getY()))/2, OI.stick1.getY()-OI.stick2.getY(), 0 ); //uses joystick 1 X and Y for x and y movement and joystick 2 x for rotation } public static void driveRobotOrientedMecanum(){ RobotMap.driveBaseRobotDrive41.mecanumDrive_Cartesian(-(OI.stick1.getX()), (OI.stick1.getY()), (OI.stick1.getZ())*Math.abs((OI.stick1.getZ())) / (2), 0 ); //at this point this is the equivalent of driveRobotOrientedmMecanum, code to get gyro angle is not in place } public static void driveFieldOrientedMecanum(){ RobotMap.driveBaseRobotDrive41.mecanumDrive_Cartesian(-(OI.stick1.getX()), (OI.stick1.getY()), (OI.stick1.getZ())*Math.abs((OI.stick1.getZ())) / (2), -(gyro1.getAngle()) ); //at this point this is the equivalent of driveRobotOrientedmMecanum, code to get gyro angle is not in place } public static void turnToAngle(int Angle){ while(Math.abs((((gyro1.getAngle()%360)+360)%360 - Angle)) > 5){ robotDrive41.drive(1, 0); } while(Math.abs((((gyro1.getAngle()%360)+360)%360 - Angle)) > 2){ robotDrive41.drive(-0.5, 0); } speedController1.set(0); speedController2.set(0); speedController3.set(0); speedController4.set(0); } public static void driveStraight() { RobotMap.driveBaseRobotDrive41.drive(-1.0, gyro1.getAngle() * -360); } }
Naching/Skip-5.6
src/org/usfirst/frc3467/Robot2015/subsystems/DriveBase.java
Java
bsd-3-clause
3,444
import org.antlr.v4.misc.OrderedHashMap; import java.util.Map; public class PropertyFileLoader extends PropertyFileBaseListener { public Map<String, String> props = new OrderedHashMap<String, String>(); public void exitProp(PropertyFileParser.PropContext ctx) { String id = ctx.ID().getText(); // Rule is prop : ID '=' STRING '\n' ; String value = ctx.STRING().getText(); props.put(id, value); } }
parrt/cs652
labs/listener/src/PropertyFileLoader.java
Java
bsd-3-clause
409
package bio.terra.cli.businessobject; import bio.terra.cli.exception.UserActionableException; import bio.terra.cli.service.SamService; import bio.terra.cli.service.SamService.GroupPolicy; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.broadinstitute.dsde.workbench.client.sam.model.ManagedGroupMembershipEntry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Internal representation of a SAM group. This class is not part of the current context or state. */ public class Group { private static final Logger logger = LoggerFactory.getLogger(Group.class); private String name; private String email; private List<GroupPolicy> currentUserPolicies; private Group(String name, String email, List<GroupPolicy> currentUserPolicies) { this.name = name; this.email = email; this.currentUserPolicies = currentUserPolicies; } /** Create a new SAM group. */ public static Group create(String name) { SamService.fromContext().createGroup(name); logger.info("Created group: name={}", name); return get(name); } /** Delete a SAM group. */ public void delete() { SamService.fromContext().deleteGroup(name); logger.info("Deleted group: name={}", name); } /** * Get the group object. * * @throws UserActionableException if the group is not found */ public static Group get(String name) { Group foundGroup = listGroupsInMap().get(name); if (foundGroup == null) { throw new UserActionableException("No group found with this name: " + name); } return foundGroup; } /** * List the groups of which the current user is a member. * * @return a list of groups */ public static List<Group> list() { return listGroupsInMap().values().stream().collect(Collectors.toList()); } /** * Get the groups in a map, to make it easy to lookup a particular group. * * @return a map of name -> group object */ private static Map<String, Group> listGroupsInMap() { // call SAM to get the list of groups the user is a member of List<ManagedGroupMembershipEntry> groupsToPolicies = SamService.fromContext().listGroups(); // convert the SAM objects (group -> policy) to CLI objects (group -> list of policies) Map<String, Group> nameToGroup = new HashMap<>(); for (ManagedGroupMembershipEntry groupToPolicy : groupsToPolicies) { String name = groupToPolicy.getGroupName(); String email = groupToPolicy.getGroupEmail(); Group group = nameToGroup.get(name); if (group == null) { group = new Group(name, email, new ArrayList<>()); nameToGroup.put(name, group); } GroupPolicy currentUserPolicy = GroupPolicy.fromSamPolicy(groupToPolicy.getRole()); group.addCurrentUserPolicy(currentUserPolicy); } return nameToGroup; } /** * Internal representation of a group member (i.e. someone who is a member of a SAM group). This * is different from a regular {@link User} because they are never logged in. This is just a * reference to another Terra user who has some group membership. This class is not part of the * current context or state. */ public static class Member { private String email; private List<GroupPolicy> policies; private Member(String email, List<GroupPolicy> policies) { this.email = email; this.policies = policies; } public String getEmail() { return email; } public List<GroupPolicy> getPolicies() { return policies; } public void addPolicy(GroupPolicy policy) { policies.add(policy); } } /** * Add a member to a SAM group. * * @param email email of the user to add * @param policy policy to assign the user */ public Member addPolicyToMember(String email, GroupPolicy policy) { // call SAM to add a policy + email to the group SamService.fromContext().addUserToGroup(name, policy, email); logger.info("Added user to group: group={}, email={}, policy={}", name, email, policy); // return a GroupMember = email + all policies (not just the one that was added here) return getMember(email); } /** * Remove a member from a SAM group policy. * * @param email email of the user to remove * @param policy policy to remove from the user */ public void removePolicyFromMember(String email, GroupPolicy policy) { // check that the email is a group member getMember(email); // call SAM to remove a policy + email from the group SamService.fromContext().removeUserFromGroup(name, policy, email); logger.info("Removed user from group: group={}, email={}, policy={}", name, email, policy); } /** * Get the group member object. * * @throws UserActionableException if the member is not found */ public Member getMember(String email) { // lowercase the email so there is a consistent way of looking up the email address // the email address casing in SAM may not match the case of what is provided by the user Member foundMember = listMembersByEmail().get(email.toLowerCase()); if (foundMember == null) { throw new UserActionableException("No group member found with this email: " + email); } return foundMember; } /** List the members of the group. */ public List<Member> getMembers() { return listMembersByEmail().values().stream().collect(Collectors.toList()); } /** * Get the members of a group in a map, to make it easy to lookup a particular user. * * @return a map of email -> group member object */ private Map<String, Member> listMembersByEmail() { // call SAM to get the emails + policies for the group // convert the SAM objects (policy -> list of emails) to CLI objects (email -> list of policies) Map<String, Member> groupMembers = new HashMap<>(); for (GroupPolicy policy : GroupPolicy.values()) { List<String> emailsWithPolicy = SamService.fromContext().listUsersInGroup(name, policy); for (String email : emailsWithPolicy) { // lowercase the email so there is a consistent way of looking up the email address // the email address casing in SAM may not match the case of what is provided by the // user String emailLowercase = email.toLowerCase(); Member groupMember = groupMembers.get(emailLowercase); if (groupMember == null) { groupMember = new Member(emailLowercase, new ArrayList<>()); groupMembers.put(emailLowercase, groupMember); } groupMember.addPolicy(policy); } } return groupMembers; } // ==================================================== // Property getters. public String getName() { return name; } public String getEmail() { return email; } public List<GroupPolicy> getCurrentUserPolicies() { return currentUserPolicies; } public void addCurrentUserPolicy(GroupPolicy policy) { currentUserPolicies.add(policy); } }
DataBiosphere/terra-cli
src/main/java/bio/terra/cli/businessobject/Group.java
Java
bsd-3-clause
7,073
// Generated source package org.jetbrains.wip.protocol.runtime; /** * Id of an execution context. */ public class ExecutionContextIdTypedef { /** * The class is 'typedef'. It merely holds a type javadoc and its only field refers to an actual type */ int actualType; }
develar/chromedevtools
wip/protocol-model/generated/org/jetbrains/wip/protocol/runtime/ExecutionContextIdTypedef.java
Java
bsd-3-clause
281
package ciir.jfoley.chai.classifier; import ciir.jfoley.chai.collections.Pair; import ciir.jfoley.chai.collections.util.ListFns; import java.util.Comparator; import java.util.List; /** * @author jfoley */ public class RankingMeasures { public enum TieBreaking { WORST_CASE, // if we assume all ties are broken in the worst way (positives lowest in ranking) BEST_CASE // if we assume all ties are broken in the best way (positives highest in ranking) } public static Comparator<PredTruth> getComparator(TieBreaking kind) { switch (kind) { case WORST_CASE: return PredTruth.scoreTiesWorstCase; case BEST_CASE: return PredTruth.scoreTiesBestCase; default: throw new IllegalArgumentException(kind.toString()); } } public static double computeRR(List<Pair<Boolean, Double>> inPoints) { if(inPoints.size() == 0) { return 0.0; } List<PredTruth> points = ListFns.map(inPoints, PredTruth::new); // order by prediction confidence: points.sort(getComparator(TieBreaking.WORST_CASE)); for (int i = 0; i < points.size(); i++) { if (points.get(i).truth) { return 1.0 / (i+1); } } return 0.0; } /** * Note still a lingering issue w.r.t. how to break ties. This is okay because in practice, w.r.t. to classification instances, it is really unlikely that we will find ties. * TieBreaking can now be manually specified, default to WORST_CASE "pessimistic", because truly anything we predict from the set of instances with equal scores will just be luck. Should not reward our AUC with this. * @param inPoints list of (true judgment, score) pairs * @return area under the ROC curve, estimated by trapezoidal approx. */ public static double computeAUC(List<Pair<Boolean, Double>> inPoints) { return computeAUC(inPoints, TieBreaking.WORST_CASE); } /** * @param inPoints list of (true judgment, score) pairs * @param what method of tie-braking (generates a comparator) * @return area under the ROC curve, estimated by trapezoidal approx. */ public static double computeAUC(List<Pair<Boolean, Double>> inPoints, TieBreaking what) { if(inPoints.size() < 2) { throw new UnsupportedOperationException("Cannot compute AUC without at least two points."); } //List<Pair<Boolean, Double>> points = new ArrayList<>(inPoints); List<PredTruth> points = ListFns.map(inPoints, PredTruth::new); // order by prediction confidence: points.sort(getComparator(what)); double[] true_pos_rate = new double[points.size()]; double[] false_pos_rate = new double[points.size()]; int total_true_pos = 0; int total_false_pos = 0; for (PredTruth point : points) { if(point.truth) total_true_pos++; else total_false_pos++; } // walk the ranked list and build graph: int true_pos = 0; int false_pos = 0; for (int i = 0; i < points.size(); i++) { if(points.get(i).truth) { true_pos++; } else { false_pos++; } double N = i+1; true_pos_rate[i] = true_pos / (double) total_true_pos; false_pos_rate[i] = false_pos / (double) total_false_pos; } // estimate area under the curve using the trapezoidal rule, as SciKitLearn does via np.trapz final double[] y = true_pos_rate; final double[] x = false_pos_rate; int lim = x.length-1; double sum = 0; for (int i = 0; i < lim; i++) { double dx = x[i+1]-x[i]; double midy = (y[i+1]+y[i]); // div 2 hoisted to end sum += dx*midy; } return sum / 2.0; } public static double maximizeAccuracy(List<Pair<Boolean, Double>> inPoints) { return maximizeAccuracy(inPoints, TieBreaking.WORST_CASE); } /** Returns a cutoff that maximizes accuracy. */ public static double maximizeAccuracy(List<Pair<Boolean, Double>> inPoints, TieBreaking kind) { List<PredTruth> points = ListFns.map(inPoints, PredTruth::new); // order by prediction confidence: points.sort(getComparator(kind)); double[] acc = new double[points.size()]; for (int i = 0; i < points.size(); i++) { BinaryClassifierInfo info = new BinaryClassifierInfo(); for (int j = 0; j < points.size(); j++) { if(j <= i) { info.update(true, points.get(j).truth); } else { info.update(false, points.get(j).truth); } } acc[i] = info.getAccuracy(); } int best_index = 0; double maxAcc = 0; for (int i = 0; i < acc.length; i++) { if(acc[i] > maxAcc) { maxAcc = acc[i]; best_index = i; } } //System.out.println("Best F1: "+maxF1+" at rank="+(best_index+1)); int lhs = best_index; int rhs = best_index+1; if(rhs >= points.size()) { double leftleft = points.get(lhs-1).prediction; double here = points.get(lhs).prediction; double diff = leftleft - here; return here - diff; } else { return (points.get(lhs).prediction + points.get(rhs).prediction) / 2.0; } } public static double maximizeF1(List<Pair<Boolean, Double>> inPoints) { return maximizeFScore(inPoints, 1.0); } public static double maximizeFScore(List<Pair<Boolean, Double>> inPoints, double beta) { List<PredTruth> points = ListFns.map(inPoints, PredTruth::new); // order by prediction confidence: points.sort(getComparator(TieBreaking.WORST_CASE)); int total_true_pos = 0; for (PredTruth point : points) { if(point.truth) total_true_pos++; } double[] f1 = new double[points.size()]; double betaSq = beta * beta; int true_pos = 0; for (int i = 0; i < points.size(); i++) { if (points.get(i).truth) { true_pos++; } double k = i + 1; if(true_pos == 0) { f1[i] = 0; } else { double prec_k = true_pos / k; double recall_k = true_pos / (double) total_true_pos; f1[i] = (1.0 + betaSq) * (prec_k * recall_k) / ((betaSq * prec_k) + recall_k); } } int best_index = 0; double maxF1 = 0; for (int i = 0; i < f1.length; i++) { if(f1[i] > maxF1) { maxF1 = f1[i]; best_index = i; } } //System.out.println("Best F1: "+maxF1+" at rank="+(best_index+1)); int lhs = best_index; int rhs = best_index+1; if(rhs >= points.size()) { double leftleft = points.get(lhs-1).prediction; double here = points.get(lhs).prediction; double diff = leftleft - here; return here - diff; } else { return (points.get(lhs).prediction + points.get(rhs).prediction) / 2.0; } } public static double computePrec(List<Pair<Boolean, Double>> data, int cutoff) { List<PredTruth> points = ListFns.map(data, PredTruth::new); // order by prediction confidence: points.sort(getComparator(TieBreaking.WORST_CASE)); int N = Math.min(cutoff, data.size()); int correct = 0; for (int i = 0; i < N; i++) { if(data.get(i).left) { correct++; } } if(correct == 0) return 0; return correct / (double) N; } public static double computeAP(List<Pair<Boolean, Double>> data) { return computeAP(data, TieBreaking.WORST_CASE); } public static double computeAP(List<Pair<Boolean, Double>> data, TieBreaking kind) { int numRelevant = 0; for (Pair<Boolean, Double> booleanDoublePair : data) { if(booleanDoublePair.left) numRelevant++; } return computeAP(data, numRelevant, kind); } public static double computeAP(List<Pair<Boolean, Double>> data, int numRelevant) { return computeAP(data, numRelevant, TieBreaking.WORST_CASE); } public static double computeAP(List<Pair<Boolean, Double>> data, int numRelevant,TieBreaking kind) { // if there are no relevant documents, // the average is artificially defined as zero, to mimic trec_eval // Really, the output is NaN, or the query should be ignored. if(numRelevant == 0) return 0; List<PredTruth> points = ListFns.map(data, PredTruth::new); // order by prediction confidence: points.sort(getComparator(kind)); double sumPrecision = 0; int recallPointCount = 0; for (int i = 0; i < points.size(); i++) { PredTruth point = points.get(i); if(point.truth) { double rank = i + 1; recallPointCount++; sumPrecision += recallPointCount / rank; } } return sumPrecision / numRelevant; } public static class PredTruth { boolean truth; double prediction; public PredTruth(Pair<Boolean, Double> input) { this(input.left, input.right); } public PredTruth(boolean truth, double prediction) { this.truth = truth; this.prediction = prediction; } public static Comparator<PredTruth> scoreTiesWorstCase = (o1, o2) -> { // highest scores first: int score = -Double.compare(o1.prediction, o2.prediction); if(score != 0) return score; // false, then true: return Boolean.compare(o1.truth, o2.truth); }; public static Comparator<PredTruth> scoreTiesBestCase = (o1, o2) -> { // highest scores first: int score = -Double.compare(o1.prediction, o2.prediction); if(score != 0) return score; // true, then false: return -Boolean.compare(o1.truth, o2.truth); }; } }
jjfiv/chai
src/main/java/ciir/jfoley/chai/classifier/RankingMeasures.java
Java
bsd-3-clause
9,372
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.vulkan; import javax.annotation.*; import java.nio.*; import org.lwjgl.*; import org.lwjgl.system.*; import static org.lwjgl.system.Checks.*; import static org.lwjgl.system.MemoryUtil.*; import static org.lwjgl.system.MemoryStack.*; import org.lwjgl.vulkan.video.*; /** * Structure specifies H.264 decode DPB picture information. * * <h5>Valid Usage (Implicit)</h5> * * <ul> * <li>{@code sType} <b>must</b> be {@link EXTVideoDecodeH264#VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT}</li> * <li>{@code pStdReferenceInfo} <b>must</b> be a valid pointer to a valid {@code StdVideoDecodeH264ReferenceInfo} value</li> * </ul> * * <h3>Layout</h3> * * <pre><code> * struct VkVideoDecodeH264DpbSlotInfoEXT { * VkStructureType {@link #sType}; * void const * pNext; * {@link StdVideoDecodeH264ReferenceInfo StdVideoDecodeH264ReferenceInfo} const * {@link #pStdReferenceInfo}; * }</code></pre> */ public class VkVideoDecodeH264DpbSlotInfoEXT extends Struct implements NativeResource { /** The struct size in bytes. */ public static final int SIZEOF; /** The struct alignment in bytes. */ public static final int ALIGNOF; /** The struct member offsets. */ public static final int STYPE, PNEXT, PSTDREFERENCEINFO; static { Layout layout = __struct( __member(4), __member(POINTER_SIZE), __member(POINTER_SIZE) ); SIZEOF = layout.getSize(); ALIGNOF = layout.getAlignment(); STYPE = layout.offsetof(0); PNEXT = layout.offsetof(1); PSTDREFERENCEINFO = layout.offsetof(2); } /** * Creates a {@code VkVideoDecodeH264DpbSlotInfoEXT} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be * visible to the struct instance and vice versa. * * <p>The created instance holds a strong reference to the container object.</p> */ public VkVideoDecodeH264DpbSlotInfoEXT(ByteBuffer container) { super(memAddress(container), __checkContainer(container, SIZEOF)); } @Override public int sizeof() { return SIZEOF; } /** the type of this structure. */ @NativeType("VkStructureType") public int sType() { return nsType(address()); } /** @return the value of the {@code pNext} field. */ @NativeType("void const *") public long pNext() { return npNext(address()); } /** a pointer to a {@code StdVideoDecodeH264ReferenceInfo} structure specifying the codec standard specific picture reference information from the H.264 specification. */ @NativeType("StdVideoDecodeH264ReferenceInfo const *") public StdVideoDecodeH264ReferenceInfo pStdReferenceInfo() { return npStdReferenceInfo(address()); } /** Sets the specified value to the {@link #sType} field. */ public VkVideoDecodeH264DpbSlotInfoEXT sType(@NativeType("VkStructureType") int value) { nsType(address(), value); return this; } /** Sets the {@link EXTVideoDecodeH264#VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT} value to the {@link #sType} field. */ public VkVideoDecodeH264DpbSlotInfoEXT sType$Default() { return sType(EXTVideoDecodeH264.VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT); } /** Sets the specified value to the {@code pNext} field. */ public VkVideoDecodeH264DpbSlotInfoEXT pNext(@NativeType("void const *") long value) { npNext(address(), value); return this; } /** Sets the address of the specified {@link StdVideoDecodeH264ReferenceInfo} to the {@link #pStdReferenceInfo} field. */ public VkVideoDecodeH264DpbSlotInfoEXT pStdReferenceInfo(@NativeType("StdVideoDecodeH264ReferenceInfo const *") StdVideoDecodeH264ReferenceInfo value) { npStdReferenceInfo(address(), value); return this; } /** Initializes this struct with the specified values. */ public VkVideoDecodeH264DpbSlotInfoEXT set( int sType, long pNext, StdVideoDecodeH264ReferenceInfo pStdReferenceInfo ) { sType(sType); pNext(pNext); pStdReferenceInfo(pStdReferenceInfo); return this; } /** * Copies the specified struct data to this struct. * * @param src the source struct * * @return this struct */ public VkVideoDecodeH264DpbSlotInfoEXT set(VkVideoDecodeH264DpbSlotInfoEXT src) { memCopy(src.address(), address(), SIZEOF); return this; } // ----------------------------------- /** Returns a new {@code VkVideoDecodeH264DpbSlotInfoEXT} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */ public static VkVideoDecodeH264DpbSlotInfoEXT malloc() { return wrap(VkVideoDecodeH264DpbSlotInfoEXT.class, nmemAllocChecked(SIZEOF)); } /** Returns a new {@code VkVideoDecodeH264DpbSlotInfoEXT} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */ public static VkVideoDecodeH264DpbSlotInfoEXT calloc() { return wrap(VkVideoDecodeH264DpbSlotInfoEXT.class, nmemCallocChecked(1, SIZEOF)); } /** Returns a new {@code VkVideoDecodeH264DpbSlotInfoEXT} instance allocated with {@link BufferUtils}. */ public static VkVideoDecodeH264DpbSlotInfoEXT create() { ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF); return wrap(VkVideoDecodeH264DpbSlotInfoEXT.class, memAddress(container), container); } /** Returns a new {@code VkVideoDecodeH264DpbSlotInfoEXT} instance for the specified memory address. */ public static VkVideoDecodeH264DpbSlotInfoEXT create(long address) { return wrap(VkVideoDecodeH264DpbSlotInfoEXT.class, address); } /** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static VkVideoDecodeH264DpbSlotInfoEXT createSafe(long address) { return address == NULL ? null : wrap(VkVideoDecodeH264DpbSlotInfoEXT.class, address); } /** * Returns a new {@link VkVideoDecodeH264DpbSlotInfoEXT.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static VkVideoDecodeH264DpbSlotInfoEXT.Buffer malloc(int capacity) { return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity); } /** * Returns a new {@link VkVideoDecodeH264DpbSlotInfoEXT.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static VkVideoDecodeH264DpbSlotInfoEXT.Buffer calloc(int capacity) { return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity); } /** * Returns a new {@link VkVideoDecodeH264DpbSlotInfoEXT.Buffer} instance allocated with {@link BufferUtils}. * * @param capacity the buffer capacity */ public static VkVideoDecodeH264DpbSlotInfoEXT.Buffer create(int capacity) { ByteBuffer container = __create(capacity, SIZEOF); return wrap(Buffer.class, memAddress(container), capacity, container); } /** * Create a {@link VkVideoDecodeH264DpbSlotInfoEXT.Buffer} instance at the specified memory. * * @param address the memory address * @param capacity the buffer capacity */ public static VkVideoDecodeH264DpbSlotInfoEXT.Buffer create(long address, int capacity) { return wrap(Buffer.class, address, capacity); } /** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static VkVideoDecodeH264DpbSlotInfoEXT.Buffer createSafe(long address, int capacity) { return address == NULL ? null : wrap(Buffer.class, address, capacity); } /** * Returns a new {@code VkVideoDecodeH264DpbSlotInfoEXT} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate */ public static VkVideoDecodeH264DpbSlotInfoEXT malloc(MemoryStack stack) { return wrap(VkVideoDecodeH264DpbSlotInfoEXT.class, stack.nmalloc(ALIGNOF, SIZEOF)); } /** * Returns a new {@code VkVideoDecodeH264DpbSlotInfoEXT} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate */ public static VkVideoDecodeH264DpbSlotInfoEXT calloc(MemoryStack stack) { return wrap(VkVideoDecodeH264DpbSlotInfoEXT.class, stack.ncalloc(ALIGNOF, 1, SIZEOF)); } /** * Returns a new {@link VkVideoDecodeH264DpbSlotInfoEXT.Buffer} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static VkVideoDecodeH264DpbSlotInfoEXT.Buffer malloc(int capacity, MemoryStack stack) { return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity); } /** * Returns a new {@link VkVideoDecodeH264DpbSlotInfoEXT.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static VkVideoDecodeH264DpbSlotInfoEXT.Buffer calloc(int capacity, MemoryStack stack) { return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity); } // ----------------------------------- /** Unsafe version of {@link #sType}. */ public static int nsType(long struct) { return UNSAFE.getInt(null, struct + VkVideoDecodeH264DpbSlotInfoEXT.STYPE); } /** Unsafe version of {@link #pNext}. */ public static long npNext(long struct) { return memGetAddress(struct + VkVideoDecodeH264DpbSlotInfoEXT.PNEXT); } /** Unsafe version of {@link #pStdReferenceInfo}. */ public static StdVideoDecodeH264ReferenceInfo npStdReferenceInfo(long struct) { return StdVideoDecodeH264ReferenceInfo.create(memGetAddress(struct + VkVideoDecodeH264DpbSlotInfoEXT.PSTDREFERENCEINFO)); } /** Unsafe version of {@link #sType(int) sType}. */ public static void nsType(long struct, int value) { UNSAFE.putInt(null, struct + VkVideoDecodeH264DpbSlotInfoEXT.STYPE, value); } /** Unsafe version of {@link #pNext(long) pNext}. */ public static void npNext(long struct, long value) { memPutAddress(struct + VkVideoDecodeH264DpbSlotInfoEXT.PNEXT, value); } /** Unsafe version of {@link #pStdReferenceInfo(StdVideoDecodeH264ReferenceInfo) pStdReferenceInfo}. */ public static void npStdReferenceInfo(long struct, StdVideoDecodeH264ReferenceInfo value) { memPutAddress(struct + VkVideoDecodeH264DpbSlotInfoEXT.PSTDREFERENCEINFO, value.address()); } /** * Validates pointer members that should not be {@code NULL}. * * @param struct the struct to validate */ public static void validate(long struct) { check(memGetAddress(struct + VkVideoDecodeH264DpbSlotInfoEXT.PSTDREFERENCEINFO)); } // ----------------------------------- /** An array of {@link VkVideoDecodeH264DpbSlotInfoEXT} structs. */ public static class Buffer extends StructBuffer<VkVideoDecodeH264DpbSlotInfoEXT, Buffer> implements NativeResource { private static final VkVideoDecodeH264DpbSlotInfoEXT ELEMENT_FACTORY = VkVideoDecodeH264DpbSlotInfoEXT.create(-1L); /** * Creates a new {@code VkVideoDecodeH264DpbSlotInfoEXT.Buffer} instance backed by the specified container. * * Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values * will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided * by {@link VkVideoDecodeH264DpbSlotInfoEXT#SIZEOF}, and its mark will be undefined. * * <p>The created buffer instance holds a strong reference to the container object.</p> */ public Buffer(ByteBuffer container) { super(container, container.remaining() / SIZEOF); } public Buffer(long address, int cap) { super(address, null, -1, 0, cap, cap); } Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) { super(address, container, mark, pos, lim, cap); } @Override protected Buffer self() { return this; } @Override protected VkVideoDecodeH264DpbSlotInfoEXT getElementFactory() { return ELEMENT_FACTORY; } /** @return the value of the {@link VkVideoDecodeH264DpbSlotInfoEXT#sType} field. */ @NativeType("VkStructureType") public int sType() { return VkVideoDecodeH264DpbSlotInfoEXT.nsType(address()); } /** @return the value of the {@code pNext} field. */ @NativeType("void const *") public long pNext() { return VkVideoDecodeH264DpbSlotInfoEXT.npNext(address()); } /** @return a {@link StdVideoDecodeH264ReferenceInfo} view of the struct pointed to by the {@link VkVideoDecodeH264DpbSlotInfoEXT#pStdReferenceInfo} field. */ @NativeType("StdVideoDecodeH264ReferenceInfo const *") public StdVideoDecodeH264ReferenceInfo pStdReferenceInfo() { return VkVideoDecodeH264DpbSlotInfoEXT.npStdReferenceInfo(address()); } /** Sets the specified value to the {@link VkVideoDecodeH264DpbSlotInfoEXT#sType} field. */ public VkVideoDecodeH264DpbSlotInfoEXT.Buffer sType(@NativeType("VkStructureType") int value) { VkVideoDecodeH264DpbSlotInfoEXT.nsType(address(), value); return this; } /** Sets the {@link EXTVideoDecodeH264#VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT} value to the {@link VkVideoDecodeH264DpbSlotInfoEXT#sType} field. */ public VkVideoDecodeH264DpbSlotInfoEXT.Buffer sType$Default() { return sType(EXTVideoDecodeH264.VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT); } /** Sets the specified value to the {@code pNext} field. */ public VkVideoDecodeH264DpbSlotInfoEXT.Buffer pNext(@NativeType("void const *") long value) { VkVideoDecodeH264DpbSlotInfoEXT.npNext(address(), value); return this; } /** Sets the address of the specified {@link StdVideoDecodeH264ReferenceInfo} to the {@link VkVideoDecodeH264DpbSlotInfoEXT#pStdReferenceInfo} field. */ public VkVideoDecodeH264DpbSlotInfoEXT.Buffer pStdReferenceInfo(@NativeType("StdVideoDecodeH264ReferenceInfo const *") StdVideoDecodeH264ReferenceInfo value) { VkVideoDecodeH264DpbSlotInfoEXT.npStdReferenceInfo(address(), value); return this; } } }
TheMrMilchmann/lwjgl3
modules/lwjgl/vulkan/src/generated/java/org/lwjgl/vulkan/VkVideoDecodeH264DpbSlotInfoEXT.java
Java
bsd-3-clause
15,279
package com.lb.three_phases_bottom_sheet; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.AppBarLayout; import android.support.design.widget.AppBarLayout.OnOffsetChangedListener; import android.support.v7.widget.Toolbar; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewGroup.MarginLayoutParams; import android.view.ViewPropertyAnimator; import android.widget.ImageView; import android.widget.TextView; import com.flipboard.bottomsheet.BaseViewTransformer; import com.flipboard.bottomsheet.BottomSheetLayout; import com.flipboard.bottomsheet.BottomSheetLayout.OnSheetStateChangeListener; import com.flipboard.bottomsheet.BottomSheetLayout.State; import com.flipboard.bottomsheet.ViewTransformer; import com.flipboard.bottomsheet.commons.BottomSheetFragment; public class MyFragment extends BottomSheetFragment { private BottomSheetLayout mBottomSheetLayout; private ImageView mBottomSheetBackgroundImageView; private int mBottomSheetHeightExpanded, mBottomSheetHeightPeeked; private ImageView mMovingIconImageView; private AppBarLayout mAppBarLayout; private TextView mTitleExpanded, mTitleCollapsed; private ViewPropertyAnimator mTitleExpandedAnimation, mToolbarAnimation; private Toolbar mLeftToolbar; private int mMovingImageviewSize; private BottomSheetState mBottomSheetState=BottomSheetState.HIDDEN; private int mMovingImageExpandedBottomSheetMarginLeft; private View mBottomSheetContentView; @Nullable @Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) { final View view=inflater.inflate(R.layout.fragment_my,container,false); mBottomSheetHeightPeeked=getResources().getDimensionPixelSize(R.dimen.header_height_peeked); mBottomSheetHeightExpanded=Math.max(mBottomSheetHeightPeeked,getResources().getDimensionPixelSize(R.dimen.header_height_expanded)); mMovingImageviewSize=getResources().getDimensionPixelSize(R.dimen.moving_image_collapsed_bottom_sheet_size); mAppBarLayout=(AppBarLayout)view.findViewById(R.id.appbar); mAppBarLayout.getLayoutParams().height=mBottomSheetHeightExpanded; mTitleExpanded=(TextView)view.findViewById(R.id.expandedTitleTextView); mTitleCollapsed=(TextView)view.findViewById(R.id.collapsedTitleTextView); mBottomSheetContentView=view.findViewById(R.id.bottomsheetContentView); ((MarginLayoutParams)mBottomSheetContentView.getLayoutParams()).topMargin=mMovingImageviewSize/2; ((MarginLayoutParams)mBottomSheetContentView.getLayoutParams()).height=mBottomSheetHeightPeeked-mMovingImageviewSize/2; mBottomSheetContentView.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { mBottomSheetLayout.expandSheet(); } }); mMovingImageExpandedBottomSheetMarginLeft=getResources().getDimensionPixelSize(R.dimen.moving_image_expanded_bottom_sheet_margin_left); view.setMinimumHeight(getResources().getDisplayMetrics().heightPixels); mLeftToolbar=(Toolbar)view.findViewById(R.id.toolbar); //final AppCompatActivity activity = (AppCompatActivity) getActivity(); //activity.setSupportActionBar(toolbar); //final ActionBar actionBar = activity.getSupportActionBar(); //actionBar.setDisplayHomeAsUpEnabled(true); //actionBar.setTitle(null); mLeftToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); mLeftToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mBottomSheetLayout.dismissSheet(); } }); mLeftToolbar.setAlpha(0); mBottomSheetBackgroundImageView=(ImageView)view.findViewById(R.id.backdrop); mBottomSheetBackgroundImageView.setAlpha(0.0f); mBottomSheetBackgroundImageView.setY(mMovingImageviewSize/2); mMovingIconImageView=(ImageView)view.findViewById(R.id.movingIconImageView); if(mBottomSheetLayout!=null) mBottomSheetLayout.setAppBarLayout(mAppBarLayout); final int actionBarHeight=getActionBarHeight(getActivity()); mMovingIconImageView.setPivotX(0); mMovingIconImageView.setPivotY(0); mTitleExpanded.setPivotX(0); mTitleExpanded.setAlpha(0); mTitleCollapsed.setAlpha(0); mAppBarLayout.addOnOffsetChangedListener(new OnOffsetChangedListener() { final float actionBarIconPaddingText=getResources().getDimensionPixelSize(R.dimen.moving_text_collapsed_toolbar_top_and_bottom_padding); final float startMarginBottomText=getResources().getDimensionPixelSize(R.dimen.moving_text_expanded_toolbar_bottom_margin); final float startMarginLeftText=getResources().getDimensionPixelSize(R.dimen.moving_text_expanded_toolbar_margin_left); boolean init=false; float startY, scaleDiff, startScale, targetY; // float scaleDiffTitle; float startYTitle; @Override public void onOffsetChanged(final AppBarLayout appBarLayout,final int verticalOffset) { if(mBottomSheetLayout!=null&&mBottomSheetLayout.isSheetShowing()&&mBottomSheetLayout.getState()==State.EXPANDED) { float progress=(float)-verticalOffset/mAppBarLayout.getTotalScrollRange(); mMovingIconImageView.setX(mMovingImageExpandedBottomSheetMarginLeft+(progress*(actionBarHeight-mMovingImageExpandedBottomSheetMarginLeft))); if(!init) { //imageview startScale=mMovingIconImageView.getScaleX(); // final int startMarginBottom=getResources().getDimensionPixelSize(R.dimen.header_view_start_margin_bottom); final float targetSizeWhenBottomSheetExpanded=getResources().getDimensionPixelSize(R.dimen.moving_image_expanded_bottom_sheet_size); final float startSizeWhenBottomSheetCollapsed=getResources().getDimensionPixelSize(R.dimen.moving_image_collapsed_bottom_sheet_size); scaleDiff=(startSizeWhenBottomSheetCollapsed-targetSizeWhenBottomSheetExpanded)/startSizeWhenBottomSheetCollapsed; final float scaleForImageView=1-scaleDiff; startY=mBottomSheetHeightExpanded-startMarginBottom-mMovingIconImageView.getHeight()*scaleForImageView; // final float actionBarIconPadding=getResources().getDimensionPixelSize(R.dimen.moving_image_collapsed_toolbar_top_and_bottom_padding); final float targetImageViewSize=actionBarHeight-actionBarIconPadding*2; targetY=mBottomSheetHeightExpanded-actionBarIconPadding-targetImageViewSize; final float targetScale=targetImageViewSize/mMovingImageviewSize; scaleDiff=startScale-targetScale; //text: scaleDiffTitle=1-(actionBarHeight-actionBarIconPaddingText*2)/mTitleExpanded.getHeight(); startYTitle=mTitleExpanded.getY(); mTitleExpanded.setPivotY(mTitleExpanded.getHeight()); init=true; } if(mToolbarAnimation!=null) { mToolbarAnimation.cancel(); mToolbarAnimation=null; mLeftToolbar.setAlpha(1); mLeftToolbar.setY(0); } if(mTitleExpandedAnimation!=null) { mTitleExpandedAnimation.cancel(); mTitleExpandedAnimation=null; } final float newScale=startScale-progress*scaleDiff; mMovingIconImageView.setScaleX(newScale); mMovingIconImageView.setScaleY(newScale); mMovingIconImageView.setY(startY-progress*(startY-targetY)); mTitleExpanded.setScaleX(1f-progress*scaleDiffTitle); mTitleExpanded.setScaleY(1f-progress*scaleDiffTitle); mTitleExpanded.setX(startMarginLeftText+(progress*(2*actionBarHeight-startMarginLeftText))); mTitleExpanded.setY(startYTitle-progress*actionBarIconPaddingText+startMarginBottomText*progress); mTitleExpanded.setAlpha(progress<=0.7f?1f:progress>=0.9f?0f:1-((progress-0.7f)/0.2f)); mTitleCollapsed.setAlpha(progress<=0.9f?0f:progress>=1f?1f:(progress-0.9f)/0.1f); } } }); return view; } /** * returns the height of the action bar */ public static int getActionBarHeight(final Context context) { // based on http://stackoverflow.com/questions/12301510/how-to-get-the-actionbar-height final TypedValue tv=new TypedValue(); int actionBarHeight=0; if(context.getTheme().resolveAttribute(R.attr.actionBarSize,tv,true)) actionBarHeight=TypedValue.complexToDimensionPixelSize(tv.data,context.getResources() .getDisplayMetrics()); return actionBarHeight; } public void setBottomSheetLayout(final BottomSheetLayout bottomSheetLayout) { mBottomSheetLayout=bottomSheetLayout; if(mBottomSheetLayout!=null&&mAppBarLayout!=null) mBottomSheetLayout.setAppBarLayout(mAppBarLayout); mBottomSheetLayout.addOnSheetStateChangeListener(new OnSheetStateChangeListener() { private ViewPropertyAnimator mToolbarAnimation; State lastState; @Override public void onSheetStateChanged(final State state) { if(lastState==state||!isAdded()) return; lastState=state; if(state!=State.EXPANDED) { mTitleCollapsed.setAlpha(0); if(mToolbarAnimation!=null) mToolbarAnimation.cancel(); mToolbarAnimation=null; if(mTitleExpandedAnimation!=null) mTitleExpandedAnimation.cancel(); mTitleExpandedAnimation=null; mTitleExpanded.setAlpha(0); mTitleExpanded.setVisibility(View.INVISIBLE); mLeftToolbar.setAlpha(0); mLeftToolbar.setVisibility(View.INVISIBLE); } else if(mToolbarAnimation==null) { mTitleExpanded.setVisibility(View.VISIBLE); mLeftToolbar.setVisibility(View.VISIBLE); mLeftToolbar.setY(-mLeftToolbar.getHeight()/3); mToolbarAnimation=mLeftToolbar.animate().setDuration(getResources().getInteger(android.R.integer.config_longAnimTime)); mToolbarAnimation.alpha(1).y(0).start(); mTitleExpanded.setAlpha(0); mTitleExpandedAnimation=mTitleExpanded.animate().setDuration(getResources().getInteger(android.R.integer.config_longAnimTime)); mTitleExpandedAnimation.alpha(1).start(); } } }); } @Override public ViewTransformer getViewTransformer() { final float targetSizeWhenBottomSheetExpanded=getResources().getDimensionPixelSize(R.dimen.moving_image_expanded_bottom_sheet_size); final float startSizeWhenBottomSheetCollapsed=getResources().getDimensionPixelSize(R.dimen.moving_image_collapsed_bottom_sheet_size); final float startMarginBottom=getResources().getDimensionPixelSize(R.dimen.moving_image_expanded_bottom_sheet_margin_bottom); return new BaseViewTransformer() { boolean init=false; float mOriginalContactPhotoXCoordinate; float mOriginalBottomSheetBackgroundImageViewY; float scaleDiff; @Override public void transformView(final float translation,final float maxTranslation,final float peekedTranslation,final BottomSheetLayout parent,final View view) { if(!init) { mOriginalBottomSheetBackgroundImageViewY=mMovingImageviewSize/2; mOriginalContactPhotoXCoordinate=mMovingIconImageView.getX(); scaleDiff=(startSizeWhenBottomSheetCollapsed-targetSizeWhenBottomSheetExpanded)/startSizeWhenBottomSheetCollapsed; init=true; } if(translation<mBottomSheetHeightPeeked) { //hidden<->peeked or hidden reportState(translation==0?BottomSheetState.HIDDEN:BottomSheetState.HIDDEN_PEEKED); return; } if(translation==mBottomSheetHeightPeeked) { //peek reportState(BottomSheetState.PEEKED); } else { //peek->expand reportState(translation==maxTranslation?BottomSheetState.EXPANDED:BottomSheetState.PEEKED_EXPANDED); } float progress=(translation-mBottomSheetHeightPeeked)/(maxTranslation-mBottomSheetHeightPeeked); mMovingIconImageView.setX(mOriginalContactPhotoXCoordinate-progress*(mOriginalContactPhotoXCoordinate-mMovingImageExpandedBottomSheetMarginLeft)); final float scaleForImageView=1-progress*scaleDiff; mMovingIconImageView.setScaleX(scaleForImageView); mMovingIconImageView.setScaleY(scaleForImageView); final float newMovingIconImageViewY=progress*(mBottomSheetHeightExpanded-startMarginBottom-mMovingIconImageView.getHeight()*scaleForImageView); mMovingIconImageView.setY(newMovingIconImageViewY); final float newBottomSheetBackgroundImageContainerY=mOriginalBottomSheetBackgroundImageViewY*(1-progress); mBottomSheetBackgroundImageView.setY(newBottomSheetBackgroundImageContainerY); } }; } protected void reportState(final BottomSheetState state) { if(mBottomSheetState!=state) { mBottomSheetState=state; switch(state) { case HIDDEN: break; case HIDDEN_PEEKED: break; case PEEKED: mBottomSheetBackgroundImageView.setImageResource(R.drawable.background); mBottomSheetBackgroundImageView.animate().cancel(); final ViewPropertyAnimator animator=mBottomSheetBackgroundImageView.animate(); animator.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)); animator.alpha(0); break; case PEEKED_EXPANDED: mBottomSheetBackgroundImageView.animate().cancel(); mBottomSheetBackgroundImageView.animate().alpha(1); break; case EXPANDED: break; } } } }
AndroidDeveloperLB/ThreePhasesBottomSheet
bottomsheet-sample/src/main/java/com/lb/three_phases_bottom_sheet/MyFragment.java
Java
bsd-3-clause
14,102
package org.motechproject.quartz; import org.apache.log4j.Logger; import org.codehaus.jackson.annotate.JsonAutoDetect; import org.codehaus.jackson.annotate.JsonProperty; import org.ektorp.support.TypeDiscriminator; import org.quartz.impl.triggers.CronTriggerImpl; import java.text.ParseException; import java.util.TimeZone; @JsonAutoDetect( fieldVisibility = JsonAutoDetect.Visibility.NONE, getterVisibility = JsonAutoDetect.Visibility.NONE, isGetterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE) @TypeDiscriminator("CouchDbTrigger") public class CouchDbCronTrigger extends CouchDbTrigger<CronTriggerImpl> { private Logger log = Logger.getLogger(CouchDbCronTrigger.class); private CouchDbCronTrigger() { this(new CronTriggerImpl()); } public CouchDbCronTrigger(CronTriggerImpl trigger, CouchDbTriggerState triggerState) { super(trigger, triggerState); } public CouchDbCronTrigger(CronTriggerImpl trigger) { this(trigger, CouchDbTriggerState.WAITING); } @JsonProperty("cron_expression") public String getCronExpression() { return getTrigger().getCronExpression(); } @JsonProperty("cron_expression") public void setCronExpression(String expr) throws ParseException { getTrigger().setCronExpression(expr); } @JsonProperty("cron_timezone") public String getTimezoneId() { return getTrigger().getTimeZone() != null ? getTrigger().getTimeZone().getID() : null; } @JsonProperty("cron_timezone") public void setTimezoneId(String timezoneId) { if (timezoneId != null) { getTrigger().setTimeZone(TimeZone.getTimeZone(timezoneId)); } } }
motech/quartz-couchdb-store
src/main/java/org/motechproject/quartz/CouchDbCronTrigger.java
Java
bsd-3-clause
1,774
/** */ package com.rockwellcollins.atc.agree.agree.impl; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.EObjectResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; import org.osate.aadl2.NamedElement; import com.rockwellcollins.atc.agree.agree.AgreePackage; import com.rockwellcollins.atc.agree.agree.Expr; import com.rockwellcollins.atc.agree.agree.RecordUpdateExpr; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Record Update Expr</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link com.rockwellcollins.atc.agree.agree.impl.RecordUpdateExprImpl#getRecord <em>Record</em>}</li> * <li>{@link com.rockwellcollins.atc.agree.agree.impl.RecordUpdateExprImpl#getArgs <em>Args</em>}</li> * <li>{@link com.rockwellcollins.atc.agree.agree.impl.RecordUpdateExprImpl#getArgExpr <em>Arg Expr</em>}</li> * </ul> * * @generated */ public class RecordUpdateExprImpl extends ExprImpl implements RecordUpdateExpr { /** * The cached value of the '{@link #getRecord() <em>Record</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getRecord() * @generated * @ordered */ protected Expr record; /** * The cached value of the '{@link #getArgs() <em>Args</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getArgs() * @generated * @ordered */ protected EList<NamedElement> args; /** * The cached value of the '{@link #getArgExpr() <em>Arg Expr</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getArgExpr() * @generated * @ordered */ protected EList<Expr> argExpr; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected RecordUpdateExprImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AgreePackage.Literals.RECORD_UPDATE_EXPR; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Expr getRecord() { return record; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetRecord(Expr newRecord, NotificationChain msgs) { Expr oldRecord = record; record = newRecord; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreePackage.RECORD_UPDATE_EXPR__RECORD, oldRecord, newRecord); if (msgs == null) { msgs = notification; } else { msgs.add(notification); } } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setRecord(Expr newRecord) { if (newRecord != record) { NotificationChain msgs = null; if (record != null) { msgs = ((InternalEObject) record).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AgreePackage.RECORD_UPDATE_EXPR__RECORD, null, msgs); } if (newRecord != null) { msgs = ((InternalEObject) newRecord).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AgreePackage.RECORD_UPDATE_EXPR__RECORD, null, msgs); } msgs = basicSetRecord(newRecord, msgs); if (msgs != null) { msgs.dispatch(); } } else if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, AgreePackage.RECORD_UPDATE_EXPR__RECORD, newRecord, newRecord)); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<NamedElement> getArgs() { if (args == null) { args = new EObjectResolvingEList<>(NamedElement.class, this, AgreePackage.RECORD_UPDATE_EXPR__ARGS); } return args; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<Expr> getArgExpr() { if (argExpr == null) { argExpr = new EObjectContainmentEList<>(Expr.class, this, AgreePackage.RECORD_UPDATE_EXPR__ARG_EXPR); } return argExpr; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AgreePackage.RECORD_UPDATE_EXPR__RECORD: return basicSetRecord(null, msgs); case AgreePackage.RECORD_UPDATE_EXPR__ARG_EXPR: return ((InternalEList<?>) getArgExpr()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case AgreePackage.RECORD_UPDATE_EXPR__RECORD: return getRecord(); case AgreePackage.RECORD_UPDATE_EXPR__ARGS: return getArgs(); case AgreePackage.RECORD_UPDATE_EXPR__ARG_EXPR: return getArgExpr(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case AgreePackage.RECORD_UPDATE_EXPR__RECORD: setRecord((Expr) newValue); return; case AgreePackage.RECORD_UPDATE_EXPR__ARGS: getArgs().clear(); getArgs().addAll((Collection<? extends NamedElement>) newValue); return; case AgreePackage.RECORD_UPDATE_EXPR__ARG_EXPR: getArgExpr().clear(); getArgExpr().addAll((Collection<? extends Expr>) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case AgreePackage.RECORD_UPDATE_EXPR__RECORD: setRecord((Expr) null); return; case AgreePackage.RECORD_UPDATE_EXPR__ARGS: getArgs().clear(); return; case AgreePackage.RECORD_UPDATE_EXPR__ARG_EXPR: getArgExpr().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AgreePackage.RECORD_UPDATE_EXPR__RECORD: return record != null; case AgreePackage.RECORD_UPDATE_EXPR__ARGS: return args != null && !args.isEmpty(); case AgreePackage.RECORD_UPDATE_EXPR__ARG_EXPR: return argExpr != null && !argExpr.isEmpty(); } return super.eIsSet(featureID); } } // RecordUpdateExprImpl
smaccm/smaccm
fm-workbench/agree/com.rockwellcollins.atc.agree/src-gen/com/rockwellcollins/atc/agree/agree/impl/RecordUpdateExprImpl.java
Java
bsd-3-clause
6,918
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.vulkan; import javax.annotation.*; import java.nio.*; import org.lwjgl.*; import org.lwjgl.system.*; import static org.lwjgl.system.Checks.*; import static org.lwjgl.system.MemoryUtil.*; import static org.lwjgl.system.MemoryStack.*; import org.lwjgl.vulkan.video.*; /** * Structure specifies H.265 encode slice NALU parameters. * * <h5>Valid Usage (Implicit)</h5> * * <ul> * <li>{@code sType} <b>must</b> be {@link EXTVideoEncodeH265#VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_EXT STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_EXT}</li> * <li>{@code pNext} <b>must</b> be {@code NULL}</li> * <li>If {@code pReferenceFinalLists} is not {@code NULL}, {@code pReferenceFinalLists} <b>must</b> be a valid pointer to a valid {@link VkVideoEncodeH265ReferenceListsEXT} structure</li> * <li>{@code pSliceHeaderStd} <b>must</b> be a valid pointer to a valid {@code StdVideoEncodeH265SliceHeader} value</li> * </ul> * * <h5>See Also</h5> * * <p>{@link VkVideoEncodeH265ReferenceListsEXT}, {@link VkVideoEncodeH265VclFrameInfoEXT}</p> * * <h3>Layout</h3> * * <pre><code> * struct VkVideoEncodeH265NaluSliceEXT { * VkStructureType {@link #sType}; * void const * {@link #pNext}; * uint32_t {@link #ctbCount}; * {@link VkVideoEncodeH265ReferenceListsEXT VkVideoEncodeH265ReferenceListsEXT} const * {@link #pReferenceFinalLists}; * {@link StdVideoEncodeH265SliceHeader StdVideoEncodeH265SliceHeader} const * {@link #pSliceHeaderStd}; * }</code></pre> */ public class VkVideoEncodeH265NaluSliceEXT extends Struct implements NativeResource { /** The struct size in bytes. */ public static final int SIZEOF; /** The struct alignment in bytes. */ public static final int ALIGNOF; /** The struct member offsets. */ public static final int STYPE, PNEXT, CTBCOUNT, PREFERENCEFINALLISTS, PSLICEHEADERSTD; static { Layout layout = __struct( __member(4), __member(POINTER_SIZE), __member(4), __member(POINTER_SIZE), __member(POINTER_SIZE) ); SIZEOF = layout.getSize(); ALIGNOF = layout.getAlignment(); STYPE = layout.offsetof(0); PNEXT = layout.offsetof(1); CTBCOUNT = layout.offsetof(2); PREFERENCEFINALLISTS = layout.offsetof(3); PSLICEHEADERSTD = layout.offsetof(4); } /** * Creates a {@code VkVideoEncodeH265NaluSliceEXT} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be * visible to the struct instance and vice versa. * * <p>The created instance holds a strong reference to the container object.</p> */ public VkVideoEncodeH265NaluSliceEXT(ByteBuffer container) { super(memAddress(container), __checkContainer(container, SIZEOF)); } @Override public int sizeof() { return SIZEOF; } /** the type of this structure. */ @NativeType("VkStructureType") public int sType() { return nsType(address()); } /** {@code NULL} or a pointer to a structure extending this structure. */ @NativeType("void const *") public long pNext() { return npNext(address()); } /** the number of CTBs in this slice. */ @NativeType("uint32_t") public int ctbCount() { return nctbCount(address()); } /** {@code NULL} or a pointer to a {@link VkVideoEncodeH265ReferenceListsEXT} structure specifying the reference lists to be used for the current slice. If {@code pReferenceFinalLists} is not {@code NULL}, these reference lists override the reference lists provided in {@link VkVideoEncodeH265VclFrameInfoEXT}{@code ::pReferenceFinalLists}. */ @Nullable @NativeType("VkVideoEncodeH265ReferenceListsEXT const *") public VkVideoEncodeH265ReferenceListsEXT pReferenceFinalLists() { return npReferenceFinalLists(address()); } /** a pointer to a {@code StdVideoEncodeH265SliceHeader} structure specifying the slice header for the current slice. */ @NativeType("StdVideoEncodeH265SliceHeader const *") public StdVideoEncodeH265SliceHeader pSliceHeaderStd() { return npSliceHeaderStd(address()); } /** Sets the specified value to the {@link #sType} field. */ public VkVideoEncodeH265NaluSliceEXT sType(@NativeType("VkStructureType") int value) { nsType(address(), value); return this; } /** Sets the {@link EXTVideoEncodeH265#VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_EXT STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_EXT} value to the {@link #sType} field. */ public VkVideoEncodeH265NaluSliceEXT sType$Default() { return sType(EXTVideoEncodeH265.VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_EXT); } /** Sets the specified value to the {@link #pNext} field. */ public VkVideoEncodeH265NaluSliceEXT pNext(@NativeType("void const *") long value) { npNext(address(), value); return this; } /** Sets the specified value to the {@link #ctbCount} field. */ public VkVideoEncodeH265NaluSliceEXT ctbCount(@NativeType("uint32_t") int value) { nctbCount(address(), value); return this; } /** Sets the address of the specified {@link VkVideoEncodeH265ReferenceListsEXT} to the {@link #pReferenceFinalLists} field. */ public VkVideoEncodeH265NaluSliceEXT pReferenceFinalLists(@Nullable @NativeType("VkVideoEncodeH265ReferenceListsEXT const *") VkVideoEncodeH265ReferenceListsEXT value) { npReferenceFinalLists(address(), value); return this; } /** Sets the address of the specified {@link StdVideoEncodeH265SliceHeader} to the {@link #pSliceHeaderStd} field. */ public VkVideoEncodeH265NaluSliceEXT pSliceHeaderStd(@NativeType("StdVideoEncodeH265SliceHeader const *") StdVideoEncodeH265SliceHeader value) { npSliceHeaderStd(address(), value); return this; } /** Initializes this struct with the specified values. */ public VkVideoEncodeH265NaluSliceEXT set( int sType, long pNext, int ctbCount, @Nullable VkVideoEncodeH265ReferenceListsEXT pReferenceFinalLists, StdVideoEncodeH265SliceHeader pSliceHeaderStd ) { sType(sType); pNext(pNext); ctbCount(ctbCount); pReferenceFinalLists(pReferenceFinalLists); pSliceHeaderStd(pSliceHeaderStd); return this; } /** * Copies the specified struct data to this struct. * * @param src the source struct * * @return this struct */ public VkVideoEncodeH265NaluSliceEXT set(VkVideoEncodeH265NaluSliceEXT src) { memCopy(src.address(), address(), SIZEOF); return this; } // ----------------------------------- /** Returns a new {@code VkVideoEncodeH265NaluSliceEXT} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */ public static VkVideoEncodeH265NaluSliceEXT malloc() { return wrap(VkVideoEncodeH265NaluSliceEXT.class, nmemAllocChecked(SIZEOF)); } /** Returns a new {@code VkVideoEncodeH265NaluSliceEXT} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */ public static VkVideoEncodeH265NaluSliceEXT calloc() { return wrap(VkVideoEncodeH265NaluSliceEXT.class, nmemCallocChecked(1, SIZEOF)); } /** Returns a new {@code VkVideoEncodeH265NaluSliceEXT} instance allocated with {@link BufferUtils}. */ public static VkVideoEncodeH265NaluSliceEXT create() { ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF); return wrap(VkVideoEncodeH265NaluSliceEXT.class, memAddress(container), container); } /** Returns a new {@code VkVideoEncodeH265NaluSliceEXT} instance for the specified memory address. */ public static VkVideoEncodeH265NaluSliceEXT create(long address) { return wrap(VkVideoEncodeH265NaluSliceEXT.class, address); } /** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static VkVideoEncodeH265NaluSliceEXT createSafe(long address) { return address == NULL ? null : wrap(VkVideoEncodeH265NaluSliceEXT.class, address); } /** * Returns a new {@link VkVideoEncodeH265NaluSliceEXT.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static VkVideoEncodeH265NaluSliceEXT.Buffer malloc(int capacity) { return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity); } /** * Returns a new {@link VkVideoEncodeH265NaluSliceEXT.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. * * @param capacity the buffer capacity */ public static VkVideoEncodeH265NaluSliceEXT.Buffer calloc(int capacity) { return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity); } /** * Returns a new {@link VkVideoEncodeH265NaluSliceEXT.Buffer} instance allocated with {@link BufferUtils}. * * @param capacity the buffer capacity */ public static VkVideoEncodeH265NaluSliceEXT.Buffer create(int capacity) { ByteBuffer container = __create(capacity, SIZEOF); return wrap(Buffer.class, memAddress(container), capacity, container); } /** * Create a {@link VkVideoEncodeH265NaluSliceEXT.Buffer} instance at the specified memory. * * @param address the memory address * @param capacity the buffer capacity */ public static VkVideoEncodeH265NaluSliceEXT.Buffer create(long address, int capacity) { return wrap(Buffer.class, address, capacity); } /** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */ @Nullable public static VkVideoEncodeH265NaluSliceEXT.Buffer createSafe(long address, int capacity) { return address == NULL ? null : wrap(Buffer.class, address, capacity); } /** * Returns a new {@code VkVideoEncodeH265NaluSliceEXT} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate */ public static VkVideoEncodeH265NaluSliceEXT malloc(MemoryStack stack) { return wrap(VkVideoEncodeH265NaluSliceEXT.class, stack.nmalloc(ALIGNOF, SIZEOF)); } /** * Returns a new {@code VkVideoEncodeH265NaluSliceEXT} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate */ public static VkVideoEncodeH265NaluSliceEXT calloc(MemoryStack stack) { return wrap(VkVideoEncodeH265NaluSliceEXT.class, stack.ncalloc(ALIGNOF, 1, SIZEOF)); } /** * Returns a new {@link VkVideoEncodeH265NaluSliceEXT.Buffer} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static VkVideoEncodeH265NaluSliceEXT.Buffer malloc(int capacity, MemoryStack stack) { return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity); } /** * Returns a new {@link VkVideoEncodeH265NaluSliceEXT.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate * @param capacity the buffer capacity */ public static VkVideoEncodeH265NaluSliceEXT.Buffer calloc(int capacity, MemoryStack stack) { return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity); } // ----------------------------------- /** Unsafe version of {@link #sType}. */ public static int nsType(long struct) { return UNSAFE.getInt(null, struct + VkVideoEncodeH265NaluSliceEXT.STYPE); } /** Unsafe version of {@link #pNext}. */ public static long npNext(long struct) { return memGetAddress(struct + VkVideoEncodeH265NaluSliceEXT.PNEXT); } /** Unsafe version of {@link #ctbCount}. */ public static int nctbCount(long struct) { return UNSAFE.getInt(null, struct + VkVideoEncodeH265NaluSliceEXT.CTBCOUNT); } /** Unsafe version of {@link #pReferenceFinalLists}. */ @Nullable public static VkVideoEncodeH265ReferenceListsEXT npReferenceFinalLists(long struct) { return VkVideoEncodeH265ReferenceListsEXT.createSafe(memGetAddress(struct + VkVideoEncodeH265NaluSliceEXT.PREFERENCEFINALLISTS)); } /** Unsafe version of {@link #pSliceHeaderStd}. */ public static StdVideoEncodeH265SliceHeader npSliceHeaderStd(long struct) { return StdVideoEncodeH265SliceHeader.create(memGetAddress(struct + VkVideoEncodeH265NaluSliceEXT.PSLICEHEADERSTD)); } /** Unsafe version of {@link #sType(int) sType}. */ public static void nsType(long struct, int value) { UNSAFE.putInt(null, struct + VkVideoEncodeH265NaluSliceEXT.STYPE, value); } /** Unsafe version of {@link #pNext(long) pNext}. */ public static void npNext(long struct, long value) { memPutAddress(struct + VkVideoEncodeH265NaluSliceEXT.PNEXT, value); } /** Unsafe version of {@link #ctbCount(int) ctbCount}. */ public static void nctbCount(long struct, int value) { UNSAFE.putInt(null, struct + VkVideoEncodeH265NaluSliceEXT.CTBCOUNT, value); } /** Unsafe version of {@link #pReferenceFinalLists(VkVideoEncodeH265ReferenceListsEXT) pReferenceFinalLists}. */ public static void npReferenceFinalLists(long struct, @Nullable VkVideoEncodeH265ReferenceListsEXT value) { memPutAddress(struct + VkVideoEncodeH265NaluSliceEXT.PREFERENCEFINALLISTS, memAddressSafe(value)); } /** Unsafe version of {@link #pSliceHeaderStd(StdVideoEncodeH265SliceHeader) pSliceHeaderStd}. */ public static void npSliceHeaderStd(long struct, StdVideoEncodeH265SliceHeader value) { memPutAddress(struct + VkVideoEncodeH265NaluSliceEXT.PSLICEHEADERSTD, value.address()); } /** * Validates pointer members that should not be {@code NULL}. * * @param struct the struct to validate */ public static void validate(long struct) { long pReferenceFinalLists = memGetAddress(struct + VkVideoEncodeH265NaluSliceEXT.PREFERENCEFINALLISTS); if (pReferenceFinalLists != NULL) { VkVideoEncodeH265ReferenceListsEXT.validate(pReferenceFinalLists); } check(memGetAddress(struct + VkVideoEncodeH265NaluSliceEXT.PSLICEHEADERSTD)); } // ----------------------------------- /** An array of {@link VkVideoEncodeH265NaluSliceEXT} structs. */ public static class Buffer extends StructBuffer<VkVideoEncodeH265NaluSliceEXT, Buffer> implements NativeResource { private static final VkVideoEncodeH265NaluSliceEXT ELEMENT_FACTORY = VkVideoEncodeH265NaluSliceEXT.create(-1L); /** * Creates a new {@code VkVideoEncodeH265NaluSliceEXT.Buffer} instance backed by the specified container. * * Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values * will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided * by {@link VkVideoEncodeH265NaluSliceEXT#SIZEOF}, and its mark will be undefined. * * <p>The created buffer instance holds a strong reference to the container object.</p> */ public Buffer(ByteBuffer container) { super(container, container.remaining() / SIZEOF); } public Buffer(long address, int cap) { super(address, null, -1, 0, cap, cap); } Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) { super(address, container, mark, pos, lim, cap); } @Override protected Buffer self() { return this; } @Override protected VkVideoEncodeH265NaluSliceEXT getElementFactory() { return ELEMENT_FACTORY; } /** @return the value of the {@link VkVideoEncodeH265NaluSliceEXT#sType} field. */ @NativeType("VkStructureType") public int sType() { return VkVideoEncodeH265NaluSliceEXT.nsType(address()); } /** @return the value of the {@link VkVideoEncodeH265NaluSliceEXT#pNext} field. */ @NativeType("void const *") public long pNext() { return VkVideoEncodeH265NaluSliceEXT.npNext(address()); } /** @return the value of the {@link VkVideoEncodeH265NaluSliceEXT#ctbCount} field. */ @NativeType("uint32_t") public int ctbCount() { return VkVideoEncodeH265NaluSliceEXT.nctbCount(address()); } /** @return a {@link VkVideoEncodeH265ReferenceListsEXT} view of the struct pointed to by the {@link VkVideoEncodeH265NaluSliceEXT#pReferenceFinalLists} field. */ @Nullable @NativeType("VkVideoEncodeH265ReferenceListsEXT const *") public VkVideoEncodeH265ReferenceListsEXT pReferenceFinalLists() { return VkVideoEncodeH265NaluSliceEXT.npReferenceFinalLists(address()); } /** @return a {@link StdVideoEncodeH265SliceHeader} view of the struct pointed to by the {@link VkVideoEncodeH265NaluSliceEXT#pSliceHeaderStd} field. */ @NativeType("StdVideoEncodeH265SliceHeader const *") public StdVideoEncodeH265SliceHeader pSliceHeaderStd() { return VkVideoEncodeH265NaluSliceEXT.npSliceHeaderStd(address()); } /** Sets the specified value to the {@link VkVideoEncodeH265NaluSliceEXT#sType} field. */ public VkVideoEncodeH265NaluSliceEXT.Buffer sType(@NativeType("VkStructureType") int value) { VkVideoEncodeH265NaluSliceEXT.nsType(address(), value); return this; } /** Sets the {@link EXTVideoEncodeH265#VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_EXT STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_EXT} value to the {@link VkVideoEncodeH265NaluSliceEXT#sType} field. */ public VkVideoEncodeH265NaluSliceEXT.Buffer sType$Default() { return sType(EXTVideoEncodeH265.VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_EXT); } /** Sets the specified value to the {@link VkVideoEncodeH265NaluSliceEXT#pNext} field. */ public VkVideoEncodeH265NaluSliceEXT.Buffer pNext(@NativeType("void const *") long value) { VkVideoEncodeH265NaluSliceEXT.npNext(address(), value); return this; } /** Sets the specified value to the {@link VkVideoEncodeH265NaluSliceEXT#ctbCount} field. */ public VkVideoEncodeH265NaluSliceEXT.Buffer ctbCount(@NativeType("uint32_t") int value) { VkVideoEncodeH265NaluSliceEXT.nctbCount(address(), value); return this; } /** Sets the address of the specified {@link VkVideoEncodeH265ReferenceListsEXT} to the {@link VkVideoEncodeH265NaluSliceEXT#pReferenceFinalLists} field. */ public VkVideoEncodeH265NaluSliceEXT.Buffer pReferenceFinalLists(@Nullable @NativeType("VkVideoEncodeH265ReferenceListsEXT const *") VkVideoEncodeH265ReferenceListsEXT value) { VkVideoEncodeH265NaluSliceEXT.npReferenceFinalLists(address(), value); return this; } /** Sets the address of the specified {@link StdVideoEncodeH265SliceHeader} to the {@link VkVideoEncodeH265NaluSliceEXT#pSliceHeaderStd} field. */ public VkVideoEncodeH265NaluSliceEXT.Buffer pSliceHeaderStd(@NativeType("StdVideoEncodeH265SliceHeader const *") StdVideoEncodeH265SliceHeader value) { VkVideoEncodeH265NaluSliceEXT.npSliceHeaderStd(address(), value); return this; } } }
TheMrMilchmann/lwjgl3
modules/lwjgl/vulkan/src/generated/java/org/lwjgl/vulkan/VkVideoEncodeH265NaluSliceEXT.java
Java
bsd-3-clause
19,763
package echosign.api.clientv20.dto17; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for DelegateSigningResultErrorCode. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="DelegateSigningResultErrorCode"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="OK"/> * &lt;enumeration value="INVALID_API_KEY"/> * &lt;enumeration value="INVALID_CREDENTIALS"/> * &lt;enumeration value="INVALID_DOCUMENT_KEY"/> * &lt;enumeration value="INVALID_OPTIONS"/> * &lt;enumeration value="INVALID_NEW_SIGNER"/> * &lt;enumeration value="INVALID_MESSAGE"/> * &lt;enumeration value="SIGNING_DELEGATION_NOT_ALLOWED"/> * &lt;enumeration value="MISC_ERROR"/> * &lt;enumeration value="EXCEPTION"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "DelegateSigningResultErrorCode") @XmlEnum public enum DelegateSigningResultErrorCode { OK, INVALID_API_KEY, INVALID_CREDENTIALS, INVALID_DOCUMENT_KEY, INVALID_OPTIONS, INVALID_NEW_SIGNER, INVALID_MESSAGE, SIGNING_DELEGATION_NOT_ALLOWED, MISC_ERROR, EXCEPTION; public String value() { return name(); } public static DelegateSigningResultErrorCode fromValue(String v) { return valueOf(v); } }
OBHITA/Consent2Share
ThirdParty/adobe-echosign-api/src/main/java/echosign/api/clientv20/dto17/DelegateSigningResultErrorCode.java
Java
bsd-3-clause
1,464
package apollo.datamodel.seq; import java.util.*; import java.io.IOException; import java.lang.String; import apollo.gui.Controller; import apollo.gui.ControllerDebugListener; import apollo.datamodel.SequenceI; import apollo.datamodel.Sequence; public class DebugLazySequence extends AbstractLazySequence implements LazySequenceI { String residues; public DebugLazySequence(String id, Controller c, String res) { super(id,c); setResidues(res); cacher.setMinChunkSize(20); } public void setResidues(String seq) { this.residues = seq; setLength(this.residues.length()); } public int getLength() { return residues.length(); } // NOTE: This returns a Sequence not a DebugLazySequence public SequenceI getSubSequence(int start, int end) { return new Sequence(getName(), getResidues(start,end)); } /* Note: low and high are relative coordinates */ protected String getResiduesFromSourceImpl(int low, int high) { Sequence tmpSeq = new Sequence("tmp",residues); String seq = ""; seq = tmpSeq.getResidues(low+1,high+1); return seq; } public static void main(String [] argv) { Controller c = new Controller(); DebugLazySequence seq = new DebugLazySequence("Dummy",c,"AAAAAAAAAACCCCCCCCCCGGGGGGGGGGTTTTTTTTTTAAAAAAAAAA"); DebugLazySequence seq2 = new DebugLazySequence("Dummy",c,"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"); ControllerDebugListener dl = new ControllerDebugListener(c); System.out.println("Sequence first 10 = " + seq.getResidues(1,10)); System.out.println("Sequence 30-40 = " + seq.getResidues(30,40)); System.out.println("Sequence 24-40 = " + seq.getResidues(24,40)); System.out.println("Sequence 2-40 = " + seq.getResidues(2,40)); System.out.println("Sequence 40-2 = " + seq.getResidues(40,2)); System.out.println("Alphabetic Sequence first 10 = " + seq2.getResidues(1,10)); System.out.println("Alphabetic Sequence 40-50 = " + seq2.getResidues(40,50)); System.out.println("Alphabetic Sequence 34-52 = " + seq2.getResidues(34,52)); System.out.println("Alphabetic Sequence 2-80 = " + seq2.getResidues(2,80)); } }
genome-vendor/apollo
src/java/apollo/datamodel/seq/DebugLazySequence.java
Java
bsd-3-clause
2,224
/** * Copyright (c) 2008-2016, Massachusetts Institute of Technology (MIT) * 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. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * */ package edu.mit.ll.sacore.tools.cli; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.GnuParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Options; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import edu.mit.ll.sacore.tools.user.AddArcGISLayers; import edu.mit.ll.sacore.tools.user.AddUserToPhiApache; import edu.mit.ll.sacore.tools.user.ChangeUsername; import edu.mit.ll.sacore.tools.user.CopyUserOrg; import edu.mit.ll.sacore.tools.user.CreateContact; import edu.mit.ll.sacore.tools.user.CreateFolderWorkspace; import edu.mit.ll.sacore.tools.user.CreateUser; import edu.mit.ll.sacore.tools.user.CreateUserOrg; import edu.mit.ll.sacore.tools.user.CreateUserOrgWorkspace; import edu.mit.ll.sacore.tools.user.OpenLDAPHelper; import edu.mit.ll.sacore.tools.user.RetrievePassword; import edu.mit.ll.sacore.tools.user.SyncUsers; import edu.mit.ll.sacore.tools.user.ValidatePassword; /** * */ public class UserManagementCLI { private Logger log; public static void main(String[] args){ UserManagementCLI cli = new UserManagementCLI(); cli.handleArgs(args); } public UserManagementCLI() { log = LoggerFactory.getLogger(UserManagementCLI.class); } public void handleArgs(String args[]) { try { Options opt = new Options(); opt.addOption("help", false, "Print help for this application"); opt.addOption("dbu", "db-username", true, "The username to use for the database"); opt.addOption("dbp", "dp-password", true, "The password to use for the database"); opt.addOption("h", "host", true, "The db server url to connect to"); opt.addOption("db", true, "The schema/database to connect use"); opt.addOption("dbu2", "db-username", true, "The username to use for the database to copy to"); opt.addOption("dbp2", "dp-password", true, "The password to use for the database to copy to"); opt.addOption("h2", "host", true, "The db server url to connect to"); opt.addOption("db2", true, "The schema/database to connect use"); opt.addOption("gp", "get-password", true, "Query to find a user's password"); opt.addOption("c", "create-user", false, "Register a user in the database"); opt.addOption("u", "username", true, "Used with -c or -o or -con: the username of the user to create"); opt.addOption("p", "password", true, "Used with -c: the password of the user to create"); opt.addOption("fn", "firstname", true, "Used with -c: The user's first name"); opt.addOption("ln", "lastname", true, "Used with -c: The user's last name"); opt.addOption("dt", "date", true, "Used with -c: The date the account was created"); opt.addOption("en", "enabled-create", false, "Used with -c or -o: if the user should be enabled"); opt.addOption("o", "user-org", false, "Register a user with a particular organization"); opt.addOption("org", "org-name", true, "Used with -o: the name of the org to register with"); opt.addOption("r", "rolename", true, "Used with -o: the name of the role the user has in the org"); opt.addOption("rank", true, "Used with -o: the user's rank"); opt.addOption("unit", true, "Used with -o: the user's unit"); opt.addOption("n","rabbit-node", true, "The rabbit node name -- rabbit@hostname"); opt.addOption("ck","rabbit-cookie", true, "The rabbit cookie value (machine specific)"); opt.addOption("con","create-contact", false, "Create a contact entry for a user"); opt.addOption("ctype", "contact-type", true, "Used with -con: the contact-type string"); opt.addOption("cval", "contact-value", true, "Used with -con: the contact value"); opt.addOption("chu", "change-username", false, "Change a user's username"); opt.addOption("on", "old-name", true, "Used with -chu (--change-username): old username to change from"); opt.addOption("nn", "new-name", true, "Used with -chu (--change-username): new username"); opt.addOption("vp", "validate-password", true, "Validate logging into rabbit with the password from the database"); opt.addOption("cu", "create-rabbit-user", true, "Create rabbit user if user does not exist"); opt.addOption("uow", "create-userorg-workspace", true, "Create userorg workspace"); opt.addOption("fw", "create-folder-workspace", true, "Create folder workspace"); opt.addOption("rfw", "create-root-folder-workspace", true, "Create folder workspace"); opt.addOption("su", "sync-two-databases", true, "Sync two different user tables"); opt.addOption("lu", "list users", true, "List users that do not exist"); opt.addOption("cws", "copy workspaceid", true, "Workspaceid"); opt.addOption("iws", "insert workspaceid", true, "Workspaceid"); opt.addOption("jasypt", false,"Encrypt or decrypt passwords for use with OpenAM"); opt.addOption("eord", true, "used with -jasypt: 'e' or 'd' for encrypt or decrypt"); opt.addOption("pass", true, "used with -jasypt: the input to encrypt"); opt.addOption("sso", false, "SSO Usermanagement Actions"); opt.addOption("setstatus", true, "used with -sso: 'e' or 'd' for enable or disable SSO user"); opt.addOption("wldapi", "write-ldap-info", false, "Write ldif file with user info from NICS"); opt.addOption("user", true, "Used with -wldapi: the username"); opt.addOption("password", true, "Used with -wldapi: the password"); opt.addOption("first", true, "Used with -wldapi: User's first name"); opt.addOption("last", true, "Used with -wldapi: User's last name"); opt.addOption("proppath", "property-path", true, "Specify property path for SSO properties"); //opt.getOption("user").setOptionalArg(true); opt.addOption("setrp", "set-rabbit-pass", false, "Set every user's rabbit account to the specified password"); opt.addOption("p", true, "used with -setrp, specify the password to set"); opt.addOption("copy", "copy-userorg", true, "Copy User Orgs from one user to another"); opt.addOption("fUser", "from-user", true, "From User"); opt.addOption("tUser", "to user", true, "To User"); opt.addOption("arcgis", "argis", true, "ArcGis layers"); opt.addOption("url", "url", true, "url"); opt.addOption("folderName", "folder-name", true, "Folder"); opt.addOption("parentFolderId", "parent-folder-id", true, "Parent Folder"); opt.addOption("phiP", "phinics-password", true, "Password"); opt.addOption("apache", "add-to-appache", true, "Add to Phi_apache table"); GnuParser parser = new GnuParser(); CommandLine cl = parser.parse(opt, args); if (cl.hasOption("help")) { HelpFormatter f = new HelpFormatter(); f.printHelp("-h -db -dbu -dbp [-c -u -p [-en -fn -ln]] [-o -org -u -r [-en]] [-con -u -ctype -cval] [-gp] [-dlw] [-fw] [-uow] [-su] [-cws] [-iws] [-copy -fUser -tUser] [-jasypt] [-wldapi] [-setrp -pass]", opt); } else { if (cl.hasOption('c')) { if (!(cl.hasOption("u") && cl.hasOption("p") && cl.hasOption("n") && cl.hasOption("ck"))) { System.out.println("create-user command requires -u, -p, -n, and -ck values"); System.exit(1); } else{ // create user CreateUser create = new CreateUser(cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db")); create.setRabbitCookie(cl.getOptionValue("ck")); create.setRabbitNode(cl.getOptionValue("n")); boolean res = create.createUserEntry(cl.getOptionValue("u"), cl.getOptionValue("p"), cl.hasOption("en"), cl.getOptionValue("fn"), cl.getOptionValue("ln"), cl.getOptionValue("dt")); if(res){ System.out.println("created " + cl.getOptionValue("u")); } else{ System.out.println("could not create " + cl.getOptionValue("u")); System.exit(1); } } } else if (cl.hasOption("o")){ if(!(cl.hasOption("org") && cl.hasOption('u') && cl.hasOption('r'))){ System.out.println("user-org command requires -org -u and -r values"); System.exit(1); } else{ //register user with org CreateUserOrg create = new CreateUserOrg(cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db")); boolean res = create.createUserOrgEntry(cl.getOptionValue('u'), cl.getOptionValue("org"), cl.getOptionValue('r'), cl.hasOption("en"), cl.getOptionValue("rank"), cl.getOptionValue("unit")); if(res){ System.out.println("registered " + cl.getOptionValue('u') + " with org " + cl.getOptionValue("org")); } else{ System.out.println("could not register " + cl.getOptionValue('u') + " with org " + cl.getOptionValue("org")); System.exit(1); } } } else if (cl.hasOption("con")){ if(!(cl.hasOption("u") && cl.hasOption("ctype") && cl.hasOption("cval"))){ System.out.println("create-contact command requires -u -ctype and -cval values"); System.exit(1); } else{ // register contact info CreateContact create = new CreateContact(cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db")); boolean res = create.createContactEntry(cl.getOptionValue('u'), cl.getOptionValue("ctype"), cl.getOptionValue("cval")); if(res){ System.out.println("added contact info for " + cl.getOptionValue('u')); } else{ System.out.println("could not add contact info for " + cl.getOptionValue('u')); System.exit(1); } } } else if (cl.hasOption("gp")){ RetrievePassword retrieve = new RetrievePassword(cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db")); String password = retrieve.findPasswordByUserName(cl.getOptionValue("gp")); if(password != null){ System.out.println(password); } else{ System.out.print("nothing found for " + cl.getOptionValue("gp")); System.exit(1); } } else if (cl.hasOption("lu")){ RetrievePassword retrieve = new RetrievePassword(cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db")); boolean exists = retrieve.locateUser(cl.getOptionValue("lu")); if(!exists){ System.out.println(cl.getOptionValue("lu")); } } else if (cl.hasOption("vp")){ //String password, String host, String database, String rabbitNode, String cookie ValidatePassword validate = new ValidatePassword( cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db"), cl.getOptionValue("n"), cl.getOptionValue("ck")); validate.validateRabbitLogin(cl.getOptionValue("vp"), cl.getOptionValue("cu")); System.exit(1); } else if (cl.hasOption("chu")){ ChangeUsername change = new ChangeUsername(cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db")); change.setRabbitCookie(cl.getOptionValue("ck")); change.setRabbitNode(cl.getOptionValue("n")); boolean res = change.changeUsername(cl.getOptionValue("on"), cl.getOptionValue("nn")); if(res){ System.out.println("changed username for " + cl.getOptionValue("on") + " to " + cl.getOptionValue("nn")); } else { System.out.println("couldn't change username for " + cl.getOptionValue("on")); } }else if (cl.hasOption("fw") && cl.hasOption("cws") && cl.hasOption("iws")){ // datalayer workspace CreateFolderWorkspace create = new CreateFolderWorkspace( cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db"), cl.getOptionValue("cws"), cl.getOptionValue("iws")); boolean res = create.createFolderWorkspace(); if(res){ System.out.println("created folder workspace"); } else{ System.out.println("could not create " + cl.getOptionValue("u")); System.exit(1); } }else if (cl.hasOption("rfw") && cl.hasOption("cws") && cl.hasOption("iws")){ // datalayer workspace CreateFolderWorkspace create = new CreateFolderWorkspace( cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db"), cl.getOptionValue("cws"), cl.getOptionValue("iws")); boolean res = create.createRootFolderWorkspace(); if(res){ System.out.println("created root folder workspace"); } else{ System.out.println("could not create " + cl.getOptionValue("u")); System.exit(1); } }else if (cl.hasOption("uow")){ // userorg workspace CreateUserOrgWorkspace create = new CreateUserOrgWorkspace( cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db")); boolean res = create.createUserOrgWorkspace(); if(res){ System.out.println("created userorg workspace"); } else{ System.out.println("could not create " + cl.getOptionValue("u")); System.exit(1); } }else if (cl.hasOption("su")){ // userorg workspace SyncUsers sync = new SyncUsers( cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue("h"), cl.getOptionValue("db"), cl.getOptionValue("dbu2"), cl.getOptionValue("dbp2"), cl.getOptionValue("h2"), cl.getOptionValue("db2")); sync.syncDatabases(); } else if(cl.hasOption("jasypt")) { String which = cl.getOptionValue("eord"); String pass = cl.getOptionValue("pass"); String resultVal = ""; boolean valid = true; if(which.equals("e")) { resultVal = OpenLDAPHelper.encrypt(pass); } else if(which.equals("d")) { resultVal = OpenLDAPHelper.decrypt(pass); } else { log.warn("Unsupported eord parameter: " + which); valid = false; } if(valid) { log.info(((which.equals("e")) ? "En" : "De") + "crypted password: " + resultVal + "\n\n"); } System.exit(0); } else if(cl.hasOption("wldapi")) { String propPath = cl.getOptionValue("proppath"); log.info("Got param proppath: " + propPath); System.setProperty("ssoToolsPropertyPath", propPath); System.setProperty("openamPropertiesPath", propPath); log.info((cl.getOptionValue("user") != null && !cl.getOptionValue("user").isEmpty()) ? ("User specified: " + cl.getOptionValue("user")) : "No user specified"); OpenLDAPHelper ldapHelper = new OpenLDAPHelper( cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue("h"), cl.getOptionValue("db"), true, true, cl.getOptionValue("user")); // TODO: make last two options //log.info(ldapHelper.writeLDIFFile()); log.info("Token success: " + ldapHelper.createUser(cl.getOptionValue("user"), cl.getOptionValue("first"), cl.getOptionValue("last"),cl.getOptionValue("password"))); System.exit(0); } else if(cl.hasOption("sso")) { String propPath = cl.getOptionValue("proppath"); log.info("Got param proppath: " + propPath); System.setProperty("ssoToolsPropertyPath", propPath); System.setProperty("openamPropertiesPath", propPath); String user = cl.getOptionValue("user"); if(user == null || user.isEmpty()) { log.info("Must pass in valid user/email address!"); System.exit(1); } String setStatus = cl.getOptionValue("setstatus"); boolean status = false; if(setStatus.toLowerCase().equals("e")) { status = true; } else if(setStatus.toLowerCase().equals("d")) { status = false; } else { // Unknown setstatus parameter, exit log.info("Passed in unknown parameter to -sso -setstatus: " + setStatus + ". Must be 'e' or 'd'\n"); System.exit(1); } OpenLDAPHelper ldapHelper = new OpenLDAPHelper(); log.info("SSO Set User Status returned with: " + ldapHelper.setUserStatus(user, status)); System.exit(0); } else if(cl.hasOption("setrp")) { String username = cl.getOptionValue("setrp"); String pass = cl.getOptionValue("pass"); boolean hasUser = false; if(username == null || username.isEmpty()) { //log.info("\n-setrp must specify a user: -setrp [email protected]\n"); //System.exit(1); } else { hasUser = true; } if(pass == null || pass.isEmpty()) { log.info("\n-setrp requires a valid -pass parameter!\n"); System.exit(1); } ValidatePassword validate = new ValidatePassword( cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db"), cl.getOptionValue("n"), cl.getOptionValue("ck")); // TODO:SOO check for option for syncing ALL or just sycning a user if(hasUser) { log.info("Setting specified user's rabbit password to the specified password..."); validate.syncToInstancePassword(username, cl.getOptionValue("pass"), cl.getOptionValue("cu")); } else { log.info("Setting all users rabbit passwords to the specified password..."); validate.syncAllRabbitUsersToInstancePassword(cl.getOptionValue("pass"), cl.getOptionValue("cu")); } System.exit(0); }else if (cl.hasOption("copy")){ //copy user organizations CopyUserOrg copyUserOrg = new CopyUserOrg( cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db")); boolean res = copyUserOrg.copyFrom(cl.getOptionValue("fUser"), cl.getOptionValue("tUser")); if(res){ System.out.println("userorgs were copied from " + cl.getOptionValue("fUser") + "'s user account to " + cl.getOptionValue("tUser")); } else{ System.out.println("could not create " + cl.getOptionValue("u")); System.exit(1); } }else if (cl.hasOption("arcgis")){ AddArcGISLayers addLayers = new AddArcGISLayers( cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db")); boolean res = addLayers.createLayers(cl.getOptionValue("url"), cl.getOptionValue("folderName"), cl.getOptionValue("parentFolderId")); if(res){ System.out.println("Datalayers were add for " + cl.getOptionValue("aUrl")); } else{ System.out.println("Could not create datalayers for " + cl.getOptionValue("aUrl")); System.exit(1); } }else if (cl.hasOption("apache")){ AddUserToPhiApache apache = new AddUserToPhiApache( cl.getOptionValue("dbu"), cl.getOptionValue("dbp"), cl.getOptionValue('h'), cl.getOptionValue("db")); boolean res = apache.addUsers(); if(res){ System.out.println("Users have been added to the phi_apache table."); }else{ System.out.println("There were issues adding users to the phi_apache table"); } } } } catch (Exception e) { log.error("error completing action", e); System.exit(1); } } }
hadrsystems/nics-tools
user-management-tools/src/main/java/edu/mit/ll/sacore/tools/cli/UserManagementCLI.java
Java
bsd-3-clause
25,905
package de.bwaldvogel.mongo; import de.bwaldvogel.AbstractReadOnlyProxyTest; import de.bwaldvogel.mongo.backend.h2.H2Backend; public class H2BackendReadOnlyProxyTest extends AbstractReadOnlyProxyTest { @Override protected MongoBackend createBackend() throws Exception { return H2Backend.inMemory(); } }
bwaldvogel/mongo-java-server
h2-backend/src/test/java/de/bwaldvogel/mongo/H2BackendReadOnlyProxyTest.java
Java
bsd-3-clause
327
//********************************************************************************************************************* // FuzzerHelper.java // // Copyright 2014 ELECTRIC POWER RESEARCH INSTITUTE, INC. All rights reserved. // // PT2 ("this software") is licensed under BSD 3-Clause license. // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // • Redistributions of source code must retain the above copyright notice, this list of conditions and // the following disclaimer. // // • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and // the following disclaimer in the documentation and/or other materials provided with the distribution. // // • Neither the name of the Electric Power Research Institute, Inc. (“EPRI”) nor the names of its contributors // may be used to endorse or promote products derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL EPRI BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // //********************************************************************************************************************* // // Code Modification History: // ------------------------------------------------------------------------------------------------------------------- // 11/20/2012 - Tam T. Do, Southwest Research Institute (SwRI) // Generated original version of source code. // 10/22/2014 - Tam T. Do, Southwest Research Institute (SwRI) // Added DNP3 software capabilities. //********************************************************************************************************************* // package org.epri.pt2.fuzzer; import java.util.List; import org.epri.pt2.DO.AbstractPacketDO; import org.epri.pt2.fuzzer.request.RequestResult; import org.epri.pt2.fuzzer.request.RequestSenderImpl; import org.epri.pt2.fuzzer.request.SendEventListener; import org.epri.pt2.proxy.FilterDO; import org.epri.pt2.proxy.ProxyController; import org.epri.pt2.proxy.ProxyFuzzerInterceptor; //import org.epri.pt2.sniffer.EthernetDataPacket; /** * Provides helper methods for sending request and response fuzz packets. * * @author Tam Do * */ public class FuzzerHelper implements SendEventListener { private final Object lock = new Object(); // private EthernetDataPacket packet; private RequestResult result; private enum MessageState { REQUEST_SENT, RESPONSE_RECEIVED } private ProxyFuzzerInterceptor responseInterceptor; private MessageState state; public FuzzerHelper() { responseInterceptor = ProxyController.getInstance() .getFuzzerInterceptor(); } public RequestResult sendRequest(AbstractPacketDO packet) { synchronized (lock) { state = MessageState.REQUEST_SENT; RequestSenderImpl.sendPacket(packet, this); while (state != MessageState.RESPONSE_RECEIVED) { try { lock.wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }; return result; } } public void queueResponse(FilterDO filter) { responseInterceptor.queueResponse(filter); } public void queueResponses(List<FilterDO> filters) { responseInterceptor.queueResponses(filters); } public int getRemainingResponses() { return responseInterceptor.getRemainingTests(); } public void sendCompleted(AbstractPacketDO packet, RequestResult result) { synchronized (lock) { // this.packet = packet; this.result = result; state = MessageState.RESPONSE_RECEIVED; lock.notify(); } } }
epri-dev/PT2
src/main/java/org/epri/pt2/fuzzer/FuzzerHelper.java
Java
bsd-3-clause
4,318
package edu.ucdenver.ccp.datasource.identifiers.impl.bio; import edu.ucdenver.ccp.datasource.fileparsers.CcpExtensionOntology; /* * #%L * Colorado Computational Pharmacology's common module * %% * Copyright (C) 2012 - 2014 Regents of the University of Colorado * %% * 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. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the Regents of the University of Colorado nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * #L% */ import edu.ucdenver.ccp.datasource.identifiers.DataSource; import edu.ucdenver.ccp.datasource.identifiers.Identifier; import edu.ucdenver.ccp.datasource.identifiers.StringDataSourceIdentifier; @Identifier(ontClass=CcpExtensionOntology.EUHCVDB_IDENTIFIER) public class EuHCVdbId extends StringDataSourceIdentifier { public EuHCVdbId(String id) { super(id, DataSource.EUHCVDB); } }
UCDenver-ccp/datasource
datasource-fileparsers/src/main/java/edu/ucdenver/ccp/datasource/identifiers/impl/bio/EuHCVdbId.java
Java
bsd-3-clause
2,208