text stringlengths 14 410k | label int32 0 9 |
|---|---|
private Matrix normal(Matrix mat) {
Matrix globalMat = new Matrix(new double[mat.numRows()][mat.numColumns()]);
for(int term = 0; term < mat.numColumns(); term++) {
double norm = 0;
for(int doc = 0; doc < mat.numRows(); doc++) {
double tf = mat.m[doc][term];
if (tf > 0) {
n... | 5 |
public void setEqualizer(Equalizer eq)
{
if (eq==null)
eq = Equalizer.PASS_THRU_EQ;
equalizer.setFrom(eq);
float[] factors = equalizer.getBandFactors();
if (filter1!=null)
filter1.setEQ(factors);
if (filter2!=null)
filter2.setEQ(factors);
} | 3 |
@Override
public Query rewrite(IndexReader reader) throws IOException {
final Term[] terms = phraseQuery.getTerms();
final int[] positions = phraseQuery.getPositions();
boolean isOptimizable = phraseQuery.getSlop() == 0
&& n >= 2 // non-overlap n-gram cannot be optimized
&& terms.length >... | 9 |
private void fireBullets(List<BulletCommand> bulletCommands) {
BulletPeer newBullet = null;
for (BulletCommand bulletCmd : bulletCommands) {
if (Double.isNaN(bulletCmd.getPower())) {
println("SYSTEM: You cannot call fire(NaN)");
continue;
}
if (gunHeat > 0 || energy == 0) {
return;
}
do... | 8 |
@Override
public List<FoodCombo> getCurrentMenuChoices() throws RuntimeException {
List<FoodCombo> items = new ArrayList<FoodCombo>();
try {
// Make sure you always open a connection before trying to
// send commands to the database.
db.openConnection... | 5 |
public String selectFile(int mode) {
String returnVal = null;
int ret = 0;
final JFileChooser fc = new JFileChooser();
JFrame frame = new JFrame("FileChooser");
//show open or save dialog
fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
if(mode == MODE_OPEN)
{
ret = fc.sh... | 4 |
private void initComponents()
{
this.setLayout(new GridLayout(3,1));
WinchPanel = new JPanel();
WinchPanel.setLayout(new GridLayout(1,2));
WinchPanel.setBackground(Color.WHITE);
DrumPanel = new JPanel();
DrumPanel.setLayout(new GridLayout(1,2));
DrumPanel.setB... | 4 |
private void buildItemData( VgerItemData theItem, Document output,
Element element )
{
Element itemNode;
itemNode = output.createElement( "Item" );
if ( theItem.getBarcode() != null )
itemNode.appendChild( makeTextNode( "ItemNumber",
... | 6 |
public static float[] rref2(float[] matrix, int matrixSize){
int i = 0;
int j = 0;
for(;j < matrixSize; j++){
float lastValue = 0;
int largestRow = i;
for(int k = i; k < matrixSize; k++){
final int pos = getPosistion(k, j, matrixSize+1);
if(Math.abs(matrix[pos]) > lastValue){
lastV... | 7 |
public ThreadPoolScheduler() {
String threads = System.getProperty("junit.parallel.threads", "16");
int numThreads = Integer.parseInt(threads);
executor = Executors.newFixedThreadPool(numThreads);
} | 0 |
public void setNeighbors(){
for(int i = 0; i < gameBoard.length; i++){
for(int j = 0; j < gameBoard[i].length; j++){
if(j - 1 >= 0){
gameBoard[i][j].addNeighbor(gameBoard[(i+1)%12][(j+3)%4]);
gameBoard[i][j].a... | 4 |
public void remindBuyerMarkReceived(Auction auction){
auction.remindBuyerMarkReceived();
} | 0 |
public static void main(String[] args) throws InterruptedException {
if(!(args.length == 2 || (args.length == 3 && args[0].matches("-speedup|-scaleup")))) {
System.out.println("Usage: java BruteForceDES [-scaleup|-speedup] t s");
System.out.println(" t number of threads control");
... | 9 |
@After
public void tearDown()
throws Exception
{
this.scheduler.shutdown();
} | 0 |
public void setEtat (int etat){
super.setEtat(etat);
switch (etat) {
case initiale: {
initSources();
btnEnregistrerOuvrage.setEnabled(true);
textFieldTitre.setEnabled(true);
textFieldIsbn.setEnabled(true);
textFieldDateEd.setEnabled(true);
textFieldEditeur.setEnabled(true);
btnAnnulerOuvrage.... | 8 |
public String getCity() {
return city;
} | 0 |
public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
for (String line; (line = in.readLine())!=null; ) {
if(line.equals("*"))break;
char[] txt=line.toCharArray();
int q = Integer.parseInt... | 7 |
public static int createDisplayList(Model m) {
int displayList = glGenLists(1);
glNewList(displayList, GL_COMPILE);
{
glMaterialf(GL_FRONT, GL_SHININESS, 120);
glColor3f(0.4f, 0.27f, 0.17f);
glBegin(GL_TRIANGLES);
for (Model.Face face : m.getFaces(... | 4 |
public String next() {
String url = null;
Node parent = current.getParent();
if (parent != null) {
int lenght = current.subNode.size();
Node next = null;
for (int i = 0; i < lenght; i++) {
if (current.getURL().equals(next = current.subNode.get(i))) {
return next.getURL();
}
}
} else {... | 3 |
public static void runEditorFrame(){
editorFrame = new EditorFrame();
editorFrame.setVisible(true);
} | 0 |
private void VoltarMenuPrincipal_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_VoltarMenuPrincipal_ButtonActionPerformed
if ("Visitante".equals(a.getTipoUtilizador())) {
new Visitante(a);
}
if ("Gestor".equals(a.getTipoUtilizador())) {
new Gesto... | 3 |
@Override
public void run()
{
String msg = input.nextLine();
while (!msg.equals(ProtocolStrings.STOP))
{
notifyListeners(msg);
msg = input.nextLine();
}
try
{
socket.close();
} catch (IOException ex)
{
... | 2 |
public void fixObjects() {
baseGenome = bestVariation;
bestVariation = null;
for (LabelGene gene : baseGenome) {
avoids = avoids.union(gene.getGeometry());
gene.render();
}
baseGenome = new LabeledGenome<LabelGene>(avoids);
} | 1 |
public ArrayList<Integer> findSubstring(String S, String[] L) {
// Start typing your Java solution below
// DO NOT write main() function
int n = S.length();
int m = L.length;
ArrayList<Integer> res = new ArrayList<Integer>();
if (n == 0 || m == 0)
return res;
int perLen = L[0].length();
int length = ... | 7 |
public MyGeneralTree<String> createGeneralTree(List<String> nodeDescriptors)
{
if(nodeDescriptors == null || nodeDescriptors.size() == 0)
return null;
NodeDescriptor rootDescriptor = null;
List<NodeDescriptor> nodeDescriptorList = new ArrayList<>();
for(String n... | 5 |
@Override
public void update() {
if (rectangles.get(0)
.contains(InputHandler.instance.getMouseLocation()) && !drawAll) {
inactiveTimer.reset();
drawAll = true;
}
if ((InputHandler.instance.getMouseButton() == MouseEvent.BUTTON2)
&& (InputHandler.instance.getMouseButtonRotation() != 0)) {
Syste... | 6 |
public void printCycle(int cycleIndex, Main m){
int[] temp = cycles.get(cycleIndex);
System.out.printf("\t Cycle %d:\n", cycleIndex);
for(int i=0; i<temp.length; i++){
if(graphNodes.get(temp[i]).getType()== _REACTION_){
System.out.printf("\t");
m.getReactions().get( graphNode... | 2 |
@Override
public boolean state() {
if (this.ticksHeld == 0) {
return false;
}
if (this.ticksHeld == 1) {
return true;
}
if (this.ticksHeld < this.initialDelay) {
return false;
}
if (this.ticksHeld == this.initialDelay) {
return true;
}
if ((this.ticksHeld - this.initialDelay) % this.repea... | 5 |
public void testPingPong () throws IOException {
fail = null;
final Data dataTCP = new Data();
populateData(dataTCP, true);
final Data dataUDP = new Data();
populateData(dataUDP, false);
final Server server = new Server(16384, 8192);
register(server.getKryo());
startEndPoint(server);
server.bind(tcp... | 8 |
@Override
public void update(GameContainer gc, StateBasedGame sb, int delta)
throws SlickException {
for (MenuButton button : buttons) {
button.update(gc, sb, delta);
}
if (playButton.isMousePressed()) {
if (Game.app.getFPS() >= 30) {
if (firstTime) {
fillAlpha = 175;
firstTime =... | 8 |
public void drawTextualMap(){
for(int i=0; i<grid.length; i++){
for(int j=0; j<grid[0].length; j++){
if(grid[i][j] instanceof Room){
if(((Room)grid[i][j]).getItems().size()>0)
System.out.print(" I ");
else
System.out.print(" R ");
}else{
System.out.print(" = ");
}
}
... | 4 |
public boolean sendData(Object data) {
if (output == null || !clientSocket.isConnected()) {
return false;
}
synchronized (this) {
try {
output.flush();
output.writeObject(data);
output.flush();
output.reset(... | 6 |
public int getLengthLifeInAquarium() {
return lengthLifeInAquarium;
} | 0 |
private void redoHelper(boolean fromNetwork) {
//get the top of the action stack, handle it, and push it to the past actions stack for undo
if(futureActions.empty()) {
System.out.println("no actions to redo!");
return;
}
if(!fromNetwork)
networking.sendAction(new BoardEltExchange(null, BoardActionType.... | 9 |
@Override
public void mousePressed(MouseEvent e) {
final TCard source = (TCard) e.getSource();
if (e.getButton() == MouseEvent.BUTTON1) {
tempCard = source;
tempX = e.getX();
tempY = e.getY();
cardPosition = source.getCardPosition();
if (e.... | 5 |
public boolean searchMatrix(int[][] matrix, int target) {
if (matrix.length == 1) {
for (int i=0; i<matrix[0].length; i++) {
if (matrix[0][i] == target)
return true;
}
return false;
}
for (int i=1; i<matrix.length; i++) {
... | 9 |
public CATEGORY getCategory() {
return this.category;
} | 0 |
public static boolean isFree(int x, int y) {
if (!inField(x, y) || !isFreeFromBricks(-1, x, y)
|| theField[x][y] == 2) {
return false;
}
return true;
} | 3 |
private void addRelativeMove(float x, float y) {
Coordinate lastCoordinates;
try {
lastCoordinates = coordinates.getLast();
} catch (NoSuchElementException e) {
lastCoordinates = new Coordinate(0, 0);
}
coordinates.add(new Coordinate(lastCoordinates.x+x, lastCoordinates.y+y));
} | 1 |
public static int LD (String s, String t) {
int d[][]; // matrix
int n; // length of s
int m; // length of t
int i; // iterates through s
int j; // iterates through t
char s_i; // ith character of s
char t_j; // jth character of t
int cost; // cost
// Step 1
n = s.length ();
m =... | 7 |
protected final Logger getLogger() {
return LoggerFactory.getLogger(this.getClass());
} | 0 |
public GeneralPath draw(Graphics2D g2,
Rectangle2D dataArea,
ValueAxis horizontalAxis, ValueAxis verticalAxis) {
GeneralPath generalPath = generateClipPath(
dataArea, horizontalAxis, verticalAxis
);
if (this.fillPath || this.dr... | 7 |
@Override
public WindowsAttributes getWindowsAttributes(String path)
throws PathNotFoundException, AccessDeniedException,
UnsupportedFeatureException {
if (hardlinks)
{
//Get hard link paths
String[] hardlinks = getHardLinks(path);
if (hardlinks.length > 0)
path = hardlinks[0];
}
if (windows... | 8 |
public void setContent(String content) {
mContent = content;
} | 0 |
@Override
public void run() {
init();
long start;
long elapsed;
long wait;
// game loop
while (running) {
start = System.nanoTime();
update();
draw();
drawToScreen();
elapsed = System.nanoTime() - start;
wait = targetTime - (elapsed / 1000000);
if (wait < 0) {
wait = 5;
}... | 3 |
public Def availDef(final Def def) {
final Def availDef = (Def) availDefs.get(def);
if (SSAPRE.DEBUG) {
System.out.println(" avail def for " + def + " is "
+ availDef);
}
return availDef;
} | 1 |
public void writeKnownAttributes(GrowableConstantPool gcp,
DataOutputStream output) throws IOException {
if (bytecode != null) {
output.writeShort(gcp.putUTF8("Code"));
output.writeInt(bytecode.getSize());
bytecode.write(gcp, output);
}
if (exceptions != null) {
int count = exceptions.length;
ou... | 5 |
public DocumentRepositoryListener[] getDocumentRepositoryListeners() {
return (DocumentRepositoryListener[]) documentRepositoryListeners.toArray();
} | 0 |
public QryResult evaluateIndri(RetrievalModel r) throws IOException {
// Initialization
allocDaaTPtrs (r);
QryResult result = new QryResult ();
double queryVal = (double) 1 / (double)this.args.size(); // args / daat ?
boolean looper = true;
double tempScore = 0;
DaaTPtr ptri;
... | 8 |
public String peekUnsearchList(){
final String sql = "SELECT min(sn), url FROM WAIT_SEARCH_URL_WIKI";
String sn = "";
String url = "";
Statement stmt;
try {
stmt = this.connection.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
sn = rs.getString(1);
url = rs.getS... | 4 |
private void analyseLineFirstPass(String assemblyLine) throws AssemblerException {
if (assemblyLine.equals(".data")){
if(dataDeclared)
throw new AssemblerException(".data section already declared.");
dataDeclared = true;
atData = true;
atText = false;
}
else if (assemblyLine.equals(".t... | 6 |
public Distance distanceTo(Point second) {
double dx, dy, difference;
dx = x - second.x;
dy = y - second.y;
difference = Math.sqrt(dx * dx + dy * dy);
return new Distance(difference, unit);
}
}
/*
* Klasse voor een lijn. Bevat een twee punten en een meeteenheid
* Deze klasse erft alles van vorm
* Deze ... | 0 |
public static void nextPermutation(int[] num) {
int index = -1;
int swap = -1;
for (int i = num.length - 1; i > 0; i--) {
if (num[i - 1] < num[i]) { index = i - 1; break;}
}
if (-1 != index) {
for (int i = num.length - 1; i >= 0; i--) {
if (num[i] > num[index]) {swap = ... | 6 |
public static float sum(float[] arr){
float sum = 0;
for (int i = 0 ; i < arr.length; i++){
sum += arr[i];
}
return sum;
} | 1 |
@Override
public SampleableList sample() {
SampleableListImpl output = new SampleableListImpl();
if (size() == 0) {
return null;
}
for (int i = 0; i < size(); i = i + 2) {
if (array[i] != null) {
output.add(get(i).getReturnValue());
} else {
break;
}
}
return output;
} | 3 |
public Map<MetaEnum, Object> getMeta() {
return this.getReferRequestWrapper().getMeta();
} | 0 |
@Id
@Column(name = "PCA_SECUEN")
public Integer getPcaSecuen() {
return pcaSecuen;
} | 0 |
public static void main(String[] args) {
int i = 0;
outer: // Can�t have statements here
for(; true ;) { // infinite loop
inner: // Can�t have statements here
for(; i < 10; i++) {
System.out.println("i = " + i);
if(i == 2) {
System.out.println("continue");
continue;
}
if(i == 3) {
... | 8 |
public ComputerControlPanel(final Computer computer) {
super(new FlowLayout(FlowLayout.CENTER));
// Construct components
final ExecutionSpeedSlider speedSlider = new ExecutionSpeedSlider();
final JButton step = new JButton("Step once");
JButton reset = new JButton("Reset... | 6 |
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
Graphics2D g3 = (Graphics2D)g;
Graphics2D cookingArea = (Graphics2D)g;
Graphics2D platingArea = (Graphics2D)g;
//Clear the screen by painting a rectangle the size of the frame
g2.setColor(getBackgroun... | 8 |
@Override
public void operation() {
getImplementor().operation();
} | 0 |
public double[] apply(double[] spectrumData) {
if (spectrumData == null) {
return null;
}
int specLen = spectrumData.length;
int barkLen = getNumberOfBarkBands();
// initialize output vector
double[] barkSpec = new double[barkLen];
// f ... fre... | 3 |
@Override
public boolean isDone(Game game) {
boolean ended = super.isFinished(game);
if(ended)
return true;
if(game.getNumSprites(itype) - game.getNumDisabledSprites(itype) <= limit && canEnd) {
countScore(game);
return true;
}
return fa... | 3 |
public static final JsonElement toJson(Object object){
if(object instanceof String){
return parse((String)object);
}
return GSON.toJsonTree(object);
} | 1 |
protected void propagateClassifier()
{
switch (mappingChoice.getSelectedIndex())
{
case RAYTRACE: // raytrace rendering.
case VIEWSPACE: // viewspace.
classificationChoice.setEnabled(true);
if (classificationChoice.getSelectedIndex() == VJClassifiers.ISOSURFACE)
classificationChoice.select(VJCla... | 9 |
void parseDocument() throws java.lang.Exception
{
char c;
parseProlog();
require('<');
parseElement();
try {
parseMisc(); //skip all white, PIs, and comments
c = readCh(); //if this doesn't throw an exception...
error("unexpected character... | 1 |
public void makeGlobalObject(int x, int y, int typeID, int orientation, int tileObjectType){ //Makes Global objects
for (Player p : server.playerHandler.players){
if(p != null){
client person = (client)p;
if((person.playerName != null || person.playerName != "null")){
if(person.distanceToPoint(x, y) <= ... | 5 |
private void handleSubCommandPlayers(String[] args, Player executingPlayer) {
if (args.length == 1) {
GrubsMessager.sendMessage(executingPlayer, GrubsMessager.MessageLevel.ERROR, "Not enough arguments.");
}
if (GrubsLaserTag.getGameState() == GrubsLaserTag.GAME_STATES.ACCEPT_PLAYERS ||
GrubsLaserTag.getGa... | 9 |
private void checkActivationName(String name, int token)
{
if (parser.insideFunction()) {
boolean activation = false;
if ("arguments".equals(name)
|| (parser.compilerEnv.activationNames != null
&& parser.compilerEnv.activationNames.containsKey(name... | 8 |
public void move(ArrayList<Cell> moveableCells, Board board, Ball ball) {
ArrayList<Cell> targetList = new ArrayList<Cell>(moveableCells);
if(!hasBall) {
//eDistanceBetween returns the straight line distance between 2 points. If the player is next to the ball, he attempts to steal
//if he is not next to th... | 8 |
static protected void UpdateLineColumn(char c)
{
column++;
if (prevCharIsLF)
{
prevCharIsLF = false;
line += (column = 1);
}
else if (prevCharIsCR)
{
prevCharIsCR = false;
if (c == '\n')
{
prevCharIsLF = true;
}
else
line += (column = ... | 6 |
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
final Player player = event.getPlayer();
if (plugin.getConfig().getBoolean("Optional.Login_Activation")) {
plugin.getServer().getScheduler()
.runTaskAsynchronously(plugin, new Runnable() {
public void run() {
if (plugin.checkAcco... | 4 |
public MemoryMapper(String outputdir,String filename){
int i;
//memc=new byte[65536];
memnc=new int[65536];
for(i=0;i<65536;i++){
// memc[i]=0;
memnc[i]=0;
}
dumpFile=new File(outputdir,filename+".mmap");
} | 1 |
public boolean checkRessourceAvailability(int resType, String startDate, String endDate, int requestedQty) {
//CONNECTION SKAL IKKE MED I PARAM, HENT FRA GETINSTANCE. SLET KALD HELE VEJEN GENNEM STRUKTUREN
int bookedQty = 0;
int totalStorageQty = 0;
//startDate = "2014-01-13";
//... | 6 |
public static void main(String[] args)
{
for( int i=0; i<POPULATION_SIZE; i++ )
population[i] = new Individual();
// for( int i=0; i<POPULATION_SIZE; i++ )
// System.out.println( "POPULATION[" + i + "]: " + population[i] );
for( int i=0; i<POPULATION_SIZE; i++ )
sumFitness += population[i].fitness;
... | 4 |
@Override
public List<Funcao> Buscar(Funcao obj) {
String Consulta = "select l from Funcao l";
if(obj != null){
Consulta = Consulta + " where l.nome like '%" + obj.getNome() + "%'";
}
Query q = manager.createQuery(Consulta);
return q.getResultList();
} | 1 |
public void move() {
if (nextGlied != null) {
nextGlied.move();
}
this.x += getDirection().getX() * width;
this.y += getDirection().getY() * height;
} | 1 |
private JSONArray buildJson() {
JSONArray json = new JSONArray();
if (!initialized || entityIds.isEmpty()) {
return json;
}
int i = 0, size = entityIds.size();
for (String entityID : entityIds) {
try {
JSONObject entityObj = new JSONObject(... | 8 |
public static ItemFactory create(){
if(itemFactory == null){
itemFactory = new ItemFactory();
}
return itemFactory;
} | 1 |
@Override
public void execute() {
p.setBackground(Color.orange);
} | 0 |
private double getGeneOverlap(LabelGene gene, GeometryFactory factory) {
Geometry geometry = gene.getGeometry();
LinkedList<Geometry> overlappingObjects = new LinkedList<Geometry>();
overlappingObjects.add(avoids.intersection(geometry));
for (LabelGene otherGene : this) {
if (otherGene != gene) {
if (gen... | 3 |
public static float[][] getClusterDistance(int kc, float[][][] X, int min) {
float tempX[][] = new float[kc][2];
float tempY[][] = new float[kc][2];
for (int i = 0; i < X.length; i++) {
for (int j = 0; j < X.length; j++) {
if ((int) X[i][0][0] >= min) {
if (X[i][0][0] == X[j][0][0]) {
tempX[(int... | 5 |
public void setState(int state) {
if (this.state != state) {
this.state = state;
stateTime = 0;
if (state == STATE_DYING) {
setVelocityX(0);
setVelocityY(0);
}
}
} | 2 |
private static void splitWordsAndDefs(String[] str)
{
ArrayList<String> wordList = new ArrayList<String>();
ArrayList<String> defList = new ArrayList<String>();
for(String s : str)
{
String word = "";
String def = "";
char[] ch = s.toCharArray();
int section = 0;
for(int i = 0; i < ch.le... | 9 |
@Override
public int sizeOf( Class<?> v )
{
return (v == null ? Compress.NULL_SIZE : Compress.sizeOfUnsignedNullable( v.getCanonicalName().length() ) + v.getCanonicalName().length() );
} | 2 |
public void run(){
final double GAME_HERTZ = 40.0;
//final double TARGET_FPS = 60.0;
final double TIME_BETWEEN_UPDATES = 1000 / GAME_HERTZ;
final int MAX_FRAMESKIP = 5;
long lastTime = System.currentTimeMillis();
long currentTime = 0;
long step = (long) TIME_BETW... | 6 |
@Override
public String buscarDocumentoPorEmpresa(String empresa) {
ArrayList<Venta> geResult= new ArrayList<Venta>();
ArrayList<Venta> dbVentas = tablaVentas();
String result="";
try{
for (int i = 0; i < dbVentas.size() ; i++){
if(dbVentas.get(i).getEmpr... | 4 |
@Override
public void mousePressed(MouseEvent e)
{
cellWidth = view.getWidth() / view.getBoardSize();
cellHeight = view.getHeight() / view.getBoardSize();
pressedX = e.getX() / cellWidth;
pressedY = e.getY() / cellHeight;
if(pressedY == 0)
{
pressedY = 7;
}
else if(pressedY == 1)
{
pres... | 8 |
public MultiTermEnum(IndexReader topReader, IndexReader[] readers, int[] starts, Term t)
throws IOException {
this.topReader = topReader;
queue = new SegmentMergeQueue(readers.length);
matchingSegments = new SegmentMergeInfo[readers.length+1];
for (int i = 0; i < readers.length; i++) {
... | 6 |
private double leastSquaresNonMissing(Instances instances, int attIndex) {
double numerator=0, denominator=0, w, t;
double[] classMeans = new double[m_numOfClasses];
double[] classTotals = new double[m_numOfClasses];
for (int i=0; i<instances.numInstances(); i++) {
LADInstance inst = (LADInstanc... | 8 |
public void render(){
for(int y = 0; y < height; y++){
for(int x = 0; x < width; x++){
Tile.getTileById(data.get((y * width) + x)).render(x * tileSize, y * tileSize);
}
}
} | 2 |
@Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... | 3 |
public static boolean hasMethod(final Class<?> clazz, final String name) {
boolean found = Boolean.FALSE;
if ((clazz != null) && (!StringUtils.isEmpty(name))) {
int i = 0;
final Method[] methods = clazz.getDeclaredMethods();
while ((i < methods.length) && (!found)) {
found = methods[i].getName().equals... | 5 |
public static void evaluateResult(TestVector v, Object result) {
if (v.pass) {
if (result instanceof String && v.expected.equals((String)result))
System.out.print("*PASS*: ");
else
System.out.print("*FAIL*: " );
System.out.println("input: [" + v.input + "] output: [" + v.expected
+ "] result: [... | 6 |
private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... | 5 |
public static int getAbsoluteValue(int i, NumberSign sign) {
if(i == 0 || i == -0) {
return 0;
}
if(sign.equals(NumberSign.NEGATIVE)){
int r = (i < 0 ? i : -i);
return r;
} else if (sign.equals(NumberSign.POSITIVE)) {
int r = (i < 0 ? -i : i);
return r;
} else {
return 0;
}
} | 6 |
@Test
public void testGetAvailableMoves() {
System.out.println("getAvailableMoves");
Board board = new Board(8, 12);
RuleManager instance = new RuleManager();
Set<Position> expResult = new HashSet<>(4);
expResult.add(new Position(5, 2));
expResult.add(new Position(5,... | 1 |
public void calcBestPastrLocation() throws GameActionException {
if (bestPastrLoc == null) {
int MIDX = (rc.getMapWidth() / 2);
int MIDY = (rc.getMapHeight() / 2);
int[] info;
switch (this.HQ_LOCATION) {
case TOP:
comms.sendSearchCoord... | 9 |
public ImportFileMenuItem(FileProtocol protocol) {
setProtocol(protocol);
addActionListener(this);
} | 0 |
public boolean write( )
{
boolean result = false;
try { //Try to load the mysql Driver
Class.forName("com.mysql.jdbc.Driver");
try { //Try to open a connection to the mysql server
String url = settingsMap.get("URL");
String user = settingsMap.get("username");
String passwd = settingsMap.get("... | 8 |
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.