text stringlengths 14 410k | label int32 0 9 |
|---|---|
public ControlUnitImpl(boolean pipeliningMode, MemoryBufferRegister mbr, BusController systemBus) {
this.pipeliningMode = pipeliningMode;
this.systemBus = systemBus;
this.mbr = mbr;
mar = new MAR();
genRegisters = new RegisterFile16();
pc = new PC();
rCC = new ConditionCodeRegister();
if (!pipe... | 2 |
public void paintComponent(Graphics g) {
if (gameStatus.get() == 0) {
super.paintComponent( g );
Graphics2D g2= (Graphics2D) g;
setBackground(Color.black);
g2.setStroke(new BasicStroke(2));
// We need to draw our walls.
g2.setPaint( Color.blue);
g2.fill(new Rectangle2D.Double(90,90,10,420... | 3 |
@Override
public List<Employee> getAll() {
return new ArrayList<Employee>(map.values());
} | 0 |
public boolean inRange(Position position){
return position.getX() >= 0 && position.getY() >= 0 && position.getX() < 8 && position.getY() < 8;
} | 3 |
public double getPrecio() {
return precio;
} | 0 |
@Override
public BMPImage apply(BMPImage image) {
BMPImage filteredImage = new BMPImage(image);
// double[][] core = {{1, 9, 3, 11},
// {13, 5, 15, 7},
// {4, 12, 2, 10},
// {16, 8, 14, 6}};
double[][] core = {
... | 8 |
private LinkedList<Direction> getPath(){
LinkedList<Direction> result = new LinkedList<Direction>();
ArrayList<Node> openlist = new ArrayList<Node>();
ArrayList<Node> closedlist = new ArrayList<Node>();
Node firstNode = new Node(null, start.x, start.y);
openlist.add(firstNode);
while(!openlist.isEm... | 5 |
private Boolean checkState()
{
int t=0;
String msg="";
Boolean stateOk=false;
try {
com.serialPort.writeByte((byte)SPACE_KEY);
while( t < 100 )
{
t++;
Thread.sleep(5);
if( com.serialPort.getInputBufferBytesCount() > 0 )
{
msg += com.serialPort.readString();
if( msg.endsWith... | 5 |
protected boolean printThisLevel(int[] levels) {
for (int currentLevel : levels) {
if (level == currentLevel) {
return true;
}
}
return false;
} | 2 |
public LinkedList<Order> getOwnOrders() throws SQLException {
LinkedList<String> select = new LinkedList<String>();
select.add("OrderID");
select.add("Date");
select.add("Amount");
select.add("Username");
select.add("ISBN");
LinkedList<String> from = new LinkedLis... | 1 |
public byte getTypeByte() {
return (byte)this.id;
} | 0 |
public void run() {
// connect to server
try {
connect(this.getUsername(), this.getPassword(), this.host, Integer.parseInt(this.port));
logger.info(fetchResponse());
if (isConnected()) {
for (String cmd : getCommandList()) {
if (cmd.trim().equalsIgnoreCase("")) {
continue;
}
logge... | 7 |
private double computeOverlap() {
for (int c = 0; c < numFClusters; c++) {
if (!(clustering.get(c) instanceof SphereCluster)) {
System.out.println("Compactness only supports Sphere Cluster. Found: " + clustering.get(c).getClass());
return Double.NaN;
}
... | 9 |
@Override
public String getSheetTypeString()
{
switch( grbit )
{
case SHEET_DIALOG:
return "Sheet or Dialog";
case XL4_MACRO:
return "XL4 Macro";
case CHART:
return "Chart";
case VBMODULE:
return "VB Module";
default:
return null;
}
} | 4 |
private void setDoubleValue(final Cursor cursor, final int index, final Field field, final Object object) {
final Double value = (!cursor.isNull(index) ? cursor.getDouble(index) : null);
Reflection.setFieldValue(field.getName(), object, value);
} | 1 |
private boolean jj_2_39(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_39(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(38, xla); }
} | 1 |
public Transition transitionCollapse(State from, State to) {
if (currentStep != CONVERT_TRANSITIONS) {
outOfOrder();
return null;
}
Transition[] ts = automaton.getTransitionsFromStateToState(from, to);
if (ts.length <= 1) {
JOptionPane.showMessageDialog(frame,
"Collapse requires 2 or more transiti... | 2 |
public TrackingDialog(final Panel panel) {
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.panel = panel;
setTitle("Video Tracking");
setBounds(1, 1, 300, 250);
Dimension size = getToolkit().getScreenSize();
setLocation(size.width / 3 - getWidth() / 3 + panel.getWidth(),
size.height / 3 - getHeigh... | 8 |
@Override public double nextDouble() throws IOException {
JsonToken token = peek();
if (token != JsonToken.NUMBER && token != JsonToken.STRING) {
throw new IllegalStateException("Expected " + JsonToken.NUMBER + " but was " + token);
}
double result = ((JsonPrimitive) peekStack()).getAsDouble();
... | 5 |
public void syncPlayerInfo(ArrayList<Player> players) {
int i;
for (i = 0; i < players.size() && i < Game.MAX_PLAYERS; i++) {
checkCircles[i].check();
nameFields[i].setText(players.get(i).getName());
typeFields[i].setText(players.get(i).getType().name());
... | 4 |
public Symbol lookup(String name) throws SymbolNotFoundError
{
//Check local table
for(Symbol s : symTable){
if(s.name().equals(name)){
return s;
}
}
SymbolTable symTablePtr = this.parent;
while(symTablePtr != null){
for(Symbol s : symTablePtr.symTable){
... | 5 |
public void validaCamposTelefone(String grupo, String telefone, String contato) {
if (grupo.isEmpty()) {
JOptionPane.showMessageDialog(null, "Grupo Inválido!");
cbx_grupo.requestFocus();
} else {
if (telefone.equals("( ) - ") == true) {
JOption... | 5 |
private ArrayList<Position> findPlayerEndPos()
{
Search.Result result;
ArrayList<Position> positions = new ArrayList<Position>();
for(Position box : this.boxes){
result = Search.bfs(this, new IsAtPosition(box.x+1,box.y), this.player.x, this.player.y);
if(result != nul... | 5 |
private void getLogcat(final Device device) {
new Thread() {
@Override
public void run() {
try {
final File ADB = adbController.getADB();
ProcessBuilder process = new ProcessBuilder();
List<String> args = new Arr... | 3 |
public int minDistance(String word1, String word2) {
if(word1.length() ==0) return word2.length();
if(word2.length() ==0) return word1.length();
int[][] res = new int[word1.length()+1][word2.length()+1];
res[0][0] = 0;
for(int i=1; i<=word1.length(); i++) res[i][0] = i;
... | 7 |
public static boolean isInsidePolygon(Vector2D[] verts, double x0, double y0){
boolean oddNodes = false;
for (int i = 0, j = verts.length - 1; i < verts.length; j = i, i++) {
Vector2D vi = verts[i];
Vector2D vj = verts[j];
if ((vi.y < y0 && vj.y >= y0 || vj.y < y0 && vi.y >= y0) && (vi.x + (y0 -... | 6 |
public void saveConsumable() {
BufferedReader reader;
try {
reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/consumables"));
String line;
int pos = 0;
StringBuilder fileContent = new StringBuilder();
String newLine = null;
while((line = reader.readLine()) !=... | 8 |
public int hashCode() {
return (name != null ? name.hashCode() : 0);
} | 1 |
public void run() {
MyMouseListener mouseListener = new MyMouseListener(getInstance());
addMouseListener(mouseListener);
addMouseMotionListener(mouseListener);
addMouseWheelListener(mouseListener);
addKeyListener(new MyKeyListener());
displayProgress("Loading...", 0);
startUp();
try {
do {
long s... | 5 |
private void printGrammar(List list, Grammar gram, String title){
list.clear();
list.add(title);
list.add("Axiom:");
list.add(gram.GetBeginNonTerminal());
list.add("Terminals:");
for(String s : gram.GetTerminals()){
list.add(s);
}
list.add("Non... | 3 |
@Override
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
switch (keyCode) {
case KeyEvent.VK_UP:
U = false;
break;
case KeyEvent.VK_W:
U = false;
break;
case KeyEvent.VK_DOWN:
D = false;
break;
case KeyEvent.VK_S:
D = false;
break;
case KeyEvent.VK_LEFT:
L ... | 8 |
public static void main(String[] args) {
String[] filenames = args.length > 0 ? args : DE406_FILES;
String strStep = System.getProperty("step", "10.0");
double dt = Double.parseDouble(strStep);
for (int i = 0; i < filenames.length; i++)
processFile(filenames[i], dt);
System.exit(0);
} | 2 |
boolean tryWhitespace() throws java.lang.Exception
{
char c;
c = readCh();
if (isWhitespace(c)) {
skipWhitespace();
return true;
} else {
unread(c);
return false;
}
} | 1 |
final private boolean jj_3R_28() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_48()) {
jj_scanpos = xsp;
if (jj_3R_49()) {
jj_scanpos = xsp;
if (jj_3R_50()) {
jj_scanpos = xsp;
if (jj_3R_51()) {
jj_scanpos = xsp;
if (jj_3_28()) {
jj_scanpos = xsp;
if (jj_3R_52()) {
jj_... | 8 |
public TargetPIDTurn(Target target, double timeout, boolean continuous){
super(target,Target.Axis.X,timeout,continuous,
0.5, 0.1, 1, // P, I, D
4,0.7, // tolerance, maxOutput (higher because of carpet)
1.0/20); // period
requires(Robot.driveTrain);
... | 0 |
private void createLeftSidePanelForUserSettings() {
btnNewUser = new JButton("Dodaj użytkownika");
btnNewUser.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
userDataRegister.setVisible(true);
}
});
btnNewUser.setBounds(6, 112, 207, 28);
leftSidePanel.add(btnN... | 0 |
public void center(int centerVs) {
Dimension otherSize = null;
Dimension dialogSize = null;
Point otherLocation = null;
if ((centerVs != VS_PARENT) && (centerVs != VS_SCREEN)) {
return;
}
// Center the dialog as directed.
switch (centerVs) {
... | 4 |
public ArrayList<Move> whiteSafeMoves(ArrayList<Move> allWhiteMoves) {
ArrayList<Move> rez = new ArrayList<Move>();
for (Move currMove : allWhiteMoves) {
int movedPiece = Utils.getMovedPieceFromMoveNumber(currMove.moveNumber);
int to = Utils.getTargetPositionFromMoveNumber(currM... | 8 |
public byte[] encode() {
int seqLength = 0;
EncodeStream stream = new EncodeStream(256);
//
// The transaction splits are encoded as an optional context-specific
// field with identifier 2
//
if (splits != null && !splits.isEmpty()) {
int splitsLeng... | 5 |
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
//需要处理的文件路径
//String originalDocsPath = PathConfig.ldaDocsPath;
String originalDocsPath = PathConfig.dblpPath;
//结果保存路径
String resultPath = PathConfig.LdaResultsPath;
//LDA参数文件路径
String parameterFile= Constant... | 5 |
public void setInformation(Tile[][] t, int length){
arrLength = length;
float rSize = (float) (SIZE / arrLength);
// This block of code will create a new Line and Color pair to correspond with each tile on the map
// This pair will then be rendered to represent the minimap.
for (int i = 0; i < arrLength; i... | 8 |
public void disable() {
disabled = true;
} | 0 |
public void getAlternateLabel(StringBuffer s) throws Exception {
//StringBuffer s = new StringBuffer();
FastVector tmp = (FastVector)m_ranges.elementAt(0);
if (m_classObject != null && m_training.classAttribute().isNominal()) {
s.append("Classified by " + m_classObject.getClass()... | 9 |
private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (accion.equals("Insertar")) {
if (lblNombre.getText().equals("") || lblNombre.getText().equals("Código Incorrecto")) {
J... | 7 |
public String validar(String usr, String cont){
try{
ConexionBD con = new ConexionBD();
Connection conex = con.conectar();
Statement stmt = conex.createStatement();
ResultSet rs = stmt.executeQuery("select * from profesor where nUsuario='"+usr+"';");
i... | 7 |
public void actionPerformed(ActionEvent e) {
if (e.getSource() == evalButton) {
evaluateRegex();
} else if (e.getSource() == nextMatchButton) {
jumpToNextMatch();
} else if (e.getSource() == prevMatchButton) {
jumpToPrevMatch();
}
} | 3 |
public static HttpServletRequest listAPatientBills(HttpServletRequest request) {
Models.DatabaseModel.Patient patient = new Models.DatabaseModel.Patient();
int patientID = Integer.parseInt(request.getParameter("patientID"));
patient = patient.findPatient(patientID);
ArrayList<Models.D... | 1 |
@Override
public int hashCode() {
int result = item != null ? item.hashCode() : 0;
result = 31 * result + (item2 != null ? item2.hashCode() : 0);
result = 31 * result + (item3 != null ? item3.hashCode() : 0);
result = 31 * result + (item4 != null ? item4.hashCode() : 0);
resu... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
HeuristicNode other = (HeuristicNode) obj;
if (fscore != other.fscore)
return false;
if (node == null) {
if (other.node != null)
retu... | 7 |
public final String getArtistBiography(String url)
throws ArtistBiographyException {
if(url.contains("en.wikipedia") == false)
throw new ArtistBiographyException("The expected url is not the english version of wikipedia web site");
//gets all info from wikipedia website
String bio= "[From en.wikipedi... | 7 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PrivateMessage that = (PrivateMessage) o;
if (recieverAccountId != that.recieverAccountId) return false;
if (senderAccountId != that.senderAcco... | 9 |
public MOB getAccountMob(String s)
{
MOB M=CMLib.players().getPlayer(s);
if(M!=null)
return M;
if(CMLib.players().playerExists(s))
return CMLib.players().getLoadPlayer(s);
if(CMLib.players().accountExists(s))
{
final PlayerAccount A=CMLib.players().getLoadAccount(s);
if(A.numPlayers()==0)
M=A... | 8 |
private List<Produto> carregaDadosDoBanco(){
this.dao = new ProdutoDAO();
List<Produto> listaDeProdutos = null;
try {
listaDeProdutos = dao.listarTodos();
} catch (ErroValidacaoException ex) {
//Logger.getLogger(frmListarProduto.class.getName()).log(Level.SEVERE, ... | 2 |
private void setProgress(
int proVal,
String proStr )
{
final int tmpVal = proVal;
final String tmpStr = proStr;
try
{
SwingUtilities.invokeAndWait(
new Runnable()
{
public void run( )
{
mainFrame.setProgress(tmpVal, tmpStr);
}
});
}
catch( Exception exc )
{
FastICAApp.exceptionDi... | 1 |
@Override
public void decodeTerm(long[] longs, DataInput in, FieldInfo fieldInfo, BlockTermState _termState, boolean absolute)
throws IOException {
final IntBlockTermState termState = (IntBlockTermState) _termState;
final boolean fieldHasPositions = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_... | 8 |
public static void setNumOS(String numOS) {
OS.numOS = numOS;
} | 0 |
public static void main(String[] args) {
if ((args.length > 1) || (args.length > 0 && args[0].equals("-h"))) {
System.out.println(USAGE);
System.exit(1);
}
String bankName;
if (args.length > 0) {
bankName = args[0];
new Client(bankName).ru... | 4 |
private static void thirdStrategy()
{
Semaphore MReading = new Semaphore(1);
Semaphore MWriting = new Semaphore(1);
Semaphore MPrio = new Semaphore(1);
Random r = new Random();
while(true)
{
if(r.nextDouble() > 0.5)
new Lecteur2(MReading,MWriting,MPrio).run();
else
new Redacteur2(MWriting... | 2 |
public static boolean isLongitude(String name, String dataType) {
if ((dataType == null || dataType.equalsIgnoreCase("lat-lng") || dataType.startsWith("float") || dataType.startsWith("double"))
&& (name.toLowerCase().equals("lng") || name.toLowerCase().equals("longitude") || name.toLowerCase().equals("lon") || na... | 8 |
public List<Long> getPathListAsEdges(List<Long> pathV) {
List<Long> pathE = new ArrayList<>(pathV.size());
for (int i = 0; i < pathV.size() - 1; i++) {
for (Long eid : graph.getEdges()) {
long currVertice = pathV.get(i);
long nextVertice = pathV.get(i + 1);
// case forward
// in this if/elseif ... | 8 |
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 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 void render(Renderer renderer) {
renderer.setColor(1, 0, 0);
if (this.isQuad()) {
renderer.drawQuad(a, b, c, d);
} else {
renderer.drawTriangle(a, b, c);
}
} | 1 |
public Node insert(Node node, int value)
{
if(node==null)
return new Node(value);
else
{
if(node.left==null) // Check is req to avoid duplicate insertion
{
System.out.println("Lnull-"+node.value);
node.left = insert(node.left,value);
}
else
{
System.out.p... | 2 |
public synchronized PacketReceipt getSentPacketWithSequenceNumber(int sequenceNumber) {
//ignore N/A sequence numbers
if(sequenceNumber == Packet.SEQUENCE_NUMBER_NOT_APPLICABLE)
return null;
//if the sequence number is for a packet in the future then we haven't sent it yet
int delta = Packet.deltaBetweenSeq... | 4 |
public void start(String[] spielerName){
for (int i = 0; i < 4; i++) {
if(spielerName[i] != null){
anzSpieler = anzSpieler + 1;
}
}
brauerei = new Brauerei[anzSpieler];
spieler = new Spieler[anzSpieler];
int[] posX = {5, 10, 15, 5, 10, 15, 5, 10, 15, 5, 10, 15, 5, 10, 15 };
int[] posY = {5, ... | 9 |
private int checkNumber(int i) {
int sum = 0;
for (Integer prim : primBrojevi) {
if (i == prim) {
return 1;
} else {
if (i % prim == 0) {
sum++;
}
}
}
if (sum == 1) {
return 4;
} else if (sum % 2 == 0) {
return 2;
}
return 3;
} | 5 |
protected void performChoice(int choice) {
if (choice == 1) {
decoding = new ViterbiDecoding(hmm);
}
else if (choice == 2) {
decoding = new PosteriorDecoding(hmm);
}
else if (choice == 3) {
if (decoding != null){
DecodingReporter reporter = null;
try {
reporter = new DecodingReporter("")... | 9 |
@Override
public void run() {
if(this.isValid()){
while(blnRepeat){
try {
Object readObject = inStream.readObject();
if(readObject instanceof IMessage){
IMessage msg = (IMessage)readObject;
sw... | 6 |
public void clean(String jobID) {
/*
// cheating, just remove the domain, TODO: change to per jobID in the future
DeleteDomainRequest request = new DeleteDomainRequest();
request.setDomainName(dbManagerDomain);
try {
DeleteDomainResponse response = service.deleteDomain(request);
... | 8 |
@Override
public double escapeTime(Complex point, Complex seed) {
// Keep iterating until either n is reached or divergence is found
int i = 0;
while (point.modulusSquared() < escapeSquared && i < iterations) {
// Z(i+1) = complement(Z(i) * Z(i)) + c
point = point.com... | 2 |
private RandomListNode copyNext (RandomListNode head) {
RandomListNode headNew = new RandomListNode(head.label);
RandomListNode node1 = head.next;
RandomListNode node2 = headNew;
map.put(head, headNew);
RandomListNode node = null;
while(node1 != null){
node ... | 1 |
private void setcamera(String camtype) {
curcam = camtype;
Utils.setpref("defcam", curcam);
String[] args = camargs.get(curcam);
if (args == null) args = new String[0];
MapView mv = ui.mapview;
if (mv != null) {
if (curcam.equals("clicktgt")) mv.cam = new Map... | 6 |
private int jjMoveStringLiteralDfa30_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 29);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 29);
}
switch(curChar)
{
case 54:
return jjMoveStringLiter... | 5 |
@EventHandler
public void EndermanNausea(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.getEndermanConfig().getDouble("Enderman.Na... | 6 |
private void initiateCandidateSolutions() {
int columns = objectiveFunction.getVariables();
position = new double[numberOfParticles][columns];
double random = upperLimit - lowerLimit;
for(int i = 0; i < numberOfParticles; i++){
for(int k = 0; k < objectiveFunction.getVariables(); k++){
double d = lowerLi... | 4 |
public double calc() {
if (calcMethod == null ) {
throw new RuntimeException("CalcMethod not yet maintained");
}
if (position == null ) {
throw new RuntimeException(" Position not yet maintained");
}
return calcMethod.calc(position);
} | 2 |
public boolean resultCheck(final ResultDataBean databean) {
boolean checkflag;
// どれか一つでもnullがあったらエラー
if (databean.getOrderId() == null || databean.getOrderId().equals("null")) {
checkflag = false;
} else if (databean.getmStatus() == null || databean.getmStatus().equals("nul... | 8 |
@SuppressWarnings("unchecked")
public static TreeMap<String, float[][]> restoreTM2D(String findFromFile) {
TreeMap<String, float[][]> dataSet = null;
try {
FileInputStream filein = new FileInputStream(findFromFile);
ObjectInputStream objin = new ObjectInputStream(filein);
try {
dataSet = (TreeMap<Stri... | 2 |
public void scale(int x, int y, int z) {
for (int i = 0; i < vertexCount; i++) {
xVertex[i] = xVertex[i] * x / 128;
yVertex[i] = yVertex[i] * z / 128;
zVertex[i] = zVertex[i] * y / 128;
}
} | 1 |
public static void findContinuesNumber(int sum){
if(sum < 3){
return ;
}
int begin = 1;
int end = 2;
int middle = (1 + sum)/2;
int curSum = begin + end;
while(begin < middle){
if(curSum == sum){
printContinuesNumber(begin,end);
break;
}
else if(curSum > sum){
curSum -= begin;
... | 4 |
@Override
public String list(){
String toRet = "";
List<String> mods = new ArrayList<>(this.getModifiers());
Collections.sort(mods);
for(String mod : mods){
toRet += mod + " ";
}
toRet += this.getPackage() + "." + this.getName() + "\n" + "Fields: ";
if(fields.size() == 0){
toRet += "(none)";
}
... | 7 |
public String goToUserProductDetails() {
this.product = this.userFacade.getProductById(this.id);
return "userProductDetails";
} | 0 |
private int insert(Funcionario f) {
Connection con = null;
PreparedStatement pstm = null;
int retorno = -1;
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS);
pstm.setString(1, f.getNo... | 3 |
public Document transformSee() throws XPathExpressionException
{
transformDocument = realDocument;
NodeList nodes = Parser.nodesByXPath(transformDocument, "//@*[starts-with(., '@')]");
for(int i =0; i < nodes.getLength(); i++)
{
Node nodeValue = nodes.item(i);
String newStringNodeValue = "";
for(Stri... | 9 |
public static void main(String[] args) {
StdDraw.text(.5, .5, "Click this window and type m, k, o, comma, l or p");
// big font for displaying the currently pressed key
StdDraw.setFont(new Font("SansSerif", Font.BOLD, 120));
Guitar guitar = new Guitar();
// keys to pluck a string
char[] pluckKeys = { 'm', '... | 9 |
public String getInternalName(){ //just for trying to preserve old way of saving.
//ASSUME that ID's are Independent
return myInternalName == null? myInternalName = "Machine"+ getID() : myInternalName; //create an internal name if one has not been assigned explicitly
} | 1 |
public boolean intersects(Rectangle other)
{
if ((x > (other.x + other.width)) || ((x + width) < other.x))
{
return false;
}
if ((y > (other.y + other.height)) || ((y + height) < other.y))
{
return false;
}
return true;
} | 4 |
public void merge(CountingBloomFilter cbf)
{
assert cbf != null;
assert filter_.length == cbf.filter_.length;
assert hashCount == cbf.hashCount;
for ( int i = 0; i < buckets(); ++i )
{
Bucket b = new Bucket(i);
Bucket b2 = cbf.getBucket(i);
... | 2 |
public void write(byte[] input) throws IOException {
synchronized (chunks)
{
if (currentChunk == null)
{
currentChunk = new Chunk();
chunks.add(currentChunk);
lastChunk = currentChunk;
}
int toWrite = input.length;
int posArray = 0;
while (true)
{
if (positionWithinChunk + toWri... | 7 |
public void setTickTime(int ups) {
if (this.tickTimer != null && this.tickTimer.isRunning()) this.tickTimer.stop();
this.tickTimer = new Timer(1000 / ups, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (isRunning) onTick(1);
}
});
this.tickTimer.start();
} | 3 |
public final void assignment() throws RecognitionException {
ParserRuleReturnScope labelfield2 =null;
ParserRuleReturnScope value3 =null;
try {
// C:\\Users\\Shreeprabha\\Documents\\GitHub\\CecilRPi\\src\\org\\raspberrypi\\cecil\\model\\grammar\\Cecil.g:164:3: ( ( '.' labelfield )? 'insert' value )
// C:\\... | 7 |
public void actionPerformed (ActionEvent ae)
{
if (ae.getActionCommand().equals("Envoyer"))
{
// On envoi un message s'il n'est pas vide
if (bcast_chat.getText().length() > 0)
{
String my_contact = Cast.getAddress() + ";" + program.getNickname();
Message message = new Message(my_contact, null, 10,... | 3 |
public ResultSet select(String column[]){
try
{
stmt = conn.createStatement();
String query = "select ";
for(int i=0;i<column.length;i++){
query += column[i] + ", ";
}
query = query.substring(0, query.length()-3);
... | 2 |
int getMaxNumberOfSameWords(){
int result = 0;
int currNumber;
Sentence sentence = new Sentence(this); //copy of current sentence
while(sentence.numberOfSentenceElements() > 0){
currNumber = 1;
SentenceElement firstElement = sentence.getSentenceElement(0);
... | 5 |
@Override
public boolean equals(Object obj)
{
if (obj instanceof String)
{
return this.str.equals(obj);
}
else if (obj instanceof Token)
{
Token tkn = (Token)obj;
if (!this.str.equals(tkn.str))
{
return false;
}
if (this.line != tkn.line)
{
return false;
}
if (... | 5 |
private void Clean_List()
{
for (int i = 0; i < positions.size(); i++)
{
for (int j = 1; j < positions.size(); j++)
{
if (i != j && positions.get(i).getPos().Equals(positions.get(j).getPos()))
positions.remove(j--);
}
}
} | 4 |
public static void splitUpMetaInfo(LinkInfo li)
{
li.getMetaData().put("power",li.getPower());
li.getMetaData().put("time", li.getTimestamp());
li.getMetaData().put("source", li.getSourceNode());
li.getMetaData().put("destination", li.getDestinationNode());
if(li.getMetaDat... | 6 |
@Override
public String howMuch(String item, String client, String market) {
logger.info("Calculating how much is the delivery. " +
"item " + item + ", client " + client + ", market " + market);
// business rule: delivery date depends of the market last letter
// business rule: delivery date depends of t... | 8 |
private List<NodeTuple> mergeNode(MappingNode node, boolean isPreffered,
Map<Object, Integer> key2index, List<NodeTuple> values) {
List<NodeTuple> nodeValue = node.getValue();
for (Iterator<NodeTuple> iter = nodeValue.iterator(); iter.hasNext();) {
final NodeTuple nodeTuple = ite... | 8 |
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.