text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void initialise(World world) throws PatternFormatException
{
String[] cellParts = cells.split(" ");
for (int i=0;i<cellParts.length;i++)
{
char[] currCells = cellParts[i].toCharArray();
for (int j=0;j<currCells.length;j++)
{
if (currCells[j] != '1' && currCells[j] != '0') ... | 5 |
public static void main(String[] args) {
ArrayList newWordList = new ArrayList();
ArrayList filteredWordList = new ArrayList();
try {
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream("My Clippings.txt");
// Get the object of DataInputStream
... | 7 |
public boolean createDirectory(String path) throws IOException {
return fs.mkdirs(new Path(path));
} | 0 |
protected GraphicalRepresentationElement representChildren(PathElement el, Set<PathElement> blackNodes)
{
// FIXME: check casts to VisualizableGraphComponent throughout the method
GraphicalRepresentationElement repr = new GraphicalRepresentationElement(this,
(VisualizableGraphComponent) el.getNode(), Type.NODE... | 8 |
private static boolean canPushBlock(int par0, World par1World, int par2, int par3, int par4, boolean par5)
{
if (par0 == Block.obsidian.blockID)
{
return false;
}
else
{
if (par0 != Block.pistonBase.blockID && par0 != Block.pistonStickyBase.blockID)
... | 9 |
public void run(){
int generation = 0;
calculateFitnesses();
//main loop
while(true){
if(generation % POPULATION_SIZE == 0){
System.out.println("\nGeneration: "+generation+", cost: "+minCost);
System.out.print("\nminimum gene: ");
printGene(genes[fittestGeneIndex]);
initRouteFromGene(ge... | 2 |
private void createDrawHistory(){
DataInstance ddi = new DataInstance(drawNet.inputNodes());
//Rack
ddi.addFeature(rack.getCards(), game.card_count);
//Probabilities
if (USE_PROB_DRAW){
double[][] prob = rack.getProbabilities(false, 0);
ddi.addFeature(prob[0], 1);
ddi.addFeature(prob[1], 1);
}
//... | 1 |
private void findAnnotations(Class clazz) {
if (clazz.getSuperclass() != null) {
findAnnotations(clazz.getSuperclass());
}
for (Method m : clazz.getDeclaredMethods()) {
Command c = null;
m.setAccessible(true);
if ((c = m.getAnnotation(Command.cl... | 9 |
public void populateFromFolder(final String str_name, final File cl_dir, final boolean b_dir) {
ScriptEngineManager lcl_mgr = new ScriptEngineManager();
for (File lcl_f : cl_dir.listFiles()) {
if (lcl_f.isDirectory()) {
if (b_dir) {
populateFromFolder(str_name, lcl_f, b_dir);
}
} else if (!lcl_f... | 5 |
@Override
public boolean equals(Object o) {
if(!(o instanceof MapEntry))
return false;
MapEntry<?, ?> me = (MapEntry<?, ?>)o;
return (key == null ? me.getKey() == null : key.equals(me.getKey()))
&& (value == null ? me.getValue() == null : value.equals(me
... | 8 |
public void update(WPEngine4 engine) {
if(lightingType.equals(LightingType.SPOT_LIGHT)) {
//setupLighting(lightingType);
for(int i = 0; i < spotList.size(); i++) {
Entity e = spotList.get(i);
int RadiusX = spotRadiusX.get(i);
int RadiusY = spotRadiusY.get(i);
int LeftX = e.getX() - RadiusX;
... | 5 |
public boolean onCommand(CommandSender sender, org.bukkit.command.Command command, String label, String[] args)
{
SubCommand subCommand;
if (args.length > 0)
{
subCommand = this.getCommand(args[0]);
}
else
{
subCommand = this.getCommandByName(t... | 7 |
public int GetBus()
{
return bus;
} | 0 |
public void addPhi(final Block block) {
Phi phi = phis[cfg.preOrderIndex(block)];
if (phi == null) {
if (StackPRE.DEBUG) {
System.out.println(" add phi for " + def + " at "
+ block);
}
phi = new Phi(block);
phis[cfg.preOrderIndex(block)] = phi;
}
} | 2 |
private PostParameter getParameterValue(String name,Object value){
if(value instanceof Boolean){
return new PostParameter(name, (Boolean)value?"0":"1");
}else if(value instanceof String){
return new PostParameter(name, value.toString());
}else if(value instanceof Integer){
return new PostParameter(name,I... | 6 |
public int claimProvince(String playerName, String worldName, int chunkX, int chunkZ) {
int updateSuccessful = 0;
Connection con = getSQLConnection();
PreparedStatement statement = null;
String SQL = "INSERT INTO `Monarchy_Provinces` (`id`, `player`, `world`, `x`, `z`, `parent`, `invited`, `time`) VALUES (NUL... | 2 |
public void deleteApp() throws IOException
{
Scanner in = new Scanner(System.in);
System.out.println("Which App do you want to delete? (App Number)");
int ch = in.nextInt();
File x = new File(appDir+ch+".txt");
boolean delete = x.delete();
if(delete)
System.out.println("Deleted!");
else
System.out.println("Cannot ... | 1 |
public Layer setActiveLayer(Layer l, boolean active, ArrayList<Layer> layers) {
if (active) {
for (Layer other : layers) {
other.setActive(false);
}
l.setActive(true);
return l;
} else {
layers.get(1).setActive(true);
... | 2 |
public List<Achievement> readAchievements(InputStream stream) throws IOException, JAXBException {
log.trace("Reading achievements XML");
// Need to clean invalid XML and comments before JAXB parsing
BufferedReader in = new BufferedReader(new InputStreamReader(stream, "UTF8"));
StringBuilder sb = new StringBui... | 2 |
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 static void printAllPercentileLocationHomeDistanceRestByDuration(int percentile, int duration){
try {
Connection con = dbConnect();
PreparedStatement getXY = con.prepareStatement(
"SELECT x,y FROM "+locTbl+" WHERE locationID = ?");
PreparedStatement getDistance = con.prepareStatement(
"SELEC... | 7 |
public void activeHeroChanged(Hero hero)
{
setActiveHero(hero);
System.out.println("active hero changed");
if (WorldMap.getLastInstance() != null) {
System.out.println("pre calculate route");
WorldMap.getLastInstance().calculateRoute(hero);
}
} | 1 |
private TimeSeriesCollection createTimeSeriesData() {
TimeSeriesCollection tsc = new TimeSeriesCollection();
TimeSeries vehTotal = new TimeSeries("Total Vehicles");
TimeSeries carTotal = new TimeSeries("Total Cars");
TimeSeries mcTotal = new TimeSeries("MotorCycles");
//Base time, data set up - the calen... | 9 |
public static void main(String[] args) {
w = new Worker();
} | 0 |
public static ObjectType getTypeFromDataChar(char dataChar) {
switch (dataChar) {
default:
case '0':
return AIR;
case '1':
return STONE;
case '2':
return BRICK;
case '3':
return ICE;
case '4':
return SPIKE;
case '5':
return PORTAL;
case '6':
return KEY;
case '7':
return POTIO... | 9 |
public static int[] mirror(int[] pixs, int w, int h, int n) {
int[] pix = new int[w * h];
for (int j = 0; j < h; j++) {
for (int i = 0; i < w; i++) {
if (n == 0) {
int u = w - 1 - i;
int v = j;
pix[v * w + u] = pixs[j * w + i];
} else if (n == 1) {
int u = i;
int v = h - 1 - j;
... | 4 |
public BSTNode getNameSearchByName(String name) {
try {
if (Tmproot == null) {
Tmproot = root;
}
String name1 = Tmproot.getName().toString();
if (root == null) {
return null;
} else {
if (name.contentEquals(name1)) {
return Tmproot;
} else if (Tmproot.getLeft() == null) {
Tmp... | 6 |
private UselessStatesDetector() {
} | 0 |
private PriceManager()
{
} | 0 |
public static void addEscapeToCloseSupport(final JDialog dialog,
final boolean fadeOnClose) {
LayerUI<Container> layerUI = new LayerUI<Container>() {
/**
*
*/
private static final long serialVersionUID = 2514339457426555702L;
private boolean closing = false;
@Override
public void installUI... | 7 |
@Override
public boolean shouldReact(Message message) {
return message.text.startsWith("stopwatch") && message.text.indexOf(' ') != NOT_FOUND;
} | 1 |
private static void inventoryAdder(Items item){
//push to array
//Items newItem = item;
inventoryHasAtLeastOne = true;
for (int i=0;i<inventory.length;i++){
if (inventory[i] == null){
inventory[i] = item;
item.setObtained(true);
ret... | 2 |
public static void haku(Pysakkiverkko2 verkko, String lahto, String maali, int aika) {
PriorityQueue<Tila2> pq = new PriorityQueue<>();
ArrayList<String> loydetyt = new ArrayList<>();
Tila2 maaliTila = null;
boolean loydetty = false;
Tila2 t = new Tila2(lahto, null, lahto, Math... | 7 |
public ActivityTypes getActivityType() {
return activityType;
} | 0 |
public void iniciar() throws Exception {
while (true) {
System.out.println();
System.out.println("Gestión de personas");
System.out.println("1. Agregar");
System.out.println("2. Modificar");
System.out.println("3. Eliminar");
System.out.println("4. Obtener uno");
System.out.println("5. Obtener to... | 7 |
public BufferedImage rotateBufferedImage(BufferedImage bf, int rotateDegree) {
if(rotateDegree % 360 == 0){
return bf;
}
int imageWidth = bf.getWidth();
int imageHeight = bf.getHeight();
double rotationRequired = Math.toRadians(rotateDegree);
double locationX = bf.getWidth() / 2;
double locationY = bf.... | 2 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Pessoa other = (Pessoa) obj;
if (this.idPessoa != other.idPessoa && (this.idPessoa == null || !this.idPes... | 5 |
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
evaluateRegex();
} else if (e.getKeyCode() == KeyEvent.VK_F3) {
if (!e.isShiftDown()) jumpToNextMatch();
else jumpToPrevMatch();
}
} | 3 |
final void method3924(boolean bool, boolean bool_2_, int i,
Class70 class70, boolean bool_3_) {
try {
anInt9852++;
if (bool_2_ == false) {
OpenGL.glTexEnvi(8960, i + 34176,
Class57.method531((byte) 101, class70));
if (bool)
OpenGL.glTexEnvi(8960, i + 34192, !bool_3_ ? 770 : 771);
else
... | 6 |
@Override
public boolean read(DummyObjectList dummyObjects, DummyObject [] dummyTypes,
TileMap tileMap) {
System.out.println("Opening .level file");
try
{
ResFileReader r;
r = new ResFileReader(path);
// load tilemap, post names are map, map2, map3 etc.
r.gotoPost("map", fal... | 9 |
public static void addRingInfo(MaplePacketLittleEndianWriter mplew, MapleCharacter chr) {
mplew.writeShort(0);
mplew.writeShort(chr.getCrushRings().size());
for (MapleRing ring : chr.getCrushRings()) {
mplew.writeInt(ring.getPartnerChrId());
mplew.writeAsciiString(StringU... | 7 |
public static String toEnglish1000(int i) {
String[] f20 = {" zero", " one", " two", " three", " four", " five", " six", " seven", " eight", " nine", " ten", " eleven", " twelve", " thirteen", " fourteen", " fifteen", " sixteen", " seventeen", " eighteen", " nineteen"};
String[] tens = {"ERR", "ERR", "... | 9 |
void helper(int need, int complete, List<String> res, StringBuilder tmp, int n) {
if (complete > need) {
tmp.deleteCharAt(tmp.length() - 1);
return;
}
if (need < n && complete < n) {
tmp.append('(');
helper(need + 1, complete, res, tmp, n);
tmp.append(')');
helper(need, complete + 1, res, tmp, n... | 8 |
public void keyReleased(KeyEvent e){
if(e.getKeyCode() == KeyEvent.VK_UP){
me.setMoveUp(false);
}
if(e.getKeyCode() == KeyEvent.VK_DOWN){
me.setMoveDown(false);
}
if(e.getKeyCode() == KeyEvent.VK_LEFT){
me.setMoveLeft(false);
}
if(e.getKeyCode() == KeyEvent.VK_RIGHT){
... | 5 |
public Wave05PewterGym(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 50; i++){
if(i < 25){
if(i % 2 == 0)
add(m.buildMob(MobID.DIGLETT));
else
add(m.buildMob(MobID.SANDSHREW));
}
else if(i >= 25 && i < 49){
if(i % 2 == 0)
add(m.buildMob(MobID.DIGLETT));
el... | 6 |
public int loadProject( File file)
{
int back = -1 ;
TProject dummy = null ;
try
{
dummy = this.readXmlFile( file ) ;
}
catch ( SAXException sxe )
{
// sxe.printStackTrace() ;
back = 1 ;
}
catch ( ParserConfigurationException pce )
{
// pce.printStackTrac... | 6 |
public List<Predicate> parsePredicates(String input) throws ParseException {
List<Predicate> predicates = new ArrayList<Predicate>();
int numberOfBrackets = 0;
int start = 0;
for (int end = 0; end < input.length(); ++end) {
char currentChar = input.charAt(end);
... | 5 |
public Point tryMove(int quad)
/*
* The quadrant is translated into a tile coordinate, and tested for
* validity. The translation varies depending on if the row position of the
* curent tile (yTile) is even or odd. null is returned if the new position
* is invalid.
*/
{
Point nextPt;
if (quad == NE)
... | 9 |
public int getIndexOfChild(Object parent, Object child)
{
if(!(parent instanceof ObjectNode))
throw new RuntimeException("unexpected object of " + parent.getClass() + " passed");
if(!(child instanceof ObjectNode))
throw new RuntimeException("unexpected object of " + child.getClass() + " passed");
... | 4 |
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
result = 31 * result + (identityCode != null ? identityCode.hashCode() ... | 9 |
public static void main(String[] args) {
// Declare the JDBC objects.
Connection con = null;
CallableStatement cstmt = null;
ResultSet rs = null;
try {
// Establish the connection.
SQLServerDataSource ds = new SQLServerDataSource();
ds.setIntegratedSecurity(true);
ds.setServerName("localhos... | 8 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TaxonDesignationPK)) {
return false;
}
TaxonDesignationPK other = (TaxonDesignationPK) object;
if ((this.taxonV... | 6 |
public static boolean isLessThan11(int i){
return i < 11;
} | 0 |
@Before
public void setUp()
{
_helper = new TruncateHelper();
} | 0 |
public void setComputerScores(){
computerScores++;
} | 0 |
private void formMouseEvent(java.awt.event.MouseEvent evt) {
int mouseEventId = evt.getID();
int buttonID = evt.getButton();
int xcord = evt.getX();
int ycord = evt.getComponent().getHeight() - evt.getY();
long time = evt.getWhen()/1000;
... | 7 |
public static boolean isLocation(Location loc1, Location loc2) {
if (loc1.getWorld() == loc2.getWorld() &&
loc1.getBlockX() == loc2.getBlockX() &&
loc1.getBlockY() == loc2.getBlockY() &&
loc1.getBlockZ() == loc2.getBlockZ())
return true;
else
return false;
} | 4 |
public boolean meet(Temporal temporal) {
if (null == temporal) return false;
// if (null == temporal || this == temporal) return false;
if (isTimeInstance()) {
if (temporal.isTimeInstance()) return startTime == temporal.startTime;
else return startTime == temporal.endTime || startTime == temporal.startTime;... | 7 |
@Override
public Iterator<E> iterator() {
return new Iterator<E>() {
private int index = -1;
@Override
public boolean hasNext() {
return index < SimpleHashSet.this.size() - 1;
}
@Override
public E next() {
... | 6 |
private float coFactor(int c, int r) {
Matrix3 minor = new Matrix3();
int i = 0;
for(int ri = 0;ri < SIZE;ri++) {
if(ri == c) continue;
for(int ci = 0;ci < SIZE;ci++) {
if(ci == r) continue;
minor.m[i++] = m[ri * 4 + ci];
}
}
if((r + c) % 2 == 0) return minor.determinant();
else return -min... | 5 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof AccessRequestType)) {
return false;
}
AccessRequestType other = (AccessRequestType) object;
if ((this.id == nul... | 5 |
private void displayLists(CommandSender sender, List<Lists> lists) {
for (Lists list : lists) {
if (list == null) {
continue;
}
int id = list.getReportId();
ReportType type = ReportType.getType(list.getType());
switch (type) {
... | 8 |
public synchronized final void close() {
if (!open) {
return; // it is not an error to attempt to close a closed Query
}
if (Prolog.thread_self() == -1) {
throw new JPLException("no engine is attached to this thread");
}
if (Prolog.current_engine().value != engine.value) {
throw new JPLException("thi... | 6 |
void genRandArray(int[] array, int size) {
if (size > array.length)
throw new IllegalArgumentException("Given size " + size
+ " exceeds array length " + array.length);
if (size < N32)
throw new IllegalArgumentException("Size must be at least " + N32
+ ", but is " + size);
if (size % 4 != 0)
thr... | 8 |
public static Stella_Object accessSubstringPositionIteratorSlotValue(SubstringPositionIterator self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Logic.SYM_LOGIC_SUPER_STRING) {
if (setvalueP) {
self.superString = ((StringWrapper)(value)).wrapperValue;
}
else ... | 8 |
private HelperGroup better(HelperGroup a, HelperGroup b, int R) {
if (a.totalCapacity >= R && b.totalCapacity < R)
return a;
if (a.totalCapacity < R && b.totalCapacity >= R)
return b;
if (a.totalCapacity < R && b.totalCapacity < R)
return max(a, b);
return min(a, b);
} | 6 |
public boolean userCanSeePatient(String uid, String uunit, Patient patient) {
int type = findType(uid);
if (type == TYPE_GOV) {
return true;
} else if (type == TYPE_DOCTOR || type == TYPE_NURSE) {
ArrayList<JournalEntry> entries = patient.getJournal().getEntries();
for (JournalEntry entry : entries) {
... | 8 |
public static void main(String[] args)
{
ConfigFile f = new ConfigFile("config.txt");
f.ReadFile();
} | 0 |
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 |
private static Interface getHID (Device dev)
throws IOException
{
Configuration config;
Interface retval = null;
DeviceDescriptor info = dev.getDeviceDescriptor ();
if (info.getDeviceClass () != 0)
throw new IllegalArgumentException ("dev class");
config = dev.getConfiguration ();
for (int i = c... | 5 |
private void touchRotate(final double X, final double Y, final Rotate ROTATE) {
double theta = getTheta(X, Y);
interactiveAngle = (theta + 90) % 360;
double newValue = Double.compare(interactiveAngle, 180) <= 0 ?
(interactiveAngle + 180.0 + getSkinnable().getStartAngle() - 360) ... | 3 |
@Override
public String toString(){
return "id= "+this.getId()+", "+this.getName()+"\n"+getTime()+"\n"+"Диаметр: "+this.getHig()+"\n"+"Длин окружности: "+this.getLengh()+"\n"+"Координаты центра: ("+this.getX() +" , "+this.getY()+")"+"\n"+"S=: "+this.getArea()+" V=: "+this.getVolume()+"\n";
} | 0 |
void lookForHbonds(NucleicPolymer other, BitSet bsA, BitSet bsB) {
// Logger.debug("NucleicPolymer.lookForHbonds()");
for (int i = monomerCount; --i >= 0;) {
NucleicMonomer myNucleotide = (NucleicMonomer) monomers[i];
if (!myNucleotide.isPurine())
continue;
Atom myN1 = myNucleotide.getN1();
Atom bes... | 8 |
public void setUtilityVisible(JButton button) {
String caseString = button.getActionCommand();
switch(caseString) {
case "diceRollerLaunch":
setPanelVisible("dicePanel");
break;
case "calculatorLaunch":
setPanelVisible("calculatorPanel");
break;
case "audioPlayerLaun... | 4 |
@Override
public boolean execute(RuleExecutorParam param) {
Rule rule = param.getRule();
List<String> values = Util.getValue(param, rule);
if (values == null || values.isEmpty()) {
return false;
}
boolean retValue = true;
for (String value : values) {
String compareValue = rule.getValue();
if (rul... | 6 |
public void updateImage()
{
//we will update animation when delay counter reaches delay, then reset delay counter
delayCounter++;
if(delayCounter>delay)
{
delayCounter=0;
frameNumber++;//updates frame to next frame
frameNumber%=totalFrame;// if surpass 3rd frame, back to frameNumber 0
//sets image to s... | 1 |
protected void initialize() {
_setDistance(Robot.vision.getCurrDistance());
super.initialize();
} | 0 |
public void setDumping(boolean b) {
dumping = b;
} | 0 |
private void prepare(){
this.year = Integer.parseInt(split[0]);
this.title = split[1];
this.rating = Float.parseFloat(split[2]);
if(split.length > 3){
if(!split[3].equals("")){
this.genre = split[3].split("\\|");
for (int i = 0; i... | 7 |
public void init(int nplayers, int[] pref) {
this.nplayer=nplayers;
this.pref=pref;
this.position=this.getIndex();// position start from 0
this.record = new int[2*nplayer];
if(nplayers-position<=9)
magic=magic_table[nplayers];
else
magic=(int) Math.round(0.369*(npla... | 1 |
private SaveState computeSaveState(Issue edited, Issue issue) {
try {
// These fields are not editable - so if they differ they are invalid
// and we cannot save.
if (!equal(edited.getId(), issue.getId())) {
return SaveState.INVALID;
}
... | 6 |
@Override
public int getdir(String path, FuseDirFiller dirFiller) throws FuseException {
Iterable<EntityInfo> iterator;
try {
iterator = fileSystem.listDirectory(path);
if (iterator == null)
System.err.println("Your file system returned null for readDirectory(" + path + ")");
} catch (PathNotFoundExcep... | 9 |
public static double getAngle(Vector2D vector) {
double x = vector.x;
double y = vector.y;
if (x > 0) {
return Math.atan(y / x);
}
else if (x < 0) {
return Math.atan(y / x) + Math.PI;
} else if (y > 0) {
return -Math.PI / 2;
} e... | 3 |
@Override public void keyPressed(KeyEvent nappain)
{
switch(nappain.getKeyCode())
{
case KeyEvent.VK_LEFT:
ohjaus.annaKomento(Komento.SIIRTO_VASEMMALLE);
break;
case KeyEvent.VK_RIGHT:
ohjaus.annaKomento(Komento... | 6 |
public static void handleEvent(int eventId)
{
// Changes focus to Main Ship Shop Menu
if(eventId == 1)
{
System.out.println("Exit Ship Shop Hulls menu to Main Ship Shop Menu selected");
Main.ShipShopHullsMenu.setVisible(false);
Main.ShipShopHullsMenu.setEnabled(false);
Main.ShipShopHullsMenu.setFocus... | 8 |
public ModelProxy<?> getModelProxy() {
return modelProxy;
} | 1 |
public Reference getRef(int i) throws ClassFormatException {
if (i == 0)
return null;
if (tags[i] != FIELDREF && tags[i] != METHODREF
&& tags[i] != INTERFACEMETHODREF)
throw new ClassFormatException("Tag mismatch");
if (constants[i] == null) {
int classIndex = indices1[i];
int nameTypeIndex = indi... | 8 |
@Override
public void run() {
while (!ctx.isShutdown()) {
if (ctx.isPaused()) {
paused = true;
ctx.sleep(1000);
} else {
paused = false;
int delay;
try {
delay = loop();
} catch (Throwable throwable) {
throwable.printStackTrace();
delay = -1;
}
if (delay >= 0) {... | 5 |
private static void doUpdateTest()
{
try
{
System.out.print("Testing update command ");
// make mvd & load it
String testData = TEST_DATA+File.separator+BLESSED_DAMOZEL;
File testDataFolder = new File( testData );
String mvdName = createTestMVD( testDataFolder );
File mvdFile = new File( mvdName ... | 4 |
public PongView(PongModel model) {
//initialize the View members:
this.model = model;
WIDTH_PXL = 600;
HEIGHT_PXL = WIDTH_PXL*((int)model.getFieldSize().getHeight())/((int)model.getFieldSize().getWidth());
this.ball = new Ball();
this.bars = Collections.unmodifiableMap... | 4 |
public static void main(String[] args)
{
ListGenericFoo<LinkedList> foo1 = new ListGenericFoo<LinkedList>();
ListGenericFoo<ArrayList> foo2 = new ListGenericFoo<ArrayList>();
LinkedList[] linkedList = new LinkedList[10];
foo1.setFooArray(linkedList);
ArrayList[] arrayList = new ArrayList[10];
f... | 0 |
public Connection getConnection() {
Context context = null;
try {
context = new InitialContext();
DataSource dataSource = (DataSource) context.lookup(JNDI_NAME);
return dataSource.getConnection();
} catch (NamingException ex) {
throw new DAOException(JNDI_NAME + " niet ge... | 4 |
@Override
public Double getScalarValue(Word word) {
for (Word word1:wordList) {
if (word1.getKeyWord().equals(word.getKeyWord())){
if(word1.getSpamLabel().equals(word.getSubkey())){
return word1.getSpamCount();
}else if(word1.getGenuineLabel()... | 4 |
public void printVector(PrintableStringWriter stream) {
{ FloatVector self = this;
if (self.arraySize == 0) {
stream.print("|i|[]");
}
else {
{ int i = 0;
int limit = 9;
stream.print("|i|[");
{ double element = Stella.NULL_FLOAT;
FloatVec... | 6 |
public static void mouseMoved(MouseEvent mouseEvent) {
Iterator<PComponent> it = components.iterator();
while(it.hasNext()) {
PComponent comp = it.next();
if(comp == null)
continue;
if (shouldHandleMouse) {
if (comp.shouldHandleMouse())... | 8 |
public Object leerObjeto (String path, String nom) /*throws FileNotFoundException, IOException*/ {
Object ob = null;
File f = new File("./Data/Barrios/" + path + nom + ".o");
try{//FileWriter fw = new FileWriter(f);
FileInputStream fis = new FileInputStream(f);
ObjectInpu... | 1 |
@Test(expected=BadPostfixException.class)
public void evaluatePostfix2() throws DAIndexOutOfBoundsException, DAIllegalArgumentException, NumberFormatException, NotEnoughOperandsException, BadPostfixException
{
try
{
postfix.addLast("5");
String result = calc.evaluatePostfix(postfix);
}
catch (... | 5 |
@Override
public void repaint(TextGraphics graphics)
{
graphics.applyTheme(graphics.getTheme().getDefinition(style));
graphics = transformAccordingToAlignment(graphics, calculatePreferredSize());
if(textColor != null)
graphics.setForegroundColor(textColor);
i... | 7 |
public void addOpenHouses() {
nextCheckForhouses = System.currentTimeMillis() + 600000; // 10 minutes
final String json = IOUtil.readString(URL_GET_HOUSES, ctx.useragent);
try {
JsonObject jsonObject = JsonObject.readFrom(json);
final JsonValue open_houses = jsonObject.get("open_houses");
if (open_house... | 7 |
public static boolean isNumber(String num) throws LexicalException
{
Long lowerBound = -4294967296L;
Long upperBound = 4294967295L;
try {
Long.valueOf(num).longValue();
} catch (NumberFormatException nfe) {
return false;
}
Long temp = Long.valu... | 3 |
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.