method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5e0bcacb-bcb2-460d-b2b5-7ae33f9d69b0 | 3 | public String verificaValorBotao(String valorBotao){
for(int i = 0; i < valorBotao.length(); i++){
if(valorBotao.charAt(i) > '9' || valorBotao.charAt(i) < '0'){
valorBotao = valorBotao.replace(valorBotao.charAt(i), ' ');
}
}
valorBotao = valorBotao.trim();... |
932a380b-cc4a-4105-a706-81fe24534d92 | 4 | private static void setLookAndFeel()
{
try
{
UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
}
catch (UnsupportedLookAndFeelException e) {}
catch (ClassNotFoundException e) {}
catch (InstantiationException e) {}
c... |
077a0573-692d-48fa-8b7c-9c573455edce | 4 | @Test
public void fuzzyTest() {
final int n = 200_000;
final ArrayList<Integer> list = new ArrayList<Integer>(n);
for(int i = 0; i < n; i++) list.add(i);
ObjectArray<Integer> arr = ObjectArray.from(new Iterator<Integer>() {
int i;
@Override
public boolean hasNext() {
return ... |
190f766b-f750-432a-a544-f4512593c8c7 | 6 | public void propertyChange(PropertyChangeEvent aPropertyChange) {
// if (aPropertyChange.getPropertyName().equalsIgnoreCase("message")) {
// System.out.println(aPropertyChange.getNewValue());
// messengerView.setChatText((String) aPropertyChange.getNewValue());
// //clientView.setHistory((String) aPropertyChang... |
74f5c1e8-43e2-4ee5-8350-b71852887c5c | 0 | public TypeEntity() {
setId(System.nanoTime());
} |
6e9b4b10-1345-467a-bd6a-09437e3fc677 | 4 | public void addSaldo(double monto, boolean registrarComoDeposito){
if(activa){
this.saldo+=monto;
if(registrarComoDeposito){
montoDepositos+=monto;
}
}else{
saldo+=(monto-(monto*0.2));
if(registrarComoDeposito){
montoDeposit... |
e9dd975d-9f78-46b5-b45b-1f30387642cf | 9 | private Map<String, Float> run() {
int index = 0;
List<Process> processesRan = new ArrayList<Process>();
Map<String, Process> processesStarted = new HashMap<String, Process>();
Map<String, Float> outputs = new HashMap<String, Float>();
processes = subListProcesses(processes, TOTA... |
0979eba3-33e4-41b5-b296-5a7358e67d59 | 1 | public synchronized String nextMessage() {
String message = null;
int messageEnd = this._stringBuf.indexOf(this._messageSeparator);
if (messageEnd > -1) {
message = this._stringBuf.substring(0, messageEnd);
this._stringBuf.delete(0, messageEnd+this._messageSeparator.length());
... |
19ad35e0-32f3-4f57-bd28-8e3c172f12f8 | 1 | public void setMovingUp(boolean isMovingUp) {
this.isMovingUp = isMovingUp;
this.isMovingDown = isMovingUp ? !isMovingUp : this.isMovingDown;
} |
4d60d450-33e4-4377-aedd-d6d89341f13b | 2 | private int CountOne(String binaryString)
{
int countOne = 0;
for(int i = 0; i < binaryString.length(); ++i)
{
if(binaryString.charAt(i) == '1')
countOne++;
}
return countOne;
} |
5060e6a1-508b-49bb-b75b-08794d2ad61b | 2 | public final String readString() {
int len = readU32();
if (len > maxStringLength)
throw new ErrorException("InStream max string length exceeded");
byte[] str = new byte[len];
readBytes(str, 0, len);
String utf8string = new String();
try {
utf8string = new String(str, "UTF8");
}... |
b16aada9-ba81-4fe7-96f6-49199df11d8c | 4 | public static void monTurn(Monster mon)
{
int whatDo = (int)(Math.random()*100);
if(mon.isAlive())
{
if(mon.isDefending()) //if it's defending. Stop.
{
mon.defend();
}
// Now will it attack or defend?
if(mon.willAttack(whatDo) && !mon.dying())
{
monAttack(mon);
}
else
{
mon... |
754f3cdd-44da-40bc-9ffa-7ccec7b68266 | 2 | public static void Walk2D(int n) throws ParameterException {
RandomVariable X = new ContinuousUniform(-1, 1);
RandomVariable Y = new ContinuousUniform(-1, 1);
double x = 0;
double y = 0;
int maxTime = 1000;
File file = new File("C:\\walk2D" + n + ".csv");
try {
PrintStream ps = new PrintStream(new File... |
97afe60e-8805-4e2c-a1eb-71c6998d5104 | 9 | protected User readUser() throws Exception {
if ( mainReadHandle == null ) {
throw new Exception("Read Handle is null.");
}
Read in = mainReadHandle;
if ( !in.nextLine().isEmpty()) {
throw new Exception("Read Error.");
}
if ( !in.nextLine().equals("UserObjectB")) {
throw new Exception("Read Error."... |
fdde0408-3ecd-46ad-ab5d-1feffee15a6f | 7 | public boolean isPlayerIn(Player player)
{
Location whereishe = player.getLocation();
//player.sendMessage("testing you in "+whereishe.getWorld().getName());
if(whereishe.getWorld().getName().equals(props.get("world")))
{
//init.log.info(sx+"/"+ex+" "+sy+"/"+ey+" "+sz+"/"+ez);
if(whereishe.getX() >... |
61f9c9f3-4167-46de-a18c-ae9fa48302cb | 3 | private void verifierSiValide() throws XmlParserException
{
Source xmlFile=null;
try
{
xmlFile = new StreamSource(this.fichierATraiter);
SchemaFactory schemaFactory = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
File file;
if(this.type==TypeFichier.LIVRAISONS)
{
file... |
a7739cc5-5f57-4d81-87ab-35349387c63a | 2 | static void writeAll(LinkedList list, DataOutputStream out)
throws IOException
{
if (list == null)
return;
int n = list.size();
for (int i = 0; i < n; ++i) {
AttributeInfo attr = (AttributeInfo)list.get(i);
attr.write(out);
}
} |
f606431c-f263-4c33-8468-0b486bfb1c94 | 5 | protected boolean sequenceDetected(
ICharacterScanner scanner,
char[] sequence,
boolean eofAllowed) {
System.out.println("[sequenceDetected]"+new String(sequence));
for (int i= 1; i < sequence.length; i++) {
int c= scanner.read();
if (c == ICharacterScanner.EOF && eofAllowed) {
return true;
} ... |
54d50516-9f2e-4fcf-b132-9962b5b2de81 | 4 | public FloorGraphics(List<CellDescription> fp) {
floor = fp;
int floorXdimension = 0;
floorYdimension = 0;
for (int i = 0; i < fp.size(); i++) {
if (fp.get(i).locX() > floorXdimension) {
floorXdimension = fp.get(i).locX();
}
if (fp.get(i).locY() > floorYdim... |
67fcdbea-6841-48d0-815b-60319ed4c08a | 9 | public void handleInput() {
if(InputHandler.isDown(InputHandler.W) && !map.isMoving()) {
yPos -= 60;
}
else if(InputHandler.isDown(InputHandler.S) && !map.isMoving()) {
yPos += 60;
}
else if(InputHandler.isDown(InputHandler.A) && !map.isMoving()) {
xPos -= 60;
}
else if(InputHandler.isDown(Inp... |
10ef2c8c-d652-4f35-bed9-f05ff78adc86 | 2 | public TicTacToeMain() {
setTitle("Tic Tac Toe");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(false);
JPanel centerPanel = new JPanel(new GridLayout(3,3));
Font font = new Font("Arial",Font.BOLD, 32);
for(int i=0;i<3;i++)
for(int j=0;j<3;j++) {
buttons[i][j] = new JButton(" ");
... |
54d91aed-4c28-4dfc-ab86-6d8e18295dd3 | 8 | public boolean isConnected(COLOR myColor, int x, int y)
{
if(isInBound(x+1,y)&&myColor==this.board.get(x+1).get(y).color)
return true;
if(isInBound(x-1,y)&&myColor==this.board.get(x-1).get(y).color)
return true;
if(isInBound(x,y+1)&&myColor==this.board.get(x).get(y+1).color)
return true;
if(isInBound(... |
3ea9dd7a-a9fd-478d-a917-0267c1c49eab | 0 | private long getTimeToDateInSeconds(Date date) {
return date.getTime() / 1000;
} |
7779ff5c-b646-474b-9840-ee32e122497e | 6 | public Element handle(FreeColServer server, Player player,
Connection connection) {
Game game = server.getGame();
ServerPlayer serverPlayer = server.getPlayer(connection);
Unit unit;
try {
unit = player.getFreeColGameObject(builderId, Unit.class);
... |
1e226f71-68d4-4d89-9b9a-56b53c27f842 | 3 | public boolean containsRelOp(String locationpath){
if (locationpath.contains("=") || locationpath.contains("<") || locationpath.contains(">")){
return true;
}else{
return false;
}
} |
4437d8b3-3210-469b-8e28-de407381f8fc | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((addressMap == null) ? 0 : addressMap.hashCode());
result = prime * result + currentAddress;
result = prime * result + currentParameterAddress;
result = prime * result
+ ((descriptorMap == null) ? 0 :... |
ca83233a-7567-45b2-a29f-e8e626388427 | 3 | private ContextCapability getContext( int x, int y ){
float best = 0.f;
ContextCapability result = null;
for( ContextCapability item : site.getCapabilities() ){
float value = item.isContextMenuEnabledAt( x, y );
if( value >= best && value > 0.f ){
best = value;
result = item;
}
}
return... |
a98b747f-877e-4639-aa01-1938bd915be5 | 9 | public void createButtonSelected(SelectionEvent event) {
/*
* Remember the example shells so they
* can be disposed by the user.
*/
if (shellCount >= shells.length) {
Shell [] newShells = new Shell [shells.length + 4];
System.arraycopy (shells, 0, newShells, 0, shells.length);
shells = newShells... |
7f9a2224-66c8-4b52-9de5-f690b6b31235 | 6 | public BigInteger[] getBNOID(byte type) throws ASN1DecoderFail {
if(data[offset]!=type) throw new ASN1DecoderFail("OCTET STR: "+type+" != "+data[offset]);
byte[] b_value = new byte[contentLength()];
Encoder.copyBytes(b_value, 0, data, contentLength(),offset+typeLen()+lenLen());
int len=2;
for(int k=1;k<b_valu... |
aff6779b-fb99-4960-817d-e3d56eb3603f | 3 | public static void main(String[] args)
{
long startTime = System.currentTimeMillis();
if(args.length == 0){
System.out.println("Please provide the location of the workload file!");
System.exit(1);
}
try {
String fileName = args[0];
... |
f9fd97b2-ce07-4bd8-a04c-1ac3f3e4016e | 0 | public String toString() {
return super.toString();
} |
9473c5ab-f109-4e45-b893-0d8d53976960 | 4 | private void printASCII(JadeTree tree, PrintWriter out) {
tree.update();
numExternalNodes = tree.externalNodes.size();
numInternalNodes = tree.internalNodes.size();
numBranches = numInternalNodes + numExternalNodes - 1;
umbrella = new boolean[numExternalNodes];
position = new int[numExternalNodes];
min... |
78822408-02a3-496c-9d07-b25b6b8d3e7a | 3 | public void drawTextBox() {
this.drawRect(this.xPos - 1, this.yPos - 1, this.xPos + this.width + 1, this.yPos + this.height + 1, -6250336);
this.drawRect(this.xPos, this.yPos, this.xPos + this.width, this.yPos + this.height, -16777216);
if(this.isEnabled) {
boolean var1 = this.isFocused && th... |
9f1a73c9-423e-488d-ba32-16e71f767dc1 | 9 | public static int containsStringAdvertisement(Element e, String s, String s2, String s3) {
final NodeList nl = e.getElementsByTagName(s);
final int length1 = nl.getLength();
Element eAux = null;
NamedNodeMap nnm = null;
int result = 0;
for (int i = 0 ; i < length1 ; ++i) {
final NodeList nl2 = nl.item(i)... |
fdd42bbb-3527-4bef-b05b-d6502859760c | 8 | private void addText(String txt) {
org.w3c.dom.Element el=_elemStack.peek();
txt=txt.replaceAll("\\s+", " ");
int i,k,n;
for(i=0,k=0,n=txt.length();i<n;i++) {
char c=txt.charAt(i);
switch (c) {
case '\t': if (k!=i) { el.appendChild(_xmlnote.createTextNode(txt.substring(k,i))); }
el.appendChild... |
2c6be9a3-77d9-4509-9285-647952f6a7e1 | 0 | public void start()
{
totalFiles ++;
updateUploadInfo("start");
} |
0c31221b-1c1b-4ebc-95f2-7d81193fc3ed | 8 | public static CommandLine parser(String[] args) throws ParseException {
// create Options object
Options options = new Options();
// add t option
options.addOption(new Option("help", "print this message"));
options.addOption(AESKEY, true, "AES key");
options.addOption(FILE_OUT_PATH, true, "Output path");
... |
d348a87f-f7a7-4217-9dcd-ade72d86f17c | 4 | private boolean checkPlayerPiecesForPlacement(HantoPlayerColor aColor)
{
boolean legalMove = false;
List<HantoCell> possibleLocations = new ArrayList<HantoCell>();
possibleLocations = generatePossibleMoves();
for(int i = 0; i < possibleLocations.size();i++)
{
if(!isAdjacentToEnemy(possibleLocations.get(i... |
048f1560-957c-4dcf-9a9c-2aac677bacc7 | 9 | private void updateForDragOver(Point where) {
int ex = where.x;
int ey = where.y;
DockLocation location = null;
DockLayoutNode over = over(ex, ey);
if (over != null) {
int x = over.getX();
int y = over.getY();
int width = over.getWidth();
int height = over.getHeight();
ex -= x;
ey -= y;
i... |
6ffcf977-1a49-47fb-aac7-ab946d5c3ed5 | 8 | @Override
public void previousDomainValid() {
if (last == null) {
throw new IllegalStateException("No previous domain.");
}
int center = last.getLower() + (last.getUpper() - last.getLower()) / 2;
int lower1 = last.getLower();
int upper1;
int lower2;
int upper2 = last.getUpper();
if (cen... |
ab667109-ffc3-4b4a-9744-7903d8862840 | 8 | private static StringBuffer build(StringBuffer sb, StringBuilderItem item) {
if (item.getValue() != null && !item.getValue().equals("")) {
switch (item.getFormattingType()) {
case FORMAT_ALONE:
sb.append(item.getValue());
break;
... |
5a31e119-4912-4647-8806-c708d41624e5 | 2 | private void showCell(int x, int y){
if((x < fieldSize)&&(y < fieldSize)) {
System.out.print("[" + field[x][y] + "]");
}
else {
System.out.println("Wrong data in showCell");
}
} |
441a281b-0ed4-4019-992e-8bab2c11bb65 | 8 | protected JTableExtender initializeTable(Object obj) {
//System.out.println("In regular multiple initialize");
boolean multiple = false;
int inputCount = 0;
if(this.getEnvironment().myObjects!=null){
multiple = true;
inputCount = 1;
}
//System.out.println("In initialize:"... |
519da054-239d-422a-b25a-21c4e9b18111 | 7 | @Override
public void processPlugins() {
for(Plugin plugin : this.registry.getPlugins()) {
List<Class<?>> interfaces = ClassUtils.getAllInterfaces(plugin.getClass());
if(interfaces.contains(HasInvocationHandler.class)) {
Class<? extends InvocationHandler> handler = ((HasInvocationHandler) plugin).getInvoca... |
1c8e7882-4521-46ef-9e7a-a1ba723f636a | 5 | private void logStart() throws Exception {
try {
// Before opening transaction for batch_log, do any queries
// necessary to look up batch_num and batch_seq_nbr
Long tempBatchNum = -1L;
Long tempBatchSeqNbr = -1L;
// If this is a new run for this job, set batch_num to batch_log_id,
// and batch_... |
b793239f-d667-4f5d-be5d-9f6f0c3ecf26 | 1 | public static void error(String msg){
if(Settings.debug) System.err.println(error+" "+msg.trim());
} |
6592537c-5a67-4b66-ba09-59547e6f79f5 | 3 | private void updateStateIngredRight(List<Keyword> keywords, List<String> terms,
List<String> approval) {
RecipeLearningState nextState;
if (approval.isEmpty()) {
DialogManager.giveDialogManager().setInErrorState(true);
}
else if (approval.get(0).equals("yes")) {
nextState = new RecipeLearningState();
nextSt... |
407d7d77-1c8f-4097-84ab-35747551ca76 | 5 | public double cos(int a){
//normalizing
if(a>360){
a %= 360;
}else if(a<0){
a %= 360;
a += 360;
}
//return
if(a <= 90){
return cos[a];
}else if(a <= 180){
return -cos[180 - a];
}else if(a <= 270){
return -cos[a - 180];
}else{
return cos[360 - a];
}
} |
5d4d38e4-4793-4713-a46e-a18d1c4455dd | 6 | public int uniquePathsWithObstacles(int[][] obstacleGrid) {
int m = obstacleGrid.length;
int n = obstacleGrid[0].length;
int[] result = new int[n];
for (int i = 0; i < n; i++) {
if (obstacleGrid[0][i] == 1)
break;
result[i] = 1;
}
... |
093a5fe4-73d2-44c4-bdf3-4f9805d8739a | 1 | public final long getLong(String key) throws JSONException {
Object o = get(key);
return o instanceof Number ?
((Number)o).longValue() : (long)getDouble(key);
} |
2ad07e41-4e87-46f6-9a2b-a1a12da33d0a | 4 | public void spinAction(JSpinner spin, boolean increase){
if(flag == 0){ //calling setValue() calls this method so this avoids recursion
int value = (Integer)spin.getValue();
if(increase == true){
if(pool > 0){
pool--;
}
else{
flag = 1;
spin.setValue(--value);
}
}
else{
... |
8b62a20d-72f4-4669-a51d-f13866469653 | 5 | public void setFrequency(int f)
{
// Bit 2 Selects White/Sync noise
if ((f & 0x04) == 0x04)
tapped_bits = WHITE_NOISE;
else
tapped_bits = SYNC_NOISE;
// Reset shift register to preset
shift = RESET;
switch(f&0x03)
{
case 0... |
db42a51b-0eee-4e61-a2f1-241eb34e95c0 | 7 | @Override
protected void syncSpi() throws BackingStoreException
{
if (isRemoved())
{
return;
}
final File file = FilePreferencesGenerator.getPreferencesFile();
if (!file.exists())
{
return;
}
synchronized (file)
{... |
714e09ce-05c6-4bd0-a95a-475b3e7f6bbb | 4 | public boolean onCommand(Player player, String[] args) {
File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml");
FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language);
if(player.hasPermission(getPermission())){
if(args.length... |
dd34ef15-6aa2-476f-952b-300027a820fc | 7 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((color == null) ? 0 : color.hashCode());
result = prime * result
+ ((imageUrl == null) ? 0 : imageUrl.hashCode());
result = prime * result
+ ((originalPrice == null) ? 0 : originalPrice.hashCode());
r... |
e93283e4-b495-463e-be5b-ec0194528007 | 6 | @EventHandler
public void SilverfishWeakness(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.getSilverfishConfig().getDouble("Silve... |
21ae3f4e-9a27-47d2-bce8-ddbd697e0de8 | 2 | @Override
protected Icon doInBackground() throws Exception {
//System.out.println("irl to imageicon...");
Icon temp = null;
temp = imageCache.IMAGE.imageCheck(URL);
if (temp != null){
return temp;
}
try {
temp = (new ImageIcon... |
570fdbf3-3c5a-4fce-bd09-304d196f6d7f | 4 | public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String sNumber1 = reader.readLine();
String sNumber2 = reader.readLine();
String sNumber3 = reader.readLine();
int n1 = Integer.parseInt(sNu... |
78ce4923-1e79-439f-869e-752dc0f398c3 | 4 | public Groop getSingleGroop(int num) throws SQLException
{
// Get a statement and run the query
String sql = "SELECT Groops.GroopNumber, groops.sort_name, groops.show_name, LineUp.LineUpNumber, ArtistNumber FROM Groops,LineUp,LineUpDetails WHERE Groops.groopnumber = ? AND Groops.GroopNumber = LineUp.Groo... |
11c51678-230a-4697-930c-e076f98dc656 | 8 | @Override
public int doStartTag() throws JspException {
try {
JspWriter out = pageContext.getOut();
HttpSession session = pageContext.getSession();
FloralComposition floralComposition = (FloralComposition) session.getAttribute(Constants.PARAM_NAME_FLORAL_COMPOSITION);
... |
e9f56301-9936-4b58-9c58-829bc4ebb30e | 3 | public static int readVarInt(DataInputStream in) throws IOException {
int i = 0;
int j = 0;
while (true) {
int k = in.readByte();
i |= (k & 0x7F) << j++ * 7;
if (j > 5) throw new IOException("VarInt too big");
if ((k & 0x80) != 128) break;
}
return i;
} |
5506ef2c-3878-44d3-84ae-ac6858f29a98 | 0 | @Override
public String getName() {
return super.getName();
} |
106fc7f2-b382-4815-b081-a6ab737625bc | 0 | public String getVille() {
return ville;
} |
18c91068-13b1-4d41-9f6b-14800dc5f182 | 7 | final void method959(int i, int i_64_, byte i_65_, r var_r) {
anInt1621++;
r_Sub2 var_r_Sub2 = (r_Sub2) var_r;
i_64_ += 1 + ((r_Sub2) var_r_Sub2).anInt10484;
i += 1 + ((r_Sub2) var_r_Sub2).anInt10489;
int i_66_ = ((Class104) this).anInt1624 * i_64_ + i;
int i_67_ = 0;
int i_68_ = ((r_Sub2) var_r_Sub2).anInt10487... |
ade50182-c9e2-4858-bf93-63a7c84ec8e2 | 2 | public void setEquipa(Collection<String> equipa, String cod_Competicao) {
try {
Statement stm = conn.createStatement();
for (String p : equipa) {
String sql = "Insert into EquipaTorneio(cod_equipa,cod_competicao)Values('" + p + "','" + cod_Competicao + "')";
... |
fced6850-ec60-49d1-927a-27d43d9bd729 | 1 | private void dragColumnDividerAndScrollIntoView(Point where) {
if (mAllowColumnResize) {
int x = where.x;
dragColumnDivider(x);
scrollContentIntoView(x - AUTO_SCROLL_MARGIN, getContentViewBounds().y, AUTO_SCROLL_MARGIN * 2, AUTO_SCROLL_MARGIN * 2);
}
} |
98b57086-1e16-448d-8a3e-ede7cc93e6d5 | 5 | @Override
public final double rent(int days) {
if(copies>0){
double total = price;
if(estado.equals("ESTRENO") && days > 3)
total += (days-3)*(price*0.5);
else if(estado.equals("NORMAL") && days > 5)
total += (days-5)*(price*0.5);
... |
046a2fed-df99-43f2-8e5a-bb67ba94b76e | 5 | public static LinkedList<BigInteger> tdFactors(BigInteger n)
{
// Set a BigInteger var representing #2
BigInteger two = BigInteger.valueOf(2);
LinkedList<BigInteger> fs = new LinkedList<BigInteger>();
// If n < 2, throw an IllegalArgumentException
if (n.compareTo(two) < 0)
{
throw new IllegalArgumentEx... |
c59bc2b0-1eb6-455c-ac3c-2116c4640b0d | 4 | public void termCompare() {
String term = "select term from term5index";
ResultSet termSet = null;
termSet = sqLconnection.Query(term);
initTermList(termSet);
int count = 0;
for (String word : termList) {
if (count == 2)
return;
int currentID = termList.indexOf(word) + 1;
for (int i = currentID... |
94943be3-7f37-49b0-9e68-212831c309d3 | 9 | private static void multiplyOutAndSubstitute(BuildState state, Element subOrBracket) throws StructureBuildingException {
Attribute multiplierAtr = subOrBracket.getAttribute(MULTIPLIER_ATR);
int multiplier = Integer.parseInt(multiplierAtr.getValue());
subOrBracket.removeAttribute(multiplierAtr);
String[] locants... |
2642d00b-1446-4e68-abf0-3036564f5326 | 8 | public void clickBlock(int var1, int var2, int var3, int var4) {
if(!this.isHittingBlock || var1 != this.currentBlockX || var2 != this.currentBlockY || var3 != this.currentblockZ) {
this.netClientHandler.addToSendQueue(new Packet14BlockDig(0, var1, var2, var3, var4));
int var5 = this.mc.theWorld... |
96f89581-ea76-4571-9674-38869b7af93b | 8 | @Override
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
thisElement = qName;
String name= new String();
int delay=0,workTime=0,runCount=0;
if (atts != null)
{
int len = atts.getLength();
for (int i = 0; i < len; i++)
... |
1125b730-af0b-46db-8f49-ec5ac079dfc6 | 2 | public int[] twoSum(int[] numbers, int target) {
int length = numbers.length;
HashMap<Integer, Integer> index = new HashMap<Integer, Integer>();
int[] result = new int[2];
for (int i = 0; i < length; i++) {
if (index.containsKey(target - numbers[i])) {
result[... |
b9b69f93-f3cc-43b7-89e6-ff468cb99234 | 6 | public void forceOpenCells(int x, int y) {
final Cell cell = cells[x][y];
List<Cell> surroundingCells = getSurroundingCells(cell);
int surroundingFlagged = 0;
for (Cell c : surroundingCells) {
final Cell.Type type = c.getType();
if (type == Cell.Type.FLAGGED || ... |
9e8b066c-a0cd-45c3-ae60-c6445d9ac4d1 | 1 | private static void swapEngineColor() throws IOException {
if ("black".equals(color)) {
color = "white";
} else {
color = "black";
}
} |
930a24d5-fe35-4e16-917d-7e78c51f26ac | 4 | public static void f(int i) throws Exception1, Exception2, Exception3 {
if(i == 1) {
throw new Exception1("Exception1");
} else if(i == 2) {
throw new Exception2("Exception2");
} else if(i == 3) {
throw new Exception3("Exception3");
} else if(i == 4) {... |
5d4f54ce-aecb-4d12-8f26-6c659399f753 | 1 | public static synchronized CancelManager getInstance() {
if (me == null) {
me = new CancelManager();
}
return me;
} |
14e27db6-5a6f-4177-964d-40ada407c186 | 7 | public static void evolve(Sprite s){
if(!(s instanceof Prey)) return;
if(s instanceof RedPrey && red < 3) red++;
else if(s instanceof GreenPrey && green < 3) green++;
else if(s instanceof BluePrey && blue < 3) blue++;
Player.color = new Color(BASE_COLOR_AMOUNT + 30 * red,
... |
16383751-3bb9-4250-8782-45d514fbdead | 7 | public void updateStatus(int status) {
if (status == currentStatus) return;
switch (status) {
case (INIT):
led.set(LED.BLINKING_YELLOW);
log("initializing");
break;
case (RUNNING):
led.set(LED.STATIC_GREEN);
log("running");
break;
case (WORKING):
led.set(LED.FAST_BLINKING_YELLOW);
l... |
1f5eeb43-52bd-4acc-b2de-b5951c4aa695 | 6 | public List<List<Double>> getRankNormalizedDataPoints()
{
List<List<Double>> rankList = new ArrayList<List<Double>>();
for( int x=0; x < getSampleNames().size(); x++)
{
List<RankHolder> innerRanks = new ArrayList<RankHolder>();
for( int y=0; y < getOtuNames().size(); y++ )
{
RankHolder rh = n... |
6a0bbd19-f0aa-478f-9259-0cccadbb26d4 | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... |
c5f12df7-f87f-4540-8dd0-b1bc444caade | 4 | public void testStep() {
out.println("step");
final int MAXEXP = 5;
final int STEPS = 15;
instance = new TabuIndex<String, String>(MAXEXP);
String[] tgts = new String[MAXEXP];
String[] srcs = new String[MAXEXP];
for (int exp = 0; exp < MAXEXP; ++exp) {
... |
3bd2f0e0-9ae7-495f-8ea8-31284b6ce7d2 | 3 | public static void main(String[] args) {
// first we set up the power structure that we want to test
WeightedIdentitySet identities = new WeightedIdentitySet();
// a simple TRUSTEE structure ie. 5 equally powerful identities
WeightedIdentity t1 = new WeightedIdentity("T1",10.00);
WeightedIdentity t2... |
8d65ad84-f5ab-453d-9e22-03a48d1cf7f1 | 2 | @Override
public int connect(String nick, String password) {
try {
Player player = (Player) em.createNamedQuery("verifyUserData").setParameter("nickName", nick).setParameter("password", password).getSingleResult();
if (player.getEtat() == PlayerState.DISCONNECTED) {
... |
b7e3987c-bdaf-4861-a30e-38fce5eb4e35 | 3 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this);
if ((clipboardContent != null)
&& (clipboardContent.isDataFlavorSupported(DataFlavor.stri... |
eeabec1b-5148-4f21-9050-4c30fabfd5c0 | 2 | @Override
public O_03_CallInputWithMultipleSupplementaryServices deserialize(ByteBuf packetPDU) {
String rad = Serialization.getString(packetPDU);
String oadc = Serialization.getString(packetPDU);
String ac = Serialization.getString(packetPDU);
String npl = Serialization.getString(packetPDU);
String gas = Se... |
6ba32b1e-162c-490d-b6ea-be8e3d31d1dd | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = get(index);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE)... |
31a9ba70-6b47-44a5-b58a-d99f0677a65b | 4 | public void undo() {
if (prevSpeed == CeilingFan.HIGH) {
ceilingFan.high();
}
if (prevSpeed == CeilingFan.MEDIUM) {
ceilingFan.medium();
}
if (prevSpeed == CeilingFan.LOW) {
ceilingFan.low();
}
if (prevSpeed == CeilingFan.OFF) {... |
3927fc3e-6ccf-4971-aac2-b9a1be1950a1 | 8 | private void _feast()
{
pacmanWasEaten=false;
for(GHOST ghost : GHOST.values())
ghostsEaten.put(ghost,false);
for(Ghost ghost : ghosts.values())
{
int distance=getShortestPathDistance(pacman.currentNodeIndex, ghost.currentNodeIndex);
if(distance<=EAT_DISTANCE && distance!=-1)
{
if(g... |
e517f2db-20aa-4cf7-afb4-ae872d688037 | 5 | private void fight(Command command) {
if (!command.hasSecondWord()) {
System.out.println("Fight who?");
}
String nameInput = command.getSecondWord();
NPC target = null;
for (NPC npc : npcs) {
String npcName = npc.getName().split(" ")[0];
if (n... |
8847eab1-94aa-4efe-b8b9-9d6d0015163d | 6 | public Quantity div (Quantity target)
{
Quantity result = new Quantity();
if( target == null)
{ throw new IllegalArgumentException(); }
result.value = this.value / target.value;
if(this.unit.isEmpty())
{
result.unit.putAll(target.unit);
return result;
}
... |
5799f5a9-3a7d-4971-b21a-92fb46802eac | 3 | public Alpha() {
setLayout(null);
setSize(Shell.DEFAULT_WINDOWSIZEX, Shell.DEFAULT_WINDOWSIZEY);
setBackground(Color.BLACK);
setVisible(true);
setDoubleBuffered(true);
addMouseListener(this);
addMouseWheelListener(this);
addMouseMotionListener(this);
... |
2de41a19-ba47-4a3a-9d41-4c1eb766a3ab | 5 | public void move(){
super.move();
PlayerShip p = game.getPlayer();
if(this.lockedOn){
x = p.x - Math.cos(-offset)*radius;
y = p.y + Math.sin(offset)*radius;
if(clock%20 == 0 && game.random(0, 2, 1)==1){
double ang = game.atan2(y-p.y, p.x-x);
shoot(ang);
}
offset += 0.05;... |
9d84dc31-8785-42e2-96b7-744fc6ff5ab2 | 0 | public void setFileSize(int fileSize) {
this.fileSize = fileSize;
} |
d3a475d7-ae43-4eef-a40b-da3d13fe77fe | 0 | public void setMobile(String mobile) {
Mobile = mobile;
} |
9fa2f182-df56-4115-a134-68d0802fab01 | 1 | @Override
public void updateImage() {//we will update animation when delay counter reaches delay, then reset delay counter
delayCounter++;
if(delayCounter>delay)
{
delayCounter=0;
frameNumber++;//updates frame to next frame
frameNumber%=totalFrame;// if surpass 3rd frame, back to frameNumber 0
//sets ima... |
5fba7959-fa85-4a0c-b83a-4bed797a69aa | 5 | public DefaultComboBoxModel<String> buildList() {
DefaultComboBoxModel<String> comboBoxModel = new DefaultComboBoxModel<String>();
String line;
try {
BufferedReader reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/weapons"));
while((line = reader.readLine()) != null) {... |
2163d699-98cd-4528-9550-b11626d48b38 | 9 | public String getColumnName(int arg1){
String cn = "";
switch (arg1){
case 0: cn = "Nr KT";
break;
case 1: cn = "Nazwa KT";
break;
case 2: cn = "Numer";
break;
case 3: cn = "Tytu";
break;
case 4: cn = "Ank. wew.";
break;
case 5: cn = "Koniec ankiety";
break;
case 6: cn = ... |
a4ad7fca-5737-4454-b8f4-6195aa4a4d54 | 9 | private void productionGoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_productionGoButtonActionPerformed
String cropfield = (String) prodCropFieldComboBox.getSelectedItem();
String cropType = (String) cropTypeInFieldComboBox.getSelectedItem();
String obs = productionO... |
7a064383-b987-4418-b642-168777717254 | 3 | private boolean decode() throws IOException {
float[][] inb = in.decode();
if(inb == null) {
buf = new byte[0];
return(false);
}
buf = new byte[2 * chn * inb[0].length];
int p = 0;
for(int i = 0; i < inb[0].length; i++) {
for(int c = 0; c < chn; c++) {
int s = (int)(inb[c][i] * 32767);
buf[p++]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.