text stringlengths 14 410k | label int32 0 9 |
|---|---|
public String toString(){
String res = new String();
if(msg != null)
res += msg;
if(codErr != null)
res += !res.isEmpty() ? " - " + codErr : codErr;
if(sourceException != null)
res += !res.isEmpty() ? "\n" + sourceException : sourceException;
return res;
} | 5 |
public ArrayList<File> indexSearch(String searchPath, String searchKey) {
ArrayList<File> matches = new ArrayList<File>();
for(File searchSubject : indexFiles(searchPath)) {
if(searchSubject.isDirectory()) {
for(File searchSubjectSub : indexSearch(searchSubject.getAbsolutePath(), searchKey)) ... | 8 |
private void playlistEditMenu() {
System.out.println(" Edit Menu ");
System.out.println("1. |Create a playlist |");
System.out.println("2. |Add song to a playlist |");
System.out.println("3. |Delete a playlist |");
System.out... | 5 |
public CtClass getType() throws NotFoundException {
int type = etable.catchType(index);
if (type == 0)
return null;
else {
ConstPool cp = getConstPool();
String name = cp.getClassInfo(type);
return thisClass.getClassPool().getCtClass(name);
... | 1 |
public void draw(Graphics2D g, Player player) {
int Px = player.getScreenXpos()/32; //get row number
int Py = (player.getScreenYpos()/32);
int arroundX = 16;
int arroundY = 10;
int someX = Px-arroundX;
int someXMax = Px+arroundX;
int someY = Py-arroundY;
int someYMax = Py+arroundY;
for(int row ... | 7 |
@Override
public Object promptForAnswer() {
HashMap<Integer, Integer> userAnswer = new HashMap<Integer, Integer>();
for (int i=1; i<=col1Choices.size(); i++){
int choice = InputHandler.getInt("Which item in column 2 matches item "+i+" from column 1?");
userAnswer.put(i, choice);
}
return userAnswer;
} | 1 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | 9 |
public static SignalAspect fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length)
return SignalAspect.RED;
return VALUES[ordinal];
} | 2 |
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
Player player = (Player) table.getValueAt(row, PlayersTable.PLAYER_COLUMN);
NationType nationType = ((Nation) table.getValueAt(row, PlayersTable.NATION_COL... | 6 |
public void add(UnitsValue<?> other) {
mValue += mUnits.convert(other.mUnits, other.mValue);
} | 1 |
*/
public boolean processAtSampling(final String line) {
if (line == null) {
return false;
}
final Matcher matcherBegin = this.patternBegin.matcher(line);
final Matcher matcherEnd = this.patternEnd.matcher(line);
final Matcher matcherCri... | 7 |
public void randTestQual(int numTests, int lenMask, long seed) {
Random rand = new Random(seed);
for( int t = 0; t < numTests; t++ ) {
String seq = "", qual = "";
int len = (rand.nextInt() & lenMask) + 10; // Randomly select sequence length
seq = randSeq(len, rand); // Create a random sequence
qual = r... | 3 |
@Override
public void setPosition( float x, float y, float z )
{
super.setPosition( x, y, z );
// Make sure OpenAL information has been created
if( sourcePosition == null )
resetALInformation();
else
positionChanged();
// put the ... | 5 |
public void remove(T data) throws Exception {
Node<T> currNode;
Node<T> prevNode;
if (head == null) {
throw new ListEmptyException();
} else {
// find the node with the data in it
// adjust the links so the Node is removed from the chain of Nodes
currNode = head;
prevNode = head;
while (currNo... | 4 |
public void Init(ContentManager manager) {
initBlocks(manager.getBlockManager());
initPackets(manager.getPacketManager());
} | 0 |
public void actionPerformed(ActionEvent event) {
frame.close();
} | 0 |
private final void remove(int[] cursorArray) {
if (cursorArray[1] < cursorArray[2]) {
if (this.head > this.tail) {
copy();
}
final int length = length();
System.arraycopy(this.content[this.cIdx], this.head,
this.content[this.cIdxNext], StringBuilder.PATTERN_SIZE,
cursorArray[1]);
System.a... | 8 |
@EventHandler
public void PlayerBlindness(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getPlayerConfig().getDouble("Player.Blind... | 6 |
public boolean checkRow(int row)
{
int i = 0, j = 0, count = 0;
for(i = 1; i < 10; i++)
{
count = 0;
for(j = 0; j < 9; j++)
{
if(i == Integer.parseInt(entries[row][j].getText()) )
{
count++;
}
if( count >= 2)
{
System.out.println("checkRow() returned false at i: " + row + ... | 4 |
@Override
public String getVersion() {
return("*");
} | 0 |
private synchronized void dequeue(PacketScheduler sched)
{
Packet np = sched.deque();
// process ping() packet
if (np instanceof InfoPacket) {
((InfoPacket) np).addExitTime( GridSim.clock() );
}
if (super.reportWriter_ != null) {
super.write("dequeui... | 4 |
protected void touchedBy(Entity entity) {
if (entity instanceof Player && pushTime == 0) {
pushDir = ((Player) entity).dir;
pushTime = 10;
}
} | 2 |
public String readPidFromFile(String targetDirectory) throws IOException {
// PID to return
String pid = "";
// Buffered Reader
BufferedReader br = null;
File pidFile = new File(targetDirectory + PID_FILE_NAME);
if (pidFile.exists()) {
try {
// Setup buffered reader
br = new BufferedReader(... | 5 |
private static void Optimize(DiffData data) {
int startPos, endPos;
startPos = 0;
while (startPos < data.Length) {
while ((startPos < data.Length) && (data.modified[startPos] == false))
startPos++;
endPos = startPos;
while ((endPos < data.Length) && (data.modified[en... | 7 |
public void generateUpdatedEntries()
{
_modifiedEntries.clear();
HashSet<String> newEntries = new HashSet<String>();
for (int i = 0; i < 5; i++)
{
OrderEntry orderEntry = null;
int action = _random.nextInt(100);
if (_orderEntries.size() == 0 || ... | 7 |
protected void updatePeProvisioning() {
//Log.printLine("dans updatePeProvisioning");
getPeMap().clear();
for (Pe pe : getPeList()) {
pe.getPeProvisioner().deallocateMipsForAllVms();
}
Iterator<Pe> peIterator = getPeList().iterator();
Pe pe = peIterator.next();
PeProvisioner peProvisione... | 7 |
public static String checkLevels(double level) {
String message = "";
if (level < 0.0) {
message = " below acceptable range.";
}
if (level > 1.0) {
message = " above acceptable range.";
}
return message;
} | 2 |
public static void main(String[] args) {
try {
FitnessCalc1 FitnessFunc;
String testfile = "C:\\Users\\Vincent\\Documents\\GitHub\\Exercises\\testFiles\\A";
/*Initialisation*/
FitnessFunc = new DCS();
Algorithm.setMaximization(true);
Algor... | 9 |
public OrgaEinheit getOrgaEinheitvonBezeichnung(String bezeichnung){
OrgaEinheit rueckgabe = null;
try {
ResultSet resultSet = db.executeQueryStatement("SELECT * FROM OrgaEinheiten WHERE OrgaEinheitBez = '" + bezeichnung + "'");
if(resultSet.next())
rueckgabe = new OrgaEinheit(resultSet, db, this);
re... | 2 |
void fill( Point a, Point b, Point c, Point a0, Point b0, Point c0 ) {
int x0 = (int)Math.floor( Util.minX(a, b, c) ), x1 = (int)Math.ceil( Util.maxX(a, b, c) );
int y0 = (int)Math.floor( Util.minY(a, b, c) ), y1 = (int)Math.ceil( Util.maxY(a, b, c) );
x0 = Math.max(x0, 0); x1 = Math.min(x1, width - 1 );
y0 = ... | 8 |
protected OgexTrack toTrack( DataStructure ds, Map<BaseStructure, Object> index ) {
OgexTrack result = new OgexTrack();
BaseStructure target = ds.getProperty("target");
Object resolved = index.get(target);
if( resolved == null ) {
// Need to figure out what it is and create... | 8 |
private static String xmlTrim(String text)
{
int start = -1, end = text.length();
while (start < text.length() && isWhitespace(text.charAt(++start)));
while (end > -1 && isWhitespace(text.charAt(--end)));
if (end != -1)
{
return text.substring(st... | 5 |
public void handleInput() {
if (Keys.isPressed(Keys.ESCAPE))
gsm.setPaused(true);
if (player.getHealth() == 0)
return;
player.setUp(Keys.keyState[Keys.UP]);
player.setDown(Keys.keyState[Keys.DOWN]);
player.setLeft(Keys.keyState[Keys.LEFT] || Keys.keyState[Keys.A]);
player.setRight(Keys.keyState[Keys.R... | 6 |
public ArrayList<Integer> readGold(ID tid) {
ArrayList<Integer> gtags = null;
BufferedReader br = null;
String line;
try {
gtags = new ArrayList<Integer>();
br = new BufferedReader(new FileReader(gold));
while ((line = br.readLine()) != null) {
... | 6 |
public boolean nodesWithSum(int sum, treeNode root) {
int[] newArray = new int[this.nodeCount];
addToArray(this.root, newArray, 0);
int indexClosetLarger = newArray.length;
int lowIndex = 0;
int matchIndex = -1;
int matchCount = 0;
// find the closet number larger than sum
for (int i = 0; i < newArray.... | 7 |
@Override
public T build(Map<Class<?>, ClassBuilder<?>> how) {
Constructor<?>[] constructors = underConstruction.getConstructors();
Constructor<?> constructorElegido = this.elegirConstructor(constructors);
if(constructorElegido != null){
try {
return (T)constructorElegido.newInstance(this.getObjects... | 6 |
public void Draw(Graphics2D g2d, Point mousePosition) {
//draws according to Framework canvas size
//g2d.drawImage(backgroundImg, 0, 0, Framework.frameWidth, Framework.frameHeight, null);
//draw moving bg???????
movingBg.Draw(g2d);
// Draws the course objects
for (int ... | 4 |
public static Cons translateLoomPartitions(Stella_Object partitions, boolean exhaustiveP, Symbol parentconcept) {
{ Cons axioms = Stella.NIL;
Cons partitionList = Stella.NIL;
if (!Stella_Object.consP(partitions)) {
partitions = Cons.consList(Cons.cons(partitions, Stella.NIL));
}
if ... | 6 |
@EventHandler
public void WitherInvisibility(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Wither.In... | 7 |
private void makeRGBTexture(GL2 gl, BufferedImage img, int target) {
/* Setup a BufferedImage suitable for OpenGL */
WritableRaster raster = Raster.createInterleavedRaster (DataBuffer.TYPE_BYTE,
img.getWidth(),
img.getHeight(),
4,
null);
... | 3 |
private synchronized void processInputs() {
int code;
try
{
// Careful: the read*() methods are blocking!
code = hmi.dataIn.readInt();
Command command = Command.values()[code];
if (command == Command.IN_SET_MODE) {
int imode = hmi.dataIn.readInt();
hmi.mode = Mode.values()[imode];
} else if... | 3 |
@Override
public void storeComment(Comment comment) {
ResultSet rs = null;
int ID = comment.getID();
if (ID > 0) { // update
editComment(comment);
} else { // insert
try {
// this.iComment = connection.prepareStatement("INSERT INTO comment (aut... | 8 |
private Comparator<? super TSource> createComparatorChain() {
final List<Comparator<TSource>> comparators = new LinkedList<Comparator<TSource>>();
SortableList<TSource> s = this;
do {
comparators.add(0, s.comparator);
} while ((s = s.parent) != null);
return new Comparator<TSource>() {
@Override
p... | 4 |
private MouseMotionListener mouseMotionListener(){
return new MouseMotionAdapter() {
@Override
public void mouseDragged( MouseEvent e ) {
if( !moving ){
if( mousePressedPoint != null ){
initMove( mousePressedPoint.x, mousePressedPoint.y );
}
}
if( moving ){
for( MoveableCapabili... | 4 |
@Override
public void restoreCurrentToDefault() {
copyHashMap(def,cur);
} | 0 |
public String expression(String expression){
this.expression = expression;
return this.expression;
} | 0 |
@Override
protected void setup(Context context) {
this.conf = context.getConfiguration();
// get cube identifier from hadoop conf
try {
initCubeIdentifierFromHadoopConf();
} catch (CubeIdentifierNotSetException e) {
e.printStackTrace();
// TODO ex... | 7 |
public boolean isVertexInArea(Point p1, Point p2) {
double[] posX = { p1.getX(), p2.getX() };
double[] posY = { p1.getY(), p2.getY() };
if (posX[0] > posX[1]) {
swapCoords(posX);
}
if (posY[0] > posY[1]) {
swapCoords(posY);
}
if (getCenterX() >= posX[0] && getCenterX() <= posX[1]
&& getCenterY()... | 6 |
@Override
public void finishOutline () {} | 0 |
public PlantManager(World world, Object3D ground, float range) {
plants=new Plant[MAX_PLANTS];
positions=new SimpleVector[MAX_PLANTS];
for (int i=0; i<MAX_PLANTS; i++) {
Plant plant=new Plant();
plants[i]=plant;
boolean ok=false;
do {
float xpos=(float)(... | 3 |
public void kick(String message, Object... args) {
if (left)
return;
PacketKick kick = new PacketKick(this);
kick.message = message;
kick.args = args;
if(properties.containsKey("translation")) {
Translation t = (Translation)properties.get("translation");
System.out.println(t.translate("client.kicked... | 4 |
@Override
public void parse(CommandInvocation invocation, List<ParsedParameter> params, List<Parameter> suggestions)
{
String token = invocation.currentToken();
for (String name : getNames())
{
if (name.equalsIgnoreCase(token))
{
invocation.consume... | 4 |
@Override
protected String makeString(String t, boolean structured) {
String n = ""; //new line
String tt = ""; //tabulators
//create new stuff, if structured
if(structured){
n = "\n";
tt = t+"\t";
}
//temp storage
StringBuilder arrsb = new StringBuilder();
//trick to h... | 3 |
@Override
public void run() {
while (true)
{
Point p;
try {
p = toLoad.take();
}catch (InterruptedException e) {
e.printStackTrace();
continue;
}
try {
Main.getLoadedWorld().addChunk(load(p));
}catch (NullPointerException e) {
try {
Thread.sleep(10);
} catch (Inte... | 4 |
public static void print(Object s) {
System.out.print(s);
} | 0 |
@Override
public String process(String content) throws ProcessorException {
// TODO Auto-generated method stub
pipeline = new SimpleAuthenticationPipeline();
context = new AuthenticateContext();
pipeline.setBasic(new LoginEntryValve());
pipeline.addValve(new FlushValve());
pipeline.addValve(new EncodeValve... | 3 |
public void bind() {
SocketAddress address;
if (ip.isEmpty()) {
address = new InetSocketAddress(this.port);
} else {
address = new InetSocketAddress(this.ip, this.port);
}
ChannelFuture future = this.bootstrap.bind(address);
Channel channel = futu... | 2 |
@SuppressWarnings("deprecation")
public void stop(){
downloadThread.stop();
} | 0 |
public void addVertex(UndirectedNode vertex) {
if (!this.vertices.contains(vertex)) {
this.vertices.add(vertex);
}
} | 1 |
public void writeWsFrameLength(byte type, int length) throws IOException {
writeRawByte(type);
// Encode length.
int b1 = length >>> 28 & 0x7F;
int b2 = length >>> 14 & 0x7F;
int b3 = length >>> 7 & 0x7F;
int b4 = length & 0x7F;
if (b1 == 0) {
if (b2 == 0) {
if (b3 == 0) {
writeRawByte(b4);
... | 3 |
@Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.countries");
String prevPage = (String) request.getSessionAttribute(JSP_PAGE);
resaveParamsShowCountry(request);
formCountryList(re... | 2 |
@Override
public void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
System.out.println("Stop JUMP");
break;
case KeyEvent.VK_DOWN:
currentSprite = anim.getImage();
robot.setDucking(false);
break;
case KeyEvent.VK_LEFT:
robot.setMovingLeft(false);
robot.stop();
... | 5 |
public int getSize() {
return type == Type.LONG_TYPE || type == Type.DOUBLE_TYPE ? 2 : 1;
} | 2 |
public WorldInfo loadWorldInfo() {
File var1 = new File(this.saveDirectory, "level.dat");
NBTTagCompound var2;
NBTTagCompound var3;
if(var1.exists()) {
try {
var2 = CompressedStreamTools.loadGzippedCompoundFromOutputStream(new FileInputStream(var1));
var3 = var2.... | 4 |
public Player play() throws GameEndedUnexpectedlyException {
Player turn = null;
WinResult gameState = WinResult.None;
//The game loop. Halts when the game has ended
while(gameState == WinResult.None)
{
//Determine whose turn it is
if (turn == player1)
{
turn = player2;
}
else
{
t... | 8 |
public static void main(String[] args) throws IOException {
for (int i = 2; i < 1000000; i++)
if (!primos[i])
for (int j = i + i; j < 1000000; j += i)
primos[j] = true;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while(true){
int n = Integer.parseInt(in.readLine().tr... | 8 |
@Override
public boolean grown() {
final FarmingDefinition definition = definition();
if (definition.containsAction("Empty") || definition.containsAction("Take-tomato")) {
return true;
}
final int bits = bits();
return bits == NORMAL_STAGE[2] || bits == SUPER_STAGE[2] || bits == TOMATO_STAGE[2];
} | 4 |
public cancelService(int route)
{
database.openBusDatabase();
Calendar cal = Calendar.getInstance();
route_id = route;
timing_point += cal.get(Calendar.HOUR_OF_DAY) * 60;
timing_point += cal.get(Calendar.MINUTE);
startDate = (Calendar)cal.clone();
if(startDate.get(Calendar.DAY_OF_WEEK) > ... | 3 |
public void mouseWheelMoved(MouseWheelEvent e) {
MapView mapView = (MapView) e.getSource();
ControllerAdapter mController = (ControllerAdapter) mapView.getModel()
.getModeController();
if (mController.isBlocked()) {
return; // block the scroll during edit (PN)
... | 7 |
private static boolean checkElementDiscovered(String element) {
for (int x = 0; x <= elementsDiscovered.length -1; x++) { //goes through the elementsDiscovered
int elementInt = elementNumber(element); //and checks if the int of the element passed
if (elementInt == elementsDiscovered[x]){ //through matches any i... | 2 |
@Test
public void test_solvable_matrix_size_3_solve() throws
ImpossibleSolutionException,UnsquaredMatrixException,
ElementOutOfRangeException{
int height=3;
int width=3;
float[][] matrix;
float[] resultVector;
float[][] knownMatrix = new f... | 3 |
public String getLyricsSnippet(String artistName,String songName){
if (artistName.equals(null) || artistName.equals("") || songName.equals(null) || songName.equals(""))
return null;
String url = buildUrl(artistName,songName);
try {
Document document = reader.read(url);
// XMLUtil.writeToFile(document, art... | 6 |
public GedcomObjectFactory findFactoryForTag(String tag) {
if (tag.equalsIgnoreCase("DATE"))
return dateFactory;
else if (tag.equalsIgnoreCase("PLAC"))
return placeFactory;
else
return null;
} | 2 |
@EventHandler
public void onPlayerDeathEvent(PlayerDeathEvent event) {
Player player = (Player) event.getEntity();
if (!player.hasPermission("trophyheads.drop")) {
return;
}
if (randomGenerator.nextInt(100) >= DROP_CHANCES.get(EntityType.PLAYER.toString())) {
... | 9 |
protected void decodeAttribute(mxCodec dec, Node attr, Object obj)
{
String name = attr.getNodeName();
if (!name.equalsIgnoreCase("as") && !name.equalsIgnoreCase("id"))
{
Object value = attr.getNodeValue();
String fieldname = getFieldName(name);
if (isReference(obj, fieldname, value, false))
{
... | 5 |
public void dequeueSound( String filename )
{
if( !toStream )
{
errorMessage( "Method 'dequeueSound' may only be used for " +
"streaming and MIDI sources." );
return;
}
if( filename == null || filename.equals( "" ) )
{
... | 6 |
private void closeDB(){
try {
if(rs!=null){
rs.close();
}
if(ps!=null){
ps.close();
}
if(conn!=null){
conn.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | 4 |
private static ResCache makeglobal() {
ResCache ret;
if ((ret = JnlpCache.create()) != null)
return (ret);
if ((ret = FileCache.foruser()) != null)
return (ret);
return (null);
} | 2 |
public static void loadAllAchievements() {
String statement = new String("SELECT * FROM " + DBTable + " WHERE type = ?");
PreparedStatement stmt;
try {
stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, HIGHSCORE_TYPE);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
HighS... | 2 |
public ArrayList<Fish> reproduceWithFish(Fish f) {
Random generator = new Random();
ArrayList<Fish> babies = new ArrayList<Fish>();
double num = generator.nextDouble();
if (num <= .01) {
int num1 = generator.nextInt(2);
for (int x = 0; x <= num1; x++) {
... | 2 |
@Test
public void testGetSquareContent() {
board.removeAllPawns();
Pawn pawn1 = new Pawn('a', 2, 2, board);
board.addPawn(pawn1);
if (board.getSquareContent(2, 2) != null) {
assertEquals('a', board.getSquareContent(2, 2).getLetter());
} else {
fail();
... | 1 |
public void input()
{
System.out.println("Available choices are score, flag, reveal, board, save, help, and exit");
String inputString = input.next().trim().toLowerCase();
if (inputString.equals("score")) {
score();
}
else if (inputString.equals("flag")) {
System.out.println("Where to flag?\nplease i... | 7 |
private static int findMatch(String s, String p) {
if (s == null || p == null) return -1;
int m = s.length();
int n = p.length();
if (m < n) return -1;
for (int i = 0; i <= (m - n); i++) { // (M - N) steps
int j = 0;
while(j < n && s.charAt(i + j) == p.charAt(j)) { // at most N steps
j++;
... | 7 |
public BounceFrame()
{
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
setTitle("Bounce");
comp = new BallComponent();
add(comp, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel();
addButton(buttonPanel, "Start", new ActionListener()
{
public void actionPerforme... | 0 |
public static String getBaseURI(NodeInfo node) {
String xmlBase = node.getAttributeValue(StandardNames.XML_BASE);
if (xmlBase != null) {
URI baseURI;
try {
baseURI = new URI(xmlBase);
if (!baseURI.isAbsolute()) {
NodeInfo parent... | 9 |
public void display(){
int index = 0;
while(index<SIZE) {
if (elements[index] != null) {
LinkedNode node = (LinkedNode) elements[index];
node.display();
}
index++;
}
} | 2 |
@Test
public void testPingSocket() {
LOGGER.log(Level.INFO, "----- STARTING TEST testPingSocket -----");
String client_hash = "";
String client_hash2 = "";
server1.setUseDisconnectedSockets(true);
Server server3 = null;
try {
server3 = new Server(game, por... | 9 |
public String toString() {
return "STATE: " + myState.toString() + " COLOR: " + myColor;
} | 0 |
public void DBDeleteAreaAndRooms(Area A)
{
if(A==null)
return;
if(!A.isSavable())
return;
if(Log.debugChannelOn()&&(CMSecurity.isDebugging(CMSecurity.DbgFlag.CMAREA)||CMSecurity.isDebugging(CMSecurity.DbgFlag.DBROOMS)))
Log.debugOut("RoomLoader","Destroying area "+A.name());
A.setAreaState(Area.State.... | 8 |
void drawEllipse(int color, int sz, int xc, int yc, int a, int b) {
/* e(x,y) = b^2*x^2 + a^2*y^2 - a^2*b^2 */
int x = 0, y = b;
long a2 = (long)a*a;
long b2 = (long)b*b;
long crit1 = -(a2/4 + a%2 + b2);
long crit2 = -(b2/4 + b%2 + a2);
long crit3 = -(b2/... | 9 |
public boolean EliminarTrata(Trata p){
if (p!=null) {
cx.Eliminar(p);
return true;
}else {
return false;
}
} | 1 |
@Override
public String newProgrammesThisWeek() throws WhatsNewServiceException
{
List<BroadCastProgramme> programmeList = iProgrammesThisWeekService.programmesThisWeek();
List<Programme> newProgrammes = new ArrayList<Programme>();
if (programmeList != null)
{
for (BroadCastProgramme broadCastProgramme : ... | 4 |
public void checkType(Symtab st) {
exp1.setScope(scope);
exp1.checkType(st);
exp2.setScope(scope);
exp2.checkType(st);
exp1Type = exp1.getType(st);
exp2Type = exp2.getType(st);
if (!exp1Type.equals("int") && !exp1Type.equals("decimal")
&& !exp1Type.equals("String") && !exp1Type.equals("message"))
M... | 8 |
public ArrayList<String> getDimensionsFromPoints(ArrayList<ClusterPoint> p)
{
ArrayList<String> pointDimensionValues = new ArrayList<String>();
for(int i = 0; i < p.size(); i++)
{
for(int j = 0; j < dimensionCount; j++)
{
try { pointDimensionValues.add(Double.toString(p.get(i).getValueAtDimension(j)));... | 3 |
public void cullConnections() throws SQLException
{
int availableCount = 0;
for (IMySQLConnection conn : conns)
{
if(conn.isAvailable()) {
++availableCount;
}
}
double check = ((double)availableCount) / ((double)conns.size());
if((conns.size() > 10) && (availableCount > 5) && (check > 0.3))
... | 8 |
private void createDropWidget(Composite parent) {
parent.setLayout(new FormLayout());
Combo combo = new Combo(parent, SWT.READ_ONLY);
combo.setItems(new String[] {"Toggle Button", "Radio Button", "Checkbox", "Canvas", "Label", "List", "Table", "Tree", "Text", "StyledText", "Combo"});
combo.select(LABEL);
dropContr... | 3 |
public SampleBuilder<P> blanks2blanks(Map<BlankBuilder<?>, BlankBuilder<?>> blanks2blanks) {
verifyMutable();
if (this.blanks2blanks == null) {
this.blanks2blanks = new HashMap<BlankBuilder<?>, BlankBuilder<?>>();
}
if (blanks2blanks != null) {
for (Map.Entry<BlankBuilder<?>, BlankBuilder<?>> e : blanks2... | 9 |
private boolean jj_3_52() {
if (jj_3R_70()) return true;
return false;
} | 1 |
@Transient
public List<LabelValue> getRoleList() {
List<LabelValue> userRoles = new ArrayList<LabelValue>();
if (this.roles != null) {
for (Role role : roles) {
// convert the user's roles to LabelValue Objects
userRoles.add(new LabelValue(role.getName(),... | 2 |
public static double LinkedListFromArrayBench(int number) {
LinkedListFromArray ll = new LinkedListFromArray();
long addLastTime = System.currentTimeMillis();
for (int i = 0; i < number; i++) {
ll.addLast("" + Math.random());
}
addLastTime = System.currentTimeMillis() - addLastTime;
ll = new LinkedLis... | 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.