text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean isReleased() {
if(isDisabled())
return false;
return released;
} | 1 |
public static ArrayList<Question> getQuestionsByQuizID(int quizID) {
ArrayList<Question> questionList = new ArrayList<Question>();
try {
String statement = new String("SELECT * FROM " + DBTable + " WHERE quizid = ?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, qui... | 2 |
@Override
public boolean equals(Object other)
{
if (other == null)
return false;
else if (other instanceof WeightedPoint)
{
WeightedPoint otherWp = (WeightedPoint)other;
return (otherWp.row == row && otherWp.col == col);
}
return false;... | 3 |
private void initializeNodes(int numInputs, int numOutputClasses){
//check to see if the hiddenlayers and hiddennodes have been initialized, and if not,
//initialize them to default values
nodesList = new ArrayList<List<PerceptronNode>>();
if(numHiddenLayers == -1){
numHiddenLayers = 2;
}
if(numHiddenNo... | 8 |
public void escalonar() {
try {
listaProcesso = arquivo.lerArquivo();
} catch (IOException ex) {
Logger.getLogger(RoundRobin.class.getName()).log(Level.SEVERE, null, ex);
}
while (!fim) {
for (int i = 0; i < listaProcesso.size(); i++) {
... | 8 |
public final File copy(final Directory destDirectory, final String newFileName) throws FileNotOnDiskException, DiskReadException {
checkExists();
String destFileName = "";
if (destDirectory != null) destFileName += destDirectory.toString();
else destFileName += this.getParent();
if (newFileName != null) de... | 8 |
private void init() throws IOException {
if (null == in) {
throw new IOException("No InputStream");
}
if (in.available() == 0) {
throw new IOException("Empty InputStream");
}
//checkMagicChar('B', "first");
//checkMagicChar('Z', "second");
... | 4 |
@Override
public Result value(Function<Double, Double> function) {
Result result = null;
try
{
AcceleratorSingleStep<Double> richardson = new RichardsonExtrapolationReal(4.0);
HashMap<Integer, Double> values = new HashMap<Integer, Double>();
double lowerBo... | 6 |
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_W) {
keyUp = false;
} else if (e.getKeyCode() == KeyEvent.VK_A) {
keyLeft = false;
// } else if (e.getKeyCode() == KeyEvent.VK_S) {
// keyDown = false;
} else if (e.getKeyCode() == KeyEvent.VK_D) {
keyRight = false;
}
} | 3 |
public void testSetIntoIntervalEx_Object_Chronology5() throws Exception {
MutableInterval m = new MutableInterval(-1000L, 1000L);
try {
StringConverter.INSTANCE.setInto(m, "P1Y/P2Y", null);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
public void renderPlayer(EntityPlayer par1EntityPlayer, double par2, double par4, double par6, float par8, float par9)
{
ItemStack var10 = par1EntityPlayer.inventory.getCurrentItem();
this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = var10 ... | 7 |
@Test
public void testGetAllLocations() throws IOException {
List<Location> remoteLocations = dexmaRestFacade.getAllLocations();
assertEquals(3,remoteLocations.size());
Iterator<Location> itRemote = remoteLocations.iterator();
while (itRemote.hasNext()) {
Location loc = itRemote.next();... | 3 |
@Override
public boolean deconnect(SlotInterface s) {
OVLine l = getLine((OVNode) s);
if (l != null) {
lines_.remove(l);
}
if (isPolyvalent() && connections_.size() == 0) {
setType(ValueType.VOID);
}
boolean flag = super.deconnect(s);
... | 4 |
private String scanFlowScalarSpaces () {
StringBuilder chunks = new StringBuilder();
int length = 0;
while (BLANK_T.indexOf(peek(length)) != -1)
length++;
String whitespaces = prefixForward(length);
// forward(length);
char ch = peek();
if (ch == '\0')
throw new TokenizerException("While scanning a ... | 5 |
@Test
public void testExist() {
List<String> list = new List<>();
list.addToEnd("test1");
list.addToEnd("test2");
list.addToEnd("test3");
for (String current : list) {
assertTrue(list.exist(current));
}
} | 1 |
private boolean enabledModsDependencyCheck(boolean ignore) {
String checkStr="";
boolean canLaunch=true;
for(int i=selProfile.mods.size()-1; i>=0; i--) {
String p = selProfile.mods.get(i);
//String str = checkDependency(p);
String str = checkDependency(util.getModDependency(p).replace("[","").replace("]"... | 7 |
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
e1.printStackTr... | 4 |
public void resetText(){
this.text = new StringBuilder("");
} | 0 |
private void load(InputStream is) throws IOException {
Map<String, Set<Lemma>> lemmas = new HashMap<>();
Set<String> allPrefixes = new HashSet<>();
Set<String> allEndings = new HashSet<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(is, UTF_8));
int sectionLength = parseInt(reader.read... | 9 |
@EventHandler
public void onPlayerMoveEvent(PlayerMoveEvent e) {
Player p = e.getPlayer();
Location l = p.getLocation();
int lightlevel = p.getLocation().getBlock().getLightLevel();
if (lightlevel < 5) {
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Integ... | 1 |
public void rotateRight() {
switch (position.getDirection()) {
case N:
position.setDirection(Direction.E);
break;
case E:
position.setDirection(Direction.S);
break;
case W:
position.setDirection(Direction.N);
break;
case S:
position.setDirection(Direction.W);
break;
}
} | 4 |
@Override
public boolean isGameOver() {
boolean gameOver = true;
for (WarMachine w : warMachine) {
if (!w.isVersenkt())
gameOver = false;
}
if (gameOver) {
Regeln.setGameOver();
return true;
} else
return false;
} | 3 |
@Override
public List<AdminCol> getColUpdList(String tblNm) {
log.debug("get column update list for table = " + tblNm);
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
ArrayList<AdminCol> list = new ArrayList<AdminCol>();
StringBuilder sql = new StringBuilder();
sql.ap... | 8 |
private void threshold_parameter_set() {
// choose different parameter setting
// according to different bowlSize and number of players
decreaseSpeed = decreaseSpeed;
minimalShift = minimalShift;
if(bowlSize < 20 ) {
decreaseSpeed = 0.5;
minimalSh... | 6 |
private void calcPrimitives(Camera camera) {
for (MassAttractObject3D obj : world.getSystem()) {
primitives.get(getNameTypeObj(obj.getName())).calcCoordinates(this, camera, obj);
if(obj.equals(world.getSelectObject()))
primitives.get("Select").calcCoordinates(this, camera... | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Connection other = (Connection) obj;
if (leftIcon == null) {
if (other.leftIcon != null)
return false;
} else if (!leftIcon.equals... | 9 |
public static String numberToString(Number number) throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
if (string... | 6 |
public void addModel(AbstractModel model) {
registeredModels.add(model);
model.addPropertyChangeListener(this);
} | 0 |
private void loadConfig(){
reloadConfig();
getConfig().options().copyDefaults(true);
this.verbose = getConfig().getBoolean("verbose",false);
verbose("Verbose mode! Spammy as hell!");
this.checkUpdates = getConfig().getBoolean("checkUpdates",true);
if (checkUpdates){
... | 6 |
public void actionPerformed(ActionEvent ae) {
//
// Process the action command
//
// "create report" - Create the report
// "done" - Done
//
try {
switch (ae.getActionCommand()) {
case "create report":
Date startDat... | 7 |
public double[] rowSums(){
double[] sums = new double[this.numberOfRows];
for(int i=0; i<this.numberOfRows; i++){
sums[i] = 0.0;
for(int j=0; j<this.numberOfColumns; j++){
sums[i] += this.matrix[i][j];
}
}
... | 2 |
public static GenderRatio getRatio(int i) {
switch (i) {
case 8:
return GenderRatio.ALWAYS_FEMALE;
case 0:
return GenderRatio.NEVER_FEMALE;
case 1:
return GenderRatio.FEMALE_18;
case 4:
return GenderRatio.HALF_FEMALE;
case 6:
return GenderRatio.FEMALE_34;
case 2:
return GenderRatio.FEMAL... | 7 |
public static boolean loadlinkDB()
{
ResultSet res;
String lineText, URL;
int cnt = 0;
db.Query("CREATE TABLE IF NOT EXISTS `database` (signurl varchar(20), url varchar(164))");
res = db.QueryRes("SELECT * FROM `database`");
try
{
while(res.next())
{
lineText = res.getString("signurl");
... | 2 |
public void write(byte b) throws IOException {
if (!(b == 0 || b == 1))
throw new IllegalArgumentException("Argument must be 0 or 1");
currentByte = (byte)(currentByte << 1 | b); // shift will implicitly convert byte to int!!!
numBitsInCurrentByte++;
if (numBitsInCurrentByte == 8) {
output.write(currentB... | 3 |
public void saveConfig()
{
if (config == null || configFile == null)
return;
try
{
config.save(configFile);
} catch (IOException ex)
{
plugin.getLogger().log(Level.SEVERE, "Could not save data to " + configFile, ex);
}
} | 3 |
public String print() {
StringBuffer buffer = new StringBuffer();
for (Food food : foods) {
FoodType foodType = food.getFoodType();
if (food.isDiscount()) {
buffer.append("[X]");
}
buffer.append("\t");
buffer.append(String.va... | 7 |
@Override
public Color intensity(Intersection i) throws Exception {
Color diffuse = i.getMaterial().getDiffuse();
double specular = i.getMaterial().getSpecularExponent();
if (diffuse.isBlack() && specular <= 0) {
return Color.BLACK;
}
Vector a = location.sub(i.getIntersection());
Vector n = i.getNormal(... | 5 |
private int parseListItem(int start) {
while (start<wikiLength && wikiChars[start]<=' ' && wikiChars[start]!='\n') start++; // skip spaces
int end=parseItem(start, null, ContextType.LIST_ITEM);
if ((listLevels[listLevel]=='>' || listLevels[listLevel]==':') && wikiText.substring(start, end).trim().length()==... | 7 |
public boolean scrollToCard(String ID) {
for (Component c : table.getComponents()) {
if ((c.getClass().equals(TCard.class) || c.getClass().equals(Token.class))) {
final TCard card = (TCard) c;
if (card.getID().equals(ID)) {
SwingUtilities.invokeLat... | 4 |
public boolean removeCensoredWord(String word) {
if (censorWords == null) censorWords = Lists.newArrayList();
if (!censorWords.contains(word.toLowerCase())) return false;
censorWords.remove(word.toLowerCase());
return true;
} | 2 |
public void decreaseKey(Node x, double k)
{
if (k > x.key)
{
throw new IllegalArgumentException(
"decreaseKey() got larger key value");
}
x.key = k;
Node y = x.parent;
if ((y != null) && (x.key < y.key))
{
cut(x, y);
cascadingCut(y);
}
if (min == null || x.key < min.key)
{
min =... | 5 |
public void addToConnectionDeque(ChannelHandlerContext ctx, String url) {
//getting an instance of ChannelTrafficShapingHandler for bandwidth monitoring
ChannelTrafficShapingHandler ch = (ChannelTrafficShapingHandler) ctx.channel().pipeline().get("shaping-handler");
ch.trafficCounter().stop(); ... | 1 |
private SitesInitializer() {
Map<String, Transaction> readLockTable = new HashMap<String, Transaction>();
Map<String, Set<Transaction>> writeLockTable
= new HashMap<String, Set<Transaction>>();
variableSitesMap = new HashMap<String,Set<Site>>();
lockManager = new LockManager(readLockTable, ... | 7 |
@Override
public QueueSysResult result(int m){
QueueSysResult result = cachedResults.get(m);
if (result == null) {
result = calculate(m);
}
return result;
} | 1 |
public static Cons extractOptions(Cons tree, KeyValueList optionstable) {
{ Cons options = null;
Cons tail = null;
while ((!(tree.rest == Stella.NIL)) &&
(!Stella_Object.keywordP(tree.rest.value))) {
tree = tree.rest;
}
if ((tree.rest == Stella.NIL) ||
(tree.rest... | 8 |
private List<StatView> produceListOfViews(Stat[] stats) {
for (Stat stat: stats) {
if (stat != null) {
list.add(new StatView(stat));
}
}
Collections.sort(list);
return list;
} | 2 |
public Avoperties(String fileName) {
String propFileName = fileName;
try(InputStream inputStream = new FileInputStream(propFileName)) {
load(inputStream);
} catch(IOException e) {
System.err.println("Property file '" + propFileName + "' not found in the classpath");
e.printStackTrace();
}
} | 1 |
protected boolean hasGotCollision(Position myFreeposition, List<Position> piecesPositions) {
int x = myFreeposition.getX();
int y = myFreeposition.getY();
Position tmp = new Position(x - 1, y - 1);
if (piecesPositions.contains(tmp)) {
return true;
}
t... | 9 |
@Override
public List<City> findCities(Criteria criteria) throws DaoException {
if (criteria.getParam(DAO_CITY_STATUS) == null) {
criteria.addParam(DAO_CITY_STATUS, ACTIVE);
}
TypedQuery query = TypedQueryFactory.getInctance(QueryType.CITYQUERY);
return query.load(criteri... | 1 |
private ArrayList<String> fillAggDetails(Aggregation a, Model model){
final String cont = a.getContainer().getIdentifier();
final String classe = a.getClass().getName() ;
final String multCont = a.getContainer().getMultiplicity();
final ArrayList<Role> part = a.getParts();
final String multPart = a.getParts()... | 1 |
private static void decentNumber(int n) {
StringBuffer numbers = new StringBuffer();
int fiveCount = 0;
int threeCount = 0;
for (int i = 0; i < n; i++) {
numbers.append(FIVE);
fiveCount++;
}
if (fiveCount % 3 == 0) {
System.out.println(numbers);
} else {
int length = numbers.length();
... | 5 |
public RemoteCallObjectData(Object data) {
this.data = data;
} | 0 |
@Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length == 0) {
ChatPlayer cp = plugin.getChatPlayer(sender.getName());
ChatChannel cc = plugin.getChannel(cp... | 7 |
public JTextField getTxtCp() {
return txtCp;
} | 0 |
static final Opcode lookup(byte opcode) {
for (Opcode one : values()) {
if (opcode == one.mOpcode) {
return one;
}
}
return UNDEFINED;
} | 2 |
private String getMime(String extension) {
String mime = "";
switch (extension) {
case ".pdf":
mime = "application/pdf";
break;
case ".png":
mime = "image/png";
case ".css":
mime = "text/css";
break;
case ".js":
mime... | 6 |
private boolean smartMove(RobotController rc, Boolean takeTwo) throws GameActionException {
Direction dir;
if(takeTwo) {
dir = Direction.values()[(int)(rndGen.nextFloat() * 8)];
} else {
if(this.destination==null){
this.destination = this.enemyHQ;
... | 9 |
public boolean changeNickname(String device, String newNickname,
PersistentDeviceModel model) {
boolean isChanged = false;
for (Device dev : model.getDevices()) {
if (dev.getName().equals(newNickname)
&& !dev.getSerialNumber().equals(device)) {
return false;
}
}
if (devices.containsKey(devic... | 4 |
public static void deserialize() {
SerialBox e = null;
try (FileInputStream fileIn = new FileInputStream("tmp/employee.ser");
ObjectInputStream in = new ObjectInputStream(fileIn)) {
e = (SerialBox) in.readObject();
in.close();
fileIn.close();
}catch(IOException i)
{
i.printStackTrace();
retur... | 3 |
public synchronized List<DataNodeEntry> select(int replicaFactor) {
Collection<DataNodeAbstract> dataNodeCollcetion = this.dataNodeTbl.values();
DataNodeAbstract[] dataNodeArray = dataNodeCollcetion.toArray(new DataNodeAbstract[0]);
Arrays.sort(dataNodeArray);
List<DataNodeEntry> entries = new ArrayList<D... | 6 |
@Override
public Tipo validarSemantica() throws Exception {
Tipo izq,der;
izq=izquierdo.validarSemantica();
der=derecho.validarSemantica();
if (izq instanceof TipoInt || der instanceof TipoFloat){
if (der instanceof TipoInt || der instanceof TipoFloat ){
r... | 4 |
public void testOne() {
TermVectorizer tv = new TermVectorizer();
for(String[] sentence: DOC_TERMS) {
int dim = tv.startColumn();
for(String word: sentence) {
tv.vectorizeTerm(word, dim);
}
}
tv.truncateVectors();
Matrix vectorMat = tv.getMatrix();
assertEquals("Ve... | 4 |
protected void doFunction(float[] inputs, int inputOffset,
float[] outputs, int outputOffset)
{
// calculate the encoded values for each input
float[] encoded = new float[getNumInputs()];
for (int i = 0; i < getNumInputs(); i++) {
// encode -... | 4 |
private void paintDownBorder(Graphics g, int x, int y, int width, int height, Color color) {
g.setColor(color);
// Left Line
if (!afterHighlighted || tabSpacing)
g.drawLine(x, y, x, y + height - 1);
// Right line
if (highlighted || last || tabSpacing)
g.drawLine(x + width... | 7 |
public void enemyDestroyedListener(GameActor actor) {
StatusComponent sc = (StatusComponent)actor.getComponent("StatusComponent");
InventoryComponent ic = (InventoryComponent)actor.getComponent("InventoryComponent");
if(ic != null) {
inventory.addMoney(ic.getMoney());
}
... | 2 |
public static void main(String[] args) {
playGame(new CheckersFactory());
playGame(new ChessFactory());
} | 0 |
public void actionPerformed(ActionEvent e)
{
String action = e.getActionCommand();
if (action.equals( Constantes.OK )) {
ok();
} else if (action.equals(Constantes.CANCEL)) {
close();
} else if (action.equals(Constantes.RIGHT)) {
... | 9 |
public Color setTopAlternativeColor(String userName, String entryName, String attrName){
Color aColor = Color.GRAY;
for(IndividualAttributeMaps a : chart.listOfAttributeMaps){
for(IndividualEntryMap e : chart.listOfEntryMaps.values()){
if(userName.equals(a.userName) && userName.equals(e.username)... | 6 |
public String printTable()
{
StringBuilder sb = new StringBuilder();
sb.append("Function name : ");
sb.append(Name);
sb.append("\r\n");
sb.append("count Type name array role\r\n");
int len = Symbols.size();
for(int i=0;i<len;i++){
SymbolEntry sym = Symbols.get(i);
if(sym.... | 3 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Address other = (Address) obj;
if (!Objects.equals(this.city, other.city)) {
return false;
... | 7 |
public void draw(Graphics g) {
img.draw(g, ProjectMedusa.SCREEN_WIDTH/2, 0, ProjectMedusa.SCREEN_WIDTH/2, ProjectMedusa.SCREEN_HEIGHT, 0, 0);
for (int h = 0; h < height; h++) {
for (int w = 0; w < width; w++) {
if (inventory[h][w] != null) {
inventory[h][w].draw(g, w, h, area, area);
}
}
}
... | 3 |
private void findIndexFile()
{
//loop files
for (String index : this.server.getConfiguration().getIndexFiles())
{
//create index file
File indexFile = new File(this.resource, index);
if (indexFile.exists())
{
//use index file
this.resource = indexFile;
break;
}
}
} | 2 |
protected void alterneigh(int rad, int i, int b, int g, int r) {
int j, k, lo, hi, a, m;
int[] p;
lo = i - rad;
if (lo < -1)
lo = -1;
hi = i + rad;
if (hi > netsize)
hi = netsize;
j = i + 1;
... | 8 |
private String getRowString(int y) {
String s = "";
for (int x = 0; x < max_x; x++) {
switch (board[x][y]) {
case 0:
s += " ";
break;
case 1:
s += "O";
break;
case 2:
s += "X";
}
if (x != max_x - 1) {
s += " | ";
}
}
... | 7 |
@Override
public BMPImage apply(BMPImage image) {
Filter grey = new Grey();
image = grey.apply(image);
BMPImage filteredImage = new BMPImage(image);
BMPImage.BMPColor[][] bitmap = image.getBitMap();
BMPImage.BMPColor[][] filteredBitmap = filteredImage.getBitMap();
for... | 4 |
public void draw(Graphics2D g)
{
int half_block = (int) (block_size*0.5);
for(int j = 0; j < grid[0].length; ++j)
{
for(int i = 0; i < grid.length; ++i)
{
if(grid[i][j].size() > 0)
{
Observation firstObs = grid[i][j]... | 3 |
public File createFormattedFile(String filename) throws IOException {
File outfile = new File("outfile");
BufferedWriter writer = new BufferedWriter(new FileWriter(outfile));
String word = new String();
BufferedReader reader = new BufferedReader(new FileReader(new File(filename)));
String line = reader.readLi... | 3 |
File addConditions(File file, File conditions) {
// adds a conditions column to the Hb and HbO files
// the conditions file contains lines of the form:
// start stop condition
// where start to stop is a range of rows in the Hb/HbO file where condition was in effect
// on each line, start and stop must ... | 6 |
public void layoutNorth()
{
// create north, set properties
north = new JPanel();
north.setLayout(new GridLayout(1, 2));
north.setBorder(new TitledBorder(new EtchedBorder(), "Choose match week"));
north.setBackground(Color.LIGHT_GRAY);
// create label for combo box, add to north
JLabel weekNumberComboBo... | 1 |
public int getSearchArticleCount(String search,String val, int area) throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
Statement stmt = null;
ResultSet rs = null;
int x = 0;
try{
conn = getConnection();
String sql = "select count(*) from board where "+search+" like '%"+val+"%' ... | 8 |
public void setSpecified(byte[] value) {
this.specified = value;
} | 0 |
public long timestamp() {
if (version() != 1) {
throw new UnsupportedOperationException("Not a time-based UUID");
}
long result = timestamp;
if (result < 0) {
result = (mostSigBits & 0x0000000000000FFFL) << 48;
result |= ((mostSigBits >> 16) & 0xFFFFL) << 32;
result |= mostSigBit... | 2 |
public void connect(TreeLinkNode root) {
while(root != null){
TreeLinkNode mostLeft = null;
TreeLinkNode prevNode = null;
for(; root != null; root = root.next){
if(mostLeft == null){
if(root.left != null)
mostLeft = root.left;
else
mostLeft = root.right;
}
if(root.left ... | 8 |
public void resetNumLocals() {
if (localsTypes != null) {
int nl = localsTypes.length;
while (nl > 0 && localsTypes[nl - 1] == TypeTag.TOP) {
if (nl > 1) {
TypeData td = localsTypes[nl - 2];
if (td == TypeTag.LONG || td == TypeTag.D... | 6 |
public void paint(Circle[] points, Graphics g) {
for (int i = 0; i < this.Colors.size(); i++) {
if (points[i] != null) {
points[i].setColor(g, color[this.Colors.get(i)]);
}
}
g.setColor(Color.black);
} | 2 |
public void remove(ProfesorBean oProfesorBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
oMysql.removeOne(oProfesorBean.getId(), "profesor");
oMysql.desconexion();
} catch (Exception e) {
throw new Exception("ProfesorDao.removeProfesor: E... | 1 |
private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged
int value = jList1.getSelectedIndex();
int i = 0, bookcode = 0;
try {
String query = "SELECT bookcode FROM books order by bookcode;";
ResultSet rs = MyQueries.... | 6 |
@Override
public void run() {
//LOG.log(Level.INFO, "New Thread spawned for client at port: {0}", clientPort);
try {
reader = new BufferedReader(new InputStreamReader(client.getInputStream()));
String request = "";
while (!client.isClosed... | 4 |
public static void main(String[] args){
parser = new OptionParser(args);
if (parser.containsOption("--noUIManager")) systemLook = false;
if (systemLook){
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
... | 5 |
public void addPurchase(Purchase purchase){
if(purchase != null){
if(purchase.id != null){
addTank(purchase.id, purchase.id_tank, purchase.id_armor, purchase.id_engine, purchase.id_first_weapon, purchase.id_second_weapon);
addArmor(purchase.id_armor);
... | 6 |
protected void registerSpringSecurityFilters(Environment environment){
// try to get spring's internal FilterChainProxy
Object proxyObject = this.applicationContext.getBean(DEFAULT_FILTER_BEAN_NAME);
if (null == proxyObject) {
logger.info("No FilterChainProxy found in the spring co... | 1 |
public void addFront(Object o) {
synchronized(_queue) {
_queue.insertElementAt(o, 0);
_queue.notify();
}
} | 0 |
private JPanel[] getNumPanel() {
JPanel[] ps = new JPanel[oNum];
for (int k = 0; k < ps.length; k++) {
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.RIGHT));
panel.add(new JLabel((k + 1) + "-th num: "));
for (int i = numFlds[k].length - 1; i >= 0; i--) {
panel.add(numFlds[k]... | 3 |
public void renderPlayer(double xPos, double yPos, float falseFall, Sprite sprite, boolean flip) {
xPos -= cameraXCoord;
yPos -= cameraYCoord;
yPos += falseFall;
for(int y = 0; y < sprite.getSizeY(); y++) {
double yAbs = y + yPos;
for(int x = 0; x < sprite.getSizeX(); x++) {
double xAbs = x + xPos;
... | 9 |
public static void copy(File src, File dest) throws IOException {
if (src.isDirectory()) {
// if directory not exists, create it
if (!dest.exists()) {
dest.mkdir();
System.out.println("Directory copied from " + src + " to "
+ dest);
}
// list all the directory contents
String files[] ... | 4 |
@Test
public void testEqualsAndHashCode()
{
final BinarySelectionTree tree = new BinarySelectionTree();
final List<TreeNode> nodes = new ArrayList<TreeNode>();
for (int i = 0; i < 100; ++i)
{
final Weightable element = new WeightDummy((i % 10) / 2.5);
nodes.add(tree.insert(element));
}
for (int i =... | 5 |
static public void loadComponent(Element e, OVContainer father) {
OVComponent c = parseElement(e, father);
if (c != null) {
father.addComponent(c);
if ((c instanceof OVNodeComponent || c instanceof OVProceduralBlock)
&& father.getMode() == EditorMode.GUI) {
c.setVisible(false);
}
}
} | 4 |
public double getBias() {
if(dendrites.containsKey(this))
return this._bias*dendrites.get(this);
else
return 0;
} | 1 |
* @Post: None
* @Return: An ArrayList of all points which lie between point and point2
*/
static ArrayList<Point> getPointsBetween(Point point, Point point2) {
// TODO Auto-generated method stub
ArrayList<Point> answer= new ArrayList<Point>();
Point difference = Game.getDistance(point, point2);
if(differen... | 8 |
public static Class<?>[] toClassArray(Collection<Class<?>> collection) {
if (collection == null) {
return null;
}
return collection.toArray(new Class<?>[collection.size()]);
} | 4 |
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.