text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Map<String, Object> getProperties()
{
return properties;
} | 0 |
public static Filter classNameMatches( String regex )
{
if ( regex == null )
{
throw new IllegalArgumentException( "Parameter 'regex' must not be null" );
}
if ( regex.length() == 0 )
{
throw new IllegalArgumentException( "Empty 'regex' not allowed" );... | 2 |
public String setMidiIn(int id)
{
if(_keyboard != null)
{
_keyboard.close();
_keyboard = null;
_midiDevices.setKeyboard(_keyboard);
}
if(id == -1)
{
return "<midi-in>-1</midi-in>";
}
_keyboard = _midiDevices.ge... | 6 |
public void startReceiverThread()
{
new Thread()
{
public void run()
{
String tmp = null;
RadiogramConnection dgConnection = null;
DatagramConnection dgSpamConnection = null;
Datagram dgSpam = null;
... | 4 |
public static void qsHelpTick( int lo, int hi, LinkedList<Stock> d ) {
if ( lo >= hi )
return;
int tmpLo = lo;
int tmpHi = hi;
String pivot = d.get(lo).getTicker();
Stock indPiv = d.get(lo);
while( tmpLo < tmpHi ) {
//first, slide markers in as far as possible without swaps
while( d.get(tmpLo)... | 8 |
public boolean collisionSideHelp(Obstacle[][] obs,int i, int j, int l) {
boolean collide = obs[Math.max(i,0)][j].CollisionBot(); // In case of jump above the roof top limit.
if ((y+height)/Obstacle.getHeight()<0)
return false; // feet above the roof ^^
l += Obstacle.getHeight() / 2; // Why ?
while (l<height)... | 4 |
public void keyReleased(KeyEvent e)
{
switch (e.getKeyCode())
{
case KeyEvent.VK_SPACE: // Start/Stop game
if (timer.isRunning())
timer.stop();
else
timer.start();
break;
case KeyEvent.VK_C: // Clear grid
life.clearG... | 8 |
public void go() {
up = down = left = right = w_key = a_key = s_key = d_key = false;
if(firstGame) {
gameFrame = new JFrame("Dry Ice Climber");
gameFrame.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
gameFrame.setLocationRelativeTo(null);
gameFrame.setDef... | 5 |
@SuppressWarnings("unchecked")
private void registerPacket(EnumProtocol protocol,
Class<? extends Packet> packetClass, int packetID,
boolean isClientbound) {
try {
if (isClientbound) {
protocol.b().put(packetID, packetClass);
} else {
protocol.a().put(packetID, packetClass);
}
Field mapFiel... | 5 |
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
... | 5 |
@Override
public void unInvoke()
{
final Physical P=affected;
super.unInvoke();
if((P instanceof MOB)&&(this.canBeUninvoked)&&(this.unInvoked))
{
if((!P.amDestroyed())
&&(((MOB)P).amFollowing()==null))
{
final Room R=CMLib.map().roomLocation(P);
if(CMLib.law().getLandOwnerName(R).length()==0)... | 9 |
public List<Path> generate() throws IOException {
List<Path> paths = new ArrayList<>();
Map<String, List<Tick>> demomap = new LinkedHashMap<>();
Map<String, String> peeknext = new LinkedHashMap<>();
String previous = null;
for (Tick tick : ticklist) {
List<Tick> ticks;
if (!demomap.conta... | 9 |
private static Map<Integer, Double> addActValue(Bookmark data, Map<Integer, Double> actValues, long baselineTimestamp, boolean resource, double dVal) {
if (!data.getTimestamp().isEmpty()) {
Double newAct = 0.0;
if (resource) {
newAct = 1.0;
} else {
Double recency = (double)(baselineTimestamp - Long.... | 6 |
public int getPieceCount(PieceColor color) {
int count = 0;
for(Piece[] row : pieces) {
for(Piece p : row) {
if(p != null && p.getColor() == color) {
count++;
}
}
}
return count;
} | 4 |
public double[] getTrainingValues(LinkedList<Board> gameHistory, TaTeTi.CellValue player) throws Exception{
double[] trainValues = new double[gameHistory.size()];
Iterator it = gameHistory.iterator();
Board board;
TaTeTi.CellValue oponent = player.equals(TaTeTi.CellValue.X) ? TaTeTi.Cell... | 9 |
protected static boolean addToZip(String absolutePath, String relativePath, String fileName, ZipOutputStream out) {
File file = new File(absolutePath + File.separator + fileName);
System.out.println("Adding \"" + absolutePath + File.separator + fileName + "\" file");
if (file.isHidden())
... | 6 |
@Override
public void playMonumentCard(IPresenter presenter) {
MoveResponse response=presenter.getProxy().playMonumentCard(presenter.getPlayerInfo().getIndex(), presenter.getCookie());
if(response != null && response.isSuccessful()) {
presenter.updateServerModel(response.getGameModel());
}
else {
Syst... | 2 |
public Intersection getClosest(Ray r) throws Exception {
Intersection closest = null;
for (Entity o : objects) {
Intersection p = o.findIntersect(r);
if (p == null) {
continue;
}
if (closest == null) {
closest = p;
continue;
}
if (p.getDistance() < closest.getDistance()) {
closest ... | 4 |
@Override
public boolean onRead(ByteBuffer sslBuffer)
{
logger.debug("Reading {}", sslBuffer);
int bufferSize = sslEngine.getSession().getApplicationBufferSize();
ByteBuffer buffer = sslByteBuffers.acquire(bufferSize, false);
try
{
out: while (handshaking)
... | 8 |
public String getAsset_id() {
return asset_id;
} | 0 |
public static void main(String[] args) {
game = new Game();
Scanner scanner = new Scanner(System.in);
while(!game.isGameOver()) {
System.out.println(game.toString());
int chosenint;
for (chosenint = -10;
chosenint >= Direction.values().len... | 5 |
public void setFrontRightThrottle(int frontRightThrottle) {
this.frontRightThrottle = frontRightThrottle;
if ( ccDialog != null ) {
ccDialog.getThrottle2().setText( Integer.toString(frontRightThrottle) );
}
} | 1 |
public CommandFactory() throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException {
try(InputStream in = CommandFactory.class.getResourceAsStream("commands.properties")){
Properties p = new Properties();
Reader reader1 = new InputStreamReader(in);
... | 3 |
public Packet decompress(Packet packet, PassthroughConnection ptc) {
int stripes = packet.getInt(14) >> 1;
int length = packet.getInt(18 + (stripes << 3));
Packet newPacket = packet.clone(fm);
byte[] buffer = newPacket.buffer;
if(length > bufferLength - 50) {
return null;
}
for(int cnt = 0; c... | 7 |
public static Tile getTileAt(int x, int y, World world) {
List<Tile> tiles = world.tiles;
for (int i = 0; i < tiles.size(); i++) {
if (tiles.get(i).position.x == x && tiles.get(i).position.y == y) {
return tiles.get(i);
}
}
return null;
} | 3 |
public long getLong(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).longValue()
: Long.parseLong((String) object);
} catch (Exception e) {
throw new JSONException("JSONArray["... | 2 |
public static ArrayList<Kill> findAttacker(ArrayList<Kill> killboard,
String attacker) {
ArrayList<Kill> resultBoard = new ArrayList<Kill>();
for (Kill K : killboard) {
ArrayList<Pilot> attackingPilots = K.gettAttackingPilots();
for (Pilot P : attackingPilots) {
if (P.findAttribute(attacker)) {
r... | 3 |
public Long getId() {
return id;
} | 0 |
private static void group(String regex) {
for (int i = listt.size() - 1; i >= 0; i--) {
Tree t = listt.get(i);
if (!t.isLeaf() && t.text.matches(regex)) {
sortlist.add(t);
fifter(t.getPid());
}
}
for (Tree t : sortlist) {
if (t.isLeaf()) {
List<Tree> tt = new ArrayList<Tree>();
sortMa... | 7 |
private static boolean isPrimitiveOrString(Object target) {
if (target instanceof String) {
return true;
}
Class<?> classOfPrimitive = target.getClass();
for (Class<?> standardPrimitive : PRIMITIVE_TYPES) {
if (standardPrimitive.isAssignableFrom(classOfPrimitive)) {
return true;
... | 5 |
public void generateAllRules() {
for (Entry<Integer, List<ItemSet<V>>> entry : frequentItemSets
.entrySet()) {
// we only do this for itemsets larger 1, it'd be kind of a boring
// rule otherwise now, wouldn't it
if (entry.getKey() > 1) {
System.out.println("Generating rules for level: "
+ entr... | 4 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Knooppunt other = (Knooppunt) obj;
if (this.rij != other.rij) {
return false;
}
... | 4 |
public static void main(String[] args) {
int personCount = 20;
LiftView liftView = new LiftView();
Monitor monitor = new Monitor(liftView);
Person[] persons = new Person[personCount];
for (int i = 0; i < personCount; i++) {
persons[i] = new Person(monitor);
... | 1 |
private String g_idxname( String f )
{
int l = f.length();
String iext = (( l>4 && f.charAt(l-4) == '.' ) ? f.substring(l-3) : "" );
if( !iext.toLowerCase().equals("idx") ) f += "."+ (ext=="dbf" ? "idx" : "IDX");
return f;
} | 4 |
static public void main(String argv[]) {
try {
String name;
if (argv.length == 1) {
name = argv[0];
} else {
name = "WebColor_Generator.txt";
}
ComplexSymbolFactory csf = new ComplexSymbolFactory ();
Lexer l = new Lexer(new FileReader(name));
l.setSymbolFacto... | 2 |
public void updateRow(int index, Object[] array) {
// data[rowIndex][columnIndex] = (String) aValue;
EntityTransaction userTransaction = manager.getTransaction();
userTransaction.begin();
People updateRecord = peopleService.updatePeople((String) array[0],
(String) array[1], (String) array[2], (String) array... | 1 |
public void insert(int index, String stringItem, Image imageItem) {
if (index > size() || index < 0)
throw new IndexOutOfBoundsException();
ScmDeviceLabel label = new ScmDeviceLabel("item", null, true);
label.selectButtonRequired = true;
label.setText(stringItem);
if ... | 5 |
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_LEFT) { //Presiono flecha izquierda
direccion = 3;
mueveJohn = true;
} else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { //Presiono flecha derecha
direccion = 4;
mueveJohn = true;
... | 9 |
public static MethodSlot stellaFunctionFromProcedure(ComputedProcedure procedure) {
if (procedure.procedureFunction != null) {
return (procedure.procedureFunction);
}
{ Symbol procedurename = procedure.procedureName;
MethodSlot stellafunction = null;
if (procedurename == null) {
p... | 6 |
@Override
public double[][] updateVelocities(){
assert(neighbourhood != null && velocities != null && position != null);
double constrictionCoefficient = calculateConstrictionCoefficient();
calculateVelocities();
for(int i = 0; i < velocities.length; i++){
for(int k = 0; k < velocities[i].length; k++)... | 4 |
public String monthAdd(String field)
{
String newField = " ADD ";
String number = "";
for(int i = 1; i <= field.length(); i++)
{
if(isNumber(field.substring(i - 1, i)))
{
number = number + field.substring(i - 1, i);
}
... | 8 |
private ByteBuffer readStream(ByteBuffer buf, PDFObject dict) throws IOException {
// pointer is at the start of a stream. read the stream and
// decode, based on the entries in the dictionary
PDFObject lengthObj = dict.getDictRef("Length");
int length = -1;
if (lengthObj != nul... | 3 |
@Override
public Card playTurn(Pile hand, Pile playedCards,
int playerIndexOfWhoStarted) {
// TODO (right now, for the purpose of testing, return any card in hand)
// [Strategy]
// Examine what Cards have been played, and by which Player
// (playedCards is designed such that the first Card in the Pile is th... | 3 |
public static byte[][] generateSubKeys(byte[] key) {
byte[] sourceCD = key;
// Splitst de source array in twee tabellen (C, D)
byte[] permutatedBlock = ByteHelper.permutFunc(sourceCD, permutatieTabel1);
byte[] C = getFirstHalf(permutatedBlock);
byte[] D = getSecondHalf(permutate... | 1 |
@EventHandler
public void onReload(ServerCommandEvent e){
if(e.getCommand().equalsIgnoreCase("reload")){
for(Player p : Bukkit.getOnlinePlayers()){
p.kickPlayer("[RP] Plugin is reloading!");
}
}
} | 2 |
void radb2(final int ido, final int l1, final double in[], final int in_off, final double out[], final int out_off, final int offset) {
int i, ic;
double t1i, t1r, w1r, w1i;
int iw1 = offset;
int idx0 = l1 * ido;
for (int k = 0; k < l1; k++) {
int idx1 = k * ido;
... | 7 |
private LuaValue push_onecapture(int i, int soff, int end) {
if (i >= this.level) {
if (i == 0) {
return s.substring(soff, end);
} else {
return error("invalid capture index");
}
} else {
int l = clen[i];
if (l == CAP_UNFINISHED) {
return error("unfinished capture");
}
i... | 4 |
private static List<PolygonP> transformPointsToPolygon(List<Point[]> polygonPointList){
List<PolygonP> polygons = new ArrayList<PolygonP>();
for(Point[] polygonPoints : polygonPointList){
int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE, height = 0;
for(Point point : polygonPoints){
if(point.y >... | 9 |
public void doSomething() {
System.out.println("共通処理 " + LoggerUtils.getSig());
strategy.logic1();
strategy.logic2();
} | 0 |
private static Source toSource(Object xml) throws IOException {
if(xml==null)
throw new IllegalArgumentException("no XML is given");
if (xml instanceof String) {
try {
xml=new URI((String)xml);
} catch (URISyntaxException e) {
xml=new ... | 9 |
public Object showInfoTableContent(String listName, String conditions) {
if (!(listName.equals("student_list") || listName.equals("login_list") || listName
.equals("log_list"))) {
listName = "teacher_list;" + listName.split("_")[0];
}
String command2 = "show;" + listName + ";" + conditions;
ArrayList<Str... | 5 |
public void add(Production production) {
String lhs = production.getLHS(), rhs = production.getRHS();
// Does the RHS already have a unique mapping?
if (rhsToLhs.containsKey(rhs))
throw new IllegalArgumentException(rhs
+ " already represented by " + rhsToLhs.get(rhs));
// Add the production.
Se... | 2 |
public static final char next (final int row, final int col,
final char[][] map) {
initMovesRecord(map);
final GameSimulation initGame = new GameSimulation(map);
final NodeForExhaust initNode =
new NodeForExhaust(initGame, SEARCH_DEPTH);
final ArrayList<NodeFo... | 6 |
public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... | 8 |
public static void main(String[] params) {
String cp = System.getProperty("java.class.path", "");
cp = cp.replace(File.pathSeparatorChar, Decompiler.altPathSeparatorChar);
String bootClassPath = System.getProperty("sun.boot.class.path");
if (bootClassPath != null)
cp += Decompiler.altPathSeparatorChar
+... | 9 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLayeredPane2 = new javax.swing.JLayeredPane();
jLabel1 = new javax.swing.JLabel();
val_token = new javax.swing.JTextField();
... | 1 |
public Codebook getMostInformativeSubset() {
// Get distance matrix for all basis vectors.
int numVects = basisVectors.getColumnDimension();
double[][] proximity = new double[numVects][];
for(int i = 0; i < numVects; i++){
proximity[i] = new double[i+1];
for(int j = 0; j < i; j++){
proximity[i][j] ... | 6 |
protected com.akamon.slots.model.SymbolSet ParseSymbolSet(SymbolSet xmlSymbolSet) throws SlotModelException {
com.akamon.slots.model.SymbolSet modelSymbolSet = new com.akamon.slots.model.SymbolSet(xmlSymbolSet.name);
for(NaturalSymbol xmlNaturalSymbol : xmlSymbolSet.getNaturalSymbol())
{
... | 6 |
public static void idlOutputAllUnitsToFile(String sourcefile) {
{ String codeoutputfile = Stella.idlMakeCodeOutputFileName(sourcefile);
OutputFileStream codeoutputstream = OutputFileStream.newOutputFileStream(codeoutputfile);
Cons globals = Stella.NIL;
Cons methods = Stella.NIL;
Cons verbati... | 8 |
public void setUserObject(Object userObject) {
this.userObject = userObject;
} | 0 |
public static void main(String[] args) throws IOException {
BufferedReader buf = new BufferedReader(
new InputStreamReader(System.in));
String line = "";
StringBuilder sb = new StringBuilder();
int f = 0;
d: do {
line = buf.readLine();
if(line==null || line.length()==0)
break d;
int c = Integ... | 4 |
private void resetCanBeAvail(final ExprInfo exprInfo, final Phi phi) {
phi.setCanBeAvail(false);
final Iterator blocks = cfg.nodes().iterator();
// For each phi whose operand is at
while (blocks.hasNext()) {
final Block block = (Block) blocks.next();
final Phi other = exprInfo.exprPhiAtBlock(block);
... | 6 |
public boolean isFlowerOut(Graph a_graph)
{
//First, see this node.
for(int i = 0; i < m_enemies.size(); ++i)
{
if(m_enemies.get(i).m_type == Sprite.KIND_ENEMY_FLOWER)
{
return true;
}
}
//If not, I have neighbors IN THE SA... | 9 |
@Override
public boolean onBlockActivated(
World world, int x, int y, int z, EntityPlayer player, int i, float j, float k, float l
)
{
if (!world.isRemote)
{
TileEntity te = world.getTileEntity(x, y, z);
if (te == null || player.isSneaking())
r... | 3 |
private boolean isValidIdentityDiscCoverage(Grid grid) {
final int identityDiscCount = getIdentityDiscsOfGrid(grid).size();
if (identityDiscCount * 100 / grid.gridSize() <= 2)
return true;
return false;
} | 1 |
public static Map<AnagramWord, String> findAnagrams(File wordFile) {
Map<AnagramWord, String> anagramList = new HashMap<AnagramWord, String>();
List<AnagramWord> wordList = extractWords(wordFile);
for (AnagramWord word : wordList) {
if (anagramList.containsKey(word)) {
String anagram = anagramList.get(w... | 4 |
private List<Keyword> keywordsFromType(KeywordType type, List<Keyword> keywords) {
List<Keyword> res = new ArrayList<Keyword>();
if (keywords == null) {
return res;
}
for (Keyword keyword : keywords) {
if (keyword.getKeywordData().getType().equals(type)) {
res.add(keyword);
}
}
return res;
} | 3 |
SpellGroup getSpellGroup(String strName)
{
SpellGroup grpStore;
for (int i=0;i<vctSpellGroups.size();i++)
{
grpStore = (SpellGroup)vctSpellGroups.elementAt(i);
if (strName.equalsIgnoreCase(grpStore.strName))
{
return grpStore;
}
}
try
{
grpStore = new SpellGroup(strName);
RandomAccess... | 7 |
public int edmons_karp(int s, int t) {
int u, e;
mf = 0;
this.s = s;
Arrays.fill(p, -1);
while (true) {
f = 0;
Queue<Integer> q = new LinkedList<Integer>();
int[] dist = new int[V];
Arrays.fill(dist, INF);
dist[s] = 0;
q.offer(s);
Arrays.fill(p, -1);
while (!q.isEmpty())... | 7 |
public void setDisplayOptions (int ordering, int nameForm, int direction) {
// Only update if something has changed.
if (
(currentDisplayOrdering != ordering) ||
(currentDisplayNameForm != nameForm) ||
(currentDisplayDirection != direction)
) {
// store the new values.
currentDisplayOrdering =... | 3 |
public HBox initHeader(String titleText) {
HBox header = new HBox();
header.setAlignment(Pos.CENTER_LEFT);
header.getStyleClass().add("popUpHeader");
header.setPrefHeight(28);
Button closeBtn = new Button();
closeBtn.getStyleClass().add("close-button");
closeBtn.setPrefSize(16, 16);
closeBtn.setMinSize... | 0 |
public String insertionSort2(String a) {
char[] arr = a.toCharArray();
char tmp;
for (int i = 1; i < arr.length; i++) {
for (int j = i; j > 0; j--) {
if (arr[j] < arr[j - 1]) {
tmp = arr[j];
arr[j] = arr[j - 1];
arr[j - 1] = tmp;
} else
break;
}
}
return new String(arr);
} | 3 |
public static String platformToLineEnding(String platform) {
if (platform.equals(PLATFORM_MAC)) {
return LINE_END_MAC;
} else if (platform.equals(PLATFORM_WIN)) {
return LINE_END_WIN;
} else if (platform.equals(PLATFORM_UNIX)) {
return LINE_END_UNIX;
} else {
return LINE_END_DEFAULT;
}
} | 3 |
@Override
public void moveItem(String fromPath, String toPath) throws ContentRepositoryException, IOException {
File from = new File(rootDir, fromPath);
File to = new File(rootDir, toPath);
if (from.isDirectory()) {
if (to.isDirectory()) {
FileUtils.moveDirectoryToDirectory(from, to, false);
} else {
... | 3 |
public static void StartingHall() {
currentRoomName = "Starting Hall";
currentRoom = 1;
RoomDescription = "The room is small, square and made of solid stone. It is cold and there is a ladder " +
"going up through a hatch.";
} | 0 |
public static void unregisterFrame(EnvironmentFrame frame) {
try {
fileToFrame.remove(getPath(frame.getEnvironment().getFile()));
} catch (NullPointerException e) {
// The environment doesn't have a file.
}
environmentToFrame.remove(frame.getEnvironment());
// If there are no other frames open, prompt ... | 2 |
@Override
public Border getBorderStyle(Side side)
{
switch (side)
{
case TOP:
return topBorder;
case LEFT:
return leftBorder;
case BOTTOM:
return bottomBorder;
case RIGHT:
return right... | 4 |
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://... | 6 |
public synchronized void actualiza(long tiempoTranscurrido){
if (cuadros.size() > 1){
tiempoDeAnimacion += tiempoTranscurrido;
if (tiempoDeAnimacion >= duracionTotal){
tiempoDeAnimacion = tiempoDeAnimacion % duracionTotal;
indiceCuadroActual = 0;
}
while (tiempoDeAnimacion > getCuadro(ind... | 3 |
public static final void main(String... args) {
String bigNumber = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722... | 5 |
private void createTSPFile(int dimension) throws IOException
{
FileWriter writer = new FileWriter(path, false);
PrintWriter printer = new PrintWriter(writer);
printer.printf("%s" + "%n", "NAME: " + path);
printer.printf("%s" + "%n", "TYPE: TSP");
printer.printf("%s" + "%n", "... | 3 |
public ArrayList<ArrayList<Integer>> permuteUnique(int[] num) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
if (num.length == 0)
return result;
if (num.length == 1) {
ArrayList<Integer> onePermute = new ArrayList<Integer>();
onePermute.add(new Integer(num[0]));
result.... | 6 |
public void crearGrups(FitxerJugadorsOut espases, FitxerJugadorsOut oros, FitxerJugadorsOut copes, FitxerJugadorsOut bastos) {
try {
Jugador j = (Jugador)ois.readObject();
while(!j.esCentinela()) {
switch(j.getEquip()) {
case ESPASES:
... | 7 |
public int[] getRoomCoords(MansionArea room) {
int[] coords = {-2, -2};
if(room.equals(start)) {
coords[0] = -1;
coords[1] = -1;
}else {
for(int i=0; i<grid.length; i++) {
for(int j=0; j<grid[0].length; j++) {
if(room.equals(grid[i][j])) {
coords[0] = i;
coords[1] = j;
}
}
... | 4 |
public void incluirNoFim(ContaCorrente conta)
{
if(this.quantasContas >= this.capacidade)
this.aContas[this.capacidade-1] = conta;
else
this.aContas[this.quantasContas] = conta;
this.quantasContas ++;
} | 1 |
public TriTileCoord pointToCoord(Point2D point, TriTileDimension dim) {
final int section_x = (int) (point.getX() / (dim.getSide() / 2.0));
final int sectionPxl_x = (int) (point.getX() % (dim.getSide() / 2.0));
final int coord_y = (int) (point.getY() / dim.getHeight());
final int section... | 7 |
private JSON urlfetch(URI uri, int protocol, Map<String, String> headers, CharSequence content, boolean sign) {
JSON result = null;
try {
HttpClient httpclient = new DefaultHttpClient();
HttpRequestBase method = null;
if (protocol == GET) {
method = new HttpGet(uri);
} else {
... | 9 |
public static void main(String args[]) throws NumberFormatException, IOException {
int i = 0;
int N = 0;
BufferedReader ob = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter value for N");
N = Integer.parseInt(ob.readLine());
int arr[] = new int[N];
Scanner sc=new Scanner(... | 3 |
@Override
public boolean equals(Object innyObiekt) {
if (innyObiekt == null) {
return false;
}
if (innyObiekt == this) {
return true;
}
if (!(innyObiekt instanceof Towar)) {
return false;
}
Towar innyTowar = (Towar) innyObi... | 6 |
public void setInterfaces(String[] nameList) {
cachedInterfaces = null;
if (nameList != null) {
int n = nameList.length;
interfaces = new int[n];
for (int i = 0; i < n; ++i)
interfaces[i] = constPool.addClassInfo(nameList[i]);
}
} | 2 |
public static void quick(List<Element> list, int start, int end) {
int i = start;
int j = end;
int temp;
// select pivot
int pivot = list.get((start + end) / 2).getValue();
do {
while (list.get(i).getValue() < pivot) {
temp = list.get(i).getNu... | 6 |
public ShellLink setCMDArgs(String s) {
if (s == null)
header.getLinkFlags().clearHasArguments();
else
header.getLinkFlags().setHasArguments();
cmdArgs = s;
return this;
} | 1 |
private void jMenuAtividadesAtrasadasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuAtividadesAtrasadasActionPerformed
if (usuarioLogado.getTipo().equals("Gerente")) {
this.atividadesAtrasadas();
} else {
JOptionPane.showMessageDialog(null, "Você não pos... | 1 |
@Override
public Node getNode() {return node;} | 0 |
private static void initRotate(Composite inComposite, int heightHint) {
final Composite toolbar = new Composite(inComposite, SWT.BORDER);
final Composite imageContainer = new Composite(inComposite, SWT.BORDER);
GridData toolbarGridData = new GridData(GridData.FILL_HORIZONTAL);
toolbarGridData.grabExcessHorizon... | 1 |
public String[] getParameterValues(String parameter) {
String[] values = super.getParameterValues(parameter);
if (values==null) {
return null;
}
int count = values.length;
String[] encodedValues = new String[count];
for (int i = 0; i < count; i++) {
... | 2 |
protected String toJSONFragment() {
StringBuffer json = new StringBuffer();
boolean first = true;
if (isSetSubscriptionId()) {
if (!first) json.append(", ");
json.append(quoteJSON("SubscriptionId"));
json.append(" : ");
json.append(quoteJSON(getSub... | 8 |
public GraphPanel getGraphPanel() {
return graphPanel;
} | 0 |
private Point getOrigin(Dimension size, Container target) {
Point origin = new Point();
if (anchor == NORTH_WEST) {
origin.x = 0;
origin.y = 0;
}
else if (anchor == NORTH) {
origin.x = ((target.getWidth() - size.width) / 2);
origin.y = 0;
... | 9 |
public static CharacterStorageInventory create(){
if(storageInventory == null){
storageInventory = new CharacterStorageInventory();
}
return storageInventory;
} | 1 |
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.