method_id
stringlengths 36
36
| cyclomatic_complexity
int32 0
9
| method_text
stringlengths 14
410k
|
---|---|---|
af8a61c6-c7be-4a46-b2de-4ebb39df40dc | 8 | public void cluster() {
_ls.log("clustering");
/* If it is the first time, create the k-means clustering points. */
if (_firstTime)
generateInitialMeans();
/* Reset the associations between means and points. */
Map<NamedPoint, Set<NamedPoint>> assignments =
new HashMap<NamedPoint, Set<NamedPoint>>();
for (NamedPoint mean : _means)
assignments.put(mean, new HashSet<NamedPoint>());
/* Associate every point with the nearest mean. */
for (NamedPoint np : _points) {
double currentDistance = Double.MAX_VALUE;
NamedPoint meanToAssignTo = null; //TODO: could be bad if 0 means
for (NamedPoint mean : _means) {
if (mean.distance(np) < currentDistance) {
np.setColor(mean.getColor());
currentDistance = mean.distance(np);
meanToAssignTo = mean;
}
}
assignments.get(meanToAssignTo).add(np);
}
/* Move the mean to the center of the points assigned to it. */
for (NamedPoint mean : assignments.keySet()) {
int sumX = 0;
int sumY = 0;
for (NamedPoint np : assignments.get(mean)) {
sumX += np.getXPosition();
sumY += np.getYPosition();
}
if (assignments.get(mean).size() != 0) {
mean.setXPosition(sumX/assignments.get(mean).size());
mean.setYPosition(sumY/assignments.get(mean).size());
}
}
// + tell the view the locations of the means and the Voronoi lines
// TODO: figure out how to draw Voronoi lines
updateView();
} |
649c3847-feb1-41d2-b39e-81e440ab691d | 5 | @Command(command = "unfreeze",
arguments = {"target player[s]"},
description = "unfreezes the target players in their place",
permissions = {"unfreeze"})
public static boolean unfreeze(CommandSender sender, String targetPlayer) throws EssentialsCommandException {
// get a list of all target players
ArrayList<Player> targetPlayers = PlayerSelector.selectPlayersExact(targetPlayer);
// make sure we have at least one target player
if(targetPlayers.size() == 0) {
throw new EssentialsCommandException("I couldn't find / parse target player[s] '%s' to unfreeze!", targetPlayer);
}
// loop through all target players
for(Iterator<Player> it = targetPlayers.iterator(); it.hasNext();) {
// get the player
Player target = it.next();
// only if they aren't already frozen
if(!isFrozen(target)) {
if(sender.getName().equals(target.getName())) {
ColourHandler.sendMessage(target, "&bYou weren't even frozen!");
}
else {
ColourHandler.sendMessage(sender, "&b%s wasn't frozen anyway!", target.getName());
}
continue;
}
// remove the metadata
target.removeMetadata("frozen", MCNSAEssentials.getInstance());
// alert them
if(sender.getName().equals(target.getName())) {
ColourHandler.sendMessage(target, "&bYou unfroze yourself!");
}
else {
ColourHandler.sendMessage(target, "&bYou have been unfrozen by %s!", sender.getName());
ColourHandler.sendMessage(sender, "&b" + target.getName() + " has been unfrozen!");
}
}
return true;
} |
455c2ba0-6770-4ece-87d5-8ca6579d0111 | 7 | public void setUnit(Unit unit, Player unitOwner, ActionListener actionListener, boolean unitActive)
{
if (unit == null) {
setUnitUIVisible(false);
nameLabel.setText(""); //If the panel labelled "unit" is empty, it should be clear that no unit is selected.
} else {
setUnitUIVisible(true);
nameLabel.setText(" " + unit.getName()); //Add a space before the name since it looks better.
if (unitOwner != null) {
factionLabel.setText(" of the " + unitOwner.getTheme().getFactionName());
} else {
factionLabel.setText(" (independant) ");
}
portraitPanel.removeAll();
try {
portraitPanel.add(new JLabel("", new ImageIcon(unit.getImage()), JLabel.CENTER));
} catch (IllegalArgumentException exception) {
exception.printStackTrace();
} catch (IOException exception) {
exception.printStackTrace();
}
displayHealth(unit);
displayMove(unit);
statusPanel.removeAll();
if (unit.getStatuses().isEmpty()) {
JLabel normalLabel = new JLabel();
normalLabel.setText("Status: NORMAL");
statusPanel.add(normalLabel);
} else {
for (UnitStatus status : unit.getStatuses()) {
addStatus(status.getType(), status.getRemainingDuration());
}
}
//Make the ability panel exactly big enough for all the abilities.
abilitiesPanel.removeAll();
abilitiesPanel.setPreferredSize(new Dimension(AbilityPanel.WIDTH, unit.getAbilities().size()*AbilityPanel.HEIGHT));
for (Ability ability : unit.getAbilities()) {
abilitiesPanel.add(new AbilityPanel(ability, actionListener, unitActive));
}
revalidate(); //Always validate the entire panel when its components change.
repaint();
}
} |
5e1e3f9e-21c3-4529-b330-666723d10da1 | 8 | @Override
public synchronized void movePlayer(SHServiceClient shServiceClientImpl,
char movement) throws RemoteException {
//First, we send the request to the servers linked to this one for the update
if(this.getIsPrimary()){
for(SHService shServiceImpl: listServices){
if(!(shServiceImpl.getHostAdress().equals(this.getHostAdress()) && (shServiceImpl.getPort() == this.getPort())) )
shServiceImpl.movePlayer(shServiceClientImpl, movement);
}
}
//Then we execute the request
if(movement == 'r') this.movePlayerToRight(shServiceClientImpl);
if(movement == 'l') this.movePlayerToLeft(shServiceClientImpl);
if(movement == 'u') this.movePlayerToUp(shServiceClientImpl);
if(movement == 'd') this.movePlayerToDown(shServiceClientImpl);
} |
d633ec8d-2390-4d49-b83e-e61f3c0bf508 | 9 | public static void main(String[] args) throws Exception
{
checkState(args.length == 2, "Expecting host and port as args");
SocketAddress addr = new InetSocketAddress(args[0], Integer.parseInt(args[1]));
try (RedisConnection conn = RedisConnection.connect(addr))
{
System.out.println("Connected");
conn.registerSerializer(new RedisSerializer(){
@Override
public boolean canSerialize(Object obj)
{
return true;
}
@Override
public byte[] serialize(Object obj) throws IOException
{
String toSerialize = Preconditions.firstNonNull(obj, "null").toString();
return toSerialize.getBytes(StandardCharsets.UTF_16);
}});
System.out.println("Testing sending a command");
RedisReply reply = conn.sendCommand("PING");
checkState(reply.getType() == RedisReply.Type.STATUS, "Expecting status reply");
checkState("pong".equalsIgnoreCase(reply.getString()), "Expected pong as a reply");
System.out.println("Testing sending verbatim command");
reply = conn.sendCommand("SET foo bar");
checkState(reply.getType() == RedisReply.Type.STATUS, "Expecting status reply");
checkState("ok".equalsIgnoreCase(reply.getString()), "Expected ok as a reply");
System.out.println("Testing string interpolation");
conn.sendCommand("SET %s %s","foo","hello world");
reply = conn.sendCommand("GET foo");
checkState(reply.getType() == RedisReply.Type.STRING, "Expecting string reply");
checkState("hello world".equals(reply.getString()), "Expected hello world as a reply");
System.out.println("Testing binary serialization");
byte[] helloWorldBytes = "hello world".getBytes(StandardCharsets.UTF_16);
conn.sendCommand("SET %s %b", "foo", "hello world");
reply = conn.sendCommand("GET foo");
checkState(reply.getType() == RedisReply.Type.STRING, "Expecting string reply");
checkState(Arrays.equals(helloWorldBytes, reply.getBytes()), "Expecting equal byte length returned");
System.out.println("Testing nil reply");
reply = conn.sendCommand("GET nokey");
checkState(reply.getType() == RedisReply.Type.NIL, "Expecting nil reply");
System.out.println("Testing integer replies");
conn.sendCommand("DEL mycounter");
reply = conn.sendCommand("INCR mycounter");
checkState(reply.getType() == RedisReply.Type.INTEGER, "Expecting integer reply");
checkState(reply.getInteger() == 1, "Expecting count to be 1");
System.out.println("Testing multi bulk replies");
conn.sendCommand("DEL mylist");
conn.sendCommand("LPUSH mylist foo");
conn.sendCommand("LPUSH mylist bar");
reply = conn.sendCommand("LRANGE mylist 0 -1");
checkState(reply.getType() == RedisReply.Type.ARRAY, "Expecting array type");
checkState(reply.getElements().length == 2, "Expecting two elements in the result");
checkState("bar".equals(BufferUtils.decode(reply.getElements()[0].getBytes())), "Expecting bar as the first result");
checkState("foo".equals(BufferUtils.decode(reply.getElements()[1].getBytes())), "Expecting foo as the second result");
System.out.println("Testing nested multi bulk replies");
conn.sendCommand("MULTI");
conn.sendCommand("LRANGE mylist 0 -1");
conn.sendCommand("PING");
reply = conn.sendCommand("EXEC");
checkState(reply.getType() == RedisReply.Type.ARRAY, "Expecting array type");
checkState(reply.getElements().length == 2, "Expecting 2 elements");
checkState(reply.getElements()[0].getType() == RedisReply.Type.ARRAY, "Expecting nested array type");
checkState(reply.getElements()[0].getElements().length == 2, "Expecting 2 nested elements");
checkState("bar".equals(BufferUtils.decode(reply.getElements()[0].getElements()[0].getBytes())), "Expecting bar as the first nested element");
checkState("foo".equals(BufferUtils.decode(reply.getElements()[0].getElements()[1].getBytes())), "Expecting foo as the second nested element");
checkState(reply.getElements()[1].getType() == RedisReply.Type.STATUS, "Expecting nested status type");
checkState("pong".equalsIgnoreCase(BufferUtils.decode(reply.getElements()[1].getBytes())), "Expected pong");
System.out.println("Testing exception on error");
try
{
conn.exceptionOnError(true);
reply = conn.sendCommand("GARBAGE");
checkState(false, "Invalid command should have thrown an error");
}
catch (IOException e)
{
// Test passed
}
System.out.println("\r\n--Testing throughput --\r\n");
for (int x = 0; x < 5; x++)
{
for (int i = 0; i < 500; i++)
{
conn.sendCommand("LPUSH mylist foo");
}
RedisReply[] replies = new RedisReply[1000];
long t1 = System.currentTimeMillis();
for (int i = 0; i < 1000; i++)
{
replies[i] = conn.sendCommand("PING");
checkState(replies[i].getType() == RedisReply.Type.STATUS, "Expecting status on all replies");
}
long t2 = System.currentTimeMillis();
System.out.println("1000 PING: " + (t2 - t1) + " ms");
t1 = System.currentTimeMillis();
for (int i = 0; i < 1000; i++)
{
replies[i] = conn.sendCommand("LRANGE mylist 0 499");
checkState(replies[i].getType() == RedisReply.Type.ARRAY, "Expecting array for all replies");
checkState(replies[i].getElements().length == 500, "Expecting 500 replies");
}
t2 = System.currentTimeMillis();
System.out.println("1000 LRANGE with 500 elements: " + (t2 - t1) + " ms");
replies = new RedisReply[10000];
for (int i = 0; i < 10000; i++)
{
conn.appendCommand("PING");
}
t1 = System.currentTimeMillis();
for (int i = 0; i < 10000; i++)
{
replies[i] = conn.getReply();
checkState(replies[i].getType() == RedisReply.Type.STATUS, "Expecting status on each reply");
}
t2 = System.currentTimeMillis();
System.out.println("10,000 PING pipelined: " + (t2 - t1) + " ms");
for (int i = 0; i < 10000; i++)
{
conn.appendCommand("LRANGE mylist 0 499");
}
t1 = System.currentTimeMillis();
for (int i = 0; i < 10000; i++)
{
replies[i] = conn.getReply();
checkState(replies[i].getType() == RedisReply.Type.ARRAY, "Expecting array for each reply");
checkState(replies[i].getElements().length == 500, "Expecting 500 elements for each reply");
}
t2 = System.currentTimeMillis();
System.out.println("10,000 LRANGE with 500 elements pipelined: " + (t2 - t1) + " ms");
}
}
System.out.println("All test passed");
System.exit(0);
} |
fe859f10-c20a-4c96-9d87-d23f8f5cadce | 6 | public static int countNumberOfRepairersForBuilding(Unit building) {
if (building == null) {
return 0;
}
int total = 0;
for (Unit worker : repairers) {
if (worker == null) {
return 0;
}
if (repairersToBuildings.get(worker) == null) {
continue;
}
if (repairersToBuildings.get(worker).equals(building)
|| building.equals(worker.getTargetUnitID())) {
total++;
}
}
return total;
} |
eb57b103-ab1f-4451-9f1d-2606b4620230 | 8 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
if(!(target instanceof MOB))
return Ability.QUALITY_INDIFFERENT;
if(((MOB)target).amDead()||(!CMLib.flags().canBeSeenBy(target,mob)))
return Ability.QUALITY_INDIFFERENT;
if((mob.isInCombat())&&(CMLib.flags().isAliveAwakeMobile((MOB)target,true)||(mob.getVictim()!=target)))
return Ability.QUALITY_INDIFFERENT;
if(!((MOB)target).mayIFight(mob))
return Ability.QUALITY_INDIFFERENT;
}
return super.castingQuality(mob,target);
} |
9d3cfb27-cbfb-4578-8714-a9304f6f0810 | 5 | public void tryToFire(boolean isEpic) {
// check that we have waiting long enough to fire
if (System.currentTimeMillis() - lastFire < firingInterval) {
return;
}
// if we waited long enough, create the shot entity, and record the time.
lastFire = System.currentTimeMillis();
ShotEntity shot = new ShotEntity(this,"sprites/shot.gif",ship.getX()+12,ship.getY()-5,upgradePanel.getLevel("ShtPwr"),0);
entities.add(shot);
shot = new ShotEntity(this,"sprites/shot.gif",ship.getX()+6,ship.getY()-5,upgradePanel.getLevel("ShtPwr"),0);
entities.add(shot);
if(isEpic&&power.getPower()>=10){
for(int i = 0;i<=upgradePanel.getLevel("BoPwr");i++){
int shotPos;
if(i%2==0){
shotPos = (9+((int) Math.ceil(((double)i)/2)));
} else {
shotPos = (9-((int) Math.ceil(((double)i)/2)));
}
shot = new ShotEntity(this,"sprites/shot2.gif",ship.getX()+shotPos,ship.getY()-5,1,0);
entities.add(shot);
}
shot = new ShotEntity(this,"sprites/shot2.gif",ship.getX()+9,ship.getY()-5,1,0);
entities.add(shot);
power.addPower(-10);
}
} |
97689d37-0568-4c83-9c61-e36771585dd1 | 4 | private static void createFactories() {
if(Utilities.dbFactory == null) {
Utilities.dbFactory = DocumentBuilderFactory.newInstance();
Utilities.dbFactory.setNamespaceAware(true);
}
if(Utilities.xpFactory == null) {
Utilities.xpFactory = XPathFactory.newInstance();
}
if(Utilities.trFactory == null) {
Utilities.trFactory = TransformerFactory.newInstance();
}
if(Utilities.sFactory == null) {
Utilities.sFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
}
} |
8c38b4e7-5193-49a1-8758-4ffcc2059609 | 8 | @Override
public void actionPerformed(ActionEvent evt) {
String cmd = evt.getActionCommand();
switch (cmd) {
case IC_ADD:
addAlarm();
break;
case IC_EDIT:
editAlarm();
break;
case IC_DELETE:
deleteAlarm();
break;
case IC_START:
switchAlarm(true);
break;
case IC_STOP:
switchAlarm(false);
break;
case IC_SETTINGS:
break;
case IC_ABOUT:
AboutDialog dlg = new AboutDialog(mainFrame);
dlg.setLocationRelativeTo(mainFrame);
dlg.setVisible(true);
break;
case IC_EXIT:
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.dispose();
break;
}
} |
1c8bb2a6-7c59-469a-8ba3-6e3e9d2d99b7 | 6 | public static void startupXmlObjects() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/POWERLOOM-SERVER/GUI-SERVER", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if (Stella.currentStartupTimePhaseP(2)) {
_StartupXmlObjects.helpStartupXmlObjects1();
_StartupXmlObjects.helpStartupXmlObjects2();
}
if (Stella.currentStartupTimePhaseP(5)) {
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLString", "(DEFCLASS |PLString| (|XMLObject|) :PUBLIC-SLOTS ((|Value| :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLString", "new_PLString", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLString", "access_PLString_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLString"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLSurrogate", "(DEFCLASS |PLSurrogate| (|XMLObject|) :PUBLIC-SLOTS ((ID :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLSurrogate", "new_PLSurrogate", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLSurrogate", "access_PLSurrogate_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLSurrogate"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("ServerException", "(DEFCLASS |ServerException| (|XMLObject|) :PUBLIC-SLOTS ((|Type| :TYPE STRING) (|Message| :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.ServerException", "new_ServerException", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.ServerException", "access_ServerException_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.ServerException"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLModuleContainer", "(DEFCLASS |PLModuleContainer| (|XMLObject|) :PUBLIC-SLOTS ((|PLModule| :TYPE (LIST OF |PLModule|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLModuleContainer", "new_PLModuleContainer", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLModuleContainer", "access_PLModuleContainer_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLModuleContainer"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLModule", "(DEFCLASS |PLModule| (|XMLObject|) :PUBLIC-SLOTS ((|ModuleName| :TYPE STRING) (|SourceString| :TYPE STRING) (|CppPackage| :TYPE STRING) (|LispPackage| :TYPE STRING) (|JavaPackage| :TYPE STRING) (|JavaCatchallClass| :TYPE STRING) (|Documentation| :TYPE STRING) (API :TYPE STRING) (|CaseSensitive| :TYPE STRING) (|PLModule| :TYPE (LIST OF |PLModule|)) (|PLSurrogate| :TYPE (LIST OF |PLSurrogate|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLModule", "new_PLModule", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLModule", "access_PLModule_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLModule"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLConcept", "(DEFCLASS |PLConcept| (|XMLObject|) :PUBLIC-SLOTS ((|ConceptName| :TYPE STRING) (|Module| :TYPE STRING) (|SourceString| :TYPE STRING) (|PLConcept| :TYPE (LIST OF |PLConcept|)) (|PLSurrogate| :TYPE (LIST OF |PLSurrogate|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLConcept", "new_PLConcept", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLConcept", "access_PLConcept_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLConcept"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLConceptContainer", "(DEFCLASS |PLConceptContainer| (|XMLObject|) :PUBLIC-SLOTS ((|PLConcept| :TYPE (LIST OF |PLConcept|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLConceptContainer", "new_PLConceptContainer", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLConceptContainer", "access_PLConceptContainer_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLConceptContainer"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLRelation", "(DEFCLASS |PLRelation| (|XMLObject|) :PUBLIC-SLOTS ((|RelationName| :TYPE STRING) (|SourceString| :TYPE STRING) (|Module| :TYPE STRING) (|IsFunction| :TYPE STRING) (|IsClosed| :TYPE STRING) (|PLRelation| :TYPE (LIST OF |PLRelation|)) (|PLSurrogate| :TYPE (LIST OF |PLSurrogate|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLRelation", "new_PLRelation", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLRelation", "access_PLRelation_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLRelation"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLRelationContainer", "(DEFCLASS |PLRelationContainer| (|XMLObject|) :PUBLIC-SLOTS ((|PLRelation| :TYPE (LIST OF |PLRelation|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLRelationContainer", "new_PLRelationContainer", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLRelationContainer", "access_PLRelationContainer_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLRelationContainer"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLInstance", "(DEFCLASS |PLInstance| (|XMLObject|) :PUBLIC-SLOTS ((|InstanceName| :TYPE STRING) (|Module| :TYPE STRING) (|SourceString| :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLInstance", "new_PLInstance", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLInstance", "access_PLInstance_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLInstance"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLInstanceContainer", "(DEFCLASS |PLInstanceContainer| (|XMLObject|) :PUBLIC-SLOTS ((|PLInstance| :TYPE (LIST OF |PLInstance|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLInstanceContainer", "new_PLInstanceContainer", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLInstanceContainer", "access_PLInstanceContainer_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLInstanceContainer"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLProposition", "(DEFCLASS |PLProposition| (|XMLObject|) :PUBLIC-SLOTS ((|PropositionName| :TYPE STRING) (|IsStrict| :TYPE STRING) (|IsAsserted| :TYPE STRING) (|IsRule| :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLProposition", "new_PLProposition", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLProposition", "access_PLProposition_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLProposition"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLPropositionContainer", "(DEFCLASS |PLPropositionContainer| (|XMLObject|) :PUBLIC-SLOTS ((|PLProposition| :TYPE (LIST OF |PLProposition|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLPropositionContainer", "new_PLPropositionContainer", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLPropositionContainer", "access_PLPropositionContainer_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLPropositionContainer"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLRule", "(DEFCLASS |PLRule| (|XMLObject|) :PUBLIC-SLOTS ((|RuleName| :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLRule", "new_PLRule", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLRule", "access_PLRule_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLRule"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLVariable", "(DEFCLASS |PLVariable| (|XMLObject|) :PUBLIC-SLOTS ((|VariableName| :TYPE |PLString|) (|VariableType| :TYPE |PLSurrogate|)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLVariable", "new_PLVariable", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLVariable", "access_PLVariable_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLVariable"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLVariableList", "(DEFCLASS |PLVariableList| (|XMLObject|) :PUBLIC-SLOTS ((|PLVariable| :TYPE (LIST OF |PLVariable|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLVariableList", "new_PLVariableList", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLVariableList", "access_PLVariableList_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLVariableList"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLModuleFileList", "(DEFCLASS |PLModuleFileList| (|XMLObject|) :PUBLIC-SLOTS ((|PLModuleFile| :TYPE (LIST OF |PLModuleFile|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLModuleFileList", "new_PLModuleFileList", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLModuleFileList", "access_PLModuleFileList_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLModuleFileList"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLModuleFile", "(DEFCLASS |PLModuleFile| (|XMLObject|) :PUBLIC-SLOTS ((|KBName| :TYPE STRING) (|ModuleName| :TYPE STRING) (|KBDescription| :TYPE STRING) (|FileName| :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLModuleFile", "new_PLModuleFile", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLModuleFile", "access_PLModuleFile_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLModuleFile"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLFile", "(DEFCLASS |PLFile| (|XMLObject|) :PUBLIC-SLOTS ((|FileName| :TYPE STRING) (|PLFileContent| :TYPE |PLFileContent|)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLFile", "new_PLFile", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLFile", "access_PLFile_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLFile"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLFileContent", "(DEFCLASS |PLFileContent| (|XMLObject|) :PUBLIC-SLOTS ((|textContent| :ENCODING-SCHEME :BASE64)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLFileContent", "new_PLFileContent", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLFileContent", "access_PLFileContent_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLFileContent"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLDirectory", "(DEFCLASS |PLDirectory| (|XMLObject|) :PUBLIC-SLOTS ((|DirectoryName| :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLDirectory", "new_PLDirectory", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLDirectory", "access_PLDirectory_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLDirectory"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLDirectoryContents", "(DEFCLASS |PLDirectoryContents| (|XMLObject|) :PUBLIC-SLOTS ((|DirectoryName| :TYPE STRING) (|PLDirectory| :TYPE (LIST OF |PLDirectory|)) (|PLFile| :TYPE (LIST OF |PLFile|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLDirectoryContents", "new_PLDirectoryContents", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLDirectoryContents", "access_PLDirectoryContents_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLDirectoryContents"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLSurrogateCollection", "(DEFCLASS |PLSurrogateCollection| (|XMLObject|) :PUBLIC-SLOTS ((|PLSurrogate| :TYPE (LIST OF |PLSurrogate|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLSurrogateCollection", "new_PLSurrogateCollection", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLSurrogateCollection", "access_PLSurrogateCollection_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLSurrogateCollection"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLObjectUnion", "(DEFCLASS |PLObjectUnion| (|XMLObject|) :PUBLIC-SLOTS ((|Type| :TYPE STRING) (|PLSurrogate| :TYPE |PLSurrogate|) (|LiteralValue| :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLObjectUnion", "new_PLObjectUnion", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLObjectUnion", "access_PLObjectUnion_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLObjectUnion"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLTuple", "(DEFCLASS |PLTuple| (|XMLObject|) :PUBLIC-SLOTS ((|PLObjectUnion| :TYPE (LIST OF |PLObjectUnion|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLTuple", "new_PLTuple", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLTuple", "access_PLTuple_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLTuple"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLQuery", "(DEFCLASS |PLQuery| (|XMLObject|) :PUBLIC-SLOTS ((|IsAsk| :TYPE STRING) (|QueryName| :TYPE STRING) (|Query| :TYPE STRING) (|Module| :TYPE STRING) (|InferenceLevel| :TYPE STRING) (|Timeout| :TYPE STRING) (|Moveout| :TYPE STRING) (|MatchMode| :TYPE STRING) (|NumResults| :TYPE STRING) (|MinScore| :TYPE STRING) (|MaxUnknowns| :TYPE STRING) (|MaximizeScore| :TYPE STRING) (|DontOptimize| :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLQuery", "new_PLQuery", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLQuery", "access_PLQuery_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLQuery"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLQueryResult", "(DEFCLASS |PLQueryResult| (|XMLObject|) :PUBLIC-SLOTS ((|PLTuple| :TYPE (LIST OF |PLTuple|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLQueryResult", "new_PLQueryResult", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLQueryResult", "access_PLQueryResult_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLQueryResult"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLSearchParameter", "(DEFCLASS |PLSearchParameter| (|XMLObject|) :PUBLIC-SLOTS ((|ModuleName| :TYPE STRING) (|SearchString| :TYPE STRING) (|SearchConcept| :TYPE STRING) (|SearchRelation| :TYPE STRING) (|SearchInstance| :TYPE STRING) (|CaseSensitive| :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLSearchParameter", "new_PLSearchParameter", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLSearchParameter", "access_PLSearchParameter_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLSearchParameter"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLSearchResult", "(DEFCLASS |PLSearchResult| (|XMLObject|) :PUBLIC-SLOTS ((|PLSearchResultItem| :TYPE (LIST OF |PLSearchResultItem|))))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLSearchResult", "new_PLSearchResult", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLSearchResult", "access_PLSearchResult_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLSearchResult"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLSearchResultItem", "(DEFCLASS |PLSearchResultItem| (|XMLObject|) :PUBLIC-SLOTS ((|ModuleName| :TYPE STRING) (|PLObjectUnion| :TYPE |PLObjectUnion|)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLSearchResultItem", "new_PLSearchResultItem", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLSearchResultItem", "access_PLSearchResultItem_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLSearchResultItem"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
{ Stella_Class renamed_Class = Stella.defineClassFromStringifiedSource("PLServerInfo", "(DEFCLASS |PLServerInfo| (|XMLObject|) :PUBLIC-SLOTS ((|AllowRemoteFileBrowsing| :TYPE STRING)))");
renamed_Class.classConstructorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLServerInfo", "new_PLServerInfo", new java.lang.Class [] {});
renamed_Class.classSlotAccessorCode = Native.find_java_method("edu.isi.powerloom.server.gui.PLServerInfo", "access_PLServerInfo_Slot_Value", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLServerInfo"), Native.find_java_class("edu.isi.stella.Symbol"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE});
}
}
if (Stella.currentStartupTimePhaseP(6)) {
Stella.finalizeClasses();
}
if (Stella.currentStartupTimePhaseP(7)) {
Stella.defineMethodObject("(DEFMETHOD (OBJECT-EQL? BOOLEAN) ((X |PLConcept|) (Y OBJECT)) :DOCUMENTATION \"Return TRUE if `x' and `y' represent the same Concept\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.powerloom.server.gui.PLConcept", "objectEqlP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.Stella_Object")}), ((java.lang.reflect.Method)(null)));
Stella.defineMethodObject("(DEFMETHOD (OBJECT-EQL? BOOLEAN) ((X |PLRelation|) (Y OBJECT)) :DOCUMENTATION \"Return TRUE if `x' and `y' represent the same Relation\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.powerloom.server.gui.PLRelation", "objectEqlP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.Stella_Object")}), ((java.lang.reflect.Method)(null)));
Stella.defineMethodObject("(DEFMETHOD (OBJECT-EQL? BOOLEAN) ((X |PLInstance|) (Y OBJECT)) :DOCUMENTATION \"Return TRUE if `x' and `y' represent the same Instance\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.powerloom.server.gui.PLInstance", "objectEqlP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.Stella_Object")}), ((java.lang.reflect.Method)(null)));
Stella.defineMethodObject("(DEFMETHOD (OBJECT-EQL? BOOLEAN) ((X |PLProposition|) (Y OBJECT)) :DOCUMENTATION \"Return TRUE if `x' and `y' represent the same Propositions\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.powerloom.server.gui.PLProposition", "objectEqlP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.Stella_Object")}), ((java.lang.reflect.Method)(null)));
Stella.defineFunctionObject(" |PLSurrogate<|", "(DEFUN (|PLSurrogate<| BOOLEAN) ((INST1 |PLSurrogate|) (INST2 |PLSurrogate|)))", Native.find_java_method("edu.isi.powerloom.server.gui.PLSurrogate", "PLSurrogateL", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLSurrogate"), Native.find_java_class("edu.isi.powerloom.server.gui.PLSurrogate")}), null);
Stella.defineFunctionObject(" |PLModule<|", "(DEFUN (|PLModule<| BOOLEAN) ((INST1 |PLModule|) (INST2 |PLModule|)))", Native.find_java_method("edu.isi.powerloom.server.gui.PLModule", "PLModuleL", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLModule"), Native.find_java_class("edu.isi.powerloom.server.gui.PLModule")}), null);
Stella.defineFunctionObject(" |PLInstance<|", "(DEFUN (|PLInstance<| BOOLEAN) ((INST1 |PLInstance|) (INST2 |PLInstance|)))", Native.find_java_method("edu.isi.powerloom.server.gui.PLInstance", "PLInstanceL", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLInstance"), Native.find_java_class("edu.isi.powerloom.server.gui.PLInstance")}), null);
Stella.defineFunctionObject(" |PLConcept<|", "(DEFUN (|PLConcept<| BOOLEAN) ((INST1 |PLConcept|) (INST2 |PLConcept|)))", Native.find_java_method("edu.isi.powerloom.server.gui.PLConcept", "PLConceptL", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLConcept"), Native.find_java_class("edu.isi.powerloom.server.gui.PLConcept")}), null);
Stella.defineFunctionObject(" |PLRelation<|", "(DEFUN (|PLRelation<| BOOLEAN) ((INST1 |PLRelation|) (INST2 |PLRelation|)))", Native.find_java_method("edu.isi.powerloom.server.gui.PLRelation", "PLRelationL", new java.lang.Class [] {Native.find_java_class("edu.isi.powerloom.server.gui.PLRelation"), Native.find_java_class("edu.isi.powerloom.server.gui.PLRelation")}), null);
Stella.defineFunctionObject("STARTUP-XML-OBJECTS", "(DEFUN STARTUP-XML-OBJECTS () :PUBLIC? TRUE)", Native.find_java_method("edu.isi.powerloom.server.gui._StartupXmlObjects", "startupXmlObjects", new java.lang.Class [] {}), null);
{ MethodSlot function = Symbol.lookupFunction(GuiServer.SYM_GUI_SERVER_STARTUP_XML_OBJECTS);
KeyValueList.setDynamicSlotValue(function.dynamicSlots, GuiServer.SYM_STELLA_METHOD_STARTUP_CLASSNAME, StringWrapper.wrapString("_StartupXmlObjects"), Stella.NULL_STRING_WRAPPER);
}
}
if (Stella.currentStartupTimePhaseP(8)) {
Stella.finalizeSlots();
Stella.cleanupUnfinalizedClasses();
}
if (Stella.currentStartupTimePhaseP(9)) {
Stella_Object.inModule(((StringWrapper)(Stella_Object.copyConsTree(StringWrapper.wrapString("GUI-SERVER")))));
}
} finally {
Stella.$CONTEXT$.set(old$Context$000);
Stella.$MODULE$.set(old$Module$000);
}
}
} |
e89d1606-1362-4e76-86b7-700ae46e3979 | 9 | public static void main(String[] args) throws Exception {
String tmpStr;
String filename;
DataSource source;
Instances data;
int classIndex;
Capabilities cap;
Iterator iter;
if (args.length == 0) {
System.out.println(
"\nUsage: " + Capabilities.class.getName()
+ " -file <dataset> [-c <class index>]\n");
return;
}
// get parameters
tmpStr = Utils.getOption("file", args);
if (tmpStr.length() == 0)
throw new Exception("No file provided with option '-file'!");
else
filename = tmpStr;
tmpStr = Utils.getOption("c", args);
if (tmpStr.length() != 0) {
if (tmpStr.equals("first"))
classIndex = 0;
else if (tmpStr.equals("last"))
classIndex = -2; // last
else
classIndex = Integer.parseInt(tmpStr) - 1;
}
else {
classIndex = -3; // not set
}
// load data
source = new DataSource(filename);
if (classIndex == -3)
data = source.getDataSet();
else if (classIndex == -2)
data = source.getDataSet(source.getStructure().numAttributes() - 1);
else
data = source.getDataSet(classIndex);
// determine and print capabilities
cap = forInstances(data);
System.out.println("File: " + filename);
System.out.println("Class index: " + ((data.classIndex() == -1) ? "not set" : "" + (data.classIndex() + 1)));
System.out.println("Capabilities:");
iter = cap.capabilities();
while (iter.hasNext())
System.out.println("- " + iter.next());
} |
4b4abf25-94fe-42b0-b744-89ef13d9dfdb | 3 | public ArrayList<Nacionalidad> resultQueryNac(String sql){
ArrayList<Nacionalidad> nacList = new ArrayList<Nacionalidad>();
try {
rs = stm.executeQuery(sql);
try {
while(rs.next()){
Nacionalidad item = new Nacionalidad(rs.getInt("idNacionalidad"),
rs.getString("nacion"));
nacList.add(item);
}
rs.close();
} catch (SQLException i) {
// TODO Auto-generated catch block
i.printStackTrace();
}
return nacList;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return nacList;
}
} |
f763b64d-7171-49e0-8b89-2f0e2cda8a08 | 7 | public static String convertToString(Car car) throws Exception
{
Class<?> currentCarClass = car.getClass();
Method getModel = null;
Method getPower = null;
Method getDateOfCreation = null;
try{
getModel = currentCarClass.getDeclaredMethod("getModel");
}catch (NoSuchMethodException e){
System.out.println("Model of "+currentCarClass.getSimpleName()+" is not filled!");
}
try{
getPower = currentCarClass.getDeclaredMethod("getPower");
}catch (NoSuchMethodException e){
System.out.println("Power of "+currentCarClass.getSimpleName()+" is not filled!");
}
try{
getDateOfCreation = currentCarClass.getDeclaredMethod("getDateOfCreation");
}catch (NoSuchMethodException e){
System.out.println("Date of creations of "+currentCarClass.getSimpleName()+" is not filled!");
}
if (getModel ==null || getPower == null || getDateOfCreation==null)
{
return "Can't give you formated line, some or all fields are empty!";
}
else
{
return "Car [model=" + getModel.invoke(car) + ", power=" + getPower.invoke(car)
+ ", dateOfCreation=" + getDateOfCreation.invoke(car) + "]";
}
} |
ff7a1ef8-5f62-4c9c-bd4a-9af4aea907a0 | 3 | private void login() {
if(!loginPanel.isFillField()) {
loginPanel.setErrorInfo("Fill all fields");
return;
}
try {
session = chatRoomEntry.login(loginPanel.getLogin(), loginPanel.getPassword());
} catch(RemoteException e) {
fatalErrorExit("Fatal error", e);
} catch(ChatRoomLoginException e) {
loginPanel.setErrorInfo("Login error");
return;
}
nickname = loginPanel.getLogin();
setTitle(APP_NAME + " : " + nickname);
setContentPane(mainPanel);
revalidate();
refreshChatRoomList();
} |
badf6422-4e76-4377-b3fe-278f2c1e844d | 0 | public void deleteTreatmentMeta(int index){
treatmentMeta.remove(index);
} |
48b56b89-6bde-4fa9-af10-3785197bd764 | 4 | public void refresh() {
combo.removeAllItems();
for(Project project : projects.getBusinessObjects()) {
((DefaultComboBoxModel<Project>) combo.getModel()).addElement(project);
}
if (!projects.getBusinessObjects().isEmpty()) {
if(project==null) project = projects.getBusinessObjects().get(0);
combo.setSelectedItem(project);
}
if(project!=null) {
journalDetailsDataModel.setJournal(project.getJournal());
resultBalanceDataModel.setBalance(project.getResultBalance());
relationsBalanceDataModel.setBalance(project.getRelationsBalance());
}
journalDetailsDataModel.fireTableDataChanged();
resultBalanceDataModel.fireTableDataChanged();
relationsBalanceDataModel.fireTableDataChanged();
} |
ac92f248-8d94-4ec3-bef2-340a71b65fee | 3 | public AbstractMatter select(Tile tile) {
//check if selected is in the tile, if it is, take the index before
//else take the last index
List<AbstractMatter> ab = tile.getAbstractMatterList();
int index = ab.size() - 1;
for(int i = ab.size() - 1; i >= 0; i--)
{
if(ab.get(i) == selected && i != 0)
{
index = i-1;
}
}
selected = ab.get(index);
return selected;
} |
933cbf15-ab88-4056-81d2-586e144b4367 | 1 | public static double product(double[] vals) {
double prod = 1;
for (double v : vals) {
prod = prod * v;
}
return prod;
} |
aa4a46b3-38be-448b-91c6-30d925930eb2 | 4 | public static boolean isText(PolyBlockType type) {
return type == FLOWING_TEXT ||
type == HEADING_TEXT ||
type == PULLOUT_TEXT ||
type == VERTICAL_TEXT ||
type == CAPTION_TEXT;
} |
feca6933-28e1-44f5-ae63-f8da482a18b9 | 9 | static final int get(Monster type, Token token) {
switch(token)
{
case Toughness:
switch(type)
{
case DarkYoung: return 3;
default: return 1;
}
case Combat:
switch(type)
{
case Cultist: return 1;
default: return 0;
}
case Stamina:
switch(type)
{
case DarkYoung: return 3;
default: return 1;
}
case Horror:
switch(type)
{
default: return 0;
}
case Sanity:
switch(type)
{
case DarkYoung: return 3;
default: return 0;
}
default:
return 0;
}
} |
17ce856e-9618-4cc2-a724-ab04880c530e | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxNextCharInd = 0;
else
ExpandBuff(false);
}
else if (available > tokenBegin)
available = bufsize;
else if ((tokenBegin - available) < 2048)
ExpandBuff(true);
else
available = tokenBegin;
}
int i;
try {
if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1)
{
inputStream.close();
throw new java.io.IOException();
}
else
maxNextCharInd += i;
return;
}
catch(java.io.IOException e) {
--bufpos;
backup(0);
if (tokenBegin == -1)
tokenBegin = bufpos;
throw e;
}
} |
952b20b7-2531-4f0d-8fbb-c4642c70a435 | 4 | public boolean deletePatient(Patient newPatient) {
if (newPatient == head) {
head = null;
return true;
}
Patient aux = head.getNext();
while (!aux.getName().equals(newPatient.getName()) && aux.getNext() != head) {
aux = aux.getNext();
}
if (aux.getNext() == head) {
//patient to remove was not found
return false;
}
else {
aux.setNext(aux.getNext().getNext());
return true;
}
} |
7a3acd72-ba35-4208-bff7-aa8c31005de9 | 3 | private void renderOptions(GameContainer c, Graphics g){
FontUtils.drawCenter(TowerGame.ricasso30, "Options", 165, 60, 470, Color.white);
FontUtils.drawCenter(TowerGame.ricasso20, "Back", 165, 185, 470, Color.gray);
switch (options){
case 1:
FontUtils.drawCenter(TowerGame.ricasso20, "- Music Volume -", 165, 125, 470, Color.white);
FontUtils.drawCenter(TowerGame.ricasso20, (int) (c.getMusicVolume()*100) + "%", 165, 155, 470, Color.white);
break;
case 2:
FontUtils.drawCenter(TowerGame.ricasso20, "- SFX Volume -", 165, 125, 470, Color.white);
FontUtils.drawCenter(TowerGame.ricasso20, (int) (c.getSoundVolume()*100) + "%", 155, 155, 470, Color.white);
break;
case 3:
FontUtils.drawCenter(TowerGame.ricasso20, "Music Volume", 165, 125, 470, Color.gray);
FontUtils.drawCenter(TowerGame.ricasso20, "SFX Volume", 165, 155, 470, Color.gray);
FontUtils.drawCenter(TowerGame.ricasso20, "- Back -", 165, 185, 470, Color.white);
break;
}
} |
8b9bde92-c265-46ad-9bd8-88c1daad2457 | 5 | private void checkShipToPlanetsCollision(ShipV2 player, ArrayList<Planet>p){
for(int i = 0; i < p.size();i++){
Planet planet = p.get(i);
if(player.getPosition().x >= planet.getPosition().x &&
player.getPosition().x <= (planet.getPosition().x + planet.getWidth()) &&
player.getPosition().y >= planet.getPosition().y &&
player.getPosition().y <= (planet.getPosition().y + planet.getHeight())){
collideShipToPlanet(player, planet);
}
}
} |
55bc19e2-9184-4031-a7a9-21a0ac15f334 | 0 | @Test
public void test() {
TernaryST st = new TernaryST();
st.put("three", (Object)3);
st.put("four", (Object)4);
System.out.println(st.contains("four"));
System.out.println(st.contains("five"));
} |
9b95a393-90dc-413b-adbf-177e9b3474a0 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
invoker=mob;
final CMMsg msg=CMClass.getMsg(mob,null,this,verbalCastCode(mob,null,auto),auto?"":L("^S<S-NAME> open(s) the gates of the abyss, incanting angrily.^?"));
if(mob.location().okMessage(mob,msg))
{
mob.location().send(mob,msg);
final MOB otherMonster=mob.location().fetchInhabitant("the great demonbeast$");
final MOB myMonster = determineMonster(mob, mob.phyStats().level()+(getXLEVELLevel(mob)+(2*getX1Level(mob))));
if(otherMonster!=null)
{
myMonster.location().showOthers(myMonster,mob,CMMsg.MSG_OK_ACTION,L("^F^<FIGHT^><S-NAME> wrests itself from out of <T-YOUPOSS> control!^</FIGHT^>^?"));
myMonster.setVictim(otherMonster);
}
else
if(CMLib.dice().rollPercentage()<10)
{
myMonster.location().showOthers(myMonster,mob,CMMsg.MSG_OK_ACTION,L("^F^<FIGHT^><S-NAME> wrests itself from out of <T-YOUPOSS> control!^</FIGHT^>^?"));
myMonster.setVictim(mob);
}
else
{
myMonster.setVictim(mob.getVictim());
CMLib.commands().postFollow(myMonster,mob,true);
if(myMonster.amFollowing()!=mob)
mob.tell(L("@x1 seems unwilling to follow you.",myMonster.name()));
}
invoker=mob;
beneficialAffect(mob,myMonster,asLevel,0);
}
}
else
return beneficialWordsFizzle(mob,null,L("<S-NAME> attempt(s) to open the gates of the abyss, but fail(s)."));
// return whether it worked
return success;
} |
2a973b4f-e95a-47ee-98b6-8d2cae0d4cf1 | 1 | public void InsertaFinal(String nombreProceso)
{
if ( VaciaLista())
PrimerNodo = UltimoNodo = new NodosListaProceso (nombreProceso);
else
UltimoNodo=UltimoNodo.siguiente =new NodosListaProceso (nombreProceso);
} |
ee76613f-e360-4a25-8687-d8d802b735c7 | 1 | private String getSuffix(String src, String... delimiter)
{
int i = Utils.findIndex(src, delimiter);
if (i == -1)
return src;
else
return src.substring(i + 1);
} |
d6b8bd3c-1306-41f7-8e16-6e35346b7661 | 0 | @Override
public void mouseExited(MouseEvent e) {
} |
4e641db2-c303-4dc9-acbc-9fff4ae0c649 | 9 | @Override
public void start(Stage primaryStage) throws Exception {
final int PANEL_HEIGHT = maze.height*SQUARE_SIZE;
final int PANEL_WIDTH = maze.width*SQUARE_SIZE;
Group root = new Group();
primaryStage.setTitle("Bob's Maze");
primaryStage.setScene(new Scene(root));
//Draw the maze
Canvas canvas = new Canvas(PANEL_WIDTH, PANEL_HEIGHT);
root.getChildren().add(canvas);
GraphicsContext gc = canvas.getGraphicsContext2D();
for (int i=0; i<maze.map.size(); i++){
List<Integer> row = maze.map.get(i);
for (int j=0; j<row.size(); j++){
switch (row.get(j).intValue()) {
case 1:
gc.setFill(Color.BLACK);
gc.fillRect(j*SQUARE_SIZE, i*SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE);
break;
case 5:
gc.setFill(Color.YELLOW);
gc.fillRect(j*SQUARE_SIZE, i*SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE);
break;
case 8:
gc.setFill(Color.BLUE);
gc.fillRect(j*SQUARE_SIZE, i*SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE);
break;
default:
break;
}
}
}
//Update population and draw best solution
Canvas canvas2 = new Canvas(PANEL_WIDTH, PANEL_HEIGHT);
root.getChildren().add(canvas2);
GraphicsContext gc2 = canvas2.getGraphicsContext2D();
gc2.setFill(Color.RED);
new AnimationTimer(){
public void handle(long currentNanoTime){
gc2.clearRect(0, 0, PANEL_WIDTH, PANEL_HEIGHT);
pop.newGeneration();
Chromo<Integer> best = pop.getFittestChromo();
Point current = new Point(maze.startP.x, maze.startP.y);
for (Integer i : best.getGenes()){
move(current, i.intValue());
if (!maze.isValidPosition(current))
break;
gc2.fillRect(current.x*SQUARE_SIZE, current.y*SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE);
}
if (pop.getNumberOfGenerations() >= MAX_GENERATIONS || maze.distToExit(current)==0)
this.stop();
}
}.start();
primaryStage.show();
} |
1c0a9b67-ad32-457b-b3ea-231271f26f37 | 5 | public void draw(Graphics2D g) {
for (int row = rowOffset; row < rowOffset + numRowsToDraw; row++) {
if (row >= numRows) {
break;
}
for (int col = colOffset; col < colOffset + numColsToDraw; col++) {
if (col >= numCols) {
break;
}
if (map[row][col] == 0) {
continue;
}
int rc = map[row][col];
int r = rc / numTilesAcross;
int c = rc % numTilesAcross;
g.drawImage(tiles[r][c].getImage(), (int) x + col * tileSize,
(int) y + row * tileSize, null);
}
}
} |
a1665421-2ea6-46f9-9b9b-56b9e57e1aa9 | 3 | private int getTextBlockHeight (Graphics2D g2d, String t) {
if ((t == null) || (t.equals(""))) {
return 0;
}
TextLayout tl = new TextLayout(t,
MainWindow.setupData.getPrintElementSetupList().getPrintElementSetup (PrintElementSetupList.FONT_SUMMARY_SHEET).getPrintFont(),
g2d.getFontRenderContext());
String[] outputs = t.split("\n");
int y = 0;
for(int l=0; l<outputs.length; l++){
y += tl.getBounds().getHeight()*1.3;
}
return y;
} |
1d1638ea-844e-4585-9992-4b196196db10 | 6 | public static Collection<Temporal> consolidateTemporalSegments(Collection<Temporal> temporals) {
if (null == temporals || temporals.size() < 2) return temporals;
Set<Temporal> origTemporals = new TreeSet<Temporal>(temporals);
temporals.clear();
if (origTemporals.contains(PERSISTENT_TEMPORAL)) {
temporals.add(PERSISTENT_TEMPORAL.clone());
return temporals;
}
Iterator<Temporal> it = origTemporals.iterator();
Temporal lastTemporal = it.next();
Temporal temporal = null;
try {
while ((temporal = it.next()) != null) {
if (lastTemporal.overlapOrMeet(temporal)) {
lastTemporal = lastTemporal.join(temporal);
} else {
temporals.add(lastTemporal);
lastTemporal = temporal;
}
}
} catch (Exception e) {
}
temporals.add(lastTemporal);
return temporals;
} |
72c3ff0a-446e-4820-99d2-6b119a569416 | 4 | @Override
public String execute() {
try {
if ((databaseContext.table != null) && databaseContext.table.getName().equals(arguments.get(1))) {
databaseContext.table = null;
}
databaseContext.provider.removeTable(arguments.get(1));
return "dropped";
} catch (IllegalStateException e) {
return arguments.get(1) + " not exists";
} catch (IOException e) {
return e.getMessage();
}
} |
9bd551ee-d34b-4da8-b6f4-82d44e7fb46f | 0 | public boolean isManaged() {
return managed;
} |
bcaab039-ba5a-49d3-a5c4-64e336870030 | 5 | public static BookCopy getBookCopyByBookCopyID(int copyID){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
BookCopy bc = null;
try {
PreparedStatement stmnt = conn.prepareStatement("SELECT * FROM Books b, BookCopies bc WHERE b.book_id = bc.book_id AND bc.copy_id = ?");
stmnt.setInt(1, copyID);
ResultSet res = stmnt.executeQuery();
if(res.next())
{
bc = new BookCopy(StringDateSwitcher.toDateYear(res.getString("year")), res.getString("place_of_publication"),
res.getString("title"), res.getString("genre"), res.getString("author"),
res.getString("isbn"), res.getString("publisher"), res.getInt("book_id"),
res.getInt("copy_id"), res.getInt("edition"),res.getBoolean("lendable"));
}
}
catch(SQLException e) {
System.out.println(e);
}
return bc;
} |
c853abf5-2b64-4cf2-853d-a359e58a6a09 | 9 | public boolean monsterAttack(int userPosition, int player) {
boolean dead = false;
for (int i = 0; i < numberofEnemys; i++) {
if (dead == false) {
if (enemyLocation.get(i) != null) {
int enemyLoc = enemyLocation.get(i);
int enemyLocXY[] = getTileLocation(enemyLoc);
int userLocXY[] = getTileLocation(userPosition);
int distance = calculateDistance(enemyLocXY, userLocXY);
if (distance <= 6) {
int attackBonus;
if (isAdjacent(userPosition, enemyLoc)) {
attackBonus = calculateAttackBonus(i, "enemy", "melle");
} else {
attackBonus = calculateAttackBonus(i, "enemy", "ranged");
}
int armorClass = calculateArmorClass(player, "user");
int callRoll = cal1d20Roll();
fightingInformation.append("\n Enemy's is Attack bonus is : " + attackBonus + " \n Roll 1d20 Dice :" + callRoll + "\n" + " Players' Armour class (AC) is :" + armorClass + "\n");
System.out.println("User is under attack Attack bonus of" + i + " :: " + attackBonus + " Armour class" + armorClass);
if ((callRoll + attackBonus) > armorClass) {
// Decrease the health
fightingInformation.append("Player is under Attack" + "\n");
fightingInformation.append("Damage Point =(Rolling 1d8 Dice + attackBonus ) = ");
int damagePoint = cal1d8Roll() + attackBonus;
fightingInformation.append("" + damagePoint);
users.get(player).setHealth(users.get(player).getHealth() - (damagePoint));
System.out.println("User" + player + "'s health is " + users.get(player).getHealth());
fightingInformation.append("\n Players hit Point" + users.get(player).getHealth() + "\n");
}
if (users.get(player).getHealth() < 0) {
// The player is dead
dead = true;
}
if (dead == true) {
System.out.println("The user : " + player + " is dead");
fightingInformation.append("Player " + player + "is dead now ! \n");
System.out.println("Pos of user" + userPosition);
tile[userLocation.get(currentplayer) - 1].setIcon(null);
users.remove((Object) player);
userLocation.remove((Object) player);
turnPanel.inventory[player].setVisible(false);
System.out.println("Monster Attacking kill" + userLocation);
if (users.size() == 0) {
System.out.println("Game is over my friend");
JOptionPane.showMessageDialog(null, "Game is over !");
fightingInformation.append("Game Over !");
}
}
}
}
}
}
return dead;
} |
0aecad5a-5bda-402a-b0c5-812a176e3c7e | 2 | public Administrateur ChercherAdministrateur(String login) {
try {
String sql = "SELECT * FROM User WHERE login='" + login + "'";
ResultSet rs = crud.exeRead(sql);
Administrateur a = new Administrateur();
while (rs.next()) {
a.setLogin(rs.getString("login"));
a.setNom(rs.getString("nom"));
a.setPrenom(rs.getString("prenom"));
a.setTelephone(rs.getInt("telephone"));;
}
return a;
} catch (SQLException ex) {
Logger.getLogger(AdministrateurDAO.class.getName()).log(Level.SEVERE, null, ex);
return null;
}
} |
535cc633-5b23-4217-91ef-e85016743e03 | 2 | private static void resplit(final double a[]) {
final double c = a[0] + a[1];
final double d = -(c - a[0] - a[1]);
if (c < 8e298 && c > -8e298) {
double z = c * HEX_40000000;
a[0] = (c + z) - z;
a[1] = c - a[0] + d;
} else {
double z = c * 9.31322574615478515625E-10;
a[0] = (c + z - c) * HEX_40000000;
a[1] = c - a[0] + d;
}
} |
d3a034b2-3b09-4a89-a9dd-97ef10f67526 | 0 | public void mouseReleased(MouseEvent e) {
//moveCamera(e);
} |
f84bc76a-fd5e-46f3-9c30-6d7473958558 | 4 | private void addHour(List<QlockWord> timeList, final int HOUR) {
if (HOUR == 12) {
timeList.add(QlockLanguage.EEN);
} else if (HOUR == 10 || HOUR + 1 == 10) {
timeList.add(QlockLanguage.TIEN1);
} else if (HOUR + 1 == 5) {
timeList.add(QlockLanguage.VIJF);
} else {
timeList.add(QlockLanguage.valueOf(LOOKUP.get(HOUR + 1)));
}
} |
49165cc0-91e5-4d37-ad15-359343e03106 | 8 | static char getAlarmSignal(int alarms){
switch(alarms){
case NoAlarm:
return ' ';
case ServerExceptionAlarm:
return 'x';
case NoServerResponseAlarm:
return '@';
case HeadersChangedAlarm:
return '$';
case PendingResponseAlarm:
return '#';
case NotSuccessAlarm:
return '!';
case ConcurrentEntriesAlarm:
return '%';
case NoStartTimeAlarm:
return '-';
}
// multiple alarms!
return '*';
} |
eda51986-a274-424a-b75c-e2390c2bb119 | 9 | private void joinGame(String sender) {
if (status == GameStatus.IDLE) {
return;
}
if (status != GameStatus.PRE) {
// if the game is already running, dont add anyone else to either list
sendNotice(sender, "The game is currently underway. Please wait for "
+ "the current game to finish before trying again.");
return;
}
if (!isInChannel(sender)) {
return;
}
if (players2.isAdded(sender)) // has the player already joined?
{
sendNotice(sender, "You are already on the player list. Please wait for the next game to join again.");
return;
}
if (players2.numPlayers() < MAXPLAYERS) {
// if there are less than MAXPLAYERS player joined
if (players2.addPlayer(sender)) // add another one
{
bot.setMode(gameChan, "+v " + sender);
if (players2.numPlayers() > 1) {
bot.sendMessage(gameChan, getFromFile("JOIN", sender, NARRATION));
}
sendNotice(sender, getFromFile("ADDED", NOTICE));
} else {
// let the user know the adding failed, so he can try again
sendNotice(sender, "Could not add you to player list. Please try again.");
}
} else {
// if play list is full, add to priority list
if (players2.numPriority() < MAXPLAYERS) {
if (players2.addPriority(sender)) {
sendNotice(sender, "Sorry, the maximum players has been reached. You have been placed in the "
+ "priority list for the next game.");
} else {
sendNotice(sender, "Could not add you to priority list. Please try again.");
}
} else {
// if both lists are full, let the user know to wait for the current
// game to end
sendNotice(sender, "Sorry, both player and priority lists are full. Please wait for the "
+ "the current game to finish before trying again.");
}
}
} |
de02e82c-a6f7-4221-bff6-0c4f216e8eae | 3 | private Value[] fillParameters(BytecodeInfo code, Object cls,
Object[] params) {
Value[] locals = new Value[code.getMaxLocals()];
for (int i = 0; i < locals.length; i++)
locals[i] = new Value();
String myType = code.getMethodInfo().getType();
String[] myParamTypes = TypeSignature.getParameterTypes(myType);
int slot = 0;
if (!code.getMethodInfo().isStatic())
locals[slot++].setObject(cls);
for (int i = 0; i < myParamTypes.length; i++) {
locals[slot].setObject(params[i]);
slot += TypeSignature.getTypeSize(myParamTypes[i]);
}
return locals;
} |
cdfc55ff-ea7e-4d32-b328-5ec0b8b268dd | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Path other = (Path) obj;
if(end == other.start && start == other.end)
return true;
if (end != other.end)
return false;
if (start != other.start)
return false;
return true;
} |
237cf755-f71e-48d0-b402-549edd46a231 | 5 | private void removeBrokenMTWCs(MTWData data) {
Set<Set<Tuple<Integer, Integer>>> set;
if (data.player == playerID) {
set = data.mTWCFP2;
} else {
set = data.mTWCFP1;
}
Iterator<Set<Tuple<Integer, Integer>>> combinations = set.iterator();
while (combinations.hasNext()) {
Set<Tuple<Integer, Integer>> combination = combinations.next();
for (Tuple<Integer, Integer> coordinate : combination) {
// Remove the combination if it contains the current coordinate
// (safely by using the iterator remove)
if (coordinate._1.equals(data.column) && coordinate._2.equals(data.row)) {
combinations.remove();
break;
}
}
}
} |
0bc0f08a-5650-46f0-a263-f3e5eb9901f2 | 2 | public void renderBlank(int xp, int yp, int w, int h, int color) {
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
paintPixel((x+xp) + (y+yp) * width, color);
}
}
} |
c3f6c946-208b-46da-9132-e3fd8fed6ce8 | 6 | public static String longestCommonPrefix(String[] strs) {
if(strs.length == 0) {
return "";
}
boolean wrong = false;
String result = new String();
for(int m = 0; m <= strs[0].length(); m++) {
result = strs[0].substring(0, m);
for(int i = 0; i < strs.length; i++) {
if(strs[i].length() < m) {
result = result.substring(0, result.length()-1);
wrong = true;
break;
}
if(! strs[i].substring(0, m).equals(result)) {
result = result.substring(0, result.length()-1);
wrong = true;
break;
}
}
if(wrong) {
break;
}
}
return result;
} |
1080c002-214d-4084-9ac1-e6e3ba01a055 | 1 | public void testMinus_Days() {
Days test2 = Days.days(2);
Days test3 = Days.days(3);
Days result = test2.minus(test3);
assertEquals(2, test2.getDays());
assertEquals(3, test3.getDays());
assertEquals(-1, result.getDays());
assertEquals(1, Days.ONE.minus(Days.ZERO).getDays());
assertEquals(1, Days.ONE.minus((Days) null).getDays());
try {
Days.MIN_VALUE.minus(Days.ONE);
fail();
} catch (ArithmeticException ex) {
// expected
}
} |
09506019-2cb1-46bf-8744-64ea19a221cc | 0 | protected void onConnect() {} |
eeb9e4e2-6254-4b30-83c2-d579360640a4 | 9 | public static correctionx line_corrections(double sigma, double w_est, double r_est)
{
correctionx result_corr = new correctionx();
int i_we,i_re;
//boolean is_valid;
double a,b;
int field;
w_est = w_est/sigma;
if (w_est < 2 || w_est > 6 || r_est < 0 || r_est > 1)
{
result_corr.w = 0;
result_corr.h = 0;
result_corr.correction = 0;
result_corr.w_strong = 0;
result_corr.w_weak = 0;
result_corr.is_valid = true;
return result_corr;
}
i_we = (int) Math.floor((w_est-2)*10);
i_re = (int) Math.floor(r_est*20);
if (i_we == 40)
i_we = 39;
if (i_re == 20)
i_re = 19;
result_corr.is_valid = ctable[i_re][i_we][7]>0 && ctable[i_re][i_we+1][7]>0 &&
ctable[i_re+1][i_we][7]>0 && ctable[i_re+1][i_we+1][7]>0;
a = (w_est-2)*10-i_we;
b = r_est*20-i_re;
field = 2;
result_corr.w =
((1-b)*((1-a)*ctable[i_re][i_we][field]+a*ctable[i_re][i_we+1][field])+
b*((1-a)*ctable[i_re+1][i_we][field]+a*ctable[i_re+1][i_we+1][field]))*sigma;
field = 3;
result_corr.h =((1-b)*((1-a)*ctable[i_re][i_we][field]+a*ctable[i_re][i_we+1][field])+
b*((1-a)*ctable[i_re+1][i_we][field]+a*ctable[i_re+1][i_we+1][field]));
field = 4;
result_corr.correction = ((1-b)*((1-a)*ctable[i_re][i_we][field]+a*ctable[i_re][i_we+1][field])+
b*((1-a)*ctable[i_re+1][i_we][field]+a*ctable[i_re+1][i_we+1][field]))*sigma;
field = 5;
result_corr.w_strong = ((1-b)*((1-a)*ctable[i_re][i_we][field]+a*ctable[i_re][i_we+1][field])+
b*((1-a)*ctable[i_re+1][i_we][field]+a*ctable[i_re+1][i_we+1][field]))*sigma;
field = 6;
result_corr.w_weak = ((1-b)*((1-a)*ctable[i_re][i_we][field]+a*ctable[i_re][i_we+1][field])+
b*((1-a)*ctable[i_re+1][i_we][field]+a*ctable[i_re+1][i_we+1][field]))*sigma;
result_corr.is_valid = !result_corr.is_valid;
return result_corr;
} |
75d0625b-4788-4c00-90e7-2ce9a02685f9 | 6 | public static void showGUI(){
//public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LoginGUI().setVisible(true);
}
});
} |
0bc517a6-5694-4511-aa95-6eac94deec37 | 6 | public void drawBackground(int i, int k)
{
i += anInt1454;
k += anInt1455;
int l = i + k * DrawingArea.width;
int i1 = 0;
int j1 = anInt1453;
int k1 = anInt1452;
int l1 = DrawingArea.width - k1;
int i2 = 0;
if(k < DrawingArea.topY)
{
int j2 = DrawingArea.topY - k;
j1 -= j2;
k = DrawingArea.topY;
i1 += j2 * k1;
l += j2 * DrawingArea.width;
}
if(k + j1 > DrawingArea.bottomY)
j1 -= (k + j1) - DrawingArea.bottomY;
if(i < DrawingArea.topX)
{
int k2 = DrawingArea.topX - i;
k1 -= k2;
i = DrawingArea.topX;
i1 += k2;
l += k2;
i2 += k2;
l1 += k2;
}
if(i + k1 > DrawingArea.bottomX)
{
int l2 = (i + k1) - DrawingArea.bottomX;
k1 -= l2;
i2 += l2;
l1 += l2;
}
if(!(k1 <= 0 || j1 <= 0))
{
method362(j1, DrawingArea.pixels, aByteArray1450, l1, l, k1, i1, anIntArray1451, i2);
}
} |
115a0c30-75c0-454d-bcb1-1b31d1cdcbf8 | 2 | public Nodo<E> getNodoXpos(int x){
Nodo<E> resp = cabeza;
for(int i=0 ; i < x ;i++){
if(resp != cola)
resp = resp.getSiguiente();
else{
System.out.println("indice fuera de rango");
return null;
}
}
return resp;
} |
76b81e61-a243-4219-af56-d6e898bbd737 | 0 | @Override
public String toString() {
return "[lines=" + lines + "]";
} |
e542f672-1ba7-4f15-993b-1678b8fedb61 | 1 | public Constant newClass(final String value) {
key2.set('C', value, null, null);
Constant result = get(key2);
if (result == null) {
newUTF8(value);
result = new Constant(key2);
put(result);
}
return result;
} |
3e0aa351-a532-41b5-a812-840759c04781 | 4 | public void showLockedChildren() {
if (Main.getInterface() == null || Main.getInterface().children == null) {
return;
}
for (int index = 0; index < Main.getInterface().children.size(); index++) {
RSInterface child = RSInterface.getInterface(Main.getInterface().children.get(index));
if (child.locked) {
RSDrawingArea.drawFilledAlphaPixels(Main.getX(Main.getInterface(), child), Main.getY(Main.getInterface(), child), child.width, child.height, 0, 150);
RSDrawingArea.drawUnfilledPixels(Main.getX(Main.getInterface(), child), Main.getY(Main.getInterface(), child), child.width, child.height, 0);
RSImage lock = new RSImage("lock.png");
lock.drawCenteredARGBImage(Main.getX(Main.getInterface(), child) + (child.width / 2), Main.getY(Main.getInterface(), child) + (child.height / 2));
}
}
} |
a50389d2-db85-45e1-974c-cfd7e631d883 | 6 | public static <GItem> Set<GItem> unionSet(final Set<? extends GItem> items1, final Set<? extends GItem> items2) throws NullPointerException {
if (items1 == null) throw new NullPointerException("items1 = null");
if (items2 == null) throw new NullPointerException("items2 = null");
return new AbstractSet<GItem>() {
@Override
public int size() {
return Iterables.size(this);
}
@Override
public Iterator<GItem> iterator() {
return Iterators.unmodifiableIterator(items1.size() < items2.size() //
? Iterators.chainedIterator(Iterators.filteredIterator(Filters.negationFilter(Filters.containsFilter(items2)), items1.iterator()), items2.iterator()) //
: Iterators.chainedIterator(Iterators.filteredIterator(Filters.negationFilter(Filters.containsFilter(items1)), items2.iterator()), items1.iterator()) //
);
}
@Override
public boolean contains(final Object item) {
return items1.contains(item) || items2.contains(item);
}
};
} |
6bbf0039-c57e-401c-8b30-901e4b7035c3 | 6 | public static void main(String args[]) {
File f = new File("config");
FileReader fr = null;
try {
fr = new FileReader(f);
} catch (FileNotFoundException e2) {
e2.printStackTrace();
}
BufferedReader br = new BufferedReader(fr);
String host = "";
String port = "";
try {
host = br.readLine();
port = br.readLine();
} catch (IOException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
try {
Client client = new Client("client", host, port);
agc = null;
try {
agc = new AppGameContainer(client);
} catch (SlickException e1) {
e1.printStackTrace();
}
try {
agc.setDisplayMode(1024, 768, false);
} catch (SlickException e) {
}
agc.setTargetFrameRate(60);
agc.setAlwaysRender(true);
try {
agc.start();
} catch (SlickException e) {
e.printStackTrace();
}
} catch (NumberFormatException e) {
e.printStackTrace();
}
} |
6d14688e-cc52-4dea-9309-9497122c0824 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Zeit other = (Zeit) obj;
if (hour != other.hour)
return false;
if (minute != other.minute)
return false;
return true;
} |
2fa4369d-11db-403d-bb2d-834103469079 | 2 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(OK)) {
ok();
} else if (e.getActionCommand().equals(CANCEL)) {
cancel();
}
} |
202d3a94-d16f-412c-99a5-76cb4438157f | 1 | public void draw(Graphics g, boolean fill) {
g.setColor(myColor);
if(fill) {
g.fillRect(getUpperLeftX(), getUpperLeftY(), getWidth(), getHeight());
} else {
g.drawRect(getUpperLeftX(), getUpperLeftY(), getWidth(), getHeight());
}
} |
54332373-7567-4dc9-a6b9-9a015ddbc17d | 9 | private void getContextNodeBinarySearch() {
int low = MIN_CONTEXT_LENGTH;
int high = _contextLength;
_contextLength = MIN_CONTEXT_LENGTH-1; // not sure we need this
_contextNode = null;
boolean isDeterministic = false;
while (high >= low) {
int contextLength = (high + low)/2;
PPMNode contextNode = lookupNode(contextLength);
if (contextNode == null || contextNode.isChildless(_excludedBytes)) {
if (contextLength < high) high = contextLength;
else --high;
} else if (contextNode.isDeterministic(_excludedBytes)) {
_contextLength = contextLength;
_contextNode = contextNode;
isDeterministic = true;
if (contextLength < high) high = contextLength;
else --high;
} else if (!isDeterministic) {
_contextLength = contextLength;
_contextNode = contextNode;
if (contextLength > low) low = contextLength;
else ++low;
} else {
if (contextLength > low) low = contextLength;
else ++low;
}
}
} |
eae39a40-2b7e-4aee-b882-2b082c6b216a | 8 | private static void WriteAttrisGrp(Document doc, Element attrigrpnode, GeneratorAttriGrp attrisgrp)
{
GeneratorAttriGrp grp;
GeneratorAttri attri;
List<GeneratorAttri> attrislist = attrisgrp.getAttrisList();
List<GeneratorAttriGrp> childattrislist = attrisgrp.getChildAttriGrpList();
int i;
for (i = 0; i < attrislist.size(); i++)
{
attri = (GeneratorAttri)attrislist.get(i);
Element attrielem = doc.createElement(ATTRIBUTE);
if (!attri.getAttriName().equals(""))
attrielem.setAttribute("name", attri.getAttriName());
if (!attri.getAttriType().equals(""))
attrielem.setAttribute("type", attri.getAttriType());
if (!attri.getAttriConstraint().equals(""))
attrielem.setAttribute("constraint", attri.getAttriConstraint());
if (!attri.getDefaultValue().equals(""))
attrielem.setAttribute("defaultvalue", attri.getDefaultValue());
if (!attri.getDefaultValue().equals(""))
attrielem.setAttribute("description", attri.getAttriDescri());
if (!attri.getAttriValue().equals(""))
{
Text textseg = doc.createTextNode(attri.getAttriValue());
attrielem.appendChild(textseg);
}
attrigrpnode.appendChild(attrielem);
}
for (i = 0; i < childattrislist.size(); i++)
{
grp = (GeneratorAttriGrp)childattrislist.get(i);
Element elem = doc.createElement(ATTRIBUTESGRP);
elem.setAttribute("name", grp.getAttriGrpName());
attrigrpnode.appendChild(elem);
WriteAttrisGrp(doc, elem, grp);
}
} |
02b54f17-d2fb-444e-a8ab-e00bbc41ce46 | 9 | public List<Client> searchClient(String usernameOrName) {
Connection conn=null;
try{
conn = dbConnector.getConnection();
if (conn==null) //cannot connect to DB
return null;
Statement st;
ResultSet rs;
String sql;
boolean searchAll = false;
if (usernameOrName==null )
searchAll=true;
usernameOrName = usernameOrName.trim();
if (usernameOrName.isEmpty())
searchAll=true;
if (searchAll) {
sql = "select * from tbClient";
} else {
sql = "select * from tbClient where "
+ " username LIKE '%"+usernameOrName+"%' "
+ " OR fname LIKE '%"+usernameOrName+"%' "
+ " OR lname LIKE '%"+usernameOrName+"%' ";
}
// check does this client's username exist?
st = conn.createStatement();
rs = st.executeQuery(sql);
List<Client> lst = new ArrayList<Client>();
// if exist, return the Client objects
while (rs.next()){
Client client = getClientFromResultSet(rs);
lst.add(client);
}
if (lst.size()<=0)
return null;
else
return lst;
}
catch(Exception e){
e.printStackTrace();
}finally {
try {
if (conn!=null)
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return null;
} |
2c70a004-73ee-413c-b268-c114924d4c61 | 7 | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof AbstractXYItemLabelGenerator)) {
return false;
}
AbstractXYItemLabelGenerator that = (AbstractXYItemLabelGenerator) obj;
if (!this.formatString.equals(that.formatString)) {
return false;
}
if (!ObjectUtilities.equal(this.xFormat, that.xFormat)) {
return false;
}
if (!ObjectUtilities.equal(this.xDateFormat, that.xDateFormat)) {
return false;
}
if (!ObjectUtilities.equal(this.yFormat, that.yFormat)) {
return false;
}
if (!ObjectUtilities.equal(this.yDateFormat, that.yDateFormat)) {
return false;
}
return true;
} |
4e48b024-43b5-4d25-b361-9954b5d433e4 | 4 | public void addAtEndBeforeBranch(Instruction i) throws Exception {
if(!instructions.isEmpty() &&
instructions.getLast() instanceof BranchInstruction) {
ListIterator<Instruction> iter =
instructions.listIterator(instructions.size() - 1);
iter.next(); // returns last instruction
// also returns the last instructions, but we are now 'going backwards'
Instruction cursor = iter.previous();
// need to put the instruction before the compare and
// branch, a compare instruction may not be present though
assert(cursor instanceof BranchInstruction); // we just tested this
// if the basic block has no other instructions, then we
// can insert the instruction immediatly, otherwise we
// need to see if there is also a Cmp
if(iter.hasPrevious()) {
cursor = iter.previous();
// if we did not get a cmp, we went too far
if(!(cursor instanceof Cmp)) {
// will return the same instruction as cursor, but now instructions will be added after it
iter.next();
}
// but if we did get a Cmp, we went just the right amount
}
i.setDominating(cursor.getDominating());
cursor.setDominating(i);
i.setContainingBB(this);
iter.add(i);
} else {
addInstruction(i);
}
} |
c3caab02-0cce-4956-b6bb-68b89bc1024e | 7 | public void solve(char[][] board) {
m = board.length;
if (m == 0)
return;
n = board[0].length;
visited = new boolean[m + 2][n + 2];
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
if (board[i][j] == 'X')
visited[i + 1][j + 1] = true;
dfs();
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
if (!visited[i + 1][j + 1])
board[i][j] = 'X';
} |
2e964136-a648-48e7-b1c7-442ba0056ed2 | 5 | public static void main(String[] args) {
int[] num = {9,5,4,3,2,7,6,1};
for(int i = 0; i < num.length; i ++) {
for(int j = i + 1; j < num.length; j ++) {
for(int n : num) {
System.out.print(n + ",");
}
System.out.println();
int tmp;
if(num[i]>num[j]) {
tmp = num[j];
num[j] = num[i];
num[i] = tmp;
}
}
}
System.out.println("###########################################################");
for(int n : num) {
System.out.print(n + ",");
}
} |
394a8b6b-8281-477c-934c-1aa48e51390e | 6 | public static <GInput, GValue, GOutput> Converter<GInput, GOutput> chainedConverter(final Converter<? super GInput, ? extends GValue> converter1,
final Converter<? super GValue, ? extends GOutput> converter2) throws NullPointerException {
if (converter1 == null) throw new NullPointerException("converter1 = null");
if (converter2 == null) throw new NullPointerException("converter2 = null");
return new Converter<GInput, GOutput>() {
@Override
public GOutput convert(final GInput input) {
return converter2.convert(converter1.convert(input));
}
@Override
public String toString() {
return Objects.toInvokeString("chainedConverter", converter1, converter2);
}
};
} |
62a88949-9cce-4c0a-b0a9-944d8b90de6f | 9 | public ContainerComponent(WorkplacePanel parent, Container container) {
this.container=container;
this.workplacePanel=parent;
preferences=workplacePanel.documentFrame.loadOrganizer.preferences;
setBorder(BorderFactory.createLineBorder(Color.BLACK,1));
Dimension boxSize=container.getSize();
Dimension size=new Dimension(boxSize.width*preferences.getGuiPixelsPerMeter()/1000,boxSize.height*preferences.getGuiPixelsPerMeter()/1000);
setSize(size);
setPreferredSize(new Dimension(size));
setOpaque(true);
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
final ContainerComponent component=this;
addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseDragged(MouseEvent e) {
Point point=e.getPoint();
Point location=getLocation();
int x=location.x+point.x-lastClick.x;
int y=location.y+point.y-lastClick.y;
//check borders of other components
workplacePanel.moveSelectedComponents(component, x, y);
workplacePanel.checkScrollBounds();
}
});
addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
workplacePanel.workplace.setComponentZOrder(component,0);
if(selected==false) {
if(e.isControlDown() || e.isShiftDown()) {
workplacePanel.switchSelected(component,false,true);
} else {
workplacePanel.switchSelected(component,true,true);
}
}
lastClick=e.getPoint();
}
@Override
public void mouseReleased(MouseEvent e) {
workplacePanel.computeInfo();
}
});
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
int offset=1;
Rectangle r=getBounds();
boolean recompute=false;
if(e.getKeyCode()==KeyEvent.VK_UP) {
workplacePanel.moveSelectedComponents(component,r.x,r.y-offset);
recompute=true;
} else
if(e.getKeyCode()==KeyEvent.VK_DOWN) {
workplacePanel.moveSelectedComponents(component,r.x,r.y+offset);
recompute=true;
} else
if(e.getKeyCode()==KeyEvent.VK_LEFT) {
workplacePanel.moveSelectedComponents(component,r.x-offset,r.y);
recompute=true;
} else
if(e.getKeyCode()==KeyEvent.VK_RIGHT) {
workplacePanel.moveSelectedComponents(component,r.x+offset,r.y);
recompute=true;
} else
if(e.getKeyCode()==KeyEvent.VK_DELETE) {
workplacePanel.deleteSelected();
}
if(recompute) {
workplacePanel.computeInfo();
}
}
});
setText("<html><table align=center valign=center><tr><td align=center><b>"+container.getName()+"</b><br><font size=1>"+container.getSap()+" "+container.getSize().width+" x "+container.getSize().height+" "+container.getWeight()+"kg</font></td></tr></table></html>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
setFont(new Font("verdana",Font.PLAIN,9)); //$NON-NLS-1$
setHorizontalAlignment(SwingConstants.CENTER);
setVerticalAlignment(SwingConstants.CENTER);
addPopupMenu();
hiddenLabel= new JLabel();
hiddenLabel.updateUI();
hiddenLabel.setBackground(this.getBackground());
hiddenLabel.setSize(getHeight(), getWidth());
hiddenLabel.setFont(this.getFont());
hiddenLabel.setBorder(this.getBorder());
hiddenLabel.setOpaque(true);
hiddenLabel.setHorizontalAlignment(this.getHorizontalAlignment());
hiddenLabel.setVerticalAlignment(this.getVerticalAlignment());
hiddenLabel.setVerticalTextPosition(this.getVerticalTextPosition());
hiddenLabel.setHorizontalAlignment(this.getHorizontalTextPosition());
hiddenLabel.setPreferredSize(this.getPreferredSize());
hiddenLabel.setText(this.getText());
} |
476c208c-bf30-46a7-b623-07981cf7f666 | 4 | private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarActionPerformed
try{
int numero = Integer.parseInt(txt1.getText());
if(numero>0){
Modificar modificar = new Modificar();
Statement consulta = conexion();
try{
ResultSet resultado = consulta.executeQuery("SELECT * FROM tblproductos "
+ "WHERE Codigo="+numero);
if(resultado.next()==true){
modificar.txt1.setText(txt1.getText());
modificar.txt2.setText((String) resultado.getObject(2));
modificar.txt3.setText((String) resultado.getObject(3));
int cantidad = (int) resultado.getObject(4);
modificar.txt4.setText(String.valueOf(cantidad));
int precio = (int) resultado.getObject(5);
modificar.txt5.setText(String.valueOf(precio));
modificar.setVisible(rootPaneCheckingEnabled);
}else{
JOptionPane.showMessageDialog(null, "El Codigo "+numero+" no existe");
}
}catch(Exception e){}
}else{
JOptionPane.showMessageDialog(null, "El numero debe ser mayor a cero");
}
}catch(NumberFormatException e){
JOptionPane.showMessageDialog(null, "Debe escribir un numero");
}
}//GEN-LAST:event_btnModificarActionPerformed |
9a1b4c38-e0ec-4e86-b3a2-b6bbb6239936 | 9 | public void reduce(Text key, Iterator<Text> values, OutputCollector<Text, Text> output, Reporter reporter) throws IOException {
// allocate and initialize 2D array of category by district
int[][] crimes = new int[categories.size()][districts.size()];
for (int i = 0; i < categories.size(); i++) {
for (int j = 0; j < districts.size(); j++) {
crimes[i][j] = 0;
}
}
// create the heat map of crimes in the category/district array
while (values.hasNext()) {
String crime = values.next().toString();
String[] cols = DataFile.getColumns(crime);
if (cols.length == 2) {
if (categoryLookup.containsKey(cols[1])) {
if (districtLookup.containsKey(cols[0])) {
int cat = categoryLookup.get(cols[1]);
int dist = districtLookup.get(cols[0]);
crimes[cat][dist]++;
} else {
log.warning(MessageFormat.format("District {0} not found.", new Object[]{cols[0]}));
}
} else {
log.warning(MessageFormat.format("Category {0} not found.", new Object[]{cols[1]}));
}
} else {
log.warning(MessageFormat.format("Input {0} was in unexpected format", new Object[]{crime}));
}
}
// serialize the non zero entries as a triplet of category index, district index, and total crimes per day
for (int i = 0; i < categories.size(); i++) {
for (int j = 0; j < districts.size(); j++) {
if (crimes[i][j] > 0) {
StringBuffer sv = new StringBuffer();
sv.append(new Integer(i).toString());
sv.append(",");
sv.append(new Integer(j).toString());
sv.append(",");
sv.append(new Integer(crimes[i][j]));
Text tv = new Text();
tv.set(sv.toString());
output.collect(key, tv);
}
}
}
} |
de218ca8-bfec-4bbf-b02d-c5902d240c69 | 2 | @Override
public Cible getCible(String cId) throws InvalidJSONException, BadResponseException {
Cible c = null;
JsonRepresentation representation = null;
Representation repr = serv.getResource("intervention/" + interId
+ "/cible", cId);
try {
representation = new JsonRepresentation(repr);
} catch (IOException e) {
e.printStackTrace();
}
try {
c = new Cible(representation.getJsonObject());
} catch (JSONException e) {
e.printStackTrace();
}
return c;
} |
b39f5738-177c-4322-96ed-feedf676258a | 7 | public void cityCheck() {
for(MyNode n : mg.getNodeArray()) {
for(MyEdge e : n.getFromEdges()) {
if(e.getRoadName().equals(address[0]) && e.getCity().equals(address[5])) {
putEdge(e);
}
}
for(MyEdge e : n.getToEdges()) {
if(e.getRoadName().equals(address[0]) && e.getCity().equals(address[5])) {
putEdge(e);
}
}
}
} |
d07d8175-3c0f-4ae2-8775-05903452d87e | 6 | private boolean checkALError()
{
switch( AL10.alGetError() )
{
case AL10.AL_NO_ERROR:
return false;
case AL10.AL_INVALID_NAME:
errorMessage( "Invalid name parameter." );
return true;
case AL10.AL_INVALID_ENUM:
errorMessage( "Invalid parameter." );
return true;
case AL10.AL_INVALID_VALUE:
errorMessage( "Invalid enumerated parameter value." );
return true;
case AL10.AL_INVALID_OPERATION:
errorMessage( "Illegal call." );
return true;
case AL10.AL_OUT_OF_MEMORY:
errorMessage( "Unable to allocate memory." );
return true;
default:
errorMessage( "An unrecognized error occurred." );
return true;
}
} |
222cc371-34cb-4ff0-8f9b-fd858f8a1788 | 1 | @Override
public Set<Class<?>> getClasses() {
return getRestResourceClasses();
} |
b5497c17-0da0-4955-9934-647848ffb2fb | 9 | public synchronized boolean equals(Object obj) {
if (!(obj instanceof FilterRequest)) return false;
FilterRequest other = (FilterRequest) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.filters==null && other.getFilters()==null) ||
(this.filters!=null &&
this.filters.equals(other.getFilters()))) &&
this.maxCount == other.getMaxCount();
__equalsCalc = null;
return _equals;
} |
be309e7e-dbb3-49f7-ad9e-b3522541d29c | 1 | private int[] mergeSort(int[] a ) {
if(a.length == 1) return a;
int middle = a.length / 2;
int[] left = new int[middle];
int[] right = new int[a.length - middle];
System.arraycopy(a, 0, left, 0, middle);
System.arraycopy(a, middle, right, 0, a.length - middle);
return merge(mergeSort(left), mergeSort(right));
} |
01df2ac5-f8dc-4628-8ef4-995f8f976021 | 2 | public static void moveItem(InventoryItem[] targetInventory, int targetIndex, InventoryItem[] destinationInventory)
{
/*Example of moving an object from your inventory to a storage chest:
* moveItem(player.Inventory,3,chest.Inventory);
* Where player is the instantiated player object, 3 is the index (in the player's inventory) of the object they want to move, and chest is the instantiated storage object.
*/
//Helper, used to find access the properties of the object in question
InventoryItem targetItem = targetInventory[targetIndex];
//Is this a quest item? Should we allow the player to drop it?
//if(targetItem.canDrop)
//{
//get the first empty slot in the destination inventory.
int emptySlot = getFirstEmptySlot(destinationInventory);
//If there were no empty slots, this value would be -1, so we need to make sure its >0. The other check is just a redundancy error check;
if(emptySlot >= 0 && emptySlot < destinationInventory.length)
{
//System.out.println(" [DEBUG] Moving " +targetItem +" from " +targetInventory +" to " +destinationInventory);
targetInventory[targetIndex] = Parasite.items.EmptyItem; //make the target Inventory at index empty
destinationInventory[emptySlot] = targetItem; //make the destination inventory at index full with the object
}
//}
} |
bc1752ad-6868-4521-a122-a97f6f95e4af | 8 | public static Password getPassword(String realm,String dft, String promptDft)
{
String passwd=System.getProperty(realm,dft);
if (passwd==null || passwd.length()==0)
{
try
{
System.out.print(realm+
((promptDft!=null && promptDft.length()>0)
?" [dft]":"")+" : ");
System.out.flush();
byte[] buf = new byte[512];
int len=System.in.read(buf);
if (len>0)
passwd=new String(buf,0,len).trim();
}
catch(IOException e)
{
log.warn(LogSupport.EXCEPTION,e);
}
if (passwd==null || passwd.length()==0)
passwd=promptDft;
}
return new Password(passwd);
} |
89916c07-eb05-4250-bfe2-e1f538be9f73 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(CtrlVisiteurs.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(CtrlVisiteurs.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(CtrlVisiteurs.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(CtrlVisiteurs.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
VueAbstrait vueA = null;
CtrlAbstrait CtrlA = null;
VueVisiteurs vue = new VueVisiteurs(CtrlA);
CtrlVisiteurs ctrl = new CtrlVisiteurs(vue, vueA);
vue.setVisible(true);
} |
df834edc-f52b-420d-9cd8-37e30895f4e0 | 6 | public String get_user_courses_in_circle_by_year(int user_id, int year, int circle_id)
{
User user = get_user_by_id(user_id);
if(user==null)
return "";
ArrayList<Circle> circles=user.user_circles;
ArrayList<Course> courses=user.user_courses;
String user_courses="";
for(Circle circle: circles) //for each circle in user circles
{
if(circle.get_circle_year()==year && circle.get_circle_id()==circle_id) //if circle in year
{
for(Course course: courses)
{
user_courses+=course.get_course_name() + "," + course.get_course_id() + ",";
}
break;
}
}
if(!user_courses.isEmpty())
user_courses=user_courses.substring(0, user_courses.length() - 1); //remove last comma
return user_courses;
} |
f1f204a1-72c8-4bf4-94dc-c68265281004 | 7 | private HashMap<String, HashSet<String>> BFS() {
HashMap<String, HashSet<String>> reverseLinks = new HashMap<String, HashSet<String>>();
if (startWord.equals(endWord))
return reverseLinks;
HashSet<String> visited = new HashSet<String>();
HashSet<String> outGoing = new HashSet<String>();
HashSet<String> reaching = new HashSet<String>();
reaching.add(startWord);
visited.add(startWord);
while (!visited.contains(endWord) && reaching.size() > 0) {
HashSet<String> temp = outGoing;
outGoing = reaching;
reaching = temp;
reaching.clear();
for (String fromWord : outGoing) {
for (String toWord : graph.connectTo(fromWord)) {
if (!visited.contains(toWord)) {
reaching.add(toWord);
HashSet<String> from = reverseLinks.get(toWord);
if (from == null) {
from = new HashSet<String>();
reverseLinks.put(toWord, from);
}
from.add(fromWord);
}
}
}
visited.addAll(reaching);
}
return reverseLinks;
} |
0907c9b5-3c6b-42b5-a661-964215a57d2d | 9 | private Node<K, V> ceilingAll( V value ) {
if( value == null ) { return null; }
Node<K, V> node = mAllRoot;
Node<K, V> ret = null;
if( mValueComparator != null ) {
Comparator<? super V> comp = mValueComparator;
while( node != null ) {
int c = comp.compare( value, node.mValue );
if( c <= 0 ) {
ret = node;
node = node.mAllLeft;
} else {
node = node.mAllRight;
}
}
} else {
Comparable<? super V> comp = (Comparable<? super V>)value;
while( node != null ) {
int c = comp.compareTo( node.mValue );
if( c <= 0 ) {
ret = node;
node = node.mAllLeft;
} else {
node = node.mAllRight;
}
}
}
return ret;
} |
91a4f699-8de9-4bd2-8a47-1261765b62a6 | 2 | Item newMethodItem(final String owner, final String name,
final String desc, final boolean itf) {
int type = itf ? IMETH : METH;
key3.set(type, owner, name, desc);
Item result = get(key3);
if (result == null) {
put122(type, newClass(owner), newNameType(name, desc));
result = new Item(index++, key3);
put(result);
}
return result;
} |
00ccd48a-6e65-4c2e-b387-82abb5b15fbd | 0 | public void clickPlayGame(ArrayList<MainMenuHeroSlot> heroies) {
state.clickPlayGame(heroies);
} |
3f8660ba-a37f-49e0-89d7-194b3204c3b0 | 3 | public void WGDefaultChannel(String channel, String sender, String login, String hostname) {
User user;
boolean changed = false;
for(Game game : games.values()) {
user = getUser(game, sender, login, hostname);
if(user != null) {
user.defaultchannel = channel;
changed = true;
}
}
if(changed) {
sendMessageWrapper(channel, sender, MSG_DEFAULTCHANNEL + channel);
}
else {
tellNotRegistered(channel, sender);
}
} |
6feabf36-8819-4379-b668-a33d127da07c | 2 | public BaseReport(File file) {
this.file = file;
fileName = file.getName();
fileNameSections = fileName.split("\\.")[0].split("_");
try {
if (checkVersion(file).equals("2003")) {
InputStream in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
} else {
InputStream in = new FileInputStream(file);
xWorkbook = new XSSFWorkbook(in);
}
} catch (Exception e) {
e.printStackTrace();
}
} |
0fc0ed76-090a-4ac2-b9a6-3522cc760712 | 7 | protected static void parseSites(final Map<String,SiteConfig> map, Node root) throws Exception {
NodeList children=root.getChildNodes();
if(children == null || children.getLength() == 0)
return;
for(int i=0; i < children.getLength(); i++) {
Node node=children.item(i);
if(node.getNodeType() != Node.ELEMENT_NODE)
continue;
match(SITE, node.getNodeName(), true);
NamedNodeMap attrs=node.getAttributes();
if(attrs == null || attrs.getLength() == 0)
continue;
Attr name_attr=(Attr)attrs.getNamedItem("name");
String name=name_attr.getValue();
if(map.containsKey(name))
throw new Exception("Site \"" + name + "\" already defined");
SiteConfig site_config=new SiteConfig(name);
map.put(name, site_config);
parseBridgesAndForwards(site_config, node);
}
} |
083aabc2-050c-485d-b58b-4c4ead2d4940 | 8 | public static void checkAccuracyRealFFT_1D() {
System.out.println("Checking accuracy of 1D real FFT...");
for (int i = 0; i < sizes1D.length; i++) {
FloatFFT_1D fft = new FloatFFT_1D(sizes1D[i]);
double err = 0.0;
float[] a = new float[sizes1D[i]];
IOUtils.fillMatrix_1D(sizes1D[i], a);
float[] b = new float[sizes1D[i]];
IOUtils.fillMatrix_1D(sizes1D[i], b);
fft.realForward(a);
fft.realInverse(a, true);
err = computeRMSE(a, b);
if (err > eps) {
System.err.println("\tsize = " + sizes1D[i] + ";\terror = " + err);
} else {
System.out.println("\tsize = " + sizes1D[i] + ";\terror = " + err);
}
a = null;
b = null;
fft = null;
System.gc();
}
System.out.println("Checking accuracy of on 1D real forward full FFT...");
for (int i = 0; i < sizes1D.length; i++) {
FloatFFT_1D fft = new FloatFFT_1D(sizes1D[i]);
double err = 0.0;
float[] a = new float[2 * sizes1D[i]];
IOUtils.fillMatrix_1D(sizes1D[i], a);
float[] b = new float[2 * sizes1D[i]];
for (int j = 0; j < sizes1D[i]; j++) {
b[2 * j] = a[j];
}
fft.realForwardFull(a);
fft.complexInverse(a, true);
err = computeRMSE(a, b);
if (err > eps) {
System.err.println("\tsize = " + sizes1D[i] + ";\terror = " + err);
} else {
System.out.println("\tsize = " + sizes1D[i] + ";\terror = " + err);
}
a = null;
b = null;
fft = null;
System.gc();
}
System.out.println("Checking accuracy of 1D real inverse full FFT...");
for (int i = 0; i < sizes1D.length; i++) {
FloatFFT_1D fft = new FloatFFT_1D(sizes1D[i]);
double err = 0.0;
float[] a = new float[2 * sizes1D[i]];
IOUtils.fillMatrix_1D(sizes1D[i], a);
float[] b = new float[2 * sizes1D[i]];
for (int j = 0; j < sizes1D[i]; j++) {
b[2 * j] = a[j];
}
fft.realInverseFull(a, true);
fft.complexForward(a);
err = computeRMSE(a, b);
if (err > eps) {
System.err.println("\tsize = " + sizes1D[i] + ";\terror = " + err);
} else {
System.out.println("\tsize = " + sizes1D[i] + ";\terror = " + err);
}
a = null;
b = null;
fft = null;
System.gc();
}
} |
1aedb250-f681-45de-bf9d-61b30951a7c3 | 0 | public void sprzedawanie(){
System.out.println("Sprzedaje sprzet...");
} |
49e2f10e-6cc2-4d98-8925-314821492716 | 8 | protected void markEnclosingMemberWithLocalType() {
if (this.currentElement != null) return; // this is already done in the recovery code
for (int i = this.astPtr; i >= 0; i--) {
ASTNode node = this.astStack[i];
if (node instanceof AbstractMethodDeclaration
|| node instanceof FieldDeclaration
|| (node instanceof TypeDeclaration // mark type for now: all initializers will be marked when added to this type
// and enclosing type must not be closed (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=147485)
&& ((TypeDeclaration) node).declarationSourceEnd == 0)) {
node.bits |= ASTNode.HasLocalType;
return;
}
}
// default to reference context (case of parse method body)
if (this.referenceContext instanceof AbstractMethodDeclaration
|| this.referenceContext instanceof TypeDeclaration) {
((ASTNode)this.referenceContext).bits |= ASTNode.HasLocalType;
}
} |
5bb36a8a-7af9-4831-b676-42cc6c3d5d78 | 3 | public DisplayMode findFirstCompatibleMode(
DisplayMode modes[])
{
DisplayMode goodModes[] = device.getDisplayModes();
for (int i = 0; i < modes.length; i++) {
for (int j = 0; j < goodModes.length; j++) {
if (displayModesMatch(modes[i], goodModes[j])) {
return modes[i];
}
}
}
return null;
} |
f7ccee19-5272-4d2e-8fd5-7a96bb288870 | 9 | @Override
public boolean exec() {
//解析
this.doComm(this.line);
//this.line = this.line.replaceAll(",", ""); //String 可能包含空格
int p1 = this.line.indexOf(" ");
int p2 = this.line.indexOf(",");
if (p1 == -1 || p2 == -1 || p2>=this.line.length()) {
this.out.append("exec var error. line:").append(this.line);
this.mgr.err(this);
log.error(this.out);
return false;
}
String[] ws = new String[3];
ws[0] = this.line.substring(0,p1);
ws[1] = this.line.substring(p1+1,p2);
ws[2] = this.line.substring(p2+2).trim();
//生成Var
v.setKey(ws[0]);
boolean isString = ws[0].contains("string");
boolean isClass = ws[0].contains("class");
String type = (isString ? "String" : (isClass ? "Class" : "number"));
v.setClassName(type);
String vName = ws[1];
v.setName(vName);
String value = ws[2].trim();
if (isString) {
v.setValue(value);
}else if(isClass){
v.setValue(value);
}else{
//直接用修正后16进制数,因为无法实际区分float,double
value = fixNum(ws[0], value);
v.setValue(value);
}
//仅输出value
v.setOut(value);
//加入到SentenceMgr的Var集合,此时需要判断mgr中是否已存在及v的输出状态
if (this.mgr.getVar(v.getName()) == null) {
// v.setOutVar(false);
this.mgr.setVar(v);
}else{
//此时很可能是赋值,变为可输出状态
Var v1 = this.mgr.getVar(v.getName());
//是否输出的判断
boolean isSet = !ComputeSentence.isLocalVar(v1, this.mgr.isStatic());
if(isSet){
this.mgr.setVar(v);
}else{
// if (type.equals("int")) {
// String right = null;
// if (String.valueOf(value).equals("0")){
// right = Var.checkIout(v1.getClassName(), "0") +" /* " + value +" */";
// }else{
// right = Var.checkIout(v1.getClassName(), value);
// }
// if (v1.getClassName().equals("int") && (!v1.getClassName().equals("int")) && StringUtil.isDigits(v1.getValue())) {
// right = String.valueOf(value);
// }
// v.setOut(right);
// }
v.setOut(Var.varOut(v1.getClassName(), value));
this.out.append(v1.getOut()).append(" = ").append(v.getOut());
this.type = Sentence.TYPE_LINE;
v1.setValue(v.getValue());
}
}
this.over();
return true;
} |
307962ca-3d88-4bdc-b593-41ede2dfce5d | 1 | @Override
public int getSlotSpacingY() {
return isNotPlayerInventory() ? 32 : 18;
} |
f94a8661-8a62-4d92-9316-dacb138dee64 | 5 | private void calcspectralDifference() {
float[] spectrum = this.nextSpectrum();
float[] lastSpectrum = new float[spectrum.length];
// System.out.println("Spectrum length = " + spectrum.length);
// while there are samples to read, we calculate the flux for each
// window
do {
float flux = 0;
for (int i = 0; i < spectrum.length; i++) {
float value = (spectrum[i] - lastSpectrum[i]);
// the negative values don't have interest
if(!useSquare) {
flux += value < 0 ? 0 : value;
} else {
flux += value < 0 ? 0 : value * value;
}
}
spectralDifference.add(flux);
// the lastSpectrum in the following iteration is the
// currentSpectrum of this iteration
System.arraycopy(spectrum, 0, lastSpectrum, 0, spectrum.length);
} while ((spectrum = this.nextSpectrum()) != null);
} |
e17b4b5a-b762-4531-a212-4c4ce547a11d | 0 | public void die()
{
alive = false;
} |
ebb642bf-469d-4db8-aba1-e8a8310c9f24 | 5 | @Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof Node) {
Node n = (Node)obj;
if (n.getId() != null && this.getId() != null
&& n.getId().equals(this.getId())) {
return true;
}
}
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.