text stringlengths 14 410k | label int32 0 9 |
|---|---|
*/
public void abandonColony(Colony colony) {
if (!requireOurTurn()) return;
Player player = freeColClient.getMyPlayer();
// Sanity check
if (colony == null || !player.owns(colony)
|| colony.getUnitCount() > 0) {
throw new IllegalStateException("Abandon bogus... | 6 |
public HashSet<String> loadProductNameWords(String productName,
HashSet<String> words) {
// HashSet<String> words = new HashSet<String>();
String[] wordArray = productName.split(" ");
for (String word : wordArray) {
if (isNumeric(word) || word.equals(" ")) {
continue;
}
words.add(word.trim());
}... | 3 |
private List<ReducerEstimatedJvmCost> estimateReducersMemory(List<Reducer> eReducers, InitialJvmCapacity gcCap) {
int fReducerNum = finishedConf.getMapred_reduce_tasks();
if(fReducerNum == 0)
return null;
List<ReducerEstimatedJvmCost> reducersJvmCostList = new ArrayList<ReducerEstimatedJvmCost>();
Re... | 4 |
public synchronized HijackCanvas getCanvas() {
if (canvas != null) {
return canvas;
}
if (loader == null || loader.getApplet() == null || !(loader.getApplet().getComponentAt(100, 100) instanceof HijackCanvas)) {
return null;
}
return (HijackCanvas) loader.getApplet().getComponentAt(100, 100);
} | 4 |
public <ObjectType> ObjectType bindAll( final ObjectType object ) {
Class cl = object.getClass();
for ( final Method method : cl.getMethods() ) {
Listener annotation = method.getAnnotation( Listener.class );
if ( annotation != null ) {
if ( m... | 8 |
public Fibonacci union(Fibonacci H1, Fibonacci H2) {
Fibonacci H = new Fibonacci();
//tarkistetaan, ettei kummankaan keon minimi ole null
if ((H1 != null) && (H2 != null)) {
//tehdään alustavasti H1:n minimistä H:n minimi
H.min = H1.m... | 5 |
public boolean intersect(int[] start, int[] off) {
int len = this.start.length;
boolean isIntersect = true;
for (int i = 0; i < len; i++) {
if ((this.start[i] >= start[i] + off[i] || this.start[i]
+ this.chunkStep[i] <= start[i])) {
isIntersect = false;
}
}
return isIntersect;
} | 3 |
@Override
public Point getTarget(GameState state) {
float[][] candidates = new float[3][5];
Point target = null;
int i = 0;
for(TargetingStrategy strategy : strategies) {
target = strategy.getTarget(state);
if(target != null) {
candidates[target.x][target.y] += weights[i];
}
++i;
}
float... | 5 |
private String statusSimple() {
int activeHosts = 0;
for (Host host : hosts.values())
if (host.isRunning())
activeHosts++;
int numServices = 0;
for (Map<String, Service> map : services.values())
numServices += map.size();
int forwardingConnections = 0;
for (Connection connection : connection... | 5 |
private int[] sevenSeg(double[] signalFFT, double Fs){
double areaTotal = ArithmanticUtil.sum(signalFFT) / Fs;
double segmentSize = areaTotal / 7;
double[] area = new double[7];
int[] interval = new int[8];
interval[0] = 0;
for(int i = 1; i < interval.length; i++)
interval[i] = signalFFT.length;
do... | 7 |
private void doUpdateJH(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String jhId = StringUtil.toString(request.getParameter("jhId"));
if(!StringUtil.isEmpty(jhId)) {
ObjectMapper mapper = new ObjectMapper();
Map result = new Ha... | 3 |
public final void doVote(final String player) {
// Check Player exists!
OfflinePlayer thePlayer = Bukkit.getOfflinePlayer(player);
if (!thePlayer.hasPlayedBefore()) {
log.info(String.format(plugin.getMessages().getString("player.never.played"), player));
return;
}... | 5 |
public FieldName(final GObject gObj, ArrayList<String> fieldNames, String type, GridPane gp, int row, HistoryManager hm) {
gp.add(new Label(LabelGrabber.getLabel("field.name.text") + ":"), 0, row);
textField = new FieldNameTextField();
this.fieldNames = fieldNames;
this.historyManager = ... | 4 |
@Test
public void test2() {
xmlReader.setContentHandler(new DefaultHandler() {
private String currentQName;
private int number;
private int requiredNumber = 2;
@Override
public void startElement(String uri, String localName,
String qName, Attributes attributes) throws SAXException {
currentQ... | 3 |
public SystemXMLParser(String fileName) {
File schemaFile;
Schema schema;
Source xmlFile = new StreamSource(new File(fileName));
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFile = new File("bin/schema.xsd");
try {
schema = schemaFactory.newSchema(... | 4 |
public void setChangable(boolean b) {
changable = b;
if (b) {
questionBody.getHtmlPane().removeLinkMonitor();
if (!isChangable()) {
if (choices != null) {
for (AbstractButton x : choices)
x.addMouseListener(popupMouseListener);
}
}
}
else {
questionBody.getHtmlPane().addLinkMonito... | 7 |
public static boolean isBlockSeparator(String s) {
if (s.startsWith("--") && s.endsWith("--")) {
return true;
}
if (s.startsWith("==") && s.endsWith("==")) {
return true;
}
if (s.startsWith("..") && s.endsWith("..") && s.equals("...") == false) {
return true;
}
if (s.startsWith("__") && s.endsWit... | 9 |
private Class classFor(final String name) {
if (name == null) throw new NullPointerException("missing required 'type' filter config parameter");
Class cl = null;
try {
return Class.forName(name);
} catch (ClassNotFoundException e) {
}
try {
return ... | 4 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WithNotAnnotatedField that = (WithNotAnnotatedField) o;
if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null) return fals... | 5 |
public static void main(String [] args) {
Primes primeGetter = new Primes();
int maxSummands = 0;
int j = 1;
// for every prime p ...
for (long p = primeGetter.getNth(j); p<=MAX_PRIME_VALUE; p = primeGetter.getNth(++j)) {
// ... start testing summations at each smaller primes p2 ...
int k = 1;
for... | 5 |
@Override
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
// Conditionally select and set the character encoding to be used
if (this.ignore || request.getCharacterEncoding() == null) {
... | 7 |
@Override
public void run() {
try {
prepare();
} catch (FileNotFoundException e) {
logger.fatal(e.getMessage());
return;
} catch (InterruptedException e) {
return;
}
String line;
... | 9 |
public void setVisible(boolean visible) {
if(window == null) {
initialize();
}
this.visible = visible;
} | 1 |
public LngLatAlt getCoordinates()
{
return coordinates;
} | 0 |
private void transformToRegularForm(String option) throws ConfigurationException, ConsoleException,
UnrecognizedCommandException, NullValueException {
if (!isTheoryModified) return;
Command transform = commands.getCommand(Transform.COMMAND_NAME);
String opt = "".equals(option.trim()) ? "" : transform.getOptio... | 7 |
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://down... | 6 |
public List<Evidence> getEvidenceList(String fileName, String actionType, String teamType) {
List<Evidence> evidenceList = new ArrayList<Evidence>();
Element evidenceE;
Evidence evidence;
ClaimDao claimDao = new ClaimDao(fileName);
Claim claim = null;
List<Claim> claimAndSubclaimList = claimDao.getClaimAndS... | 4 |
private void setNameGameWorld(String name) {
nameGameWorld = name.substring(name.lastIndexOf(".") + 1, name.indexOf("Loc"));
} | 0 |
public int immuneCounter(Type primary, Type secondary) {
int counter = 0;
if (immuneTypes == null || immuneTypes.length ==0) {
return 0;
}
for (int i = 0; i < immuneTypes.length; i++) {
if (immuneTypes[i].equalsTo(primary.showType()) || immuneTypes[i].equ... | 5 |
private void unfoldNonRecursiveTails() {
// a la mohri nederhof determinization:
// every time a nonrecursive tail is used, make a copy for the specific used position.
// this can be done before addReduceTransitions
Relation<Item, Item> edges = new Relation<Item, Item>();
for (Item i : allItems()) {
for... | 9 |
protected int transform(JavaMethod javaMethod, List tokens, int i) {
if (!javaMethod.getName().equals("initializeClassAttributes")) {
return i;
}
javaMethod.methodBody.remove(i, i+5/*12*/);
if (((JavaToken)tokens.get(i)).value.equals("friends")) {
int end = javaMethod.methodBody.findClosingCallEnd(i... | 9 |
private void updateButton(MouseEvent event)
{
int index = getUI().tabForCoordinate(CloseableTabbedPane.this, event.getX(), event.getY());
if (index != -1 && index != getSelectedIndex()) {
if (visibleIndex == index) {
return;
}
setButtonVisible(index, true);
if (visibleIndex != index && visi... | 9 |
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {} | 0 |
public void computeStabilities(String s) {
try {
BufferedReader bufferedreader = new BufferedReader(new FileReader(s));
for (int i = 0; i < 10000; i++) {
bufferedreader.readLine();
}
for (int j = 0; j < 0x3d0900; j++) {
String s1 = bufferedreader.readLine();
if (s1 == null) {
break;
... | 7 |
private String loadRivers() {
if (details) System.out.println("Loading rivers.");
File imageFile = new File("output/"+Name+"/overviews/rivers_overview.png");
if (imageFile.exists()) {
try {
BufferedImage tempImage = ImageIO.read(imageFile);
if (tempImage.getWidth() == chunksX * MyzoGEN.DIMENSION_X &... | 9 |
public String toString() {
String res = "[Polygon";
for(int i=0; i<corners.length && i<4; i++)
res += " " + corners[i].toString();
return res+"]\n";
} | 2 |
public int action(ArrayList<RObj> objs, int actionBy) {
Player plr = (Player) objs.get(0);
needIntersect = !needIntersect;
if (panel.isEnabled()) {
if (plr.getInv() == null) {
intersect = true;
fireThrough = true;
riftIntersect = true;
panel.setEnabled(false);
panel.setOpaque(false);
pl... | 7 |
public void keyReleased(KeyEvent e) {
int key = e.getKeyCode();
switch (key) {
case KeyEvent.VK_UP:
action.thrust = 0;
break;
case KeyEvent.VK_LEFT:
action.turn = 0;
break;
case KeyEvent.VK_RIGHT:
... | 6 |
@Override
public boolean equals(Object other){
if(other == null){
return false;
} else if (this == other) {
return true;
} else if (!(other instanceof RecipeIngredient)) {
return false;
}
//Numbers in prefix and suffix might be sql doubles... | 5 |
public Iterable<Key> keys() {
Queue<Key> queue = new Queue<Key>();
for (Node x = first; x != null; x = x.next)
queue.enqueue(x.key);
return queue;
} | 1 |
@GET
@Path("events/{id}/participants")
@Produces({MediaType.APPLICATION_JSON })
public List<Participant> getEventParticipants(@PathParam("id")int idEvent){
System.out.println("Return the partcipants list of the event selected by the id");
return JpaTest.eventService.getParticipants(idEvent);
} | 0 |
public void testInverted() {
m_Filter = getFilter("1,2,3,4,5,6");
((TimeSeriesDelta)m_Filter).setInvertSelection(true);
Instances result = useFilter();
// Number of attributes shouldn't change
assertEquals(m_Instances.numAttributes(), result.numAttributes());
assertEquals(m_Instances.numInstance... | 7 |
public void run(){
AudioInputStream stream = null;
for (int i = (int) (Math.random() * songs1.size()); i < songs1.size(); i++){
try {
// open the audio input stream
stream = AudioSystem.getAudioInputStream(songs1.get(i));
format = stream.getFormat();
//... | 6 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TAdjstkPK other = (TAdjstkPK) obj;
if (!Objects.equals(this.transNo, other.transNo)) {
return... | 4 |
@Override
public void conversion() {
switch (type) {
case RZ:
codageRZ();
break;
case NRZ:
codageNRZ();
break;
case NRZT:
codageNRZT();
break;
}
} | 3 |
public void setAction(TicketQueryAction value) {
this._action = value;
} | 0 |
public double rawAllResponsesVariance(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawAllResponsesVariance;
} | 2 |
public String getRecommendation() {
return recommendation;
} | 0 |
public float addWeight(int numberSum, int numberDirection) {
switch (numberDirection) {
case 1:
if (numberSum >= 4)
return 15;
else
return (float) 15 / (4 - 1) * numberSum - (float) 15 / (4 - 1);
case 2:
if (numberSum >= 7)
return 15;
else
return (float) 15 / (7 - 1) * numberSum - (flo... | 8 |
@Test
public void testCadastrarProduto(){
Produto p5 = new Produto(5,"Smartphone Samsung Galaxy Ace Preto, Desbloqueado Vivo, GSM, Android, C‚mera de 5MP, Tela Touchscreen 3.5\", 3G, Wi-Fi, Bluetooth e Cart„o de MemÛria 2GB",3, 499.00f);
try {
facade.cadastrarProduto(p5);
Assert.assertEquals(facade.listarPro... | 3 |
public AffichageUserGui() {
initComponents();
setSize(700, 500);
setMinimumSize(new Dimension(600, 0));
setMaximumSize(new Dimension(800, Integer.MAX_VALUE));
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation(dim.width/2-this.getSize().width/2,... | 2 |
@Override
public void addAllMapLast(Map<? extends K, ? extends Collection<? extends V>> map) {
for (Map.Entry<? extends K, ? extends Collection<? extends V>> en : map.entrySet()) {
addAllLast(en.getKey(), en.getValue());
}
} | 7 |
public void steppedOn(Level level, int xt, int yt, Entity entity) {
if (random.nextInt(60) != 0) return;
if (level.getData(xt, yt) < 5) return;
level.setTile(xt, yt, Tile.dirt, 0);
} | 2 |
public static Stella_Class getIdenticalClass(String classname, String stringifiedsource) {
{ Surrogate surrogate = Surrogate.lookupSurrogate(classname);
Stella_Object oldvalue = ((surrogate != null) ? surrogate.surrogateValue : ((Stella_Object)(null)));
if (oldvalue != null) {
if (Surrogate.sub... | 6 |
@Override
public String toString() {
final ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
PrintStream out;
try {
out = new PrintStream(bos, false, IOUtils.UTF_8);
} catch (UnsupportedEncodingException bogus) {
throw new RuntimeException(bogus);
}
out.println(" ... | 9 |
@Override
public void update(double delta) {
if(linked.getRemoved()) {
getEntity().remove();
}
} | 1 |
public static SensitivityEnumeration fromString(String v) {
if (v != null) {
for (SensitivityEnumeration c : SensitivityEnumeration.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} | 3 |
@Override
public ICacheable put(Object key, ICacheable value) {
if (key == null || value == null) {
throw new NullPointerException("key == null || value == null");
}
ICacheable previous = null;
synchronized (this) {
mPutCount++;
mCurrSize += safeSizeOf(key, valu... | 3 |
public void setResourceParameter(int resourceID, double cost)
{
Resource res = new Resource();
res.resourceId = resourceID;
res.costPerSec = cost;
res.resourceName = GridSim.getEntityName(resourceID);
// add into a list if moving to a new grid resource
resList_.add(r... | 3 |
public LSystemEnvironment(LSystemInputPane input) {
super(null);
this.input = input;
input.addLSystemInputListener(new LSystemInputListener() {
public void lSystemChanged(LSystemInputEvent event) {
setDirty();
}
});
} | 0 |
private void askForItemToUse() {
UseItemDialog dialog = new UseItemDialog("Choose item to use", 500, 500, objectTron.getActivePlayerInfo().getInventoryItems());
int answer = dialog.show();
if (answer == JOptionPane.OK_OPTION) {
int chosenItemIndex = dialog.getChosenItemIndex();
ElementInfo chosenItem = obj... | 5 |
@Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/mensaje.jsp");
EntradaBean oEntradaBean = new EntradaBean();
EntradaParam oEntradaPar... | 1 |
public synchronized void createTables() throws BoardInitException, SQLException {
ResultSet res;
String commonSql = null;
// Check if common stuff has already been created
tableChkStmt.setString(1, "index_counters");
res = tableChkStmt.executeQuery();
try {
i... | 9 |
public Tile getBlockAt(int x, int y) {
if (!this.tiles.isEmpty()) {
for (int i = 0; i < this.tiles.size(); i++) {
if (this.tiles.get(i) != null) {
Tile tile = this.tiles.get(i);
if (tile.getX() / 48 == x && tile.getY() / 48 == y)
return tile;
}
}
}
return null;
} | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ConstructorInfo other = (ConstructorInfo) obj;
if (beanClass == null) {
if (other.beanClass != null)
return false;
} else if (!beanClass... | 9 |
public void drawFields(Graphics2D g)
{
// WILL EVENTUALLY CHANGE THESE CONSTANT NUMBERS
for(int i = 0; i < this.getBoardSize(); i++)
{
if(i < 7)
this.fields.get(i).draw(g, field_size, Color.WHITE);
else if(i < 16)
this.fields.get(i).dra... | 5 |
@Test
public void testParseArguments() {
Arguments args = new Arguments();
args.setArgument("var1",
"Teest1 test2 test3 blah blah blahtest3 blah blah "
+ "blahtest3 blah blah blahtest3 blah blah "
+ "blahtest... | 3 |
private String getSelectedButtonName(ButtonGroup bg) {
String returnString = "";
boolean isFound = false;
Enumeration<AbstractButton> blockButtons = bg.getElements();
while(blockButtons.hasMoreElements() && !isFound) {
JToggleButton button ... | 3 |
final void method3677(Canvas canvas) {
try {
aCanvas7575 = null;
anInt7621++;
aLong7636 = 0L;
if (canvas == null || canvas == aCanvas7626) {
aCanvas7575 = aCanvas7626;
aLong7636 = aLong7553;
} else if (aHashtable7577.containsKey(canvas)) {
Long var_long = (Long) aHashtable7577.get(canvas... | 7 |
public static void setDescriptor (
Device dev,
byte descriptorClass,
byte descriptorType,
byte id,
int index,
byte buf []
) throws IOException
{
if (index > 0xffff || buf.length > 0xffff)
throw new IllegalArgumentException ();
ControlMessage msg = new ControlMessage ();
msg.setRequestType ((byte... | 2 |
private void parseContributorList(String key) {
// Init
if (!contributors.containsKey(key))
{
contributors.put(key, new ArrayList<String>());
}
List<String> list = contributors.get(key);
if (config.has(key) && config.get(key).isJsonArray())
{
for(JsonElement el: config.get(key).getAsJsonArray()) {... | 4 |
public String numberize(int number)
{
if (number >= 100)
return "" + number;
else if (number >= 10)
return "0" + number;
else
return "00" + number;
} | 2 |
@Override
public void render(GameContainer gc, StateBasedGame arg1, Graphics g)
throws SlickException {
backgroundImage.draw(0, 0);
for(Bird bird : birds) {
bird.render(gc, g);
}
for(Obstacle o : obstacles) {
o.render(gc, g);
}
controlledBird.render(gc, g);
HashMap<Integer, Boolean> enab... | 4 |
@Override
public void startUp(final GameTime gameTime) {
// Call the start up methods of any children that previously existed on
// the logicalQueue
for (ILogical gameComponent : logicalQueue) {
gameComponent.startUp(gameTime);
}
// Also call the start up methods of any children that were queued to be
/... | 1 |
public void paintComponent(Graphics g) {
super.paintComponent(g);
if ( (OSI == null) || OSI.getWidth() != getWidth() || OSI.getHeight() != getHeight() ) {
OSI = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
needsRedraw = true;
}
if (needsRedraw) {
... | 6 |
Key[] resize(Key[] a, int n)
{
Key[] b = (Key[]) new Comparable[n];
System.arraycopy(a, 0, b, 0, (a.length < b.length) ? a.length
: b.length);
return b;
} | 1 |
private String Trans2Syn(String s)
{
Stack<Character> ts = new Stack<Character>();
for (int i = 0; i < s.length(); ++i)
{
if (Character.isDigit(s.charAt(i)))
{
if (ts.size() == 0 || !ts.peek().equals('i'))
{
ts.push('i');
}
} else
{
ts.push(s.charAt(i));
}
}
String tmp = "... | 5 |
@EventHandler
public void handleBlockBreaks(BlockBreakEvent event) {
Player player = event.getPlayer();
User user = EdgeCoreAPI.userAPI().getUser(player.getName());
if (user != null) {
Cuboid cuboid = Cuboid.getCuboid(player.getLocation());
if (cuboid == null) {
if (!WorldManager.get... | 8 |
public static void decrypt(File inputFile, File outputFile) throws IOException {
BufferedImage img = ImageIO.read(inputFile);
int p1,p2;
/**
* Step 1: do the stuff
*/
p1 = img.getRGB(0, 0);
p2 = img.getRGB(1, 0);
int[] bitsPerChannel = new int[3];
getChannelEncoding(new byte[] { (byte)((p1 >... | 9 |
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
try {
this.commandsManager.execute(command.getName(), args, sender, sender);
} catch (CommandPermissionsException e) {
sender.sendMessage(ChatColor.RED + "You don't have p... | 6 |
public static void main(String[] args)
{
Digraph G = null;
try
{
G = new Digraph(new In(args[0]));
System.out.println(args[0] + "\n" + G);
}
catch (Exception e)
{
System.out.println(e);
System.exit(1);
}
System.out.println("Vertex: Component");
StronglyConnectedComponents scc = new Stro... | 2 |
protected boolean isFinished() {
return false;
} | 0 |
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null || obj.getClass() != this.getClass()) {
return false;
}
Admin admin = (Admin) obj;
if (admin.getLogin() == login || (login.equals(admin.getLogin())) && admin.getPassword() == password || (password.equals(... | 7 |
@Test
public void depthest02vsdepthest21()
{
for(int i = 0; i < BIG_INT; i++)
{
int numPlayers = 2; //assume/require > 1, < 7
Player[] playerList = new Player[numPlayers];
ArrayList<Color> factionList = Faction.allFactions();
playerList[0] = new Player(chooseFaction(factionList), new DepthEstA... | 4 |
public boolean hasPreviouslyJudged(Judge j, Pair pairToCheck,
List<Round> rounds) {
for (Round r : rounds) {
for (Pair currPair : r.getPairs()) {
if (currPair.getAffTeam() == pairToCheck.getAffTeam()
|| currPair.getAffTeam() == pairToCheck.getNegTeam()
|| currPair.getNegTeam() == pairToCheck.get... | 7 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Product other = (Product) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
... | 4 |
public void setActive(boolean active){
if(this.active == false && active == true){
this.status = Status.JOINABLE;
}
if(this.active == true && active == false){
File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml");
FileConfiguration Language = YamlCo... | 4 |
@Override
public void update(Object obj) {
if(obj.equals("Revived") || obj.equals("Alive")){
recordRevive();
} else if(obj.equals("Dead")){
recordKill();
}
} | 3 |
@Override
public void run() {
File file = new File(tmpFileDestination);
if(file.exists()) {
File[] files = file.listFiles();
for(int i=0;i<files.length;i++)
files[i].delete();
MyLog.logINFO("tmpFile has been cleared...");
}
File fil... | 6 |
public static BasicUser lookUp(String username, char[] password){
BasicUser ret = null;
try {
Connection conn = DriverManager.getConnection("jdbc:mysql://174.102.54.43/communityhub", "commhubuser", "foobar");
String query = "SELECT password,role FROM user WHERE username='" + username + "';";
S... | 6 |
protected static FastVector merge(Sequence seq1, Sequence seq2, boolean oneElements, boolean mergeElements) {
FastVector mergeResult = new FastVector();
//merge 1-sequences
if (oneElements) {
Element element1 = (Element) seq1.getElements().firstElement();
Element element2 = (Element) seq2.getEl... | 9 |
public ArrayList<ArrayList<String>> partition(String s) {
ArrayList<ArrayList<String>> rows = new ArrayList<ArrayList<String>>();
ArrayList<String> row = new ArrayList<String>();
int len = s.length();
if (len == 0 || len == 1){
row.add(s);
rows.add(row);
}
Set<String> dict = getPalindromes(s);
// ... | 5 |
private void constructAboutPopup()
{
aboutPane = new JEditorPane("text/html", ABOUT_CONTENTS);
aboutPane.addHyperlinkListener(new HyperlinkListener()
{
public void hyperlinkUpdate(HyperlinkEvent e)
{
if (EventType.ACTIVATED.equals(e.getEventType()))
... | 4 |
public void checkDragging(int c, int d) {
if(Greenfoot.mousePressed(this) && !isGrabbed){
// grab the object
isGrabbed = true;
wasGrabbed = true;
contGoneX = this.getX();
contGoneY = this.getY();
// the rest of this block... | 7 |
public Object makeDefaultValue(Class type)
{
if (type == int.class)
return new Integer(0);
else if (type == boolean.class)
return Boolean.FALSE;
else if (type == double.class)
return new Double(0);
else if (type == S... | 8 |
private String mobList(List<MOB> mobList, MOB oldMob, String oldValue)
{
final StringBuffer list=new StringBuffer("");
if(oldMob==null)
oldMob=RoomData.getMOBFromCatalog(oldValue);
for (final MOB M2 : mobList)
{
list.append("<OPTION VALUE=\""+RoomData.getMOBCode(mobList, M2)+"\" ");
if((oldMob!=null)&... | 8 |
@Override public boolean equals( Object oth ) {
if( !(oth instanceof TraceNode) ) return false;
TraceNode tn = (TraceNode)oth;
return
division == tn.division &&
equalsOrBothNull(material, tn.material) &&
splitPoint == tn.splitPoint &&
equalsOrBothNull(subNodeA, tn.subNodeA) &&
equalsOrBothNull(s... | 5 |
public void WGSafeQuit(String sender) {
for(Game game : new HashSet<Game>(games.values())) {
if(saveGame(game)) {
sendMessage(sender, "Game " + game.id + " saved.");
}
else {
sendMessage(sender, MSG_SAVEERROR);
}
}
... | 3 |
private void calcNormalizedDirection(Point result,
int x1, int y1, int x2, int y2)
{
// Hajo: calculate normalized vector components
int dxn = (x1 == x2) ? 0 : (x1 < x2) ? 1 : -1;
int dyn = (y1 == y2) ? 0 : (y1 < y2) ? 1 : -1;
if(dxn != 0 &&... | 7 |
public HashMap<String, String> constructHashMap(){
int num=255;
HashMap<String,String> binaryDecimal = new HashMap<String, String>();
binaryDecimal.put("00000000","0");
StringBuilder remainders ;
while(num!=0){
remainders = new StringBuilder();
int temp = ... | 2 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.