text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void testAbstractMethods(ByteMatcher matcher) {
// test methods from abstract superclass
assertEquals("length is one", 1, matcher.length());
assertEquals("matcher for position 0 is this", matcher, matcher.getMatcherForPosition(0));
try {
matcher.getMatcherForPositio... | 9 |
public int insert(ModelCRLV crlv) throws ClassNotFoundException, SQLException{
int result;
con = abrirBanco(con);
String sql = "insert into crlv"
+ "(via, cod_renavam, rntrc, exercicio, nome, cpf_cnpj, placa,"
+ "uf_placa, placa_ant, uf_placa_ant, ch... | 1 |
void maxSlidingWindow(int A[], int n, int w, int B[]) {
LinkedList<Integer> Q = new LinkedList<Integer>();
for (int i = 0; i < w; i++) {
while (!Q.isEmpty() && A[i] >= A[Q.getLast()])
Q.removeLast();
Q.addLast(i);
}
for (int i = w; i < n; i++) {
B[i-w] = A[Q.getFirst()];
... | 8 |
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
KundeDTO kunde = kundeList.get(rowIndex);
Object value = null;
switch (columnIndex) {
case 0:
value = kunde.getKundeId();
break;
case 1:
value = kunde.getFirmaNavn();
break;
case 2:
value = kunde.getKontaktNavn();
break;
... | 5 |
public void doStatsOnList(ArrayList<Float> data) {
ArrayList<Float> medianFinder = new ArrayList<Float>();
for (float dataPoint : data) {
if (dataPoint != dataPoint)
continue;
n++;
sum += dataPoint;
sumOfSquares += dataPoint * dataPoint;
medianFinder.add(dataPoint);
}
mean = sum / n;
if (... | 5 |
private void hookListener(final ColumnViewer viewer) {
Listener listener = new Listener() {
public void handleEvent(Event event) {
switch (event.type) {
case SWT.MouseDown:
handleMouseDown(event);
break;
case SWT.KeyDown:
handleKeyDown(event);
break;
case SWT.Selection:
ha... | 9 |
public void getSysRunDate() {
date = gregorianCalendar.getTime();
sysRunTime = (date.toString()).split(" ");
} | 0 |
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
try {
if (!(sender instanceof Player)) {
return true;
}
Player player = (Player)sender;
if (HyperPVP.getSpectators().contains(player.getName())) {
player.teleport(HyperPVP.getMa... | 4 |
public synchronized void finishEntropyProcessing(int num_msgs, int otherID, Socket sock) {
// Write nextWrite;
// Write committedWrite;
entropy_size = num_msgs;
while(entropy_writes.size() != entropy_size) {
try {
wait();
}
catch(InterruptedException e) {}
}
for(int i = 1; i<=num_msgs; i++... | 8 |
public int getPoints() {
return points;
} | 0 |
public CombatScreen(TurnBasedGame _game, Battle battle, CombatEntity player, CombatEntity monster, MapScreen parent) {
this.game = _game;
this.battle = battle;
this.player = player;
this.monster = monster;
this.mapScreen = parent;
rng = new Random();
battle.addBattleEndListener(new BattleEndListener() ... | 9 |
static String getMessageName(StringBuilder sb, Class<?> type,
boolean includeScope) {
// Crosstown does not support complex generated names since they won't
// translate to
// dotNet
if (includeScope) {
String scope = null;
if (ExternallyNamespaced.class.isAssignableFrom(type)) {
// Use dotNet Nam... | 6 |
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == trainSelector)
{
redraw();
}
else if(e.getSource() == engine)
{
int currTrain = Integer.parseInt((String) trainSelector.getSelectedItem());
if(trainModelWrapper.isInFailure(currTrain))
{
trainModelWrapper.resolveF... | 9 |
private int compareHandsLo(String hand1, String hand2)
{
if (hand1.equals("0")) {
return hand2.equals("0") ? 0 : 2;
} else if (hand2.equals("0")) {
return 1;
}
for (int i = 0; i < 5; i++) {
if (Card.getRank(hand1.charAt(i)) > Card.getRank(... | 6 |
public static void main(String[] args) throws Exception {
String env = null;
if (args != null && args.length > 0) {
env = args[0];
}
if (! "dev".equals(env))
if (! "prod".equals(env)) {
System.out.println("Usage: $0 (dev|prod)\n");
... | 9 |
public void testKeepLastNDeletionPolicy() throws IOException {
final int N = 5;
for(int pass=0;pass<2;pass++) {
boolean useCompoundFile = (pass % 2) != 0;
Directory dir = new RAMDirectory();
KeepLastNDeletionPolicy policy = new KeepLastNDeletionPolicy(N);
for(int j=0;j<N+1;j++) {
... | 8 |
@Override
public void addCallback(IJeTTEventCallback callback) {
// Create adapters
// Create an adapter for each type of callback here
CallbackAdapter<?>[] adapters = new CallbackAdapter[] {
new EventCallbackAdapter(callback),
new ResultCallbackAdapter(callback),
};
// Add all
for(CallbackAdapter<?... | 4 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Contact)) {
return false;
}
Contact other = (Contact) object;
if ((this.contactID == null && other.contactID !=... | 5 |
public double getAltura() {
return altura;
} | 0 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Cidade)) {
return false;
}
Cidade other = (Cidade) object;
if ((this.codcidade == null && other.codcidade != nu... | 5 |
@Override
public void actionPerformed(GUIComponent source) {
if (source == newGameButton) {
Game.linkedGet().newGame();
this.deactivate();
Game.linkedGet().resumePlay();
}
else if (source == quitButton) {
Game.linkedGet().quit();
th... | 2 |
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
switch (columnIndex) {
case 0:
return listReclamation.get(rowIndex).getIdReclamation();
case 1:
return listReclamation.get(rowIndex).getDateReclamation();
case 2:
... | 4 |
private synchronized String getSelection() {
while (selection == null) {
try {
this.wait();
} catch (InterruptedException e) {
throw (new RuntimeException(e));
//Seriously when is it ever correct to actually handle this error
}
}
return selection;
} | 2 |
private static <AnyType extends Comparable<? super AnyType>>
void percDown( AnyType [ ] a, int i, int n )
{
int child;
AnyType tmp;
for( tmp = a[ i ]; leftChild( i ) < n; i = child )
{
child = leftChild( i );
if( child != n - 1 && a[ child ].compareTo( a[... | 5 |
private void getStringFiles(File[] valuesFolder) {
for (File valuesVersion : valuesFolder) {
System.out.println("Parsing xml from " + valuesVersion.getName()
+ "\n");
String columnName = valuesVersion.getName().substring(
"values".length());
if (ConstantMethods.isEmptyString(columnName)) {
col... | 5 |
public Object getConfig(int i, String name) {
String str = "";
int in = 0;
long lng = 0;
double dbl = 0;
boolean bln = false;
try {
Transaction trans=new JDBCTransaction(createConnection());
Connection connection = ((JDBCTransaction)trans).getConnection();
Statement stmt=connection.createState... | 8 |
public E get(int id) {
try {
selectId.setInt(1, id);
ResultSet rs = selectId.executeQuery();
while(rs.next()){
return build(rs);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
} | 2 |
@Override
public void mouseDown(Point mousePoint, boolean shiftDown, boolean ctrlDown) {
// if ctrl is down deselect all selected objects
if (!ctrlDown) {
for (Object go : model.list()) {
((GraphicalObject) go).setSelected(false);
}
}
Graphica... | 6 |
public void addPageHeader(List<String> whereTo, String head) {
whereTo.add("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
whereTo.add("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" >\n");
whereTo.add("<head>\n");
whereTo.add... | 9 |
public final void handlePlace(PlayerInteractEvent event, BlockAPI plugin)
{
Player player = event.getPlayer();
ItemStack item = event.getItem();
Block block = event.getClickedBlock().getRelative(event.getBlockFace());
BlockState state = block.getState();
if ((!block.isEmpty()) && (!block.isLiquid())) {
r... | 4 |
private void btn_generate_tokenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_generate_tokenActionPerformed
// TODO add your handling code here:
String cadToken = this.val_token.getText();
if (cadToken.length() > 0) {
while (modelTable.getRowCount() > 0) {
... | 2 |
@Override
public void mouseReleased(MouseEvent e) {
if (this.isMovingToolBar)
this.isMovingToolBar = false;
if (this.isDrawing)
this.isDrawing = false;
if (this.isSelecting) {
this.isSelecting = false;
}
System.out.println("mouseReleased: "+e.getX()+","+e.getY());
} | 3 |
public void setCaso(TCaso node)
{
if(this._caso_ != null)
{
this._caso_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}... | 3 |
public static void deleteWorlds() {
if (!containsLoadedWorlds()) {
if (ChristmasCrashers.isDebugModeEnabled())
System.out.println("Cancelling DeleteWorldsTask - there are no loaded worlds.");
return;
}
ArrayList<World> worldsToDelete = new ArrayList<World>();
for (World w : worlds)
if (w != null... | 5 |
public Object getValue() {
return this.value;
} | 0 |
private FriendsStatusListener makeFriendsStatusListener() {
return new FriendsStatusListener() {
@Override
public void statusChange(Long friendId, SkypeStatus newStatus) {
System.out.println(" !! Status msg receiv: userID:"+friendId+" newStatus:"+newStatus.name());
switch (newStatus) {
case O... | 6 |
public ReportServer() {
try {
server = new Server();
Network.register(server.getKryo());
server.start();
server.bind(Network.PORT, Network.PORT);
database = new ReportDB();
server.addListener(new Listener() {
@Override
public void received(Connection con, Object o) {
if(o instanceo... | 4 |
private boolean execMakeCollaborativeProfiles(VectorMap queryParam, StringBuffer respBody, DBAccess dbAccess) {
int clntIdx = queryParam.qpIndexOfKeyNoCase("clnt");
String clientName = (String) queryParam.getVal(clntIdx);
int threasholdIdx = queryParam.qpIndexOfKeyNoCase("th");
if (thre... | 8 |
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 = maxN... | 9 |
public Process getNextProcess(Integer processor)
{
Process currentProcess = runningProcesses.get(processor);
if(currentProcess != null && preemption == false)
{
return currentProcess;
}
if(waitingProcesses.size() == 0)
{
return null;
}
... | 8 |
public List<Message> getAllChildrenMessages(int parentId) {
List<Message> list = new LinkedList<>();
Connection connection = ConnectionManager.getConnection();
if (connection == null) {
logger.log(Level.SEVERE, "Couln't establish a connection to database");
return list;
... | 3 |
private void downloadCover (String coverName){
File f=new File(downloadPath+File.separator+coverName);
InputStream is = null;
try {
is = new URL("http://beta.grooveshark.com/static/amazonart/"+coverName).openStream();
} catch (MalformedURLException e1) {
showMessage(("Cover Download Failed"));
e1.prin... | 7 |
public Library addNative(OperatingSystem operatingSystem, String name) {
if ((operatingSystem == null) || (!operatingSystem.isSupported())) throw new IllegalArgumentException("Cannot add native for unsupported OS");
if ((name == null) || (name.length() == 0)) throw new IllegalArgumentException("Cannot add nativ... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
StageDirection other = (StageDirection) obj;
if (direction == null) {
if (other.direction != null)
return false;
} else if (!direction.e... | 6 |
public int longestConsecutive(int[] num){
Map<Integer,Integer> mapStart = new HashMap<Integer,Integer>();
Map<Integer,Integer> mapEnd = new HashMap<Integer,Integer>();
int maxLength = 0;
for(int i = 0 ;i < num.length;i++){
if(mapStart.containsKey(num[i]))
con... | 4 |
public boolean parseStr(String str){
Pattern pattern = Pattern.compile("[,;]");
String[] strs = pattern.split(str);
x1=Integer.valueOf(strs[0]);
y1=Integer.valueOf(strs[1]);
x2=Integer.valueOf(strs[2]);
y2=Integer.valueOf(strs[3]);
if(cb.getX()<=x1||x1<0||cb.getX()<=x2||x2<0||cb.getY()<=y1||y1<0||cb.getY(... | 8 |
public int sumNumbers(TreeNode root) {
int result = 0 ;
if(root == null)
return result;
String s ="";
saveNumber(s,root);
return total;
} | 1 |
public static int getIndexOfPS(Stock u, ArrayList<Stock> stocks) {
int counter = 0;
for(Stock e:stocks) {
if(e.getTickername().equalsIgnoreCase(u.getTickername())) {
return counter;
}
counter++;
}
return -1;
} | 2 |
private String nextQuotedValue(char quote) throws IOException {
// Like nextNonWhitespace, this uses locals 'p' and 'l' to save inner-loop field access.
char[] buffer = this.buffer;
StringBuilder builder = new StringBuilder();
while (true) {
int p = pos;
int l = limit;
/* the index of ... | 6 |
@Override
public double[][] solve(double[] T_0, int n, double k, double u, double dt, double dx) {
double[][] ans = new double[n][];
int m = T_0.length;
ans[0] = T_0;
for (int layer = 1; layer < 2; layer++) {
double[] T = ans[layer - 1];
double[] curLayer = new double[m];
for (int i =... | 4 |
@SuppressWarnings("unchecked")
public void tabulateSurvey(Survey s) throws IOException{ //Takes a Survey given by the user and shows all response results for the Survey.
Survey surv = s;
ArrayList<ArrayList<Response>> resp = new ArrayList<ArrayList<Response>>();
final File dir = new File("responses");
if (!... | 7 |
public boolean containsValue( Object value ) {
final int num = mBuckets.length;
if( value != null ) {
for( int i = 0; i < num; i++ ) {
Node<V> entry = mBuckets[i];
while( entry != null ) {
if( value.equals( entry.mValue ) ) {
... | 7 |
public List<RoomEvent> getRoomEventList() {
return roomEventList;
} | 0 |
public GeneralConfigurationPanel() {
super();
setLayout(new BorderLayout());
contents = new GeneralData();
PropertySet ps = new PropertySet();
final TextProperty tpName = new TextProperty("Game name", null);
final FileProperty fpMenuBackgroundImage = new FileProperty(
"Menu background image (800 \u00... | 5 |
public void start() throws BITalinoException {
int bit = 1;
for (int channel : analogChannels)
bit = bit | 1 << (2 + channel);
try {
socket.write(bit);
} catch (Exception e) {
throw new BITalinoException(BITalinoErrorTypes.BT_DEVICE_NOT_CONNECTED);
... | 2 |
public void saveYMLFile(String fileName) {
if (!FileConfigs.containsKey(fileName)) {
FileConfigs.put(fileName, new YamlConfiguration());
}
try {
FileConfigs.get(fileName).save(Files.get(fileName));
} catch (IOException e) {e.printStackTrace();
}
} | 2 |
public String toString()
{
String str = paintNo+"|"+manu+"|";
for(String man : manus)
{
str = str + man + ",";
}
str = str.substring(0, str.length()-1);
for(String num : numbers)
{
str = str + num + ",";
}
str = str.substring(0, str.length()-1);
return str;
} | 2 |
public PlanMinuten(JSONObject object, Object min) throws FatalError {
super("Minuten");
if (min != null && min instanceof Integer) {
count = (Integer) min;
} else {
throw new ConfigError("Minuten");
}
if (count < 0) {
Output.println("Config: Minuten is set to 0.", 0);
count = 0;
}
} | 3 |
public void keyTyped(KeyEvent e)
{
debug("keyTyped("+e+")");
char c=e.getKeyChar();
if(((c>='0')&&(c<='9'))||((c>='A')&&(c<='F'))||((c>='a')&&(c<='f')))
{
char[] str=new char[2];
String n="00"+Integer.toHexString((int)he.buff[he.cursor]);
if(n.len... | 9 |
private static void convertRGBtoHSL(final int r, final int g, final int b, final float[] hsl) {
final float varR = (r / 255f);
final float varG = (g / 255f);
final float varB = (b / 255f);
float varMin;
float varMax;
float delMax;
if ... | 9 |
public boolean login(String inUsername){
String sql = "select username " +
"from Users " +
"where username LIKE ?";
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(sql);
ps.setString(1, inUsername);
ResultSet rs = ps.executeQuery();
while(rs.next()) {
String username = rs.getStri... | 5 |
public void die(){
alive = false;
respawnX = x;
respawnY = y;
respawnColX = colOffsetX;
respawnColY = colOffsetY;
respawnWidth = width;
respawnHeight = height;
respawnTexture = texture;
if(loot.size() > 0){
setBounds(x + colOffsetX + width/2 - 16, y + colOffsetY + height/2 - 16,32,32);
setCollis... | 1 |
public static String getLocalHostName() throws SocketException, UnknownHostException {
try {
final String canonicalHostName = InetAddress.getLocalHost().getCanonicalHostName();
if (isFQDN(canonicalHostName)) {
return canonicalHostName;
} else {
... | 4 |
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
try {
//metodo de impresion anterior por JTable
/**try {
MessageFormat headerFormat = new MessageFormat(jLabel1.getText());
MessageFormat footer... | 6 |
public Double relativePrime(Double x) {
ArrayList<Double> primes = new ArrayList<Double>();
Double relativePrime = BigInteger.probablePrime(9, new Random()).doubleValue();
while (relativePrime<x) {
if (BigInteger.valueOf(x.longValue()).gcd(BigInteger.valueOf(relativePrime.longValue()... | 3 |
@Override public void finishPopulate()
{
} | 0 |
public void deleteObject(ChunkyObject chunkyObject) {
if (isLoaded()) {
query(QueryGen.deleteAllOwnership(chunkyObject));
query(QueryGen.deleteAllPermissions(chunkyObject));
query(QueryGen.deleteObject(chunkyObject));
if (chunkyObject instanceof ChunkyGroup)
... | 2 |
public void receiveMsg(){
try {
InputStream is = socket.getInputStream();
ObjectInputStream ois = new ObjectInputStream(is);
Object newObj = ois.readObject();
if (newObj instanceof ClientModel) {
// Always perform add when ClientModel receive to update client information
ClientModel client = (Clie... | 9 |
@Override
public void addToEnd(String value) throws AlreadyExist {
if (!exists(value)) {
super.addToEnd(value);
} else {
throw new AlreadyExist("Alredy exist in List");
}
} | 1 |
public String process(String wikiText) {
String[] linesArray = arrayOfBloks(wikiText);
String HalfBaked = "";
for (String line : linesArray) {
// For each bloke of text:
// if it free text Wrap with P tag.
// Otherwise append it as is.
i... | 2 |
public void printProblem()
{
System.out.println("Number of meetings: " + this.NumMeetings);
System.out.println("Number of employees: " + this.NumEmployees);
System.out.println("Number of time slots: " + this.NumTimeSlots);
System.out.println("Meetings each employee must attend:");
for(Integer e : this.Emp... | 5 |
public GuideUserAction predict(DependencyStructure gold, ParserConfiguration configuration) throws MaltChainedException {
StackConfig config = (StackConfig)configuration;
Stack<DependencyNode> stack = config.getStack();
if (!swapArrayActive) {
createSwapArray(gold);
swapArrayActive = true;
}
GuideUserA... | 8 |
public IrcListenerThread(AprilonIrc plugin, IrcClient hostclient)
{
this.Parent = plugin;
this.HostClient = hostclient;
this.HostReader = hostclient.getReader();
thread = new Thread(this);
} | 0 |
public static void validateHotel(Hotel hotel) throws TechnicalException {
if (hotel == null) {
throw new TechnicalException(MSG_ERR_NULL_ENTITY);
}
if ( ! isStringValid(hotel.getName(), NAME_SIZE)) {
throw new TechnicalException(NAME_ERROR_MSG);
}
if ( ! i... | 6 |
@Basic
@Column(name = "description")
public String getDescription() {
return description;
} | 0 |
public static void main(String args[]) {
SynchronizedSrc target = new SynchronizedSrc();
Caller ob1 = new Caller(target, "Hello");
Caller ob2 = new Caller(target, "Synchronized");
Caller ob3 = new Caller(target, "World");
// wait for threads to end
try {
ob1.t.join();
ob2.t.join();
o... | 1 |
@Override
public V get(K key) throws InvalidKeyException, InvalidPositionException,
BoundaryViolationException, EmptyTreeException {
checkKey(key);
Position<Entry<K, V>> currentP = treeSearch(key, root());
actionP = currentP;
if (isInternal(currentP))
return value(currentP);
return null;
} | 1 |
public RGBColor pathShade(ShadeRec rec, int depth) {
RGBColor L=new RGBColor(RGBColor.black);
int lightnum=rec.w.ls.size();
Light cur;
for(int i=0;i<lightnum;i++){
cur=rec.w.ls.get(i);
if(cur instanceof AreaLight){
AreaLight arealight=(AreaLight)cur;
boolean shadowed=false;
arealight.randsam()... | 9 |
@Override
public boolean execute(final CommandSender sender, final String[] split) {
if (sender instanceof Player) {
if (MonsterIRC.getHandleManager().getPermissionsHandler() != null) {
if (!MonsterIRC.getHandleManager().getPermissionsHandler()
.hasCommand... | 7 |
@Override
public void validate(ProcessingEnvironment procEnv,
RoundEnvironment roundEnv, TypeElement annotationType,
AnnotationMirror annotation, ExecutableElement e) {
AnnotationValue expectedReturnType = AnnotationProcessingUtils
.getAnnotationElementValue(procEnv, annotation,
"expectedReturnType")... | 1 |
public static Double parseTimestamp(String data) {
String[] lines = data.split("\n");
for (String line : lines) {
String[] parts = line.split(":", 2);
if (parts[0].equals("t")) {
return Double.parseDouble( parts[1].replace(",",".") );
}
}
return null;
} | 2 |
public void func() {
System.out.println(this + ".func() : " + data);
} | 0 |
public Collection<Label> getLabels()
{
try
{
if (labels.size() == 0)
execute();
}
catch (SQLException e)
{
e.printStackTrace();
}
return labels.values();
} | 2 |
public int dividir(int a, int b) throws MiExcepcion{
if (a==5){
throw new MiExcepcion("No vale el número 5");
}
if (b==0){
throw new MiExcepcion("Oh por DIOS!?!? ¿qué hiciste?");
}
return a / b;
} | 2 |
public boolean qualifies(MOB mob, Room R)
{
if((mob==affected)||(mob==null))
return false;
if(mob.fetchEffect(ID())!=null)
return false;
if(mob.isMonster())
{
if(matchPlayersFollowersOnly)
{
final MOB folM=mob.amUltimatelyFollowing();
return (folM!=null)&& (!folM.isMonster());
}
retur... | 9 |
public String getPermutation(int n, int k) {
// Start typing your Java solution below
// DO NOT write main() function
if (k > factorial(n) || k <= 0 || n <= 0) {
return new String();
}
StringBuilder sb = new StringBuilder();
ArrayList<Integer> num = new ArrayList<Integer>();
for (int i = 1; i <= n; i++... | 7 |
private void nombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nombreActionPerformed
nombre.setText(cliente.getNombre());
}//GEN-LAST:event_nombreActionPerformed | 0 |
public Object copyColorData() {
// Note: This is a fudge. The data about defaultColor,
// groutingColor, and alwaysDrawGrouting is added to the
// last row of the grid. If alwaysDrawGrouting is true,
// this is recorded by adding an extra empty space to
// that row.
Color[][] copy... | 3 |
public boolean validateUserName(String userName) throws IllegalAccessError, SocketTimeoutException {
boolean answer = false;
try {
clientSocket.Escribir("USUARIO " + userName + '\n');
serverAnswer = clientSocket.Leer();
} catch (IOException e) {
throw new SocketTimeoutException();
}
if(serverAnswer !... | 4 |
public void paint(Graphics g)
{
if(mElementDimension == null)
{
mElementDimension = new Dimension();
FontMetrics fm = g.getFontMetrics(mFonts[0]);
mElementDimension.width = fm.charWidth('_')+1;
mElementDimension.height = fm.getHeight()+1;
}
Stack<AffineTransform> transforms = new Stack... | 9 |
@Test
public void treeMapRetrievesIndexes()
{
Random r = new Random();
for (int i = 0; i < 1000; i++)
{
MyInteger m = new MyInteger(r.nextInt(10000));
if (!tree.contains(m))
treeHeap.insert(m);
}
Object[] array = treeHeap.getArray()... | 4 |
public static Rectangle2D getBounds(CellView[] views) {
if (views != null && views.length > 0) {
Rectangle2D r = (views[0] != null) ? views[0].getBounds() : null;
Rectangle2D ret = (r != null) ? (Rectangle2D) r.clone() : null;
for (int i = 1; i < views.length; i++) {
r = (views[i] != null) ? views[i].get... | 9 |
private void about() {
JOptionPane
.showMessageDialog(
this,
"Mit Hilfe von diesem Programm k\u00F6nnen Sie Ihre Kontakte verwalten.\n"
+ "Es besitzt Aktionen zum Erstellen, L\u00F6schen und Editieren\n"
+ "Ihrer Kontakte und hat Felder wie Vorname, Nachname und eMail.");
} | 0 |
public CLC() {
commandMap = new HashMap<String, Action>();
abbrMap = new HashMap<Character, Action>();
optionMap = new HashMap<String, Action>();
contextMap = new HashMap<String, CLC>();
defaultAction = unknownCommandAction;
rootAction = defaultRootAction;
} | 0 |
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
QuizService quizService = new QuizService();
int quizId = Integer.parseInt(request.getParameter("quizId"));
Quiz quiz = null;
//deleteQuiz cas... | 7 |
@Override
public void actionPerformed(GuiButton button)
{
if(button.id == 0)
holder.closeWindow(this);
else if(button.id == 1)
{
try
{
Entity e = ((GuiEditor)holder).getMap().getEntityList().getEntityWithUUID(entity);
R2DFileManager manager = new R2DFileManager(textField.text,null);
Map.sav... | 3 |
void notifyConnected () {
if (INFO) {
SocketChannel socketChannel = tcp.socketChannel;
if (socketChannel != null) {
Socket socket = tcp.socketChannel.socket();
if (socket != null) {
InetSocketAddress remoteSocketAddress = (InetSocketAddress)socket.getRemoteSocketAddress();
if (remoteSocketAddr... | 5 |
private void calcMode(ArrayList<Double> values) {
int maxCount = 0;
/* Tallies each value to determine the max count */
for (int i = 0; i < values.size(); i++) {
int count = 0; // count resets to 0
for (int j = 0; j < values.size(); j++) {
if (values.get(j... | 9 |
public static boolean inCWars() {
int x = Players.getLocal().getLocation().getX();
int y = Players.getLocal().getLocation().getY();
return (y >= 3072 && y < 3135 && x > 2368 && x < 2431);
} | 3 |
public final DccFileTransfer dccSendFile(File file, String nick, int timeout) {
DccFileTransfer transfer = new DccFileTransfer(this, _dccManager, file, nick, timeout);
transfer.doSend(true);
return transfer;
} | 0 |
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.