text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void paintComponent(Graphics g) {
if ( image == null ) {
super.paintComponent(g);
return;
}
Dimension size = getSize();
int iw = image.getWidth();
int ih = image.getHeight();
if ( iw > size.width ) {
ih *= (double)size.width/iw;
iw = size.width;
}
if ( ih > size.heigh... | 5 |
public static Connection getConn(){
Connection conn = null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/struts", "root", "root");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace(... | 2 |
static List<List<Card>> checkPairs(List<Card> cards) {
boolean skipIter;
Card temp;
List<Card> bottomSet;
List<Card> currentSet;
List<Card> topSet;
List<List<Card>> sets;
temp = cards.get(0);
skipIter = true;
bottomSet = new ArrayList<>();... | 6 |
public void pushMinusOperator(){
((Vector)operatorStack).add(0, new MinusOperator());
} | 0 |
public static double computeThreshold(ArrayList<Double> class1, ArrayList<Double> class2)
{
double threshold = 0;
Collections.sort(class1);
Collections.sort(class2);
// Choose c1 as the most left-located class and c2 as the most right-located
ArrayList<Double> c1, c2;
if (class1.get(0) < class2.get(0)) {
... | 8 |
public void use(){
// use skill by type
// add effects & element
if(Game.PLAYER.reduceMana(requiredMana)){
switch(type){
case PROJECTILE: projectileAttack();
break;
case LASER: laserAttack();
break;
case IMPACT: impactAttack();
break;
case AURA: auraAttack();
break;
}
}
delta++;
... | 6 |
private void ValidateMapSize(int height, int width) {
boolean change = false;
int newwidth = Game.map.width;
int newheight = Game.map.height;
if (height >= Game.map.minsize && height <= Game.map.maxsize) {newwidth = width;change = true;}
if (width >= Game.map.minsize && width <= Game.map.maxsize) {newheight =... | 5 |
public boolean isDiagonal(int p1Index, int p2Index) {
Point p1 = points.get(p1Index);
Point p2 = points.get(p2Index);
boolean result;
/*
* Neighborhood test.
*/
Point ccwNeighbor = points.get((p1Index + 1) % points.size());
Point cwNeighbor = points.get((p1Index + points.size() - 1) % points.size());
... | 9 |
public void renderElement(Graphics2D g2d)
{
if(this.Enable)
{
BufferedImage DrawTexture = new BufferedImage(Texture.getWidth(), Texture.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D ImgG2d = DrawTexture.createGraphics();
ImgG2d.rotate(Rotation, DrawTexture... | 2 |
public String[] queryColumn(String table, String columnName, int n) {
String[] resultColumn = null;
try {
String stm = null;
stm = "select " + columnName + " from " + table;
con = DriverManager.getConnection(url, user, password);
pst = con.prepareStatement(stm);
rs = pst.executeQuery();
resultCol... | 5 |
private void getWordsAmountForSections () {
try {
connection = DriverManager.getConnection(Utils.DB_URL);
statement = connection.createStatement();
for (Integer id : sectionIdList) {
resultSet = statement.executeQuery("SELECT COUNT(*) AS count FROM word WHERE ... | 2 |
public boolean deleteDir(File dir) {
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i=0; i<children.length; i++) {
boolean success = deleteDir(new File(dir, children[i]));
if (!success) {
return false;
... | 3 |
public void run() {
if (!parent.getConfigu().getBool(
Config.Option.DisableEditDupeProtection)) {
for (@SuppressWarnings("rawtypes")
Map.Entry e : parent.map.entrySet()) {
@SuppressWarnings("rawtypes")
Iterator i = ((CBlock) e.getValue()).getBlocks();
while (i.hasNext()) {
Block b = Util
... | 6 |
private List<Cell> neighbors(Cell [][] cells, Cell cell) {
List<Cell> neighbors = new ArrayList<Cell>();
if (cell.getxCoordinate() + 1 < Config.X_AMOUNT_CELLS
&& cells[cell.getxCoordinate() + 1][cell.getyCoordinate()].getBall() == null) {
neighbors.add(cells[cell.getxCoordinate() + 1][cell.getyCo... | 8 |
@Override
public void update() {
if (InputHandler.instance.keyIsDown(KeyEvent.VK_ESCAPE) && (StateHandler.instance.getCurrentState() == State.PLAYING) && (waitTimer.getRemaining() == 0)) {
StateHandler.instance.setCurrentState(State.IN_GAME_MENU);
showing = true;
waitTimer.reset();
} else if (InputHandler... | 6 |
private void readMapITP() throws Exception {
try {
FileReader fr = new FileReader(mapFilenameITP);
BufferedReader br = new BufferedReader(fr);
String str = br.readLine();
while (str != null) {
int as1;
int as2;
try {
as1 = Integer.parseInt(str.substring(0, str.indexOf("\t")));
st... | 7 |
public static <A> Equal<Option<A>> optionEqual(final Equal<A> ea) {
return equal(o1 -> o2 -> o1.isNone() && o2.isNone() ||
o1.isSome() && o2.isSome() && ea.f.f(o1.some()).f(o2.some()));
} | 4 |
public void heapIncKey(int indeksi, int arvo) {
if (indeksi >= 0 && indeksi < keko.size()) {
if (arvo > keko.get(indeksi)) {
keko.set(indeksi, arvo);
}
while (indeksi > 0 && keko.get(parent(indeksi)) < arvo) {
int apuluku = keko.get(parent(inde... | 5 |
public static int numberOfInversionsB(List<Element> a) {
int counter = 0;
for (int i = 0; i < a.size() - 1; i++) {
if (a.get(i).getValue() > a.get(i + 1).getValue()) {
counter++;
}
}
return counter;
} | 2 |
public Map<String, String> getMapOfFieldsNames() {
try {
if (verifyMappingModel()) {
logger.debug("Start searching field assignment for "
+ srcClass.getSimpleName());
Field[] srcfields = getFieldsFromSourceClass();
for (Field srcField : srcfields) {
String sourceFieldName = srcField.getName... | 4 |
public void ensureSkeleton() {
if (skeleton != null) return;
List<Integer> sids = new ArrayList<Integer>();
if (sid != -1) {
sids.add(sid);
}
for (Integer stsid : soundtracks.keySet()) {
if (stsid != -1) {
sids.add(stsid);
}
... | 5 |
@Basic
@Column(name = "PCA_PRECIO_VENTA")
public Integer getPcaPrecioVenta() {
return pcaPrecioVenta;
} | 0 |
public Complex getPropagationConstant(){
if(this.distributedResistance==0.0D && this.distributedConductance==0.0D){
this.generalPropagationConstant = new Complex(0.0D, this.omega * Math.sqrt(this.distributedInductance * this.distributedCapacitance));
}
else{
this.generalP... | 2 |
public static void main(String[] args) {
if (args.length < 2) {
System.out.println("Usage: java MD md-algorithm filename");
System.exit(0);
}
try {
// MessageDigest-Objekt erstellen (Algorithmus z.B. SHA-1 oder MD5)
MessageDigest md = MessageDigest... | 4 |
public boolean exists(Place searchedPlace) {
for (Place place : places) {
if (place.getNumber() == searchedPlace.getNumber()) {
return true;
}
}
return false;
} | 2 |
public static String generateLine(String lastWord, int desiredLetterCount) {
if(lyricMap == null) {
throw new NullPointerException("You forgot to set RCLineGenerator's lyric map");
}
String result = lastWord;
while(lyricMap.hasPreviousWord(lastWord)) {
String newWord = lyricMap.getRandomPreviousWor... | 6 |
public JSONWriter object() throws JSONException {
if (this.mode == 'i') {
this.mode = 'o';
}
if (this.mode == 'o' || this.mode == 'a') {
this.append("{");
this.push(new JSONObject());
this.comma = false;
return this;
}
t... | 3 |
public Object getData(int pos) {
if (pos == 1){
return this.data1;
}
if (pos == 2){
return this.data2;
}
if (pos == 3){
return this.data3;
}
if (pos == 4){
return this.data... | 7 |
private static void printDiamondDetails (int indent, DeviceDescriptor info)
{
Device dev = info.getDevice ();
if (info.getProductId () != 0x0001) {
indentLine (indent, "That's not a Rio 500 ...");
return;
}
Rio500 rio = null;
try {
indentLine (indent, "Rio 500 Status: ");
indent += 2;
... | 4 |
private void sendAck(COMMAND cmd, boolean success) {
try {
COMMAND msgCmd = (success ? cmd : COMMAND.BLANK);
Message msg = new Message(true, msgCmd, 1, "", new byte[1][0]);
objectToClient.writeObject(msg);
objectToClient.flush();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception... | 3 |
public static List<String> frequentWords(String input, int count){
HashMap<String,Integer> wordHash = new HashMap<String,Integer>(); //Stores the words with their frequency count
ArrayList<String> list[]; //Array of list of words with their frequency count as index
ArrayList<String> result = new ArrayList<String>... | 9 |
private Element findFirstChildByTag(Element element, String name){
Node current = element.getFirstChild();
while(null != current){
if(name.equals(current.getNodeName()))
return (Element)current;
current = current.getNextSibling();
}
return null... | 2 |
public void endMatch(Player victor) {
inProgress = false;
if (victor == null) {
System.out.println("A draw has occurred.");
} else {
System.out.println(victor.getTheme().toString()+" is victorious.");
}
cancelCurrentAction();
panel.endMatch();
board.repaint();
//TODO: Display victory on the match ... | 1 |
@Override
public boolean equals( Object b ) {
if (!(b instanceof gridArrayClass)){
return false;
}
if ( grid.length != ((gridArrayClass)b).grid.length ){
return false;
}
for (int k = 0; k < grid.length; k++ ){
if ( grid[k].length != ((gridArrayClass)b).grid[k].length ){
... | 7 |
public void installUI(JComponent c) {
super.installUI(c);
tip = (JToolTip) c;
rendererPane = new CellRendererPane();
c.add(rendererPane);
} | 0 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TipoMoto other = (TipoMoto) obj;
if (this.id != other.id) {
return false;
}
i... | 4 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if(sender instanceof ConsoleCommandSender) {
sender.sendMessage("§cThis can only be run in game!");
return true;
}
Player p = (Player) sender;
if(args.length== 0)
return false;
if(args[0].equa... | 8 |
static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... | 9 |
private void summariseDemand(Base base) {
shortages.removeAllItems() ;
surpluses.removeAllItems() ;
final World world = base.world ;
final Tile t = world.tileAt(0, 0) ;
for (Object o : world.presences.matchesNear(SupplyDepot.class, t, -1)) {
final SupplyDepot venue = (SupplyDepot) o ... | 6 |
private static double incbcf(double a, double b, double x) throws ArithmeticException {
double xk, pk, pkm1, pkm2, qk, qkm1, qkm2;
double k1, k2, k3, k4, k5, k6, k7, k8;
double r, t, ans, thresh;
int n;
double big = 4.503599627370496e15;
double biginv = 2.22044604925031308085e-16;
k1 = a;
k2 = a + b;
... | 7 |
private void checkAccess(){
boolean tested=true;
if(!(gamePath.equals("") | gamePath==null)){
File f = new File(gamePath); //Check if we have read and write access
if(!f.canWrite() & !f.canRead()) {
tested=false; //if no access
con.log("Severe","Failed to write and read");
}
}
try {
FileW... | 5 |
public void copyLanguageFiles() {
File langFolder = new File(plugin.getDataFolder() + "/lang/");
if (!langFolder.exists())
langFolder.mkdirs();
try {
JarFile jarFile = new JarFile(plugin.getClass()
.getProtectionDomain().getCodeSource().getLocation()
.toURI().getPath());
for (Enumeration<JarE... | 7 |
public boolean setCellData(String sheetName,String colName,int rowNum, String data){
try{
fis = new FileInputStream(path);
workbook = new XSSFWorkbook(fis);
if(rowNum<=0)
return false;
int index = workbook.getSheetIndex(sheetName);
int colNum=-1;
if(index==-1)
return false;
sheet = work... | 8 |
private void drawOneColumn(Graphics2D g2d, Column column, Rectangle bounds) {
Shape oldClip = g2d.getClip();
Color divColor = getDividerColor();
int last = getLastRowToDisplay();
int y = bounds.y;
int maxY = bounds.y + bounds.height;
if (mHeaderPanel != null) {
bounds.height = mHeaderPanel.getHeight();
... | 7 |
public void open(Display display) {
Shell shell = new Shell(display);
shell.setText("Drag and Drop Example");
shell.setLayout(new FillLayout());
itemImage = new Image (display, DNDExample.class.getResourceAsStream("openFolder.gif"));
ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROL... | 4 |
public Class<?>[] genericsTypes(Class<?> superClazz) {
Type type = getGenericSupertype(clazz, superClazz);
List<Class<?>> types = new LinkedList<Class<?>>();
if (type instanceof ParameterizedType) {
Type[] paramTypes = ((ParameterizedType) type).getActualTypeArguments();
types.addAll(evalTypesAsClasses(pa... | 7 |
private static ProcessWrapper[] topologicallyOrder( ProcessWrapper[] processes ) throws ProcessException
{
while( !isTopologicallyOrdered( processes ) )
{
List<ProcessWrapper> sorted = new LinkedList<ProcessWrapper>();
sorted.add( processes[ 0 ] );
for( int i = 1; i < processes.length;... | 7 |
@Override
public void run() {
List<UIEvent> lastEvents = Model.getModel().getInteractionStack().getLastEvents(2);
if (lastEvents.get(0).getEventType() != EventType.MOUSE_BUTTON_UP
|| lastEvents.get(0).getButton() != 1
|| lastEvents.get(1).getEventType() != EventType.MOUSE_BUTTON_DOWN
|| Model.getModel(... | 9 |
private void show() {
if (!UIUtilities.inModalState()) {
if (mWindow != null) {
if (mWindow.isDisplayable() && mWindow.isVisible()) {
mWindow.toFront();
return;
}
}
JPanel aboutPanel = App.createAboutPanel();
if (aboutPanel != null) {
mWindow = new AppWindow(getTitle());
mWindow.... | 5 |
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 synchronized void keyTyped(KeyEvent e) {
if (e.getKeyChar() <= currentKeys.length) {
letter = e.getKeyChar();
}
} | 1 |
public static Move[] generateMoves(int nMoves) {
Move[] moves = new Move[nMoves];
for (int i = 0; i < nMoves; i++) {
Move m = new Move("Move #" + i);
moves[i] = m;
}
for (Move m0 : moves) {
for (Move m1 : moves) {
if (m0 == m1 || m0.beats(m1) || m1.beats(m0))
continue;
if (RPSGame.rand.nex... | 9 |
public ArrayList<Residue> calcPMOI(ArrayList<Residue> residueList) {
newResArray = new ArrayList<Residue>();
int bc = 0;
int newC = 0;
boolean nt, ct;
for (int i = 0; i < residueList.size(); ++i) {
// get relevant info for residue construction
ArrayList<Atom> atomList = residueList.get(i).getAtomList... | 5 |
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {
XYPlot plot = getPlot();
if (plot == null) {
return null;
}
XYDataset dataset = plot.getDataset(datasetIndex);
if (dataset == null) {
return null;
}
if ... | 8 |
public String loadHelpContents(String target) {
String contents = "";
try {
BufferedReader fin = new BufferedReader(new FileReader(("src/resources/help" + target + ".txt")));
String line;
while ((line = fin.readLine()) != null) {
contents += line + "\n";
}
} catch (IOException e) {
System.out.p... | 2 |
protected void addFrameVetoListener() {
addVetoableChangeListener(new VetoableChangeListener() {
@Override
public void vetoableChange(PropertyChangeEvent evt)
throws PropertyVetoException {
if (evt.getPropertyName().equals(
JInternalFrame.IS_SELECTED_PROPERTY)
&& evt.getNewValue().equals(B... | 8 |
@Override
public List<TroubleTicket> getTroubleTicketsByName(String callerName)
{
try
{
// Build select query
String selectQuery = "SELECT * FROM troubletickets";
if (callerName.length() > 0)
{
selectQuery += " WHERE callerName = '" + callerName + "'";
}
// Select all trouble ticket... | 3 |
public void run()
{
try
{
GuiConnecting.setNetClientHandler(connectingGui, new NetClientHandler(GuiConnecting.func_74256_a(connectingGui), ip, port));
if (GuiConnecting.func_74257_b(connectingGui))
{
return;
}
GuiConnectin... | 7 |
public void writeInformation(Description d, int categoryID, HUD UI) {
d.append("Is: ") ;
super.describeStatus(d) ;
d.append("\n\nCondition: ") ;
final Batch <String> healthDesc = health.conditionsDesc() ;
for (String desc : healthDesc) {
d.append("\n "+desc) ;
}
final Batch <Cond... | 5 |
public TreeMap<Integer, Integer> colorieur(TreeMap<Integer, Integer> couleur, TreeMap<Integer, TreeSet<Integer>> couleurPossible )
{
if(couleurPossible.isEmpty())
{
return couleur;
}
else
{
Entry<Integer, TreeSet<Integer>> entry = couleurPossible.firstEntry();
TreeSet<Integer> tree = entry.getValue... | 5 |
public static void main(String [] args){
System.out.println("Enter value of n:");
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
for(int i=1;i<=n;i++){
for(int j=1;j<=n+(i-1);j++)
System.out.print(" ");
for(int k=n;k>=i;k--){
System.out.print(" "+ k);
}
Sy... | 3 |
public void movePlayerXPositive(int PlayerID)
{
if(checkNoPlayerBoundsCollisionPositive(PlayerID) == true) players.get(PlayerID).moveBatPositve();
} | 1 |
void addHistoryItem(Choice choiceHistory, String historyFile, String newItem) {
boolean alreadyInHistory = false;
try {
String line = new String();
BufferedReader history = new BufferedReader(new FileReader(historyFile));
while ((line = history.readLine()) != null) {
if (line.equals(... | 5 |
@Override
public Object evaluate(ArrayList<Context1> pila) throws Exception {
System.out.println("estoy evaluando");
if (e.evaluate(pila) instanceof Double) {
valor = (Double) e.evaluate(pila);
} else {
System.out.println("In the increment the object is not double");
}
int i;
for (i = pila.size() - ... | 8 |
public String getContract() {
return contract;
} | 0 |
private BufferedReader makeRequest() {
URL request;
String authtext = "";
if(!mUser.equalsIgnoreCase("") && !mPass.equalsIgnoreCase("")) // If the user provided both username and password, include them.
authtext = mUser + ":" + mPass + "@";
URL url;
try { // Check that the URL is ok and form the request... | 4 |
private DijkstraAlgorithm getPathFinder() {
List<Vertex> vertices = new ArrayList<Vertex>();
List<Edge> edges = new ArrayList<Edge>();
this.vertexArray = new Vertex[16];
for(Entry<Byte,TreeSet<Byte>> neighbour : networkTreeMap.entrySet()) {
String id = neighbour.getKey().toString();
Vertex v = new V... | 5 |
public static String formatJSON(String s) {
try {
return new JSONObject(s).toString(4);
} catch (JSONException e) {
try {
return new JSONArray(s).toString(4);
} catch (JSONException e2) {
return s;
}
}
} | 2 |
public Location towards(Location other) {
if(x < other.x) {
return new Location(x+1, y);
} else if(x > other.x) {
return new Location(x-1, y);
} else if(y < other.y) {
return new Location(x, y+1);
} else if(y > other.y) {
return new Location(x, y-1);
} else {
return new Location(x, y);
}
} | 4 |
public void setNewTranslation(String newTranslation){
this.newTranslation.setText(newTranslation);
} | 0 |
private int readHexDigit() throws PDFParseException {
// read until we hit a non-whitespace character or the
// end of the stream
while (buf.remaining() > 0) {
int c = (int) buf.get();
// see if we found a useful character
if (!PDFFile.isWhiteSpac... | 9 |
private void mainFrame() throws DALException {
mf = new JFrame("Top Pharma");
mf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mf.setSize(802, 640);
if (currentUser.getmedArbId() == 0) {
JOptionPane.showMessageDialog(mf, "Velkommen Til MedCo Synthetics\n"
+ "Click ok for at logge ind", "Opstart" ... | 9 |
public Player(int x, int y){
this.x = x;
this.y = y;
centerCamera();
baseStats.setIntelligence(15);
baseStats.setStrength(10);
baseStats.setWisdom(10);
baseStats.setVitality(12);
baseStats.setpDef(10);
baseStats.setmDef(8);
recalculateStats();
// TODO remove these testcases
// START TE... | 3 |
public Node insertChg(Node node, int value)
{
if(node==null)
return new Node(value);
else
{
if(node.right==null)
{
System.out.println("Rnull-"+node.value);
node.right = insertChg(node.right,value);
}
else
{
System.out.println("!Rnull-"+node.value);
n... | 2 |
protected void loadInputProperties() {
if (VERBOSE)
System.out.println("Loading '" + getInputFilename() + "'...");
m_InputProperties = new Properties();
try {
File f = new File(getInputFilename());
if (getExplicitPropsFile() && f.exists())
m_InputProperties.load(new FileInputStrea... | 9 |
public static boolean isReservedColon(String candidate) {
int START_STATE = 0;
int TERMINAL_STATE = 1;
char next;
if (candidate.length()!=1){
return false;
}
int state = START_STATE;
for (int i = 0; i < candidate.length(); i++)
... | 5 |
public void testNullInputGivesCorrectErrorMessage() throws MalformedParenthesisException, InvalidOperandException, MalformedTokenException, MalformedDecimalException {
String badExpressionString = null;
try {
Expression badExpression = new Expression(badExpressionString);
fail("Expression not thrown!... | 1 |
private static String[] safeSplit(String cmdString)
{
//This will be converted into an array and returned in the end
ArrayList<String> parts = new ArrayList<String>();
StringBuilder partBuilder = new StringBuilder();
char[] chars = cmdString.toCharArray();
boolean goingThroughVariant = false;
for(... | 7 |
public String toString() {
return "q_" + Integer.toString(getID()) + " at ("
+ Integer.toString(getPoint().x) + ","
+ Integer.toString(getPoint().y) + ")" + " label: "
+ getLabel();
} | 0 |
private BencodeInteger getIntegerValue(String stringValue) throws InvalidFormatException {
try {
Integer result = Integer.valueOf(stringValue);
return new BencodeInteger(result);
} catch (NumberFormatException e) {
throw new InvalidFormatException();
}
} | 1 |
public String toJSONString()
{
StringBuilder sb = new StringBuilder();
sb.append("{");
//boolean rowWithNesting = hasNestedTable();
if ( isHidden() )
sb.append("\"class\":\"hidden\"," );
//else if ( rowWithNesting )
// sb.append(" class=\"nested\"" );
... | 6 |
public void render(GameContainer gc, StateBasedGame sbg, Graphics g){
if(!isGameOver){
if(!isPause){
//draw the bounds of the object
g.draw(boundsArea);
g.setColor(Color.orange);
g.fill(boundsArea);
for(int i = 0; i < groundTiles.size(... | 5 |
public InputManager(){
t = new Timer();
t.schedule(Base.in, 0, 1000 / 60);
} | 0 |
private void handleActionComplete(MqttToken token)
throws MqttException {
final String methodName = "handleActionComplete";
synchronized (token) {
// @TRACE 705=callback and notify for key={0}
log.fine(className, methodName, "705", new Object[] { token.internalTok.getKey() });
// Unblock any waiters... | 7 |
private void removeAxisPairMetricObjects(List<Integer> currentAxisList) {
for(AxisPairMetrics am: metricsList){
int axis1 = am.getDimension1();
int axis2 = am.getDimension2();
for(int index=0; index<currentAxisList.size()-1; index++)
{
if((currentAxisList.get(index)== axis1 && currentAxisList.get(... | 6 |
private void selectionAboutToChange() {
if (mOwner != null) {
mOwner.selectionAboutToChange();
}
} | 1 |
public void set(int i, int j, GameObjectModel go) {
if(i > -1 && j > -1 && i < m_height && j < m_width){
m_board[i * m_width + j] = go;
}
} | 4 |
private void updateBoundryCheck (T p) {
if ((p.getX () - p.r < 0 && p.v.dx < 0)
|| (p.getX () + p.r > width && p.v.dx > 0)) {
p.v.dx = -p.v.dx;
updateNextPosition (p);
}
//v = p.v;
if ((p.getY () - p.r < 0 && p.v.dy < 0)
|| (p.getY () + p.r > height && p.v.dy > 0)) {
p.v.dy = -p.v.dy;
updateN... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final ChangeOfState other = (ChangeOfState) obj;
if (listOfValues == null) {
... | 9 |
public Symbol debug_parse()
throws java.lang.Exception
{
/* the current action code */
int act;
/* the Symbol/stack element returned by a reduce */
Symbol lhs_sym = null;
/* information about production being reduced with */
short handle_size, lhs_sym_num;
/* set up ... | 7 |
private Battlefield() {
heroTurn = new LinkedList<BattleHeroSlots>(); // no turn at first
monsterTurn = new LinkedList<MonsterSlots>(); // no turn for monster at first
} | 0 |
public void showAllBombs(Tile[][] tempField) {
int x, y;
for(x=0; x<10; x++) {
for(y=0; y<10; y++) {
if(tempField[x][y].checkForBomb()) {
try {
Image icon = ImageIO.read(getClass().getResource("bomb.gif"));
tempField[x][y].setIcon(new ImageIcon(icon));
} catch (IOException ex) { }
... | 4 |
public Configuration[] getInitialConfigurations(String input)
{
Configuration[] configs = new Configuration[1];
configs[0] = new MealyConfiguration(myAutomaton.getInitialState(), null, input,
input, ((MooreMachine)myAutomaton).getOutput(myAutomaton.getInitialState()));
retu... | 0 |
public int longestValidParentheses_3(String s) { // solution where indices are stored in the stack
if(s == null || s.length() == 0) return 0;
Stack<Integer> stk = new Stack<Integer>();
int res = 0;
for(int i = 0; i < s.length(); ++i){
char c = s.charAt(i);
if(c == '(') stk.push(i);
else if(c == ')'){
... | 8 |
public static void main(String[] args) {
Visitor ceo = new VisitorCEO();
Visitor a = new VisitorA();
Visitor b = new VisitorB();
Element pa = new PartA();
Element pb = new PartB();
ObjectStructure os = new ObjectStructure();
os.addVisitor(pa);
os.addVisitor(pb);
os.accapt(ceo);
os.accapt(a);
os.a... | 0 |
public void update() {
//Log.print("Actor hp: "+characterSheet.getHP());
if (characterSheet.isDead()) {
flagDelete = true;
}
} | 1 |
@Override
public void processEntity(Entity entity) {
Spatial spatialComponent = entity.getComponent(Spatial.class, true);
/**
* It is assumed, as everywhere (unless explicitly stated) that top left
* is 0,0. We check if either the center x location of the entity is
* within the camera's boundaries, and if... | 4 |
public void setObject(Object obj) {
if(obj != null && obj instanceof BancaExaminadora){
this.banca = (BancaExaminadora)obj;
this.lblTituloValor.setText(
(banca.getDissertacao() != null ? banca.getDissertacao().getTitulo() : ""));
if(ba... | 8 |
private Object toValueI(String name, int[] vals) {
Object orig = parameter.get(name);
if (orig.toString().indexOf('{') > -1) {
// this is an array (hopefully 1dim)
return Conversions.convert(vals, String.class);
} else {
return Integer.... | 1 |
public static void escribirFichero(Cliente x){
float aux_cuenta_corriente=0, aux_cuenta_ahorro=0, aux_penalizacion=0;
try{
if(x.getCunetacorriente()==null){
aux_cuenta_corriente=-1;
}else{
aux_cuenta_corriente=x.getCunetacorriente().consultarSaldo();
}
if(x.getCunetaahorro()==null){
aux_cuenta_ahor... | 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.