method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
341ae4a7-f48e-4adc-bd3e-c6415825aa37 | 7 | static int checkDup(String[]input, int n){
int i =0;
char[] cArray=new char[n];
int[] indexArray=new int[n];
int c=0;
while(i<input.length){
if(input[i]==null){
i++;
continue;
}
cArray[c] =input[i].charAt(0);
indexArray[c]=i;
c++;
i++;
if(c==n){
break;
}
}
... |
f6a52854-8e15-489d-bcde-a888d42af783 | 7 | private void drawNodes(Graphics gs) {
//bg.setColor(Color.white);
//bg.fillRect(0, 0, gs.get, 5000);
for (int i = 0; i < timeout.length; i++) {
timeout[i]++;
}
if (nodes == null) {
return;
}
int id = 0;
for (Point p : nodes) {
... |
979e6b42-bd33-43ba-8328-4c9d55034b80 | 3 | private void group(CommandSender sender, String[] args) {
if (!sender.hasPermission("graveyard.command.group")) {
noPermission(sender);
return;
} else if (!(sender instanceof Player)) {
noConsole(sender);
return;
}
Player player = (Player) ... |
d14a39e7-d0aa-4d2e-b7ef-d03fd7489f14 | 5 | public boolean checkNumber(String text){
String ValidNum = "0123456789";
if (text.length()==0){
return true;
}
if ((ValidNum.indexOf(text.charAt(0))) == -1){
return false;
}
if ((ValidNum.indexOf(text.charAt(text.length()-1))) ... |
f5cacd5f-0af5-4964-82a2-a2bd080e027c | 6 | private void createMenu() {
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
menuBar.add(fileMenu);
JMenuItem menuItem = new JMenuItem("New connection");
fileMenu.add(menuItem);
menuItem.addActionListener(new AbstractAction() {
@Overri... |
b855aa6e-a591-42f4-a678-a2579b86fea3 | 6 | protected void printParameter(String parentParameterFile,
String childParameterFile, ArrayList<_Doc> docList) {
System.out.println("printing parameter");
try {
System.out.println(parentParameterFile);
System.out.println(childParameterFile);
PrintWriter parentParaOut = new PrintWriter(new File(
pa... |
dafdb381-1989-480d-bc64-7fe7952fa115 | 7 | public void run() {
Graphics g = getGraphics();
g.setClip(new Rectangle(width, height));
// BufferedImage img = new BufferedImage(width, height,
// BufferedImage.TYPE_3BYTE_BGR);
system = new Simulation();
Body ball1 = new Body(new CollisionCircle(20, new Vector(100, 100)... |
524dae05-70d7-4c30-a84b-3efd9bb9a900 | 7 | @Override
public void run() {
//get the socket's output stream for writing
try {
writer = new PrintStream(socket.getOutputStream());
} catch(IOException e) {
System.err.println("Error getting writer: " + e);
}
//get the socket's input stream f... |
d6a4a923-c3ec-47aa-a9b0-6941cc3c5991 | 1 | public String addBlogDetails() {
FacesMessage doneMessage = null;
String outcome = null;
Blog blog = new Blog();
blog.setBlogContent(this.blogContent);
blog.setBlogContentLable(this.blogLabel);
blog.setCreatedDate(new Date());
if (blogDelegate.saveBlog(blog) !... |
f2c4d8aa-dca1-43bc-ba0e-30e14ec08f0c | 1 | public static Car createCar(String carType){
if (carType.equals("AutomobileI")){
return new TruckI("black", (int) (Math.random() * 5) );
}
else return null;
} |
109c5a87-c8a6-41d7-983c-354679cde87c | 2 | @Override
public void spawnEnemy(String enemyData) {
if(!free()) {
return;
}
int r = Application.get().getRNG().nextInt(7) ;
GameActor a = Application.get().getLogic().createActor(enemyData);
PhysicsComponent pc = (PhysicsComponent)a.getComponent("PhysicsComponent... |
5c709350-b12c-4473-bbd6-07040b1943ed | 4 | @Override
public IMatrix sub(IMatrix other) {
//ako nisu jednake dimenzije, vrati iznimku
if (this.getColsCount() != other.getColsCount()
|| this.getRowsCount() != other.getRowsCount()) {
throw new IncompatibleOperandException(
"Matrices have not same dimensions.");
}
for (int row = 0; row < this.... |
a4403ae6-bc0a-4593-9a14-ed84aa922690 | 7 | private void downSafety(final ExprInfo exprInfo) {
final Iterator blocks = cfg.nodes().iterator();
while (blocks.hasNext()) {
final Block block = (Block) blocks.next();
final Phi phi = exprInfo.exprPhiAtBlock(block);
if (phi == null) {
continue;
}
if (StackPRE.DEBUG) {
System.out.println(... |
b06694f6-5610-4ba6-b67a-57b22f568650 | 7 | public int[] addInstance(BallNode node, Instance inst) throws Exception {
double leftDist, rightDist;
if (node.m_Left!=null && node.m_Right!=null) { //if node is not a leaf
// go further down the tree to look for the leaf the instance should be in
leftDist = m_DistanceFunction... |
f0c1649f-3b28-4595-a5d7-124988d59b4e | 7 | public void codageRZ() {
for (int i = 0; i < informationRecue.nbElements(); i++) {
for (int j = 0; j < nbEchantillon; j++) {
if (informationRecue.iemeElement(i)) {
if (j < nbEchantillon / 2)
informationEmise.add(max);
else if (j >= nbEchantillon / 2)
informationEmise.add(0f);
} els... |
a7af2485-9eb9-49ea-a771-e320aa7d032a | 4 | public static Image add(Image img1, Image img2) {
if (img1 == null || img2 == null) {
return null;
}
Image img = img1.shallowClone();
double min = 0, max = 255;
for (int x = 0; x < img1.getWidth(); x++) {
for (int y = 0; y < img1.getHeight(); y++) {
double red = img1.getPixel(x, y, RED)
+ img2... |
03176780-a924-42c3-a7e9-a8af0540a5e1 | 8 | @FXML
private void ConnectButtomAction(ActionEvent event) {
this.host = Hostinput.getText();
this.port = Portinput.getText();
this.username = Usernameinput.getText();
this.password = Passwordinput.getText();
this.sid = SIDInput.getText();
int port1 = 0;
... |
da60f333-81bd-40f6-ba6d-a05cc40d8bce | 7 | private void setupMicrophone(String name) {
Mixer.Info[] mixerInfos = AudioSystem.getMixerInfo();
for (Mixer.Info info : mixerInfos) {
if (!info.getName().equals(name)) {
continue;
}
Mixer mixer = AudioSystem.getMixer(info);
int maxLines ... |
6f74039c-0ee3-493f-bee9-de315c26ec14 | 6 | @Override
public void actionPerformed(ActionEvent e) {
//Handle open button action
if (e.getSource() == openButton)
{
openButtonAction();
}
else if ((e.getSource() == pathText))
{
if (currentState != State.PROCESSING)
pathTextEn... |
279593ea-ba41-4e92-a6eb-8b54c9308138 | 2 | public boolean draw(int numToDraw) {
for (int i = 0; i < numToDraw; i++) {
if (deck.size() <= 0) {
this.hasLost = true;
return this.hasLost;
}
this.hand.add(this.deck.remove(0));
}
return this.hasLost;
} |
d8d0eec4-b2eb-474b-ae97-2851567a5714 | 3 | private <T> T find(Class<T> itemClass) {
for (Item item : items)
if (item != null && item.getClass().equals(itemClass))
return itemClass.cast(item);
return null;
} |
cd4a2c6f-d478-4479-993e-515e0dfea7ef | 0 | void f() throws VeryImportantException {
throw new VeryImportantException();
} |
4bd5cf91-73fa-45be-b608-2b2f9840a5aa | 6 | public void exchangeLeveledLists() {
String ID;
SPProgressBarPlug.setStatus("Exchange LeveledItems in LeveledList");
for (int i = 1; i < RBS_Main.amountBodyTypes; i++) {
ID = RBS_Randomize.createID(i);
for (LVLI leveledItem : SkyProcStarter.patch.getLeveledItems()) {
... |
f05ad942-3bdd-4a43-8376-1f57ce45f178 | 0 | public void setPanels(ArrayList<Rectangle> panels) {
this.panels = panels;
} |
e6455564-9755-42ef-80f5-66f14ee8e3e4 | 6 | public static Image createSquareImage(int height, int width) {
Image binaryImage = new RgbImage(width, height);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
// Analyzes if the point is in the black or white square
boolean fitsInSquareByWidth = (x > width / 4 && x < 3 * (width / 4)... |
c38164f0-d724-404b-b5b4-fdf283ed0262 | 8 | private static BigDecimal applyTheDayOfWeekMarketDiscountsAndGetProductPrice(
Product product, String day) {
// TODO Auto-generated method stub
BigDecimal price = product.getPrice();
switch (day) {
case "Tuesday":
return (!product.isFruit()) ? price : price
.multiply(new BigDecimal("0.80"));
case "... |
5c61b10e-0f41-49e3-92dc-9be4fe0fcc38 | 7 | public static List<CDCRelation> readValidMatrices(){
// load a file containing the matrix description of network
String fileName = "ValidM.csv";
//int[][] aWCTList = null;
InputStream MatrixStream = CDCComposition.class.getResourceAsStream(fileName);;
List<CDCRelation> aMatrixList = new ArrayList<CDCR... |
e44afe66-822a-4e65-84ad-384666e53262 | 1 | private String makeDeckMove(CardGame game) {
if (topRow) {
return game.moveCardOntoTopRowFromDeck(boardIndexTo);
} else {
return game.moveCardOntoCardFromDeck(boardIndexTo);
}
} |
ca1bd4e1-a397-4052-a3b7-0df7747fc015 | 1 | public List<DetallePunto> ObtenerDetallePunto(String consulta){
List<DetallePunto> lista=new ArrayList<DetallePunto>();
if (!consulta.equals("")) {
lista=cx.getObjects(consulta);
}else {
lista=null;
}
return lista;
} |
696a1a75-6f94-4001-a4e1-36b3992f82de | 6 | public Component getTableCellRendererComponent(JTable table,
Object value, boolean selected, boolean focused, int row,
int column) {
super.getTableCellRendererComponent(table, value, selected,
focused, row, column);
if (column == 0 || column == 6) { // Week-end
setBackground(new Color(255, 220, 2... |
bd2211dd-c054-4027-8514-8a00b0c13e19 | 5 | public void act() {
if(life <= 0){
CreatureSimulator cs = (CreatureSimulator)this.getEnvironment();
cs.removeCreature(this);
} else {
// iterate over all nearby plants
Iterable<ICreature> creatures = plantsAround(this);
int count = 0;
for (ICreature c : creatures) {
if (this.distanceFromAPoint... |
646fe282-6fe0-43f7-a416-fd27002c3c2f | 4 | public static List<ABObject> getAllSupporter (List<ABObject> objs,List<ABObject> ob)
{
List<ABObject> result = new LinkedList<ABObject>();
try
{
for (int i = 0; i < objs.size(); i++)
{
List<ABObject> temp = getSupporters (objs.get(i), ob, objs.get(i).depth + 1);
if (!result.containsAll(temp))
... |
ab9f1a36-941b-40ad-82cc-43964c85c3a1 | 0 | public static void startAlgorithm(Vertex start) {
algorithm.initialize(start);
} |
18a11dbc-f738-4359-a6b7-a9393572fa92 | 2 | @Override
protected void addPlayerOnGrid(Player p) {
if (p == null)
throw new IllegalArgumentException("The given arguments are invalid!");
super.addPlayerOnGrid(p);
if(p instanceof PlayerCTF){
PlayerFlag playerFlag = new PlayerFlag(grid, p);
((PlayerCTF)p).setPlayerFlag(playerFlag);
grid.addEleme... |
15d581d5-3626-47d5-945f-c754094745b8 | 1 | public int[] nextInts(int n) throws IOException {
int[] res = new int[n];
for (int i = 0; i < n; ++i) {
res[i] = nextInt();
}
return res;
} |
281a4947-4f15-4e3a-b949-c1411b8829fc | 2 | public static boolean containsOnlyNotNull(Object... values){
for(Object o : values){
if(o== null){
return false;
}
}
return true;
} |
bcf76f6e-1c6a-4362-9c39-182871598e2b | 2 | public boolean playVideo(Integer key, boolean fromUser) {
if(videos.containsKey(key)){
if(!stoppedVideoKeys.contains(key)){
videos.get(key).pause();;
stoppedVideoKeys.add(key);
return true;
} else {
videos.get(key).loop();
stoppedVideoKeys.remove(key);
return true;
}
}
/... |
4c44d2ca-ed42-4b21-a32b-ec67ba3f10a8 | 0 | public ArrayList<Piste> getPisteet() {
ArrayList<Piste> pisteet = new ArrayList();
pisteet.add(vasenYlakulma);
pisteet.add(oikeaAlakulma);
return pisteet;
} |
2589e929-133a-4fa4-8c20-02266565fa68 | 1 | public void setMaxSpeed(int maxSpeed) throws CarriageException {
if (maxSpeed >= 0) {
this.maxSpeed = maxSpeed;
} else {
throw new CarriageException("Maximum speed is under zero");
}
} |
d4cfa18d-b7f4-4728-93f0-cac1d8e69c47 | 4 | private void filling(){
//获取棋子
HashMap<ChessMan,Integer> map=getAllChessMan();
Random random = new Random();
//横坐标
for(int i=0;i<x;i++){
//纵坐标
for(int j=0;j<y;j++){
int r;
if(map.size()==1){
r=0;
}else{
r = random.nextInt(map.size()-1);
}
ChessMan cm = list.get(r);
int ... |
a7d13119-f705-42a7-828b-8b44885a4646 | 2 | EntrySet(int size) {
if(size < 0)
this.size = 0;
// Can't be any bigger than the array:
else if(size > DATA.length)
this.size = DATA.length;
else
this.size = size;
} |
38128cdc-62d7-4952-b469-1266e4a4d281 | 9 | public void start(Archive archive, Client client) {
String versionNames[] = {"model_version", "anim_version", "midi_version", "map_version"};
for (int i = 0; i < 4; i++) {
byte buf[] = archive.get(versionNames[i]);
int len = buf.length / 2;
Stream buffer = new Stream(... |
3a5d9b1a-7948-4af1-b836-ebe8c67b4492 | 4 | protected static DateTime entrerDateConsole(){
Scanner sc = new Scanner(System.in);
DateTime horaire = null;
boolean dateOK = false;//validité de la date au sens chronologique
boolean dateFormatOK = false;//validité de la date pour le parsing
while(!dateOK){
while(!dateFormatOK){
System.out.print("Entr... |
00c5267d-3e23-4d25-8bc4-8066c2abb60d | 1 | public Texture loadTexture(String filename) {
String[] splitArray = filename.split("\\.");
String ext = splitArray[splitArray.length - 1];
try {
int id = TextureLoader
.getTexture(
ext,
new FileInputStream(n... |
82c32245-6e22-43f4-a676-f3b0de9c2bed | 1 | public boolean isExempt(Player p) {
if (p.hasPermission("hunger.effects.exempt"))
return true;
else
return false;
} |
319b023f-9d6a-4394-afb0-da067426e853 | 9 | private FunctionCompletion createFunctionCompletion() {
FunctionCompletion fc = null;
if (funcCompletionType!=null) {
try {
Class<?> clazz = null;
if (completionCL!=null) {
clazz = Class.forName(funcCompletionType, true,
completionCL);
}
else {
clazz = Class.forName(funcComp... |
abe6d5e6-24a9-4d98-a192-6356ae0a54c3 | 8 | private static Farbe farbeZuweisen() {
if (!Farbe.ROT.isIstFrei() && Farbe.SCHWARZ.isIstFrei()) {
return Farbe.SCHWARZ;
} else if (!Farbe.BLAU.isIstFrei() && Farbe.GRUEN.isIstFrei()) {
return Farbe.GRUEN;
} else if (!Farbe.GRUEN.isIstFrei() && Farbe.BLAU.isIstFrei()) {
return Farbe.BLAU;
} else if (!Fa... |
3a80bbd7-ee44-4cd1-98f0-ba93a4d1a250 | 9 | public static void printHex(byte[] b)
{
for (int i = 0; i < b.length; ++i)
{
if (i % 16 == 0)
{
System.out.print(Integer.toHexString(i & 0xFFFF | 0x10000)
.substring(1, 5)
+ " - ");
}
System.out.print(Integer.toHexString(b[i] & 0xFF | 0x100)
.substring(1, 3)
+ " ");
if (i %... |
b4e241e1-72e3-4454-940f-012a113960bd | 9 | private void passToken() {
activity = true;
if (silence() < Constants.USAGE_TIMEOUT && eventCount > Constants.MIN_OCTETS) {
// SawTokenUser
// debug("passToken:SawTokenUser");
if (LOG.isLoggable(Level.FINE))
LOG.fine(thisStation + " passToke... |
2b4b2bfa-7e9f-4e2b-afe0-81c89c7114ac | 4 | @Override
protected void setReaction(Message message) {
try {
String langFrom = getLang(message.text, true);
String langTo = getLang(message.text, false);
if (isLangAllowed(langFrom) && isLangAllowed(langTo)) {
if (langFrom.equals(langTo)) {
... |
79a90d41-69e6-4248-af14-5f5748bd0403 | 0 | public Items getHead() {
return head;
} |
e90aa3ee-43cf-4cb1-a2ff-d853d19d6753 | 4 | public static void main(String[] args) {
Scanner inputScanner = null;
try {
inputScanner = new Scanner(new File(args[0]));
} catch (FileNotFoundException e) {
System.err.println("Invalid input file.");
}
while (inputScanner.hasNextLine()) {
String[] outputLine = inputScanner.nextLine().split(" ");
... |
b9b47031-4b0f-4f7d-a96c-fff0bb9a022e | 2 | public int getConstantValue() {
if ((accessFlags & AccessFlag.STATIC) == 0)
return 0;
ConstantAttribute attr
= (ConstantAttribute)getAttribute(ConstantAttribute.tag);
if (attr == null)
return 0;
else
return attr.getConstantValue();
} |
1a5b2e5e-c791-434e-ba28-19d492b3b3aa | 5 | @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
final UUID uuid = player.getUniqueId();
final String name = player.getName();
final Database database = plugin.getDatabaseManager().getDatabase();
if (database instanceof YAML... |
88f44ae0-d96a-45b9-9038-f2453c7bae0e | 8 | public void drawHead(Graphics graphics, Point position, Point size) {
int startAngle = 30;
if (getDirection() == Direction.RIGHT) {
startAngle = 30;
} else if (getDirection() == Direction.LEFT) {
startAngle = 210;
} else if (getDirection() == Direction.UP) {
... |
5338bc60-7b5d-4ff9-9537-0f8d8ec32d09 | 7 | public static ArrayList<Sub> getSubs()
{
ArrayList<String> tempsubs = new ArrayList<String>();
for(int i = 0; i < file.size(); i++) {
if( file.get(i).equals(""))
{
subs.add(new Sub(id, fromTime, toTime, new ArrayList<String>(tempsubs)));
tempsubs.clear();
id = 0;
fromTim... |
88baf151-0856-4c84-9bdb-362244e7c7ec | 9 | protected void Calcula_Tamanho() {
int quantidadeAtributos = atributosTabela.size();
for (int k = 0; k < quantidadeAtributos; k++) {
TipodeDados A = (TipodeDados) atributosTabela.get(k);
switch (A.tipoAtributo) {
case (TipodeDados.BOOLEAN): {
t... |
4032da43-1628-40cd-8352-9bec80f61a5e | 1 | public String getLabel() {
if (label == null)
label = "while_" + (serialno++) + "_";
return label;
} |
6935c9d1-b8c1-4de0-b6ec-2a398469118c | 9 | private int neighborCount(int x, int y) {
int count = 0;
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
int currentY = y + i;
int currentX = x + j;
if (currentX != x || currentY != y) {
if (currentX >= 0 && currentX < field[0].length && currentY >= 0 && ... |
fc5d1a76-f519-4e58-ba4c-a9f115fdd35f | 0 | @Override
public boolean isComplete() {
return complete;
} |
fe73b17c-99e5-4cc9-9696-bed4ff68ca95 | 9 | public void onTimerEvent() {
final List<Customer> customers = customerRepository.getNewCustomers();
final Campaign campaign = new HalfOfCampaign();
final Set<Long> ids = new HashSet<Long>();
if (customers == null) {
throw new IllegalArgumentException("No new customers found"... |
b8bde8c7-7afa-41b7-b938-91b91a3d833b | 0 | protected void setCurrent(int i)
{
myCurrent = i;
} |
1db0fcb6-8550-491d-9815-9bda6be448fc | 4 | @Override
void update() {
x += Math.cos(DIRECTION) * SPEED;
y += Math.sin(DIRECTION) * SPEED;
AffineTransform tran = new AffineTransform();
tran.translate(x, y);
tran.rotate(angle, SIZE / 2, SIZE / 2);
painter.drawImage(IMAGE, tran, null);
if... |
719750d7-ca86-48d5-98cf-278da5d4165f | 8 | public boolean permissible(GuideUserAction currentAction, ParserConfiguration config) throws MaltChainedException {
currentAction.getAction(actionContainers);
int trans = transActionContainer.getActionCode();
if ((trans == LEFTARC || trans == RIGHTARC) && !isActionContainersLabeled()) {
return false;
}
Dep... |
ba74a2cf-1819-4f39-bb0f-561d6e8d6a80 | 6 | @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onItemHeldChange(PlayerItemHeldEvent event)
{
Player player = event.getPlayer();
if (player.isSneaking())
{
if ((player.isOp() || player.hasPermission("voxelbar.use")) && plugin.getConfigurat... |
aa7d700e-7c90-4be2-9c3f-3a59ecdc75ec | 8 | private void lengthConversionsMenu() throws InterruptedException {
System.out.println();
println("Choose a conversion or enter any integer to go back:");
println("0: Centimeters to meters");
println("1: Meters to centimeters");
println("2: Microns to centimeters");
println("3: Centimeters to mi... |
09578332-ef42-4808-bf3d-507414c2cb5d | 0 | public String[] getLastMessages()
{
return previousMessages;
} |
0dc76add-c6f0-4b9d-9924-1b6bb84047ae | 1 | public boolean getTruthValue() {
if (!hasTruthValue()) {
throw new RuntimeException("Attempt to get the truth value for a result set with non-truth value data.");
}
return truthValue;
} |
985f4c8e-c4c7-46f1-b407-27b0e1c8b604 | 6 | private boolean processSanninCommand(MapleClient c, MessageCallback mc, String[] splitted) {
DefinitionSanninCommandPair definitionCommandPair = sannincommands.get(splitted[0]);
if (definitionCommandPair != null) {
try {
definitionCommandPair.getCommand().execute(c, mc, split... |
da6633c9-8ef2-4131-9fd4-ef2d812fb955 | 1 | public void setNametextZoomedFontsize(int fontsize) {
if (fontsize <= 0) {
this.nametextZoomedFontSize = UIFontInits.NAMEZOOMED.getSize();
} else {
this.nametextZoomedFontSize = fontsize;
}
somethingChanged();
} |
e98ad577-33e0-4ec0-9c62-4ca22c7ca620 | 9 | public String toString() {
if (version == null) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < orderedVersionNumbers.size(); i++) {
Integer curVersionNumber = (Integer) orderedVersionNumbers.get(i);
result.append(curVersionNumber.intValu... |
fc49d484-441d-4f31-b246-30f75dfd046e | 1 | public void endLifetime() {
if (this.lifetime > 0)
this.lifetime = 0;
} |
d8603c58-6b0b-4eec-aa3e-a2a70df6d6ea | 4 | @Override
public void removeUpdate(double delta) {
timer += delta;
if (timer >= solidityDuration) {
getEntity().remove(CollisionComponent.ID);
}
if (timer >= duration) {
getEntity().forceRemove();
}
double amt = (duration - timer) / duration;
SpriteComponent sc = (SpriteComponent) getEntity().getC... |
81809026-357c-48a4-8a40-ad1c46674d27 | 1 | @Override
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
final String command = buildFormatCommand(obj);
try {
toAppendTo.append(getCycAccess().converseString(command));
} catch (Exception ex) {
throw new RuntimeException("Exception formatting " + obj, ex)... |
9cf13410-8e4f-416e-8f3a-74c503a7029c | 7 | public static void htmlExecuteQuery(KeyValueList querydata, org.powerloom.PrintableStringWriter stream) {
{ String modulename = ((StringWrapper)(querydata.lookup(StringWrapper.wrapString("MODULE")))).wrapperValue;
Module module = Logic.getModule(StringWrapper.wrapString(modulename));
StringWrapper nvalu... |
99520afa-c36a-46d9-b122-c329bf752878 | 5 | public Fraction evaluate(String expression) {
IEvaluable ev;
try {
TokenList tl = tokenizer.tokenize(expression);
if (debug) System.out.println("\nBuilding syntax tree...");
ev = tl.parse();
} catch (ParseError e) {
throw e;
} catch (NumberFormatException e) {
throw new ParseError("Invalid n... |
de7551b1-736b-46cd-a877-c2ce2d1138dc | 4 | private void drawLogoLayer() {
ctx.clearRect(0, 0, size, size);
if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
ctx.setFill(getSkinnable().isNightMode() ? Color.rgb(240, 240, 240) : Color.rgb(10, 10, 10));
ctx.fillRect(size * 0.5 - 1, size * 0.18, 2, size * 0.27);
... |
f55eb0ca-75e2-459a-a5da-0a9585c8b644 | 0 | public int getGladiolos() {
return gladiolos;
} |
037303ac-2b6d-4842-9804-a3aa4a5ac573 | 6 | public HashMap hashResult(String query) throws SQLException
{
Connection connection = null;
Statement statement = null;
ResultSet result = null;
String key = "";
String val = "";
HashMap hashedList = new HashMap();
try
{
Class.forName(driver);
connection = DriverManager.getConnection(url, use... |
2e39f716-e43e-47cd-94b6-97229a2e43be | 2 | public static ArrayList<Clientes> sqlSelectTodos()
{
ArrayList<Clientes> cat = new ArrayList();
if(!BD.getInstance().sqlSelect("SELECT * FROM clientes ORDER BY idclientes DESC")){
return cat;
}
while(BD.getInstance().sqlFetch()){
cat.add(new Clientes(B... |
d696063c-e53a-45bf-8404-18d7d050f483 | 3 | public void refuel(int amount) {
if((amount > 0) && ((amount + fuelLevel) <= fuelCapacity) && !infinite) {
fuelLevel += amount;
}
} |
4b16bf6f-05de-4bd1-95ec-0c056dbbdd42 | 4 | @Override
public void ParseIn(Connection Main, Server Environment)
{
if(Main.Data.Trade != null)
{
return;
}
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null)
{
return;
}
int User = Roo... |
ee53777d-0268-4ffa-a517-882b8f05668b | 3 | @Override
public String remove(String hashKey) {
if (manager.remove(hashKey) == null) {
return "Error: No match to object!";
} else {
if (hashKey.startsWith("A")) {
aisleCount--;
} else if (hashKey.startsWith("R")) {
rackCount--;
... |
9daf09ff-784d-43a2-805b-ac0812974e69 | 4 | public synchronized void drop_tables() {
Connection c = null;
try {
c = connectionPool.getConnection();
clearSoftState();
Statement stmt = c.createStatement();
for( String t : TABLES )
{
try {
stmt.executeUpdate("DROP TABLE IF EXISTS " + t);
} catch( Exception e ) {
logger.... |
b38d19c2-2434-446e-b04b-dff25232aa59 | 2 | public Object getPrice(MaterialData data){
if(data==null)
return null;
if(prices.containsKey(data))
return prices.get(data);
return defaultPrice;
} |
1e8f5d48-45ed-48e7-b4f8-051c21922d48 | 0 | public void setTotalPrice(float totalPrice) {
this.totalPrice = totalPrice;
} |
e358092e-99df-459d-92d4-0b22a6ea8049 | 9 | public Request getNextBlock(){
if(complete){return null;}
Iterator<SubPiece> itor = data.iterator();
SubPiece last=null;
int max = idealSize;
if(max > finalPiece.length){
max = finalPiece.length;
}
//TODO: reduces i think?
while(itor.hasNext()){
if(last==null){
last=itor.next();
}else{
... |
6382b371-4aa6-46ed-98b9-9efd5d73a01e | 2 | public int getInt(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).intValue()
: Integer.parseInt((String) object);
} catch (Exception e) {
throw new JSONException("JSONArray[" ... |
57235daf-4bc8-4b23-856c-79e7faca2c29 | 9 | public static void addInventoryInfo(MaplePacketLittleEndianWriter mplew, MapleCharacter chr) {
mplew.writeInt(chr.getMeso()); // mesos
mplew.write(chr.getInventory(MapleInventoryType.EQUIP).getSlotLimit()); // equip slots
mplew.write(chr.getInventory(MapleInventoryType.USE).getSlotLimit()); // u... |
6815d489-47a2-420e-9a36-10c6ee02acbe | 4 | public void setClobField(Clob clobField) {
this.clobField = clobField;
BufferedReader reader = null;
try {
reader = new BufferedReader(clobField.getCharacterStream());
setClobData(reader.readLine());
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} f... |
82ecca0a-a654-461b-ab90-c66393d8bdc4 | 8 | public void addNpe(String className, NpeData data) {
String name = className;
if(data == null) {
data = new NpeData(this);
}
// Register the MBean
ObjectName oName;
try {
oName = new ObjectName("org.dkhenry.minejmx:type=NpeData,name=" + name);
if( mbs.isRegistered(oName) ) {
mbs.unregisterMBean... |
8d73509b-9821-4734-b3fd-77f0a5ac8ee1 | 0 | @Override
public void testIgnored(Description description) {
testStarted(description);
final Xpp3Dom testCase = getCurrentTestCase();
testCase.addChild(createResult(TestState.blocked));
final String message = description.getAnnotation(Ignore.class).value();
testCase.addChild(... |
05835d43-bb2e-4f93-9e92-eabb03b42094 | 0 | @Override
public void addUnsearchQueue(WebPage unsearchQueue) {
// TODO Auto-generated method stub
} |
7d42de29-2c8f-431e-9b06-623beb3bc032 | 3 | public JSONWriter array() throws JSONException {
if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
this.push(null);
this.append("[");
this.comma = false;
return this;
}
throw new JSONException("Misplaced array.");
} |
32508d28-fcc1-46d2-82e4-b78611571464 | 4 | public NewMemberGui()
{
System.out.println("DEBUG: starting NewMemberGui...");
try
{
mM = MemberManager.getInstance();
System.out.println("DEBUG: mM-instance: " + MemberManager.getInstance());
}
catch (FileNotFoundException ex)
{
L... |
1a1870e0-40da-49c3-8d64-ea7dea4941be | 0 | public IterableGroup(TKey key, Iterable<TElement> source)
{
this._key = key;
this._source = source;
} |
616b048c-159b-4409-bea7-9a7020479cf6 | 3 | private String extractParameterValue(String str, String parameterName) {
int paraIdx = str.indexOf("\""+parameterName+"\"");
if (paraIdx < 0)
return "";
int startIdx = str.indexOf(":", paraIdx)+1;
if (startIdx <= -1)
return "";
String value;
int en... |
09fe27bf-7125-4252-aef7-ea88a8ac642c | 2 | public double[] rawPersonMaxima(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawPersonMaxima;
} |
2592f970-7297-4f3a-a1e4-eb1e89a74ec7 | 8 | private static void fillPersonFields(Person p, String[] tokens) {
int i = 1; //Start in token 1 as token 0 is the field label (MANAGER, PLAYER, etc.)
String flag = null, value = null;
do {
//Get current flag
flag = tokens[i];
value = tokens[i+1];
switch(flag) {
case "-name": {
p.se... |
895baf52-d8d5-4a55-a813-657342c1b1cb | 0 | public Worker () {
//initial settings
isInputActive = true;
this.keyboard = new BufferedReader(new InputStreamReader(System.in));
System.out.println(MSG_WELCOME);
//start
this.lifeCycle();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.