text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void renderAllTiles(int z, int x, int y, int z_start, int z_stop) throws IOException {
// find the projected bounds of this tile in osm projection
double[] tile = TileToMercBounds.tileToMercBounds(z, x, y);
// convert the bounds to a jts geometry
Envelope envolope = new Envelope(tile[0], tile[2... | 7 |
public void setFecha(GregorianCalendar fecha) {
this.fecha = fecha;
} | 0 |
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} | 6 |
@Override
public void keyPressed(KeyEvent e) {
switch(e.getKeyCode()){
case(KeyEvent.VK_W) : rocket.player.buttom[0] = true; break;
case(KeyEvent.VK_A) : rocket.player.buttom[1] = true; break;
case(KeyEvent.VK_S) : rocket.player.buttom[2] = true; break;
case(KeyEvent.VK_D) : rocket.player.buttom[3] = true; b... | 4 |
public void calculateExecTime() {
double newExeTime;
double newCost;
dEval = 0;
dTime = 0;
dCost = 0;
for (int i = 0; i < iClass; i++) {
newExeTime = 0;
print("Cost[" + i + "]");
for (int j = 0; j < iSite; j++) {
if (dmAlloc[i][j] != -1) {
if (dmAlloc[i][j] < 1) {
newExeTime = 0;
... | 8 |
private void checkAvailabilityButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAvailabilityButtonActionPerformed
Date checkInDate = checkIn.getDate();
Date checkOutDate = checkOut.getDate();
if (checkInDate != null && checkOutDate != null && !checkInDate.equals(check... | 4 |
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
try {
List<Pays> pp1 = RequetesPays.selectPays();
for (Pays pays : pp1) {
jComboBoxPays.addItem(pays);
}
} catch (SQLException ex) {
... | 2 |
public Bullet handleInput(Camera camera) {
Bullet bullet = null;
if (Gdx.input.isKeyPressed(scheme.Left)) {
player.moveLeft();
}
else if (Gdx.input.isKeyPressed(scheme.Right)) {
player.moveRight();
}
else {
player.stopMoving();
}
if (Gdx.input.isKeyPressed(scheme.Jump)) {
player.jump();
}
... | 5 |
private void checkForUpdates_settingsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkForUpdates_settingsButtonActionPerformed
if (debug)
logger.log(Level.DEBUG, "Setting preference \"checkForUpdates\" from " + settings.checkForUpdatesOnStartup() + " to " + check... | 1 |
@SuppressWarnings("deprecation")
void listen(Function<String> listener) {
if (socket == null) {
println("Cannot operate with a null socket");
return;
} else if (listener == null) {
println("The listener needs to be set");
return;
}
DataInputStream input;
String tmp;
try {
input = new DataIn... | 5 |
@Test
public void insertAndDeleteTest(){
long start = System.currentTimeMillis();
for (int i = 0; i < 1000000; i++){
heap.insert(i);
}
for (int i = 0; i < 1000000; i++){
assertEquals(heap.extract_min().value, i);
}
long end = System.currentTime... | 2 |
public Collection<BookingEntity> getBooking() {
return booking;
} | 0 |
public static boolean isPutChessmen(final ChessBoardEntity b, final ChessmenEntity c, final PositionEntity p) {
boolean result = false;
do {
if (null == c || null == p) {
break;
}
if (!c.isPlayer()) {
// ̋łȂłB
break;
}
if (c.isBoard()) {
// Տ̋łB
break;
}
if (isChessmen(b, p... | 7 |
public static void memberOfEvaluator(Proposition self) {
{ Stella_Object member = Logic.valueOf((self.arguments.theArray)[0]);
Stella_Object collection = Logic.valueOf((self.arguments.theArray)[1]);
if (Proposition.trueP(self)) {
if (Stella_Object.isaP(collection, Logic.SGT_LOGIC_DESCRIPTION) &... | 7 |
@Test
public void resolve() {
int days = daysOfYear(1900);
int count = 0;
for (int year = 1901; year <= 2000; year++) {
for (int mon = 1; mon <= 12; mon++) {
if (days % 7 == 0) {
count++;
}
days += getDaysOfMonth(year, mon);
}
}
print(count);
} | 3 |
@SuppressWarnings("static-access")
public void read(Buffer buf) throws IOException {
// Check if we've finished all the frames.
if (nextImage >= images.size()) {
// We are done. Set EndOfMedia.
System.err.println("Done reading all images.");
buf.setEOM(true);
buf.set... | 4 |
public static void main(String[] args) {
SpaceShipDelegation protector = new SpaceShipDelegation("NSEA Protector");
protector.forward(100);
} | 0 |
public String toString() {
StringBuilder sb = new StringBuilder();
long ms = this.millis;
int ns = this.nanos;
if (ms < 0 || (ms == 0 && ns < 0)) {
sb.append("-");
ms *= -1;
ns *= -1;
}
if (ms > Duration.DAY) {
ms = extract(... | 8 |
public void recruitHero()
{
if (castle.getHero() != null && castle.getHero().isInCastle(castle)) {
QMessageBox.warning(this, "Nie można wynająć bohatera", "W tym zamku znajduje się już inny bohater");
} else if (player.getResource(core.ResourceType.GOLD) < 2500) {
QMessageBox.warning(this, "Nie można wynająć... | 4 |
public Forme getForme() {
return forme;
} | 0 |
final int[] method3042(int i, int i_13_) {
anInt9457++;
int[] is = ((Class348_Sub40) this).aClass191_7032.method1433(0, i);
if (i_13_ != 255)
method3148(true);
if (((Class191) ((Class348_Sub40) this).aClass191_7032).aBoolean2570) {
int i_14_ = 1 + (anInt9463 + anInt9463);
int i_15_ = 65536 / i_14_;
... | 7 |
public void rotate(boolean clockwise) {
int turns;
if (clockwise)
turns = 1;
else
turns = 3;
for (int k = 1; k <= turns; k++) {
boolean sec[][] = new boolean[getHeight()][getWidth()];
for (int i = 0; i < getHeight(); i++) {
for (int j = getWidth() - 1; j >= 0; j--) {
sec[i][getWidth() - 1 ... | 4 |
private void reduceUnits(){
newTimeSecond = totalSeconds;
if ((newTimeSecond <= 60) || (newTimeSecond >= 60)){
newTimeMinute = newTimeSecond / 60;
newTimeSecond = newTimeSecond % 60;
}
if ((newTimeMinute <= 60) || (newTimeMinute >= 60)){
newTimeHour = newTimeMinute / 60;
newTimeMinute = newTimeMi... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
User other = (User) obj;
if (groups == null) {
... | 9 |
protected static void mult_INT_PACK_Data(WritableRaster wr) {
// System.out.println("Multiply Int: " + wr);
SinglePixelPackedSampleModel sppsm;
sppsm = (SinglePixelPackedSampleModel) wr.getSampleModel();
final int width = wr.getWidth();
final int scanStride = sppsm.getScanline... | 4 |
void test() throws InterruptedException,
ExecutionException{
ExecutorService exec = Executors.newCachedThreadPool();
ArrayList<Future<String>> results = new ArrayList<Future<String>>(); //Future 相当于是用来存放Executor执行的结果的一种容器
for (int i = 0; i < 10; i++) {
results.add(exe... | 3 |
public void annuler() throws InvalidArgumentException {
if (prixReserveAtteint() && etatEnchere == EtatEnchere.PUBLIEE)
throw new InvalidArgumentException(
"Prix de réserve atteint. Annulation impossible.");
else if (etatEnchere == EtatEnchere.TERMINEE)
throw new InvalidArgumentException(
"Enchère ... | 7 |
public void run() {
try {
File f = new File ( filename );
MediaLocator locator = new MediaLocator ( f.toURI().toURL());
player = Manager.createPlayer ( locator );
pla... | 2 |
public T getFirst() { return first; } | 0 |
public void enterEnvironmentRecord(String identifier, int offset) {
environmentStack.peek().putSymbolTable(identifier, offset);
} | 0 |
private boolean isControlWord(String line) {
return line != null && (line.length() >= 2 && (line.charAt(0) == '#' && line.charAt(1) != ' '));
} | 3 |
public static void main(String[] args) throws FileNotFoundException {
File videoOut = new File("data/video1_out.mp4");
File videoIn = new File("data/video1.mp4");
// Vytvorim si testovacie video
// List<VideoSection> louderSections = new ArrayList<>();
// louderSections.add(new VideoSection(45L, 120L, TimeUn... | 1 |
public void printCombs(ArrayList<ArrayList<Integer>> comb) {
System.out.println("[");
for (int i = 0; i < comb.size(); i++) {
ArrayList<Integer> curComb = comb.get(i);
System.out.print("[");
for (int j = 0; j < curComb.size(); j++) {
if (j == curComb.size() - 1)
System.out.print(curComb.get(j));
... | 3 |
public int addEntry(Score newScore) {
lastIndex++; //update the index of the last entry in the list
//System.out.println("lastIndex: "+lastIndex);
// check if list's size needs to be increase
if (isFull())
doubleArraySize();
boolean isHighest = false;
boolean done = false;
int currentIndex = lastInd... | 5 |
public AbstractMainframe(Controlador controlador) {
super(controlador);
panel.setLayout(new FlowLayout(FlowLayout.LEADING));
desconectar.setEnabled(false);
frame.setResizable(false);
/* False para iconified, True para o resto */
frame.addWindowStateListener(e -> frame.setVisible(e.getNewState() != JFrame... | 7 |
public void fillDeclarables(Collection used) {
for (int i = 0; i < subExpressions.length; i++)
subExpressions[i].fillDeclarables(used);
} | 1 |
public boolean setNext(Unit unit) {
if (predicate.obtains(unit)) { // Of course, it has to be valid...
Unit first = (units.isEmpty()) ? null : units.get(0);
while (!units.isEmpty()) {
if (units.get(0) == unit) return true;
units.remove(... | 7 |
private void addDiagonalCell (java.util.List<Point> adjoiningCells, Point adjoiningCell, Point parentCell) {
if (isCellOutOfField(adjoiningCell) || isCellWall(adjoiningCell) || isCellClosed(adjoiningCell) || isCellOpened(adjoiningCell)) {
return;
}
java.util.List<Point> checkCells =... | 9 |
private static Object processFunctionResults(final Object binaryOperatorKey,
final Object functionResult)
{
if (binaryOperatorKey.equals(Syntax.OPERATOR_GREATER))
{
return ((Number) functionResult).intValue() == 1 ? Boolean.TRUE
... | 8 |
public boolean canEquip(int slotId, int itemId) {
if (slotId == Equipment.SLOT_CAPE || slotId == Equipment.SLOT_HAT) {
player.getPackets().sendGameMessage(
"You can't remove your team's colours.");
return false;
}
if (slotId == Equipment.SLOT_WEAPON || slotId == Equipment.SLOT_SHIELD) {
int weaponId... | 6 |
public boolean concatenateAligned(BitOutputStream src) {
int bitsToAdd = src.totalBits - src.totalConsumedBits;
if (bitsToAdd == 0) return true;
if (outBits != src.consumedBits) return false;
if (!ensureSize(bitsToAdd)) return false;
if (outBits == 0) {
System.arrayco... | 7 |
private void processCommand(String unprocessedCommand)
{
unprocessedCommand = unprocessedCommand.replaceAll("\\s+", " "); //take out all extra spaces. ("Hello world!" -> "Hello world")
if(unprocessedCommand.length() == 0 || (unprocessedCommand.charAt(0) == ' ' && unprocessedCommand.length() == 1)) //avoi... | 8 |
public synchronized void gridletSubmit(Gridlet gridlet, boolean ack) {
int reqPE = gridlet.getNumPE();
try {
// reject the Gridlet if it requires more PEs than the maximum
if(reqPE > super.totalPE_) {
String userName = GridSim.getEntityName( gridlet.getUserID() );
logger.warnin... | 4 |
public void actionPerformed(ActionEvent e) {
if(e.getSource() == buttonStop){
serial.write(125);
MainWindow mainWindow = new MainWindow(serial, laser1, laser2);
dispose();
timer.stop();
}
if(e.getSource() == buttonIncreaseL1){
serial.write(108);
}
if(e.getSource() == buttonReduceL1){
... | 7 |
private void createMenuBar() {
menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("Menu");
JMenuItem scoresMenuItem = new JMenuItem("Najlepsze wyniki");
JMenuItem loginMenuItem = new JMenuItem("Zaloguj");
JMenuItem registerMenuItem = new JMenuItem("Rejestruj");
JMenu... | 3 |
public void setName(String name)
{
this.name = name;
} | 0 |
public String getVersion() {
return version;
} | 0 |
public static void main(String[] args){
//made a linked list of integers
LinkedList<Integer> myList = new LinkedList();
myList.add(2);
myList.add(3);
for(int i = 5; i<Integer.MAX_VALUE; i=i+2){
int ALSize = myList.size();
boolean isPrime = true;
//while the number is not proved to not be a pri... | 6 |
final int method2426(int i) {
anInt10504++;
if (i != 200)
return 115;
if ((((NpcDefinition) ((Npc) this).definition)
.anIntArray1377)
!= null) {
NpcDefinition class79
= ((Npc) this).definition
.method794(Mob.varbitHandler, -1);
if (class79 != null && ((NpcDefinition) class79).anIn... | 5 |
private String aboutText() {
return
"Small World Agents [1.0] has been produced by the\nMulti Agents " +
"Systems and Simulation (MASS) Group at the University of Leeds, UK. \n\n" +
"It is a working framework for Agent based systems " +
"in which Agents can ... | 0 |
private void setSettingsPanel() {
if (square) {
playersNumber = new JComboBox<String>(new String[]{"1 Player", "2 Players", "3 Players", "4 Players"});
} else {
playersNumber = new JComboBox<String>(new String[]{"1 Player", "2 Players", "3 Players", "4 Players", "5 Players", "6 Players"});
}
playersNumber... | 7 |
public void buildDB(){
Console.line("Building Database\n**********************\n");
for (CorpusSource source : sources){
if (!source.wasRead()){
Console.text(".");
if (source.open()){
while (source.hasNext()){
String sentence = source.readSentence();
//sentence = sentence.replaceAll("[\\... | 9 |
public Move move(boolean[] foodpresent, int[] neighbors, int foodleft, int energyleft) {
MoveInfo moveData = new MoveInfo(foodpresent, neighbors, foodleft, energyleft, lastMove);
preMoveTrack(moveData);
Move move; // placeholder for return value
move = reproduce(moveData);
if (move == null) {
move ... | 9 |
public boolean locationCheck(Locale newLocale) {
if (newLocale == null) {
return false;
} else {
currentLocale = newLocale;
try {
myStack.push(currentLocale);
} catch (Exception ex) {
System.out.println("Stack is full");
}
try {
myQueue.enqueue(currentLocale);
} catch (Exception ... | 3 |
private double desiredDirection() {
if (directions.contains(Direction.UP)) {
if (directions.contains(Direction.RIGHT)) {
return 45;
}
if (directions.contains(Direction.LEFT)) {
return 315;
}
return 0;
}
if (directions.contains(Direction.DOWN)) {
if (directions.contains(Direction.RIGHT)) ... | 8 |
public boolean fGuiCheckObjectNonExistence(String strDesc){
//Delimiters
String[] delimiters = new String[] {":="};
String[] arrFindByValues = strDesc.split(delimiters[0]);
//Get Findby and Value
String FindBy = arrFindByValues[0];
String val = arrFindByValues[1];
... | 9 |
private int countMapFiles()
{
int counter = 0;
CodeSource src = this.getClass().getProtectionDomain().getCodeSource();
if( src != null ) {
URL jar = src.getLocation();
ZipInputStream zip;
try {
zip = new ZipInputStream( jar.openStream());
ZipEntry ze = null;
while((ze = zip.getNextE... | 5 |
private void notifyListeners(ProcessState event) {
for (IProcessComponentListener listener : this.listeners) {
switch (event) {
case EXECUTING:
listener.onExecuting(new ProcessEventArgs(this));
break;
case ROLLBACKING:
listener.onRollbacking(new ProcessEventArgs(this));
break;
case ... | 8 |
public PeanutButterSandwich() {
this.setName("PeanutButterSandwich");
this.setPrice(new BigDecimal(30));
} | 0 |
public TransformType createTransformType() {
return new TransformType();
} | 0 |
public static boolean equals( double[] vec1, double[] vec2 )
{
if ( vec1.length != vec2.length )
return(false);
for ( int i = 0; i < vec1.length; ++i )
if ( vec1[i] != vec2[i] )
return(false);
return(true);
} | 3 |
public static String[] substringsBetween(String str, String open,
String close) {
if (str == null || isEmpty(open) || isEmpty(close)) {
return null;
}
int strLen = str.length();
if (strLen == 0) {
return new String[0];
}
int closeLen = close.length();
int openLen = open.length();
List<... | 8 |
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt(),
k = in.nextInt();
if (k == 0) {
out.println(n == 1 ? 1 : -1);
}
else if (n < 2 || n... | 9 |
private void init() {
// default values
props.put(REPRODUCIBLE_PRNG, new Boolean(reproducible).toString());
props.put(CHECK_WEAK_KEYS, new Boolean(checkForWeakKeys).toString());
props.put(DO_RSA_BLINDING, new Boolean(doRSABlinding).toString());
// 1. allow site-wide override by readin... | 7 |
@Override
public void render(Screen screen) {
switch (dir) {
case NONE:
sprite = Sprite.player;
break;
case UP:
sprite = Sprite.playerUp;
break;
case RIGHT:
sprite = Sprite.playerRight;
... | 6 |
public GraphPoint[] getSelectedPoints() {
ArrayList<GraphPoint> buffer = new ArrayList();
Iterator<Map.Entry<Integer, GraphPoint>> it = points.entrySet().iterator();
GraphPoint bgp;
while (it.hasNext()) {
bgp = it.next().getValue();
if (bgp.getComponent().getSele... | 2 |
public HashSet<ymlReward> getymlRewardsFromHashMap(int questNumber, HashMap<String,Object> map){
//Since there can be different types of the same reward as well as an undefined amount of them... iterate
HashSet<ymlReward> returnMe = new HashSet<ymlReward>();
for (Map.Entry<String, Object> entry : map.entrySe... | 3 |
private void goToTest(GenericLittleMan<?> littleMan) {
final boolean isComplete = littleMan.goToComputerLocation(littleManTest.getComputerLocation());
if (isComplete) {
incrementConditionalActionStep();
}
} | 2 |
public void setApplicationName(String name) {
this.applicationName = name;
} | 0 |
public void visit_iinc(final Instruction inst) {
final IncOperand operand = (IncOperand) inst.operand();
final int index = operand.var().index();
if (index + 1 > maxLocals) {
maxLocals = index + 1;
}
final int incr = operand.incr();
if ((index < 256) && ((byte) incr == incr)) {
addOpcode(Opcode.op... | 3 |
protected void execute() {
processPendingRequests();
Loadable task = null;
try { // it probably won't hurt much not to synchronize this iterator
for (Iterator it = taskPool.iterator(); it.hasNext();) {
if (off || isStopped())
return;
task = (AbstractLoadable) it.next();
if (task == null || !ta... | 9 |
public void addDownServices() {
LinkedList<Integer> list = new LinkedList<Integer>();
//conn.query("select service_id from esri.services si where si.service_id not in " +
// "(select service_id from esri.service_date_uptime where date_trunc('day', localtimestamp) = time);");
conn.query("select service_id fr... | 3 |
public void FecharConexao(){
try{
if (!conbco.isClosed() )
{
conbco.close();
}
}
catch(Exception ex){
}
} | 2 |
@Override
public void train(final Matrix matrix) {
List<List<Double>> data = matrix.getData();
for (int colIndex = 0; colIndex < data.get(0).size(); colIndex++){
if (matrix.getColumnAttributes(colIndex).getColumnType()== ColumnAttributes.ColumnType.CATEGORICAL){
Counter<D... | 7 |
private static final String clean(final String desc) {
final StringBuilder result = new StringBuilder();
int pos = 0;
for (int i = 0; i < desc.length(); i++) {
final char c = desc.charAt(i);
if (c == '\\') {
result.append(desc.substring(pos, i));
pos = i += 2;
} else if (c == '"') {
result.ap... | 9 |
public void savePatient(Patient patient,String action)throws Exception{
log.debug("savePatient Service method called...");
PatientDAO patientDao=new PatientDAOJDBCImpl();
if(action.equals("Save")){
patientDao.addPatient(patient);
}else if(action.equals("Update")){
patientDao.updatePatient(patient);
... | 2 |
private CompilerToken makeToken(final String token, final String state) throws LexicalException {
if (state.equalsIgnoreCase("identifier")) {
return processIdentifier(token);
} else if (state.equalsIgnoreCase("integer")) {
return processInteger(token);
... | 7 |
@Override
public double[] calculateFractal3DWithoutPeriodicity(Complex pixel) {
iterations = 0;
Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel)));
Complex tempz2 = new Complex(init_val2.getPixel(pixel));
Complex[] complex = new Complex[3];
complex[... | 9 |
public int testGetState(){
if(bomb) return Spot.BOMB;
if(flag) return Spot.FLAG;
return getBombCount();
} | 2 |
private void loadShapes(String[] files, final HashMap<Integer, GMTShape> shapes) {
GMTParser gmtpBuildings = new GMTParser() {
@Override
public void processShape(GMTShape shape) {
shapes.put(shape.getID(), shape);
}
};
try {
for (S... | 4 |
public Worker () {
//initial settings
this.iFrom=IFROM;
this.iTo=ITO;
System.out.println(MSG_WELCOME);
//start
this.lifeCycle();
} | 0 |
@Test
public void getConnectedComponentsTestZero() {
City_Graph city_graph2 = new City_Graph();
city_graph2.loadMap("res/singleCity.mp");
City testCity = city_graph2.getCity(0);
VertexSet emptySet = new VertexSet();
assertTrue(city_graph2.getNeighbourhood(testCity).equals(emptySet));
} | 0 |
public double f_to_minimize(double x[]) {
double f,sq1,sq2,sq3,f1,f2,f3,f4,fac,c1,c2,s1,s2;
double theta,x1,x2,x3,x4;
if (id_f_to_min == 0) {
f = x[1]*x[1];
} else if (id_f_to_min == 1) {
sq1 = (x[1] - c)*(x[1] - c);
sq2 = (x[2] - d)*(x[2] - d);
f = sq1 ... | 8 |
public MealyLambdaTransitionChecker()
{
super();
} | 0 |
public RrdDef getRrdDef() throws RrdException {
if (!root.getTagName().equals("rrd_def")) {
throw new RrdException("XML definition must start with <rrd_def>");
}
validateTagsOnlyOnce(root, new String[] {
"path", "start", "step", "datasource*", "archive*"
});
// PATH must be supplied or exception is thro... | 5 |
public static Color getColor ( byte multiplier, byte type ) {
switch ( type ) {
case 0:
switch ( multiplier ) {
case 1:
return new Color ( 170, 100, 0 ) ;
case 2:
return Color.CYAN ;
case 3:
return Color.BLUE ;
default:
... | 7 |
public PhaseId getPhaseId()
{
return PhaseId.RENDER_RESPONSE;
} | 0 |
@Override
public int hashCode() {
int result = parentCategoryId;
result = 31 * result + accountId;
result = 31 * result + id;
result = 31 * result + (headLine != null ? headLine.hashCode() : 0);
result = 31 * result + (text != null ? text.hashCode() : 0);
result = 31 ... | 3 |
public void setFreeColGameObject(String id, FreeColGameObject fcgo) {
if (aiObjects.containsKey(id)) return;
if (!id.equals(fcgo.getId())) {
throw new IllegalArgumentException("!id.equals(fcgo.getId())");
}
if (fcgo instanceof Colony) {
new AIColony(this, (Colony)... | 8 |
@SuppressWarnings("unchecked")
public static Class<?> getClass(Type type) {
if (type instanceof Class) {
return (Class) type;
} else if (type instanceof ParameterizedType) {
return getClass(((ParameterizedType) type).getRawType());
} else if (type instanceof GenericArrayType) {
Type componentType = ((Ge... | 6 |
@Override
public double distribute(TVC newCon) {
int id1 = newCon.getFirewallId1();
int id2 = newCon.getFirewallId2();
List<TVC> conns = new LinkedList<>();
for (TVC c : environment.getConnectionsSortedDown()) {
if ( c.mightBeManagedBy(id1) && c.mightBeManagedBy(id2)) {
conns.add(c)... | 6 |
public static StringBuffer expertiseList(MOB E, HTTPRequest httpReq, java.util.Map<String,String> parms)
{
final StringBuffer str=new StringBuffer("");
if(parms.containsKey("EXPERTISELIST"))
{
final ArrayList<String> theclasses=new ArrayList<String>();
if(httpReq.isUrlParameter("EXPER1"))
{
int num=... | 9 |
public void testLongLargeArrayArraycopy()
{
long[] data = new long[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int startPos = 2;
int length = 8;
LargeArray.setMaxSizeOf32bitArray(1073741824);
LongLargeArray a = new LongLargeArray(data);
LongLargeArray b = new LongLargeArray(2 *... | 4 |
private void initBoutons() {
// Création des boutons
for (int i = 0; i < this.animaux.size(); i++) {
this.boutons.add(i, new JButton() );
this.boutons.get(i).setBackground(java.awt.Color.white);
this.boutons.get(i).setText(this.animaux.get(i).getNom());
th... | 2 |
public void draw(Graphics2D g) {
int offsetX = 0;
for (int i = 0; i < playerLives; i++){
g.drawImage(playerHeadImage, playerLivesX + offsetX, playerLivesY, null);
offsetX += 15;
}
g.drawImage(healthBarImage,healthBarX,healthBarY,null );
offsetX = 0;
for (int i = 0; i < playerHealth; i++){
g.drawIma... | 2 |
public static void compareAndChangeId(int comparedId)
{
if(id<comparedId)
id=comparedId+1;
} | 1 |
public static synchronized HashMap<String, Integer> getUserStock(String uid) {
UserStorageAccess xmlAccessor = new UserStorageAccess();
stocks = xmlAccessor.getUserStocks(uid);
//System.out.println("size of Hashmap : " + stocks.size());
//System.out.println(stocks.containsKey("CCR"));
return... | 0 |
private TreeNode SimpleExpresion() {
TreeNode tmp = AdditiveExpression();
switch (t.id) {
case Constants.EQ:
case Constants.LEQ:
case Constants.LS:
case Constants.GEQ:
case Constants.GT:
case Constants.NEQ:
TreeNode tmp2 = Relop();
tmp2.C1 = tmp;
tmp = tmp2;
tmp.C2 = AdditiveExpression();
... | 7 |
static byte HopperFix(byte data, String kierunek)
{
if (kierunek.equals("right"))
{
if (data == 2) {
return 5;
}
if (data == 4) {
return 2;
}
if (data == 5) {
return 3;
}
if (data == 3) {
return 4;
}
}
else
... | 9 |
private static Key toKey(byte[] key, String algorithm)
throws InvalidKeyException, NoSuchAlgorithmException,
InvalidKeySpecException {
DESKeySpec spec = new DESKeySpec(key);
SecretKey secretKey = new SecretKeySpec(key, algorithm);
if (algorithm.equals(DES)) {
SecretKeyFactory factory = SecretKeyFactory.... | 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.