text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void saveRegion( Region region, File dir )
{
File f = new File( dir, String.format( "r%d %d %d.gven.dat", region.x, region.y, region.z ) );
if ( !createFile( f ) )
{
return;
}
Chunk[] chunks = region.getChunks();
int[][] chunkCoords = new ... | 5 |
Transcript createTranscript(Gene gene, String trId) {
int start = gene.getStart(), end = gene.getEnd();
Transcript tr = new Transcript(gene, gene.getStart(), gene.getEnd(), gene.getStrand(), "transcript_" + trId);
tr.setProteinCoding(true);
add(tr);
// Add exons
int numEx = Math.max(random.nextInt(maxExons... | 3 |
private Cipher createAndInitialiseContentCipher(
ByteBuffer encrypted,
byte[] decryptionKeyBytes)
throws
PDFParseException,
NoSuchAlgorithmException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterExce... | 3 |
private void getKeys() {
try {
generatedKeys = (List<KeyPair>)((new ObjectInputStream(new FileInputStream(SCRATCH_PATH))).readObject());
} catch( Exception e ) {
System.err.println("couldn't get scratch keys: " + e.toString());
System.out.println("generating keys...");
CryptoUtils c = new CryptoUtil... | 4 |
public void downloadVideo(String ytLink){
final String[] args = new String[]{"youtube-dl.exe","-c", ytLink};
final String vidString = ytLink.substring(ytLink.indexOf("watch?v=")+8);
try {
youtubeProc = Runtime.getRuntime().exec(args);
downloadThread = new Thread(){
public void run(){
BufferedRea... | 6 |
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerRespawn(PlayerRespawnEvent e){
File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml");
final FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language);
final String ... | 5 |
public boolean remove(Class<?> type)
{
T removed = provided.remove(type);
if (removed != null)
{
provided.values().removeAll(Arrays.asList(removed));
return true;
}
return false;
} | 2 |
private Polygon rectangleShadow(int x, int y, int shapeX, int shapeY, int width, int height) {
int[] xPoints = {0, 0, 0, 0, 0};
int[] yPoints = {0, 0, 0, 0, 0};
//Left side of screen
if (x > shapeX + width) {
//top
if (y > shapeY + height) {
xPoints = new int[] {shapeX,
... | 8 |
private boolean HandleMiscCommand(String s) {
if (s.equals("i") || s.equals("inventory")) {
if (! inventory.isEmpty()) {
String invStr = inventory.toString();
invStr = invStr.split("\\[")[1];
invStr = invStr.split("\\]")[0];
System.out.println("inventory: " + invStr);
} else {
System.out.pri... | 9 |
@Override
public void execute(CommandSender arg0, String[] arg1) {
if (!arg0.hasPermission("BungeeSuite.admin")) {
arg0.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length == 1) {
if (arg1[0].equalsIgnoreCase("reload")) {
plugin.reload();
arg0.sendMessage("All configs for BungeeSuite r... | 3 |
public void afficherPiece(Piece piece, JPanel panel)
{
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
panel.getComponent(i + j * 4).setBackground(Color.DARK_GRAY);
}
}
if (piece != null) {
int positiony = 0;
int ... | 8 |
public Main () {
int nCounters = 3;
YourMonitor mon = new YourMonitor(nCounters);
DisplayHandler disp = new DisplayHandler(mon);
ClerkHandler[] clerk = new ClerkHandler[nCounters];
for (int i=0; i<nCounters; i++) clerk[i] = new ClerkHandler(mon, i);
CustomerHandler dispenser = new CustomerHandler(mon);
... | 2 |
public static void main(String[] args) throws IOException {
BufferedReader in;
StringBuilder out = new StringBuilder();
File f = new File("entrada");
if (f.exists()) {
in = new BufferedReader(new FileReader(f));
} else
in = new BufferedReader(new InputStreamReader(System.in));
int HPy, ATKy, DEFy, HP... | 9 |
public void visitPhiCatchStmt(final PhiCatchStmt stmt) {
if (stmt.target() != null) {
stmt.target().visit(this);
}
print(" := Phi-Catch(");
final Iterator e = stmt.operands().iterator();
while (e.hasNext()) {
final Expr operand = (Expr) e.next();
operand.visit(this);
if (e.hasNext()) {
pri... | 3 |
private String constructTagAttributesQuery(String regExp,
String qualification, String[][] values) {
String selectqry = "";
String columnName = "";
if (qualification.equalsIgnoreCase("Tags")) {
selectqry = " SELECT TAG_ENTITY_UUID FROM TAGS"
+ " WHERE UPPER(TAG_NAME)";
columnName = "UPPER(TAG_NAME)"... | 6 |
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
} | 1 |
private <T> ArrayList<Method> findTestMethods(T object, String testname) {
Method[] allMethods = findAllMethods(object.getClass());
ArrayList<Method> allNamed = new ArrayList<Method>();
Class<?>[] testerParam = new Class[] { this.getClass() };
// make a list of all methods with the given name
for (Method me... | 6 |
private void subdivide(EChannel cod_info) {
int scfb_anz = 0;
if ( bigvalues_region == 0) {
/* no big_values region */
cod_info.region0_count = 0;
cod_info.region1_count = 0;
} else {
if ( cod_info.window_switching_flag == 0 ) {
int index0, index1;
/* Calculate scfb_anz */
while (scale... | 5 |
public ArrayList<String> parseTemplate(ArrayList<String> data,ArrayList<String> expressions){
int position;
ArrayList<String> newTemplate = new ArrayList<String>();
for(String line : template){
for(int i = 0; i < data.size();i++){
String temp = expressions.get(i); // Get expression
position = line.inde... | 3 |
public void upgrade()
{
if(canUpgrade)
{
ArrayList<Object> deedNames = new ArrayList<Object>();
for (int i = 0; i < deeds.size(); i++)
{
Property prop = deeds.get(i);
if (prop instanceof Street) deedNames.add(prop.name);
}
String[] nam... | 4 |
@Override
public void keyTyped(KeyEvent e) {
/*
* if (keys.contains(KeyEvent.VK_COMMA) && speed - 50 >= 1) {
* timer.cancel(); speed -= 50; setTimers(); } if
* (keys.contains(KeyEvent.VK_PERIOD)) { timer.cancel(); speed += 50;
* setTimers(); }
*/
if (keys.contains(KeyEvent.VK_ESCAPE)) {
if (state... | 3 |
public void decoder(int[] octets_data){
} | 0 |
public Path shortestPath(int x1, int y1, int x2, int y2){
if(x1<0 || x2<0 || y1<0 || y2<0 || x1>(width-1) || x2>(width-1) || y1>(height-1) || y2>(height-1)){
return null;
}
PathFinder pf = new AStar(this.graph,this);
return pf.shortestPath(this.grid.get(new Coordinate(x1,y1)... | 8 |
public int getSeconds() {
return (int) (this.numSamples / this.sampleRateHz);
} | 0 |
protected void play(InputStream in, AudioDevice dev) throws JavaLayerException
{
stopPlayer();
if (in!=null && dev!=null)
{
player = new Player(in, dev);
playerThread = createPlayerThread();
playerThread.start();
}
} | 2 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public double[] subarray_as_magnitude_of_Phasor(int start, int end){
if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1));
Phasor[] pp = this.getArray_as_Phasor();
double[] magn = new double[end-start+1];
for(in... | 2 |
public String toString() {
Set<Product> set = deals_list.keySet();
Iterator<Product> i = set.iterator();
String list = "";
String message;
while (i.hasNext()) {
Product p = i.next();
Deal d = deals_list.get(p);
if (p instanceof UnitProduct && d instanceof ItemPromo) {
message = ("Buy " + d.getDea... | 5 |
public static Map<Integer, Map<Integer, Pearson>> getAllPearson(UserPreferences[] UP, double minPearson) {
Map<Integer, Map<Integer, Pearson>> pearsons = new TreeMap<Integer, Map<Integer, Pearson>>();
for (int i = 0; i < UP.length; i++) {
for (int j = i + 1; j < UP.length; j++) {
Pearson p = new Pearson(UP[i... | 5 |
private void updateGegnerPanels(JPanel spielFeld) {
List<JPanel> panels = new ArrayList<JPanel>();
for (int i = 9; i >= 0; i--) {
for (int j = 0; j < 10; j++) {
JPanel panel = new JPanel();
if (gegner.getSpielfeld().getElements()[j][i]
.getZustandsIndex() == 2) {
panel.setBackground(new FreiZu... | 4 |
private Method findSupertypeMethod(Object o, String methodName, Class<?>[] types) {
Method matchingMethod = null;
Method[] methods = o.getClass().getDeclaredMethods();
methodloop:
for (Method method : methods) {
if (methodName.equals(method.getName())) {
Class<?>[] params = metho... | 7 |
public Polygon getPolygon() {
Polygon polygon = new Polygon();
for(Point P : vertices) {
polygon.addPoint(P.ix, P.iy);
}
return polygon;
} | 1 |
public void start() {
synchronized (this) {
if (ps != null) {
ps.destroy();
ps = null;
}
running = true;
Thread t = new Thread(new Runnable() {
@Override
public void run() {
String[] cmd;
if (from.endsWith("TVCardTC4000SD")) {
cmd = new String[] { "/usr/local/bin/ffmpeg... | 9 |
private DocumentBuilder getDocumentBuilder() throws ParserConfigurationException {
if(documentBuilder==null) {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilder = documentBuilderFactory.newDocumentBuilder();
documentBuilder.... | 1 |
void obfuscatePasswd(String passwd, byte[] obfuscated) {
for (int i = 0; i < 8; i++) {
if (i < passwd.length())
obfuscated[i] = (byte)passwd.charAt(i);
else
obfuscated[i] = 0;
}
DesCipher des = new DesCipher(obfuscationKey);
des.encrypt(obfuscated, 0, obfuscated, 0);
} | 2 |
public void print(int mm,int yy){
if(mm<0||mm>11)
throw new IllegalArgumentException("Month "+mm+" bad, must be 0-11.");
System.out.print(months[mm]);
System.out.print(" ");
System.out.println(yy);
System.out.println("Su Mo Tu We Th Fr Sa");
GregorianCalendar calendar=new GregorianCalendar(yy... | 8 |
public Dialog(int rows,int columns,final Matrix m){
super("matrix input");
final JTextField field[][] = new JTextField[rows][columns];
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e) {
... | 5 |
public int getHP() {
return hp;
} | 0 |
public static void main(String [] args){
String usage = "java mobilemedia.startMobileMediaServer --hostName <String> --portNum <String> --archName <String>\n";
String hostName=null,portNum=null;
String archName=null;
for(int i=0; i < args.length; i++){
if(args[i].equals("--hostName")){
hostName = args... | 9 |
@Override
public void mouseExited(MouseEvent e) {
if(selection != -1) {
setSelection(selection);
}
e.consume();
} | 1 |
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.translate(200,200);
GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
for(int x = 0; x >-100; x--)
{
for(int y = -100; y < 0; y++)
{
if(x == 0)
{
path.moveTo(0, -100);
}
... | 6 |
void updateDisplay() {
long now = System.currentTimeMillis(); // current time in ms
long elapsed = now - lastUpdate; // ms elapsed since last update
remaining -= elapsed; // adjust remaining time
lastUpdate = now; // remember this update time
// Convert remaining milliseconds to mm:ss format and display
if... | 7 |
public boolean equals(Object o) {
if (o instanceof Map.Entry) {
Map.Entry e = (Map.Entry) o;
return key.equals(e.getKey()) && value.equals(e.getValue());
}
return false;
} | 2 |
@Override
public void draw(Graphics2D g) {
setMapPosition();
if(jiggle){
tracker ++;
if(tracker < 2)
xmap +=4;
else if(tracker < 4)
xmap-=4;
else {
jiggle = false;
tracker = 0;
}
}
if (facingRight)
g.drawImage(getAnimation().getImage(),
(int) ((xScreen + xmap) - (width ... | 5 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(target==mob)
{
mob.tell(L("You already know your own alignment!."));
return false;
}
if(... | 7 |
public DrawableItem getDitem() {
return ditem;
} | 0 |
private static void run() throws InterruptedException {
while (!finished) {
Display.update();
if (Display.isCloseRequested()) {
finished = true;
} else if (Display.isActive()) {
Display.sync(FRAMERATE);
render();
} e... | 5 |
private static void addFiles(File file, List<String> result, File reference) {
if (file == null || !file.exists() || !file.isDirectory()) {
return;
}
for (File child : file.listFiles()) {
if (child.isDirectory()) {
addFiles(child, result, reference);
} else {
String path = null;
while (child ... | 8 |
public static void main(String[] args){
int h;
System.out.println();
} | 0 |
@Override
public String rawReviewsData(int pageNum) {
HttpPost httppost = null;
String responseBody = "";
try {
StringBuffer sb = new StringBuffer(postURL);
sb.append("id="+ID)
.append("/page="+pageNum)
.append("/xml");
ResponseHandler<String> responseHandler = new ResponseHandler<String>(){
... | 9 |
private static void generateMainPanel() {
// main panel layout
GridLayout mainPanelGrid = new GridLayout(1, 2);
mainPanel.setLayout(mainPanelGrid);
// generating data source
data = new DataRetriever();
initMap(data); // map initialization
// Flights and crews
flightList = new JList(data.generateFlight... | 4 |
public boolean addObject(int x, int y, int width, int length, int height) {
if ((x - width) > 0 || (x + width) < map.length || (y - length) > 0 || (y + length) < map[0].length) {
for (int i = x - (width / 2); i < x + (width / 2); i++) {
for (int j = y - (length / 2); j < y + (length ... | 7 |
public void setChecked(boolean checked) {
Object newValue = null;
// For backward compatibility, if the style is not
// set yet, then convert it to a toggle button.
if (value == null || value == VAL_TOGGLE_BTN_ON
|| value == VAL_TOGGLE_BTN_OFF) {
newValue = checked ? VAL_TOGGLE_BTN_ON : VAL_TOGGLE_BTN_O... | 9 |
public void setRight(PExpLogica node)
{
if(this._right_ != null)
{
this._right_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... | 3 |
public DoubledDigraph<SugiyamaNode<V>,SugiyamaArc<V,E>> createLayoutGraph(Digraph<V,E> graph, DigraphLayoutDimensionProvider<V> dimensions, Digraph<V,?> feedback, int horizontalSpacing) {
DoubledDigraph<SugiyamaNode<V>,SugiyamaArc<V,E>> result =
DoubledDigraphAdapter.getAdapterFactory(factory).create();
Map<V,S... | 7 |
protected void syncActivation(float[] activeNumbers) {
//todo: refactor (it can become faster and easier)
HashSet<Model> activeModel2 = new HashSet<>();
activeModels.clear();
if (activeNumbers[0] >= 0) {
int speed = 0;
int ls = 0;
for (Model model : mo... | 9 |
public void SetParameter(String head,
String unit,
String digital,
String analog,
float xfrom,
... | 8 |
private void reduce(){
int[] primeNumbers = getPrimeNumbers();
for (int primeNumber: primeNumbers){
while (isReducible(primeNumber)){
numerator /= primeNumber;
denominator /= primeNumber;
}
}
} | 2 |
public Object opt(int index) {
return (index < 0 || index >= length()) ?
null : this.myArrayList.get(index);
} | 2 |
private int inserir (Endereco e){
int status = -1;
Connection con = null;
PreparedStatement pstm = null;
try{
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS);
pstm.setStrin... | 2 |
private boolean isValidPixel(int pixel) {
if (pixel >= 0 && pixel < pixels.length)
return true;
return false;
} | 2 |
private PublicKey byteArrayToPublicKey(byte[] tmp) {
PublicKey pubK = null;
ByteArrayInputStream bis = new ByteArrayInputStream(tmp);
ObjectInput in;
try {
in = new ObjectInputStream(bis);
pubK = (PublicKey) in.readObject();
bis.close();
in.close();
} catch (Exception e) {
e.printStackTrace();
... | 1 |
final public void Class_name() throws ParseException {
/*@bgen(jjtree) Class_name */
SimpleNode jjtn000 = new SimpleNode(JJTCLASS_NAME);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Identifier();
} catch (Throwable jjte000) ... | 8 |
public double computeSimilarity(Map<Integer, Double> a, Map<Integer, Double> b) throws Exception {
double result = 0.0;
// compute inner product of a and b
double sum = 0.0;
for (int keya : a.keySet()){
if (b.containsKey(keya)){
sum += a.get(keya) * b.get(keya);
}
}
if (... | 5 |
private static void render(String s)
{
if (s.equals("{"))
{
buf_.append("\n");
indent();
buf_.append(s);
_n_ = _n_ + 2;
buf_.append("\n");
indent();
}
else if (s.equals("(") || s.equals("["))
buf_.append(s);
else if (s.equals(")") || s.equals("]"))
... | 9 |
public static void gerenciarCarros() {
int opcao;
String chassi, cor, modelo, placa;
float diaria;
int ano;
ArrayList<Carro> carros;
while (true) {
opcao = menu.menuCarros();
switch (opcao) {
case 1:
System.out.p... | 9 |
protected void skipAttributes(DataInputStream input) throws IOException {
int count = input.readUnsignedShort();
for (int i = 0; i < count; i++) {
input.readUnsignedShort(); // the name index
long length = input.readInt();
while (length > 0) {
long skipped = input.skip(length);
if (skipped == 0)
... | 3 |
public void close() {
try {
if ((this.connect != null) && (!this.connect.isClosed())) {
this.connect.close();
}
} catch (SQLException ex) {
System.out.println("Error: " + ex);
}
} | 3 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
String msj_exito =... | 2 |
public Tr(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "align":
align = Align.parse(this, v);
break;
case "bgcolor":
bgcolor = Bgcolor.parse(this, v);
bre... | 6 |
private final void parseDoctype() throws IOException {
int nesting = 1;
while (true) {
switch (read()) {
case -1:
fail(UNEXPECTED_EOF);
break;
case '<':
nesting++;
break;
case '>':
if (--nesting == 0) {
return;
}
break;
default:
break;
}
}
} | 5 |
public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... | 4 |
protected void keyTyped(char par1, int par2)
{
field_73905_m = false;
if (par2 == 15)
{
completePlayerName();
}
else
{
field_73897_d = false;
}
if (par2 == 1)
{
mc.displayGuiScreen(null);
}
... | 9 |
public void faltaEnvido(boolean envido, boolean envidoEnvido, boolean realEnvido, Humano jugadorH, Contador contador, boolean mentir){
System.out.println("\n"+this.getNombre()+": Falta Envido");
//condicional para ver si el humano quiere
if(jugadorH.cantoFaltaEnvido()){
System.out.println(jugadorH.getNombre()+... | 5 |
private boolean findUnexploredCellWithDist(int rowCount, int colCount) {
boolean foundMin = false;
for(int rowID = 0;rowID < rowCount ; rowID++){
for(int colID = 0;colID < colCount;colID++){
for(int drcID = OREIT_MIN;drcID <= OREIT_MAX;drcID ++){
if(!explored[rowID][colID][drcID] &&
distance[ro... | 5 |
public static void validateCity(City city) throws TechnicalException {
if (city == null) {
throw new TechnicalException(MSG_ERR_NULL_ENTITY);
}
if ( ! isStringValid(city.getName(), NAME_SIZE)) {
throw new TechnicalException(NAME_ERROR_MSG);
}
if ( ! isStri... | 4 |
private int[] createBowl(int [] platter)
{
int[] bowl = new int[NUM_FRUITS];
int sz = 0;
while (sz < bowlsize) {
// pick a fruit according to current fruit distribution
int fruit = pickFruit(platter);
int c = 1 + random.nextInt(3);
c = Math.mi... | 1 |
private static int compareIp(final InetAddress adr1, final InetAddress adr2) {
byte[] ba1 = adr1.getAddress();
byte[] ba2 = adr2.getAddress();
// general ordering: ipv4 before ipv6
if (ba1.length < ba2.length) {
return -1;
}
if (ba1.length > ba2.length) {
... | 5 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
@Test(expected = IllegalArgumentException.class)
public void testPickUpActionTestInventoryFull() throws InvalidActionException {
// Max size of inventory is 6
for (int i = 0; i < 6; i++)
player.getInventory().add(new LightGrenade(grid));
player.incrementActionsWithMaxActions();
final LightGrenade item = ... | 1 |
public SpriteSheet(String path) {
BufferedImage image = null;
try {
image = ImageIO.read(this.getClass().getResourceAsStream(path));
} catch (IOException e) {
e.printStackTrace();
}
if (image == null) {
return;
}
this.path = path;
this.width = image.getWidth();
this.height = image.getHeight(... | 4 |
public void calculateDeltaFunctionValuesForOutputNeuron(double teachingInput) {
myDelta = 0.0;
if (this.neuronType != ENeuronType.Output)
throw new UnsupportedOperationException(
"This function is only for the use with Output-Neurons! This is a "
+ this.neuronType.toString());
myDelta = teachingInp... | 2 |
private static void identifySeparator(File fname) {
separators.put(",", new int[2]);
separators.put(";", new int[2]);
separators.put(":", new int[2]);
separators.put("|", new int[2]);
separators.put("\t", new int[2]);
separators.put(" ", new int[2]);
java.io.Buffe... | 7 |
public void writeBooleanArray(boolean[] v) throws IOException
{
final int size = v.length;
final int byteCount = NBTInputStream.ceilDiv(size, 8);
final byte[] data = new byte[byteCount];
this.writeInt(size);
for (int boolIndex = 0, byteIndex = 0, bitIndex = 7; boolIndex < size; boolIndex++)
{
if (v[bo... | 3 |
public SingleTreeNode uct(StateObservationMulti state) {
SingleTreeNode selected = null;
double bestValue = -Double.MAX_VALUE;
for (SingleTreeNode child : this.children)
{
double hvVal = child.totValue;
double childValue = hvVal / (child.nVisits + this.epsilon);... | 3 |
protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) {
Color backColor = tabPane.getBackgroundAt(tabIndex);
if (!(backColor instanceof UIResource)) {
super.paintText(g, tabPlacement, font, m... | 9 |
public void updatePosition() {
if (xPos < xDestination)
xPos++;
else if (xPos > xDestination)
xPos--;
if (yPos < yDestination)
yPos++;
else if (yPos > yDestination)
yPos--;
if(xPos == xDestination && yPos == yDestination) ... | 8 |
public void toDot(String filename) {
System.out.println("Writing " + filename);
BufferedWriter w = null;
try {
FileWriter fstream = new FileWriter(filename);
w = new BufferedWriter(fstream);
w.write("digraph G {\n");
// nodes
for (PDAState s : states) {
String id = Util.dotId(s);
if ... | 9 |
public double standardDeviation_as_Complex_ConjugateCalcn() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
Complex[] cc = this.getArray_as_Complex();
double variance = Stat.varianceConjugat... | 2 |
public static boolean readUserSelectedFile() {
if (fileDialog == null)
fileDialog = new JFileChooser();
fileDialog.setDialogTitle("Select File for Input");
int option = fileDialog.showOpenDialog(null);
if (option != JFileChooser.APPROVE_OPTION)
return false;
File selected... | 5 |
public static synchronized JMenu createFileMenu(){
JMenu fileMenu = new JMenu("File");
// Open File
JMenuItem item = MenuBarUtils.createItem("Open", "open.png", new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileSummary fileSummary = FileUtils.openF... | 8 |
public ArrayList<String> wordBreak(String s, Set<String> dict) {
if (s == null || s.length() == 0) {
return null;
}
int len = s.length();
boolean[] t = new boolean[len + 1];
t[0] = true;
for (int i = 0; i < len; i++) {
if (!t[i])
continue;
for (String a : dict) {
int length = a.length();
... | 9 |
protected Cursor loadCursor(String address, int x, int y) {
if (address == null)
return null;
File f = null;
if (Page.isApplet() || FileUtilities.isRemote(address)) {
URL u = null;
try {
u = new URL(address);
}
catch (MalformedURLException e) {
e.printStackTrace();
return null;
}
... | 9 |
public void setTransform(AffineTransform af){
curTransform = af;
} | 0 |
public static void moveSelectedY(int y) {
if (Main.selectedId != -1 && !Main.getSelected().locked) {
RSInterface rsi = Main.getInterface();
if (rsi != null) {
if (rsi.children != null) {
rsi.childY.set(getSelectedIndex(), rsi.childY.get(getSelectedIndex()) + y);
}
}
}
} | 4 |
public boolean satisfies(ArrayList<Boolean> b)
{
//since a clause is a disjunction, if one variable is
//true, the whole clause is true.
for(Variable v: variables)
{
boolean varBoo = b.get(v.getNumber()-1); //get boolean
//for corresponding variable.
... | 2 |
@Override
public String buscarDocumentoPorFechaVencimiento(String fechaven1, String fechaven2) {
ArrayList<Venta> geResult= new ArrayList<Venta>();
ArrayList<Venta> dbVentas = tablaVentas();
String result="";
Date xfechaven1;
Date xfechaven2;
Date f1;
... | 8 |
@Test
public void testPutGetMessagesInOrder() {
try {
int noOfMessages = 5;
final CountDownLatch gate = new CountDownLatch(noOfMessages);
final ArrayList<Message> list = new ArrayList<Message>(noOfMessages);
for (int i = 0; i < noOfMessages; i++) {
Message msg = new MockMessage("TestMessage");
li... | 3 |
public String getFieldrefName(int index) {
FieldrefInfo f = (FieldrefInfo)getItem(index);
if (f == null)
return null;
else {
NameAndTypeInfo n = (NameAndTypeInfo)getItem(f.nameAndTypeIndex);
if(n == null)
return null;
else
... | 2 |
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String str;
int temp = 0;
int last = -1;
Boolean consecutive = true;
System.out.println("Please enter a string of positve integers.");
System.out.println("Please enter '... | 7 |
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.